Skip to content

Commit

Permalink
read gold cost option as int32
Browse files Browse the repository at this point in the history
removes redundant int32 casts

no need to store gold cost as uint32; gold cost max is 214748g
  • Loading branch information
sogladev committed Nov 30, 2024
1 parent 2daf861 commit 6c95bb2
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/RacialTraitSwap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class npc_race_trait_swap : public CreatureScript

bool OnGossipSelect(Player* player, Creature* creature, uint32 /*menuId*/, uint32 gossipListId) override
{
int32 const RTS1 = sConfigMgr->GetOption<uint32>("Racial.Traits.Swap.Gold", 100);
int32 const RTS1 = sConfigMgr->GetOption<int32>("Racial.Traits.Swap.Gold", 100);

char const* localizedExit = {};
char const* localizedBack = {};
Expand Down Expand Up @@ -1219,9 +1219,9 @@ class npc_race_trait_swap : public CreatureScript

case 112: // Blood Elf
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occure and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(28877, false); // Arcane Affinity
Expand Down Expand Up @@ -1261,9 +1261,9 @@ class npc_race_trait_swap : public CreatureScript

case 212: // Draenei
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occure and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(28875, false); // Gem Cutting
Expand Down Expand Up @@ -1333,9 +1333,9 @@ class npc_race_trait_swap : public CreatureScript

case 31: // Dwarves
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occure and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(2481, false); // Find Treasure
Expand All @@ -1354,9 +1354,9 @@ class npc_race_trait_swap : public CreatureScript

case 41: // Gnome
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occur and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(20592, false); // Arcane Resistance
Expand All @@ -1374,9 +1374,9 @@ class npc_race_trait_swap : public CreatureScript

case 51: // Human
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occure and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(20599, false); // Diplomacy
Expand All @@ -1396,9 +1396,9 @@ class npc_race_trait_swap : public CreatureScript

case 61: // Night Elf
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occure and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(20583, false); // Nature Resistance
Expand All @@ -1417,9 +1417,9 @@ class npc_race_trait_swap : public CreatureScript

case 71: // Orc
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occure and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(20574, false); // Axe Specialization
Expand Down Expand Up @@ -1475,9 +1475,9 @@ class npc_race_trait_swap : public CreatureScript

case 81: // Tauren
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occure and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(20552, false); // Cultivation
Expand All @@ -1495,9 +1495,9 @@ class npc_race_trait_swap : public CreatureScript

case 91: // Troll
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occure and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(20557, false); // Beast Slaying
Expand All @@ -1517,9 +1517,9 @@ class npc_race_trait_swap : public CreatureScript

case 101: // Undead
CloseGossipMenuFor(player);
if (!player->HasEnoughMoney(int32(RTS1 * GOLD))) // gold check
if (!player->HasEnoughMoney(RTS1 * GOLD)) // gold check
return true;
player->ModifyMoney(int32(-RTS1 * GOLD)); // Deducting the money if check passes
player->ModifyMoney(-RTS1 * GOLD); // Deducting the money if check passes
player->CastSpell(player, 47292); // Level up visual effect to let you know the transaction did occure and money is deducted
RemoveAllRacials(player); // Remove all racials
player->learnSpell(20577, false); // Cannibalize
Expand Down

0 comments on commit 6c95bb2

Please sign in to comment.