mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-13 02:38:45 +00:00
Implement bazaar item identity and offline trading rework
This commit is contained in:
+98
-16
@@ -303,7 +303,7 @@ public:
|
||||
void Trader_CustomerBrowsing(Client *Customer);
|
||||
|
||||
void TraderEndTrader();
|
||||
void TraderPriceUpdate(const EQApplicationPacket *app);
|
||||
void TraderUpdateItem(const EQApplicationPacket *app);
|
||||
void SendBazaarDone(uint32 trader_id);
|
||||
void SendBulkBazaarTraders();
|
||||
void SendBulkBazaarBuyers();
|
||||
@@ -340,7 +340,7 @@ public:
|
||||
void SendTraderPacket(Client* trader, uint32 Unknown72 = 51);
|
||||
void SendBuyerPacket(Client* Buyer);
|
||||
void SendBuyerToBarterWindow(Client* buyer, uint32 action);
|
||||
GetItems_Struct* GetTraderItems();
|
||||
GetBazaarItems_Struct* GetTraderItems();
|
||||
void SendBazaarWelcome();
|
||||
void SendBarterWelcome();
|
||||
void DyeArmor(EQ::TintProfile* dye);
|
||||
@@ -361,15 +361,17 @@ public:
|
||||
void SendColoredText(uint32 color, std::string message);
|
||||
void SendTraderItem(uint32 item_id,uint16 quantity, TraderRepository::Trader &trader);
|
||||
void DoBazaarSearch(BazaarSearchCriteria_Struct search_criteria);
|
||||
uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity);
|
||||
uint32 FindTraderItemSerialNumber(int32 ItemID);
|
||||
EQ::ItemInstance* FindTraderItemBySerialNumber(int32 SerialNumber);
|
||||
void FindAndNukeTraderItem(int32 serial_number, int16 quantity, Client* customer, uint16 trader_slot);
|
||||
void NukeTraderItem(uint16 slot, int16 charges, int16 quantity, Client* customer, uint16 trader_slot, int32 serial_number, int32 item_id = 0);
|
||||
uint16 FindTraderItem(std::string &SerialNumber,uint16 Quantity);
|
||||
EQ::ItemInstance* FindTraderItemByUniqueID(std::string &unique_id);
|
||||
EQ::ItemInstance* FindTraderItemByUniqueID(const char* unique_id);
|
||||
std::vector<EQ::ItemInstance *> FindTraderItemsByUniqueID(const char* unique_id);
|
||||
void FindAndNukeTraderItem(std::string &item_unique_id, int16 quantity, Client* customer, uint16 trader_slot);
|
||||
void NukeTraderItem(uint16 slot, int16 charges, int16 quantity, Client* customer, uint16 trader_slot, const std::string &serial_number, int32 item_id = 0);
|
||||
void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges, uint32 itemid = 0);
|
||||
void TradeRequestFailed(const EQApplicationPacket* app);
|
||||
void BuyTraderItem(TraderBuy_Struct* tbs, Client* trader, const EQApplicationPacket* app);
|
||||
void BuyTraderItemOutsideBazaar(TraderBuy_Struct* tbs, const EQApplicationPacket* app);
|
||||
void TradeRequestFailed(TraderBuy_Struct &in);
|
||||
void BuyTraderItem(const EQApplicationPacket* app);
|
||||
void BuyTraderItemFromBazaarWindow(const EQApplicationPacket* app);
|
||||
void FinishTrade(
|
||||
Mob *with,
|
||||
bool finalizer = false,
|
||||
@@ -401,13 +403,22 @@ public:
|
||||
int32 FindNextFreeParcelSlot(uint32 char_id);
|
||||
int32 FindNextFreeParcelSlotUsingMemory();
|
||||
void SendParcelIconStatus();
|
||||
bool IsOffline() { return m_offline; }
|
||||
void SetOffline(bool status) { m_offline = status; }
|
||||
|
||||
void SendBecomeTraderToWorld(Client *trader, BazaarTraderBarterActions action);
|
||||
void SendBecomeTrader(BazaarTraderBarterActions action, uint32 trader_id);
|
||||
|
||||
bool IsThereACustomer() const { return customer_id ? true : false; }
|
||||
bool IsThereACustomer() const { return customer_id ? true : false; }
|
||||
uint32 GetCustomerID() { return customer_id; }
|
||||
void SetCustomerID(uint32 id) { customer_id = id; }
|
||||
void SetCustomerID(uint32 id) { customer_id = id; }
|
||||
void ClearTraderMerchantList() { m_trader_merchant_list.clear(); }
|
||||
void AddDataToMerchantList(int16 slot_id, uint32 item_id, int32 quantity, const std::string &item_unique_id);
|
||||
int16 GetNextFreeSlotFromMerchantList();
|
||||
std::tuple<uint32, int32, std::string> GetDataFromMerchantListByMerchantSlotId(int16 slot_id);
|
||||
int16 GetSlotFromMerchantListByItemUniqueId(const std::string &unique_id);
|
||||
std::pair<int16, std::tuple<uint32, int32, std::string>> GetDataFromMerchantListByItemUniqueId(const std::string &unique_id);
|
||||
std::map<int16, std::tuple<uint32, int32, std::string>>* GetTraderMerchantList() { return &m_trader_merchant_list; }
|
||||
|
||||
void SetBuyerID(uint32 id) { m_buyer_id = id; }
|
||||
uint32 GetBuyerID() { return m_buyer_id; }
|
||||
@@ -486,7 +497,12 @@ public:
|
||||
inline bool ClientDataLoaded() const { return client_data_loaded; }
|
||||
inline bool Connected() const { return (client_state == CLIENT_CONNECTED); }
|
||||
inline bool InZone() const { return (client_state == CLIENT_CONNECTED || client_state == CLIENT_LINKDEAD); }
|
||||
inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; }
|
||||
inline void Disconnect() {
|
||||
if (eqs) {
|
||||
eqs->Close();
|
||||
client_state = DISCONNECTED;
|
||||
}
|
||||
}
|
||||
inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); }
|
||||
void Kick(const std::string &reason);
|
||||
void WorldKick();
|
||||
@@ -576,8 +592,8 @@ public:
|
||||
void DisableAreaRegens();
|
||||
|
||||
void ServerFilter(SetServerFilter_Struct* filter);
|
||||
void BulkSendTraderInventory(uint32 char_id);
|
||||
void SendSingleTraderItem(uint32 char_id, int serial_number);
|
||||
void BulkSendTraderInventory(uint32 character_id);
|
||||
void SendSingleTraderItem(uint32 char_id, const std::string &serial_number);
|
||||
void BulkSendMerchantInventory(int merchant_id, int npcid);
|
||||
|
||||
inline uint8 GetLanguageSkill(uint8 language_id) const { return m_pp.languages[language_id]; }
|
||||
@@ -1134,13 +1150,13 @@ public:
|
||||
bool FindNumberOfFreeInventorySlotsWithSizeCheck(std::vector<BuyerLineTradeItems_Struct> items);
|
||||
bool PushItemOnCursor(const EQ::ItemInstance& inst, bool client_update = false);
|
||||
void SendCursorBuffer();
|
||||
void DeleteItemInInventory(int16 slot_id, int16 quantity = 0, bool client_update = false, bool update_db = true);
|
||||
bool DeleteItemInInventory(int16 slot_id, int16 quantity = 0, bool client_update = false, bool update_db = true);
|
||||
uint32 CountItem(uint32 item_id);
|
||||
void ResetItemCooldown(uint32 item_id);
|
||||
void SetItemCooldown(uint32 item_id, bool use_saved_timer = false, uint32 in_seconds = 1);
|
||||
uint32 GetItemCooldown(uint32 item_id);
|
||||
void RemoveItem(uint32 item_id, uint32 quantity = 1);
|
||||
void RemoveItemBySerialNumber(uint32 serial_number, uint32 quantity = 1);
|
||||
bool RemoveItemByItemUniqueId(const std::string &item_unique_id, uint32 quantity = 1);
|
||||
bool SwapItem(MoveItem_Struct* move_in);
|
||||
void SwapItemResync(MoveItem_Struct* move_slots);
|
||||
void PutLootInInventory(int16 slot_id, const EQ::ItemInstance &inst, LootItem** bag_item_data = 0);
|
||||
@@ -2093,7 +2109,9 @@ private:
|
||||
uint8 mercSlot; // selected merc slot
|
||||
time_t m_trader_transaction_date;
|
||||
uint32 m_trader_count{};
|
||||
std::map<int16, std::tuple<uint32, int32, std::string>> m_trader_merchant_list{}; // itemid, qty, item_unique_id
|
||||
uint32 m_buyer_id;
|
||||
bool m_offline;
|
||||
uint32 m_barter_time;
|
||||
int32 m_parcel_platinum;
|
||||
int32 m_parcel_gold;
|
||||
@@ -2423,4 +2441,68 @@ public:
|
||||
bool IsFilteredAFKPacket(const EQApplicationPacket *p);
|
||||
void CheckAutoIdleAFK(PlayerPositionUpdateClient_Struct *p);
|
||||
void SyncWorldPositionsToClient(bool ignore_idle = false);
|
||||
|
||||
|
||||
Mob* GetMob() {
|
||||
return Mob::GetMob();
|
||||
}
|
||||
|
||||
void Clone(Client& in)
|
||||
{
|
||||
WID = in.WID;
|
||||
admin = in.admin;
|
||||
guild_id = in.guild_id;
|
||||
guildrank = in.guildrank;
|
||||
LFG = in.LFG;
|
||||
m_is_afk = in.m_is_afk;
|
||||
m_is_idle = in.m_is_idle;
|
||||
m_is_manual_afk = in.m_is_manual_afk;
|
||||
trader_id = in.trader_id;
|
||||
m_buyer_id = in.m_buyer_id;
|
||||
race = in.race;
|
||||
class_ = in.class_;
|
||||
size = in.size;
|
||||
deity = in.deity;
|
||||
texture = in.texture;
|
||||
m_ClientVersion = in.m_ClientVersion;
|
||||
m_ClientVersionBit = in.m_ClientVersionBit;
|
||||
character_id = in.character_id;
|
||||
account_id = in.account_id;
|
||||
lsaccountid = in.lsaccountid;
|
||||
|
||||
m_pp.platinum = in.m_pp.platinum;
|
||||
m_pp.gold = in.m_pp.gold;
|
||||
m_pp.silver = in.m_pp.silver;
|
||||
m_pp.copper = in.m_pp.copper;
|
||||
m_pp.platinum_bank = in.m_pp.platinum_bank;
|
||||
m_pp.gold_bank = in.m_pp.gold_bank;
|
||||
m_pp.silver_bank = in.m_pp.silver_bank;
|
||||
m_pp.copper_bank = in.m_pp.copper_bank;
|
||||
m_pp.platinum_cursor = in.m_pp.platinum_cursor;
|
||||
m_pp.gold_cursor = in.m_pp.gold_cursor;
|
||||
m_pp.silver_cursor = in.m_pp.silver_cursor;
|
||||
m_pp.copper_cursor = in.m_pp.copper_cursor;
|
||||
m_pp.currentRadCrystals = in.m_pp.currentRadCrystals;
|
||||
m_pp.careerRadCrystals = in.m_pp.careerRadCrystals;
|
||||
m_pp.currentEbonCrystals = in.m_pp.currentEbonCrystals;
|
||||
m_pp.careerEbonCrystals = in.m_pp.careerEbonCrystals;
|
||||
m_pp.gm = in.m_pp.gm;
|
||||
|
||||
m_inv.SetInventoryVersion(in.m_ClientVersion);
|
||||
SetBodyType(in.GetBodyType(), false);
|
||||
|
||||
for (auto [slot, item] : in.m_inv.GetPersonal()) {
|
||||
if (item) {
|
||||
m_inv.GetPersonal()[slot] = item->Clone();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto [slot, item] : in.m_inv.GetWorn()) {
|
||||
if (item) {
|
||||
m_inv.GetWorn()[slot] = item->Clone();
|
||||
}
|
||||
}
|
||||
|
||||
CloneMob(*in.GetMob());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user