mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 19:51:29 +00:00
Cleanup perl parsers
This commit is contained in:
parent
0e4ac63b6b
commit
43d0350870
@ -17,6 +17,7 @@ SET(zone_sources
|
||||
doors.cpp
|
||||
effects.cpp
|
||||
embparser.cpp
|
||||
embparser_api.cpp
|
||||
embperl.cpp
|
||||
embxs.cpp
|
||||
entity.cpp
|
||||
@ -53,7 +54,6 @@ SET(zone_sources
|
||||
perl_questitem.cpp
|
||||
perl_raids.cpp
|
||||
perlpacket.cpp
|
||||
perlparser.cpp
|
||||
petitions.cpp
|
||||
pets.cpp
|
||||
PlayerCorpse.cpp
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _EQE_QUESTINTERFACE_H
|
||||
#define _EQE_QUESTINTERFACE_H
|
||||
|
||||
@ -10,19 +28,19 @@ class NPC;
|
||||
|
||||
class QuestInterface {
|
||||
public:
|
||||
virtual double EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) { return 100.0; }
|
||||
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 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; }
|
||||
virtual bool PlayerHasQuestSub(const char *subname) { return false; }
|
||||
virtual bool GlobalPlayerHasQuestSub(const char *subname) { return false; }
|
||||
virtual bool GlobalPlayerHasQuestSub(const char *subname) { return false; }
|
||||
virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname) { return false; }
|
||||
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname) { return false; }
|
||||
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname) { return false; }
|
||||
|
||||
virtual void LoadNPCScript(std::string filename, int npc_id) { }
|
||||
virtual void LoadGlobalNPCScript(std::string filename) { }
|
||||
@ -31,10 +49,10 @@ public:
|
||||
virtual void LoadItemScript(std::string filename, std::string item_script) { }
|
||||
virtual void LoadSpellScript(std::string filename, uint32 spell_id) { }
|
||||
|
||||
virtual void AddVar(std::string name, std::string val) { }
|
||||
virtual void AddVar(std::string name, std::string val) { }
|
||||
virtual std::string GetVar(std::string name) { return std::string(); }
|
||||
virtual void ReloadQuests() { }
|
||||
virtual uint32 GetIdentifier() = 0;
|
||||
virtual void ReloadQuests() { }
|
||||
virtual uint32 GetIdentifier() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,38 +1,57 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _EQE_QUESTPARSERCOLLECTION_H
|
||||
#define _EQE_QUESTPARSERCOLLECTION_H
|
||||
|
||||
#include "../common/types.h"
|
||||
#include "../common/Item.h"
|
||||
|
||||
#include "masterentity.h"
|
||||
#include "QuestInterface.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include "masterentity.h"
|
||||
#include "../common/Item.h"
|
||||
#include "QuestInterface.h"
|
||||
|
||||
#define QuestFailedToLoad 0xFFFFFFFF
|
||||
#define QuestUnloaded 0x00
|
||||
|
||||
class QuestParserCollection {
|
||||
public:
|
||||
QuestParserCollection();
|
||||
~QuestParserCollection();
|
||||
QuestParserCollection();
|
||||
~QuestParserCollection();
|
||||
|
||||
void RegisterQuestInterface(QuestInterface *qi, std::string ext);
|
||||
void RegisterQuestInterface(QuestInterface *qi, std::string ext);
|
||||
|
||||
void AddVar(std::string name, std::string val);
|
||||
void ReloadQuests(bool reset_timers = true);
|
||||
void AddVar(std::string name, std::string val);
|
||||
void ReloadQuests(bool reset_timers = true);
|
||||
|
||||
bool HasQuestSub(uint32 npcid, const char *subname);
|
||||
bool HasQuestSub(uint32 npcid, const char *subname);
|
||||
bool PlayerHasQuestSub(const char *subname);
|
||||
bool SpellHasQuestSub(uint32 spell_id, const char *subname);
|
||||
bool ItemHasQuestSub(ItemInst *itm, const char *subname);
|
||||
bool ItemHasQuestSub(ItemInst *itm, const char *subname);
|
||||
|
||||
void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
|
||||
void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data);
|
||||
void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
|
||||
void EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data);
|
||||
void EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
void EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data);
|
||||
void EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data);
|
||||
|
||||
private:
|
||||
bool HasQuestSubLocal(uint32 npcid, const char *subname);
|
||||
@ -45,25 +64,25 @@ private:
|
||||
void EventPlayerLocal(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
void EventPlayerGlobal(QuestEventID evt, Client *client, std::string data, uint32 extra_data);
|
||||
|
||||
QuestInterface *GetQIByNPCQuest(uint32 npcid, std::string &filename);
|
||||
QuestInterface *GetQIByGlobalNPCQuest(std::string &filename);
|
||||
QuestInterface *GetQIByPlayerQuest(std::string &filename);
|
||||
QuestInterface *GetQIByGlobalPlayerQuest(std::string &filename);
|
||||
QuestInterface *GetQIBySpellQuest(uint32 spell_id, std::string &filename);
|
||||
QuestInterface *GetQIByItemQuest(std::string item_script, std::string &filename);
|
||||
QuestInterface *GetQIByNPCQuest(uint32 npcid, std::string &filename);
|
||||
QuestInterface *GetQIByGlobalNPCQuest(std::string &filename);
|
||||
QuestInterface *GetQIByPlayerQuest(std::string &filename);
|
||||
QuestInterface *GetQIByGlobalPlayerQuest(std::string &filename);
|
||||
QuestInterface *GetQIBySpellQuest(uint32 spell_id, std::string &filename);
|
||||
QuestInterface *GetQIByItemQuest(std::string item_script, std::string &filename);
|
||||
|
||||
std::map<uint32, QuestInterface*> _interfaces;
|
||||
std::map<uint32, std::string> _extensions;
|
||||
std::list<QuestInterface*> _load_precedence;
|
||||
std::map<uint32, QuestInterface*> _interfaces;
|
||||
std::map<uint32, std::string> _extensions;
|
||||
std::list<QuestInterface*> _load_precedence;
|
||||
|
||||
//0x00 = Unloaded
|
||||
//0xFFFFFFFF = Failed to Load
|
||||
std::map<uint32, uint32> _npc_quest_status;
|
||||
//0x00 = Unloaded
|
||||
//0xFFFFFFFF = Failed to Load
|
||||
std::map<uint32, uint32> _npc_quest_status;
|
||||
uint32 _global_npc_quest_status;
|
||||
uint32 _player_quest_status;
|
||||
uint32 _global_player_quest_status;
|
||||
std::map<uint32, uint32> _spell_quest_status;
|
||||
std::map<std::string, uint32> _item_quest_status;
|
||||
uint32 _player_quest_status;
|
||||
uint32 _global_player_quest_status;
|
||||
std::map<uint32, uint32> _spell_quest_status;
|
||||
std::map<std::string, uint32> _item_quest_status;
|
||||
};
|
||||
|
||||
extern QuestParserCollection *parse;
|
||||
|
||||
@ -1,31 +1,30 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net)
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef EMBPERL
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "../common/seperator.h"
|
||||
#include "../common/MiscFunctions.h"
|
||||
#include "../common/features.h"
|
||||
#include "masterentity.h"
|
||||
#include "embparser.h"
|
||||
#include "questmgr.h"
|
||||
#include "command.h"
|
||||
#include "../common/seperator.h"
|
||||
#include "../common/MiscFunctions.h"
|
||||
#include "QGlobals.h"
|
||||
#include "zone.h"
|
||||
#include <algorithm>
|
||||
@ -184,11 +183,11 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
|
||||
}
|
||||
else if(isSpellQuest)
|
||||
{
|
||||
if(mob) {
|
||||
SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr);
|
||||
} else {
|
||||
SendCommands(package_name.c_str(), sub_name, 0, npcmob, mob, nullptr);
|
||||
}
|
||||
if(mob) {
|
||||
SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr);
|
||||
} else {
|
||||
SendCommands(package_name.c_str(), sub_name, 0, npcmob, mob, nullptr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SendCommands(package_name.c_str(), sub_name, objid, npcmob, mob, nullptr);
|
||||
@ -645,7 +644,7 @@ void PerlembParser::SendCommands(const char *pkgprefix, const char *event, uint3
|
||||
perl->dosub(std::string(pkgprefix).append("::").append(event).c_str());
|
||||
|
||||
#ifdef EMBPERL_XS_CLASSES
|
||||
std::string eval_str = (std::string)"$" + (std::string)pkgprefix + (std::string)"::client = undef;";
|
||||
std::string eval_str = (std::string)"$" + (std::string)pkgprefix + (std::string)"::client = undef;";
|
||||
eval_str += (std::string)"$" + (std::string)pkgprefix + (std::string)"::npc = undef;";
|
||||
eval_str += (std::string)"$" + (std::string)pkgprefix + (std::string)"::questitem = undef;";
|
||||
eval_str += (std::string)"$" + (std::string)pkgprefix + (std::string)"::entity_list = undef;";
|
||||
@ -765,12 +764,12 @@ void PerlembParser::GetQuestTypes(bool &isPlayerQuest, bool &isGlobalPlayerQuest
|
||||
{
|
||||
if(!npcmob && mob) {
|
||||
if(!iteminst) {
|
||||
if(global) {
|
||||
isGlobalPlayerQuest = true;
|
||||
} else {
|
||||
isPlayerQuest = true;
|
||||
}
|
||||
}
|
||||
if(global) {
|
||||
isGlobalPlayerQuest = true;
|
||||
} else {
|
||||
isPlayerQuest = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
isItemQuest = true;
|
||||
}
|
||||
@ -811,7 +810,7 @@ void PerlembParser::GetQuestPackageName(bool &isPlayerQuest, bool &isGlobalPlaye
|
||||
}
|
||||
else if(isGlobalPlayerQuest) {
|
||||
package_name = "qst_global_player";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
package_name = "qst_spell_";
|
||||
@ -1221,7 +1220,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
|
||||
}
|
||||
|
||||
case EVENT_SCALE_CALC:
|
||||
case EVENT_ITEM_ENTERZONE: {
|
||||
case EVENT_ITEM_ENTERZONE: {
|
||||
ExportVar(package_name.c_str(), "itemid", objid);
|
||||
ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name);
|
||||
break;
|
||||
|
||||
210
zone/embparser.h
210
zone/embparser.h
@ -1,17 +1,37 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_EMBPARSER_H
|
||||
#define EQMEU_EMBPARSER_H
|
||||
#ifdef EMBPERL
|
||||
|
||||
|
||||
#include "client.h"
|
||||
#include "../common/features.h"
|
||||
#include "QuestParserCollection.h"
|
||||
#include "QuestInterface.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <map>
|
||||
#include "embperl.h"
|
||||
|
||||
class ItemInst;
|
||||
class Mob;
|
||||
class Client;
|
||||
class NPC;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
questUnloaded,
|
||||
@ -37,17 +57,17 @@ public:
|
||||
|
||||
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 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);
|
||||
virtual bool PlayerHasQuestSub(const char *subname);
|
||||
virtual bool GlobalPlayerHasQuestSub(const char *subname);
|
||||
virtual bool GlobalPlayerHasQuestSub(const char *subname);
|
||||
virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname);
|
||||
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname);
|
||||
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname);
|
||||
|
||||
virtual void LoadNPCScript(std::string filename, int npc_id);
|
||||
virtual void LoadGlobalNPCScript(std::string filename);
|
||||
@ -56,10 +76,10 @@ public:
|
||||
virtual void LoadItemScript(std::string filename, std::string item_script);
|
||||
virtual void LoadSpellScript(std::string filename, uint32 spell_id);
|
||||
|
||||
virtual void AddVar(std::string name, std::string val);
|
||||
virtual void AddVar(std::string name, std::string val);
|
||||
virtual std::string GetVar(std::string name);
|
||||
virtual void ReloadQuests();
|
||||
virtual uint32 GetIdentifier() { return 0xf8b05c11; }
|
||||
virtual void ReloadQuests();
|
||||
virtual uint32 GetIdentifier() { return 0xf8b05c11; }
|
||||
private:
|
||||
Embperl *perl;
|
||||
|
||||
@ -111,167 +131,3 @@ private:
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////extends the parser to include perl
|
||||
////Eglin
|
||||
//
|
||||
//#ifndef EMBPARSER_H
|
||||
//#define EMBPARSER_H
|
||||
//
|
||||
//#ifdef EMBPERL
|
||||
//
|
||||
//#include "client.h"
|
||||
//#include "parser.h"
|
||||
//#include "embperl.h"
|
||||
//#include "../common/features.h"
|
||||
//#include "QuestParserCollection.h"
|
||||
//#include "QuestInterface.h"
|
||||
//
|
||||
//#include <string>
|
||||
//#include <map>
|
||||
//#include <queue>
|
||||
//using namespace std;
|
||||
//
|
||||
//class Seperator;
|
||||
//
|
||||
//typedef enum {
|
||||
// questDefault = 1,
|
||||
// questDefaultByZone,
|
||||
// questByName,
|
||||
// questTemplate,
|
||||
// questTemplateByID,
|
||||
// questByID
|
||||
//} questMode;
|
||||
//
|
||||
//typedef enum {
|
||||
// itemQuestUnloaded = 1,
|
||||
// itemQuestScale,
|
||||
// itemQuestLore,
|
||||
// itemQuestID,
|
||||
// itemScriptFileID
|
||||
//} itemQuestMode;
|
||||
//
|
||||
//typedef enum {
|
||||
// pQuestLoaded = 1,
|
||||
// pQuestUnloaded,
|
||||
// pQuestEventCast, // player.pl loaded, has an EVENT_CAST sub
|
||||
// pQuestReadyToLoad
|
||||
//} playerQuestMode;
|
||||
//
|
||||
//typedef enum {
|
||||
// nQuestLoaded = 1,
|
||||
// nQuestUnloaded,
|
||||
// nQuestReadyToLoad
|
||||
//} GlobalNPCQuestMode;
|
||||
//
|
||||
//typedef enum {
|
||||
// spellQuestUnloaded = 1,
|
||||
// spellQuestFullyLoaded,
|
||||
// spellQuestFailed
|
||||
//} spellQuestMode;
|
||||
//
|
||||
//
|
||||
//struct EventRecord {
|
||||
// QuestEventID event;
|
||||
// uint32 objid;
|
||||
// string data;
|
||||
// NPC* npcmob;
|
||||
// ItemInst* iteminst;
|
||||
// Mob* mob;
|
||||
// uint32 extradata;
|
||||
// bool global;
|
||||
//};
|
||||
//
|
||||
//class PerlembParser : public Parser
|
||||
//{
|
||||
//protected:
|
||||
//
|
||||
// //could prolly get rid of this map now, since I check for the
|
||||
// //actual subroutine in the quest package as opposed to just seeing
|
||||
// //if they do not have a quest or the default.
|
||||
// map<uint32, questMode> hasQuests; //npcid -> questMode
|
||||
// map<std::string, playerQuestMode> playerQuestLoaded; //zone shortname -> playerQuestMode
|
||||
// playerQuestMode globalPlayerQuestLoaded;
|
||||
// GlobalNPCQuestMode globalNPCQuestLoaded;
|
||||
// map<std::string, itemQuestMode> itemQuestLoaded; // package name - > itemQuestMode
|
||||
// map<uint32, spellQuestMode> spellQuestLoaded;
|
||||
//
|
||||
// queue<EventRecord> eventQueue; //for events that happen when perl is in use.
|
||||
// bool eventQueueProcessing;
|
||||
//
|
||||
// void HandleQueue();
|
||||
//
|
||||
// void EventCommon(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob, uint32 extradata, bool global = false);
|
||||
//
|
||||
// Embperl * perl;
|
||||
// //export a symbol table of sorts
|
||||
// virtual void map_funs();
|
||||
//public:
|
||||
// PerlembParser(void);
|
||||
// ~PerlembParser();
|
||||
// Embperl * getperl(void) { return perl; };
|
||||
// //todo, consider making the following two methods static (need to check for perl!=null, first, then)
|
||||
// bool isloaded(const char *packagename) const;
|
||||
//
|
||||
// //interface stuff
|
||||
// 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 bool HasQuestSub(uint32 npcid, const char *subname);
|
||||
// virtual bool HasGlobalQuestSub(const char *subname);
|
||||
// virtual bool PlayerHasQuestSub(const char *subname);
|
||||
// virtual bool GlobalPlayerHasQuestSub(const char *subname);
|
||||
// virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname);
|
||||
// virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname);
|
||||
//
|
||||
// virtual void ReloadQuests(bool with_timers = false);
|
||||
// virtual void AddVar(std::string name, std::string val) { Parser::AddVar(name, val); };
|
||||
// virtual uint32 GetIdentifier() { return 0xf8b05c11; }
|
||||
//
|
||||
// virtual void LoadNPCScript(std::string filename, int npc_id);
|
||||
// virtual void LoadGlobalNPCScript(std::string filename);
|
||||
// virtual void LoadPlayerScript(std::string filename);
|
||||
// virtual void LoadGlobalPlayerScript(std::string filename);
|
||||
// virtual void LoadItemScript(std::string filename, std::string item_script);
|
||||
// virtual void LoadSpellScript(std::string filename, uint32 spell_id);
|
||||
//
|
||||
// //int LoadScript(int npcid, const char * zone, Mob* activater=0);
|
||||
// //int LoadGlobalNPCScript();
|
||||
// //int LoadPlayerScript(const char *zone);
|
||||
// //int LoadGlobalPlayerScript();
|
||||
// //int LoadItemScript(ItemInst* iteminst, string packagename, itemQuestMode Qtype);
|
||||
// //int LoadSpellScript(uint32 id);
|
||||
//
|
||||
// //expose a var to the script (probably parallels addvar))
|
||||
// //i.e. exportvar("qst1234", "name", "somemob");
|
||||
// //would expose the variable $name='somemob' to the script that handles npc1234
|
||||
// void ExportHash(const char *pkgprefix, const char *hashname, std::map<string,string> &vals);
|
||||
// void ExportVar(const char * pkgprefix, const char * varname, const char * value) const;
|
||||
// void ExportVar(const char * pkgprefix, const char * varname, int value) const;
|
||||
// void ExportVar(const char * pkgprefix, const char * varname, unsigned int value) const;
|
||||
// void ExportVar(const char * pkgprefix, const char * varname, float value) const;
|
||||
// //I don't escape the strings, so use caution!!
|
||||
// //Same as export var, except value is not quoted, and is evaluated as perl
|
||||
// void ExportVarComplex(const char * pkgprefix, const char * varname, const char * value) const;
|
||||
//
|
||||
// //get an appropriate namespage/packagename from an npcid
|
||||
// std::string GetPkgPrefix(uint32 npcid, bool defaultOK = true);
|
||||
// //call the appropriate perl handler. afterwards, parse and dispatch the command queue
|
||||
// //SendCommands("qst1234", "EVENT_SAY") would trigger sub EVENT_SAY() from the qst1234.pl file
|
||||
// virtual void SendCommands(const char * pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst* iteminst);
|
||||
//
|
||||
// int HasQuestFile(uint32 npcid);
|
||||
//
|
||||
//
|
||||
//};
|
||||
//
|
||||
//#endif //EMBPERL
|
||||
//
|
||||
//#endif //EMBPARSER_H
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../common/features.h"
|
||||
@ -22,12 +22,13 @@
|
||||
#ifdef EMBPERL_XS
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "../common/MiscFunctions.h"
|
||||
#include "embparser.h"
|
||||
#include "questmgr.h"
|
||||
#include "embxs.h"
|
||||
#include "entity.h"
|
||||
#include "../common/MiscFunctions.h"
|
||||
#include "zone.h"
|
||||
|
||||
extern Zone* zone;
|
||||
|
||||
/*
|
||||
@ -141,7 +142,7 @@ XS(XS__echo) {
|
||||
dXSARGS;
|
||||
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: echo(id#, str)");
|
||||
Perl_croak(aTHX_ "Usage: echo(id#, str)");
|
||||
|
||||
quest_manager.echo(SvUV(ST(0)), SvPV_nolen(ST(1)));
|
||||
|
||||
@ -1741,79 +1742,79 @@ XS(XS__clear_zone_flag)
|
||||
XS(XS__summonburriedplayercorpse);
|
||||
XS(XS__summonburriedplayercorpse)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 5)
|
||||
Perl_croak(aTHX_ "Usage: summonburriedplayercorpse(char_id,dest_x,dest_y,dest_z,dest_heading)");
|
||||
dXSARGS;
|
||||
if (items != 5)
|
||||
Perl_croak(aTHX_ "Usage: summonburriedplayercorpse(char_id,dest_x,dest_y,dest_z,dest_heading)");
|
||||
|
||||
bool RETVAL;
|
||||
uint32 char_id = (int)SvIV(ST(0));
|
||||
float dest_x = (float)SvIV(ST(1));
|
||||
float dest_y = (float)SvIV(ST(2));
|
||||
float dest_z = (float)SvIV(ST(3));
|
||||
float dest_heading = (float)SvIV(ST(4));
|
||||
bool RETVAL;
|
||||
uint32 char_id = (int)SvIV(ST(0));
|
||||
float dest_x = (float)SvIV(ST(1));
|
||||
float dest_y = (float)SvIV(ST(2));
|
||||
float dest_z = (float)SvIV(ST(3));
|
||||
float dest_heading = (float)SvIV(ST(4));
|
||||
|
||||
RETVAL = quest_manager.summonburriedplayercorpse(char_id, dest_x, dest_y, dest_z, dest_heading);
|
||||
RETVAL = quest_manager.summonburriedplayercorpse(char_id, dest_x, dest_y, dest_z, dest_heading);
|
||||
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
XSRETURN(1);
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__summonallplayercorpses);
|
||||
XS(XS__summonallplayercorpses)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 5)
|
||||
Perl_croak(aTHX_ "Usage: summonallplayercorpses(char_id,dest_x,dest_y,dest_z,dest_heading)");
|
||||
dXSARGS;
|
||||
if (items != 5)
|
||||
Perl_croak(aTHX_ "Usage: summonallplayercorpses(char_id,dest_x,dest_y,dest_z,dest_heading)");
|
||||
|
||||
bool RETVAL;
|
||||
uint32 char_id = (int)SvIV(ST(0));
|
||||
float dest_x = (float)SvIV(ST(1));
|
||||
float dest_y = (float)SvIV(ST(2));
|
||||
float dest_z = (float)SvIV(ST(3));
|
||||
float dest_heading = (float)SvIV(ST(4));
|
||||
bool RETVAL;
|
||||
uint32 char_id = (int)SvIV(ST(0));
|
||||
float dest_x = (float)SvIV(ST(1));
|
||||
float dest_y = (float)SvIV(ST(2));
|
||||
float dest_z = (float)SvIV(ST(3));
|
||||
float dest_heading = (float)SvIV(ST(4));
|
||||
|
||||
RETVAL = quest_manager.summonallplayercorpses(char_id, dest_x, dest_y, dest_z, dest_heading);
|
||||
RETVAL = quest_manager.summonallplayercorpses(char_id, dest_x, dest_y, dest_z, dest_heading);
|
||||
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
XSRETURN(1);
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__getplayerburriedcorpsecount);
|
||||
XS(XS__getplayerburriedcorpsecount)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: getplayerburriedcorpsecount(char_id)");
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: getplayerburriedcorpsecount(char_id)");
|
||||
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
uint32 char_id = (int)SvIV(ST(0));
|
||||
uint32 char_id = (int)SvIV(ST(0));
|
||||
|
||||
RETVAL = quest_manager.getplayerburriedcorpsecount(char_id);
|
||||
XSprePUSH; PUSHu((IV)RETVAL);
|
||||
RETVAL = quest_manager.getplayerburriedcorpsecount(char_id);
|
||||
XSprePUSH; PUSHu((IV)RETVAL);
|
||||
|
||||
XSRETURN(1);
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__buryplayercorpse);
|
||||
XS(XS__buryplayercorpse)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: buryplayercorpse(char_id)");
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: buryplayercorpse(char_id)");
|
||||
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
uint32 char_id = (int)SvIV(ST(0));
|
||||
uint32 char_id = (int)SvIV(ST(0));
|
||||
|
||||
RETVAL = quest_manager.buryplayercorpse(char_id);
|
||||
XSprePUSH; PUSHu((IV)RETVAL);
|
||||
RETVAL = quest_manager.buryplayercorpse(char_id);
|
||||
XSprePUSH; PUSHu((IV)RETVAL);
|
||||
|
||||
XSRETURN(1);
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__forcedooropen);
|
||||
@ -1885,14 +1886,14 @@ XS(XS__toggledoorstate)
|
||||
XS(XS__isdooropen);
|
||||
XS(XS__isdooropen)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: isdooropen(doorid)");
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: isdooropen(doorid)");
|
||||
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
uint32 doorid = (int)SvIV(ST(0));
|
||||
uint32 doorid = (int)SvIV(ST(0));
|
||||
|
||||
RETVAL = quest_manager.isdooropen(doorid);
|
||||
XSprePUSH; PUSHu((IV)RETVAL);
|
||||
@ -2073,9 +2074,9 @@ XS(XS__npcfeature)
|
||||
XS(XS__createbotcount);
|
||||
XS(XS__createbotcount)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
RETVAL = quest_manager.createbotcount();
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
@ -2086,9 +2087,9 @@ XS(XS__createbotcount)
|
||||
XS(XS__spawnbotcount);
|
||||
XS(XS__spawnbotcount)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
RETVAL = quest_manager.spawnbotcount();
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
@ -2099,9 +2100,9 @@ XS(XS__spawnbotcount)
|
||||
XS(XS__botquest);
|
||||
XS(XS__botquest)
|
||||
{
|
||||
dXSARGS;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
dXSARGS;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
RETVAL = quest_manager.botquest();
|
||||
XSprePUSH; PUSHu((IV)RETVAL);
|
||||
@ -2201,7 +2202,7 @@ XS(XS__istaskenabled);
|
||||
XS(XS__istaskenabled)
|
||||
{
|
||||
dXSARGS;
|
||||
bool RETVAL;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2219,7 +2220,7 @@ XS(XS__istaskactive);
|
||||
XS(XS__istaskactive)
|
||||
{
|
||||
dXSARGS;
|
||||
bool RETVAL;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2237,7 +2238,7 @@ XS(XS__istaskactivityactive);
|
||||
XS(XS__istaskactivityactive)
|
||||
{
|
||||
dXSARGS;
|
||||
bool RETVAL;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 2) {
|
||||
@ -2256,7 +2257,7 @@ XS(XS__gettaskactivitydonecount);
|
||||
XS(XS__gettaskactivitydonecount)
|
||||
{
|
||||
dXSARGS;
|
||||
uint32 RETVAL;
|
||||
uint32 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 2) {
|
||||
@ -2358,7 +2359,7 @@ XS(XS__tasktimeleft);
|
||||
XS(XS__tasktimeleft)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2377,7 +2378,7 @@ XS(XS__istaskcompleted);
|
||||
XS(XS__istaskcompleted)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2396,7 +2397,7 @@ XS(XS__enabledtaskcount);
|
||||
XS(XS__enabledtaskcount)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2415,7 +2416,7 @@ XS(XS__firsttaskinset);
|
||||
XS(XS__firsttaskinset)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2434,7 +2435,7 @@ XS(XS__lasttaskinset);
|
||||
XS(XS__lasttaskinset)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2453,7 +2454,7 @@ XS(XS__nexttaskinset);
|
||||
XS(XS__nexttaskinset)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 2) {
|
||||
@ -2472,7 +2473,7 @@ XS(XS__activespeaktask);
|
||||
XS(XS__activespeaktask)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 0) {
|
||||
@ -2490,7 +2491,7 @@ XS(XS__activespeakactivity);
|
||||
XS(XS__activespeakactivity)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2509,7 +2510,7 @@ XS(XS__activetasksinset);
|
||||
XS(XS__activetasksinset)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2528,7 +2529,7 @@ XS(XS__completedtasksinset);
|
||||
XS(XS__completedtasksinset)
|
||||
{
|
||||
dXSARGS;
|
||||
int RETVAL;
|
||||
int RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2548,7 +2549,7 @@ XS(XS__istaskappropriate);
|
||||
XS(XS__istaskappropriate)
|
||||
{
|
||||
dXSARGS;
|
||||
bool RETVAL;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if(items == 1) {
|
||||
@ -2565,13 +2566,13 @@ XS(XS__istaskappropriate)
|
||||
|
||||
XS(XS__popup); // prototype to pass -Wmissing-prototypes
|
||||
XS(XS__popup) {
|
||||
dXSARGS;
|
||||
dXSARGS;
|
||||
int popupid = 0;
|
||||
int buttons = 0;
|
||||
int duration = 0;
|
||||
|
||||
if((items < 2) || (items > 5))
|
||||
Perl_croak(aTHX_ "Usage: popup(windowtitle, text, popupid, buttons, duration)");
|
||||
Perl_croak(aTHX_ "Usage: popup(windowtitle, text, popupid, buttons, duration)");
|
||||
|
||||
if(items >= 3)
|
||||
popupid = (int)SvIV(ST(2));
|
||||
@ -2582,9 +2583,9 @@ XS(XS__istaskappropriate)
|
||||
if(items == 5)
|
||||
duration = (int)SvIV(ST(4));
|
||||
|
||||
quest_manager.popup(SvPV_nolen(ST(0)), SvPV_nolen(ST(1)), popupid, buttons, duration);
|
||||
quest_manager.popup(SvPV_nolen(ST(0)), SvPV_nolen(ST(1)), popupid, buttons, duration);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
XS(XS__clearspawntimers);
|
||||
XS(XS__clearspawntimers)
|
||||
@ -2952,11 +2953,11 @@ XS(XS__saylink) {
|
||||
Const_char * RETVAL;
|
||||
char text[250];
|
||||
char text2[250];
|
||||
bool silent = false;
|
||||
bool silent = false;
|
||||
strcpy(text,(char *)SvPV_nolen(ST(0)));
|
||||
if(items >= 2) {
|
||||
silent = ((int)SvIV(ST(1))) == 0 ? false : true;
|
||||
}
|
||||
if(items >= 2) {
|
||||
silent = ((int)SvIV(ST(1))) == 0 ? false : true;
|
||||
}
|
||||
if (items == 3)
|
||||
strcpy(text2,(char *)SvPV_nolen(ST(2)));
|
||||
else
|
||||
@ -3000,12 +3001,12 @@ XS(XS__SetRunning)
|
||||
XS(XS__IsRunning);
|
||||
XS(XS__IsRunning)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items >= 1)
|
||||
Perl_croak(aTHX_ "Usage: IsRunning()");
|
||||
dXSARGS;
|
||||
if (items >= 1)
|
||||
Perl_croak(aTHX_ "Usage: IsRunning()");
|
||||
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
|
||||
RETVAL = quest_manager.IsRunning();
|
||||
@ -3017,14 +3018,14 @@ XS(XS__IsRunning)
|
||||
XS(XS__IsEffectInSpell);
|
||||
XS(XS__IsEffectInSpell)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: IsEffectInSpell(spell_id, effect_id)");
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: IsEffectInSpell(spell_id, effect_id)");
|
||||
|
||||
uint32 spell_id = (uint32)SvUV(ST(0));
|
||||
uint32 effect_id = (uint32)SvUV(ST(1));
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
|
||||
RETVAL = IsEffectInSpell(spell_id, effect_id);
|
||||
@ -3036,13 +3037,13 @@ XS(XS__IsEffectInSpell)
|
||||
XS(XS__IsBeneficialSpell);
|
||||
XS(XS__IsBeneficialSpell)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: IsBeneficialSpell(spell_id)");
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: IsBeneficialSpell(spell_id)");
|
||||
|
||||
uint32 spell_id = (uint32)SvUV(ST(0));
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
bool RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
|
||||
RETVAL = BeneficialSpell(spell_id);
|
||||
@ -3054,13 +3055,13 @@ XS(XS__IsBeneficialSpell)
|
||||
XS(XS__GetSpellResistType);
|
||||
XS(XS__GetSpellResistType)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: GetSpellResistType(spell_id)");
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: GetSpellResistType(spell_id)");
|
||||
|
||||
uint32 spell_id = (uint32)SvUV(ST(0));
|
||||
int32 spell_val = 0;
|
||||
dXSTARG;
|
||||
dXSTARG;
|
||||
|
||||
spell_val = GetSpellResistType(spell_id);
|
||||
XSRETURN_UV(spell_val);
|
||||
@ -3069,13 +3070,13 @@ XS(XS__GetSpellResistType)
|
||||
XS(XS__GetSpellTargetType);
|
||||
XS(XS__GetSpellTargetType)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: GetSpellTargetType(spell_id)");
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: GetSpellTargetType(spell_id)");
|
||||
|
||||
uint32 spell_id = (uint32)SvUV(ST(0));
|
||||
int32 spell_val = 0;
|
||||
dXSTARG;
|
||||
dXSTARG;
|
||||
|
||||
spell_val = GetSpellTargetType(spell_id);
|
||||
XSRETURN_UV(spell_val);
|
||||
@ -3108,7 +3109,7 @@ XS(XS__enabletitle)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: enabletitle(titleset)");
|
||||
Perl_croak(aTHX_ "Usage: enabletitle(titleset)");
|
||||
|
||||
int titleset = (int)SvIV(ST(0));
|
||||
|
||||
@ -3122,16 +3123,16 @@ XS(XS__checktitle)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: checktitle(titleset)");
|
||||
Perl_croak(aTHX_ "Usage: checktitle(titleset)");
|
||||
|
||||
bool RETVAL;
|
||||
int titleset = (int)SvIV(ST(0));
|
||||
|
||||
RETVAL = quest_manager.checktitle(titleset);
|
||||
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
XSRETURN(1);
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__removetitle);
|
||||
@ -3139,7 +3140,7 @@ XS(XS__removetitle)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: removetitle(titleset)");
|
||||
Perl_croak(aTHX_ "Usage: removetitle(titleset)");
|
||||
|
||||
int titleset = (int)SvIV(ST(0));
|
||||
|
||||
@ -3151,9 +3152,9 @@ XS(XS__removetitle)
|
||||
XS(XS__wearchange);
|
||||
XS(XS__wearchange)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: wearchange(slot, texture)");
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: wearchange(slot, texture)");
|
||||
|
||||
uint8 slot = (int)SvUV(ST(0));
|
||||
uint16 texture = (int)SvUV(ST(1));
|
||||
@ -3183,72 +3184,72 @@ XS(XS__voicetell)
|
||||
XS(XS__LearnRecipe);
|
||||
XS(XS__LearnRecipe)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: LearnRecipe(recipe_id)");
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: LearnRecipe(recipe_id)");
|
||||
|
||||
uint32 recipe_id = (uint32)SvIV(ST(0));
|
||||
uint32 recipe_id = (uint32)SvIV(ST(0));
|
||||
|
||||
quest_manager.LearnRecipe(recipe_id);
|
||||
quest_manager.LearnRecipe(recipe_id);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS__SendMail);
|
||||
XS(XS__SendMail)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 4)
|
||||
Perl_croak(aTHX_ "Usage: SendMail(to, from, subject, message)");
|
||||
dXSARGS;
|
||||
if (items != 4)
|
||||
Perl_croak(aTHX_ "Usage: SendMail(to, from, subject, message)");
|
||||
|
||||
char *to = (char *)SvPV_nolen(ST(0));
|
||||
char *from = (char *)SvPV_nolen(ST(1));
|
||||
char *subject = (char *)SvPV_nolen(ST(2));
|
||||
char *message = (char *)SvPV_nolen(ST(3));
|
||||
char *to = (char *)SvPV_nolen(ST(0));
|
||||
char *from = (char *)SvPV_nolen(ST(1));
|
||||
char *subject = (char *)SvPV_nolen(ST(2));
|
||||
char *message = (char *)SvPV_nolen(ST(3));
|
||||
|
||||
quest_manager.SendMail(to, from, subject, message);
|
||||
quest_manager.SendMail(to, from, subject, message);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS__GetZoneID);
|
||||
XS(XS__GetZoneID)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: GetZoneID(zone)");
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: GetZoneID(zone)");
|
||||
|
||||
char *zone = (char *)SvPV_nolen(ST(0));
|
||||
int32 id = quest_manager.GetZoneID(zone);
|
||||
|
||||
XSRETURN_IV(id);
|
||||
char *zone = (char *)SvPV_nolen(ST(0));
|
||||
int32 id = quest_manager.GetZoneID(zone);
|
||||
|
||||
XSRETURN_IV(id);
|
||||
}
|
||||
|
||||
XS(XS__GetZoneLongName);
|
||||
XS(XS__GetZoneLongName)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: GetZoneLongName(zone)");
|
||||
dXSTARG;
|
||||
char *zone = (char *)SvPV_nolen(ST(0));
|
||||
Const_char* RETVAL = quest_manager.GetZoneLongName(zone);
|
||||
|
||||
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: GetZoneLongName(zone)");
|
||||
dXSTARG;
|
||||
char *zone = (char *)SvPV_nolen(ST(0));
|
||||
Const_char* RETVAL = quest_manager.GetZoneLongName(zone);
|
||||
|
||||
sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__GetTimeSeconds);
|
||||
XS(XS__GetTimeSeconds)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 0)
|
||||
Perl_croak(aTHX_ "Usage: GetTimeSeconds()");
|
||||
dXSARGS;
|
||||
if (items != 0)
|
||||
Perl_croak(aTHX_ "Usage: GetTimeSeconds()");
|
||||
|
||||
uint32 seconds = 0;
|
||||
dXSTARG;
|
||||
dXSTARG;
|
||||
|
||||
seconds = Timer::GetTimeSeconds();
|
||||
seconds = Timer::GetTimeSeconds();
|
||||
XSRETURN_UV(seconds);
|
||||
}
|
||||
|
||||
@ -3401,7 +3402,7 @@ EXTERN_C XS(boot_quest)
|
||||
newXS(strcpy(buf, "addloot"), XS__addloot, file);
|
||||
newXS(strcpy(buf, "zone"), XS__zone, file);
|
||||
newXS(strcpy(buf, "settimer"), XS__settimer, file);
|
||||
newXS(strcpy(buf, "settimerMS"), XS__settimerMS, file);
|
||||
newXS(strcpy(buf, "settimerMS"), XS__settimerMS, file);
|
||||
newXS(strcpy(buf, "stoptimer"), XS__stoptimer, file);
|
||||
newXS(strcpy(buf, "stopalltimers"), XS__stopalltimers, file);
|
||||
newXS(strcpy(buf, "emote"), XS__emote, file);
|
||||
@ -3573,14 +3574,14 @@ EXTERN_C XS(boot_quest)
|
||||
newXS(strcpy(buf, "removetitle"), XS__removetitle, file);
|
||||
newXS(strcpy(buf, "wearchange"), XS__wearchange, file);
|
||||
newXS(strcpy(buf, "voicetell"), XS__voicetell, file);
|
||||
newXS(strcpy(buf, "LearnRecipe"), XS__LearnRecipe, file);
|
||||
newXS(strcpy(buf, "SendMail"), XS__SendMail, file);
|
||||
newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file);
|
||||
newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file);
|
||||
newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file);
|
||||
newXS(strcpy(buf, "LearnRecipe"), XS__LearnRecipe, file);
|
||||
newXS(strcpy(buf, "SendMail"), XS__SendMail, file);
|
||||
newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file);
|
||||
newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file);
|
||||
newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file);
|
||||
newXS(strcpy(buf, "handleturnin"), XS__handleturnin, file);
|
||||
newXS(strcpy(buf, "completehandin"), XS__completehandin, file);
|
||||
newXS(strcpy(buf, "resethandin"), XS__resethandin, file);
|
||||
newXS(strcpy(buf, "completehandin"), XS__completehandin, file);
|
||||
newXS(strcpy(buf, "resethandin"), XS__resethandin, file);
|
||||
newXS(strcpy(buf, "clearhandin"), XS__clearhandin, file);
|
||||
newXS(strcpy(buf, "crosszonesignalclientbycharid"), XS__crosszonesignalclientbycharid, file);
|
||||
newXS(strcpy(buf, "crosszonesignalclientbyname"), XS__crosszonesignalclientbyname, file);
|
||||
14
zone/net.cpp
14
zone/net.cpp
@ -54,7 +54,6 @@ extern volatile bool ZoneLoaded;
|
||||
#include "../common/Mutex.h"
|
||||
#include "../common/version.h"
|
||||
#include "../common/EQEMuError.h"
|
||||
#include "ZoneConfig.h"
|
||||
#include "../common/packet_dump_file.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/guilds.h"
|
||||
@ -67,22 +66,23 @@ extern volatile bool ZoneLoaded;
|
||||
#include "../common/ipc_mutex.h"
|
||||
#include "../common/memory_mapped_file.h"
|
||||
#include "../common/eqemu_exception.h"
|
||||
#include "../common/spdat.h"
|
||||
|
||||
#include "masterentity.h"
|
||||
#include "worldserver.h"
|
||||
#include "net.h"
|
||||
#include "../common/spdat.h"
|
||||
#include "zone.h"
|
||||
#include "command.h"
|
||||
#include "embparser.h"
|
||||
#include "perlparser.h"
|
||||
#include "lua_parser.h"
|
||||
#include "client_logs.h"
|
||||
#include "questmgr.h"
|
||||
#include "ZoneConfig.h"
|
||||
#include "titles.h"
|
||||
#include "guild_mgr.h"
|
||||
#include "tasks.h"
|
||||
|
||||
#include "QuestParserCollection.h"
|
||||
#include "embparser.h"
|
||||
#include "lua_parser.h"
|
||||
#include "client_logs.h"
|
||||
#include "questmgr.h"
|
||||
|
||||
TimeoutManager timeout_manager;
|
||||
NetConnection net;
|
||||
|
||||
1694
zone/parser.cpp
1694
zone/parser.cpp
File diff suppressed because it is too large
Load Diff
124
zone/parser.h
124
zone/parser.h
@ -1,124 +0,0 @@
|
||||
#ifndef PARSER_H
|
||||
#define PARSER_H
|
||||
|
||||
#define Parser_MaxVars 1024
|
||||
#include "../common/timer.h"
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "event_codes.h"
|
||||
#include "QuestInterface.h"
|
||||
|
||||
|
||||
struct EventList {
|
||||
std::string event;
|
||||
std::string command;
|
||||
};
|
||||
|
||||
struct Events {
|
||||
uint32 npcid;
|
||||
std::list<EventList*> Event;
|
||||
};
|
||||
|
||||
struct Alias {
|
||||
int index;
|
||||
uint32 npcid;
|
||||
char name[100][100];
|
||||
char command[100][1024];
|
||||
};
|
||||
|
||||
struct vars {
|
||||
std::string name;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
struct command_list {
|
||||
char command_name[100];
|
||||
int param_amount[17];
|
||||
};
|
||||
|
||||
|
||||
class Parser : public QuestInterface
|
||||
{
|
||||
public:
|
||||
Parser();
|
||||
virtual ~Parser();
|
||||
int mindex;
|
||||
const std::string DEFAULT_QUEST_PREFIX;
|
||||
|
||||
typedef list<Events*>::iterator iter_events;
|
||||
typedef list<EventList*>::iterator iter_eventlist;
|
||||
std::list<Events*> MainList;
|
||||
std::list<vars*> varlist;
|
||||
std::list<Alias*> AliasList;
|
||||
uint32 npcarrayindex;
|
||||
|
||||
uint32 AddNPCQuestID(uint32 npcid);
|
||||
uint32 FindNPCQuestID(int32 npcid);
|
||||
int CheckAliases(const char * alias, uint32 npcid, Mob* npcmob, Mob* mob);
|
||||
void ClearAliasesByNPCID(uint32 iNPCID);
|
||||
void ClearCache();
|
||||
void ClearEventsByNPCID(uint32 iNPCID);
|
||||
|
||||
void DelChatAndItemVars(uint32 npcid);
|
||||
void DeleteVar(std::string name);
|
||||
|
||||
void ExCommands(std::string command, std::string parms, int argnums, uint32 npcid, Mob* other, Mob* mob );
|
||||
|
||||
void GetCommandName(char * command1, char * arg);
|
||||
int GetFreeID();
|
||||
int GetItemCount(std::string itemid, uint32 npcid);
|
||||
int32 GetNPCqstID(uint32 iNPCID);
|
||||
std::string GetVar(std::string varname, uint32 npcid);
|
||||
|
||||
void HandleVars(std::string varname, std::string varparms, std::string& origstring, std::string format, uint32 npcid, Mob* mob);
|
||||
|
||||
bool LoadAttempted(uint32 iNPCID);
|
||||
void LoadCommands(const char * filename);
|
||||
virtual int LoadScript(int npcid, const char * zone, Mob* activater=0);
|
||||
|
||||
void MakeParms(const char * string, uint32 npcid);
|
||||
void MakeVars(std::string text, uint32 npcid);
|
||||
|
||||
int numtok(const char *text, char character);
|
||||
|
||||
int ParseCommands(std::string text, int line, int justcheck, uint32 npcid, Mob* other, Mob* mob, std::string filename=string("none"));
|
||||
int ParseIf(std::string text);
|
||||
int pcalc(const char * string);
|
||||
void ParseVars(std::string& text, uint32 npcid, Mob* mob);
|
||||
|
||||
void Replace(std::string& string1, std::string repstr, std::string rep, int all=0);
|
||||
|
||||
void scanformat(char *string, const char *format, char arg[10][1024]);
|
||||
bool SetNPCqstID(uint32 iNPCID, int32 iValue);
|
||||
char * strrstr(char* string, const char * sub);
|
||||
virtual void SendCommands(const char * event, uint32 npcid, NPC* npcmob, Mob* mob);
|
||||
|
||||
int HasQuestFile(uint32 npcid);
|
||||
|
||||
//interface stuff
|
||||
virtual void EventNPC(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 bool HasQuestSub(uint32 npcid, const char *subname) { return HasQuestFile(npcid) != 0; }
|
||||
virtual bool PlayerHasQuestSub(const char *subname) { return true; }
|
||||
virtual bool GlobalPlayerHasQuestSub(const char *subname) { return true; }
|
||||
virtual bool SpellHasQuestSub(uint32 spell_id, const char *subname) { return true; }
|
||||
virtual bool ItemHasQuestSub(ItemInst *itm, const char *subname) { return true; }
|
||||
virtual void AddVar(std::string varname, std::string varval);
|
||||
virtual void ReloadQuests(bool with_timers = false);
|
||||
virtual uint32 GetIdentifier() { return 0x04629fff; }
|
||||
|
||||
private:
|
||||
//void Event(int event, uint32 npcid, const char * data, Mob* npcmob, Mob* mob);
|
||||
//changed - Eglin. more reasonable (IMHO) than changing every single referance to the global pointer.
|
||||
//that's what you get for using globals! :)
|
||||
virtual void Event(QuestEventID event, uint32 npcid, const char * data, NPC* npcmob, Mob* mob, uint32 extradata = 0);
|
||||
|
||||
uint32 pMaxNPCID;
|
||||
int32* pNPCqstID;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1 +0,0 @@
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user