mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-03 20:03:50 +00:00
fix warnings, remove phases from commentaries
This commit is contained in:
parent
43aecab1ef
commit
0e6aaeb44e
6 changed files with 33 additions and 55 deletions
|
|
@ -143,28 +143,25 @@ private:
|
|||
void applyUpdateObjectBlock(const UpdateBlock& block, bool& newItemCreated);
|
||||
void finalizeUpdateObjectBatch(bool newItemCreated);
|
||||
|
||||
// --- Phase 1: Extracted helper methods ---
|
||||
bool extractPlayerAppearance(const std::map<uint16_t, uint32_t>& fields,
|
||||
uint8_t& outRace, uint8_t& outGender,
|
||||
uint32_t& outAppearanceBytes, uint8_t& outFacial) const;
|
||||
void maybeDetectCoinageIndex(const std::map<uint16_t, uint32_t>& oldFields,
|
||||
const std::map<uint16_t, uint32_t>& newFields);
|
||||
|
||||
// --- Phase 2: Update type handlers ---
|
||||
void handleCreateObject(const UpdateBlock& block, bool& newItemCreated);
|
||||
void handleValuesUpdate(const UpdateBlock& block);
|
||||
void handleMovementUpdate(const UpdateBlock& block);
|
||||
|
||||
// --- Phase 3: Concern-specific helpers ---
|
||||
// 3i: Update transport-relative child attachment (non-player entities).
|
||||
// Update transport-relative child attachment (non-player entities).
|
||||
// Consolidates identical logic from CREATE/VALUES/MOVEMENT handlers.
|
||||
void updateNonPlayerTransportAttachment(const UpdateBlock& block,
|
||||
const std::shared_ptr<Entity>& entity,
|
||||
ObjectType entityType);
|
||||
// 3f: Rebuild playerAuras_ from UNIT_FIELD_AURAS (Classic/vanilla only).
|
||||
// Rebuild playerAuras_ from UNIT_FIELD_AURAS (Classic/vanilla only).
|
||||
// Consolidates identical logic from CREATE and VALUES handlers.
|
||||
void syncClassicAurasFromFields(const std::shared_ptr<Entity>& entity);
|
||||
// 3h: Detect mount/dismount from UNIT_FIELD_MOUNTDISPLAYID changes (self-player only).
|
||||
// Detect mount/dismount from UNIT_FIELD_MOUNTDISPLAYID changes (self-player only).
|
||||
// Consolidates identical logic from CREATE and VALUES handlers.
|
||||
void detectPlayerMountChange(uint32_t newMountDisplayId,
|
||||
const std::map<uint16_t, uint32_t>& blockFields);
|
||||
|
|
@ -172,7 +169,6 @@ private:
|
|||
// Shared player-death handler: caches corpse position, sets death state.
|
||||
void markPlayerDead(const char* source);
|
||||
|
||||
// --- Phase 4: Field index cache structs ---
|
||||
// Cached field indices resolved once per handler call to avoid repeated lookups.
|
||||
struct UnitFieldIndices {
|
||||
uint16_t health, maxHealth, powerBase, maxPowerBase;
|
||||
|
|
@ -202,44 +198,42 @@ private:
|
|||
uint32_t oldDisplayId = 0;
|
||||
};
|
||||
|
||||
// --- Phase 3: Extracted concern-specific helpers (continued) ---
|
||||
// 3a: Entity factory — creates the correct Entity subclass for the given block.
|
||||
// Entity factory — creates the correct Entity subclass for the given block.
|
||||
std::shared_ptr<Entity> createEntityFromBlock(const UpdateBlock& block);
|
||||
// 3b: Track player-on-transport state from movement blocks.
|
||||
// Track player-on-transport state from movement blocks.
|
||||
void applyPlayerTransportState(const UpdateBlock& block,
|
||||
const std::shared_ptr<Entity>& entity,
|
||||
const glm::vec3& canonicalPos, float oCanonical,
|
||||
bool updateMovementInfoPos);
|
||||
// 3c: Apply unit fields during CREATE — returns true if entity is initially dead.
|
||||
// Apply unit fields during CREATE — returns true if entity is initially dead.
|
||||
bool applyUnitFieldsOnCreate(const UpdateBlock& block,
|
||||
std::shared_ptr<Unit>& unit,
|
||||
const UnitFieldIndices& ufi);
|
||||
// 3c: Apply unit fields during VALUES — returns change tracking result.
|
||||
// Apply unit fields during VALUES — returns change tracking result.
|
||||
UnitFieldUpdateResult applyUnitFieldsOnUpdate(const UpdateBlock& block,
|
||||
const std::shared_ptr<Entity>& entity,
|
||||
std::shared_ptr<Unit>& unit,
|
||||
const UnitFieldIndices& ufi);
|
||||
// 3d: Apply player stat fields (XP, inventory, skills, etc.). isCreate=true for CREATE path.
|
||||
// Apply player stat fields (XP, inventory, skills, etc.). isCreate=true for CREATE path.
|
||||
bool applyPlayerStatFields(const std::map<uint16_t, uint32_t>& fields,
|
||||
const PlayerFieldIndices& pfi, bool isCreate);
|
||||
// 3e: Dispatch spawn callbacks (creature/player) — deduplicates CREATE and VALUES paths.
|
||||
// Dispatch spawn callbacks (creature/player) — deduplicates CREATE and VALUES paths.
|
||||
void dispatchEntitySpawn(uint64_t guid, ObjectType objectType,
|
||||
const std::shared_ptr<Entity>& entity,
|
||||
const std::shared_ptr<Unit>& unit, bool isDead);
|
||||
// 3g: Track item/container on CREATE.
|
||||
// Track item/container on CREATE.
|
||||
void trackItemOnCreate(const UpdateBlock& block, bool& newItemCreated);
|
||||
// 3g: Update item fields on VALUES update.
|
||||
// Update item fields on VALUES update.
|
||||
void updateItemOnValuesUpdate(const UpdateBlock& block,
|
||||
const std::shared_ptr<Entity>& entity);
|
||||
|
||||
// --- Phase 5: Strategy pattern — object-type handler interface ---
|
||||
// Allows extending object-type handling without modifying handler dispatch.
|
||||
struct IObjectTypeHandler {
|
||||
virtual ~IObjectTypeHandler() = default;
|
||||
virtual void onCreate(const UpdateBlock& block, std::shared_ptr<Entity>& entity,
|
||||
bool& newItemCreated) {}
|
||||
virtual void onValuesUpdate(const UpdateBlock& block, std::shared_ptr<Entity>& entity) {}
|
||||
virtual void onMovementUpdate(const UpdateBlock& block, std::shared_ptr<Entity>& entity) {}
|
||||
virtual void onCreate(const UpdateBlock& /*block*/, std::shared_ptr<Entity>& /*entity*/,
|
||||
bool& /*newItemCreated*/) {}
|
||||
virtual void onValuesUpdate(const UpdateBlock& /*block*/, std::shared_ptr<Entity>& /*entity*/) {}
|
||||
virtual void onMovementUpdate(const UpdateBlock& /*block*/, std::shared_ptr<Entity>& /*entity*/) {}
|
||||
};
|
||||
struct UnitTypeHandler;
|
||||
struct PlayerTypeHandler;
|
||||
|
|
@ -250,7 +244,6 @@ private:
|
|||
void initTypeHandlers();
|
||||
IObjectTypeHandler* getTypeHandler(ObjectType type) const;
|
||||
|
||||
// --- Phase 5: Type-specific handler implementations (trampolined from handlers) ---
|
||||
void onCreateUnit(const UpdateBlock& block, std::shared_ptr<Entity>& entity);
|
||||
void onCreatePlayer(const UpdateBlock& block, std::shared_ptr<Entity>& entity);
|
||||
void onCreateGameObject(const UpdateBlock& block, std::shared_ptr<Entity>& entity);
|
||||
|
|
@ -265,7 +258,6 @@ private:
|
|||
void onValuesUpdateItem(const UpdateBlock& block, std::shared_ptr<Entity>& entity);
|
||||
void onValuesUpdateGameObject(const UpdateBlock& block, std::shared_ptr<Entity>& entity);
|
||||
|
||||
// --- Phase 6: Deferred event bus ---
|
||||
// Collects addon events during block processing, flushes at the end.
|
||||
struct PendingEvents {
|
||||
std::vector<std::pair<std::string, std::vector<std::string>>> events;
|
||||
|
|
|
|||
|
|
@ -627,7 +627,6 @@ public:
|
|||
void resetWardenState(); // clear all warden module/crypto state for connect/disconnect
|
||||
void clearUnitCaches(); // clear per-unit cast states and aura caches
|
||||
|
||||
// ---- Phase 1: Name queries (delegated to EntityController) ----
|
||||
void queryPlayerName(uint64_t guid);
|
||||
void queryCreatureInfo(uint32_t entry, uint64_t guid);
|
||||
void queryGameObjectInfo(uint32_t entry, uint64_t guid);
|
||||
|
|
@ -661,7 +660,6 @@ public:
|
|||
return entityController_->getCreatureFamily(entry);
|
||||
}
|
||||
|
||||
// ---- Phase 2: Combat (delegated to CombatHandler) ----
|
||||
void startAutoAttack(uint64_t targetGuid);
|
||||
void stopAutoAttack();
|
||||
bool isAutoAttacking() const;
|
||||
|
|
@ -696,7 +694,6 @@ public:
|
|||
const std::vector<ThreatEntry>* getThreatList(uint64_t unitGuid) const;
|
||||
const std::vector<ThreatEntry>* getTargetThreatList() const;
|
||||
|
||||
// ---- Phase 3: Spells ----
|
||||
void castSpell(uint32_t spellId, uint64_t targetGuid = 0);
|
||||
void cancelCast();
|
||||
void cancelAura(uint32_t spellId);
|
||||
|
|
@ -1239,7 +1236,7 @@ public:
|
|||
void acceptResurrect();
|
||||
void declineResurrect();
|
||||
|
||||
// ---- Phase 4: Group ----
|
||||
// ---- Group ----
|
||||
void inviteToGroup(const std::string& playerName);
|
||||
void acceptGroupInvite();
|
||||
void declineGroupInvite();
|
||||
|
|
@ -1396,7 +1393,7 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// ---- Phase 5: Loot ----
|
||||
// ---- Loot ----
|
||||
void lootTarget(uint64_t guid);
|
||||
void lootItem(uint8_t slotIndex);
|
||||
void closeLoot();
|
||||
|
|
@ -2177,7 +2174,6 @@ private:
|
|||
*/
|
||||
void handlePong(network::Packet& packet);
|
||||
|
||||
// ---- Phase 1 handlers (entity queries delegated to EntityController) ----
|
||||
void handleItemQueryResponse(network::Packet& packet);
|
||||
void queryItemInfo(uint32_t entry, uint64_t guid);
|
||||
void rebuildOnlineInventory();
|
||||
|
|
@ -2190,7 +2186,6 @@ private:
|
|||
void extractContainerFields(uint64_t containerGuid, const std::map<uint16_t, uint32_t>& fields);
|
||||
uint64_t resolveOnlineItemGuid(uint32_t itemId) const;
|
||||
|
||||
// ---- Phase 2 handlers (dead — dispatched via CombatHandler) ----
|
||||
// handleAttackStart, handleAttackStop, handleAttackerStateUpdate,
|
||||
// handleSpellDamageLog, handleSpellHealLog removed
|
||||
|
||||
|
|
@ -2198,12 +2193,6 @@ private:
|
|||
void handleUpdateAuraDuration(uint8_t slot, uint32_t durationMs);
|
||||
// handleSetForcedReactions — dispatched via CombatHandler
|
||||
|
||||
// ---- Phase 3 handlers ----
|
||||
|
||||
// ---- Talent handlers ----
|
||||
|
||||
// ---- Phase 4 handlers ----
|
||||
|
||||
// ---- Guild handlers ----
|
||||
void handlePetSpells(network::Packet& packet);
|
||||
|
||||
|
|
@ -2217,7 +2206,6 @@ private:
|
|||
|
||||
// ---- Other player movement (MSG_MOVE_* from server) ----
|
||||
|
||||
// ---- Phase 5 handlers ----
|
||||
void clearPendingQuestAccept(uint32_t questId);
|
||||
void triggerQuestAcceptResync(uint32_t questId, uint64_t npcGuid, const char* reason);
|
||||
bool hasQuestInLog(uint32_t questId) const;
|
||||
|
|
@ -2411,7 +2399,6 @@ private:
|
|||
uint32_t homeBindZoneId_ = 0;
|
||||
glm::vec3 homeBindPos_{0.0f};
|
||||
|
||||
// ---- Phase 1: Name caches (moved to EntityController) ----
|
||||
|
||||
// ---- Friend/contact list cache ----
|
||||
std::unordered_map<std::string, uint64_t> friendsCache; // name -> guid
|
||||
|
|
@ -2510,11 +2497,10 @@ private:
|
|||
std::unordered_set<uint64_t> pendingAutoInspect_;
|
||||
float inspectRateLimit_ = 0.0f;
|
||||
|
||||
// ---- Phase 2: Combat (state moved to CombatHandler) ----
|
||||
// ---- Combat ----
|
||||
bool wasCombat_ = false; // Previous frame combat state for PLAYER_REGEN edge detection
|
||||
std::deque<std::string> areaTriggerMsgs_;
|
||||
|
||||
// ---- Phase 3: Spells ----
|
||||
WorldEntryCallback worldEntryCallback_;
|
||||
KnockBackCallback knockBackCallback_;
|
||||
CameraShakeCallback cameraShakeCallback_;
|
||||
|
|
@ -2674,7 +2660,7 @@ private:
|
|||
void loadFactionNameCache() const;
|
||||
std::string getFactionName(uint32_t factionId) const;
|
||||
|
||||
// ---- Phase 4: Group ----
|
||||
// ---- Group ----
|
||||
GroupListData partyData;
|
||||
bool pendingGroupInvite = false;
|
||||
std::string pendingInviterName;
|
||||
|
|
@ -2745,7 +2731,7 @@ private:
|
|||
// Barber shop
|
||||
bool barberShopOpen_ = false;
|
||||
|
||||
// ---- Phase 5: Loot ----
|
||||
// ---- Loot ----
|
||||
bool lootWindowOpen = false;
|
||||
bool autoLoot_ = false;
|
||||
bool autoSellGrey_ = false;
|
||||
|
|
|
|||
|
|
@ -1460,7 +1460,7 @@ public:
|
|||
};
|
||||
|
||||
// ============================================================
|
||||
// Phase 1: Foundation — Targeting, Name Queries
|
||||
// Foundation — Targeting, Name Queries
|
||||
// ============================================================
|
||||
|
||||
/** CMSG_SET_SELECTION packet builder */
|
||||
|
|
@ -1663,7 +1663,7 @@ public:
|
|||
};
|
||||
|
||||
// ============================================================
|
||||
// Phase 2: Combat Core
|
||||
// Combat Core
|
||||
// ============================================================
|
||||
|
||||
/** SMSG_MONSTER_MOVE data */
|
||||
|
|
@ -1805,7 +1805,7 @@ public:
|
|||
};
|
||||
|
||||
// ============================================================
|
||||
// Phase 3: Spells, Action Bar, Auras
|
||||
// Spells, Action Bar, Auras
|
||||
// ============================================================
|
||||
|
||||
/** SMSG_INITIAL_SPELLS data */
|
||||
|
|
@ -1930,7 +1930,7 @@ public:
|
|||
};
|
||||
|
||||
// ============================================================
|
||||
// Phase 4: Group/Party System
|
||||
// Group/Party System
|
||||
// ============================================================
|
||||
|
||||
/** CMSG_GROUP_INVITE packet builder */
|
||||
|
|
@ -1998,7 +1998,7 @@ public:
|
|||
};
|
||||
|
||||
// ============================================================
|
||||
// Phase 5: Loot System
|
||||
// Loot System
|
||||
// ============================================================
|
||||
|
||||
/** Loot item entry */
|
||||
|
|
@ -2100,7 +2100,7 @@ public:
|
|||
};
|
||||
|
||||
// ============================================================
|
||||
// Phase 5: NPC Gossip
|
||||
// NPC Gossip
|
||||
// ============================================================
|
||||
|
||||
/** Gossip menu option */
|
||||
|
|
@ -2278,7 +2278,7 @@ public:
|
|||
};
|
||||
|
||||
// ============================================================
|
||||
// Phase 5: Vendor
|
||||
// Vendor
|
||||
// ============================================================
|
||||
|
||||
/** Vendor item entry */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue