Skip to content

Commit

Permalink
Multiplayer: Enable Black Mushroom Quest
Browse files Browse the repository at this point in the history
  • Loading branch information
obligaron authored and AJenbo committed Feb 7, 2023
1 parent 34d5aeb commit 2d4e84c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions Source/inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ void CheckQuestItem(Player &player, Item &questItem)
if (questItem.IDidx == IDI_MUSHROOM && Quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE && Quests[Q_MUSHROOM]._qvar1 == QS_MUSHSPAWNED) {
player.Say(HeroSpeech::NowThatsOneBigMushroom, 10); // BUGFIX: Voice for this quest might be wrong in MP
Quests[Q_MUSHROOM]._qvar1 = QS_MUSHPICKED;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
}

if (questItem.IDidx == IDI_ANVIL && Quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) {
Expand Down
13 changes: 9 additions & 4 deletions Source/objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2140,8 +2140,13 @@ void OperateMushroomPatch(const Player &player, Object &mushroomPatch)

PlaySfxLoc(IS_CHEST, mushroomPatch.position);
Point pos = GetSuperItemLoc(mushroomPatch.position);
SpawnQuestItem(IDI_MUSHROOM, pos, 0, 0, true);
Quests[Q_MUSHROOM]._qvar1 = QS_MUSHSPAWNED;

if (&player == MyPlayer) {
SpawnQuestItem(IDI_MUSHROOM, pos, 0, 0, true);
Quests[Q_MUSHROOM]._qvar1 = QS_MUSHSPAWNED;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
NetSendCmdLoc(MyPlayerId, false, CMD_OPERATEOBJ, mushroomPatch.position);
}
}

void OperateInnSignChest(const Player &player, Object &questContainer, bool sendmsg)
Expand Down Expand Up @@ -3810,7 +3815,7 @@ void InitObjects()
AdvanceRndSeed();
if (currlevel == 9 && !gbIsMultiplayer)
AddSlainHero();
if (currlevel == Quests[Q_MUSHROOM]._qlevel && Quests[Q_MUSHROOM]._qactive == QUEST_INIT)
if (Quests[Q_MUSHROOM].IsAvailable())
AddMushPatch();

if (currlevel == 4 || currlevel == 8 || currlevel == 12)
Expand Down Expand Up @@ -4538,7 +4543,7 @@ void DeltaSyncOpObject(Object &object)
UpdateState(object, 3);
break;
case OBJ_MUSHPATCH:
if (Quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) {
if (Quests[Q_MUSHROOM]._qvar1 >= QS_MUSHSPAWNED) {
UpdateState(object, object._oAnimFrame + 1);
}
break;
Expand Down
7 changes: 6 additions & 1 deletion Source/towners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ void TalkToWitch(Player &player, Towner & /*witch*/)
Quests[Q_MUSHROOM]._qactive = QUEST_ACTIVE;
Quests[Q_MUSHROOM]._qlog = true;
Quests[Q_MUSHROOM]._qvar1 = QS_TOMEGIVEN;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
InitQTextMsg(TEXT_MUSH8);
return;
}
Expand All @@ -431,24 +432,27 @@ void TalkToWitch(Player &player, Towner & /*witch*/)
QuestDialogTable[TOWN_HEALER][Q_MUSHROOM] = TEXT_MUSH3;
QuestDialogTable[TOWN_WITCH][Q_MUSHROOM] = TEXT_NONE;
Quests[Q_MUSHROOM]._qmsg = TEXT_MUSH10;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
InitQTextMsg(TEXT_MUSH10);
return;
}
if (Quests[Q_MUSHROOM]._qmsg != TEXT_MUSH9) {
Quests[Q_MUSHROOM]._qmsg = TEXT_MUSH9;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
InitQTextMsg(TEXT_MUSH9);
return;
}
}
if (Quests[Q_MUSHROOM]._qvar1 >= QS_MUSHGIVEN) {
if (HasInventoryItemWithId(player, IDI_BRAIN)) {
Quests[Q_MUSHROOM]._qmsg = TEXT_MUSH11;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
InitQTextMsg(TEXT_MUSH11);
return;
}
if (HasInventoryOrBeltItemWithId(player, IDI_SPECELIX)) {
InitQTextMsg(TEXT_MUSH12);
Quests[Q_MUSHROOM]._qactive = QUEST_DONE;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
// Ensure Spectral Elixir is usable after the quest is finished
for (Item &item : InventoryAndBeltPlayerItemsRange { player }) {
item.updateRequiredStatsCacheForPlayer(player);
Expand Down Expand Up @@ -508,6 +512,7 @@ void TalkToHealer(Player &player, Towner &healer)
InitQTextMsg(TEXT_MUSH4);
Quests[Q_MUSHROOM]._qvar1 = QS_BRAINGIVEN;
QuestDialogTable[TOWN_HEALER][Q_MUSHROOM] = TEXT_NONE;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
return;
}
}
Expand Down

0 comments on commit 2d4e84c

Please sign in to comment.