mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
Fix online mode creature spawning and packet parsing
- Fix encryption desync by tracking decrypted header bytes in world socket - Fix UPDATE_OBJECT movement block parsing to handle 3.3.5a update flags - Fix UNIT_FIELD_DISPLAYID index (67, not 71) - Add creature spawn/despawn callbacks with DBC-based model loading - Add SMSG_COMPRESSED_UPDATE_OBJECT opcode support
This commit is contained in:
parent
a4fcc38c12
commit
c28376e193
9 changed files with 445 additions and 30 deletions
|
|
@ -147,6 +147,10 @@ public:
|
|||
uint32_t getEntry() const { return entry; }
|
||||
void setEntry(uint32_t e) { entry = e; }
|
||||
|
||||
// Display ID (model display)
|
||||
uint32_t getDisplayId() const { return displayId; }
|
||||
void setDisplayId(uint32_t id) { displayId = id; }
|
||||
|
||||
protected:
|
||||
std::string name;
|
||||
uint32_t health = 0;
|
||||
|
|
@ -156,6 +160,7 @@ protected:
|
|||
uint8_t powerType = 0; // 0=mana, 1=rage, 2=focus, 3=energy
|
||||
uint32_t level = 1;
|
||||
uint32_t entry = 0;
|
||||
uint32_t displayId = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -276,6 +276,15 @@ public:
|
|||
using WorldEntryCallback = std::function<void(uint32_t mapId, float x, float y, float z)>;
|
||||
void setWorldEntryCallback(WorldEntryCallback cb) { worldEntryCallback_ = std::move(cb); }
|
||||
|
||||
// Creature spawn callback (online mode - triggered when creature enters view)
|
||||
// Parameters: guid, displayId, x, y, z (canonical), orientation
|
||||
using CreatureSpawnCallback = std::function<void(uint64_t guid, uint32_t displayId, float x, float y, float z, float orientation)>;
|
||||
void setCreatureSpawnCallback(CreatureSpawnCallback cb) { creatureSpawnCallback_ = std::move(cb); }
|
||||
|
||||
// Creature despawn callback (online mode - triggered when creature leaves view)
|
||||
using CreatureDespawnCallback = std::function<void(uint64_t guid)>;
|
||||
void setCreatureDespawnCallback(CreatureDespawnCallback cb) { creatureDespawnCallback_ = std::move(cb); }
|
||||
|
||||
// Cooldowns
|
||||
float getSpellCooldown(uint32_t spellId) const;
|
||||
|
||||
|
|
@ -383,6 +392,11 @@ private:
|
|||
*/
|
||||
void handleUpdateObject(network::Packet& packet);
|
||||
|
||||
/**
|
||||
* Handle SMSG_COMPRESSED_UPDATE_OBJECT from server
|
||||
*/
|
||||
void handleCompressedUpdateObject(network::Packet& packet);
|
||||
|
||||
/**
|
||||
* Handle SMSG_DESTROY_OBJECT from server
|
||||
*/
|
||||
|
|
@ -529,6 +543,8 @@ private:
|
|||
// ---- Phase 3: Spells ----
|
||||
HearthstoneCallback hearthstoneCallback;
|
||||
WorldEntryCallback worldEntryCallback_;
|
||||
CreatureSpawnCallback creatureSpawnCallback_;
|
||||
CreatureDespawnCallback creatureDespawnCallback_;
|
||||
std::vector<uint32_t> knownSpells;
|
||||
std::unordered_map<uint32_t, float> spellCooldowns; // spellId -> remaining seconds
|
||||
uint8_t castCount = 0;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ enum class Opcode : uint16_t {
|
|||
|
||||
// ---- Entity/Object updates ----
|
||||
SMSG_UPDATE_OBJECT = 0x0A9,
|
||||
SMSG_COMPRESSED_UPDATE_OBJECT = 0x1F6,
|
||||
SMSG_DESTROY_OBJECT = 0x0AA,
|
||||
|
||||
// ---- Chat ----
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue