Fix for clickies not working, changed order of dispatch events to allow nuking items from regular item events. Changed the lua modules path.

This commit is contained in:
KimLS 2013-06-24 12:42:42 -07:00
parent b904689a98
commit 342a4c1b17
3 changed files with 16 additions and 13 deletions

View File

@ -227,9 +227,9 @@ bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) {
int QuestParserCollection::EventNPC(QuestEventID evt, NPC *npc, Mob *init, std::string data, uint32 extra_data, int QuestParserCollection::EventNPC(QuestEventID evt, NPC *npc, Mob *init, std::string data, uint32 extra_data,
std::vector<void*> *extra_pointers) { std::vector<void*> *extra_pointers) {
DispatchEventNPC(evt, npc, init, data, extra_data, extra_pointers);
int rl = EventNPCLocal(evt, npc, init, data, extra_data, extra_pointers); int rl = EventNPCLocal(evt, npc, init, data, extra_data, extra_pointers);
int rg = EventNPCGlobal(evt, npc, init, data, extra_data, extra_pointers); int rg = EventNPCGlobal(evt, npc, init, data, extra_data, extra_pointers);
DispatchEventNPC(evt, npc, init, data, extra_data, extra_pointers);
//Local quests returning non-default values have priority over global quests //Local quests returning non-default values have priority over global quests
if(rl != 0) { if(rl != 0) {
@ -285,9 +285,9 @@ int QuestParserCollection::EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init,
int QuestParserCollection::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data, int QuestParserCollection::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
std::vector<void*> *extra_pointers) { std::vector<void*> *extra_pointers) {
DispatchEventPlayer(evt, client, data, extra_data, extra_pointers);
int rl = EventPlayerLocal(evt, client, data, extra_data, extra_pointers); int rl = EventPlayerLocal(evt, client, data, extra_data, extra_pointers);
int rg = EventPlayerGlobal(evt, client, data, extra_data, extra_pointers); int rg = EventPlayerGlobal(evt, client, data, extra_data, extra_pointers);
DispatchEventPlayer(evt, client, data, extra_data, extra_pointers);
//Local quests returning non-default values have priority over global quests //Local quests returning non-default values have priority over global quests
if(rl != 0) { if(rl != 0) {
@ -355,8 +355,8 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst
//loaded or failed to load //loaded or failed to load
if(iter->second != QuestFailedToLoad) { if(iter->second != QuestFailedToLoad) {
std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second); std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second);
auto ret = qiter->second->EventItem(evt, client, item, mob, data, extra_data, extra_pointers);
DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers); DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
auto ret = qiter->second->EventItem(evt, client, item, mob, data, extra_data, extra_pointers);
return ret; return ret;
} }
DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers); DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
@ -366,8 +366,8 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst
if(qi) { if(qi) {
_item_quest_status[item_id] = qi->GetIdentifier(); _item_quest_status[item_id] = qi->GetIdentifier();
qi->LoadItemScript(filename, item); qi->LoadItemScript(filename, item);
auto ret = qi->EventItem(evt, client, item, mob, data, extra_data, extra_pointers);
DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers); DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
auto ret = qi->EventItem(evt, client, item, mob, data, extra_data, extra_pointers);
return ret; return ret;
} else { } else {
_item_quest_status[item_id] = QuestFailedToLoad; _item_quest_status[item_id] = QuestFailedToLoad;
@ -384,8 +384,8 @@ int QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client
//loaded or failed to load //loaded or failed to load
if(iter->second != QuestFailedToLoad) { if(iter->second != QuestFailedToLoad) {
std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second); std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second);
auto ret = qiter->second->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers); DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
auto ret = qiter->second->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
return ret; return ret;
} }
DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers); DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
@ -395,8 +395,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);
auto ret = qi->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers); DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
auto ret = qi->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
return ret; return ret;
} else { } else {
_spell_quest_status[spell_id] = QuestFailedToLoad; _spell_quest_status[spell_id] = QuestFailedToLoad;

View File

@ -2116,7 +2116,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
return; return;
} }
if(i != 0) { if(i == 0) {
CastSpell(item->Click.Effect, target_id, 10, item->CastTime, 0, 0, slot_id); CastSpell(item->Click.Effect, target_id, 10, item->CastTime, 0, 0, slot_id);
} }
} }
@ -2143,7 +2143,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
return; return;
} }
if(i != 0) { if(i == 0) {
CastSpell(augitem->Click.Effect, target_id, 10, augitem->CastTime, 0, 0, slot_id); CastSpell(augitem->Click.Effect, target_id, 10, augitem->CastTime, 0, 0, slot_id);
} }
} }
@ -4592,10 +4592,10 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
ItemInst* p_inst = (ItemInst*)inst; ItemInst* p_inst = (ItemInst*)inst;
int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, nullptr, "", castspell->inventoryslot); int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, nullptr, "", castspell->inventoryslot);
if(i != 0) { if(i == 0) {
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot); CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
} else { } else {
SendSpellBarEnable(castspell->spell_id); InterruptSpell(castspell->spell_id);
return; return;
} }
} }
@ -4611,10 +4611,10 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
ItemInst* p_inst = (ItemInst*)inst; ItemInst* p_inst = (ItemInst*)inst;
int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, nullptr, "", castspell->inventoryslot); int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, nullptr, "", castspell->inventoryslot);
if(i != 0) { if(i == 0) {
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot); CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
} else { } else {
SendSpellBarEnable(castspell->spell_id); InterruptSpell(castspell->spell_id);
return; return;
} }
} }

View File

@ -772,10 +772,13 @@ void LuaParser::ReloadQuests() {
lua_pushnil(L); lua_pushnil(L);
lua_setglobal(L, "os"); lua_setglobal(L, "os");
lua_pushnil(L);
lua_setglobal(L, "io");
lua_getglobal(L, "package"); lua_getglobal(L, "package");
lua_getfield(L, -1, "path"); lua_getfield(L, -1, "path");
std::string module_path = lua_tostring(L,-1); std::string module_path = lua_tostring(L,-1);
module_path += "lua_modules/?.lua"; module_path += "./lua_modules/?.lua";
lua_pop(L, 1); lua_pop(L, 1);
lua_pushstring(L, module_path.c_str()); lua_pushstring(L, module_path.c_str());
lua_setfield(L, -2, "path"); lua_setfield(L, -2, "path");