本文整理汇总了C++中GuildMember::OnMoneyWithdraw方法的典型用法代码示例。如果您正苦于以下问题:C++ GuildMember::OnMoneyWithdraw方法的具体用法?C++ GuildMember::OnMoneyWithdraw怎么用?C++ GuildMember::OnMoneyWithdraw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuildMember
的用法示例。
在下文中一共展示了GuildMember::OnMoneyWithdraw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WithdrawMoney
void Guild::WithdrawMoney(WorldSession * pClient, uint32 uAmount)
{
GuildMember * pMember = pClient->GetPlayer()->m_playerInfo->guildMember;
if (pMember == NULL)
return;
// sanity checks
if (pMember->pRank->iGoldLimitPerDay > 0)
{
if (pMember->CalculateAvailableAmount() < uAmount)
{
pClient->SystemMessage("You have already withdrawn too much today.");
return;
}
}
if (pMember->pRank->iGoldLimitPerDay == 0)
{
pClient->SystemMessage("You don't have permission to do that.");
return;
}
if (m_bankBalance < uAmount)
return;
if (sWorld.GoldCapEnabled)
{
if ((pClient->GetPlayer()->GetUInt32Value(PLAYER_FIELD_COINAGE) + uAmount) > sWorld.GoldLimit)
{
pClient->GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_TOO_MUCH_GOLD);
return;
}
}
// update his bank state
pMember->OnMoneyWithdraw(uAmount);
// give the gold! GM PLS GOLD PLS 1 COIN
pClient->GetPlayer()->ModUnsigned32Value(PLAYER_FIELD_COINAGE, (uint32)uAmount);
// subtract the balance
m_bankBalance -= uAmount;
// update in db
CharacterDatabase.Execute("UPDATE guilds SET bankBalance = %u WHERE guildId = %u", (m_bankBalance > 0) ? m_bankBalance : 0, m_guildId);
// notify everyone with the new balance
char buf[20];
snprintf(buf, 20, I64FMT, (uint64)m_bankBalance);
LogGuildEvent(GUILD_EVENT_SETNEWBALANCE, 1, buf);
// log it!
LogGuildBankActionMoney(GUILD_BANK_LOG_EVENT_WITHDRAW_MONEY, pClient->GetPlayer()->GetLowGUID(), uAmount);
}
示例2: WithdrawMoney
void Guild::WithdrawMoney(WorldSession * pClient, uint32 uAmount)
{
PlayerInfo * pPlayer = pClient->GetPlayer()->m_playerInfo;
GuildMember * pMember = pClient->GetPlayer()->m_playerInfo->guildMember;
if(pMember==NULL)
return;
if(uAmount == 0)
return;
if(m_bankBalance < uAmount)
{
pClient->SystemMessage("You cannot withdraw more money then the account holds.");
return;
}
// sanity checks (execpt for guildmasters)
if( pPlayer->guildRank->iId !=0 )
{
if(pMember->pRank->iGoldLimitPerDay > 0 && pMember->CalculateAvailableAmount() < uAmount )
{
pClient->SystemMessage("You have already withdrawn too much today.");
return;
}
if(pMember->pRank->iGoldLimitPerDay == 0 )
{
pClient->SystemMessage("You don't have permission to withdraw money.");
return;
}
}
// update his bank state
pMember->OnMoneyWithdraw(uAmount);
// give the gold! GM PLS GOLD PLS 1 COIN
pClient->GetPlayer()->ModUnsigned32Value(PLAYER_FIELD_COINAGE, (uint32)uAmount);
// subtract the balance
m_bankBalance -= uAmount;
// update in db
CharacterDatabase.Execute("UPDATE guilds SET bankBalance = %u WHERE guildId = %u", (m_bankBalance>0)?m_bankBalance:0, m_guildId);
// notify everyone with the new balance
char buf[20];
snprintf(buf, 20, I64FMT, (long long unsigned int)m_bankBalance);
LogGuildEvent(GUILD_EVENT_SETNEWBALANCE, 1, buf);
// log it!
LogGuildBankActionMoney(GUILD_BANK_LOG_EVENT_WITHDRAW_MONEY, pClient->GetPlayer()->GetLowGUID(), uAmount);
}
示例3: WithdrawMoney
void Guild::WithdrawMoney(WorldSession* pClient, uint32 uAmount)
{
GuildMember* pMember = pClient->GetPlayer()->getPlayerInfo()->guildMember;
if(pMember == NULL)
return;
// sanity checks
if(pMember->pRank->iGoldLimitPerDay > 0)
{
if(pMember->CalculateAvailableAmount() < uAmount)
{
pClient->SystemMessage("You have already withdrawn too much today.");
return;
}
}
if(pMember->pRank->iGoldLimitPerDay == 0)
{
pClient->SystemMessage("You don't have permission to do that.");
return;
}
if(m_bankBalance < uAmount)
return;
// Check they dont have more than the max gold
if(sWorld.GoldCapEnabled)
{
if((pClient->GetPlayer()->GetGold() + uAmount) > sWorld.GoldLimit)
{
pClient->GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_TOO_MUCH_GOLD);
return;
}
}
// update his bank state
pMember->OnMoneyWithdraw(uAmount);
// give the gold! GM PLS GOLD PLS 1 COIN
pClient->GetPlayer()->ModGold((uint32)uAmount);
SpendMoney(uAmount);
// log it!
LogGuildBankActionMoney(GUILD_BANK_LOG_EVENT_WITHDRAW_MONEY, pClient->GetPlayer()->GetLowGUID(), uAmount);
}