[Bug Fix] SendSpellBarEnable sends correct slotid to fix spellbar on RoF2 (#1848)

* SendSpellBarEnable sends correct slotid to fix spellbar on RoF2

* Send correct data when using StopCasting() to re-enable spellbar
This commit is contained in:
Natedog2012 2021-11-27 08:45:57 -06:00 committed by GitHub
parent 298ae3e3ba
commit 8566662d56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -793,6 +793,7 @@ public:
void UnmemSpellBySpellID(int32 spell_id);
void UnmemSpellAll(bool update_client = true);
uint16 FindMemmedSpellBySlot(int slot);
int FindMemmedSpellByID(uint16 spell_id);
int MemmedCount();
std::vector<int> GetLearnableDisciplines(uint8 min_level = 1, uint8 max_level = 0);
std::vector<int> GetLearnedDisciplines();

View File

@ -995,13 +995,18 @@ void Mob::StopCasting()
c->ResetAlternateAdvancementTimer(casting_spell_aa_id);
}
int casting_slot = -1;
if (casting_spell_slot < CastingSlot::MaxGems) {
casting_slot = static_cast<int>(casting_spell_slot);
}
auto outapp = new EQApplicationPacket(OP_ManaChange, sizeof(ManaChange_Struct));
auto mc = (ManaChange_Struct *)outapp->pBuffer;
mc->new_mana = GetMana();
mc->stamina = GetEndurance();
mc->spell_id = casting_spell_id;
mc->keepcasting = 0;
mc->slot = -1;
mc->slot = casting_slot;
c->FastQueuePacket(&outapp);
}
ZeroCastingVars();
@ -5219,7 +5224,7 @@ void Mob::SendSpellBarEnable(uint16 spell_id)
manachange->spell_id = spell_id;
manachange->stamina = CastToClient()->GetEndurance();
manachange->keepcasting = 0;
manachange->slot = -1;
manachange->slot = CastToClient()->FindMemmedSpellByID(spell_id);
outapp->priority = 6;
CastToClient()->QueuePacket(outapp);
safe_delete(outapp);
@ -5428,6 +5433,15 @@ int Client::MemmedCount() {
return memmed_count;
}
int Client::FindMemmedSpellByID(uint16 spell_id) {
for (int i = 0; i < EQ::spells::SPELL_GEM_COUNT; i++) {
if (m_pp.mem_spells[i] == spell_id) {
return i;
}
}
return -1;
}
void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client, bool defer_save)
{