-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccesorries.py
130 lines (104 loc) · 3.82 KB
/
accesorries.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import pandas as pd
from prices import get_item_id, get_prices, get_market_price_info
from fs_costs import read_fs_costs
costs = read_fs_costs()
class Accessory():
def __init__(self, name):
self.id = get_item_id(name)
self.name = name
df = get_prices(name)
self.prices = [int(df['Base Price'].values[i]) for i in range(6)]
self.base_chance = [0, 0.25, 0.1, 0.075, 0.025, 0.005]
self.soft_cap = [0, 18, 40, 44, 110, 330]
# Get enhancement success chance based on enh. level and failstack
def get_chance(self, level, fs):
if fs <= self.soft_cap[level]:
return self.base_chance[level] + fs * self.base_chance[level] / 10
else:
return self.base_chance[level] + self.soft_cap[level] * self.base_chance[level] / 10 + (
fs - self.soft_cap[level]) * self.base_chance[level] / 50
# def enhance(self,level):
# stake = self.prices[0] + self.prices[level-1]
# success = self.prices[level]
# soft_cap = self.soft_cap[level]
# for fs, cost in enumerate(costs):
# chance = self.get_chance(level, fs)
# profit = self.prices[level] - cost - stake / chance
# Get most profitable FS to enhance a specific level
def optimal_enhance(self, level):
best_fs = 0
best_profit = -10000000000
stake = self.prices[0] + self.prices[level-1]
for fs, cost in enumerate(costs):
chance = self.get_chance(level, fs)
profit = self.prices[level] - cost - stake / chance
if profit > best_profit:
best_fs = fs
best_profit = profit
return (best_fs, int(best_profit/1000000))
def profits(self):
print(self.name)
print(self.optimal_enhance(1))
print(self.optimal_enhance(2))
print(self.optimal_enhance(3))
items = [
"Serap's Necklace",
"Sicil's Necklace",
"Laytenn's Power Stone",
'Ogre Ring',
'Tungrad Necklace',
'Revived Lunar Necklace',
'Revived River Necklace',
'Deboreka Necklace',
'Forest Ronaros Ring',
'Ring of Cadry Guardian',
'Ring of Crescent Guardian',
'Eye of the Ruins Ring',
'Ominous Ring',
'Tungrad Ring',
'Narc Ear Accessory',
'Ethereal Earring',
'Tungrad Earring',
"Vaha's Dawn",
'Black Distortion Earring',
"Centaurus Belt",
"Orkinrad's Belt",
"Basilisk's Belt",
"Valtarra Eclipsed Belt",
"Tungrad Belt",
"Turo's Belt",
"Deboreka Belt",
]
items = [
"Serap's Necklace",
"Sicil's Necklace",]
def acc_profits():
data = {}
for item in items:
acc = Accessory(item)
PRI = acc.optimal_enhance(1)
DUO = acc.optimal_enhance(2)
TRI = acc.optimal_enhance(3)
TET = acc.optimal_enhance(4)
PEN = acc.optimal_enhance(5)
row = [acc.prices[0], *PRI, *DUO, *TRI, *TET, *PEN]
data[acc.name] = row
columns = ['base_price', 'PRI_FS', 'PRI_profit', 'DUO_FS',
'DUO_profit', 'TRI_FS', 'TRI_profit', 'TET_FS', 'TET_profit', 'PEN_FS', 'PEN_profit']
df = pd.DataFrame.from_dict(data, orient='index', columns=columns)
# df['PRI-TRI'] = df['PRI_profit'] + df['DUO_profit'] + df['TRI_profit']
# df['DUO-TRI'] = df['DUO_profit'] + df['TRI_profit']
# df['DUO-TET'] = df['DUO_profit'] + df['TRI_profit'] + df['TET_profit']
print(df.sort_values(by='base_price', ascending=True))
def prices_overview():
data = {}
for item in items:
data[item] = []
for level in range(5):
prices = get_market_price_info(get_item_id(item),level)
avg = sum(prices)/len(prices)
last = prices[-1]
data[item].append(round(last/avg, 2))
print(pd.DataFrame.from_dict(data, orient='index'))
acc_profits()
# prices_overview()