Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 9.07 KB | None | 0 0
  1. # pf loot generator
  2. # (c) Sven M.
  3. # v 1.0 2019.06.16:
  4.  
  5. # v 1.2 2019.08.09:
  6. # rework. only 1 equip- dictionary instead a list and a dictionary. This avoid errors bc there are no more two lists to carry of.
  7.  
  8. """
  9. Usage:
  10. first line insert the level of the encounter between 1 and 30 (1/8, 1/6, 1/4, 1/2 is possible).
  11. second line insert loot -
  12. progression level
  13. 1 = LOW
  14. 2 = MID
  15. 3 = FAST
  16. """
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23. # pf loot generator
  24. # 2.0 first programm was lost
  25. # Sven M.
  26. # 2019-03-16 start ~ 11.00 pm
  27.  
  28.  
  29. # REQUIERED IMPORTS
  30.  
  31. import random as r
  32.  
  33. # REQUIERED DATA
  34.  
  35. # 3 encounter - loot tables
  36. # (values in GOLD)
  37.  
  38. l_loot = {
  39. "1/8" : 20, "1/6" : 30, "1/4" : 40,
  40. "1/3" : 55, "1/2" : 85, "1" : 170,
  41. "2" : 350, "3" : 550, "4" : 750,
  42. "5" : 1000, "6" : 1350, "7" : 1750,
  43. "8" : 2200, "9" : 2850, "10" : 3650,
  44. "11" : 4650, "12" : 6000, "13" : 7750, "14" : 10000, "15" : 13000,
  45. "16" : 16500, "17" : 22000,
  46. "18" : 28000, "19" : 35000,
  47. "20" : 44000, "21" : 55000,
  48. "22" : 69000, "23" : 85000,
  49. "24" : 102000, "25" : 125000,
  50. "26" : 150000, "27" : 175000,
  51. "28" : 205000, "29" : 240000,
  52. "30" : 280000}
  53.  
  54. m_loot = {
  55. "1/8" : 35, "1/6" : 45, "1/4" : 65,
  56. "1/3" : 85, "1/2" : 130, "1" : 260,
  57. "2" : 550, "3" : 800, "4" : 1150,
  58. "5" : 1550, "6" : 2000, "7" : 2600,
  59. "8" : 3350, "9" : 4250, "10" : 5450,
  60. "11" : 7000, "12" : 9000, "13" : 11600,
  61. "14" : 15000, "15" : 19500,
  62. "16" : 25000, "17" : 32000,
  63. "18" : 41000, "19" : 53000,
  64. "20" : 67000, "21" : 84000,
  65. "22" : 104000, "23" : 127000,
  66. "24" : 155000, "25" : 185000,
  67. "26" : 220000, "27" : 260000,
  68. "28" : 305000, "29" : 360000,
  69. "30" : 420000}
  70.  
  71. f_loot= {
  72. "1/8" : 50, "1/6" : 65, "1/4" : 100,
  73. "1/3" : 135, "1/2" : 200, "1" : 400,
  74. "2" : 800, "3" : 1200, "4" : 1700,
  75. "5" : 2300, "6" : 3000, "7" : 3900,
  76. "8" : 5000, "9" : 6400, "10" : 8200,
  77. "11" : 10500, "12" : 13500,
  78. "13" : 17500, "14" : 22000,
  79. "15" : 29000, "16" : 38000,
  80. "17" : 48000, "18" : 62000,
  81. "19" : 79000, "20" : 100000,
  82. "21" : 125000, "22" : 155000,
  83. "23" : 190000, "24" : 230000,
  84. "25" : 275000, "26" : 330000,
  85. "27" : 390000, "28" : 460000,
  86. "29" : 540000, "30" : 630000}
  87.  
  88. # dict of prices of the items. Values in COPPER
  89.  
  90. eqdic = {
  91. "Hoelzerner Krug" : 5,
  92. "Alter Silberkrug" : 100,
  93. "Angelaufener Teller aus Silber" : 150,
  94. "Feiner Silberteller" : 200,
  95. "Geschnitzer Krug" : 10,
  96. "Beutelchen mit Baldriantee" : 10,
  97. "Beutelchen mit Kraeutertee" : 2,
  98. "Beutelchen mit Rotbuschtee" : 2,
  99. "Beutel mit Pfefferminztee" : 1,
  100. "Beutelchen mit Lavendeltee" : 2,
  101. "Beutelchen mit Kamilentee" : 1,
  102. "Beutelchen mit Holundertee" : 1,
  103. "Beutelchen mit Fencheltee" : 2,
  104. "Beutel mit getrockneten Salatkraeutern" : 1,
  105. "Tonphiole mit 0,5l Kefir" : 3,
  106. "Tonphiole mit Pferdemilch" : 1,
  107. "Leinenbeutel gefuellt mit Reis (250g)" : 2,
  108. "Saeckchen Rueben" : 1,
  109. "kleiner Sack mit Kartoffeln" : 1,
  110. "Alchemistenfeuer" : 2000,
  111. "Dünner Ring aus purem Gold" : 200,
  112. "Massiver Ring aus purem Gold" : 1000,
  113. "Fackel" : 1,
  114. "Verstrickungsbeutel" : 5000,
  115. "Eiserner Wurfhaken" : 100,
  116. "Tonkrug" : 3,
  117. "Tonbecher" : 2,
  118. "Tonhumpen" : 2,
  119. "Silberbecher" : 20,
  120. "Silberhumpen" : 20,
  121. "Goldener Becher" : 1000,
  122. "Becher aus purem Gold" : 3000,
  123. "Goldener Krug" : 2000,
  124. "Praechtiger Krug aus purem Gold" : 6000,
  125. "Reich verzierter Krug aus purem Gold" : 6000,
  126. "Massiver Krug aus purem Gold" : 6000,
  127. "Goldener Humpen, mit edelsteinen verziert" : 3000,
  128. "Goldener Humpen" : 1000,
  129. "Humpen aus purem Gold" : 3000,
  130. "Kaestchen (3x6x3) aus Eichenholz" : 1,
  131. "Kleiner Hammer" : 500,
  132. "kleines Stueck wohlriechende Seife" : 2,
  133. "Schachtel mit alter Seife" : 1,
  134. "kleines Zelt" : 500,
  135. "rostige Baerenfalle" : 1000,
  136. "Angelhaken" : 5,
  137. "Kompass" : 1000,
  138. "kleines Gloeckchen aus Eisen" : 100,
  139. "Holzgabel" : 1,
  140. "kleiner Goldloeffel" : 1000,
  141. "Suppenloeffel aus Gold" : 1500,
  142. "Gabel aus Silber" : 1000,
  143. "Filigrane Silbergabel" : 1500,
  144. "Antike Silbergabel" : 2000,
  145. "Antike Kupfermuenze" : 5,
  146. "Antike Silbermünze" : 500,
  147. "Antike Goldmünze" : 5000,
  148. "Einfach gearbeitetes Brotmesser aus Silber" : 1000,
  149. "Brotmesser aus Gold" : 10000,
  150. "Gabel aus Gold" : 100000,
  151. "Fein gearbeitete Gabel aus Gold" :  15000,
  152. "kleiner Stahlspiegel" : 1000,
  153. "25m Hanfseil" : 100,
  154. "12m Strickseil" : 10,
  155. "10m Hanfseil" : 50,
  156. "25m Seil aus Seide" : 1000,
  157. "25m Seil aus Spinnenseide" : 20000,
  158. "Lampe (mit Kerze)" : 5000,
  159. "einfacher Schlafsack" : 10,
  160. "kleine Flasche Cauim (Bierartig; hergestellt aus Maniok- Wurzeln)" : 100,
  161. "kleine Flasche Kumis(Bierartig; hergestellt aus Pferdemilch)" : 50,
  162. "handvoll Roggenbrot" : 1,
  163. "Pfund Kuerbisbrot" :2,
  164. "Pfund Weizenbrot" : 2,
  165. "1 Leib Knoblauchbrot" : 2,
  166. "Glaeschen Honig" : 100,
  167. "Glaeschen Kirschmarmelade" : 50,
  168. "Beutel mit Kaffee (20g)" : 1,
  169. "Kleiner Sack Kaffeepulver (500g)" : 450,
  170. "Flaeschen mit Saure" : 1000,
  171. "Rauchstab" : 2000,
  172. "Sonnenzepter": 2000,
  173. "Donnerstein" : 3000,
  174. "Ewige Fackel (Farbe von Feuer" : 11000,
  175. "Fläschen Weihwasser mit dem Symbol Pyrons" : 2500,
  176. "Streichholz" : 100,
  177. "Tonflaeschen Tinte (30ml)" : 2500,
  178. "Glasflasche mit Tinte (1L" : 2600,
  179. "Tonphiole mit Tinte 1L" : 2600,
  180. "Stundenglas mit hoelzernem Rahmen (30min)" : 2500,
  181. "Prachtvolles Stundenglas aus Silber(30min)" : 5000,
  182. "Einfaches Stundenglas aus Gold (1h)" : 2500,
  183. "Glasflaeschen gefuellt mit Tinte (30ml)" : 2500,
  184. }
  185.  
  186. # PROGRAM PART
  187.  
  188. def lootworth(elvl, wlvl):
  189.     if wlvl == 1:
  190.         loot_worth = l_loot.get(elvl)
  191.         return loot_worth
  192.     elif wlvl == 2:
  193.         loot_worth = m_loot.get(elvl)
  194.         return loot_worth
  195.     elif wlvl == 3:
  196.         loot_worth = f_loot.get(elvl)
  197.         return loot_worth
  198.     else:
  199.         print("Bitte gib eine gueltige Nummer ein. Versuch es noch einmal.")
  200.         lootworth(elvl,wlvl)
  201.  
  202. # split up the gold
  203.  
  204. def goldsplit(lootworth):
  205.     split= 25 # ***
  206.     raw = lootworth(elvl, wlvl) /100 *split
  207.     return raw
  208.  
  209.  
  210. """
  211. we split the sum, which is in
  212. gold in pieces of gold, silver and copper. 1g = 10s or 100 copper &
  213. return the result
  214. """
  215.  
  216. def lines(number):
  217.     print("\n" * number)
  218.  
  219. def raw_gold(goldsplit):
  220.     gold_counter = 0
  221.     silver_counter = 0
  222.     copper_counter = 0
  223.     options = ["gold", "silver", "copper"]
  224.     g = goldsplit(lootworth)
  225.     lines(10)
  226.     print("- - - - - - - - - - - - - - - -")
  227.     lines(2)
  228.     print("Rawgold = ", g)
  229.     print("\nVerteilt auf folgende Muenzen:")
  230.     for x in range(int(goldsplit(lootworth))):
  231.         rollit = r.choice(options)
  232.         if rollit == "gold":
  233.             gold_counter += 1
  234.         elif rollit == "silver":
  235.             silver_counter += 10
  236.         elif rollit == "copper":
  237.             copper_counter += 100
  238.     print("Goldmuenzen:  ", gold_counter, "\nSilbermuenzen: ", silver_counter, "\nKupfermuenzen: ", copper_counter)
  239.  
  240.  
  241. """
  242. next
  243. we split the sum of gold for the loot
  244. which is given instead in coins, in equipment.
  245. what we do is, while sum >= 0, we take a random - item of a list (eqlist) look what it cost & subtract it from the sum.
  246. """
  247.  
  248. def duplitest(a):
  249.     dupli_test = []
  250.     dupli_storage = {}
  251.     for i in a:
  252.         dupli_test.append(i)
  253.         dupli_storage[i] = 1
  254.     if i in dupli_test and i in a:
  255.         dupli_storage[i] +=1
  256.     for k, v in dupli_storage.items():
  257.         print(k, v)
  258.  
  259. def loot(lootworth, goldsplit):
  260.     budget = (lootworth(elvl,wlvl) - goldsplit(lootworth)) * 100
  261.     budgetingold = budget / 100
  262.     print("\n\nGesamtwert Equip: ", budgetingold, "\n")
  263.     loot_list =[]
  264.     worklist = []
  265.     clc = []
  266.     duplicate_entrys = {}
  267.     for i in eqdic.keys():
  268.         worklist.append(i)
  269.     while budget > 0:
  270.         pice = r.choice(worklist)
  271.         budget -= eqdic.get(pice)
  272.         if budget < 0:
  273.             budget += eqdic.get(pice)
  274.         else:
  275.                 loot_list.append(pice)
  276.                 budget_toadd = str(budget)
  277.                 to_add = pice + " added to loot. Lootworth remain = " + budget_toadd
  278.                 clc.append(to_add)
  279.     duplitest(loot_list)
  280. #    for i in loot_list:
  281. #        print(i)
  282.     show_clc = input("\n\nWant to see the calculation? enter y")
  283.     if show_clc == "y":
  284.         print(clc)
  285.         print("Lootworth remain = ", budget)
  286.     else:
  287.         quit()
  288.  
  289. """
  290. new part
  291.  
  292. to sumup all duplicante entrys
  293.  
  294. i.ex.:
  295.    
  296. a = [
  297.    "a",
  298.    "b",
  299.    "c",
  300.    "a",
  301. ]
  302.  
  303. def duplitest(a):
  304.    dupli_test = []
  305.    dupli_storage = {}
  306.    for i in a:
  307.        dupli_test.append(i)
  308.        dupli_storage[i] = 1
  309.    if i in dupli_test and i in a:
  310.        dupli_storage[i] +=1
  311.    print("given",a)
  312.    print(dupli_test)
  313.    print("There was duplicate entrys")
  314.    print(dupli_storage)
  315.    for k, v in dupli_storage.items():
  316.        print(k, v)
  317.  
  318.  
  319. duplitest(a)
  320.  
  321. """
  322.  
  323. # PROGRAM RUNNIG FLOW PART
  324. print("\n    PATHFINDER LOOT GENERATOR\n")
  325.  
  326. # 2 USER - INPUTS REQUIERED
  327. elvl= input("\n\nGib ein Encounter-Level zwischen\n1 und 30 ein.\n(1/8, 1/6, 1/4, 1/2 sind auch moeglich)\n>>> ")
  328.  
  329. wlvl= int(input("\n\nGib das  wealth - progression - Level ein.\n\n1 = LOW\n2 = MID\n3 = FAST\n>>> "))
  330.  
  331. # proceed the input to
  332. # raw - loot a number (int)
  333. lootworth(elvl, wlvl)
  334. # into a number (lootwoth)
  335. # we proceed the output of
  336. # the function above
  337. # split up the gold
  338. goldsplit(lootworth)
  339. raw_gold(goldsplit)
  340. loot(lootworth, goldsplit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement