Skip to content

Commit a2416c0

Browse files
committed
added gp/hr and xp/hr to fish profit command
1 parent 1e87a6b commit a2416c0

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

bot/commands/fish_profit.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ async def select_callback(self, interaction: discord.Interaction, select: discor
3030
return
3131

3232
df = pd.DataFrame(self.fish_prices)
33-
df_sorted = df.sort_values(by="Profit", ascending=False)
33+
df_sorted = df.sort_values(by="GP/hr", ascending=False)
3434

3535
if format_choice == "markdown":
36-
table_header = f"{'Fish':<12} {'Raw Price':<12} {'Cooked Price':<12} {'Profit':<12}\n{'-'*12} {'-'*12} {'-'*12} {'-'*12}\n"
36+
table_header = f"{'Fish':<12} {'Raw Price':<12} {'Cooked Price':<12} {'Profit':<12} {'XP/hr':<12} {'GP/hr':<12}\n{'-'*12} {'-'*12} {'-'*12} {'-'*12} {'-'*12} {'-'*12}\n"
3737
table_rows = ""
3838
for index, row in df_sorted.iterrows():
39-
table_rows += f"{row['Fish']:<12} {row['Raw Price']:<12} {row['Cooked Price']:<12} {int(row['Profit']):<12}\n"
39+
table_rows += f"{row['Fish']:<12} {row['Raw Price']:<12} {row['Cooked Price']:<12} {int(row['Profit']):<12} {row['XP/hr']:<12} {row['GP/hr']:<12}\n"
4040
table = f"```{table_header}{table_rows}```"
4141
await self.interaction.followup.send(content=f"{self.interaction.user.mention} Here are the results:\n{table}")
4242

@@ -50,6 +50,8 @@ async def select_callback(self, interaction: discord.Interaction, select: discor
5050
f"**Raw Price:** {row['Raw Price']}\n"
5151
f"**Cooked Price:** {row['Cooked Price']}\n"
5252
f"**Profit:** {int(row['Profit'])}\n"
53+
f"**XP/hr:** {row['XP/hr']}\n"
54+
f"**GP/hr:** {row['XP/hr']}\n"
5355
),
5456
inline=False
5557
)
@@ -63,21 +65,27 @@ def __init__(self, bot):
6365
@app_commands.command(name="fish_profit", description="Calculate the potential profit from cooking fish.")
6466
async def fish_profit(self, interaction: discord.Interaction):
6567
prices = fetch_latest_prices()
68+
cooking_rate = 1435
6669

6770
profit_results = []
6871
for fish_name, info in fish.items():
6972
raw_id_str = str(info["raw_id"])
7073
cooked_id_str = str(info["cooked_id"])
74+
fish_xp_each = info["xp_each"]
7175
raw_price = prices[raw_id_str]["high"]
7276
cooked_price = prices[cooked_id_str]["high"]
7377

7478
if raw_price and cooked_price:
7579
profit_fish = cooked_price - raw_price
80+
xphr = cooking_rate * fish_xp_each
81+
gphr = cooking_rate * profit_fish
7682
profit_results.append({
7783
"Fish": fish_name,
7884
"Raw Price": raw_price,
7985
"Cooked Price": cooked_price,
80-
"Profit": profit_fish
86+
"Profit": profit_fish,
87+
"XP/hr": xphr,
88+
"GP/hr": gphr
8189
})
8290

8391
view = FormatSelectView(bot=self.bot, interaction=interaction, fish_prices=profit_results)

bot/utils/calculations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def calculate_custom_profit(prices, herbs, farming_level, patches, weiss, trollh
6262
if "Hosidius" in protected_names and kourend:
6363
expected_yield_protected = generate_estimated_yield(
6464
farming_level, low_cts, high_cts, harvest_lives, item_bonus, kourend_bonus, attas_bonus)
65-
else:
65+
else: # change logic to check for kandarin patches (Catherby)
6666
expected_yield_protected = generate_estimated_yield(
6767
farming_level, low_cts, high_cts, harvest_lives, item_bonus, kandarin_bonus, attas_bonus)
6868
total_yield_protected += expected_yield_protected

data/items.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
}
1818

1919
fish = {
20-
"Tuna": {"raw_id": 359, "cooked_id": 361},
21-
"Lobster": {"raw_id": 377, "cooked_id": 379},
22-
"Swordfish": {"raw_id": 371, "cooked_id": 373},
23-
"Monkfish": {"raw_id": 7944, "cooked_id": 7946},
24-
"Shark": {"raw_id": 383, "cooked_id": 385},
25-
"Anglerfish": {"raw_id": 13439, "cooked_id": 13441},
26-
"Manta Ray": {"raw_id": 389, "cooked_id": 391}
20+
"Tuna": {"raw_id": 359, "cooked_id": 361, "xp_each": 100},
21+
"Lobster": {"raw_id": 377, "cooked_id": 379, "xp_each": 120},
22+
"Swordfish": {"raw_id": 371, "cooked_id": 373, "xp_each": 140},
23+
"Monkfish": {"raw_id": 7944, "cooked_id": 7946, "xp_each": 150},
24+
"Shark": {"raw_id": 383, "cooked_id": 385, "xp_each": 210},
25+
"Anglerfish": {"raw_id": 13439, "cooked_id": 13441, "xp_each": 230},
26+
"Manta Ray": {"raw_id": 389, "cooked_id": 391, "xp_each": 216.3}
2727
}

0 commit comments

Comments
 (0)