Skip to content

Commit

Permalink
Added GetResetCost to remove multiple default entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnchyDev committed Oct 7, 2023
1 parent 45e819c commit 3d5ecef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Attriboost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,11 @@ uint32 GetTotalAttributes(Player* player)
return GetTotalAttributes(attributes);
}

uint32 GetResetCost()
{
return sConfigMgr->GetOption<uint32>("Attriboost.ResetCost", 2500000);
}

bool HasSetting(Player* player, uint32 setting)
{
if (!player)
Expand Down Expand Up @@ -724,7 +729,7 @@ bool AttriboostCreatureScript::OnGossipHello(Player* player, Creature* creature)

if (HasAttributes(player))
{
uint32 resetCost = sConfigMgr->GetOption<uint32>("Attriboost.ResetCost", 2500000);
uint32 resetCost = GetResetCost();
AddGossipItemFor(player, GOSSIP_ICON_DOT, "|TInterface\\GossipFrame\\UnlearnGossipIcon:16|t Reset Attributes", GOSSIP_SENDER_MAIN, 1000, "Are you sure you want to reset your attributes?", resetCost, false);
}

Expand Down Expand Up @@ -809,7 +814,7 @@ void AttriboostCreatureScript::HandleAttributeAllocation(Player* player, uint32

if (reset)
{
auto cost = sConfigMgr->GetOption<uint32>("Attriboost.ResetCost", 2500000);
auto cost = GetResetCost();
if (player->HasEnoughMoney(cost))
{
player->SetMoney(player->GetMoney() - cost);
Expand Down
1 change: 1 addition & 0 deletions src/Attriboost.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ bool IsAttributeAtMax(uint32 /*attribute*/);
uint32 GetAttributesToSpend(Player* /*player*/);
uint32 GetTotalAttributes(Player* /*player*/);
uint32 GetTotalAttributes(Attriboosts* /*attributes*/);
uint32 GetResetCost();
bool HasSetting(Player* player, uint32 /*setting*/);
void ToggleSetting(Player* player, uint32 /*setting*/);

Expand Down

0 comments on commit 3d5ecef

Please sign in to comment.