Core:
* add Player::HasEnoughMoney methods to check, whether player has specified amount of money and use new methods where applicable * fix some signed/unsigned warnings and some typos --HG-- branch : trunk
This commit is contained in:
@@ -91,10 +91,10 @@ void BattlegroundWS::Update(uint32 diff)
|
||||
else
|
||||
EndBattleground(ALLIANCE);
|
||||
}
|
||||
else if (GetStartTime() > m_minutesElapsed*MINUTE*IN_MILLISECONDS)
|
||||
else if (GetStartTime() > uint32(m_minutesElapsed * MINUTE * IN_MILLISECONDS))
|
||||
{
|
||||
++m_minutesElapsed;
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, 25-m_minutesElapsed);
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, 25 - m_minutesElapsed);
|
||||
}
|
||||
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
|
||||
@@ -3367,7 +3367,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(uloc_idx);
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
CreatureLocale const *cl = sObjectMgr.GetCreatureLocale (id);
|
||||
if (cl)
|
||||
{
|
||||
@@ -3438,7 +3438,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(uloc_idx);
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
GameObjectLocale const *gl = sObjectMgr.GetGameObjectLocale(id);
|
||||
if (gl)
|
||||
{
|
||||
|
||||
@@ -1622,7 +1622,7 @@ bool Pet::resetTalents(bool no_cost)
|
||||
{
|
||||
cost = resetTalentsCost();
|
||||
|
||||
if (player->GetMoney() < cost)
|
||||
if (!player->HasEnoughMoney(cost))
|
||||
{
|
||||
player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
return false;
|
||||
|
||||
@@ -4027,7 +4027,7 @@ bool Player::resetTalents(bool no_cost)
|
||||
{
|
||||
cost = resetTalentsCost();
|
||||
|
||||
if (GetMoney() < cost)
|
||||
if (!HasEnoughMoney(cost))
|
||||
{
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
return false;
|
||||
@@ -5090,7 +5090,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
|
||||
|
||||
TotalCost = costs;
|
||||
}
|
||||
else if (GetMoney() < costs)
|
||||
else if (!HasEnoughMoney(costs))
|
||||
{
|
||||
sLog.outStaticDebug("You do not have enough money");
|
||||
return TotalCost;
|
||||
@@ -13699,7 +13699,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
||||
case GOSSIP_OPTION_LEARNDUALSPEC:
|
||||
if (GetSpecsCount() == 1 && !(getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))
|
||||
{
|
||||
if (GetMoney() < 10000000)
|
||||
if (!HasEnoughMoney(10000000))
|
||||
{
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
PlayerTalkClass->CloseGossip();
|
||||
@@ -14127,7 +14127,7 @@ bool Player::CanCompleteQuest(uint32 quest_id)
|
||||
|
||||
if (qInfo->GetRewOrReqMoney() < 0)
|
||||
{
|
||||
if (GetMoney() < uint32(-qInfo->GetRewOrReqMoney()))
|
||||
if (!HasEnoughMoney(-qInfo->GetRewOrReqMoney()))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14194,7 +14194,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, bool msg)
|
||||
}
|
||||
|
||||
// prevent receive reward with low money and GetRewOrReqMoney() < 0
|
||||
if (pQuest->GetRewOrReqMoney() < 0 && GetMoney() < uint32(-pQuest->GetRewOrReqMoney()))
|
||||
if (pQuest->GetRewOrReqMoney() < 0 && !HasEnoughMoney(-pQuest->GetRewOrReqMoney()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -19790,7 +19790,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
||||
if (price)
|
||||
price = uint32(floor(price * GetReputationPriceDiscount(pCreature)));
|
||||
|
||||
if (GetMoney() < price)
|
||||
if (!HasEnoughMoney(price))
|
||||
{
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, item, 0);
|
||||
return false;
|
||||
|
||||
@@ -1447,8 +1447,15 @@ class Player : public Unit, public GridObject<Player>
|
||||
void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;}
|
||||
void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
|
||||
|
||||
uint32 GetMoney() { return GetUInt32Value (PLAYER_FIELD_COINAGE); }
|
||||
uint32 GetMoney() const { return GetUInt32Value (PLAYER_FIELD_COINAGE); }
|
||||
void ModifyMoney(int32 d);
|
||||
bool HasEnoughMoney(uint32 amount) const { return (GetMoney() >= amount); }
|
||||
bool HasEnoughMoney(int32 amount) const
|
||||
{
|
||||
if (amount > 0)
|
||||
return (GetMoney() >= (uint32) amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetMoney(uint32 value)
|
||||
{
|
||||
|
||||
@@ -122,7 +122,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
|
||||
uint32 reqmoney = cost + money;
|
||||
|
||||
if (pl->GetMoney() < reqmoney)
|
||||
if (!pl->HasEnoughMoney(reqmoney))
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
@@ -425,7 +425,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
|
||||
}
|
||||
|
||||
// prevent cheating with skip client money check
|
||||
if (pl->GetMoney() < m->COD)
|
||||
if (!pl->HasEnoughMoney(m->COD))
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
|
||||
@@ -198,7 +198,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
|
||||
//we have to take deposit :
|
||||
uint32 deposit = sAuctionMgr.GetAuctionDeposit(auctionHouseEntry, etime, it);
|
||||
if (pl->GetMoney() < deposit)
|
||||
if (!pl->HasEnoughMoney(deposit))
|
||||
{
|
||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
|
||||
return;
|
||||
@@ -305,7 +305,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (price > pl->GetMoney())
|
||||
if (pl->HasEnoughMoney(price))
|
||||
{
|
||||
//you don't have enought money!, client tests!
|
||||
//SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
|
||||
@@ -404,7 +404,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
||||
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
|
||||
{
|
||||
uint32 auctionCut = auction->GetAuctionCut();
|
||||
if (pl->GetMoney() < auctionCut) //player doesn't have enough money, maybe message needed
|
||||
if (!pl->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
||||
return;
|
||||
//some auctionBidderNotification would be needed, but don't know that parts..
|
||||
sAuctionMgr.SendAuctionCancelledToBidderMail(auction, trans);
|
||||
|
||||
@@ -1080,7 +1080,7 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
|
||||
// 0 - ok
|
||||
// 1,3 - not enough money
|
||||
// 2 - you have to seat on barber chair
|
||||
if (_player->GetMoney() < Cost)
|
||||
if (!_player->HasEnoughMoney(Cost))
|
||||
{
|
||||
WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
|
||||
data << uint32(1); // no money
|
||||
|
||||
@@ -743,7 +743,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetPlayer()->GetMoney() < 10*GOLD)
|
||||
if (!GetPlayer()->HasEnoughMoney(10 * GOLD))
|
||||
{
|
||||
//"You can't afford to do that."
|
||||
SendSaveGuildEmblem(ERR_GUILDEMBLEM_NOTENOUGHMONEY);
|
||||
@@ -873,7 +873,7 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket & recv_data)
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
return;
|
||||
|
||||
if (GetPlayer()->GetMoney() < money)
|
||||
if (!GetPlayer()->HasEnoughMoney(money))
|
||||
return;
|
||||
|
||||
uint32 GuildId = GetPlayer()->GetGuildId();
|
||||
@@ -1098,7 +1098,7 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket & recv_data)
|
||||
if (!TabCost)
|
||||
return;
|
||||
|
||||
if (GetPlayer()->GetMoney() < TabCost) // Should not happen, this is checked by client
|
||||
if (!GetPlayer()->HasEnoughMoney(TabCost)) // Should not happen, this is checked by client
|
||||
return;
|
||||
|
||||
// Go on with creating tab
|
||||
|
||||
@@ -619,7 +619,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
|
||||
if (pItem)
|
||||
{
|
||||
uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START);
|
||||
if (_player->GetMoney() < price)
|
||||
if (!_player->HasEnoughMoney(price))
|
||||
{
|
||||
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, pItem->GetEntry(), 0);
|
||||
return;
|
||||
@@ -886,7 +886,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
|
||||
|
||||
uint32 price = slotEntry->price;
|
||||
|
||||
if (_player->GetMoney() < price)
|
||||
if (!_player->HasEnoughMoney(price))
|
||||
{
|
||||
data << uint32(ERR_BANKSLOT_INSUFFICIENT_FUNDS);
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -277,7 +277,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data)
|
||||
uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(unit)));
|
||||
|
||||
// check money requirement
|
||||
if (_player->GetMoney() < nSpellCost)
|
||||
if (!_player->HasEnoughMoney(nSpellCost))
|
||||
return;
|
||||
|
||||
_player->ModifyMoney(-int32(nSpellCost));
|
||||
@@ -727,7 +727,7 @@ void WorldSession::HandleBuyStableSlot(WorldPacket & recv_data)
|
||||
if (GetPlayer()->m_stableSlots < MAX_PET_STABLES)
|
||||
{
|
||||
StableSlotPricesEntry const *SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1);
|
||||
if (_player->GetMoney() >= SlotPrice->Price)
|
||||
if (_player->HasEnoughMoney(SlotPrice->Price))
|
||||
{
|
||||
++GetPlayer()->m_stableSlots;
|
||||
_player->ModifyMoney(-int32(SlotPrice->Price));
|
||||
|
||||
@@ -179,7 +179,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player->GetMoney() < cost)
|
||||
if (!_player->HasEnoughMoney(cost))
|
||||
{ //player hasn't got enough money
|
||||
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, charterid, 0);
|
||||
return;
|
||||
|
||||
@@ -273,7 +273,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
my_trade->SetAccepted(true);
|
||||
|
||||
// not accept case incorrect money amount
|
||||
if (my_trade->GetMoney() > _player->GetMoney())
|
||||
if (!_player->HasEnoughMoney(my_trade->GetMoney()))
|
||||
{
|
||||
SendNotification(LANG_NOT_ENOUGH_GOLD);
|
||||
my_trade->SetAccepted(false, true);
|
||||
@@ -281,7 +281,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
}
|
||||
|
||||
// not accept case incorrect money amount
|
||||
if (his_trade->GetMoney() > trader->GetMoney())
|
||||
if (trader->HasEnoughMoney(his_trade->GetMoney()))
|
||||
{
|
||||
trader->GetSession()->SendNotification(LANG_NOT_ENOUGH_GOLD);
|
||||
his_trade->SetAccepted(false, true);
|
||||
|
||||
@@ -310,7 +310,7 @@ class boss_akilzon : public CreatureScript
|
||||
CallLighting_Timer = (12 + rand()%5)*1000; //totaly random timer. can't find any info on this
|
||||
} else CallLighting_Timer -= diff;
|
||||
|
||||
if (!isRaining && ElectricalStorm_Timer < 8000 + rand()%5000)
|
||||
if (!isRaining && ElectricalStorm_Timer < uint32(8000 + rand() % 5000))
|
||||
{
|
||||
SetWeather(WEATHER_STATE_HEAVY_RAIN, 0.9999f);
|
||||
isRaining = true;
|
||||
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
if (Phase == FEEDING && pEmbraceTarget && pEmbraceTarget->isAlive())
|
||||
{
|
||||
uiEmbraceTakenDamage += damage;
|
||||
if (uiEmbraceTakenDamage > DUNGEON_MODE(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG))
|
||||
if (uiEmbraceTakenDamage > (uint32) DUNGEON_MODE(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG))
|
||||
{
|
||||
Phase = NORMAL;
|
||||
uiPhaseTimer = 0;
|
||||
|
||||
@@ -122,8 +122,8 @@ public:
|
||||
events.ScheduleEvent(EVENT_BERSERK, 5*60000);
|
||||
break;
|
||||
case EVENT_SUMMON:
|
||||
for (uint32 i = 0; i < RAID_MODE(1,2); ++i)
|
||||
DoSummon(MOB_ZOMBIE, PosSummon[rand()%3]);
|
||||
for (int32 i = 0; i < RAID_MODE(1, 2); ++i)
|
||||
DoSummon(MOB_ZOMBIE, PosSummon[rand() % 3]);
|
||||
events.ScheduleEvent(EVENT_SUMMON, 10000);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1151,12 +1151,12 @@ public:
|
||||
// Start encounter
|
||||
if (uiAction == 0)
|
||||
{
|
||||
for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i)
|
||||
DoSummon(VEHICLE_SIEGE, PosSiege[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i)
|
||||
DoSummon(VEHICLE_CHOPPER, PosChopper[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i)
|
||||
DoSummon(VEHICLE_DEMOLISHER,PosDemolisher[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
for (int32 i = 0; i < RAID_MODE(2, 5); ++i)
|
||||
DoSummon(VEHICLE_SIEGE, PosSiege[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
for (int32 i = 0; i < RAID_MODE(2, 5); ++i)
|
||||
DoSummon(VEHICLE_CHOPPER, PosChopper[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
for (int32 i = 0; i < RAID_MODE(2, 5); ++i)
|
||||
DoSummon(VEHICLE_DEMOLISHER, PosDemolisher[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -951,7 +951,7 @@ public:
|
||||
return;
|
||||
|
||||
Event = EVENT_NULL;
|
||||
for (uint32 i = 1; i <= MaxTimer[Phase]; ++i)
|
||||
for (int32 i = 1; i <= MaxTimer[Phase]; ++i)
|
||||
{
|
||||
if (Timer[i]) // Event is enabled
|
||||
if (Timer[i] <= diff)
|
||||
|
||||
@@ -185,17 +185,17 @@ there is no difference here (except that default text is chosen with `gameobject
|
||||
# formulas to calculate unlearning cost
|
||||
###*/
|
||||
|
||||
uint32 DoLearnCost(Player* /*pPlayer*/) //tailor, alchemy
|
||||
int32 DoLearnCost(Player* /*pPlayer*/) //tailor, alchemy
|
||||
{
|
||||
return 200000;
|
||||
}
|
||||
|
||||
uint32 DoHighUnlearnCost(Player* /*pPlayer*/) //tailor, alchemy
|
||||
int32 DoHighUnlearnCost(Player* /*pPlayer*/) //tailor, alchemy
|
||||
{
|
||||
return 1500000;
|
||||
}
|
||||
|
||||
uint32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leatherwork
|
||||
int32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leatherwork
|
||||
{
|
||||
uint8 level = pPlayer->getLevel();
|
||||
if (level < 51)
|
||||
@@ -206,7 +206,7 @@ uint32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leath
|
||||
return 1000000;
|
||||
}
|
||||
|
||||
uint32 DoLowUnlearnCost(Player* pPlayer) //blacksmith
|
||||
int32 DoLowUnlearnCost(Player* pPlayer) //blacksmith
|
||||
{
|
||||
uint8 level = pPlayer->getLevel();
|
||||
if (level < 66)
|
||||
@@ -412,7 +412,7 @@ public:
|
||||
break;
|
||||
//Learn Alchemy
|
||||
case GOSSIP_ACTION_INFO_DEF + 1:
|
||||
if (!pPlayer->HasSpell(S_TRANSMUTE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer))
|
||||
if (!pPlayer->HasSpell(S_TRANSMUTE) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_LEARN_TRANSMUTE, true);
|
||||
pPlayer->ModifyMoney(-DoLearnCost(pPlayer));
|
||||
@@ -421,7 +421,7 @@ public:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF + 2:
|
||||
if (!pPlayer->HasSpell(S_ELIXIR) && pPlayer->GetMoney() >= DoLearnCost(pPlayer))
|
||||
if (!pPlayer->HasSpell(S_ELIXIR) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_LEARN_ELIXIR, true);
|
||||
pPlayer->ModifyMoney(-DoLearnCost(pPlayer));
|
||||
@@ -430,7 +430,7 @@ public:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF + 3:
|
||||
if (!pPlayer->HasSpell(S_POTION) && pPlayer->GetMoney() >= DoLearnCost(pPlayer))
|
||||
if (!pPlayer->HasSpell(S_POTION) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_LEARN_POTION, true);
|
||||
pPlayer->ModifyMoney(-DoLearnCost(pPlayer));
|
||||
@@ -440,7 +440,7 @@ public:
|
||||
break;
|
||||
//Unlearn Alchemy
|
||||
case GOSSIP_ACTION_INFO_DEF + 4:
|
||||
if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer)))
|
||||
{
|
||||
pCreature->CastSpell(pPlayer, S_UNLEARN_TRANSMUTE, true);
|
||||
pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer));
|
||||
@@ -449,7 +449,7 @@ public:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF + 5:
|
||||
if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer)))
|
||||
{
|
||||
pCreature->CastSpell(pPlayer, S_UNLEARN_ELIXIR, true);
|
||||
pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer));
|
||||
@@ -458,7 +458,7 @@ public:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF + 6:
|
||||
if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer)))
|
||||
{
|
||||
pCreature->CastSpell(pPlayer, S_UNLEARN_POTION, true);
|
||||
pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer));
|
||||
@@ -650,7 +650,7 @@ public:
|
||||
}
|
||||
else if (EquippedOk(pPlayer,S_UNLEARN_WEAPON))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoLowUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoLowUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_WEAPON, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_WEAPON);
|
||||
@@ -669,7 +669,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 4:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_ARMOR))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoLowUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoLowUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_ARMOR, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_ARMOR);
|
||||
@@ -698,7 +698,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 8:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_HAMMER))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_HAMMER, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_HAMMER);
|
||||
@@ -712,7 +712,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 9:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_AXE))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_AXE, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_AXE);
|
||||
@@ -726,7 +726,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 10:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_SWORD))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_SWORD, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SWORD);
|
||||
@@ -1012,7 +1012,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 1:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_DRAGON))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_DRAGON, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_DRAGON);
|
||||
@@ -1026,7 +1026,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 2:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_ELEMENTAL))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_ELEMENTAL, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_ELEMENTAL);
|
||||
@@ -1040,7 +1040,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 3:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_TRIBAL))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoMedUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_TRIBAL, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_TRIBAL);
|
||||
@@ -1166,7 +1166,7 @@ public:
|
||||
break;
|
||||
//Learn Tailor
|
||||
case GOSSIP_ACTION_INFO_DEF + 1:
|
||||
if (!pPlayer->HasSpell(S_SPELLFIRE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer))
|
||||
if (!pPlayer->HasSpell(S_SPELLFIRE) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_LEARN_SPELLFIRE, true);
|
||||
pPlayer->ModifyMoney(-DoLearnCost(pPlayer));
|
||||
@@ -1175,7 +1175,7 @@ public:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF + 2:
|
||||
if (!pPlayer->HasSpell(S_MOONCLOTH) && pPlayer->GetMoney() >= DoLearnCost(pPlayer))
|
||||
if (!pPlayer->HasSpell(S_MOONCLOTH) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_LEARN_MOONCLOTH, true);
|
||||
pPlayer->ModifyMoney(-DoLearnCost(pPlayer));
|
||||
@@ -1184,7 +1184,7 @@ public:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF + 3:
|
||||
if (!pPlayer->HasSpell(S_SHADOWEAVE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer))
|
||||
if (!pPlayer->HasSpell(S_SHADOWEAVE) && pPlayer->HasEnoughMoney(DoLearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_LEARN_SHADOWEAVE, true);
|
||||
pPlayer->ModifyMoney(-DoLearnCost(pPlayer));
|
||||
@@ -1196,7 +1196,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 4:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_SPELLFIRE))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_SPELLFIRE, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SPELLFIRE);
|
||||
@@ -1210,7 +1210,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 5:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_MOONCLOTH))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_MOONCLOTH, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_MOONCLOTH);
|
||||
@@ -1224,7 +1224,7 @@ public:
|
||||
case GOSSIP_ACTION_INFO_DEF + 6:
|
||||
if (EquippedOk(pPlayer,S_UNLEARN_SHADOWEAVE))
|
||||
{
|
||||
if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer))
|
||||
if (pPlayer->HasEnoughMoney(DoHighUnlearnCost(pPlayer)))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, S_UNLEARN_SHADOWEAVE, true);
|
||||
ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SHADOWEAVE);
|
||||
|
||||
@@ -1314,7 +1314,7 @@ public:
|
||||
case GOSSIP_OPTION_LEARNDUALSPEC:
|
||||
if (pPlayer->GetSpecsCount() == 1 && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))
|
||||
{
|
||||
if (pPlayer->GetMoney() < 10000000)
|
||||
if (!pPlayer->HasEnoughMoney(10000000))
|
||||
{
|
||||
pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
pPlayer->PlayerTalkClass->CloseGossip();
|
||||
@@ -2582,7 +2582,7 @@ public:
|
||||
}
|
||||
if (doSwitch)
|
||||
{
|
||||
if (pPlayer->GetMoney() < EXP_COST)
|
||||
if (!pPlayer->HasEnoughMoney(EXP_COST))
|
||||
pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
else if (noXPGain)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user