mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-31 22:52:25 +00:00
Refactor OP_BeginCast into it's own function
This commit is contained in:
parent
2030278116
commit
b4bab425f5
@ -3901,14 +3901,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
|
|||||||
Log(Logs::Detail, Logs::Combat,
|
Log(Logs::Detail, Logs::Combat,
|
||||||
"Spell proc %d procing spell %d (%.2f percent chance)",
|
"Spell proc %d procing spell %d (%.2f percent chance)",
|
||||||
i, SpellProcs[i].spellID, chance);
|
i, SpellProcs[i].spellID, chance);
|
||||||
auto outapp = new EQApplicationPacket(OP_BeginCast,sizeof(BeginCast_Struct));
|
SendBeginCast(SpellProcs[i].spellID, 0);
|
||||||
BeginCast_Struct* begincast = (BeginCast_Struct*)outapp->pBuffer;
|
|
||||||
begincast->caster_id = GetID();
|
|
||||||
begincast->spell_id = SpellProcs[i].spellID;
|
|
||||||
begincast->cast_time = 0;
|
|
||||||
outapp->priority = 3;
|
|
||||||
entity_list.QueueCloseClients(this, outapp, false, RuleI(Range, SpellMessages), 0, true);
|
|
||||||
safe_delete(outapp);
|
|
||||||
ExecWeaponProc(nullptr, SpellProcs[i].spellID, on, SpellProcs[i].level_override);
|
ExecWeaponProc(nullptr, SpellProcs[i].spellID, on, SpellProcs[i].level_override);
|
||||||
CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0,
|
CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0,
|
||||||
SpellProcs[i].base_spellID);
|
SpellProcs[i].base_spellID);
|
||||||
|
|||||||
@ -279,6 +279,7 @@ public:
|
|||||||
uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0);
|
uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0);
|
||||||
bool SpellFinished(uint16 spell_id, Mob *target, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, uint16 mana_used = 0,
|
bool SpellFinished(uint16 spell_id, Mob *target, EQEmu::CastingSlot slot = EQEmu::CastingSlot::Item, uint16 mana_used = 0,
|
||||||
uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0, bool isproc = false, int level_override = -1);
|
uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0, bool isproc = false, int level_override = -1);
|
||||||
|
void SendBeginCast(uint16 spell_id, uint32 casttime);
|
||||||
virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect = false,
|
virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect = false,
|
||||||
bool use_resist_adjust = false, int16 resist_adjust = 0, bool isproc = false, int level_override = -1);
|
bool use_resist_adjust = false, int16 resist_adjust = 0, bool isproc = false, int level_override = -1);
|
||||||
virtual bool SpellEffect(Mob* caster, uint16 spell_id, float partial = 100, int level_override = -1);
|
virtual bool SpellEffect(Mob* caster, uint16 spell_id, float partial = 100, int level_override = -1);
|
||||||
|
|||||||
@ -477,23 +477,8 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
|
|||||||
// now tell the people in the area -- we ALWAYS want to send this, even instant cast spells.
|
// now tell the people in the area -- we ALWAYS want to send this, even instant cast spells.
|
||||||
// The only time this is skipped is for NPC innate procs and weapon procs. Procs from buffs
|
// The only time this is skipped is for NPC innate procs and weapon procs. Procs from buffs
|
||||||
// oddly still send this. Since those cases don't reach here, we don't need to check them
|
// oddly still send this. Since those cases don't reach here, we don't need to check them
|
||||||
if (slot != CastingSlot::Discipline) {
|
if (slot != CastingSlot::Discipline)
|
||||||
auto outapp = new EQApplicationPacket(OP_BeginCast,sizeof(BeginCast_Struct));
|
SendBeginCast(spell_id, orgcasttime);
|
||||||
BeginCast_Struct* begincast = (BeginCast_Struct*)outapp->pBuffer;
|
|
||||||
begincast->caster_id = GetID();
|
|
||||||
begincast->spell_id = spell_id;
|
|
||||||
begincast->cast_time = orgcasttime; // client calculates reduced time by itself
|
|
||||||
outapp->priority = 3;
|
|
||||||
entity_list.QueueCloseClients(
|
|
||||||
this, /* Sender */
|
|
||||||
outapp, /* Packet */
|
|
||||||
false, /* Ignore Sender */
|
|
||||||
RuleI(Range, BeginCast),
|
|
||||||
0, /* Skip this Mob */
|
|
||||||
true /* Packet ACK */
|
|
||||||
); //IsClient() ? FILTER_PCSPELLS : FILTER_NPCSPELLS);
|
|
||||||
safe_delete(outapp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// cast time is 0, just finish it right now and be done with it
|
// cast time is 0, just finish it right now and be done with it
|
||||||
if(cast_time == 0) {
|
if(cast_time == 0) {
|
||||||
@ -536,6 +521,29 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mob::SendBeginCast(uint16 spell_id, uint32 casttime)
|
||||||
|
{
|
||||||
|
auto outapp = new EQApplicationPacket(OP_BeginCast, sizeof(BeginCast_Struct));
|
||||||
|
auto begincast = (BeginCast_Struct *)outapp->pBuffer;
|
||||||
|
|
||||||
|
begincast->caster_id = GetID();
|
||||||
|
begincast->spell_id = spell_id;
|
||||||
|
begincast->cast_time = casttime; // client calculates reduced time by itself
|
||||||
|
|
||||||
|
outapp->priority = 3;
|
||||||
|
|
||||||
|
entity_list.QueueCloseClients(
|
||||||
|
this, /* Sender */
|
||||||
|
outapp, /* Packet */
|
||||||
|
false, /* Ignore Sender */
|
||||||
|
RuleI(Range, BeginCast),
|
||||||
|
0, /* Skip this Mob */
|
||||||
|
true /* Packet ACK */
|
||||||
|
); //IsClient() ? FILTER_PCSPELLS : FILTER_NPCSPELLS);
|
||||||
|
|
||||||
|
safe_delete(outapp);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some failures should be caught before the spell finishes casting
|
* Some failures should be caught before the spell finishes casting
|
||||||
* This is especially helpful to clients when they cast really long things
|
* This is especially helpful to clients when they cast really long things
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user