diff --git a/zone/client.h b/zone/client.h index 68a86500f..b8592d1eb 100644 --- a/zone/client.h +++ b/zone/client.h @@ -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 GetLearnableDisciplines(uint8 min_level = 1, uint8 max_level = 0); std::vector GetLearnedDisciplines(); diff --git a/zone/spells.cpp b/zone/spells.cpp index 3d333d768..e5581d7af 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -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(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) {