mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
Implement Perl Export Variable settings map (Huge performance boost) (Preliminary)
This commit is contained in:
parent
33917fe2a9
commit
53c8d63981
@ -23,6 +23,7 @@
|
||||
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
|
||||
#include "types.h"
|
||||
#include "dbcore.h"
|
||||
#include "linked_list.h"
|
||||
|
||||
@ -116,7 +116,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
platform_file_name = "ucs";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin)
|
||||
platform_file_name = "login";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin)
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLaunch)
|
||||
platform_file_name = "launcher";
|
||||
}
|
||||
|
||||
|
||||
@ -182,6 +182,7 @@
|
||||
#define ServerOP_CZMessagePlayer 0x4008
|
||||
#define ServerOP_ReloadWorld 0x4009
|
||||
#define ServerOP_ReloadLogs 0x4010
|
||||
#define ServerOP_ReloadPerlExportSettings 0x4011
|
||||
/* Query Server OP Codes */
|
||||
#define ServerOP_QSPlayerLogTrades 0x5010
|
||||
#define ServerOP_QSPlayerLogHandins 0x5011
|
||||
|
||||
@ -349,7 +349,7 @@ void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* con
|
||||
}
|
||||
|
||||
AppendAnyLenString(&output, &outsize, &outlen,
|
||||
"#%-3i :: %s :: %15s:%-5i :: %2i :: %s:%i :: %s :: (%u)",
|
||||
"#%-3i :: %s :: %15s:%-5i :: %2i :: %s:%i :: %s :: (%u)",
|
||||
zone_server_data->GetID(),
|
||||
is_static_string,
|
||||
inet_ntoa(in),
|
||||
|
||||
@ -826,6 +826,11 @@ bool ZoneServer::Process() {
|
||||
RuleManager::Instance()->LoadRules(&database, "default");
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadPerlExportSettings:
|
||||
{
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_CameraShake:
|
||||
{
|
||||
zoneserver_list.SendPacket(pack);
|
||||
|
||||
@ -334,6 +334,7 @@ int command_init(void) {
|
||||
command_add("reloadallrules", "Executes a reload of all rules.", 80, command_reloadallrules) ||
|
||||
command_add("reloademote", "Reloads NPC Emotes", 80, command_reloademote) ||
|
||||
command_add("reloadlevelmods", nullptr,255, command_reloadlevelmods) ||
|
||||
command_add("reloadperlexportsettings", nullptr, 255, command_reloadperlexportsettings) ||
|
||||
command_add("reloadqst", " - Clear quest cache (any argument causes it to also stop all timers)", 150, command_reloadqst) ||
|
||||
command_add("reloadquest", " - Clear quest cache (any argument causes it to also stop all timers)", 150, command_reloadqst) ||
|
||||
command_add("reloadrulesworld", "Executes a reload of all rules in world specifically.", 80, command_reloadworldrules) ||
|
||||
@ -10768,4 +10769,16 @@ void command_apply_shared_memory(Client *c, const Seperator *sep) {
|
||||
strcpy((char*)pack.pBuffer, hotfix_name.c_str());
|
||||
}
|
||||
worldserver.SendPacket(&pack);
|
||||
}
|
||||
|
||||
void command_reloadperlexportsettings(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (c)
|
||||
{
|
||||
ServerPacket *pack = new ServerPacket(ServerOP_ReloadPerlExportSettings, 0);
|
||||
worldserver.SendPacket(pack);
|
||||
c->Message(13, "Successfully sent the packet to world to reload Perl Export settings");
|
||||
safe_delete(pack);
|
||||
|
||||
}
|
||||
}
|
||||
@ -332,6 +332,7 @@ void command_load_shared_memory(Client *c, const Seperator *sep);
|
||||
void command_apply_shared_memory(Client *c, const Seperator *sep);
|
||||
void command_untraindisc(Client *c, const Seperator *sep);
|
||||
void command_untraindiscs(Client *c, const Seperator *sep);
|
||||
void command_reloadperlexportsettings(Client *c, const Seperator *sep);
|
||||
|
||||
#ifdef EQPROFILE
|
||||
void command_profiledump(Client *c, const Seperator *sep);
|
||||
|
||||
@ -183,15 +183,31 @@ int PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * da
|
||||
|
||||
int char_id = 0;
|
||||
ExportCharID(package_name, char_id, npcmob, mob);
|
||||
ExportQGlobals(isPlayerQuest, isGlobalPlayerQuest, isGlobalNPC, isItemQuest, isSpellQuest,
|
||||
package_name, npcmob, mob, char_id);
|
||||
|
||||
/* Check for QGlobal export event enable */
|
||||
if (parse->perl_event_export_settings[event].qglobals){
|
||||
ExportQGlobals(isPlayerQuest, isGlobalPlayerQuest, isGlobalNPC, isItemQuest, isSpellQuest, package_name, npcmob, mob, char_id);
|
||||
}
|
||||
|
||||
//ExportGenericVariables();
|
||||
ExportMobVariables(isPlayerQuest, isGlobalPlayerQuest, isGlobalNPC, isItemQuest, isSpellQuest,
|
||||
package_name, mob, npcmob);
|
||||
ExportZoneVariables(package_name);
|
||||
ExportItemVariables(package_name, mob);
|
||||
ExportEventVariables(package_name, event, objid, data, npcmob, iteminst, mob, extradata, extra_pointers);
|
||||
/* Check for Mob export event enable */
|
||||
if (parse->perl_event_export_settings[event].mob){
|
||||
ExportMobVariables(isPlayerQuest, isGlobalPlayerQuest, isGlobalNPC, isItemQuest, isSpellQuest, package_name, mob, npcmob);
|
||||
}
|
||||
|
||||
/* Check for Zone export event enable */
|
||||
if (parse->perl_event_export_settings[event].zone){
|
||||
ExportZoneVariables(package_name);
|
||||
}
|
||||
|
||||
/* Check for Item export event enable */
|
||||
if (parse->perl_event_export_settings[event].item){
|
||||
ExportItemVariables(package_name, mob);
|
||||
}
|
||||
|
||||
/* Check for Event export event enable */
|
||||
if (parse->perl_event_export_settings[event].event_variables){
|
||||
ExportEventVariables(package_name, event, objid, data, npcmob, iteminst, mob, extradata, extra_pointers);
|
||||
}
|
||||
|
||||
if(isPlayerQuest || isGlobalPlayerQuest){
|
||||
return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr);
|
||||
@ -199,8 +215,7 @@ int PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * da
|
||||
else if(isItemQuest) {
|
||||
return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, iteminst);
|
||||
}
|
||||
else if(isSpellQuest)
|
||||
{
|
||||
else if(isSpellQuest){
|
||||
if(mob) {
|
||||
return SendCommands(package_name.c_str(), sub_name, 0, mob, mob, nullptr);
|
||||
} else {
|
||||
|
||||
@ -75,6 +75,7 @@ public:
|
||||
virtual std::string GetVar(std::string name);
|
||||
virtual void ReloadQuests();
|
||||
virtual uint32 GetIdentifier() { return 0xf8b05c11; }
|
||||
|
||||
private:
|
||||
Embperl *perl;
|
||||
|
||||
|
||||
@ -110,6 +110,7 @@ extern void MapOpcodes();
|
||||
int main(int argc, char** argv) {
|
||||
RegisterExecutablePlatform(ExePlatformZone);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
|
||||
set_exception_handler();
|
||||
QServ = new QueryServ;
|
||||
|
||||
@ -339,6 +340,10 @@ int main(int argc, char** argv) {
|
||||
#ifdef EMBPERL
|
||||
PerlembParser *perl_parser = new PerlembParser();
|
||||
parse->RegisterQuestInterface(perl_parser, "pl");
|
||||
|
||||
/* Load Perl Event Export Settings */
|
||||
parse->LoadPerlEventExportSettings(parse->perl_event_export_settings);
|
||||
|
||||
#endif
|
||||
|
||||
//now we have our parser, load the quests
|
||||
|
||||
@ -1032,3 +1032,42 @@ int QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void QuestParserCollection::LoadPerlEventExportSettings(PerlEventExportSettings* perl_event_export_settings) {
|
||||
|
||||
Log.Out(Logs::General, Logs::Zone_Server, "Loading Perl Event Export Settings...");
|
||||
|
||||
/* Write Defaults First (All Enabled) */
|
||||
for (int i = 0; i < _LargestEventID; i++){
|
||||
perl_event_export_settings[i].qglobals = 1;
|
||||
perl_event_export_settings[i].mob = 1;
|
||||
perl_event_export_settings[i].zone = 1;
|
||||
perl_event_export_settings[i].item = 1;
|
||||
perl_event_export_settings[i].event_variables = 1;
|
||||
}
|
||||
|
||||
std::string query =
|
||||
"SELECT "
|
||||
"event_id, "
|
||||
"event_description, "
|
||||
"export_qglobals, "
|
||||
"export_mob, "
|
||||
"export_zone, "
|
||||
"export_item, "
|
||||
"export_event "
|
||||
"FROM "
|
||||
"perl_event_export_settings "
|
||||
"ORDER BY event_id";
|
||||
|
||||
int event_id = 0;
|
||||
auto results = database.QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
event_id = atoi(row[0]);
|
||||
perl_event_export_settings[event_id].qglobals = atoi(row[2]);
|
||||
perl_event_export_settings[event_id].mob = atoi(row[3]);
|
||||
perl_event_export_settings[event_id].zone = atoi(row[4]);
|
||||
perl_event_export_settings[event_id].item = atoi(row[5]);
|
||||
perl_event_export_settings[event_id].event_variables = atoi(row[6]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -77,6 +77,27 @@ public:
|
||||
|
||||
void GetErrors(std::list<std::string> &err);
|
||||
|
||||
/*
|
||||
Internally used memory reference for all Perl Event Export Settings
|
||||
Some exports are very taxing on CPU given how much an event is called.
|
||||
|
||||
These are loaded via DB and have defaults loaded in PerlEventExportSettingsDefaults.
|
||||
|
||||
Database loaded via Database::LoadPerlEventExportSettings(log_settings)
|
||||
*/
|
||||
|
||||
struct PerlEventExportSettings {
|
||||
uint8 qglobals;
|
||||
uint8 mob;
|
||||
uint8 zone;
|
||||
uint8 item;
|
||||
uint8 event_variables;
|
||||
};
|
||||
|
||||
PerlEventExportSettings perl_event_export_settings[_LargestEventID];
|
||||
|
||||
void LoadPerlEventExportSettings(PerlEventExportSettings* perl_event_export_settings);
|
||||
|
||||
private:
|
||||
bool HasQuestSubLocal(uint32 npcid, QuestEventID evt);
|
||||
bool HasQuestSubGlobal(QuestEventID evt);
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include "client.h"
|
||||
#include "corpse.h"
|
||||
#include "entity.h"
|
||||
#include "quest_parser_collection.h"
|
||||
#include "guild_mgr.h"
|
||||
#include "mob.h"
|
||||
#include "net.h"
|
||||
@ -60,6 +61,9 @@ extern NetConnection net;
|
||||
extern PetitionList petition_list;
|
||||
extern uint32 numclients;
|
||||
extern volatile bool RunLoops;
|
||||
extern QuestParserCollection *parse;
|
||||
|
||||
// QuestParserCollection *parse = 0;
|
||||
|
||||
WorldServer::WorldServer()
|
||||
: WorldConnection(EmuTCPConnection::packetModeZone)
|
||||
@ -1742,6 +1746,10 @@ void WorldServer::Process() {
|
||||
database.LoadLogSettings(Log.log_settings);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadPerlExportSettings: {
|
||||
parse->LoadPerlEventExportSettings(parse->perl_event_export_settings);
|
||||
break;
|
||||
}
|
||||
case ServerOP_CameraShake:
|
||||
{
|
||||
if(zone)
|
||||
|
||||
@ -46,7 +46,7 @@ void ZoneDatabase::ZDBInitVars() {
|
||||
ZoneDatabase::~ZoneDatabase() {
|
||||
unsigned int x;
|
||||
if (npc_spells_cache) {
|
||||
for (x=0; x<=npc_spells_maxid; x++) {
|
||||
for (x = 0; x <= npc_spells_maxid; x++) {
|
||||
safe_delete_array(npc_spells_cache[x]);
|
||||
}
|
||||
safe_delete_array(npc_spells_cache);
|
||||
@ -54,7 +54,7 @@ ZoneDatabase::~ZoneDatabase() {
|
||||
safe_delete_array(npc_spells_loadtried);
|
||||
|
||||
if (npc_spellseffects_cache) {
|
||||
for (x=0; x<=npc_spellseffects_maxid; x++) {
|
||||
for (x = 0; x <= npc_spellseffects_maxid; x++) {
|
||||
safe_delete_array(npc_spellseffects_cache[x]);
|
||||
}
|
||||
safe_delete_array(npc_spellseffects_cache);
|
||||
@ -62,7 +62,7 @@ ZoneDatabase::~ZoneDatabase() {
|
||||
safe_delete_array(npc_spellseffects_loadtried);
|
||||
|
||||
if (faction_array != nullptr) {
|
||||
for (x=0; x <= max_faction; x++) {
|
||||
for (x = 0; x <= max_faction; x++) {
|
||||
if (faction_array[x] != 0)
|
||||
safe_delete(faction_array[x]);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "../common/faction.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "aa_ability.h"
|
||||
#include "event_codes.h"
|
||||
|
||||
class Client;
|
||||
class Corpse;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user