Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import pandas as pd
- #import numpy as np
- #import re
- #import datetime
- #import math as m
- #from pathlib import Path
- #
- def skillCost(rarity=1):
- SALVsteps = [1, 25, 49, 67, 79, 88, 94, 97]
- skillBoostsUsed = [4, 5, 5, 5, 5, 5, 5, 5]
- totalCost = 0
- for i, j in zip(SALVsteps, skillBoostsUsed):
- costStipend = j*(rarity * i**2 + 100)
- #print(i, j)
- totalCost += costStipend
- print(str(costStipend) + " added to " + str(totalCost - costStipend) + " → total " + str(totalCost))
- print(totalCost)
- def levelCost(rarity=5,
- myLV=False,
- expToNextLV = False,
- preseeded = True,
- refTableName = "levelXP.tsv",
- boostTableName = "boostXP.tsv"):
- #make XP-per-level table
- if not Path(refTableName).exists():
- levels = range(1, 81)
- XPreq = [12, 15, 27, 36, 50, 80, 100, 130, 150, 200,
- 250, 350, 400, 550, 650, 700, 750, 800, 850, 900,
- 950, 1000, 1050, 1100, 1150, 1250, 1400, 1500, 1600, 1700,
- 1700, 1800, 1800, 1800, 1800, 1800, 1800, 1900, 1900, 1950,
- 2000, 2150, 2200, 2300, 2400, 2600, 2600, 2800, 3000, 3200,
- 3600, 4200, 5000, 5800, 6600, 7600, 8600, 9600, 10800, 11600,
- 12800, 14000, 15200, 16400, 17600, 19000, 20400, 23200, 24800, 26800,
- 28800, 31000, 33200, 35400, 37600, 39600, 42300, 45200, 47400, 50000]
- cumXP = [sum(XPreq[0:x+1]) - XPreq[x] for x in range(len(XPreq))]
- print(len(XPreq), len(levels))
- data = {"LV":levels, "XP to LV+1":XPreq, "Cumulative XP":cumXP }
- refTable = pd.DataFrame(data)
- print(refTable)
- refTable.to_csv(refTableName, sep="\t", index = False)
- #make Boost XP table
- if not Path(boostTableName).exists():
- boostLevel = ["S", "M", "L", "G"]
- boost1XP = 20
- XPboosts = [(4**x)*boost1XP for x in range(0,4)]
- XPmatchMultiplier = 1.2
- XPboosts2 = [int(x*XPmatchMultiplier) for x in XPboosts]
- data = {"Boost Size":boostLevel, "Boost XP":XPboosts, "Boost XP (match)":XPboosts2}
- boostTable = pd.DataFrame(data)
- print(boostTable)
- boostTable.to_csv(boostTableName, sep="\t", index = False)
- RT = pd.read_table(refTableName, sep="\t")
- BT = pd.read_table(boostTableName, sep="\t")
- LB0Cap = 20 + (rarity-1)*5
- if preseeded == False:
- LBcaps = [LB0Cap + 10*x for x in range(0, 4)]
- LVseedCaps = [LBcaps[-1] + x for x in range(1, 11)]
- caps = LBcaps + LVseedCaps
- LBlist = ["LB" + str(x) for x in range(0, 4)]
- LVseedList = ["LV+" + str(x) for x in range(1, 11)]
- capList = LBlist + LVseedList
- elif preseeded == True:
- LBcaps = [LB0Cap + 10*x for x in range(0, 3)]
- caps = LBcaps + [LBcaps[-1] + 20]
- LBlist = ["LB" + str(x) for x in range(0, 3)]
- capList = LBlist + ["Final LB and preseeded"]
- else:
- print("error preseeded status")
- return
- print(caps, capList)
- data = {"Cap Label":capList, "Level Cap":caps}
- capTable = pd.DataFrame(data)
- XPcumLB = [RT.loc[(RT["LV"] == x), "Cumulative XP"].tolist()[0] for x in capTable["Level Cap"].tolist()]
- XPbyLB = [XPcumLB[x] - XPcumLB[x-1] if x != 0 else XPcumLB[x] for x in range(len(XPcumLB))]
- print(XPcumLB)
- print(XPbyLB)
- def coinCalc(LV, slotted=5):
- coins = slotted*(20*LV + 100)
- return coins
- maxBoostMatchXP = BT["Boost XP (match)"].max()
- maxBoostXP = BT["Boost XP"].max()
- totalCost = 0
- print("☆☆ Batching begins here")
- OP = ""
- totalBoosts = 0
- totalNonMatches = 0
- for i in range(len(XPbyLB)):
- #determine how many matching boosts are required to reach the next LV cap
- XPremaining = XPbyLB[i]
- maxBoostMatches = 0
- if myLV == False:
- if i != 0:
- floorLV = caps[i-1]
- else:
- floorLV = 1
- else:
- floorLV = myLV
- capLV = caps[i]
- while XPremaining > 0:
- maxBoostMatches += 1
- XPremaining -= maxBoostMatchXP
- print("☾☾ Leveling from " + str(floorLV) + " to " + str(capLV))
- print("Matched max boosts used: " + str(maxBoostMatches))
- print("XP wasted: " + str(-XPremaining))
- #minimize how many matching boosts can be subbed with nonmatchers
- nonmatchBoosts = 0
- if XPremaining != 0 and maxBoostMatchXP - maxBoostXP > 0:
- tempMaxBoostMatches = maxBoostMatches
- while XPremaining < 0 and tempMaxBoostMatches > 0:
- nonmatchBoosts += 1
- tempMaxBoostMatches -= 1
- XPremaining = -(-XPremaining - (maxBoostMatchXP - maxBoostXP))
- if XPremaining != 0:
- nonmatchBoosts -= 1
- nonmatchBoostsStable = nonmatchBoosts
- #if XPremaining ends up being positive from subbing with nonmatchers, this indicates subbing has become inefficient enough for ≥1 more boost to be required
- print("Non-matching boosts: " + str(nonmatchBoosts))
- # a max of 4 nonmatch subs is possible
- #subbing for any more even in the most extreme wasteful situation (G at 1XP left, for 1535 wasted) will lead to needing more boosts
- matchBoosts = maxBoostMatches - nonmatchBoosts
- #cost
- LVrangeCost = 0
- currentLV = floorLV
- currentXP = RT.loc[(RT["LV"] == currentLV), "Cumulative XP"].tolist()[0]
- #print(currentLV, currentXP)
- firstBatch = maxBoostMatches % 5
- if firstBatch == 0:
- firstBatch = 5
- remainderBatchCount = (maxBoostMatches - firstBatch)//5
- #print(remainderBatchCount, type(remainderBatchCount))
- batchList = [firstBatch,] + [5]*remainderBatchCount
- print(batchList)
- for j in range(len(batchList)):
- batchCost = coinCalc(currentLV, batchList[j])
- LVrangeCost += batchCost
- for k in range(batchList[j]):
- #print(str(k+1) + " of " + str(batchList[j]) + " boosts in a batch (" + str(nonmatchBoosts) + " non-match boosts in tow before use)")
- if nonmatchBoosts > 0:
- nonmatchBoosts -= 1
- currentXP += maxBoostXP
- elif matchBoosts > 0:
- matchBoosts -=1
- currentXP += maxBoostMatchXP
- else:
- print("error: " + str(nonmatchBoosts) + " non-match boosts and " + str(matchBoosts) + " match boosts")
- return
- for k in range(len(RT.index) - 1):
- if RT.loc[k, "Cumulative XP"] <= currentXP <= RT.loc[k+1, "Cumulative XP"]:
- currentLV = RT.loc[k, "LV"]
- break
- print("cost for this leveling range is " + str(LVrangeCost))
- totalCost += LVrangeCost
- totalXP = sum(XPbyLB)
- totalBoosts += maxBoostMatches
- totalNonMatches += nonmatchBoostsStable
- print("Total cost up to this point is " + str(totalCost))
- OP += "|" + str(XPbyLB[i]) + " <br/> " + str(maxBoostMatches) + " (" + str(nonmatchBoostsStable) + ") <br/> " + str(LVrangeCost) + "\n"
- print("☆☆")
- totalPrint = "|" + str(totalXP) + " <br/> " + str(totalBoosts) + " (" + str(totalNonMatches) + ") <br/> " + str(totalCost) + "\n"
- OP += totalPrint
- print(OP)
- def masterdataSearch(datatype="Skill", start=0, Length=100):
- mystr1 = "{{#masterdata:"+datatype+"|"
- mystr2 = "}}"
- if datatype == "Skill":
- mystr2 = "|format=wiki" + mystr2
- elif datatype == "Quest":
- mystr2 = "|args=fullname" + mystr2
- ##n.b. for datatype==Quest:
- #[20000,30000) main story main quest, test main story main quests?
- #[20000,30000):
- #1-48 main story free quests (ch1-9)
- #49-51 AR lesson quests
- #[30000,40000) for character quests
- #[40000,50000):
- #1-25 test main story free quests?
- #next few are love quests
- #[50000,80000) for daily quests
- #[60000,70000) for event main quests
- #[70000,80000) for event free quests
- #[80000,90000) for special quests
- #[90000,100000) for skill quests
- #[100000,11000) for dungeon quests
- finish = start + Length
- for i in range(start, finish):
- print(mystr1 + str(i+1) + mystr2)
- def valueWikiTabular(myInput=("0 1 2 3 4 5 6 7 8 9")):
- myList = myInput.split("\t")
- del myList[2:4]
- OP = " || ".join(myList)
- print(OP)
- def dungeonXPsplitter(questXP = 32000, XPreq = 65000, mentorMod = 0.5):
- #assumes each unit requires XPreq
- questXP *= 1 + mentorMod
- overages = []
- allCaseRuns = []
- for units in range(1,6): #support excluded from XP distribution, so only up the overages for runs done by up to 5 units are checked
- XPoverage = XPreq - questXP/units
- runs = 1
- print(str(units) + " units")
- while XPoverage > 0:
- print("cum XP per unit gained in "+ str(runs) + " runs: " + str((questXP/units)*runs))
- XPoverage -= questXP/units
- runs += 1
- print("total XP per unit gained in "+ str(runs) + " runs: " + str((questXP/units)*runs) + " (" + str(-XPoverage) + " wasted)")
- overages.append(XPoverage)
- allCaseRuns.append(runs)
- for i in range(len(overages)):
- print(str(i+1) + " units, " + str(-overages[i]) + " wasted XP, " + str(-overages[i]/(i+1)) + " wasted XP per run, " + str(allCaseRuns[i]) + " runs.")
- #convert multi-column lookup formula from array-dependent to array-independent
- #{=INDEX(range1,MATCH(1,(A1=range2)*(B1=range3)*(C1=range4),0))} → =INDEX(rng1,MATCH(1,INDEX((A1=rng2)*(B1=rng3)*(C1=rng4),0,1),0))
- '''
- '''
- if __name__ == "__main__":
- values = "7591 9682 49.388 710 3871 5365 1006 1395 3019 4184"
- #valueWikiTabular(values)
- #masterdataSearch(datatype="Skill", start=1100, Length=100)
- #levelCost(rarity=1)
- dungeonXPsplitter()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement