diff --git a/sql/custom/world/2026_11_16_60_world_local_quest_and_spawn_repairs.sql b/sql/custom/world/2026_11_16_60_world_local_quest_and_spawn_repairs.sql new file mode 100644 index 0000000000..c6ddc25c68 --- /dev/null +++ b/sql/custom/world/2026_11_16_60_world_local_quest_and_spawn_repairs.sql @@ -0,0 +1,41 @@ +-- SIN's fix (1amcoff1n), Quest and World Fixes for 0.1.36, file 2026_11_14_01 renamed. Taken out (held or not taken): +-- the Banner of the Fallen quest rows, the 273/1699 -1 objective delete, the Snowbound map pin and focus move, Gar'im's move, +-- and the Ylva banner script names and Headsplitter delete. +-- Forever Bots 0.1.36 local_quest_and_spawn_repairs. Client build 70938. +START TRANSACTION; + +-- These are two different items with the same localized name. Core loot +-- eligibility hides the starter while active/rewarded and the quest loot +-- until needed. Independent chance rolls used to leave eligible uses empty. +UPDATE gameobject_loot_template SET Chance=100 +WHERE Entry=665282 AND ItemType=0 AND GroupId=0 AND + ((Item=278049 AND QuestRequired=0 AND Chance=30) OR + (Item=278398 AND QuestRequired=1 AND Chance=70)); + +-- Keep turn-in blobs. Add the missing objective blobs using the existing +-- objective IDs. The trigger coordinates come from local AreaTrigger.db2. +INSERT INTO quest_poi (QuestID,BlobIndex,Idx1,ObjectiveIndex,QuestObjectiveID,QuestObjectID,MapID,UiMapID,Flags) +VALUES (273,0,0,0,9000273,2057,0,1432,1), + (455,0,2,2,385480,175,0,1437,1), + (1699,0,0,0,385494,482,0,1433,1) +ON DUPLICATE KEY UPDATE QuestID=VALUES(QuestID); +INSERT INTO quest_poi_points (QuestID,Idx1,Idx2,X,Y,Z) VALUES + (273,0,0,-5763,-3433,306),(455,2,0,-4086,-2611,46), + (1699,0,0,-8933,-1986,140) +ON DUPLICATE KEY UPDATE QuestID=VALUES(QuestID); + +-- Both posters had the terrain elevation beneath the building. Mount them +-- beside the existing wanted notice on the same wall, at its height/facing. +UPDATE gameobject p JOIN gameobject ref ON ref.guid=30042496 AND ref.id=60 AND ref.map=0 +SET p.position_x=ref.position_x,p.position_y=ref.position_y+ + CASE p.guid WHEN 64905100 THEN -1.3 ELSE 1.3 END, + p.position_z=ref.position_z,p.orientation=ref.orientation, + p.rotation0=ref.rotation0,p.rotation1=ref.rotation1, + p.rotation2=ref.rotation2,p.rotation3=ref.rotation3 +WHERE p.guid IN(64905100,64905101) AND p.id=649051 AND p.map=0 + AND ABS(p.position_z-63.934)<0.01; +-- Explicit area objectives already gate completion. The legacy flag also +-- sends QuestUpdateComplete on entrance, even with kills still outstanding. +UPDATE quest_template SET Flags=Flags & ~4 WHERE (ID=455 AND Flags=12) OR (ID=1699 AND Flags=5); + +COMMIT; diff --git a/sql/custom/world/2026_11_16_61_world_local_banner_focus_and_grunt.sql b/sql/custom/world/2026_11_16_61_world_local_banner_focus_and_grunt.sql new file mode 100644 index 0000000000..51ec6db876 --- /dev/null +++ b/sql/custom/world/2026_11_16_61_world_local_banner_focus_and_grunt.sql @@ -0,0 +1,16 @@ +-- SIN's fix (1amcoff1n), Quest and World Fixes for 0.1.36, file 2026_11_14_02 renamed. +-- local_banner_focus_and_grunt: native spell 1303317 requires focus 2311. +START TRANSACTION; +INSERT INTO gameobject_template (entry,type,displayId,name,Data0,Data1) +VALUES (8380091,8,299,'Ironforge banner site (spell focus)',2311,15) +ON DUPLICATE KEY UPDATE entry=8380091; +INSERT INTO gameobject (guid,id,map,spawnDifficulties,position_x,position_y,position_z,orientation,rotation3,state) +SELECT 838009100,8380091,map,spawnDifficulties,position_x,position_y,position_z,0,1,1 +FROM creature WHERE id=269153 AND map=0 +ON DUPLICATE KEY UPDATE guid=838009100; + +-- Only this stationary Blackrock Grunt had no reachable polygon at its home. +UPDATE creature SET position_x=-9706.812,position_y=-3167.993,position_z=59.415 +WHERE guid=20006742 AND id=440 AND map=0 AND ABS(position_x+9711.56)<0.01 + AND ABS(position_y+3165.54)<0.01; +COMMIT; diff --git a/sql/custom/world/2026_11_16_62_world_local_lakeshire_poster.sql b/sql/custom/world/2026_11_16_62_world_local_lakeshire_poster.sql new file mode 100644 index 0000000000..1f329fbdf6 --- /dev/null +++ b/sql/custom/world/2026_11_16_62_world_local_lakeshire_poster.sql @@ -0,0 +1,9 @@ +-- SIN's fix (1amcoff1n), Quest and World Fixes for 0.1.36, file 2026_11_14_04 renamed. +-- local_lakeshire_poster: mount the doorway poster on the opposite jamb. +-- Viewed from outside looking north, left is toward increasing world Y. +UPDATE gameobject p JOIN gameobject ref ON ref.guid=30042496 AND ref.id=60 AND ref.map=0 +SET p.position_y=ref.position_y+7.2 +WHERE p.guid=64905101 AND p.id=649051 AND p.map=0 + AND ABS(p.position_x-ref.position_x)<0.01 + AND ABS(p.position_z-ref.position_z)<0.01 + AND ABS(p.position_y-ref.position_y-1.3)<0.01; diff --git a/sql/custom/world/2026_11_16_63_world_local_lakeshire_poster_height.sql b/sql/custom/world/2026_11_16_63_world_local_lakeshire_poster_height.sql new file mode 100644 index 0000000000..3c85d481c1 --- /dev/null +++ b/sql/custom/world/2026_11_16_63_world_local_lakeshire_poster_height.sql @@ -0,0 +1,8 @@ +-- SIN's fix (1amcoff1n), Quest and World Fixes for 0.1.36, file 2026_11_14_05 renamed. +-- local_lakeshire_poster_height: raise the two large notices beside the arch. +UPDATE gameobject p JOIN gameobject ref ON ref.guid=30042496 AND ref.id=60 AND ref.map=0 +SET p.position_z=ref.position_z+0.9 +WHERE p.id=649051 AND p.map=0 AND ABS(p.position_x-ref.position_x)<0.01 + AND ABS(p.position_z-ref.position_z)<0.01 + AND ((p.guid=64905100 AND ABS(p.position_y-ref.position_y+1.3)<0.01) + OR (p.guid=64905101 AND ABS(p.position_y-ref.position_y-7.2)<0.01)); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 55fa5d0339..a51ae9f7d7 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -2410,6 +2410,14 @@ bool GameObject::ActivateToQuest(Player const* target) const if (getLootState() == GO_NOT_READY) return false; + // Excavation Tools also drops the item that offers quest 86613. + // Enable the first interaction before the collection objective exists. + if (GetEntry() == 665282 && target->GetQuestStatus(86613) == QUEST_STATUS_NONE + && !target->HasItemCount(278049, 1, true)) + if (Quest const* quest = sObjectMgr->GetQuestTemplate(86613)) + if (target->CanTakeQuest(quest, false)) + return true; + // scan GO chest with loot including quest items if (target->GetQuestStatus(GetGOInfo()->chest.questID) == QUEST_STATUS_INCOMPLETE || LootTemplates_Gameobject.HaveQuestLootForPlayer(GetGOInfo()->chest.chestLoot, target) diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index da2351f784..8c2d777f73 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -499,7 +499,6 @@ Item::Item() m_slot = 0; uState = ITEM_NEW; - uQueuePos = -1; m_container = nullptr; m_lootGenerated = false; mb_in_trade = false; @@ -513,7 +512,20 @@ Item::Item() memset(&_bonusData, 0, sizeof(_bonusData)); } -Item::~Item() = default; +Item::~Item() +{ + DetachFromUpdateQueue(); +} + +void Item::DetachFromUpdateQueue() +{ + if (!_updateQueueOwner) + return; + auto& queue = _updateQueueOwner->GetItemUpdateQueue(); + ASSERT(uQueuePos < queue.size() && queue[uQueuePos] == this); + queue[uQueuePos] = nullptr; + _updateQueueOwner = nullptr; +} bool Item::Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const* owner) { @@ -1333,9 +1345,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer) } else { - // unset in queue - // the item must be removed from the queue manually - uQueuePos = -1; + DetachFromUpdateQueue(); uState = ITEM_UNCHANGED; } } @@ -1358,6 +1368,7 @@ void AddItemToUpdateQueueOf(Item* item, Player* player) return; player->m_itemUpdateQueue.push_back(item); + item->_updateQueueOwner = player; item->uQueuePos = player->m_itemUpdateQueue.size() - 1; } @@ -1368,18 +1379,8 @@ void RemoveItemFromUpdateQueueOf(Item* item, Player* player) ASSERT(player != nullptr); - if (player->GetGUID() != item->GetOwnerGUID()) - { - TC_LOG_DEBUG("entities.player.items", "RemoveItemFromUpdateQueueOf - Owner's guid ({}) and player's guid ({}) don't match!", - item->GetOwnerGUID().ToString(), player->GetGUID().ToString()); - return; - } - - if (player->m_itemUpdateQueueBlocked) - return; - - player->m_itemUpdateQueue[item->uQueuePos] = nullptr; - item->uQueuePos = -1; + if (item->_updateQueueOwner == player) + item->DetachFromUpdateQueue(); } uint8 Item::GetBagSlot() const diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 005581be46..3a8ec44759 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -339,8 +339,8 @@ class TC_GAME_API Item : public Object // Update States ItemUpdateState GetState() const { return uState; } void SetState(ItemUpdateState state, Player* forplayer = nullptr); - bool IsInUpdateQueue() const { return uQueuePos != -1; } - uint16 GetQueuePos() const { return uQueuePos; } + bool IsInUpdateQueue() const { return _updateQueueOwner != nullptr; } + size_t GetQueuePos() const { return uQueuePos; } void FSetState(ItemUpdateState state) // forced { uState = state; @@ -474,7 +474,9 @@ class TC_GAME_API Item : public Object uint8 m_slot; Bag* m_container; ItemUpdateState uState; - int16 uQueuePos; + Player* _updateQueueOwner = nullptr; + size_t uQueuePos = 0; + void DetachFromUpdateQueue(); bool mb_in_trade; // true if item is currently in trade-window ObjectGuid m_refundRecipient; uint64 m_paidMoney; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 7be558291b..464e94fe75 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -379,6 +379,10 @@ Player::~Player() // it must be unloaded already in PlayerLogout and accessed only for logged in player //m_social = nullptr; + for (Item* item : m_itemUpdateQueue) + if (item) + RemoveItemFromUpdateQueueOf(item, this); + // Note: buy back item already deleted from DB when player was saved for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; ++i) delete m_items[i]; @@ -22396,6 +22400,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans) if (!item) continue; + RemoveItemFromUpdateQueueOf(item, this); Bag* container = item->GetContainer(); if (item->GetState() != ITEM_REMOVED) { diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index bf8ad4772d..7822abf7a7 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -705,24 +705,24 @@ public: if (item->IsInUpdateQueue()) { - uint16 qp = item->GetQueuePos(); - if (qp > updateQueue.size()) + size_t qp = item->GetQueuePos(); + if (qp >= updateQueue.size()) { - handler->PSendSysMessage("The item with slot %d and %s has its queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUID().ToString().c_str(), qp); + handler->PSendSysMessage("The item with slot %d and %s has its queuepos (%zu) larger than the update queue size! ", item->GetSlot(), item->GetGUID().ToString().c_str(), qp); error = true; continue; } if (updateQueue[qp] == nullptr) { - handler->PSendSysMessage("The item with slot %d and %s has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().ToString().c_str(), qp); + handler->PSendSysMessage("The item with slot %d and %s has its queuepos (%zu) pointing to NULL in the queue!", item->GetSlot(), item->GetGUID().ToString().c_str(), qp); error = true; continue; } if (updateQueue[qp] != item) { - handler->PSendSysMessage("The item with slot %d and %s has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, %s)", item->GetSlot(), item->GetGUID().ToString().c_str(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().ToString().c_str()); + handler->PSendSysMessage("The item with slot %d and %s has a queuepos (%zu) that points to another item in the queue (bag: %d, slot: %d, %s)", item->GetSlot(), item->GetGUID().ToString().c_str(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().ToString().c_str()); error = true; continue; } @@ -773,24 +773,24 @@ public: if (item2->IsInUpdateQueue()) { - uint16 qp = item2->GetQueuePos(); - if (qp > updateQueue.size()) + size_t qp = item2->GetQueuePos(); + if (qp >= updateQueue.size()) { - handler->PSendSysMessage("The item in bag %d at slot %d having %s has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), qp); + handler->PSendSysMessage("The item in bag %d at slot %d having %s has a queuepos (%zu) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), qp); error = true; continue; } if (updateQueue[qp] == nullptr) { - handler->PSendSysMessage("The item in bag %d at slot %d having %s has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), qp); + handler->PSendSysMessage("The item in bag %d at slot %d having %s has a queuepos (%zu) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), qp); error = true; continue; } if (updateQueue[qp] != item2) { - handler->PSendSysMessage("The item in bag %d at slot %d having %s has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, %s)", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().ToString().c_str()); + handler->PSendSysMessage("The item in bag %d at slot %d having %s has a queuepos (%zu) that points to another item in the queue (bag: %d, slot: %d, %s)", bag->GetSlot(), item2->GetSlot(), item2->GetGUID().ToString().c_str(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUID().ToString().c_str()); error = true; continue; } diff --git a/src/server/scripts/Custom/Classic/instances/deadmines/classic_instance_deadmines.cpp b/src/server/scripts/Custom/Classic/instances/deadmines/classic_instance_deadmines.cpp index 22d5670cbe..21ec3f9d8d 100644 --- a/src/server/scripts/Custom/Classic/instances/deadmines/classic_instance_deadmines.cpp +++ b/src/server/scripts/Custom/Classic/instances/deadmines/classic_instance_deadmines.cpp @@ -235,13 +235,13 @@ public: { if (data == IN_PROGRESS) { - if (GameObject* go = instance->GetGameObject(m_uiIronCladGUID)) - { - // no breaking the door if it's open - if (!(go->GetGoState() == GO_STATE_ACTIVE)) - go->UseDoorOrButton(0, true); - m_uiIronDoorTimer = 3000; - } + GameObject* door = instance->GetGameObject(m_uiIronCladGUID); + if (!door) + return; + + if (door->GetGoState() == GO_STATE_READY) + door->UseDoorOrButton(0, true); + m_uiIronDoorTimer = 3000; } m_auiEncounter[0] = data; } @@ -341,6 +341,7 @@ public: ClassicScriptText(CDM_INST_SAY_ALARM2, mrSmite); m_uiIronDoorStep = 0; m_uiIronDoorTimer = 0; + m_auiEncounter[0] = DONE; TC_LOG_DEBUG("scripts", "Instance Deadmines: Iron door event reached end."); break; default: