Merge fix

This commit is contained in:
KimLS
2019-03-10 00:48:48 -08:00
16 changed files with 1968 additions and 506 deletions
+7 -2
View File
@@ -17,6 +17,7 @@ SET(zone_sources
client_mods.cpp
client_packet.cpp
client_process.cpp
console.cpp
command.cpp
corpse.cpp
data_bucket.cpp
@@ -28,6 +29,7 @@ SET(zone_sources
embxs.cpp
encounter.cpp
entity.cpp
eqemu_api_zone_data_service.cpp
exp.cpp
fastmath.cpp
fearpath.cpp
@@ -140,7 +142,8 @@ SET(zone_sources
zone.cpp
zone_config.cpp
zonedb.cpp
zoning.cpp)
zoning.cpp
)
SET(zone_headers
aa.h
@@ -157,14 +160,16 @@ SET(zone_headers
client_packet.h
command.h
common.h
console.h
corpse.h
data_bucket.h
data_bucket.h
doors.h
embparser.h
embperl.h
embxs.h
encounter.h
entity.h
eqemu_api_zone_data_service.h
errmsg.h
event_codes.h
fastmath.h
+122
View File
@@ -0,0 +1,122 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#include "console.h"
#include "../common/string_util.h"
#include "../common/md5.h"
#include "../common/database.h"
#include "../common/json/json.h"
#include "zone.h"
#include "npc.h"
#include "entity.h"
#include "eqemu_api_zone_data_service.h"
/**
* @param username
* @param password
* @return
*/
struct EQ::Net::ConsoleLoginStatus CheckLogin(const std::string &username, const std::string &password)
{
struct EQ::Net::ConsoleLoginStatus ret;
ret.account_id = database.CheckLogin(username.c_str(), password.c_str());
if (ret.account_id == 0) {
return ret;
}
char account_name[64];
database.GetAccountName(static_cast<uint32>(ret.account_id), account_name);
ret.account_name = account_name;
ret.status = database.CheckStatus(static_cast<uint32>(ret.account_id));
return ret;
}
/**
* @param connection
* @param command
* @param args
*/
void ConsoleApi(
EQ::Net::ConsoleServerConnection *connection,
const std::string &command,
const std::vector<std::string> &args
)
{
Json::Value root;
Json::Value response;
BenchTimer timer;
timer.reset();
EQEmuApiZoneDataService::get(response, args);
std::string method = args[0];
root["execution_time"] = std::to_string(timer.elapsed());
root["method"] = method;
root["data"] = response;
std::stringstream payload;
payload << root;
connection->SendLine(payload.str());
}
/**
*
* @param connection
* @param command
* @param args
*/
void ConsoleNull(
EQ::Net::ConsoleServerConnection *connection,
const std::string &command,
const std::vector<std::string> &args
)
{
}
/**
* @param connection
* @param command
* @param args
*/
void ConsoleQuit(
EQ::Net::ConsoleServerConnection *connection,
const std::string &command,
const std::vector<std::string> &args
)
{
connection->SendLine("Exiting...");
connection->Close();
}
/**
* @param console
*/
void RegisterConsoleFunctions(std::unique_ptr<EQ::Net::ConsoleServer> &console)
{
console->RegisterLogin(std::bind(CheckLogin, std::placeholders::_1, std::placeholders::_2));
console->RegisterCall("api", 200, "api", std::bind(ConsoleApi, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("ping", 50, "ping", std::bind(ConsoleNull, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("quit", 50, "quit", std::bind(ConsoleQuit, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("exit", 50, "exit", std::bind(ConsoleQuit, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
}
+25
View File
@@ -0,0 +1,25 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2018 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#pragma once
#include "../common/net/console_server.h"
void RegisterConsoleFunctions(std::unique_ptr<EQ::Net::ConsoleServer> &console);
+678
View File
@@ -0,0 +1,678 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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
*
*/
#include "client.h"
#include "entity.h"
#include "corpse.h"
#include "eqemu_api_zone_data_service.h"
#include "npc.h"
#include "object.h"
#include "zone.h"
#include "doors.h"
#include <iostream>
extern Zone *zone;
void callGetNpcListDetail(Json::Value &response)
{
auto &list = entity_list.GetNPCList();
for (auto &iter : list) {
auto npc = iter.second;
Json::Value row;
/**
* Main
*/
row["id"] = npc->GetID();
row["clean_name"] = npc->GetCleanName();
row["x"] = npc->GetX();
row["y"] = npc->GetY();
row["z"] = npc->GetZ();
row["heading"] = npc->GetHeading();
/**
* Rest
*/
row["accuracy_rating"] = npc->GetAccuracyRating();
row["ai_has_spells"] = npc->AI_HasSpells();
row["ai_has_spells_effects"] = npc->AI_HasSpellsEffects();
row["ammo_id_file"] = npc->GetAmmoIDfile();
row["attack_delay"] = npc->GetAttackDelay();
row["attack_speed"] = npc->GetAttackSpeed();
row["avoidance_rating"] = npc->GetAvoidanceRating();
row["base_damage"] = npc->GetBaseDamage();
row["combat_event"] = npc->GetCombatEvent();
row["copper"] = npc->GetCopper();
row["count_loot"] = npc->CountLoot();
row["drops_global_loot"] = npc->DropsGlobalLoot();
row["gold"] = npc->GetGold();
row["grid"] = npc->GetGrid();
row["has_private_corpse"] = npc->HasPrivateCorpse();
row["is_animal"] = npc->IsAnimal();
row["is_guarding"] = npc->IsGuarding();
row["is_ldon_locked"] = npc->IsLDoNLocked();
row["is_ldon_trap_detected"] = npc->IsLDoNTrapDetected();
row["is_ldon_trapped"] = npc->IsLDoNTrapped();
row["is_merchant_open"] = npc->IsMerchantOpen();
row["is_not_targetable_with_hotkey"] = npc->IsNotTargetableWithHotkey();
row["is_proximity_set"] = npc->IsProximitySet();
row["is_taunting"] = npc->IsTaunting();
row["ldon_locked_skill"] = npc->GetLDoNLockedSkill();
row["ldon_trap_spell_id"] = npc->GetLDoNTrapSpellID();
row["ldon_trap_type"] = npc->GetLDoNTrapType();
row["loottable_id"] = npc->GetLoottableID();
row["max_dmg"] = npc->GetMaxDMG();
row["max_wp"] = npc->GetMaxWp();
row["min_damage"] = npc->GetMinDamage();
row["min_dmg"] = npc->GetMinDMG();
row["npc_spells_effects_id"] = npc->GetNPCSpellsEffectsID();
row["npc_spells_id"] = npc->GetNPCSpellsID();
row["npchp_regen"] = npc->GetNPCHPRegen();
row["num_merc_types"] = npc->GetNumMercTypes();
row["num_mercs"] = npc->GetNumMercs();
row["number_of_attacks"] = npc->GetNumberOfAttacks();
row["pet_spell_id"] = npc->GetPetSpellID();
row["platinum"] = npc->GetPlatinum();
row["prim_skill"] = npc->GetPrimSkill();
if (npc->IsProximitySet()) {
row["proximity_max_x"] = npc->GetProximityMaxX();
row["proximity_max_y"] = npc->GetProximityMaxY();
row["proximity_max_z"] = npc->GetProximityMaxZ();
row["proximity_min_x"] = npc->GetProximityMinX();
row["proximity_min_y"] = npc->GetProximityMinY();
row["proximity_min_z"] = npc->GetProximityMinZ();
}
row["ranged_skill"] = npc->GetRangedSkill();
row["raw_ac"] = npc->GetRawAC();
row["sec_skill"] = npc->GetSecSkill();
row["silver"] = npc->GetSilver();
row["slow_mitigation"] = npc->GetSlowMitigation();
row["sp2"] = npc->GetSp2();
row["swarm_owner"] = npc->GetSwarmOwner();
row["swarm_target"] = npc->GetSwarmTarget();
row["waypoint_max"] = npc->GetWaypointMax();
row["will_aggro_npcs"] = npc->WillAggroNPCs();
response.append(row);
}
}
void callGetDoorListDetail(Json::Value &response)
{
auto &door_list = entity_list.GetDoorsList();
for (auto itr : door_list) {
Doors *door = itr.second;
Json::Value row;
row["door_name"] = door->GetDoorName();
row["client_version_mask"] = door->GetClientVersionMask();
row["disable_timer"] = door->GetDisableTimer();
row["door_db_id"] = door->GetDoorDBID();
row["door_id"] = door->GetDoorID();
row["door_param"] = door->GetDoorParam();
row["entity_id"] = door->GetEntityID();
row["guild_id"] = door->GetGuildID();
row["incline"] = door->GetIncline();
row["invert_state"] = door->GetInvertState();
row["is_door"] = door->IsDoor();
row["is_door_open"] = door->IsDoorOpen();
row["is_ldon_door"] = door->IsLDoNDoor();
row["key_item"] = door->GetKeyItem();
row["lockpick"] = door->GetLockpick();
row["no_keyring"] = door->GetNoKeyring();
row["open_type"] = door->GetOpenType();
row["size"] = door->GetSize();
row["trigger_door_id"] = door->GetTriggerDoorID();
row["trigger_type"] = door->GetTriggerType();
row["x"] = door->GetX();
row["y"] = door->GetY();
row["z"] = door->GetZ();
response.append(row);
}
}
void callGetCorpseListDetail(Json::Value &response)
{
auto &corpse_list = entity_list.GetCorpseList();
for (auto itr : corpse_list) {
auto corpse = itr.second;
Json::Value row;
row["char_id"] = corpse->GetCharID();
row["copper"] = corpse->GetCopper();
row["corpse_dbid"] = corpse->GetCorpseDBID();
row["count_items"] = corpse->CountItems();
row["decay_time"] = corpse->GetDecayTime();
row["gold"] = corpse->GetGold();
row["is_become_npc_corpse"] = corpse->IsBecomeNPCCorpse();
row["is_being_looted"] = corpse->IsBeingLooted();
row["is_corpse"] = corpse->IsCorpse();
row["is_locked"] = corpse->IsLocked();
row["is_npc_corpse"] = corpse->IsNPCCorpse();
row["is_player_corpse"] = corpse->IsPlayerCorpse();
row["is_rezzed"] = corpse->IsRezzed();
row["owner_name"] = corpse->GetOwnerName();
row["platinum"] = corpse->GetPlatinum();
row["player_kill_item"] = corpse->GetPlayerKillItem();
row["rez_exp"] = corpse->GetRezExp();
row["rez_time"] = corpse->GetRezTime();
row["silver"] = corpse->GetSilver();
response.append(row);
}
}
void callGetObjectListDetail(Json::Value &response)
{
auto &list = entity_list.GetObjectList();
for (auto &iter : list) {
auto object = iter.second;
Json::Value row;
row["display_name"] = object->GetDisplayName();
row["dbid"] = object->GetDBID();
row["heading_data"] = object->GetHeadingData();
row["icon"] = object->GetIcon();
row["is_ground_spawn"] = object->IsGroundSpawn();
row["item_id"] = object->GetItemID();
row["model_name"] = object->GetModelName();
row["size"] = object->GetSize();
row["solid_type"] = object->GetSolidType();
row["tilt_x"] = object->GetTiltX();
row["tilt_y"] = object->GetTiltY();
row["type"] = object->GetType();
row["x"] = object->GetX();
row["y"] = object->GetY();
row["z"] = object->GetZ();
response.append(row);
}
}
void callGetMobListDetail(Json::Value &response)
{
auto &list = entity_list.GetMobList();
for (auto &iter : list) {
auto mob = iter.second;
Json::Value row;
/**
* Main
*/
row["id"] = mob->GetID();
row["clean_name"] = mob->GetCleanName();
row["x"] = mob->GetX();
row["y"] = mob->GetY();
row["z"] = mob->GetZ();
row["heading"] = mob->GetHeading();
/**
* Rest
*/
row["ac"] = mob->GetAC();
row["ac_softcap"] = mob->GetACSoftcap();
row["ac_sum"] = mob->ACSum();
row["active_light_type"] = mob->GetActiveLightType();
row["aggro_range"] = mob->GetAggroRange();
row["allow_beneficial"] = mob->GetAllowBeneficial();
row["animation"] = mob->GetAnimation();
row["assist_range"] = mob->GetAssistRange();
row["aura_slots"] = mob->GetAuraSlots();
row["base_fear_speed"] = mob->GetBaseFearSpeed();
row["base_runspeed"] = mob->GetBaseRunspeed();
row["base_size"] = mob->GetBaseSize();
row["base_walkspeed"] = mob->GetBaseWalkspeed();
row["beard"] = mob->GetBeard();
row["beard_color"] = mob->GetBeardColor();
row["best_melee_skill"] = mob->GetBestMeleeSkill();
row["calc_fear_resist_chance"] = mob->CalcFearResistChance();
row["calc_resist_chance_bonus"] = mob->CalcResistChanceBonus();
row["can_block_spell"] = mob->CanBlockSpell();
row["can_facestab"] = mob->CanFacestab();
row["casted_spell_inv_slot"] = mob->GetCastedSpellInvSlot();
row["casting_spell_id"] = mob->CastingSpellID();
row["charmed"] = mob->Charmed();
row["check_last_los_state"] = mob->CheckLastLosState();
row["class"] = mob->GetClass();
row["class_level_factor"] = mob->GetClassLevelFactor();
row["class_race_ac_bonus"] = mob->GetClassRaceACBonus();
row["compute_defense"] = mob->compute_defense();
row["count_dispellable_buffs"] = mob->CountDispellableBuffs();
row["cripp_blow_chance"] = mob->GetCrippBlowChance();
row["cur_wp"] = mob->GetCurWp();
row["cwp"] = mob->GetCWP();
row["cwpp"] = mob->GetCWPP();
row["divine_aura"] = mob->DivineAura();
row["do_casting_checks"] = mob->DoCastingChecks();
row["dont_buff_me_before"] = mob->DontBuffMeBefore();
row["dont_cure_me_before"] = mob->DontCureMeBefore();
row["dont_dot_me_before"] = mob->DontDotMeBefore();
row["dont_heal_me_before"] = mob->DontHealMeBefore();
row["dont_root_me_before"] = mob->DontRootMeBefore();
row["dont_snare_me_before"] = mob->DontSnareMeBefore();
row["drakkin_details"] = mob->GetDrakkinDetails();
row["drakkin_heritage"] = mob->GetDrakkinHeritage();
row["drakkin_tattoo"] = mob->GetDrakkinTattoo();
row["emote_id"] = mob->GetEmoteID();
row["equipment_light_type"] = mob->GetEquipmentLightType();
row["eye_color1"] = mob->GetEyeColor1();
row["eye_color2"] = mob->GetEyeColor2();
row["fear_speed"] = mob->GetFearSpeed();
row["flurry_chance"] = mob->GetFlurryChance();
row["follow_can_run"] = mob->GetFollowCanRun();
row["follow_distance"] = mob->GetFollowDistance();
row["follow_id"] = mob->GetFollowID();
row["gender"] = mob->GetGender();
row["hair_color"] = mob->GetHairColor();
row["hair_style"] = mob->GetHairStyle();
row["has_active_song"] = mob->HasActiveSong();
row["has_assist_aggro"] = mob->HasAssistAggro();
row["has_died"] = mob->HasDied();
row["has_disc_buff"] = mob->HasDiscBuff();
row["has_endur_upkeep"] = mob->HasEndurUpkeep();
row["has_free_aura_slots"] = mob->HasFreeAuraSlots();
row["has_free_trap_slots"] = mob->HasFreeTrapSlots();
row["has_mgb"] = mob->HasMGB();
row["has_numhits"] = mob->HasNumhits();
row["has_pet"] = mob->HasPet();
row["has_pet_affinity"] = mob->HasPetAffinity();
row["has_primary_aggro"] = mob->HasPrimaryAggro();
row["has_project_illusion"] = mob->HasProjectIllusion();
row["has_projectile_attack"] = mob->HasProjectileAttack();
row["has_shield_equiped"] = mob->HasShieldEquiped();
row["has_special_abilities"] = mob->HasSpecialAbilities();
row["has_tar_reflection"] = mob->HasTargetReflection();
row["has_temp_pets_active"] = mob->HasTempPetsActive();
row["has_two_hand_blunt_equiped"] = mob->HasTwoHandBluntEquiped();
row["has_two_hander_equipped"] = mob->HasTwoHanderEquipped();
row["has_virus"] = mob->HasVirus();
row["hate_summon"] = mob->HateSummon();
row["helm_texture"] = mob->GetHelmTexture();
row["hp"] = mob->GetHP();
row["improved_taunt"] = mob->ImprovedTaunt();
row["innate_light_type"] = mob->GetInnateLightType();
row["is_ai_controlled"] = mob->IsAIControlled();
row["is_amnesiad"] = mob->IsAmnesiad();
row["is_animation"] = mob->IsAnimation();
row["is_blind"] = mob->IsBlind();
row["is_casting"] = mob->IsCasting();
row["is_charmed"] = mob->IsCharmed();
row["is_destructible_object"] = mob->IsDestructibleObject();
row["is_engaged"] = mob->IsEngaged();
row["is_enraged"] = mob->IsEnraged();
row["is_familiar"] = mob->IsFamiliar();
row["is_feared"] = mob->IsFeared();
row["is_findable"] = mob->IsFindable();
row["is_focused"] = mob->IsFocused();
row["is_g_held"] = mob->IsGHeld();
row["is_grouped"] = mob->IsGrouped();
row["is_held"] = mob->IsHeld();
row["is_looting"] = mob->IsLooting();
row["is_melee_disabled"] = mob->IsMeleeDisabled();
row["is_mezzed"] = mob->IsMezzed();
row["is_moved"] = mob->IsMoved();
row["is_moving"] = mob->IsMoving();
row["is_no_cast"] = mob->IsNoCast();
row["is_off_hand_atk"] = mob->IsOffHandAtk();
row["is_pet_owner_client"] = mob->IsPetOwnerClient();
row["is_pet_regroup"] = mob->IsPetRegroup();
row["is_pet_stop"] = mob->IsPetStop();
row["is_pseudo_rooted"] = mob->IsPseudoRooted();
row["is_raid_grouped"] = mob->IsRaidGrouped();
row["is_rare_spawn"] = mob->IsRareSpawn();
row["is_roamer"] = mob->IsRoamer();
row["is_rooted"] = mob->IsRooted();
row["is_running"] = mob->IsRunning();
row["is_silenced"] = mob->IsSilenced();
row["is_stunned"] = mob->IsStunned();
row["is_tar_lock_pet"] = mob->IsTargetLockPet();
row["is_tarable"] = mob->IsTargetable();
row["is_tared"] = mob->IsTargeted();
row["is_temp_pet"] = mob->IsTempPet();
row["is_trackable"] = mob->IsTrackable();
row["item_hp_bonuses"] = mob->GetItemHPBonuses();
row["last_name"] = mob->GetLastName();
row["level"] = mob->GetLevel();
row["luclin_face"] = mob->GetLuclinFace();
row["mana"] = mob->GetMana();
row["mana_percent"] = mob->GetManaPercent();
row["mana_ratio"] = mob->GetManaRatio();
row["max_hp"] = mob->GetMaxHP();
row["max_mana"] = mob->GetMaxMana();
row["melee_mitigation"] = mob->GetMeleeMitigation();
row["mitigation_ac"] = mob->GetMitigationAC();
row["movespeed"] = mob->GetMovespeed();
row["name"] = mob->GetName();
row["next_hp_event"] = mob->GetNextHPEvent();
row["next_inc_hp_event"] = mob->GetNextIncHPEvent();
row["npc_assist_cap"] = mob->NPCAssistCap();
row["npc_type_id"] = mob->GetNPCTypeID();
row["orig_level"] = mob->GetOrigLevel();
row["orig_name"] = mob->GetOrigName();
row["owner_id"] = mob->GetOwnerID();
row["pet_id"] = mob->GetPetID();
row["pet_power"] = mob->GetPetPower();
row["pet_tar_lock_id"] = mob->GetPetTargetLockID();
row["qglobal"] = mob->GetQglobal();
row["race"] = mob->GetRace();
row["run_anim_speed"] = mob->GetRunAnimSpeed();
row["sanctuary"] = mob->Sanctuary();
row["see_hide"] = mob->SeeHide();
row["see_improved_hide"] = mob->SeeImprovedHide();
row["see_invisible"] = mob->SeeInvisible();
row["see_invisible_undead"] = mob->SeeInvisibleUndead();
row["size"] = mob->GetSize();
row["slow_mitigation"] = mob->GetSlowMitigation();
row["snared_amount"] = mob->GetSnaredAmount();
row["spawned"] = mob->Spawned();
row["spell_hp_bonuses"] = mob->GetSpellHPBonuses();
row["spell_light_type"] = mob->GetSpellLightType();
row["spell_power_distance_mod"] = mob->GetSpellPowerDistanceMod();
row["spell_x"] = mob->GetSpellX();
row["spell_y"] = mob->GetSpellY();
row["spell_z"] = mob->GetSpellZ();
row["tar_ring_x"] = mob->GetTargetRingX();
row["tar_ring_y"] = mob->GetTargetRingY();
row["tar_ring_z"] = mob->GetTargetRingZ();
row["temp_pet_count"] = mob->GetTempPetCount();
row["texture"] = mob->GetTexture();
row["trap_slots"] = mob->GetTrapSlots();
row["try_death_save"] = mob->TryDeathSave();
row["try_divine_save"] = mob->TryDivineSave();
row["try_spell_on_death"] = mob->TrySpellOnDeath();
row["update_active_light"] = mob->UpdateActiveLight();
row["wander_type"] = mob->GetWanderType();
response.append(row);
}
}
void callGetClientListDetail(Json::Value &response)
{
auto &list = entity_list.GetClientList();
for (auto &iter : list) {
auto client = iter.second;
Json::Value row;
/**
* Main
*/
row["id"] = client->GetID();
row["clean_name"] = client->GetCleanName();
row["x"] = client->GetX();
row["y"] = client->GetY();
row["z"] = client->GetZ();
row["heading"] = client->GetHeading();
/**
* Rest
*/
row["aa_percent"] = client->GetAAPercent();
row["aa_points"] = client->GetAAPoints();
row["aaxp"] = client->GetAAXP();
row["account_age"] = client->GetAccountAge();
row["account_creation"] = client->GetAccountCreation();
row["account_id"] = client->AccountID();
row["account_name"] = client->AccountName();
row["act_agi"] = client->GetActAGI();
row["act_cha"] = client->GetActCHA();
row["act_dex"] = client->GetActDEX();
row["act_int"] = client->GetActINT();
row["act_sta"] = client->GetActSTA();
row["act_str"] = client->GetActSTR();
row["act_wis"] = client->GetActWIS();
row["active_task_count"] = client->GetActiveTaskCount();
row["admin"] = client->Admin();
row["aggro_count"] = client->GetAggroCount();
row["aggro_meter_available"] = client->AggroMeterAvailable();
row["all_money"] = client->GetAllMoney();
row["anon"] = client->GetAnon();
row["atk_rating"] = client->GetATKRating();
row["auto_attack_enabled"] = client->AutoAttackEnabled();
row["auto_fire_enabled"] = client->AutoFireEnabled();
row["auto_split_enabled"] = client->AutoSplitEnabled();
row["base_agi"] = client->GetBaseAGI();
row["base_beard"] = client->GetBaseBeard();
row["base_beard_color"] = client->GetBaseBeardColor();
row["base_cha"] = client->GetBaseCHA();
row["base_class"] = client->GetBaseClass();
row["base_corrup"] = client->GetBaseCorrup();
row["base_details"] = client->GetBaseDetails();
row["base_dex"] = client->GetBaseDEX();
row["base_eye_color"] = client->GetBaseEyeColor();
row["base_face"] = client->GetBaseFace();
row["base_gender"] = client->GetBaseGender();
row["base_hair_color"] = client->GetBaseHairColor();
row["base_hair_style"] = client->GetBaseHairStyle();
row["base_heritage"] = client->GetBaseHeritage();
row["base_hp"] = client->GetBaseHP();
row["base_int"] = client->GetBaseINT();
row["base_ph_r"] = client->GetBasePhR();
row["base_race"] = client->GetBaseRace();
row["base_sta"] = client->GetBaseSTA();
row["base_str"] = client->GetBaseSTR();
row["base_tattoo"] = client->GetBaseTattoo();
row["base_wis"] = client->GetBaseWIS();
row["become_npc_level"] = client->GetBecomeNPCLevel();
row["boat_id"] = client->GetBoatID();
row["buyer_welcome_message"] = client->GetBuyerWelcomeMessage();
row["calc_atk"] = client->CalcATK();
row["calc_base_mana"] = client->CalcBaseMana();
row["calc_current_weight"] = client->CalcCurrentWeight();
row["calc_endurance_regen_cap"] = client->CalcEnduranceRegenCap();
row["calc_hp_regen_cap"] = client->CalcHPRegenCap();
row["calc_mana_regen_cap"] = client->CalcManaRegenCap();
row["calc_max_mana"] = client->CalcMaxMana();
row["can_fast_regen"] = client->CanFastRegen();
row["can_fish"] = client->CanFish();
row["can_med_on_horse"] = client->CanMedOnHorse();
row["carried_money"] = client->GetCarriedMoney();
row["char_max_level_from_bucket"] = client->GetCharMaxLevelFromBucket();
row["char_max_level_from_q_global"] = client->GetCharMaxLevelFromQGlobal();
row["character_id"] = client->CharacterID();
row["check_can_unsuspend_merc"] = client->CheckCanUnsuspendMerc();
row["check_double_attack"] = client->CheckDoubleAttack();
row["check_double_ranged_attack"] = client->CheckDoubleRangedAttack();
row["check_dual_wield"] = client->CheckDualWield();
row["check_trade_non_droppable"] = client->CheckTradeNonDroppable();
row["check_triple_attack"] = client->CheckTripleAttack();
row["client_max_level"] = client->GetClientMaxLevel();
row["client_version_bit"] = client->ClientVersionBit();
row["connected"] = client->Connected();
row["copper"] = client->GetCopper();
row["corpse_count"] = client->GetCorpseCount();
row["duel_tar"] = client->GetDuelTarget();
row["ebon_crystals"] = client->GetEbonCrystals();
row["endurance"] = client->GetEndurance();
row["endurance_percent"] = client->GetEndurancePercent();
row["exp"] = client->GetEXP();
row["face"] = client->GetFace();
row["feigned"] = client->GetFeigned();
row["gm"] = client->GetGM();
row["gm_speed"] = client->GetGMSpeed();
row["gold"] = client->GetGold();
row["group_exp"] = client->GetGroupEXP();
row["group_leadership_aa_health_enhancement"] = client->GroupLeadershipAAHealthEnhancement();
row["group_leadership_aa_health_regeneration"] = client->GroupLeadershipAAHealthRegeneration();
row["group_leadership_aa_mana_enhancement"] = client->GroupLeadershipAAManaEnhancement();
row["group_leadership_aa_offense_enhancement"] = client->GroupLeadershipAAOffenseEnhancement();
row["group_points"] = client->GetGroupPoints();
row["guild_id"] = client->GuildID();
row["guild_rank"] = client->GuildRank();
row["has_adventure_data"] = client->HasAdventureData();
row["hide_me"] = client->GetHideMe();
row["horse_id"] = client->GetHorseId();
row["hunger"] = client->GetHunger();
row["hungry"] = client->Hungry();
row["in_zone"] = client->InZone();
row["instance_id"] = client->GetInstanceID();
row["interrogate_inv_state"] = client->GetInterrogateInvState();
row["ip"] = client->GetIP();
row["is_become_npc"] = client->IsBecomeNPC();
row["is_buyer"] = client->IsBuyer();
row["is_dead"] = client->IsDead();
row["is_dragging_corpse"] = client->IsDraggingCorpse();
row["is_dueling"] = client->IsDueling();
row["is_guild_banker"] = client->IsGuildBanker();
row["is_hovering_for_respawn"] = client->IsHoveringForRespawn();
row["is_in_a_guild"] = client->IsInAGuild();
row["is_ld"] = client->IsLD();
row["is_leadership_exp_on"] = client->IsLeadershipEXPOn();
row["is_lfp"] = client->IsLFP();
row["is_medding"] = client->IsMedding();
row["is_on_adventure"] = client->IsOnAdventure();
row["is_rezz_pending"] = client->IsRezzPending();
row["is_sitting"] = client->IsSitting();
row["is_starved"] = client->IsStarved();
row["is_tracking"] = client->IsTracking();
row["is_trader"] = client->IsTrader();
row["is_unconscious"] = client->IsUnconscious();
row["ldon_losses"] = client->GetLDoNLosses();
row["ldon_wins"] = client->GetLDoNWins();
row["last_inv_snapshot_time"] = client->GetLastInvSnapshotTime();
row["last_name"] = client->GetLastName();
row["level2"] = client->GetLevel2();
row["level_regen"] = client->LevelRegen();
row["ls_account_id"] = client->LSAccountID();
row["max_endurance"] = client->GetMaxEndurance();
row["max_x_tars"] = client->GetMaxXTargets();
row["merc_id"] = client->GetMercID();
row["merc_only_or_no_group"] = client->MercOnlyOrNoGroup();
row["merc_slot"] = client->GetMercSlot();
row["next_inv_snapshot_time"] = client->GetNextInvSnapshotTime();
row["num_mercs"] = client->GetNumMercs();
row["pending_adventure_create"] = client->GetPendingAdventureCreate();
row["pending_adventure_door_click"] = client->GetPendingAdventureDoorClick();
row["pending_adventure_leave"] = client->GetPendingAdventureLeave();
row["pending_adventure_request"] = client->GetPendingAdventureRequest();
row["pending_guild_invitation"] = client->GetPendingGuildInvitation();
row["platinum"] = client->GetPlatinum();
row["port"] = client->GetPort();
row["primary_skill_value"] = client->GetPrimarySkillValue();
row["proximity_x"] = client->ProximityX();
row["proximity_y"] = client->ProximityY();
row["proximity_z"] = client->ProximityZ();
row["pvp_points"] = client->GetPVPPoints();
row["radiant_crystals"] = client->GetRadiantCrystals();
row["raid_exp"] = client->GetRaidEXP();
row["raid_points"] = client->GetRaidPoints();
row["raw_item_ac"] = client->GetRawItemAC();
row["required_aa_experience"] = client->GetRequiredAAExperience();
row["revoked"] = client->GetRevoked();
row["run_mode"] = client->GetRunMode();
row["save_currency"] = client->SaveCurrency();
row["save_task_state"] = client->SaveTaskState();
row["silver"] = client->GetSilver();
row["skill_points"] = client->GetSkillPoints();
row["spent_aa"] = client->GetSpentAA();
row["tgb"] = client->TGB();
row["thirst"] = client->GetThirst();
row["thirsty"] = client->Thirsty();
row["total_atk"] = client->GetTotalATK();
row["total_seconds_played"] = client->GetTotalSecondsPlayed();
row["weight"] = client->GetWeight();
row["wid"] = client->GetWID();
row["x_tarting_available"] = client->XTargettingAvailable();
response.append(row);
}
}
void callGetZoneAttributes(Json::Value &response)
{
Json::Value row;
row["aggro_limit_reached"] = zone->AggroLimitReached();
row["allow_mercs"] = zone->AllowMercs();
row["buff_timers_suspended"] = zone->BuffTimersSuspended();
row["can_bind"] = zone->CanBind();
row["can_cast_outdoor"] = zone->CanCastOutdoor();
row["can_do_combat"] = zone->CanDoCombat();
row["can_levitate"] = zone->CanLevitate();
row["count_auth"] = zone->CountAuth();
row["count_spawn2"] = zone->CountSpawn2();
row["file_name"] = zone->GetFileName();
row["graveyard_id"] = zone->graveyard_id();
row["graveyard_zoneid"] = zone->graveyard_zoneid();
row["has_graveyard"] = zone->HasGraveyard();
row["has_map"] = zone->HasMap();
row["has_water_map"] = zone->HasWaterMap();
row["has_weather"] = zone->HasWeather();
row["instance_id"] = zone->GetInstanceID();
row["instance_version"] = zone->GetInstanceVersion();
row["instant_grids"] = zone->InstantGrids();
row["is_city"] = zone->IsCity();
row["is_hotzone"] = zone->IsHotzone();
row["is_instance_persistent"] = zone->IsInstancePersistent();
row["is_pvp_zone"] = zone->IsPVPZone();
row["is_static_zone"] = zone->IsStaticZone();
row["is_ucs_server_available"] = zone->IsUCSServerAvailable();
row["long_name"] = zone->GetLongName();
row["max_clients"] = zone->GetMaxClients();
row["mobs_aggro_count"] = zone->MobsAggroCount();
row["save_zone_cfg"] = zone->SaveZoneCFG();
row["short_name"] = zone->GetShortName();
row["total_blocked_spells"] = zone->GetTotalBlockedSpells();
row["zone_id"] = zone->GetZoneID();
row["zone_type"] = zone->GetZoneType();
response.append(row);
}
void EQEmuApiZoneDataService::get(Json::Value &response, const std::vector<std::string> &args)
{
std::string method = args[0];
if (method == "get_npc_list_detail") {
callGetNpcListDetail(response);
}
if (method == "get_client_list_detail") {
callGetClientListDetail(response);
}
if (method == "get_mob_list_detail") {
callGetMobListDetail(response);
}
if (method == "get_door_list_detail") {
callGetDoorListDetail(response);
}
if (method == "get_corpse_list_detail") {
callGetCorpseListDetail(response);
}
if (method == "get_object_list_detail") {
callGetObjectListDetail(response);
}
if (method == "get_zone_attributes") {
callGetZoneAttributes(response);
}
}
+32
View File
@@ -0,0 +1,32 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* 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_API_ZONE_DATA_SERVICE_H
#define EQEMU_API_ZONE_DATA_SERVICE_H
#include "../common/json/json.h"
class EQEmuApiZoneDataService {
public:
static void get(Json::Value &response, const std::vector<std::string> &args);
};
#endif //EQEMU_API_ZONE_DATA_SERVICE_H
+33 -3
View File
@@ -68,6 +68,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/event/event_loop.h"
#include "../common/event/timer.h"
#include "../common/net/eqstream.h"
#include "../common/net/servertalk_server.h"
#include <iostream>
#include <string>
@@ -91,6 +92,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#else
#include <pthread.h>
#include "../common/unix.h"
#include "../common/net/console_server.h"
#include "console.h"
#endif
volatile bool RunLoops = true;
@@ -447,24 +451,50 @@ int main(int argc, char** argv) {
Log(Logs::Detail, Logs::None, "Main thread running with thread id %d", pthread_self());
#endif
bool worldwasconnected = worldserver.Connected();
bool eqsf_open = false;
bool telnet_server_opened = false;
Timer quest_timers(100);
UpdateWindowTitle();
bool worldwasconnected = worldserver.Connected();
std::shared_ptr<EQStreamInterface> eqss;
EQStreamInterface *eqsi;
bool eqsf_open = false;
std::unique_ptr<EQ::Net::EQStreamManager> eqsm;
std::chrono::time_point<std::chrono::system_clock> frame_prev = std::chrono::system_clock::now();
std::unique_ptr<EQ::Net::ConsoleServer> console;
auto loop_fn = [&](EQ::Timer* t) {
//Advance the timer to our current point in time
Timer::SetCurrentTime();
//Calculate frame time
/**
* Calculate frame time
*/
std::chrono::time_point<std::chrono::system_clock> frame_now = std::chrono::system_clock::now();
frame_time = std::chrono::duration_cast<std::chrono::duration<double>>(frame_now - frame_prev).count();
frame_prev = frame_now;
/**
* Telnet server
*/
if (!telnet_server_opened && Config->ZonePort != 0) {
if (Config->TelnetEnabled) {
Log(
Logs::General,
Logs::Zone_Server,
"Telnet Console (TCP) listener started (%s:%u).",
Config->TelnetIP.c_str(),
Config->ZonePort
);
console.reset(new EQ::Net::ConsoleServer(Config->TelnetIP, Config->ZonePort));
RegisterConsoleFunctions(console);
telnet_server_opened = true;
}
}
/**
* EQStreamManager
*/
if (!eqsf_open && Config->ZonePort != 0) {
Log(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d", Config->ZonePort);
-27
View File
@@ -1834,33 +1834,6 @@ void Zone::ShowSpawnStatusByID(Mob* client, uint32 spawnid)
client->Message(0, "No matching spawn id was found in this zone.");
}
bool Zone::RemoveSpawnEntry(uint32 spawnid)
{
LinkedListIterator<Spawn2*> iterator(spawn2_list);
iterator.Reset();
while(iterator.MoreElements())
{
if(iterator.GetData()->GetID() == spawnid)
{
iterator.RemoveCurrent();
return true;
}
else
iterator.Advance();
}
return false;
}
bool Zone::RemoveSpawnGroup(uint32 in_id) {
if(spawn_group_list.RemoveSpawnGroup(in_id))
return true;
else
return false;
}
bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct *npcCorpseDecayTimes)
{
const std::string query =
+265 -264
View File
@@ -31,32 +31,31 @@
#include "pathfinder_interface.h"
#include "global_loot_manager.h"
struct ZonePoint
{
float x;
float y;
float z;
float heading;
struct ZonePoint {
float x;
float y;
float z;
float heading;
uint16 number;
float target_x;
float target_y;
float target_z;
float target_heading;
float target_x;
float target_y;
float target_z;
float target_heading;
uint16 target_zone_id;
int32 target_zone_instance;
int32 target_zone_instance;
uint32 client_version_mask;
};
struct ZoneClientAuth_Struct {
uint32 ip; // client's IP address
uint32 wid; // client's WorldID#
uint32 accid;
int16 admin;
uint32 charid;
bool tellsoff;
char charname[64];
char lskey[30];
bool stale;
uint32 ip; // client's IP address
uint32 wid; // client's WorldID#
uint32 accid;
int16 admin;
uint32 charid;
bool tellsoff;
char charname[64];
char lskey[30];
bool stale;
};
struct ZoneEXPModInfo {
@@ -65,11 +64,11 @@ struct ZoneEXPModInfo {
};
struct item_tick_struct {
uint32 itemid;
uint32 chance;
uint32 level;
int16 bagslot;
std::string qglobal;
uint32 itemid;
uint32 chance;
uint32 level;
int16 bagslot;
std::string qglobal;
};
class Client;
@@ -81,290 +80,292 @@ struct NPCType;
struct ServerZoneIncomingClient_Struct;
class MobMovementManager;
class Zone
{
class Zone {
public:
static bool Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone = false);
static void Shutdown(bool quite = false);
Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name);
Zone(uint32 in_zoneid, uint32 in_instanceid, const char *in_short_name);
~Zone();
/* When zone has its own version of time */
bool is_zone_time_localized;
bool Init(bool iStaticZone);
bool LoadZoneCFG(const char* filename, uint16 instance_id);
bool SaveZoneCFG();
bool IsLoaded();
bool IsPVPZone() { return pvpzone; }
inline const char* GetLongName() { return long_name; }
inline const char* GetFileName() { return file_name; }
inline const char* GetShortName() { return short_name; }
inline const uint32 GetZoneID() const { return zoneid; }
inline const uint32 GetInstanceID() const { return instanceid; }
inline const uint16 GetInstanceVersion() const { return instanceversion; }
inline const bool IsInstancePersistent() const { return pers_instance; }
inline const uint8 GetZoneType() const { return zone_type; }
inline Timer* GetInstanceTimer() { return Instance_Timer; }
Timer spawn2_timer;
inline glm::vec3 GetSafePoint() { return m_SafePoint; }
inline const uint32& graveyard_zoneid() { return pgraveyard_zoneid; }
inline glm::vec4 GetGraveyardPoint() { return m_Graveyard; }
inline const uint32& graveyard_id() { return pgraveyard_id; }
inline const uint32& GetMaxClients() { return pMaxClients; }
//new AA
void LoadAlternateAdvancement();
AA::Ability *GetAlternateAdvancementAbility(int id);
AA::Ability *GetAlternateAdvancementAbilityByRank(int rank_id);
AA::Rank *GetAlternateAdvancementRank(int rank_id);
std::pair<AA::Ability*, AA::Rank*> GetAlternateAdvancementAbilityAndRank(int id, int points_spent);
void LoadZoneDoors(const char* zone, int16 version);
bool LoadZoneObjects();
bool LoadGroundSpawns();
void ReloadStaticData();
uint32 CountSpawn2();
ZonePoint* GetClosestZonePoint(const glm::vec3& location, const char* to_name, Client *client, float max_distance = 40000.0f);
ZonePoint* GetClosestZonePoint(const glm::vec3& location, uint32 to, Client *client, float max_distance = 40000.0f);
ZonePoint* GetClosestZonePointWithoutZone(float x, float y, float z, Client *client, float max_distance = 40000.0f);
SpawnGroupList spawn_group_list;
bool RemoveSpawnEntry(uint32 spawnid);
bool RemoveSpawnGroup(uint32 in_id);
bool Process();
void Despawn(uint32 spawngroupID);
bool Depop(bool StartSpawnTimer = false);
void Repop(uint32 delay = 0);
void RepopClose(const glm::vec4& client_position, uint32 repop_distance);
void ClearNPCTypeCache(int id);
void SpawnStatus(Mob* client);
void ShowEnabledSpawnStatus(Mob* client);
void ShowDisabledSpawnStatus(Mob* client);
void ShowSpawnStatusByID(Mob* client, uint32 spawnid);
void StartShutdownTimer(uint32 set_time = (RuleI(Zone, AutoShutdownDelay)));
void ChangeWeather();
bool HasWeather();
void AddAuth(ServerZoneIncomingClient_Struct* szic);
void RemoveAuth(const char* iCharName);
void ResetAuth();
bool GetAuth(uint32 iIP, const char* iCharName, uint32* oWID = 0, uint32* oAccID = 0, uint32* oCharID = 0, int16* oStatus = 0, char* oLSKey = 0, bool* oTellsOff = 0);
uint32 CountAuth();
void AddAggroMob() { aggroedmobs++; }
void DelAggroMob() { aggroedmobs--; }
bool AggroLimitReached() { return (aggroedmobs>10)?true:false; } // change this value, to allow more NPCs to autoaggro
int32 MobsAggroCount() { return aggroedmobs; }
inline bool InstantGrids() { return(!initgrids_timer.Enabled()); }
void SetStaticZone(bool sz) { staticzone = sz; }
inline bool IsStaticZone() { return staticzone; }
inline void SetZoneHasCurrentTime(bool time) { zone_has_current_time = time; }
void SpawnConditionChanged(const SpawnCondition &c, int16 old_value);
void GetMerchantDataForZoneLoad();
void LoadNewMerchantData(uint32 merchantid);
void LoadTempMerchantData();
uint32 GetTempMerchantQuantity(uint32 NPCID, uint32 Slot);
int SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold=false);
void LoadMercTemplates();
void LoadMercSpells();
void LoadLevelEXPMods();
MercTemplate* GetMercTemplate( uint32 template_id );
void SetInstanceTimer(uint32 new_duration);
void LoadLDoNTraps();
void LoadLDoNTrapEntries();
void LoadAdventureFlavor();
std::map<uint32,NPCType *> npctable;
std::map<uint32,NPCType *> merctable;
std::map<uint32,std::list<MerchantList> > merchanttable;
std::map<uint32,std::list<TempMerchantList> > tmpmerchanttable;
std::map<uint32,std::string> adventure_entry_list_flavor;
std::map<uint32,LDoNTrapTemplate*> ldon_trap_list;
std::map<uint32,std::list<LDoNTrapTemplate*> > ldon_trap_entry_list;
std::map<uint32,std::list<MercStanceInfo> > merc_stance_list;
std::map<uint32, MercTemplate> merc_templates;
std::map<uint32,std::list<MercSpellEntry> > merc_spells_list;
std::map<uint32, ZoneEXPModInfo> level_exp_mod;
std::list<InternalVeteranReward> VeteranRewards;
std::list<AltCurrencyDefinition_Struct> AlternateCurrencies;
char *adv_data;
bool is_zone_time_localized;
bool AggroLimitReached() { return (aggroedmobs > 10) ? true : false; }
bool AllowMercs() const { return (allow_mercs); }
bool CanBind() const { return (can_bind); }
bool CanCastOutdoor() const { return (can_castoutdoor); } //qadar
bool CanDoCombat() const { return (can_combat); }
bool CanLevitate() const { return (can_levitate); } // Magoth78
bool Depop(bool StartSpawnTimer = false);
bool did_adventure_actions;
bool GetAuth(
uint32 iIP,
const char *iCharName,
uint32 *oWID = 0,
uint32 *oAccID = 0,
uint32 *oCharID = 0,
int16 *oStatus = 0,
char *oLSKey = 0,
bool *oTellsOff = 0
);
bool HasGraveyard();
bool HasWeather();
bool Init(bool iStaticZone);
bool IsCity() const { return (is_city); }
bool IsHotzone() const { return (is_hotzone); }
bool IsLoaded();
bool IsPVPZone() { return pvpzone; }
bool IsSpellBlocked(uint32 spell_id, const glm::vec3 &location);
bool IsUCSServerAvailable() { return m_ucss_available; }
bool LoadGroundSpawns();
bool LoadZoneCFG(const char *filename, uint16 instance_id);
bool LoadZoneObjects();
bool Process();
bool SaveZoneCFG();
//new AA
std::unordered_map<int, std::unique_ptr<AA::Ability>> aa_abilities;
std::unordered_map<int, std::unique_ptr<AA::Rank>> aa_ranks;
char *adv_data;
void DoAdventureCountIncrease();
void DoAdventureAssassinationCountIncrease();
void DoAdventureActions();
void LoadVeteranRewards();
void LoadAlternateCurrencies();
void LoadNPCEmotes(LinkedList<NPC_Emote_Struct*>* NPCEmoteList);
void ReloadWorld(uint32 Option);
void ReloadMerchants();
const char *GetSpellBlockedMessage(uint32 spell_id, const glm::vec3 &location);
Map *zonemap;
WaterMap *watermap;
IPathfinder *pathing;
NewZone_Struct newzone_data;
EQEmu::Random random;
EQTime zone_time;
SpawnConditionManager spawn_conditions;
ZonePoint *GetClosestZonePoint(const glm::vec3 &location, const char *to_name, Client *client, float max_distance = 40000.0f);
EQTime zone_time;
void GetTimeSync();
void SetDate(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute);
void SetTime(uint8 hour, uint8 minute, bool update_world = true);
void weatherSend(Client* client = nullptr);
bool CanBind() const { return(can_bind); }
bool IsCity() const { return(is_city); }
bool CanDoCombat() const { return(can_combat); }
bool CanLevitate() const {return(can_levitate); } // Magoth78
bool CanCastOutdoor() const {return(can_castoutdoor);} //qadar
bool AllowMercs() const {return(allow_mercs);}
bool IsHotzone() const { return(is_hotzone); }
inline bool BuffTimersSuspended() const { return newzone_data.SuspendBuffs != 0; };
time_t weather_timer;
uint8 weather_intensity;
uint8 zone_weather;
uint8 loglevelvar;
uint8 merchantvar;
uint8 tradevar;
uint8 lootvar;
bool HasGraveyard();
void SetGraveyard(uint32 zoneid, const glm::vec4& graveyardPosition);
void LoadBlockedSpells(uint32 zoneid);
void ClearBlockedSpells();
bool IsSpellBlocked(uint32 spell_id, const glm::vec3& location);
const char *GetSpellBlockedMessage(uint32 spell_id, const glm::vec3& location);
int GetTotalBlockedSpells() { return totalBS; }
inline bool BuffTimersSuspended() const { return newzone_data.SuspendBuffs != 0; };
inline bool HasMap() { return zonemap != nullptr; }
inline bool HasWaterMap() { return watermap != nullptr; }
QGlobalCache *GetQGlobals() { return qGlobals; }
QGlobalCache *CreateQGlobals() { qGlobals = new QGlobalCache(); return qGlobals; }
void UpdateQGlobal(uint32 qid, QGlobal newGlobal);
void DeleteQGlobal(std::string name, uint32 npcID, uint32 charID, uint32 zoneID);
LinkedList<Spawn2*> spawn2_list;
LinkedList<ZonePoint*> zone_point_list;
uint32 numzonepoints;
LinkedList<NPC_Emote_Struct*> NPCEmoteList;
void LoadTickItems();
uint32 GetSpawnKillCount(uint32 in_spawnid);
void UpdateHotzone();
std::unordered_map<int, item_tick_struct> tick_items;
inline bool InstantGrids() { return (!initgrids_timer.Enabled()); }
inline bool IsStaticZone() { return staticzone; }
inline const bool IsInstancePersistent() const { return pers_instance; }
inline const char *GetFileName() { return file_name; }
inline const char *GetLongName() { return long_name; }
inline const char *GetShortName() { return short_name; }
inline const uint8 GetZoneType() const { return zone_type; }
inline const uint16 GetInstanceVersion() const { return instanceversion; }
inline const uint32 &GetMaxClients() { return pMaxClients; }
inline const uint32 &graveyard_id() { return pgraveyard_id; }
inline const uint32 &graveyard_zoneid() { return pgraveyard_zoneid; }
inline const uint32 GetInstanceID() const { return instanceid; }
inline const uint32 GetZoneID() const { return zoneid; }
inline glm::vec3 GetSafePoint() { return m_SafePoint; }
inline glm::vec4 GetGraveyardPoint() { return m_Graveyard; }
inline std::vector<int> GetGlobalLootTables(NPC *mob) const { return m_global_loot.GetGlobalLootTables(mob); }
inline Timer *GetInstanceTimer() { return Instance_Timer; }
inline void AddGlobalLootEntry(GlobalLootEntry &in) { return m_global_loot.AddEntry(in); }
inline void ShowZoneGlobalLoot(Client *to) { m_global_loot.ShowZoneGlobalLoot(to); }
inline void SetZoneHasCurrentTime(bool time) { zone_has_current_time = time; }
inline void ShowNPCGlobalLoot(Client *to, NPC *who) { m_global_loot.ShowNPCGlobalLoot(to, who); }
inline void ShowZoneGlobalLoot(Client *to) { m_global_loot.ShowZoneGlobalLoot(to); }
int GetTotalBlockedSpells() { return totalBS; }
int SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold = false);
int32 MobsAggroCount() { return aggroedmobs; }
IPathfinder *pathing;
LinkedList<NPC_Emote_Struct *> NPCEmoteList;
LinkedList<Spawn2 *> spawn2_list;
LinkedList<ZonePoint *> zone_point_list;
Map *zonemap;
MercTemplate *GetMercTemplate(uint32 template_id);
NewZone_Struct newzone_data;
QGlobalCache *CreateQGlobals()
{
qGlobals = new QGlobalCache();
return qGlobals;
}
QGlobalCache *GetQGlobals() { return qGlobals; }
SpawnConditionManager spawn_conditions;
SpawnGroupList spawn_group_list;
std::list<AltCurrencyDefinition_Struct> AlternateCurrencies;
std::list<InternalVeteranReward> VeteranRewards;
std::map<uint32, LDoNTrapTemplate *> ldon_trap_list;
std::map<uint32, MercTemplate> merc_templates;
std::map<uint32, NPCType *> merctable;
std::map<uint32, NPCType *> npctable;
std::map<uint32, std::list<LDoNTrapTemplate *> > ldon_trap_entry_list;
std::map<uint32, std::list<MerchantList> > merchanttable;
std::map<uint32, std::list<MercSpellEntry> > merc_spells_list;
std::map<uint32, std::list<MercStanceInfo> > merc_stance_list;
std::map<uint32, std::list<TempMerchantList> > tmpmerchanttable;
std::map<uint32, std::string> adventure_entry_list_flavor;
std::map<uint32, ZoneEXPModInfo> level_exp_mod;
std::pair<AA::Ability *, AA::Rank *> GetAlternateAdvancementAbilityAndRank(int id, int points_spent);
std::unordered_map<int, item_tick_struct> tick_items;
std::unordered_map<int, std::unique_ptr<AA::Ability>> aa_abilities;
std::unordered_map<int, std::unique_ptr<AA::Rank>> aa_ranks;
time_t weather_timer;
Timer spawn2_timer;
uint8 weather_intensity;
uint8 zone_weather;
uint8 loglevelvar;
uint8 lootvar;
uint8 merchantvar;
uint8 tradevar;
uint32 numzonepoints;
uint32 CountAuth();
uint32 CountSpawn2();
uint32 GetSpawnKillCount(uint32 in_spawnid);
uint32 GetTempMerchantQuantity(uint32 NPCID, uint32 Slot);
void AddAggroMob() { aggroedmobs++; }
void AddAuth(ServerZoneIncomingClient_Struct *szic);
void ChangeWeather();
void ClearBlockedSpells();
void ClearNPCTypeCache(int id);
void DelAggroMob() { aggroedmobs--; }
void DeleteQGlobal(std::string name, uint32 npcID, uint32 charID, uint32 zoneID);
void Despawn(uint32 spawngroupID);
void DoAdventureActions();
void DoAdventureAssassinationCountIncrease();
void DoAdventureCountIncrease();
void GetMerchantDataForZoneLoad();
void GetTimeSync();
void LoadAdventureFlavor();
void LoadAlternateAdvancement();
void LoadAlternateCurrencies();
void LoadBlockedSpells(uint32 zoneid);
void LoadLDoNTrapEntries();
void LoadLDoNTraps();
void LoadLevelEXPMods();
void LoadMercSpells();
void LoadMercTemplates();
void LoadNewMerchantData(uint32 merchantid);
void LoadNPCEmotes(LinkedList<NPC_Emote_Struct *> *NPCEmoteList);
void LoadTempMerchantData();
void LoadTickItems();
void LoadVeteranRewards();
void LoadZoneDoors(const char *zone, int16 version);
void ReloadStaticData();
void ReloadWorld(uint32 Option);
void RemoveAuth(const char *iCharName);
void Repop(uint32 delay = 0);
void RepopClose(const glm::vec4 &client_position, uint32 repop_distance);
void RequestUCSServerStatus();
void ResetAuth();
void SetDate(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute);
void SetGraveyard(uint32 zoneid, const glm::vec4 &graveyardPosition);
void SetInstanceTimer(uint32 new_duration);
void SetStaticZone(bool sz) { staticzone = sz; }
void SetTime(uint8 hour, uint8 minute, bool update_world = true);
void SetUCSServerAvailable(bool ucss_available, uint32 update_timestamp);
bool IsUCSServerAvailable() { return m_ucss_available; }
void ShowDisabledSpawnStatus(Mob *client);
void ShowEnabledSpawnStatus(Mob *client);
void ShowSpawnStatusByID(Mob *client, uint32 spawnid);
void SpawnConditionChanged(const SpawnCondition &c, int16 old_value);
void SpawnStatus(Mob *client);
void StartShutdownTimer(uint32 set_time = (RuleI(Zone, AutoShutdownDelay)));
void UpdateHotzone();
void UpdateQGlobal(uint32 qid, QGlobal newGlobal);
void weatherSend(Client *client = nullptr);
// random object that provides random values for the zone
EQEmu::Random random;
WaterMap *watermap;
ZonePoint *GetClosestZonePoint(const glm::vec3 &location, uint32 to, Client *client, float max_distance = 40000.0f);
ZonePoint *GetClosestZonePointWithoutZone(float x, float y, float z, Client *client, float max_distance = 40000.0f);
static void GMSayHookCallBackProcess(uint16 log_category, std::string message){
/* Cut messages down to 4000 max to prevent client crash */
if (!message.empty())
/**
* GMSay Callback for LogSys
*
* @param log_category
* @param message
*/
static void GMSayHookCallBackProcess(uint16 log_category, std::string message)
{
/**
* Cut messages down to 4000 max to prevent client crash
*/
if (!message.empty()) {
message = message.substr(0, 4000);
}
/* Replace Occurrences of % or MessageStatus will crash */
/**
* Replace Occurrences of % or MessageStatus will crash
*/
find_replace(message, std::string("%"), std::string("."));
if (message.find("\n") != std::string::npos){
if (message.find("\n") != std::string::npos) {
auto message_split = SplitString(message, '\n');
entity_list.MessageStatus(0, 80, LogSys.GetGMSayColorFromCategory(log_category), "%s", message_split[0].c_str());
entity_list.MessageStatus(
0,
80,
LogSys.GetGMSayColorFromCategory(log_category),
"%s",
message_split[0].c_str()
);
for (size_t iter = 1; iter < message_split.size(); ++iter) {
entity_list.MessageStatus(0, 80, LogSys.GetGMSayColorFromCategory(log_category), "--- %s", message_split[iter].c_str());
entity_list.MessageStatus(
0,
80,
LogSys.GetGMSayColorFromCategory(log_category),
"--- %s",
message_split[iter].c_str()
);
}
}
else{
else {
entity_list.MessageStatus(0, 80, LogSys.GetGMSayColorFromCategory(log_category), "%s", message.c_str());
}
}
//MODDING HOOKS
/**
* Modding hooks
*/
void mod_init();
void mod_repop();
private:
uint32 zoneid;
uint32 instanceid;
uint16 instanceversion;
bool pers_instance;
char* short_name;
char file_name[16];
char* long_name;
char* map_name;
bool pvpzone;
bool allow_mercs;
bool can_bind;
bool can_castoutdoor;
bool can_combat;
bool can_levitate;
bool is_city;
bool is_hotzone;
bool pers_instance;
bool pvpzone;
bool m_ucss_available;
bool staticzone;
bool zone_has_current_time;
char *long_name;
char *map_name;
char *short_name;
char file_name[16];
glm::vec3 m_SafePoint;
uint32 pMaxClients;
bool can_bind;
bool is_city;
bool can_combat;
bool can_castoutdoor;
bool can_levitate;
bool is_hotzone;
uint8 zone_type;
bool allow_mercs;
uint32 pgraveyard_id, pgraveyard_zoneid;
glm::vec4 m_Graveyard;
int default_ruleset;
int default_ruleset;
int totalBS;
int32 aggroedmobs;
uint8 zone_type;
uint16 instanceversion;
uint32 instanceid;
uint32 pgraveyard_id, pgraveyard_zoneid;
uint32 pMaxClients;
uint32 zoneid;
uint32 m_last_ucss_update;
uint32 pQueuedMerchantsWorkID;
uint32 pQueuedTempMerchantsWorkID;
int totalBS;
ZoneSpellsBlocked *blocked_spells;
GlobalLootManager m_global_loot;
LinkedList<ZoneClientAuth_Struct *> client_auth_list;
MobMovementManager *mMovementManager;
QGlobalCache *qGlobals;
Timer *Instance_Shutdown_Timer;
Timer *Instance_Timer;
Timer *Instance_Warning_timer;
Timer *Weather_Timer;
Timer autoshutdown_timer;
Timer clientauth_timer;
Timer hotzone_timer;
Timer initgrids_timer; //delayed loading of initial grids.
Timer qglobal_purge_timer;
ZoneSpellsBlocked *blocked_spells;
/*
Spawn related things
*/
int32 aggroedmobs;
Timer initgrids_timer; //delayed loading of initial grids.
bool staticzone;
bool zone_has_current_time;
uint32 pQueuedMerchantsWorkID;
uint32 pQueuedTempMerchantsWorkID;
Timer autoshutdown_timer;
Timer clientauth_timer;
Timer qglobal_purge_timer;
Timer* Weather_Timer;
Timer* Instance_Timer;
Timer* Instance_Shutdown_Timer;
Timer* Instance_Warning_timer;
LinkedList<ZoneClientAuth_Struct*> client_auth_list;
QGlobalCache *qGlobals;
Timer hotzone_timer;
GlobalLootManager m_global_loot;
bool m_ucss_available;
uint32 m_last_ucss_update;
MobMovementManager *mMovementManager;
};
#endif