mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix compilation errors from single-player removal
- Fixed corrupted header (removed orphaned code fragment) - Restored NPC callbacks needed for online animations - NpcDeathCallback, NpcRespawnCallback, NpcSwingCallback - These were incorrectly removed as "SP-only" but are used for animations in online mode - Removed calls to deleted methods: - getItemTemplateName, getItemTemplateQuality (used fallback in loot window) - notifyInventoryChanged, notifyEquipmentChanged (SP persistence markers) - Removed hearthstone single-player handling (now uses server) All online features preserved. Code should now compile.
This commit is contained in:
parent
82e59f77f1
commit
8377c640bb
4 changed files with 18 additions and 27 deletions
|
|
@ -236,13 +236,23 @@ public:
|
|||
const std::vector<AuraSlot>& getPlayerAuras() const { return playerAuras; }
|
||||
const std::vector<AuraSlot>& getTargetAuras() const { return targetAuras; }
|
||||
|
||||
// NPC death callback (for animations)
|
||||
using NpcDeathCallback = std::function<void(uint64_t guid)>;
|
||||
void setNpcDeathCallback(NpcDeathCallback cb) { npcDeathCallback_ = std::move(cb); }
|
||||
|
||||
// NPC respawn callback (health 0 → >0, resets animation to idle)
|
||||
using NpcRespawnCallback = std::function<void(uint64_t guid)>;
|
||||
void setNpcRespawnCallback(NpcRespawnCallback cb) { npcRespawnCallback_ = std::move(cb); }
|
||||
|
||||
// Melee swing callback (for driving animation/SFX)
|
||||
using MeleeSwingCallback = std::function<void()>;
|
||||
void setMeleeSwingCallback(MeleeSwingCallback cb) { meleeSwingCallback_ = std::move(cb); }
|
||||
playerXp_ = 0;
|
||||
}
|
||||
|
||||
// XP tracking (works in both single-player and server modes)
|
||||
// NPC swing callback (plays attack animation on NPC)
|
||||
using NpcSwingCallback = std::function<void(uint64_t guid)>;
|
||||
void setNpcSwingCallback(NpcSwingCallback cb) { npcSwingCallback_ = std::move(cb); }
|
||||
|
||||
// XP tracking
|
||||
uint32_t getPlayerXp() const { return playerXp_; }
|
||||
uint32_t getPlayerNextLevelXp() const { return playerNextLevelXp_; }
|
||||
uint32_t getPlayerLevel() const { return serverPlayerLevel_; }
|
||||
|
|
@ -671,7 +681,10 @@ private:
|
|||
uint32_t serverPlayerLevel_ = 1;
|
||||
static uint32_t xpForLevel(uint32_t level);
|
||||
|
||||
NpcDeathCallback npcDeathCallback_;
|
||||
NpcRespawnCallback npcRespawnCallback_;
|
||||
MeleeSwingCallback meleeSwingCallback_;
|
||||
NpcSwingCallback npcSwingCallback_;
|
||||
bool playerDead_ = false;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2051,14 +2051,7 @@ void GameHandler::handleSpellHealLog(network::Packet& packet) {
|
|||
// ============================================================
|
||||
|
||||
void GameHandler::castSpell(uint32_t spellId, uint64_t targetGuid) {
|
||||
// Hearthstone (8690) — handle locally when no server connection (single-player)
|
||||
if (spellId == 8690 && hearthstoneCallback) {
|
||||
LOG_INFO("Hearthstone: teleporting home");
|
||||
hearthstoneCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
// Attack (6603) routes to auto-attack instead of cast (works without server)
|
||||
// Attack (6603) routes to auto-attack instead of cast
|
||||
if (spellId == 6603) {
|
||||
uint64_t target = targetGuid != 0 ? targetGuid : this->targetGuid;
|
||||
if (target != 0) {
|
||||
|
|
|
|||
|
|
@ -154,15 +154,10 @@ void GameScreen::render(game::GameHandler& gameHandler) {
|
|||
// Character screen (C key toggle handled inside render())
|
||||
inventoryScreen.renderCharacterScreen(gameHandler);
|
||||
|
||||
if (inventoryScreen.consumeInventoryDirty()) {
|
||||
gameHandler.notifyInventoryChanged();
|
||||
}
|
||||
|
||||
if (inventoryScreen.consumeEquipmentDirty() || gameHandler.consumeOnlineEquipmentDirty()) {
|
||||
updateCharacterGeosets(gameHandler.getInventory());
|
||||
updateCharacterTextures(gameHandler.getInventory());
|
||||
core::Application::getInstance().loadEquippedWeapons();
|
||||
gameHandler.notifyEquipmentChanged();
|
||||
inventoryScreen.markPreviewDirty();
|
||||
// Update renderer weapon type for animation selection
|
||||
auto* r = core::Application::getInstance().getRenderer();
|
||||
|
|
@ -2017,14 +2012,7 @@ void GameScreen::renderLootWindow(game::GameHandler& gameHandler) {
|
|||
itemName = info->name;
|
||||
quality = static_cast<game::ItemQuality>(info->quality);
|
||||
} else {
|
||||
// Fallback: look up name from item template DB (single-player)
|
||||
auto tplName = gameHandler.getItemTemplateName(item.itemId);
|
||||
if (!tplName.empty()) {
|
||||
itemName = tplName;
|
||||
quality = gameHandler.getItemTemplateQuality(item.itemId);
|
||||
} else {
|
||||
itemName = "Item #" + std::to_string(item.itemId);
|
||||
}
|
||||
itemName = "Item #" + std::to_string(item.itemId);
|
||||
}
|
||||
ImVec4 qColor = InventoryScreen::getQualityColor(quality);
|
||||
|
||||
|
|
|
|||
|
|
@ -628,9 +628,6 @@ void InventoryScreen::render(game::Inventory& inventory, uint64_t moneyCopper) {
|
|||
heldItem = game::ItemDef{};
|
||||
heldSource = HeldSource::NONE;
|
||||
inventoryDirty = true;
|
||||
if (gameHandler_) {
|
||||
gameHandler_->notifyInventoryChanged();
|
||||
}
|
||||
dropItemName_.clear();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue