Advertisement
Guest User

Housamo Scripts

a guest
May 31st, 2019
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.13 KB | None | 0 0
  1. def skillCost(rarity=1):
  2. SALVsteps = [1, 25, 49, 67, 79, 88, 94, 97]
  3. skillBoostsUsed = [4, 5, 5, 5, 5, 5, 5, 5]
  4.  
  5. totalCost = 0
  6. for i, j in zip(SALVsteps, skillBoostsUsed):
  7. costStipend = j*(rarity * i**2 + 100)
  8. #print(i, j)
  9. totalCost += costStipend
  10. print(str(costStipend) + " added to " + str(totalCost - costStipend) + " → total " + str(totalCost))
  11. print(totalCost)
  12.  
  13. def levelCost(rarity=5,
  14. myLV=False,
  15. expToNextLV = False,
  16. preseeded = False,
  17. refTableName = "levelXP.tsv",
  18. boostTableName = "boostXP.tsv"):
  19. #make XP-per-level table
  20. if not Path(refTableName).exists():
  21. levels = range(1, 81)
  22. XPreq = [12, 15, 27, 36, 50, 80, 100, 130, 150, 200,
  23. 250, 350, 400, 550, 650, 700, 750, 800, 850, 900,
  24. 950, 1000, 1050, 1100, 1150, 1250, 1400, 1500, 1600, 1700,
  25. 1700, 1800, 1800, 1800, 1800, 1800, 1800, 1900, 1900, 1950,
  26. 2000, 2150, 2200, 2300, 2400, 2600, 2600, 2800, 3000, 3200,
  27. 3600, 4200, 5000, 5800, 6600, 7600, 8600, 9600, 10800, 11600,
  28. 12800, 14000, 15200, 16400, 17600, 19000, 20400, 23200, 24800, 26800,
  29. 28800, 31000, 33200, 35400, 37600, 39600, 42300, 45200, 47400, 50000]
  30. cumXP = [sum(XPreq[0:x+1]) - XPreq[x] for x in range(len(XPreq))]
  31.  
  32. print(len(XPreq), len(levels))
  33.  
  34. data = {"LV":levels, "XP to LV+1":XPreq, "Cumulative XP":cumXP }
  35. refTable = pd.DataFrame(data)
  36. print(refTable)
  37. refTable.to_csv(refTableName, sep="\t", index = False)
  38. #make Boost XP table
  39. if not Path(boostTableName).exists():
  40. boostLevel = ["S", "M", "L", "G"]
  41. boost1XP = 20
  42. XPboosts = [(4**x)*boost1XP for x in range(0,4)]
  43. XPmatchMultiplier = 1.2
  44. XPboosts2 = [int(x*XPmatchMultiplier) for x in XPboosts]
  45.  
  46. data = {"Boost Size":boostLevel, "Boost XP":XPboosts, "Boost XP (match)":XPboosts2}
  47.  
  48. boostTable = pd.DataFrame(data)
  49. print(boostTable)
  50. boostTable.to_csv(boostTableName, sep="\t", index = False)
  51.  
  52.  
  53. RT = pd.read_table(refTableName, sep="\t")
  54. BT = pd.read_table(boostTableName, sep="\t")
  55.  
  56. LB0Cap = 20 + (rarity-1)*5
  57. if preseeded == False:
  58. LBcaps = [LB0Cap + 10*x for x in range(0, 4)]
  59. LVseedCaps = [LBcaps[-1] + x for x in range(1, 11)]
  60. caps = LBcaps + LVseedCaps
  61.  
  62. LBlist = ["LB" + str(x) for x in range(0, 4)]
  63. LVseedList = ["LV+" + str(x) for x in range(1, 11)]
  64. capList = LBlist + LVseedList
  65. elif preseeded == True:
  66. LBcaps = [LB0Cap + 10*x for x in range(0, 3)]
  67. caps = LBcaps + [LBcaps[-1] + 20]
  68.  
  69. LBlist = ["LB" + str(x) for x in range(0, 3)]
  70. capList = LBlist + ["Final LB and preseeded"]
  71.  
  72.  
  73. else:
  74. print("error preseeded status")
  75. return
  76.  
  77.  
  78. print(caps, capList)
  79. data = {"Cap Label":capList, "Level Cap":caps}
  80.  
  81. capTable = pd.DataFrame(data)
  82.  
  83.  
  84. XPcumLB = [RT.loc[(RT["LV"] == x), "Cumulative XP"].tolist()[0] for x in capTable["Level Cap"].tolist()]
  85. XPbyLB = [XPcumLB[x] - XPcumLB[x-1] if x != 0 else XPcumLB[x] for x in range(len(XPcumLB))]
  86. print(XPcumLB)
  87. print(XPbyLB)
  88.  
  89. def coinCalc(LV, slotted=5):
  90. coins = slotted*(20*LV + 100)
  91. return coins
  92.  
  93. maxBoostMatchXP = BT["Boost XP (match)"].max()
  94. maxBoostXP = BT["Boost XP"].max()
  95. totalCost = 0
  96.  
  97. print("☆☆ Batching begins here")
  98.  
  99. OP = ""
  100.  
  101. totalBoosts = 0
  102. totalNonMatches = 0
  103. for i in range(len(XPbyLB)):
  104. #determine how many matching boosts are required to reach the next LV cap
  105. XPremaining = XPbyLB[i]
  106. maxBoostMatches = 0
  107. if myLV == False:
  108. if i != 0:
  109. floorLV = caps[i-1]
  110. else:
  111. floorLV = 1
  112. else:
  113. floorLV = myLV
  114. capLV = caps[i]
  115. while XPremaining > 0:
  116. maxBoostMatches += 1
  117. XPremaining -= maxBoostMatchXP
  118. print("☾☾ Leveling from " + str(floorLV) + " to " + str(capLV))
  119. print("Matched max boosts used: " + str(maxBoostMatches))
  120. print("XP wasted: " + str(-XPremaining))
  121.  
  122. #minimize how many matching boosts can be subbed with nonmatchers
  123. nonmatchBoosts = 0
  124. if XPremaining != 0 and maxBoostMatchXP - maxBoostXP > 0:
  125. tempMaxBoostMatches = maxBoostMatches
  126. while XPremaining < 0 and tempMaxBoostMatches > 0:
  127. nonmatchBoosts += 1
  128. tempMaxBoostMatches -= 1
  129. XPremaining = -(-XPremaining - (maxBoostMatchXP - maxBoostXP))
  130. if XPremaining != 0:
  131. nonmatchBoosts -= 1
  132. nonmatchBoostsStable = nonmatchBoosts
  133. #if XPremaining ends up being positive from subbing with nonmatchers, this indicates subbing has become inefficient enough for ≥1 more boost to be required
  134.  
  135. print("Non-matching boosts: " + str(nonmatchBoosts))
  136. # a max of 4 nonmatch subs is possible
  137. #subbing for any more even in the most extreme wasteful situation (G at 1XP left, for 1535 wasted) will lead to needing more boosts
  138.  
  139. matchBoosts = maxBoostMatches - nonmatchBoosts
  140.  
  141. #cost
  142. LVrangeCost = 0
  143. currentLV = floorLV
  144. currentXP = RT.loc[(RT["LV"] == currentLV), "Cumulative XP"].tolist()[0]
  145. #print(currentLV, currentXP)
  146.  
  147. firstBatch = maxBoostMatches % 5
  148. if firstBatch == 0:
  149. firstBatch = 5
  150. remainderBatchCount = (maxBoostMatches - firstBatch)//5
  151. #print(remainderBatchCount, type(remainderBatchCount))
  152.  
  153.  
  154.  
  155. batchList = [firstBatch,] + [5]*remainderBatchCount
  156. print(batchList)
  157.  
  158. for j in range(len(batchList)):
  159.  
  160. batchCost = coinCalc(currentLV, batchList[j])
  161. LVrangeCost += batchCost
  162.  
  163. for k in range(batchList[j]):
  164. #print(str(k+1) + " of " + str(batchList[j]) + " boosts in a batch (" + str(nonmatchBoosts) + " non-match boosts in tow before use)")
  165. if nonmatchBoosts > 0:
  166. nonmatchBoosts -= 1
  167. currentXP += maxBoostXP
  168. elif matchBoosts > 0:
  169. matchBoosts -=1
  170. currentXP += maxBoostMatchXP
  171. else:
  172. print("error: " + str(nonmatchBoosts) + " non-match boosts and " + str(matchBoosts) + " match boosts")
  173. return
  174. for k in range(len(RT.index) - 1):
  175.  
  176. if RT.loc[k, "Cumulative XP"] <= currentXP <= RT.loc[k+1, "Cumulative XP"]:
  177. currentLV = RT.loc[k, "LV"]
  178. break
  179. print("cost for this leveling range is " + str(LVrangeCost))
  180. totalCost += LVrangeCost
  181. totalBoosts += maxBoostMatches
  182. totalNonMatches += nonmatchBoostsStable
  183. print("Total cost up to this point is " + str(totalCost))
  184.  
  185. OP += "|" + str(maxBoostMatches) + " (" + str(nonmatchBoostsStable) + ") <br/> " + str(LVrangeCost) + "\n"
  186.  
  187.  
  188. print("☆☆")
  189. totalPrint = "|" + str(totalBoosts) + " (" + str(totalNonMatches) + ") <br/> " + str(totalCost) + "\n"
  190. OP += totalPrint
  191. print(OP)
  192.  
  193.  
  194.  
  195.  
  196. def skillSearch(start=0, Length=100):
  197. mystr1 = "{{#masterdata:Skill|"
  198. mystr2 = "|format=wiki}}"
  199.  
  200.  
  201. finish = start + Length
  202.  
  203. for i in range(start, finish):
  204. print(mystr1 + str(i+1) + mystr2)
  205.  
  206.  
  207. def valueWikiTabular(myInput=("0 1 2 3 4 5 6 7 8 9")):
  208. myList = myInput.split("\t")
  209. del myList[2:4]
  210. OP = " || ".join(myList)
  211. print(OP)
  212.  
  213.  
  214. '''
  215.  
  216.  
  217.  
  218.  
  219. - Under Rage, he’s obliged to have Tenacity up or at least a defensive buff, otherwise his durability is terrible, what with requiring to be hit for it to trigger.
  220.  
  221. - Only under Rage is his Charge worth noting, since LB3 doesn’t apply to it nor does it have any good effects despite the ailment being rather unique, making LB1 a bit useless.
  222.  
  223. '''
  224.  
  225.  
  226. if __name__ == "__main__":
  227. values = "6389 8274 68.776 510 4912 6599 2701 3630 8104 10889"
  228. #valueWikiTabular(values)
  229. skillSearch(300,100)
  230. #levelCost(rarity=1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement