Core/Players: Several gold handling improvements (#155)
* Updated the following systems to support large (64bit) gold numbers: - Auction House - Mail - Commands - Guild bank withdraw limits - Guild Bank eventlog - Vendor * Fixed some vendor checks for when BuyCount > 1 * Tweaked some checks for available gold space
This commit is contained in:
1 parent
43a6d3d759
commit
31b6b77200
27 files changed
+181
-160
No files matched your search
@@ -252,12 +252,12 @@ CREATE TABLE `auctionhouse` (
|
||||
`houseid` tinyint(3) unsigned NOT NULL DEFAULT '7',
|
||||
`itemguid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`itemowner` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`buyoutprice` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`buyoutprice` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`time` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`buyguid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`lastbid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`startbid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`deposit` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`lastbid` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`startbid` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`deposit` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `item_guid` (`itemguid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@@ -2021,7 +2021,7 @@ CREATE TABLE `guild_bank_eventlog` (
|
||||
`TabId` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Guild bank TabId',
|
||||
`EventType` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Event type',
|
||||
`PlayerGuid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`ItemOrMoney` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`ItemOrMoney` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`ItemStackCount` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`DestTabId` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Destination Tab Id',
|
||||
`TimeStamp` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Event UNIX time',
|
||||
@@ -2257,7 +2257,7 @@ CREATE TABLE `guild_member_withdraw` (
|
||||
`tab5` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`tab6` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`tab7` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`money` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`money` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`guid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Guild Member Daily Withdraws';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
@@ -3047,7 +3047,8 @@ INSERT INTO `updates` VALUES
|
||||
('custom_2019_08_20_00_characters.sql','09DC2B6A0E602E377F240CB29F6E1E3209FD346B','ARCHIVED','2019-11-06 00:17:45',0),
|
||||
('custom_2020_01_05_00_character.sql','DEC981779DA0311FA1E20FF0424BE5F997D21BEE','ARCHIVED','2020-01-06 10:44:59',0),
|
||||
('2020_05_19_00_characters.sql','5FFAB4D7060E872AB6221D759EC1BCF461F1E9E3','ARCHIVED','2020-05-19 01:44:34',0),
|
||||
('2020_06_15_00_characters.sql','4422FE31AABBA352C473E33B56927F6695492BCB','RELEASED','2020-06-15 10:23:44',0);
|
||||
('2020_06_15_00_characters.sql','4422FE31AABBA352C473E33B56927F6695492BCB','RELEASED','2020-06-15 10:23:44',0),
|
||||
('2020_08_02_00_characters.sql','D304C702A83D5C22DF060B98DDE119EEFC92CF52','RELEASED','2020-08-02 03:19:22',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
ALTER TABLE `auctionhouse`
|
||||
CHANGE `buyoutprice` `buyoutprice` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
CHANGE `lastbid` `lastbid` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
CHANGE `startbid` `startbid` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
CHANGE `deposit` `deposit` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
|
||||
ALTER TABLE `guild_member_withdraw` CHANGE `money` `money` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
|
||||
ALTER TABLE `guild_bank_eventlog` CHANGE `ItemOrMoney` `ItemOrMoney` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
@@ -225,9 +225,10 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_UPD_GUILD_RANK_BANK_MONEY, "UPDATE guild_rank SET BankMoneyPerDay = ? WHERE rid = ? AND guildid = ?", CONNECTION_ASYNC); // 0: uint32, 1: uint8, 2: uint32
|
||||
PrepareStatement(CHAR_UPD_GUILD_BANK_TAB_TEXT, "UPDATE guild_bank_tab SET TabText = ? WHERE guildid = ? AND TabId = ?", CONNECTION_ASYNC); // 0: string, 1: uint32, 2: uint8
|
||||
|
||||
PrepareStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW,
|
||||
"INSERT INTO guild_member_withdraw (guid, tab0, tab1, tab2, tab3, tab4, tab5, tab6, tab7, money) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) "
|
||||
"ON DUPLICATE KEY UPDATE tab0 = VALUES (tab0), tab1 = VALUES (tab1), tab2 = VALUES (tab2), tab3 = VALUES (tab3), tab4 = VALUES (tab4), tab5 = VALUES (tab5), tab6 = VALUES (tab6), tab7 = VALUES (tab7), money = VALUES (money)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW_TABS,
|
||||
"INSERT INTO guild_member_withdraw (guid, tab0, tab1, tab2, tab3, tab4, tab5, tab6, tab7) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) "
|
||||
"ON DUPLICATE KEY UPDATE tab0 = VALUES (tab0), tab1 = VALUES (tab1), tab2 = VALUES (tab2), tab3 = VALUES (tab3), tab4 = VALUES (tab4), tab5 = VALUES (tab5), tab6 = VALUES (tab6), tab7 = VALUES (tab7)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW_MONEY, "INSERT INTO guild_member_withdraw (guid, money) VALUES (?, ?) ON DUPLICATE KEY UPDATE money = VALUES (money)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_GUILD_MEMBER_WITHDRAW, "TRUNCATE guild_member_withdraw", CONNECTION_ASYNC);
|
||||
|
||||
// 0: uint32, 1: uint32, 2: uint32
|
||||
|
||||
@@ -195,7 +195,8 @@ enum CharacterDatabaseStatements : uint32
|
||||
CHAR_UPD_GUILD_BANK_EVENTLOG_TAB,
|
||||
CHAR_UPD_GUILD_RANK_BANK_MONEY,
|
||||
CHAR_UPD_GUILD_BANK_TAB_TEXT,
|
||||
CHAR_INS_GUILD_MEMBER_WITHDRAW,
|
||||
CHAR_INS_GUILD_MEMBER_WITHDRAW_TABS,
|
||||
CHAR_INS_GUILD_MEMBER_WITHDRAW_MONEY,
|
||||
CHAR_DEL_GUILD_MEMBER_WITHDRAW,
|
||||
CHAR_SEL_CHAR_DATA_FOR_GUILD,
|
||||
CHAR_SEL_OLD_GUILD_DATA,
|
||||
|
||||
@@ -86,7 +86,7 @@ AuctionHouseObject* AuctionHouseMgr::GetAuctionsMapByHouseId(uint8 auctionHouseI
|
||||
}
|
||||
}
|
||||
|
||||
uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count)
|
||||
uint64 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count)
|
||||
{
|
||||
uint32 MSV = pItem->GetTemplate()->GetSellPrice();
|
||||
|
||||
@@ -95,7 +95,7 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
|
||||
|
||||
float multiplier = CalculatePct(float(entry->DepositRate), 3);
|
||||
uint32 timeHr = (((time / 60) / 60) / 12);
|
||||
uint32 deposit = uint32(MSV * multiplier * sWorld->getRate(RATE_AUCTION_DEPOSIT));
|
||||
uint64 deposit = uint64(MSV * multiplier * sWorld->getRate(RATE_AUCTION_DEPOSIT));
|
||||
float remainderbase = float(MSV * multiplier * sWorld->getRate(RATE_AUCTION_DEPOSIT)) - deposit;
|
||||
|
||||
deposit *= timeHr * count;
|
||||
@@ -110,7 +110,7 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
|
||||
TC_LOG_DEBUG("auctionHouse", "MSV: %u", MSV);
|
||||
TC_LOG_DEBUG("auctionHouse", "Items: %u", count);
|
||||
TC_LOG_DEBUG("auctionHouse", "Multiplier: %f", multiplier);
|
||||
TC_LOG_DEBUG("auctionHouse", "Deposit: %u", deposit);
|
||||
TC_LOG_DEBUG("auctionHouse", "Deposit: " UI64FMTD, deposit);
|
||||
TC_LOG_DEBUG("auctionHouse", "Deposit rm: %f", remainderbase * count);
|
||||
|
||||
if (deposit < AH_MINIMUM_DEPOSIT * sWorld->getRate(RATE_AUCTION_DEPOSIT))
|
||||
@@ -157,7 +157,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, CharacterDatabas
|
||||
|
||||
uint32 ownerAccId = sCharacterCache->GetCharacterAccountIdByGuid(ownerGuid);
|
||||
|
||||
sLog->outCommand(bidderAccId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
|
||||
sLog->outCommand(bidderAccId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: " UI64FMTD ". Original owner %s (Account: %u)",
|
||||
bidderName.c_str(), bidderAccId, pItem->GetTemplate()->GetDefaultLocaleName(), pItem->GetEntry(), pItem->GetCount(), auction->bid, ownerName.c_str(), ownerAccId);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, Character
|
||||
// owner exist
|
||||
if ((owner || owner_accId) && !sAuctionBotConfig->IsBotChar(auction->owner))
|
||||
{
|
||||
uint32 profit = auction->bid + auction->deposit - auction->GetAuctionCut();
|
||||
uint64 profit = auction->bid + auction->deposit - auction->GetAuctionCut();
|
||||
|
||||
//FIXME: what do if owner offline
|
||||
if (owner)
|
||||
@@ -255,7 +255,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, CharacterDat
|
||||
}
|
||||
|
||||
//this function sends mail to old bidder
|
||||
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, CharacterDatabaseTransaction& trans)
|
||||
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint64 newPrice, Player* newBidder, CharacterDatabaseTransaction& trans)
|
||||
{
|
||||
ObjectGuid oldBidder_guid(HighGuid::Player, auction->bidder);
|
||||
Player* oldBidder = ObjectAccessor::FindConnectedPlayer(oldBidder_guid);
|
||||
@@ -488,13 +488,13 @@ void AuctionHouseMgr::PendingAuctionProcess(Player* player)
|
||||
totalItems += AH->itemCount;
|
||||
}
|
||||
|
||||
uint32 totaldeposit = 0;
|
||||
uint64 totaldeposit = 0;
|
||||
auto itr = (*thisAH->begin());
|
||||
|
||||
if (Item* item = GetAItem(itr->itemGUIDLow))
|
||||
totaldeposit = GetAuctionDeposit(itr->auctionHouseEntry, itr->etime, item, totalItems);
|
||||
|
||||
uint32 depositremain = totaldeposit;
|
||||
uint64 depositremain = totaldeposit;
|
||||
for (auto itr = thisAH->begin(); itr != thisAH->end(); ++itr)
|
||||
{
|
||||
AuctionEntry* AH = (*itr);
|
||||
@@ -515,7 +515,7 @@ void AuctionHouseMgr::PendingAuctionProcess(Player* player)
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
pendingAuctionMap.erase(player->GetGUID());
|
||||
delete thisAH;
|
||||
player->ModifyMoney(-int32(totaldeposit));
|
||||
player->ModifyMoney(-int64(totaldeposit));
|
||||
}
|
||||
|
||||
void AuctionHouseMgr::UpdatePendingAuctions()
|
||||
@@ -861,16 +861,16 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data, Item* sourceItem) const
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 AuctionEntry::GetAuctionCut() const
|
||||
uint64 AuctionEntry::GetAuctionCut() const
|
||||
{
|
||||
int32 cut = int32(CalculatePct(bid, auctionHouseEntry->ConsignmentRate) * sWorld->getRate(RATE_AUCTION_CUT));
|
||||
return std::max(cut, 0);
|
||||
int64 cut = int64(CalculatePct(bid, auctionHouseEntry->ConsignmentRate) * sWorld->getRate(RATE_AUCTION_CUT));
|
||||
return std::max(cut, int64(0));
|
||||
}
|
||||
|
||||
/// the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
|
||||
uint32 AuctionEntry::GetAuctionOutBid() const
|
||||
uint64 AuctionEntry::GetAuctionOutBid() const
|
||||
{
|
||||
uint32 outbid = CalculatePct(bid, 5);
|
||||
uint64 outbid = CalculatePct(bid, 5);
|
||||
return outbid ? outbid : 1;
|
||||
}
|
||||
|
||||
@@ -894,12 +894,12 @@ void AuctionEntry::SaveToDB(CharacterDatabaseTransaction& trans) const
|
||||
stmt->setUInt8(1, houseId);
|
||||
stmt->setUInt32(2, itemGUIDLow);
|
||||
stmt->setUInt32(3, owner);
|
||||
stmt->setUInt32(4, buyout);
|
||||
stmt->setUInt64(4, buyout);
|
||||
stmt->setUInt32(5, uint32(expire_time));
|
||||
stmt->setUInt32(6, bidder);
|
||||
stmt->setUInt32(7, bid);
|
||||
stmt->setUInt32(8, startbid);
|
||||
stmt->setUInt32(9, deposit);
|
||||
stmt->setUInt64(7, bid);
|
||||
stmt->setUInt64(8, startbid);
|
||||
stmt->setUInt64(9, deposit);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
@@ -911,12 +911,12 @@ bool AuctionEntry::LoadFromDB(Field* fields)
|
||||
itemEntry = fields[3].GetUInt32();
|
||||
itemCount = fields[4].GetUInt32();
|
||||
owner = fields[5].GetUInt32();
|
||||
buyout = fields[6].GetUInt32();
|
||||
buyout = fields[6].GetUInt64();
|
||||
expire_time = fields[7].GetUInt32();
|
||||
bidder = fields[8].GetUInt32();
|
||||
bid = fields[9].GetUInt32();
|
||||
startbid = fields[10].GetUInt32();
|
||||
deposit = fields[11].GetUInt32();
|
||||
bid = fields[9].GetUInt64();
|
||||
startbid = fields[10].GetUInt64();
|
||||
deposit = fields[11].GetUInt64();
|
||||
|
||||
auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntryFromHouse(houseId);
|
||||
if (!auctionHouseEntry)
|
||||
@@ -942,7 +942,7 @@ std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) c
|
||||
return strm.str();
|
||||
}
|
||||
|
||||
std::string AuctionEntry::BuildAuctionMailBody(ObjectGuid::LowType lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut)
|
||||
std::string AuctionEntry::BuildAuctionMailBody(ObjectGuid::LowType lowGuid, uint64 bid, uint64 buyout, uint64 deposit, uint64 cut)
|
||||
{
|
||||
std::ostringstream strm;
|
||||
strm.width(16);
|
||||
|
||||
@@ -80,26 +80,26 @@ struct TC_GAME_API AuctionEntry
|
||||
uint32 itemEntry;
|
||||
uint32 itemCount;
|
||||
ObjectGuid::LowType owner;
|
||||
uint32 startbid; //maybe useless
|
||||
uint32 bid;
|
||||
uint32 buyout;
|
||||
uint64 startbid; //maybe useless
|
||||
uint64 bid;
|
||||
uint64 buyout;
|
||||
time_t expire_time;
|
||||
ObjectGuid::LowType bidder;
|
||||
uint32 deposit; //deposit can be calculated only when creating auction
|
||||
uint64 deposit; //deposit can be calculated only when creating auction
|
||||
uint32 etime;
|
||||
std::unordered_set<ObjectGuid> bidders;
|
||||
AuctionHouseEntry const* auctionHouseEntry; // in AuctionHouse.dbc
|
||||
|
||||
// helpers
|
||||
uint8 GetHouseId() const { return houseId; }
|
||||
uint32 GetAuctionCut() const;
|
||||
uint32 GetAuctionOutBid() const;
|
||||
uint64 GetAuctionCut() const;
|
||||
uint64 GetAuctionOutBid() const;
|
||||
bool BuildAuctionInfo(WorldPacket & data, Item* sourceItem = nullptr) const;
|
||||
void DeleteFromDB(CharacterDatabaseTransaction& trans) const;
|
||||
void SaveToDB(CharacterDatabaseTransaction& trans) const;
|
||||
bool LoadFromDB(Field* fields);
|
||||
std::string BuildAuctionMailSubject(MailAuctionAnswers response) const;
|
||||
static std::string BuildAuctionMailBody(ObjectGuid::LowType lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut);
|
||||
static std::string BuildAuctionMailBody(ObjectGuid::LowType lowGuid, uint64 bid, uint64 buyout, uint64 deposit, uint64 cut);
|
||||
|
||||
};
|
||||
|
||||
@@ -179,10 +179,10 @@ class TC_GAME_API AuctionHouseMgr
|
||||
void SendAuctionSalePendingMail(AuctionEntry* auction, CharacterDatabaseTransaction& trans);
|
||||
void SendAuctionSuccessfulMail(AuctionEntry* auction, CharacterDatabaseTransaction& trans);
|
||||
void SendAuctionExpiredMail(AuctionEntry* auction, CharacterDatabaseTransaction& trans);
|
||||
void SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, CharacterDatabaseTransaction& trans);
|
||||
void SendAuctionOutbiddedMail(AuctionEntry* auction, uint64 newPrice, Player* newBidder, CharacterDatabaseTransaction& trans);
|
||||
void SendAuctionCancelledToBidderMail(AuctionEntry* auction, CharacterDatabaseTransaction& trans, Item* item);
|
||||
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count);
|
||||
static uint64 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntryFromHouse(uint8 houseId);
|
||||
public:
|
||||
|
||||
@@ -535,7 +535,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
|
||||
|
||||
InitRunes();
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_COINAGE, sWorld->getIntConfig(CONFIG_START_PLAYER_MONEY));
|
||||
SetUInt64Value(PLAYER_FIELD_COINAGE, sWorld->getIntConfig(CONFIG_START_PLAYER_MONEY));
|
||||
SetCurrency(CURRENCY_TYPE_HONOR_POINTS, sWorld->getIntConfig(CONFIG_CURRENCY_START_HONOR_POINTS));
|
||||
SetCurrency(CURRENCY_TYPE_JUSTICE_POINTS, sWorld->getIntConfig(CONFIG_CURRENCY_START_JUSTICE_POINTS));
|
||||
SetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, sWorld->getIntConfig(CONFIG_CURRENCY_START_CONQUEST_POINTS));
|
||||
@@ -16422,7 +16422,7 @@ void Player::TalkedToCreature(uint32 entry, ObjectGuid guid)
|
||||
}
|
||||
}
|
||||
|
||||
void Player::MoneyChanged(uint32 count)
|
||||
void Player::MoneyChanged(uint64 value)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
|
||||
{
|
||||
@@ -16437,7 +16437,7 @@ void Player::MoneyChanged(uint32 count)
|
||||
|
||||
if (q_status.Status == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
if (int32(count) >= -qInfo->GetRewOrReqMoney())
|
||||
if (int64(value) >= -int64(qInfo->GetRewOrReqMoney()))
|
||||
{
|
||||
if (CanCompleteQuest(questid))
|
||||
CompleteQuest(questid);
|
||||
@@ -16445,7 +16445,7 @@ void Player::MoneyChanged(uint32 count)
|
||||
}
|
||||
else if (q_status.Status == QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
if (int32(count) < -qInfo->GetRewOrReqMoney())
|
||||
if (int64(value) < -int64(qInfo->GetRewOrReqMoney()))
|
||||
IncompleteQuest(questid);
|
||||
}
|
||||
}
|
||||
@@ -18385,8 +18385,8 @@ void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mail
|
||||
m->body = fields[5].GetString();
|
||||
m->expire_time = time_t(fields[6].GetUInt32());
|
||||
m->deliver_time = time_t(fields[7].GetUInt32());
|
||||
m->money = fields[8].GetUInt32();
|
||||
m->COD = fields[9].GetUInt32();
|
||||
m->money = fields[8].GetUInt64();
|
||||
m->COD = fields[9].GetUInt64();
|
||||
m->checked = fields[10].GetUInt8();
|
||||
m->stationery = fields[11].GetUInt8();
|
||||
m->mailTemplateId = fields[12].GetInt16();
|
||||
@@ -20123,8 +20123,8 @@ void Player::_SaveMail(CharacterDatabaseTransaction& trans)
|
||||
stmt->setUInt8(0, uint8(m->HasItems() ? 1 : 0));
|
||||
stmt->setUInt32(1, uint32(m->expire_time));
|
||||
stmt->setUInt32(2, uint32(m->deliver_time));
|
||||
stmt->setUInt32(3, m->money);
|
||||
stmt->setUInt32(4, m->COD);
|
||||
stmt->setUInt64(3, m->money);
|
||||
stmt->setUInt64(4, m->COD);
|
||||
stmt->setUInt8(5, uint8(m->checked));
|
||||
stmt->setUInt32(6, m->messageID);
|
||||
|
||||
@@ -21998,7 +21998,7 @@ void Player::InitDisplayIds()
|
||||
}
|
||||
}
|
||||
|
||||
inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore)
|
||||
inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint32 count, uint8 bag, uint8 slot, int64 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore)
|
||||
{
|
||||
uint32 stacks = count / pProto->GetBuyCount();
|
||||
ItemPosCountVec vDest;
|
||||
@@ -22056,7 +22056,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c
|
||||
{
|
||||
it->SetFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE);
|
||||
it->SetRefundRecipient(GetGUID().GetCounter());
|
||||
it->SetPaidMoney(price);
|
||||
it->SetPaidMoney(uint32(price));
|
||||
it->SetPaidExtendedCost(crItem->ExtendedCost);
|
||||
it->SaveRefundDataToDB();
|
||||
AddRefundReference(it->GetGUID());
|
||||
@@ -22225,7 +22225,7 @@ bool Player::BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot,
|
||||
}
|
||||
|
||||
// Return true is the bought item has a max count to force refresh of window by caller
|
||||
bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
|
||||
bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint32 count, uint8 bag, uint8 slot)
|
||||
{
|
||||
// cheating attempt
|
||||
if (count < 1) count = 1;
|
||||
@@ -22294,7 +22294,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
|
||||
// check current item amount if it limited
|
||||
if (crItem->maxcount != 0)
|
||||
{
|
||||
if (creature->GetVendorItemCurrentCount(crItem) < pProto->GetBuyCount() * count)
|
||||
if (creature->GetVendorItemCurrentCount(crItem) < count)
|
||||
{
|
||||
SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, creature, item, 0);
|
||||
return false;
|
||||
@@ -22399,27 +22399,26 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
|
||||
}
|
||||
}
|
||||
|
||||
uint32 price = 0;
|
||||
uint64 price = 0;
|
||||
if (crItem->IsGoldRequired(pProto) && pProto->GetBuyPrice() > 0) //Assume price cannot be negative (do not know why it is int32)
|
||||
{
|
||||
uint32 maxCount = MAX_MONEY_AMOUNT / pProto->GetBuyPrice();
|
||||
if ((uint32)count > maxCount)
|
||||
double buyPricePerItem = double(pProto->GetBuyPrice()) / pProto->GetBuyCount();
|
||||
uint32 maxCount = MAX_MONEY_AMOUNT / buyPricePerItem;
|
||||
if (count > maxCount)
|
||||
{
|
||||
TC_LOG_INFO("entities.player.cheat", "Player::BuyItemFromVendorSlot: Player '%s' (%s) tried to buy item (ItemID: %u, Count: %u), causing overflow",
|
||||
GetName().c_str(), GetGUID().ToString().c_str(), pProto->GetId(), (uint32)count);
|
||||
count = (uint8)maxCount;
|
||||
GetName().c_str(), GetGUID().ToString().c_str(), pProto->GetId(), count);
|
||||
count = maxCount;
|
||||
}
|
||||
price = pProto->GetBuyPrice() * count; //it should not exceed MAX_MONEY_AMOUNT
|
||||
|
||||
price /= pProto->GetBuyCount();
|
||||
price = uint64(buyPricePerItem * count); //it should not exceed MAX_MONEY_AMOUNT
|
||||
|
||||
// reputation discount
|
||||
price = uint32(floor(price * GetReputationPriceDiscount(creature)));
|
||||
price = uint64(floor(price * GetReputationPriceDiscount(creature)));
|
||||
|
||||
if (int32 priceMod = GetTotalAuraModifier(SPELL_AURA_MOD_VENDOR_ITEMS_PRICES))
|
||||
price -= CalculatePct(price, priceMod);
|
||||
|
||||
if (!HasEnoughMoney(uint64(price)))
|
||||
if (!HasEnoughMoney(price))
|
||||
{
|
||||
SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item, 0);
|
||||
return false;
|
||||
@@ -23196,7 +23195,7 @@ bool Player::ModifyMoney(int64 amount, bool sendError /*= true*/)
|
||||
SetMoney(GetMoney() > uint64(-amount) ? GetMoney() + amount : 0);
|
||||
else
|
||||
{
|
||||
if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint64>(amount))
|
||||
if (GetMoney() <= MAX_MONEY_AMOUNT - static_cast<uint64>(amount))
|
||||
SetMoney(GetMoney() + amount);
|
||||
else
|
||||
{
|
||||
@@ -27290,7 +27289,7 @@ void Player::RefundItem(Item* item)
|
||||
|
||||
// Grant back money
|
||||
if (moneyRefund)
|
||||
ModifyMoney(moneyRefund); // Saved in SaveInventoryAndGoldToDB
|
||||
ModifyMoney(int64(moneyRefund)); // Saved in SaveInventoryAndGoldToDB
|
||||
|
||||
SaveInventoryAndGoldToDB(trans);
|
||||
|
||||
|
||||
@@ -1288,9 +1288,9 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
bool IsTwoHandUsed() const;
|
||||
bool IsUsingTwoHandedWeaponInOneHand() const;
|
||||
void SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast = false, bool sendChatMessage = true);
|
||||
bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
|
||||
bool BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint32 count, uint8 bag, uint8 slot);
|
||||
bool BuyCurrencyFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorSlot, uint32 currency, uint32 count);
|
||||
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
|
||||
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint32 count, uint8 bag, uint8 slot, int64 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
|
||||
|
||||
float GetReputationPriceDiscount(Creature const* creature) const;
|
||||
|
||||
@@ -1431,7 +1431,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void KilledPlayerCreditForQuest(uint16 count, Quest const* quest);
|
||||
void KillCreditGO(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
|
||||
void TalkedToCreature(uint32 entry, ObjectGuid guid);
|
||||
void MoneyChanged(uint32 value);
|
||||
void MoneyChanged(uint64 value);
|
||||
void ReputationChanged(FactionEntry const* factionEntry);
|
||||
void ReputationChanged2(FactionEntry const* factionEntry);
|
||||
bool HasQuestForItem(uint32 itemId, uint32 excludeQuestId = 0, bool turnIn = false) const;
|
||||
|
||||
@@ -280,7 +280,7 @@ void Guild::BankEventLogEntry::SaveToDB(CharacterDatabaseTransaction& trans) con
|
||||
stmt->setUInt8 (++index, m_bankTabId);
|
||||
stmt->setUInt8 (++index, uint8(m_eventType));
|
||||
stmt->setUInt32(++index, m_playerGuid);
|
||||
stmt->setUInt32(++index, m_itemOrMoney);
|
||||
stmt->setUInt64(++index, m_itemOrMoney);
|
||||
stmt->setUInt16(++index, m_itemStackCount);
|
||||
stmt->setUInt8 (++index, m_destTabId);
|
||||
stmt->setUInt64(++index, m_timestamp);
|
||||
@@ -464,9 +464,6 @@ void Guild::RankInfo::SetRights(uint32 rights)
|
||||
|
||||
void Guild::RankInfo::SetBankMoneyPerDay(uint32 money)
|
||||
{
|
||||
if (m_rankId == GR_GUILDMASTER) // Prevent loss of leader rights
|
||||
money = uint32(GUILD_WITHDRAW_MONEY_UNLIMITED);
|
||||
|
||||
if (m_bankMoneyPerDay == money)
|
||||
return;
|
||||
|
||||
@@ -667,6 +664,7 @@ Guild::Member::Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId
|
||||
m_logoutTime(::GameTime::GetGameTime()),
|
||||
m_accountId(0),
|
||||
m_rankId(rankId),
|
||||
m_bankWithdrawMoney(0),
|
||||
m_achievementPoints(0),
|
||||
m_totalActivity(0),
|
||||
m_weekActivity(0),
|
||||
@@ -681,7 +679,7 @@ Guild::Member::Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId
|
||||
m_professions[i].RecipeUniqueBits.fill(0);
|
||||
}
|
||||
|
||||
memset(m_bankWithdraw, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(int32));
|
||||
memset(m_bankWithdraw, 0, (GUILD_BANK_MAX_TABS) * sizeof(uint32));
|
||||
}
|
||||
|
||||
void Guild::Member::SetStats(Player* player)
|
||||
@@ -781,9 +779,11 @@ bool Guild::Member::LoadFromDB(Field* fields)
|
||||
m_publicNote = fields[3].GetString();
|
||||
m_officerNote = fields[4].GetString();
|
||||
|
||||
for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS; ++i)
|
||||
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||
m_bankWithdraw[i] = fields[5 + i].GetUInt32();
|
||||
|
||||
m_bankWithdrawMoney = fields[13].GetUInt64();
|
||||
|
||||
SetStats(fields[14].GetString(),
|
||||
fields[15].GetUInt8(), // characters.level
|
||||
fields[16].GetUInt8(), // characters.class
|
||||
@@ -910,16 +910,14 @@ void Guild::Member::UpdateLogoutTime()
|
||||
m_logoutTime = ::GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
// Decreases amount of money/slots left for today.
|
||||
// If (tabId == GUILD_BANK_MAX_TABS) decrease money amount.
|
||||
// Otherwise decrease remaining items amount for specified tab.
|
||||
void Guild::Member::UpdateBankWithdrawValue(CharacterDatabaseTransaction& trans, uint8 tabId, uint32 amount)
|
||||
// Decreases amount of slots left for today.
|
||||
void Guild::Member::UpdateBankTabWithdrawValue(CharacterDatabaseTransaction& trans, uint8 tabId, uint32 amount)
|
||||
{
|
||||
m_bankWithdraw[tabId] += amount;
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW_TABS);
|
||||
stmt->setUInt32(0, m_guid.GetCounter());
|
||||
for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS;)
|
||||
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS;)
|
||||
{
|
||||
uint32 withdraw = m_bankWithdraw[i++];
|
||||
stmt->setUInt32(i, withdraw);
|
||||
@@ -928,11 +926,24 @@ void Guild::Member::UpdateBankWithdrawValue(CharacterDatabaseTransaction& trans,
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
}
|
||||
|
||||
// Decreases amount of money left for today.
|
||||
void Guild::Member::UpdateBankMoneyWithdrawValue(CharacterDatabaseTransaction& trans, uint64 amount)
|
||||
{
|
||||
m_bankWithdrawMoney += amount;
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW_MONEY);
|
||||
stmt->setUInt64(0, m_guid.GetCounter());
|
||||
stmt->setUInt64(1, m_bankWithdrawMoney);
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
}
|
||||
|
||||
void Guild::Member::ResetValues(bool weekly /* = false*/)
|
||||
{
|
||||
for (uint8 tabId = 0; tabId <= GUILD_BANK_MAX_TABS; ++tabId)
|
||||
for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
|
||||
m_bankWithdraw[tabId] = 0;
|
||||
|
||||
m_bankWithdrawMoney = 0;
|
||||
|
||||
if (weekly)
|
||||
ResetWeekActivityAndReputation();
|
||||
}
|
||||
@@ -1007,18 +1018,6 @@ void Guild::Member::UpdateProfessionData()
|
||||
}
|
||||
}
|
||||
|
||||
// Get amount of money/slots left for today.
|
||||
// If (tabId == GUILD_BANK_MAX_TABS) return money amount.
|
||||
// Otherwise return remaining items amount for specified tab.
|
||||
int32 Guild::Member::GetBankWithdrawValue(uint8 tabId) const
|
||||
{
|
||||
// Guild master has unlimited amount.
|
||||
if (IsRank(GR_GUILDMASTER))
|
||||
return static_cast<int32>(tabId == GUILD_BANK_MAX_TABS ? GUILD_WITHDRAW_MONEY_UNLIMITED : GUILD_WITHDRAW_SLOT_UNLIMITED);
|
||||
|
||||
return m_bankWithdraw[tabId];
|
||||
}
|
||||
|
||||
// EmblemInfo
|
||||
void EmblemInfo::ReadPacket(WorldPacket& recv)
|
||||
{
|
||||
@@ -1717,7 +1716,7 @@ void Guild::SendGuildRankInfo(WorldSession* session) const
|
||||
rankData.RankID = rankInfo->GetId();
|
||||
rankData.RankOrder = uint32(i);
|
||||
rankData.Flags = rankInfo->GetRights();
|
||||
rankData.WithdrawGoldLimit = (rankInfo->GetId() == GR_GUILDMASTER ? (-1) : int32(rankInfo->GetBankMoneyPerDay() / GOLD));
|
||||
rankData.WithdrawGoldLimit = rankInfo->GetBankMoneyPerDay();
|
||||
rankData.RankName = rankInfo->GetName();
|
||||
|
||||
for (uint8 j = 0; j < GUILD_BANK_MAX_TABS; ++j)
|
||||
@@ -2245,17 +2244,18 @@ void Guild::HandleRemoveRank(WorldSession* session, uint8 rankId)
|
||||
|
||||
void Guild::HandleMemberDepositMoney(WorldSession* session, uint64 amount, bool cashFlow /*=false*/)
|
||||
{
|
||||
Player* player = session->GetPlayer();
|
||||
|
||||
// Call script after validation and before money transfer.
|
||||
sScriptMgr->OnGuildMemberDepositMoney(this, player, amount);
|
||||
|
||||
// guild bank cannot have more than GUILD_BANK_MONEY_LIMIT
|
||||
if (m_bankMoney > GUILD_BANK_MONEY_LIMIT - amount)
|
||||
{
|
||||
SendCommandResult(session, GUILD_COMMAND_MOVE_ITEM, ERR_GUILD_BANK_FULL);
|
||||
return;
|
||||
}
|
||||
|
||||
Player* player = session->GetPlayer();
|
||||
|
||||
// Call script after validation and before money transfer.
|
||||
sScriptMgr->OnGuildMemberDepositMoney(this, player, amount);
|
||||
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
_ModifyBankMoney(trans, amount, true);
|
||||
if (!cashFlow)
|
||||
@@ -2281,7 +2281,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint64 amount, bool
|
||||
bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint64 amount, bool repair)
|
||||
{
|
||||
// clamp amount to MAX_MONEY_AMOUNT, Players can't hold more than that anyway
|
||||
amount = std::min(amount, uint64(MAX_MONEY_AMOUNT));
|
||||
amount = std::min(amount, MAX_MONEY_AMOUNT);
|
||||
|
||||
if (m_bankMoney < amount) // Not enough money in bank
|
||||
return false;
|
||||
@@ -2292,7 +2292,10 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint64 amount, bool
|
||||
if (!member)
|
||||
return false;
|
||||
|
||||
if (uint64(_GetMemberRemainingMoney(member)) < amount) // Check if we have enough slot/money today
|
||||
if (!_HasRankRight(player, repair ? GR_RIGHT_WITHDRAW_REPAIR : GR_RIGHT_WITHDRAW_GOLD))
|
||||
return false;
|
||||
|
||||
if (_GetMemberRemainingMoney(member) < int64(amount)) // Check if we have enough slot/money today
|
||||
return false;
|
||||
|
||||
// Call script after validation and before money transfer.
|
||||
@@ -2309,7 +2312,7 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint64 amount, bool
|
||||
}
|
||||
|
||||
// Update remaining money amount
|
||||
member->UpdateBankWithdrawValue(trans, GUILD_BANK_MAX_TABS, amount);
|
||||
member->UpdateBankMoneyWithdrawValue(trans, amount);
|
||||
// Remove money from bank
|
||||
_ModifyBankMoney(trans, amount, false);
|
||||
|
||||
@@ -2496,7 +2499,7 @@ void Guild::SendPermissions(WorldSession* session) const
|
||||
data << uint32(rankId);
|
||||
data << uint32(_GetPurchasedTabsSize());
|
||||
data << uint32(_GetRankRights(rankId));
|
||||
data << uint32(_GetMemberRemainingMoney(member));
|
||||
data << uint32(_GetRankBankMoneyPerDay(rankId));
|
||||
data.WriteBits(GUILD_BANK_MAX_TABS, 23);
|
||||
for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
|
||||
{
|
||||
@@ -2514,11 +2517,11 @@ void Guild::SendMoneyInfo(WorldSession* session) const
|
||||
if (!member)
|
||||
return;
|
||||
|
||||
int32 amount = _GetMemberRemainingMoney(member);
|
||||
int64 amount = _GetMemberRemainingMoney(member);
|
||||
WorldPacket data(SMSG_GUILD_BANK_MONEY_WITHDRAWN, 8);
|
||||
data << int64(amount);
|
||||
session->SendPacket(&data);
|
||||
TC_LOG_DEBUG("guild", "SMSG_GUILD_BANK_MONEY_WITHDRAWN [%s] Money: %u", session->GetPlayerInfo().c_str(), amount);
|
||||
TC_LOG_DEBUG("guild", "SMSG_GUILD_BANK_MONEY_WITHDRAWN [%s] Money: " SI64FMTD, session->GetPlayerInfo().c_str(), amount);
|
||||
}
|
||||
|
||||
void Guild::SendLoginInfo(WorldSession* session)
|
||||
@@ -2718,7 +2721,7 @@ bool Guild::LoadBankEventLogFromDB(Field* fields)
|
||||
dbTabId, // tab id
|
||||
eventType, // event type
|
||||
fields[4].GetUInt32(), // player guid
|
||||
fields[5].GetUInt32(), // item or money
|
||||
fields[5].GetUInt64(), // item or money
|
||||
fields[6].GetUInt16(), // itam stack count
|
||||
fields[7].GetUInt8())); // dest tab id
|
||||
}
|
||||
@@ -3373,7 +3376,7 @@ inline uint32 Guild::_GetRankRights(uint8 rankId) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int32 Guild::_GetRankBankMoneyPerDay(uint8 rankId) const
|
||||
inline uint32 Guild::_GetRankBankMoneyPerDay(uint8 rankId) const
|
||||
{
|
||||
if (RankInfo const* rankInfo = GetRankInfo(rankId))
|
||||
return rankInfo->GetBankMoneyPerDay();
|
||||
@@ -3404,7 +3407,7 @@ inline int32 Guild::_GetMemberRemainingSlots(Member const* member, uint8 tabId)
|
||||
return static_cast<int32>(GUILD_WITHDRAW_SLOT_UNLIMITED);
|
||||
if ((_GetRankBankTabRights(rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != 0)
|
||||
{
|
||||
int32 remaining = _GetRankBankTabSlotsPerDay(rankId, tabId) - member->GetBankWithdrawValue(tabId);
|
||||
int32 remaining = _GetRankBankTabSlotsPerDay(rankId, tabId) - member->GetBankTabWithdrawValue(tabId);
|
||||
if (remaining > 0)
|
||||
return remaining;
|
||||
}
|
||||
@@ -3412,17 +3415,17 @@ inline int32 Guild::_GetMemberRemainingSlots(Member const* member, uint8 tabId)
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int32 Guild::_GetMemberRemainingMoney(Member const* member) const
|
||||
inline int64 Guild::_GetMemberRemainingMoney(Member const* member) const
|
||||
{
|
||||
if (member)
|
||||
{
|
||||
uint8 rankId = member->GetRankId();
|
||||
if (rankId == GR_GUILDMASTER)
|
||||
return static_cast<int32>(GUILD_WITHDRAW_MONEY_UNLIMITED);
|
||||
return std::numeric_limits<int64>::max();
|
||||
|
||||
if ((_GetRankRights(rankId) & (GR_RIGHT_WITHDRAW_REPAIR | GR_RIGHT_WITHDRAW_GOLD)) != 0)
|
||||
{
|
||||
int32 remaining = _GetRankBankMoneyPerDay(rankId) - member->GetBankWithdrawValue(GUILD_BANK_MAX_TABS);
|
||||
int64 remaining = (int64(_GetRankBankMoneyPerDay(rankId)) * GOLD) - member->GetBankMoneyWithdrawValue();
|
||||
if (remaining > 0)
|
||||
return remaining;
|
||||
}
|
||||
@@ -3433,12 +3436,7 @@ inline int32 Guild::_GetMemberRemainingMoney(Member const* member) const
|
||||
inline void Guild::_UpdateMemberWithdrawSlots(CharacterDatabaseTransaction& trans, ObjectGuid guid, uint8 tabId)
|
||||
{
|
||||
if (Member* member = GetMember(guid))
|
||||
{
|
||||
uint8 rankId = member->GetRankId();
|
||||
if (rankId != GR_GUILDMASTER
|
||||
&& member->GetBankWithdrawValue(tabId) < _GetRankBankTabSlotsPerDay(rankId, tabId))
|
||||
member->UpdateBankWithdrawValue(trans, tabId, 1);
|
||||
}
|
||||
member->UpdateBankTabWithdrawValue(trans, tabId, 1);
|
||||
}
|
||||
|
||||
inline bool Guild::_MemberHasTabRights(ObjectGuid guid, uint8 tabId, uint32 rights) const
|
||||
@@ -3464,7 +3462,7 @@ inline void Guild::_LogEvent(GuildEventLogTypes eventType, ObjectGuid::LowType p
|
||||
}
|
||||
|
||||
// Add new bank event log record
|
||||
void Guild::_LogBankEvent(CharacterDatabaseTransaction& trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType lowguid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
|
||||
void Guild::_LogBankEvent(CharacterDatabaseTransaction& trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType lowguid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
|
||||
{
|
||||
if (tabId > GUILD_BANK_MAX_TABS)
|
||||
return;
|
||||
|
||||
@@ -409,8 +409,10 @@ private:
|
||||
inline bool IsRankNotLower(uint8 rankId) const { return m_rankId <= rankId; }
|
||||
inline bool IsSamePlayer(ObjectGuid guid) const { return m_guid == guid; }
|
||||
|
||||
void UpdateBankWithdrawValue(CharacterDatabaseTransaction& trans, uint8 tabId, uint32 amount);
|
||||
int32 GetBankWithdrawValue(uint8 tabId) const;
|
||||
void UpdateBankTabWithdrawValue(CharacterDatabaseTransaction& trans, uint8 tabId, uint32 amount);
|
||||
void UpdateBankMoneyWithdrawValue(CharacterDatabaseTransaction& trans, uint64 amount);
|
||||
uint32 GetBankTabWithdrawValue(uint8 tabId) const { return m_bankWithdraw[tabId]; };
|
||||
uint64 GetBankMoneyWithdrawValue() const { return m_bankWithdrawMoney; };
|
||||
void ResetValues(bool weekly = false);
|
||||
void ResetWeekActivityAndReputation();
|
||||
|
||||
@@ -436,7 +438,8 @@ private:
|
||||
|
||||
std::set<uint32> m_trackedCriteriaIds;
|
||||
|
||||
int32 m_bankWithdraw[GUILD_BANK_MAX_TABS + 1];
|
||||
uint32 m_bankWithdraw[GUILD_BANK_MAX_TABS];
|
||||
uint64 m_bankWithdrawMoney;
|
||||
uint32 m_achievementPoints;
|
||||
uint64 m_totalActivity;
|
||||
uint64 m_weekActivity;
|
||||
@@ -595,8 +598,7 @@ private:
|
||||
RankInfo(): m_guildId(0), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_EMPTY), m_bankMoneyPerDay(0) { }
|
||||
RankInfo(ObjectGuid::LowType guildId) : m_guildId(guildId), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_EMPTY), m_bankMoneyPerDay(0) { }
|
||||
RankInfo(ObjectGuid::LowType guildId, uint8 rankId, std::string const& name, uint32 rights, uint32 money) :
|
||||
m_guildId(guildId), m_rankId(rankId), m_name(name), m_rights(rights),
|
||||
m_bankMoneyPerDay(rankId != GR_GUILDMASTER ? money : GUILD_WITHDRAW_MONEY_UNLIMITED) { }
|
||||
m_guildId(guildId), m_rankId(rankId), m_name(name), m_rights(rights), m_bankMoneyPerDay(money) { }
|
||||
|
||||
void LoadFromDB(Field* fields);
|
||||
void SaveToDB(CharacterDatabaseTransaction& trans) const;
|
||||
@@ -609,7 +611,10 @@ private:
|
||||
uint32 GetRights() const { return m_rights; }
|
||||
void SetRights(uint32 rights);
|
||||
|
||||
int32 GetBankMoneyPerDay() const { return m_bankMoneyPerDay; }
|
||||
uint32 GetBankMoneyPerDay() const
|
||||
{
|
||||
return m_rankId != GR_GUILDMASTER ? m_bankMoneyPerDay : GUILD_WITHDRAW_MONEY_UNLIMITED;
|
||||
}
|
||||
|
||||
void SetBankMoneyPerDay(uint32 money);
|
||||
|
||||
@@ -989,17 +994,17 @@ private:
|
||||
void _SetRankBankTabRightsAndSlots(uint8 rankId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB = true);
|
||||
int8 _GetRankBankTabRights(uint8 rankId, uint8 tabId) const;
|
||||
uint32 _GetRankRights(uint8 rankId) const;
|
||||
int32 _GetRankBankMoneyPerDay(uint8 rankId) const;
|
||||
uint32 _GetRankBankMoneyPerDay(uint8 rankId) const;
|
||||
int32 _GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const;
|
||||
std::string _GetRankName(uint8 rankId) const;
|
||||
|
||||
int32 _GetMemberRemainingSlots(Member const* member, uint8 tabId) const;
|
||||
int32 _GetMemberRemainingMoney(Member const* member) const;
|
||||
int64 _GetMemberRemainingMoney(Member const* member) const;
|
||||
void _UpdateMemberWithdrawSlots(CharacterDatabaseTransaction& trans, ObjectGuid guid, uint8 tabId);
|
||||
bool _MemberHasTabRights(ObjectGuid guid, uint8 tabId, uint32 rights) const;
|
||||
|
||||
void _LogEvent(GuildEventLogTypes eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2 = 0, uint8 newRank = 0);
|
||||
void _LogBankEvent(CharacterDatabaseTransaction& trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint32 itemOrMoney, uint16 itemStackCount = 0, uint8 destTabId = 0);
|
||||
void _LogBankEvent(CharacterDatabaseTransaction& trans, GuildBankEventLogTypes eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount = 0, uint8 destTabId = 0);
|
||||
|
||||
Item* _GetItem(uint8 tabId, uint8 slotId) const;
|
||||
void _RemoveItem(CharacterDatabaseTransaction& trans, uint8 tabId, uint8 slotId);
|
||||
|
||||
@@ -103,7 +103,7 @@ void WorldSession::SendAuctionCommandResult(AuctionEntry* auction, uint32 action
|
||||
}
|
||||
|
||||
//this function sends notification, if bidder is online
|
||||
void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 itemEntry)
|
||||
void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint64 bidSum, uint64 diff, uint32 itemEntry)
|
||||
{
|
||||
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4));
|
||||
data << uint32(location);
|
||||
@@ -279,8 +279,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
uint32 auctionTime = uint32(etime * sWorld->getRate(RATE_AUCTION_TIME));
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
|
||||
|
||||
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
|
||||
if (!_player->HasEnoughMoney((uint64)deposit))
|
||||
uint64 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
|
||||
if (!_player->HasEnoughMoney(deposit))
|
||||
{
|
||||
SendAuctionCommandResult(nullptr, AUCTION_SELL_ITEM, ERR_AUCTION_NOT_ENOUGHT_MONEY);
|
||||
return;
|
||||
@@ -538,7 +538,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_AUCTION_BID);
|
||||
stmt->setUInt32(0, auction->bidder);
|
||||
stmt->setUInt32(1, auction->bid);
|
||||
stmt->setUInt64(1, auction->bid);
|
||||
stmt->setUInt32(2, auction->Id);
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -619,8 +619,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
{
|
||||
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((uint64)auctionCut)) //player doesn't have enough money, maybe message needed
|
||||
uint64 auctionCut = auction->GetAuctionCut();
|
||||
if (!player->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
||||
return;
|
||||
sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans, pItem);
|
||||
player->ModifyMoney(-int64(auctionCut));
|
||||
|
||||
@@ -415,6 +415,14 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (pProto->GetSellPrice() > 0)
|
||||
{
|
||||
uint64 money = uint64(pProto->GetSellPrice()) * count;
|
||||
|
||||
if (money >= 0xFFFFFFFF) // Can't exceed 32bit limit on a buyback entry
|
||||
{
|
||||
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (count < pItem->GetCount()) // need split items
|
||||
{
|
||||
Item* pNewItem = pItem->CloneItem(count, _player);
|
||||
@@ -443,7 +451,6 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
||||
_player->AddItemToBuyBackSlot(pItem);
|
||||
}
|
||||
|
||||
uint32 money = pProto->GetSellPrice() * count;
|
||||
_player->ModifyMoney(money);
|
||||
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS, money);
|
||||
}
|
||||
@@ -490,7 +497,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
||||
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
_player->ModifyMoney(-(int32)price);
|
||||
_player->ModifyMoney(-int64(price));
|
||||
_player->RemoveItemFromBuyBackSlot(slot, false);
|
||||
_player->ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
|
||||
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
|
||||
|
||||
@@ -535,7 +535,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// prevent cheating with skip client money check
|
||||
if (!player->HasEnoughMoney(uint64(m->COD)))
|
||||
if (!player->HasEnoughMoney(m->COD))
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
@@ -588,7 +588,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
.SendMailTo(trans, MailReceiver(receiver, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
|
||||
}
|
||||
|
||||
player->ModifyMoney(-int32(m->COD));
|
||||
player->ModifyMoney(-int64(m->COD));
|
||||
}
|
||||
m->COD = 0;
|
||||
m->state = MAIL_STATE_CHANGED;
|
||||
|
||||
@@ -191,7 +191,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
_player->ModifyMoney(-(int32)cost);
|
||||
_player->ModifyMoney(-int64(cost));
|
||||
Item* charter = _player->StoreNewItem(dest, charterid, true);
|
||||
if (!charter)
|
||||
return;
|
||||
|
||||
@@ -379,7 +379,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player->GetMoney() >= uint64(MAX_MONEY_AMOUNT) - his_trade->GetMoney())
|
||||
if (_player->GetMoney() > uint64(MAX_MONEY_AMOUNT) - his_trade->GetMoney())
|
||||
{
|
||||
info.Status = TRADE_STATUS_CLOSE_WINDOW;
|
||||
info.Result = EQUIP_ERR_TOO_MUCH_GOLD;
|
||||
@@ -388,7 +388,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
return;
|
||||
}
|
||||
|
||||
if (trader->GetMoney() >= uint64(MAX_MONEY_AMOUNT) - my_trade->GetMoney())
|
||||
if (trader->GetMoney() > uint64(MAX_MONEY_AMOUNT) - my_trade->GetMoney())
|
||||
{
|
||||
info.Status = TRADE_STATUS_CLOSE_WINDOW;
|
||||
info.Result = EQUIP_ERR_TOO_MUCH_GOLD;
|
||||
|
||||
@@ -225,8 +225,8 @@ void MailDraft::SendMailTo(CharacterDatabaseTransaction& trans, MailReceiver con
|
||||
stmt->setBool (++index, !m_items.empty());
|
||||
stmt->setUInt64(++index, uint64(expire_time));
|
||||
stmt->setUInt64(++index, uint64(deliver_time));
|
||||
stmt->setUInt32(++index, m_money);
|
||||
stmt->setUInt32(++index, m_COD);
|
||||
stmt->setUInt64(++index, m_money);
|
||||
stmt->setUInt64(++index, m_COD);
|
||||
stmt->setUInt8 (++index, uint8(checked));
|
||||
trans->Append(stmt);
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class TC_GAME_API MailDraft
|
||||
public: // modifiers
|
||||
MailDraft& AddItem(Item* item);
|
||||
MailDraft& AddMoney(uint64 money) { m_money = money; return *this; }
|
||||
MailDraft& AddCOD(uint32 COD) { m_COD = COD; return *this; }
|
||||
MailDraft& AddCOD(uint64 COD) { m_COD = COD; return *this; }
|
||||
|
||||
public: // finishers
|
||||
void SendReturnToSender(uint32 sender_acc, ObjectGuid::LowType sender_guid, ObjectGuid::LowType receiver_guid, CharacterDatabaseTransaction& trans);
|
||||
|
||||
@@ -2046,7 +2046,7 @@ void ScriptMgr::OnGuildEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType
|
||||
FOREACH_SCRIPT(GuildScript)->OnEvent(guild, eventType, playerGuid1, playerGuid2, newRank);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
|
||||
void ScriptMgr::OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
|
||||
{
|
||||
FOREACH_SCRIPT(GuildScript)->OnBankEvent(guild, eventType, tabId, playerGuid, itemOrMoney, itemStackCount, destTabId);
|
||||
}
|
||||
|
||||
@@ -770,7 +770,7 @@ class TC_GAME_API GuildScript : public ScriptObject
|
||||
|
||||
virtual void OnEvent(Guild* /*guild*/, uint8 /*eventType*/, ObjectGuid::LowType /*playerGuid1*/, ObjectGuid::LowType /*playerGuid2*/, uint8 /*newRank*/) { }
|
||||
|
||||
virtual void OnBankEvent(Guild* /*guild*/, uint8 /*eventType*/, uint8 /*tabId*/, ObjectGuid::LowType /*playerGuid*/, uint32 /*itemOrMoney*/, uint16 /*itemStackCount*/, uint8 /*destTabId*/) { }
|
||||
virtual void OnBankEvent(Guild* /*guild*/, uint8 /*eventType*/, uint8 /*tabId*/, ObjectGuid::LowType /*playerGuid*/, uint64 /*itemOrMoney*/, uint16 /*itemStackCount*/, uint8 /*destTabId*/) { }
|
||||
};
|
||||
|
||||
class TC_GAME_API GroupScript : public ScriptObject
|
||||
@@ -1035,7 +1035,7 @@ class TC_GAME_API ScriptMgr
|
||||
void OnGuildItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank, uint8 srcContainer, uint8 srcSlotId,
|
||||
bool isDestBank, uint8 destContainer, uint8 destSlotId);
|
||||
void OnGuildEvent(Guild* guild, uint8 eventType, ObjectGuid::LowType playerGuid1, ObjectGuid::LowType playerGuid2, uint8 newRank);
|
||||
void OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId);
|
||||
void OnGuildBankEvent(Guild* guild, uint8 eventType, uint8 tabId, ObjectGuid::LowType playerGuid, uint64 itemOrMoney, uint16 itemStackCount, uint8 destTabId);
|
||||
|
||||
public: /* GroupScript */
|
||||
|
||||
|
||||
@@ -523,7 +523,7 @@ class TC_GAME_API WorldSession
|
||||
//auction
|
||||
void SendAuctionHello(ObjectGuid guid, Creature* unit);
|
||||
void SendAuctionCommandResult(AuctionEntry* auction, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
|
||||
void SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 item_template);
|
||||
void SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint64 bidSum, uint64 diff, uint32 item_template);
|
||||
void SendAuctionOwnerNotification(AuctionEntry* auction);
|
||||
void SendAuctionRemovedNotification(uint32 auctionId, uint32 itemEntry, int32 randomPropertyId);
|
||||
|
||||
|
||||
@@ -943,7 +943,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_int_configs[CONFIG_START_PLAYER_MONEY] = sConfigMgr->GetIntDefault("StartPlayerMoney", 0);
|
||||
if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0)
|
||||
{
|
||||
TC_LOG_ERROR("server.loading", "StartPlayerMoney (%i) must be in range 0.." UI64FMTD ". Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], uint64(MAX_MONEY_AMOUNT), 0);
|
||||
TC_LOG_ERROR("server.loading", "StartPlayerMoney (%i) must be in range 0.." UI64FMTD ". 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] > 0x7FFFFFFF-1) // TODO: (See MAX_MONEY_AMOUNT)
|
||||
|
||||
@@ -585,7 +585,7 @@ public:
|
||||
std::string subject = queryFields[5].GetString();
|
||||
uint64 deliverTime = queryFields[6].GetUInt32();
|
||||
uint64 expireTime = queryFields[7].GetUInt32();
|
||||
uint32 money = queryFields[8].GetUInt32();
|
||||
uint64 money = queryFields[8].GetUInt64();
|
||||
uint8 hasItem = queryFields[9].GetUInt8();
|
||||
uint32 gold = money / GOLD;
|
||||
uint32 silv = (money % GOLD) / SILVER;
|
||||
|
||||
@@ -1612,7 +1612,7 @@ public:
|
||||
uint32 totalPlayerTime = 0;
|
||||
uint8 level = 0;
|
||||
std::string alive = handler->GetTrinityString(LANG_ERROR);
|
||||
uint32 money = 0;
|
||||
uint64 money = 0;
|
||||
uint32 xp = 0;
|
||||
uint32 xptotal = 0;
|
||||
|
||||
@@ -1669,7 +1669,7 @@ public:
|
||||
Field* fields = result->Fetch();
|
||||
totalPlayerTime = fields[0].GetUInt32();
|
||||
level = fields[1].GetUInt8();
|
||||
money = fields[2].GetUInt32();
|
||||
money = fields[2].GetUInt64();
|
||||
accId = fields[3].GetUInt32();
|
||||
raceid = fields[4].GetUInt8();
|
||||
classid = fields[5].GetUInt8();
|
||||
|
||||
@@ -570,7 +570,7 @@ public:
|
||||
{
|
||||
int64 newmoney = int64(targetMoney) + moneyToAdd;
|
||||
|
||||
TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_CURRENT_MONEY), uint32(targetMoney), int32(moneyToAdd), uint32(newmoney));
|
||||
TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney);
|
||||
if (newmoney <= 0)
|
||||
{
|
||||
NotifyModification(handler, target, LANG_YOU_TAKE_ALL_MONEY, LANG_YOURS_ALL_MONEY_GONE);
|
||||
@@ -590,9 +590,9 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, uint32(moneyToAdd), handler->GetNameLink(target).c_str());
|
||||
handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, moneyToAdd, handler->GetNameLink(target).c_str());
|
||||
if (handler->needReportToTarget(target))
|
||||
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), uint32(moneyToAdd));
|
||||
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd);
|
||||
|
||||
if (moneyToAdd >= int64(MAX_MONEY_AMOUNT))
|
||||
moneyToAdd = MAX_MONEY_AMOUNT;
|
||||
@@ -603,7 +603,7 @@ public:
|
||||
target->ModifyMoney(moneyToAdd);
|
||||
}
|
||||
|
||||
TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_NEW_MONEY), uint32(targetMoney), int32(moneyToAdd), uint32(target->GetMoney()));
|
||||
TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ public:
|
||||
// If the quest requires money
|
||||
int32 ReqOrRewMoney = quest->GetRewOrReqMoney(player);
|
||||
if (ReqOrRewMoney < 0)
|
||||
player->ModifyMoney(-ReqOrRewMoney);
|
||||
player->ModifyMoney(-int64(ReqOrRewMoney));
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
|
||||
{
|
||||
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
return false;
|
||||
|
||||
char* moneyStr = strtok(nullptr, "");
|
||||
int32 money = moneyStr ? atoi(moneyStr) : 0;
|
||||
int64 money = moneyStr ? atoll(moneyStr) : 0;
|
||||
if (money <= 0)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ void ProcessCastaction(Player* player, Creature* creature, uint32 spellId, uint3
|
||||
if (!(spellId && player->HasSpell(spellId)) && player->HasEnoughMoney((int64)cost))
|
||||
{
|
||||
player->CastSpell(player, triggeredSpellId, true);
|
||||
player->ModifyMoney(-cost);
|
||||
player->ModifyMoney(-int64(cost));
|
||||
}
|
||||
else
|
||||
player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, 0, 0);
|
||||
|
||||
Reference in new issue
Block a user