Core/Misc: Update money to 64 bits (from 32), increasing the maximum gold possible
This got a bit messy and will be further fixed when all related packets are updated. (Also fixed a typo in atoll msvc macro)
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE `characters` CHANGE `money` `money` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `mail` CHANGE `money` `money` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `mail` CHANGE `cod` `cod` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
@@ -251,7 +251,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
return false;
|
||||
|
||||
uint32 accId = 0;
|
||||
uint32 money = 0;
|
||||
uint64 money = 0;
|
||||
uint32 total_player_time = 0;
|
||||
uint8 level = 0;
|
||||
uint32 latency = 0;
|
||||
@@ -299,7 +299,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
Field* fields = result->Fetch();
|
||||
total_player_time = fields[0].GetUInt32();
|
||||
level = fields[1].GetUInt8();
|
||||
money = fields[2].GetUInt32();
|
||||
money = fields[2].GetUInt64();
|
||||
accId = fields[3].GetUInt32();
|
||||
race = fields[4].GetUInt8();
|
||||
Class = fields[5].GetUInt8();
|
||||
@@ -422,9 +422,9 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
}
|
||||
|
||||
std::string timeStr = secsToTimeString(total_player_time, true, true);
|
||||
uint32 gold = money /GOLD;
|
||||
uint32 silv = (money % GOLD) / SILVER;
|
||||
uint32 copp = (money % GOLD) % SILVER;
|
||||
uint64 gold = money / GOLD;
|
||||
uint64 silv = (money % GOLD) / SILVER;
|
||||
uint64 copp = (money % GOLD) % SILVER;
|
||||
PSendSysMessage(LANG_PINFO_LEVEL, race_s.c_str(), Class_s.c_str(), timeStr.c_str(), level, gold, silv, copp);
|
||||
|
||||
// Add map, zone, subzone and phase to output
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "SmartAI.h"
|
||||
#include "Group.h"
|
||||
#include "ChannelMgr.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
bool ChatHandler::HandleMaxSkillCommand(const char* /*args*/)
|
||||
{
|
||||
@@ -1388,7 +1389,7 @@ bool ChatHandler::HandleSendMoneyCommand(const char *args)
|
||||
return false;
|
||||
|
||||
char* money_str = strtok(NULL, "");
|
||||
int32 money = money_str ? atoi(money_str) : 0;
|
||||
int64 money = money_str ? atoll(money_str) : 0;
|
||||
if (money <= 0)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/)
|
||||
Update(false); // send spell info to caster self
|
||||
}
|
||||
|
||||
void TradeData::SetMoney(uint32 money)
|
||||
void TradeData::SetMoney(uint64 money)
|
||||
{
|
||||
if (m_money == money)
|
||||
return;
|
||||
@@ -4412,7 +4412,7 @@ bool Player::ResetTalents(bool no_cost)
|
||||
{
|
||||
cost = GetNextResetTalentsCost();
|
||||
|
||||
if (!HasEnoughMoney(cost))
|
||||
if (!HasEnoughMoney(uint64(cost)))
|
||||
{
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
return false;
|
||||
@@ -5454,13 +5454,13 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
|
||||
|
||||
TotalCost = costs;
|
||||
}
|
||||
else if (!HasEnoughMoney(costs))
|
||||
else if (!HasEnoughMoney(uint64(costs)))
|
||||
{
|
||||
sLog->outStaticDebug("You do not have enough money");
|
||||
return TotalCost;
|
||||
}
|
||||
else
|
||||
ModifyMoney(-int32(costs));
|
||||
ModifyMoney(-int64(costs));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14325,7 +14325,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
|
||||
return;
|
||||
|
||||
int32 cost = int32(item->BoxMoney);
|
||||
if (!HasEnoughMoney(cost))
|
||||
if (!HasEnoughMoney(int64(cost)))
|
||||
{
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
PlayerTalkClass->SendCloseGossip();
|
||||
@@ -14773,7 +14773,7 @@ bool Player::CanCompleteQuest(uint32 quest_id)
|
||||
|
||||
if (qInfo->GetRewOrReqMoney() < 0)
|
||||
{
|
||||
if (!HasEnoughMoney(-qInfo->GetRewOrReqMoney()))
|
||||
if (!HasEnoughMoney(-int64(qInfo->GetRewOrReqMoney())))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14836,7 +14836,7 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg)
|
||||
}
|
||||
|
||||
// prevent receive reward with low money and GetRewOrReqMoney() < 0
|
||||
if (quest->GetRewOrReqMoney() < 0 && !HasEnoughMoney(-quest->GetRewOrReqMoney()))
|
||||
if (quest->GetRewOrReqMoney() < 0 && !HasEnoughMoney(-int64(quest->GetRewOrReqMoney())))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -16755,7 +16755,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
// load achievements before anything else to prevent multiple gains for the same achievement/criteria on every loading (as loading does call UpdateAchievementCriteria)
|
||||
m_achievementMgr.LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS));
|
||||
|
||||
uint32 money = fields[8].GetUInt32();
|
||||
uint64 money = fields[8].GetUInt64();
|
||||
if (money > MAX_MONEY_AMOUNT)
|
||||
money = MAX_MONEY_AMOUNT;
|
||||
SetMoney(money);
|
||||
@@ -18647,7 +18647,7 @@ void Player::SaveToDB(bool create /*=false*/)
|
||||
stmt->setUInt8(index++, getGender());
|
||||
stmt->setUInt8(index++, getLevel());
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_XP));
|
||||
stmt->setUInt32(index++, GetMoney());
|
||||
stmt->setUInt64(index++, GetMoney());
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES));
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES_2));
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FLAGS));
|
||||
@@ -18755,7 +18755,7 @@ void Player::SaveToDB(bool create /*=false*/)
|
||||
stmt->setUInt8(index++, getGender());
|
||||
stmt->setUInt8(index++, getLevel());
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_XP));
|
||||
stmt->setUInt32(index++, GetMoney());
|
||||
stmt->setUInt64(index++, GetMoney());
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES));
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_BYTES_2));
|
||||
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FLAGS));
|
||||
@@ -18921,7 +18921,7 @@ void Player::SaveInventoryAndGoldToDB(SQLTransaction& trans)
|
||||
void Player::SaveGoldToDB(SQLTransaction& trans)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_MONEY);
|
||||
stmt->setUInt32(0, GetMoney());
|
||||
stmt->setUInt64(0, GetMoney());
|
||||
stmt->setUInt32(1, GetGUIDLow());
|
||||
trans->Append(stmt);
|
||||
}
|
||||
@@ -20772,7 +20772,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 money = GetMoney();
|
||||
uint64 money = GetMoney();
|
||||
|
||||
if (npc)
|
||||
totalcost = (uint32)ceil(totalcost*GetReputationPriceDiscount(npc));
|
||||
@@ -20785,7 +20785,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
|
||||
}
|
||||
|
||||
//Checks and preparations done, DO FLIGHT
|
||||
ModifyMoney(-(int32)totalcost);
|
||||
ModifyMoney(-int64(totalcost));
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost);
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, 1);
|
||||
|
||||
@@ -21161,7 +21161,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
||||
// reputation discount
|
||||
price = uint32(floor(price * GetReputationPriceDiscount(creature)));
|
||||
|
||||
if (!HasEnoughMoney(price))
|
||||
if (!HasEnoughMoney(uint64(price)))
|
||||
{
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item, 0);
|
||||
return false;
|
||||
@@ -21949,16 +21949,16 @@ void Player::InitPrimaryProfessions()
|
||||
SetFreePrimaryProfessions(sWorld->getIntConfig(CONFIG_MAX_PRIMARY_TRADE_SKILL));
|
||||
}
|
||||
|
||||
void Player::ModifyMoney(int32 d)
|
||||
void Player::ModifyMoney(int64 d)
|
||||
{
|
||||
sScriptMgr->OnPlayerMoneyChanged(this, d);
|
||||
|
||||
if (d < 0)
|
||||
SetMoney (GetMoney() > uint32(-d) ? GetMoney() + d : 0);
|
||||
SetMoney (GetMoney() > uint64(-d) ? GetMoney() + d : 0);
|
||||
else
|
||||
{
|
||||
uint32 newAmount = 0;
|
||||
if (GetMoney() < uint32(MAX_MONEY_AMOUNT - d))
|
||||
uint64 newAmount = 0;
|
||||
if (GetMoney() < uint64(MAX_MONEY_AMOUNT - d))
|
||||
newAmount = GetMoney() + d;
|
||||
else
|
||||
{
|
||||
@@ -21967,7 +21967,7 @@ void Player::ModifyMoney(int32 d)
|
||||
if (d)
|
||||
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
|
||||
}
|
||||
SetMoney (newAmount);
|
||||
SetMoney(newAmount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -832,7 +832,7 @@ enum PlayerDelayedOperations
|
||||
|
||||
// Player summoning auto-decline time (in secs)
|
||||
#define MAX_PLAYER_SUMMON_DELAY (2*MINUTE)
|
||||
#define MAX_MONEY_AMOUNT (0x7FFFFFFF-1)
|
||||
#define MAX_MONEY_AMOUNT (UI64LIT(9999999999)) // TODO: Move this restriction to worldserver.conf, default to this value, hardcap at uint64.max
|
||||
|
||||
struct InstancePlayerBind
|
||||
{
|
||||
@@ -1000,8 +1000,8 @@ class TradeData
|
||||
Item* GetSpellCastItem() const;
|
||||
bool HasSpellCastItem() const { return m_spellCastItem != 0; }
|
||||
|
||||
uint32 GetMoney() const { return m_money; }
|
||||
void SetMoney(uint32 money);
|
||||
uint64 GetMoney() const { return m_money; }
|
||||
void SetMoney(uint64 money);
|
||||
|
||||
bool IsAccepted() const { return m_accepted; }
|
||||
void SetAccepted(bool state, bool crosssend = false);
|
||||
@@ -1021,7 +1021,7 @@ class TradeData
|
||||
bool m_accepted; // m_player press accept for trade list
|
||||
bool m_acceptProccess; // one from player/trader press accept and this processed
|
||||
|
||||
uint32 m_money; // m_player place money to trade
|
||||
uint64 m_money; // m_player place money to trade
|
||||
|
||||
uint32 m_spell; // m_player apply spell to non-traded slot item
|
||||
uint64 m_spellCastItem; // applied spell casted by item use
|
||||
@@ -1590,19 +1590,19 @@ class Player : public Unit, public GridObject<Player>
|
||||
void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;}
|
||||
void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
|
||||
|
||||
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
|
||||
uint64 GetMoney() const { return GetUInt64Value(PLAYER_FIELD_COINAGE); }
|
||||
void ModifyMoney(int64 d);
|
||||
bool HasEnoughMoney(uint64 amount) const { return GetMoney() >= amount; }
|
||||
bool HasEnoughMoney(int64 amount) const
|
||||
{
|
||||
if (amount > 0)
|
||||
return (GetMoney() >= (uint32) amount);
|
||||
return (GetMoney() >= (uint64)amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetMoney(uint32 value)
|
||||
void SetMoney(uint64 value)
|
||||
{
|
||||
SetUInt32Value(PLAYER_FIELD_COINAGE, value);
|
||||
SetUInt64Value(PLAYER_FIELD_COINAGE, value);
|
||||
MoneyChanged(value);
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED);
|
||||
}
|
||||
|
||||
@@ -1322,12 +1322,12 @@ void Guild::HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo)
|
||||
if (!_IsLeader(player))
|
||||
// "Only guild leaders can create emblems."
|
||||
SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTGUILDMASTER);
|
||||
else if (!player->HasEnoughMoney(EMBLEM_PRICE))
|
||||
else if (!player->HasEnoughMoney(uint64(EMBLEM_PRICE)))
|
||||
// "You can't afford to do that."
|
||||
SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTENOUGHMONEY);
|
||||
else
|
||||
{
|
||||
player->ModifyMoney(-int32(EMBLEM_PRICE));
|
||||
player->ModifyMoney(-int64(EMBLEM_PRICE));
|
||||
|
||||
m_emblemInfo = emblemInfo;
|
||||
m_emblemInfo.SaveToDB(m_id);
|
||||
@@ -1418,13 +1418,13 @@ void Guild::HandleBuyBankTab(WorldSession* session, uint8 tabId)
|
||||
return;
|
||||
|
||||
Player* player = session->GetPlayer();
|
||||
if (!player->HasEnoughMoney(tabCost)) // Should not happen, this is checked by client
|
||||
if (!player->HasEnoughMoney(uint64(tabCost))) // Should not happen, this is checked by client
|
||||
return;
|
||||
|
||||
if (!_CreateNewBankTab())
|
||||
return;
|
||||
|
||||
player->ModifyMoney(-int32(tabCost));
|
||||
player->ModifyMoney(-int64(tabCost));
|
||||
_SetRankBankMoneyPerDay(player->GetRank(), uint32(GUILD_WITHDRAW_MONEY_UNLIMITED));
|
||||
_SetRankBankTabRightsAndSlots(player->GetRank(), tabId, GuildBankRightsAndSlots(GUILD_BANK_RIGHT_FULL, uint32(GUILD_WITHDRAW_SLOT_UNLIMITED)));
|
||||
HandleRoster(); // Broadcast for tab rights update
|
||||
@@ -1652,13 +1652,13 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
|
||||
// Add money to bank
|
||||
_ModifyBankMoney(trans, amount, true);
|
||||
// Remove money from player
|
||||
player->ModifyMoney(-int32(amount));
|
||||
player->ModifyMoney(-int64(amount));
|
||||
player->SaveGoldToDB(trans);
|
||||
// Log GM action (TODO: move to scripts)
|
||||
if (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
{
|
||||
sLog->outCommand(player->GetSession()->GetAccountId(),
|
||||
"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
|
||||
"GM %s (Account: %u) deposit money (Amount: " UI64FMTD ") to guild bank (Guild ID %u)",
|
||||
player->GetName(), player->GetSession()->GetAccountId(), amount, m_id);
|
||||
}
|
||||
// Log guild bank event
|
||||
|
||||
@@ -225,7 +225,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
|
||||
if (!_player->HasEnoughMoney(deposit))
|
||||
if (!_player->HasEnoughMoney((uint64)deposit))
|
||||
{
|
||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
|
||||
return;
|
||||
@@ -412,7 +412,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player->HasEnoughMoney((uint32)price))
|
||||
if (!player->HasEnoughMoney(price))
|
||||
{
|
||||
//you don't have enought money!, client tests!
|
||||
//SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
|
||||
@@ -426,16 +426,16 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
|
||||
if (auction->bidder > 0)
|
||||
{
|
||||
if (auction->bidder == player->GetGUIDLow())
|
||||
player->ModifyMoney(-int32(price - auction->bid));
|
||||
player->ModifyMoney(-int64(price - auction->bid));
|
||||
else
|
||||
{
|
||||
// mail to last bidder and return money
|
||||
sAuctionMgr->SendAuctionOutbiddedMail(auction, price, GetPlayer(), trans);
|
||||
player->ModifyMoney(-int32(price));
|
||||
player->ModifyMoney(-int64(price));
|
||||
}
|
||||
}
|
||||
else
|
||||
player->ModifyMoney(-int32(price));
|
||||
player->ModifyMoney(-int64(price));
|
||||
|
||||
auction->bidder = player->GetGUIDLow();
|
||||
auction->bid = price;
|
||||
@@ -453,10 +453,10 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
|
||||
{
|
||||
//buyout:
|
||||
if (player->GetGUIDLow() == auction->bidder)
|
||||
player->ModifyMoney(-int32(auction->buyout - auction->bid));
|
||||
player->ModifyMoney(-int64(auction->buyout - auction->bid));
|
||||
else
|
||||
{
|
||||
player->ModifyMoney(-int32(auction->buyout));
|
||||
player->ModifyMoney(-int64(auction->buyout));
|
||||
if (auction->bidder) //buyout for bidded auction ..
|
||||
sAuctionMgr->SendAuctionOutbiddedMail(auction, auction->buyout, GetPlayer(), trans);
|
||||
}
|
||||
@@ -516,11 +516,11 @@ 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 (!player->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
||||
if (!player->HasEnoughMoney((uint64)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);
|
||||
player->ModifyMoney(-int32(auctionCut));
|
||||
player->ModifyMoney(-int64(auctionCut));
|
||||
}
|
||||
|
||||
// item will deleted or added to received mail list
|
||||
|
||||
@@ -1387,12 +1387,12 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
|
||||
if (bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
|
||||
return;
|
||||
|
||||
uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
|
||||
uint32 cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
|
||||
|
||||
// 0 - ok
|
||||
// 1, 3 - not enough money
|
||||
// 2 - you have to seat on barber chair
|
||||
if (!_player->HasEnoughMoney(Cost))
|
||||
if (!_player->HasEnoughMoney((uint64)cost))
|
||||
{
|
||||
WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
|
||||
data << uint32(1); // no money
|
||||
@@ -1406,8 +1406,8 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
_player->ModifyMoney(-int32(Cost)); // it isn't free
|
||||
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, Cost);
|
||||
_player->ModifyMoney(-int64(cost)); // it isn't free
|
||||
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, cost);
|
||||
|
||||
_player->SetByteValue(PLAYER_BYTES, 2, uint8(bs_hair->hair_id));
|
||||
_player->SetByteValue(PLAYER_BYTES, 3, uint8(Color));
|
||||
|
||||
@@ -396,13 +396,13 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket & recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANK_DEPOSIT_MONEY)");
|
||||
|
||||
uint64 GoGuid;
|
||||
recv_data >> GoGuid;
|
||||
uint64 goGuid;
|
||||
recv_data >> goGuid;
|
||||
|
||||
uint32 money;
|
||||
uint64 money;
|
||||
recv_data >> money;
|
||||
|
||||
if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
if (GetPlayer()->GetGameObjectIfCanInteractWith(goGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
if (money && GetPlayer()->HasEnoughMoney(money))
|
||||
if (Guild* guild = _GetPlayerGuild(this))
|
||||
guild->HandleMemberDepositMoney(this, money);
|
||||
|
||||
@@ -624,7 +624,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
|
||||
if (pItem)
|
||||
{
|
||||
uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START);
|
||||
if (!_player->HasEnoughMoney(price))
|
||||
if (!_player->HasEnoughMoney(uint64(price)))
|
||||
{
|
||||
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, pItem->GetEntry(), 0);
|
||||
return;
|
||||
@@ -934,7 +934,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
|
||||
|
||||
uint32 price = slotEntry->price;
|
||||
|
||||
if (!_player->HasEnoughMoney(price))
|
||||
if (!_player->HasEnoughMoney(uint64(price)))
|
||||
{
|
||||
data << uint32(ERR_BANKSLOT_INSUFFICIENT_FUNDS);
|
||||
SendPacket(&data);
|
||||
@@ -942,7 +942,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
|
||||
_player->SetBankBagSlotCount(slot);
|
||||
_player->ModifyMoney(-int32(price));
|
||||
_player->ModifyMoney(-int64(price));
|
||||
|
||||
data << uint32(ERR_BANKSLOT_OK);
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -105,7 +105,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
|
||||
uint32 cost = items_count ? 30 * items_count : 30; // price hardcoded in client
|
||||
|
||||
uint32 reqmoney = cost + money;
|
||||
uint64 reqmoney = cost + uint64(money);
|
||||
|
||||
if (!player->HasEnoughMoney(reqmoney) && !player->isGameMaster())
|
||||
{
|
||||
@@ -439,7 +439,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
|
||||
}
|
||||
|
||||
// prevent cheating with skip client money check
|
||||
if (!player->HasEnoughMoney(m->COD))
|
||||
if (!player->HasEnoughMoney(uint64(m->COD)))
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
|
||||
@@ -277,10 +277,10 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data)
|
||||
uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(unit)));
|
||||
|
||||
// check money requirement
|
||||
if (!_player->HasEnoughMoney(nSpellCost))
|
||||
if (!_player->HasEnoughMoney(uint64(nSpellCost)))
|
||||
return;
|
||||
|
||||
_player->ModifyMoney(-int32(nSpellCost));
|
||||
_player->ModifyMoney(-int64(nSpellCost));
|
||||
|
||||
unit->SendPlaySpellVisual(179); // 53 SpellCastDirected
|
||||
unit->SendPlaySpellImpact(_player->GetGUID(), 362); // 113 EmoteSalute
|
||||
|
||||
@@ -187,7 +187,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player->HasEnoughMoney(cost))
|
||||
if (!_player->HasEnoughMoney(uint64(cost)))
|
||||
{ //player hasn't got enough money
|
||||
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, charterid, 0);
|
||||
return;
|
||||
|
||||
@@ -477,9 +477,9 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
}
|
||||
|
||||
// update money
|
||||
_player->ModifyMoney(-int32(my_trade->GetMoney()));
|
||||
_player->ModifyMoney(-int64(my_trade->GetMoney()));
|
||||
_player->ModifyMoney(his_trade->GetMoney());
|
||||
trader->ModifyMoney(-int32(his_trade->GetMoney()));
|
||||
trader->ModifyMoney(-int64(his_trade->GetMoney()));
|
||||
trader->ModifyMoney(my_trade->GetMoney());
|
||||
|
||||
if (my_spell)
|
||||
@@ -676,7 +676,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
|
||||
void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
uint32 gold;
|
||||
uint64 gold;
|
||||
recvPacket >> gold;
|
||||
|
||||
TradeData* my_trade = _player->GetTradeData();
|
||||
|
||||
@@ -123,8 +123,8 @@ class MailDraft
|
||||
public: // Accessors
|
||||
uint16 GetMailTemplateId() const { return m_mailTemplateId; }
|
||||
std::string const& GetSubject() const { return m_subject; }
|
||||
uint32 GetMoney() const { return m_money; }
|
||||
uint32 GetCOD() const { return m_COD; }
|
||||
uint64 GetMoney() const { return m_money; }
|
||||
uint64 GetCOD() const { return m_COD; }
|
||||
std::string const& GetBody() const { return m_body; }
|
||||
|
||||
public: // modifiers
|
||||
@@ -172,8 +172,8 @@ struct Mail
|
||||
std::vector<uint32> removedItems;
|
||||
time_t expire_time;
|
||||
time_t deliver_time;
|
||||
uint32 money;
|
||||
uint32 COD;
|
||||
uint64 money;
|
||||
uint64 COD;
|
||||
uint32 checked;
|
||||
MailState state;
|
||||
|
||||
|
||||
@@ -1224,7 +1224,7 @@ void ScriptMgr::OnPlayerTalentsReset(Player* player, bool noCost)
|
||||
FOREACH_SCRIPT(PlayerScript)->OnTalentsReset(player, noCost);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnPlayerMoneyChanged(Player* player, int32& amount)
|
||||
void ScriptMgr::OnPlayerMoneyChanged(Player* player, int64& amount)
|
||||
{
|
||||
FOREACH_SCRIPT(PlayerScript)->OnMoneyChanged(player, amount);
|
||||
}
|
||||
|
||||
@@ -684,7 +684,7 @@ class PlayerScript : public ScriptObject
|
||||
virtual void OnTalentsReset(Player* /*player*/, bool /*noCost*/) { }
|
||||
|
||||
// Called when a player's money is modified (before the modification is done)
|
||||
virtual void OnMoneyChanged(Player* /*player*/, int32& /*amount*/) { }
|
||||
virtual void OnMoneyChanged(Player* /*player*/, int64& /*amount*/) { }
|
||||
|
||||
// Called when a player gains XP (before anything is given)
|
||||
virtual void OnGiveXP(Player* /*player*/, uint32& /*amount*/, Unit* /*victim*/) { }
|
||||
@@ -990,7 +990,7 @@ class ScriptMgr
|
||||
void OnPlayerLevelChanged(Player* player, uint8 oldLevel);
|
||||
void OnPlayerFreeTalentPointsChanged(Player* player, uint32 newPoints);
|
||||
void OnPlayerTalentsReset(Player* player, bool noCost);
|
||||
void OnPlayerMoneyChanged(Player* player, int32& amount);
|
||||
void OnPlayerMoneyChanged(Player* player, int64& amount);
|
||||
void OnGivePlayerXP(Player* player, uint32& amount, Unit* victim);
|
||||
void OnPlayerReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental);
|
||||
void OnPlayerDuelRequest(Player* target, Player* challenger);
|
||||
|
||||
@@ -1080,7 +1080,7 @@ void InitOpcodes()
|
||||
//DEFINE_OPCODE_HANDLER(SMSG_LOOT_ITEM_NOTIFY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
//DEFINE_OPCODE_HANDLER(SMSG_LOOT_LIST, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
//DEFINE_OPCODE_HANDLER(SMSG_LOOT_MASTER_LIST, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
//DEFINE_OPCODE_HANDLER(SMSG_LOOT_MONEY_NOTIFY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_LOOT_MONEY_NOTIFY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
//DEFINE_OPCODE_HANDLER(SMSG_LOOT_RELEASE_RESPONSE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
//DEFINE_OPCODE_HANDLER(SMSG_LOOT_REMOVED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
//DEFINE_OPCODE_HANDLER(SMSG_LOOT_RESPONSE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
|
||||
@@ -774,11 +774,11 @@ void World::LoadConfigSettings(bool reload)
|
||||
sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
|
||||
m_int_configs[CONFIG_START_PLAYER_MONEY] = 0;
|
||||
}
|
||||
else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT)
|
||||
else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > 0x7FFFFFFF-1) // TODO: (See MAX_MONEY_AMOUNT)
|
||||
{
|
||||
sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
|
||||
m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT);
|
||||
m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT;
|
||||
m_int_configs[CONFIG_START_PLAYER_MONEY], 0x7FFFFFFF-1, 0x7FFFFFFF-1);
|
||||
m_int_configs[CONFIG_START_PLAYER_MONEY] = 0x7FFFFFFF-1;
|
||||
}
|
||||
|
||||
m_int_configs[CONFIG_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("MaxHonorPoints", 75000);
|
||||
|
||||
@@ -25,6 +25,7 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Chat.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
class modify_commandscript : public CommandScript
|
||||
{
|
||||
@@ -1002,13 +1003,13 @@ public:
|
||||
if (handler->HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
int32 addmoney = atoi((char*)args);
|
||||
int64 addmoney = atoll((char*)args);
|
||||
|
||||
uint32 moneyuser = target->GetMoney();
|
||||
uint64 moneyuser = target->GetMoney();
|
||||
|
||||
if (addmoney < 0)
|
||||
{
|
||||
int32 newmoney = int32(moneyuser) + addmoney;
|
||||
int64 newmoney = int32(moneyuser) + addmoney;
|
||||
|
||||
sLog->outDetail(handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
|
||||
if (newmoney <= 0)
|
||||
|
||||
@@ -209,7 +209,7 @@ int32 DoLowUnlearnCost(Player* player) //blacksmith
|
||||
|
||||
void ProcessCastaction(Player* player, Creature* creature, uint32 spellId, uint32 triggeredSpellId, int32 cost)
|
||||
{
|
||||
if (!(spellId && player->HasSpell(spellId)) && player->HasEnoughMoney(cost))
|
||||
if (!(spellId && player->HasSpell(spellId)) && player->HasEnoughMoney((int64)cost))
|
||||
{
|
||||
player->CastSpell(player, triggeredSpellId, true);
|
||||
player->ModifyMoney(-cost);
|
||||
@@ -347,11 +347,11 @@ void ProcessUnlearnAction(Player* player, Creature* creature, uint32 spellId, ui
|
||||
{
|
||||
if (EquippedOk(player, spellId))
|
||||
{
|
||||
if (player->HasEnoughMoney(cost))
|
||||
if (player->HasEnoughMoney(int64(cost)))
|
||||
{
|
||||
player->CastSpell(player, spellId, true);
|
||||
ProfessionUnlearnSpells(player, spellId);
|
||||
player->ModifyMoney(-cost);
|
||||
player->ModifyMoney(-int64(cost));
|
||||
if (alternativeSpellId)
|
||||
creature->CastSpell(player, alternativeSpellId, true);
|
||||
}
|
||||
|
||||
@@ -1287,7 +1287,7 @@ public:
|
||||
case GOSSIP_OPTION_LEARNDUALSPEC:
|
||||
if (player->GetSpecsCount() == 1 && !(player->getLevel() < sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL)))
|
||||
{
|
||||
if (!player->HasEnoughMoney(10000000))
|
||||
if (!player->HasEnoughMoney(UI64LIT(10000000)))
|
||||
{
|
||||
player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
player->PlayerTalkClass->SendCloseGossip();
|
||||
@@ -1295,7 +1295,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
player->ModifyMoney(-10000000);
|
||||
player->ModifyMoney(SI64LIT(-10000000));
|
||||
|
||||
// Cast spells that teach dual spec
|
||||
// Both are also ImplicitTarget self and must be cast by player
|
||||
@@ -2600,11 +2600,11 @@ public:
|
||||
}
|
||||
if (doSwitch)
|
||||
{
|
||||
if (!player->HasEnoughMoney(EXP_COST))
|
||||
if (!player->HasEnoughMoney(uint64(EXP_COST)))
|
||||
player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
|
||||
else if (noXPGain)
|
||||
{
|
||||
player->ModifyMoney(-EXP_COST);
|
||||
player->ModifyMoney(-int64(EXP_COST));
|
||||
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
|
||||
}
|
||||
else if (!noXPGain)
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
#define I32FMT "%08I32X"
|
||||
#define I64FMT "%016I64X"
|
||||
#define snprintf _snprintf
|
||||
#define atoll __atoi64
|
||||
#define atoll _atoi64
|
||||
#define vsnprintf _vsnprintf
|
||||
#define finite(X) _finite(X)
|
||||
#define llabs _abs64
|
||||
|
||||
Reference in New Issue
Block a user