mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
Failed merge on a specific file also fix for std and string changes in my embparser
This commit is contained in:
parent
e47de5deed
commit
d25d8187b6
@ -21,6 +21,7 @@
|
|||||||
#include "../common/debug.h"
|
#include "../common/debug.h"
|
||||||
#include "../common/seperator.h"
|
#include "../common/seperator.h"
|
||||||
#include "../common/MiscFunctions.h"
|
#include "../common/MiscFunctions.h"
|
||||||
|
#include "../common/StringUtil.h"
|
||||||
#include "../common/features.h"
|
#include "../common/features.h"
|
||||||
#include "masterentity.h"
|
#include "masterentity.h"
|
||||||
#include "embparser.h"
|
#include "embparser.h"
|
||||||
@ -844,7 +845,7 @@ void PerlembParser::ExportQGlobals(bool isPlayerQuest, bool isGlobalPlayerQuest,
|
|||||||
//only export for npcs that are global enabled.
|
//only export for npcs that are global enabled.
|
||||||
if(npcmob && npcmob->GetQglobal())
|
if(npcmob && npcmob->GetQglobal())
|
||||||
{
|
{
|
||||||
map<string, string> globhash;
|
std::map<std::string, std::string> globhash;
|
||||||
QGlobalCache *npc_c = nullptr;
|
QGlobalCache *npc_c = nullptr;
|
||||||
QGlobalCache *char_c = nullptr;
|
QGlobalCache *char_c = nullptr;
|
||||||
QGlobalCache *zone_c = nullptr;
|
QGlobalCache *zone_c = nullptr;
|
||||||
@ -905,7 +906,7 @@ void PerlembParser::ExportQGlobals(bool isPlayerQuest, bool isGlobalPlayerQuest,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
map<string, string> globhash;
|
std::map<std::string, std::string> globhash;
|
||||||
QGlobalCache *char_c = nullptr;
|
QGlobalCache *char_c = nullptr;
|
||||||
QGlobalCache *zone_c = nullptr;
|
QGlobalCache *zone_c = nullptr;
|
||||||
|
|
||||||
@ -1026,7 +1027,7 @@ void PerlembParser::ExportZoneVariables(std::string &package_name) {
|
|||||||
void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) {
|
void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) {
|
||||||
if(mob && mob->IsClient())
|
if(mob && mob->IsClient())
|
||||||
{
|
{
|
||||||
string hashname = package_name + std::string("::hasitem");
|
std::string hashname = package_name + std::string("::hasitem");
|
||||||
|
|
||||||
//start with an empty hash
|
//start with an empty hash
|
||||||
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
|
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
|
||||||
@ -1045,7 +1046,7 @@ void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mob && mob->IsClient()) {
|
if(mob && mob->IsClient()) {
|
||||||
string hashname = package_name + std::string("::oncursor");
|
std::string hashname = package_name + std::string("::oncursor");
|
||||||
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
|
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
|
||||||
char *hi_decl = nullptr;
|
char *hi_decl = nullptr;
|
||||||
int itemid = mob->CastToClient()->GetItemIDAt(30);
|
int itemid = mob->CastToClient()->GetItemIDAt(30);
|
||||||
@ -1094,7 +1095,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
|
|||||||
ExportVar(package_name.c_str(), "silver", GetVar("silver." + std::string(itoa(objid))).c_str());
|
ExportVar(package_name.c_str(), "silver", GetVar("silver." + std::string(itoa(objid))).c_str());
|
||||||
ExportVar(package_name.c_str(), "gold", GetVar("gold." + std::string(itoa(objid))).c_str());
|
ExportVar(package_name.c_str(), "gold", GetVar("gold." + std::string(itoa(objid))).c_str());
|
||||||
ExportVar(package_name.c_str(), "platinum", GetVar("platinum." + std::string(itoa(objid))).c_str());
|
ExportVar(package_name.c_str(), "platinum", GetVar("platinum." + std::string(itoa(objid))).c_str());
|
||||||
string hashname = package_name + std::string("::itemcount");
|
std::string hashname = package_name + std::string("::itemcount");
|
||||||
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
|
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
|
||||||
perl->eval(std::string("++$").append(hashname).append("{$").append(package_name).append("::item1};").c_str());
|
perl->eval(std::string("++$").append(hashname).append("{$").append(package_name).append("::item1};").c_str());
|
||||||
perl->eval(std::string("++$").append(hashname).append("{$").append(package_name).append("::item2};").c_str());
|
perl->eval(std::string("++$").append(hashname).append("{$").append(package_name).append("::item2};").c_str());
|
||||||
|
|||||||
103
zone/embparser.h
103
zone/embparser.h
@ -24,78 +24,8 @@
|
|||||||
#include "QuestInterface.h"
|
#include "QuestInterface.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
<<<<<<< HEAD
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "embperl.h"
|
#include "embperl.h"
|
||||||
=======
|
|
||||||
|
|
||||||
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;
|
|
||||||
std::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.
|
|
||||||
std::map<uint32, questMode> hasQuests; //npcid -> questMode
|
|
||||||
std::map<std::string, playerQuestMode> playerQuestLoaded; //zone shortname -> playerQuestMode
|
|
||||||
playerQuestMode globalPlayerQuestLoaded;
|
|
||||||
GlobalNPCQuestMode globalNPCQuestLoaded;
|
|
||||||
std::map<std::string, itemQuestMode> itemQuestLoaded; // package name - > itemQuestMode
|
|
||||||
std::map<uint32, spellQuestMode> spellQuestLoaded;
|
|
||||||
|
|
||||||
std::queue<EventRecord> eventQueue; //for events that happen when perl is in use.
|
|
||||||
bool eventQueueProcessing;
|
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
class ItemInst;
|
class ItemInst;
|
||||||
class Mob;
|
class Mob;
|
||||||
@ -146,7 +76,6 @@ public:
|
|||||||
virtual void LoadItemScript(std::string filename, std::string item_script);
|
virtual void LoadItemScript(std::string filename, std::string item_script);
|
||||||
virtual void LoadSpellScript(std::string filename, uint32 spell_id);
|
virtual void LoadSpellScript(std::string filename, uint32 spell_id);
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
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 std::string GetVar(std::string name);
|
||||||
virtual void ReloadQuests();
|
virtual void ReloadQuests();
|
||||||
@ -165,38 +94,6 @@ private:
|
|||||||
uint32 extradata, bool global);
|
uint32 extradata, bool global);
|
||||||
void SendCommands(const char *pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst* iteminst);
|
void SendCommands(const char *pkgprefix, const char *event, uint32 npcid, Mob* other, Mob* mob, ItemInst* iteminst);
|
||||||
void MapFunctions();
|
void MapFunctions();
|
||||||
=======
|
|
||||||
int LoadScript(int npcid, const char * zone, Mob* activater=0);
|
|
||||||
int LoadGlobalNPCScript();
|
|
||||||
int LoadPlayerScript(const char *zone);
|
|
||||||
int LoadGlobalPlayerScript();
|
|
||||||
int LoadItemScript(ItemInst* iteminst, std::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<std::string,std::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);
|
|
||||||
|
|
||||||
#ifdef EMBPERL_COMMANDS
|
|
||||||
void ExecCommand(Client *c, Seperator *sep);
|
|
||||||
#endif
|
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
void HandleQueue();
|
void HandleQueue();
|
||||||
void AddQueueEvent(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob,
|
void AddQueueEvent(QuestEventID event, uint32 objid, const char * data, NPC* npcmob, ItemInst* iteminst, Mob* mob,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user