From deee72b0bce73100d83156f5d1adb00d03a05426 Mon Sep 17 00:00:00 2001 From: obligaron Date: Thu, 18 May 2023 09:03:29 +0200 Subject: [PATCH] Move Zhar talk logic (spawn item) to TalktoMonster --- Source/monster.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Source/monster.cpp b/Source/monster.cpp index 3fb5aabf7..3fc8c7e8b 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1421,16 +1421,6 @@ void MonsterTalk(Monster &monster) NetSendCmdQuest(true, Quests[Q_GARBUD]); } } - if (monster.uniqueType == UniqueMonsterType::Zhar - && monster.talkMsg == TEXT_ZHAR1 - && (monster.flags & MFLAG_QUEST_COMPLETE) == 0) { - Quests[Q_ZHAR]._qactive = QUEST_ACTIVE; - Quests[Q_ZHAR]._qlog = true; - Quests[Q_ZHAR]._qvar1 = QS_ZHAR_ITEM_SPAWNED; - CreateTypeItem(monster.position.tile + Displacement { 1, 1 }, false, ItemType::Misc, IMISC_BOOK, false, false, true); - monster.flags |= MFLAG_QUEST_COMPLETE; - NetSendCmdQuest(true, Quests[Q_ZHAR]); - } if (monster.uniqueType == UniqueMonsterType::SnotSpill) { if (monster.talkMsg == TEXT_BANNER10 && (monster.flags & MFLAG_QUEST_COMPLETE) == 0) { ObjChangeMap(SetPiece.position.x, SetPiece.position.y, SetPiece.position.x + (SetPiece.size.width / 2) + 2, SetPiece.position.y + (SetPiece.size.height / 2) - 2); @@ -4503,7 +4493,8 @@ Monster *PreSpawnSkeleton() void TalktoMonster(Player &player, Monster &monster) { monster.mode = MonsterMode::Talk; - if (monster.ai != MonsterAIID::Snotspill && monster.ai != MonsterAIID::Lachdanan) { + + if (IsNoneOf(monster.ai, MonsterAIID::Snotspill, MonsterAIID::Lachdanan, MonsterAIID::Zhar)) { return; } @@ -4527,6 +4518,18 @@ void TalktoMonster(Player &player, Monster &monster) } } } + if (monster.uniqueType == UniqueMonsterType::Zhar + && monster.talkMsg == TEXT_ZHAR1 + && (monster.flags & MFLAG_QUEST_COMPLETE) == 0) { + if (MyPlayer == &player) { + Quests[Q_ZHAR]._qactive = QUEST_ACTIVE; + Quests[Q_ZHAR]._qlog = true; + Quests[Q_ZHAR]._qvar1 = QS_ZHAR_ITEM_SPAWNED; + CreateTypeItem(monster.position.tile + Displacement { 1, 1 }, false, ItemType::Misc, IMISC_BOOK, false, false, true); + monster.flags |= MFLAG_QUEST_COMPLETE; + NetSendCmdQuest(true, Quests[Q_ZHAR]); + } + } } void SpawnGolem(Player &player, Monster &golem, Point position, Missile &missile)