mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-02 15:20:26 +00:00
Parser stuff, fix for GetSpawnKillCount + item_tick
This commit is contained in:
@@ -39,7 +39,6 @@ SET(zone_sources
|
||||
npc.cpp
|
||||
NpcAI.cpp
|
||||
Object.cpp
|
||||
parser.cpp
|
||||
pathing.cpp
|
||||
perl_client.cpp
|
||||
perl_doors.cpp
|
||||
@@ -122,7 +121,6 @@ SET(zone_headers
|
||||
npc.h
|
||||
NpcAI.h
|
||||
object.h
|
||||
parser.h
|
||||
pathing.h
|
||||
perlpacket.h
|
||||
perlparser.h
|
||||
|
||||
@@ -28,7 +28,6 @@ using namespace std;
|
||||
#include "NpcAI.h"
|
||||
#include "map.h"
|
||||
#include "../common/moremath.h"
|
||||
#include "parser.h"
|
||||
#include "StringIDs.h"
|
||||
#include "../common/MiscFunctions.h"
|
||||
#include "../common/rulesys.h"
|
||||
|
||||
@@ -10,12 +10,12 @@ class NPC;
|
||||
|
||||
class QuestInterface {
|
||||
public:
|
||||
virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { }
|
||||
virtual void EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { }
|
||||
virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { }
|
||||
virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { }
|
||||
virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { }
|
||||
virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { }
|
||||
virtual double EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { return 100.0; }
|
||||
virtual double EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { return 100.0; }
|
||||
virtual double EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { return 100.0; }
|
||||
virtual double EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) { return 100.0; }
|
||||
virtual double EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) { return 100.0; }
|
||||
virtual double EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) { return 100.0; }
|
||||
|
||||
virtual bool HasQuestSub(uint32 npcid, const char *subname) { return false; }
|
||||
virtual bool HasGlobalQuestSub(const char *subname) { return false; }
|
||||
|
||||
@@ -1470,5 +1470,4 @@ private:
|
||||
std::map<std::string,std::string> accountflags;
|
||||
};
|
||||
|
||||
#include "parser.h"
|
||||
#endif
|
||||
|
||||
+18
-483
@@ -29,6 +29,7 @@
|
||||
#include "QGlobals.h"
|
||||
#include "zone.h"
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
extern Zone* zone;
|
||||
|
||||
@@ -151,28 +152,34 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
}
|
||||
}
|
||||
|
||||
void PerlembParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {
|
||||
double PerlembParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {
|
||||
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, false);
|
||||
return 100.0;
|
||||
}
|
||||
|
||||
void PerlembParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {
|
||||
double PerlembParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {
|
||||
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, true);
|
||||
return 100.0;
|
||||
}
|
||||
|
||||
void PerlembParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
double PerlembParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, false);
|
||||
return 100.0;
|
||||
}
|
||||
|
||||
void PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
double PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
|
||||
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true);
|
||||
return 100.0;
|
||||
}
|
||||
|
||||
void PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) {
|
||||
double PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) {
|
||||
EventCommon(evt, objid, nullptr, nullptr, item, client, extra_data, false);
|
||||
return 100.0;
|
||||
}
|
||||
|
||||
void PerlembParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {
|
||||
double 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);
|
||||
return 100.0;
|
||||
}
|
||||
|
||||
bool PerlembParser::HasQuestSub(uint32 npcid, const char *subname) {
|
||||
@@ -199,484 +206,12 @@ bool PerlembParser::ItemHasQuestSub(ItemInst *itm, const char *subname) {
|
||||
return false;
|
||||
}
|
||||
|
||||
////int PerlembParser::LoadScript(int npcid, const char * zone, Mob* activater)
|
||||
////{
|
||||
//// if(!perl)
|
||||
//// {
|
||||
//// return(0);
|
||||
//// }
|
||||
////
|
||||
//// //we have already tried to load this quest...
|
||||
//// if(hasQuests.count(npcid) == 1)
|
||||
//// {
|
||||
//// return(1);
|
||||
//// }
|
||||
////
|
||||
//// string filename = "quests/", packagename = GetPkgPrefix(npcid);
|
||||
//// //each package name is of the form qstxxxx where xxxx = npcid (since numbers alone are not valid package names)
|
||||
//// questMode curmode = questDefault;
|
||||
//// FILE *tmpf;
|
||||
//// //LogFile->write(EQEMuLog::Debug, "LoadScript(%d, %s):\n", npcid, zone);
|
||||
//// if(!npcid || !zone)
|
||||
//// {
|
||||
//// //Load quests/default.pl
|
||||
//// filename += DEFAULT_QUEST_PREFIX;
|
||||
//// filename += ".pl";
|
||||
//// curmode = questDefault;
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// filename += zone;
|
||||
//// filename += "/";
|
||||
////#ifdef QUEST_SCRIPTS_BYNAME
|
||||
//// string bnfilename = filename;
|
||||
////#endif
|
||||
//// filename += itoa(npcid);
|
||||
//// filename += ".pl";
|
||||
//// curmode = questByID;
|
||||
////
|
||||
////#ifdef QUEST_SCRIPTS_BYNAME
|
||||
//// //assuming name limit stays 64 chars.
|
||||
//// char tmpname[64];
|
||||
//// int count0 = 0;
|
||||
//// bool filefound = false;
|
||||
//// tmpf = fopen(filename.c_str(), "r");
|
||||
//// if(tmpf != NULL)
|
||||
//// {
|
||||
//// fclose(tmpf);
|
||||
//// filefound = true;
|
||||
//// }
|
||||
//// //LogFile->write(EQEMuLog::Debug, " tried '%s': %d", filename.c_str(), filefound);
|
||||
////
|
||||
//// tmpname[0] = 0;
|
||||
//// //if there is no file for the NPC's ID, try for the NPC's name
|
||||
//// if(!filefound)
|
||||
//// {
|
||||
//// //revert to just path
|
||||
//// filename = bnfilename;
|
||||
//// const NPCType *npct = database.GetNPCType(npcid);
|
||||
//// if(npct == NULL)
|
||||
//// {
|
||||
//// //LogFile->write(EQEMuLog::Debug, " no npc type");
|
||||
//// //revert and go on with life
|
||||
//// filename += itoa(npcid);
|
||||
//// filename += ".pl";
|
||||
//// curmode = questByID;
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// //trace out the ` characters, turn into -
|
||||
//// int nlen = strlen(npct->name);
|
||||
//// //just to make sure
|
||||
//// if(nlen < 64)
|
||||
//// {
|
||||
//// int r;
|
||||
//// //this should get our NULL as well..
|
||||
//// for(r = 0; r <= nlen; r++)
|
||||
//// {
|
||||
//// tmpname[r] = npct->name[r];
|
||||
////
|
||||
//// //watch for 00 delimiter
|
||||
//// if(tmpname[r] == '0')
|
||||
//// {
|
||||
//// count0++;
|
||||
//// //second '0'
|
||||
//// if(count0 > 1)
|
||||
//// {
|
||||
//// //stop before previous 0
|
||||
//// tmpname[r-1] = '\0';
|
||||
//// break;
|
||||
//// }
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// count0 = 0;
|
||||
//// }
|
||||
////
|
||||
//// //rewrite ` to be more file name friendly
|
||||
//// if(tmpname[r] == '`')
|
||||
//// {
|
||||
//// tmpname[r] = '-';
|
||||
//// }
|
||||
////
|
||||
//// }
|
||||
//// filename += tmpname;
|
||||
//// filename += ".pl";
|
||||
//// curmode = questByName;
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// //LogFile->write(EQEMuLog::Debug, " namelen too long");
|
||||
//// //revert and go on with life, again
|
||||
//// filename += itoa(npcid);
|
||||
//// filename += ".pl";
|
||||
//// curmode = questByID;
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
////#ifdef QUEST_TEMPLATES_BYNAME
|
||||
////
|
||||
//// tmpf = fopen(filename.c_str(), "r");
|
||||
//// if(tmpf != NULL)
|
||||
//// {
|
||||
//// fclose(tmpf);
|
||||
//// filefound = true;
|
||||
//// }
|
||||
////
|
||||
////
|
||||
//// //LogFile->write(EQEMuLog::Debug, " tried '%s': %d", filename.c_str(), filefound2);
|
||||
////
|
||||
//// //if there is no file for the NPC's ID or name,
|
||||
//// //try for the NPC's name in the templates directory
|
||||
//// //only works if we have gotten the NPC's name above
|
||||
//// if(!filefound)
|
||||
//// {
|
||||
//// if(tmpname[0] != 0)
|
||||
//// {
|
||||
//// //revert to just path
|
||||
//// filename = "quests/";
|
||||
//// filename += QUEST_TEMPLATES_DIRECTORY;
|
||||
//// filename += "/";
|
||||
//// filename += tmpname;
|
||||
//// filename += ".pl";
|
||||
//// curmode = questTemplate;
|
||||
//// //LogFile->write(EQEMuLog::Debug, " template '%s'", filename.c_str(), filefound2);
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// //LogFile->write(EQEMuLog::Debug, " no template name");
|
||||
//// filename = "quests/";
|
||||
//// filename += QUEST_TEMPLATES_DIRECTORY;
|
||||
//// filename += "/";
|
||||
//// filename += itoa(npcid);
|
||||
//// filename += ".pl";
|
||||
//// curmode = questTemplateByID;
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
////#endif //QUEST_TEMPLATES_BYNAME
|
||||
////
|
||||
////#endif //QUEST_SCRIPTS_BYNAME
|
||||
////
|
||||
//// tmpf = fopen(filename.c_str(), "r");
|
||||
//// if(tmpf != NULL)
|
||||
//// {
|
||||
//// fclose(tmpf);
|
||||
//// filefound = true;
|
||||
//// }
|
||||
////
|
||||
//// // If by ID, Name or Template wasn't found, load /quests/zone/default.pl
|
||||
//// if(!filefound)
|
||||
//// {
|
||||
//// //Load Default Quests Per Zone quests/zonename/default.pl
|
||||
//// filename = bnfilename;
|
||||
//// filename += "default.pl";
|
||||
//// curmode = questDefaultByZone;
|
||||
//// //LogFile->write(EQEMuLog::Debug, "LoadScript(%s)", filename.c_str());
|
||||
//// }
|
||||
////
|
||||
//// tmpf = fopen(filename.c_str(), "r");
|
||||
//// if(tmpf != NULL)
|
||||
//// {
|
||||
//// fclose(tmpf);
|
||||
//// filefound = true;
|
||||
//// }
|
||||
////
|
||||
//// // If zone template isn't found look for it globally /quests/template/default.pl
|
||||
//// if(!filefound)
|
||||
//// {
|
||||
//// //Load Default Quests Globally
|
||||
//// //filename = bnfilename;
|
||||
//// filename = "quests/";
|
||||
//// filename += QUEST_TEMPLATES_DIRECTORY;
|
||||
//// filename += "/";
|
||||
//// filename += "default.pl";
|
||||
//// curmode = questDefaultByZone;
|
||||
//// //LogFile->write(EQEMuLog::Debug, "LoadScript(%s)", filename.c_str());
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// //check for existance of quest file before trying to make perl load it.
|
||||
//// tmpf = fopen(filename.c_str(), "r");
|
||||
//// if(tmpf == NULL)
|
||||
//// {
|
||||
//// //the npc has no qst file, attach the defaults
|
||||
//// std::string setdefcmd = "$";
|
||||
//// setdefcmd += packagename;
|
||||
//// setdefcmd += "::isdefault = 1;";
|
||||
//// perl->eval(setdefcmd.c_str());
|
||||
//// setdefcmd = "$";
|
||||
//// setdefcmd += packagename;
|
||||
//// setdefcmd += "::isloaded = 1;";
|
||||
//// perl->eval(setdefcmd.c_str());
|
||||
//// hasQuests[npcid] = questDefault;
|
||||
//// return(1);
|
||||
//// }
|
||||
//// else
|
||||
//// {
|
||||
//// fclose(tmpf);
|
||||
//// }
|
||||
////
|
||||
//// //LogFile->write(EQEMuLog::Debug, " finally settling on '%s'", filename.c_str());
|
||||
//// // LogFile->write(EQEMuLog::Status, "Looking for quest file: '%s'", filename.c_str());
|
||||
////
|
||||
//// // todo: decide whether or not to delete the package to allow for script refreshes w/o restarting the server
|
||||
//// // remember to guard against deleting the default package, on a similar note... consider deleting packages upon zone change
|
||||
//// // try { perl->eval(std::string("delete_package(\"").append(packagename).append("\");").c_str()); }
|
||||
//// // catch(...) {/*perl balked at us trynig to delete a non-existant package... no big deal.*/}
|
||||
////
|
||||
//// try {
|
||||
//// perl->eval_file(packagename.c_str(), filename.c_str());
|
||||
//// }
|
||||
//// catch(const char * err)
|
||||
//// {
|
||||
//// //try to reduce some of the console spam...
|
||||
//// //todo: tweak this to be more accurate at deciding what to filter (we don't want to gag legit errors)
|
||||
//// //if(!strstr(err,"No such file or directory"))
|
||||
//// LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s (reverting to default questfile)", filename.c_str(), err);
|
||||
//// }
|
||||
//// //todo: change this to just read eval_file's %cache - duh!
|
||||
//// if(!isloaded(packagename.c_str()))
|
||||
//// {
|
||||
//// //the npc has no qst file, attach the defaults
|
||||
//// std::string setdefcmd = "$";
|
||||
//// setdefcmd += packagename;
|
||||
//// setdefcmd += "::isdefault = 1;";
|
||||
//// perl->eval(setdefcmd.c_str());
|
||||
//// setdefcmd = "$";
|
||||
//// setdefcmd += packagename;
|
||||
//// setdefcmd += "::isloaded = 1;";
|
||||
//// perl->eval(setdefcmd.c_str());
|
||||
//// curmode = questDefault;
|
||||
//// }
|
||||
////
|
||||
//// hasQuests[npcid] = curmode;
|
||||
//// return(1);
|
||||
////}
|
||||
////
|
||||
////int PerlembParser::LoadGlobalNPCScript()
|
||||
////{
|
||||
//// if(!perl)
|
||||
//// return 0;
|
||||
////
|
||||
//// if(perl->InUse())
|
||||
//// {
|
||||
//// return 0;
|
||||
//// }
|
||||
////
|
||||
//// if(globalNPCQuestLoaded != nQuestReadyToLoad) {
|
||||
//// return 1;
|
||||
//// }
|
||||
////
|
||||
//// string filename = "quests/";
|
||||
//// filename += QUEST_TEMPLATES_DIRECTORY;
|
||||
//// filename += "/global_npc.pl";
|
||||
//// string packagename = "global_npc";
|
||||
////
|
||||
//// try {
|
||||
//// perl->eval_file(packagename.c_str(), filename.c_str());
|
||||
//// }
|
||||
//// catch(const char * err)
|
||||
//// {
|
||||
//// LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err);
|
||||
//// }
|
||||
////
|
||||
//// globalNPCQuestLoaded = nQuestLoaded;
|
||||
////
|
||||
//// return 1;
|
||||
////}
|
||||
////
|
||||
////int PerlembParser::LoadPlayerScript(const char *zone_name)
|
||||
////{
|
||||
//// if(!perl)
|
||||
//// return 0;
|
||||
////
|
||||
//// if(perl->InUse())
|
||||
//// {
|
||||
//// return 0;
|
||||
//// }
|
||||
////
|
||||
//// if(playerQuestLoaded.count(zone_name) == 1) {
|
||||
//// return 1;
|
||||
//// }
|
||||
////
|
||||
//// string filename= "quests/";
|
||||
//// filename += zone_name;
|
||||
//// filename += "/player_v";
|
||||
//// filename += itoa(zone->GetInstanceVersion());
|
||||
//// filename += ".pl";
|
||||
//// string packagename = "player";
|
||||
//// packagename += "_";
|
||||
//// packagename += zone_name;
|
||||
////
|
||||
//// try {
|
||||
//// perl->eval_file(packagename.c_str(), filename.c_str());
|
||||
//// }
|
||||
//// catch(const char * err)
|
||||
//// {
|
||||
//// LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err);
|
||||
//// }
|
||||
////
|
||||
//// if(!isloaded(packagename.c_str()))
|
||||
//// {
|
||||
//// filename= "quests/";
|
||||
//// filename += zone_name;
|
||||
//// filename += "/player.pl";
|
||||
//// try {
|
||||
//// perl->eval_file(packagename.c_str(), filename.c_str());
|
||||
//// }
|
||||
//// catch(const char * err)
|
||||
//// {
|
||||
//// LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err);
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// //todo: change this to just read eval_file's %cache - duh!
|
||||
//// if(!isloaded(packagename.c_str()))
|
||||
//// {
|
||||
//// filename = "quests/";
|
||||
//// filename += QUEST_TEMPLATES_DIRECTORY;
|
||||
//// filename += "/player.pl";
|
||||
//// try {
|
||||
//// perl->eval_file(packagename.c_str(), filename.c_str());
|
||||
//// }
|
||||
//// catch(const char * err)
|
||||
//// {
|
||||
//// LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err);
|
||||
//// }
|
||||
//// if(!isloaded(packagename.c_str()))
|
||||
//// {
|
||||
//// playerQuestLoaded[zone_name] = pQuestUnloaded;
|
||||
//// return 0;
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// if(perl->SubExists(packagename.c_str(), "EVENT_CAST"))
|
||||
//// playerQuestLoaded[zone_name] = pQuestEventCast;
|
||||
//// else
|
||||
//// playerQuestLoaded[zone_name] = pQuestLoaded;
|
||||
//// return 1;
|
||||
////}
|
||||
////
|
||||
////int PerlembParser::LoadGlobalPlayerScript()
|
||||
////{
|
||||
//// if(!perl)
|
||||
//// return 0;
|
||||
////
|
||||
//// if(perl->InUse())
|
||||
//// {
|
||||
//// return 0;
|
||||
//// }
|
||||
////
|
||||
//// if(globalPlayerQuestLoaded != pQuestReadyToLoad) {
|
||||
//// return 1;
|
||||
//// }
|
||||
////
|
||||
//// string filename = "quests/";
|
||||
//// filename += QUEST_TEMPLATES_DIRECTORY;
|
||||
//// filename += "/global_player.pl";
|
||||
//// string packagename = "global_player";
|
||||
////
|
||||
//// try {
|
||||
//// perl->eval_file(packagename.c_str(), filename.c_str());
|
||||
//// }
|
||||
//// catch(const char * err)
|
||||
//// {
|
||||
//// LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err);
|
||||
//// }
|
||||
////
|
||||
//// if(perl->SubExists(packagename.c_str(), "EVENT_CAST"))
|
||||
//// globalPlayerQuestLoaded = pQuestEventCast;
|
||||
//// else
|
||||
//// globalPlayerQuestLoaded = pQuestLoaded;
|
||||
//// return 1;
|
||||
////}
|
||||
////
|
||||
////int PerlembParser::LoadItemScript(ItemInst* iteminst, string packagename, itemQuestMode Qtype) {
|
||||
//// if(!perl)
|
||||
//// return 0;
|
||||
////
|
||||
//// if(perl->InUse())
|
||||
//// {
|
||||
//// return 0;
|
||||
//// }
|
||||
////
|
||||
//// // if we've already tried to load it, don't try again
|
||||
//// if(itemQuestLoaded.count(packagename) == 1)
|
||||
//// return 1;
|
||||
////
|
||||
//// string filename = "quests/items/";
|
||||
//// if(Qtype == itemQuestScale)
|
||||
//// filename += packagename;
|
||||
//// else if(Qtype == itemQuestLore) {
|
||||
//// filename += "lore_";
|
||||
//// filename += itoa(iteminst->GetItem()->LoreGroup);
|
||||
//// }
|
||||
//// else if(Qtype == itemScriptFileID) {
|
||||
//// filename += "script_";
|
||||
//// filename += itoa(iteminst->GetItemScriptID());
|
||||
//// }
|
||||
//// else
|
||||
//// filename += itoa(iteminst->GetID());
|
||||
//// filename += ".pl";
|
||||
//// printf("Loading file %s\n",filename.c_str());
|
||||
////
|
||||
//// try {
|
||||
//// perl->eval_file(packagename.c_str(), filename.c_str());
|
||||
//// }
|
||||
//// catch(const char* err) {
|
||||
//// LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err);
|
||||
//// }
|
||||
////
|
||||
//// if(!isloaded(packagename.c_str())) {
|
||||
//// itemQuestLoaded[packagename] = Qtype;
|
||||
//// return 0;
|
||||
//// }
|
||||
////
|
||||
//// itemQuestLoaded[packagename] = itemQuestUnloaded;
|
||||
//// return 1;
|
||||
////}
|
||||
////
|
||||
////int PerlembParser::LoadSpellScript(uint32 id)
|
||||
////{
|
||||
//// if(!perl)
|
||||
//// return 0;
|
||||
////
|
||||
//// if(perl->InUse())
|
||||
//// {
|
||||
//// return 0;
|
||||
//// }
|
||||
////
|
||||
//// // if we've already tried to load it, don't try again
|
||||
//// if(spellQuestLoaded.count(id) == 1)
|
||||
//// return 1;
|
||||
////
|
||||
//// string filename = "quests/spells/";
|
||||
//// string packagename = "spell_effect_";
|
||||
//// filename += itoa(id);
|
||||
//// packagename += itoa(id);
|
||||
//// filename += ".pl";
|
||||
//// printf("Loading file %s\n", filename.c_str());
|
||||
////
|
||||
//// try {
|
||||
//// perl->eval_file(packagename.c_str(), filename.c_str());
|
||||
//// }
|
||||
//// catch(const char* err) {
|
||||
//// LogFile->write(EQEMuLog::Quest, "WARNING: error compiling quest file %s: %s", filename.c_str(), err);
|
||||
//// }
|
||||
////
|
||||
//// if(!isloaded(packagename.c_str())) {
|
||||
//// spellQuestLoaded[id] = spellQuestFailed;
|
||||
//// return 0;
|
||||
//// }
|
||||
////
|
||||
//// spellQuestLoaded[id] = spellQuestFullyLoaded;
|
||||
//// return 1;
|
||||
////}
|
||||
|
||||
void PerlembParser::LoadNPCScript(std::string filename, int npc_id) {
|
||||
printf("Load NPC %d = %s\n", npc_id, filename.c_str());
|
||||
std::stringstream package_name;
|
||||
package_name << "qst_" << npc_id;
|
||||
|
||||
printf("%s = %s\n", package_name.str().c_str(), filename.c_str());
|
||||
|
||||
}
|
||||
|
||||
void PerlembParser::LoadGlobalNPCScript(std::string filename) {
|
||||
|
||||
+18
-6
@@ -20,16 +20,27 @@ typedef enum
|
||||
} PerlQuestStatus;
|
||||
|
||||
class PerlembParser : public QuestInterface {
|
||||
typedef struct {
|
||||
QuestEventID event;
|
||||
uint32 objid;
|
||||
const char *data;
|
||||
NPC* npcmob;
|
||||
ItemInst* iteminst;
|
||||
Mob* mob;
|
||||
uint32 extradata;
|
||||
bool global;
|
||||
} EventRecord;
|
||||
|
||||
public:
|
||||
PerlembParser();
|
||||
~PerlembParser();
|
||||
|
||||
virtual void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
|
||||
virtual void EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
|
||||
virtual void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
virtual void EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
virtual void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data);
|
||||
virtual void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
|
||||
virtual double EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
|
||||
virtual double EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
|
||||
virtual double EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
virtual double EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
virtual double EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data);
|
||||
virtual double EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
|
||||
|
||||
virtual bool HasQuestSub(uint32 npcid, const char *subname);
|
||||
virtual bool HasGlobalQuestSub(const char *subname);
|
||||
@@ -70,6 +81,7 @@ private:
|
||||
PerlQuestStatus global_player_quest_status_;
|
||||
std::map<std::string, PerlQuestStatus> item_quest_status_;
|
||||
std::map<uint32, PerlQuestStatus> spell_quest_status_;
|
||||
std::queue<EventRecord> event_queue_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,7 +42,6 @@ using namespace std;
|
||||
#include "../common/spdat.h"
|
||||
#include "../common/features.h"
|
||||
#include "StringIDs.h"
|
||||
#include "parser.h"
|
||||
#include "../common/dbasync.h"
|
||||
#include "guild_mgr.h"
|
||||
#include "raids.h"
|
||||
|
||||
@@ -71,7 +71,6 @@ using namespace std;
|
||||
#include "../common/MiscFunctions.h"
|
||||
#include "spawn2.h"
|
||||
#include "zone.h"
|
||||
#include "parser.h"
|
||||
#include "event_codes.h"
|
||||
#include "guild_mgr.h"
|
||||
#include "../common/rulesys.h"
|
||||
|
||||
@@ -29,7 +29,6 @@ using namespace std;
|
||||
#include "map.h"
|
||||
#include "watermap.h"
|
||||
#include "../common/moremath.h"
|
||||
#include "parser.h"
|
||||
#include "StringIDs.h"
|
||||
#include "../common/MiscFunctions.h"
|
||||
#include "../common/rulesys.h"
|
||||
|
||||
+3
-16
@@ -54,7 +54,6 @@ using namespace std;
|
||||
#include "object.h"
|
||||
#include "petitions.h"
|
||||
#include "pathing.h"
|
||||
#include "parser.h"
|
||||
#include "event_codes.h"
|
||||
#include "client_logs.h"
|
||||
#include "../common/rulesys.h"
|
||||
@@ -2676,23 +2675,15 @@ void Zone::LoadTickItems()
|
||||
char* query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
#if _MSC_VER==1600
|
||||
item_tick_struct ti_tmp;
|
||||
#endif
|
||||
tick_items.clear();
|
||||
//tick_globals.clear();
|
||||
|
||||
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"), errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
if(atoi(row[0]) < 1)
|
||||
{
|
||||
//tick_globals[std::string(row[0])] = { 0, atoi(row[1]), atoi(row[2]), (int16)atoi(row[4]), std::string(row[3]) };
|
||||
}
|
||||
else
|
||||
#if _MSC_VER==1600
|
||||
if(atoi(row[0]) >= 1)
|
||||
{
|
||||
item_tick_struct ti_tmp;
|
||||
ti_tmp.itemid = atoi(row[0]);
|
||||
ti_tmp.chance = atoi(row[1]);
|
||||
ti_tmp.level = atoi(row[2]);
|
||||
@@ -2700,11 +2691,6 @@ void Zone::LoadTickItems()
|
||||
ti_tmp.qglobal = std::string(row[3]);
|
||||
tick_items[atoi(row[0])] = ti_tmp;
|
||||
}
|
||||
#else
|
||||
{
|
||||
tick_items[atoi(row[0])] = { atoi(row[0]), atoi(row[1]), atoi(row[2]), (int16)atoi(row[4]), std::string(row[3]) };
|
||||
}
|
||||
#endif
|
||||
}
|
||||
mysql_free_result(result);
|
||||
safe_delete_array(query);
|
||||
@@ -2728,6 +2714,7 @@ uint32 Zone::GetSpawnKillCount(uint32 in_spawnid) {
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Zone::UpdateHotzone()
|
||||
|
||||
Reference in New Issue
Block a user