mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
Regression fixes, support for new lua arguments for many events
This commit is contained in:
parent
bb8d11a57b
commit
d8a1d84a49
@ -632,6 +632,23 @@ std::string ItemInst::GetCustomData(std::string identifier) {
|
||||
return "";
|
||||
}
|
||||
|
||||
void ItemInst::SetTimer(std::string name, uint32 time) {
|
||||
Timer t(time);
|
||||
t.Start(time, false);
|
||||
m_timers[name] = t;
|
||||
}
|
||||
|
||||
void ItemInst::StopTimer(std::string name) {
|
||||
auto iter = m_timers.find(name);
|
||||
if(iter != m_timers.end()) {
|
||||
m_timers.erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemInst::ClearTimers() {
|
||||
m_timers.clear();
|
||||
}
|
||||
|
||||
// Retrieve item at specified position within bag
|
||||
ItemInst* Inventory::GetItem(int16 slot_id, uint8 bagidx) const
|
||||
{
|
||||
|
||||
@ -380,6 +380,9 @@ public:
|
||||
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
|
||||
|
||||
std::map<std::string, Timer>& GetTimers() { return m_timers; }
|
||||
void SetTimer(std::string name, uint32 time);
|
||||
void StopTimer(std::string name);
|
||||
void ClearTimers();
|
||||
|
||||
protected:
|
||||
//////////////////////////
|
||||
|
||||
@ -465,7 +465,9 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
char buf[10];
|
||||
snprintf(buf, 9, "%u", m_inst->GetItem()->ID);
|
||||
buf[9] = '\0';
|
||||
parse->EventPlayer(EVENT_PLAYER_PICKUP, sender, buf, 0);
|
||||
std::vector<void*> args;
|
||||
args.push_back(m_inst);
|
||||
parse->EventPlayer(EVENT_PLAYER_PICKUP, sender, buf, 0, &args);
|
||||
|
||||
// Transfer item to client
|
||||
sender->PutItemInInventory(SLOT_CURSOR, *m_inst, false);
|
||||
|
||||
@ -29,14 +29,19 @@ class NPC;
|
||||
class QuestInterface {
|
||||
public:
|
||||
virtual int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) { return 0; }
|
||||
std::vector<void*> *extra_pointers) { return 0; }
|
||||
virtual int EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) { return 0; }
|
||||
virtual int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { return 0; }
|
||||
virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { return 0; }
|
||||
virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data) { return 0; }
|
||||
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { return 0; }
|
||||
virtual int EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data) { return 0; }
|
||||
std::vector<void*> *extra_pointers) { return 0; }
|
||||
virtual int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) { return 0; }
|
||||
virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) { return 0; }
|
||||
virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) { return 0; }
|
||||
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) { return 0; }
|
||||
virtual int EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) { return 0; }
|
||||
|
||||
virtual bool HasQuestSub(uint32 npcid, QuestEventID evt) { return false; }
|
||||
virtual bool HasGlobalQuestSub(QuestEventID evt) { return false; }
|
||||
@ -55,10 +60,13 @@ public:
|
||||
virtual void LoadEncounterScript(std::string filename, std::string encounter_name) { }
|
||||
|
||||
virtual void DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) { }
|
||||
virtual void DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { }
|
||||
virtual void DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data) { }
|
||||
virtual void DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { }
|
||||
std::vector<void*> *extra_pointers) { }
|
||||
virtual void DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) { }
|
||||
virtual void DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) { }
|
||||
virtual void DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) { }
|
||||
|
||||
virtual void AddVar(std::string name, std::string val) { }
|
||||
virtual std::string GetVar(std::string name) { return std::string(); }
|
||||
|
||||
@ -226,10 +226,10 @@ bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) {
|
||||
}
|
||||
|
||||
int QuestParserCollection::EventNPC(QuestEventID evt, NPC *npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
int rl = EventNPCLocal(evt, npc, init, data, extra_data, items);
|
||||
int rg = EventNPCGlobal(evt, npc, init, data, extra_data, items);
|
||||
DispatchEventNPC(evt, npc, init, data, extra_data, items);
|
||||
std::vector<void*> *extra_pointers) {
|
||||
int rl = EventNPCLocal(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
|
||||
if(rl != 0) {
|
||||
@ -242,13 +242,13 @@ int QuestParserCollection::EventNPC(QuestEventID evt, NPC *npc, Mob *init, std::
|
||||
}
|
||||
|
||||
int QuestParserCollection::EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
std::map<uint32, uint32>::iterator iter = _npc_quest_status.find(npc->GetNPCTypeID());
|
||||
if(iter != _npc_quest_status.end()) {
|
||||
//loaded or failed to load
|
||||
if(iter->second != QuestFailedToLoad) {
|
||||
std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second);
|
||||
return qiter->second->EventNPC(evt, npc, init, data, extra_data, items);
|
||||
return qiter->second->EventNPC(evt, npc, init, data, extra_data, extra_pointers);
|
||||
}
|
||||
} else {
|
||||
std::string filename;
|
||||
@ -256,7 +256,7 @@ int QuestParserCollection::EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init,
|
||||
if(qi) {
|
||||
_npc_quest_status[npc->GetNPCTypeID()] = qi->GetIdentifier();
|
||||
qi->LoadNPCScript(filename, npc->GetNPCTypeID());
|
||||
return qi->EventNPC(evt, npc, init, data, extra_data, items);
|
||||
return qi->EventNPC(evt, npc, init, data, extra_data, extra_pointers);
|
||||
} else {
|
||||
_npc_quest_status[npc->GetNPCTypeID()] = QuestFailedToLoad;
|
||||
}
|
||||
@ -265,17 +265,17 @@ int QuestParserCollection::EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init,
|
||||
}
|
||||
|
||||
int QuestParserCollection::EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
if(_global_npc_quest_status != QuestUnloaded && _global_npc_quest_status != QuestFailedToLoad) {
|
||||
std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(_global_npc_quest_status);
|
||||
return qiter->second->EventGlobalNPC(evt, npc, init, data, extra_data, items);
|
||||
return qiter->second->EventGlobalNPC(evt, npc, init, data, extra_data, extra_pointers);
|
||||
} else {
|
||||
std::string filename;
|
||||
QuestInterface *qi = GetQIByGlobalNPCQuest(filename);
|
||||
if(qi) {
|
||||
_global_npc_quest_status = qi->GetIdentifier();
|
||||
qi->LoadGlobalNPCScript(filename);
|
||||
return qi->EventGlobalNPC(evt, npc, init, data, extra_data, items);
|
||||
return qi->EventGlobalNPC(evt, npc, init, data, extra_data, extra_pointers);
|
||||
} else {
|
||||
_global_npc_quest_status = QuestFailedToLoad;
|
||||
}
|
||||
@ -283,10 +283,11 @@ int QuestParserCollection::EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QuestParserCollection::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
int rl = EventPlayerLocal(evt, client, data, extra_data);
|
||||
int rg = EventPlayerGlobal(evt, client, data, extra_data);
|
||||
DispatchEventPlayer(evt, client, data, extra_data);
|
||||
int QuestParserCollection::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
int rl = EventPlayerLocal(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
|
||||
if(rl != 0) {
|
||||
@ -298,43 +299,46 @@ int QuestParserCollection::EventPlayer(QuestEventID evt, Client *client, std::st
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QuestParserCollection::EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
int QuestParserCollection::EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
if(_player_quest_status == QuestUnloaded) {
|
||||
std::string filename;
|
||||
QuestInterface *qi = GetQIByPlayerQuest(filename);
|
||||
if(qi) {
|
||||
_player_quest_status = qi->GetIdentifier();
|
||||
qi->LoadPlayerScript(filename);
|
||||
return qi->EventPlayer(evt, client, data, extra_data);
|
||||
return qi->EventPlayer(evt, client, data, extra_data, extra_pointers);
|
||||
}
|
||||
} else {
|
||||
if(_player_quest_status != QuestFailedToLoad) {
|
||||
std::map<uint32, QuestInterface*>::iterator iter = _interfaces.find(_player_quest_status);
|
||||
return iter->second->EventPlayer(evt, client, data, extra_data);
|
||||
return iter->second->EventPlayer(evt, client, data, extra_data, extra_pointers);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QuestParserCollection::EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
int QuestParserCollection::EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
if(_global_player_quest_status == QuestUnloaded) {
|
||||
std::string filename;
|
||||
QuestInterface *qi = GetQIByGlobalPlayerQuest(filename);
|
||||
if(qi) {
|
||||
_global_player_quest_status = qi->GetIdentifier();
|
||||
qi->LoadGlobalPlayerScript(filename);
|
||||
return qi->EventGlobalPlayer(evt, client, data, extra_data);
|
||||
return qi->EventGlobalPlayer(evt, client, data, extra_data, extra_pointers);
|
||||
}
|
||||
} else {
|
||||
if(_global_player_quest_status != QuestFailedToLoad) {
|
||||
std::map<uint32, QuestInterface*>::iterator iter = _interfaces.find(_global_player_quest_status);
|
||||
return iter->second->EventGlobalPlayer(evt, client, data, extra_data);
|
||||
return iter->second->EventGlobalPlayer(evt, client, data, extra_data, extra_pointers);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data) {
|
||||
int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
std::string item_script;
|
||||
if(item->GetItem()->ScriptFileID != 0) {
|
||||
item_script = "script_";
|
||||
@ -351,63 +355,65 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst
|
||||
//loaded or failed to load
|
||||
if(iter->second != QuestFailedToLoad) {
|
||||
std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second);
|
||||
auto ret = qiter->second->EventItem(evt, client, item, mob, data, extra_data);
|
||||
DispatchEventItem(evt, client, item, mob, data, extra_data);
|
||||
auto ret = qiter->second->EventItem(evt, client, item, mob, data, extra_data, extra_pointers);
|
||||
DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
|
||||
return ret;
|
||||
}
|
||||
DispatchEventItem(evt, client, item, mob, data, extra_data);
|
||||
DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
|
||||
} else {
|
||||
std::string filename;
|
||||
QuestInterface *qi = GetQIByItemQuest(item_script, filename);
|
||||
if(qi) {
|
||||
_item_quest_status[item_id] = qi->GetIdentifier();
|
||||
qi->LoadItemScript(filename, item);
|
||||
auto ret = qi->EventItem(evt, client, item, mob, data, extra_data);
|
||||
DispatchEventItem(evt, client, item, mob, data, extra_data);
|
||||
auto ret = qi->EventItem(evt, client, item, mob, data, extra_data, extra_pointers);
|
||||
DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
|
||||
return ret;
|
||||
} else {
|
||||
_item_quest_status[item_id] = QuestFailedToLoad;
|
||||
DispatchEventItem(evt, client, item, mob, data, extra_data);
|
||||
DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
|
||||
}
|
||||
}
|
||||
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, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
std::map<uint32, uint32>::iterator iter = _spell_quest_status.find(spell_id);
|
||||
if(iter != _spell_quest_status.end()) {
|
||||
//loaded or failed to load
|
||||
if(iter->second != QuestFailedToLoad) {
|
||||
std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second);
|
||||
auto ret = qiter->second->EventSpell(evt, npc, client, spell_id, extra_data);
|
||||
DispatchEventSpell(evt, npc, client, spell_id, extra_data);
|
||||
auto ret = qiter->second->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
||||
DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
||||
return ret;
|
||||
}
|
||||
DispatchEventSpell(evt, npc, client, spell_id, extra_data);
|
||||
DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
||||
} else {
|
||||
std::string filename;
|
||||
QuestInterface *qi = GetQIBySpellQuest(spell_id, filename);
|
||||
if(qi) {
|
||||
_spell_quest_status[spell_id] = qi->GetIdentifier();
|
||||
qi->LoadSpellScript(filename, spell_id);
|
||||
auto ret = qi->EventSpell(evt, npc, client, spell_id, extra_data);
|
||||
DispatchEventSpell(evt, npc, client, spell_id, extra_data);
|
||||
auto ret = qi->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
||||
DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
||||
return ret;
|
||||
} else {
|
||||
_spell_quest_status[spell_id] = QuestFailedToLoad;
|
||||
DispatchEventSpell(evt, npc, client, spell_id, extra_data);
|
||||
DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QuestParserCollection::EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data) {
|
||||
int QuestParserCollection::EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
auto iter = _encounter_quest_status.find(encounter_name);
|
||||
if(iter != _encounter_quest_status.end()) {
|
||||
//loaded or failed to load
|
||||
if(iter->second != QuestFailedToLoad) {
|
||||
std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second);
|
||||
return qiter->second->EventEncounter(evt, encounter_name, extra_data);
|
||||
return qiter->second->EventEncounter(evt, encounter_name, extra_data, extra_pointers);
|
||||
}
|
||||
} else {
|
||||
std::string filename;
|
||||
@ -415,7 +421,7 @@ int QuestParserCollection::EventEncounter(QuestEventID evt, std::string encounte
|
||||
if(qi) {
|
||||
_encounter_quest_status[encounter_name] = qi->GetIdentifier();
|
||||
qi->LoadEncounterScript(filename, encounter_name);
|
||||
return qi->EventEncounter(evt, encounter_name, extra_data);
|
||||
return qi->EventEncounter(evt, encounter_name, extra_data, extra_pointers);
|
||||
} else {
|
||||
_encounter_quest_status[encounter_name] = QuestFailedToLoad;
|
||||
}
|
||||
@ -855,36 +861,37 @@ void QuestParserCollection::GetErrors(std::list<std::string> &err) {
|
||||
}
|
||||
|
||||
void QuestParserCollection::DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
auto iter = _load_precedence.begin();
|
||||
while(iter != _load_precedence.end()) {
|
||||
(*iter)->DispatchEventNPC(evt, npc, init, data, extra_data, items);
|
||||
(*iter)->DispatchEventNPC(evt, npc, init, data, extra_data, extra_pointers);
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void QuestParserCollection::DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
void QuestParserCollection::DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
auto iter = _load_precedence.begin();
|
||||
while(iter != _load_precedence.end()) {
|
||||
(*iter)->DispatchEventPlayer(evt, client, data, extra_data);
|
||||
(*iter)->DispatchEventPlayer(evt, client, data, extra_data, extra_pointers);
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void QuestParserCollection::DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data,
|
||||
uint32 extra_data) {
|
||||
uint32 extra_data, std::vector<void*> *extra_pointers) {
|
||||
auto iter = _load_precedence.begin();
|
||||
while(iter != _load_precedence.end()) {
|
||||
(*iter)->DispatchEventItem(evt, client, item, mob, data, extra_data);
|
||||
(*iter)->DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {
|
||||
void QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
auto iter = _load_precedence.begin();
|
||||
while(iter != _load_precedence.end()) {
|
||||
(*iter)->DispatchEventSpell(evt, npc, client, spell_id, extra_data);
|
||||
(*iter)->DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers);
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,11 +50,15 @@ public:
|
||||
bool ItemHasQuestSub(ItemInst *itm, QuestEventID evt);
|
||||
|
||||
int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items = nullptr);
|
||||
int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data);
|
||||
int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
|
||||
int EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data);
|
||||
std::vector<void*> *extra_pointers = nullptr);
|
||||
int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers = nullptr);
|
||||
int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers = nullptr);
|
||||
int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers = nullptr);
|
||||
int EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers = nullptr);
|
||||
|
||||
void GetErrors(std::list<std::string> &err);
|
||||
|
||||
@ -64,10 +68,10 @@ private:
|
||||
bool PlayerHasQuestSubLocal(QuestEventID evt);
|
||||
bool PlayerHasQuestSubGlobal(QuestEventID evt);
|
||||
|
||||
int EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<ItemInst*> *items);
|
||||
int EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<ItemInst*> *items);
|
||||
int EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
int EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
int EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<void*> *extra_pointers);
|
||||
int EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<void*> *extra_pointers);
|
||||
int EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector<void*> *extra_pointers);
|
||||
int EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data, std::vector<void*> *extra_pointers);
|
||||
|
||||
QuestInterface *GetQIByNPCQuest(uint32 npcid, std::string &filename);
|
||||
QuestInterface *GetQIByGlobalNPCQuest(std::string &filename);
|
||||
@ -77,10 +81,14 @@ private:
|
||||
QuestInterface *GetQIByItemQuest(std::string item_script, std::string &filename);
|
||||
QuestInterface *GetQIByEncounterQuest(std::string encounter_name, std::string &filename);
|
||||
|
||||
void DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector<ItemInst*> *items);
|
||||
void DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
void DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data);
|
||||
void DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
|
||||
void DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
std::map<uint32, QuestInterface*> _interfaces;
|
||||
std::map<uint32, std::string> _extensions;
|
||||
|
||||
@ -2441,10 +2441,6 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
|
||||
{
|
||||
EvoItemInst* e_inst = (EvoItemInst*)inst;
|
||||
uint16 oldexp = e_inst->GetExp();
|
||||
|
||||
//if(login) {
|
||||
// parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, e_inst, nullptr, "", 0);
|
||||
//}
|
||||
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, nullptr, "", 0);
|
||||
|
||||
if (e_inst->GetExp() != oldexp) { // if the scaling factor changed, rescale the item and update the client
|
||||
@ -2465,10 +2461,6 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y)
|
||||
{
|
||||
EvoItemInst* e_inst = (EvoItemInst*)a_inst;
|
||||
uint16 oldexp = e_inst->GetExp();
|
||||
|
||||
//if(login) {
|
||||
// parse->EventItem(EVENT_ITEM_ENTER_ZONE, this, e_inst, nullptr, "", 0);
|
||||
//}
|
||||
parse->EventItem(EVENT_SCALE_CALC, this, e_inst, nullptr, "", 0);
|
||||
|
||||
if (e_inst->GetExp() != oldexp)
|
||||
@ -2520,7 +2512,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
|
||||
bool changed = false;
|
||||
for(int i = slot_x; i < slot_y; i++) {
|
||||
ItemInst* inst = m_inv.GetItem(i);
|
||||
if(inst == 0)
|
||||
if(!inst)
|
||||
continue;
|
||||
|
||||
bool update_slot = false;
|
||||
|
||||
210
zone/client.cpp
210
zone/client.cpp
@ -26,13 +26,13 @@
|
||||
|
||||
// for windows compile
|
||||
#ifdef _WINDOWS
|
||||
#define abs64 _abs64
|
||||
#define abs64 _abs64
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "../common/unix.h"
|
||||
#define abs64 abs
|
||||
#include <stdarg.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "../common/unix.h"
|
||||
#define abs64 abs
|
||||
#endif
|
||||
|
||||
extern volatile bool RunLoops;
|
||||
@ -159,7 +159,8 @@ Client::Client(EQStreamInterface* ieqs)
|
||||
TrackingTimer(2000),
|
||||
RespawnFromHoverTimer(0),
|
||||
merc_timer(RuleI(Mercs, UpkeepIntervalMS)),
|
||||
ItemTickTimer(10000)
|
||||
ItemTickTimer(10000),
|
||||
ItemQuestTimer(500)
|
||||
{
|
||||
for(int cf=0; cf < _FilterCount; cf++)
|
||||
ClientFilters[cf] = FilterShow;
|
||||
@ -7617,109 +7618,166 @@ some day.
|
||||
|
||||
void Client::LoadAccountFlags()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
accountflags.clear();
|
||||
MakeAnyLenString(&query, "SELECT p_flag, p_value FROM account_flags WHERE p_accid = '%d'", account_id);
|
||||
if(database.RunQuery(query, strlen(query), errbuf, &result))
|
||||
{
|
||||
while(row = mysql_fetch_row(result))
|
||||
{
|
||||
std::string fname(row[0]);
|
||||
std::string fval(row[1]);
|
||||
accountflags[fname] = fval;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error in LoadAccountFlags query '" << query << "' " << errbuf << std::endl;
|
||||
}
|
||||
safe_delete_array(query);
|
||||
accountflags.clear();
|
||||
MakeAnyLenString(&query, "SELECT p_flag, p_value FROM account_flags WHERE p_accid = '%d'", account_id);
|
||||
if(database.RunQuery(query, strlen(query), errbuf, &result))
|
||||
{
|
||||
while(row = mysql_fetch_row(result))
|
||||
{
|
||||
std::string fname(row[0]);
|
||||
std::string fval(row[1]);
|
||||
accountflags[fname] = fval;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error in LoadAccountFlags query '" << query << "' " << errbuf << std::endl;
|
||||
}
|
||||
safe_delete_array(query);
|
||||
}
|
||||
|
||||
void Client::SetAccountFlag(std::string flag, std::string val)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
|
||||
MakeAnyLenString(&query, "REPLACE INTO account_flags (p_accid, p_flag, p_value) VALUES( '%d', '%s', '%s')", account_id, flag.c_str(), val.c_str());
|
||||
if(!database.RunQuery(query, strlen(query), errbuf))
|
||||
{
|
||||
std::cerr << "Error in SetAccountFlags query '" << query << "' " << errbuf << std::endl;
|
||||
}
|
||||
safe_delete_array(query);
|
||||
MakeAnyLenString(&query, "REPLACE INTO account_flags (p_accid, p_flag, p_value) VALUES( '%d', '%s', '%s')", account_id, flag.c_str(), val.c_str());
|
||||
if(!database.RunQuery(query, strlen(query), errbuf))
|
||||
{
|
||||
std::cerr << "Error in SetAccountFlags query '" << query << "' " << errbuf << std::endl;
|
||||
}
|
||||
safe_delete_array(query);
|
||||
|
||||
accountflags[flag] = val;
|
||||
accountflags[flag] = val;
|
||||
}
|
||||
|
||||
std::string Client::GetAccountFlag(std::string flag)
|
||||
{
|
||||
return(accountflags[flag]);
|
||||
return(accountflags[flag]);
|
||||
}
|
||||
|
||||
void Client::TickItemCheck()
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if(zone->tick_items.empty()) { return; }
|
||||
|
||||
//Scan equip slots for items
|
||||
for(i = 0; i <= 21; i++)
|
||||
{
|
||||
//Scan equip slots for items
|
||||
for(i = 0; i <= 21; i++)
|
||||
{
|
||||
TryItemTick(i);
|
||||
}
|
||||
//Scan main inventory + cursor
|
||||
for(i = 22; i < 31; i++)
|
||||
{
|
||||
}
|
||||
//Scan main inventory + cursor
|
||||
for(i = 22; i < 31; i++)
|
||||
{
|
||||
TryItemTick(i);
|
||||
}
|
||||
//Scan bags
|
||||
for(i = 251; i < 340; i++)
|
||||
{
|
||||
}
|
||||
//Scan bags
|
||||
for(i = 251; i < 340; i++)
|
||||
{
|
||||
TryItemTick(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::TryItemTick(int slot)
|
||||
{
|
||||
int iid = 0;
|
||||
const ItemInst* inst = m_inv[slot];
|
||||
if(inst == 0) { return; }
|
||||
const ItemInst* inst = m_inv[slot];
|
||||
if(inst == 0) { return; }
|
||||
|
||||
iid = inst->GetID();
|
||||
iid = inst->GetID();
|
||||
|
||||
if(zone->tick_items.count(iid) > 0)
|
||||
{
|
||||
if( GetLevel() >= zone->tick_items[iid].level && MakeRandomInt(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot < 22) )
|
||||
{
|
||||
ItemInst* e_inst = (ItemInst*)inst;
|
||||
parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot);
|
||||
}
|
||||
}
|
||||
if(zone->tick_items.count(iid) > 0)
|
||||
{
|
||||
if( GetLevel() >= zone->tick_items[iid].level && MakeRandomInt(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot < 22) )
|
||||
{
|
||||
ItemInst* e_inst = (ItemInst*)inst;
|
||||
parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot);
|
||||
}
|
||||
}
|
||||
|
||||
//Only look at augs in main inventory
|
||||
if(slot > 21) { return; }
|
||||
|
||||
for(int x = 0; x < MAX_AUGMENT_SLOTS; ++x)
|
||||
{
|
||||
ItemInst * a_inst = inst->GetAugment(x);
|
||||
if(!a_inst) { continue; }
|
||||
for(int x = 0; x < MAX_AUGMENT_SLOTS; ++x)
|
||||
{
|
||||
ItemInst * a_inst = inst->GetAugment(x);
|
||||
if(!a_inst) { continue; }
|
||||
|
||||
iid = a_inst->GetID();
|
||||
iid = a_inst->GetID();
|
||||
|
||||
if(zone->tick_items.count(iid) > 0)
|
||||
{
|
||||
if( GetLevel() >= zone->tick_items[iid].level && MakeRandomInt(0, 100) >= (100 - zone->tick_items[iid].chance) )
|
||||
{
|
||||
ItemInst* e_inst = (ItemInst*)a_inst;
|
||||
parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(zone->tick_items.count(iid) > 0)
|
||||
{
|
||||
if( GetLevel() >= zone->tick_items[iid].level && MakeRandomInt(0, 100) >= (100 - zone->tick_items[iid].chance) )
|
||||
{
|
||||
ItemInst* e_inst = (ItemInst*)a_inst;
|
||||
parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::ItemTimerCheck()
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i <= 21; i++)
|
||||
{
|
||||
TryItemTimer(i);
|
||||
}
|
||||
|
||||
for(i = 22; i < 31; i++)
|
||||
{
|
||||
TryItemTimer(i);
|
||||
}
|
||||
|
||||
for(i = 251; i < 340; i++)
|
||||
{
|
||||
TryItemTimer(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::TryItemTimer(int slot)
|
||||
{
|
||||
ItemInst* inst = m_inv.GetItem(slot);
|
||||
if(!inst) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto item_timers = inst->GetTimers();
|
||||
auto it_iter = item_timers.begin();
|
||||
while(it_iter != item_timers.end()) {
|
||||
if(it_iter->second.Check()) {
|
||||
parse->EventItem(EVENT_TIMER, this, inst, nullptr, it_iter->first, 0);
|
||||
}
|
||||
++it_iter;
|
||||
}
|
||||
|
||||
if(slot > 21) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(int x = 0; x < MAX_AUGMENT_SLOTS; ++x)
|
||||
{
|
||||
ItemInst * a_inst = inst->GetAugment(x);
|
||||
if(!a_inst) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto item_timers = a_inst->GetTimers();
|
||||
auto it_iter = item_timers.begin();
|
||||
while(it_iter != item_timers.end()) {
|
||||
if(it_iter->second.Check()) {
|
||||
parse->EventItem(EVENT_TIMER, this, a_inst, nullptr, it_iter->first, 0);
|
||||
}
|
||||
++it_iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::RefundAA() {
|
||||
|
||||
@ -1122,6 +1122,9 @@ public:
|
||||
|
||||
void TickItemCheck();
|
||||
void TryItemTick(int slot);
|
||||
void ItemTimerCheck();
|
||||
void TryItemTimer(int slot);
|
||||
|
||||
int16 GetActSTR() { return( std::min(GetMaxSTR(), GetSTR()) ); }
|
||||
int16 GetActSTA() { return( std::min(GetMaxSTA(), GetSTA()) ); }
|
||||
int16 GetActDEX() { return( std::min(GetMaxDEX(), GetDEX()) ); }
|
||||
@ -1455,7 +1458,8 @@ private:
|
||||
|
||||
struct XTarget_Struct XTargets[XTARGET_HARDCAP];
|
||||
|
||||
Timer ItemTickTimer;
|
||||
Timer ItemTickTimer;
|
||||
Timer ItemQuestTimer;
|
||||
std::map<std::string,std::string> accountflags;
|
||||
};
|
||||
|
||||
|
||||
@ -4562,7 +4562,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
LogFile->write(EQEMuLog::Debug, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*) castspell->cs_unknown, *(uint16*) castspell->cs_unknown+sizeof(uint16) );
|
||||
LogFile->write(EQEMuLog::Debug, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*) castspell->cs_unknown, *(uint16*) castspell->cs_unknown+sizeof(uint16) );
|
||||
#endif
|
||||
LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot);
|
||||
LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot);
|
||||
|
||||
if ((castspell->slot == USE_ITEM_SPELL_SLOT) || (castspell->slot == POTION_BELT_SPELL_SLOT)) // this means item
|
||||
{
|
||||
@ -4671,22 +4671,28 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
|
||||
else
|
||||
spell_to_cast = SPELL_HARM_TOUCH2;
|
||||
p_timers.Start(pTimerHarmTouch, HarmTouchReuseTime);
|
||||
} else if(castspell->slot == DISCIPLINE_SPELL_SLOT) {
|
||||
}
|
||||
|
||||
//handle disciplines, OLD, they keep changing this
|
||||
if(castspell->slot == DISCIPLINE_SPELL_SLOT) {
|
||||
if(!UseDiscipline(castspell->spell_id, castspell->target_id)) {
|
||||
printf("Unknown ability being used by %s, spell being cast is: %i\n",GetName(),castspell->spell_id);
|
||||
InterruptSpell(castspell->spell_id);
|
||||
}
|
||||
return;
|
||||
} else if(castspell->slot < MAX_PP_MEMSPELL) {
|
||||
}
|
||||
|
||||
if(castspell->slot < MAX_PP_MEMSPELL)
|
||||
{
|
||||
spell_to_cast = m_pp.mem_spells[castspell->slot];
|
||||
if(spell_to_cast != castspell->spell_id)
|
||||
{
|
||||
InterruptSpell(castspell->spell_id); //CHEATER!!!
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
//If we get to here this slot should be invalid invalid
|
||||
InterruptSpell(castspell->spell_id);
|
||||
}
|
||||
else {
|
||||
InterruptSpell();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5759,7 +5765,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
|
||||
if ((RuleB(Character, EnableDiscoveredItems)))
|
||||
{
|
||||
if(!GetGM() && !IsDiscovered(item_id))
|
||||
DiscoverItem(item_id);
|
||||
DiscoverItem(item_id);
|
||||
}
|
||||
|
||||
t1.stop();
|
||||
@ -6009,15 +6015,18 @@ void Client::Handle_OP_ClickObject(const EQApplicationPacket *app)
|
||||
|
||||
ClickObject_Struct* click_object = (ClickObject_Struct*)app->pBuffer;
|
||||
Entity* entity = entity_list.GetID(click_object->drop_id);
|
||||
//TODO: should enforce range checking here.
|
||||
if (entity && entity->IsObject()) {
|
||||
Object* object = entity->CastToObject();
|
||||
|
||||
object->HandleClick(this, click_object);
|
||||
|
||||
std::vector<void*> args;
|
||||
args.push_back(object);
|
||||
|
||||
char buf[10];
|
||||
snprintf(buf, 9, "%u", click_object->drop_id);
|
||||
buf[9] = '\0';
|
||||
parse->EventPlayer(EVENT_CLICK_OBJECT, this, buf, 0);
|
||||
parse->EventPlayer(EVENT_CLICK_OBJECT, this, buf, 0, &args);
|
||||
}
|
||||
|
||||
// Observed in RoF after OP_ClickObjectAction:
|
||||
@ -6253,7 +6262,9 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app)
|
||||
char buf[20];
|
||||
snprintf(buf, 19, "%u", cd->doorid);
|
||||
buf[19] = '\0';
|
||||
parse->EventPlayer(EVENT_CLICK_DOOR, this, buf, 0);
|
||||
std::vector<void*> args;
|
||||
args.push_back(currentdoor);
|
||||
parse->EventPlayer(EVENT_CLICK_DOOR, this, buf, 0, &args);
|
||||
|
||||
currentdoor->HandleClick(this,0);
|
||||
return;
|
||||
|
||||
@ -641,9 +641,14 @@ bool Client::Process() {
|
||||
}
|
||||
|
||||
if(ItemTickTimer.Check())
|
||||
{
|
||||
TickItemCheck();
|
||||
}
|
||||
{
|
||||
TickItemCheck();
|
||||
}
|
||||
|
||||
if(ItemQuestTimer.Check())
|
||||
{
|
||||
ItemTimerCheck();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1167,12 +1167,15 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
|
||||
strcpy(corpse_name, orgname);
|
||||
snprintf(buf, 87, "%d %d %s", inst->GetItem()->ID, inst->GetCharges(), EntityList::RemoveNumbers(corpse_name));
|
||||
buf[87] = '\0';
|
||||
parse->EventPlayer(EVENT_LOOT, client, buf, 0);
|
||||
std::vector<void*> args;
|
||||
args.push_back(inst);
|
||||
args.push_back(this);
|
||||
parse->EventPlayer(EVENT_LOOT, client, buf, 0, &args);
|
||||
|
||||
if ((RuleB(Character, EnableDiscoveredItems)))
|
||||
{
|
||||
if(client && !client->GetGM() && !client->IsDiscovered(inst->GetItem()->ID))
|
||||
client->DiscoverItem(inst->GetItem()->ID);
|
||||
client->DiscoverItem(inst->GetItem()->ID);
|
||||
}
|
||||
|
||||
if (zone->lootvar != 0)
|
||||
|
||||
@ -142,7 +142,7 @@ void PerlembParser::ReloadQuests() {
|
||||
}
|
||||
|
||||
void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob,
|
||||
uint32 extradata, bool global, std::vector<ItemInst*> *items)
|
||||
uint32 extradata, bool global, std::vector<void*> *extra_pointers)
|
||||
{
|
||||
if(!perl)
|
||||
return;
|
||||
@ -151,7 +151,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
return;
|
||||
|
||||
if(perl->InUse()) {
|
||||
AddQueueEvent(event, objid, data, npcmob, iteminst, mob, extradata, global, items);
|
||||
AddQueueEvent(event, objid, data, npcmob, iteminst, mob, extradata, global, extra_pointers);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
package_name, mob, npcmob);
|
||||
ExportZoneVariables(package_name);
|
||||
ExportItemVariables(package_name, mob);
|
||||
ExportEventVariables(package_name, event, objid, data, npcmob, iteminst, mob, extradata, items);
|
||||
ExportEventVariables(package_name, event, objid, data, npcmob, iteminst, mob, extradata, extra_pointers);
|
||||
|
||||
if(isPlayerQuest || isGlobalPlayerQuest){
|
||||
SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr);
|
||||
@ -206,34 +206,38 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
}
|
||||
|
||||
int PerlembParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, false, items);
|
||||
std::vector<void*> *extra_pointers) {
|
||||
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, false, extra_pointers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PerlembParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, true, nullptr);
|
||||
std::vector<void*> *extra_pointers) {
|
||||
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, true, extra_pointers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PerlembParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, false, nullptr);
|
||||
int PerlembParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, false, extra_pointers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true, nullptr);
|
||||
int PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true, extra_pointers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data) {
|
||||
EventCommon(evt, item->GetID(), nullptr, nullptr, item, client, extra_data, false, nullptr);
|
||||
int PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
EventCommon(evt, item->GetID(), nullptr, nullptr, item, client, extra_data, false, extra_pointers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PerlembParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {
|
||||
EventCommon(evt, 0, itoa(spell_id), npc, nullptr, client, extra_data, false, nullptr);
|
||||
int PerlembParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
EventCommon(evt, 0, itoa(spell_id), npc, nullptr, client, extra_data, false, extra_pointers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -750,10 +754,10 @@ void PerlembParser::HandleQueue() {
|
||||
EventRecord e = event_queue_.front();
|
||||
event_queue_.pop();
|
||||
|
||||
EventCommon(e.event, e.objid, e.data.c_str(), e.npcmob, e.iteminst, e.mob, e.extradata, e.global, &e.items);
|
||||
EventCommon(e.event, e.objid, e.data.c_str(), e.npcmob, e.iteminst, e.mob, e.extradata, e.global, &e.extra_pointers);
|
||||
|
||||
for(size_t i = 0; i < e.items.size(); ++i) {
|
||||
delete e.items[i];
|
||||
for(size_t i = 0; i < e.extra_pointers.size(); ++i) {
|
||||
delete e.extra_pointers[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -761,7 +765,7 @@ void PerlembParser::HandleQueue() {
|
||||
}
|
||||
|
||||
void PerlembParser::AddQueueEvent(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob,
|
||||
uint32 extradata, bool global, std::vector<ItemInst*> *items)
|
||||
uint32 extradata, bool global, std::vector<void*> *extra_pointers)
|
||||
{
|
||||
EventRecord e;
|
||||
e.event = event;
|
||||
@ -773,9 +777,9 @@ void PerlembParser::AddQueueEvent(QuestEventID event, uint32 objid, const char *
|
||||
e.extradata = extradata;
|
||||
e.global = global;
|
||||
|
||||
if(items) {
|
||||
for(size_t i = 0; i < items->size(); ++i) {
|
||||
e.items.push_back(items->at(i)->Clone());
|
||||
if(extra_pointers) {
|
||||
for(size_t i = 0; i < extra_pointers->size(); ++i) {
|
||||
e.extra_pointers.push_back(reinterpret_cast<ItemInst*>(extra_pointers->at(i))->Clone());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1083,7 +1087,7 @@ void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) {
|
||||
#undef HASITEM_ISNULLITEM
|
||||
|
||||
void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID event, uint32 objid, const char * data,
|
||||
NPC* npcmob, ItemInst* iteminst, Mob* mob, uint32 extradata, std::vector<ItemInst*> *items)
|
||||
NPC* npcmob, ItemInst* iteminst, Mob* mob, uint32 extradata, std::vector<void*> *extra_pointers)
|
||||
{
|
||||
switch (event) {
|
||||
case EVENT_SAY: {
|
||||
@ -1098,9 +1102,9 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
|
||||
}
|
||||
|
||||
case EVENT_TRADE: {
|
||||
if(items) {
|
||||
for(size_t i = 0; i < items->size(); ++i) {
|
||||
ItemInst *inst = items->at(i);
|
||||
if(extra_pointers) {
|
||||
for(size_t i = 0; i < extra_pointers->size(); ++i) {
|
||||
ItemInst *inst = reinterpret_cast<ItemInst*>(extra_pointers->at(i));
|
||||
std::string var_name = "item";
|
||||
var_name += std::to_string(i + 1);
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ class PerlembParser : public QuestInterface {
|
||||
Mob* mob;
|
||||
uint32 extradata;
|
||||
bool global;
|
||||
std::vector<ItemInst*> items;
|
||||
std::vector<void*> extra_pointers;
|
||||
} EventRecord;
|
||||
|
||||
public:
|
||||
@ -57,13 +57,17 @@ public:
|
||||
~PerlembParser();
|
||||
|
||||
virtual int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
virtual int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data);
|
||||
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
virtual bool HasQuestSub(uint32 npcid, QuestEventID evt);
|
||||
virtual bool HasGlobalQuestSub(QuestEventID evt);
|
||||
@ -94,13 +98,13 @@ private:
|
||||
void ExportVarComplex(const char *pkgprefix, const char *varname, const char *value) const;
|
||||
|
||||
void EventCommon(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob,
|
||||
uint32 extradata, bool global, std::vector<ItemInst*> *items);
|
||||
void SendCommands(const char *pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst* iteminst);
|
||||
uint32 extradata, bool global, std::vector<void*> *extra_pointers);
|
||||
void SendCommands(const char *pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst *iteminst);
|
||||
void MapFunctions();
|
||||
|
||||
void HandleQueue();
|
||||
void AddQueueEvent(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob,
|
||||
uint32 extradata, bool global, std::vector<ItemInst*> *items);
|
||||
uint32 extradata, bool global, std::vector<void*> *extra_pointers);
|
||||
|
||||
void GetQuestTypes(bool &isPlayerQuest, bool &isGlobalPlayerQuest, bool &isGlobalNPC, bool &isItemQuest,
|
||||
bool &isSpellQuest, QuestEventID event, NPC* npcmob, ItemInst* iteminst, Mob* mob, bool global);
|
||||
@ -115,7 +119,7 @@ private:
|
||||
void ExportZoneVariables(std::string &package_name);
|
||||
void ExportItemVariables(std::string &package_name, Mob *mob);
|
||||
void ExportEventVariables(std::string &package_name, QuestEventID event, uint32 objid, const char * data,
|
||||
NPC* npcmob, ItemInst* iteminst, Mob* mob, uint32 extradata, std::vector<ItemInst*> *items);
|
||||
NPC* npcmob, ItemInst* iteminst, Mob* mob, uint32 extradata, std::vector<void*> *extra_pointers);
|
||||
|
||||
std::map<uint32, PerlQuestStatus> npc_quest_status_;
|
||||
PerlQuestStatus global_npc_quest_status_;
|
||||
|
||||
@ -715,13 +715,12 @@ void EntityList::AddToSpawnQueue(uint16 entityid, NewSpawn_Struct** ns) {
|
||||
NumSpawnsOnQueue++;
|
||||
if (tsFirstSpawnOnQueue == 0xFFFFFFFF)
|
||||
tsFirstSpawnOnQueue = Timer::GetCurrentTime();
|
||||
*ns = 0; // make it so the calling function cant fuck us and delete the data =)
|
||||
*ns = nullptr;
|
||||
}
|
||||
|
||||
void EntityList::CheckSpawnQueue() {
|
||||
// Send the stuff if the oldest packet on the queue is older than 50ms -Quagmire
|
||||
if (tsFirstSpawnOnQueue != 0xFFFFFFFF && (Timer::GetCurrentTime() - tsFirstSpawnOnQueue) > 50) {
|
||||
//if (NumSpawnsOnQueue <= 5) {
|
||||
LinkedListIterator<NewSpawn_Struct*> iterator(SpawnQueue);
|
||||
EQApplicationPacket* outapp = 0;
|
||||
|
||||
@ -729,29 +728,10 @@ void EntityList::CheckSpawnQueue() {
|
||||
while(iterator.MoreElements()) {
|
||||
outapp = new EQApplicationPacket;
|
||||
Mob::CreateSpawnPacket(outapp, iterator.GetData());
|
||||
// cout << "Sending spawn packet: " << iterator.GetData()->spawn.name << endl;
|
||||
QueueClients(0, outapp);
|
||||
safe_delete(outapp);
|
||||
iterator.RemoveCurrent();
|
||||
}
|
||||
//sending Spawns like this after zone in causes the client to freeze...
|
||||
/*}
|
||||
else {
|
||||
uint32 spawns_per_pack = MAX_SPAWNS_PER_PACKET;
|
||||
if(NumSpawnsOnQueue < spawns_per_pack)
|
||||
spawns_per_pack = NumSpawnsOnQueue;
|
||||
|
||||
BulkZoneSpawnPacket* bzsp = new BulkZoneSpawnPacket(0, spawns_per_pack);
|
||||
LinkedListIterator<NewSpawn_Struct*> iterator(SpawnQueue);
|
||||
|
||||
iterator.Reset();
|
||||
while(iterator.MoreElements()) {
|
||||
bzsp->AddSpawn(iterator.GetData());
|
||||
iterator.RemoveCurrent();
|
||||
}
|
||||
safe_delete(bzsp);
|
||||
}*/
|
||||
|
||||
tsFirstSpawnOnQueue = 0xFFFFFFFF;
|
||||
NumSpawnsOnQueue = 0;
|
||||
}
|
||||
@ -1883,8 +1863,12 @@ void EntityList::DuelMessage(Mob* winner, Mob* loser, bool flee) {
|
||||
|
||||
if(winner->GetLevelCon(winner->GetLevel(), loser->GetLevel()) > 2)
|
||||
{
|
||||
parse->EventPlayer(EVENT_DUEL_WIN, winner->CastToClient(), loser->GetName(), loser->CastToClient()->CharacterID());
|
||||
parse->EventPlayer(EVENT_DUEL_LOSE, loser->CastToClient(), winner->GetName(), winner->CastToClient()->CharacterID());
|
||||
std::vector<void*> args;
|
||||
args.push_back(winner);
|
||||
args.push_back(loser);
|
||||
|
||||
parse->EventPlayer(EVENT_DUEL_WIN, winner->CastToClient(), loser->GetName(), loser->CastToClient()->CharacterID(), &args);
|
||||
parse->EventPlayer(EVENT_DUEL_LOSE, loser->CastToClient(), winner->GetName(), winner->CastToClient()->CharacterID(), &args);
|
||||
}
|
||||
|
||||
iterator.Reset();
|
||||
@ -3367,6 +3351,8 @@ void EntityList::ClearFeignAggro(Mob* targ)
|
||||
}
|
||||
|
||||
if(targ->IsClient()) {
|
||||
std::vector<void*> args;
|
||||
args.push_back(iterator.GetData());
|
||||
int i = parse->EventPlayer(EVENT_FEIGN_DEATH, targ->CastToClient(), "", 0);
|
||||
if(i != 0) {
|
||||
iterator.Advance();
|
||||
|
||||
@ -350,23 +350,28 @@ void Client::GoFish()
|
||||
const Item_Struct* food_item = database.GetItem(food_id);
|
||||
|
||||
Message_StringID(MT_Skills, FISHING_SUCCESS);
|
||||
const ItemInst* inst = database.CreateItem(food_item, 1);
|
||||
ItemInst* inst = database.CreateItem(food_item, 1);
|
||||
if(inst != nullptr) {
|
||||
if(CheckLoreConflict(inst->GetItem()))
|
||||
{
|
||||
this->Message_StringID(0,DUP_LORE);
|
||||
Message_StringID(0, DUP_LORE);
|
||||
safe_delete(inst);
|
||||
}
|
||||
else
|
||||
{
|
||||
PushItemOnCursor(*inst); // changed from PutItemInInventory(SLOT_CURSOR, *inst); - was additional overhead
|
||||
PushItemOnCursor(*inst);
|
||||
SendItemPacket(SLOT_CURSOR,inst,ItemPacketSummonItem);
|
||||
if(RuleB(TaskSystem, EnableTaskSystem))
|
||||
UpdateTasksForItem(ActivityFish, food_id);
|
||||
|
||||
safe_delete(inst);
|
||||
inst = m_inv.GetItem(SLOT_CURSOR);
|
||||
}
|
||||
safe_delete(inst);
|
||||
}
|
||||
|
||||
parse->EventPlayer(EVENT_FISH_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0);
|
||||
std::vector<void*> args;
|
||||
args.push_back(inst);
|
||||
parse->EventPlayer(EVENT_FISH_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0, &args);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -459,28 +464,33 @@ void Client::ForageItem(bool guarantee) {
|
||||
}
|
||||
|
||||
Message_StringID(MT_Skills, stringid);
|
||||
const ItemInst* inst = database.CreateItem(food_item, 1);
|
||||
ItemInst* inst = database.CreateItem(food_item, 1);
|
||||
if(inst != nullptr) {
|
||||
// check to make sure it isn't a foraged lore item
|
||||
if(CheckLoreConflict(inst->GetItem()))
|
||||
{
|
||||
this->Message_StringID(0,DUP_LORE);
|
||||
Message_StringID(0, DUP_LORE);
|
||||
safe_delete(inst);
|
||||
}
|
||||
else {
|
||||
PushItemOnCursor(*inst);
|
||||
SendItemPacket(SLOT_CURSOR, inst, ItemPacketSummonItem);
|
||||
if(RuleB(TaskSystem, EnableTaskSystem))
|
||||
UpdateTasksForItem(ActivityForage, foragedfood);
|
||||
|
||||
safe_delete(inst);
|
||||
inst = m_inv.GetItem(SLOT_CURSOR);
|
||||
}
|
||||
safe_delete(inst);
|
||||
}
|
||||
|
||||
parse->EventPlayer(EVENT_FORAGE_SUCCESS, this, "", inst != nullptr ? inst->GetItem()->ID : 0);
|
||||
std::vector<void*> args;
|
||||
args.push_back(inst);
|
||||
parse->EventPlayer(EVENT_FORAGE_SUCCESS, this, "", inst ? inst->GetItem()->ID : 0, &args);
|
||||
|
||||
int ChanceSecondForage = aabonuses.ForageAdditionalItems + itembonuses.ForageAdditionalItems + spellbonuses.ForageAdditionalItems;
|
||||
if(!guarantee && MakeRandomInt(0,99) < ChanceSecondForage) {
|
||||
this->Message_StringID(MT_Skills, FORAGE_MASTERY);
|
||||
this->ForageItem(true);
|
||||
Message_StringID(MT_Skills, FORAGE_MASTERY);
|
||||
ForageItem(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@ -303,7 +303,7 @@ void Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
||||
if ((RuleB(Character, EnableDiscoveredItems)))
|
||||
{
|
||||
if(!GetGM() && !IsDiscovered(item_id))
|
||||
DiscoverItem(item_id);
|
||||
DiscoverItem(item_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,11 +7,6 @@
|
||||
#include "doors.h"
|
||||
#include "lua_door.h"
|
||||
|
||||
int Lua_Door::GetID() {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetID();
|
||||
}
|
||||
|
||||
void Lua_Door::SetDoorName(const char *name) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetDoorName(name);
|
||||
@ -147,7 +142,6 @@ luabind::scope lua_register_door() {
|
||||
.def(luabind::constructor<>())
|
||||
.property("null", &Lua_Door::Null)
|
||||
.property("valid", &Lua_Door::Valid)
|
||||
.def("GetID", (int(Lua_Door::*)(void))&Lua_Door::GetID)
|
||||
.def("SetDoorName", (void(Lua_Door::*)(const char*))&Lua_Door::SetDoorName)
|
||||
.def("GetDoorName", (const char*(Lua_Door::*)(void))&Lua_Door::GetDoorName)
|
||||
.def("GetX", (float(Lua_Door::*)(void))&Lua_Door::GetX)
|
||||
|
||||
@ -29,7 +29,6 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int GetID();
|
||||
void SetDoorName(const char *name);
|
||||
const char *GetDoorName();
|
||||
float GetX();
|
||||
|
||||
@ -253,6 +253,21 @@ Lua_ItemInst Lua_ItemInst::Clone() {
|
||||
return Lua_ItemInst(self->Clone(), true);
|
||||
}
|
||||
|
||||
void Lua_ItemInst::SetTimer(std::string name, uint32 time) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetTimer(name, time);
|
||||
}
|
||||
|
||||
void Lua_ItemInst::StopTimer(std::string name) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->StopTimer(name);
|
||||
}
|
||||
|
||||
void Lua_ItemInst::ClearTimers() {
|
||||
Lua_Safe_Call_Void();
|
||||
self->ClearTimers();
|
||||
}
|
||||
|
||||
luabind::scope lua_register_iteminst() {
|
||||
return luabind::class_<Lua_ItemInst>("ItemInst")
|
||||
.def(luabind::constructor<>())
|
||||
@ -301,7 +316,10 @@ luabind::scope lua_register_iteminst() {
|
||||
.def("AddExp", (void(Lua_ItemInst::*)(uint32))&Lua_ItemInst::AddExp)
|
||||
.def("GetMaxEvolveLvl", (int(Lua_ItemInst::*)(void))&Lua_ItemInst::GetMaxEvolveLvl)
|
||||
.def("GetKillsNeeded", (uint32(Lua_ItemInst::*)(int))&Lua_ItemInst::GetKillsNeeded)
|
||||
.def("Clone", (Lua_ItemInst(Lua_ItemInst::*)(void))&Lua_ItemInst::Clone);
|
||||
.def("Clone", (Lua_ItemInst(Lua_ItemInst::*)(void))&Lua_ItemInst::Clone)
|
||||
.def("SetTimer", (void(Lua_ItemInst::*)(std::string,uint32))&Lua_ItemInst::SetTimer)
|
||||
.def("StopTimer", (void(Lua_ItemInst::*)(std::string))&Lua_ItemInst::StopTimer)
|
||||
.def("ClearTimers", (void(Lua_ItemInst::*)(void))&Lua_ItemInst::ClearTimers);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -70,6 +70,9 @@ public:
|
||||
int GetMaxEvolveLvl();
|
||||
uint32 GetKillsNeeded(int current_level);
|
||||
Lua_ItemInst Clone();
|
||||
void SetTimer(std::string name, uint32 time);
|
||||
void StopTimer(std::string name);
|
||||
void ClearTimers();
|
||||
|
||||
private:
|
||||
bool cloned_;
|
||||
|
||||
@ -130,7 +130,7 @@ LuaParser::LuaParser() {
|
||||
NPCArgumentDispatch[EVENT_SLAY] = handle_npc_single_mob;
|
||||
NPCArgumentDispatch[EVENT_ENTER] = handle_npc_single_client;
|
||||
NPCArgumentDispatch[EVENT_EXIT] = handle_npc_single_client;
|
||||
NPCArgumentDispatch[EVENT_TASK_ACCEPTED] = handle_npc_single_client;
|
||||
NPCArgumentDispatch[EVENT_TASK_ACCEPTED] = handle_npc_task_accepted;
|
||||
NPCArgumentDispatch[EVENT_POPUP_RESPONSE] = handle_npc_popup;
|
||||
NPCArgumentDispatch[EVENT_WAYPOINT_ARRIVE] = handle_npc_waypoint;
|
||||
NPCArgumentDispatch[EVENT_WAYPOINT_DEPART] = handle_npc_waypoint;
|
||||
@ -162,11 +162,16 @@ LuaParser::LuaParser() {
|
||||
PlayerArgumentDispatch[EVENT_DUEL_LOSE] = handle_player_duel_loss;
|
||||
PlayerArgumentDispatch[EVENT_LOOT] = handle_player_loot;
|
||||
PlayerArgumentDispatch[EVENT_TASK_STAGE_COMPLETE] = handle_player_task_stage_complete;
|
||||
PlayerArgumentDispatch[EVENT_TASK_COMPLETE] = handle_player_task_complete;
|
||||
PlayerArgumentDispatch[EVENT_TASK_COMPLETE] = handle_player_task_update;
|
||||
PlayerArgumentDispatch[EVENT_TASK_UPDATE] = handle_player_task_update;
|
||||
PlayerArgumentDispatch[EVENT_COMMAND] = handle_player_command;
|
||||
PlayerArgumentDispatch[EVENT_COMBINE_SUCCESS] = handle_player_combine;
|
||||
PlayerArgumentDispatch[EVENT_COMBINE_FAILURE] = handle_player_combine;
|
||||
PlayerArgumentDispatch[EVENT_FEIGN_DEATH] = handle_player_feign;
|
||||
|
||||
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
||||
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
|
||||
ItemArgumentDispatch[EVENT_TIMER] = handle_item_timer;
|
||||
|
||||
SpellArgumentDispatch[EVENT_SPELL_EFFECT_CLIENT] = handle_spell_effect;
|
||||
SpellArgumentDispatch[EVENT_SPELL_BUFF_TIC_CLIENT] = handle_spell_effect;
|
||||
@ -182,7 +187,7 @@ LuaParser::~LuaParser() {
|
||||
}
|
||||
|
||||
int LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return 0;
|
||||
@ -197,11 +202,11 @@ int LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data,
|
||||
}
|
||||
|
||||
std::string package_name = "npc_" + std::to_string(npc->GetNPCTypeID());
|
||||
return _EventNPC(package_name, evt, npc, init, data, extra_data, items);
|
||||
return _EventNPC(package_name, evt, npc, init, data, extra_data, extra_pointers);
|
||||
}
|
||||
|
||||
int LuaParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return 0;
|
||||
@ -215,11 +220,11 @@ int LuaParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _EventNPC("global_npc", evt, npc, init, data, extra_data, items);
|
||||
return _EventNPC("global_npc", evt, npc, init, data, extra_data, extra_pointers);
|
||||
}
|
||||
|
||||
int LuaParser::_EventNPC(std::string package_name, QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items, luabind::object *l_func) {
|
||||
std::vector<void*> *extra_pointers, luabind::object *l_func) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
|
||||
int start = lua_gettop(L);
|
||||
@ -242,7 +247,7 @@ int LuaParser::_EventNPC(std::string package_name, QuestEventID evt, NPC* npc, M
|
||||
lua_setfield(L, -2, "self");
|
||||
|
||||
auto arg_function = NPCArgumentDispatch[evt];
|
||||
arg_function(this, L, npc, init, data, extra_data, items);
|
||||
arg_function(this, L, npc, init, data, extra_data, extra_pointers);
|
||||
Client *c = (init && init->IsClient()) ? init->CastToClient() : nullptr;
|
||||
|
||||
quest_manager.StartQuest(npc, c, nullptr);
|
||||
@ -277,7 +282,8 @@ int LuaParser::_EventNPC(std::string package_name, QuestEventID evt, NPC* npc, M
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
int LuaParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return 0;
|
||||
@ -291,10 +297,11 @@ int LuaParser::EventPlayer(QuestEventID evt, Client *client, std::string data, u
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _EventPlayer("player", evt, client, data, extra_data);
|
||||
return _EventPlayer("player", evt, client, data, extra_data, extra_pointers);
|
||||
}
|
||||
|
||||
int LuaParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
int LuaParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return 0;
|
||||
@ -308,11 +315,11 @@ int LuaParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string d
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _EventPlayer("global_player", evt, client, data, extra_data);
|
||||
return _EventPlayer("global_player", evt, client, data, extra_data, extra_pointers);
|
||||
}
|
||||
|
||||
int LuaParser::_EventPlayer(std::string package_name, QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
luabind::object *l_func) {
|
||||
std::vector<void*> *extra_pointers, luabind::object *l_func) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
int start = lua_gettop(L);
|
||||
|
||||
@ -334,7 +341,7 @@ int LuaParser::_EventPlayer(std::string package_name, QuestEventID evt, Client *
|
||||
lua_setfield(L, -2, "self");
|
||||
|
||||
auto arg_function = PlayerArgumentDispatch[evt];
|
||||
arg_function(this, L, client, data, extra_data);
|
||||
arg_function(this, L, client, data, extra_data, extra_pointers);
|
||||
|
||||
quest_manager.StartQuest(client, client, nullptr);
|
||||
if(lua_pcall(L, 1, 1, 0)) {
|
||||
@ -368,7 +375,8 @@ int LuaParser::_EventPlayer(std::string package_name, QuestEventID evt, Client *
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data) {
|
||||
int LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return 0;
|
||||
@ -384,11 +392,11 @@ int LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *
|
||||
|
||||
std::string package_name = "item_";
|
||||
package_name += std::to_string(item->GetID());
|
||||
return _EventItem(package_name, evt, client, item, mob, data, extra_data);
|
||||
return _EventItem(package_name, evt, client, item, mob, data, extra_data, extra_pointers);
|
||||
}
|
||||
|
||||
int LuaParser::_EventItem(std::string package_name, QuestEventID evt, Client *client, ItemInst *item, Mob *mob,
|
||||
std::string data, uint32 extra_data, luabind::object *l_func) {
|
||||
std::string data, uint32 extra_data, std::vector<void*> *extra_pointers, luabind::object *l_func) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
|
||||
int start = lua_gettop(L);
|
||||
@ -416,7 +424,7 @@ int LuaParser::_EventItem(std::string package_name, QuestEventID evt, Client *cl
|
||||
|
||||
//redo this arg function
|
||||
auto arg_function = ItemArgumentDispatch[evt];
|
||||
arg_function(this, L, client, item, 0, extra_data);
|
||||
arg_function(this, L, client, item, data, extra_data, extra_pointers);
|
||||
|
||||
quest_manager.StartQuest(client, client, item);
|
||||
if(lua_pcall(L, 1, 1, 0)) {
|
||||
@ -450,7 +458,8 @@ int LuaParser::_EventItem(std::string package_name, QuestEventID evt, Client *cl
|
||||
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, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return 0;
|
||||
@ -462,11 +471,11 @@ int LuaParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spe
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _EventSpell(package_name, evt, npc, client, spell_id, extra_data);
|
||||
return _EventSpell(package_name, evt, npc, client, spell_id, extra_data, extra_pointers);
|
||||
}
|
||||
|
||||
int LuaParser::_EventSpell(std::string package_name, QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
luabind::object *l_func) {
|
||||
std::vector<void*> *extra_pointers, luabind::object *l_func) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
|
||||
int start = lua_gettop(L);
|
||||
@ -496,7 +505,7 @@ int LuaParser::_EventSpell(std::string package_name, QuestEventID evt, NPC* npc,
|
||||
lua_setfield(L, -2, "self");
|
||||
|
||||
auto arg_function = SpellArgumentDispatch[evt];
|
||||
arg_function(this, L, npc, client, spell_id, extra_data);
|
||||
arg_function(this, L, npc, client, spell_id, extra_data, extra_pointers);
|
||||
|
||||
quest_manager.StartQuest(npc, client, nullptr);
|
||||
if(lua_pcall(L, 1, 1, 0)) {
|
||||
@ -530,7 +539,7 @@ int LuaParser::_EventSpell(std::string package_name, QuestEventID evt, NPC* npc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaParser::EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data) {
|
||||
int LuaParser::EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data, std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return 0;
|
||||
@ -542,10 +551,11 @@ int LuaParser::EventEncounter(QuestEventID evt, std::string encounter_name, uint
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _EventEncounter(package_name, evt, encounter_name, extra_data);
|
||||
return _EventEncounter(package_name, evt, encounter_name, extra_data, extra_pointers);
|
||||
}
|
||||
|
||||
int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std::string encounter_name, uint32 extra_data) {
|
||||
int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std::string encounter_name, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
const char *sub_name = LuaEvents[evt];
|
||||
|
||||
int start = lua_gettop(L);
|
||||
@ -884,7 +894,7 @@ void LuaParser::MapFunctions(lua_State *L) {
|
||||
}
|
||||
|
||||
void LuaParser::DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return;
|
||||
@ -904,13 +914,14 @@ void LuaParser::DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::str
|
||||
while(riter != iter->second.end()) {
|
||||
if(riter->event_id == evt) {
|
||||
std::string package_name = "encounter_" + riter->encounter_name;
|
||||
_EventNPC(package_name, evt, npc, init, data, extra_data, items, &riter->lua_reference);
|
||||
_EventNPC(package_name, evt, npc, init, data, extra_data, extra_pointers, &riter->lua_reference);
|
||||
}
|
||||
++riter;
|
||||
}
|
||||
}
|
||||
|
||||
void LuaParser::DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
void LuaParser::DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return;
|
||||
@ -927,13 +938,14 @@ void LuaParser::DispatchEventPlayer(QuestEventID evt, Client *client, std::strin
|
||||
while(riter != iter->second.end()) {
|
||||
if(riter->event_id == evt) {
|
||||
std::string package_name = "encounter_" + riter->encounter_name;
|
||||
_EventPlayer(package_name, evt, client, data, extra_data, &riter->lua_reference);
|
||||
_EventPlayer(package_name, evt, client, data, extra_data, extra_pointers, &riter->lua_reference);
|
||||
}
|
||||
++riter;
|
||||
}
|
||||
}
|
||||
|
||||
void LuaParser::DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data) {
|
||||
void LuaParser::DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return;
|
||||
@ -954,13 +966,14 @@ void LuaParser::DispatchEventItem(QuestEventID evt, Client *client, ItemInst *it
|
||||
while(riter != iter->second.end()) {
|
||||
if(riter->event_id == evt) {
|
||||
std::string package_name = "encounter_" + riter->encounter_name;
|
||||
_EventItem(package_name, evt, client, item, mob, data, extra_data, &riter->lua_reference);
|
||||
_EventItem(package_name, evt, client, item, mob, data, extra_data, extra_pointers, &riter->lua_reference);
|
||||
}
|
||||
++riter;
|
||||
}
|
||||
}
|
||||
|
||||
void LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {
|
||||
void LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
evt = ConvertLuaEvent(evt);
|
||||
if(evt >= _LargestEventID) {
|
||||
return;
|
||||
@ -977,7 +990,7 @@ void LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, u
|
||||
while(riter != iter->second.end()) {
|
||||
if(riter->event_id == evt) {
|
||||
std::string package_name = "encounter_" + riter->encounter_name;
|
||||
_EventSpell(package_name, evt, npc, client, spell_id, extra_data, &riter->lua_reference);
|
||||
_EventSpell(package_name, evt, npc, client, spell_id, extra_data, extra_pointers, &riter->lua_reference);
|
||||
}
|
||||
++riter;
|
||||
}
|
||||
|
||||
@ -26,14 +26,19 @@ public:
|
||||
~LuaParser();
|
||||
|
||||
virtual int EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
virtual int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data);
|
||||
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
|
||||
virtual int EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data);
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual int EventEncounter(QuestEventID evt, std::string encounter_name, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
virtual bool HasQuestSub(uint32 npc_id, QuestEventID evt);
|
||||
virtual bool HasGlobalQuestSub(QuestEventID evt);
|
||||
@ -58,21 +63,25 @@ public:
|
||||
virtual uint32 GetIdentifier() { return 0xb0712acc; }
|
||||
|
||||
virtual void DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
virtual void DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
virtual void DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data);
|
||||
virtual void DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual void DispatchEventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual void DispatchEventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
virtual void DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
private:
|
||||
int _EventNPC(std::string package_name, QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items, luabind::object *l_func = nullptr);
|
||||
std::vector<void*> *extra_pointers, luabind::object *l_func = nullptr);
|
||||
int _EventPlayer(std::string package_name, QuestEventID evt, Client *client, std::string data, uint32 extra_data,
|
||||
luabind::object *l_func = nullptr);
|
||||
std::vector<void*> *extra_pointers, luabind::object *l_func = nullptr);
|
||||
int _EventItem(std::string package_name, QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data,
|
||||
uint32 extra_data, luabind::object *l_func = nullptr);
|
||||
uint32 extra_data, std::vector<void*> *extra_pointers, luabind::object *l_func = nullptr);
|
||||
int _EventSpell(std::string package_name, QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data,
|
||||
luabind::object *l_func = nullptr);
|
||||
int _EventEncounter(std::string package_name, QuestEventID evt, std::string encounter_name, uint32 extra_data);
|
||||
std::vector<void*> *extra_pointers, luabind::object *l_func = nullptr);
|
||||
int _EventEncounter(std::string package_name, QuestEventID evt, std::string encounter_name, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
void LoadScript(std::string filename, std::string package_name);
|
||||
bool HasFunction(std::string function, std::string package_name);
|
||||
|
||||
@ -17,12 +17,15 @@
|
||||
#include "lua_client.h"
|
||||
#include "lua_npc.h"
|
||||
#include "lua_spell.h"
|
||||
#include "lua_corpse.h"
|
||||
#include "lua_door.h"
|
||||
#include "lua_object.h"
|
||||
#include "zone.h"
|
||||
#include "lua_parser_events.h"
|
||||
|
||||
//NPC
|
||||
void handle_npc_event_say(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
npc->DoQuestPause(init);
|
||||
|
||||
Lua_Client l_client(reinterpret_cast<Client*>(init));
|
||||
@ -38,7 +41,7 @@ void handle_npc_event_say(QuestInterface *parse, lua_State* L, NPC* npc, Mob *in
|
||||
}
|
||||
|
||||
void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Client l_client(reinterpret_cast<Client*>(init));
|
||||
luabind::object l_client_o = luabind::object(L, l_client);
|
||||
l_client_o.push(L);
|
||||
@ -48,10 +51,10 @@ void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob *
|
||||
std::stringstream ident;
|
||||
ident << npc->GetNPCTypeID();
|
||||
|
||||
if(items) {
|
||||
for(size_t i = 0; i < items->size(); ++i) {
|
||||
if(extra_pointers) {
|
||||
for(size_t i = 0; i < extra_pointers->size(); ++i) {
|
||||
std::string prefix = "item" + std::to_string(i + 1);
|
||||
Lua_ItemInst l_inst = items->at(i);
|
||||
Lua_ItemInst l_inst = reinterpret_cast<ItemInst*>(extra_pointers->at(i));
|
||||
luabind::object l_inst_o = luabind::object(L, l_inst);
|
||||
l_inst_o.push(L);
|
||||
|
||||
@ -74,7 +77,7 @@ void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob *
|
||||
}
|
||||
|
||||
void handle_npc_event_hp(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
if(extra_data == 1) {
|
||||
lua_pushinteger(L, -1);
|
||||
lua_setfield(L, -2, "hp_event");
|
||||
@ -91,7 +94,7 @@ void handle_npc_event_hp(QuestInterface *parse, lua_State* L, NPC* npc, Mob *ini
|
||||
}
|
||||
|
||||
void handle_npc_single_mob(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Mob l_mob(init);
|
||||
luabind::object l_mob_o = luabind::object(L, l_mob);
|
||||
l_mob_o.push(L);
|
||||
@ -99,7 +102,7 @@ void handle_npc_single_mob(QuestInterface *parse, lua_State* L, NPC* npc, Mob *i
|
||||
}
|
||||
|
||||
void handle_npc_single_client(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Client l_client(reinterpret_cast<Client*>(init));
|
||||
luabind::object l_client_o = luabind::object(L, l_client);
|
||||
l_client_o.push(L);
|
||||
@ -107,15 +110,26 @@ void handle_npc_single_client(QuestInterface *parse, lua_State* L, NPC* npc, Mob
|
||||
}
|
||||
|
||||
void handle_npc_single_npc(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_NPC l_npc(reinterpret_cast<NPC*>(init));
|
||||
luabind::object l_npc_o = luabind::object(L, l_npc);
|
||||
l_npc_o.push(L);
|
||||
lua_setfield(L, -2, "other");
|
||||
}
|
||||
|
||||
void handle_npc_task_accepted(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Client l_client(reinterpret_cast<Client*>(init));
|
||||
luabind::object l_client_o = luabind::object(L, l_client);
|
||||
l_client_o.push(L);
|
||||
lua_setfield(L, -2, "other");
|
||||
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "task_id");
|
||||
}
|
||||
|
||||
void handle_npc_popup(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Mob l_mob(init);
|
||||
luabind::object l_mob_o = luabind::object(L, l_mob);
|
||||
l_mob_o.push(L);
|
||||
@ -126,7 +140,7 @@ void handle_npc_popup(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init,
|
||||
}
|
||||
|
||||
void handle_npc_waypoint(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Mob l_mob(init);
|
||||
luabind::object l_mob_o = luabind::object(L, l_mob);
|
||||
l_mob_o.push(L);
|
||||
@ -137,7 +151,7 @@ void handle_npc_waypoint(QuestInterface *parse, lua_State* L, NPC* npc, Mob *ini
|
||||
}
|
||||
|
||||
void handle_npc_hate(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Mob l_mob(init);
|
||||
luabind::object l_mob_o = luabind::object(L, l_mob);
|
||||
l_mob_o.push(L);
|
||||
@ -149,19 +163,19 @@ void handle_npc_hate(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, s
|
||||
|
||||
|
||||
void handle_npc_signal(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "signal");
|
||||
}
|
||||
|
||||
void handle_npc_timer(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "timer");
|
||||
}
|
||||
|
||||
void handle_npc_death(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Mob l_mob(init);
|
||||
luabind::object l_mob_o = luabind::object(L, l_mob);
|
||||
l_mob_o.push(L);
|
||||
@ -189,7 +203,7 @@ void handle_npc_death(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init,
|
||||
}
|
||||
|
||||
void handle_npc_cast(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
int spell_id = std::stoi(data);
|
||||
if(IsValidSpell(spell_id)) {
|
||||
Lua_Spell l_spell(&spells[spell_id]);
|
||||
@ -205,11 +219,12 @@ void handle_npc_cast(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, s
|
||||
}
|
||||
|
||||
void handle_npc_null(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items) {
|
||||
std::vector<void*> *extra_pointers) {
|
||||
}
|
||||
|
||||
//Player
|
||||
void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "message");
|
||||
|
||||
@ -217,7 +232,8 @@ void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std:
|
||||
lua_setfield(L, -2, "language");
|
||||
}
|
||||
|
||||
void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Seperator sep(data.c_str());
|
||||
|
||||
Mob *o = entity_list.GetMobID(std::stoi(sep.arg[0]));
|
||||
@ -246,12 +262,14 @@ void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, st
|
||||
lua_setfield(L, -2, "skill");
|
||||
}
|
||||
|
||||
void handle_player_timer(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_timer(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "timer");
|
||||
}
|
||||
|
||||
void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
const Item_Struct *item = database.GetItem(extra_data);
|
||||
if(item) {
|
||||
Lua_Item l_item(item);
|
||||
@ -266,37 +284,52 @@ void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* cl
|
||||
}
|
||||
}
|
||||
|
||||
void handle_player_fish_forage_success(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "item_id");
|
||||
void handle_player_fish_forage_success(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_ItemInst l_item(reinterpret_cast<ItemInst*>(extra_pointers->at(0)));
|
||||
luabind::object l_item_o = luabind::object(L, l_item);
|
||||
l_item_o.push(L);
|
||||
lua_setfield(L, -2, "item");
|
||||
}
|
||||
|
||||
void handle_player_click_object(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "object_id");
|
||||
void handle_player_click_object(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Object l_object(reinterpret_cast<Object*>(extra_pointers->at(0)));
|
||||
luabind::object l_object_o = luabind::object(L, l_object);
|
||||
l_object_o.push(L);
|
||||
lua_setfield(L, -2, "object");
|
||||
}
|
||||
|
||||
void handle_player_click_door(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "door_id");
|
||||
void handle_player_click_door(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Door l_door(reinterpret_cast<Doors*>(extra_pointers->at(0)));
|
||||
luabind::object l_door_o = luabind::object(L, l_door);
|
||||
l_door_o.push(L);
|
||||
lua_setfield(L, -2, "door");
|
||||
}
|
||||
|
||||
void handle_player_signal(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_signal(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "signal");
|
||||
}
|
||||
|
||||
void handle_player_popup_response(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_popup_response(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "popup_id");
|
||||
}
|
||||
|
||||
void handle_player_pick_up(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "picked_up_id");
|
||||
void handle_player_pick_up(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_ItemInst l_item(reinterpret_cast<ItemInst*>(extra_pointers->at(0)));
|
||||
luabind::object l_item_o = luabind::object(L, l_item);
|
||||
l_item_o.push(L);
|
||||
lua_setfield(L, -2, "item");
|
||||
}
|
||||
|
||||
void handle_player_cast(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_cast(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
int spell_id = std::stoi(data);
|
||||
if(IsValidSpell(spell_id)) {
|
||||
Lua_Spell l_spell(&spells[spell_id]);
|
||||
@ -311,45 +344,49 @@ void handle_player_cast(QuestInterface *parse, lua_State* L, Client* client, std
|
||||
lua_setfield(L, -2, "spell");
|
||||
}
|
||||
|
||||
void handle_player_task_fail(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_task_fail(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "task_id");
|
||||
}
|
||||
|
||||
void handle_player_zone(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_zone(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushinteger(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "zone_id");
|
||||
}
|
||||
|
||||
void handle_player_duel_win(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "loser_character_name");
|
||||
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "loser_character_id");
|
||||
void handle_player_duel_win(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Client l_client(reinterpret_cast<Client*>(extra_pointers->at(1)));
|
||||
luabind::object l_client_o = luabind::object(L, l_client);
|
||||
l_client_o.push(L);
|
||||
lua_setfield(L, -2, "other");
|
||||
}
|
||||
|
||||
void handle_player_duel_loss(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "winner_character_name");
|
||||
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "winner_character_id");
|
||||
void handle_player_duel_loss(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_Client l_client(reinterpret_cast<Client*>(extra_pointers->at(0)));
|
||||
luabind::object l_client_o = luabind::object(L, l_client);
|
||||
l_client_o.push(L);
|
||||
lua_setfield(L, -2, "other");
|
||||
}
|
||||
|
||||
void handle_player_loot(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
Seperator sep(data.c_str());
|
||||
lua_pushinteger(L, std::stoi(sep.arg[0]));
|
||||
lua_setfield(L, -2, "looted_id");
|
||||
void handle_player_loot(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Lua_ItemInst l_item(reinterpret_cast<ItemInst*>(extra_pointers->at(0)));
|
||||
luabind::object l_item_o = luabind::object(L, l_item);
|
||||
l_item_o.push(L);
|
||||
lua_setfield(L, -2, "item");
|
||||
|
||||
lua_pushinteger(L, std::stoi(sep.arg[1]));
|
||||
lua_setfield(L, -2, "looted_charges");
|
||||
|
||||
lua_pushstring(L, sep.arg[2]);
|
||||
Lua_Corpse l_corpse(reinterpret_cast<Corpse*>(extra_pointers->at(1)));
|
||||
luabind::object l_corpse_o = luabind::object(L, l_corpse);
|
||||
l_corpse_o.push(L);
|
||||
lua_setfield(L, -2, "corpse");
|
||||
}
|
||||
|
||||
void handle_player_task_stage_complete(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_task_stage_complete(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Seperator sep(data.c_str());
|
||||
lua_pushinteger(L, std::stoi(sep.arg[0]));
|
||||
lua_setfield(L, -2, "task_id");
|
||||
@ -358,10 +395,11 @@ void handle_player_task_stage_complete(QuestInterface *parse, lua_State* L, Clie
|
||||
lua_setfield(L, -2, "activity_id");
|
||||
}
|
||||
|
||||
void handle_player_task_complete(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_task_update(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Seperator sep(data.c_str());
|
||||
lua_pushinteger(L, std::stoi(sep.arg[0]));
|
||||
lua_setfield(L, -2, "done_count");
|
||||
lua_setfield(L, -2, "count");
|
||||
|
||||
lua_pushinteger(L, std::stoi(sep.arg[1]));
|
||||
lua_setfield(L, -2, "activity_id");
|
||||
@ -370,7 +408,8 @@ void handle_player_task_complete(QuestInterface *parse, lua_State* L, Client* cl
|
||||
lua_setfield(L, -2, "task_id");
|
||||
}
|
||||
|
||||
void handle_player_command(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_command(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
Seperator sep(data.c_str(), ' ', 10, 100, true);
|
||||
std::string command(sep.arg[0] + 1);
|
||||
lua_pushstring(L, command.c_str());
|
||||
@ -388,20 +427,43 @@ void handle_player_command(QuestInterface *parse, lua_State* L, Client* client,
|
||||
lua_setfield(L, -2, "args");
|
||||
}
|
||||
|
||||
void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data) {
|
||||
void handle_player_combine(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "recipe_id");
|
||||
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "recipe_name");
|
||||
}
|
||||
|
||||
void handle_player_feign(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
}
|
||||
|
||||
void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
}
|
||||
|
||||
//Item
|
||||
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, uint32 objid, uint32 extra_data) {
|
||||
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "slot_id");
|
||||
lua_setfield(L, -2, "slot_id");
|
||||
}
|
||||
|
||||
void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, uint32 objid, uint32 extra_data) {
|
||||
void handle_item_timer(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "timer");
|
||||
}
|
||||
|
||||
void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
}
|
||||
|
||||
//Spell
|
||||
void handle_spell_effect(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data) {
|
||||
void handle_spell_effect(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
if(npc) {
|
||||
Lua_NPC l_npc(npc);
|
||||
luabind::object l_npc_o = luabind::object(L, l_npc);
|
||||
@ -421,7 +483,8 @@ void handle_spell_effect(QuestInterface *parse, lua_State* L, NPC* npc, Client*
|
||||
lua_setfield(L, -2, "caster_id");
|
||||
}
|
||||
|
||||
void handle_spell_fade(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data) {
|
||||
void handle_spell_fade(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
if(npc) {
|
||||
Lua_NPC l_npc(npc);
|
||||
luabind::object l_npc_o = luabind::object(L, l_npc);
|
||||
@ -441,5 +504,6 @@ void handle_spell_fade(QuestInterface *parse, lua_State* L, NPC* npc, Client* cl
|
||||
lua_setfield(L, -2, "buff_slot");
|
||||
}
|
||||
|
||||
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, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers) {
|
||||
}
|
||||
|
||||
@ -2,71 +2,104 @@
|
||||
#define _EQE_LUA_PARSER_EVENTS_H
|
||||
#ifdef LUA_EQEMU
|
||||
|
||||
typedef void(*NPCArgumentHandler)(QuestInterface*, lua_State*, NPC*, Mob*, std::string, uint32, std::vector<ItemInst*>*);
|
||||
typedef void(*PlayerArgumentHandler)(QuestInterface*, lua_State*, Client*, std::string, uint32);
|
||||
typedef void(*ItemArgumentHandler)(QuestInterface*, lua_State*, Client*, ItemInst*, uint32, uint32);
|
||||
typedef void(*SpellArgumentHandler)(QuestInterface*, lua_State*, NPC*, Client*, uint32, uint32);
|
||||
typedef void(*NPCArgumentHandler)(QuestInterface*, lua_State*, NPC*, Mob*, std::string, uint32, std::vector<void*>*);
|
||||
typedef void(*PlayerArgumentHandler)(QuestInterface*, lua_State*, Client*, std::string, uint32, std::vector<void*>*);
|
||||
typedef void(*ItemArgumentHandler)(QuestInterface*, lua_State*, Client*, ItemInst*, std::string, uint32, std::vector<void*>*);
|
||||
typedef void(*SpellArgumentHandler)(QuestInterface*, lua_State*, NPC*, Client*, uint32, uint32, std::vector<void*>*);
|
||||
|
||||
//NPC
|
||||
void handle_npc_event_say(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_event_hp(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_single_mob(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_single_client(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_single_npc(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_task_accepted(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_popup(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_waypoint(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_hate(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_signal(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_timer(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_death(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_cast(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_npc_null(QuestInterface *parse, lua_State* L, NPC* npc, Mob *init, std::string data, uint32 extra_data,
|
||||
std::vector<ItemInst*> *items);
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
//Player
|
||||
void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_timer(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_fish_forage_success(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_click_object(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_click_door(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_signal(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_popup_response(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_pick_up(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_cast(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_task_fail(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_zone(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_duel_win(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_duel_loss(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_loot(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_task_stage_complete(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_task_complete(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_command(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data);
|
||||
void handle_player_say(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_death(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_timer(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_discover_item(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_fish_forage_success(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_click_object(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_click_door(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_signal(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_popup_response(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_pick_up(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_cast(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_task_fail(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_zone(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_duel_win(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_duel_loss(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_loot(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_task_stage_complete(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_task_update(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_command(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_combine(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_feign(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
//Item
|
||||
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, uint32 objid, uint32 extra_data);
|
||||
void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, uint32 objid, uint32 extra_data);
|
||||
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_item_timer(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_item_null(QuestInterface *parse, lua_State* L, Client* client, ItemInst* item, std::string data, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
//Spell
|
||||
void handle_spell_effect(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data);
|
||||
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, uint32 extra_data);
|
||||
void handle_spell_effect(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_spell_fade(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
void handle_spell_null(QuestInterface *parse, lua_State* L, NPC* npc, Client* client, uint32 spell_id, uint32 extra_data,
|
||||
std::vector<void*> *extra_pointers);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
142
zone/mob.cpp
142
zone/mob.cpp
@ -726,6 +726,71 @@ void Mob::CreateSpawnPacket(EQApplicationPacket* app, Mob* ForWho) {
|
||||
memset(app->pBuffer, 0, app->size);
|
||||
NewSpawn_Struct* ns = (NewSpawn_Struct*)app->pBuffer;
|
||||
FillSpawnStruct(ns, ForWho);
|
||||
|
||||
if(strlen(ns->spawn.lastName) == 0) {
|
||||
switch(ns->spawn.class_)
|
||||
{
|
||||
case TRIBUTE_MASTER:
|
||||
strcpy(ns->spawn.lastName, "Tribute Master");
|
||||
break;
|
||||
case ADVENTURERECRUITER:
|
||||
strcpy(ns->spawn.lastName, "Adventure Recruiter");
|
||||
break;
|
||||
case BANKER:
|
||||
strcpy(ns->spawn.lastName, "Banker");
|
||||
break;
|
||||
case ADVENTUREMERCHANT:
|
||||
strcpy(ns->spawn.lastName,"Adventure Merchant");
|
||||
break;
|
||||
case WARRIORGM:
|
||||
strcpy(ns->spawn.lastName, "GM Warrior");
|
||||
break;
|
||||
case PALADINGM:
|
||||
strcpy(ns->spawn.lastName, "GM Paladin");
|
||||
break;
|
||||
case RANGERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Ranger");
|
||||
break;
|
||||
case SHADOWKNIGHTGM:
|
||||
strcpy(ns->spawn.lastName, "GM Shadowknight");
|
||||
break;
|
||||
case DRUIDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Druid");
|
||||
break;
|
||||
case BARDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Bard");
|
||||
break;
|
||||
case ROGUEGM:
|
||||
strcpy(ns->spawn.lastName, "GM Rogue");
|
||||
break;
|
||||
case SHAMANGM:
|
||||
strcpy(ns->spawn.lastName, "GM Shaman");
|
||||
break;
|
||||
case NECROMANCERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Necromancer");
|
||||
break;
|
||||
case WIZARDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Wizard");
|
||||
break;
|
||||
case MAGICIANGM:
|
||||
strcpy(ns->spawn.lastName, "GM Magician");
|
||||
break;
|
||||
case ENCHANTERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Enchanter");
|
||||
break;
|
||||
case BEASTLORDGM:
|
||||
strcpy(ns->spawn.lastName, "GM Beastlord");
|
||||
break;
|
||||
case BERSERKERGM:
|
||||
strcpy(ns->spawn.lastName, "GM Berserker");
|
||||
break;
|
||||
case MERCERNARY_MASTER:
|
||||
strcpy(ns->spawn.lastName, "Mercenary Recruiter");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mob::CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns) {
|
||||
@ -740,47 +805,71 @@ void Mob::CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns) {
|
||||
// Custom packet data
|
||||
NewSpawn_Struct* ns2 = (NewSpawn_Struct*)app->pBuffer;
|
||||
strcpy(ns2->spawn.name, ns->spawn.name);
|
||||
/*if (ns->spawn.class_==MERCHANT)
|
||||
strcpy(ns2->spawn.lastName, "EQEmu Shopkeeper");
|
||||
else*/ if (ns->spawn.class_==TRIBUTE_MASTER)
|
||||
switch(ns->spawn.class_)
|
||||
{
|
||||
case TRIBUTE_MASTER:
|
||||
strcpy(ns2->spawn.lastName, "Tribute Master");
|
||||
else if (ns->spawn.class_==ADVENTURERECRUITER)
|
||||
break;
|
||||
case ADVENTURERECRUITER:
|
||||
strcpy(ns2->spawn.lastName, "Adventure Recruiter");
|
||||
else if (ns->spawn.class_==BANKER)
|
||||
break;
|
||||
case BANKER:
|
||||
strcpy(ns2->spawn.lastName, "Banker");
|
||||
else if (ns->spawn.class_==ADVENTUREMERCHANT)
|
||||
break;
|
||||
case ADVENTUREMERCHANT:
|
||||
strcpy(ns->spawn.lastName,"Adventure Merchant");
|
||||
else if (ns->spawn.class_==WARRIORGM)
|
||||
break;
|
||||
case WARRIORGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Warrior");
|
||||
else if (ns->spawn.class_==PALADINGM)
|
||||
break;
|
||||
case PALADINGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Paladin");
|
||||
else if (ns->spawn.class_==RANGERGM)
|
||||
break;
|
||||
case RANGERGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Ranger");
|
||||
else if (ns->spawn.class_==SHADOWKNIGHTGM)
|
||||
break;
|
||||
case SHADOWKNIGHTGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Shadowknight");
|
||||
else if (ns->spawn.class_==DRUIDGM)
|
||||
break;
|
||||
case DRUIDGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Druid");
|
||||
else if (ns->spawn.class_==BARDGM)
|
||||
break;
|
||||
case BARDGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Bard");
|
||||
else if (ns->spawn.class_==ROGUEGM)
|
||||
break;
|
||||
case ROGUEGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Rogue");
|
||||
else if (ns->spawn.class_==SHAMANGM)
|
||||
break;
|
||||
case SHAMANGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Shaman");
|
||||
else if (ns->spawn.class_==NECROMANCERGM)
|
||||
break;
|
||||
case NECROMANCERGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Necromancer");
|
||||
else if (ns->spawn.class_==WIZARDGM)
|
||||
break;
|
||||
case WIZARDGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Wizard");
|
||||
else if (ns->spawn.class_==MAGICIANGM)
|
||||
break;
|
||||
case MAGICIANGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Magician");
|
||||
else if (ns->spawn.class_==ENCHANTERGM)
|
||||
break;
|
||||
case ENCHANTERGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Enchanter");
|
||||
else if (ns->spawn.class_==BEASTLORDGM)
|
||||
break;
|
||||
case BEASTLORDGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Beastlord");
|
||||
else if (ns->spawn.class_==BERSERKERGM)
|
||||
break;
|
||||
case BERSERKERGM:
|
||||
strcpy(ns2->spawn.lastName, "GM Berserker");
|
||||
else
|
||||
break;
|
||||
case MERCERNARY_MASTER:
|
||||
strcpy(ns->spawn.lastName, "Mercenary Recruiter");
|
||||
break;
|
||||
default:
|
||||
strcpy(ns2->spawn.lastName, ns->spawn.lastName);
|
||||
memset(&app->pBuffer[sizeof(Spawn_Struct)-7],0xFF,7);
|
||||
break;
|
||||
}
|
||||
|
||||
memset(&app->pBuffer[sizeof(Spawn_Struct)-7], 0xFF, 7);
|
||||
}
|
||||
|
||||
void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||
@ -788,10 +877,10 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||
int i;
|
||||
|
||||
strcpy(ns->spawn.name, name);
|
||||
if(IsClient())
|
||||
{
|
||||
strn0cpy(ns->spawn.lastName,lastname,sizeof(ns->spawn.lastName));
|
||||
}
|
||||
if(IsClient()) {
|
||||
strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName));
|
||||
}
|
||||
|
||||
ns->spawn.heading = FloatToEQ19(heading);
|
||||
ns->spawn.x = FloatToEQ19(x_pos);//((int32)x_pos)<<3;
|
||||
ns->spawn.y = FloatToEQ19(y_pos);//((int32)y_pos)<<3;
|
||||
@ -808,7 +897,6 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||
ns->spawn.deity = deity;
|
||||
ns->spawn.animation = 0;
|
||||
ns->spawn.findable = findable?1:0;
|
||||
// vesuvias - appearence fix
|
||||
ns->spawn.light = light;
|
||||
ns->spawn.showhelm = 1;
|
||||
|
||||
|
||||
@ -425,6 +425,7 @@ public:
|
||||
void CreateDespawnPacket(EQApplicationPacket* app, bool Decay);
|
||||
void CreateHorseSpawnPacket(EQApplicationPacket* app, const char* ownername, uint16 ownerid, Mob* ForWho = 0);
|
||||
void CreateSpawnPacket(EQApplicationPacket* app, Mob* ForWho = 0);
|
||||
static void CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns);
|
||||
virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
|
||||
void CreateHPPacket(EQApplicationPacket* app);
|
||||
void SendHPUpdate();
|
||||
@ -432,7 +433,6 @@ public:
|
||||
//Util
|
||||
static uint32 RandomTimer(int min, int max);
|
||||
static uint8 GetDefaultGender(uint16 in_race, uint8 in_gender = 0xFF);
|
||||
static void CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns);
|
||||
uint16 GetSkillByItemType(int ItemType);
|
||||
virtual void MakePet(uint16 spell_id, const char* pettype, const char *petname = nullptr);
|
||||
virtual void MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const char *petname = nullptr);
|
||||
|
||||
@ -448,10 +448,7 @@ void QuestManager::settimer(const char *timer_name, int seconds) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if(questitem) {
|
||||
auto timers = questitem->GetTimers();
|
||||
Timer t(seconds * 1000);
|
||||
t.Start(seconds * 1000, false);
|
||||
timers[timer_name] = t;
|
||||
questitem->SetTimer(timer_name, seconds * 1000);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -475,10 +472,7 @@ void QuestManager::settimerMS(const char *timer_name, int milliseconds) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if(questitem) {
|
||||
auto timers = questitem->GetTimers();
|
||||
Timer t(milliseconds);
|
||||
t.Start(milliseconds, false);
|
||||
timers[timer_name] = t;
|
||||
questitem->SetTimer(timer_name, milliseconds);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -501,6 +495,11 @@ void QuestManager::settimerMS(const char *timer_name, int milliseconds) {
|
||||
void QuestManager::stoptimer(const char *timer_name) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if(questitem) {
|
||||
questitem->StopTimer(timer_name);
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end;
|
||||
|
||||
end = QTimerList.end();
|
||||
@ -518,6 +517,11 @@ void QuestManager::stoptimer(const char *timer_name) {
|
||||
void QuestManager::stopalltimers() {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if(questitem) {
|
||||
questitem->ClearTimers();
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<QuestTimer>::iterator cur = QTimerList.begin(), end, tmp;
|
||||
|
||||
end = QTimerList.end();
|
||||
|
||||
@ -574,7 +574,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
|
||||
quest_npc = true;
|
||||
}
|
||||
|
||||
std::vector<ItemInst*> item_list;
|
||||
std::vector<void*> item_list;
|
||||
uint32 items[4] = { 0 };
|
||||
for(int i = 3000; i < 3004; ++i) {
|
||||
ItemInst *inst = m_inv.GetItem(i);
|
||||
|
||||
@ -175,7 +175,6 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
|
||||
buf[9] = '\0';
|
||||
parse->EventPlayer(EVENT_ZONE, this, buf, 0);
|
||||
|
||||
|
||||
//handle circumvention of zone restrictions
|
||||
//we need the value when creating the outgoing packet as well.
|
||||
uint8 ignorerestrictions = zonesummon_ignorerestrictions;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user