diff --git a/common/spdat.h b/common/spdat.h index 2616ba717..416f63561 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -22,6 +22,7 @@ #include "skills.h" #define SPELL_UNKNOWN 0xFFFF +#define POISON_PROC 0xFFFE #define SPELLBOOK_UNKNOWN 0xFFFFFFFF //player profile spells are 32 bit //some spell IDs which will prolly change, but are needed diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d5dde9750..563b54dca 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2856,7 +2856,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) if (ChanceRoll < (.75 + poison_skill / 1000)) { ApplyPoisonSuccessResult = 1; - AddProcToWeapon(poison->Proc.Effect, false, (GetDEX() / 100) + 103); + AddProcToWeapon(poison->Proc.Effect, false, (GetDEX() / 100) + 103, POISON_PROC); } } else { diff --git a/zone/spells.cpp b/zone/spells.cpp index 406739acf..494ac3b04 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5360,13 +5360,31 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b } Log(Logs::Detail, Logs::Spells, "Too many perma procs for %s", GetName()); } else { + // If its a poison proc, replace any existing one if present. + if (base_spell_id == POISON_PROC) { + for (i = 0; i < MAX_PROCS; i++) { + // If we already have a poison proc active replace it and return + if (SpellProcs[i].base_spellID == POISON_PROC) { + SpellProcs[i].spellID = spell_id; + SpellProcs[i].chance = iChance; + SpellProcs[i].level_override = level_override; + Log(Logs::Detail, Logs::Spells, "Replaced poison-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); + return true; + } + } + } + + // If we get here it either wasn't poison (which can only use 1 slot) + // or it is poison and no poison procs are currently present. + // Find a slot and use it as normal. + for (i = 0; i < MAX_PROCS; i++) { if (SpellProcs[i].spellID == SPELL_UNKNOWN) { SpellProcs[i].spellID = spell_id; SpellProcs[i].chance = iChance; SpellProcs[i].base_spellID = base_spell_id;; SpellProcs[i].level_override = level_override; - Log(Logs::Detail, Logs::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log(Logs::Detail, Logs::Spells, "Added %s-granted proc spell %d with chance %d to slot %d", (base_spell_id == POISON_PROC) ? "poison" : "spell", spell_id, iChance, i); return true; } }