mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
Fix online interactions, UI, and inventory sync
This commit is contained in:
parent
7436420cd1
commit
fdc614902b
14 changed files with 525 additions and 143 deletions
|
|
@ -110,6 +110,7 @@ public:
|
|||
|
||||
using CharDeleteCallback = std::function<void(bool success)>;
|
||||
void setCharDeleteCallback(CharDeleteCallback cb) { charDeleteCallback_ = std::move(cb); }
|
||||
uint8_t getLastCharDeleteResult() const { return lastCharDeleteResult_; }
|
||||
|
||||
/**
|
||||
* Select and log in with a character
|
||||
|
|
@ -214,6 +215,7 @@ public:
|
|||
void startAutoAttack(uint64_t targetGuid);
|
||||
void stopAutoAttack();
|
||||
bool isAutoAttacking() const { return autoAttacking; }
|
||||
bool isAggressiveTowardPlayer(uint64_t guid) const { return hostileAttackers_.count(guid) > 0; }
|
||||
const std::vector<CombatTextEntry>& getCombatText() const { return combatText; }
|
||||
void updateCombatText(float deltaTime);
|
||||
|
||||
|
|
@ -332,6 +334,7 @@ public:
|
|||
void lootTarget(uint64_t guid);
|
||||
void lootItem(uint8_t slotIndex);
|
||||
void closeLoot();
|
||||
void activateSpiritHealer(uint64_t npcGuid);
|
||||
bool isLootWindowOpen() const { return lootWindowOpen; }
|
||||
const LootResponseData& getCurrentLoot() const { return currentLoot; }
|
||||
|
||||
|
|
@ -363,6 +366,8 @@ public:
|
|||
void buyItem(uint64_t vendorGuid, uint32_t itemId, uint32_t slot, uint8_t count);
|
||||
void sellItem(uint64_t vendorGuid, uint64_t itemGuid, uint8_t count);
|
||||
void sellItemBySlot(int backpackIndex);
|
||||
void autoEquipItemBySlot(int backpackIndex);
|
||||
void useItemBySlot(int backpackIndex);
|
||||
bool isVendorWindowOpen() const { return vendorWindowOpen; }
|
||||
const ListInventoryData& getVendorItems() const { return currentVendorItems; }
|
||||
const ItemQueryResponseData* getItemInfo(uint32_t itemId) const {
|
||||
|
|
@ -467,6 +472,8 @@ private:
|
|||
void handleItemQueryResponse(network::Packet& packet);
|
||||
void queryItemInfo(uint32_t entry, uint64_t guid);
|
||||
void rebuildOnlineInventory();
|
||||
void detectInventorySlotBases(const std::map<uint16_t, uint32_t>& fields);
|
||||
bool applyInventoryFields(const std::map<uint16_t, uint32_t>& fields);
|
||||
|
||||
// ---- Phase 2 handlers ----
|
||||
void handleAttackStart(network::Packet& packet);
|
||||
|
|
@ -606,11 +613,16 @@ private:
|
|||
std::unordered_set<uint32_t> pendingItemQueries_;
|
||||
std::array<uint64_t, 23> equipSlotGuids_{};
|
||||
std::array<uint64_t, 16> backpackSlotGuids_{};
|
||||
int invSlotBase_ = -1;
|
||||
int packSlotBase_ = -1;
|
||||
std::map<uint16_t, uint32_t> lastPlayerFields_;
|
||||
bool onlineEquipDirty_ = false;
|
||||
|
||||
// ---- Phase 2: Combat ----
|
||||
bool autoAttacking = false;
|
||||
uint64_t autoAttackTarget = 0;
|
||||
bool autoAttackOutOfRange_ = false;
|
||||
std::unordered_set<uint64_t> hostileAttackers_;
|
||||
std::vector<CombatTextEntry> combatText;
|
||||
|
||||
// ---- Phase 3: Spells ----
|
||||
|
|
@ -674,6 +686,7 @@ private:
|
|||
WorldConnectFailureCallback onFailure;
|
||||
CharCreateCallback charCreateCallback_;
|
||||
CharDeleteCallback charDeleteCallback_;
|
||||
uint8_t lastCharDeleteResult_ = 0xFF;
|
||||
bool pendingCharCreateResult_ = false;
|
||||
bool pendingCharCreateSuccess_ = false;
|
||||
std::string pendingCharCreateMsg_;
|
||||
|
|
|
|||
|
|
@ -162,11 +162,13 @@ enum class Opcode : uint16_t {
|
|||
// ---- Phase 5: Item/Equip ----
|
||||
CMSG_ITEM_QUERY_SINGLE = 0x056,
|
||||
SMSG_ITEM_QUERY_SINGLE_RESPONSE = 0x058,
|
||||
CMSG_USE_ITEM = 0x00AB,
|
||||
CMSG_AUTOEQUIP_ITEM = 0x10A,
|
||||
SMSG_INVENTORY_CHANGE_FAILURE = 0x112,
|
||||
|
||||
// ---- Death/Respawn ----
|
||||
CMSG_REPOP_REQUEST = 0x015A,
|
||||
CMSG_SPIRIT_HEALER_ACTIVATE = 0x0176,
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
|
|
|
|||
|
|
@ -1125,6 +1125,18 @@ public:
|
|||
static network::Packet build(uint8_t slotIndex);
|
||||
};
|
||||
|
||||
/** CMSG_USE_ITEM packet builder */
|
||||
class UseItemPacket {
|
||||
public:
|
||||
static network::Packet build(uint8_t bagIndex, uint8_t slotIndex, uint64_t itemGuid);
|
||||
};
|
||||
|
||||
/** CMSG_AUTOEQUIP_ITEM packet builder */
|
||||
class AutoEquipItemPacket {
|
||||
public:
|
||||
static network::Packet build(uint64_t itemGuid);
|
||||
};
|
||||
|
||||
/** CMSG_LOOT_RELEASE packet builder */
|
||||
class LootReleasePacket {
|
||||
public:
|
||||
|
|
@ -1274,5 +1286,11 @@ public:
|
|||
static network::Packet build();
|
||||
};
|
||||
|
||||
/** CMSG_SPIRIT_HEALER_ACTIVATE packet builder */
|
||||
class SpiritHealerActivatePacket {
|
||||
public:
|
||||
static network::Packet build(uint64_t npcGuid);
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
} // namespace wowee
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue