Core/Guilds: Guild bank tabs are now purchased only using money deposited in the bank (since 11.1.0)
Port From (https://github.com/TrinityCore/TrinityCore/commit/8f07dce5c128951d80ad86838013e5bba276f3c3)
This commit is contained in:
@@ -171,8 +171,8 @@ namespace Framework.Constants
|
||||
WithdrawMoney = 5,
|
||||
RepairMoney = 6,
|
||||
MoveItem2 = 7,
|
||||
Unk1 = 8,
|
||||
BuySlot = 9,
|
||||
WithdrawToBuyTab = 8,
|
||||
BuyTab = 9,
|
||||
CashFlowDeposit = 10
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -505,6 +505,9 @@ namespace Game.Guilds
|
||||
if (member == null)
|
||||
return;
|
||||
|
||||
if (GetLeaderGUID() != player.GetGUID())
|
||||
return;
|
||||
|
||||
if (_GetPurchasedTabsSize() >= GuildConst.MaxBankTabs)
|
||||
return;
|
||||
|
||||
@@ -514,18 +517,19 @@ namespace Game.Guilds
|
||||
if (tabId >= GuildConst.MaxBankTabs)
|
||||
return;
|
||||
|
||||
// Do not get money for bank tabs that the GM bought, we had to buy them already.
|
||||
// This is just a speedup check, GetGuildBankTabPrice will return 0.
|
||||
if (tabId < GuildConst.MaxBankTabs - 2) // 7th tab is actually the 6th
|
||||
{
|
||||
long tabCost = (long)(GetGuildBankTabPrice(tabId) * MoneyConstants.Gold);
|
||||
if (!player.HasEnoughMoney(tabCost)) // Should not happen, this is checked by client
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
|
||||
// Remove money from bank
|
||||
ulong tabCost = GetGuildBankTabPrice(tabId) * MoneyConstants.Gold;
|
||||
if (tabCost != 0 && !_ModifyBankMoney(trans, tabCost, false)) // Should not happen, this is checked by client
|
||||
return;
|
||||
|
||||
player.ModifyMoney(-tabCost);
|
||||
}
|
||||
// Log guild bank event
|
||||
_LogBankEvent(trans, GuildBankEventLogTypes.BuyTab, tabId, player.GetGUID().GetCounter(), (uint)tabCost);
|
||||
|
||||
_CreateNewBankTab();
|
||||
_CreateNewBankTab(trans);
|
||||
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
|
||||
BroadcastPacket(new GuildEventTabAdded());
|
||||
|
||||
@@ -1813,13 +1817,11 @@ namespace Game.Guilds
|
||||
}
|
||||
|
||||
// Private methods
|
||||
void _CreateNewBankTab()
|
||||
void _CreateNewBankTab(SQLTransaction trans)
|
||||
{
|
||||
byte tabId = _GetPurchasedTabsSize(); // Next free id
|
||||
m_bankTabs.Add(new BankTab(m_id, tabId));
|
||||
|
||||
SQLTransaction trans = new();
|
||||
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_TAB);
|
||||
stmt.AddValue(0, m_id);
|
||||
stmt.AddValue(1, tabId);
|
||||
@@ -1833,8 +1835,6 @@ namespace Game.Guilds
|
||||
++tabId;
|
||||
foreach (var rank in m_ranks)
|
||||
rank.CreateMissingTabsIfNeeded(tabId, trans, false);
|
||||
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
void _CreateDefaultGuildRanks(SQLTransaction trans, Locale loc = Locale.enUS)
|
||||
|
||||
Reference in New Issue
Block a user