Make NetSendCmdQuest() take a quest structure as input
This commit is contained in:
parent
4891258775
commit
5ddcd90ff9
8 changed files with 213 additions and 180 deletions
|
|
@ -225,11 +225,12 @@ std::string DebugCmdQuest(const std::string_view parameter)
|
|||
|
||||
if (questId >= MAXQUESTS)
|
||||
return fmt::format("Quest {} is not known. Do you want to write a mod?", questId);
|
||||
auto &quest = Quests[questId];
|
||||
|
||||
if (IsNoneOf(Quests[questId]._qactive, QUEST_NOTAVAIL, QUEST_INIT))
|
||||
if (IsNoneOf(quest._qactive, QUEST_NOTAVAIL, QUEST_INIT))
|
||||
return fmt::format("{} was already given.", QuestData[questId]._qlstr);
|
||||
|
||||
Quests[questId]._qactive = QUEST_ACTIVE;
|
||||
quest._qactive = QUEST_ACTIVE;
|
||||
|
||||
return fmt::format("{} enabled.", QuestData[questId]._qlstr);
|
||||
}
|
||||
|
|
@ -343,7 +344,8 @@ void PrintDebugQuest()
|
|||
{
|
||||
char dstr[128];
|
||||
|
||||
sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", DebugQuestId, Quests[DebugQuestId]._qactive, Quests[DebugQuestId]._qvar1);
|
||||
auto &quest = Quests[DebugQuestId];
|
||||
sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", DebugQuestId, quest._qactive, quest._qvar1);
|
||||
NetSendCmdString(1 << MyPlayerId, dstr);
|
||||
|
||||
DebugQuestId++;
|
||||
|
|
|
|||
|
|
@ -1786,18 +1786,20 @@ int InvPutItem(PlayerStruct &player, Point position)
|
|||
if (player.HoldItem._iCurs == ICURS_RUNE_BOMB && xp >= 79 && xp <= 82 && yp >= 61 && yp <= 64) {
|
||||
Displacement relativePosition = position - player.position.tile;
|
||||
NetSendCmdLocParam2(false, CMD_OPENHIVE, player.position.tile, relativePosition.deltaX, relativePosition.deltaY);
|
||||
Quests[Q_FARMER]._qactive = QUEST_DONE;
|
||||
auto &quest = Quests[Q_FARMER];
|
||||
quest._qactive = QUEST_DONE;
|
||||
if (gbIsMultiplayer) {
|
||||
NetSendCmdQuest(true, Q_FARMER);
|
||||
NetSendCmdQuest(true, quest);
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (player.HoldItem.IDidx == IDI_MAPOFDOOM && xp >= 35 && xp <= 38 && yp >= 20 && yp <= 24) {
|
||||
NetSendCmd(false, CMD_OPENCRYPT);
|
||||
Quests[Q_GRAVE]._qactive = QUEST_DONE;
|
||||
auto &quest = Quests[Q_GRAVE];
|
||||
quest._qactive = QUEST_DONE;
|
||||
if (gbIsMultiplayer) {
|
||||
NetSendCmdQuest(true, Q_GRAVE);
|
||||
NetSendCmdQuest(true, quest);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -738,28 +738,28 @@ void LoadPremium(LoadHelper *file, int i)
|
|||
|
||||
void LoadQuest(LoadHelper *file, int i)
|
||||
{
|
||||
QuestStruct *pQuest = &Quests[i];
|
||||
auto &quest = Quests[i];
|
||||
|
||||
pQuest->_qlevel = file->NextLE<uint8_t>();
|
||||
quest._qlevel = file->NextLE<uint8_t>();
|
||||
file->Skip<uint8_t>(); // _qtype, identical to _qidx
|
||||
pQuest->_qactive = static_cast<quest_state>(file->NextLE<uint8_t>());
|
||||
pQuest->_qlvltype = static_cast<dungeon_type>(file->NextLE<uint8_t>());
|
||||
pQuest->position.x = file->NextLE<int32_t>();
|
||||
pQuest->position.y = file->NextLE<int32_t>();
|
||||
pQuest->_qslvl = static_cast<_setlevels>(file->NextLE<uint8_t>());
|
||||
pQuest->_qidx = static_cast<quest_id>(file->NextLE<uint8_t>());
|
||||
quest._qactive = static_cast<quest_state>(file->NextLE<uint8_t>());
|
||||
quest._qlvltype = static_cast<dungeon_type>(file->NextLE<uint8_t>());
|
||||
quest.position.x = file->NextLE<int32_t>();
|
||||
quest.position.y = file->NextLE<int32_t>();
|
||||
quest._qslvl = static_cast<_setlevels>(file->NextLE<uint8_t>());
|
||||
quest._qidx = static_cast<quest_id>(file->NextLE<uint8_t>());
|
||||
if (gbIsHellfireSaveGame) {
|
||||
file->Skip(2); // Alignment
|
||||
pQuest->_qmsg = static_cast<_speech_id>(file->NextLE<int32_t>());
|
||||
quest._qmsg = static_cast<_speech_id>(file->NextLE<int32_t>());
|
||||
} else {
|
||||
pQuest->_qmsg = static_cast<_speech_id>(file->NextLE<uint8_t>());
|
||||
quest._qmsg = static_cast<_speech_id>(file->NextLE<uint8_t>());
|
||||
}
|
||||
pQuest->_qvar1 = file->NextLE<uint8_t>();
|
||||
pQuest->_qvar2 = file->NextLE<uint8_t>();
|
||||
quest._qvar1 = file->NextLE<uint8_t>();
|
||||
quest._qvar2 = file->NextLE<uint8_t>();
|
||||
file->Skip(2); // Alignment
|
||||
if (!gbIsHellfireSaveGame)
|
||||
file->Skip(1); // Alignment
|
||||
pQuest->_qlog = file->NextBool32();
|
||||
quest._qlog = file->NextBool32();
|
||||
|
||||
ReturnLvlX = file->NextBE<int32_t>();
|
||||
ReturnLvlY = file->NextBE<int32_t>();
|
||||
|
|
@ -1381,28 +1381,28 @@ void SavePremium(SaveHelper *file, int i)
|
|||
|
||||
void SaveQuest(SaveHelper *file, int i)
|
||||
{
|
||||
QuestStruct *pQuest = &Quests[i];
|
||||
auto &quest = Quests[i];
|
||||
|
||||
file->WriteLE<uint8_t>(pQuest->_qlevel);
|
||||
file->WriteLE<uint8_t>(pQuest->_qidx); // _qtype for compatability, used in DRLG_CheckQuests
|
||||
file->WriteLE<uint8_t>(pQuest->_qactive);
|
||||
file->WriteLE<uint8_t>(pQuest->_qlvltype);
|
||||
file->WriteLE<int32_t>(pQuest->position.x);
|
||||
file->WriteLE<int32_t>(pQuest->position.y);
|
||||
file->WriteLE<uint8_t>(pQuest->_qslvl);
|
||||
file->WriteLE<uint8_t>(pQuest->_qidx);
|
||||
file->WriteLE<uint8_t>(quest._qlevel);
|
||||
file->WriteLE<uint8_t>(quest._qidx); // _qtype for compatability, used in DRLG_CheckQuests
|
||||
file->WriteLE<uint8_t>(quest._qactive);
|
||||
file->WriteLE<uint8_t>(quest._qlvltype);
|
||||
file->WriteLE<int32_t>(quest.position.x);
|
||||
file->WriteLE<int32_t>(quest.position.y);
|
||||
file->WriteLE<uint8_t>(quest._qslvl);
|
||||
file->WriteLE<uint8_t>(quest._qidx);
|
||||
if (gbIsHellfire) {
|
||||
file->Skip(2); // Alignment
|
||||
file->WriteLE<int32_t>(pQuest->_qmsg);
|
||||
file->WriteLE<int32_t>(quest._qmsg);
|
||||
} else {
|
||||
file->WriteLE<uint8_t>(pQuest->_qmsg);
|
||||
file->WriteLE<uint8_t>(quest._qmsg);
|
||||
}
|
||||
file->WriteLE<uint8_t>(pQuest->_qvar1);
|
||||
file->WriteLE<uint8_t>(pQuest->_qvar2);
|
||||
file->WriteLE<uint8_t>(quest._qvar1);
|
||||
file->WriteLE<uint8_t>(quest._qvar2);
|
||||
file->Skip(2); // Alignment
|
||||
if (!gbIsHellfire)
|
||||
file->Skip(1); // Alignment
|
||||
file->WriteLE<uint32_t>(pQuest->_qlog ? 1 : 0);
|
||||
file->WriteLE<uint32_t>(quest._qlog ? 1 : 0);
|
||||
|
||||
file->WriteBE<int32_t>(ReturnLvlX);
|
||||
file->WriteBE<int32_t>(ReturnLvlY);
|
||||
|
|
|
|||
|
|
@ -1061,9 +1061,10 @@ void StartEating(MonsterStruct &monster)
|
|||
void DiabloDeath(MonsterStruct &diablo, bool sendmsg)
|
||||
{
|
||||
PlaySFX(USFX_DIABLOD);
|
||||
Quests[Q_DIABLO]._qactive = QUEST_DONE;
|
||||
auto &quest = Quests[Q_DIABLO];
|
||||
quest._qactive = QUEST_DONE;
|
||||
if (sendmsg)
|
||||
NetSendCmdQuest(true, Q_DIABLO);
|
||||
NetSendCmdQuest(true, quest);
|
||||
sgbSaveSoundOn = gbSoundOn;
|
||||
gbProcessPlayers = false;
|
||||
for (int j = 0; j < ActiveMonsterCount; j++) {
|
||||
|
|
|
|||
|
|
@ -2313,15 +2313,15 @@ void NetSendCmdParam3(bool bHiPri, _cmd_id bCmd, uint16_t wParam1, uint16_t wPar
|
|||
NetSendLoPri(MyPlayerId, (byte *)&cmd, sizeof(cmd));
|
||||
}
|
||||
|
||||
void NetSendCmdQuest(bool bHiPri, BYTE q)
|
||||
void NetSendCmdQuest(bool bHiPri, const QuestStruct &quest)
|
||||
{
|
||||
TCmdQuest cmd;
|
||||
|
||||
cmd.q = q;
|
||||
cmd.bCmd = CMD_SYNCQUEST;
|
||||
cmd.qstate = Quests[q]._qactive;
|
||||
cmd.qlog = Quests[q]._qlog ? 1 : 0;
|
||||
cmd.qvar1 = Quests[q]._qvar1;
|
||||
cmd.q = quest._qidx,
|
||||
cmd.qstate = quest._qactive;
|
||||
cmd.qlog = quest._qlog ? 1 : 0;
|
||||
cmd.qvar1 = quest._qvar1;
|
||||
|
||||
if (bHiPri)
|
||||
NetSendHiPri(MyPlayerId, (byte *)&cmd, sizeof(cmd));
|
||||
else
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ struct TCmdGolem {
|
|||
|
||||
struct TCmdQuest {
|
||||
_cmd_id bCmd;
|
||||
uint8_t q;
|
||||
int8_t q;
|
||||
quest_state qstate;
|
||||
uint8_t qlog;
|
||||
uint8_t qvar1;
|
||||
|
|
@ -431,7 +431,7 @@ void NetSendCmdLocParam3(bool bHiPri, _cmd_id bCmd, Point position, uint16_t wPa
|
|||
void NetSendCmdParam1(bool bHiPri, _cmd_id bCmd, uint16_t wParam1);
|
||||
void NetSendCmdParam2(bool bHiPri, _cmd_id bCmd, uint16_t wParam1, uint16_t wParam2);
|
||||
void NetSendCmdParam3(bool bHiPri, _cmd_id bCmd, uint16_t wParam1, uint16_t wParam2, uint16_t wParam3);
|
||||
void NetSendCmdQuest(bool bHiPri, BYTE q);
|
||||
void NetSendCmdQuest(bool bHiPri, const QuestStruct &quest);
|
||||
void NetSendCmdGItem(bool bHiPri, _cmd_id bCmd, BYTE mast, BYTE pnum, BYTE ii);
|
||||
void NetSendCmdPItem(bool bHiPri, _cmd_id bCmd, Point position);
|
||||
void NetSendCmdChItem(bool bHiPri, BYTE bLoc);
|
||||
|
|
|
|||
|
|
@ -337,40 +337,41 @@ void CheckQuests()
|
|||
if (gbIsSpawn)
|
||||
return;
|
||||
|
||||
if (Quests[Q_BETRAYER].IsAvailable() && gbIsMultiplayer && Quests[Q_BETRAYER]._qvar1 == 2) {
|
||||
auto &quest = Quests[Q_BETRAYER];
|
||||
if (quest.IsAvailable() && gbIsMultiplayer && quest._qvar1 == 2) {
|
||||
AddObject(OBJ_ALTBOY, { 2 * setpc_x + 20, 2 * setpc_y + 22 });
|
||||
Quests[Q_BETRAYER]._qvar1 = 3;
|
||||
NetSendCmdQuest(true, Q_BETRAYER);
|
||||
quest._qvar1 = 3;
|
||||
NetSendCmdQuest(true, quest);
|
||||
}
|
||||
|
||||
if (gbIsMultiplayer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currlevel == Quests[Q_BETRAYER]._qlevel
|
||||
if (currlevel == quest._qlevel
|
||||
&& !setlevel
|
||||
&& Quests[Q_BETRAYER]._qvar1 >= 2
|
||||
&& (Quests[Q_BETRAYER]._qactive == QUEST_ACTIVE || Quests[Q_BETRAYER]._qactive == QUEST_DONE)
|
||||
&& (Quests[Q_BETRAYER]._qvar2 == 0 || Quests[Q_BETRAYER]._qvar2 == 2)) {
|
||||
Quests[Q_BETRAYER].position.x = 2 * Quests[Q_BETRAYER].position.x + 16;
|
||||
Quests[Q_BETRAYER].position.y = 2 * Quests[Q_BETRAYER].position.y + 16;
|
||||
int rportx = Quests[Q_BETRAYER].position.x;
|
||||
int rporty = Quests[Q_BETRAYER].position.y;
|
||||
&& quest._qvar1 >= 2
|
||||
&& (quest._qactive == QUEST_ACTIVE || quest._qactive == QUEST_DONE)
|
||||
&& (quest._qvar2 == 0 || quest._qvar2 == 2)) {
|
||||
quest.position.x = 2 * quest.position.x + 16;
|
||||
quest.position.y = 2 * quest.position.y + 16;
|
||||
int rportx = quest.position.x;
|
||||
int rporty = quest.position.y;
|
||||
AddMissile({ rportx, rporty }, { rportx, rporty }, 0, MIS_RPORTAL, TARGET_MONSTERS, MyPlayerId, 0, 0);
|
||||
Quests[Q_BETRAYER]._qvar2 = 1;
|
||||
if (Quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) {
|
||||
Quests[Q_BETRAYER]._qvar1 = 3;
|
||||
quest._qvar2 = 1;
|
||||
if (quest._qactive == QUEST_ACTIVE) {
|
||||
quest._qvar1 = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (Quests[Q_BETRAYER]._qactive == QUEST_DONE
|
||||
if (quest._qactive == QUEST_DONE
|
||||
&& setlevel
|
||||
&& setlvlnum == SL_VILEBETRAYER
|
||||
&& Quests[Q_BETRAYER]._qvar2 == 4) {
|
||||
&& quest._qvar2 == 4) {
|
||||
int rportx = 35;
|
||||
int rporty = 32;
|
||||
AddMissile({ rportx, rporty }, { rportx, rporty }, 0, MIS_RPORTAL, TARGET_MONSTERS, MyPlayerId, 0, 0);
|
||||
Quests[Q_BETRAYER]._qvar2 = 3;
|
||||
quest._qvar2 = 3;
|
||||
}
|
||||
|
||||
if (setlevel) {
|
||||
|
|
@ -437,16 +438,18 @@ void CheckQuestKill(const MonsterStruct &monster, bool sendmsg)
|
|||
auto &myPlayer = Players[MyPlayerId];
|
||||
|
||||
if (monster.MType->mtype == MT_SKING) {
|
||||
Quests[Q_SKELKING]._qactive = QUEST_DONE;
|
||||
auto &quest = Quests[Q_SKELKING];
|
||||
quest._qactive = QUEST_DONE;
|
||||
myPlayer.Say(HeroSpeech::RestWellLeoricIllFindYourSon, 30);
|
||||
if (sendmsg)
|
||||
NetSendCmdQuest(true, Q_SKELKING);
|
||||
NetSendCmdQuest(true, quest);
|
||||
|
||||
} else if (monster.MType->mtype == MT_CLEAVER) {
|
||||
Quests[Q_BUTCHER]._qactive = QUEST_DONE;
|
||||
auto &quest = Quests[Q_BUTCHER];
|
||||
quest._qactive = QUEST_DONE;
|
||||
myPlayer.Say(HeroSpeech::TheSpiritsOfTheDeadAreNowAvenged, 30);
|
||||
if (sendmsg)
|
||||
NetSendCmdQuest(true, Q_BUTCHER);
|
||||
NetSendCmdQuest(true, quest);
|
||||
} else if (monster._uniqtype - 1 == UMT_GARBUD) { //"Gharbad the Weak"
|
||||
Quests[Q_GARBUD]._qactive = QUEST_DONE;
|
||||
myPlayer.Say(HeroSpeech::ImNotImpressed, 30);
|
||||
|
|
@ -454,9 +457,11 @@ void CheckQuestKill(const MonsterStruct &monster, bool sendmsg)
|
|||
Quests[Q_ZHAR]._qactive = QUEST_DONE;
|
||||
myPlayer.Say(HeroSpeech::ImSorryDidIBreakYourConcentration, 30);
|
||||
} else if (monster._uniqtype - 1 == UMT_LAZARUS && gbIsMultiplayer) { //"Arch-Bishop Lazarus"
|
||||
Quests[Q_BETRAYER]._qactive = QUEST_DONE;
|
||||
Quests[Q_BETRAYER]._qvar1 = 7;
|
||||
Quests[Q_DIABLO]._qactive = QUEST_ACTIVE;
|
||||
auto &betrayerQuest = Quests[Q_BETRAYER];
|
||||
auto &diabloQuest = Quests[Q_DIABLO];
|
||||
betrayerQuest._qactive = QUEST_DONE;
|
||||
betrayerQuest._qvar1 = 7;
|
||||
diabloQuest._qactive = QUEST_ACTIVE;
|
||||
|
||||
for (int j = 0; j < MAXDUNY; j++) {
|
||||
for (int i = 0; i < MAXDUNX; i++) {
|
||||
|
|
@ -469,8 +474,8 @@ void CheckQuestKill(const MonsterStruct &monster, bool sendmsg)
|
|||
}
|
||||
myPlayer.Say(HeroSpeech::YourMadnessEndsHereBetrayer, 30);
|
||||
if (sendmsg) {
|
||||
NetSendCmdQuest(true, Q_BETRAYER);
|
||||
NetSendCmdQuest(true, Q_DIABLO);
|
||||
NetSendCmdQuest(true, betrayerQuest);
|
||||
NetSendCmdQuest(true, diabloQuest);
|
||||
}
|
||||
} else if (monster._uniqtype - 1 == UMT_LAZARUS && !gbIsMultiplayer) { //"Arch-Bishop Lazarus"
|
||||
Quests[Q_BETRAYER]._qactive = QUEST_DONE;
|
||||
|
|
@ -589,39 +594,52 @@ void ResyncMPQuests()
|
|||
if (gbIsSpawn)
|
||||
return;
|
||||
|
||||
if (Quests[Q_SKELKING]._qactive == QUEST_INIT
|
||||
&& currlevel >= Quests[Q_SKELKING]._qlevel - 1
|
||||
&& currlevel <= Quests[Q_SKELKING]._qlevel + 1) {
|
||||
Quests[Q_SKELKING]._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, Q_SKELKING);
|
||||
auto &kingQuest = Quests[Q_SKELKING];
|
||||
if (kingQuest._qactive == QUEST_INIT
|
||||
&& currlevel >= kingQuest._qlevel - 1
|
||||
&& currlevel <= kingQuest._qlevel + 1) {
|
||||
kingQuest._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, kingQuest);
|
||||
}
|
||||
if (Quests[Q_BUTCHER]._qactive == QUEST_INIT
|
||||
&& currlevel >= Quests[Q_BUTCHER]._qlevel - 1
|
||||
&& currlevel <= Quests[Q_BUTCHER]._qlevel + 1) {
|
||||
Quests[Q_BUTCHER]._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, Q_BUTCHER);
|
||||
|
||||
auto &butcherQuest = Quests[Q_BUTCHER];
|
||||
if (butcherQuest._qactive == QUEST_INIT
|
||||
&& currlevel >= butcherQuest._qlevel - 1
|
||||
&& currlevel <= butcherQuest._qlevel + 1) {
|
||||
butcherQuest._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, butcherQuest);
|
||||
}
|
||||
if (Quests[Q_BETRAYER]._qactive == QUEST_INIT && currlevel == Quests[Q_BETRAYER]._qlevel - 1) {
|
||||
Quests[Q_BETRAYER]._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, Q_BETRAYER);
|
||||
|
||||
auto &betrayerQuest = Quests[Q_BETRAYER];
|
||||
if (betrayerQuest._qactive == QUEST_INIT && currlevel == betrayerQuest._qlevel - 1) {
|
||||
betrayerQuest._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, betrayerQuest);
|
||||
}
|
||||
if (Quests[Q_BETRAYER].IsAvailable())
|
||||
if (betrayerQuest.IsAvailable())
|
||||
AddObject(OBJ_ALTBOY, { 2 * setpc_x + 20, 2 * setpc_y + 22 });
|
||||
if (Quests[Q_GRAVE]._qactive == QUEST_INIT && currlevel == Quests[Q_GRAVE]._qlevel - 1) {
|
||||
Quests[Q_GRAVE]._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, Q_GRAVE);
|
||||
|
||||
auto &cryptQuest = Quests[Q_GRAVE];
|
||||
if (cryptQuest._qactive == QUEST_INIT && currlevel == cryptQuest._qlevel - 1) {
|
||||
cryptQuest._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, cryptQuest);
|
||||
}
|
||||
if (Quests[Q_DEFILER]._qactive == QUEST_INIT && currlevel == Quests[Q_DEFILER]._qlevel - 1) {
|
||||
Quests[Q_DEFILER]._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, Q_DEFILER);
|
||||
|
||||
auto &defilerQuest = Quests[Q_DEFILER];
|
||||
if (defilerQuest._qactive == QUEST_INIT && currlevel == defilerQuest._qlevel - 1) {
|
||||
defilerQuest._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, defilerQuest);
|
||||
}
|
||||
if (Quests[Q_NAKRUL]._qactive == QUEST_INIT && currlevel == Quests[Q_NAKRUL]._qlevel - 1) {
|
||||
Quests[Q_NAKRUL]._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, Q_NAKRUL);
|
||||
|
||||
auto &nakrulQuest = Quests[Q_NAKRUL];
|
||||
if (nakrulQuest._qactive == QUEST_INIT && currlevel == nakrulQuest._qlevel - 1) {
|
||||
nakrulQuest._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, nakrulQuest);
|
||||
}
|
||||
if (Quests[Q_JERSEY]._qactive == QUEST_INIT && currlevel == Quests[Q_JERSEY]._qlevel - 1) {
|
||||
Quests[Q_JERSEY]._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, Q_JERSEY);
|
||||
|
||||
auto &cowQuest = Quests[Q_JERSEY];
|
||||
if (cowQuest._qactive == QUEST_INIT && currlevel == cowQuest._qlevel - 1) {
|
||||
cowQuest._qactive = QUEST_ACTIVE;
|
||||
NetSendCmdQuest(true, cowQuest);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,45 +297,47 @@ void TalkToBarOwner(PlayerStruct &player, TownerStruct &barOwner)
|
|||
return;
|
||||
}
|
||||
|
||||
if (Quests[Q_SKELKING]._qactive != QUEST_NOTAVAIL) {
|
||||
auto &kingQuest = Quests[Q_SKELKING];
|
||||
if (kingQuest._qactive != QUEST_NOTAVAIL) {
|
||||
if (player._pLvlVisited[2] || player._pLvlVisited[4]) {
|
||||
if (Quests[Q_SKELKING]._qvar2 == 0) {
|
||||
Quests[Q_SKELKING]._qvar2 = 1;
|
||||
Quests[Q_SKELKING]._qlog = true;
|
||||
if (Quests[Q_SKELKING]._qactive == QUEST_INIT) {
|
||||
Quests[Q_SKELKING]._qactive = QUEST_ACTIVE;
|
||||
Quests[Q_SKELKING]._qvar1 = 1;
|
||||
if (kingQuest._qvar2 == 0) {
|
||||
kingQuest._qvar2 = 1;
|
||||
kingQuest._qlog = true;
|
||||
if (kingQuest._qactive == QUEST_INIT) {
|
||||
kingQuest._qactive = QUEST_ACTIVE;
|
||||
kingQuest._qvar1 = 1;
|
||||
}
|
||||
InitQTextMsg(TEXT_KING2);
|
||||
NetSendCmdQuest(true, Q_SKELKING);
|
||||
NetSendCmdQuest(true, kingQuest);
|
||||
return;
|
||||
}
|
||||
if (Quests[Q_SKELKING]._qactive == QUEST_DONE && Quests[Q_SKELKING]._qvar2 == 1) {
|
||||
Quests[Q_SKELKING]._qvar2 = 2;
|
||||
Quests[Q_SKELKING]._qvar1 = 2;
|
||||
if (kingQuest._qactive == QUEST_DONE && kingQuest._qvar2 == 1) {
|
||||
kingQuest._qvar2 = 2;
|
||||
kingQuest._qvar1 = 2;
|
||||
InitQTextMsg(TEXT_KING4);
|
||||
NetSendCmdQuest(true, Q_SKELKING);
|
||||
NetSendCmdQuest(true, kingQuest);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Quests[Q_LTBANNER]._qactive != QUEST_NOTAVAIL) {
|
||||
if (player._pLvlVisited[3] && Quests[Q_LTBANNER]._qactive != QUEST_DONE) {
|
||||
if (Quests[Q_LTBANNER]._qvar2 == 0) {
|
||||
Quests[Q_LTBANNER]._qvar2 = 1;
|
||||
if (Quests[Q_LTBANNER]._qactive == QUEST_INIT) {
|
||||
Quests[Q_LTBANNER]._qvar1 = 1;
|
||||
Quests[Q_LTBANNER]._qactive = QUEST_ACTIVE;
|
||||
auto &bannerQuest = Quests[Q_LTBANNER];
|
||||
if (bannerQuest._qactive != QUEST_NOTAVAIL) {
|
||||
if (player._pLvlVisited[3] && bannerQuest._qactive != QUEST_DONE) {
|
||||
if (bannerQuest._qvar2 == 0) {
|
||||
bannerQuest._qvar2 = 1;
|
||||
if (bannerQuest._qactive == QUEST_INIT) {
|
||||
bannerQuest._qvar1 = 1;
|
||||
bannerQuest._qactive = QUEST_ACTIVE;
|
||||
}
|
||||
Quests[Q_LTBANNER]._qlog = true;
|
||||
bannerQuest._qlog = true;
|
||||
InitQTextMsg(TEXT_BANNER2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Quests[Q_LTBANNER]._qvar2 == 1 && player.TryRemoveInvItemById(IDI_BANNER)) {
|
||||
Quests[Q_LTBANNER]._qactive = QUEST_DONE;
|
||||
Quests[Q_LTBANNER]._qvar1 = 3;
|
||||
if (bannerQuest._qvar2 == 1 && player.TryRemoveInvItemById(IDI_BANNER)) {
|
||||
bannerQuest._qactive = QUEST_DONE;
|
||||
bannerQuest._qvar1 = 3;
|
||||
SpawnUnique(UITEM_HARCREST, barOwner.position + DIR_SW);
|
||||
InitQTextMsg(TEXT_BANNER3);
|
||||
return;
|
||||
|
|
@ -349,20 +351,21 @@ void TalkToBarOwner(PlayerStruct &player, TownerStruct &barOwner)
|
|||
|
||||
void TalkToDeadguy(PlayerStruct &player, TownerStruct & /*deadguy*/)
|
||||
{
|
||||
if (Quests[Q_BUTCHER]._qactive == QUEST_DONE)
|
||||
auto &quest = Quests[Q_BUTCHER];
|
||||
if (quest._qactive == QUEST_DONE)
|
||||
return;
|
||||
|
||||
if (Quests[Q_BUTCHER]._qvar1 == 1) {
|
||||
if (quest._qvar1 == 1) {
|
||||
player.SaySpecific(HeroSpeech::YourDeathWillBeAvenged);
|
||||
return;
|
||||
}
|
||||
|
||||
Quests[Q_BUTCHER]._qactive = QUEST_ACTIVE;
|
||||
Quests[Q_BUTCHER]._qlog = true;
|
||||
Quests[Q_BUTCHER]._qmsg = TEXT_BUTCH9;
|
||||
Quests[Q_BUTCHER]._qvar1 = 1;
|
||||
quest._qactive = QUEST_ACTIVE;
|
||||
quest._qlog = true;
|
||||
quest._qmsg = TEXT_BUTCH9;
|
||||
quest._qvar1 = 1;
|
||||
InitQTextMsg(TEXT_BUTCH9);
|
||||
NetSendCmdQuest(true, Q_BUTCHER);
|
||||
NetSendCmdQuest(true, quest);
|
||||
}
|
||||
|
||||
void TalkToBlackSmith(PlayerStruct &player, TownerStruct &blackSmith)
|
||||
|
|
@ -517,29 +520,31 @@ void TalkToBoy(PlayerStruct & /*player*/, TownerStruct & /*boy*/)
|
|||
|
||||
void TalkToStoryteller(PlayerStruct &player, TownerStruct & /*storyteller*/)
|
||||
{
|
||||
auto &betrayerQuest = Quests[Q_BETRAYER];
|
||||
if (!gbIsMultiplayer) {
|
||||
if (Quests[Q_BETRAYER]._qactive == QUEST_INIT && player.TryRemoveInvItemById(IDI_LAZSTAFF)) {
|
||||
if (betrayerQuest._qactive == QUEST_INIT && player.TryRemoveInvItemById(IDI_LAZSTAFF)) {
|
||||
InitQTextMsg(TEXT_VILE1);
|
||||
Quests[Q_BETRAYER]._qlog = true;
|
||||
Quests[Q_BETRAYER]._qactive = QUEST_ACTIVE;
|
||||
Quests[Q_BETRAYER]._qvar1 = 2;
|
||||
betrayerQuest._qlog = true;
|
||||
betrayerQuest._qactive = QUEST_ACTIVE;
|
||||
betrayerQuest._qvar1 = 2;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (Quests[Q_BETRAYER]._qactive == QUEST_ACTIVE && !Quests[Q_BETRAYER]._qlog) {
|
||||
if (betrayerQuest._qactive == QUEST_ACTIVE && !betrayerQuest._qlog) {
|
||||
InitQTextMsg(TEXT_VILE1);
|
||||
Quests[Q_BETRAYER]._qlog = true;
|
||||
NetSendCmdQuest(true, Q_BETRAYER);
|
||||
betrayerQuest._qlog = true;
|
||||
NetSendCmdQuest(true, betrayerQuest);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Quests[Q_BETRAYER]._qactive == QUEST_DONE && Quests[Q_BETRAYER]._qvar1 == 7) {
|
||||
Quests[Q_BETRAYER]._qvar1 = 8;
|
||||
if (betrayerQuest._qactive == QUEST_DONE && betrayerQuest._qvar1 == 7) {
|
||||
betrayerQuest._qvar1 = 8;
|
||||
InitQTextMsg(TEXT_VILE3);
|
||||
Quests[Q_DIABLO]._qlog = true;
|
||||
auto &diabloQuest = Quests[Q_DIABLO];
|
||||
diabloQuest._qlog = true;
|
||||
if (gbIsMultiplayer) {
|
||||
NetSendCmdQuest(true, Q_BETRAYER);
|
||||
NetSendCmdQuest(true, Q_DIABLO);
|
||||
NetSendCmdQuest(true, betrayerQuest);
|
||||
NetSendCmdQuest(true, diabloQuest);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -580,17 +585,18 @@ void TalkToCow(PlayerStruct &player, TownerStruct &cow)
|
|||
|
||||
void TalkToFarmer(PlayerStruct &player, TownerStruct &farmer)
|
||||
{
|
||||
switch (Quests[Q_FARMER]._qactive) {
|
||||
auto &quest = Quests[Q_FARMER];
|
||||
switch (quest._qactive) {
|
||||
case QUEST_NOTAVAIL:
|
||||
case QUEST_INIT:
|
||||
if (player.HasItem(IDI_RUNEBOMB)) {
|
||||
InitQTextMsg(TEXT_FARMER2);
|
||||
Quests[Q_FARMER]._qactive = QUEST_ACTIVE;
|
||||
Quests[Q_FARMER]._qvar1 = 1;
|
||||
Quests[Q_FARMER]._qmsg = TEXT_FARMER1;
|
||||
Quests[Q_FARMER]._qlog = true;
|
||||
quest._qactive = QUEST_ACTIVE;
|
||||
quest._qvar1 = 1;
|
||||
quest._qmsg = TEXT_FARMER1;
|
||||
quest._qlog = true;
|
||||
if (gbIsMultiplayer)
|
||||
NetSendCmdQuest(true, Q_FARMER);
|
||||
NetSendCmdQuest(true, quest);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -607,13 +613,13 @@ void TalkToFarmer(PlayerStruct &player, TownerStruct &farmer)
|
|||
}
|
||||
|
||||
InitQTextMsg(TEXT_FARMER1);
|
||||
Quests[Q_FARMER]._qactive = QUEST_ACTIVE;
|
||||
Quests[Q_FARMER]._qvar1 = 1;
|
||||
Quests[Q_FARMER]._qlog = true;
|
||||
Quests[Q_FARMER]._qmsg = TEXT_FARMER1;
|
||||
quest._qactive = QUEST_ACTIVE;
|
||||
quest._qvar1 = 1;
|
||||
quest._qlog = true;
|
||||
quest._qmsg = TEXT_FARMER1;
|
||||
SpawnRuneBomb(farmer.position + Displacement { 1, 0 });
|
||||
if (gbIsMultiplayer)
|
||||
NetSendCmdQuest(true, Q_FARMER);
|
||||
NetSendCmdQuest(true, quest);
|
||||
break;
|
||||
case QUEST_ACTIVE:
|
||||
InitQTextMsg(player.HasItem(IDI_RUNEBOMB) ? TEXT_FARMER2 : TEXT_FARMER3);
|
||||
|
|
@ -621,10 +627,10 @@ void TalkToFarmer(PlayerStruct &player, TownerStruct &farmer)
|
|||
case QUEST_DONE:
|
||||
InitQTextMsg(TEXT_FARMER4);
|
||||
SpawnRewardItem(IDI_AURIC, farmer.position + Displacement { 1, 0 });
|
||||
Quests[Q_FARMER]._qactive = QUEST_HIVE_DONE;
|
||||
Quests[Q_FARMER]._qlog = false;
|
||||
quest._qactive = QUEST_HIVE_DONE;
|
||||
quest._qlog = false;
|
||||
if (gbIsMultiplayer)
|
||||
NetSendCmdQuest(true, Q_FARMER);
|
||||
NetSendCmdQuest(true, quest);
|
||||
break;
|
||||
case QUEST_HIVE_DONE:
|
||||
break;
|
||||
|
|
@ -641,30 +647,32 @@ void TalkToCowFarmer(PlayerStruct &player, TownerStruct &cowFarmer)
|
|||
return;
|
||||
}
|
||||
|
||||
auto &quest = Quests[Q_JERSEY];
|
||||
|
||||
if (player.TryRemoveInvItemById(IDI_BROWNSUIT)) {
|
||||
SpawnUnique(UITEM_BOVINE, cowFarmer.position + DIR_SE);
|
||||
InitQTextMsg(TEXT_JERSEY8);
|
||||
Quests[Q_JERSEY]._qactive = QUEST_DONE;
|
||||
quest._qactive = QUEST_DONE;
|
||||
LoadTownerAnimations(cowFarmer, "Towners\\Farmer\\mfrmrn2.CEL", 15, DIR_SW, 3);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.HasItem(IDI_RUNEBOMB)) {
|
||||
InitQTextMsg(TEXT_JERSEY5);
|
||||
Quests[Q_JERSEY]._qactive = QUEST_ACTIVE;
|
||||
Quests[Q_JERSEY]._qvar1 = 1;
|
||||
Quests[Q_JERSEY]._qmsg = TEXT_JERSEY4;
|
||||
Quests[Q_JERSEY]._qlog = true;
|
||||
quest._qactive = QUEST_ACTIVE;
|
||||
quest._qvar1 = 1;
|
||||
quest._qmsg = TEXT_JERSEY4;
|
||||
quest._qlog = true;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Quests[Q_JERSEY]._qactive) {
|
||||
switch (quest._qactive) {
|
||||
case QUEST_NOTAVAIL:
|
||||
case QUEST_INIT:
|
||||
InitQTextMsg(TEXT_JERSEY1);
|
||||
Quests[Q_JERSEY]._qactive = QUEST_HIVE_TEASE1;
|
||||
quest._qactive = QUEST_HIVE_TEASE1;
|
||||
if (gbIsMultiplayer)
|
||||
NetSendCmdQuest(true, Q_JERSEY);
|
||||
NetSendCmdQuest(true, quest);
|
||||
break;
|
||||
case QUEST_ACTIVE:
|
||||
InitQTextMsg(TEXT_JERSEY5);
|
||||
|
|
@ -674,15 +682,15 @@ void TalkToCowFarmer(PlayerStruct &player, TownerStruct &cowFarmer)
|
|||
break;
|
||||
case QUEST_HIVE_TEASE1:
|
||||
InitQTextMsg(TEXT_JERSEY2);
|
||||
Quests[Q_JERSEY]._qactive = QUEST_HIVE_TEASE2;
|
||||
quest._qactive = QUEST_HIVE_TEASE2;
|
||||
if (gbIsMultiplayer)
|
||||
NetSendCmdQuest(true, Q_JERSEY);
|
||||
NetSendCmdQuest(true, quest);
|
||||
break;
|
||||
case QUEST_HIVE_TEASE2:
|
||||
InitQTextMsg(TEXT_JERSEY3);
|
||||
Quests[Q_JERSEY]._qactive = QUEST_HIVE_ACTIVE;
|
||||
quest._qactive = QUEST_HIVE_ACTIVE;
|
||||
if (gbIsMultiplayer)
|
||||
NetSendCmdQuest(true, Q_JERSEY);
|
||||
NetSendCmdQuest(true, quest);
|
||||
break;
|
||||
case QUEST_HIVE_ACTIVE:
|
||||
if (!player._pLvlVisited[9] && player._pLevel < 15) {
|
||||
|
|
@ -703,13 +711,13 @@ void TalkToCowFarmer(PlayerStruct &player, TownerStruct &cowFarmer)
|
|||
}
|
||||
|
||||
InitQTextMsg(TEXT_JERSEY4);
|
||||
Quests[Q_JERSEY]._qactive = QUEST_ACTIVE;
|
||||
Quests[Q_JERSEY]._qvar1 = 1;
|
||||
Quests[Q_JERSEY]._qmsg = TEXT_JERSEY4;
|
||||
Quests[Q_JERSEY]._qlog = true;
|
||||
quest._qactive = QUEST_ACTIVE;
|
||||
quest._qvar1 = 1;
|
||||
quest._qmsg = TEXT_JERSEY4;
|
||||
quest._qlog = true;
|
||||
SpawnRuneBomb(cowFarmer.position + Displacement { 1, 0 });
|
||||
if (gbIsMultiplayer)
|
||||
NetSendCmdQuest(true, Q_JERSEY);
|
||||
NetSendCmdQuest(true, quest);
|
||||
break;
|
||||
default:
|
||||
InitQTextMsg(TEXT_JERSEY5);
|
||||
|
|
@ -719,27 +727,29 @@ void TalkToCowFarmer(PlayerStruct &player, TownerStruct &cowFarmer)
|
|||
|
||||
void TalkToGirl(PlayerStruct &player, TownerStruct &girl)
|
||||
{
|
||||
if (Quests[Q_GIRL]._qactive != QUEST_DONE && player.TryRemoveInvItemById(IDI_THEODORE)) {
|
||||
auto &quest = Quests[Q_GIRL];
|
||||
|
||||
if (quest._qactive != QUEST_DONE && player.TryRemoveInvItemById(IDI_THEODORE)) {
|
||||
InitQTextMsg(TEXT_GIRL4);
|
||||
CreateAmulet(girl.position, 13, false, true);
|
||||
Quests[Q_GIRL]._qlog = false;
|
||||
Quests[Q_GIRL]._qactive = QUEST_DONE;
|
||||
quest._qlog = false;
|
||||
quest._qactive = QUEST_DONE;
|
||||
LoadTownerAnimations(girl, "Towners\\Girl\\Girls1.CEL", 20, DIR_S, 6);
|
||||
if (gbIsMultiplayer)
|
||||
NetSendCmdQuest(true, Q_GIRL);
|
||||
NetSendCmdQuest(true, quest);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Quests[Q_GIRL]._qactive) {
|
||||
switch (quest._qactive) {
|
||||
case QUEST_NOTAVAIL:
|
||||
case QUEST_INIT:
|
||||
InitQTextMsg(TEXT_GIRL2);
|
||||
Quests[Q_GIRL]._qactive = QUEST_ACTIVE;
|
||||
Quests[Q_GIRL]._qvar1 = 1;
|
||||
Quests[Q_GIRL]._qlog = true;
|
||||
Quests[Q_GIRL]._qmsg = TEXT_GIRL2;
|
||||
quest._qactive = QUEST_ACTIVE;
|
||||
quest._qvar1 = 1;
|
||||
quest._qlog = true;
|
||||
quest._qmsg = TEXT_GIRL2;
|
||||
if (gbIsMultiplayer)
|
||||
NetSendCmdQuest(true, Q_GIRL);
|
||||
NetSendCmdQuest(true, quest);
|
||||
return;
|
||||
case QUEST_ACTIVE:
|
||||
InitQTextMsg(TEXT_GIRL3);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue