idlechampwiki.py 173 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480
  1. import json
  2. from pprint import pprint
  3. import re
  4. from collections import OrderedDict
  5. import math
  6. from decimal import Decimal
  7. import html
  8. from idlechampaccount import ICAccount
  9. import subprocess
  10. import filecmp
  11. import os
  12. import requests
  13. import tempfile
  14. COMPARE = True
  15. POST = False
  16. REDOWNLOAD = False
  17. SHOW_CHANGES = False
  18. _summary = None
  19. PRINT_UPGRADES = False
  20. PRINT_TABLE = False
  21. PRINT_MISSING_ROWS = False
  22. PRINT_MULTIPLE_ABILTIES = False
  23. PRINT_REQUIRED_ABILTIES = False
  24. if POST:
  25. instance = ICAccount()
  26. instance.login()
  27. # filename = '/home/txtsd/.local/share/Steam/steamapps/common/IdleChampions/IdleDragons_Data/StreamingAssets/downloaded_files/cached_definitions.json'
  28. filename = '/tmp/cached_definitions.json'
  29. if REDOWNLOAD or not os.path.isfile(filename):
  30. result = requests.get('http://master.idlechampions.com/~idledragons/post.php?call=getdefinitions')
  31. with open(filename, 'w') as f:
  32. if result.status_code == 200:
  33. # text = result.text
  34. # text = re.sub('\\u00fb', 'û', text)
  35. # text = re.sub('\\u00a9', '©', text)
  36. # f.write(text)
  37. f.write(result.text)
  38. # f.write(result.text.encode('utf-8').decode('unicode-escape'))
  39. with open(filename) as f:
  40. file = f.read()
  41. js = json.loads(html.unescape(file))
  42. js_graphic = js['graphic_defines']
  43. js_attack = js['attack_defines']
  44. js_hero = js['hero_defines']
  45. js_hero_skin = js['hero_skin_defines']
  46. js_upgrade = js['upgrade_defines']
  47. js_premium_item = js['premium_item_defines']
  48. js_sound = js['sound_defines']
  49. js_buff = js['buff_defines']
  50. js_loot = js['loot_defines']
  51. js_achievement = js['achievement_defines']
  52. js_ability = js['ability_defines']
  53. js_effect = js['effect_defines']
  54. js_changelog = js['changelog_defines']
  55. js_text = js['text_defines']
  56. js_chest_type = js['chest_type_defines']
  57. js_effect_key = js['effect_key_defines']
  58. js_tutorial_state = js['tutorial_state_defines']
  59. js_game_rule = js['game_rule_defines']
  60. js_news = js['news_defines']
  61. js_language = js['language_defines']
  62. js_familiar = js['familiar_defines']
  63. temp_count = 0
  64. for effect in js_upgrade:
  65. if '{' in effect['effect']:
  66. str_effect = effect['effect']
  67. _effect = effect['effect'].replace("'", "\'")
  68. temp = json.loads(_effect)
  69. effect['effect'] = temp
  70. # pprint(js_upgrade)
  71. # exit()
  72. breakout = 0
  73. for hero in js_hero:
  74. if not re.search('^E\d', hero['name']):
  75. champ_str = '''
  76. {{{{Champion
  77. | name = {{{{SUBJECTPAGENAME}}}}{skin}
  78. | class = {class_}
  79. | race = {race}
  80. | age = {age}
  81. | alignment = {alignment}
  82. | group = {group}
  83. | str={str_} | dex={dex}
  84. | con={con} | int={int_}
  85. | wis={wis} | cha={cha}
  86. | base_cooldown = {b_cd}
  87. | ulti_cooldown = {u_cd}
  88. | swap1 = {swap1}
  89. | swap2 = {swap2}
  90. | swap3 = {swap3}
  91. | swap4 = {swap4}
  92. }}}}
  93. \'\'\'{fullname}\'\'\' is one of the [[champions]] of [[Idle Champions of the Forgotten Realms]].{extra_info}
  94. ==Backstory==
  95. {{{{Quote|{backstory}}}}}
  96. ==Abilities and Levels==
  97. {abilities}
  98. {wikitable}
  99. == Equipment ==
  100. {equipment}
  101. ==Trivia==
  102. {trivia}
  103. ==Media==
  104. {media}
  105. {{{{Navbox-Champions}}}}
  106. {{{{Navbox-IdleChampions}}}}
  107. [[Category:Champions]]'''
  108. # Basic information
  109. id_ = hero['id']
  110. # if id_ in [2, 25]:
  111. # continue
  112. name = hero['name']
  113. skinnames = []
  114. for skin in js_hero_skin:
  115. if hero['id'] == skin['hero_id']:
  116. skinnames.append(skin['name'])
  117. skin = ''
  118. if not len(skinnames) == 0:
  119. for enum, skinname in enumerate(skinnames):
  120. skin += ('\n' + '| skin' + str(enum + 1) + ' = ' + skinname)
  121. _class = hero['character_sheet_details']['class']
  122. _race = hero['character_sheet_details']['race']
  123. _age = hero['character_sheet_details']['age']
  124. _alignment = hero['character_sheet_details']['alignment']
  125. _str = hero['character_sheet_details']['ability_scores']['str']
  126. _dex = hero['character_sheet_details']['ability_scores']['dex']
  127. _con = hero['character_sheet_details']['ability_scores']['con']
  128. _int = hero['character_sheet_details']['ability_scores']['int']
  129. _wis = hero['character_sheet_details']['ability_scores']['wis']
  130. _cha = hero['character_sheet_details']['ability_scores']['cha']
  131. fullname = hero['character_sheet_details']['full_name']
  132. extra_info = ''
  133. system_desc = hero['character_sheet_details']['system_description'] if 'system_description' in hero['character_sheet_details'] else ''
  134. backstory = hero['character_sheet_details']['backstory']
  135. class_ = '<onlyinclude>{{{{#ifeq:{{{{{{include|class}}}}}}|class|{class__}}}}}</onlyinclude>'.format(
  136. class__=_class)
  137. race = '<onlyinclude>{{{{#ifeq:{{{{{{include|race}}}}}}|race|{race}}}}}</onlyinclude>'.format(
  138. race=_race)
  139. age = '<onlyinclude>{{{{#ifeq:{{{{{{include|age}}}}}}|age|{age}}}}}</onlyinclude>'.format(
  140. age=_age)
  141. alignment = '<onlyinclude>{{{{#ifeq:{{{{{{include|alignment}}}}}}|alignment|{alignment}}}}}</onlyinclude>'.format(
  142. alignment=_alignment)
  143. str_ = '<onlyinclude>{{{{#ifeq:{{{{{{include|str}}}}}}|str|{str}}}}}</onlyinclude>'.format(
  144. str=_str)
  145. dex = '<onlyinclude>{{{{#ifeq:{{{{{{include|dex}}}}}}|dex|{dex}}}}}</onlyinclude>'.format(
  146. dex=_dex)
  147. con = '<onlyinclude>{{{{#ifeq:{{{{{{include|con}}}}}}|con|{con}}}}}</onlyinclude>'.format(
  148. con=_con)
  149. int_ = '<onlyinclude>{{{{#ifeq:{{{{{{include|int}}}}}}|int|{int_}}}}}</onlyinclude>'.format(
  150. int_=_int)
  151. wis = '<onlyinclude>{{{{#ifeq:{{{{{{include|wis}}}}}}|wis|{wis}}}}}</onlyinclude>'.format(
  152. wis=_wis)
  153. cha = '<onlyinclude>{{{{#ifeq:{{{{{{include|cha}}}}}}|cha|{cha}}}}}</onlyinclude>'.format(
  154. cha=_cha)
  155. if name == 'Drizzt':
  156. extra_info = ' He is obtained as reward of the [[Overdue Rendezvous]] [[Variants|Variant]] of the [[Underdeep Cartography]] [[Adventures|Adventure]].'
  157. elif name == 'Stoki':
  158. extra_info = ' She is obtained from the [[Highharvestide]] Event.'
  159. elif name == 'Krond':
  160. extra_info = ' He is obtained from the [[Liars\' Night]] Event.'
  161. elif name == 'Gromma':
  162. extra_info = ' She is obtained from the [[Feast of the Moon]] Event.'
  163. elif name == 'Dhadius':
  164. extra_info = ' He is obtained from the [[Simril]] Event.'
  165. elif name == 'Barrowin':
  166. extra_info = ' She is obtained from the [[Wintershield]] Event.'
  167. elif name == 'Regis':
  168. extra_info = ' He is obtained from the [[Midwinter]] Event.'
  169. elif name == 'Birdsong':
  170. extra_info = ' She is obtained from the [[Grand Revel]] Event.'
  171. elif name == 'Zorbu':
  172. extra_info = ' He is obtained from the [[Fleetswake]] Event.'
  173. elif name == 'Strix':
  174. extra_info = ' She is obtained from the [[Festival of Fools]] Event.'
  175. elif name == 'Nrakk':
  176. extra_info = ' He is obtained from the [[Greengrass]] Event.'
  177. elif name == 'Catti-brie':
  178. extra_info = ' She is obtained from [[The Running]] Event.'
  179. elif name == 'Evelyn':
  180. extra_info = ' She is obtained from [[The Great Modron March]] Event.'
  181. elif name == 'Binwin':
  182. extra_info = ' He is obtained from the [[Dragondown]] Event.'
  183. elif name == 'Deekin':
  184. extra_info = ' He is obtained from the [[Founder\'s Day]] Event.'
  185. elif name == 'Diath':
  186. extra_info = ' He is obtained from the [[Midsummer]] Event.'
  187. elif name == 'Azaka':
  188. extra_info = ' She is obtained as reward of the [[Azaka\'s Procession]] [[Variants|Variant]] of the [[Tomb of the Nine Gods]] [[Adventures|Adventure]].'
  189. elif name == 'Ishi':
  190. extra_info = ' She is obtained from the [[Ahghairon\'s Day]] Event.'
  191. elif name == 'Wulfgar':
  192. extra_info = ' He is obtained from the [[Brightswords]] Event.'
  193. elif name == 'Farideh':
  194. extra_info = ' She is obtained from the [[Highharvestide]] Event.'
  195. elif name == 'Donaar':
  196. extra_info = ' He is obtained from the [[Liars\' Night]] Event.'
  197. elif name == 'Vlahnya':
  198. extra_info = ' She is obtained from the [[Feast of the Moon]] Event.'
  199. elif name == 'Warden':
  200. extra_info = ' He is obtained from the [[Simril]] Event.'
  201. elif name == 'Nerys':
  202. extra_info = ' She is obtained from the [[Wintershield]] Event.'
  203. elif name == 'K\'thriss':
  204. extra_info = ' He is obtained from the [[Midwinter]] Event.'
  205. elif name == 'Paultin':
  206. extra_info = ' He is obtained from the [[Grand Revel]] Event.'
  207. elif name == 'Black Viper':
  208. extra_info = ' She is obtained from the [[Fleetswake]] Event.'
  209. elif name == 'Rosie':
  210. extra_info = ' She is obtained from the [[Festival of Fools]] Event.'
  211. elif name == 'Aila':
  212. extra_info = ' She is obtained from the [[Greengrass]] Event.'
  213. elif name == 'Spurt':
  214. extra_info = ' He is obtained from [[The Running]] Event.'
  215. elif name == 'Qillek':
  216. extra_info = ' He is obtained from [[The Great Modron March]] Event.'
  217. elif name == 'Korth':
  218. extra_info = ' He is obtained from the [[Dragondown]] Event.'
  219. elif name == 'Walnut':
  220. extra_info = ' She is obtained from the [[Founder\'s Day]] Event.'
  221. # elif name == 'Walnut':
  222. # extra_info = ''
  223. if not system_desc == '':
  224. extra_info += '\n\n{system_desc}'.format(system_desc=system_desc)
  225. # Cost things
  226. cost_curve = hero['cost_curves']['1']
  227. health_curve = hero['health_curves']['1']
  228. base_cost = int(hero['base_cost'])
  229. base_damage = int(hero['base_damage'])
  230. base_health = int(hero['base_health'])
  231. # Group
  232. _tags = hero['tags']
  233. if 'companion' in _tags:
  234. group = 'Companions of the Hall'
  235. elif 'forcegrey' in _tags:
  236. group = 'Force Grey'
  237. elif 'wafflecrew' in _tags:
  238. group = 'Waffle Crew'
  239. elif 'cteam' in _tags:
  240. group = 'Acquisitions Incorporated: The “C” Team'
  241. elif 'baldursgate' in _tags:
  242. group = 'Heroes of Baldur\'s Gate'
  243. elif 'cneoriginal' in _tags:
  244. group = ''
  245. elif 'aerois' in _tags:
  246. group = 'Heroes of Aerois'
  247. else:
  248. group = ''
  249. # Swaps
  250. _swap = []
  251. for _hero in js_hero:
  252. if not re.search('^E\d', _hero['name']):
  253. if _hero['seat_id'] == hero['seat_id']:
  254. if not _hero['id'] == hero['id']:
  255. _swap.append(_hero['name'])
  256. swap1 = _swap[0] if len(_swap) >= 1 else ''
  257. swap2 = _swap[1] if len(_swap) >= 2 else ''
  258. swap3 = _swap[2] if len(_swap) >= 3 else ''
  259. swap4 = _swap[3] if len(_swap) >= 4 else ''
  260. # Abilities
  261. if name == 'Minsc':
  262. abilities = '''
  263. \'\'\'{a_base} - Base Attack\'\'\'
  264. {a_base_desc}
  265. {gained_abilities}
  266. \'\'\'{a_ult} - Ultimate Attack\'\'\'
  267. {a_ult_desc}
  268. ===Specialization Choices===
  269. \'\'\'{{{{Spec|{spec_1}}}}}\'\'\'
  270. {spec_desc_1}
  271. \'\'\'{{{{Spec|{spec_2}}}}}\'\'\'
  272. {spec_desc_2}
  273. \'\'\'{{{{Spec|{spec_3}}}}}\'\'\'
  274. {spec_desc_3}
  275. \'\'\'{{{{Spec|{spec_4}}}}}\'\'\'
  276. {spec_desc_4}
  277. \'\'\'{{{{Spec|{spec_5}}}}}\'\'\'
  278. {spec_desc_5}
  279. '''
  280. elif name == 'Asharra':
  281. abilities = '''
  282. \'\'\'{a_base} - Base Attack\'\'\'
  283. {a_base_desc}
  284. {gained_abilities}
  285. \'\'\'{a_ult} - Ultimate Attack\'\'\'
  286. {a_ult_desc}
  287. ===Specialization Choices===
  288. \'\'\'<u>Specialization Choice 1</u>\'\'\'
  289. \'\'\'{{{{Spec|{spec_1}}}}}\'\'\'
  290. {spec_desc_1}
  291. \'\'\'{{{{Spec|{spec_2}}}}}\'\'\'
  292. {spec_desc_2}
  293. \'\'\'{{{{Spec|{spec_3}}}}}\'\'\'
  294. {spec_desc_3}
  295. \'\'\'<u>Specialization Choice 2</u>\'\'\'
  296. \'\'\'{{{{Spec|{spec_4}}}}}\'\'\'
  297. {spec_desc_4}
  298. \'\'\'{{{{Spec|{spec_5}}}}}\'\'\'
  299. {spec_desc_5}
  300. \'\'\'{{{{Spec|{spec_6}}}}}\'\'\'
  301. {spec_desc_6}
  302. '''
  303. elif name == 'Tyril':
  304. abilities = '''
  305. {gained_abilities}
  306. ===Specialization Choices===
  307. \'\'\'{{{{Spec|{spec_1}}}}}\'\'\'
  308. {spec_desc_1}
  309. :\'\'\'{a_base_1} - Base Attack\'\'\'
  310. :{a_base_1_desc}
  311. :\'\'\'{a_ult_1} - Ultimate Attack\'\'\'
  312. :{a_ult_1_desc}
  313. \'\'\'{{{{Spec|{spec_2}}}}}\'\'\'
  314. {spec_desc_2}
  315. :\'\'\'{a_base_2} - Base Attack\'\'\'
  316. :{a_base_2_desc}
  317. :\'\'\'{a_ult_2} - Ultimate Attack\'\'\'
  318. :{a_ult_2_desc}
  319. '''
  320. elif name in [
  321. 'Krond',
  322. 'Gromma',
  323. 'Birdsong',
  324. ]:
  325. abilities = '''
  326. \'\'\'{a_base} - Base Attack\'\'\'
  327. {a_base_desc}
  328. {gained_abilities}
  329. \'\'\'{a_ult} - Ultimate Attack\'\'\'
  330. {a_ult_desc}
  331. ===Specialization Choice===
  332. \'\'\'{{{{Spec|{spec_1}}}}}\'\'\'
  333. {spec_desc_1}
  334. \'\'\'{{{{Spec|{spec_2}}}}}\'\'\'
  335. {spec_desc_2}
  336. \'\'\'{{{{Spec|{spec_3}}}}}\'\'\'
  337. {spec_desc_3}
  338. '''
  339. elif name in [
  340. 'Regis',
  341. 'Ishi',
  342. ]:
  343. abilities = '''
  344. \'\'\'{a_base} - Base Attack\'\'\'
  345. {a_base_desc}
  346. {gained_abilities}
  347. \'\'\'{a_ult} - Ultimate Attack\'\'\'
  348. {a_ult_desc}
  349. ===Specialization Choices===
  350. \'\'\'<u>Specialization Choice 1</u>\'\'\'
  351. \'\'\'{{{{Spec|{spec_1}}}}}\'\'\'
  352. {spec_desc_1}
  353. \'\'\'{{{{Spec|{spec_2}}}}}\'\'\'
  354. {spec_desc_2}
  355. \'\'\'<u>Specialization Choice 2</u>\'\'\'
  356. \'\'\'{{{{Spec|{spec_3}}}}}\'\'\'
  357. {spec_desc_3}
  358. \'\'\'{{{{Spec|{spec_4}}}}}\'\'\'
  359. {spec_desc_4}
  360. \'\'\'{{{{Spec|{spec_5}}}}}\'\'\'
  361. {spec_desc_5}
  362. '''
  363. elif name == 'Zorbu':
  364. abilities = '''
  365. \'\'\'{a_base} - Base Attack\'\'\'
  366. {a_base_desc}
  367. {gained_abilities}
  368. \'\'\'{a_ult} - Ultimate Attack\'\'\'
  369. {a_ult_desc}
  370. ===Specialization Choices===
  371. \'\'\'<u>Specialization Choice 1</u>\'\'\'
  372. \'\'\'{{{{Spec|{spec_1}}}}}\'\'\'
  373. {spec_desc_1}
  374. \'\'\'{{{{Spec|{spec_2}}}}}\'\'\'
  375. {spec_desc_2}
  376. \'\'\'{{{{Spec|{spec_3}}}}}\'\'\'
  377. {spec_desc_3}
  378. \'\'\'{{{{Spec|{spec_4}}}}}\'\'\'
  379. {spec_desc_4}
  380. \'\'\'{{{{Spec|{spec_5}}}}}\'\'\'
  381. {spec_desc_5}
  382. \'\'\'<u>Specialization Choice 2</u>\'\'\'
  383. \'\'\'{{{{Spec|{spec_6}}}}}\'\'\'
  384. {spec_desc_6}
  385. \'\'\'{{{{Spec|{spec_7}}}}}\'\'\'
  386. {spec_desc_7}
  387. '''
  388. elif name == 'Wulfgar':
  389. abilities = '''
  390. \'\'\'{a_base} - Base Attack\'\'\'
  391. {a_base_desc}
  392. {gained_abilities}
  393. \'\'\'{a_ult} - Ultimate Attack\'\'\'
  394. {a_ult_desc}
  395. ===Specialization Choices===
  396. \'\'\'{{{{Spec|{spec_1}}}}}\'\'\'
  397. {spec_desc_1}
  398. \'\'\'{{{{Spec|{spec_2}}}}}\'\'\'
  399. {spec_desc_2}
  400. \'\'\'{{{{Spec|{spec_3}}}}}\'\'\'
  401. {spec_desc_3}
  402. '''
  403. elif name == 'Walnut':
  404. abilities = '''
  405. \'\'\'{a_base} - Base Attack\'\'\'
  406. {a_base_desc}
  407. {gained_abilities}
  408. \'\'\'{a_ult} - Ultimate Attack\'\'\'
  409. {a_ult_desc}
  410. ===Specialization Choices===
  411. \'\'\'<u>Specialization Choice 1</u>\'\'\'
  412. \'\'\'{{{{Spec|{spec_1}}}}}\'\'\'
  413. {spec_desc_1}
  414. \'\'\'{{{{Spec|{spec_2}}}}}\'\'\'
  415. {spec_desc_2}
  416. \'\'\'{{{{Spec|{spec_3}}}}}\'\'\'
  417. {spec_desc_3}
  418. \'\'\'<u>Specialization Choice 2</u>\'\'\'
  419. \'\'\'{{{{Spec|{spec_4}}}}}\'\'\'
  420. {spec_desc_4}
  421. \'\'\'{{{{Spec|{spec_5}}}}}\'\'\'
  422. {spec_desc_5}
  423. '''
  424. else:
  425. abilities = '''
  426. \'\'\'{a_base} - Base Attack\'\'\'
  427. {a_base_desc}
  428. {gained_abilities}
  429. \'\'\'{a_ult} - Ultimate Attack\'\'\'
  430. {a_ult_desc}
  431. \'\'\'<u>Specialization Choice</u>\'\'\'
  432. \'\'\'{{{{Spec|{spec_1}}}}}\'\'\'
  433. {spec_desc_1}
  434. \'\'\'{{{{Spec|{spec_2}}}}}\'\'\'
  435. {spec_desc_2}
  436. '''
  437. # Base & Ult Attacks and Cooldowns
  438. _b_a_id = hero['base_attack_id']
  439. _u_a_id = hero['ultimate_attack_id']
  440. for attack in js_attack:
  441. # Tyril special case base attack and ultimate
  442. if name == 'Tyril':
  443. if attack['id'] == _b_a_id:
  444. a_base_1 = attack['name']
  445. a_base_1_desc = attack['description']
  446. if attack['id'] == _u_a_id:
  447. a_ult_1 = attack['name']
  448. a_ult_1_desc = attack['description']
  449. if ('long_description' in attack) and not (attack['long_description'] == ''):
  450. a_ult_1_desc = attack['long_description']
  451. if attack['id'] == 32:
  452. a_base_2 = attack['name']
  453. a_base_2_desc = attack['description']
  454. if attack['id'] == 27:
  455. a_ult_2 = attack['name']
  456. a_ult_2_desc = attack['description']
  457. if ('long_description' in attack) and not (attack['long_description'] == ''):
  458. a_ult_2_desc = attack['long_description']
  459. if attack['id'] == _b_a_id:
  460. _b_cd = attack['cooldown']
  461. b_cd = '<onlyinclude>{{{{#ifeq:{{{{{{include|base_cd}}}}}}|base_cd|{base_cd}}}}}</onlyinclude>'.format(
  462. base_cd=_b_cd)
  463. a_base = attack['name']
  464. a_base_desc = attack['description'].replace('$attack_num_targets', str(attack['num_targets']))
  465. if attack['id'] == 134:
  466. a_base_desc = a_base_desc\
  467. .replace('$stun_chance', str(attack['animations'][0]['stun_chance']))\
  468. .replace('$stun_time', str(attack['animations'][0]['stun_on_hit']))
  469. if ('long_description' in attack) and not (attack['long_description'] == ''):
  470. if attack['id'] == 139:
  471. a_base_desc += '\n'
  472. a_base_desc += '* '
  473. a_base_desc += attack['long_description']
  474. a_base_desc = a_base_desc\
  475. .replace('$(attack_indexed_effect_amount 0)', attack['animations'][0]['effects_on_monsters'][0]['effect_string'].split(',')[1])\
  476. .replace('$(attack_indexed_effect_amount 1)', attack['animations'][0]['effects_on_monsters'][1]['effect_string'].split(',')[1])\
  477. .replace('$(attack_indexed_effect_amount 2)', attack['animations'][0]['effects_on_monsters'][2]['effect_string'].split(',')[1])\
  478. .replace('$(attack_indexed_effect_amount 3)', attack['animations'][0]['effects_on_monsters'][3]['effect_string'].split(',')[1])\
  479. .replace(';', '\n* ')
  480. else:
  481. a_base_desc = attack['long_description']
  482. elif attack['id'] == _u_a_id:
  483. _u_cd = attack['cooldown']
  484. u_cd = '<onlyinclude>{{{{#ifeq:{{{{{{include|ult_cd}}}}}}|ult_cd|{ult_cd}}}}}</onlyinclude>'.format(
  485. ult_cd=_u_cd)
  486. a_ult = attack['name']
  487. a_ult_desc = attack['description'].replace('$ishi_ult_time', '15').replace('$(nrakk_ult_buffed 200)', '200')
  488. if ('long_description' in attack) and not (attack['long_description'] == ''):
  489. a_ult_desc = attack['long_description'].replace('$ishi_ult_time', '15').replace('$(nrakk_ult_buffed 200)', '200')
  490. # Gromma's ult id is wrong
  491. if name == 'Gromma':
  492. if attack['id'] == 59:
  493. a_ult = attack['name']
  494. a_ult_desc = attack['long_description']
  495. # Another go at the table
  496. # __upgrades = OrderedDict()
  497. __upgrades = []
  498. _upgrades = []
  499. ab_table = {}
  500. for upgrade in js_upgrade:
  501. if upgrade['hero_id'] == id_:
  502. __upgrades.append(upgrade)
  503. __upgrades = sorted(__upgrades, key=lambda x: x['required_level'])
  504. if PRINT_UPGRADES is True:
  505. pprint(__upgrades)
  506. for upgrade in js_upgrade:
  507. _upgrades.append(upgrade)
  508. _upgrades = sorted(_upgrades, key=lambda x: x['required_level'])
  509. if PRINT_MULTIPLE_ABILTIES is True:
  510. req_level_thing = {}
  511. print(name, 'PRINT_MULTIPLE_ABILTIES')
  512. for upgrade in __upgrades:
  513. if not upgrade['required_level'] == 9999:
  514. # if not 'specialization_name' in upgrade:
  515. if isinstance(req_level_thing, list):
  516. temp = {}
  517. temp['level'] = upgrade['required_level']
  518. temp['req_id'] = upgrade['required_upgrade_id']
  519. temp['full'] = upgrade
  520. req_level_thing.append(temp)
  521. elif not 'level' in req_level_thing:
  522. req_level_thing['level'] = upgrade['required_level']
  523. req_level_thing['req_id'] = upgrade['required_upgrade_id']
  524. req_level_thing['full'] = upgrade
  525. else:
  526. temp = req_level_thing
  527. req_level_thing = []
  528. req_level_thing.append(temp)
  529. temp2 = {}
  530. temp2['level'] = upgrade['required_level']
  531. temp2['req_id'] = upgrade['required_upgrade_id']
  532. temp2['full'] = upgrade
  533. req_level_thing.append(temp2)
  534. prev_item = {'level': 0}
  535. for item in req_level_thing:
  536. if item['level'] == prev_item['level']:
  537. print(item['full'])
  538. print(prev_item['full'])
  539. prev_item = item
  540. # pprint(req_level_thing)
  541. if PRINT_REQUIRED_ABILTIES is True:
  542. required_thing = {}
  543. print(name, 'PRINT_REQUIRED_ABILTIES')
  544. for upgrade in __upgrades:
  545. if not upgrade['required_level'] == 9999:
  546. if not upgrade['required_upgrade_id'] == 0:
  547. if isinstance(required_thing, list):
  548. temp = {}
  549. temp['level'] = upgrade['required_level']
  550. temp['req_id'] = upgrade['required_upgrade_id']
  551. temp['full'] = upgrade
  552. required_thing.append(temp)
  553. elif not 'level' in required_thing:
  554. required_thing['level'] = upgrade['required_level']
  555. required_thing['req_id'] = upgrade['required_upgrade_id']
  556. required_thing['full'] = upgrade
  557. else:
  558. temp = required_thing
  559. required_thing = []
  560. required_thing.append(temp)
  561. temp2 = {}
  562. temp2['level'] = upgrade['required_level']
  563. temp2['req_id'] = upgrade['required_upgrade_id']
  564. temp2['full'] = upgrade
  565. required_thing.append(temp2)
  566. print('PRINT_REQUIRED_ABILTIES', upgrade)
  567. # for item in required_thing:
  568. # print(item['full'])
  569. def parse_description(desc):
  570. pass
  571. def parse_effect(effect):
  572. if isinstance(effect, dict):
  573. # effect_key = effect['effect_string'].split(',')[0]
  574. # effect_id = effect['effect_string'].split(',')[2]
  575. # print('dict', effect)
  576. effect_desc = effect['description']
  577. effect = effect['effect_string']
  578. if isinstance(effect, str):
  579. # print(effect)
  580. if len(effect.split(',')) == 1:
  581. effect_key = effect
  582. if len(effect.split(',')) == 2:
  583. # print('2', effect)
  584. effect_key = effect.split(',')[0]
  585. effect_id = effect.split(',')[1]
  586. elif len(effect.split(',')) == 3:
  587. # print('3', effect)
  588. effect_key = effect.split(',')[0]
  589. effect_amount = effect.split(',')[1]
  590. effect_id = effect.split(',')[2]
  591. elif len(effect.split(',')) > 3:
  592. # print('>3', effect)
  593. effect_key = effect.split(',')[0]
  594. effect_ids = []
  595. if effect_key in [
  596. 'buff_upgrades',
  597. 'buff_attacks_damage', # found while doing equipment
  598. 'hero_dps_multiplier_if_attack', # found while doing equipment
  599. ]:
  600. effect_amount = effect.split(',')[1]
  601. for __id in effect.split(',', 2)[2].split(','):
  602. effect_ids.append(__id)
  603. elif effect_key == 'buff_upgrade':
  604. # print(effect)
  605. effect_amount = effect.split(',')[1]
  606. # print(effect.split(',', 2)[2].split(',')[0])
  607. effect_id = effect.split(',', 2)[2].split(',')[0]
  608. # print(effect.split(',', 2)[2].split(',')[1])
  609. effect_extra = effect.split(',', 2)[2].split(',')[1]
  610. elif effect_key == 'effect_def':
  611. for __id in effect.split(',', 1)[1].split(','):
  612. effect_ids.append(__id)
  613. elif effect_key == 'buff_upgrade_per_any_tagged_crusader_mult': # Bruenor
  614. effect_amount = effect.split(',')[1]
  615. effect_id = effect.split(',')[2]
  616. effect_extra = effect.split(',')[3]
  617. elif effect_key == 'targets_with_tag_gold_multiplier_mult': # Ishi
  618. effect_amount = effect.split(',')[1]
  619. effect_extra = effect_rest = effect.split(',', 1)[1]
  620. elif effect_key == 'buff_upgrade_by_tag_mult': # Diath
  621. effect_amount = effect.split(',')[1]
  622. effect_id = effect.split(',')[3]
  623. elif effect_key in [
  624. 'hero_dps_mult_per_crusader_where_mult', # Rosie
  625. 'change_base_attack_every', # Rosie
  626. ]:
  627. effect_id = effect.split(',')[1] # Actually amount
  628. else:
  629. effect_rest = effect.split(',', 1)[1]
  630. # print(effect.split(',', 2))
  631. # print(effect_ids)
  632. else:
  633. print('uh')
  634. exit()
  635. if effect_key == 'effect_def':
  636. if len(effect.split(',')) < 3:
  637. for effect in js_effect:
  638. if str(effect['id']) == effect_id:
  639. desc = effect['description']
  640. if 'buff_upgrade_per_any_tagged_crusader_mult' in effect['effect_keys'][0]['effect_string']:
  641. __effect = parse_effect(effect['effect_keys'][0]['effect_string'])
  642. # print(__effect)
  643. if any(
  644. y in desc for y in [
  645. '$amount%',
  646. '$(amount)%',
  647. '$chance%',
  648. '$percent%',
  649. ]
  650. ):
  651. unit = '%'
  652. elif any(
  653. y in desc for y in [
  654. '$amount seconds',
  655. '$(amount) seconds',
  656. ]
  657. ):
  658. unit = ' sec'
  659. for __effect in effect['effect_keys']:
  660. # print(effect)
  661. # print(__effect['effect_string'])
  662. _effect = parse_effect(__effect['effect_string'])
  663. if not _effect:
  664. # _effect = []
  665. continue
  666. # print(_effect['amount'])
  667. # print(desc)
  668. if _effect['key'] == 'grant_temporary_hp_with_cooldown':
  669. desc = desc\
  670. .replace('$(tmp_hp_cooldown cooldown)', _effect['cooldown'])\
  671. .replace('$optional_percent_limit', _effect['percent'])
  672. if _effect['key'] == 'add_health_plus_tag_targets_percent_health':
  673. desc = desc\
  674. .replace('$percent', _effect['percent'])
  675. if _effect['key'] == 'bonus_damage_range':
  676. desc = desc\
  677. .replace('$min_amount', _effect['min_amount'])\
  678. .replace('$damage_type', _effect['damage_type'])
  679. if _effect['key'] == 'hero_dps_mult_by_tag_additive':
  680. desc = desc\
  681. .replace('$(amount___2)', _effect['amount'])
  682. if _effect['key'] == 'revive_with_health_transfer':
  683. desc = desc\
  684. .replace('$gain_percent', _effect['gain_percent'])\
  685. .replace('$lose_percent', _effect['lose_percent'])\
  686. .replace('$wait_time', _effect['wait_time'])
  687. if _effect['key'] == 'increase_attack_cooldown':
  688. desc = desc\
  689. .replace('$(seconds_plural amount)', _effect['amount'])\
  690. .replace('$(amount___2)', _effect['amount___2'])
  691. if _effect['key'] == 'stun_does_cooldown_and_damage_mult':
  692. desc = desc\
  693. .replace('$cooldown', _effect['cooldown'])
  694. if _effect['key'] == 'azaka_weretiger':
  695. desc = desc\
  696. .replace('$azaka_attacks', _effect['azaka_attacks'])\
  697. .replace('$azaka_time', _effect['azaka_time'])
  698. if _effect['key'] == 'buff_attack_monster_effects_index':
  699. desc = desc\
  700. .replace('$amount___' + _effect['index'], _effect['amount'])
  701. if _effect['key'] == 'gold_multiplier_reduce':
  702. desc = desc\
  703. .replace('$amount___2', _effect['amount'])
  704. if _effect['key'] == 'monster_effect_on_attacked':
  705. desc = desc\
  706. .replace('$(time_str amount)', _effect['amount'] + ' second')
  707. if _effect['key'] == 'bonus_damage_monster_percent_from_party_range':
  708. desc = desc\
  709. .replace('$start_percent', _effect['start'])\
  710. .replace('$end_percent', _effect['end'])
  711. if _effect['key'] == 'add_percent_targets_max_health':
  712. desc = desc\
  713. .replace('$(targets_desc_plural targets)', _effect['targets'] + name)
  714. if _effect['key'] == 'overwhelm_start_increase':
  715. desc = desc\
  716. .replace('$amount___2', _effect['amount'])
  717. if _effect['key'] == 'hero_dps_multiplier_reduced_by_age':
  718. desc = desc\
  719. .replace('$reduce', _effect['reduce'])\
  720. .replace('$every_years', _effect['every_years'])\
  721. .replace('$(start_years)', _effect['start_years'])\
  722. .replace('$min', _effect['min'])
  723. if _effect['key'] == 'buff_upgrade_by_target_tag_mult':
  724. desc = desc\
  725. .replace('$(not_buffed amount___2)', _effect['amount'])
  726. if effect['id'] == 141:
  727. desc = desc\
  728. .replace('$seconds', str(__effect['seconds']))\
  729. .replace('$hits', str(__effect['hits']))\
  730. .replace('$(value stun_time)', str(__effect['stun_time']))
  731. if _effect['key'] == 'binwin_multi_attack':
  732. desc = desc\
  733. .replace('$(binwin_odds_buff base_odds)', _effect['base_odds'])\
  734. .replace('$cooldown_added', _effect['cooldown_added'])\
  735. .replace('$reduce_odds', _effect['reduce_odds'])
  736. if effect['id'] == 165:
  737. desc = desc\
  738. .replace('$upgrade_base_stack', _effect['amount'])
  739. if effect['id'] == 226:
  740. if 'for_time' in __effect:
  741. desc = desc\
  742. .replace('$for_time', str(__effect['for_time']))
  743. if _effect['key'] == 'buff_upgrade_per_stunned_enemy':
  744. desc = desc\
  745. .replace('$cap_percent', _effect['cap_percent'])
  746. if effect['id'] == 204 or effect['id'] == 203:
  747. # Could be a bug that description only uses 1 $amount var
  748. if 'monster_effect' in __effect:
  749. desc = desc\
  750. .replace('$amount___2', _effect['amount'])
  751. if _effect['key'] == 'add_attack_stun':
  752. desc = desc\
  753. .replace('$duration', _effect['duration'])\
  754. .replace('$(attack_names_and optional_attack_ids)', _effect['name'])
  755. if effect['id'] == 233:
  756. if 'monster_effect_time' in __effect:
  757. desc = desc\
  758. .replace('$(monster_effect_time___2)', str(__effect['monster_effect_time']))
  759. if _effect['key'] == 'reduce_attack_cooldown_per_any_tagged_crusader':
  760. desc = desc\
  761. .replace('$(seconds_plural amount___2)', _effect['amount'] + ' seconds')
  762. if _effect['key'] in ['chance_add_attack_targets', 'chance_attack_adds_dot']:
  763. desc = desc\
  764. .replace('$chance', _effect['chance'])
  765. if effect['id'] == 351:
  766. desc = desc\
  767. .replace('$kill_count', _effect['kill_count'])\
  768. .replace('$time', _effect['time'])\
  769. .replace('$(if spurt_is_spirit)^^(', '. \'\'')\
  770. .replace(')$fi$(only_when_purchased)^^Current Wasp Swarm Kills: $spurt_wasp_kills', '\'\'')
  771. if effect['id'] == 342:
  772. desc = desc\
  773. .replace('$(if spurt_is_spirit)^^(', '. \'\'')\
  774. .replace('$fi', '\'\'')
  775. if effect['id'] == 345:
  776. desc = desc\
  777. .replace('$(if spurt_is_spirit)^^(', '. \'\'')\
  778. .replace('$fi', '\'\'')
  779. desc = desc.replace('$amount___2', '$interim___2')
  780. if effect['id'] == 360:
  781. desc = desc\
  782. .replace('$increase_by_slot', _effect['amount'])
  783. if effect['id'] == 361:
  784. desc = desc\
  785. .replace(' $(if upgrade_purchased 2318)Champions exactly two slots away from Qillek provide twice the bonus each.', '')
  786. if effect['id'] == 369:
  787. desc = desc\
  788. .replace('$cooldown_buff', _effect['amount'])
  789. if effect['id'] == 371:
  790. desc = desc\
  791. .replace('$fighting_spirit_cooldown', _effect['amount'])
  792. if effect['id'] == 370:
  793. desc = desc\
  794. .replace('$calculated_stack_time', _effect['time'])
  795. if effect['id'] == 373:
  796. desc = desc\
  797. .replace('$charges', _effect['amount'])\
  798. .replace('$(time_str charge_timer)', _effect['timer'] + ' seconds')
  799. if effect['id'] == 372:
  800. desc = desc\
  801. .replace('$chance', _effect['chance'])\
  802. .replace('$ult_reduce_seconds', _effect['ult_reduce'])
  803. if effect['id'] == 376:
  804. desc = desc\
  805. .replace('$(if upgrade_purchased 2393)all Champions$(elif upgrade_purchased 2392)adjacent champions and champions in the top or bottom of their column$(elif upgrade_purchased 2391)champions up to two slots away$(or)', '')\
  806. .replace('$(not_buffed amount)', _effect['amount'])
  807. if effect['id'] == 377:
  808. desc = desc\
  809. .replace('$(duration)', _effect['duration'])\
  810. .replace('$duration', _effect['duration'])
  811. if effect['id'] == 378:
  812. desc = desc\
  813. .replace('$(round amount)', _effect['amount'])
  814. desc = desc.replace('$amount___2', '$interim___2')
  815. desc = desc\
  816. .replace('$amount', _effect['amount'])\
  817. .replace('$(amount)', _effect['amount'])\
  818. .replace('$(not_buffed amount)', _effect['amount'])\
  819. .replace('%%', '%')
  820. desc = desc.replace('$interim___2', '$amount___2')
  821. # print(desc)
  822. if _effect:
  823. desc = desc\
  824. .replace(' \r\n\r\nAila\'s Contibution: $(aila_synergy)%\r\nTotal Aerois Synergy Pool: $(aerois_synergy)%', '')\
  825. .replace(' \r\n\r\nQillek\'s Contibution: $(qillek_synergy)%\r\nTotal Aerois Synergy Pool: $(aerois_synergy)%', '')\
  826. .replace('$(if upgrade_purchased 1550) or Champions within 2 slots distance of $target$(elif upgrade_purchased 1548) or Champions adjacent to $target', '')\
  827. .replace('$(describe_rarity rarity)', 'Epic')\
  828. .replace('$(tmp_hp_cooldown cooldown)', '10')\
  829. .replace('$optional_percent_limit', '200')\
  830. .replace('$only_when_purchased (Current Attackers: $num_attacking_monsters)', '')\
  831. .replace('$asharra_kir_sabal_desc', '')\
  832. .replace('Bruenor_hero', 'Bruenor')\
  833. .replace('$(if upgrade_purchased 1897). Hex is spread to nearby enemies when a Hex cursed enemy is killed.$(fi)', '')\
  834. .replace('$(if upgrade_purchased 1897). Hex is spread to nearby enemies when a Hex cursed enemy is killed.$(fi)', '')\
  835. .replace('. (multiplicative, then buffed by $(upgrade_bonus 2037)%)', ' (multiplicative).')\
  836. .replace('$(if upgrade_purchased 1192)or anyone kills an enemy affected by Silver Lining $(fi)', '')\
  837. .replace('$(if upgrade_purchased 2329) ($(mult_value chance 2)% chance for Champions not adjacent to Korth)$fi', '')\
  838. .replace('$only_when_purchased^^$korth_resurrection_charges', '')\
  839. .replace('$(if upgrade_purchased 2112)33$(or)', '')\
  840. .replace('$(if upgrade_purchased 2112)12.5$(or)', '')\
  841. .replace(' $jewel_thief_description', '')\
  842. .replace('$(if upgrade_purchased 2111)or second $(fi)', '')\
  843. .replace('$(if upgrade_purchased 2111)Black Viper attacks 0.5s faster after she Sneak Attacks.$(fi)', '')\
  844. .replace('$(if jewel_thief_upgrade_unlocked 0)Warlocks, Rangers, $(fi)', '')\
  845. .replace('$(if jewel_thief_upgrade_unlocked 1)200$(or)', '')\
  846. .replace('$(if jewel_thief_upgrade_unlocked 1)10$(or)', '')\
  847. .replace('$(if upgrade_purchased 2153)fourth$(or)', '')\
  848. .replace(' $hordesperson_description', '')\
  849. .replace('$weretiger_description', '')\
  850. .replace('$(if not upgrade_purchased 1152)Adjacent$(or)All$(fi)', 'Adjacent')\
  851. .replace('$only_when_purchased^(Current Stacks: $upgrade_stacks)', '')\
  852. .replace('$only_when_purchased^^Current Stacks: $upgrade_stacks', '')\
  853. .replace('$only_when_purchased^^(Current Bounty of the Hall: $companion_bounty_pool%)', '')\
  854. .replace('$(fi)', '')\
  855. .replace('$target', name)\
  856. .replace('$(target)', name)\
  857. .replace('$source_hero', name)\
  858. .replace('$source', name)\
  859. .replace('$first_effect_key_target', name)\
  860. .replace('$(upgrade_hero id)', name)\
  861. .replace('$(upgrade_name id)', _effect['name'] if ('_effect' in locals() and 'name' in _effect) else '')
  862. # print(desc)
  863. return {
  864. 'desc': desc,
  865. 'key': effect_key,
  866. 'id': effect_id,
  867. 'unit': unit if 'unit' in locals() else ''
  868. }
  869. else:
  870. # print('more effects than expected')
  871. if effect_key == 'effect_def': # Vlahnya
  872. return {
  873. 'key': effect_key,
  874. 'ids': effect.split(',', 1)[1],
  875. }
  876. # exit()
  877. elif effect_key == 'set_ultimate_attack':
  878. for attack in js_attack:
  879. if str(attack['id']) == effect_id:
  880. desc = attack['description']
  881. name_ = attack['name']
  882. return {
  883. 'name': name_,
  884. 'desc': desc,
  885. 'key': effect_key,
  886. 'id': effect_id,
  887. 'amount': '',
  888. }
  889. elif effect_key in [
  890. 'hero_dps_multiplier_mult',
  891. 'global_dps_multiplier_mult',
  892. 'buff_ultimate',
  893. 'health_add',
  894. 'gold_multiplier_mult',
  895. 'temporary_hp_cooldown_reduce', # Calliope not handled yet
  896. # 'add_attack_targets', # Asharra
  897. 'owner_killing_blow_gold_bonus', # Makos
  898. 'increase_aoe_radius', # Nrakk
  899. 'increase_stun_time', # Nrakk
  900. # 'increase_num_unique_hits', # Binwin
  901. 'reduce_hordesperson_drops', # K'thriss
  902. # 'storm_aura_shielding_storm', # Aila
  903. 'reduce_ultimate_cooldown', # found while doing equipment
  904. 'health_mult', # found while doing equipment
  905. 'buff_nrakk_ultimate', # found while doing equipment
  906. 'buff_ishi_ultimate_time', # found while doing equipment
  907. 'increase_health_by_source_percent', # Evelyn
  908. 'increase_monster_spawn_time_mult', # Deekin
  909. 'return_source_dps_when_hit', # Farideh
  910. 'heal', # Donaar, Celeste
  911. 'gold_multiplier_reduce', # K'thriss
  912. 'increase_armored_damage', # Wulfgar
  913. 'stunned_monster_extra_gold', # Wulfgar
  914. 'increase_damage_when_monster_stunned', # Wulfgar
  915. 'heal_most_damaged', # Nerys
  916. 'buff_incoming_formation_abilities', # Black Viper
  917. 'add_hit_effect_to_source', # Black Viper
  918. 'hero_dps_mult_per_crusader_where_mult', # Rosie
  919. 'change_base_attack_every', # Rosie
  920. 'attacking_monsters_global_dps_mult', # Nayeli
  921. 'asharra_take_flight', # Asharra
  922. 'dhadius_stacking_damage_buff', # Dhadius
  923. 'buff_dhadius_chance_same_orb', # Dhadius
  924. 'bonus_damage_when_monster_damaged', # Zorbu
  925. 'bonus_damage_when_monster_attacking', # Zorbu
  926. 'global_dps_multiplier_per_dead_champion_additive', # Strix
  927. 'add_ally_effective_heal_effects', # Evelyn
  928. 'buff_azaka_weretiger_time_reduce', # Azaka
  929. 'reduce_azaka_weretiger_attacks', # Azaka
  930. 'increase_ultimate_cooldown', # Spurt
  931. 'time_scale',
  932. 'increase_damage_against_korth_marked', # Korth
  933. 'lizardfolk_tactics_additional_cooldown_reduction', # Korth
  934. 'rapid_strike_chance_buff', # Korth
  935. 'bruenor_bounty_contribution', # Bruenor
  936. 'hero_dps_mult_per_mark_of_ki', # Stoki
  937. ]:
  938. return {
  939. 'key': effect_key,
  940. 'amount': effect_id
  941. }
  942. elif effect_key == 'add_attack_targets': # Asharra
  943. for ___effect in js_effect_key:
  944. if ___effect['key'] == 'add_attack_targets':
  945. desc = ___effect['descriptions']['desc']
  946. if len(effect.split(',')) == 3:
  947. _amount = effect_amount
  948. optional_attack_id = effect.split(',')[2]
  949. else:
  950. _amount = effect_id
  951. return {
  952. 'key': effect_key,
  953. 'amount': _amount,
  954. 'desc': desc,
  955. }
  956. elif effect_key in [
  957. 'buff_upgrade',
  958. 'buff_crit_chance',
  959. 'buff_upgrade_base_stack',
  960. 'reduce_upgrade_every_num_attacks', # Rosie
  961. ]:
  962. for upgrade in __upgrades:
  963. if str(upgrade['id']) == effect_id:
  964. name_ = upgrade['name']
  965. return {
  966. 'name': name_,
  967. 'key': effect_key,
  968. 'id': effect_id,
  969. 'amount': effect_amount + '%'
  970. }
  971. elif effect_key == 'buff_upgrades':
  972. # for upgrade in __upgrades:
  973. # desc = effect['desc']
  974. # if str(upgrade['id']) == effect_id:
  975. # # name_ = upgrade['name']
  976. # desc = effect_desc
  977. return {
  978. 'desc': effect_desc if 'effect_desc' in locals() else None, # Regis doesn't have upgrade desc
  979. 'ids': effect_ids,
  980. 'key': effect_key,
  981. 'amount': effect_amount
  982. }
  983. elif effect_key == 'add_attack_nearby_targets': # Not handled
  984. return {
  985. 'key': effect_key,
  986. 'targets': '+' + effect.split(',')[1],
  987. 'amount': effect.split(',')[2] + '%'
  988. }
  989. elif effect_key in [
  990. 'reduce_overwhelm_effect', # Gromma
  991. 'buff_binwin_multi_attack_chance', # Binwin
  992. 'increase_num_unique_hits', # Binwin
  993. ]:
  994. for _effect in js_effect_key:
  995. if _effect['key'] == effect_key:
  996. desc = _effect['descriptions']['desc']
  997. if effect_key in [
  998. 'reduce_overwhelm_effect', # Gromma
  999. 'buff_binwin_multi_attack_chance', # Binwin
  1000. ]:
  1001. _amount = effect.split(',')[1] + '%'
  1002. desc = desc.replace('$amount', effect.split(',')[1])
  1003. desc = desc.replace('$target', name)
  1004. elif effect_key in [
  1005. 'increase_num_unique_hits', # Binwin
  1006. ]:
  1007. desc = desc.replace('$(as_multiplier amount)', str(
  1008. int(int(effect.split(',')[1]) / 100) + 1))
  1009. _amount = '+' + effect.split(',')[1]
  1010. elif effect_key in [
  1011. 'reduce_upgrade_every_num_attacks', # Rosie
  1012. ]:
  1013. _amount = '-' + effect.split(',')[1]
  1014. return {
  1015. # 'name': upgrade['name'],
  1016. 'key': effect_key,
  1017. 'amount': _amount,
  1018. 'desc': desc,
  1019. }
  1020. elif effect_key == 'attack_crit_chance':
  1021. for _effect in js_effect_key:
  1022. if _effect['key'] == effect_key:
  1023. desc = _effect['descriptions']['desc']
  1024. desc = desc\
  1025. .replace('$source', name)\
  1026. .replace('$(buffed_crit_chance chance)', effect.split(',')[2])\
  1027. .replace('$amount', effect.split(',')[1])
  1028. return {
  1029. 'key': effect_key,
  1030. 'amount': effect.split(',')[1],
  1031. 'chance': effect.split(',')[2],
  1032. 'upgrade_id': effect.split(',')[3],
  1033. 'desc': desc,
  1034. }
  1035. elif effect_key == 'add_sneak_attack_hit': # Black Viper
  1036. return {
  1037. 'key': effect_key,
  1038. 'amount': effect.split(',')[1],
  1039. 'desc': effect_desc,
  1040. }
  1041. elif effect_key in ['aila_storm_aura']: # Aila
  1042. return {
  1043. 'key': effect_key,
  1044. 'amount': effect_amount,
  1045. 'cooldown': effect_id,
  1046. }
  1047. elif effect_key in ['storm_aura_storm_soul']: # Aila
  1048. # print(effect)
  1049. return {
  1050. 'key': effect_key,
  1051. 'amount': effect_id,
  1052. }
  1053. elif effect_key == 'storm_aura_raging_storm': # Aila
  1054. for _effect in js_effect_key:
  1055. if _effect['key'] == effect_key:
  1056. desc = _effect['descriptions']['desc']
  1057. return {
  1058. 'key': effect_key,
  1059. 'radius': effect_amount,
  1060. 'amount': effect_id,
  1061. 'desc': desc,
  1062. }
  1063. elif effect_key == 'storm_aura_shielding_storm': # Aila
  1064. for _effect in js_effect_key:
  1065. if _effect['key'] == effect_key:
  1066. desc = _effect['descriptions']['desc']
  1067. return {
  1068. 'key': effect_key,
  1069. 'amount': effect_id,
  1070. 'desc': desc,
  1071. }
  1072. elif effect_key == 'reduce_storm_aura_seconds': # Aila
  1073. for _effect in js_effect_key:
  1074. if _effect['key'] == effect_key:
  1075. desc = _effect['descriptions']['desc']
  1076. return {
  1077. 'key': effect_key,
  1078. 'amount': effect_id,
  1079. 'desc': desc
  1080. }
  1081. elif effect_key == 'buff_aila_ult_bonus_dmg': # Aila
  1082. for _effect in js_effect_key:
  1083. if _effect['key'] == effect_key:
  1084. desc = _effect['descriptions']['desc']
  1085. return {
  1086. 'key': effect_key,
  1087. 'amount': effect_id,
  1088. 'desc': desc
  1089. }
  1090. elif effect_key in [
  1091. 'buff_chance_attack_miss', # Diath
  1092. 'buff_attack_stun_chance',
  1093. 'global_dps_mult_by_tag_mult', # Deekin
  1094. 'global_dps_multiplier_mult_area_tags', # Azaka
  1095. 'hero_dps_mult_per_tagged_crusader', # Ishi
  1096. 'hero_dps_mult_per_tagged_crusader_mult', # Farideh
  1097. 'buff_stunned_monster_crit_chance', # Wulfgar
  1098. 'increase_monster_effect_limit_max', # Warden
  1099. 'increase_monster_with_tags_damage', # Nerys
  1100. 'gold_mult_per_target_crusader', # Paultin
  1101. 'hero_dps_mult_per_target_crusader', # Paultin
  1102. 'hero_dps_mult_per_tagged_crusader_mult_amount_before', # Paultin
  1103. # 'buff_upgrade', # Paultin
  1104. 'reduce_attack_cooldown_per_any_tagged_crusader', # Rosie
  1105. 'increase_monster_damage_if_affected_by', # Gromma
  1106. 'single_target_damage_buff', # Minsc
  1107. 'single_hit_attacks_again', # Nrakk
  1108. 'add_crit_effect', # Catti-brie
  1109. ]:
  1110. return {
  1111. 'key': effect_key,
  1112. 'amount': effect_amount,
  1113. 'attack_id': effect_id,
  1114. # 'desc': desc,
  1115. }
  1116. elif effect_key in [
  1117. 'buff_attacks_damage', # found while doing equipment
  1118. 'hero_dps_multiplier_if_attack', # found while doing equipment
  1119. 'targets_with_tag_gold_multiplier_mult', # Ishi
  1120. ]:
  1121. # print(effect)
  1122. return {
  1123. 'key': effect_key,
  1124. 'amount': effect_amount,
  1125. 'ids': effect_ids,
  1126. # 'desc': desc,
  1127. }
  1128. elif effect_key in [
  1129. 'buff_upgrade_per_any_tagged_crusader_mult', # Bruenor
  1130. 'buff_upgrade_per_attacking_monster', # Evelyn
  1131. 'reduce_upgrade_every_num_attacks', # Rosie
  1132. ]:
  1133. for upgrade in __upgrades:
  1134. if upgrade['id'] == int(effect_id):
  1135. _name = upgrade['name']
  1136. return {
  1137. 'key': effect_key,
  1138. 'amount': effect_amount,
  1139. 'id': effect_id,
  1140. 'name': _name,
  1141. }
  1142. elif effect_key in [
  1143. 'buff_upgrade_by_tag_mult', # Diath
  1144. ]:
  1145. for upgrade in __upgrades:
  1146. if upgrade['id'] == int(effect_id):
  1147. _name = upgrade['name']
  1148. return {
  1149. 'key': effect_key,
  1150. 'amount': effect_amount,
  1151. 'id': effect_id,
  1152. 'name': _name,
  1153. }
  1154. elif effect_key == 'hero_dps_multiplier_reduced_by_age': # Gromma
  1155. return {
  1156. 'key': effect_key,
  1157. 'amount': effect.split(',')[1],
  1158. 'reduce': effect.split(',')[2],
  1159. 'start_years': effect.split(',')[3],
  1160. 'every_years': effect.split(',')[4],
  1161. 'min': effect.split(',')[5],
  1162. }
  1163. elif effect_key == 'add_percent_targets_max_health': # Barrowin
  1164. return {
  1165. 'key': effect_key,
  1166. 'amount': effect.split(',')[1],
  1167. 'targets': 'Champions in the same column as ',
  1168. }
  1169. elif effect_key == 'overwhelm_start_increase': # Barrowin
  1170. return {
  1171. 'key': effect_key,
  1172. 'amount': effect.split(',')[1]
  1173. }
  1174. elif effect_key == 'monster_effect_on_attacked': # Barrowin
  1175. return {
  1176. 'key': effect_key,
  1177. 'amount': effect.split(',')[1]
  1178. }
  1179. elif effect_key == 'buff_attacks_damage': # Krond Loot
  1180. return {
  1181. 'key': effect_key,
  1182. 'amount': effect.split(',')[1],
  1183. 'ids': effect.split(',', 1)[1]
  1184. }
  1185. # elif effect_key == 'revive_with_health_transfer': # Strix
  1186. # return {
  1187. # 'key': effect_key,
  1188. # 'gain': effect.split(',')[1],
  1189. # 'lose': effect.split(',')[2],
  1190. # 'wait': effect.split(',')[3],
  1191. # }
  1192. elif effect_key == 'bonus_damage_monster_percent_from_party_range': # Catti-brie
  1193. for _effect in js_effect_key:
  1194. if _effect['key'] == effect_key:
  1195. desc = _effect['descriptions']['desc']
  1196. return {
  1197. 'key': effect_key,
  1198. 'desc': desc,
  1199. 'amount': effect.split(',')[1],
  1200. 'start': effect.split(',')[2],
  1201. 'end': effect.split(',')[3],
  1202. }
  1203. elif effect_key == 'binwin_multi_attack': # Binwin
  1204. for _effect in js_effect_key:
  1205. if _effect['key'] == effect_key:
  1206. desc = _effect['descriptions']['desc']
  1207. return {
  1208. 'key': effect_key,
  1209. 'desc': desc,
  1210. 'amount': effect.split(',')[1],
  1211. 'base_odds': effect.split(',')[2],
  1212. 'cooldown_added': effect.split(',')[3],
  1213. 'reduce_odds': effect.split(',')[4],
  1214. }
  1215. elif effect_key == 'add_monster_hit_effects': # Wulfgar
  1216. if len(effect.split(',')) == 2:
  1217. return {
  1218. 'key': effect_key,
  1219. 'amount': effect_id,
  1220. }
  1221. elif effect == effect_key:
  1222. pass
  1223. else:
  1224. # print(effect)
  1225. return {
  1226. 'key': effect_key,
  1227. 'amount': effect.split(',')[1],
  1228. 'ids': effect.split(',', 2)[2]
  1229. }
  1230. elif effect_key == 'buff_upgrade_per_stunned_enemy': # Wulfgar
  1231. return {
  1232. 'key': effect_key,
  1233. 'id': effect.split(',')[1],
  1234. 'amount': effect.split(',')[2],
  1235. 'cap_percent': effect.split(',')[3],
  1236. }
  1237. elif effect_key == 'add_attack_stun': # Vlahnya
  1238. atk_name = ''
  1239. for _attack in js_attack:
  1240. if str(_attack['id']) == effect.split(',', 4)[4]:
  1241. atk_name = _attack['name']
  1242. return {
  1243. 'key': effect_key,
  1244. 'amount': effect.split(',')[1],
  1245. 'duration': effect.split(',')[2],
  1246. 'ids': effect.split(',', 4)[4],
  1247. 'name': atk_name,
  1248. }
  1249. elif effect_key == 'attacking_companion': # Warden
  1250. return {
  1251. 'key': effect_key,
  1252. 'amount': effect.split(',')[1],
  1253. 'attack_id': effect.split(',')[2],
  1254. 'companion_gfx_id': effect.split(',')[3],
  1255. }
  1256. elif effect_key == 'sneak_attack_hit': # Black Viper
  1257. return {
  1258. 'key': effect_key,
  1259. 'amount': effect.split(',')[2],
  1260. 'num_hits': effect.split(',')[1],
  1261. }
  1262. elif effect_key == 'add_attack_aoe_targets': # Gromma
  1263. return {
  1264. 'key': effect_key,
  1265. 'amount': effect.split(',')[1],
  1266. 'radius': effect.split(',')[2],
  1267. }
  1268. elif effect_key == 'change_upgrade_targets': # Evelyn
  1269. for upgrade in __upgrades:
  1270. if not upgrade['required_level'] == 9999:
  1271. if upgrade['id'] == int(effect_id):
  1272. _name = upgrade['name']
  1273. return {
  1274. 'key': effect_key,
  1275. 'name': _name,
  1276. 'amount': effect.split(',')[1],
  1277. }
  1278. elif effect_key == 'gold_mult_per_tagged_crusader': # Jarlaxle
  1279. return {
  1280. 'key': effect_key,
  1281. 'amount': effect.split(',')[1],
  1282. }
  1283. elif effect_key == 'hero_dps_mult_per_target_tag_crusader_mult_amount_before': # Jarlaxle
  1284. return {
  1285. 'key': effect_key,
  1286. 'amount': effect.split(',')[1],
  1287. }
  1288. elif effect_key == 'hero_dps_mult_per_target_loot_rarity': # Jarlaxle
  1289. return {
  1290. 'key': effect_key,
  1291. 'amount': effect.split(',')[1],
  1292. }
  1293. elif effect_key == 'grant_temporary_hp_with_cooldown': # Calliope
  1294. return {
  1295. 'key': effect_key,
  1296. 'amount': effect.split(',')[1],
  1297. 'interval': effect.split(',')[2],
  1298. 'cooldown': effect.split(',')[3],
  1299. 'percent': effect.split(',')[4],
  1300. }
  1301. elif effect_key == 'buff_upgrades_per_active_upgrade_tag_mult': # Asharra
  1302. return {
  1303. 'key': effect_key,
  1304. 'amount': effect.split(',')[1],
  1305. }
  1306. elif effect_key == 'non_boss_wave_chances_extra_enemies': # Minsc
  1307. return {
  1308. 'key': effect_key,
  1309. 'amount': effect.split(',')[1],
  1310. }
  1311. elif effect_key == 'monster_with_tag_more_damage': # Minsc
  1312. return {
  1313. 'key': effect_key,
  1314. 'amount': effect.split(',')[1],
  1315. }
  1316. elif effect_key == 'damage_buff_on_upgrade_tag_targets': # Minsc
  1317. return {
  1318. 'key': effect_key,
  1319. 'amount': effect.split(',')[1],
  1320. }
  1321. elif effect_key == 'chance_attack_adds_dot': # Delina
  1322. return {
  1323. 'key': effect_key,
  1324. 'amount': effect.split(',')[1],
  1325. 'chance': effect.split(',')[4],
  1326. }
  1327. elif effect_key == 'hero_dps_mult_per_target_crusader_prebonus_mult': # Delina
  1328. return {
  1329. 'key': effect_key,
  1330. 'amount': effect.split(',')[1],
  1331. }
  1332. elif effect_key == 'chance_add_attack_targets': # Delina
  1333. return {
  1334. 'key': effect_key,
  1335. 'amount': effect.split(',')[1],
  1336. 'chance': effect.split(',')[2],
  1337. }
  1338. elif effect_key == 'buff_upgrade_per_any_tagged_crusader': # Makos
  1339. return {
  1340. 'key': effect_key,
  1341. 'amount': effect.split(',')[1],
  1342. }
  1343. elif effect_key == 'global_dps_multiplier_mult_minus_targets': # Tyril
  1344. return {
  1345. 'key': effect_key,
  1346. 'amount': effect.split(',')[1],
  1347. }
  1348. elif effect_key == 'reduce_damage_with_limit': # Tyril
  1349. return {
  1350. 'key': effect_key,
  1351. 'amount': effect.split(',')[1],
  1352. 'limit': effect.split(',')[2],
  1353. }
  1354. elif effect_key == 'target_attacking_monsters_hero_dps_mult': # Tyril
  1355. return {
  1356. 'key': effect_key,
  1357. 'amount': effect.split(',')[1],
  1358. 'limit': effect.split(',')[2],
  1359. }
  1360. elif effect_key == 'add_health_plus_tag_targets_percent_health': # Jamilah
  1361. return {
  1362. 'key': effect_key,
  1363. 'amount': effect.split(',')[1],
  1364. 'percent': effect.split(',')[4],
  1365. }
  1366. elif effect_key == 'hero_dps_multiplier_from_temp_hp': # Jamilah
  1367. return {
  1368. 'key': effect_key,
  1369. 'amount': effect.split(',')[1],
  1370. }
  1371. elif effect_key == 'hero_dps_mult_per_target_unique_attacker': # Jamilah
  1372. return {
  1373. 'key': effect_key,
  1374. 'amount': effect.split(',')[1],
  1375. }
  1376. elif effect_key == 'change_base_attack_per_num_attacking': # Arkhan
  1377. return {
  1378. 'key': effect_key,
  1379. 'attack_id': effect.split(',')[1],
  1380. 'min_attackers': effect.split(',')[2],
  1381. 'amount': '', # hack
  1382. }
  1383. elif effect_key == 'receive_all_formation_abilities_for': # Arkhan
  1384. return {
  1385. 'key': effect_key,
  1386. 'amount': effect.split(',')[1],
  1387. }
  1388. elif effect_key == 'change_base_attack': # Hitch
  1389. return {
  1390. 'key': effect_key,
  1391. 'attack_id': effect.split(',')[1],
  1392. 'amount': '', # hack
  1393. }
  1394. elif effect_key == 'hero_dps_mult_per_target_crusader_mult': # Hitch
  1395. return {
  1396. 'key': effect_key,
  1397. 'amount': effect.split(',')[1],
  1398. }
  1399. elif effect_key == 'damage_reduction_ranged': # Gromma
  1400. return {
  1401. 'key': effect_key,
  1402. 'amount': effect.split(',')[1],
  1403. }
  1404. elif effect_key == 'bonus_damage_range': # Drizzt
  1405. return {
  1406. 'key': effect_key,
  1407. 'amount': effect.split(',')[1],
  1408. 'min_amount': effect.split(',')[2],
  1409. 'damage_type': effect.split(',')[3],
  1410. }
  1411. elif effect_key == 'targets_with_tag_hero_dps_mult': # Drizzt
  1412. return {
  1413. 'key': effect_key,
  1414. 'amount': effect.split(',')[1],
  1415. }
  1416. elif effect_key == 'hero_dps_mult_by_tag_additive': # Drizzt
  1417. return {
  1418. 'key': effect_key,
  1419. 'amount': effect.split(',')[1],
  1420. }
  1421. elif effect_key == 'increase_monster_damage_from': # Regis
  1422. return {
  1423. 'key': effect_key,
  1424. 'amount': effect.split(',')[1],
  1425. }
  1426. elif effect_key == 'buff_effects_from_upgrade_fa': # Birdsong
  1427. for upgrade in __upgrades:
  1428. if not upgrade['required_level'] == 9999:
  1429. if upgrade['id'] == int(effect_id):
  1430. _name = upgrade['name']
  1431. return {
  1432. 'key': effect_key,
  1433. 'amount': effect.split(',')[1],
  1434. 'name': _name,
  1435. }
  1436. elif effect_key == 'increase_monster_damage_percent_to_party': # Strix
  1437. return {
  1438. 'key': effect_key,
  1439. 'amount': effect.split(',')[1],
  1440. }
  1441. elif effect_key == 'revive_with_health_transfer': # Strix
  1442. return {
  1443. 'key': effect_key,
  1444. 'gain_percent': effect.split(',')[1],
  1445. 'lose_percent': effect.split(',')[2],
  1446. 'wait_time': effect.split(',')[3],
  1447. 'amount': '', # hack
  1448. }
  1449. elif effect_key == 'reduce_attack_cooldown_if_formation_under_attack': # Strix
  1450. return {
  1451. 'key': effect_key,
  1452. 'amount': effect.split(',')[1],
  1453. }
  1454. elif effect_key == 'increase_attack_cooldown': # Strix
  1455. return {
  1456. 'key': effect_key,
  1457. 'amount': effect.split(',')[1],
  1458. 'amount___2': str(int(int(effect.split(',')[1])*2)),
  1459. }
  1460. elif effect_key == 'add_attack_aoe_targets_every': # Nrakk
  1461. return {
  1462. 'key': effect_key,
  1463. 'amount': effect.split(',')[1],
  1464. 'radius': effect.split(',')[2],
  1465. 'every_num_attacks': effect.split(',')[3],
  1466. }
  1467. elif effect_key == 'bonus_damage_every': # Nrakk
  1468. return {
  1469. 'key': effect_key,
  1470. 'amount': effect.split(',')[1],
  1471. }
  1472. elif effect_key == 'stun_does_cooldown_and_damage_mult': # Nrakk
  1473. return {
  1474. 'key': effect_key,
  1475. 'amount': effect.split(',')[1],
  1476. 'limit': effect.split(',')[2],
  1477. 'cooldown': effect.split(',')[3],
  1478. }
  1479. elif effect_key == 'add_target_to_upgrade': # Deekin
  1480. return {
  1481. 'key': effect_key,
  1482. 'amount': '', # hack
  1483. }
  1484. elif effect_key == 'buff_upgrade_or_has_tracked_effect': # Deekin
  1485. return {
  1486. 'key': effect_key,
  1487. 'amount': '', # hack
  1488. }
  1489. elif effect_key == 'azaka_weretiger': # Azaka
  1490. return {
  1491. 'key': effect_key,
  1492. 'amount': effect.split(',')[1],
  1493. 'azaka_time': effect.split(',')[2],
  1494. 'azaka_attacks': effect.split(',')[3],
  1495. }
  1496. elif effect_key == 'gold_mult_if_monsters_on_screen': # Ishi
  1497. return {
  1498. 'key': effect_key,
  1499. 'amount': effect.split(',')[1],
  1500. }
  1501. elif effect_key == 'buff_attack_monster_effects_index_additive': # Donaar
  1502. return {
  1503. 'key': effect_key,
  1504. 'amount': effect.split(',')[1],
  1505. 'index': effect.split(',')[2],
  1506. }
  1507. elif effect_key == 'buff_attack_monster_effects_index': # Donaar
  1508. return {
  1509. 'key': effect_key,
  1510. 'amount': effect.split(',')[1],
  1511. 'index': effect.split(',')[2],
  1512. }
  1513. elif effect_key == 'force_add_target_to_upgrade': # Donaar
  1514. return {
  1515. 'key': effect_key,
  1516. 'amount': '',
  1517. }
  1518. elif effect_key == 'attack_hits_again': # Warden
  1519. return {
  1520. 'key': effect_key,
  1521. 'amount': '',
  1522. }
  1523. elif effect_key == 'spread_monster_effect': # Warden
  1524. return {
  1525. 'key': effect_key,
  1526. 'amount': '',
  1527. }
  1528. elif effect_key == 'fire_trigger_by_upgrade_id': # Nerys
  1529. return {
  1530. 'key': effect_key,
  1531. 'amount': '',
  1532. }
  1533. elif effect_key == 'kthriss_hordesperson': # K'thriss
  1534. return {
  1535. 'key': effect_key,
  1536. 'amount': '',
  1537. }
  1538. elif effect_key == 'blackviper_jewel_thief': # Black Viper
  1539. return {
  1540. 'key': effect_key,
  1541. 'amount': '',
  1542. }
  1543. elif effect_key == 'increase_jewel_thief_drop_rate': # Black Viper
  1544. return {
  1545. 'key': effect_key,
  1546. 'amount': '',
  1547. }
  1548. elif effect_key == 'increase_jewel_thief_damage_bonus': # Black Viper
  1549. return {
  1550. 'key': effect_key,
  1551. 'amount': '',
  1552. }
  1553. elif effect_key == 'return_source_damage_when_hit': # Rosie
  1554. return {
  1555. 'key': effect_key,
  1556. 'amount': '',
  1557. }
  1558. elif effect_key == 'buff_upgrade_per_any_tagged_crusader_where': # Rosie
  1559. return {
  1560. 'key': effect_key,
  1561. 'amount': effect.split(',')[1],
  1562. }
  1563. elif effect_key == 'increase_storm_soul_stun_seconds': # Aila
  1564. return {
  1565. 'key': effect_key,
  1566. 'amount': '',
  1567. }
  1568. elif effect_key == 'increase_raging_storm_stun_seconds': # Aila
  1569. return {
  1570. 'key': effect_key,
  1571. 'amount': '',
  1572. }
  1573. elif effect_key == 'spurt_waspiration': # Spurt
  1574. return {
  1575. 'key': effect_key,
  1576. 'kill_count': effect.split(',')[1],
  1577. 'time': effect.split(',')[2],
  1578. 'amount': '',
  1579. }
  1580. elif effect_key == 'aila_aerois_synergy_contribution': # Aila
  1581. return {
  1582. 'key': effect_key,
  1583. 'amount': effect.split(',')[1],
  1584. 'amount_max': effect.split(',')[2],
  1585. }
  1586. elif effect_key == 'upgrade_buff_from_aerois_synergy_pool': # Aila
  1587. return {
  1588. 'key': effect_key,
  1589. 'amount': effect.split(',')[1],
  1590. 'upgrade_id': effect.split(',')[2],
  1591. }
  1592. elif effect_key == 'heal_by_distance_from_source': # Qillek
  1593. return {
  1594. 'key': effect_key,
  1595. 'amount': effect.split(',')[1],
  1596. 'distance': effect.split(',')[2],
  1597. }
  1598. elif effect_key == 'add_upgrade_bonus_by_target': # Qillek
  1599. return {
  1600. 'key': effect_key,
  1601. 'amount': effect.split(',')[1],
  1602. }
  1603. elif effect_key == 'qilleck_aerois_synergy_contribution': # Qillek
  1604. return {
  1605. 'key': effect_key,
  1606. 'amount': effect.split(',')[1],
  1607. 'amount_min': effect.split(',')[2],
  1608. 'increase': effect.split(',')[3],
  1609. }
  1610. elif effect_key == 'korth_lizardfolk_tactics': # Korth
  1611. return {
  1612. 'key': effect_key,
  1613. 'amount': effect.split(',')[1],
  1614. }
  1615. elif effect_key == 'korth_fighting_spirit': # Korth
  1616. return {
  1617. 'key': effect_key,
  1618. 'amount': effect.split(',')[1],
  1619. 'cooldown': effect.split(',')[2],
  1620. }
  1621. elif effect_key == 'korth_calculated': # Korth
  1622. return {
  1623. 'key': effect_key,
  1624. 'amount': effect.split(',')[1],
  1625. 'time': effect.split(',')[2],
  1626. }
  1627. elif effect_key == 'korth_rapid_strike': # Korth
  1628. return {
  1629. 'key': effect_key,
  1630. 'chance': effect.split(',')[1],
  1631. 'ult_reduce': effect.split(',')[2],
  1632. 'amount': '',
  1633. }
  1634. elif effect_key == 'korth_resurrection': # Korth
  1635. return {
  1636. 'key': effect_key,
  1637. 'amount': effect.split(',')[1],
  1638. 'timer': effect.split(',')[2],
  1639. }
  1640. elif effect_key == 'walnut_jobs_done': # Walnut
  1641. for upgrade in __upgrades:
  1642. if upgrade['id'] == int(effect.split(',')[2]):
  1643. _name = upgrade['name']
  1644. return {
  1645. 'key': effect_key,
  1646. 'amount': effect.split(',')[1],
  1647. 'upgrade_id': effect.split(',')[2],
  1648. 'duration': effect.split(',')[3],
  1649. 'name': _name,
  1650. }
  1651. elif effect_key == 'wolfnut': # Walnut
  1652. return {
  1653. 'key': effect_key,
  1654. 'amount': effect.split(',')[1],
  1655. 'attack_id': effect.split(',')[2],
  1656. }
  1657. elif effect_key == 'walnut_cosigners': # Walnut
  1658. return {
  1659. 'key': effect_key,
  1660. 'amount': effect.split(',')[1],
  1661. 'attack_id': effect.split(',')[2],
  1662. }
  1663. elif effect_key == 'buff_upgrade_by_target_tag_mult':
  1664. return {
  1665. 'key': effect_key,
  1666. 'amount': effect.split(',')[1],
  1667. 'upgrade_id': effect.split(',')[4],
  1668. }
  1669. elif effect_key == 'grant_temporary_hp_with_cooldown':
  1670. return {
  1671. 'key': effect_key,
  1672. 'amount': effect.split(',')[1],
  1673. 'interval': effect.split(',')[2],
  1674. 'cooldown': effect.split(',')[3],
  1675. 'optional_percent_limit': effect.split(',')[4],
  1676. }
  1677. # elif effect_key == 'reduce_upgrade_every_num_attacks': # Rosie
  1678. # return {
  1679. # 'key': effect_key,
  1680. # 'amount': effect.split(',')[2],
  1681. # 'num_hits': effect.split(',')[1],
  1682. # }
  1683. elif effect_key == 'do_nothing':
  1684. return {
  1685. 'key': effect_key,
  1686. 'amount': '',
  1687. }
  1688. print('error:', effect)
  1689. return False
  1690. for upgrade in __upgrades:
  1691. if not upgrade['required_level'] == 9999:
  1692. # If Unlock Specialization
  1693. if 'specialization_name' in upgrade:
  1694. # if upgrade['name'] == upgrade['specialization_name']:
  1695. # print(name, upgrade)
  1696. # print('specialization')
  1697. if not upgrade['required_level'] in ab_table:
  1698. ab_table[upgrade['required_level']] = {'unlockSpec': True}
  1699. ab_table[upgrade['required_level']]['unlockSpec'] = True
  1700. spec_desc = upgrade['specialization_description']
  1701. spec_name = upgrade['specialization_name']
  1702. if 'spec7title' in ab_table[upgrade['required_level']]:
  1703. ab_table[upgrade['required_level']]['spec8title'] = spec_desc
  1704. elif 'spec6title' in ab_table[upgrade['required_level']]:
  1705. ab_table[upgrade['required_level']]['spec7title'] = spec_desc
  1706. elif 'spec5title' in ab_table[upgrade['required_level']]:
  1707. ab_table[upgrade['required_level']]['spec6title'] = spec_desc
  1708. elif 'spec4title' in ab_table[upgrade['required_level']]:
  1709. ab_table[upgrade['required_level']]['spec5title'] = spec_desc
  1710. elif 'spec3title' in ab_table[upgrade['required_level']]:
  1711. ab_table[upgrade['required_level']]['spec4title'] = spec_desc
  1712. elif 'spec2title' in ab_table[upgrade['required_level']]:
  1713. ab_table[upgrade['required_level']]['spec3title'] = spec_desc
  1714. elif 'spec1title' in ab_table[upgrade['required_level']]:
  1715. ab_table[upgrade['required_level']]['spec2title'] = spec_desc
  1716. else:
  1717. ab_table[upgrade['required_level']]['spec1title'] = spec_desc
  1718. if 'spec7name' in ab_table[upgrade['required_level']]:
  1719. ab_table[upgrade['required_level']]['spec8name'] = spec_name
  1720. elif 'spec6name' in ab_table[upgrade['required_level']]:
  1721. ab_table[upgrade['required_level']]['spec7name'] = spec_name
  1722. elif 'spec5name' in ab_table[upgrade['required_level']]:
  1723. ab_table[upgrade['required_level']]['spec6name'] = spec_name
  1724. elif 'spec4name' in ab_table[upgrade['required_level']]:
  1725. ab_table[upgrade['required_level']]['spec5name'] = spec_name
  1726. elif 'spec3name' in ab_table[upgrade['required_level']]:
  1727. ab_table[upgrade['required_level']]['spec4name'] = spec_name
  1728. elif 'spec2name' in ab_table[upgrade['required_level']]:
  1729. ab_table[upgrade['required_level']]['spec3name'] = spec_name
  1730. elif 'spec1name' in ab_table[upgrade['required_level']]:
  1731. ab_table[upgrade['required_level']]['spec2name'] = spec_name
  1732. else:
  1733. ab_table[upgrade['required_level']]['spec1name'] = spec_name
  1734. # If Unlock Ability
  1735. if upgrade['upgrade_type'] == 'unlock_ability':
  1736. # print('unlockAbility')
  1737. if 'specialization_name' not in upgrade:
  1738. if not upgrade['required_level'] in ab_table:
  1739. ab_table[upgrade['required_level']] = {'unlockAbility': True}
  1740. effect = None
  1741. # print(upgrade)
  1742. effect = parse_effect(upgrade['effect'])
  1743. if effect:
  1744. # print(effect)
  1745. if effect['key'] == 'reduce_overwhelm_effect':
  1746. # print('unlock_ability -> reduce_overwhelm_effect')
  1747. ab_table[upgrade['required_level']
  1748. ]['redOverwhelm'] = effect['amount'] + '%'
  1749. # desc = effect['desc'].replace('$target', name)
  1750. ab_table[upgrade['required_level']]['abTitle'] = effect['desc']
  1751. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1752. elif effect['key'] == 'attack_crit_chance':
  1753. # print('attack_crit_chance')
  1754. ab_table[upgrade['required_level']
  1755. ]['AttCritChance'] = effect['chance'] + '%'
  1756. ab_table[upgrade['required_level']]['AttCritDmg'] = effect['amount']
  1757. ab_table[upgrade['required_level']]['abTitle'] = effect['desc']
  1758. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1759. elif effect['key'] == 'increase_num_unique_hits':
  1760. # print('increase_num_unique_hits')
  1761. desc = effect['desc']
  1762. desc = desc.replace('$target', name)
  1763. ab_table[upgrade['required_level']]['IncHits'] = effect['amount'] + '%'
  1764. ab_table[upgrade['required_level']]['abTitle'] = desc
  1765. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1766. elif effect['key'] == 'effect_def':
  1767. # print('just a multiple effect_def. should be in Vlahnya.')
  1768. desc = effect['desc'] if 'desc' in effect else ''
  1769. if desc == '':
  1770. if not name == 'Aila':
  1771. desc = upgrade['tip_text'] # Vlahnya
  1772. ids = effect['ids']
  1773. for _effect in js_effect:
  1774. if str(_effect['id']) in ids.split(','):
  1775. if not _effect['id'] == 237:
  1776. _effect_name = _effect['properties']['effect_name']
  1777. _effect_desc = _effect['description']\
  1778. .replace('\r\n', '')\
  1779. .replace('$(if not incoming_desc)Increases the damage of Champions ahead of $source by $(with_upgrade_bonus 1656,3 amount)% for each stack:$(fi)', '')\
  1780. .replace('$only_when_purchased (Current stacks: $(upgrade_stacks_num 1656,0)/$max_stacks at $(upgrade_bonus 1656,0)% effectiveness = $(active_upgrade_value_with_bonuses 1656,0 1656,3)%)', '')\
  1781. .replace('$only_when_purchased (Current stacks: $(upgrade_stacks_num 1656,1)/$max_stacks at $(upgrade_bonus 1656,1)% effectiveness = $(active_upgrade_value_with_bonuses 1656,1 ', '')\
  1782. .replace('$only_when_purchased (Current stacks: $(upgrade_stacks_num 1656,1)/$max_stacks at $(upgrade_bonus 1656,1)% effectiveness = $(active_upgrade_value_with_bonuses 1656,1 1656,3)%)', '')\
  1783. .replace('$only_when_purchased (Current stacks: $(upgrade_stacks_num 1656,2)/$max_stacks at $(upgrade_bonus 1656,2)% effectiveness = $(active_upgrade_value_with_bonuses 1656,2 1656,3)%)$(if not incoming_desc)Each trigger\'s stack decreases by 20% every 10 secondsTotal Bonus: $(active_upgrade_value 1656,3)%$(fi)', '')\
  1784. .replace('$base_stack_amount', str(_effect['effect_keys'][0]['base_stack_amount']))\
  1785. .replace('$source', name)
  1786. desc += '\n\n'
  1787. desc += ('* ' + _effect_name)
  1788. desc += '\n\n'
  1789. desc += (': ' + _effect_desc)
  1790. if isinstance(ab_table[upgrade['required_level']], list):
  1791. temp = {'unlockAbility': True}
  1792. temp['abTitle'] = desc
  1793. temp['abName'] = upgrade['name']
  1794. ab_table[upgrade['required_level']].append(temp)
  1795. elif not 'abTitle' in ab_table[upgrade['required_level']]:
  1796. ab_table[upgrade['required_level']]['abTitle'] = desc
  1797. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1798. else:
  1799. temp = ab_table[upgrade['required_level']]
  1800. ab_table[upgrade['required_level']] = []
  1801. ab_table[upgrade['required_level']].append(temp)
  1802. temp2 = {'unlockAbility': True}
  1803. temp2['abTitle'] = desc
  1804. temp2['abName'] = upgrade['name']
  1805. ab_table[upgrade['required_level']].append(temp2)
  1806. elif effect['key'] == 'reduce_upgrade_every_num_attacks': # Rosie
  1807. # print('reduce_upgrade_every_num_attacks')
  1808. # _effect = parse_effect
  1809. # desc = effect['desc']
  1810. for _effect_key in js_effect_key:
  1811. if effect['key'] == _effect_key['key']:
  1812. desc = _effect_key['descriptions']['desc']
  1813. desc = desc\
  1814. .replace('$(upgrade_hero id)', name)\
  1815. .replace('$(upgrade_name id)', effect['name'])\
  1816. .replace('$amount', effect['amount'])
  1817. ab_table[upgrade['required_level']]['abTitle'] = desc
  1818. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1819. elif effect['key'] in ['aila_storm_aura', 'storm_aura_storm_soul']: # Aila
  1820. # print('aila_storm_aura or storm_aura_storm_soul')
  1821. ab_table[upgrade['required_level']]['abTitle'] = upgrade['tip_text']
  1822. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1823. elif effect['key'] in [
  1824. 'storm_aura_shielding_storm', # Aila
  1825. 'storm_aura_raging_storm', # Aila
  1826. ]:
  1827. # print('storm_aura_shielding_storm')
  1828. # for _effect_key in js_effect_key:
  1829. # if effect['key'] == _effect_key['key']:
  1830. # desc = _effect_key['descriptions']['desc']
  1831. desc = effect['desc']
  1832. desc = desc\
  1833. .replace('$amount', effect['amount'])\
  1834. .replace('$(if not upgrade_purchased 2206)0.5 seconds$(or)', '')\
  1835. .replace('$(fi)', '')
  1836. ab_table[upgrade['required_level']]['abTitle'] = desc
  1837. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1838. elif 'specialization_name' in upgrade: # Nerys
  1839. pass
  1840. # print('spec, not unlock ability')
  1841. # ab_table[upgrade['required_level']]['REQUIRE'] = upgrade['name'] if not upgrade['name'] == '' else upgrade['specialization_name']
  1842. elif not effect['key'] in ['health_add']:
  1843. # print('unlock_ability but not health_add')
  1844. print(upgrade)
  1845. print(effect)
  1846. ab_table[upgrade['required_level']]['abTitle'] = effect['desc']
  1847. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1848. # Special Celeste Ability Unlock
  1849. elif upgrade['upgrade_type'] == 'increase_health':
  1850. effect = None
  1851. effect = parse_effect(upgrade['effect'])
  1852. if effect:
  1853. if effect['key'] == 'effect_def':
  1854. if not upgrade['required_level'] in ab_table:
  1855. ab_table[upgrade['required_level']] = {'unlockAbility': True}
  1856. desc = effect['desc']
  1857. desc = desc\
  1858. .replace('$target', name)\
  1859. .replace('$source', name)\
  1860. .replace('$(upgrade_hero id)', name)\
  1861. .replace('$(upgrade_name id)', effect['name'] if 'name' in effect else '')\
  1862. .replace(' $amount%', '')\
  1863. .replace(' $(amount)%', '')\
  1864. .replace(' $amount seconds', '')\
  1865. .replace(' $(amount) seconds', '')\
  1866. .replace(' for $(amount)', '')\
  1867. .replace(' for $amount', '')
  1868. if isinstance(ab_table[upgrade['required_level']], list):
  1869. temp = {'unlockAbility': True}
  1870. temp['abTitle'] = desc
  1871. temp['abName'] = upgrade['name']
  1872. ab_table[upgrade['required_level']].append(temp)
  1873. elif not 'abTitle' in ab_table[upgrade['required_level']]:
  1874. ab_table[upgrade['required_level']]['abTitle'] = desc
  1875. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1876. else:
  1877. temp = ab_table[upgrade['required_level']]
  1878. ab_table[upgrade['required_level']] = []
  1879. ab_table[upgrade['required_level']].append(temp)
  1880. temp2 = {'unlockAbility': True}
  1881. temp2['abTitle'] = desc
  1882. temp2['abName'] = upgrade['name']
  1883. ab_table[upgrade['required_level']].append(temp2)
  1884. # elif effect['key'] == 'buff_upgrade':
  1885. # for _upgrade in __upgrades:
  1886. # if (not upgrade['required_upgrade_id'] == 0) and (not upgrade['required_upgrade_id'] == 9999):
  1887. # if int(effect['id']) == _upgrade['id']:
  1888. # # print(_upgrade)
  1889. # # print(effect)
  1890. # _amount = effect['amount']
  1891. # # print(upgrade)
  1892. # # print(_upgrade)
  1893. # for __upgrade in __upgrades:
  1894. # if (not upgrade['required_upgrade_id'] == 0) and (not upgrade['required_upgrade_id'] == 9999):
  1895. # if upgrade['required_upgrade_id'] == __upgrade['id']:
  1896. # specname = __upgrade['specialization_name']
  1897. # # if 'specialization_name' in _upgrade:
  1898. # if not upgrade['required_level'] in ab_table:
  1899. # ab_table[upgrade['required_level']] = {}
  1900. # if isinstance(ab_table[upgrade['required_level']], list):
  1901. # # temp[effect['name']] = '{amount}'.format(amount=_amount)
  1902. # temp[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=specname, amount=_amount)
  1903. # ab_table[upgrade['required_level']].append(temp)
  1904. # elif not effect['name'] in ab_table[upgrade['required_level']]:
  1905. # # ab_table[upgrade['required_level']][effect['name']] = '{amount}'.format(amount=_amount)
  1906. # ab_table[upgrade['required_level']][effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=specname, amount=_amount)
  1907. # else:
  1908. # temp = ab_table[upgrade['required_level']]
  1909. # ab_table[upgrade['required_level']] = []
  1910. # ab_table[upgrade['required_level']].append(temp)
  1911. # temp2 = {}
  1912. # # temp2[effect['name']] = '{amount}'.format(amount=_amount)
  1913. # temp2[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=specname, amount=_amount)
  1914. # ab_table[upgrade['required_level']].append(temp2)
  1915. # Special Calliope Ability Unlock
  1916. elif upgrade['upgrade_type'] is None:
  1917. # if not upgrade['hero_id'] == 6: # If not Asharra
  1918. effect = None
  1919. effect = parse_effect(upgrade['effect'])
  1920. if effect:
  1921. if effect['key'] == 'effect_def':
  1922. if not upgrade['required_level'] in ab_table:
  1923. ab_table[upgrade['required_level']] = {'unlockAbility': True}
  1924. # print(ab_table[upgrade['required_level']])
  1925. ab_table[upgrade['required_level']]['abTitle'] = effect['desc']
  1926. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  1927. pass
  1928. # Asharra
  1929. elif effect['key'] == 'add_attack_targets': # Asharra
  1930. if not upgrade['required_level'] in ab_table:
  1931. ab_table[upgrade['required_level']] = {}
  1932. ab_table[upgrade['required_level']]['add_attack_targets'] = ' +' + effect['amount']
  1933. ab_table[upgrade['required_level']]['abName'] = 'add_attack_targets'
  1934. # Upgrade ability
  1935. elif upgrade['upgrade_type'] == 'upgrade_ability':
  1936. effect = None
  1937. effect = parse_effect(upgrade['effect'])
  1938. if effect:
  1939. if effect['key'] == 'add_attack_targets': # Asharra
  1940. if not upgrade['required_level'] in ab_table:
  1941. ab_table[upgrade['required_level']] = {}
  1942. ab_table[upgrade['required_level']]['add_attack_targets'] = ' +' + effect['amount']
  1943. ab_table[upgrade['required_level']]['abName'] = 'add_attack_targets'
  1944. if name == 'Asharra':
  1945. if effect['key'] == 'buff_upgrades': # Asharra Bond buff
  1946. if len(effect['ids']) == 3:
  1947. if not upgrade['required_level'] in ab_table:
  1948. ab_table[upgrade['required_level']] = {}
  1949. ab_table[upgrade['required_level']]['spec1upg'] = effect['amount'] + '%'
  1950. ab_table[upgrade['required_level']]['abName'] = 'spec1upg'
  1951. elif len(effect['ids']) == 6:
  1952. if not upgrade['required_level'] in ab_table:
  1953. ab_table[upgrade['required_level']] = {}
  1954. ab_table[upgrade['required_level']]['spec2upg'] = effect['amount'] + '%'
  1955. ab_table[upgrade['required_level']]['spec1upg'] = effect['amount'] + '%'
  1956. ab_table[upgrade['required_level']]['abName'] = 'spec2upg'
  1957. else:
  1958. print('ugh')
  1959. elif name == 'Minsc':
  1960. if effect['key'] == 'buff_upgrades': # Asharra Bond buff
  1961. if len(effect['ids']) == 5:
  1962. if not upgrade['required_level'] in ab_table:
  1963. ab_table[upgrade['required_level']] = {}
  1964. ab_table[upgrade['required_level']]['specupg'] = effect['amount'] + '%'
  1965. ab_table[upgrade['required_level']]['abName'] = 'specupg'
  1966. elif name == 'Regis':
  1967. if effect['key'] == 'buff_upgrades': # Asharra Bond buff
  1968. if len(effect['ids']) == 2:
  1969. if not upgrade['required_level'] in ab_table:
  1970. ab_table[upgrade['required_level']] = {}
  1971. ab_table[upgrade['required_level']]['spec1upg'] = effect['amount'] + '%'
  1972. ab_table[upgrade['required_level']]['abName'] = 'spec1upg'
  1973. elif len(effect['ids']) == 3:
  1974. if not upgrade['required_level'] in ab_table:
  1975. ab_table[upgrade['required_level']] = {}
  1976. ab_table[upgrade['required_level']]['spec2upg'] = effect['amount'] + '%'
  1977. # ab_table[upgrade['required_level']]['spec1upg'] = effect['amount'] + '%'
  1978. ab_table[upgrade['required_level']]['abName'] = 'spec2upg'
  1979. else:
  1980. print('ugh')
  1981. exit()
  1982. elif name == 'Zorbu':
  1983. if effect['key'] == 'buff_upgrade': # Asharra Bond buff
  1984. if effect['id'] in ['843', '844', '845', '846', '847']:
  1985. if not upgrade['required_level'] in ab_table:
  1986. ab_table[upgrade['required_level']] = {}
  1987. ab_table[upgrade['required_level']]['spec1upg'] = effect['amount']
  1988. ab_table[upgrade['required_level']]['abName'] = 'spec1upg'
  1989. elif effect['id'] in ['850', '851']:
  1990. if not upgrade['required_level'] in ab_table:
  1991. ab_table[upgrade['required_level']] = {}
  1992. ab_table[upgrade['required_level']]['spec2upg'] = effect['amount']
  1993. ab_table[upgrade['required_level']]['abName'] = 'spec2upg'
  1994. elif name =='Gromma':
  1995. if effect['key'] == 'effect_def':
  1996. if not upgrade['required_level'] in ab_table:
  1997. ab_table[upgrade['required_level']] = {'unlockAbility': True}
  1998. # print(ab_table[upgrade['required_level']])
  1999. _effect = None
  2000. _effect = parse_effect(upgrade['effect'])
  2001. desc = _effect['desc']
  2002. desc = desc\
  2003. .replace('$target', name)\
  2004. .replace('$source', name)\
  2005. .replace('$(upgrade_hero id)', name)\
  2006. .replace('$(upgrade_name id)', effect['name'] if 'name' in effect else '')
  2007. # .replace('$amount', _effect['amount'])
  2008. if isinstance(ab_table[upgrade['required_level']], list):
  2009. temp = {'unlockAbility': True}
  2010. temp['abTitle'] = desc
  2011. temp['abName'] = upgrade['name']
  2012. ab_table[upgrade['required_level']].append(temp)
  2013. elif not 'abTitle' in ab_table[upgrade['required_level']]:
  2014. ab_table[upgrade['required_level']]['abTitle'] = desc
  2015. ab_table[upgrade['required_level']]['abName'] = upgrade['name']
  2016. else:
  2017. temp = ab_table[upgrade['required_level']]
  2018. ab_table[upgrade['required_level']] = []
  2019. ab_table[upgrade['required_level']].append(temp)
  2020. temp2 = {'unlockAbility': True}
  2021. temp2['abTitle'] = desc
  2022. temp2['abName'] = upgrade['name']
  2023. ab_table[upgrade['required_level']].append(temp2)
  2024. # print(ab_table[upgrade['required_level']])
  2025. elif name == 'Ishi':
  2026. if effect['key'] == 'buff_upgrade': # Asharra Bond buff
  2027. if effect['id'] in ['1239', '1240']:
  2028. if not upgrade['required_level'] in ab_table:
  2029. ab_table[upgrade['required_level']] = {}
  2030. ab_table[upgrade['required_level']]['spec1upg'] = effect['amount']
  2031. ab_table[upgrade['required_level']]['abName'] = 'spec1upg'
  2032. elif effect['id'] in ['1243', '1244', '1245']:
  2033. if not upgrade['required_level'] in ab_table:
  2034. ab_table[upgrade['required_level']] = {}
  2035. ab_table[upgrade['required_level']]['spec2upg'] = effect['amount']
  2036. ab_table[upgrade['required_level']]['abName'] = 'spec2upg'
  2037. # If Ultimate
  2038. effect = None
  2039. effect = parse_effect(upgrade['effect'])
  2040. if effect:
  2041. if effect['key'] == 'set_ultimate_attack':
  2042. # print('ultimate')
  2043. if not upgrade['required_level'] in ab_table:
  2044. ab_table[upgrade['required_level']] = {'unlockUltimate': True}
  2045. for attack in js_attack:
  2046. if str(attack['id']) == effect['id']:
  2047. desc = effect['desc']
  2048. desc = desc.replace('$ishi_ult_time', '15') # Ishi
  2049. ab_table[upgrade['required_level']]['abTitle'] = desc
  2050. ab_table[upgrade['required_level']]['abName'] = effect['name']
  2051. elif (id_ == 43 and upgrade['upgrade_type'] == 'unlock_ultimate'):
  2052. if not upgrade['required_level'] in ab_table:
  2053. ab_table[upgrade['required_level']] = {'unlockUltimate': True}
  2054. for _effect in js_effect:
  2055. if int(effect['id']) == _effect['id']:
  2056. effect_string = _effect['effect_keys'][0]['effect_string']
  2057. __effect = parse_effect(effect_string)
  2058. ab_table[upgrade['required_level']]['abTitle'] = desc
  2059. ab_table[upgrade['required_level']]['abName'] = __effect['name']
  2060. # If Damage
  2061. effect = None
  2062. effect = parse_effect(upgrade['effect'])
  2063. if effect:
  2064. if effect['key'] == 'hero_dps_multiplier_mult':
  2065. # print('ifdamage')
  2066. if not upgrade['required_level'] in ab_table:
  2067. ab_table[upgrade['required_level']] = {}
  2068. if (not upgrade['required_upgrade_id'] == 0) and (not upgrade['required_upgrade_id'] == 9999):
  2069. for _upgrade in __upgrades:
  2070. if not _upgrade['required_level'] == 9999:
  2071. if (not upgrade['required_upgrade_id'] == 0) and (not upgrade['required_upgrade_id'] == 9999):
  2072. if upgrade['required_upgrade_id'] == _upgrade['id']:
  2073. specname = _upgrade['specialization_name']
  2074. ab_table[upgrade['required_level']]['dmg'] = '{{{{Spec|{spec}|{amount}%}}}}'.format(spec=specname, amount=effect['amount'])
  2075. else:
  2076. ab_table[upgrade['required_level']]['dmg'] = effect['amount'] + '%'
  2077. # If Damage All
  2078. effect = None
  2079. effect = parse_effect(upgrade['effect'])
  2080. if effect:
  2081. if effect['key'] == 'global_dps_multiplier_mult':
  2082. # print('ifdamageall')
  2083. if not upgrade['required_level'] in ab_table:
  2084. ab_table[upgrade['required_level']] = {}
  2085. if (not upgrade['required_upgrade_id'] == 0) and (not upgrade['required_upgrade_id'] == 9999):
  2086. for _upgrade in __upgrades:
  2087. if not _upgrade['required_level'] == 9999:
  2088. if (not upgrade['required_upgrade_id'] == 0) and (not upgrade['required_upgrade_id'] == 9999):
  2089. if upgrade['required_upgrade_id'] == _upgrade['id']:
  2090. specname = _upgrade['specialization_name']
  2091. ab_table[upgrade['required_level']]['dmg_all'] = '{{{{Spec|{spec}|{amount}%}}}}'.format(spec=specname, amount=effect['amount'])
  2092. else:
  2093. ab_table[upgrade['required_level']]['dmg_all'] = effect['amount'] + '%'
  2094. # If Gold Mult
  2095. effect = None
  2096. effect = parse_effect(upgrade['effect'])
  2097. if effect:
  2098. if effect['key'] == 'gold_multiplier_mult':
  2099. # print('ifgoldX')
  2100. if not upgrade['required_level'] in ab_table:
  2101. ab_table[upgrade['required_level']] = {}
  2102. ab_table[upgrade['required_level']]['GoldFind'] = effect['amount'] + '%'
  2103. # If health
  2104. effect = None
  2105. effect = parse_effect(upgrade['effect'])
  2106. if effect:
  2107. if effect['key'] == 'health_add':
  2108. # print('health')
  2109. if not upgrade['required_level'] in ab_table:
  2110. ab_table[upgrade['required_level']] = {}
  2111. # if 'tanking' in hero['tags']:
  2112. # ab_table[upgrade['required_level']]['Health'] = ' +' + effect['amount']
  2113. ###################print(effect)
  2114. ###################print(upgrade)
  2115. spec = None
  2116. for _upgrade in __upgrades:
  2117. # print(upgrade['required_upgrade_id'], _upgrade['id'])
  2118. if upgrade['required_upgrade_id'] == _upgrade['id']:
  2119. spec = _upgrade['specialization_name']
  2120. _amount = effect['amount']
  2121. if isinstance(ab_table[upgrade['required_level']], list):
  2122. temp['Health'] = '{{{{Spec|{spec}|+{amount}}}}}'.format(spec=spec, amount=_amount)
  2123. ab_table[upgrade['required_level']].append(temp)
  2124. elif not 'Health' in ab_table[upgrade['required_level']]:
  2125. # ab_table[upgrade['required_level']]['Health'] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=spec, amount=_amount)
  2126. if spec is None:
  2127. ab_table[upgrade['required_level']]['Health'] = ' +{amount}'.format(amount=_amount)
  2128. else:
  2129. ab_table[upgrade['required_level']]['Health'] = '{{{{Spec|{spec}|+{amount}}}}}'.format(spec=spec, amount=_amount)
  2130. else:
  2131. temp = ab_table[upgrade['required_level']]
  2132. ab_table[upgrade['required_level']] = []
  2133. ab_table[upgrade['required_level']].append(temp)
  2134. temp2 = {}
  2135. # temp2['Health'] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=spec, amount=_amount)
  2136. temp2['Health'] = '{{{{Spec|{spec}|+{amount}}}}}'.format(spec=spec, amount=_amount)
  2137. ab_table[upgrade['required_level']].append(temp2)
  2138. # If spec upgrade
  2139. effect = None
  2140. effect = parse_effect(upgrade['effect'])
  2141. if effect:
  2142. if effect['key'] == 'buff_upgrade':
  2143. # print('spec upgrade')
  2144. if not upgrade['required_level'] in ab_table:
  2145. ab_table[upgrade['required_level']] = {}
  2146. _unit = effect['unit'] if 'unit' in effect else ''
  2147. _amount = effect['amount'] + _unit
  2148. if 'specialization_name' in upgrade:
  2149. _spec = upgrade['specialization_name']
  2150. if isinstance(ab_table[upgrade['required_level']], list):
  2151. temp[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=_spec, amount=_amount)
  2152. ab_table[upgrade['required_level']].append(temp)
  2153. # print(id_, 'spec_upg', name, upgrade)
  2154. elif not effect['name'] in ab_table[upgrade['required_level']]:
  2155. ab_table[upgrade['required_level']][effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=_spec, amount=_amount)
  2156. # print(id_, 'spec_upg', name, upgrade)
  2157. else:
  2158. temp = ab_table[upgrade['required_level']]
  2159. ab_table[upgrade['required_level']] = []
  2160. ab_table[upgrade['required_level']].append(temp)
  2161. temp2 = {}
  2162. temp2[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=_spec, amount=_amount)
  2163. ab_table[upgrade['required_level']].append(temp2)
  2164. # print(id_, 'spec_upg', name, upgrade)
  2165. else:
  2166. for _upgrade in __upgrades:
  2167. if not _upgrade['required_level'] == 9999:
  2168. if (not upgrade['required_upgrade_id'] == 0) and (not upgrade['required_upgrade_id'] == 9999):
  2169. if 'specialization_name' in _upgrade:
  2170. _effect = parse_effect(_upgrade['effect'])
  2171. if _effect['key'] == 'buff_upgrade':
  2172. if not name in ['Catti-brie', 'Hitch']:
  2173. if isinstance(ab_table[upgrade['required_level']], list):
  2174. temp[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount)
  2175. ab_table[upgrade['required_level']].append(temp)
  2176. # print(id_, '~~~~~~~~~~~~', name, upgrade, _upgrade, _effect)
  2177. # print('{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount))
  2178. elif not effect['name'] in ab_table[upgrade['required_level']]:
  2179. ab_table[upgrade['required_level']][effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount)
  2180. # print(id_, '~~~~~~~~~~~~', name, upgrade, _upgrade, _effect)
  2181. # print('{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount))
  2182. else:
  2183. temp = ab_table[upgrade['required_level']]
  2184. ab_table[upgrade['required_level']] = []
  2185. ab_table[upgrade['required_level']].append(temp)
  2186. temp2 = {}
  2187. temp2[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount)
  2188. ab_table[upgrade['required_level']].append(temp2)
  2189. # print(id_, '~~~~~~~~~~~~', name, upgrade, _upgrade, _effect)
  2190. # print('{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount))
  2191. elif int(effect['id']) == _upgrade['id']:
  2192. if not name in ['Zorbu', 'Ishi']:
  2193. if isinstance(ab_table[upgrade['required_level']], list):
  2194. temp[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount)
  2195. ab_table[upgrade['required_level']].append(temp)
  2196. # print(id_, '*************', name, upgrade, _upgrade, effect)
  2197. # print('{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount))
  2198. elif not effect['name'] in ab_table[upgrade['required_level']]:
  2199. ab_table[upgrade['required_level']][effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount)
  2200. # print(id_, '*************', name, upgrade, _upgrade, effect)
  2201. # print('{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount))
  2202. else:
  2203. temp = ab_table[upgrade['required_level']]
  2204. ab_table[upgrade['required_level']] = []
  2205. ab_table[upgrade['required_level']].append(temp)
  2206. temp2 = {}
  2207. temp2[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount)
  2208. ab_table[upgrade['required_level']].append(temp2)
  2209. # print(id_, '*************', name, upgrade, _upgrade, effect)
  2210. # print('{{{{Spec|{spec}|{amount}}}}}'.format(spec=_upgrade['specialization_name'], amount=_amount))
  2211. elif int(effect['id']) == _upgrade['id']:
  2212. # if name not in ['Gromma']:
  2213. for __upgrade in __upgrades:
  2214. if not __upgrade['required_level'] == 9999:
  2215. if (not upgrade['required_upgrade_id'] == 0) and (not upgrade['required_upgrade_id'] == 9999):
  2216. if upgrade['required_upgrade_id'] == __upgrade['id']:
  2217. specname = __upgrade['specialization_name']
  2218. # print("I\'m here")
  2219. # print(specname)
  2220. if isinstance(ab_table[upgrade['required_level']], list):
  2221. temp = {}
  2222. temp[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=specname, amount=_amount)
  2223. # print('before', ab_table[upgrade['required_level']])
  2224. ab_table[upgrade['required_level']].append(temp)
  2225. # print('after', ab_table[upgrade['required_level']])
  2226. # print(id_, 'onlybuffupg_reqid_nospec_if', name, upgrade)
  2227. # print(id_, 'onlybuffupg_reqid_nospec_if', name, '\t', _upgrade)
  2228. # print(id_, 'onlybuffupg_reqid_nospec_if', name, '\t\t', ab_table[upgrade['required_level']])
  2229. # print(id_, 'onlybuffupg_reqid_nospec_if', name, '\t\t\t', effect)
  2230. # print(id_, 'onlybuffupg_reqid_nospec_if', name, '\t\t\t\t', specname)
  2231. elif not effect['name'] in ab_table[upgrade['required_level']]:
  2232. # print('before', ab_table[upgrade['required_level']])
  2233. ab_table[upgrade['required_level']][effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=specname, amount=_amount)
  2234. # print('after', ab_table[upgrade['required_level']])
  2235. # print(id_, 'onlybuffupg_reqid_nospec_elif', name, upgrade)
  2236. # print(id_, 'onlybuffupg_reqid_nospec_elif', name, '\t', _upgrade)
  2237. # print(id_, 'onlybuffupg_reqid_nospec_elif', name, '\t\t', ab_table[upgrade['required_level']])
  2238. # print(id_, 'onlybuffupg_reqid_nospec_elif', name, '\t\t\t', effect)
  2239. # print(id_, 'onlybuffupg_reqid_nospec_elif', name, '\t\t\t\t', specname)
  2240. else:
  2241. temp = None
  2242. temp = ab_table[upgrade['required_level']]
  2243. ab_table[upgrade['required_level']] = []
  2244. ab_table[upgrade['required_level']].append(temp)
  2245. temp2 = {}
  2246. temp2[effect['name']] = '{{{{Spec|{spec}|{amount}}}}}'.format(spec=specname, amount=_amount)
  2247. # print('before', ab_table[upgrade['required_level']])
  2248. ab_table[upgrade['required_level']].append(temp2)
  2249. # print('after', ab_table[upgrade['required_level']])
  2250. # print(id_, 'onlybuffupg_reqid_nospec_else', name, upgrade)
  2251. # print(id_, 'onlybuffupg_reqid_nospec_else', name, '\t', _upgrade)
  2252. # print(id_, 'onlybuffupg_reqid_nospec_else', name, '\t\t', ab_table[upgrade['required_level']])
  2253. # print(id_, 'onlybuffupg_reqid_nospec_else', name, '\t\t\t', effect)
  2254. # print(id_, 'onlybuffupg_reqid_nospec_else', name, '\t\t\t\t', specname)
  2255. elif upgrade['required_upgrade_id'] == 0:
  2256. if int(effect['id']) == _upgrade['id']:
  2257. if isinstance(ab_table[upgrade['required_level']], list):
  2258. temp[effect['name']] = '{amount}'.format(amount=_amount)
  2259. ab_table[upgrade['required_level']].append(temp)
  2260. # print(id_, 'onlybuffupg_special_case', name, upgrade)
  2261. elif not effect['name'] in ab_table[upgrade['required_level']]:
  2262. ab_table[upgrade['required_level']][effect['name']] = '{amount}'.format(amount=_amount)
  2263. # print(id_, 'onlybuffupg_special_case', name, upgrade)
  2264. else:
  2265. temp = ab_table[upgrade['required_level']]
  2266. ab_table[upgrade['required_level']] = []
  2267. ab_table[upgrade['required_level']].append(temp)
  2268. temp2 = {}
  2269. temp2[effect['name']] = '{amount}'.format(amount=_amount)
  2270. ab_table[upgrade['required_level']].append(temp2)
  2271. # print(id_, 'onlybuffupg_special_case', name, upgrade)
  2272. # print('\n')
  2273. # Buff Ultimate
  2274. effect = None
  2275. effect = parse_effect(upgrade['effect'])
  2276. if effect:
  2277. if effect['key'] == 'buff_ultimate':
  2278. # print('buff ultimate')
  2279. if not upgrade['required_level'] in ab_table:
  2280. ab_table[upgrade['required_level']] = {}
  2281. ab_table[upgrade['required_level']]['buffUlt'] = effect['amount'] + '%'
  2282. # Increase targets and damage
  2283. effect = None
  2284. effect = parse_effect(upgrade['effect'])
  2285. if effect:
  2286. if effect['key'] == 'add_attack_nearby_targets':
  2287. # print('add_attack_nearby_targets')
  2288. if not upgrade['required_level'] in ab_table:
  2289. ab_table[upgrade['required_level']] = {}
  2290. ab_table[upgrade['required_level']]['incTarAmt'] = '+' + effect['targets']
  2291. ab_table[upgrade['required_level']]['incTarDmg'] = effect['amount'] + '%'
  2292. # Reduce overwhelm effect
  2293. effect = None
  2294. effect = parse_effect(upgrade['effect'])
  2295. if effect:
  2296. if effect['key'] == 'reduce_overwhelm_effect':
  2297. # print('reduce_overwhelm_effect')
  2298. if not upgrade['required_level'] in ab_table:
  2299. ab_table[upgrade['required_level']] = {}
  2300. ab_table[upgrade['required_level']]['redOverwhelm'] = effect['amount'] + '%'
  2301. # Increase AOE Radius
  2302. effect = None
  2303. effect = parse_effect(upgrade['effect'])
  2304. if effect:
  2305. if effect['key'] == 'increase_aoe_radius':
  2306. # print('increase_aoe_radius')
  2307. if not upgrade['required_level'] in ab_table:
  2308. ab_table[upgrade['required_level']] = {}
  2309. ab_table[upgrade['required_level']]['incAOERad'] = effect['amount'] + '%'
  2310. # Increase AOE Radius
  2311. effect = None
  2312. effect = parse_effect(upgrade['effect'])
  2313. if effect:
  2314. if effect['key'] == 'increase_stun_time':
  2315. # print('increase_stun_time')
  2316. if not upgrade['required_level'] in ab_table:
  2317. ab_table[upgrade['required_level']] = {}
  2318. ab_table[upgrade['required_level']]['incStunTime'] = effect['amount'] + ' sec'
  2319. # Buff Crit Chance
  2320. effect = None
  2321. effect = parse_effect(upgrade['effect'])
  2322. if effect:
  2323. if effect['key'] == 'buff_crit_chance':
  2324. # print('buff_crit_chance')
  2325. if not upgrade['required_level'] in ab_table:
  2326. ab_table[upgrade['required_level']] = {}
  2327. # print(ab_table[upgrade['required_level']])
  2328. # ab_table[upgrade['required_level']]['CritChance'] = effect['amount']
  2329. if isinstance(ab_table[upgrade['required_level']], list):
  2330. temp = {}
  2331. temp['CritChance'] = effect['amount']
  2332. ab_table[upgrade['required_level']].append(temp)
  2333. elif not 'abTitle' in ab_table[upgrade['required_level']]:
  2334. ab_table[upgrade['required_level']]['CritChance'] = effect['amount']
  2335. else:
  2336. temp = ab_table[upgrade['required_level']]
  2337. ab_table[upgrade['required_level']] = []
  2338. ab_table[upgrade['required_level']].append(temp)
  2339. temp2 = {}
  2340. temp2['CritChance'] = effect['amount']
  2341. ab_table[upgrade['required_level']].append(temp2)
  2342. # Buff Extra attack chance
  2343. effect = None
  2344. effect = parse_effect(upgrade['effect'])
  2345. if effect:
  2346. if effect['key'] == 'buff_binwin_multi_attack_chance':
  2347. # print('buff_binwin_multi_attack_chance')
  2348. if not upgrade['required_level'] in ab_table:
  2349. ab_table[upgrade['required_level']] = {}
  2350. ab_table[upgrade['required_level']]['ExtraAtkChance'] = effect['amount']
  2351. # Buff Upgrade base stack
  2352. effect = None
  2353. effect = parse_effect(upgrade['effect'])
  2354. if effect:
  2355. if effect['key'] == 'buff_upgrade_base_stack':
  2356. # print('buff_upgrade_base_stack')
  2357. if not upgrade['required_level'] in ab_table:
  2358. ab_table[upgrade['required_level']] = {}
  2359. # ab_table[upgrade['required_level']
  2360. # ]['buff_upgrade_base_stack'] = effect['amount']
  2361. ab_table[upgrade['required_level']]['buff_upgrade_base_stack'] = effect['amount']
  2362. # buff_aila_ult_bonus_dmg
  2363. effect = None
  2364. effect = parse_effect(upgrade['effect'])
  2365. if effect:
  2366. if effect['key'] == 'buff_aila_ult_bonus_dmg':
  2367. # print('buff_aila_ult_bonus_dmg')
  2368. if not upgrade['required_level'] in ab_table:
  2369. ab_table[upgrade['required_level']] = {}
  2370. ab_table[upgrade['required_level']
  2371. ]['buffUlt'] = effect['amount'] + '%'
  2372. # Calliope College of Lore
  2373. effect = None
  2374. effect = parse_effect(upgrade['effect'])
  2375. if effect:
  2376. if effect['key'] == 'temporary_hp_cooldown_reduce':
  2377. # print('buff_aila_ult_bonus_dmg')
  2378. if not upgrade['required_level'] in ab_table:
  2379. ab_table[upgrade['required_level']] = {}
  2380. ab_table[upgrade['required_level']
  2381. ]['tempHPCDred'] = effect['amount'] + ' secs'
  2382. # Do Nothing
  2383. effect = None
  2384. effect = parse_effect(upgrade['effect'])
  2385. if effect:
  2386. if effect['key'] in [
  2387. # 'owner_killing_blow_gold_bonus',
  2388. # 'increase_num_unique_hits',
  2389. 'buff_chance_attack_miss',
  2390. 'buff_attack_stun_chance',
  2391. 'reduce_hordesperson_drops',
  2392. 'add_sneak_attack_hit',
  2393. 'reduce_storm_aura_seconds',
  2394. ]:
  2395. pass
  2396. if PRINT_TABLE is True:
  2397. pprint(ab_table)
  2398. if PRINT_MISSING_ROWS is True:
  2399. print(name, 'PRINT_MISSING_ROWS')
  2400. for upgrade in __upgrades:
  2401. if not upgrade['required_level'] == 9999:
  2402. if not upgrade['required_level'] in ab_table:
  2403. print(upgrade)
  2404. if ab_table[upgrade['required_level']] == {}:
  2405. print(upgrade)
  2406. #######################################################################
  2407. # Finish abilities section
  2408. gained_abilities = ''
  2409. gained_abilities_template = '''
  2410. \'\'\'{ability_name} - Ability\'\'\'
  2411. {ability_description}
  2412. '''
  2413. for entry in ab_table:
  2414. # print(isinstance(ab_table[entry], list))
  2415. if isinstance(ab_table[entry], list):
  2416. for listitem in ab_table[entry]:
  2417. # print(listitem)
  2418. if ('unlockAbility' in listitem) and (not 'unlockSpec' in listitem):
  2419. gained_abilities += gained_abilities_template.format(
  2420. ability_name=listitem['abName'],
  2421. ability_description=listitem['abTitle'],
  2422. )
  2423. elif ('unlockAbility' in ab_table[entry]) and (not 'unlockSpec' in ab_table[entry]):
  2424. # pprint(ab_table)
  2425. gained_abilities += gained_abilities_template.format(
  2426. ability_name=ab_table[entry]['abName'],
  2427. ability_description=ab_table[entry]['abTitle'],
  2428. )
  2429. # Specializations
  2430. _specs = []
  2431. for upgrade in js_upgrade:
  2432. if upgrade['hero_id'] == id_:
  2433. if 'specialization_name' in upgrade:
  2434. _specs.append((upgrade['specialization_name'],
  2435. upgrade['specialization_description']))
  2436. spec_1 = _specs[0][0] if len(_specs) >= 1 else ''
  2437. spec_desc_1 = _specs[0][1] if len(_specs) >= 1 else ''
  2438. spec_2 = _specs[1][0] if len(_specs) >= 2 else ''
  2439. spec_desc_2 = _specs[1][1] if len(_specs) >= 2 else ''
  2440. spec_3 = _specs[2][0] if len(_specs) >= 3 else ''
  2441. spec_desc_3 = _specs[2][1] if len(_specs) >= 3 else ''
  2442. spec_4 = _specs[3][0] if len(_specs) >= 4 else ''
  2443. spec_desc_4 = _specs[3][1] if len(_specs) >= 4 else ''
  2444. spec_5 = _specs[4][0] if len(_specs) >= 5 else ''
  2445. spec_desc_5 = _specs[4][1] if len(_specs) >= 5 else ''
  2446. spec_6 = _specs[5][0] if len(_specs) >= 6 else ''
  2447. spec_desc_6 = _specs[5][1] if len(_specs) >= 6 else ''
  2448. spec_7 = _specs[6][0] if len(_specs) >= 7 else ''
  2449. spec_desc_7 = _specs[6][1] if len(_specs) >= 7 else ''
  2450. if name == 'Minsc':
  2451. abilities = abilities.format(
  2452. a_base=a_base,
  2453. a_base_desc=a_base_desc,
  2454. a_ult=a_ult,
  2455. a_ult_desc=a_ult_desc,
  2456. spec_1=spec_1,
  2457. spec_desc_1=spec_desc_1,
  2458. spec_2=spec_2,
  2459. spec_desc_2=spec_desc_2,
  2460. spec_3=spec_3,
  2461. spec_desc_3=spec_desc_3,
  2462. spec_4=spec_4,
  2463. spec_desc_4=spec_desc_4,
  2464. spec_5=spec_5,
  2465. spec_desc_5=spec_desc_5,
  2466. gained_abilities=gained_abilities,
  2467. )
  2468. elif name == 'Asharra':
  2469. abilities = abilities.format(
  2470. a_base=a_base,
  2471. a_base_desc=a_base_desc,
  2472. a_ult=a_ult,
  2473. a_ult_desc=a_ult_desc,
  2474. spec_1=spec_1,
  2475. spec_desc_1=spec_desc_1,
  2476. spec_2=spec_2,
  2477. spec_desc_2=spec_desc_2,
  2478. spec_3=spec_3,
  2479. spec_desc_3=spec_desc_3,
  2480. spec_4=spec_4,
  2481. spec_desc_4=spec_desc_4,
  2482. spec_5=spec_5,
  2483. spec_desc_5=spec_desc_5,
  2484. spec_6=spec_6,
  2485. spec_desc_6=spec_desc_6,
  2486. gained_abilities=gained_abilities,
  2487. )
  2488. elif name == 'Tyril':
  2489. abilities = abilities.format(
  2490. a_base_1=a_base_1,
  2491. a_base_1_desc=a_base_1_desc,
  2492. a_ult_1=a_ult_1,
  2493. a_ult_1_desc=a_ult_1_desc,
  2494. a_base_2=a_base_2,
  2495. a_base_2_desc=a_base_2_desc,
  2496. a_ult_2=a_ult_2,
  2497. a_ult_2_desc=a_ult_2_desc,
  2498. spec_1=spec_1,
  2499. spec_desc_1=spec_desc_1,
  2500. spec_2=spec_2,
  2501. spec_desc_2=spec_desc_2,
  2502. gained_abilities=gained_abilities,
  2503. )
  2504. elif name in [
  2505. 'Krond',
  2506. 'Gromma',
  2507. 'Birdsong',
  2508. ]:
  2509. abilities = abilities.format(
  2510. a_base=a_base,
  2511. a_base_desc=a_base_desc,
  2512. a_ult=a_ult,
  2513. a_ult_desc=a_ult_desc,
  2514. spec_1=spec_1,
  2515. spec_desc_1=spec_desc_1,
  2516. spec_2=spec_2,
  2517. spec_desc_2=spec_desc_2,
  2518. spec_3=spec_3,
  2519. spec_desc_3=spec_desc_3,
  2520. gained_abilities=gained_abilities,
  2521. )
  2522. elif name in [
  2523. 'Regis',
  2524. 'Ishi',
  2525. ]:
  2526. abilities = abilities.format(
  2527. a_base=a_base,
  2528. a_base_desc=a_base_desc,
  2529. a_ult=a_ult,
  2530. a_ult_desc=a_ult_desc,
  2531. spec_1=spec_1,
  2532. spec_desc_1=spec_desc_1,
  2533. spec_2=spec_2,
  2534. spec_desc_2=spec_desc_2,
  2535. spec_3=spec_3,
  2536. spec_desc_3=spec_desc_3,
  2537. spec_4=spec_4,
  2538. spec_desc_4=spec_desc_4,
  2539. spec_5=spec_5,
  2540. spec_desc_5=spec_desc_5,
  2541. gained_abilities=gained_abilities,
  2542. )
  2543. elif name == 'Zorbu':
  2544. abilities = abilities.format(
  2545. a_base=a_base,
  2546. a_base_desc=a_base_desc,
  2547. a_ult=a_ult,
  2548. a_ult_desc=a_ult_desc,
  2549. spec_1=spec_1,
  2550. spec_desc_1=spec_desc_1,
  2551. spec_2=spec_2,
  2552. spec_desc_2=spec_desc_2,
  2553. spec_3=spec_3,
  2554. spec_desc_3=spec_desc_3,
  2555. spec_4=spec_4,
  2556. spec_desc_4=spec_desc_4,
  2557. spec_5=spec_5,
  2558. spec_desc_5=spec_desc_5,
  2559. spec_6=spec_6,
  2560. spec_desc_6=spec_desc_6,
  2561. spec_7=spec_7,
  2562. spec_desc_7=spec_desc_7,
  2563. gained_abilities=gained_abilities,
  2564. )
  2565. elif name == 'Wulfgar':
  2566. abilities = abilities.format(
  2567. a_base=a_base,
  2568. a_base_desc=a_base_desc,
  2569. a_ult=a_ult,
  2570. a_ult_desc=a_ult_desc,
  2571. spec_1=spec_1,
  2572. spec_desc_1=spec_desc_1,
  2573. spec_2=spec_2,
  2574. spec_desc_2=spec_desc_2,
  2575. spec_3=spec_3,
  2576. spec_desc_3=spec_desc_3,
  2577. gained_abilities=gained_abilities,
  2578. )
  2579. elif name == 'Walnut':
  2580. abilities = abilities.format(
  2581. a_base=a_base,
  2582. a_base_desc=a_base_desc,
  2583. a_ult=a_ult,
  2584. a_ult_desc=a_ult_desc,
  2585. spec_1=spec_1,
  2586. spec_desc_1=spec_desc_1,
  2587. spec_2=spec_2,
  2588. spec_desc_2=spec_desc_2,
  2589. spec_3=spec_3,
  2590. spec_desc_3=spec_desc_3,
  2591. spec_4=spec_4,
  2592. spec_desc_4=spec_desc_4,
  2593. spec_5=spec_5,
  2594. spec_desc_5=spec_desc_5,
  2595. gained_abilities=gained_abilities,
  2596. )
  2597. else:
  2598. abilities = abilities.format(
  2599. a_base=a_base,
  2600. a_base_desc=a_base_desc,
  2601. a_ult=a_ult,
  2602. a_ult_desc=a_ult_desc,
  2603. spec_1=spec_1,
  2604. spec_desc_1=spec_desc_1,
  2605. spec_2=spec_2,
  2606. spec_desc_2=spec_desc_2,
  2607. gained_abilities=gained_abilities,
  2608. )
  2609. # Finish abilities section
  2610. #######################################################################
  2611. table_contents = [
  2612. 'cost',
  2613. 'dmg',
  2614. 'dmg_all',
  2615. 'ult',
  2616. 'unlockAbility',
  2617. 'unlockUltimate',
  2618. 'unlockSpec',
  2619. 'abTitle',
  2620. 'abName',
  2621. 'buffUlt',
  2622. ]
  2623. # Wikitable
  2624. _wikitable = '''| class="wikitable levels-table" style="text-align:center"
  2625. |-
  2626. ! width="75px" | Level
  2627. ! width="75px" | <abbr title="Cost of gold form previous skill-unlock to this.">Cost</abbr>
  2628. ! Damage
  2629. ! Damage All
  2630. '''.format(a_ult=a_ult)
  2631. # Wikitable columns
  2632. spec_set = []
  2633. add_these_specs = []
  2634. abilities_set = []
  2635. new_columns = []
  2636. for _upgrade in __upgrades:
  2637. if 'specialization_name' in _upgrade:
  2638. if _upgrade['name'] == _upgrade['specialization_name']:
  2639. spec_set.append(_upgrade['name'])
  2640. ult_name = ''
  2641. for entry in ab_table:
  2642. if 'abName' in ab_table[entry]:
  2643. if 'unlockUltimate' in ab_table[entry]:
  2644. _wikitable += '! <abbr title="Ultimate Attack">{ability_name}</abbr>\n'.format(
  2645. ability_name=ab_table[entry]['abName'])
  2646. ult_name = ab_table[entry]['abName']
  2647. for entry in ab_table:
  2648. if isinstance(ab_table[entry], list):
  2649. for listitem in ab_table[entry]:
  2650. if ('unlockAbility' in listitem) and (not 'unlockSpec' in listitem):
  2651. if listitem['abName'] not in abilities_set:
  2652. abilities_set.append(listitem['abName'])
  2653. elif 'abName' in ab_table[entry]:
  2654. if ('unlockAbility' in ab_table[entry]) and (not 'unlockSpec' in ab_table[entry]):
  2655. if ab_table[entry]['abName'] not in abilities_set:
  2656. abilities_set.append(ab_table[entry]['abName'])
  2657. # See if columns should be included
  2658. has_entries = []
  2659. for entry in ab_table:
  2660. for ability in abilities_set:
  2661. if ability in ab_table[entry]:
  2662. has_entries.append(ability)
  2663. has_entries = set(has_entries)
  2664. # print(abilities_set)
  2665. # print(spec_set)
  2666. # print(has_entries)
  2667. for entry in ab_table:
  2668. if isinstance(ab_table[entry], list):
  2669. for listitem in ab_table[entry]:
  2670. if ('unlockAbility' in listitem) and (not 'unlockSpec' in listitem):
  2671. if listitem['abName'] in abilities_set and listitem['abName'] in has_entries:
  2672. _wikitable += '! {ability_name}\n'.format(ability_name=listitem['abName'])
  2673. elif 'abName' in ab_table[entry]:
  2674. if ('unlockAbility' in ab_table[entry]) and (not 'unlockSpec' in ab_table[entry]):
  2675. if (ab_table[entry]['abName'] in abilities_set) and (ab_table[entry]['abName'] in has_entries):
  2676. _wikitable += '! {ability_name}\n'.format(ability_name=ab_table[entry]['abName'])
  2677. for spec in spec_set:
  2678. for entry in ab_table:
  2679. if spec in ab_table[entry]:
  2680. add_these_specs.append(spec)
  2681. add_these_specs = set(add_these_specs)
  2682. # print(add_these_specs)
  2683. for spec in spec_set:
  2684. if spec in add_these_specs:
  2685. _wikitable += '! {ability_name}\n'.format(ability_name=spec)
  2686. for entry in ab_table:
  2687. if 'Health' in ab_table[entry]:
  2688. if not 'Health' in new_columns:
  2689. _wikitable += '! {ability_name}\n'.format(ability_name='Health')
  2690. if 'Health' not in new_columns:
  2691. new_columns.append('Health')
  2692. if 'CritChance' in ab_table[entry]:
  2693. if not 'CritChance' in new_columns:
  2694. _wikitable += '! {ability_name}\n'.format(ability_name='CritChance')
  2695. if 'CritChance' not in new_columns:
  2696. new_columns.append('CritChance')
  2697. if 'GoldFind' in ab_table[entry]:
  2698. if not 'GoldFind' in new_columns:
  2699. _wikitable += '! {ability_name}\n'.format(ability_name='Gold Find')
  2700. if 'GoldFind' not in new_columns:
  2701. new_columns.append('GoldFind')
  2702. if 'add_attack_targets' in ab_table[entry]:
  2703. if not 'add_attack_targets' in new_columns:
  2704. _wikitable += '! {ability_name}\n'.format(ability_name=' +Targets')
  2705. if 'add_attack_targets' not in new_columns:
  2706. new_columns.append('add_attack_targets')
  2707. if 'buff_upgrade_base_stack' in ab_table[entry]:
  2708. if not 'buff_upgrade_base_stack' in new_columns:
  2709. _wikitable += '! {ability_name}\n'.format(ability_name=' Story of Doom Base Value')
  2710. if 'buff_upgrade_base_stack' not in new_columns:
  2711. new_columns.append('buff_upgrade_base_stack')
  2712. if 'spec1upg' in ab_table[entry]:
  2713. if not 'spec1upg' in new_columns:
  2714. _wikitable += '! {ability_name}\n'.format(ability_name='Buff Spec 1')
  2715. if 'spec1upg' not in new_columns:
  2716. new_columns.append('spec1upg')
  2717. if 'spec2upg' in ab_table[entry]:
  2718. if not 'spec2upg' in new_columns:
  2719. _wikitable += '! {ability_name}\n'.format(ability_name='Buff Spec 2')
  2720. if 'spec2upg' not in new_columns:
  2721. new_columns.append('spec2upg')
  2722. if 'specupg' in ab_table[entry]:
  2723. if not 'specupg' in new_columns:
  2724. _wikitable += '! {ability_name}\n'.format(ability_name='Buff Spec')
  2725. if 'specupg' not in new_columns:
  2726. new_columns.append('specupg')
  2727. # if 'tempHPCDred' in ab_table[entry]:
  2728. # if not 'tempHPCDred' in new_columns:
  2729. # _wikitable += '! {ability_name}\n'.format(ability_name='Temp HP CD')
  2730. # if 'tempHPCDred' not in new_columns:
  2731. # new_columns.append('tempHPCDred')
  2732. # Wikitable fields
  2733. # print('abilities_set', abilities_set)
  2734. # print('new_columns', new_columns)
  2735. previous_entry = 0
  2736. _previous_cost = 0
  2737. totals = {'dmg': 1, 'dmg_all': 1}
  2738. for ability in abilities_set:
  2739. totals[ability] = 0
  2740. for column in new_columns:
  2741. totals[column] = 0
  2742. for entry in ab_table:
  2743. _cost = 0
  2744. _rounded_cost = 0
  2745. row = '|-' + '\n'
  2746. row += '|' + str(entry) + '\n'
  2747. for index in range(previous_entry - 1, entry - 1):
  2748. if not index == -1:
  2749. _cost += (base_cost * pow(cost_curve, index))
  2750. _rounded_cost += round(base_cost * pow(cost_curve, index))
  2751. # print(index, float(base_cost * pow(cost_curve, index)), _cost, _rounded_cost)
  2752. if (_rounded_cost / 1000) < 1:
  2753. cost = str(_rounded_cost)
  2754. else:
  2755. cost = ('{0:.2E}'.format(Decimal(_rounded_cost))).replace('E+', 'e')
  2756. row += '|' + cost + '\n'
  2757. previous_entry = entry
  2758. _previous_cost = _cost
  2759. if 'unlockSpec' in ab_table[entry]:
  2760. colspan = 3
  2761. if 'spec7name' in ab_table[entry]:
  2762. row += '| colspan={colspan} | <abbr title="{spec1} or {spec2} or {spec3} or {spec4} or {spec5} or {spec6} or {spec7}">Unlock Specialization Choice</abbr>\n'.format(
  2763. spec1=ab_table[entry]['spec1name'],
  2764. spec2=ab_table[entry]['spec2name'],
  2765. spec3=ab_table[entry]['spec3name'],
  2766. spec4=ab_table[entry]['spec4name'],
  2767. spec5=ab_table[entry]['spec5name'],
  2768. spec6=ab_table[entry]['spec6name'],
  2769. spec7=ab_table[entry]['spec7name'],
  2770. colspan=colspan
  2771. )
  2772. elif 'spec6name' in ab_table[entry]:
  2773. row += '| colspan={colspan} | <abbr title="{spec1} or {spec2} or {spec3} or {spec4} or {spec5} or {spec6}">Unlock Specialization Choice</abbr>\n'.format(
  2774. spec1=ab_table[entry]['spec1name'],
  2775. spec2=ab_table[entry]['spec2name'],
  2776. spec3=ab_table[entry]['spec3name'],
  2777. spec4=ab_table[entry]['spec4name'],
  2778. spec5=ab_table[entry]['spec5name'],
  2779. spec6=ab_table[entry]['spec6name'],
  2780. colspan=colspan
  2781. )
  2782. elif 'spec5name' in ab_table[entry]:
  2783. row += '| colspan={colspan} | <abbr title="{spec1} or {spec2} or {spec3} or {spec4} or {spec5}">Unlock Specialization Choice</abbr>\n'.format(
  2784. spec1=ab_table[entry]['spec1name'],
  2785. spec2=ab_table[entry]['spec2name'],
  2786. spec3=ab_table[entry]['spec3name'],
  2787. spec4=ab_table[entry]['spec4name'],
  2788. spec5=ab_table[entry]['spec5name'],
  2789. colspan=colspan
  2790. )
  2791. elif 'spec4name' in ab_table[entry]:
  2792. row += '| colspan={colspan} | <abbr title="{spec1} or {spec2} or {spec3} or {spec4}">Unlock Specialization Choice</abbr>\n'.format(
  2793. spec1=ab_table[entry]['spec1name'],
  2794. spec2=ab_table[entry]['spec2name'],
  2795. spec3=ab_table[entry]['spec3name'],
  2796. spec4=ab_table[entry]['spec4name'],
  2797. colspan=colspan
  2798. )
  2799. elif 'spec3name' in ab_table[entry]:
  2800. row += '| colspan={colspan} | <abbr title="{spec1} or {spec2} or {spec3}">Unlock Specialization Choice</abbr>\n'.format(
  2801. spec1=ab_table[entry]['spec1name'],
  2802. spec2=ab_table[entry]['spec2name'],
  2803. spec3=ab_table[entry]['spec3name'],
  2804. colspan=colspan
  2805. )
  2806. else:
  2807. row += '| colspan={colspan} | <abbr title="{spec1} or {spec2}">Unlock Specialization Choice</abbr>\n'.format(
  2808. spec1=ab_table[entry]['spec1name'],
  2809. spec2=ab_table[entry]['spec2name'],
  2810. colspan=colspan
  2811. )
  2812. elif isinstance(ab_table[entry], list) and any('unlockAbility' in x for x in ab_table[entry]):
  2813. didit = False
  2814. colspan = len(has_entries) + len(new_columns) + len(add_these_specs) + 3
  2815. row += '| colspan={colspan} | Unlock '.format(colspan=colspan)
  2816. for listitem in ab_table[entry]:
  2817. if 'unlockAbility' in listitem:
  2818. didit = True
  2819. row += '<abbr title="{ability_title}">{ability_name}</abbr> or '.format(
  2820. ability_name=listitem['abName'],
  2821. ability_title=listitem['abTitle'].replace('"', "'") if 'abTitle' in listitem else '',
  2822. colspan=colspan
  2823. )
  2824. if didit:
  2825. row = row[:-4]
  2826. row += '\n'
  2827. elif 'unlockAbility' in ab_table[entry]:
  2828. colspan = len(has_entries) + len(new_columns) + len(add_these_specs) + 3
  2829. row += '| colspan={colspan} | <abbr title="{ability_title}">Unlock {ability_name}</abbr>\n'.format(
  2830. ability_name=ab_table[entry]['abName'],
  2831. ability_title=ab_table[entry]['abTitle'] if 'abTitle' in ab_table[entry] else '',
  2832. colspan=colspan
  2833. )
  2834. elif 'unlockUltimate' in ab_table[entry]:
  2835. colspan = len(has_entries) + len(new_columns) + len(add_these_specs) + 3
  2836. row += '| colspan={colspan} | <abbr title="{ability_title}">Unlock {ability_name}</abbr>\n'.format(
  2837. ability_name=ab_table[entry]['abName'],
  2838. ability_title=ab_table[entry]['abTitle'] if 'abTitle' in ab_table[entry] else '',
  2839. colspan=colspan
  2840. )
  2841. else:
  2842. dmg_num = re.search('(\d+)' , ab_table[entry]['dmg']).group() if 'dmg' in ab_table[entry] else 0
  2843. totals['dmg'] *= (int(float(dmg_num) / 100) + 1) if 'dmg' in ab_table[entry] else 1
  2844. row += '|' + (ab_table[entry]['dmg'] if 'dmg' in ab_table[entry] else '') + '\n'
  2845. dmgall_num = re.search('(\d+)' , ab_table[entry]['dmg_all']).group() if 'dmg_all' in ab_table[entry] else 0
  2846. totals['dmg_all'] *= (int(float(dmgall_num) / 100) + 1) if 'dmg_all' in ab_table[entry] else 1
  2847. row += '|' + (ab_table[entry]['dmg_all']
  2848. if 'dmg_all' in ab_table[entry] else '') + '\n'
  2849. row += '|' + (ab_table[entry]['buffUlt']
  2850. if 'buffUlt' in ab_table[entry] else '') + '\n'
  2851. if isinstance(ab_table[entry], list):
  2852. for listitem in ab_table[entry]:
  2853. if ('unlockSpec' in listitem) or (not 'unlockAbility' in listitem) or (not 'unlockUltimate' in listitem):
  2854. # print('entry', listitem)
  2855. doit = True
  2856. if 'unlockAbility' in listitem or 'unlockUltimate' in listitem:
  2857. doit = False
  2858. else:
  2859. if ('unlockSpec' in ab_table[entry]) or (not 'unlockAbility' in ab_table[entry]) or (not 'unlockUltimate' in ab_table[entry]):
  2860. # print('entry', ab_table[entry])
  2861. doit = True
  2862. if 'unlockAbility' in ab_table[entry] or 'unlockUltimate' in ab_table[entry]:
  2863. doit = False
  2864. if doit == True:
  2865. for ability in abilities_set:
  2866. if ability in has_entries:
  2867. # print('building wikitable (ability):', ability)
  2868. if isinstance(ab_table[entry], list):
  2869. # print('building wikitable (if):', ab_table[entry])
  2870. # row += '|' + '\n'
  2871. row += '|'
  2872. didit = False
  2873. for listitem in ab_table[entry]:
  2874. if ability in listitem:
  2875. row += listitem[ability] + '\n'
  2876. didit = True
  2877. if didit:
  2878. row = row[:-1]
  2879. row += '\n'
  2880. elif ability in ab_table[entry]:
  2881. # print('building wikitable (elif):', ab_table[entry])
  2882. row += '|' + ab_table[entry][ability] + '\n'
  2883. else:
  2884. # print('building wikitable (else):', ab_table[entry])
  2885. row += '|' + '\n'
  2886. for spec in spec_set:
  2887. if spec in add_these_specs:
  2888. if spec in ab_table[entry]:
  2889. row += '|' + ab_table[entry][spec] + '\n'
  2890. else:
  2891. row += '|' + '\n'
  2892. if len(new_columns) > 0:
  2893. for column in new_columns:
  2894. # print('building wikitable (column):', ability)
  2895. if isinstance(ab_table[entry], list):
  2896. # print('building wikitable (if):', ab_table[entry])
  2897. # row += '|' + '\n'
  2898. row += '|'
  2899. didit = False
  2900. for listitem in ab_table[entry]:
  2901. if column in listitem:
  2902. row += listitem[column] + '\n'
  2903. didit = True
  2904. if didit:
  2905. row = row[:-1]
  2906. row += '\n'
  2907. elif column in ab_table[entry]:
  2908. # print('building wikitable (elif):', ab_table[entry])
  2909. row += '|' + ab_table[entry][column] + '\n'
  2910. else:
  2911. # print('building wikitable (else):', ab_table[entry])
  2912. row += '|' + '\n'
  2913. _wikitable += row
  2914. for entry in ab_table:
  2915. row = '|-' + 'style="background:#181818;border:4px;border-top-style:double"' + '\n'
  2916. row += '|' + '\'\'\'Total:\'\'\'' + '\n'
  2917. row += '|' + '\n'
  2918. _dmg = (totals['dmg'] - 1) * 100
  2919. if (_dmg / 10000) >= 1:
  2920. _dmg = ('{0:.2E}'.format(Decimal(_dmg))).replace('E+', 'e')
  2921. row += '|' + \
  2922. '<onlyinclude>{{{{#ifeq:{{{{{{include|damage}}}}}}|damage|{dmg}%}}}}</onlyinclude>'.format(
  2923. dmg=_dmg) + '\n'
  2924. _dmg_all = (totals['dmg_all'] - 1) * 100
  2925. if (_dmg_all / 10000) >= 1:
  2926. _dmg_all = ('{0:.2E}'.format(Decimal(_dmg_all))).replace('E+', 'e')
  2927. row += '|' + \
  2928. '<onlyinclude>{{{{#ifeq:{{{{{{include|damageAll}}}}}}|damageAll|{dmg_all}%}}}}</onlyinclude>'.format(
  2929. dmg_all=_dmg_all) + '\n'
  2930. for ability in has_entries:
  2931. row += '|' + '\n'
  2932. for spec in spec_set:
  2933. if spec in add_these_specs:
  2934. row += '|' + '\n'
  2935. if len(new_columns) > 0:
  2936. for column in new_columns:
  2937. row += '|' + '\n'
  2938. row += '|' + '\n'
  2939. _wikitable += row
  2940. # Wikitable end
  2941. _wikitable += '|}'
  2942. _wikitable = '{' + _wikitable
  2943. # Equipment
  2944. eq_table = {
  2945. 'slot1': {'desc': 0, '1': 0, '2': 0, '3': 0, '4': 0},
  2946. 'slot2': {'desc': 0, '1': 0, '2': 0, '3': 0, '4': 0},
  2947. 'slot3': {'desc': 0, '1': 0, '2': 0, '3': 0, '4': 0},
  2948. 'slot4': {'desc': 0, '1': 0, '2': 0, '3': 0, '4': 0},
  2949. 'slot5': {'desc': 0, '1': 0, '2': 0, '3': 0, '4': 0},
  2950. 'slot6': {'desc': 0, '1': 0, '2': 0, '3': 0, '4': 0},
  2951. }
  2952. for loot in js_loot:
  2953. if loot['hero_id'] == id_:
  2954. # print(loot['hero_id'])
  2955. # print(loot)
  2956. slot_id = 'slot' + str(loot['slot_id'])
  2957. rarity = loot['rarity']
  2958. # desc = loot['description']
  2959. desc = ''
  2960. effect = None
  2961. effect = parse_effect(loot['effects'][0]['effect_string'])
  2962. # print(effect)
  2963. effect_amt = effect['amount']
  2964. if '.' in effect_amt:
  2965. effect_amt = float(effect_amt.replace('%', '').replace(' sec', ''))
  2966. else:
  2967. effect_amt = int(effect_amt.replace('%', '').replace(' sec', ''))
  2968. effect_key = effect['key']
  2969. # print(effect)
  2970. for _effect_key in js_effect_key:
  2971. if _effect_key['key'] == effect_key:
  2972. desc = _effect_key['descriptions']['desc']
  2973. if ('$amount%' in desc) or ('$(amount)%' in desc):
  2974. unit = '%'
  2975. elif ('$amount seconds' in desc) or ('$(amount) seconds' in desc):
  2976. unit = ' sec'
  2977. if effect_key == 'buff_upgrades':
  2978. if 'description' in loot['effects'][0]:
  2979. desc = loot['effects'][0]['description']
  2980. ability_list = ''
  2981. if not spec_1 == '':
  2982. ability_list += (spec_1 + ' and ')
  2983. if not spec_2 == '':
  2984. ability_list += (spec_2 + ' and ')
  2985. if not spec_3 == '':
  2986. ability_list += (spec_3 + ' and ')
  2987. if not spec_4 == '':
  2988. ability_list += (spec_4 + ' and ')
  2989. if not spec_5 == '':
  2990. ability_list += (spec_5 + ' and ')
  2991. if not spec_6 == '':
  2992. ability_list += (spec_6 + ' and ')
  2993. if not spec_7 == '':
  2994. ability_list += (spec_7 + ' and ')
  2995. ability_list = ability_list[:-4]
  2996. ability_list += 'abilities'
  2997. desc = desc\
  2998. .replace('$target', name)\
  2999. .replace('$(upgrade_hero id)', name)\
  3000. .replace('$(upgrade_hero ids)', name)\
  3001. .replace('$(upgrade_name id)', effect['name'] if 'name' in effect else '')\
  3002. .replace('$(attack_names_and attack_ids)', 'Krond\'s Cantrip abilities')\
  3003. .replace(' $amount%', '')\
  3004. .replace(' $(amount)%', '')\
  3005. .replace(' $amount seconds', '')\
  3006. .replace(' $(amount) seconds', '')\
  3007. .replace('$(ability_list ids)', ability_list)\
  3008. .replace('Wild Shape', 'Wild Inspiration') # Tyril
  3009. # .replace(' $(upgrade_name id)', name)
  3010. if desc[-1:] == '.':
  3011. desc = desc[:-1]
  3012. eq_table[slot_id]['desc'] = desc
  3013. # print(desc)
  3014. eq_table[slot_id][str(rarity)] = str(effect_amt) + unit
  3015. shiny_effect_amt = effect_amt * 1.5
  3016. if shiny_effect_amt - int(shiny_effect_amt) == 0:
  3017. shiny_effect_amt = str(int(shiny_effect_amt))
  3018. else:
  3019. shiny_effect_amt = str(float(shiny_effect_amt))
  3020. golden_effect_amt = effect_amt * 2
  3021. if golden_effect_amt - int(golden_effect_amt) == 0:
  3022. golden_effect_amt = str(int(golden_effect_amt))
  3023. else:
  3024. golden_effect_amt = str(float(golden_effect_amt))
  3025. eq_table[slot_id][str(rarity + 4)] = shiny_effect_amt + unit
  3026. eq_table[slot_id][str(rarity + 8)] = golden_effect_amt + unit
  3027. # pprint(eq_table)
  3028. equipment = '''{| class="wikitable"
  3029. !Slot
  3030. !Description
  3031. !<span style="background:#202020; border: #bad6e8; border-style: solid; border-width: 0px; padding: inherit;"><span style="color: #ffffff>Common</span></span>
  3032. !<span style="background:#202020; border: #bad6e8; border-style: solid; border-width: 0px; padding: inherit;"><span style="color: #53e105>Uncommon</span></span>
  3033. !<span style="background:#202020; border: #bad6e8; border-style: solid; border-width: 0px; padding: inherit;"><span style="color: #2a8cfa>Rare</span></span>
  3034. !<span style="background:#202020; border: #bad6e8; border-style: solid; border-width: 0px; padding: inherit;"><span style="color: #a200ff>Epic</span></span>
  3035. !<span style="background:#202020; border: #bad6e8; border-style: solid; border-width: 1px; padding: inherit;"><span style="color: #bad6e8>Shiny</span> <span style="color: #ffffff>Common</span></span>
  3036. !<span style="background:#202020; border: #bad6e8; border-style: solid; border-width: 1px; padding: inherit;"><span style="color: #bad6e8>Shiny</span> <span style="color: #53e105>Uncommon</span></span>
  3037. !<span style="background:#202020; border: #bad6e8; border-style: solid; border-width: 1px; padding: inherit;"><span style="color: #bad6e8>Shiny</span> <span style="color: #2a8cfa>Rare</span></span>
  3038. !<span style="background:#202020; border: #bad6e8; border-style: solid; border-width: 1px; padding: inherit;"><span style="color: #bad6e8>Shiny</span> <span style="color: #a200ff>Epic</span></span>
  3039. !<span style="background:#202020; border: #fccc3b; border-style: solid; border-width: 1px; padding: inherit;"><span style="color: #fccc3b>Golden</span> <span style="color: #a200ff>Epic</span></span>
  3040. |-
  3041. |1
  3042. |''' + eq_table['slot1']['desc'] + '''
  3043. |''' + eq_table['slot1']['1'] + '''
  3044. |''' + eq_table['slot1']['2'] + '''
  3045. |''' + eq_table['slot1']['3'] + '''
  3046. |''' + eq_table['slot1']['4'] + '''
  3047. |''' + eq_table['slot1']['5'] + '''
  3048. |''' + eq_table['slot1']['6'] + '''
  3049. |''' + eq_table['slot1']['7'] + '''
  3050. |''' + eq_table['slot1']['8'] + '''
  3051. |''' + eq_table['slot1']['12'] + '''
  3052. |-
  3053. |2
  3054. |''' + eq_table['slot2']['desc'] + '''
  3055. |''' + eq_table['slot2']['1'] + '''
  3056. |''' + eq_table['slot2']['2'] + '''
  3057. |''' + eq_table['slot2']['3'] + '''
  3058. |''' + eq_table['slot2']['4'] + '''
  3059. |''' + eq_table['slot2']['5'] + '''
  3060. |''' + eq_table['slot2']['6'] + '''
  3061. |''' + eq_table['slot2']['7'] + '''
  3062. |''' + eq_table['slot2']['8'] + '''
  3063. |''' + eq_table['slot2']['12'] + '''
  3064. |-
  3065. |3
  3066. |''' + eq_table['slot3']['desc'] + '''
  3067. |''' + eq_table['slot3']['1'] + '''
  3068. |''' + eq_table['slot3']['2'] + '''
  3069. |''' + eq_table['slot3']['3'] + '''
  3070. |''' + eq_table['slot3']['4'] + '''
  3071. |''' + eq_table['slot3']['5'] + '''
  3072. |''' + eq_table['slot3']['6'] + '''
  3073. |''' + eq_table['slot3']['7'] + '''
  3074. |''' + eq_table['slot3']['8'] + '''
  3075. |''' + eq_table['slot3']['12'] + '''
  3076. |-
  3077. |4
  3078. |''' + eq_table['slot4']['desc'] + '''
  3079. |''' + eq_table['slot4']['1'] + '''
  3080. |''' + eq_table['slot4']['2'] + '''
  3081. |''' + eq_table['slot4']['3'] + '''
  3082. |''' + eq_table['slot4']['4'] + '''
  3083. |''' + eq_table['slot4']['5'] + '''
  3084. |''' + eq_table['slot4']['6'] + '''
  3085. |''' + eq_table['slot4']['7'] + '''
  3086. |''' + eq_table['slot4']['8'] + '''
  3087. |''' + eq_table['slot4']['12'] + '''
  3088. |-
  3089. |5
  3090. |''' + eq_table['slot5']['desc'] + '''
  3091. |''' + eq_table['slot5']['1'] + '''
  3092. |''' + eq_table['slot5']['2'] + '''
  3093. |''' + eq_table['slot5']['3'] + '''
  3094. |''' + eq_table['slot5']['4'] + '''
  3095. |''' + eq_table['slot5']['5'] + '''
  3096. |''' + eq_table['slot5']['6'] + '''
  3097. |''' + eq_table['slot5']['7'] + '''
  3098. |''' + eq_table['slot5']['8'] + '''
  3099. |''' + eq_table['slot5']['12'] + '''
  3100. |-
  3101. |6
  3102. |''' + eq_table['slot6']['desc'] + '''
  3103. |''' + eq_table['slot6']['1'] + '''
  3104. |''' + eq_table['slot6']['2'] + '''
  3105. |''' + eq_table['slot6']['3'] + '''
  3106. |''' + eq_table['slot6']['4'] + '''
  3107. |''' + eq_table['slot6']['5'] + '''
  3108. |''' + eq_table['slot6']['6'] + '''
  3109. |''' + eq_table['slot6']['7'] + '''
  3110. |''' + eq_table['slot6']['8'] + '''
  3111. |''' + eq_table['slot6']['12'] + '''
  3112. |}
  3113. '''
  3114. if name == 'Bruenor':
  3115. equipment += '''
  3116. ===Golden Gear===
  3117. * Slot 1: Received from buying normal gold chests with real money the first time.
  3118. * Slot 2: Received from buying the [http://store.steampowered.com/app/714850/Idle_Champions_of_the_Forgotten_Realms__Bruenors_Starter_Pack/ Bruenor's Starter Pack].
  3119. '''
  3120. elif name == 'Celeste':
  3121. equipment += '''
  3122. ===Golden Gear===
  3123. * Slot 1: Received from buying the [http://store.steampowered.com/app/714860/Idle_Champions_of_the_Forgotten_Realms__Celestes_Starter_Pack/ Celeste's Starter Pack].
  3124. '''
  3125. elif name == 'Nayeli':
  3126. equipment += '''
  3127. ===Golden Gear===
  3128. * Slot 1: Received from buying the [http://store.steampowered.com/app/714861/Idle_Champions_of_the_Forgotten_Realms__Nayelis_Starter_Pack/ Nayeli's Starter Pack].
  3129. '''
  3130. elif name == 'Nayeli':
  3131. equipment += '''
  3132. ===Golden Gear===
  3133. * Slot 1: Received from buying the [http://store.steampowered.com/app/714861/Idle_Champions_of_the_Forgotten_Realms__Nayelis_Starter_Pack/ Nayeli's Starter Pack].
  3134. '''
  3135. elif name == 'Stoki':
  3136. equipment += '''
  3137. ===Golden Gear===
  3138. * Slot 2: Received from buying event chest's during the first [[Highharvestide]] Event.
  3139. '''
  3140. elif name == 'Gromma':
  3141. equipment += '''
  3142. ===Golden Gear===
  3143. * Slot 4: Received from buying event chest's during the first [[Feast of the Moon]] Event.
  3144. '''
  3145. elif name == 'Strix':
  3146. equipment += '''
  3147. ===Golden Gear===
  3148. * Slot 1: Received from buying Buff Weekend Chest
  3149. * Slot 3: Received from buying Festival of Fools gold chests with real money the first time.
  3150. '''
  3151. elif name == 'Evelyn':
  3152. equipment += '''
  3153. ===Golden Gear===
  3154. * Slot 2: Received from buying [[The Great Modron March]] gold chests with real money the first time.
  3155. '''
  3156. elif name == 'Donaar':
  3157. equipment += '''
  3158. ===Golden Gear===
  3159. * Slot 4: Gotten by buying multiple Gold Donaar Chests on the 2018 [[Liar's Night]] Event.
  3160. '''
  3161. # Trivia
  3162. trivia = ''
  3163. if name == 'Minsc':
  3164. trivia += '''
  3165. * Minsc (and Boo) was the first Champion to be revealed.
  3166. * Hovering over his Strength Stat will show "18/93". Older D&D rules interpret this as 18 strength, 93 percentile. This was because AD&D set 18 as the upper limit for all stats, with a percentile score representing strength higher than 18. In short, Minsc is very strong.
  3167. '''
  3168. elif name == 'Tyril':
  3169. trivia += '''
  3170. Created by Actor and Entrepreneur Dylan Sprouse.
  3171. '''
  3172. elif name == 'Evelyn':
  3173. trivia += '''
  3174. Evelyn's full name, according to creator Anna Prosser Robinson, is Evelyn Avalona Helvig Marthain.
  3175. '''
  3176. elif name == 'Binwin':
  3177. trivia += '''
  3178. Binwin is in the webcomic [http://tabletitans.com/binwins-minions Binwin's Minions], which is part of the [http://tabletitans.com/comics Table Titans] webcomic series.
  3179. '''
  3180. elif name == 'Donaar':
  3181. trivia += '''
  3182. Donaar is played by Ryan Hartman.
  3183. '''
  3184. elif name == 'Spurt':
  3185. trivia += '''
  3186. Spurt is based on Dungeons & Dragons designer Chris Perkins' guest character on the live-stream show [https://www.youtube.com/channel/UCpXBGqwsBkpvcYjsJBQ7LEQ Critical Role].
  3187. '''
  3188. elif name == 'Vlahnya':
  3189. trivia += '''
  3190. Vlahnya is based on [https://www.mazearcana.com/ Maze Arcana] dungeon master and former Community Manager for Dungeons & Dragons, Satine Phoenix.
  3191. '''
  3192. # Media
  3193. media = ''
  3194. for num in range(1, 6):
  3195. media += '{{{{#ifexist: File:{name}{num}.jpg | [[File:{name}{num}.jpg|350px|inline]] |}}}}\n'.format(
  3196. name=name,
  3197. num=f'{num:03}',
  3198. )
  3199. media += '{{{{#ifexist: File:{name}{num}.png | [[File:{name}{num}.png|350px|inline]] |}}}}\n'.format(
  3200. name=name,
  3201. num=f'{num:03}',
  3202. )
  3203. # Stubs
  3204. # if name == 'Spurt':
  3205. # champ_str = '{{{{stub}}}}' + champ_str
  3206. final_str = champ_str.format(
  3207. id_=id_,
  3208. name=name,
  3209. skin=skin,
  3210. class_=class_,
  3211. race=race,
  3212. age=age,
  3213. alignment=alignment,
  3214. str_=str_,
  3215. dex=dex,
  3216. con=con,
  3217. int_=int_,
  3218. wis=wis,
  3219. cha=cha,
  3220. fullname=fullname,
  3221. backstory=backstory,
  3222. extra_info=extra_info,
  3223. group=group,
  3224. b_cd=b_cd,
  3225. u_cd=u_cd,
  3226. swap1=swap1,
  3227. swap2=swap2,
  3228. swap3=swap3,
  3229. swap4=swap4,
  3230. abilities=abilities,
  3231. wikitable=_wikitable,
  3232. spec_1=spec_1,
  3233. spec_2=spec_2,
  3234. spec_desc_1=spec_desc_1,
  3235. spec_desc_2=spec_desc_2,
  3236. equipment=equipment,
  3237. trivia=trivia,
  3238. media=media,
  3239. )
  3240. with open('output/{filename}.txt'.format(filename=name), 'w') as f:
  3241. f.write(html.unescape(final_str))
  3242. if COMPARE:
  3243. dir_path = os.path.dirname(os.path.realpath(__file__))
  3244. if not os.path.isdir(os.path.join(dir_path, 'output')):
  3245. os.makedirs(os.path.join(dir_path, 'output'))
  3246. main_file = os.path.join(dir_path, 'output/{filename}.txt'.format(filename=name))
  3247. posted_file = os.path.join(dir_path, 'output/posted/{filename}.txt'.format(filename=name))
  3248. try:
  3249. result = filecmp.cmp(main_file, posted_file, shallow=False)
  3250. except FileNotFoundError as e:
  3251. print('{name}: No source found'.format(name=name))
  3252. result = None
  3253. if (result is not None) and (result == True):
  3254. print('{name}: No changes'.format(name=name))
  3255. else:
  3256. print('{name}: Changes detected!'.format(name=name))
  3257. if SHOW_CHANGES:
  3258. result = subprocess.run(['git', 'diff', '--no-index', posted_file, main_file])
  3259. if POST:
  3260. if _summary is None:
  3261. _summary = input('Enter change summary: ')
  3262. EDIT_PARAMS = {
  3263. 'action': 'edit',
  3264. 'title': name,
  3265. 'text': final_str,
  3266. 'bot': '1',
  3267. 'summary': _summary
  3268. # 'nocreate': '1',
  3269. }
  3270. print('{name}: Posting...'.format(name=name))
  3271. R2 = instance.post(data=EDIT_PARAMS)
  3272. if R2.status_code == 200:
  3273. if 'error' not in R2.json():
  3274. print('{name}: Success!'.format(name=name))
  3275. with open('output/posted/{filename}.txt'.format(filename=name), 'w') as g:
  3276. g.write(final_str)
  3277. else:
  3278. print('{name}: FAIL! Error Message: {error}'.format(name=name, error=R2.json()['error']['info']))
  3279. # if R2.status_code == 200:
  3280. # print('{name}: Success!'.format(name=name))
  3281. # with open('output/posted/{filename}.txt'.format(filename=name), 'w') as g:
  3282. # g.write(final_str)
  3283. else:
  3284. print('{name}: FAIL!'.format(name=name))
  3285. if id_ == 32:
  3286. exit()
  3287. # break