Browse Source

Fix Book requirements not updating from Objects (#6316)

pull/6322/head
Eric Robinson 3 years ago committed by GitHub
parent
commit
5ebedafd83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      Source/objects.cpp

18
Source/objects.cpp

@ -1982,8 +1982,10 @@ void OperateBook(Player &player, Object &book, bool sendmsg)
if (setlvlnum == SL_BONECHAMB) {
if (sendmsg) {
uint8_t newSpellLevel = player._pSplLvl[static_cast<int8_t>(SpellID::Guardian)] + 1;
if (newSpellLevel <= MaxSpellLevel)
if (newSpellLevel <= MaxSpellLevel) {
player._pSplLvl[static_cast<int8_t>(SpellID::Guardian)] = newSpellLevel;
NetSendCmdParam2(true, CMD_CHANGE_SPELL_LEVEL, static_cast<uint16_t>(SpellID::Guardian), newSpellLevel);
}
Quests[Q_SCHAMB]._qactive = QUEST_DONE;
NetSendCmdQuest(true, Quests[Q_SCHAMB]);
@ -2544,15 +2546,20 @@ void OperateShrineEnchanted(Player &player)
} while ((player._pMemSpells & GetSpellBitmask(static_cast<SpellID>(spellToReduce))) == 0);
spell = 1;
for (uint8_t j = static_cast<uint8_t>(SpellID::Firebolt); j < maxSpells; j++) { // BUGFIX: < MAX_SPELLS, there is no spell with MAX_SPELLS index (fixed)
for (uint8_t j = static_cast<uint8_t>(SpellID::Firebolt); j < maxSpells; j++) {
if ((player._pMemSpells & spell) != 0 && player._pSplLvl[j] < MaxSpellLevel && j != spellToReduce) {
NetSendCmdParam2(true, CMD_CHANGE_SPELL_LEVEL, j, static_cast<uint8_t>(player._pSplLvl[j] + 1));
uint8_t newSpellLevel = static_cast<uint8_t>(player._pSplLvl[j] + 1);
player._pSplLvl[j] = newSpellLevel;
NetSendCmdParam2(true, CMD_CHANGE_SPELL_LEVEL, j, newSpellLevel);
}
spell *= 2;
}
if (player._pSplLvl[spellToReduce] > 0)
NetSendCmdParam2(true, CMD_CHANGE_SPELL_LEVEL, spellToReduce, player._pSplLvl[spellToReduce] - 1);
if (player._pSplLvl[spellToReduce] > 0) {
uint8_t newSpellLevel = static_cast<uint8_t>(player._pSplLvl[spellToReduce] - 1);
player._pSplLvl[spellToReduce] = newSpellLevel;
NetSendCmdParam2(true, CMD_CHANGE_SPELL_LEVEL, spellToReduce, newSpellLevel);
}
}
InitDiabloMsg(EMSG_SHRINE_ENCHANTED);
@ -2585,6 +2592,7 @@ void OperateShrineCostOfWisdom(Player &player, SpellID spellId, diablo_message m
uint8_t curSpellLevel = player._pSplLvl[static_cast<int8_t>(spellId)];
if (curSpellLevel < MaxSpellLevel) {
uint8_t newSpellLevel = std::min(static_cast<uint8_t>(curSpellLevel + 2), MaxSpellLevel);
player._pSplLvl[static_cast<int8_t>(spellId)] = newSpellLevel;
NetSendCmdParam2(true, CMD_CHANGE_SPELL_LEVEL, static_cast<uint16_t>(spellId), newSpellLevel);
}

Loading…
Cancel
Save