mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 12:41:30 +00:00
[Feature] GuildBank Updates (#4674)
* First pass of a re-write of Guild Bank to enable RoF2 features * Testing - Corrected a few bugs with merging, splitting and withdrawing * Testing - Corrected a few bugs with depositing of bags * Added player event logging for deposit, withdrawal and movement between deposit to main area. * Fix the guilddelete routine Fix the guilddelete routine as a result of the new guild_bank table structure * Fix an issue with items not being withdrawn correctly. * Final Testing Phase 1 - A few failures to be resolved yet. * Final Testing Phase 2 - Looks good * Final Testing Phase 3 - Repair a visual bug with withdrawal of items with charges * Cleanup * Formatting feedback updates * Rebase and fix version.h * Fix manifest issue after changes
This commit is contained in:
parent
8201175c2c
commit
c09fad5a75
@ -6789,6 +6789,29 @@ UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 321) + 5410)
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 331) + 5610) WHERE `equip_slot` BETWEEN 331 AND 340; -- Bag 9
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 341) + 5810) WHERE `equip_slot` BETWEEN 341 AND 350; -- Bag 10
|
||||
)",
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9304,
|
||||
.description = "2024_12_01_2024_update_guild_bank",
|
||||
.check = "SHOW COLUMNS FROM `guild_bank` LIKE 'augment_1_id'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `guild_bank`
|
||||
DROP INDEX `guildid`,
|
||||
CHANGE COLUMN `guildid` `guild_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `id`,
|
||||
CHANGE COLUMN `itemid` `item_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `slot`,
|
||||
CHANGE COLUMN `whofor` `who_for` VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8_general_ci' AFTER `permissions`,
|
||||
ADD COLUMN `augment_one_id` INT UNSIGNED NULL DEFAULT '0' AFTER `item_id`,
|
||||
ADD COLUMN `augment_two_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_one_id`,
|
||||
ADD COLUMN `augment_three_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_two_id`,
|
||||
ADD COLUMN `augment_four_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_three_id`,
|
||||
ADD COLUMN `augment_five_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_four_id`,
|
||||
ADD COLUMN `augment_six_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_five_id`,
|
||||
CHANGE COLUMN `qty` `quantity` INT(10) NOT NULL DEFAULT '0' AFTER `augment_six_id`;
|
||||
ALTER TABLE `guild_bank`
|
||||
ADD INDEX `guild_id` (`guild_id`);
|
||||
)"
|
||||
}
|
||||
// -- template; copy/paste this when you need to create a new entry
|
||||
// ManifestEntry{
|
||||
|
||||
@ -130,6 +130,8 @@ namespace EQ
|
||||
using RoF2::invtype::MAIL_SIZE;
|
||||
using RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE;
|
||||
using RoF2::invtype::KRONO_SIZE;
|
||||
using RoF2::invtype::GUILD_BANK_MAIN_SIZE;
|
||||
using RoF2::invtype::GUILD_BANK_DEPOSIT_SIZE;
|
||||
using RoF2::invtype::OTHER_SIZE;
|
||||
|
||||
using RoF2::invtype::TRADE_NPC_SIZE;
|
||||
|
||||
@ -173,7 +173,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
||||
ClientUnknown::INULL
|
||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL
|
||||
),
|
||||
|
||||
ClientUnknown::INULL,
|
||||
@ -200,7 +200,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
Client62::INULL, Client62::INULL, Client62::INULL,
|
||||
Client62::INULL, Client62::INULL, Client62::INULL,
|
||||
Client62::INULL, Client62::INULL, Client62::INULL,
|
||||
Client62::INULL
|
||||
Client62::INULL, Client62::INULL, Client62::INULL
|
||||
),
|
||||
|
||||
Client62::INULL,
|
||||
@ -227,7 +227,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::invtype::ALT_STORAGE_SIZE, Titanium::invtype::ARCHIVED_SIZE,
|
||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||
Titanium::invtype::OTHER_SIZE
|
||||
Titanium::INULL, Titanium::INULL, Titanium::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
Titanium::invslot::EQUIPMENT_BITMASK,
|
||||
@ -254,7 +254,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::invtype::ALT_STORAGE_SIZE, SoF::invtype::ARCHIVED_SIZE,
|
||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||
SoF::invtype::OTHER_SIZE
|
||||
SoF::INULL, SoF::INULL, SoF::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
SoF::invslot::EQUIPMENT_BITMASK,
|
||||
@ -281,7 +281,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::invtype::ALT_STORAGE_SIZE, SoD::invtype::ARCHIVED_SIZE,
|
||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||
SoD::invtype::OTHER_SIZE
|
||||
SoD::INULL, SoD::INULL, SoD::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
SoD::invslot::EQUIPMENT_BITMASK,
|
||||
@ -308,7 +308,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::invtype::ALT_STORAGE_SIZE, UF::invtype::ARCHIVED_SIZE,
|
||||
UF::INULL, UF::INULL, UF::INULL,
|
||||
UF::invtype::OTHER_SIZE
|
||||
UF::INULL, UF::INULL, UF::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
UF::invslot::EQUIPMENT_BITMASK,
|
||||
@ -335,7 +335,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::invtype::ALT_STORAGE_SIZE, RoF::invtype::ARCHIVED_SIZE,
|
||||
RoF::invtype::MAIL_SIZE, RoF::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF::INULL,
|
||||
RoF::invtype::OTHER_SIZE
|
||||
RoF::INULL,RoF::INULL,RoF::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
RoF::invslot::EQUIPMENT_BITMASK,
|
||||
@ -362,7 +362,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::invtype::ALT_STORAGE_SIZE, RoF2::invtype::ARCHIVED_SIZE,
|
||||
RoF2::invtype::MAIL_SIZE, RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF2::invtype::KRONO_SIZE,
|
||||
RoF2::invtype::OTHER_SIZE
|
||||
RoF2::invtype::GUILD_BANK_MAIN_SIZE,RoF2::invtype::GUILD_BANK_DEPOSIT_SIZE, RoF2::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
RoF2::invslot::EQUIPMENT_BITMASK,
|
||||
@ -389,7 +389,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
||||
EntityLimits::NPC::INULL
|
||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,EntityLimits::NPC::INULL
|
||||
),
|
||||
|
||||
EntityLimits::NPC::INULL,
|
||||
@ -416,7 +416,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
||||
EntityLimits::NPCMerchant::INULL
|
||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL
|
||||
),
|
||||
|
||||
EntityLimits::NPCMerchant::INULL,
|
||||
@ -443,7 +443,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
||||
EntityLimits::Merc::INULL
|
||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL
|
||||
),
|
||||
|
||||
EntityLimits::Merc::INULL,
|
||||
@ -470,7 +470,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||
EntityLimits::Bot::INULL
|
||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL
|
||||
),
|
||||
|
||||
EntityLimits::Bot::invslot::EQUIPMENT_BITMASK,
|
||||
@ -497,7 +497,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
||||
EntityLimits::ClientPet::INULL
|
||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL
|
||||
),
|
||||
|
||||
EntityLimits::ClientPet::INULL,
|
||||
@ -524,7 +524,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
||||
EntityLimits::NPCPet::INULL
|
||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL
|
||||
),
|
||||
|
||||
EntityLimits::NPCPet::INULL,
|
||||
@ -551,7 +551,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
||||
EntityLimits::MercPet::INULL
|
||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL
|
||||
),
|
||||
|
||||
EntityLimits::MercPet::INULL,
|
||||
@ -578,7 +578,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
||||
EntityLimits::BotPet::INULL
|
||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL
|
||||
),
|
||||
|
||||
EntityLimits::BotPet::INULL,
|
||||
@ -605,7 +605,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::INULL, Titanium::INULL,
|
||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||
Titanium::INULL
|
||||
Titanium::INULL, Titanium::INULL, Titanium::INULL
|
||||
),
|
||||
|
||||
Titanium::INULL,
|
||||
@ -632,7 +632,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::INULL, SoF::INULL,
|
||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||
SoF::INULL
|
||||
SoF::INULL, SoF::INULL, SoF::INULL
|
||||
),
|
||||
|
||||
SoF::INULL,
|
||||
@ -659,7 +659,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::INULL, SoD::INULL,
|
||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||
SoD::INULL
|
||||
SoD::INULL, SoD::INULL, SoD::INULL
|
||||
),
|
||||
|
||||
SoD::INULL,
|
||||
@ -686,7 +686,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::INULL, UF::INULL,
|
||||
UF::INULL, UF::INULL, UF::INULL,
|
||||
UF::INULL
|
||||
UF::INULL, UF::INULL, UF::INULL
|
||||
),
|
||||
|
||||
UF::INULL,
|
||||
@ -713,7 +713,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::INULL, RoF::INULL,
|
||||
RoF::INULL, RoF::INULL, RoF::INULL,
|
||||
RoF::INULL
|
||||
RoF::INULL, RoF::INULL, RoF::INULL
|
||||
),
|
||||
|
||||
RoF::INULL,
|
||||
@ -740,7 +740,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
||||
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::INULL, RoF2::INULL,
|
||||
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
||||
RoF2::INULL
|
||||
RoF2::INULL, RoF2::INULL, RoF2::INULL
|
||||
),
|
||||
|
||||
RoF2::INULL,
|
||||
|
||||
@ -87,7 +87,7 @@ namespace EQ
|
||||
int16 ViewMODPC, ViewMODBank, ViewMODSharedBank;
|
||||
int16 ViewMODLimbo, AltStorage, Archived;
|
||||
int16 Mail, GuildTrophyTribute, Krono;
|
||||
int16 Other;
|
||||
int16 GuildBankMain,GuildBankDeposit, Other;
|
||||
|
||||
InventoryTypeSize_Struct(
|
||||
int16 Possessions, int16 Bank, int16 SharedBank,
|
||||
@ -98,7 +98,7 @@ namespace EQ
|
||||
int16 ViewMODPC, int16 ViewMODBank, int16 ViewMODSharedBank,
|
||||
int16 ViewMODLimbo, int16 AltStorage, int16 Archived,
|
||||
int16 Mail, int16 GuildTrophyTribute, int16 Krono,
|
||||
int16 Other
|
||||
int16 GuildBankMain,int16 GuildBankDeposit, int16 Other
|
||||
) :
|
||||
Possessions(Possessions), Bank(Bank), SharedBank(SharedBank),
|
||||
Trade(Trade), World(World), Limbo(Limbo),
|
||||
@ -108,7 +108,7 @@ namespace EQ
|
||||
ViewMODPC(ViewMODPC), ViewMODBank(ViewMODBank), ViewMODSharedBank(ViewMODSharedBank),
|
||||
ViewMODLimbo(ViewMODLimbo), AltStorage(AltStorage), Archived(Archived),
|
||||
Mail(Mail), GuildTrophyTribute(GuildTrophyTribute), Krono(Krono),
|
||||
Other(Other)
|
||||
GuildBankMain(GuildBankMain), GuildBankDeposit(GuildBankDeposit), Other(Other)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@ -19,17 +19,17 @@
|
||||
#ifndef EQ_PACKET_STRUCTS_H
|
||||
#define EQ_PACKET_STRUCTS_H
|
||||
|
||||
#include "types.h"
|
||||
#include <list>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <time.h>
|
||||
#include "../common/version.h"
|
||||
#include "emu_constants.h"
|
||||
#include "textures.h"
|
||||
#include "../cereal/include/cereal/archives/binary.hpp"
|
||||
#include "../cereal/include/cereal/types/string.hpp"
|
||||
#include "../cereal/include/cereal/types/vector.hpp"
|
||||
#include "../common/version.h"
|
||||
#include "emu_constants.h"
|
||||
#include "textures.h"
|
||||
#include "types.h"
|
||||
|
||||
static const uint32 BUFF_COUNT = 42;
|
||||
static const uint32 PET_BUFF_COUNT = 30;
|
||||
@ -5529,56 +5529,65 @@ struct GuildBankWithdrawItem_Struct
|
||||
|
||||
struct GuildBankItemUpdate_Struct
|
||||
{
|
||||
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||
void Init(
|
||||
uint32 inAction,
|
||||
uint32 inUnknown004,
|
||||
uint16 inSlotID,
|
||||
uint16 inArea,
|
||||
uint16 inUnknown012,
|
||||
uint32 inItemID,
|
||||
uint32 inIcon,
|
||||
uint32 inQuantity,
|
||||
uint32 inPermissions,
|
||||
uint32 inAllowMerge,
|
||||
bool inUseable)
|
||||
{
|
||||
Action = inAction;
|
||||
Unknown004 = inUnknown004;
|
||||
SlotID = inSlotID;
|
||||
Area = inArea;
|
||||
Unknown012 = inUnknown012;
|
||||
ItemID = inItemID;
|
||||
Icon = inIcon;
|
||||
Quantity = inQuantity;
|
||||
Permissions = inPermissions;
|
||||
AllowMerge = inAllowMerge;
|
||||
Useable = inUseable;
|
||||
ItemName[0] = '\0';
|
||||
Donator[0] = '\0';
|
||||
WhoFor[0] = '\0';
|
||||
action = inAction;
|
||||
unknown004 = inUnknown004;
|
||||
slot_id = inSlotID;
|
||||
area = inArea;
|
||||
display = inUnknown012;
|
||||
item_id = inItemID;
|
||||
icon_id = inIcon;
|
||||
quantity = inQuantity;
|
||||
permissions = inPermissions;
|
||||
allow_merge = inAllowMerge;
|
||||
is_useable = inUseable;
|
||||
item_name[0] = '\0';
|
||||
donator[0] = '\0';
|
||||
who_for[0] = '\0';
|
||||
};
|
||||
|
||||
/*000*/ uint32 Action;
|
||||
/*004*/ uint32 Unknown004;
|
||||
/*008*/ uint16 SlotID;
|
||||
/*010*/ uint16 Area;
|
||||
/*012*/ uint32 Unknown012;
|
||||
/*016*/ uint32 ItemID;
|
||||
/*020*/ uint32 Icon;
|
||||
/*024*/ uint32 Quantity;
|
||||
/*028*/ uint32 Permissions;
|
||||
/*032*/ uint8 AllowMerge;
|
||||
/*033*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*034*/ char ItemName[64];
|
||||
/*098*/ char Donator[64];
|
||||
/*162*/ char WhoFor[64];
|
||||
/*226*/ uint16 Unknown226;
|
||||
/*000*/ uint32 action;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint16 slot_id;
|
||||
/*010*/ uint16 area;
|
||||
/*012*/ uint32 display;
|
||||
/*016*/ uint32 item_id;
|
||||
/*020*/ uint32 icon_id;
|
||||
/*024*/ uint32 quantity;
|
||||
/*028*/ uint32 permissions;
|
||||
/*032*/ uint8 allow_merge;
|
||||
/*033*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*034*/ char item_name[64];
|
||||
/*098*/ char donator[64];
|
||||
/*162*/ char who_for[64];
|
||||
/*226*/ uint16 unknown226;
|
||||
};
|
||||
|
||||
// newer clients (RoF+) send a list that contains 240 entries
|
||||
// The packets don't actually use all 64 chars in the strings, but we'll just overallocate for these
|
||||
struct GuildBankItemListEntry_Struct
|
||||
{
|
||||
uint8 vaild;
|
||||
struct GuildBankItemListEntry_Struct {
|
||||
uint8 vaild;
|
||||
uint32 permissions;
|
||||
char whofor[64];
|
||||
char donator[64];
|
||||
char whofor[64];
|
||||
char donator[64];
|
||||
uint32 item_id;
|
||||
uint32 item_icon;
|
||||
uint32 quantity;
|
||||
uint8 allow_merge; // 1 here for non-full stacks
|
||||
uint8 usable;
|
||||
char item_name[64];
|
||||
uint8 allow_merge; // 1 here for non-full stacks
|
||||
uint8 usable;
|
||||
char item_name[64];
|
||||
};
|
||||
|
||||
struct GuildBankClear_Struct
|
||||
|
||||
@ -65,6 +65,9 @@ namespace PlayerEvent {
|
||||
BARTER_TRANSACTION,
|
||||
SPEECH,
|
||||
EVOLVE_ITEM,
|
||||
GUILD_BANK_DEPOSIT,
|
||||
GUILD_BANK_WITHDRAWAL,
|
||||
GUILD_BANK_MOVE_TO_BANK_AREA,
|
||||
MAX // dont remove
|
||||
};
|
||||
|
||||
@ -130,6 +133,10 @@ namespace PlayerEvent {
|
||||
"Barter Transaction",
|
||||
"Player Speech",
|
||||
"Evolve Item Update"
|
||||
"Barter Transaction",
|
||||
"Guild Bank Item Deposit",
|
||||
"Guild Bank Item Withdrawal",
|
||||
"Guild Bank Move From Deposit Area to Bank Area"
|
||||
};
|
||||
|
||||
// Generic struct used by all events
|
||||
@ -1274,6 +1281,38 @@ namespace PlayerEvent {
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
struct GuildBankTransaction {
|
||||
uint32 char_id;
|
||||
uint32 guild_id;
|
||||
uint32 item_id;
|
||||
uint32 aug_slot_one;
|
||||
uint32 aug_slot_two;
|
||||
uint32 aug_slot_three;
|
||||
uint32 aug_slot_four;
|
||||
uint32 aug_slot_five;
|
||||
uint32 aug_slot_six;
|
||||
uint32 quantity;
|
||||
uint32 permission;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(char_id),
|
||||
CEREAL_NVP(guild_id),
|
||||
CEREAL_NVP(item_id),
|
||||
CEREAL_NVP(aug_slot_one),
|
||||
CEREAL_NVP(aug_slot_two),
|
||||
CEREAL_NVP(aug_slot_three),
|
||||
CEREAL_NVP(aug_slot_four),
|
||||
CEREAL_NVP(aug_slot_five),
|
||||
CEREAL_NVP(aug_slot_six),
|
||||
CEREAL_NVP(quantity)
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //EQEMU_PLAYER_EVENTS_H
|
||||
|
||||
@ -547,60 +547,62 @@ uint32 BaseGuildManager::UpdateDbCreateGuild(std::string name, uint32 leader)
|
||||
|
||||
bool BaseGuildManager::UpdateDbDeleteGuild(uint32 guild_id, bool local_delete, bool db_delete)
|
||||
{
|
||||
auto const where_filter = fmt::format("guild_id = {}", guild_id);
|
||||
auto const bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
||||
|
||||
if (local_delete) {
|
||||
auto where_filter = fmt::format("guildid = {}", guild_id);
|
||||
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
||||
if (!bank_items.empty()) {
|
||||
LogError(
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||
"again.",
|
||||
guild_id,
|
||||
bank_items.size()
|
||||
);
|
||||
LogGuilds(
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||
"again.",
|
||||
guild_id,
|
||||
bank_items.size()
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
std::map<uint32, GuildInfo *>::iterator res;
|
||||
res = m_guilds.find(guild_id);
|
||||
if (res != m_guilds.end()) {
|
||||
delete res->second;
|
||||
m_guilds.erase(res);
|
||||
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
||||
//Does this need to be sent to world?
|
||||
}
|
||||
|
||||
auto res = m_guilds.find(guild_id);
|
||||
if (res != m_guilds.end()) {
|
||||
safe_delete(res->second);
|
||||
m_guilds.erase(res);
|
||||
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
||||
// Does this need to be sent to world?
|
||||
}
|
||||
}
|
||||
|
||||
if (db_delete) {
|
||||
auto where_filter = fmt::format("guildid = {}", guild_id);
|
||||
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
||||
if (!bank_items.empty()) {
|
||||
LogError(
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||
"again.",
|
||||
guild_id,
|
||||
bank_items.size()
|
||||
);
|
||||
LogGuilds(
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||
"again.",
|
||||
guild_id,
|
||||
bank_items.size()
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
auto where_filter = fmt::format("guild_id = {}", guild_id);
|
||||
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
||||
GuildsRepository::DeleteOne(*m_db, guild_id);
|
||||
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
||||
GuildPermissionsRepository::DeleteWhere(*m_db, where_filter);
|
||||
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
||||
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
||||
}
|
||||
|
||||
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
||||
GuildsRepository::DeleteOne(*m_db, guild_id);
|
||||
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
||||
GuildPermissionsRepository::DeleteWhere(*m_db, where_filter);
|
||||
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
||||
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1213,22 +1213,22 @@ namespace RoF
|
||||
case 1: { // GuildBankItemUpdate
|
||||
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
||||
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
||||
eq->Action = 0;
|
||||
OUT(Unknown004);
|
||||
eq->Unknown08 = 0;
|
||||
OUT(SlotID);
|
||||
OUT(Area);
|
||||
OUT(Unknown012);
|
||||
OUT(ItemID);
|
||||
OUT(Icon);
|
||||
OUT(Quantity);
|
||||
OUT(Permissions);
|
||||
OUT(AllowMerge);
|
||||
OUT(Useable);
|
||||
OUT_str(ItemName);
|
||||
OUT_str(Donator);
|
||||
OUT_str(WhoFor);
|
||||
OUT(Unknown226);
|
||||
eq->action = 0;
|
||||
OUT(unknown004);
|
||||
eq->unknown008 = 0;
|
||||
OUT(slot_id);
|
||||
OUT(area);
|
||||
OUT(display);
|
||||
OUT(item_id);
|
||||
OUT(icon_id);
|
||||
OUT(quantity);
|
||||
OUT(permissions);
|
||||
OUT(allow_merge);
|
||||
OUT(is_useable);
|
||||
OUT_str(item_name);
|
||||
OUT_str(donator);
|
||||
OUT_str(who_for);
|
||||
OUT(unknown226);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@ -1743,22 +1743,19 @@ namespace RoF2
|
||||
case 1: { // GuildBankItemUpdate
|
||||
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
||||
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
||||
eq->Action = 0;
|
||||
OUT(Unknown004);
|
||||
eq->Unknown08 = 0;
|
||||
OUT(SlotID);
|
||||
OUT(Area);
|
||||
OUT(Unknown012);
|
||||
OUT(ItemID);
|
||||
OUT(Icon);
|
||||
OUT(Quantity);
|
||||
OUT(Permissions);
|
||||
OUT(AllowMerge);
|
||||
OUT(Useable);
|
||||
OUT_str(ItemName);
|
||||
OUT_str(Donator);
|
||||
OUT_str(WhoFor);
|
||||
OUT(Unknown226);
|
||||
eq->action = 0;
|
||||
OUT(display);
|
||||
OUT(slot_id);
|
||||
OUT(area);
|
||||
OUT(item_id);
|
||||
OUT(icon_id);
|
||||
OUT(quantity);
|
||||
OUT(permissions);
|
||||
OUT(allow_merge);
|
||||
OUT(is_useable);
|
||||
OUT_str(item_name);
|
||||
OUT_str(donator);
|
||||
OUT_str(who_for);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@ -101,6 +101,8 @@ namespace RoF2
|
||||
const int16 MAIL_SIZE = 0;//unknown
|
||||
const int16 GUILD_TROPHY_TRIBUTE_SIZE = 0;//unknown
|
||||
const int16 KRONO_SIZE = 0;//unknown
|
||||
const int16 GUILD_BANK_MAIN_SIZE = 200;
|
||||
const int16 GUILD_BANK_DEPOSIT_SIZE = 40;
|
||||
const int16 OTHER_SIZE = 0;//unknown
|
||||
|
||||
const int16 TRADE_NPC_SIZE = 4; // defined by implication
|
||||
|
||||
@ -1965,41 +1965,39 @@ struct GuildBankWithdrawItem_Struct
|
||||
|
||||
struct GuildBankItemUpdate_Struct
|
||||
{
|
||||
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown016, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||
{
|
||||
Action = inAction;
|
||||
Unknown004 = inUnknown004;
|
||||
SlotID = inSlotID;
|
||||
Area = inArea;
|
||||
Unknown012 = inUnknown012;
|
||||
ItemID = inItemID;
|
||||
Icon = inIcon;
|
||||
Quantity = inQuantity;
|
||||
Permissions = inPermissions;
|
||||
AllowMerge = inAllowMerge;
|
||||
Useable = inUseable;
|
||||
ItemName[0] = '\0';
|
||||
Donator[0] = '\0';
|
||||
WhoFor[0] = '\0';
|
||||
action = inAction;
|
||||
slot_id = inSlotID;
|
||||
area = inArea;
|
||||
display = inUnknown016;
|
||||
item_id = inItemID;
|
||||
icon_id = inIcon;
|
||||
quantity = inQuantity;
|
||||
permissions = inPermissions;
|
||||
allow_merge = inAllowMerge;
|
||||
is_useable = inUseable;
|
||||
item_name[0] = '\0';
|
||||
donator[0] = '\0';
|
||||
who_for[0] = '\0';
|
||||
};
|
||||
|
||||
/*000*/ uint32 Action;
|
||||
/*004*/ uint32 Unknown004;
|
||||
/*008*/ uint32 Unknown08;
|
||||
/*012*/ uint16 SlotID;
|
||||
/*014*/ uint16 Area;
|
||||
/*016*/ uint32 Unknown012;
|
||||
/*020*/ uint32 ItemID;
|
||||
/*024*/ uint32 Icon;
|
||||
/*028*/ uint32 Quantity;
|
||||
/*032*/ uint32 Permissions;
|
||||
/*036*/ uint8 AllowMerge;
|
||||
/*037*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*038*/ char ItemName[64];
|
||||
/*102*/ char Donator[64];
|
||||
/*166*/ char WhoFor[64];
|
||||
/*230*/ uint16 Unknown226;
|
||||
/*000*/ uint32 action;
|
||||
/*004*/ uint32 not_used004; //disassemble of client did not use this
|
||||
/*008*/ uint32 not_used008; //disassemble of client did not use this
|
||||
/*012*/ uint16 slot_id;
|
||||
/*014*/ uint16 area;
|
||||
/*016*/ uint32 display;
|
||||
/*020*/ uint32 item_id;
|
||||
/*024*/ uint32 icon_id;
|
||||
/*028*/ uint32 quantity;
|
||||
/*032*/ uint32 permissions;
|
||||
/*036*/ uint8 allow_merge;
|
||||
/*037*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*038*/ char item_name[64];
|
||||
/*102*/ char donator[64];
|
||||
/*166*/ char who_for[64];
|
||||
};
|
||||
|
||||
struct GuildBankClear_Struct
|
||||
|
||||
@ -1946,38 +1946,38 @@ struct GuildBankItemUpdate_Struct
|
||||
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||
{
|
||||
Action = inAction;
|
||||
Unknown004 = inUnknown004;
|
||||
SlotID = inSlotID;
|
||||
Area = inArea;
|
||||
Unknown012 = inUnknown012;
|
||||
ItemID = inItemID;
|
||||
Icon = inIcon;
|
||||
Quantity = inQuantity;
|
||||
Permissions = inPermissions;
|
||||
AllowMerge = inAllowMerge;
|
||||
Useable = inUseable;
|
||||
ItemName[0] = '\0';
|
||||
Donator[0] = '\0';
|
||||
WhoFor[0] = '\0';
|
||||
action = inAction;
|
||||
unknown004 = inUnknown004;
|
||||
slot_id = inSlotID;
|
||||
area = inArea;
|
||||
display = inUnknown012;
|
||||
item_id = inItemID;
|
||||
icon_id = inIcon;
|
||||
quantity = inQuantity;
|
||||
permissions = inPermissions;
|
||||
allow_merge = inAllowMerge;
|
||||
is_useable = inUseable;
|
||||
item_name[0] = '\0';
|
||||
donator[0] = '\0';
|
||||
who_for[0] = '\0';
|
||||
};
|
||||
|
||||
/*000*/ uint32 Action;
|
||||
/*004*/ uint32 Unknown004;
|
||||
/*008*/ uint32 Unknown08;
|
||||
/*012*/ uint16 SlotID;
|
||||
/*014*/ uint16 Area;
|
||||
/*016*/ uint32 Unknown012;
|
||||
/*020*/ uint32 ItemID;
|
||||
/*024*/ uint32 Icon;
|
||||
/*028*/ uint32 Quantity;
|
||||
/*032*/ uint32 Permissions;
|
||||
/*036*/ uint8 AllowMerge;
|
||||
/*037*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*038*/ char ItemName[64];
|
||||
/*102*/ char Donator[64];
|
||||
/*166*/ char WhoFor[64];
|
||||
/*230*/ uint16 Unknown226;
|
||||
/*000*/ uint32 action;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/ uint16 slot_id;
|
||||
/*014*/ uint16 area;
|
||||
/*016*/ uint32 display;
|
||||
/*020*/ uint32 item_id;
|
||||
/*024*/ uint32 icon_id;
|
||||
/*028*/ uint32 quantity;
|
||||
/*032*/ uint32 permissions;
|
||||
/*036*/ uint8 allow_merge;
|
||||
/*037*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*038*/ char item_name[64];
|
||||
/*102*/ char donator[64];
|
||||
/*166*/ char who_for[64];
|
||||
/*230*/ uint16 unknown226;
|
||||
};
|
||||
|
||||
struct GuildBankClear_Struct
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
||||
@ -16,19 +16,24 @@
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseGuildBankRepository {
|
||||
public:
|
||||
struct GuildBank {
|
||||
uint32_t id;
|
||||
uint32_t guildid;
|
||||
uint32_t guild_id;
|
||||
uint8_t area;
|
||||
uint32_t slot;
|
||||
uint32_t itemid;
|
||||
uint32_t qty;
|
||||
uint32_t item_id;
|
||||
uint32_t augment_one_id;
|
||||
uint32_t augment_two_id;
|
||||
uint32_t augment_three_id;
|
||||
uint32_t augment_four_id;
|
||||
uint32_t augment_five_id;
|
||||
uint32_t augment_six_id;
|
||||
int32_t quantity;
|
||||
std::string donator;
|
||||
uint8_t permissions;
|
||||
std::string whofor;
|
||||
std::string who_for;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@ -40,14 +45,20 @@ public:
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"guildid",
|
||||
"guild_id",
|
||||
"area",
|
||||
"slot",
|
||||
"itemid",
|
||||
"qty",
|
||||
"item_id",
|
||||
"augment_one_id",
|
||||
"augment_two_id",
|
||||
"augment_three_id",
|
||||
"augment_four_id",
|
||||
"augment_five_id",
|
||||
"augment_six_id",
|
||||
"quantity",
|
||||
"donator",
|
||||
"permissions",
|
||||
"whofor",
|
||||
"who_for",
|
||||
};
|
||||
}
|
||||
|
||||
@ -55,14 +66,20 @@ public:
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"guildid",
|
||||
"guild_id",
|
||||
"area",
|
||||
"slot",
|
||||
"itemid",
|
||||
"qty",
|
||||
"item_id",
|
||||
"augment_one_id",
|
||||
"augment_two_id",
|
||||
"augment_three_id",
|
||||
"augment_four_id",
|
||||
"augment_five_id",
|
||||
"augment_six_id",
|
||||
"quantity",
|
||||
"donator",
|
||||
"permissions",
|
||||
"whofor",
|
||||
"who_for",
|
||||
};
|
||||
}
|
||||
|
||||
@ -103,15 +120,21 @@ public:
|
||||
{
|
||||
GuildBank e{};
|
||||
|
||||
e.id = 0;
|
||||
e.guildid = 0;
|
||||
e.area = 0;
|
||||
e.slot = 0;
|
||||
e.itemid = 0;
|
||||
e.qty = 0;
|
||||
e.donator = "";
|
||||
e.permissions = 0;
|
||||
e.whofor = "";
|
||||
e.id = 0;
|
||||
e.guild_id = 0;
|
||||
e.area = 0;
|
||||
e.slot = 0;
|
||||
e.item_id = 0;
|
||||
e.augment_one_id = 0;
|
||||
e.augment_two_id = 0;
|
||||
e.augment_three_id = 0;
|
||||
e.augment_four_id = 0;
|
||||
e.augment_five_id = 0;
|
||||
e.augment_six_id = 0;
|
||||
e.quantity = 0;
|
||||
e.donator = "";
|
||||
e.permissions = 0;
|
||||
e.who_for = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -148,15 +171,21 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
GuildBank e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.donator = row[6] ? row[6] : "";
|
||||
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.whofor = row[8] ? row[8] : "";
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_four_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.augment_five_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.augment_six_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.quantity = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
||||
e.donator = row[12] ? row[12] : "";
|
||||
e.permissions = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.who_for = row[14] ? row[14] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -190,14 +219,20 @@ public:
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.guildid));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.guild_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.area));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.slot));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.itemid));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.qty));
|
||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.donator) + "'");
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.permissions));
|
||||
v.push_back(columns[8] + " = '" + Strings::Escape(e.whofor) + "'");
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.item_id));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.augment_one_id));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.augment_two_id));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.augment_three_id));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.augment_four_id));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.augment_five_id));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.augment_six_id));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.quantity));
|
||||
v.push_back(columns[12] + " = '" + Strings::Escape(e.donator) + "'");
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.permissions));
|
||||
v.push_back(columns[14] + " = '" + Strings::Escape(e.who_for) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -220,14 +255,20 @@ public:
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.guildid));
|
||||
v.push_back(std::to_string(e.guild_id));
|
||||
v.push_back(std::to_string(e.area));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.itemid));
|
||||
v.push_back(std::to_string(e.qty));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.augment_one_id));
|
||||
v.push_back(std::to_string(e.augment_two_id));
|
||||
v.push_back(std::to_string(e.augment_three_id));
|
||||
v.push_back(std::to_string(e.augment_four_id));
|
||||
v.push_back(std::to_string(e.augment_five_id));
|
||||
v.push_back(std::to_string(e.augment_six_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
||||
v.push_back(std::to_string(e.permissions));
|
||||
v.push_back("'" + Strings::Escape(e.whofor) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -258,14 +299,20 @@ public:
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.guildid));
|
||||
v.push_back(std::to_string(e.guild_id));
|
||||
v.push_back(std::to_string(e.area));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.itemid));
|
||||
v.push_back(std::to_string(e.qty));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.augment_one_id));
|
||||
v.push_back(std::to_string(e.augment_two_id));
|
||||
v.push_back(std::to_string(e.augment_three_id));
|
||||
v.push_back(std::to_string(e.augment_four_id));
|
||||
v.push_back(std::to_string(e.augment_five_id));
|
||||
v.push_back(std::to_string(e.augment_six_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
||||
v.push_back(std::to_string(e.permissions));
|
||||
v.push_back("'" + Strings::Escape(e.whofor) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@ -299,15 +346,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
GuildBank e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.donator = row[6] ? row[6] : "";
|
||||
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.whofor = row[8] ? row[8] : "";
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_four_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.augment_five_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.augment_six_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.quantity = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
||||
e.donator = row[12] ? row[12] : "";
|
||||
e.permissions = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.who_for = row[14] ? row[14] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -332,15 +385,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
GuildBank e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.donator = row[6] ? row[6] : "";
|
||||
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.whofor = row[8] ? row[8] : "";
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_four_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.augment_five_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.augment_six_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.quantity = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
||||
e.donator = row[12] ? row[12] : "";
|
||||
e.permissions = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.who_for = row[14] ? row[14] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -399,6 +458,90 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const GuildBank &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.guild_id));
|
||||
v.push_back(std::to_string(e.area));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.augment_one_id));
|
||||
v.push_back(std::to_string(e.augment_two_id));
|
||||
v.push_back(std::to_string(e.augment_three_id));
|
||||
v.push_back(std::to_string(e.augment_four_id));
|
||||
v.push_back(std::to_string(e.augment_five_id));
|
||||
v.push_back(std::to_string(e.augment_six_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
||||
v.push_back(std::to_string(e.permissions));
|
||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int ReplaceMany(
|
||||
Database& db,
|
||||
const std::vector<GuildBank> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.guild_id));
|
||||
v.push_back(std::to_string(e.area));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.augment_one_id));
|
||||
v.push_back(std::to_string(e.augment_two_id));
|
||||
v.push_back(std::to_string(e.augment_three_id));
|
||||
v.push_back(std::to_string(e.augment_four_id));
|
||||
v.push_back(std::to_string(e.augment_five_id));
|
||||
v.push_back(std::to_string(e.augment_six_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
||||
v.push_back(std::to_string(e.permissions));
|
||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9303
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9304
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
|
||||
|
||||
#endif
|
||||
|
||||
@ -7585,292 +7585,298 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app)
|
||||
|
||||
void Client::Handle_OP_GuildBank(const EQApplicationPacket *app)
|
||||
{
|
||||
if (!GuildBanks)
|
||||
if (!GuildBanks) {
|
||||
GuildBankAck();
|
||||
return;
|
||||
}
|
||||
|
||||
if (zone->GetZoneID() != Zones::GUILDHALL)
|
||||
{
|
||||
if (zone->GetZoneID() != Zones::GUILDHALL) {
|
||||
Message(Chat::Red, "The Guild Bank is not available in this zone.");
|
||||
|
||||
GuildBankAck();
|
||||
return;
|
||||
}
|
||||
|
||||
if (app->size < sizeof(uint32)) {
|
||||
LogError("Wrong size: OP_GuildBank, size=[{}], expected [{}]", app->size, sizeof(uint32));
|
||||
DumpPacket(app);
|
||||
GuildBankAck();
|
||||
return;
|
||||
}
|
||||
|
||||
char *Buffer = (char *)app->pBuffer;
|
||||
|
||||
uint32 Action = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
|
||||
char *Buffer = (char *) app->pBuffer;
|
||||
uint32 Action = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
|
||||
uint32 sentAction = Action;
|
||||
|
||||
if (!IsInAGuild())
|
||||
{
|
||||
if (!IsInAGuild()) {
|
||||
Message(Chat::Red, "You must be in a Guild to use the Guild Bank.");
|
||||
|
||||
if (Action == GuildBankDeposit)
|
||||
if (Action == GuildBankDeposit) {
|
||||
GuildBankDepositAck(true, sentAction);
|
||||
else
|
||||
}
|
||||
else {
|
||||
GuildBankAck();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsGuildBanker())
|
||||
{
|
||||
if ((Action != GuildBankDeposit) && (Action != GuildBankViewItem) && (Action != GuildBankWithdraw))
|
||||
if (Action != GuildBankDeposit && Action != GuildBankViewItem && Action != GuildBankWithdraw)
|
||||
{
|
||||
LogError("Suspected hacking attempt on guild bank from [{}]", GetName());
|
||||
|
||||
GuildBankAck();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (Action)
|
||||
{
|
||||
case GuildBankPromote:
|
||||
{
|
||||
if (GuildBanks->IsAreaFull(GuildID(), GuildBankMainArea))
|
||||
{
|
||||
MessageString(Chat::Red, GUILD_BANK_FULL);
|
||||
|
||||
GuildBankDepositAck(true, sentAction);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GuildBankPromote_Struct *gbps = (GuildBankPromote_Struct*)app->pBuffer;
|
||||
|
||||
int Slot = GuildBanks->Promote(GuildID(), gbps->Slot);
|
||||
|
||||
if (Slot >= 0)
|
||||
{
|
||||
EQ::ItemInstance* inst = GuildBanks->GetItem(GuildID(), GuildBankMainArea, Slot, 1);
|
||||
|
||||
if (inst)
|
||||
{
|
||||
MessageString(Chat::LightGray, GUILD_BANK_TRANSFERRED, inst->GetItem()->Name);
|
||||
safe_delete(inst);
|
||||
}
|
||||
}
|
||||
else
|
||||
Message(Chat::Red, "Unexpected error while moving item into Guild Bank.");
|
||||
|
||||
GuildBankAck();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GuildBankViewItem:
|
||||
{
|
||||
GuildBankViewItem_Struct *gbvis = (GuildBankViewItem_Struct*)app->pBuffer;
|
||||
|
||||
EQ::ItemInstance* inst = GuildBanks->GetItem(GuildID(), gbvis->Area, gbvis->SlotID, 1);
|
||||
|
||||
if (!inst)
|
||||
break;
|
||||
|
||||
SendItemPacket(0, inst, ItemPacketViewLink);
|
||||
|
||||
safe_delete(inst);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GuildBankDeposit: // Deposit Item
|
||||
{
|
||||
EQ::ItemInstance *CursorItemInst = GetInv().GetItem(EQ::invslot::slotCursor);
|
||||
|
||||
bool Allowed = true;
|
||||
|
||||
if (!CursorItemInst)
|
||||
{
|
||||
Message(Chat::Red, "No Item on the cursor.");
|
||||
|
||||
GuildBankDepositAck(true, sentAction);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const EQ::ItemData* CursorItem = CursorItemInst->GetItem();
|
||||
|
||||
if (GuildBanks->IsAreaFull(GuildID(), GuildBankDepositArea))
|
||||
{
|
||||
MessageString(Chat::Red, GUILD_BANK_FULL);
|
||||
GuildBankDepositAck(true, sentAction);
|
||||
if (ClientVersion() >= EQ::versions::ClientVersion::RoF) {
|
||||
GetInv().PopItem(EQ::invslot::slotCursor);
|
||||
PushItemOnCursor(CursorItem, true);
|
||||
switch (Action) {
|
||||
case GuildBankPromote: {
|
||||
if (GuildBanks->IsAreaFull(GuildID(), GuildBankMainArea)) {
|
||||
MessageString(Chat::Red, GUILD_BANK_FULL);
|
||||
GuildBankAck();
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
auto gbps = (GuildBankPromote_Struct *) app->pBuffer;
|
||||
int slot_id = GuildBanks->Promote(GuildID(), gbps->Slot, this);
|
||||
|
||||
if (!CursorItem->NoDrop || CursorItemInst->IsAttuned())
|
||||
{
|
||||
Allowed = false;
|
||||
}
|
||||
else if (CursorItemInst->IsNoneEmptyContainer())
|
||||
{
|
||||
Allowed = false;
|
||||
}
|
||||
else if (CursorItemInst->IsAugmented())
|
||||
{
|
||||
Allowed = false;
|
||||
}
|
||||
else if (CursorItem->NoRent == 0)
|
||||
{
|
||||
Allowed = false;
|
||||
}
|
||||
else if (CursorItem->LoreFlag && GuildBanks->HasItem(GuildID(), CursorItem->ID))
|
||||
{
|
||||
Allowed = false;
|
||||
}
|
||||
if (slot_id >= 0) {
|
||||
auto inst = GuildBanks->GetItem(GuildID(), GuildBankMainArea, slot_id, 1);
|
||||
if (inst) {
|
||||
if (player_event_logs.IsEventEnabled(PlayerEvent::GUILD_BANK_MOVE_TO_BANK_AREA)) {
|
||||
PlayerEvent::GuildBankTransaction log{};
|
||||
log.char_id = CharacterID();
|
||||
log.guild_id = GuildID();
|
||||
log.item_id = inst->GetID();
|
||||
log.quantity = inst->GetCharges();
|
||||
if (inst->IsAugmented()) {
|
||||
auto augs = inst->GetAugmentIDs();
|
||||
log.aug_slot_one = augs.at(0);
|
||||
log.aug_slot_two = augs.at(1);
|
||||
log.aug_slot_three = augs.at(2);
|
||||
log.aug_slot_four = augs.at(3);
|
||||
log.aug_slot_five = augs.at(4);
|
||||
log.aug_slot_six = augs.at(5);
|
||||
}
|
||||
|
||||
if (!Allowed)
|
||||
{
|
||||
MessageString(Chat::Red, GUILD_BANK_CANNOT_DEPOSIT);
|
||||
GuildBankDepositAck(true, sentAction);
|
||||
RecordPlayerEventLog(PlayerEvent::GUILD_BANK_MOVE_TO_BANK_AREA, log);
|
||||
}
|
||||
|
||||
if (ClientVersion() >= EQ::versions::ClientVersion::RoF) {
|
||||
GetInv().PopItem(EQ::invslot::slotCursor);
|
||||
PushItemOnCursor(CursorItem, true);
|
||||
MessageString(Chat::LightGray, GUILD_BANK_TRANSFERRED, inst->GetItem()->Name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Message(Chat::Red, "Unexpected error while moving item into Guild Bank.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (GuildBanks->AddItem(GuildID(), GuildBankDepositArea, CursorItem->ID, CursorItemInst->GetCharges(), GetName(), GuildBankBankerOnly, ""))
|
||||
{
|
||||
GuildBankDepositAck(false, sentAction);
|
||||
|
||||
DeleteItemInInventory(EQ::invslot::slotCursor, 0, false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GuildBankPermissions:
|
||||
{
|
||||
GuildBankPermissions_Struct *gbps = (GuildBankPermissions_Struct*)app->pBuffer;
|
||||
|
||||
if (gbps->Permissions == 1)
|
||||
GuildBanks->SetPermissions(GuildID(), gbps->SlotID, gbps->Permissions, gbps->MemberName);
|
||||
else
|
||||
GuildBanks->SetPermissions(GuildID(), gbps->SlotID, gbps->Permissions, "");
|
||||
|
||||
GuildBankAck();
|
||||
break;
|
||||
}
|
||||
|
||||
case GuildBankWithdraw:
|
||||
{
|
||||
if (GetInv()[EQ::invslot::slotCursor])
|
||||
{
|
||||
MessageString(Chat::Red, GUILD_BANK_EMPTY_HANDS);
|
||||
|
||||
GuildBankAck();
|
||||
break;
|
||||
}
|
||||
|
||||
case GuildBankViewItem: {
|
||||
auto gbvis = (GuildBankViewItem_Struct *) app->pBuffer;
|
||||
auto inst = GuildBanks->GetItem(GuildID(), gbvis->Area, gbvis->SlotID, 1);
|
||||
|
||||
if (!inst) {
|
||||
break;
|
||||
}
|
||||
|
||||
SendItemPacket(0, inst.get(), ItemPacketViewLink);
|
||||
break;
|
||||
}
|
||||
|
||||
case GuildBankDeposit: // Deposit Item
|
||||
{
|
||||
const auto cursor_item_inst = GetInv().GetItem(EQ::invslot::slotCursor);
|
||||
bool allowed = true;
|
||||
|
||||
if (!cursor_item_inst) {
|
||||
Message(Chat::Red, "No Item on the cursor.");
|
||||
GuildBankDepositAck(true, sentAction);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto cursor_item = cursor_item_inst->GetItem();
|
||||
if (GuildBanks->IsAreaFull(GuildID(), GuildBankDepositArea)) {
|
||||
MessageString(Chat::Red, GUILD_BANK_FULL);
|
||||
GuildBankDepositAck(true, sentAction);
|
||||
if (ClientVersion() >= EQ::versions::ClientVersion::RoF) {
|
||||
GetInv().PopItem(EQ::invslot::slotCursor);
|
||||
PushItemOnCursor(*cursor_item_inst, true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cursor_item->NoDrop ||
|
||||
cursor_item_inst->IsAttuned() ||
|
||||
cursor_item_inst->IsNoneEmptyContainer() ||
|
||||
cursor_item->NoRent == 0 ||
|
||||
(cursor_item->LoreFlag && GuildBanks->HasItem(GuildID(), cursor_item->ID))
|
||||
) {
|
||||
allowed = false;
|
||||
}
|
||||
|
||||
if (!allowed) {
|
||||
MessageString(Chat::Red, GUILD_BANK_CANNOT_DEPOSIT);
|
||||
GuildBankDepositAck(true, sentAction);
|
||||
|
||||
if (ClientVersion() >= EQ::versions::ClientVersion::RoF) {
|
||||
GetInv().PopItem(EQ::invslot::slotCursor);
|
||||
PushItemOnCursor(*cursor_item_inst, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto item = GuildBankRepository::NewEntity();
|
||||
item.guild_id = GuildID();
|
||||
item.area = GuildBankDepositArea;
|
||||
item.item_id = cursor_item->ID;
|
||||
item.quantity = cursor_item_inst->GetCharges();
|
||||
item.donator = GetCleanName();
|
||||
item.permissions = GuildBankBankerOnly;
|
||||
if (cursor_item_inst->IsAugmented()) {
|
||||
auto const augs = cursor_item_inst->GetAugmentIDs();
|
||||
item.augment_one_id = augs.at(0);
|
||||
item.augment_two_id = augs.at(1);
|
||||
item.augment_three_id = augs.at(2);
|
||||
item.augment_four_id = augs.at(3);
|
||||
item.augment_five_id = augs.at(4);
|
||||
item.augment_six_id = augs.at(5);
|
||||
}
|
||||
|
||||
if (GuildBanks->AddItem(item, this)) {
|
||||
GuildBankDepositAck(false, sentAction);
|
||||
DeleteItemInInventory(EQ::invslot::slotCursor, 0, false);
|
||||
|
||||
if (player_event_logs.IsEventEnabled(PlayerEvent::GUILD_BANK_DEPOSIT)) {
|
||||
PlayerEvent::GuildBankTransaction log{};
|
||||
log.char_id = CharacterID();
|
||||
log.guild_id = GuildID();
|
||||
log.item_id = item.item_id;
|
||||
log.quantity = item.quantity;
|
||||
log.aug_slot_one = item.augment_one_id;
|
||||
log.aug_slot_two = item.augment_two_id;
|
||||
log.aug_slot_three = item.augment_three_id;
|
||||
log.aug_slot_four = item.augment_four_id;
|
||||
log.aug_slot_five = item.augment_five_id;
|
||||
log.aug_slot_six = item.augment_six_id;
|
||||
|
||||
RecordPlayerEventLog(PlayerEvent::GUILD_BANK_DEPOSIT, log);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
GuildBankWithdrawItem_Struct *gbwis = (GuildBankWithdrawItem_Struct*)app->pBuffer;
|
||||
case GuildBankPermissions: {
|
||||
auto gbps = (GuildBankPermissions_Struct *) app->pBuffer;
|
||||
|
||||
EQ::ItemInstance* inst = GuildBanks->GetItem(GuildID(), gbwis->Area, gbwis->SlotID, gbwis->Quantity);
|
||||
if (gbps->Permissions == 1) {
|
||||
GuildBanks->SetPermissions(GuildID(), gbps->SlotID, gbps->Permissions, gbps->MemberName, this);
|
||||
}
|
||||
else {
|
||||
GuildBanks->SetPermissions(GuildID(), gbps->SlotID, gbps->Permissions, "", this);
|
||||
}
|
||||
|
||||
if (!inst)
|
||||
{
|
||||
GuildBankAck();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!guild_mgr.CheckPermission(GuildID(), GuildRank(), GUILD_ACTION_BANK_WITHDRAW_ITEMS))
|
||||
{
|
||||
Message(Chat::Red, "You do not have permission to withdraw.");
|
||||
case GuildBankWithdraw: {
|
||||
if (GetInv()[EQ::invslot::slotCursor]) {
|
||||
MessageString(Chat::Red, GUILD_BANK_EMPTY_HANDS);
|
||||
GuildBankAck();
|
||||
break;
|
||||
}
|
||||
|
||||
auto gbwis = (GuildBankWithdrawItem_Struct *) app->pBuffer;
|
||||
auto inst = GuildBanks->GetItem(GuildID(), gbwis->Area, gbwis->SlotID, gbwis->Quantity);
|
||||
|
||||
if (!inst) {
|
||||
GuildBankAck();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!guild_mgr.CheckPermission(GuildID(), GuildRank(), GUILD_ACTION_BANK_WITHDRAW_ITEMS)) {
|
||||
Message(Chat::Red, "You do not have permission to withdraw.");
|
||||
GuildBankAck();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!IsGuildBanker()) {
|
||||
LogError("Suspected attempted hack on the guild bank from [{}]", GetName());
|
||||
GuildBankAck();
|
||||
break;
|
||||
}
|
||||
|
||||
if (CheckLoreConflict(inst->GetItem())) {
|
||||
MessageString(Chat::Red, DUP_LORE);
|
||||
GuildBankAck();
|
||||
break;
|
||||
}
|
||||
|
||||
if (inst->GetCharges() > 0) {
|
||||
gbwis->Quantity = inst->GetCharges();
|
||||
}
|
||||
|
||||
if (inst->GetCharges() < 0) {
|
||||
gbwis->Quantity = 1;
|
||||
}
|
||||
|
||||
PushItemOnCursor(*inst.get());
|
||||
SendItemPacket(EQ::invslot::slotCursor, inst.get(), ItemPacketLimbo);
|
||||
GuildBanks->DeleteItem(GuildID(), gbwis->Area, gbwis->SlotID, gbwis->Quantity, this);
|
||||
|
||||
if (player_event_logs.IsEventEnabled(PlayerEvent::GUILD_BANK_WITHDRAWAL)) {
|
||||
PlayerEvent::GuildBankTransaction log{};
|
||||
log.char_id = CharacterID();
|
||||
log.guild_id = GuildID();
|
||||
log.item_id = inst->GetID();
|
||||
log.quantity = gbwis->Quantity;
|
||||
if (inst->IsAugmented()) {
|
||||
auto augs = inst->GetAugmentIDs();
|
||||
log.aug_slot_one = augs.at(0);
|
||||
log.aug_slot_two = augs.at(1);
|
||||
log.aug_slot_three = augs.at(2);
|
||||
log.aug_slot_four = augs.at(3);
|
||||
log.aug_slot_five = augs.at(4);
|
||||
log.aug_slot_six = augs.at(5);
|
||||
}
|
||||
|
||||
RecordPlayerEventLog(PlayerEvent::GUILD_BANK_WITHDRAWAL, log);
|
||||
}
|
||||
|
||||
else {
|
||||
Message(Chat::Red, "Unable to withdraw 0 quantity of %s", inst->GetItem()->Name);
|
||||
}
|
||||
|
||||
GuildBankAck();
|
||||
break;
|
||||
}
|
||||
case GuildBankSplitStacks: {
|
||||
if (GuildBanks->IsAreaFull(GuildID(), GuildBankMainArea)) {
|
||||
MessageString(Chat::Red, GUILD_BANK_FULL);
|
||||
}
|
||||
else {
|
||||
auto gbwis = (GuildBankWithdrawItem_Struct *) app->pBuffer;
|
||||
GuildBanks->SplitStack(GuildID(), gbwis->SlotID, gbwis->Quantity, this);
|
||||
}
|
||||
|
||||
GuildBankAck();
|
||||
break;
|
||||
}
|
||||
case GuildBankMergeStacks: {
|
||||
auto gbwis = (GuildBankWithdrawItem_Struct *) app->pBuffer;
|
||||
GuildBanks->MergeStacks(GuildID(), gbwis->SlotID, this);
|
||||
GuildBankAck();
|
||||
safe_delete(inst);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!IsGuildBanker() && !GuildBanks->AllowedToWithdraw(GuildID(), gbwis->Area, gbwis->SlotID, GetName()))
|
||||
{
|
||||
LogError("Suspected attempted hack on the guild bank from [{}]", GetName());
|
||||
|
||||
GuildBankAck();
|
||||
|
||||
safe_delete(inst);
|
||||
|
||||
break;
|
||||
default: {
|
||||
Message(Chat::Red, "Unexpected GuildBank action.");
|
||||
LogError("Received unexpected guild bank action code [{}] from [{}]", Action, GetName());
|
||||
}
|
||||
|
||||
if (CheckLoreConflict(inst->GetItem()))
|
||||
{
|
||||
MessageString(Chat::Red, DUP_LORE);
|
||||
|
||||
GuildBankAck();
|
||||
|
||||
safe_delete(inst);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (gbwis->Quantity > 0)
|
||||
{
|
||||
PushItemOnCursor(*inst);
|
||||
|
||||
SendItemPacket(EQ::invslot::slotCursor, inst, ItemPacketLimbo);
|
||||
|
||||
GuildBanks->DeleteItem(GuildID(), gbwis->Area, gbwis->SlotID, gbwis->Quantity);
|
||||
}
|
||||
else
|
||||
{
|
||||
Message(Chat::Red, "Unable to withdraw 0 quantity of %s", inst->GetItem()->Name);
|
||||
}
|
||||
|
||||
safe_delete(inst);
|
||||
|
||||
GuildBankAck();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GuildBankSplitStacks:
|
||||
{
|
||||
if (GuildBanks->IsAreaFull(GuildID(), GuildBankMainArea))
|
||||
MessageString(Chat::Red, GUILD_BANK_FULL);
|
||||
else
|
||||
{
|
||||
GuildBankWithdrawItem_Struct *gbwis = (GuildBankWithdrawItem_Struct*)app->pBuffer;
|
||||
|
||||
GuildBanks->SplitStack(GuildID(), gbwis->SlotID, gbwis->Quantity);
|
||||
}
|
||||
|
||||
GuildBankAck();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GuildBankMergeStacks:
|
||||
{
|
||||
GuildBankWithdrawItem_Struct *gbwis = (GuildBankWithdrawItem_Struct*)app->pBuffer;
|
||||
|
||||
GuildBanks->MergeStacks(GuildID(), gbwis->SlotID);
|
||||
|
||||
GuildBankAck();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
Message(Chat::Red, "Unexpected GuildBank action.");
|
||||
|
||||
LogError("Received unexpected guild bank action code [{}] from [{}]", Action, GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2332,30 +2332,18 @@ void EntityList::QueueClientsGuild(const EQApplicationPacket *app, uint32 guild_
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::QueueClientsGuildBankItemUpdate(const GuildBankItemUpdate_Struct *gbius, uint32 GuildID)
|
||||
void EntityList::QueueClientsGuildBankItemUpdate(GuildBankItemUpdate_Struct *gbius, uint32 guild_id)
|
||||
{
|
||||
auto outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct));
|
||||
auto data = reinterpret_cast<GuildBankItemUpdate_Struct *>(outapp->pBuffer);
|
||||
|
||||
GuildBankItemUpdate_Struct *outgbius = (GuildBankItemUpdate_Struct*)outapp->pBuffer;
|
||||
memcpy(data, gbius, sizeof(GuildBankItemUpdate_Struct));
|
||||
|
||||
memcpy(outgbius, gbius, sizeof(GuildBankItemUpdate_Struct));
|
||||
|
||||
const EQ::ItemData *Item = database.GetItem(gbius->ItemID);
|
||||
|
||||
auto it = client_list.begin();
|
||||
while (it != client_list.end()) {
|
||||
Client *client = it->second;
|
||||
|
||||
if (client->IsInGuild(GuildID)) {
|
||||
if (Item && (gbius->Permissions == GuildBankPublicIfUsable))
|
||||
outgbius->Useable = Item->IsEquipable(client->GetBaseRace(), client->GetBaseClass());
|
||||
|
||||
client->QueuePacket(outapp);
|
||||
for (auto const &[key, client]: client_list) {
|
||||
if (client->IsInGuild(guild_id)) {
|
||||
client->QueuePacket(outapp.get());
|
||||
}
|
||||
|
||||
++it;
|
||||
}
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void EntityList::MessageStatus(uint32 to_guild_id, int to_minstatus, uint32 type, const char *message, ...)
|
||||
|
||||
@ -429,7 +429,7 @@ public:
|
||||
void QueueClients(Mob* sender, const EQApplicationPacket* app, bool ignore_sender=false, bool ackreq = true);
|
||||
void QueueClientsStatus(Mob* sender, const EQApplicationPacket* app, bool ignore_sender = false, uint8 minstatus = AccountStatus::Player, uint8 maxstatus = AccountStatus::Player);
|
||||
void QueueClientsGuild(const EQApplicationPacket* app, uint32 guildeqid = 0);
|
||||
void QueueClientsGuildBankItemUpdate(const GuildBankItemUpdate_Struct *gbius, uint32 GuildID);
|
||||
void QueueClientsGuildBankItemUpdate(GuildBankItemUpdate_Struct *gbius, uint32 GuildID);
|
||||
void QueueClientsByTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender = true, Mob* SkipThisMob = 0, bool ackreq = true, bool HoTT = true, uint32 ClientVersionBits = 0xFFFFFFFF, bool inspect_buffs = false, bool clear_target_window = false);
|
||||
|
||||
void QueueClientsByXTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender = true, EQ::versions::ClientVersionBitmask client_version_bits = EQ::versions::ClientVersionBitmask::maskAllClients);
|
||||
|
||||
@ -603,35 +603,73 @@ void command_guild(Client* c, const Seperator* sep)
|
||||
auto guild_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto guild = guild_mgr.GetGuildByGuildID(guild_id);
|
||||
|
||||
PlayerEvent::LootItemEvent e{};
|
||||
e.charges = -1;
|
||||
e.corpse_name = "Test Corpse Name";
|
||||
e.item_id = 123456789;
|
||||
e.item_name = "Test Item Name";
|
||||
e.npc_id = 987654321;
|
||||
e.augment_1_id = 11;
|
||||
e.augment_2_id = 0;
|
||||
e.augment_3_id = 0;
|
||||
e.augment_4_id = 44;
|
||||
e.augment_5_id = 55;
|
||||
e.augment_6_id = 66;
|
||||
|
||||
RecordPlayerEventLogWithClient(c, PlayerEvent::LOOT_ITEM, e);
|
||||
|
||||
PlayerEvent::DestroyItemEvent e2{};
|
||||
e2.charges = -1;
|
||||
e2.attuned = true;
|
||||
e.augment_1_id = 11;
|
||||
e.augment_2_id = 0;
|
||||
e.augment_3_id = 0;
|
||||
e.augment_4_id = 44;
|
||||
e.augment_5_id = 55;
|
||||
e.augment_6_id = 66;
|
||||
e2.item_id = 123456789;
|
||||
e2.item_name = "Test Item Destroy Name";
|
||||
e2.reason = "Test Item Destroy Reason";
|
||||
|
||||
RecordPlayerEventLogWithClient(c, PlayerEvent::ITEM_DESTROY, e2);
|
||||
// PlayerEvent::LootItemEvent e{};
|
||||
// e.charges = -1;
|
||||
// e.corpse_name = "Test Corpse Name";
|
||||
// e.item_id = 123456789;
|
||||
// e.item_name = "Test Item Name";
|
||||
// e.npc_id = 987654321;
|
||||
// e.augment_1_id = 11;
|
||||
// e.augment_2_id = 0;
|
||||
// e.augment_3_id = 0;
|
||||
// e.augment_4_id = 44;
|
||||
// e.augment_5_id = 55;
|
||||
// e.augment_6_id = 66;
|
||||
//
|
||||
// RecordPlayerEventLogWithClient(c, PlayerEvent::LOOT_ITEM, e);
|
||||
//
|
||||
// PlayerEvent::DestroyItemEvent e2{};
|
||||
// e2.charges = -1;
|
||||
// e2.attuned = true;
|
||||
// e.augment_1_id = 11;
|
||||
// e.augment_2_id = 0;
|
||||
// e.augment_3_id = 0;
|
||||
// e.augment_4_id = 44;
|
||||
// e.augment_5_id = 55;
|
||||
// e.augment_6_id = 66;
|
||||
// e2.item_id = 123456789;
|
||||
// e2.item_name = "Test Item Destroy Name";
|
||||
// e2.reason = "Test Item Destroy Reason";
|
||||
//
|
||||
// RecordPlayerEventLogWithClient(c, PlayerEvent::ITEM_DESTROY, e2);
|
||||
// auto id = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
// //auto guild = guild_mgr.GetGuildByGuildID(guild_id);
|
||||
// // c->SendGuildMembersList();
|
||||
// auto bank = GuildBanks->GetGuildBank(guild_id);
|
||||
// if (id == 1) {
|
||||
// for (auto &[key, item]: bank->items.main_area) {
|
||||
// auto i = ItemsRepository::FindOne(content_db, item.item_id);
|
||||
// c->Message(Chat::Yellow, fmt::format("key:{:02} item:{:05} Name:{:40} Qty:{:40} Slot:{}",
|
||||
// key, item.item_id, i.Name, item.quantity, item.slot).c_str());
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// if (id == 2) {
|
||||
// for (auto &[key, item]: bank->items.deposit_area) {
|
||||
// auto i = ItemsRepository::FindOne(content_db, item.item_id);
|
||||
// c->Message(Chat::Yellow, fmt::format("key:{:02} item:{:05} Name:{} Qty:{:40} Slot:{}",
|
||||
// key, item.item_id, i.Name, item.quantity, item.slot).c_str());
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// if (id == 3) {
|
||||
// for (auto &[key, item]: bank->items.main_area) {
|
||||
// if (item.item_id == 30416) {
|
||||
// auto i = ItemsRepository::FindOne(content_db, item.item_id);
|
||||
// c->Message(Chat::Yellow, fmt::format("key:{:02} item:{:05} Name:{:40} Qty:{:40} Slot:{}",
|
||||
// key, item.item_id, i.Name, item.quantity, item.slot).c_str());
|
||||
// }
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// if (id == 4) {
|
||||
// c->Message(Chat::Yellow, "Guild Test 4");
|
||||
// auto inst = database.CreateItem(30416, 30);
|
||||
// database.UpdateInventorySlot(c->CharacterID(), inst, -1);
|
||||
// safe_delete(inst);
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1239
zone/guild_mgr.cpp
1239
zone/guild_mgr.cpp
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,12 @@
|
||||
#ifndef GUILD_MGR_H_
|
||||
#define GUILD_MGR_H_
|
||||
|
||||
#include "../common/types.h"
|
||||
#include "../common/guild_base.h"
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include "../common/guild_base.h"
|
||||
#include "../common/types.h"
|
||||
|
||||
#include "../common/repositories/guild_bank_repository.h"
|
||||
#include "../zone/petitions.h"
|
||||
|
||||
extern PetitionList petition_list;
|
||||
@ -14,38 +16,50 @@ extern PetitionList petition_list;
|
||||
#define PBUFFER 50
|
||||
#define MBUFFER 50
|
||||
|
||||
#define GUILD_BANK_MAIN_AREA_SIZE 200
|
||||
#define GUILD_BANK_DEPOSIT_AREA_SIZE 20
|
||||
class Client;
|
||||
class ServerPacket;
|
||||
|
||||
struct GuildBankItem
|
||||
{
|
||||
uint32 ItemID;
|
||||
uint32 Quantity;
|
||||
char Donator[64];
|
||||
uint8 Permissions;
|
||||
char WhoFor[64];
|
||||
};
|
||||
|
||||
struct GuildBankItems
|
||||
{
|
||||
GuildBankItem MainArea[GUILD_BANK_MAIN_AREA_SIZE];
|
||||
GuildBankItem DepositArea[GUILD_BANK_DEPOSIT_AREA_SIZE];
|
||||
std::map<int32, GuildBankRepository::GuildBank> main_area{};
|
||||
std::map<int32, GuildBankRepository::GuildBank> deposit_area{};
|
||||
};
|
||||
|
||||
struct GuildBank
|
||||
{
|
||||
uint32 GuildID;
|
||||
GuildBankItems Items;
|
||||
uint32 guild_id;
|
||||
GuildBankItems items{};
|
||||
|
||||
GuildBank()
|
||||
{
|
||||
guild_id = 0;
|
||||
}
|
||||
};
|
||||
|
||||
enum { GuildBankBulkItems = 0, GuildBankItemUpdate = 1, GuildBankPromote = 3, GuildBankViewItem = 4, GuildBankDeposit = 5,
|
||||
GuildBankPermissions = 6, GuildBankWithdraw = 7, GuildBankSplitStacks = 8, GuildBankMergeStacks = 9, GuildBankAcknowledge = 10 };
|
||||
enum {
|
||||
GuildBankBulkItems = 0,
|
||||
GuildBankItemUpdate = 1,
|
||||
GuildBankPromote = 3,
|
||||
GuildBankViewItem = 4,
|
||||
GuildBankDeposit = 5,
|
||||
GuildBankPermissions = 6,
|
||||
GuildBankWithdraw = 7,
|
||||
GuildBankSplitStacks = 8,
|
||||
GuildBankMergeStacks = 9,
|
||||
GuildBankAcknowledge = 10
|
||||
};
|
||||
|
||||
enum { GuildBankDepositArea = 0, GuildBankMainArea = 1 };
|
||||
enum {
|
||||
GuildBankDepositArea = 0,
|
||||
GuildBankMainArea = 1
|
||||
};
|
||||
|
||||
enum { GuildBankBankerOnly = 0, GuildBankSingleMember = 1, GuildBankPublicIfUsable = 2, GuildBankPublic = 3 };
|
||||
enum {
|
||||
GuildBankBankerOnly = 0,
|
||||
GuildBankSingleMember = 1,
|
||||
GuildBankPublicIfUsable = 2,
|
||||
GuildBankPublic = 3
|
||||
};
|
||||
|
||||
class ZoneGuildManager : public BaseGuildManager {
|
||||
public:
|
||||
@ -82,7 +96,7 @@ public:
|
||||
void UpdateRankName(uint32 gid, uint32 rank, std::string rank_name);
|
||||
void SendRankName(uint32 guild_id, uint32 rank, std::string rank_name);
|
||||
void SendAllRankNames(uint32 guild_id, uint32 char_id);
|
||||
BaseGuildManager::GuildInfo* GetGuildByGuildID(uint32 guild_id);
|
||||
GuildInfo* GetGuildByGuildID(uint32 guild_id);
|
||||
virtual void SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation);
|
||||
|
||||
protected:
|
||||
@ -103,30 +117,30 @@ class GuildBankManager
|
||||
public:
|
||||
~GuildBankManager();
|
||||
void SendGuildBank(Client *c);
|
||||
bool AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 QtyOrCharges, const char *Donator, uint8 Permissions, const char *WhoFor);
|
||||
int Promote(uint32 GuildID, int SlotID);
|
||||
void SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Permissions, const char *MemberName);
|
||||
EQ::ItemInstance* GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity);
|
||||
bool DeleteItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity);
|
||||
bool HasItem(uint32 GuildID, uint32 ItemID);
|
||||
bool IsAreaFull(uint32 GuildID, uint16 Area);
|
||||
bool MergeStacks(uint32 GuildID, uint16 SlotID);
|
||||
bool SplitStack(uint32 GuildID, uint16 SlotID, uint32 Quantity);
|
||||
bool AllowedToWithdraw(uint32 GuildID, uint16 Area, uint16 SlotID, const char *Name);
|
||||
bool AddItem(GuildBankRepository::GuildBank &guild_bank_item, Client* client);
|
||||
int Promote(uint32 GuildID, int SlotID, Client* c);
|
||||
void SetPermissions(uint32 GuildID, uint16 SlotID, uint32 Permissions, const char *MemberName, Client* c);
|
||||
std::unique_ptr<EQ::ItemInstance> GetItem(uint32 guild_id, uint16 area, uint16 slot_id, uint32 quantity);
|
||||
bool DeleteItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity, Client* c);
|
||||
bool HasItem(uint32 guild_id, uint32 item_id);
|
||||
bool IsAreaFull(uint32 guild_id, uint16 area);
|
||||
int32 NextFreeBankSlot(uint32 guild_id, uint32 area);
|
||||
bool MergeStacks(uint32 GuildID, uint16 SlotID, Client* c);
|
||||
bool SplitStack(uint32 GuildID, uint16 SlotID, uint32 Quantity, Client* c);
|
||||
//bool AllowedToWithdraw(uint32 GuildID, uint16 Area, uint16 SlotID, const char *Name);
|
||||
void SendGuildBankItemUpdate(uint32 guild_id, int32 slot_id, uint32 area, bool display, Client* c);
|
||||
std::shared_ptr<GuildBank> GetGuildBank(uint32 guild_id);
|
||||
|
||||
private:
|
||||
bool IsLoaded(uint32 GuildID);
|
||||
bool Load(uint32 GuildID);
|
||||
std::list<GuildBank*>::iterator GetGuildBank(uint32 GuildID);
|
||||
void Load(uint32 GuildID);
|
||||
void UpdateItemQuantity(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity);
|
||||
|
||||
std::list<GuildBank*> Banks;
|
||||
|
||||
std::list<std::shared_ptr<GuildBank>> banks{};
|
||||
};
|
||||
|
||||
extern ZoneGuildManager guild_mgr;
|
||||
extern GuildBankManager *GuildBanks;
|
||||
|
||||
|
||||
#endif /*GUILD_MGR_H_*/
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user