[Quest API] Convert Spell Events to similar formats and exports. (#1618)

* [Quest API] Convert Spell Events to similar formats and exports.
Export spell ID, caster ID, caster level, tics remaining, and buff slot to Perl/Lua spell events.
- Export e.buff_slot, e.caster_id, e.caster_level, e.spell_id, and e.tics_remaining to `event_spell_buff_tic`, `event_spell_effect`, and `event_spell_fade` in Lua.
- Export $buff_slot, $caster_id, $caster_level, $spell_id, $tics_remaining to `EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT`, `EVENT_SPELL_EFFECT_BUFF_TIC_NPC`, `EVENT_SPELL_EFFECT_CLIENT`, `EVENT_SPELL_EFFECT_NPC`, and `EVENT_SPELL_FADE` in Perl.

* Formatting.

* Remove debug variable.
This commit is contained in:
Kinglykrab
2021-10-20 16:02:12 -04:00
committed by GitHub
parent edf298685e
commit 81e7cf5a32
15 changed files with 164 additions and 184 deletions
+29 -16
View File
@@ -14761,38 +14761,44 @@ void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app)
void Client::Handle_OP_Translocate(const EQApplicationPacket *app)
{
if (app->size != sizeof(Translocate_Struct)) {
LogDebug("Size mismatch in OP_Translocate expected [{}] got [{}]", sizeof(Translocate_Struct), app->size);
DumpPacket(app);
return;
}
Translocate_Struct *its = (Translocate_Struct*)app->pBuffer;
if (!PendingTranslocate)
if (!PendingTranslocate) {
return;
}
if ((RuleI(Spells, TranslocateTimeLimit) > 0) && (time(nullptr) > (TranslocateTime + RuleI(Spells, TranslocateTimeLimit)))) {
auto translocate_time_limit = RuleI(Spells, TranslocateTimeLimit);
if (
translocate_time_limit &&
time(nullptr) > (TranslocateTime + translocate_time_limit)
) {
Message(Chat::Red, "You did not accept the Translocate within the required time limit.");
PendingTranslocate = false;
return;
}
if (its->Complete == 1) {
int SpellID = PendingTranslocateData.spell_id;
int i = parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, SpellID, 0);
if (i == 0)
{
uint32 spell_id = PendingTranslocateData.spell_id;
bool in_translocate_zone = (
zone->GetZoneID() == PendingTranslocateData.zone_id &&
zone->GetInstanceID() == PendingTranslocateData.instance_id
);
if (parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, spell_id, "", 0) == 0) {
// If the spell has a translocate to bind effect, AND we are already in the zone the client
// is bound in, use the GoToBind method. If we send OP_Translocate in this case, the client moves itself
// to the bind coords it has from the PlayerProfile, but with the X and Y reversed. I suspect they are
// reversed in the pp, and since spells like Gate are handled serverside, this has not mattered before.
if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) &&
(zone->GetZoneID() == PendingTranslocateData.zone_id &&
zone->GetInstanceID() == PendingTranslocateData.instance_id))
{
if (
IsTranslocateSpell(spell_id) &&
in_translocate_zone
) {
PendingTranslocate = false;
GoToBind();
return;
@@ -14800,9 +14806,16 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app)
////Was sending the packet back to initiate client zone...
////but that could be abusable, so lets go through proper channels
MovePC(PendingTranslocateData.zone_id, PendingTranslocateData.instance_id,
PendingTranslocateData.x, PendingTranslocateData.y,
PendingTranslocateData.z, PendingTranslocateData.heading, 0, ZoneSolicited);
MovePC(
PendingTranslocateData.zone_id,
PendingTranslocateData.instance_id,
PendingTranslocateData.x,
PendingTranslocateData.y,
PendingTranslocateData.z,
PendingTranslocateData.heading,
0,
ZoneSolicited
);
}
}