mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Quest API] Add Timer Events to Perl/Lua (#4099)
* [Quest API] Add Timer Events to Perl/Lua # DRAFT * Cleanup
This commit is contained in:
parent
137a9f835a
commit
db3601c25c
@ -193,6 +193,10 @@ const char* QuestEventSubroutines[_LargestEventID] = {
|
|||||||
"EVENT_ALT_CURRENCY_LOSS",
|
"EVENT_ALT_CURRENCY_LOSS",
|
||||||
"EVENT_CRYSTAL_GAIN",
|
"EVENT_CRYSTAL_GAIN",
|
||||||
"EVENT_CRYSTAL_LOSS",
|
"EVENT_CRYSTAL_LOSS",
|
||||||
|
"EVENT_TIMER_PAUSE",
|
||||||
|
"EVENT_TIMER_RESUME",
|
||||||
|
"EVENT_TIMER_START",
|
||||||
|
"EVENT_TIMER_STOP",
|
||||||
|
|
||||||
// Add new events before these or Lua crashes
|
// Add new events before these or Lua crashes
|
||||||
"EVENT_SPELL_EFFECT_BOT",
|
"EVENT_SPELL_EFFECT_BOT",
|
||||||
@ -1668,11 +1672,21 @@ void PerlembParser::ExportEventVariables(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EVENT_TIMER: {
|
case EVENT_TIMER:
|
||||||
|
case EVENT_TIMER_STOP: {
|
||||||
ExportVar(package_name.c_str(), "timer", data);
|
ExportVar(package_name.c_str(), "timer", data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case EVENT_TIMER_PAUSE:
|
||||||
|
case EVENT_TIMER_RESUME:
|
||||||
|
case EVENT_TIMER_START: {
|
||||||
|
Seperator sep(data);
|
||||||
|
ExportVar(package_name.c_str(), "timer", sep.arg[0]);
|
||||||
|
ExportVar(package_name.c_str(), "duration", sep.arg[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case EVENT_SIGNAL: {
|
case EVENT_SIGNAL: {
|
||||||
ExportVar(package_name.c_str(), "signal", data);
|
ExportVar(package_name.c_str(), "signal", data);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -353,47 +353,67 @@ void Perl__zoneraid(const char* zone_name)
|
|||||||
quest_manager.ZoneRaid(zone_name);
|
quest_manager.ZoneRaid(zone_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Perl__hastimer(const char* timer_name)
|
bool Perl__hastimer(std::string timer_name)
|
||||||
{
|
{
|
||||||
return quest_manager.hastimer(timer_name);
|
return quest_manager.hastimer(timer_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Perl__ispausedtimer(const char* timer_name)
|
bool Perl__ispausedtimer(std::string timer_name)
|
||||||
{
|
{
|
||||||
return quest_manager.ispausedtimer(timer_name);
|
return quest_manager.ispausedtimer(timer_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Perl__getremainingtimeMS(const char* timer_name)
|
uint32_t Perl__getremainingtimeMS(std::string timer_name)
|
||||||
{
|
{
|
||||||
return quest_manager.getremainingtimeMS(timer_name);
|
return quest_manager.getremainingtimeMS(timer_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Perl__gettimerdurationMS(const char* timer_name)
|
uint32_t Perl__gettimerdurationMS(std::string timer_name)
|
||||||
{
|
{
|
||||||
return quest_manager.gettimerdurationMS(timer_name);
|
return quest_manager.gettimerdurationMS(timer_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Perl__settimer(const char* timer_name, int seconds)
|
void Perl__settimer(std::string timer_name, uint32 seconds)
|
||||||
{
|
{
|
||||||
quest_manager.settimer(timer_name, seconds);
|
quest_manager.settimer(timer_name, seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Perl__settimerMS(const char* timer_name, int milliseconds)
|
void Perl__settimer(std::string timer_name, uint32 seconds, Mob* m)
|
||||||
|
{
|
||||||
|
quest_manager.settimer(timer_name, seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl__settimer(std::string timer_name, uint32 seconds, EQ::ItemInstance* inst)
|
||||||
|
{
|
||||||
|
quest_manager.settimer(timer_name, seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl__settimerMS(std::string timer_name, uint32 milliseconds)
|
||||||
{
|
{
|
||||||
quest_manager.settimerMS(timer_name, milliseconds);
|
quest_manager.settimerMS(timer_name, milliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Perl__pausetimer(const char* timer_name)
|
void Perl__settimerMS(std::string timer_name, uint32 milliseconds, Mob* m)
|
||||||
|
{
|
||||||
|
quest_manager.settimerMS(timer_name, milliseconds, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl__settimerMS(std::string timer_name, uint32 milliseconds, EQ::ItemInstance* inst)
|
||||||
|
{
|
||||||
|
quest_manager.settimerMS(timer_name, milliseconds, inst);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl__pausetimer(std::string timer_name)
|
||||||
{
|
{
|
||||||
quest_manager.pausetimer(timer_name);
|
quest_manager.pausetimer(timer_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Perl__resumetimer(const char* timer_name)
|
void Perl__resumetimer(std::string timer_name)
|
||||||
{
|
{
|
||||||
quest_manager.resumetimer(timer_name);
|
quest_manager.resumetimer(timer_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Perl__stoptimer(const char* timer_name)
|
void Perl__stoptimer(std::string timer_name)
|
||||||
{
|
{
|
||||||
quest_manager.stoptimer(timer_name);
|
quest_manager.stoptimer(timer_name);
|
||||||
}
|
}
|
||||||
@ -6606,8 +6626,12 @@ void perl_register_quest()
|
|||||||
package.add("settarget", &Perl__settarget);
|
package.add("settarget", &Perl__settarget);
|
||||||
package.add("settime", (void(*)(int, int))&Perl__settime);
|
package.add("settime", (void(*)(int, int))&Perl__settime);
|
||||||
package.add("settime", (void(*)(int, int, bool))&Perl__settime);
|
package.add("settime", (void(*)(int, int, bool))&Perl__settime);
|
||||||
package.add("settimer", &Perl__settimer);
|
package.add("set_timer", (void(*)(std::string, uint32))&Perl__settimer),
|
||||||
package.add("settimerMS", &Perl__settimerMS);
|
package.add("set_timer", (void(*)(std::string, uint32, EQ::ItemInstance*))&Perl__settimer),
|
||||||
|
package.add("set_timer", (void(*)(std::string, uint32, Mob*))&Perl__settimer),
|
||||||
|
package.add("settimerMS", (void(*)(std::string, uint32))&Perl__settimerMS);
|
||||||
|
package.add("settimerMS", (void(*)(std::string, uint32, EQ::ItemInstance*))&Perl__settimerMS);
|
||||||
|
package.add("settimerMS", (void(*)(std::string, uint32, Mob*))&Perl__settimerMS);
|
||||||
package.add("sfollow", &Perl__sfollow);
|
package.add("sfollow", &Perl__sfollow);
|
||||||
package.add("shout", &Perl__shout);
|
package.add("shout", &Perl__shout);
|
||||||
package.add("shout2", &Perl__shout2);
|
package.add("shout2", &Perl__shout2);
|
||||||
|
|||||||
@ -135,6 +135,10 @@ typedef enum {
|
|||||||
EVENT_ALT_CURRENCY_LOSS,
|
EVENT_ALT_CURRENCY_LOSS,
|
||||||
EVENT_CRYSTAL_GAIN,
|
EVENT_CRYSTAL_GAIN,
|
||||||
EVENT_CRYSTAL_LOSS,
|
EVENT_CRYSTAL_LOSS,
|
||||||
|
EVENT_TIMER_PAUSE,
|
||||||
|
EVENT_TIMER_RESUME,
|
||||||
|
EVENT_TIMER_START,
|
||||||
|
EVENT_TIMER_STOP,
|
||||||
|
|
||||||
// Add new events before these or Lua crashes
|
// Add new events before these or Lua crashes
|
||||||
EVENT_SPELL_EFFECT_BOT,
|
EVENT_SPELL_EFFECT_BOT,
|
||||||
|
|||||||
@ -299,35 +299,35 @@ void lua_disable_spawn2(int spawn2_id) {
|
|||||||
quest_manager.disable_spawn2(spawn2_id);
|
quest_manager.disable_spawn2(spawn2_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_set_timer(const char *timer, int time_ms) {
|
void lua_set_timer(std::string timer, uint32 time_ms) {
|
||||||
quest_manager.settimerMS(timer, time_ms);
|
quest_manager.settimerMS(timer, time_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_set_timer(const char *timer, int time_ms, Lua_ItemInst inst) {
|
void lua_set_timer(std::string timer, uint32 time_ms, Lua_ItemInst inst) {
|
||||||
quest_manager.settimerMS(timer, time_ms, inst);
|
quest_manager.settimerMS(timer, time_ms, inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_set_timer(const char *timer, int time_ms, Lua_Mob mob) {
|
void lua_set_timer(std::string timer, uint32 time_ms, Lua_Mob mob) {
|
||||||
quest_manager.settimerMS(timer, time_ms, mob);
|
quest_manager.settimerMS(timer, time_ms, mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_set_timer(const char *timer, int time_ms, Lua_Encounter enc) {
|
void lua_set_timer(std::string timer, uint32 time_ms, Lua_Encounter enc) {
|
||||||
quest_manager.settimerMS(timer, time_ms, enc);
|
quest_manager.settimerMS(timer, time_ms, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_stop_timer(const char *timer) {
|
void lua_stop_timer(std::string timer) {
|
||||||
quest_manager.stoptimer(timer);
|
quest_manager.stoptimer(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_stop_timer(const char *timer, Lua_ItemInst inst) {
|
void lua_stop_timer(std::string timer, Lua_ItemInst inst) {
|
||||||
quest_manager.stoptimer(timer, inst);
|
quest_manager.stoptimer(timer, inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_stop_timer(const char *timer, Lua_Mob mob) {
|
void lua_stop_timer(std::string timer, Lua_Mob mob) {
|
||||||
quest_manager.stoptimer(timer, mob);
|
quest_manager.stoptimer(timer, mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_stop_timer(const char *timer, Lua_Encounter enc) {
|
void lua_stop_timer(std::string timer, Lua_Encounter enc) {
|
||||||
quest_manager.stoptimer(timer, enc);
|
quest_manager.stoptimer(timer, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,27 +347,27 @@ void lua_stop_all_timers(Lua_Encounter enc) {
|
|||||||
quest_manager.stopalltimers(enc);
|
quest_manager.stopalltimers(enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_pause_timer(const char *timer) {
|
void lua_pause_timer(std::string timer) {
|
||||||
quest_manager.pausetimer(timer);
|
quest_manager.pausetimer(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lua_resume_timer(const char *timer) {
|
void lua_resume_timer(std::string timer) {
|
||||||
quest_manager.resumetimer(timer);
|
quest_manager.resumetimer(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lua_is_paused_timer(const char *timer) {
|
bool lua_is_paused_timer(std::string timer) {
|
||||||
return quest_manager.ispausedtimer(timer);
|
return quest_manager.ispausedtimer(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lua_has_timer(const char *timer) {
|
bool lua_has_timer(std::string timer) {
|
||||||
return quest_manager.hastimer(timer);
|
return quest_manager.hastimer(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 lua_get_remaining_time(const char *timer) {
|
uint32 lua_get_remaining_time(std::string timer) {
|
||||||
return quest_manager.getremainingtimeMS(timer);
|
return quest_manager.getremainingtimeMS(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 lua_get_timer_duration(const char *timer) {
|
uint32 lua_get_timer_duration(std::string timer) {
|
||||||
return quest_manager.gettimerdurationMS(timer);
|
return quest_manager.gettimerdurationMS(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5623,20 +5623,20 @@ luabind::scope lua_register_general() {
|
|||||||
luabind::def("spawn_from_spawn2", (Lua_Mob(*)(uint32))&lua_spawn_from_spawn2),
|
luabind::def("spawn_from_spawn2", (Lua_Mob(*)(uint32))&lua_spawn_from_spawn2),
|
||||||
luabind::def("enable_spawn2", &lua_enable_spawn2),
|
luabind::def("enable_spawn2", &lua_enable_spawn2),
|
||||||
luabind::def("disable_spawn2", &lua_disable_spawn2),
|
luabind::def("disable_spawn2", &lua_disable_spawn2),
|
||||||
luabind::def("has_timer", (bool(*)(const char*))&lua_has_timer),
|
luabind::def("has_timer", (bool(*)(std::string))&lua_has_timer),
|
||||||
luabind::def("get_remaining_time", (uint32(*)(const char*))&lua_get_remaining_time),
|
luabind::def("get_remaining_time", (uint32(*)(std::string))&lua_get_remaining_time),
|
||||||
luabind::def("get_timer_duration", (uint32(*)(const char*))&lua_get_timer_duration),
|
luabind::def("get_timer_duration", (uint32(*)(std::string))&lua_get_timer_duration),
|
||||||
luabind::def("set_timer", (void(*)(const char*, int))&lua_set_timer),
|
luabind::def("set_timer", (void(*)(std::string, uint32))&lua_set_timer),
|
||||||
luabind::def("set_timer", (void(*)(const char*, int, Lua_ItemInst))&lua_set_timer),
|
luabind::def("set_timer", (void(*)(std::string, uint32, Lua_ItemInst))&lua_set_timer),
|
||||||
luabind::def("set_timer", (void(*)(const char*, int, Lua_Mob))&lua_set_timer),
|
luabind::def("set_timer", (void(*)(std::string, uint32, Lua_Mob))&lua_set_timer),
|
||||||
luabind::def("set_timer", (void(*)(const char*, int, Lua_Encounter))&lua_set_timer),
|
luabind::def("set_timer", (void(*)(std::string, uint32, Lua_Encounter))&lua_set_timer),
|
||||||
luabind::def("stop_timer", (void(*)(const char*))&lua_stop_timer),
|
luabind::def("stop_timer", (void(*)(std::string))&lua_stop_timer),
|
||||||
luabind::def("stop_timer", (void(*)(const char*, Lua_ItemInst))&lua_stop_timer),
|
luabind::def("stop_timer", (void(*)(std::string, Lua_ItemInst))&lua_stop_timer),
|
||||||
luabind::def("stop_timer", (void(*)(const char*, Lua_Mob))&lua_stop_timer),
|
luabind::def("stop_timer", (void(*)(std::string, Lua_Mob))&lua_stop_timer),
|
||||||
luabind::def("stop_timer", (void(*)(const char*, Lua_Encounter))&lua_stop_timer),
|
luabind::def("stop_timer", (void(*)(std::string, Lua_Encounter))&lua_stop_timer),
|
||||||
luabind::def("pause_timer", (void(*)(const char*))&lua_pause_timer),
|
luabind::def("pause_timer", (void(*)(std::string))&lua_pause_timer),
|
||||||
luabind::def("resume_timer", (void(*)(const char*))&lua_resume_timer),
|
luabind::def("resume_timer", (void(*)(std::string))&lua_resume_timer),
|
||||||
luabind::def("is_paused_timer", (bool(*)(const char*))&lua_is_paused_timer),
|
luabind::def("is_paused_timer", (bool(*)(std::string))&lua_is_paused_timer),
|
||||||
luabind::def("stop_all_timers", (void(*)(void))&lua_stop_all_timers),
|
luabind::def("stop_all_timers", (void(*)(void))&lua_stop_all_timers),
|
||||||
luabind::def("stop_all_timers", (void(*)(Lua_ItemInst))&lua_stop_all_timers),
|
luabind::def("stop_all_timers", (void(*)(Lua_ItemInst))&lua_stop_all_timers),
|
||||||
luabind::def("stop_all_timers", (void(*)(Lua_Mob))&lua_stop_all_timers),
|
luabind::def("stop_all_timers", (void(*)(Lua_Mob))&lua_stop_all_timers),
|
||||||
@ -6656,7 +6656,11 @@ luabind::scope lua_register_events() {
|
|||||||
luabind::value("alt_currency_gain", static_cast<int>(EVENT_ALT_CURRENCY_GAIN)),
|
luabind::value("alt_currency_gain", static_cast<int>(EVENT_ALT_CURRENCY_GAIN)),
|
||||||
luabind::value("alt_currency_loss", static_cast<int>(EVENT_ALT_CURRENCY_LOSS)),
|
luabind::value("alt_currency_loss", static_cast<int>(EVENT_ALT_CURRENCY_LOSS)),
|
||||||
luabind::value("crystal_gain", static_cast<int>(EVENT_CRYSTAL_GAIN)),
|
luabind::value("crystal_gain", static_cast<int>(EVENT_CRYSTAL_GAIN)),
|
||||||
luabind::value("crystal_loss", static_cast<int>(EVENT_CRYSTAL_LOSS))
|
luabind::value("crystal_loss", static_cast<int>(EVENT_CRYSTAL_LOSS)),
|
||||||
|
luabind::value("timer_pause", static_cast<int>(EVENT_TIMER_PAUSE)),
|
||||||
|
luabind::value("timer_resume", static_cast<int>(EVENT_TIMER_RESUME)),
|
||||||
|
luabind::value("timer_start", static_cast<int>(EVENT_TIMER_START)),
|
||||||
|
luabind::value("timer_stop", static_cast<int>(EVENT_TIMER_STOP))
|
||||||
)];
|
)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -175,7 +175,11 @@ const char *LuaEvents[_LargestEventID] = {
|
|||||||
"event_alt_currency_gain",
|
"event_alt_currency_gain",
|
||||||
"event_alt_currency_loss",
|
"event_alt_currency_loss",
|
||||||
"event_crystal_gain",
|
"event_crystal_gain",
|
||||||
"event_crystal_loss"
|
"event_crystal_loss",
|
||||||
|
"event_timer_pause",
|
||||||
|
"event_timer_resume",
|
||||||
|
"event_timer_start",
|
||||||
|
"event_timer_stop",
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Zone *zone;
|
extern Zone *zone;
|
||||||
@ -242,6 +246,10 @@ LuaParser::LuaParser() {
|
|||||||
NPCArgumentDispatch[EVENT_DAMAGE_GIVEN] = handle_npc_damage;
|
NPCArgumentDispatch[EVENT_DAMAGE_GIVEN] = handle_npc_damage;
|
||||||
NPCArgumentDispatch[EVENT_DAMAGE_TAKEN] = handle_npc_damage;
|
NPCArgumentDispatch[EVENT_DAMAGE_TAKEN] = handle_npc_damage;
|
||||||
NPCArgumentDispatch[EVENT_LOOT_ADDED] = handle_npc_loot_added;
|
NPCArgumentDispatch[EVENT_LOOT_ADDED] = handle_npc_loot_added;
|
||||||
|
NPCArgumentDispatch[EVENT_TIMER_PAUSE] = handle_npc_timer_pause_resume_start;
|
||||||
|
NPCArgumentDispatch[EVENT_TIMER_RESUME] = handle_npc_timer_pause_resume_start;
|
||||||
|
NPCArgumentDispatch[EVENT_TIMER_START] = handle_npc_timer_pause_resume_start;
|
||||||
|
NPCArgumentDispatch[EVENT_TIMER_STOP] = handle_npc_timer_stop;
|
||||||
|
|
||||||
PlayerArgumentDispatch[EVENT_SAY] = handle_player_say;
|
PlayerArgumentDispatch[EVENT_SAY] = handle_player_say;
|
||||||
PlayerArgumentDispatch[EVENT_ENVIRONMENTAL_DAMAGE] = handle_player_environmental_damage;
|
PlayerArgumentDispatch[EVENT_ENVIRONMENTAL_DAMAGE] = handle_player_environmental_damage;
|
||||||
@ -322,6 +330,10 @@ LuaParser::LuaParser() {
|
|||||||
PlayerArgumentDispatch[EVENT_ALT_CURRENCY_LOSS] = handle_player_alt_currency_gain_loss;
|
PlayerArgumentDispatch[EVENT_ALT_CURRENCY_LOSS] = handle_player_alt_currency_gain_loss;
|
||||||
PlayerArgumentDispatch[EVENT_CRYSTAL_GAIN] = handle_player_crystal_gain_loss;
|
PlayerArgumentDispatch[EVENT_CRYSTAL_GAIN] = handle_player_crystal_gain_loss;
|
||||||
PlayerArgumentDispatch[EVENT_CRYSTAL_LOSS] = handle_player_crystal_gain_loss;
|
PlayerArgumentDispatch[EVENT_CRYSTAL_LOSS] = handle_player_crystal_gain_loss;
|
||||||
|
PlayerArgumentDispatch[EVENT_TIMER_PAUSE] = handle_player_timer_pause_resume_start;
|
||||||
|
PlayerArgumentDispatch[EVENT_TIMER_RESUME] = handle_player_timer_pause_resume_start;
|
||||||
|
PlayerArgumentDispatch[EVENT_TIMER_START] = handle_player_timer_pause_resume_start;
|
||||||
|
PlayerArgumentDispatch[EVENT_TIMER_STOP] = handle_player_timer_stop;
|
||||||
|
|
||||||
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
||||||
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
|
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
|
||||||
@ -334,6 +346,10 @@ LuaParser::LuaParser() {
|
|||||||
ItemArgumentDispatch[EVENT_UNAUGMENT_ITEM] = handle_item_augment;
|
ItemArgumentDispatch[EVENT_UNAUGMENT_ITEM] = handle_item_augment;
|
||||||
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;
|
||||||
|
ItemArgumentDispatch[EVENT_TIMER_PAUSE] = handle_item_timer_pause_resume_start;
|
||||||
|
ItemArgumentDispatch[EVENT_TIMER_RESUME] = handle_item_timer_pause_resume_start;
|
||||||
|
ItemArgumentDispatch[EVENT_TIMER_START] = handle_item_timer_pause_resume_start;
|
||||||
|
ItemArgumentDispatch[EVENT_TIMER_STOP] = handle_item_timer_stop;
|
||||||
|
|
||||||
SpellArgumentDispatch[EVENT_SPELL_EFFECT_CLIENT] = handle_spell_event;
|
SpellArgumentDispatch[EVENT_SPELL_EFFECT_CLIENT] = handle_spell_event;
|
||||||
SpellArgumentDispatch[EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT] = handle_spell_event;
|
SpellArgumentDispatch[EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT] = handle_spell_event;
|
||||||
@ -365,6 +381,10 @@ LuaParser::LuaParser() {
|
|||||||
BotArgumentDispatch[EVENT_DAMAGE_TAKEN] = handle_bot_damage;
|
BotArgumentDispatch[EVENT_DAMAGE_TAKEN] = handle_bot_damage;
|
||||||
BotArgumentDispatch[EVENT_LEVEL_UP] = handle_bot_level_up;
|
BotArgumentDispatch[EVENT_LEVEL_UP] = handle_bot_level_up;
|
||||||
BotArgumentDispatch[EVENT_LEVEL_DOWN] = handle_bot_level_down;
|
BotArgumentDispatch[EVENT_LEVEL_DOWN] = handle_bot_level_down;
|
||||||
|
BotArgumentDispatch[EVENT_TIMER_PAUSE] = handle_bot_timer_pause_resume_start;
|
||||||
|
BotArgumentDispatch[EVENT_TIMER_RESUME] = handle_bot_timer_pause_resume_start;
|
||||||
|
BotArgumentDispatch[EVENT_TIMER_START] = handle_bot_timer_pause_resume_start;
|
||||||
|
BotArgumentDispatch[EVENT_TIMER_STOP] = handle_bot_timer_stop;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
L = nullptr;
|
L = nullptr;
|
||||||
|
|||||||
@ -553,6 +553,37 @@ void handle_npc_loot_added(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handle_npc_timer_pause_resume_start(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
NPC* npc,
|
||||||
|
Mob *init,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
) {
|
||||||
|
Seperator sep(data.c_str());
|
||||||
|
|
||||||
|
lua_pushstring(L, sep.arg[0]);
|
||||||
|
lua_setfield(L, -2, "timer");
|
||||||
|
|
||||||
|
lua_pushinteger(L, Strings::ToUnsignedInt(sep.arg[1]));
|
||||||
|
lua_setfield(L, -2, "duration");
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_npc_timer_stop(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
NPC* npc,
|
||||||
|
Mob *init,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
) {
|
||||||
|
lua_pushstring(L, data.c_str());
|
||||||
|
lua_setfield(L, -2, "timer");
|
||||||
|
}
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
void handle_player_say(
|
void handle_player_say(
|
||||||
QuestInterface *parse,
|
QuestInterface *parse,
|
||||||
@ -1731,6 +1762,39 @@ void handle_item_null(
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handle_item_timer_pause_resume_start(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Client* client,
|
||||||
|
EQ::ItemInstance* item,
|
||||||
|
Mob *mob,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
) {
|
||||||
|
Seperator sep(data.c_str());
|
||||||
|
|
||||||
|
lua_pushstring(L, sep.arg[0]);
|
||||||
|
lua_setfield(L, -2, "timer");
|
||||||
|
|
||||||
|
lua_pushinteger(L, Strings::ToUnsignedInt(sep.arg[1]));
|
||||||
|
lua_setfield(L, -2, "duration");
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_item_timer_stop(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Client* client,
|
||||||
|
EQ::ItemInstance* item,
|
||||||
|
Mob *mob,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
) {
|
||||||
|
lua_pushstring(L, data.c_str());
|
||||||
|
lua_setfield(L, -2, "timer");
|
||||||
|
}
|
||||||
|
|
||||||
// Spell
|
// Spell
|
||||||
void handle_spell_event(
|
void handle_spell_event(
|
||||||
QuestInterface *parse,
|
QuestInterface *parse,
|
||||||
@ -2061,6 +2125,35 @@ void handle_player_augment_remove(
|
|||||||
lua_setfield(L, -2, "destroyed");
|
lua_setfield(L, -2, "destroyed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handle_player_timer_pause_resume_start(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Client* client,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
) {
|
||||||
|
Seperator sep(data.c_str());
|
||||||
|
|
||||||
|
lua_pushstring(L, sep.arg[0]);
|
||||||
|
lua_setfield(L, -2, "timer");
|
||||||
|
|
||||||
|
lua_pushinteger(L, Strings::ToUnsignedInt(sep.arg[1]));
|
||||||
|
lua_setfield(L, -2, "duration");
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_player_timer_stop(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Client* client,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
) {
|
||||||
|
lua_pushstring(L, data.c_str());
|
||||||
|
lua_setfield(L, -2, "timer");
|
||||||
|
}
|
||||||
|
|
||||||
// Bot
|
// Bot
|
||||||
|
|
||||||
void handle_bot_null(
|
void handle_bot_null(
|
||||||
@ -2453,4 +2546,35 @@ void handle_bot_level_down(
|
|||||||
lua_setfield(L, -2, "levels_lost");
|
lua_setfield(L, -2, "levels_lost");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handle_bot_timer_pause_resume_start(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Bot* bot,
|
||||||
|
Mob *init,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
) {
|
||||||
|
Seperator sep(data.c_str());
|
||||||
|
|
||||||
|
lua_pushstring(L, sep.arg[0]);
|
||||||
|
lua_setfield(L, -2, "timer");
|
||||||
|
|
||||||
|
lua_pushinteger(L, Strings::ToUnsignedInt(sep.arg[1]));
|
||||||
|
lua_setfield(L, -2, "duration");
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_bot_timer_stop(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Bot* bot,
|
||||||
|
Mob *init,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
) {
|
||||||
|
lua_pushstring(L, data.c_str());
|
||||||
|
lua_setfield(L, -2, "timer");
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -220,6 +220,26 @@ void handle_npc_loot_added(
|
|||||||
std::vector<std::any> *extra_pointers
|
std::vector<std::any> *extra_pointers
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void handle_npc_timer_pause_resume_start(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
NPC* npc,
|
||||||
|
Mob *init,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
);
|
||||||
|
|
||||||
|
void handle_npc_timer_stop(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
NPC* npc,
|
||||||
|
Mob *init,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
);
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
void handle_player_say(
|
void handle_player_say(
|
||||||
QuestInterface *parse,
|
QuestInterface *parse,
|
||||||
@ -770,6 +790,24 @@ void handle_player_crystal_gain_loss(
|
|||||||
std::vector<std::any> *extra_pointers
|
std::vector<std::any> *extra_pointers
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void handle_player_timer_pause_resume_start(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Client* client,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
);
|
||||||
|
|
||||||
|
void handle_player_timer_stop(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Client* client,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
);
|
||||||
|
|
||||||
// Item
|
// Item
|
||||||
void handle_item_click(
|
void handle_item_click(
|
||||||
QuestInterface *parse,
|
QuestInterface *parse,
|
||||||
@ -870,6 +908,28 @@ void handle_item_null(
|
|||||||
std::vector<std::any> *extra_pointers
|
std::vector<std::any> *extra_pointers
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void handle_item_timer_pause_resume_start(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Client* client,
|
||||||
|
EQ::ItemInstance* item,
|
||||||
|
Mob *mob,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
);
|
||||||
|
|
||||||
|
void handle_item_timer_stop(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Client* client,
|
||||||
|
EQ::ItemInstance* item,
|
||||||
|
Mob *mob,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
);
|
||||||
|
|
||||||
// Spell
|
// Spell
|
||||||
void handle_spell_event(
|
void handle_spell_event(
|
||||||
QuestInterface *parse,
|
QuestInterface *parse,
|
||||||
@ -1112,5 +1172,25 @@ void handle_bot_level_down(
|
|||||||
std::vector<std::any> *extra_pointers
|
std::vector<std::any> *extra_pointers
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void handle_bot_timer_pause_resume_start(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Bot* bot,
|
||||||
|
Mob* init,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
);
|
||||||
|
|
||||||
|
void handle_bot_timer_stop(
|
||||||
|
QuestInterface *parse,
|
||||||
|
lua_State* L,
|
||||||
|
Bot* bot,
|
||||||
|
Mob* init,
|
||||||
|
std::string data,
|
||||||
|
uint32 extra_data,
|
||||||
|
std::vector<std::any> *extra_pointers
|
||||||
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -500,317 +500,698 @@ void QuestManager::ZoneRaid(const char *zone_name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::settimer(const char* timer_name, int seconds, Mob* mob) {
|
void QuestManager::settimer(const std::string& timer_name, uint32 seconds, Mob* m)
|
||||||
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(questitem) {
|
if (questitem) {
|
||||||
questitem->SetTimer(timer_name, seconds * 1000);
|
questitem->SetTimer(timer_name, seconds * 1000);
|
||||||
|
|
||||||
|
if (parse->ItemHasQuestSub(questitem, EVENT_TIMER_START)) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
timer_name,
|
||||||
|
seconds * 1000
|
||||||
|
);
|
||||||
|
|
||||||
|
parse->EventItem(EVENT_TIMER_START, nullptr, questitem, nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
if (!m && !owner) {
|
||||||
|
return;
|
||||||
end = QTimerList.end();
|
|
||||||
|
|
||||||
const auto m = mob ? mob : owner;
|
|
||||||
|
|
||||||
while (cur != end) {
|
|
||||||
if (cur->mob && cur->mob == m && cur->name == timer_name) {
|
|
||||||
cur->Timer_.Enable();
|
|
||||||
cur->Timer_.Start(seconds * 1000, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimerList.emplace_back(QuestTimer(seconds * 1000, owner, timer_name));
|
Mob* mob = m ? m : owner;
|
||||||
|
|
||||||
|
if (!mob) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool has_start_event = (
|
||||||
|
(mob->IsClient() && parse->PlayerHasQuestSub(EVENT_TIMER_START)) ||
|
||||||
|
(mob->IsBot() && parse->BotHasQuestSub(EVENT_TIMER_START)) ||
|
||||||
|
(mob->IsNPC() && parse->HasQuestSub(mob->GetNPCTypeID(), EVENT_TIMER_START))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!QTimerList.empty()) {
|
||||||
|
for (auto e : QTimerList) {
|
||||||
|
if (e.mob && e.mob == mob && e.name == timer_name) {
|
||||||
|
e.Timer_.Enable();
|
||||||
|
e.Timer_.Start(seconds * 1000, false);
|
||||||
|
|
||||||
|
if (has_start_event) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
timer_name,
|
||||||
|
seconds * 1000
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mob->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_START, mob->CastToClient(), export_string, 0);
|
||||||
|
} else if (mob->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_START, mob->CastToBot(), nullptr, export_string, 0);
|
||||||
|
} else if (mob->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_START, mob->CastToNPC(), nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QTimerList.emplace_back(QuestTimer(seconds * 1000, mob, timer_name));
|
||||||
|
|
||||||
|
if (has_start_event) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
timer_name,
|
||||||
|
seconds * 1000
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mob->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_START, mob->CastToClient(), export_string, 0);
|
||||||
|
} else if (mob->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_START, mob->CastToBot(), nullptr, export_string, 0);
|
||||||
|
} else if (mob->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_START, mob->CastToNPC(), nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::settimerMS(const char* timer_name, int milliseconds) {
|
void QuestManager::settimerMS(const std::string& timer_name, uint32 milliseconds)
|
||||||
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(questitem) {
|
if (!owner) {
|
||||||
questitem->SetTimer(timer_name, milliseconds);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
const bool has_start_event = (
|
||||||
|
(owner->IsClient() && parse->PlayerHasQuestSub(EVENT_TIMER_START)) ||
|
||||||
|
(owner->IsBot() && parse->BotHasQuestSub(EVENT_TIMER_START)) ||
|
||||||
|
(owner->IsNPC() && parse->HasQuestSub(owner->GetNPCTypeID(), EVENT_TIMER_START))
|
||||||
|
);
|
||||||
|
|
||||||
end = QTimerList.end();
|
if (questitem) {
|
||||||
while (cur != end) {
|
questitem->SetTimer(timer_name, milliseconds);
|
||||||
if(cur->mob && cur->mob == owner && cur->name == timer_name)
|
|
||||||
{
|
if (parse->ItemHasQuestSub(questitem, EVENT_TIMER_START)) {
|
||||||
cur->Timer_.Enable();
|
const std::string& export_string = fmt::format(
|
||||||
cur->Timer_.Start(milliseconds, false);
|
"{} {}",
|
||||||
return;
|
timer_name,
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
parse->EventItem(EVENT_TIMER_START, nullptr, questitem, nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!QTimerList.empty()) {
|
||||||
|
for (auto e : QTimerList) {
|
||||||
|
if (e.mob && e.mob == owner && e.name == timer_name) {
|
||||||
|
e.Timer_.Enable();
|
||||||
|
e.Timer_.Start(milliseconds, false);
|
||||||
|
|
||||||
|
if (has_start_event) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
e.name,
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
if (owner->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_START, owner->CastToClient(), export_string, 0);
|
||||||
|
} else if (owner->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_START, owner->CastToBot(), nullptr, export_string, 0);
|
||||||
|
} else if (owner->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_START, owner->CastToNPC(), nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimerList.emplace_back(QuestTimer(milliseconds, owner, timer_name));
|
QTimerList.emplace_back(QuestTimer(milliseconds, owner, timer_name));
|
||||||
|
|
||||||
|
if (has_start_event) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
timer_name,
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
if (owner->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_START, owner->CastToClient(), export_string, 0);
|
||||||
|
} else if (owner->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_START, owner->CastToBot(), nullptr, export_string, 0);
|
||||||
|
} else if (owner->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_START, owner->CastToNPC(), nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::settimerMS(const char* timer_name, int milliseconds, EQ::ItemInstance *inst) {
|
void QuestManager::settimerMS(const std::string& timer_name, uint32 milliseconds, EQ::ItemInstance* inst)
|
||||||
|
{
|
||||||
if (inst) {
|
if (inst) {
|
||||||
inst->SetTimer(timer_name, milliseconds);
|
inst->SetTimer(timer_name, milliseconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::settimerMS(const char* timer_name, int milliseconds, Mob *mob) {
|
void QuestManager::settimerMS(const std::string& timer_name, uint32 milliseconds, Mob* m)
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
{
|
||||||
|
if (!m) {
|
||||||
end = QTimerList.end();
|
return;
|
||||||
while (cur != end) {
|
|
||||||
if (cur->mob && cur->mob == mob && cur->name == timer_name)
|
|
||||||
{
|
|
||||||
cur->Timer_.Enable();
|
|
||||||
cur->Timer_.Start(milliseconds, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimerList.emplace_back(QuestTimer(milliseconds, mob, timer_name));
|
const bool has_start_event = (
|
||||||
|
(m->IsClient() && parse->PlayerHasQuestSub(EVENT_TIMER_START)) ||
|
||||||
|
(m->IsBot() && parse->BotHasQuestSub(EVENT_TIMER_START)) ||
|
||||||
|
(m->IsNPC() && parse->HasQuestSub(m->GetNPCTypeID(), EVENT_TIMER_START))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!QTimerList.empty()) {
|
||||||
|
for (auto e : QTimerList) {
|
||||||
|
if (e.mob && e.mob == m && e.name == timer_name) {
|
||||||
|
e.Timer_.Enable();
|
||||||
|
e.Timer_.Start(milliseconds, false);
|
||||||
|
|
||||||
|
if (has_start_event) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
timer_name,
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
if (m->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_START, m->CastToClient(), export_string, 0);
|
||||||
|
} else if (m->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_START, m->CastToBot(), nullptr, export_string, 0);
|
||||||
|
} else if (m->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_START, m->CastToNPC(), nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QTimerList.emplace_back(QuestTimer(milliseconds, m, timer_name));
|
||||||
|
|
||||||
|
if (has_start_event) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
timer_name,
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
if (m->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_START, m->CastToClient(), export_string, 0);
|
||||||
|
} else if (m->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_START, m->CastToBot(), nullptr, export_string, 0);
|
||||||
|
} else if (m->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_START, m->CastToNPC(), nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::stoptimer(const char* timer_name) {
|
void QuestManager::stoptimer(const std::string& timer_name)
|
||||||
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if (questitem) {
|
if (questitem) {
|
||||||
questitem->StopTimer(timer_name);
|
questitem->StopTimer(timer_name);
|
||||||
|
|
||||||
|
if (parse->ItemHasQuestSub(questitem, EVENT_TIMER_STOP)) {
|
||||||
|
parse->EventItem(EVENT_TIMER_STOP, nullptr, questitem, nullptr, timer_name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
if (!owner) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
end = QTimerList.end();
|
if (QTimerList.empty()) {
|
||||||
while (cur != end) {
|
return;
|
||||||
if (cur->mob && cur->mob == owner && cur->name == timer_name) {
|
}
|
||||||
QTimerList.erase(cur);
|
|
||||||
return;
|
const bool has_stop_event = (
|
||||||
|
(owner->IsClient() && parse->PlayerHasQuestSub(EVENT_TIMER_STOP)) ||
|
||||||
|
(owner->IsBot() && parse->BotHasQuestSub(EVENT_TIMER_STOP)) ||
|
||||||
|
(owner->IsNPC() && parse->HasQuestSub(owner->GetNPCTypeID(), EVENT_TIMER_STOP))
|
||||||
|
);
|
||||||
|
|
||||||
|
for (auto e = QTimerList.begin(); e != QTimerList.end(); ++e) {
|
||||||
|
LogInfo("Current [{}] Timer [{}]", e->name, timer_name);
|
||||||
|
|
||||||
|
if (e->mob && e->mob == owner && e->name == timer_name) {
|
||||||
|
LogInfo("Matched [{}] Timer [{}]", e->name, timer_name);
|
||||||
|
|
||||||
|
if (has_stop_event) {
|
||||||
|
if (owner->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_STOP, owner->CastToClient(), timer_name, 0);
|
||||||
|
} else if (owner->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_STOP, owner->CastToBot(), nullptr, timer_name, 0);
|
||||||
|
} else if (owner->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_STOP, owner->CastToNPC(), nullptr, timer_name, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QTimerList.erase(e);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::stoptimer(const char* timer_name, EQ::ItemInstance *inst) {
|
void QuestManager::stoptimer(const std::string& timer_name, EQ::ItemInstance* inst)
|
||||||
|
{
|
||||||
if (inst) {
|
if (inst) {
|
||||||
inst->StopTimer(timer_name);
|
inst->StopTimer(timer_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::stoptimer(const char* timer_name, Mob *mob) {
|
void QuestManager::stoptimer(const std::string& timer_name, Mob* m)
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
{
|
||||||
|
if (!m) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
end = QTimerList.end();
|
if (QTimerList.empty()) {
|
||||||
while (cur != end) {
|
return;
|
||||||
if (cur->mob && cur->mob == mob && cur->name == timer_name) {
|
}
|
||||||
QTimerList.erase(cur);
|
|
||||||
return;
|
const bool has_stop_event = (
|
||||||
|
(m->IsClient() && parse->PlayerHasQuestSub(EVENT_TIMER_STOP)) ||
|
||||||
|
(m->IsBot() && parse->BotHasQuestSub(EVENT_TIMER_STOP)) ||
|
||||||
|
(m->IsNPC() && parse->HasQuestSub(m->GetNPCTypeID(), EVENT_TIMER_STOP))
|
||||||
|
);
|
||||||
|
|
||||||
|
for (auto e = QTimerList.begin(); e != QTimerList.end();) {
|
||||||
|
if (e->mob && e->mob == m) {
|
||||||
|
if (has_stop_event) {
|
||||||
|
if (m->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_STOP, m->CastToClient(), e->name, 0);
|
||||||
|
} else if (m->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_STOP, m->CastToBot(), nullptr, e->name, 0);
|
||||||
|
} else if (m->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_STOP, m->CastToNPC(), nullptr, e->name, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QTimerList.erase(e);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::stopalltimers() {
|
void QuestManager::stopalltimers()
|
||||||
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(questitem) {
|
if (questitem) {
|
||||||
|
if (parse->ItemHasQuestSub(questitem, EVENT_TIMER_STOP)) {
|
||||||
|
auto item_timers = questitem->GetTimers();
|
||||||
|
|
||||||
|
if (item_timers.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto e = item_timers.begin(); e != item_timers.end(); ++e) {
|
||||||
|
if (parse->ItemHasQuestSub(questitem, EVENT_TIMER_STOP)) {
|
||||||
|
parse->EventItem(EVENT_TIMER_STOP, nullptr, questitem, nullptr, e->first, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
questitem->ClearTimers();
|
questitem->ClearTimers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
|
if (!owner) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
end = QTimerList.end();
|
if (QTimerList.empty()) {
|
||||||
while (cur != end) {
|
return;
|
||||||
if(cur->mob && cur->mob == owner)
|
}
|
||||||
cur = QTimerList.erase(cur);
|
|
||||||
else
|
const bool has_stop_event = (
|
||||||
++cur;
|
(owner->IsClient() && parse->PlayerHasQuestSub(EVENT_TIMER_STOP)) ||
|
||||||
|
(owner->IsBot() && parse->BotHasQuestSub(EVENT_TIMER_STOP)) ||
|
||||||
|
(owner->IsNPC() && parse->HasQuestSub(owner->GetNPCTypeID(), EVENT_TIMER_STOP))
|
||||||
|
);
|
||||||
|
|
||||||
|
for (auto e = QTimerList.begin(); e != QTimerList.end();) {
|
||||||
|
if (e->mob && e->mob == owner) {
|
||||||
|
if (has_stop_event) {
|
||||||
|
if (owner->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_STOP, owner->CastToClient(), e->name, 0);
|
||||||
|
} else if (owner->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_STOP, owner->CastToBot(), nullptr, e->name, 0);
|
||||||
|
} else if (owner->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_STOP, owner->CastToNPC(), nullptr, e->name, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e = QTimerList.erase(e);
|
||||||
|
} else {
|
||||||
|
++e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::stopalltimers(EQ::ItemInstance *inst) {
|
void QuestManager::stopalltimers(EQ::ItemInstance* inst)
|
||||||
|
{
|
||||||
if (inst) {
|
if (inst) {
|
||||||
|
if (parse->ItemHasQuestSub(inst, EVENT_TIMER_STOP)) {
|
||||||
|
auto item_timers = inst->GetTimers();
|
||||||
|
|
||||||
|
if (item_timers.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto e = item_timers.begin(); e != item_timers.begin(); ++e) {
|
||||||
|
if (parse->ItemHasQuestSub(inst, EVENT_TIMER_STOP)) {
|
||||||
|
parse->EventItem(EVENT_TIMER_STOP, nullptr, inst, nullptr, e->first, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inst->ClearTimers();
|
inst->ClearTimers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::stopalltimers(Mob *mob) {
|
void QuestManager::stopalltimers(Mob* m)
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
|
{
|
||||||
|
if (!m) {
|
||||||
end = QTimerList.end();
|
|
||||||
while (cur != end) {
|
|
||||||
if (cur->mob && cur->mob == mob)
|
|
||||||
cur = QTimerList.erase(cur);
|
|
||||||
else
|
|
||||||
++cur;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuestManager::pausetimer(const char* timer_name, Mob* mob) {
|
|
||||||
QuestManagerCurrentQuestVars();
|
|
||||||
|
|
||||||
if (!mob && !owner) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
if (QTimerList.empty()) {
|
||||||
std::list<PausedTimer>::iterator pcur = PTimerList.begin(), pend;
|
return;
|
||||||
PausedTimer pt;
|
}
|
||||||
uint32 milliseconds = 0;
|
|
||||||
|
|
||||||
const auto m = mob ? mob : owner;
|
const bool has_stop_event = (
|
||||||
|
(m->IsClient() && parse->PlayerHasQuestSub(EVENT_TIMER_STOP)) ||
|
||||||
|
(m->IsBot() && parse->BotHasQuestSub(EVENT_TIMER_STOP)) ||
|
||||||
|
(m->IsNPC() && parse->HasQuestSub(m->GetNPCTypeID(), EVENT_TIMER_STOP))
|
||||||
|
);
|
||||||
|
|
||||||
pend = PTimerList.end();
|
for (auto e = QTimerList.begin(); e != QTimerList.end();) {
|
||||||
while (pcur != pend) {
|
if (e->mob && e->mob == m) {
|
||||||
if (pcur->owner && pcur->owner == m && pcur->name == timer_name) {
|
if (has_stop_event) {
|
||||||
LogQuests("Timer [{}] is already paused for [{}]. Returning", timer_name, owner->GetName());
|
if (m->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_STOP, m->CastToClient(), e->name, 0);
|
||||||
|
} else if (m->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_STOP, m->CastToBot(), nullptr, e->name, 0);
|
||||||
|
} else if (m->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_STOP, m->CastToNPC(), nullptr, e->name, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e = QTimerList.erase(e);
|
||||||
|
} else {
|
||||||
|
++e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuestManager::pausetimer(const std::string& timer_name, Mob* m)
|
||||||
|
{
|
||||||
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
|
if (!m && !owner) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mob* mob = m ? m : owner;
|
||||||
|
|
||||||
|
if (!mob) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QTimerList.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& e : PTimerList) {
|
||||||
|
if (e.owner && e.owner == mob && e.name == timer_name) {
|
||||||
|
LogQuests("Timer [{}] is already paused for [{}]", timer_name, owner->GetName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
++pcur;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end = QTimerList.end();
|
uint32 milliseconds = 0;
|
||||||
while (cur != end) {
|
|
||||||
if (cur->mob && cur->mob == m && cur->name == timer_name) {
|
const bool has_pause_event = (
|
||||||
milliseconds = cur->Timer_.GetRemainingTime();
|
(mob->IsClient() && parse->PlayerHasQuestSub(EVENT_TIMER_PAUSE)) ||
|
||||||
QTimerList.erase(cur);
|
(mob->IsBot() && parse->BotHasQuestSub(EVENT_TIMER_PAUSE)) ||
|
||||||
break;
|
(mob->IsNPC() && parse->HasQuestSub(mob->GetNPCTypeID(), EVENT_TIMER_PAUSE))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!QTimerList.empty()) {
|
||||||
|
for (auto e = QTimerList.begin(); e != QTimerList.end(); ++e) {
|
||||||
|
if (e->mob && e->mob == mob && e->name == timer_name) {
|
||||||
|
milliseconds = e->Timer_.GetRemainingTime();
|
||||||
|
QTimerList.erase(e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PTimerList.emplace_back(
|
||||||
|
PausedTimer{
|
||||||
|
.owner = owner,
|
||||||
|
.name = timer_name,
|
||||||
|
.time = milliseconds
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (has_pause_event) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
timer_name,
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mob->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_PAUSE, mob->CastToClient(), export_string, 0);
|
||||||
|
} else if (mob->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_PAUSE, mob->CastToBot(), nullptr, export_string, 0);
|
||||||
|
} else if (mob->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_PAUSE, mob->CastToNPC(), nullptr, export_string, 0);
|
||||||
}
|
}
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string timername = timer_name;
|
|
||||||
pt.name = timername;
|
|
||||||
pt.owner = owner;
|
|
||||||
pt.time = milliseconds;
|
|
||||||
LogQuests("Pausing timer [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
|
LogQuests("Pausing timer [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
|
||||||
PTimerList.push_back(pt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::resumetimer(const char* timer_name, Mob* mob) {
|
void QuestManager::resumetimer(const std::string& timer_name, Mob* m)
|
||||||
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if (!mob && !owner) {
|
if (!m && !owner) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
|
||||||
std::list<PausedTimer>::iterator pcur = PTimerList.begin(), pend;
|
|
||||||
PausedTimer pt;
|
|
||||||
uint32 milliseconds = 0;
|
uint32 milliseconds = 0;
|
||||||
|
|
||||||
const auto m = mob ? mob : owner;
|
Mob* mob = m ? m : owner;
|
||||||
|
|
||||||
pend = PTimerList.end();
|
if (!mob) {
|
||||||
while (pcur != pend) {
|
|
||||||
if (pcur->owner && pcur->owner == m && pcur->name == timer_name) {
|
|
||||||
milliseconds = pcur->time;
|
|
||||||
PTimerList.erase(pcur);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++pcur;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (milliseconds == 0) {
|
|
||||||
LogQuests("Paused timer [{}] not found or has expired. Returning", timer_name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
end = QTimerList.end();
|
if (PTimerList.empty()) {
|
||||||
while (cur != end) {
|
return;
|
||||||
if (cur->mob && cur->mob == m && cur->name == timer_name) {
|
}
|
||||||
cur->Timer_.Enable();
|
|
||||||
cur->Timer_.Start(milliseconds, false);
|
for (auto e = PTimerList.begin(); e != PTimerList.end(); ++e) {
|
||||||
LogQuests("Resuming timer [{}] for [{}] with [{}] ms remaining",
|
if (e->owner && e->owner == mob && e->name == timer_name) {
|
||||||
timer_name,
|
milliseconds = e->time;
|
||||||
owner->GetName(),
|
PTimerList.erase(e);
|
||||||
milliseconds);
|
break;
|
||||||
return;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!milliseconds) {
|
||||||
|
LogQuests("Paused timer [{}] not found or has expired.", timer_name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool has_resume_event = (
|
||||||
|
(mob->IsClient() && parse->PlayerHasQuestSub(EVENT_TIMER_RESUME)) ||
|
||||||
|
(mob->IsBot() && parse->BotHasQuestSub(EVENT_TIMER_RESUME)) ||
|
||||||
|
(mob->IsNPC() && parse->HasQuestSub(mob->GetNPCTypeID(), EVENT_TIMER_RESUME))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!QTimerList.empty()) {
|
||||||
|
for (auto e : QTimerList) {
|
||||||
|
if (e.mob && e.mob == mob && e.name == timer_name) {
|
||||||
|
e.Timer_.Enable();
|
||||||
|
e.Timer_.Start(milliseconds, false);
|
||||||
|
LogQuests(
|
||||||
|
"Resuming timer [{}] for [{}] with [{}] ms remaining",
|
||||||
|
timer_name,
|
||||||
|
owner->GetName(),
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
if (has_resume_event) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
timer_name,
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mob->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_RESUME, mob->CastToClient(), export_string, 0);
|
||||||
|
} else if (mob->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_RESUME, mob->CastToBot(), nullptr, export_string, 0);
|
||||||
|
} else if (mob->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_RESUME, mob->CastToNPC(), nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimerList.emplace_back(QuestTimer(milliseconds, m, timer_name));
|
QTimerList.emplace_back(QuestTimer(milliseconds, m, timer_name));
|
||||||
LogQuests("Creating a new timer and resuming [{}] for [{}] with [{}] ms remaining", timer_name, owner->GetName(), milliseconds);
|
|
||||||
|
if (has_resume_event) {
|
||||||
|
const std::string& export_string = fmt::format(
|
||||||
|
"{} {}",
|
||||||
|
timer_name,
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mob->IsClient()) {
|
||||||
|
parse->EventPlayer(EVENT_TIMER_RESUME, mob->CastToClient(), export_string, 0);
|
||||||
|
} else if (mob->IsBot()) {
|
||||||
|
parse->EventBot(EVENT_TIMER_RESUME, mob->CastToBot(), nullptr, export_string, 0);
|
||||||
|
} else if (mob->IsNPC()) {
|
||||||
|
parse->EventNPC(EVENT_TIMER_RESUME, mob->CastToNPC(), nullptr, export_string, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LogQuests(
|
||||||
|
"Creating a new timer and resuming [{}] for [{}] with [{}] ms remaining",
|
||||||
|
timer_name,
|
||||||
|
owner->GetName(),
|
||||||
|
milliseconds
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuestManager::ispausedtimer(const char* timer_name, Mob* mob) {
|
bool QuestManager::ispausedtimer(const std::string& timer_name, Mob* m)
|
||||||
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
std::list<PausedTimer>::iterator pcur = PTimerList.begin(), pend;
|
if (!m && !owner) {
|
||||||
|
return false;
|
||||||
const auto m = mob ? mob : owner;
|
|
||||||
|
|
||||||
pend = PTimerList.end();
|
|
||||||
while (pcur != pend) {
|
|
||||||
if (pcur->owner && pcur->owner == m && pcur->name == timer_name) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
++pcur;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
Mob* mob = m ? m : owner;
|
||||||
|
|
||||||
|
if (!mob) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& e = std::find_if(
|
||||||
|
PTimerList.begin(),
|
||||||
|
PTimerList.end(),
|
||||||
|
[&timer_name, &mob](PausedTimer e) {
|
||||||
|
return e.owner && e.owner == mob && e.name == timer_name;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return e != PTimerList.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuestManager::hastimer(const char* timer_name, Mob* mob) {
|
bool QuestManager::hastimer(const std::string& timer_name, Mob* m)
|
||||||
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
if (!m && !owner) {
|
||||||
|
return false;
|
||||||
const auto m = mob ? mob : owner;
|
|
||||||
|
|
||||||
end = QTimerList.end();
|
|
||||||
while (cur != end) {
|
|
||||||
if (cur->mob && cur->mob == m && cur->name == timer_name) {
|
|
||||||
if (cur->Timer_.Enabled()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
Mob* mob = m ? m : owner;
|
||||||
|
|
||||||
|
if (!mob) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& e = std::find_if(
|
||||||
|
QTimerList.begin(),
|
||||||
|
QTimerList.end(),
|
||||||
|
[&timer_name, &mob](QuestTimer e) {
|
||||||
|
return e.mob && e.mob == mob && e.name == timer_name;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return e != QTimerList.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 QuestManager::getremainingtimeMS(const char* timer_name, Mob* mob) {
|
uint32 QuestManager::getremainingtimeMS(const std::string& timer_name, Mob* m)
|
||||||
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
if (!m && !owner) {
|
||||||
|
return 0;
|
||||||
const auto m = mob ? mob : owner;
|
|
||||||
|
|
||||||
end = QTimerList.end();
|
|
||||||
while (cur != end) {
|
|
||||||
if (cur->mob && cur->mob == m && cur->name == timer_name) {
|
|
||||||
if (cur->Timer_.Enabled()) {
|
|
||||||
return cur->Timer_.GetRemainingTime();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
const auto mob = m ? m : owner;
|
||||||
|
|
||||||
|
if (!mob) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& e = std::find_if(
|
||||||
|
QTimerList.begin(),
|
||||||
|
QTimerList.end(),
|
||||||
|
[&timer_name, &mob](QuestTimer e) {
|
||||||
|
return e.mob && e.mob == mob && e.name == timer_name;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return e != QTimerList.end() ? e->Timer_.GetRemainingTime() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 QuestManager::gettimerdurationMS(const char* timer_name, Mob* mob) {
|
uint32 QuestManager::gettimerdurationMS(const std::string& timer_name, Mob* m)
|
||||||
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
if (!m && !owner) {
|
||||||
|
return 0;
|
||||||
const auto m = mob ? mob : owner;
|
|
||||||
|
|
||||||
end = QTimerList.end();
|
|
||||||
while (cur != end) {
|
|
||||||
if (cur->mob && cur->mob == m && cur->name == timer_name) {
|
|
||||||
if (cur->Timer_.Enabled()) {
|
|
||||||
return cur->Timer_.GetDuration();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
++cur;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
const auto mob = m ? m : owner;
|
||||||
|
|
||||||
|
if (!mob) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& e = std::find_if(
|
||||||
|
QTimerList.begin(),
|
||||||
|
QTimerList.end(),
|
||||||
|
[&timer_name, &mob](QuestTimer e) {
|
||||||
|
return e.mob && e.mob == mob && e.name == timer_name;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return e != QTimerList.end() ? e->Timer_.GetDuration() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::emote(const char *str) {
|
void QuestManager::emote(const char *str) {
|
||||||
|
|||||||
@ -44,9 +44,9 @@ class QuestManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct PausedTimer {
|
struct PausedTimer {
|
||||||
Mob * owner;
|
Mob* owner;
|
||||||
std::string name;
|
std::string name;
|
||||||
uint32 time;
|
uint32 time;
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
QuestManager();
|
QuestManager();
|
||||||
@ -81,22 +81,22 @@ public:
|
|||||||
void Zone(const char *zone_name);
|
void Zone(const char *zone_name);
|
||||||
void ZoneGroup(const char *zone_name);
|
void ZoneGroup(const char *zone_name);
|
||||||
void ZoneRaid(const char *zone_name);
|
void ZoneRaid(const char *zone_name);
|
||||||
void settimer(const char* timer_name, int seconds, Mob* mob = nullptr);
|
void settimer(const std::string& timer_name, uint32 seconds, Mob* m = nullptr);
|
||||||
void settimerMS(const char* timer_name, int milliseconds);
|
void settimerMS(const std::string& timer_name, uint32 milliseconds);
|
||||||
void settimerMS(const char* timer_name, int milliseconds, EQ::ItemInstance *inst);
|
void settimerMS(const std::string& timer_name, uint32 milliseconds, EQ::ItemInstance* inst);
|
||||||
void settimerMS(const char* timer_name, int milliseconds, Mob *mob);
|
void settimerMS(const std::string& timer_name, uint32 milliseconds, Mob* m);
|
||||||
void stoptimer(const char* timer_name);
|
void stoptimer(const std::string& timer_name);
|
||||||
void stoptimer(const char* timer_name, EQ::ItemInstance *inst);
|
void stoptimer(const std::string& timer_name, EQ::ItemInstance* inst);
|
||||||
void stoptimer(const char* timer_name, Mob *mob);
|
void stoptimer(const std::string& timer_name, Mob* m);
|
||||||
void stopalltimers();
|
void stopalltimers();
|
||||||
void stopalltimers(EQ::ItemInstance *inst);
|
void stopalltimers(EQ::ItemInstance* inst);
|
||||||
void stopalltimers(Mob *mob);
|
void stopalltimers(Mob* m);
|
||||||
void pausetimer(const char* timer_name, Mob* mob = nullptr);
|
void pausetimer(const std::string& timer_name, Mob* m = nullptr);
|
||||||
void resumetimer(const char* timer_name, Mob* mob = nullptr);
|
void resumetimer(const std::string& timer_name, Mob* m = nullptr);
|
||||||
bool ispausedtimer(const char* timer_name, Mob* mob = nullptr);
|
bool ispausedtimer(const std::string& timer_name, Mob* m = nullptr);
|
||||||
bool hastimer(const char* timer_name, Mob* mob = nullptr);
|
bool hastimer(const std::string& timer_name, Mob* m = nullptr);
|
||||||
uint32 getremainingtimeMS(const char* timer_name, Mob* mob = nullptr);
|
uint32 getremainingtimeMS(const std::string& timer_name, Mob* m = nullptr);
|
||||||
uint32 gettimerdurationMS(const char* timer_name, Mob* mob = nullptr);
|
uint32 gettimerdurationMS(const std::string& timer_name, Mob* m = nullptr);
|
||||||
void emote(const char *str);
|
void emote(const char *str);
|
||||||
void shout(const char *str);
|
void shout(const char *str);
|
||||||
void shout2(const char *str);
|
void shout2(const char *str);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user