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); }
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); }
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); }