mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
[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:
parent
edf298685e
commit
81e7cf5a32
@ -833,6 +833,14 @@ bool IsTeleportSpell(uint16 spell_id)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsTranslocateSpell(uint16 spell_id)
|
||||||
|
{
|
||||||
|
if (IsEffectInSpell(spell_id, SE_Translocate))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsGateSpell(uint16 spell_id)
|
bool IsGateSpell(uint16 spell_id)
|
||||||
{
|
{
|
||||||
if (IsEffectInSpell(spell_id, SE_Gate))
|
if (IsEffectInSpell(spell_id, SE_Gate))
|
||||||
|
|||||||
@ -129,6 +129,8 @@
|
|||||||
#define SPELL_SPIRITUAL_ECHO 1248
|
#define SPELL_SPIRITUAL_ECHO 1248
|
||||||
#define SPELL_BRISTLING_ARMAMENT 1249
|
#define SPELL_BRISTLING_ARMAMENT 1249
|
||||||
#define SPELL_WATON_DESTRUCTION 1250
|
#define SPELL_WATON_DESTRUCTION 1250
|
||||||
|
#define SPELL_TRANSLOCATE_GROUP 1334
|
||||||
|
#define SPELL_TRANSLOCATE 1422
|
||||||
#define SPELL_ACTING_MAGIC_RESIST_I 1900
|
#define SPELL_ACTING_MAGIC_RESIST_I 1900
|
||||||
#define SPELL_ACTING_FIRE_RESIST_I 1901
|
#define SPELL_ACTING_FIRE_RESIST_I 1901
|
||||||
#define SPELL_ACTING_COLD_RESIST_I 1902
|
#define SPELL_ACTING_COLD_RESIST_I 1902
|
||||||
@ -154,6 +156,7 @@
|
|||||||
#define SPELL_ACTING_SPIRIT_II 1922
|
#define SPELL_ACTING_SPIRIT_II 1922
|
||||||
#define SPELL_RESURRECTION_SICKNESS 756
|
#define SPELL_RESURRECTION_SICKNESS 756
|
||||||
#define SPELL_RESURRECTION_SICKNESS4 757
|
#define SPELL_RESURRECTION_SICKNESS4 757
|
||||||
|
#define SPELL_TELEPORT 3243
|
||||||
#define SPELL_RESURRECTION_SICKNESS2 5249
|
#define SPELL_RESURRECTION_SICKNESS2 5249
|
||||||
#define SPELL_REVIVAL_SICKNESS 13087
|
#define SPELL_REVIVAL_SICKNESS 13087
|
||||||
#define SPELL_RESURRECTION_SICKNESS3 37624
|
#define SPELL_RESURRECTION_SICKNESS3 37624
|
||||||
@ -1472,6 +1475,7 @@ bool IsPartialDeathSaveSpell(uint16 spell_id);
|
|||||||
bool IsShadowStepSpell(uint16 spell_id);
|
bool IsShadowStepSpell(uint16 spell_id);
|
||||||
bool IsSuccorSpell(uint16 spell_id);
|
bool IsSuccorSpell(uint16 spell_id);
|
||||||
bool IsTeleportSpell(uint16 spell_id);
|
bool IsTeleportSpell(uint16 spell_id);
|
||||||
|
bool IsTranslocateSpell(uint16 spell_id);
|
||||||
bool IsGateSpell(uint16 spell_id);
|
bool IsGateSpell(uint16 spell_id);
|
||||||
bool IsPlayerIllusionSpell(uint16 spell_id); // seveian 2008-09-23
|
bool IsPlayerIllusionSpell(uint16 spell_id); // seveian 2008-09-23
|
||||||
bool IsLDoNObjectSpell(uint16 spell_id);
|
bool IsLDoNObjectSpell(uint16 spell_id);
|
||||||
|
|||||||
@ -14761,38 +14761,44 @@ void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
void Client::Handle_OP_Translocate(const EQApplicationPacket *app)
|
void Client::Handle_OP_Translocate(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (app->size != sizeof(Translocate_Struct)) {
|
if (app->size != sizeof(Translocate_Struct)) {
|
||||||
LogDebug("Size mismatch in OP_Translocate expected [{}] got [{}]", sizeof(Translocate_Struct), app->size);
|
LogDebug("Size mismatch in OP_Translocate expected [{}] got [{}]", sizeof(Translocate_Struct), app->size);
|
||||||
DumpPacket(app);
|
DumpPacket(app);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Translocate_Struct *its = (Translocate_Struct*)app->pBuffer;
|
Translocate_Struct *its = (Translocate_Struct*)app->pBuffer;
|
||||||
|
|
||||||
if (!PendingTranslocate)
|
if (!PendingTranslocate) {
|
||||||
return;
|
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.");
|
Message(Chat::Red, "You did not accept the Translocate within the required time limit.");
|
||||||
PendingTranslocate = false;
|
PendingTranslocate = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (its->Complete == 1) {
|
if (its->Complete == 1) {
|
||||||
|
uint32 spell_id = PendingTranslocateData.spell_id;
|
||||||
int SpellID = PendingTranslocateData.spell_id;
|
bool in_translocate_zone = (
|
||||||
int i = parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, SpellID, 0);
|
zone->GetZoneID() == PendingTranslocateData.zone_id &&
|
||||||
|
zone->GetInstanceID() == PendingTranslocateData.instance_id
|
||||||
if (i == 0)
|
);
|
||||||
{
|
|
||||||
|
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
|
// 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
|
// 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
|
// 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.
|
// reversed in the pp, and since spells like Gate are handled serverside, this has not mattered before.
|
||||||
if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) &&
|
if (
|
||||||
(zone->GetZoneID() == PendingTranslocateData.zone_id &&
|
IsTranslocateSpell(spell_id) &&
|
||||||
zone->GetInstanceID() == PendingTranslocateData.instance_id))
|
in_translocate_zone
|
||||||
{
|
) {
|
||||||
PendingTranslocate = false;
|
PendingTranslocate = false;
|
||||||
GoToBind();
|
GoToBind();
|
||||||
return;
|
return;
|
||||||
@ -14800,9 +14806,16 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
////Was sending the packet back to initiate client zone...
|
////Was sending the packet back to initiate client zone...
|
||||||
////but that could be abusable, so lets go through proper channels
|
////but that could be abusable, so lets go through proper channels
|
||||||
MovePC(PendingTranslocateData.zone_id, PendingTranslocateData.instance_id,
|
MovePC(
|
||||||
PendingTranslocateData.x, PendingTranslocateData.y,
|
PendingTranslocateData.zone_id,
|
||||||
PendingTranslocateData.z, PendingTranslocateData.heading, 0, ZoneSolicited);
|
PendingTranslocateData.instance_id,
|
||||||
|
PendingTranslocateData.x,
|
||||||
|
PendingTranslocateData.y,
|
||||||
|
PendingTranslocateData.z,
|
||||||
|
PendingTranslocateData.heading,
|
||||||
|
0,
|
||||||
|
ZoneSolicited
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -253,19 +253,15 @@ int PerlembParser::EventCommon(
|
|||||||
|
|
||||||
if (isPlayerQuest || isGlobalPlayerQuest) {
|
if (isPlayerQuest || isGlobalPlayerQuest) {
|
||||||
return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr);
|
return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr);
|
||||||
}
|
} else if (isItemQuest) {
|
||||||
else if (isItemQuest) {
|
|
||||||
return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, item_inst);
|
return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, item_inst);
|
||||||
}
|
} else if (isSpellQuest) {
|
||||||
else if (isSpellQuest) {
|
|
||||||
if (mob) {
|
if (mob) {
|
||||||
return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr);
|
return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return SendCommands(package_name.c_str(), sub_name, 0, npcmob, mob, nullptr);
|
return SendCommands(package_name.c_str(), sub_name, 0, npcmob, mob, nullptr);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return SendCommands(package_name.c_str(), sub_name, objid, npcmob, mob, nullptr);
|
return SendCommands(package_name.c_str(), sub_name, objid, npcmob, mob, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -312,11 +308,11 @@ int PerlembParser::EventItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
int PerlembParser::EventSpell(
|
int PerlembParser::EventSpell(
|
||||||
QuestEventID evt, NPC *npc, Client *client, uint32 spell_id, uint32 extra_data,
|
QuestEventID evt, NPC *npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers
|
std::vector<EQ::Any> *extra_pointers
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EventCommon(evt, 0, itoa(spell_id), npc, nullptr, client, extra_data, false, extra_pointers);
|
return EventCommon(evt, spell_id, data.c_str(), npc, nullptr, client, extra_data, false, extra_pointers);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PerlembParser::HasQuestSub(uint32 npcid, QuestEventID evt)
|
bool PerlembParser::HasQuestSub(uint32 npcid, QuestEventID evt)
|
||||||
@ -1004,8 +1000,8 @@ void PerlembParser::GetQuestTypes(
|
|||||||
{
|
{
|
||||||
if (event == EVENT_SPELL_EFFECT_CLIENT ||
|
if (event == EVENT_SPELL_EFFECT_CLIENT ||
|
||||||
event == EVENT_SPELL_EFFECT_NPC ||
|
event == EVENT_SPELL_EFFECT_NPC ||
|
||||||
event == EVENT_SPELL_BUFF_TIC_CLIENT ||
|
event == EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT ||
|
||||||
event == EVENT_SPELL_BUFF_TIC_NPC ||
|
event == EVENT_SPELL_EFFECT_BUFF_TIC_NPC ||
|
||||||
event == EVENT_SPELL_FADE ||
|
event == EVENT_SPELL_FADE ||
|
||||||
event == EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE) {
|
event == EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE) {
|
||||||
isSpellQuest = true;
|
isSpellQuest = true;
|
||||||
@ -1042,31 +1038,31 @@ void PerlembParser::GetQuestPackageName(
|
|||||||
bool global
|
bool global
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!isPlayerQuest && !isGlobalPlayerQuest && !isItemQuest && !isSpellQuest) {
|
if (
|
||||||
|
!isPlayerQuest &&
|
||||||
|
!isGlobalPlayerQuest &&
|
||||||
|
!isItemQuest &&
|
||||||
|
!isSpellQuest
|
||||||
|
) {
|
||||||
if (global) {
|
if (global) {
|
||||||
isGlobalNPC = true;
|
isGlobalNPC = true;
|
||||||
package_name = "qst_global_npc";
|
package_name = "qst_global_npc";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
package_name = "qst_npc_";
|
package_name = "qst_npc_";
|
||||||
package_name += itoa(npcmob->GetNPCTypeID());
|
package_name += std::to_string(npcmob->GetNPCTypeID());
|
||||||
}
|
}
|
||||||
}
|
} else if (isItemQuest) {
|
||||||
else if (isItemQuest) {
|
|
||||||
// need a valid EQ::ItemInstance pointer check here..unsure how to cancel this process
|
// need a valid EQ::ItemInstance pointer check here..unsure how to cancel this process
|
||||||
const EQ::ItemData *item = item_inst->GetItem();
|
const EQ::ItemData *item = item_inst->GetItem();
|
||||||
package_name = "qst_item_";
|
package_name = "qst_item_";
|
||||||
package_name += itoa(item->ID);
|
package_name += std::to_string(item->ID);
|
||||||
}
|
} else if (isPlayerQuest) {
|
||||||
else if (isPlayerQuest) {
|
|
||||||
package_name = "qst_player";
|
package_name = "qst_player";
|
||||||
}
|
} else if (isGlobalPlayerQuest) {
|
||||||
else if (isGlobalPlayerQuest) {
|
|
||||||
package_name = "qst_global_player";
|
package_name = "qst_global_player";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
package_name = "qst_spell_";
|
package_name = "qst_spell_";
|
||||||
package_name += data;
|
package_name += std::to_string(objid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1525,11 +1521,17 @@ void PerlembParser::ExportEventVariables(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT:
|
||||||
|
case EVENT_SPELL_EFFECT_BUFF_TIC_NPC:
|
||||||
case EVENT_SPELL_EFFECT_CLIENT:
|
case EVENT_SPELL_EFFECT_CLIENT:
|
||||||
case EVENT_SPELL_EFFECT_NPC:
|
case EVENT_SPELL_EFFECT_NPC:
|
||||||
case EVENT_SPELL_BUFF_TIC_CLIENT:
|
case EVENT_SPELL_FADE: {
|
||||||
case EVENT_SPELL_BUFF_TIC_NPC: {
|
Seperator sep(data);
|
||||||
ExportVar(package_name.c_str(), "caster_id", extradata);
|
ExportVar(package_name.c_str(), "spell_id", objid);
|
||||||
|
ExportVar(package_name.c_str(), "caster_id", sep.arg[0]);
|
||||||
|
ExportVar(package_name.c_str(), "tics_remaining", sep.arg[1]);
|
||||||
|
ExportVar(package_name.c_str(), "caster_level", sep.arg[2]);
|
||||||
|
ExportVar(package_name.c_str(), "buff_slot", sep.arg[3]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ public:
|
|||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
virtual int EventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
virtual int EventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
|
|
||||||
virtual bool HasQuestSub(uint32 npcid, QuestEventID evt);
|
virtual bool HasQuestSub(uint32 npcid, QuestEventID evt);
|
||||||
|
|||||||
@ -43,8 +43,8 @@ typedef enum {
|
|||||||
EVENT_HATE_LIST,
|
EVENT_HATE_LIST,
|
||||||
EVENT_SPELL_EFFECT_CLIENT,
|
EVENT_SPELL_EFFECT_CLIENT,
|
||||||
EVENT_SPELL_EFFECT_NPC,
|
EVENT_SPELL_EFFECT_NPC,
|
||||||
EVENT_SPELL_BUFF_TIC_CLIENT,
|
EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT,
|
||||||
EVENT_SPELL_BUFF_TIC_NPC,
|
EVENT_SPELL_EFFECT_BUFF_TIC_NPC,
|
||||||
EVENT_SPELL_FADE,
|
EVENT_SPELL_FADE,
|
||||||
EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE,
|
EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE,
|
||||||
EVENT_COMBINE_SUCCESS, //PC successfully combined a recipe
|
EVENT_COMBINE_SUCCESS, //PC successfully combined a recipe
|
||||||
|
|||||||
@ -4126,7 +4126,7 @@ luabind::scope lua_register_events() {
|
|||||||
luabind::value("target_change", static_cast<int>(EVENT_TARGET_CHANGE)),
|
luabind::value("target_change", static_cast<int>(EVENT_TARGET_CHANGE)),
|
||||||
luabind::value("hate_list", static_cast<int>(EVENT_HATE_LIST)),
|
luabind::value("hate_list", static_cast<int>(EVENT_HATE_LIST)),
|
||||||
luabind::value("spell_effect", static_cast<int>(EVENT_SPELL_EFFECT_CLIENT)),
|
luabind::value("spell_effect", static_cast<int>(EVENT_SPELL_EFFECT_CLIENT)),
|
||||||
luabind::value("spell_buff_tic", static_cast<int>(EVENT_SPELL_BUFF_TIC_CLIENT)),
|
luabind::value("spell_buff_tic", static_cast<int>(EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT)),
|
||||||
luabind::value("spell_fade", static_cast<int>(EVENT_SPELL_FADE)),
|
luabind::value("spell_fade", static_cast<int>(EVENT_SPELL_FADE)),
|
||||||
luabind::value("spell_effect_translocate_complete", static_cast<int>(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE)),
|
luabind::value("spell_effect_translocate_complete", static_cast<int>(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE)),
|
||||||
luabind::value("combine_success ", static_cast<int>(EVENT_COMBINE_SUCCESS )),
|
luabind::value("combine_success ", static_cast<int>(EVENT_COMBINE_SUCCESS )),
|
||||||
|
|||||||
@ -241,9 +241,9 @@ LuaParser::LuaParser() {
|
|||||||
ItemArgumentDispatch[EVENT_AUGMENT_INSERT] = handle_item_augment_insert;
|
ItemArgumentDispatch[EVENT_AUGMENT_INSERT] = handle_item_augment_insert;
|
||||||
ItemArgumentDispatch[EVENT_AUGMENT_REMOVE] = handle_item_augment_remove;
|
ItemArgumentDispatch[EVENT_AUGMENT_REMOVE] = handle_item_augment_remove;
|
||||||
|
|
||||||
SpellArgumentDispatch[EVENT_SPELL_EFFECT_CLIENT] = handle_spell_effect;
|
SpellArgumentDispatch[EVENT_SPELL_EFFECT_CLIENT] = handle_spell_event;
|
||||||
SpellArgumentDispatch[EVENT_SPELL_BUFF_TIC_CLIENT] = handle_spell_tic;
|
SpellArgumentDispatch[EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT] = handle_spell_event;
|
||||||
SpellArgumentDispatch[EVENT_SPELL_FADE] = handle_spell_fade;
|
SpellArgumentDispatch[EVENT_SPELL_FADE] = handle_spell_event;
|
||||||
SpellArgumentDispatch[EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE] = handle_translocate_finish;
|
SpellArgumentDispatch[EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE] = handle_translocate_finish;
|
||||||
|
|
||||||
EncounterArgumentDispatch[EVENT_TIMER] = handle_encounter_timer;
|
EncounterArgumentDispatch[EVENT_TIMER] = handle_encounter_timer;
|
||||||
@ -535,7 +535,7 @@ int LuaParser::_EventItem(std::string package_name, QuestEventID evt, Client *cl
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LuaParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
int LuaParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
std::vector<EQ::Any> *extra_pointers) {
|
||||||
evt = ConvertLuaEvent(evt);
|
evt = ConvertLuaEvent(evt);
|
||||||
if(evt >= _LargestEventID) {
|
if(evt >= _LargestEventID) {
|
||||||
@ -548,10 +548,10 @@ int LuaParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spe
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _EventSpell(package_name, evt, npc, client, spell_id, extra_data, extra_pointers);
|
return _EventSpell(package_name, evt, npc, client, spell_id, data, extra_data, extra_pointers);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LuaParser::_EventSpell(std::string package_name, QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
int LuaParser::_EventSpell(std::string package_name, QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers, luabind::adl::object *l_func) {
|
std::vector<EQ::Any> *extra_pointers, luabind::adl::object *l_func) {
|
||||||
const char *sub_name = LuaEvents[evt];
|
const char *sub_name = LuaEvents[evt];
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ int LuaParser::_EventSpell(std::string package_name, QuestEventID evt, NPC* npc,
|
|||||||
lua_setfield(L, -2, "self");
|
lua_setfield(L, -2, "self");
|
||||||
|
|
||||||
auto arg_function = SpellArgumentDispatch[evt];
|
auto arg_function = SpellArgumentDispatch[evt];
|
||||||
arg_function(this, L, npc, client, spell_id, extra_data, extra_pointers);
|
arg_function(this, L, npc, client, spell_id, data, extra_data, extra_pointers);
|
||||||
|
|
||||||
quest_manager.StartQuest(npc, client, nullptr);
|
quest_manager.StartQuest(npc, client, nullptr);
|
||||||
if(lua_pcall(L, 1, 1, 0)) {
|
if(lua_pcall(L, 1, 1, 0)) {
|
||||||
@ -1276,7 +1276,7 @@ int LuaParser::DispatchEventItem(QuestEventID evt, Client *client, EQ::ItemInsta
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
int LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
std::vector<EQ::Any> *extra_pointers) {
|
||||||
evt = ConvertLuaEvent(evt);
|
evt = ConvertLuaEvent(evt);
|
||||||
if(evt >= _LargestEventID) {
|
if(evt >= _LargestEventID) {
|
||||||
@ -1292,7 +1292,7 @@ int LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, ui
|
|||||||
while(riter != iter->second.end()) {
|
while(riter != iter->second.end()) {
|
||||||
if(riter->event_id == evt) {
|
if(riter->event_id == evt) {
|
||||||
std::string package_name = "encounter_" + riter->encounter_name;
|
std::string package_name = "encounter_" + riter->encounter_name;
|
||||||
int i = _EventSpell(package_name, evt, npc, client, spell_id, extra_data, extra_pointers, &riter->lua_reference);
|
int i = _EventSpell(package_name, evt, npc, client, spell_id, data, extra_data, extra_pointers, &riter->lua_reference);
|
||||||
if(i != 0) {
|
if(i != 0) {
|
||||||
ret = i;
|
ret = i;
|
||||||
}
|
}
|
||||||
@ -1310,7 +1310,7 @@ int LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, ui
|
|||||||
while(riter != iter->second.end()) {
|
while(riter != iter->second.end()) {
|
||||||
if(riter->event_id == evt) {
|
if(riter->event_id == evt) {
|
||||||
std::string package_name = "encounter_" + riter->encounter_name;
|
std::string package_name = "encounter_" + riter->encounter_name;
|
||||||
int i = _EventSpell(package_name, evt, npc, client, spell_id, extra_data, extra_pointers, &riter->lua_reference);
|
int i = _EventSpell(package_name, evt, npc, client, spell_id, data, extra_data, extra_pointers, &riter->lua_reference);
|
||||||
if(i != 0)
|
if(i != 0)
|
||||||
ret = i;
|
ret = i;
|
||||||
}
|
}
|
||||||
@ -1329,9 +1329,9 @@ QuestEventID LuaParser::ConvertLuaEvent(QuestEventID evt) {
|
|||||||
case EVENT_SPELL_EFFECT_NPC:
|
case EVENT_SPELL_EFFECT_NPC:
|
||||||
return EVENT_SPELL_EFFECT_CLIENT;
|
return EVENT_SPELL_EFFECT_CLIENT;
|
||||||
break;
|
break;
|
||||||
case EVENT_SPELL_BUFF_TIC_CLIENT:
|
case EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT:
|
||||||
case EVENT_SPELL_BUFF_TIC_NPC:
|
case EVENT_SPELL_EFFECT_BUFF_TIC_NPC:
|
||||||
return EVENT_SPELL_BUFF_TIC_CLIENT;
|
return EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT;
|
||||||
break;
|
break;
|
||||||
case EVENT_AGGRO:
|
case EVENT_AGGRO:
|
||||||
case EVENT_ATTACK:
|
case EVENT_ATTACK:
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public:
|
|||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
virtual int EventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
virtual int EventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
virtual int EventEncounter(QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
|
virtual int EventEncounter(QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
@ -80,7 +80,7 @@ public:
|
|||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
virtual int DispatchEventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
virtual int DispatchEventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
virtual int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
virtual int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
|
|
||||||
static LuaParser* Instance() {
|
static LuaParser* Instance() {
|
||||||
@ -112,7 +112,7 @@ private:
|
|||||||
std::vector<EQ::Any> *extra_pointers, luabind::adl::object *l_func = nullptr);
|
std::vector<EQ::Any> *extra_pointers, luabind::adl::object *l_func = nullptr);
|
||||||
int _EventItem(std::string package_name, QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data,
|
int _EventItem(std::string package_name, QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data,
|
||||||
uint32 extra_data, std::vector<EQ::Any> *extra_pointers, luabind::adl::object *l_func = nullptr);
|
uint32 extra_data, std::vector<EQ::Any> *extra_pointers, luabind::adl::object *l_func = nullptr);
|
||||||
int _EventSpell(std::string package_name, QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
int _EventSpell(std::string package_name, QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers, luabind::adl::object *l_func = nullptr);
|
std::vector<EQ::Any> *extra_pointers, luabind::adl::object *l_func = nullptr);
|
||||||
int _EventEncounter(std::string package_name, QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
|
int _EventEncounter(std::string package_name, QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
|
|||||||
@ -702,8 +702,7 @@ void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, EQ::I
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Spell
|
//Spell
|
||||||
void handle_spell_effect(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
void handle_spell_event(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, std::string data, uint32 extra_data, std::vector<EQ::Any> *extra_pointers) {
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
|
||||||
if(npc) {
|
if(npc) {
|
||||||
Lua_Mob l_npc(npc);
|
Lua_Mob l_npc(npc);
|
||||||
luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc);
|
luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc);
|
||||||
@ -720,71 +719,30 @@ void handle_spell_effect(QuestInterface *parse, lua_State* L, NPC* npc, Client*
|
|||||||
|
|
||||||
lua_setfield(L, -2, "target");
|
lua_setfield(L, -2, "target");
|
||||||
|
|
||||||
lua_pushinteger(L, *EQ::any_cast<int*>(extra_pointers->at(0)));
|
lua_pushinteger(L, spell_id);
|
||||||
lua_setfield(L, -2, "buff_slot");
|
lua_setfield(L, -2, "spell_id");
|
||||||
|
|
||||||
lua_pushinteger(L, extra_data);
|
Seperator sep(data.c_str());
|
||||||
|
|
||||||
|
lua_pushinteger(L, std::stoi(sep.arg[0]));
|
||||||
lua_setfield(L, -2, "caster_id");
|
lua_setfield(L, -2, "caster_id");
|
||||||
}
|
|
||||||
|
|
||||||
void handle_spell_tic(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
lua_pushinteger(L, std::stoi(sep.arg[1]));
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
|
||||||
if(npc) {
|
|
||||||
Lua_Mob l_npc(npc);
|
|
||||||
luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc);
|
|
||||||
l_npc_o.push(L);
|
|
||||||
} else if(client) {
|
|
||||||
Lua_Mob l_client(client);
|
|
||||||
luabind::adl::object l_client_o = luabind::adl::object(L, l_client);
|
|
||||||
l_client_o.push(L);
|
|
||||||
} else {
|
|
||||||
Lua_Mob l_mob(nullptr);
|
|
||||||
luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob);
|
|
||||||
l_mob_o.push(L);
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "target");
|
|
||||||
|
|
||||||
lua_pushinteger(L, *EQ::any_cast<int*>(extra_pointers->at(0)));
|
|
||||||
lua_setfield(L, -2, "tics_remaining");
|
lua_setfield(L, -2, "tics_remaining");
|
||||||
|
|
||||||
lua_pushinteger(L, *EQ::any_cast<uint8*>(extra_pointers->at(1)));
|
lua_pushinteger(L, std::stoi(sep.arg[2]));
|
||||||
lua_setfield(L, -2, "caster_level");
|
lua_setfield(L, -2, "caster_level");
|
||||||
|
|
||||||
lua_pushinteger(L, *EQ::any_cast<int*>(extra_pointers->at(2)));
|
lua_pushinteger(L, std::stoi(sep.arg[3]));
|
||||||
lua_setfield(L, -2, "buff_slot");
|
lua_setfield(L, -2, "buff_slot");
|
||||||
|
|
||||||
lua_pushinteger(L, extra_data);
|
Lua_Spell l_spell(spell_id);
|
||||||
lua_setfield(L, -2, "caster_id");
|
luabind::adl::object l_spell_o = luabind::adl::object(L, l_spell);
|
||||||
|
l_spell_o.push(L);
|
||||||
|
lua_setfield(L, -2, "spell");
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_spell_fade(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
void handle_translocate_finish(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, std::string data, uint32 extra_data, std::vector<EQ::Any> *extra_pointers) {
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
|
||||||
if(npc) {
|
|
||||||
Lua_Mob l_npc(npc);
|
|
||||||
luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc);
|
|
||||||
l_npc_o.push(L);
|
|
||||||
} else if(client) {
|
|
||||||
Lua_Mob l_client(client);
|
|
||||||
luabind::adl::object l_client_o = luabind::adl::object(L, l_client);
|
|
||||||
l_client_o.push(L);
|
|
||||||
} else {
|
|
||||||
Lua_Mob l_mob(nullptr);
|
|
||||||
luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob);
|
|
||||||
l_mob_o.push(L);
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_setfield(L, -2, "target");
|
|
||||||
|
|
||||||
lua_pushinteger(L, extra_data);
|
|
||||||
lua_setfield(L, -2, "buff_slot");
|
|
||||||
|
|
||||||
lua_pushinteger(L, *EQ::any_cast<uint16*>(extra_pointers->at(0)));
|
|
||||||
lua_setfield(L, -2, "caster_id");
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle_translocate_finish(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
|
||||||
if(npc) {
|
if(npc) {
|
||||||
Lua_Mob l_npc(npc);
|
Lua_Mob l_npc(npc);
|
||||||
luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc);
|
luabind::adl::object l_npc_o = luabind::adl::object(L, l_npc);
|
||||||
@ -802,9 +760,7 @@ void handle_translocate_finish(QuestInterface *parse, lua_State* L, NPC* npc, Cl
|
|||||||
lua_setfield(L, -2, "target");
|
lua_setfield(L, -2, "target");
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_spell_null(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
void handle_spell_null(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, std::string data, uint32 extra_data, std::vector<EQ::Any> *extra_pointers) { }
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void handle_encounter_timer(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data,
|
void handle_encounter_timer(QuestInterface *parse, lua_State* L, Encounter* encounter, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
std::vector<EQ::Any> *extra_pointers) {
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
typedef void(*NPCArgumentHandler)(QuestInterface*, lua_State*, NPC*, Mob*, std::string, uint32, std::vector<EQ::Any>*);
|
typedef void(*NPCArgumentHandler)(QuestInterface*, lua_State*, NPC*, Mob*, std::string, uint32, std::vector<EQ::Any>*);
|
||||||
typedef void(*PlayerArgumentHandler)(QuestInterface*, lua_State*, Client*, std::string, uint32, std::vector<EQ::Any>*);
|
typedef void(*PlayerArgumentHandler)(QuestInterface*, lua_State*, Client*, std::string, uint32, std::vector<EQ::Any>*);
|
||||||
typedef void(*ItemArgumentHandler)(QuestInterface*, lua_State*, Client*, EQ::ItemInstance*, Mob*, std::string, uint32, std::vector<EQ::Any>*);
|
typedef void(*ItemArgumentHandler)(QuestInterface*, lua_State*, Client*, EQ::ItemInstance*, Mob*, std::string, uint32, std::vector<EQ::Any>*);
|
||||||
typedef void(*SpellArgumentHandler)(QuestInterface*, lua_State*, NPC*, Client*, uint32, uint32, std::vector<EQ::Any>*);
|
typedef void(*SpellArgumentHandler)(QuestInterface*, lua_State*, NPC*, Client*, uint32, std::string, uint32, std::vector<EQ::Any>*);
|
||||||
typedef void(*EncounterArgumentHandler)(QuestInterface*, lua_State*, Encounter* encounter, std::string, uint32, std::vector<EQ::Any>*);
|
typedef void(*EncounterArgumentHandler)(QuestInterface*, lua_State*, Encounter* encounter, std::string, uint32, std::vector<EQ::Any>*);
|
||||||
|
|
||||||
//NPC
|
//NPC
|
||||||
@ -135,15 +135,11 @@ void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, EQ::I
|
|||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
|
|
||||||
//Spell
|
//Spell
|
||||||
void handle_spell_effect(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
void handle_spell_event(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
void handle_spell_tic(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
void handle_translocate_finish(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
void handle_spell_fade(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
void handle_spell_null(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
|
||||||
void handle_translocate_finish(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
|
||||||
void handle_spell_null(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public:
|
|||||||
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
||||||
virtual int EventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
virtual int EventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
||||||
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
||||||
virtual int EventEncounter(QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
|
virtual int EventEncounter(QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
||||||
@ -70,7 +70,7 @@ public:
|
|||||||
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
||||||
virtual int DispatchEventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
virtual int DispatchEventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
||||||
virtual int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
virtual int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
std::vector<EQ::Any> *extra_pointers) { return 0; }
|
||||||
|
|
||||||
virtual void AddVar(std::string name, std::string val) { }
|
virtual void AddVar(std::string name, std::string val) { }
|
||||||
|
|||||||
@ -410,21 +410,21 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, EQ::ItemI
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
int QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
std::vector<EQ::Any> *extra_pointers) {
|
||||||
auto iter = _spell_quest_status.find(spell_id);
|
auto iter = _spell_quest_status.find(spell_id);
|
||||||
if(iter != _spell_quest_status.end()) {
|
if(iter != _spell_quest_status.end()) {
|
||||||
//loaded or failed to load
|
//loaded or failed to load
|
||||||
if(iter->second != QuestFailedToLoad) {
|
if(iter->second != QuestFailedToLoad) {
|
||||||
auto qiter = _interfaces.find(iter->second);
|
auto qiter = _interfaces.find(iter->second);
|
||||||
int ret = DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
int ret = DispatchEventSpell(evt, npc, client, spell_id, data, extra_data, extra_pointers);
|
||||||
int i = qiter->second->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
int i = qiter->second->EventSpell(evt, npc, client, spell_id, data, extra_data, extra_pointers);
|
||||||
if(i != 0) {
|
if(i != 0) {
|
||||||
ret = i;
|
ret = i;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
return DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
return DispatchEventSpell(evt, npc, client, spell_id, data, extra_data, extra_pointers);
|
||||||
}
|
}
|
||||||
else if (_spell_quest_status[spell_id] != QuestFailedToLoad) {
|
else if (_spell_quest_status[spell_id] != QuestFailedToLoad) {
|
||||||
std::string filename;
|
std::string filename;
|
||||||
@ -432,8 +432,8 @@ int QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client
|
|||||||
if (qi) {
|
if (qi) {
|
||||||
_spell_quest_status[spell_id] = qi->GetIdentifier();
|
_spell_quest_status[spell_id] = qi->GetIdentifier();
|
||||||
qi->LoadSpellScript(filename, spell_id);
|
qi->LoadSpellScript(filename, spell_id);
|
||||||
int ret = DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
int ret = DispatchEventSpell(evt, npc, client, spell_id, data, extra_data, extra_pointers);
|
||||||
int i = qi->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
int i = qi->EventSpell(evt, npc, client, spell_id, data, extra_data, extra_pointers);
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
ret = i;
|
ret = i;
|
||||||
}
|
}
|
||||||
@ -441,7 +441,7 @@ int QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_spell_quest_status[spell_id] = QuestFailedToLoad;
|
_spell_quest_status[spell_id] = QuestFailedToLoad;
|
||||||
return DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
return DispatchEventSpell(evt, npc, client, spell_id, data, extra_data, extra_pointers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1042,12 +1042,12 @@ int QuestParserCollection::DispatchEventItem(QuestEventID evt, Client *client, E
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
int QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers) {
|
std::vector<EQ::Any> *extra_pointers) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
auto iter = _load_precedence.begin();
|
auto iter = _load_precedence.begin();
|
||||||
while(iter != _load_precedence.end()) {
|
while(iter != _load_precedence.end()) {
|
||||||
int i = (*iter)->DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
int i = (*iter)->DispatchEventSpell(evt, npc, client, spell_id, data, extra_data, extra_pointers);
|
||||||
if(i != 0) {
|
if(i != 0) {
|
||||||
ret = i;
|
ret = i;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ public:
|
|||||||
std::vector<EQ::Any> *extra_pointers = nullptr);
|
std::vector<EQ::Any> *extra_pointers = nullptr);
|
||||||
int EventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
int EventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers = nullptr);
|
std::vector<EQ::Any> *extra_pointers = nullptr);
|
||||||
int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers = nullptr);
|
std::vector<EQ::Any> *extra_pointers = nullptr);
|
||||||
int EventEncounter(QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
|
int EventEncounter(QuestEventID evt, std::string encounter_name, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers = nullptr);
|
std::vector<EQ::Any> *extra_pointers = nullptr);
|
||||||
@ -131,7 +131,7 @@ private:
|
|||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
int DispatchEventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
int DispatchEventItem(QuestEventID evt, Client *client, EQ::ItemInstance *item, Mob *mob, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
int DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, std::string data, uint32 extra_data,
|
||||||
std::vector<EQ::Any> *extra_pointers);
|
std::vector<EQ::Any> *extra_pointers);
|
||||||
|
|
||||||
std::map<uint32, QuestInterface*> _interfaces;
|
std::map<uint32, QuestInterface*> _interfaces;
|
||||||
|
|||||||
@ -161,22 +161,21 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IsNPC())
|
std::string buf = fmt::format(
|
||||||
{
|
"{} {} {} {}",
|
||||||
std::vector<EQ::Any> args;
|
caster->GetID(),
|
||||||
args.push_back(&buffslot);
|
buffs[buffslot].ticsremaining,
|
||||||
int i = parse->EventSpell(EVENT_SPELL_EFFECT_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0, &args);
|
caster->GetLevel(),
|
||||||
if(i != 0){
|
buffslot
|
||||||
|
);
|
||||||
|
|
||||||
|
if (IsClient()) {
|
||||||
|
if (parse->EventSpell(EVENT_SPELL_EFFECT_CLIENT, nullptr, CastToClient(), spell_id, buf, 0) != 0) {
|
||||||
CalcBonuses();
|
CalcBonuses();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} else if (IsNPC()) {
|
||||||
else if(IsClient())
|
if (parse->EventSpell(EVENT_SPELL_EFFECT_NPC, CastToNPC(), nullptr, spell_id, buf, 0) != 0) {
|
||||||
{
|
|
||||||
std::vector<EQ::Any> args;
|
|
||||||
args.push_back(&buffslot);
|
|
||||||
int i = parse->EventSpell(EVENT_SPELL_EFFECT_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0, &args);
|
|
||||||
if(i != 0){
|
|
||||||
CalcBonuses();
|
CalcBonuses();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3750,24 +3749,20 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster)
|
|||||||
|
|
||||||
const SPDat_Spell_Struct &spell = spells[buff.spellid];
|
const SPDat_Spell_Struct &spell = spells[buff.spellid];
|
||||||
|
|
||||||
if (IsNPC()) {
|
std::string buf = fmt::format(
|
||||||
std::vector<EQ::Any> args;
|
"{} {} {} {}",
|
||||||
args.push_back(&buff.ticsremaining);
|
caster->GetID(),
|
||||||
args.push_back(&buff.casterlevel);
|
buffs[slot].ticsremaining,
|
||||||
args.push_back(&slot);
|
caster->GetLevel(),
|
||||||
int i = parse->EventSpell(EVENT_SPELL_BUFF_TIC_NPC, CastToNPC(), nullptr, buff.spellid,
|
slot
|
||||||
caster ? caster->GetID() : 0, &args);
|
);
|
||||||
if (i != 0) {
|
|
||||||
|
if (IsClient()) {
|
||||||
|
if (parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT, nullptr, CastToClient(), buff.spellid, buf, 0) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (IsNPC()) {
|
||||||
std::vector<EQ::Any> args;
|
if (parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_NPC, CastToNPC(), nullptr, buff.spellid, buf, 0) != 0) {
|
||||||
args.push_back(&buff.ticsremaining);
|
|
||||||
args.push_back(&buff.casterlevel);
|
|
||||||
args.push_back(&slot);
|
|
||||||
int i = parse->EventSpell(EVENT_SPELL_BUFF_TIC_CLIENT, nullptr, CastToClient(), buff.spellid,
|
|
||||||
caster ? caster->GetID() : 0, &args);
|
|
||||||
if (i != 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4115,16 +4110,22 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IsClient()) {
|
std::string buf = fmt::format(
|
||||||
std::vector<EQ::Any> args;
|
"{} {} {} {}",
|
||||||
args.push_back(&buffs[slot].casterid);
|
buffs[slot].casterid,
|
||||||
|
buffs[slot].ticsremaining,
|
||||||
|
buffs[slot].casterlevel,
|
||||||
|
slot
|
||||||
|
);
|
||||||
|
|
||||||
parse->EventSpell(EVENT_SPELL_FADE, nullptr, CastToClient(), buffs[slot].spellid, slot, &args);
|
if (IsClient()) {
|
||||||
} else if(IsNPC()) {
|
if (parse->EventSpell(EVENT_SPELL_FADE, nullptr, CastToClient(), buffs[slot].spellid, buf, 0) != 0) {
|
||||||
std::vector<EQ::Any> args;
|
return;
|
||||||
args.push_back(&buffs[slot].casterid);
|
}
|
||||||
|
} else if (IsNPC()) {
|
||||||
parse->EventSpell(EVENT_SPELL_FADE, CastToNPC(), nullptr, buffs[slot].spellid, slot, &args);
|
if (parse->EventSpell(EVENT_SPELL_FADE, CastToNPC(), nullptr, buffs[slot].spellid, buf, 0) != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i < EFFECT_COUNT; i++)
|
for (int i=0; i < EFFECT_COUNT; i++)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user