Browse Source

Use CMD_SPAWNITEM to spawn Zhars first book

pull/6142/head
obligaron 3 years ago committed by Anders Jenbo
parent
commit
e1082126a3
  1. 8
      Source/items.cpp
  2. 2
      Source/items.h
  3. 2
      Source/monster.cpp

8
Source/items.cpp

@ -1555,7 +1555,7 @@ void SetupAllItems(const Player &player, Item &item, _item_indexes idx, uint32_t
SetupItem(item);
}
void SetupBaseItem(Point position, _item_indexes idx, bool onlygood, bool sendmsg, bool delta)
void SetupBaseItem(Point position, _item_indexes idx, bool onlygood, bool sendmsg, bool delta, bool spawn = false)
{
if (ActiveItemCount >= MAXITEMS)
return;
@ -1571,6 +1571,8 @@ void SetupBaseItem(Point position, _item_indexes idx, bool onlygood, bool sendms
NetSendCmdPItem(false, CMD_DROPITEM, item.position, item);
if (delta)
DeltaAddItem(ii);
if (spawn)
NetSendCmdPItem(false, CMD_SPAWNITEM, item.position, item);
}
void SetupAllUseful(Item &item, int iseed, int lvl)
@ -3307,7 +3309,7 @@ void CreateRndUseful(Point position, bool sendmsg)
NetSendCmdPItem(false, CMD_DROPITEM, item.position, item);
}
void CreateTypeItem(Point position, bool onlygood, ItemType itemType, int imisc, bool sendmsg, bool delta)
void CreateTypeItem(Point position, bool onlygood, ItemType itemType, int imisc, bool sendmsg, bool delta, bool spawn)
{
_item_indexes idx;
@ -3317,7 +3319,7 @@ void CreateTypeItem(Point position, bool onlygood, ItemType itemType, int imisc,
else
idx = IDI_GOLD;
SetupBaseItem(position, idx, onlygood, sendmsg, delta);
SetupBaseItem(position, idx, onlygood, sendmsg, delta, spawn);
}
void RecreateItem(const Player &player, Item &item, _item_indexes idx, uint16_t icreateinfo, uint32_t iseed, int ivalue, bool isHellfire)

2
Source/items.h

@ -513,7 +513,7 @@ Item *SpawnUnique(_unique_items uid, Point position, bool sendmsg = true);
void SpawnItem(Monster &monster, Point position, bool sendmsg);
void CreateRndItem(Point position, bool onlygood, bool sendmsg, bool delta);
void CreateRndUseful(Point position, bool sendmsg);
void CreateTypeItem(Point position, bool onlygood, ItemType itemType, int imisc, bool sendmsg, bool delta);
void CreateTypeItem(Point position, bool onlygood, ItemType itemType, int imisc, bool sendmsg, bool delta, bool spawn = false);
void RecreateItem(const Player &player, Item &item, _item_indexes idx, uint16_t icreateinfo, uint32_t iseed, int ivalue, bool isHellfire);
void RecreateEar(Item &item, uint16_t ic, uint32_t iseed, uint8_t bCursval, string_view heroName);
void CornerstoneSave();

2
Source/monster.cpp

@ -1427,7 +1427,7 @@ void MonsterTalk(Monster &monster)
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, true, false);
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]);
}

Loading…
Cancel
Save