Advertisement
Zalmoxix

Untitled

Oct 29th, 2020
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.75 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. #al_bot.py
  5. import os
  6. import random
  7. import zipfile
  8. import discord
  9. import re
  10. import io
  11. import string_utils
  12. import regex
  13. import asyncio
  14. import importlib
  15. from discord.ext import commands
  16. from dotenv import load_dotenv
  17. from discord.utils import get
  18. import codecs
  19. import fuzzywuzzy
  20. import operator
  21. import pickle
  22. import itertools
  23.  
  24. #MISSING ERROR CONTROL ON COMMANDS
  25.  
  26. load_dotenv()
  27. TOKEN = os.getenv('DISCORD_TOKEN')
  28. bot = commands.Bot(command_prefix='!', case_insensitive=True)
  29. #text_channels = ["general", "canal2"]
  30. rex = re.compile('\.zip')
  31. response = "Something went wrong, contact an admin!"
  32.  
  33. monsterData = {}
  34. lootData = {}
  35. reverseLootData = {}
  36. itemsData = {}
  37. craftData = {}
  38. bugList = []
  39. sugList = []
  40. testData = {}
  41. infoTestData = {}
  42.  
  43. fh = codecs.open("units.txt", "r", "utf-8")
  44. data = fh.read()
  45. monsters = re.compile("\[*.\]").split(data)
  46.  
  47. for x in monsters:
  48.  
  49. x = re.sub(r"\|[cC][a-fA-F0-9]{8}", "", x)
  50. x = re.sub(r"^=.*", "", x).replace("|","")
  51. x = x.strip().replace("|r","").replace(":",":").replace("。",".").replace(",",",").replace("\r","")
  52. x = re.sub(r"\[.*\\r", "", x) #test ID removal
  53. x = re.sub(r"\[.*\\n", "", x)
  54. print("DATA BLOCK-------------\n"+x)
  55. monsterData = dict(line.split('=') for line in x.split("\n"))
  56. try:
  57. #
  58.  
  59. #print("TEST--"+monsterData["Name"])
  60. #print("KEY--> "+monsterData["Name"]) #Keys show correctly
  61. #print("----------------------------------------------------------------------------------")
  62. #print("DATA--> "+monsterData["Name"])
  63. lootData[monsterData["Name"]] = monsterData #Not sure how to make this work, need a [name][all-data-of-this-name] dict
  64. #print(monsterData["Name"])
  65. except KeyError:
  66. print("0000")
  67. except ValueError:
  68. print("")
  69. print(lootData.keys())
  70. print(lootData["Egthoro, the Angry God"].get("Art"))
  71.  
  72. ---SAMPLE FROM TXT DATA BELOW--
  73. [AexT]
  74. sortAbil=z2
  75. comment(s)=Naisha
  76. auto=_
  77. abilList=A0LM,A0LN,A02V
  78. InBeta=0
  79. sortBalance=z2
  80. sort2=zz
  81. level=725
  82. =FALSE
  83. type=giant
  84. goldcost=195
  85. lumbercost=20
  86. goldRep=195
  87. lumberRep=20
  88. fmade= -
  89. fused=3
  90. bountydice=0
  91. bountysides=0
  92. bountyplus=0
  93. lumberbountydice=0
  94. lumberbountysides=0
  95. lumberbountyplus=0
  96. stockMax=3
  97. stockRegen=30
  98. stockStart=0
  99. HP=31000000
  100. realHP=700
  101. regenHP=20000.00
  102. regenType=always
  103. manaN=100
  104. realM=-
  105. mana0=-
  106. regenMana= -
  107. def=953
  108. defUp=2
  109. realdef=3
  110. defType=hero
  111. spd=400
  112. minSpd=0
  113. maxSpd=0
  114. bldtm=30
  115. reptm=30
  116. sight=3000
  117. nsight=3000
  118. STR= -
  119. INT= -
  120. AGI= -
  121. STRplus= -
  122. INTplus= -
  123. AGIplus= -
  124. abilTest=-
  125. Primary=_
  126. upgrades=
  127. tilesets=*
  128. nbrandom=-
  129. isbldg=0
  130. preventPlace=_
  131. requirePlace=_
  132. repulse=0
  133. repulseParam=0
  134. repulseGroup=0
  135. repulsePrio=0
  136. collision=32
  137. sort=z2
  138. race=undead
  139. prio=3
  140. threat=1
  141. valid=1
  142. deathType=3
  143. death=3
  144. canSleep=0
  145. cargoSize=1
  146. movetp=foot
  147. moveHeight=0
  148. moveFloor=0
  149. turnRate=0.6
  150. propWin=60
  151. orientInterp=4
  152. formation=0
  153. targType=ground
  154. pathTex=_
  155. fatLOS=0
  156. points=100
  157. buffType=_
  158. buffRadius=-
  159. nameCount=-
  160. canFlee=1
  161. requireWaterRadius=0
  162. isBuildOn=0
  163. canBuildOn=0
  164. version=1
  165. sortUI=z2
  166. file=war3mapImported\Tauren.mdl
  167. fileVerFlags=0
  168. unitSound=Naisha
  169. tilesetSpecific=0
  170. name=naisha
  171. special=0
  172. campaign=0
  173. inEditor=1
  174. hiddenInEditor=0
  175. hostilePal=-
  176. dropItems=1
  177. nbmmIcon=-
  178. useClickHelper=0
  179. hideHeroBar=0
  180. hideHeroMinimap=0
  181. hideHeroDeathMsg=0
  182. hideOnMinimap=0
  183. blend=0.15
  184. scale=3.00
  185. scaleBull=0
  186. maxPitch=45
  187. maxRoll=10
  188. elevPts=-
  189. elevRad=30
  190. fogRad=0
  191. walk=240
  192. run=240
  193. selZ=3.00
  194. weap1=MetalMediumSlice
  195. weap2=_
  196. teamColor=-1
  197. customTeamColor=0
  198. armor=Flesh
  199. modelScale=4.00
  200. red=125
  201. green=125
  202. blue=125
  203. uberSplat=_
  204. unitShadow=Shadow
  205. buildingShadow=_
  206. shadowW=190
  207. shadowH=190
  208. shadowX=75
  209. shadowY=75
  210. shadowOnWater=1
  211. selCircOnWater=0
  212. occH=0
  213. sortWeap=z2
  214. weapsOn=1
  215. acquire=600.00
  216. minRange=-
  217. castpt=0.6
  218. castbsw=0.4
  219. launchX=0
  220. launchY=0
  221. launchZ=60
  222. launchSwimZ=0
  223. impactZ=60
  224. impactSwimZ=0
  225. weapType1=
  226. targs1=ground,structure,item,debris,air,ward
  227. showUI1=1
  228. rangeN1=350
  229. RngTst=-
  230. RngBuff1=250
  231. atkType1=chaos
  232. weapTp1=normal
  233. cool1=2.00
  234. mincool1=-
  235. dice1=1
  236. sides1=5
  237. dmgplus1=321525
  238. dmgUp1=-
  239. mindmg1=27
  240. avgdmg1=29
  241. maxdmg1=31
  242. dmgpt1=0.46
  243. backSw1=0.54
  244. Farea1=400
  245. Harea1= -
  246. Qarea1= -
  247. Hfact1=-
  248. Qfact1=-
  249. splashTargs1=ground,structure,debris,item,ward,enemy
  250. targCount1=5
  251. damageLoss1=0.5
  252. spillDist1=0
  253. spillRadius1=0
  254. DmgUpg=high
  255. dmod1=22
  256. DPS=16.1111111111111
  257. weapType2=_
  258. targs2=_
  259. showUI2=1
  260. rangeN2=-
  261. RngTst2=-
  262. RngBuff2=-
  263. atkType2=normal
  264. weapTp2=_
  265. cool2=-
  266. mincool2=-
  267. dice2=-
  268. sides2=-
  269. dmgplus2=-
  270. dmgUp2=-
  271. mindmg2= -
  272. avgdmg2=-
  273. maxdmg2= -
  274. dmgpt2=-
  275. backSw2=-
  276. Farea2=-
  277. Harea2=-
  278. Qarea2=-
  279. Hfact2=-
  280. Qfact2=-
  281. splashTargs2=_
  282. targCount2=1
  283. damageLoss2=0
  284. spillDist2=0
  285. spillRadius2=0
  286. Name=|cffd45e19Egthoro, the Angry God|
  287. Art=ReplaceableTextures\CommandButtons\BTNTauren.blp
  288. Buttonpos=1,0
  289. Specialart=Objects\Spawnmodels\NightElf\NightElfLargeDeathExplode\NightElfLargeDeathExplode.mdl
  290. Attachmentanimprops=medium
  291. Missileart=
  292. Missilearc=0.10
  293. Missilespeed=900
  294. [Hblm]
  295. sortAbil=a1
  296. comment(s)=HeroBloodMage
  297. auto=_
  298. abilList=AInv,Asph,Amls
  299. heroAbilList=A02S,A00I,ANcf,AHpx,ANic
  300. InBeta=1
  301. sortBalance=a1
  302. sort2=uher
  303. level=5
  304. =FALSE
  305. type=_
  306. goldcost=425
  307. lumbercost=100
  308. goldRep=425
  309. lumberRep=100
  310. fmade=-
  311. fused=5
  312. bountydice=8
  313. bountysides=3
  314. bountyplus=30
  315. lumberbountydice=0
  316. lumberbountysides=0
  317. lumberbountyplus=0
  318. stockMax=3
  319. stockRegen=30
  320. stockStart=0
  321. HP=100
  322. realHP=550
  323. regenHP=0.25
  324. regenType=always
  325. manaN=0
  326. realM=285
  327. mana0=100
  328. regenMana=5.00
  329. def=0
  330. defUp=0
  331. realdef=2.2
  332. defType=hero
  333. spd=300
  334. minSpd=0
  335. maxSpd=0
  336. bldtm=55
  337. reptm=55
  338. sight=1800
  339. nsight=800
  340. STR=18
  341. INT=24
  342. AGI=14
  343. STRplus=2
  344. INTplus=3.20
  345. AGIplus=1
  346. abilTest=6
  347. Primary=INT
  348. upgrades=_
  349. tilesets=*
  350. nbrandom=-
  351. isbldg=0
  352. preventPlace=_
  353. requirePlace=_
  354. repulse=0
  355. repulseParam=0
  356. repulseGroup=0
  357. repulsePrio=0
  358. collision=32
  359. sort=a1
  360. race=human
  361. prio=9
  362. threat=1
  363. valid=1
  364. deathType=2
  365. death=3
  366. canSleep=0
  367. cargoSize=1
  368. movetp=foot
  369. moveHeight=0
  370. moveFloor=0
  371. turnRate=0.5
  372. propWin=60
  373. orientInterp=4
  374. formation=2
  375. targType=ground
  376. pathTex=_
  377. fatLOS=0
  378. points=100
  379. buffType=_
  380. buffRadius=-
  381. nameCount=1
  382. canFlee=1
  383. requireWaterRadius=0
  384. isBuildOn=0
  385. canBuildOn=0
  386. version=1
  387. sortUI=a1
  388. file=units\human\HeroBloodElf\HeroBloodElf
  389. fileVerFlags=0
  390. unitSound=BloodElfSorceror
  391. tilesetSpecific=0
  392. name=bloodmage
  393. unitClass=HHero04
  394. special=0
  395. campaign=0
  396. inEditor=1
  397. hiddenInEditor=0
  398. hostilePal=-
  399. dropItems=1
  400. nbmmIcon=-
  401. useClickHelper=0
  402. hideHeroBar=0
  403. hideHeroMinimap=0
  404. hideHeroDeathMsg=0
  405. hideOnMinimap=0
  406. blend=0.15
  407. scale=1.5
  408. scaleBull=1
  409. maxPitch=10
  410. maxRoll=10
  411. elevPts=-
  412. elevRad=30
  413. fogRad=0
  414. walk=250
  415. run=250
  416. selZ=0
  417. weap1=_
  418. weap2=_
  419. teamColor=-1
  420. customTeamColor=0
  421. armor=Flesh
  422. modelScale=1
  423. red=255
  424. green=255
  425. blue=255
  426. uberSplat=_
  427. unitShadow=Shadow
  428. buildingShadow=_
  429. shadowW=170
  430. shadowH=170
  431. shadowX=65
  432. shadowY=65
  433. shadowOnWater=1
  434. selCircOnWater=0
  435. occH=0
  436. sortWeap=a1
  437. weapsOn=1
  438. acquire=600
  439. minRange=-
  440. castpt=0.5
  441. castbsw=1
  442. launchX=15
  443. launchY=0
  444. launchZ=66
  445. launchSwimZ=0
  446. impactZ=60
  447. impactSwimZ=0
  448. weapType1=_
  449. targs1=ground,structure,debris,air,item,ward
  450. showUI1=1
  451. rangeN1=600
  452. RngTst=-
  453. RngBuff1=250
  454. atkType1=hero
  455. weapTp1=missile
  456. cool1=1.64
  457. mincool1=-
  458. dice1=2
  459. sides1=4
  460. dmgplus1=0
  461. dmgUp1=-
  462. mindmg1=2
  463. avgdmg1=5
  464. maxdmg1=8
  465. dmgpt1=0.55
  466. backSw1=0.85
  467. Farea1= -
  468. Harea1= -
  469. Qarea1= -
  470. Hfact1=-
  471. Qfact1=-
  472. splashTargs1=_
  473. targCount1=1
  474. damageLoss1=0
  475. spillDist1=0
  476. spillRadius1=0
  477. DmgUpg=-
  478. dmod1=-
  479. DPS=3.04878048780488
  480. weapType2=_
  481. targs2=ground,structure,debris,air,item,ward
  482. showUI2=1
  483. rangeN2=500
  484. RngTst2=-
  485. RngBuff2=250
  486. atkType2=hero
  487. weapTp2=missile
  488. cool2=1.64
  489. mincool2=-
  490. dice2=2
  491. sides2=4
  492. dmgplus2=0
  493. dmgUp2=-
  494. mindmg2=2
  495. avgdmg2=5
  496. maxdmg2=8
  497. dmgpt2=0.55
  498. backSw2=0.85
  499. Farea2=-
  500. Harea2=-
  501. Qarea2=-
  502. Hfact2=-
  503. Qfact2=-
  504. splashTargs2=_
  505. targCount2=1
  506. damageLoss2=0
  507. spillDist2=0
  508. spillRadius2=0
  509. Name=Blood Mage
  510. Propernames=Hale Magefir
  511. Tip=
  512. Hotkey=
  513. Ubertip=
  514. Revivetip=
  515. Awakentip=
  516. Art=ReplaceableTextures\CommandButtons\BTNHeroBloodElfPrince.blp
  517. Buttonpos=0,1
  518. Requires=
  519. Requires1=hkee
  520. Requires2=hcas
  521. Specialart=Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
  522. ScoreScreenIcon=UI\Glues\ScoreScreen\scorescreen-hero-sorceror.blp
  523. Missileart=Abilities\Weapons\BloodElfMissile\BloodElfMissile.mdl
  524. Missilearc=0.15
  525. Missilespeed=900
  526. MissileHoming=1
  527. Requirescount=3
  528. [Hmkg]
  529. sortAbil=a1
  530. comment(s)=HeroMountainKing
  531. auto=_
  532. abilList=AInv,A01K
  533. heroAbilList=AHtb,AHtc,AHbh,AHav,A005
  534. InBeta=1
  535. sortBalance=a1
  536. sort2=uher
  537. level=5
  538. =FALSE
  539. type=_
  540. goldcost=425
  541. lumbercost=100
  542. goldRep=425
  543. lumberRep=100
  544. fmade=-
  545. fused=5
  546. bountydice=8
  547. bountysides=3
  548. bountyplus=30
  549. lumberbountydice=0
  550. lumberbountysides=0
  551. lumberbountyplus=0
  552. stockMax=3
  553. stockRegen=30
  554. stockStart=0
  555. HP=100
  556. realHP=700
  557. regenHP=10.00
  558. regenType=always
  559. manaN=0
  560. realM=225
  561. mana0=100
  562. regenMana=0.01
  563. def=1
  564. defUp=0
  565. realdef=2.3
  566. defType=hero
  567. spd=400
  568. minSpd=0
  569. maxSpd=0
  570. bldtm=55
  571. reptm=55
  572. sight=1800
  573. nsight=800
  574. STR=28
  575. INT=15
  576. AGI=11
  577. STRplus=4.00
  578. INTplus=1.5
  579. AGIplus=1.5
  580. abilTest=6
  581. Primary=STR
  582. upgrades=_
  583. tilesets=*
  584. nbrandom=-
  585. isbldg=0
  586. preventPlace=_
  587. requirePlace=_
  588. repulse=0
  589. repulseParam=0
  590. repulseGroup=0
  591. repulsePrio=0
  592. collision=32
  593. sort=a1
  594. race=human
  595. prio=9
  596. threat=1
  597. valid=1
  598. deathType=2
  599. death=2.5
  600. canSleep=0
  601. cargoSize=1
  602. movetp=foot
  603. moveHeight=0
  604. moveFloor=0
  605. turnRate=0.6
  606. propWin=60
  607. orientInterp=5
  608. formation=0
  609. targType=ground
  610. pathTex=_
  611. fatLOS=0
  612. points=100
  613. buffType=_
  614. buffRadius=-
  615. nameCount=1
  616. canFlee=1
  617. requireWaterRadius=0
  618. isBuildOn=0
  619. canBuildOn=0
  620. version=0
  621. sortUI=a1
  622. file=units\human\HeroMountainKing\HeroMountainKing
  623. fileVerFlags=0
  624. unitSound=HeroMountainKing
  625. tilesetSpecific=0
  626. name=mountainking
  627. unitClass=HHero03
  628. special=0
  629. campaign=0
  630. inEditor=1
  631. hiddenInEditor=0
  632. hostilePal=-
  633. dropItems=1
  634. nbmmIcon=-
  635. useClickHelper=0
  636. hideHeroBar=0
  637. hideHeroMinimap=0
  638. hideHeroDeathMsg=0
  639. hideOnMinimap=0
  640. blend=0.15
  641. scale=1.25
  642. scaleBull=1
  643. maxPitch=10
  644. maxRoll=10
  645. elevPts=-
  646. elevRad=50
  647. fogRad=0
  648. walk=250
  649. run=250
  650. selZ=0
  651. weap1=MetalHeavyBash
  652. weap2=_
  653. teamColor=-1
  654. customTeamColor=0
  655. armor=Metal
  656. modelScale=1.10
  657. red=255
  658. green=255
  659. blue=255
  660. uberSplat=_
  661. unitShadow=Shadow
  662. buildingShadow=_
  663. shadowW=150
  664. shadowH=150
  665. shadowX=60
  666. shadowY=60
  667. shadowOnWater=1
  668. selCircOnWater=0
  669. occH=0
  670. sortWeap=a1
  671. weapsOn=1
  672. acquire=500
  673. minRange=-
  674. castpt=0.4
  675. castbsw=0.5
  676. launchX=0
  677. launchY=0
  678. launchZ=60
  679. launchSwimZ=0
  680. impactZ=60
  681. impactSwimZ=0
  682. weapType1=MetalHeavyBash
  683. targs1=ground,structure,item,debris,air,ward
  684. showUI1=1
  685. rangeN1=100
  686. RngTst=-
  687. RngBuff1=250
  688. atkType1=hero
  689. weapTp1=normal
  690. cool1=1.80
  691. mincool1=-
  692. dice1=2
  693. sides1=6
  694. dmgplus1=0
  695. dmgUp1=-
  696. mindmg1=2
  697. avgdmg1=7
  698. maxdmg1=12
  699. dmgpt1=0.35
  700. backSw1=0.65
  701. Farea1= -
  702. Harea1= -
  703. Qarea1= -
  704. Hfact1=-
  705. Qfact1=-
  706. splashTargs1=_
  707. targCount1=1
  708. damageLoss1=0
  709. spillDist1=0
  710. spillRadius1=0
  711. DmgUpg=-
  712. dmod1=-
  713. DPS=3.15315315315315
  714. weapType2=_
  715. targs2=ground,structure,debris,air,item,ward
  716. showUI2=1
  717. rangeN2=500
  718. RngTst2=-
  719. RngBuff2=250
  720. atkType2=hero
  721. weapTp2=missile
  722. cool2=2.22
  723. mincool2=-
  724. dice2=2
  725. sides2=6
  726. dmgplus2=0
  727. dmgUp2=-
  728. mindmg2=2
  729. avgdmg2=7
  730. maxdmg2=12
  731. dmgpt2=0.35
  732. backSw2=0.65
  733. Farea2=-
  734. Harea2=-
  735. Qarea2=-
  736. Hfact2=-
  737. Qfact2=-
  738. splashTargs2=_
  739. targCount2=1
  740. damageLoss2=0
  741. spillDist2=0
  742. spillRadius2=0
  743. Name=Mountain King
  744. Propernames=Munin Ironclif
  745. Tip=
  746. Hotkey=
  747. Ubertip=
  748. Revivetip=
  749. Awakentip=
  750. Art=ReplaceableTextures\CommandButtons\BTNHeroMountainKing.blp
  751. Buttonpos=1,2
  752. Requires=
  753. Requires1=hkee
  754. Requires2=hcas
  755. Specialart=Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
  756. ScoreScreenIcon=UI\Glues\ScoreScreen\scorescreen-hero-mountainking.blp
  757. Requirescount=3
  758. UberTip="Warrior Hero, adept at offensive combat and disrupting enemy troops. Can learn Storm Bolt, Thunder Clap, Bash and Avatar. |n|n|cffffcc00Attacks land units.|r"
  759.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement