Core/Gossip: Removed hardcoded costs for dual spec and fixed handling of gossip menus with box_money

This commit is contained in:
Shauren
2011-05-29 12:06:16 +02:00
parent 0194710990
commit 0bde74eff6
+16 -17
View File
@@ -14141,6 +14141,14 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
if (!menuItemData)
return;
int32 cost = int32(item->BoxMoney);
if (!HasEnoughMoney(cost))
{
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
PlayerTalkClass->SendCloseGossip();
return;
}
switch (gossipOptionId)
{
case GOSSIP_OPTION_GOSSIP:
@@ -14187,24 +14195,13 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
case GOSSIP_OPTION_LEARNDUALSPEC:
if (GetSpecsCount() == 1 && getLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))
{
if (!HasEnoughMoney(10000000))
{
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
PlayerTalkClass->SendCloseGossip();
break;
}
else
{
ModifyMoney(-10000000);
// Cast spells that teach dual spec
// Both are also ImplicitTarget self and must be cast by player
CastSpell(this, 63680, true, NULL, NULL, GetGUID());
CastSpell(this, 63624, true, NULL, NULL, GetGUID());
// Cast spells that teach dual spec
// Both are also ImplicitTarget self and must be cast by player
CastSpell(this, 63680, true, NULL, NULL, GetGUID());
CastSpell(this, 63624, true, NULL, NULL, GetGUID());
// Should show another Gossip text with "Congratulations..."
PlayerTalkClass->SendCloseGossip();
}
// Should show another Gossip text with "Congratulations..."
PlayerTalkClass->SendCloseGossip();
}
break;
case GOSSIP_OPTION_UNLEARNTALENTS:
@@ -14254,6 +14251,8 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
break;
}
}
ModifyMoney(-cost);
}
uint32 Player::GetGossipTextId(WorldObject *pSource)