Decouple zone calls, cleanup logic

This commit is contained in:
Akkadius 2020-04-19 04:36:39 -05:00
parent ebda1cf601
commit 373fb3f0e7
57 changed files with 705 additions and 467 deletions

View File

@ -1082,50 +1082,6 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
return true;
}
bool Database::LoadZoneNames() {
std::string query("SELECT zoneidnumber, short_name FROM zone");
auto results = QueryDatabase(query);
if (!results.Success())
{
return false;
}
for (auto row= results.begin();row != results.end();++row)
{
uint32 zoneid = atoi(row[0]);
std::string zonename = row[1];
zonename_array.insert(std::pair<uint32,std::string>(zoneid,zonename));
}
return true;
}
uint32 Database::GetZoneID(const char* zonename) {
if (zonename == nullptr)
return 0;
for (auto & iter : zonename_array)
if (strcasecmp(iter.second.c_str(), zonename) == 0)
return iter.first;
return 0;
}
const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
auto iter = zonename_array.find(zoneID);
if (iter != zonename_array.end())
return iter->second.c_str();
if (ErrorUnknown)
return "UNKNOWN";
return 0;
}
uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){
std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version);
@ -1342,29 +1298,31 @@ uint8 Database::GetServerType() {
return atoi(row[0]);
}
bool Database::MoveCharacterToZone(const char* charname, const char* zonename, uint32 zoneid) {
if(zonename == nullptr || strlen(zonename) == 0)
return false;
bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
{
std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i",
zone_id,
character_id
);
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'", zoneid, charname);
auto results = QueryDatabase(query);
if (!results.Success()) {
return false;
}
if (results.RowsAffected() == 0)
return false;
return true;
return results.RowsAffected() != 0;
}
bool Database::MoveCharacterToZone(const char* charname, const char* zonename) {
return MoveCharacterToZone(charname, zonename, GetZoneID(zonename));
}
bool Database::MoveCharacterToZone(const char *charname, uint32 zone_id)
{
std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'",
zone_id,
charname
);
bool Database::MoveCharacterToZone(uint32 iCharID, const char* iZonename) {
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i", GetZoneID(iZonename), iCharID);
auto results = QueryDatabase(query);
if (!results.Success()) {

View File

@ -108,9 +108,8 @@ public:
bool AddToNameFilter(const char* name);
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
bool DeleteCharacter(char* character_name);
bool MoveCharacterToZone(const char* charname, const char* zonename);
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
bool MoveCharacterToZone(const char* charname, uint32 zone_id);
bool MoveCharacterToZone(uint32 character_id, uint32 zone_id);
bool ReserveName(uint32 account_id, char* name);
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
@ -155,7 +154,6 @@ public:
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
uint16 GetInstanceVersion(uint16 instance_id);
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
@ -243,16 +241,11 @@ public:
/* General Queries */
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
bool LoadPTimers(uint32 charid, PTimerList &into);
bool LoadZoneNames();
const char* GetZoneName(uint32 zone_id, bool ErrorUnknown = false);
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
uint32 GetZoneID(const char* zonename);
uint8 GetPEQZone(uint32 zoneID, uint32 version);
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
@ -275,8 +268,6 @@ public:
/* EQEmuLogSys */
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
std::map<uint32,std::string> zonename_array;
private:
Mutex Mvarcache;

View File

@ -306,36 +306,6 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
return true;
}
uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 version) {
std::string query = StringFormat(
"SELECT "
"instance_list.id "
"FROM "
"instance_list, "
"instance_list_player "
"WHERE "
"instance_list.zone = %u "
"AND instance_list.version = %u "
"AND instance_list.id = instance_list_player.id "
"AND instance_list_player.charid = %u "
"LIMIT 1 ",
GetZoneID(zone),
version,
character_id
);
auto results = QueryDatabase(query);
if (!results.Success())
return 0;
if (results.RowCount() == 0)
return 0;
auto row = results.begin();
return atoi(row[0]);
}
uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version)
{
if (!zone)

View File

@ -24,6 +24,7 @@ SET(world_sources
world_console_connection.cpp
world_server_command_handler.cpp
worlddb.cpp
world_store.cpp
zonelist.cpp
zoneserver.cpp
)
@ -54,6 +55,7 @@ SET(world_headers
world_tcp_connection.h
world_server_command_handler.h
worlddb.h
world_store.h
zonelist.h
zoneserver.h
)

View File

@ -11,6 +11,7 @@
#include "zonelist.h"
#include "clientlist.h"
#include "cliententry.h"
#include "world_store.h"
extern ZSList zoneserver_list;
extern ClientList client_list;
@ -143,7 +144,7 @@ bool Adventure::Process()
bool Adventure::CreateInstance()
{
uint32 zone_id = content_db.GetZoneID(adventure_template->zone);
uint32 zone_id = ZoneID(adventure_template->zone);
if(!zone_id)
{
return false;
@ -362,7 +363,7 @@ void Adventure::Finished(AdventureWinStatus ws)
afe.points = 0;
}
adventure_manager.AddFinishedEvent(afe);
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
}
++iter;

View File

@ -10,6 +10,7 @@
#include "zonelist.h"
#include "clientlist.h"
#include "cliententry.h"
#include "world_store.h"
#include <sstream>
#include <stdio.h>
@ -771,7 +772,7 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do
sizeof(ServerPlayerClickedAdventureDoorReply_Struct));
ServerPlayerClickedAdventureDoorReply_Struct *sr = (ServerPlayerClickedAdventureDoorReply_Struct*)pack->pBuffer;
strcpy(sr->player, player);
sr->zone_id = content_db.GetZoneID(t->zone);
sr->zone_id = ZoneID(t->zone);
sr->instance_id = (*iter)->GetInstanceID();
sr->x = t->dest_x;
sr->y = t->dest_y;

View File

@ -46,6 +46,7 @@
#include "clientlist.h"
#include "wguild_mgr.h"
#include "sof_char_create_data.h"
#include "world_store.h"
#include <iostream>
#include <iomanip>
@ -64,7 +65,7 @@
#include <winsock2.h>
#include <windows.h>
#else
#ifdef FREEBSD //Timothy Whitman - January 7, 2003
#include <sys/types.h>
#endif
@ -109,7 +110,7 @@ Client::Client(EQStreamInterface* ieqs)
m_ClientVersion = eqs->ClientVersion();
m_ClientVersionBit = EQEmu::versions::ConvertClientVersionToClientVersionBit(m_ClientVersion);
numclients++;
}
@ -171,7 +172,7 @@ void Client::SendEnterWorld(std::string name)
void Client::SendExpansionInfo() {
auto outapp = new EQApplicationPacket(OP_ExpansionInfo, sizeof(ExpansionInfo_Struct));
ExpansionInfo_Struct *eis = (ExpansionInfo_Struct*)outapp->pBuffer;
if (RuleB(World, UseClientBasedExpansionSettings)) {
eis->Expansions = EQEmu::expansions::ConvertClientVersionToExpansionsMask(eqs->ClientVersion());
}
@ -430,7 +431,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
if (!is_player_zoning) {
// Track who is in and who is out of the game
char *inout= (char *) "";
if (cle->GetOnline() == CLE_Status::Never){
// Desktop -> Char Select
inout = (char *) "In";
@ -439,21 +440,21 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
// Game -> Char Select
inout=(char *) "Out";
}
// Always at Char select at this point.
// Either from a fresh client launch or coming back from the game.
// Exiting the game entirely does not come through here.
// Could use a Logging Out Completely message somewhere.
cle->SetOnline(CLE_Status::CharSelect);
LogInfo("Account ({}) Logging({}) to character select :: LSID [{}] ", cle->AccountName(), inout, cle->LSID());
}
else {
cle->SetOnline();
}
const WorldConfig *Config=WorldConfig::get();
if(Config->UpdateStats) {
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSPlayerJoinWorld;
@ -466,10 +467,10 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
loginserverlist.SendPacket(pack);
safe_delete(pack);
}
if (!is_player_zoning)
SendGuildList();
SendLogServer();
SendApproveWorld();
SendEnterWorld(cle->name());
@ -509,18 +510,18 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app)
outapp->size = 1;
bool valid = false;
if(!database.CheckNameFilter(char_name)) {
valid = false;
if(!database.CheckNameFilter(char_name)) {
valid = false;
}
/* Name must begin with an upper-case letter. */
else if (islower(char_name[0])) {
valid = false;
}
else if (database.ReserveName(GetAccountID(), char_name)) {
valid = true;
else if (islower(char_name[0])) {
valid = false;
}
else {
valid = false;
else if (database.ReserveName(GetAccountID(), char_name)) {
valid = true;
}
else {
valid = false;
}
outapp->pBuffer[0] = valid? 1 : 0;
@ -690,7 +691,7 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
return true;
}
bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if (GetAccountID() == 0) {
LogInfo("Enter world with no logged in account");
eqs->Close();
@ -785,7 +786,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if (tutorial_enabled) {
zone_id = RuleI(World, TutorialZoneID);
database.MoveCharacterToZone(charid, content_db.GetZoneName(zone_id));
database.MoveCharacterToZone(charid, zone_id);
}
else {
LogInfo("[{}] is trying to go to tutorial but are not allowed", char_name);
@ -796,9 +797,9 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
}
}
if (zone_id == 0 || !content_db.GetZoneName(zone_id)) {
if (zone_id == 0 || !ZoneName(zone_id)) {
// This is to save people in an invalid zone, once it's removed from the DB
database.MoveCharacterToZone(charid, "arena");
database.MoveCharacterToZone(charid, ZoneID("arena"));
LogInfo("Zone not found in database zone_id=[{}], moveing char to arena character:[{}]", zone_id, char_name);
}
@ -856,7 +857,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
}
QueuePacket(outapp);
safe_delete(outapp);
// set mailkey - used for duration of character session
int MailKey = emu_random.Int(1, INT_MAX);
@ -1154,7 +1155,7 @@ void Client::EnterWorld(bool TryBootup) {
else
zone_server = zoneserver_list.FindByZoneID(zone_id);
const char *zone_name = content_db.GetZoneName(zone_id, true);
const char *zone_name = ZoneName(zone_id, true);
if (zone_server) {
if (false == enter_world_triggered) {
//Drop any clients we own in other zones.
@ -1204,9 +1205,9 @@ void Client::EnterWorld(bool TryBootup) {
LogInfo(
"({}) [{}] [{}] (Zone ID [{}]: Instance ID: [{}]) ",
char_name,
(seen_character_select ? "Zoning from character select" : "Zoning to"),
zone_name,
zone_id,
(seen_character_select ? "Zoning from character select" : "Zoning to"),
zone_name,
zone_id,
instance_id
);
@ -1267,7 +1268,7 @@ void Client::Clearance(int8 response)
return;
}
const char* zonename = content_db.GetZoneName(zone_id);
const char* zonename = ZoneName(zone_id);
if (zonename == 0) {
LogInfo("zonename is nullptr in Client::Clearance!!");
TellClientZoneUnavailable();
@ -1322,7 +1323,7 @@ void Client::Clearance(int8 response)
void Client::TellClientZoneUnavailable() {
auto outapp = new EQApplicationPacket(OP_ZoneUnavail, sizeof(ZoneUnavail_Struct));
ZoneUnavail_Struct* ua = (ZoneUnavail_Struct*)outapp->pBuffer;
const char* zonename = content_db.GetZoneName(zone_id);
const char* zonename = ZoneName(zone_id);
if (zonename)
strcpy(ua->zonename, zonename);
QueuePacket(outapp);
@ -1502,7 +1503,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
// strcpy(pp.servername, WorldConfig::get()->ShortName.c_str());
memset(pp.spell_book, 0xFF, (sizeof(uint32) * EQEmu::spells::SPELLBOOK_SIZE));
memset(pp.mem_spells, 0xFF, (sizeof(uint32) * EQEmu::spells::SPELL_GEM_COUNT));
for(i = 0; i < BUFF_COUNT; i++)
@ -1522,11 +1523,11 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
else {
LogInfo("Found 'TitaniumStartZoneID' rule setting: [{}]", RuleI(World, TitaniumStartZoneID));
if (RuleI(World, TitaniumStartZoneID) > 0) { /* if there's a startzone variable put them in there */
pp.zone_id = RuleI(World, TitaniumStartZoneID);
cc->start_zone = pp.zone_id;
}
}
}
/* use normal starting zone logic to either get defaults, or if startzone was set, load that from the db table.*/
bool ValidStartZone = content_db.GetStartZone(&pp, cc, m_ClientVersionBit & EQEmu::versions::maskTitaniumAndEarlier);
@ -1568,7 +1569,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
/* Overrides if we have the tutorial flag set! */
if (cc->tutorial && RuleB(World, EnableTutorialButton)) {
pp.zone_id = RuleI(World, TutorialZoneID);
content_db.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z);
content_db.GetSafePoints(ZoneName(pp.zone_id), 0, &pp.x, &pp.y, &pp.z);
}
/* Will either be the same as home or tutorial if enabled. */
@ -1581,11 +1582,11 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
}
Log(Logs::Detail, Logs::WorldServer, "Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f",
content_db.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
ZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
Log(Logs::Detail, Logs::WorldServer, "Bind location: %s (%d) %0.2f, %0.2f, %0.2f",
content_db.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
ZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
Log(Logs::Detail, Logs::WorldServer, "Home location: %s (%d) %0.2f, %0.2f, %0.2f",
content_db.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
ZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
/* Starting Items inventory */
content_db.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
@ -2090,7 +2091,7 @@ bool Client::StoreCharacter(
return false;
}
const char *zone_name = content_db.GetZoneName(p_player_profile_struct->zone_id);
const char *zone_name = ZoneName(p_player_profile_struct->zone_id);
if (zone_name == nullptr) {
/* Zone not in the DB, something to prevent crash... */
strn0cpy(zone, "qeynos", 49);
@ -2134,4 +2135,4 @@ bool Client::StoreCharacter(
}
return true;
}
}

View File

@ -33,6 +33,7 @@
#include "../common/event_sub.h"
#include "web_interface.h"
#include "wguild_mgr.h"
#include "world_store.h"
#include <set>
extern WebInterfaceList web_interface;
@ -107,7 +108,7 @@ void ClientList::GetCLEIP(uint32 iIP) {
iterator.Reset();
while(iterator.MoreElements()) {
countCLEIPs = iterator.GetData();
countCLEIPs = iterator.GetData();
if ((countCLEIPs->GetIP() == iIP) && ((countCLEIPs->Admin() < (RuleI(World, ExemptMaxClientsStatus))) || (RuleI(World, ExemptMaxClientsStatus) < 0))) { // If the IP matches, and the connection admin status is below the exempt status, or exempt status is less than 0 (no-one is exempt)
IPInstances++; // Increment the occurences of this IP address
LogClientLogin("Account ID: [{}] Account Name: [{}] IP: [{}]", countCLEIPs->LSID(), countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str());
@ -129,7 +130,7 @@ void ClientList::GetCLEIP(uint32 iIP) {
if (IPInstances > (RuleI(World, MaxClientsPerIP))) { // If the number of connections exceeds the lower limit
if (RuleB(World, MaxClientsSetByStatus)) { // If MaxClientsSetByStatus is set to True, override other IP Limit Rules
LogClientLogin("Account ID: [{}] Account Name: [{}] IP: [{}] IP Instances: [{}] Max IP Instances: [{}]", countCLEIPs->LSID(), countCLEIPs->LSName(), long2ip(countCLEIPs->GetIP()).c_str(), IPInstances, countCLEIPs->Admin());
if (IPInstances > countCLEIPs->Admin()) { // The IP Limit is set by the status of the account if status > MaxClientsPerIP
if (IPInstances > countCLEIPs->Admin()) { // The IP Limit is set by the status of the account if status > MaxClientsPerIP
if(RuleB(World, IPLimitDisconnectAll)) {
LogClientLogin("Disconnect: All accounts on IP [{}]", long2ip(countCLEIPs->GetIP()).c_str());
DisconnectByIP(iIP);
@ -142,7 +143,7 @@ void ClientList::GetCLEIP(uint32 iIP) {
}
}
} else if ((countCLEIPs->Admin() < RuleI(World, AddMaxClientsStatus)) || (RuleI(World, AddMaxClientsStatus) < 0)) { // Else if the Admin status of the connection is not eligible for the higher limit, or there is no higher limit (AddMaxClientStatus < 0)
if(RuleB(World, IPLimitDisconnectAll)) {
if(RuleB(World, IPLimitDisconnectAll)) {
LogClientLogin("Disconnect: All accounts on IP [{}]", long2ip(countCLEIPs->GetIP()).c_str());
DisconnectByIP(iIP);
return;
@ -152,7 +153,7 @@ void ClientList::GetCLEIP(uint32 iIP) {
iterator.RemoveCurrent();
continue;
}
} else if (IPInstances > RuleI(World, AddMaxClientsPerIP)) { // else they are eligible for the higher limit, but if they exceed that
} else if (IPInstances > RuleI(World, AddMaxClientsPerIP)) { // else they are eligible for the higher limit, but if they exceed that
if(RuleB(World, IPLimitDisconnectAll)) {
LogClientLogin("Disconnect: All accounts on IP [{}]", long2ip(countCLEIPs->GetIP()).c_str());
DisconnectByIP(iIP);
@ -293,7 +294,7 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
if (cle->LSID())
AppendAnyLenString(&output, &outsize, &outlen, "%s LSID: %i LSName: %s WorldAdmin: %i", newline, cle->LSID(), cle->LSName(), cle->WorldAdmin());
if (cle->CharID())
AppendAnyLenString(&output, &outsize, &outlen, "%s CharID: %i CharName: %s Zone: %s (%i)", newline, cle->CharID(), cle->name(), content_db.GetZoneName(cle->zone()), cle->zone());
AppendAnyLenString(&output, &outsize, &outlen, "%s CharID: %i CharName: %s Zone: %s (%i)", newline, cle->CharID(), cle->name(), ZoneName(cle->zone()), cle->zone());
if (outlen >= 3072) {
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
safe_delete(output);
@ -500,7 +501,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
countclients.Reset();
while(countclients.MoreElements()){
countcle = countclients.GetData();
const char* tmpZone = content_db.GetZoneName(countcle->zone());
const char* tmpZone = ZoneName(countcle->zone());
if (
(countcle->Online() >= CLE_Status::Zoning) &&
(!countcle->GetGM() || countcle->Anon() != 1 || admin >= countcle->Admin()) &&
@ -580,7 +581,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
while(iterator.MoreElements()) {
cle = iterator.GetData();
const char* tmpZone = content_db.GetZoneName(cle->zone());
const char* tmpZone = ZoneName(cle->zone());
if (
(cle->Online() >= CLE_Status::Zoning) &&
(!cle->GetGM() || cle->Anon() != 1 || admin >= cle->Admin()) &&
@ -965,7 +966,7 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
iterator.Reset();
while (iterator.MoreElements()) {
cle = iterator.GetData();
const char* tmpZone = content_db.GetZoneName(cle->zone());
const char* tmpZone = ZoneName(cle->zone());
if (
(cle->Online() >= CLE_Status::Zoning)
&& (whom == 0 || (
@ -1086,7 +1087,7 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
AppendAnyLenString(&output, &outsize, &outlen, "\r\n");
else
AppendAnyLenString(&output, &outsize, &outlen, "\n");
//console_list.SendConsoleWho(connection, to, admin, &output, &outsize, &outlen);
}
if (output)
@ -1282,7 +1283,7 @@ void ClientList::GetClients(const char *zone_name, std::vector<ClientListEntry *
iterator.Advance();
}
} else {
uint32 zoneid = content_db.GetZoneID(zone_name);
uint32 zoneid = ZoneID(zone_name);
while(iterator.MoreElements()) {
ClientListEntry* tmp = iterator.GetData();
if(tmp->zone() == zoneid)
@ -1358,7 +1359,7 @@ void ClientList::SendClientVersionSummary(const char *Name)
}
zoneserver_list.SendEmoteMessage(Name, 0, 0, 13, "There are %i Titanium, %i SoF, %i SoD, %i UF, %i RoF, %i RoF2 clients currently connected.",
ClientTitaniumCount, ClientSoFCount, ClientSoDCount, ClientUnderfootCount, ClientRoFCount, ClientRoF2Count);
ClientTitaniumCount, ClientSoFCount, ClientSoDCount, ClientUnderfootCount, ClientRoFCount, ClientRoF2Count);
}
void ClientList::OnTick(EQ::Timer *t)
@ -1378,7 +1379,7 @@ void ClientList::OnTick(EQ::Timer *t)
while (Iterator.MoreElements())
{
ClientListEntry* cle = Iterator.GetData();
Json::Value outclient;
outclient["Online"] = cle->Online();

View File

@ -30,6 +30,7 @@
#include "../common/string_util.h"
#include "../common/md5.h"
#include "eqemu_api_world_data_service.h"
#include "world_store.h"
#include <fmt/format.h>
extern ClientList client_list;
@ -541,7 +542,7 @@ void ConsoleZoneShutdown(
s->ZoneServerID = atoi(args[0].c_str());
}
else {
s->zoneid = content_db.GetZoneID(args[0].c_str());
s->zoneid = ZoneID(args[0].c_str());
}
ZoneServer *zs = 0;
@ -549,7 +550,7 @@ void ConsoleZoneShutdown(
zs = zoneserver_list.FindByID(s->ZoneServerID);
}
else if (s->zoneid != 0) {
zs = zoneserver_list.FindByName(content_db.GetZoneName(s->zoneid));
zs = zoneserver_list.FindByName(ZoneName(s->zoneid));
}
else {
connection->SendLine("Error: ZoneShutdown: neither ID nor name specified");
@ -633,10 +634,10 @@ void ConsoleZoneLock(
return;
}
uint16 tmp = content_db.GetZoneID(args[1].c_str());
uint16 tmp = ZoneID(args[1].c_str());
if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, true)) {
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", content_db.GetZoneName(tmp));
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", ZoneName(tmp));
}
else {
connection->SendLine("Failed to change lock");
@ -651,10 +652,10 @@ void ConsoleZoneLock(
return;
}
uint16 tmp = content_db.GetZoneID(args[1].c_str());
uint16 tmp = ZoneID(args[1].c_str());
if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, false)) {
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", content_db.GetZoneName(tmp));
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", ZoneName(tmp));
}
else {
connection->SendLine("Failed to change lock");
@ -936,4 +937,4 @@ void RegisterConsoleFunctions(std::unique_ptr<EQ::Net::ConsoleServer>& console)
console->RegisterCall("zonestatus", 50, "zonestatus", std::bind(ConsoleZoneStatus, 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));
}
}

View File

@ -230,7 +230,7 @@ bool Console::Process() {
std::string connecting_ip = inet_ntoa(in);
SendMessage(2, StringFormat("Establishing connection from IP: %s Port: %d", inet_ntoa(in), GetPort()).c_str());
if (connecting_ip.find("127.0.0.1") != std::string::npos) {
SendMessage(2, StringFormat("Connecting established from local host, auto assuming admin").c_str());
state = CONSOLE_STATE_CONNECTED;
@ -244,7 +244,7 @@ bool Console::Process() {
}
prompt_timer.Disable();
}
if (timeout_timer.Check()) {
@ -269,7 +269,7 @@ bool Console::Process() {
LogInfo("New launcher from [{}]:[{}]", inet_ntoa(in), GetPort());
launcher_list.Add(tcpc);
tcpc = 0;
}
}
else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS)
{
LogInfo("New UCS Connection from [{}]:[{}]", inet_ntoa(in), GetPort());
@ -281,7 +281,7 @@ bool Console::Process() {
LogInfo("New QS Connection from [{}]:[{}]", inet_ntoa(in), GetPort());
QSLink.SetConnection(tcpc);
tcpc = 0;
}
}
else {
LogInfo("Unsupported packet mode from [{}]:[{}]", inet_ntoa(in), GetPort());
}
@ -616,7 +616,7 @@ void Console::ProcessCommand(const char* command) {
if(sep.arg[1][0]==0 || sep.arg[2][0] == 0)
SendMessage(1, "Usage: movechar [charactername] [zonename]");
else {
if (!content_db.GetZoneID(sep.arg[2]))
if (!ZoneID(sep.arg[2]))
SendMessage(1, "Error: Zone '%s' not found", sep.arg[2]);
else if (!database.CheckUsedName((char*) sep.arg[1])) {
if (!database.MoveCharacterToZone((char*) sep.arg[1], (char*) sep.arg[2]))
@ -711,13 +711,13 @@ void Console::ProcessCommand(const char* command) {
if (sep.arg[1][0] >= '0' && sep.arg[1][0] <= '9')
s->ZoneServerID = atoi(sep.arg[1]);
else
s->zoneid = content_db.GetZoneID(sep.arg[1]);
s->zoneid = ZoneID(sep.arg[1]);
ZoneServer* zs = 0;
if (s->ZoneServerID != 0)
zs = zoneserver_list.FindByID(s->ZoneServerID);
else if (s->zoneid != 0)
zs = zoneserver_list.FindByName(content_db.GetZoneName(s->zoneid));
zs = zoneserver_list.FindByName(ZoneName(s->zoneid));
else
SendMessage(1, "Error: ZoneShutdown: neither ID nor name specified");
@ -828,10 +828,10 @@ void Console::ProcessCommand(const char* command) {
zoneserver_list.ListLockedZones(0, this);
}
else if (strcasecmp(sep.arg[1], "lock") == 0 && admin >= 101) {
uint16 tmp = content_db.GetZoneID(sep.arg[2]);
uint16 tmp = ZoneID(sep.arg[2]);
if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, true))
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", content_db.GetZoneName(tmp));
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", ZoneName(tmp));
else
SendMessage(1, "Failed to change lock");
}
@ -839,10 +839,10 @@ void Console::ProcessCommand(const char* command) {
SendMessage(1, "Usage: #zonelock lock [zonename]");
}
else if (strcasecmp(sep.arg[1], "unlock") == 0 && admin >= 101) {
uint16 tmp = content_db.GetZoneID(sep.arg[2]);
uint16 tmp = ZoneID(sep.arg[2]);
if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, false))
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", content_db.GetZoneName(tmp));
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", ZoneName(tmp));
else
SendMessage(1, "Failed to change lock");
}

View File

@ -21,6 +21,7 @@
#include "launcher_link.h"
#include "launcher_list.h"
#include "../common/string_util.h"
#include "world_store.h"
#include <cstdlib>
#include <cstring>
@ -156,7 +157,7 @@ void EQLConfig::StartZone(Const_char *zone_ref) {
bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
//make sure the short name is valid.
if(content_db.GetZoneID(short_name) == 0)
if(ZoneID(short_name) == 0)
return false;
//database update
@ -191,7 +192,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
//make sure the short name is valid.
if(content_db.GetZoneID(short_name) == 0)
if(ZoneID(short_name) == 0)
return false;
//check internal state

View File

@ -188,7 +188,7 @@ std::map<std::string,std::string> EQW::GetPlayerDetails(Const_char *char_name) {
res["character"] = cle->name();
res["account"] = cle->AccountName();
res["account_id"] = itoa(cle->AccountID());
res["location_short"] = cle->zone()?content_db.GetZoneName(cle->zone()):"No Zone";
res["location_short"] = cle->zone()?ZoneName(cle->zone()):"No Zone";
res["location_long"] = res["location_short"];
res["location_id"] = itoa(cle->zone());
res["ip"] = long2ip(cle->GetIP());

View File

@ -94,7 +94,9 @@ union semun {
#include "world_server_command_handler.h"
#include "../common/content/world_content_service.h"
#include "../common/repositories/merchantlist_temp_repository.h"
#include "world_store.h"
WorldStore world_store;
ClientList client_list;
GroupLFPList LFPGroupList;
ZSList zoneserver_list;
@ -329,9 +331,7 @@ int main(int argc, char** argv) {
LogInfo("Loading zones");
// Load to both context for now... this needs to be cleaned up as this has always been cludgy
content_db.LoadZoneNames();
database.zonename_array = content_db.zonename_array;
world_store.LoadZones();
LogInfo("Clearing groups");
database.ClearGroup();

132
world/world_store.cpp Normal file
View File

@ -0,0 +1,132 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 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 "world_store.h"
WorldStore::WorldStore() = default;
WorldStore::~WorldStore()= default;
void WorldStore::LoadZones()
{
zones = ZoneRepository::All();
}
uint32 WorldStore::GetZoneID(const char *in_zone_name)
{
if (in_zone_name == nullptr) {
return 0;
}
std::string zone_name = in_zone_name;
return GetZoneID(zone_name);
}
uint32 WorldStore::GetZoneID(std::string zone_name)
{
for (auto &z: zones) {
if (z.short_name == zone_name) {
return z.zoneidnumber;
}
}
return 0;
}
/**
* @param zone_id
* @param error_unknown
* @return
*/
const char *WorldStore::GetZoneName(uint32 zone_id, bool error_unknown)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id) {
return z.short_name.c_str();
}
}
if (error_unknown) {
return "UNKNOWN";
}
return nullptr;
}
/**
* @param zone_id
* @return
*/
std::string WorldStore::GetZoneName(uint32 zone_id)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id) {
return z.short_name;
}
}
return std::string();
}
/**
* @param zone_id
* @return
*/
std::string WorldStore::GetZoneLongName(uint32 zone_id)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id) {
return z.long_name;
}
}
return std::string();
}
/**
* @param zone_id
* @param version
* @return
*/
ZoneRepository::Zone WorldStore::GetZone(uint32 zone_id, int version)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id && z.version == version) {
return z;
}
}
return ZoneRepository::Zone();
}
/**
* @param in_zone_name
* @return
*/
ZoneRepository::Zone WorldStore::GetZone(const char *in_zone_name)
{
for (auto &z: zones) {
if (z.short_name == in_zone_name) {
return z;
}
}
return ZoneRepository::Zone();
}

64
world/world_store.h Normal file
View File

@ -0,0 +1,64 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 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_WORLD_STORE_H
#define EQEMU_WORLD_STORE_H
#include "worlddb.h"
#include "../common/repositories/zone_repository.h"
class WorldStore {
public:
WorldStore();
virtual ~WorldStore();
std::vector<ZoneRepository::Zone> zones{};
void LoadZones();
ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0);
ZoneRepository::Zone GetZone(const char *in_zone_name);
uint32 GetZoneID(const char *in_zone_name);
uint32 GetZoneID(std::string zone_name);
std::string GetZoneName(uint32 zone_id);
std::string GetZoneLongName(uint32 zone_id);
const char *GetZoneName(uint32 zone_id, bool error_unknown = false);
};
extern WorldStore world_store;
/**
* Global helpers
*/
inline uint32 ZoneID(const char *in_zone_name) { return world_store.GetZoneID(in_zone_name); }
inline uint32 ZoneID(std::string zone_name) { return world_store.GetZoneID(zone_name); }
inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
{
return world_store.GetZoneName(
zone_id,
error_unknown
);
}
inline const char *ZoneLongName(uint32 zone_id) { return world_store.GetZoneLongName(zone_id).c_str(); }
inline ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0) { return world_store.GetZone(zone_id, version); };
inline ZoneRepository::Zone GetZone(const char *in_zone_name) { return world_store.GetZone(in_zone_name); };
#endif //EQEMU_WORLD_STORE_H

View File

@ -26,6 +26,7 @@
#include <vector>
#include "sof_char_create_data.h"
#include "../common/repositories/criteria/content_filter_criteria.h"
#include "world_store.h"
WorldDatabase database;
WorldDatabase content_db;
@ -209,7 +210,13 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
/* If a bind_id is specified, make them start there */
if (atoi(row_d[1]) != 0) {
player_profile_struct.binds[4].zoneId = (uint32) atoi(row_d[1]);
GetSafePoints(player_profile_struct.binds[4].zoneId, 0, &player_profile_struct.binds[4].x, &player_profile_struct.binds[4].y, &player_profile_struct.binds[4].z);
content_db.GetSafePoints(
ZoneName(player_profile_struct.binds[4].zoneId),
0,
&player_profile_struct.binds[4].x,
&player_profile_struct.binds[4].y,
&player_profile_struct.binds[4].z
);
}
/* Otherwise, use the zone and coordinates given */
else {
@ -217,7 +224,15 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
float x = atof(row_d[2]);
float y = atof(row_d[3]);
float z = atof(row_d[4]);
if (x == 0 && y == 0 && z == 0) { content_db.GetSafePoints(player_profile_struct.binds[4].zoneId, 0, &x, &y, &z); }
if (x == 0 && y == 0 && z == 0) {
content_db.GetSafePoints(
ZoneName(player_profile_struct.binds[4].zoneId),
0,
&x,
&y,
&z
);
}
player_profile_struct.binds[4].x = x;
player_profile_struct.binds[4].y = y;
player_profile_struct.binds[4].z = z;
@ -459,11 +474,24 @@ bool WorldDatabase::GetStartZone(
}
if (p_player_profile_struct->x == 0 && p_player_profile_struct->y == 0 && p_player_profile_struct->z == 0) {
content_db.GetSafePoints(p_player_profile_struct->zone_id, 0, &p_player_profile_struct->x, &p_player_profile_struct->y, &p_player_profile_struct->z);
content_db.GetSafePoints(
ZoneName(p_player_profile_struct->zone_id),
0,
&p_player_profile_struct->x,
&p_player_profile_struct->y,
&p_player_profile_struct->z
);
}
if (p_player_profile_struct->binds[0].x == 0 && p_player_profile_struct->binds[0].y == 0 && p_player_profile_struct->binds[0].z == 0) {
content_db.GetSafePoints(p_player_profile_struct->binds[0].zoneId, 0, &p_player_profile_struct->binds[0].x, &p_player_profile_struct->binds[0].y, &p_player_profile_struct->binds[0].z);
if (p_player_profile_struct->binds[0].x == 0 && p_player_profile_struct->binds[0].y == 0 &&
p_player_profile_struct->binds[0].z == 0) {
content_db.GetSafePoints(
ZoneName(p_player_profile_struct->binds[0].zoneId),
0,
&p_player_profile_struct->binds[0].x,
&p_player_profile_struct->binds[0].y,
&p_player_profile_struct->binds[0].z
);
}
return true;

View File

@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/json/json.h"
#include "../common/event_sub.h"
#include "web_interface.h"
#include "world_store.h"
extern uint32 numzones;
extern bool holdzones;
@ -263,7 +264,7 @@ void ZSList::ListLockedZones(const char* to, WorldTCPConnection* connection) {
int x = 0;
for (auto &zone : pLockedZones) {
if (zone) {
connection->SendEmoteMessageRaw(to, 0, 0, 0, content_db.GetZoneName(zone, true));
connection->SendEmoteMessageRaw(to, 0, 0, 0, ZoneName(zone, true));
x++;
}
}
@ -529,7 +530,7 @@ void ZSList::SOPZoneBootup(const char* adminname, uint32 ZoneServerID, const cha
ZoneServer* zs = 0;
ZoneServer* zs2 = 0;
uint32 zoneid;
if (!(zoneid = content_db.GetZoneID(zonename)))
if (!(zoneid = ZoneID(zonename)))
SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zone '%s' not found in 'zone' table. Typo protection=ON.", zonename);
else {
if (ZoneServerID != 0)

View File

@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "adventure_manager.h"
#include "ucs.h"
#include "queryserv.h"
#include "world_store.h"
extern ClientList client_list;
extern GroupLFPList LFPGroupList;
@ -86,7 +87,7 @@ ZoneServer::~ZoneServer() {
bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
is_booting_up = false;
const char* zn = MakeLowerString(content_db.GetZoneName(iZoneID));
const char* zn = MakeLowerString(ZoneName(iZoneID));
char* longname;
if (iZoneID)
@ -566,7 +567,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
SetZone_Struct* szs = (SetZone_Struct*)pack->pBuffer;
if (szs->zoneid != 0) {
if (content_db.GetZoneName(szs->zoneid))
if (ZoneName(szs->zoneid))
SetZone(szs->zoneid, szs->instanceid, szs->staticzone);
else
SetZone(0);
@ -648,7 +649,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
if (s->ZoneServerID != 0)
zs = zoneserver_list.FindByID(s->ZoneServerID);
else if (s->zoneid != 0)
zs = zoneserver_list.FindByName(content_db.GetZoneName(s->zoneid));
zs = zoneserver_list.FindByName(ZoneName(s->zoneid));
else
zoneserver_list.SendEmoteMessage(s->adminname, 0, 0, 0, "Error: SOP_ZoneShutdown: neither ID nor name specified");
@ -660,7 +661,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
}
case ServerOP_ZoneBootup: {
ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *)pack->pBuffer;
zoneserver_list.SOPZoneBootup(s->adminname, s->ZoneServerID, content_db.GetZoneName(s->zoneid), s->makestatic);
zoneserver_list.SOPZoneBootup(s->adminname, s->ZoneServerID, ZoneName(s->zoneid), s->makestatic);
break;
}
case ServerOP_ZoneStatus: {
@ -1018,13 +1019,13 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
break;
case 1:
if (zoneserver_list.SetLockedZone(s->zoneID, true))
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", content_db.GetZoneName(s->zoneID));
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", ZoneName(s->zoneID));
else
this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock");
break;
case 2:
if (zoneserver_list.SetLockedZone(s->zoneID, false))
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", content_db.GetZoneName(s->zoneID));
zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", ZoneName(s->zoneID));
else
this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock");
break;

View File

@ -33,6 +33,7 @@ Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
#include "string_ids.h"
#include "titles.h"
#include "zonedb.h"
#include "zone_store.h"
extern QueryServ* QServ;

View File

@ -22,6 +22,7 @@
#include "../common/net/websocket_server.h"
#include "../common/eqemu_logsys.h"
#include "zonedb.h"
#include "zone_store.h"
#include "client.h"
#include "entity.h"
#include "corpse.h"

View File

@ -283,7 +283,7 @@ bool Mob::CheckHitChance(Mob* other, DamageHitInfo &hit)
bool lua_ret = false;
bool ignoreDefault = false;
lua_ret = LuaParser::Instance()->CheckHitChance(this, other, hit, ignoreDefault);
if(ignoreDefault) {
return lua_ret;
}
@ -323,7 +323,7 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
bool lua_ret = false;
bool ignoreDefault = false;
lua_ret = LuaParser::Instance()->AvoidDamage(this, other, hit, ignoreDefault);
if (ignoreDefault) {
return lua_ret;
}
@ -866,7 +866,7 @@ int Mob::GetBestMeleeSkill()
{ EQEmu::skills::Skill1HBlunt,
EQEmu::skills::Skill1HSlashing,
EQEmu::skills::Skill2HBlunt,
EQEmu::skills::Skill2HSlashing,
EQEmu::skills::Skill2HSlashing,
EQEmu::skills::SkillHandtoHand,
EQEmu::skills::Skill1HPiercing,
EQEmu::skills::Skill2HPiercing,
@ -879,7 +879,7 @@ int Mob::GetBestMeleeSkill()
value = GetSkill(meleeSkills[i]);
bestSkill = std::max(value, bestSkill);
}
return bestSkill;
}
@ -892,7 +892,7 @@ int Mob::offense(EQEmu::skills::SkillType skill)
case EQEmu::skills::SkillArchery:
case EQEmu::skills::SkillThrowing:
stat_bonus = GetDEX();
break;
break;
// Mobs with no weapons default to H2H.
// Since H2H is capped at 100 for many many classes,
@ -943,7 +943,7 @@ void Mob::MeleeMitigation(Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions
#ifdef LUA_EQEMU
bool ignoreDefault = false;
LuaParser::Instance()->MeleeMitigation(this, attacker, hit, opts, ignoreDefault);
if (ignoreDefault) {
return;
}
@ -1735,7 +1735,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::Sk
if (!RuleB(Character, UseDeathExpLossMult)) {
exploss = (int)(GetLevel() * (GetLevel() / 18.0) * 12000);
}
if (RuleB(Zone, LevelBasedEXPMods)) {
// Death in levels with xp_mod (such as hell levels) was resulting
// in losing more that appropriate since the loss was the same but
@ -1893,7 +1893,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::Sk
dead_timer.Start(5000, true);
m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zoneInstance = m_pp.binds[0].instance_id;
database.MoveCharacterToZone(this->CharacterID(), content_db.GetZoneName(m_pp.zone_id));
database.MoveCharacterToZone(this->CharacterID(), m_pp.zone_id);
Save();
GoToDeath();
}
@ -2452,7 +2452,7 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::Skil
bool allow_merchant_corpse = RuleB(Merchant, AllowCorpse);
bool is_merchant = (class_ == MERCHANT || class_ == ADVENTUREMERCHANT || MerchantType != 0);
if (!HasOwner() && !IsMerc() && !GetSwarmInfo() && (!is_merchant || allow_merchant_corpse) &&
((killer && (killer->IsClient() || (killer->HasOwner() && killer->GetUltimateOwner()->IsClient()) ||
(killer->IsNPC() && killer->CastToNPC()->GetSwarmInfo() && killer->CastToNPC()->GetSwarmInfo()->GetOwner() && killer->CastToNPC()->GetSwarmInfo()->GetOwner()->IsClient())))
@ -4093,7 +4093,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
if (IsPet() && hand != EQEmu::invslot::slotPrimary) //Pets can only proc spell procs from their primay hand (ie; beastlord pets)
continue; // If pets ever can proc from off hand, this will need to change
if (SpellProcs[i].base_spellID == POISON_PROC &&
if (SpellProcs[i].base_spellID == POISON_PROC &&
(!weapon || weapon->ItemType != EQEmu::item::ItemType1HPiercing))
continue; // Old school poison will only proc with 1HP equipped.
@ -4113,7 +4113,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
// Spell procs (buffs)
if (SpellProcs[i].spellID != SPELL_UNKNOWN) {
if (SpellProcs[i].base_spellID == POISON_PROC) {
poison_slot=i;
poison_slot=i;
continue; // Process the poison proc last per @mackal
}
@ -4160,7 +4160,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
RemoveProcFromWeapon(spell_id);
}
}
}
}
if (HasSkillProcs() && hand != EQEmu::invslot::slotRange) { //We check ranged skill procs within the attack functions.
uint16 skillinuse = 28;
@ -4696,7 +4696,7 @@ void Mob::ApplyDamageTable(DamageHitInfo &hit)
#ifdef LUA_EQEMU
bool ignoreDefault = false;
LuaParser::Instance()->ApplyDamageTable(this, hit, ignoreDefault);
if (ignoreDefault) {
return;
}

View File

@ -29,6 +29,7 @@
#include "groups.h"
#include "corpse.h"
#include "zonedb.h"
#include "zone_store.h"
#include "string_ids.h"
#include "../common/misc_functions.h"
#include "../common/global_define.h"
@ -320,7 +321,7 @@ public:
void SetStopMeleeLevel(uint8 level);
void SetGuardMode();
void SetHoldMode();
// Mob AI Virtual Override Methods
virtual void AI_Process();
virtual void AI_Stop();
@ -351,7 +352,7 @@ public:
virtual void UpdateEquipmentLight() { m_Light.Type[EQEmu::lightsource::LightEquipment] = m_inv.FindBrightestLightType(); m_Light.Level[EQEmu::lightsource::LightEquipment] = EQEmu::lightsource::TypeToLevel(m_Light.Type[EQEmu::lightsource::LightEquipment]); }
const EQEmu::InventoryProfile& GetBotInv() const { return m_inv; }
// Static Class Methods
// Static Class Methods
//static void DestroyBotRaidObjects(Client* client); // Can be removed after bot raids are dumped
static Bot* LoadBot(uint32 botID);
static uint32 SpawnedBotCount(uint32 botOwnerCharacterID);
@ -405,7 +406,7 @@ public:
static BotSpell GetDebuffBotSpell(Bot* botCaster, Mob* target);
static BotSpell GetBestBotSpellForCure(Bot* botCaster, Mob* target);
static BotSpell GetBestBotSpellForResistDebuff(Bot* botCaster, Mob* target);
static NPCType *CreateDefaultNPCTypeStructForBot(std::string botName, std::string botLastName, uint8 botLevel, uint16 botRace, uint8 botClass, uint8 gender);
// Static Bot Group Methods
@ -451,7 +452,7 @@ public:
bool IsBotNonSpellFighter() { return IsNonSpellFighterClass(GetClass()); }
bool CanHeal();
int GetRawACNoShield(int &shield_ac);
// new heal rotation code
bool CreateHealRotation(uint32 cycle_duration_ms = 5000, bool fast_heals = false, bool adaptive_targeting = false, bool casting_override = false);
bool DestroyHealRotation();
@ -597,7 +598,7 @@ public:
int32 GetBasePR() { return _basePR; }
int32 GetBaseDR() { return _baseDR; }
int32 GetBaseCorrup() { return _baseCorrup; }
protected:
virtual void PetAIProcess();
virtual void BotMeditate(bool isSitting);
@ -656,7 +657,7 @@ private:
int32 max_end;
int32 end_regen;
uint32 timers[MaxTimer];
Timer m_evade_timer; // can be moved to pTimers at some point
Timer m_alt_combat_hate_timer;
Timer m_auto_defend_timer;

View File

@ -24,7 +24,7 @@
2. Add the function in this file.
3. In the bot_command_init function you must add a call to bot_command_add
for your function.
Notes: If you want an alias for your bot command, add an entry to the
`bot_command_settings` table in your database. The access level you
set with bot_command_add is the default setting if the bot command isn't
@ -60,6 +60,7 @@
#include "bot_command.h"
#include "zonedb.h"
#include "zone_store.h"
#include "guild_mgr.h"
#include "map.h"
#include "doors.h"
@ -120,18 +121,18 @@ public:
static void Load() {
bot_command_spells.clear();
bcst_levels_map bot_levels_map;
for (int i = BCEnum::SpellTypeFirst; i <= BCEnum::SpellTypeLast; ++i) {
bot_command_spells[static_cast<BCEnum::SpType>(i)];
bot_levels_map[static_cast<BCEnum::SpType>(i)];
}
for (int spell_id = 2; spell_id < SPDAT_RECORDS; ++spell_id) {
if (spells[spell_id].player_1[0] == '\0')
continue;
if (spells[spell_id].targettype != ST_Target && spells[spell_id].CastRestriction != 0) // watch
continue;
auto target_type = BCEnum::TT_None;
switch (spells[spell_id].targettype) {
case ST_GroupTeleport:
@ -196,7 +197,7 @@ public:
}
if (target_type == BCEnum::TT_None)
continue;
uint8 class_levels[16] = { 0 };
bool player_spell = false;
for (int class_type = WARRIOR; class_type <= BERSERKER; ++class_type) {
@ -209,7 +210,7 @@ public:
}
if (!player_spell)
continue;
STBaseEntry* entry_prototype = nullptr;
while (true) {
switch (spells[spell_id].effectid[EFFECTIDTOINDEX(1)]) {
@ -310,7 +311,7 @@ public:
}
if (entry_prototype)
break;
switch (spells[spell_id].effectid[EFFECTIDTOINDEX(2)]) {
case SE_Succor:
entry_prototype = new STEscapeEntry;
@ -334,7 +335,7 @@ public:
}
if (entry_prototype)
break;
while (spells[spell_id].typedescnum == 27) {
if (!spells[spell_id].goodEffect)
break;
@ -351,7 +352,7 @@ public:
}
if (entry_prototype)
break;
switch (spells[spell_id].SpellAffectIndex) {
case 1: {
bool valid_spell = false;
@ -453,7 +454,7 @@ public:
}
if (!entry_prototype)
continue;
if (target_type == BCEnum::TT_Self && (entry_prototype->BCST() != BCEnum::SpT_Stance && entry_prototype->BCST() != BCEnum::SpT_SummonCorpse)) {
#ifdef BCSTSPELLDUMP
LogError("DELETING entry_prototype (primary clause) - name: [{}], target_type: [{}], BCST: [{}]",
@ -532,12 +533,12 @@ public:
spell_entry = new STBaseEntry(entry_prototype);
break;
}
assert(spell_entry);
spell_entry->caster_class = class_type;
spell_entry->spell_level = class_levels[class_index];
bot_command_spells[spell_entry->BCST()].push_back(spell_entry);
if (bot_levels.find(class_type) == bot_levels.end() || bot_levels[class_type] > class_levels[class_index])
@ -546,7 +547,7 @@ public:
delete(entry_prototype);
}
remove_inactive();
order_all();
load_teleport_zone_names();
@ -1152,7 +1153,7 @@ private:
auto bcst_id = static_cast<BCEnum::SpType>(i);
spell_dump << StringFormat("BCSpells::spell_dump(): - '%s' returned %u spells:\n",
BCEnum::SpellTypeEnumToString(bcst_id).c_str(), bot_command_spells[bcst_id].size());
bcst_list& map_entry = bot_command_spells[bcst_id];
for (auto list_iter = map_entry.begin(); list_iter != map_entry.end(); ++list_iter) {
STBaseEntry* list_entry = *list_iter;
@ -1229,7 +1230,7 @@ private:
spell_dump << "\n";
++entry_count;
}
spell_dump << StringFormat("required_bots_map[%s] = \"%s\"\n",
BCEnum::SpellTypeEnumToString(static_cast<BCEnum::SpType>(i)).c_str(), required_bots_map[static_cast<BCEnum::SpType>(i)].c_str());
@ -1477,7 +1478,7 @@ int bot_command_init(void)
working_bcl_iter.first.c_str()
);
}
continue;
}
@ -1487,7 +1488,7 @@ int bot_command_init(void)
working_bcl_iter.first.c_str(),
bcs_iter->second.first
);
if (bcs_iter->second.second.empty()) {
continue;
}
@ -1522,11 +1523,11 @@ int bot_command_init(void)
LogInfo("Failed to process 'Injected Bot Commands' update operation.");
}
}
bot_command_dispatch = bot_command_real_dispatch;
BCSpells::Load();
return bot_command_count;
}
@ -1710,10 +1711,10 @@ namespace MyBots
auto test_bot = my_bot->CastToBot();
if (!test_bot->GetOwner() || !test_bot->GetOwner()->IsClient() || test_bot->GetOwner()->CastToClient() != bot_owner)
return false;
return true;
}
static bool IsMyBotInTargetsGroup(Client *bot_owner, Mob *grouped_bot) {
if (!bot_owner || !grouped_bot || !grouped_bot->GetGroup() || !IsMyBot(bot_owner, grouped_bot))
return false;
@ -1724,7 +1725,7 @@ namespace MyBots
if (!target_mob->GetGroup() || (!target_mob->IsClient() && !target_mob->IsBot()))
return false;
return (grouped_bot->GetGroup() == target_mob->GetGroup());
}
@ -1757,7 +1758,7 @@ namespace MyBots
sbl.clear();
if (!bot_owner || !name)
return;
auto selectable_bot_list = entity_list.GetBotsByBotOwnerCharacterID(bot_owner->CharacterID());
for (auto bot_iter : selectable_bot_list) {
if (!strcasecmp(bot_iter->GetCleanName(), name)) {
@ -1765,7 +1766,7 @@ namespace MyBots
return;
}
}
if (!clear_list)
UniquifySBL(sbl);
}
@ -1785,7 +1786,7 @@ namespace MyBots
if (IsMyBot(bot_owner, member_iter))
sbl.push_back(member_iter);
}
if (!clear_list)
UniquifySBL(sbl);
}
@ -1806,7 +1807,7 @@ namespace MyBots
if (IsMyBot(bot_owner, member_iter))
sbl.push_back(member_iter);
}
if (!clear_list)
UniquifySBL(sbl);
}
@ -1835,11 +1836,11 @@ namespace MyBots
if (IsMyBot(bot_owner, member_iter))
sbl.push_back(member_iter);
}
if (!clear_list)
UniquifySBL(sbl);
}
static void PopulateSBL_ByHealRotation(Client *bot_owner, std::list<Bot*> &sbl, const char* name, bool clear_list = true) {
if (clear_list)
sbl.clear();
@ -1890,11 +1891,11 @@ namespace MyBots
if (IsMyBot(bot_owner, hrm_iter))
sbl.push_back(hrm_iter);
}
if (!clear_list)
UniquifySBL(sbl);
}
static void PopulateSBL_ByHealRotationTargets(Client *bot_owner, std::list<Bot*> &sbl, const char* name, bool clear_list = true) {
if (clear_list)
sbl.clear();
@ -1915,7 +1916,7 @@ namespace MyBots
if (IsMyBot(bot_owner, hrm_iter))
sbl.push_back(static_cast<Bot*>(hrm_iter));
}
if (!clear_list)
UniquifySBL(sbl);
}
@ -2461,7 +2462,7 @@ namespace ActionableBots
sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); });
sbl.remove_if([bot_owner](Bot* l) { return (!l->IsBotArcher()); });
}
static void Filter_ByHighestSkill(Client* bot_owner, std::list<Bot*>& sbl, EQEmu::skills::SkillType skill_type, float& skill_value) {
sbl.remove_if([bot_owner](Bot* l) { return (!MyBots::IsMyBot(bot_owner, l)); });
skill_value = 0.0f;
@ -2610,7 +2611,7 @@ void bot_command_apply_poison(Client *c, const Seperator *sep)
c->Message(m_fail, "Your rogue bot must be level 18 before %s can apply poison!", (my_rogue_bot->GetGender() == 1 ? "she" : "he"));
return;
}
const auto poison_instance = c->GetInv().GetItem(EQEmu::invslot::slotCursor);
if (!poison_instance) {
@ -2748,7 +2749,7 @@ void bot_command_attack(Client *c, const Seperator *sep)
return;
}
if (helper_is_help_or_usage(sep->arg[1])) {
c->Message(m_usage, "usage: <enemy_target> %s [actionable: byname | ownergroup | botgroup | namesgroup | healrotation | default: spawned] ([actionable_name])", sep->arg[0]);
return;
}
@ -2756,7 +2757,7 @@ void bot_command_attack(Client *c, const Seperator *sep)
Mob* target_mob = ActionableTarget::AsSingle_ByAttackable(c);
if (!target_mob) {
c->Message(m_fail, "You must <target> an enemy to use this command");
return;
}
@ -2765,7 +2766,7 @@ void bot_command_attack(Client *c, const Seperator *sep)
if (ab_arg.empty()) {
ab_arg = "spawned";
}
std::list<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, ab_arg.c_str(), sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None) {
return;
@ -2831,7 +2832,7 @@ void bot_command_bind_affinity(Client *c, const Seperator *sep)
c->Message(m_fail, "Failed to bind %s to this location", target_mob->GetCleanName());
break;
}
helper_no_available_bots(c, my_bot);
}
@ -2866,7 +2867,7 @@ void bot_command_bot(Client *c, const Seperator *sep)
"botlist", "botoutofcombat", "botreport", "botspawn", "botstance", "botsummon", "bottogglearcher", "bottogglehelm", "botupdate"
};
*/
if (helper_command_alias_fail(c, "bot_command_bot", sep->arg[0], "bot"))
return;
@ -2890,7 +2891,7 @@ void bot_command_botgroup(Client *c, const Seperator *sep)
"botgroupaddmember", "botgroupcreate", "botgroupdelete", "botgrouplist", "botgroupload", "botgroupremovemember"
};
*/
if (helper_command_alias_fail(c, "bot_command_botgroup", sep->arg[0], "botgroup"))
return;
@ -2946,7 +2947,7 @@ void bot_command_charm(Client *c, const Seperator *sep)
break;
}
helper_no_available_bots(c, my_bot);
}
@ -3016,7 +3017,7 @@ void bot_command_cure(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -3031,7 +3032,7 @@ void bot_command_defensive(Client *c, const Seperator *sep)
return;
}
const int ab_mask = ActionableBots::ABM_Type1;
std::list<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[1], sbl, ab_mask, sep->arg[2]) == ActionableBots::ABT_None)
return;
@ -3127,7 +3128,7 @@ void bot_command_depart(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -3170,7 +3171,7 @@ void bot_command_escape(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -3182,7 +3183,7 @@ void bot_command_find_aliases(Client *c, const Seperator *sep)
c->Message(m_usage, "usage: %s [alias | command]", sep->arg[0]);
return;
}
auto find_iter = bot_command_aliases.find(sep->arg[1]);
if (find_iter == bot_command_aliases.end()) {
c->Message(m_fail, "No bot commands or aliases match '%s'", sep->arg[1]);
@ -3248,7 +3249,7 @@ void bot_command_follow(Client *c, const Seperator *sep)
std::list<Bot*> sbl;
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, sep->arg[name_arg]) == ActionableBots::ABT_None)
return;
sbl.remove(nullptr);
for (auto bot_iter : sbl) {
bot_iter->WipeHateList();
@ -3366,7 +3367,7 @@ void bot_command_heal_rotation(Client *c, const Seperator *sep)
subcommand_list.push_back("healrotationstart");
subcommand_list.push_back("healrotationstop");
/* VS2012 code - end */
/* VS2013 code
const std::list<const char*> subcommand_list = {
"healrotationadaptivetargeting", "healrotationaddmember", "healrotationaddtarget", "healrotationadjustcritical", "healrotationadjustsafe",
@ -3375,7 +3376,7 @@ void bot_command_heal_rotation(Client *c, const Seperator *sep)
"healrotationresetlimits", "healrotationsethot", "healrotationstart", "healrotationstop"
};
*/
if (helper_command_alias_fail(c, "bot_command_heal_rotation", sep->arg[0], "healrotation"))
return;
@ -3401,7 +3402,7 @@ void bot_command_help(Client *c, const Seperator *sep)
{
if (helper_command_alias_fail(c, "bot_command_help", sep->arg[0], "help"))
return;
c->Message(m_message, "Available EQEMu bot commands:");
int bot_commands_shown = 0;
@ -3505,7 +3506,7 @@ void bot_command_identify(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -3581,7 +3582,7 @@ void bot_command_invisibility(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -3647,7 +3648,7 @@ void bot_command_item_use(Client* c, const Seperator* sep)
msg = StringFormat("%cinventorygive byname %s", BOT_COMMAND_CHAR, bot_iter->GetCleanName());
text_link = bot_iter->CreateSayLink(c, msg.c_str(), bot_iter->GetCleanName());
for (auto slot_iter : equipable_slot_list) {
// needs more failure criteria - this should cover the bulk for now
@ -3717,7 +3718,7 @@ void bot_command_levitation(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -3787,7 +3788,7 @@ void bot_command_mesmerize(Client *c, const Seperator *sep)
auto target_mob = actionable_targets.Select(c, local_entry->target_type, ENEMY);
if (!target_mob)
continue;
if (spells[local_entry->spell_id].max[EFFECTIDTOINDEX(1)] < target_mob->GetLevel())
continue;
@ -3850,7 +3851,7 @@ void bot_command_movement_speed(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -3859,7 +3860,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
if (helper_is_help_or_usage(sep->arg[1])) {
c->Message(m_usage, "usage: %s [option] [argument]", sep->arg[0]);
std::string window_title = "Bot Owner Options";
std::string window_text =
"<table>"
@ -3944,7 +3945,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
"<td><c \"#888888\">show current settings</td>"
"</tr>"
"</table>";
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
return;
@ -3964,7 +3965,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
else {
c->SetBotOption(Client::booDeathMarquee, !c->GetBotOption(Client::booDeathMarquee));
}
database.botdb.SaveOwnerOption(c->CharacterID(), Client::booDeathMarquee, c->GetBotOption(Client::booDeathMarquee));
c->Message(m_action, "Bot 'death marquee' is now %s.", (c->GetBotOption(Client::booDeathMarquee) == true ? "enabled" : "disabled"));
@ -4054,7 +4055,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
c->Message(m_action, "Bot 'spawn message' is now %s.", argument.c_str());
}
else if (!owner_option.compare("altcombat")) {
if (RuleB(Bots, AllowOwnerOptionAltCombat)) {
if (!argument.compare("enable")) {
@ -4130,7 +4131,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
c->Message(m_action, "Bot 'monk wu message' is now %s.", (c->GetBotOption(Client::booMonkWuMessage) == true ? "enabled" : "disabled"));
}
else if (!owner_option.compare("current")) {
std::string window_title = "Current Bot Owner Options Settings";
std::string window_text = fmt::format(
"<table>"
@ -4156,7 +4157,7 @@ void bot_command_owner_option(Client *c, const Seperator *sep)
(c->GetBotOption(Client::booBuffCounter) ? "enabled" : "disabled"),
(c->GetBotOption(Client::booMonkWuMessage) ? "enabled" : "disabled")
);
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
}
else {
@ -4172,7 +4173,7 @@ void bot_command_pet(Client *c, const Seperator *sep)
subcommand_list.push_back("petremove");
subcommand_list.push_back("petsettype");
/* VS2012 code - end */
/* VS2013 code
const std::list<const char*> subcommand_list = { "petgetlost", "petremove", "petsettype" };
*/
@ -4205,7 +4206,7 @@ void bot_command_pick_lock(Client *c, const Seperator *sep)
}
Bot* my_bot = sbl.front();
my_bot->InterruptSpell();
Bot::BotGroupSay(my_bot, "Attempting to pick the lock..");
@ -4310,7 +4311,7 @@ void bot_command_pull(Client *c, const Seperator *sep)
if (bot_iter->GetAppearance() == eaDead || bot_iter->GetBotStance() == EQEmu::constants::stancePassive) {
continue;
}
switch (bot_iter->GetClass()) {
case ROGUE:
case MONK:
@ -4385,7 +4386,7 @@ void bot_command_pull(Client *c, const Seperator *sep)
if (bot_puller) {
bot_puller->SetPullFlag();
}
helper_no_available_bots(c, bot_puller);
}
@ -4452,7 +4453,7 @@ void bot_command_resistance(Client *c, const Seperator *sep)
return true;
if (_l->resist_value[RESISTANCEIDTOINDEX(resistance_type)] == _r->resist_value[RESISTANCEIDTOINDEX(resistance_type)] && spells[_l->spell_id].mana == spells[_r->spell_id].mana && _l->resist_total > _r->resist_total)
return true;
return false;
});
@ -4480,14 +4481,14 @@ void bot_command_resistance(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
void bot_command_resurrect(Client *c, const Seperator *sep)
{
// Obscure bot spell code prohibits the aoe portion from working correctly...
bcst_list* local_list = &bot_command_spells[BCEnum::SpT_Resurrect];
if (helper_spell_list_fail(c, local_list, BCEnum::SpT_Resurrect) || helper_command_alias_fail(c, "bot_command_resurrect", sep->arg[0], "resurrect"))
return;
@ -4516,7 +4517,7 @@ void bot_command_resurrect(Client *c, const Seperator *sep)
// continue;
if (local_entry->aoe)
continue;
auto target_mob = actionable_targets.Select(c, local_entry->target_type, FRIENDLY);
//if (!target_mob && !local_entry->aoe)
// continue;
@ -4573,14 +4574,14 @@ void bot_command_rune(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
void bot_command_send_home(Client *c, const Seperator *sep)
{
// Obscure bot spell code prohibits the aoe portion from working correctly...
bcst_list* local_list = &bot_command_spells[BCEnum::SpT_SendHome];
if (helper_spell_list_fail(c, local_list, BCEnum::SpT_SendHome) || helper_command_alias_fail(c, "bot_command_send_home", sep->arg[0], "sendhome"))
return;
@ -4607,7 +4608,7 @@ void bot_command_send_home(Client *c, const Seperator *sep)
continue;
if (local_entry->group != group)
continue;
auto target_mob = actionable_targets.Select(c, local_entry->target_type, FRIENDLY);
if (!target_mob)
continue;
@ -4668,7 +4669,7 @@ void bot_command_size(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -4679,7 +4680,7 @@ void bot_command_summon_corpse(Client *c, const Seperator *sep)
// temp
c->Message(m_fail, "This command is currently unavailable...");
return;
bcst_list* local_list = &bot_command_spells[BCEnum::SpT_SummonCorpse];
if (helper_spell_list_fail(c, local_list, BCEnum::SpT_SummonCorpse) || helper_command_alias_fail(c, "bot_command_summon_corpse", sep->arg[0], "summoncorpse"))
return;
@ -4698,7 +4699,7 @@ void bot_command_summon_corpse(Client *c, const Seperator *sep)
auto local_entry = list_iter;
if (helper_spell_check_fail(local_entry))
continue;
auto target_mob = ActionableTarget::AsSingle_ByPlayer(c);
if (!target_mob)
continue;
@ -4711,7 +4712,7 @@ void bot_command_summon_corpse(Client *c, const Seperator *sep)
continue;
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
@ -4771,12 +4772,12 @@ void bot_command_taunt(Client *c, const Seperator *sep)
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, sep->arg[(ab_arg + 1)]) == ActionableBots::ABT_None)
return;
sbl.remove(nullptr);
int taunting_count = 0;
for (auto bot_iter : sbl) {
if (!bot_iter->GetSkill(EQEmu::skills::SkillTaunt))
continue;
if (toggle_taunt)
bot_iter->SetTaunting(!bot_iter->IsTaunting());
else
@ -4814,10 +4815,10 @@ void bot_command_track(Client *c, const Seperator *sep)
std::list<Bot*> sbl;
MyBots::PopulateSBL_BySpawnedBots(c, sbl);
uint16 class_mask = (PLAYER_CLASS_RANGER_BIT | PLAYER_CLASS_DRUID_BIT | PLAYER_CLASS_BARD_BIT);
ActionableBots::Filter_ByClasses(c, sbl, class_mask);
Bot* my_bot = ActionableBots::AsSpawned_ByMinLevelAndClass(c, sbl, 1, RANGER);
if (tracking_scope.empty()) {
if (!my_bot)
@ -4903,7 +4904,7 @@ void bot_command_water_breathing(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -4926,14 +4927,14 @@ void bot_subcommand_bot_appearance(Client *c, const Seperator *sep)
subcommand_list.push_back("bottattoo");
subcommand_list.push_back("botwoad");
/* VS2012 code - end */
/* VS2013 code
const std::list<const char*> subcommand_list = {
"botbeardcolor", "botbeardstyle", "botdetails", "boteyes", "botface",
"bothaircolor", "bothairstyle", "botheritage", "bottattoo", "botwoad"
};
*/
if (helper_command_alias_fail(c, "bot_subcommand_bot_appearance", sep->arg[0], "botappearance"))
return;
@ -5102,7 +5103,7 @@ void bot_subcommand_bot_clone(Client *c, const Seperator *sep)
if (!database.botdb.CreateCloneBotInventory(c->CharacterID(), my_bot->GetBotID(), clone_id))
c->Message(m_fail, "%s for clone '%s'", BotDatabase::fail::CreateCloneBotInventory(), bot_name.c_str());
c->Message(m_action, "Bot '%s' was successfully cloned to bot '%s'", my_bot->GetCleanName(), bot_name.c_str());
}
@ -5257,7 +5258,7 @@ void bot_subcommand_bot_delete(Client *c, const Seperator *sep)
void bot_subcommand_bot_details(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
if (helper_command_alias_fail(c, "bot_subcommand_bot_details", sep->arg[0], "botdetails"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
@ -5296,10 +5297,10 @@ void bot_subcommand_bot_details(Client *c, const Seperator *sep)
void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
const std::string msg_matslot = StringFormat("mat_slot: %c(All), %i(Head), %i(Chest), %i(Arms), %i(Wrists), %i(Hands), %i(Legs), %i(Feet)",
'*', EQEmu::textures::armorHead, EQEmu::textures::armorChest, EQEmu::textures::armorArms, EQEmu::textures::armorWrist, EQEmu::textures::armorHands, EQEmu::textures::armorLegs, EQEmu::textures::armorFeet);
if (helper_command_alias_fail(c, "bot_subcommand_bot_dye_armor", sep->arg[0], "botdyearmor"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
@ -5377,7 +5378,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
void bot_subcommand_bot_eyes(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
// not sure if left/right bias is allowed in pc-type entities (something is keeping them from being different)
if (helper_command_alias_fail(c, "bot_subcommand_bot_eyes", sep->arg[0], "boteyes"))
return;
@ -5611,7 +5612,7 @@ void bot_subcommand_bot_hairstyle(Client *c, const Seperator *sep)
void bot_subcommand_bot_heritage(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
if (helper_command_alias_fail(c, "bot_subcommand_bot_heritage", sep->arg[0], "botheritage"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
@ -5640,7 +5641,7 @@ void bot_subcommand_bot_heritage(Client *c, const Seperator *sep)
fail_type = BCEnum::AFT_Value;
else
my_bot->SetDrakkinHeritage(uvalue);
if (helper_bot_appearance_fail(c, my_bot, fail_type, "heritage"))
return;
@ -5856,7 +5857,7 @@ void bot_subcommand_bot_out_of_combat(Client *c, const Seperator *sep)
bot_iter->SetAltOutOfCombatBehavior(!bot_iter->GetAltOutOfCombatBehavior());
else
bot_iter->SetAltOutOfCombatBehavior(behavior_state);
helper_bot_out_of_combat(c, bot_iter);
}
}
@ -6069,7 +6070,7 @@ void bot_subcommand_bot_spawn(Client *c, const Seperator *sep)
c->Message(m_fail, "You can't spawn bots while you are engaged.");
return;
}
//if (c->IsEngaged()) {
// c->Message(m_fail, "You can't spawn bots while you are engaged.");
// return;
@ -6143,7 +6144,7 @@ void bot_subcommand_bot_stance(Client *c, const Seperator *sep)
bool current_flag = false;
auto bst = EQEmu::constants::stanceUnknown;
if (!strcasecmp(sep->arg[1], "current"))
current_flag = true;
else if (sep->IsNumber(1)) {
@ -6268,7 +6269,7 @@ void bot_subcommand_bot_summon(Client *c, const Seperator *sep)
void bot_subcommand_bot_tattoo(Client *c, const Seperator *sep)
{
// TODO: Trouble-shoot model update issue
if (helper_command_alias_fail(c, "bot_subcommand_bot_tattoo", sep->arg[0], "bottattoo"))
return;
if (helper_is_help_or_usage(sep->arg[1])) {
@ -6336,7 +6337,7 @@ void bot_subcommand_bot_toggle_archer(Client *c, const Seperator *sep)
for (auto bot_iter : sbl) {
if (!bot_iter)
continue;
if (toggle_archer)
bot_iter->SetBotArcher(!bot_iter->IsBotArcher());
else
@ -6925,7 +6926,7 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep)
safe_delete(botgroup_leader);
return;
}
Group* group_inst = new Group(botgroup_leader);
entity_list.AddGroup(group_inst);
@ -7052,7 +7053,7 @@ void bot_subcommand_circle(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}
@ -7536,7 +7537,7 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
sep->arg[0], CASTING_CYCLE_DEFAULT_INTERVAL_S, CASTING_CYCLE_MINIMUM_INTERVAL_S, CASTING_CYCLE_MAXIMUM_INTERVAL_S);
return;
}
std::string interval_arg;
std::string fast_heals_arg;
std::string adaptive_targeting_arg;
@ -7594,10 +7595,10 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
hr_fast_heals = true;
hr_interval_s = atoi(interval_arg.c_str());
}
if (hr_interval_s < CASTING_CYCLE_MINIMUM_INTERVAL_S || hr_interval_s > CASTING_CYCLE_MAXIMUM_INTERVAL_S)
hr_interval_s = CASTING_CYCLE_DEFAULT_INTERVAL_S;
hr_interval_s *= 1000; // convert to milliseconds for Bot/HealRotation constructor
if (!creator_member->CreateHealRotation(hr_interval_s, hr_fast_heals, hr_adaptive_targeting, hr_casting_override)) {
@ -7613,12 +7614,12 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
if (!database.botdb.LoadHealRotation(creator_member, member_list, target_list, load_flag, member_fail, target_fail))
c->Message(m_fail, "%s", BotDatabase::fail::LoadHealRotation());
if (!load_flag) {
c->Message(m_action, "Successfully added %s as a current member to a new Heal Rotation", creator_member->GetCleanName());
return;
}
if (!member_fail) {
MyBots::PopulateSBL_BySpawnedBots(c, sbl);
for (auto member_iter : member_list) {
@ -7663,7 +7664,7 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
else {
c->Message(m_fail, "%s", BotDatabase::fail::LoadHealRotationTargets());
}
c->Message(m_action, "Successfully loaded %s's Heal Rotation", creator_member->GetCleanName());
}
@ -8198,7 +8199,7 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
c->Message(m_message, "I need something for my %s (slot %i)", EQEmu::invslot::GetInvPossessionsSlotName(i), i);
continue;
}
item = inst->GetItem();
if ((i == EQEmu::invslot::slotPrimary) && item->IsType2HWeapon()) {
is2Hweapon = true;
@ -8272,7 +8273,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep)
c->MessageString(Chat::White, PICK_LORE);
return;
}
std::string error_message;
if (itm) {
c->PushItemOnCursor(*itminst, true);
@ -8517,7 +8518,7 @@ void bot_subcommand_pet_set_type(Client *c, const Seperator *sep)
c->Message(m_fail, "You have no spawned Magician bots capable of using this pet type: '%s'", pet_arg.c_str());
return;
}
uint16 reclaim_energy_id = 331;
for (auto bot_iter : sbl) {
if (!bot_iter)
@ -8588,7 +8589,7 @@ void bot_subcommand_portal(Client *c, const Seperator *sep)
cast_success = helper_cast_standard_spell(my_bot, target_mob, local_entry->spell_id);
break;
}
helper_no_available_bots(c, my_bot);
}

View File

@ -24,6 +24,7 @@
#include "../common/eqemu_logsys.h"
#include "zonedb.h"
#include "zone_store.h"
#include "bot.h"
#include "client.h"
@ -192,7 +193,7 @@ bool BotDatabase::QueryBotCount(const uint32 owner_id, uint32& bot_count)
return false;
if (!results.RowCount())
return true;
auto row = results.begin();
bot_count = atoi(row[0]);
@ -314,7 +315,7 @@ bool BotDatabase::LoadBotID(const uint32 owner_id, const std::string& bot_name,
return false;
if (!results.RowCount())
return true;
auto row = results.begin();
bot_id = atoi(row[0]);
@ -451,7 +452,7 @@ bool BotDatabase::SaveNewBot(Bot* bot_inst, uint32& bot_id)
{
if (!bot_inst)
return false;
query = StringFormat(
"INSERT INTO `bot_data` ("
" `owner_id`,"
@ -596,7 +597,7 @@ bool BotDatabase::SaveBot(Bot* bot_inst)
{
if (!bot_inst)
return false;
query = StringFormat(
"UPDATE `bot_data`"
" SET"
@ -1014,7 +1015,7 @@ bool BotDatabase::LoadTimers(Bot* bot_inst)
if (timer_id >= 0 && timer_id < MaxTimer && timer_value < (Timer::GetCurrentTime() + max_value))
bot_timers[timer_id] = timer_value;
}
return true;
}
@ -1127,7 +1128,7 @@ bool BotDatabase::QueryInventoryCount(const uint32 bot_id, uint32& item_count)
{
if (!bot_id)
return false;
query = StringFormat("SELECT COUNT(`inventories_index`) FROM `bot_inventories` WHERE `bot_id` = '%u'", bot_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
@ -1173,7 +1174,7 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& invent
return false;
if (!results.RowCount())
return true;
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = atoi(row[0]);
if (slot_id < EQEmu::invslot::EQUIPMENT_BEGIN || slot_id > EQEmu::invslot::EQUIPMENT_END)
@ -1281,7 +1282,7 @@ bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint
{
if (!bot_id || slot_id > EQEmu::invslot::EQUIPMENT_END)
return false;
query = StringFormat("SELECT `item_id` FROM `bot_inventories` WHERE `bot_id` = '%i' AND `slot_id` = '%i' LIMIT 1", bot_id, slot_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
@ -1305,11 +1306,11 @@ bool BotDatabase::SaveItemBySlot(Bot* bot_inst, const uint32 slot_id, const EQEm
if (!item_inst || !item_inst->GetID())
return true;
uint32 augment_id[EQEmu::invaug::SOCKET_COUNT] = { 0, 0, 0, 0, 0, 0 };
for (int augment_iter = EQEmu::invaug::SOCKET_BEGIN; augment_iter <= EQEmu::invaug::SOCKET_END; ++augment_iter)
augment_id[augment_iter] = item_inst->GetAugmentItemID(augment_iter);
uint16 item_charges = 0;
if (item_inst->GetCharges() >= 0)
item_charges = item_inst->GetCharges();
@ -1400,7 +1401,7 @@ bool BotDatabase::LoadEquipmentColor(const uint32 bot_id, const uint8 material_s
int16 slot_id = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot_id);
if (slot_id == INVALID_INDEX)
return false;
query = StringFormat("SELECT `inst_color` FROM `bot_inventories` WHERE `bot_id` = '%u' AND `slot_id` = '%u' LIMIT 1", bot_id, slot_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
@ -1451,7 +1452,7 @@ bool BotDatabase::LoadPetIndex(const uint32 bot_id, uint32& pet_index)
{
if (!bot_id)
return false;
query = StringFormat("SELECT `pets_index` FROM `bot_pets` WHERE `bot_id` = '%u' LIMIT 1", bot_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
@ -1461,7 +1462,7 @@ bool BotDatabase::LoadPetIndex(const uint32 bot_id, uint32& pet_index)
auto row = results.begin();
pet_index = atoi(row[0]);
return true;
}
@ -1479,7 +1480,7 @@ bool BotDatabase::LoadPetSpellID(const uint32 bot_id, uint32& pet_spell_id)
auto row = results.begin();
pet_spell_id = atoi(row[0]);
return true;
}
@ -1506,7 +1507,7 @@ bool BotDatabase::LoadPetStats(const uint32 bot_id, std::string& pet_name, uint3
pet_name = row[1];
pet_mana = atoi(row[2]);
pet_hp = atoi(row[3]);
return true;
}
@ -1514,7 +1515,7 @@ bool BotDatabase::SavePetStats(const uint32 bot_id, const std::string& pet_name,
{
if (!bot_id || pet_name.empty() || !pet_spell_id || pet_spell_id > SPDAT_RECORDS)
return false;
if (!DeletePetItems(bot_id))
return false;
if (!DeletePetBuffs(bot_id))
@ -1607,14 +1608,14 @@ bool BotDatabase::LoadPetBuffs(const uint32 bot_id, SpellBuff_Struct* pet_buffs)
++buff_index;
}
return true;
}
bool BotDatabase::SavePetBuffs(const uint32 bot_id, const SpellBuff_Struct* pet_buffs, bool delete_flag)
{
// Only use 'delete_flag' if not invoked after a botdb.SavePetStats() call
if (!bot_id || !pet_buffs)
return false;
@ -1701,14 +1702,14 @@ bool BotDatabase::LoadPetItems(const uint32 bot_id, uint32* pet_items)
pet_items[item_index] = atoi(row[0]);
++item_index;
}
return true;
}
bool BotDatabase::SavePetItems(const uint32 bot_id, const uint32* pet_items, bool delete_flag)
{
// Only use 'delete_flag' if not invoked after a botdb.SavePetStats() call
if (!bot_id || !pet_items)
return false;
@ -1777,7 +1778,7 @@ bool BotDatabase::LoadInspectMessage(const uint32 bot_id, InspectMessage_Struct&
return true;
memcpy(inspect_message.text, bot_message.c_str(), bot_message.size());
return true;
}
@ -1785,7 +1786,7 @@ bool BotDatabase::SaveInspectMessage(const uint32 bot_id, const InspectMessage_S
{
if (!bot_id)
return false;
if (!DeleteInspectMessage(bot_id))
return false;
@ -1825,7 +1826,7 @@ bool BotDatabase::SaveAllInspectMessages(const uint32 owner_id, const InspectMes
if (!DeleteAllInspectMessages(owner_id))
return false;
std::string bot_message = inspect_message.text;
if (bot_message.size() > 255)
bot_message = bot_message.substr(0, 255);
@ -1907,7 +1908,7 @@ bool BotDatabase::SaveHelmAppearance(const uint32 owner_id, const uint32 bot_id,
{
if (!owner_id || !bot_id)
return false;
query = StringFormat(
"UPDATE `bot_data`"
" SET `show_helm` = '%u'"
@ -2025,7 +2026,7 @@ bool BotDatabase::CreateCloneBot(const uint32 owner_id, const uint32 bot_id, con
{
if (!owner_id || !bot_id || clone_name.empty())
return false;
query = StringFormat(
"INSERT INTO `bot_data`"
" ("
@ -2198,7 +2199,7 @@ bool BotDatabase::CreateCloneBotInventory(const uint32 owner_id, const uint32 bo
DeleteItems(clone_id);
return false;
}
return true;
}
@ -2237,7 +2238,7 @@ bool BotDatabase::LoadOwnerOptions(Client *owner)
}
for (auto row : results) {
owner->SetBotOption(static_cast<Client::BotOwnerOption>(atoul(row[0])), (atoul(row[1]) != 0));
}
@ -2369,7 +2370,7 @@ bool BotDatabase::LoadBotGroupIDByLeaderID(const uint32 leader_id, uint32& botgr
auto row = results.begin();
botgroup_id = atoi(row[0]);
return true;
}
@ -2387,7 +2388,7 @@ bool BotDatabase::LoadBotGroupIDByMemberID(const uint32 member_id, uint32& botgr
auto row = results.begin();
botgroup_id = atoi(row[0]);
return true;
}
@ -2405,7 +2406,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupName(const std::string& group_name, uint
auto row = results.begin();
leader_id = atoi(row[0]);
return true;
}
@ -2423,7 +2424,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupID(const uint32 group_id, uint32& leader
auto row = results.begin();
leader_id = atoi(row[0]);
return true;
}
@ -2441,7 +2442,7 @@ bool BotDatabase::LoadBotGroupNameByBotGroupID(const uint32 group_id, std::strin
auto row = results.begin();
botgroup_name = row[0];
return true;
}
@ -2459,7 +2460,7 @@ bool BotDatabase::LoadBotGroupNameByLeaderID(const uint32 leader_id, std::string
auto row = results.begin();
botgroup_name = row[0];
return true;
}
@ -2603,7 +2604,7 @@ bool BotDatabase::LoadBotGroup(const std::string& group_name, std::map<uint32, s
for (auto row = results.begin(); row != results.end(); ++row)
member_list[botgroup_id].push_back(atoi(row[0]));
return true;
}

View File

@ -43,6 +43,7 @@ extern volatile bool RunLoops;
#include "position.h"
#include "worldserver.h"
#include "zonedb.h"
#include "zone_store.h"
#include "petitions.h"
#include "command.h"
#include "water_map.h"
@ -4005,7 +4006,7 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) {
PendingTranslocateData.heading = m_pp.binds[0].heading;
}
else {
PendingTranslocateData.zone_id = ts->ZoneID = content_db.GetZoneID(Spell.teleport_zone);
PendingTranslocateData.zone_id = ts->ZoneID = ZoneID(Spell.teleport_zone);
PendingTranslocateData.instance_id = 0;
PendingTranslocateData.y = ts->y = Spell.base[0];
PendingTranslocateData.x = ts->x = Spell.base[1];
@ -5287,7 +5288,7 @@ void Client::SetStartZone(uint32 zoneid, float x, float y, float z)
}
// check to make sure the zone is valid
const char *target_zone_name = content_db.GetZoneName(zoneid);
const char *target_zone_name = ZoneName(zoneid);
if(target_zone_name == nullptr)
return;
@ -5297,7 +5298,7 @@ void Client::SetStartZone(uint32 zoneid, float x, float y, float z)
}
if (x == 0 && y == 0 && z == 0) {
content_db.GetSafePoints(m_pp.binds[4].zoneId, 0, &m_pp.binds[4].x, &m_pp.binds[4].y, &m_pp.binds[4].z);
content_db.GetSafePoints(ZoneName(m_pp.binds[4].zoneId), 0, &m_pp.binds[4].x, &m_pp.binds[4].y, &m_pp.binds[4].z);
}
else {
m_pp.binds[4].x = x;
@ -9298,7 +9299,7 @@ void Client::SetBotOption(BotOwnerOption boo, bool flag) {
void Client::SendToGuildHall()
{
std::string zone_short_name = "guildhall";
uint32 zone_id = content_db.GetZoneID(zone_short_name.c_str());
uint32 zone_id = ZoneID(zone_short_name.c_str());
if (zone_id == 0) {
return;
}

View File

@ -58,6 +58,7 @@ namespace EQEmu
#include "questmgr.h"
#include "zone.h"
#include "zonedb.h"
#include "zone_store.h"
#ifdef _WINDOWS
// since windows defines these within windef.h (which windows.h include)

View File

@ -790,7 +790,7 @@ void Client::CompleteConnect()
//enforce some rules..
if (!CanBeInZone()) {
LogDebug("[CLIENT] Kicking char from zone, not allowed here");
GoToSafeCoords(content_db.GetZoneID("arena"), 0);
GoToSafeCoords(ZoneID("arena"), 0);
return;
}
@ -6419,7 +6419,7 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
uint16 zid = gmzr->zone_id;
if (gmzr->zone_id == 0)
zid = zonesummon_id;
const char * zname = content_db.GetZoneName(zid);
const char * zname = ZoneName(zid);
if (zname == nullptr)
tarzone[0] = 0;
else
@ -12441,7 +12441,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
{
// if the character has a start city, don't let them use the command
if (m_pp.binds[4].zoneId != 0 && m_pp.binds[4].zoneId != 189) {
Message(Chat::Yellow, "Your home city has already been set.", m_pp.binds[4].zoneId, content_db.GetZoneName(m_pp.binds[4].zoneId));
Message(Chat::Yellow, "Your home city has already been set.", m_pp.binds[4].zoneId, ZoneName(m_pp.binds[4].zoneId));
return;
}
@ -12507,7 +12507,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
zoneid = atoi(row[0]);
char* name = nullptr;
content_db.GetZoneLongName(content_db.GetZoneName(zoneid), &name);
content_db.GetZoneLongName(ZoneName(zoneid), &name);
Message(Chat::Yellow, "%d - %s", zoneid, name);
}

View File

@ -53,6 +53,7 @@
#include "worldserver.h"
#include "zone.h"
#include "zonedb.h"
#include "zone_store.h"
extern QueryServ* QServ;
extern Zone* zone;
@ -129,7 +130,7 @@ bool Client::Process() {
CheckManaEndUpdate();
if (dead && dead_timer.Check()) {
database.MoveCharacterToZone(GetName(), content_db.GetZoneName(m_pp.binds[0].zoneId));
database.MoveCharacterToZone(GetName(), m_pp.binds[0].zoneId);
m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zoneInstance = m_pp.binds[0].instance_id;
@ -2087,7 +2088,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
m_pp.zone_id = chosen->zone_id;
m_pp.zoneInstance = chosen->instance_id;
database.MoveCharacterToZone(CharacterID(), content_db.GetZoneName(chosen->zone_id));
database.MoveCharacterToZone(CharacterID(), chosen->zone_id);
Save();

View File

@ -1171,7 +1171,7 @@ void command_zone(Client *c, const Seperator *sep)
return;
}
zoneid = content_db.GetZoneID(sep->arg[1]);
zoneid = ZoneID(sep->arg[1]);
if(zoneid == 0) {
c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]);
return;
@ -1306,7 +1306,7 @@ void command_peqzone(Client *c, const Seperator *sep)
return;
}
else {
zoneid = content_db.GetZoneID(sep->arg[1]);
zoneid = ZoneID(sep->arg[1]);
destzone = content_db.GetPEQZone(zoneid, 0);
if(zoneid == 0) {
c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]);
@ -1344,7 +1344,7 @@ void command_movechar(Client *c, const Seperator *sep)
if (tmp)
{
if (c->Admin() >= commandMovecharSelfOnly || tmp == c->AccountID())
if (!database.MoveCharacterToZone((char*) sep->arg[1], (char*) sep->arg[2]))
if (!database.MoveCharacterToZone((char*) sep->arg[1], ZoneID(sep->arg[2])))
c->Message(Chat::White, "Character Move Failed!");
else
c->Message(Chat::White, "Character has been moved.");
@ -2105,7 +2105,7 @@ void command_zheader(Client *c, const Seperator *sep)
if(sep->arg[1][0]==0) {
c->Message(Chat::White, "Usage: #zheader <zone name>");
}
else if(content_db.GetZoneID(sep->argplus[1])==0)
else if(ZoneID(sep->argplus[1])==0)
c->Message(Chat::White, "Invalid Zone Name: %s", sep->argplus[1]);
else {
@ -4290,7 +4290,7 @@ void command_zoneshutdown(Client *c, const Seperator *sep)
if (sep->arg[1][0] >= '0' && sep->arg[1][0] <= '9')
s->ZoneServerID = atoi(sep->arg[1]);
else
s->zoneid = content_db.GetZoneID(sep->arg[1]);
s->zoneid = ZoneID(sep->arg[1]);
worldserver.SendPacket(pack);
safe_delete(pack);
}
@ -4308,7 +4308,7 @@ void command_zonebootup(Client *c, const Seperator *sep)
ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer;
s->ZoneServerID = atoi(sep->arg[1]);
strcpy(s->adminname, c->GetName());
s->zoneid = content_db.GetZoneID(sep->arg[2]);
s->zoneid = ZoneID(sep->arg[2]);
s->makestatic = (bool) (strcasecmp(sep->arg[3], "static") == 0);
worldserver.SendPacket(pack);
safe_delete(pack);
@ -4491,7 +4491,7 @@ void command_zonelock(Client *c, const Seperator *sep)
worldserver.SendPacket(pack);
}
else if (strcasecmp(sep->arg[1], "lock") == 0 && c->Admin() >= commandLockZones) {
uint16 tmp = content_db.GetZoneID(sep->arg[2]);
uint16 tmp = ZoneID(sep->arg[2]);
if (tmp) {
s->op = 1;
s->zoneID = tmp;
@ -4501,7 +4501,7 @@ void command_zonelock(Client *c, const Seperator *sep)
c->Message(Chat::White, "Usage: #zonelock lock [zonename]");
}
else if (strcasecmp(sep->arg[1], "unlock") == 0 && c->Admin() >= commandLockZones) {
uint16 tmp = content_db.GetZoneID(sep->arg[2]);
uint16 tmp = ZoneID(sep->arg[2]);
if (tmp) {
s->op = 2;
s->zoneID = tmp;
@ -4908,7 +4908,7 @@ void command_gmzone(Client *c, const Seperator *sep)
const char *zone_short_name = sep->arg[1];
auto zone_version = static_cast<uint32>(sep->arg[2] ? atoi(sep->arg[2]) : 0);
std::string identifier = "gmzone";
uint32 zone_id = content_db.GetZoneID(zone_short_name);
uint32 zone_id = ZoneID(zone_short_name);
uint32 duration = 100000000;
uint16 instance_id = 0;
@ -9206,7 +9206,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
if(sep->arg[2][0] != '\0') {
zoneid = atoi(sep->arg[2]);
if(zoneid < 1) {
zoneid = content_db.GetZoneID(sep->arg[2]);
zoneid = ZoneID(sep->arg[2]);
}
}
if(zoneid < 1) {
@ -9231,7 +9231,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
return;
}
c->Message(Chat::Yellow, "Success! Zone %s now requires a flag, named %s", content_db.GetZoneName(zoneid), flag_name);
c->Message(Chat::Yellow, "Success! Zone %s now requires a flag, named %s", ZoneName(zoneid), flag_name);
return;
}
@ -9240,7 +9240,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
if(sep->arg[2][0] != '\0') {
zoneid = atoi(sep->arg[2]);
if(zoneid < 1) {
zoneid = content_db.GetZoneID(sep->arg[2]);
zoneid = ZoneID(sep->arg[2]);
}
}
@ -9258,7 +9258,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
return;
}
c->Message(Chat::Yellow, "Success! Zone %s no longer requires a flag.", content_db.GetZoneName(zoneid));
c->Message(Chat::Yellow, "Success! Zone %s no longer requires a flag.", ZoneName(zoneid));
return;
}
@ -9282,7 +9282,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
if(sep->arg[2][0] != '\0') {
zoneid = atoi(sep->arg[2]);
if(zoneid < 1) {
zoneid = content_db.GetZoneID(sep->arg[2]);
zoneid = ZoneID(sep->arg[2]);
}
}
if(zoneid < 1) {
@ -9305,7 +9305,7 @@ void command_flagedit(Client *c, const Seperator *sep) {
if(sep->arg[2][0] != '\0') {
zoneid = atoi(sep->arg[2]);
if(zoneid < 1) {
zoneid = content_db.GetZoneID(sep->arg[2]);
zoneid = ZoneID(sep->arg[2]);
}
}
if(zoneid < 1) {
@ -9770,7 +9770,7 @@ void command_setgraveyard(Client *c, const Seperator *sep)
return;
}
zoneid = content_db.GetZoneID(sep->arg[1]);
zoneid = ZoneID(sep->arg[1]);
if(zoneid > 0) {
graveyard_id = content_db.CreateGraveyardRecord(zoneid, t->GetPosition());
@ -9806,7 +9806,7 @@ void command_deletegraveyard(Client *c, const Seperator *sep)
return;
}
zoneid = content_db.GetZoneID(sep->arg[1]);
zoneid = ZoneID(sep->arg[1]);
graveyard_id = content_db.GetZoneGraveyardID(zoneid, 0);
if(zoneid > 0 && graveyard_id > 0) {
@ -10211,12 +10211,12 @@ void command_instance(Client *c, const Seperator *sep)
}
else
{
zone_id = content_db.GetZoneID(sep->arg[2]);
zone_id = ZoneID(sep->arg[2]);
}
uint32 version = atoi(sep->arg[3]);
uint32 duration = atoi(sep->arg[4]);
zn = content_db.GetZoneName(zone_id);
zn = ZoneName(zone_id);
if(!zn)
{
@ -10371,7 +10371,7 @@ void command_setstartzone(Client *c, const Seperator *sep)
startzone = 0;
}
else {
startzone = content_db.GetZoneID(sep->arg[1]);
startzone = ZoneID(sep->arg[1]);
if(startzone == 0) {
c->Message(Chat::White, "Unable to locate zone '%s'", sep->arg[1]);
return;

View File

@ -141,7 +141,7 @@ Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std:
pc->consented_guild_id = guild_consent_id;
pc->UpdateEquipmentLight(); // itemlist populated above..need to determine actual values
safe_delete_array(pcs);
return pc;
@ -339,7 +339,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
// TODO soulbound items need not be added to corpse, but they need
// to go into the regular slots on the player, out of bags
std::list<uint32> removed_list;
// ideally, we would start at invslot::slotGeneral1 and progress to invslot::slotCursor..
// ..then regress and process invslot::EQUIPMENT_BEGIN through invslot::EQUIPMENT_END...
// without additional work to database loading of player corpses, this order is not
@ -837,7 +837,7 @@ bool Corpse::Process() {
spc->zone_id = zone->graveyard_zoneid();
worldserver.SendPacket(pack);
safe_delete(pack);
LogDebug("Moved [{}] player corpse to the designated graveyard in zone [{}]", this->GetName(), content_db.GetZoneName(zone->graveyard_zoneid()));
LogDebug("Moved [{}] player corpse to the designated graveyard in zone [{}]", this->GetName(), ZoneName(zone->graveyard_zoneid()));
corpse_db_id = 0;
}
@ -941,7 +941,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
SendLootReqErrorPacket(client, LootResponse::TooFar);
return;
}
if (being_looted_by != 0xFFFFFFFF && being_looted_by != client->GetID()) {
SendLootReqErrorPacket(client, LootResponse::SomeoneElse);
return;
@ -1078,16 +1078,16 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
auto loot_slot = EQEmu::invslot::CORPSE_BEGIN;
auto corpse_mask = client->GetInv().GetLookup()->CorpseBitmask;
for (auto item_data : itemlist) {
// every loot session must either set all items' lootslots to 'invslot::SLOT_INVALID'
// or to a valid enumerated client-versioned corpse slot (lootslot is not equip_slot)
item_data->lootslot = 0xFFFF;
// align server and client corpse slot mappings so translators can function properly
while (loot_slot <= EQEmu::invslot::CORPSE_END && (((uint64)1 << loot_slot) & corpse_mask) == 0)
++loot_slot;
if (loot_slot > EQEmu::invslot::CORPSE_END)
continue;
@ -1098,7 +1098,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if (item_data->equip_slot < EQEmu::invslot::POSSESSIONS_BEGIN || item_data->equip_slot > EQEmu::invslot::POSSESSIONS_END)
continue;
}
const auto *item = database.GetItem(item_data->item_id);
auto inst = database.CreateItem(
item,
@ -1121,7 +1121,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
client->SendItemPacket(loot_slot, inst, ItemPacketLoot);
safe_delete(inst);
item_data->lootslot = loot_slot++;
}
@ -1574,21 +1574,21 @@ void Corpse::UpdateEquipmentLight()
for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) {
if ((*iter)->equip_slot < EQEmu::invslot::EQUIPMENT_BEGIN || (*iter)->equip_slot > EQEmu::invslot::EQUIPMENT_END) { continue; }
if ((*iter)->equip_slot == EQEmu::invslot::slotAmmo) { continue; }
auto item = database.GetItem((*iter)->item_id);
if (item == nullptr) { continue; }
if (EQEmu::lightsource::IsLevelGreater(item->Light, m_Light.Type[EQEmu::lightsource::LightEquipment]))
m_Light.Type[EQEmu::lightsource::LightEquipment] = item->Light;
}
uint8 general_light_type = 0;
for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) {
if ((*iter)->equip_slot < EQEmu::invslot::GENERAL_BEGIN || (*iter)->equip_slot > EQEmu::invslot::GENERAL_END) { continue; }
auto item = database.GetItem((*iter)->item_id);
if (item == nullptr) { continue; }
if (!item->IsClassCommon()) { continue; }
if (item->Light < 9 || item->Light > 13) { continue; }

View File

@ -2,6 +2,7 @@
#include <utility>
#include "../common/string_util.h"
#include "zonedb.h"
#include "zone_store.h"
#include <ctime>
#include <cctype>
#include <algorithm>
@ -172,4 +173,4 @@ uint32 DataBucket::ParseStringTimeToInt(std::string time_string)
duration = unit * 31556926;
return duration;
}
}

View File

@ -28,6 +28,7 @@
#include "string_ids.h"
#include "worldserver.h"
#include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h"
#include <iostream>
@ -452,7 +453,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
if (!disable_add_to_key_ring) {
sender->KeyRingAdd(player_key);
}
if (content_db.GetZoneID(destination_zone_name) == zone->GetZoneID()) {
if (ZoneID(destination_zone_name) == zone->GetZoneID()) {
sender->MovePC(
zone->GetZoneID(),
zone->GetInstanceID(),
@ -463,7 +464,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
);
} else {
sender->MovePC(
content_db.GetZoneID(destination_zone_name),
ZoneID(destination_zone_name),
static_cast<uint32>(destination_instance_id),
m_Destination.x,
m_Destination.y,
@ -474,7 +475,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
}
if ((!IsDoorOpen() || open_type == 58) && (!required_key_item)) {
if (content_db.GetZoneID(destination_zone_name) == zone->GetZoneID()) {
if (ZoneID(destination_zone_name) == zone->GetZoneID()) {
sender->MovePC(
zone->GetZoneID(),
zone->GetInstanceID(),
@ -485,7 +486,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
);
} else {
sender->MovePC(
content_db.GetZoneID(destination_zone_name),
ZoneID(destination_zone_name),
static_cast<uint32>(this->destination_instance_id),
m_Destination.x,
m_Destination.y,

View File

@ -28,6 +28,7 @@
#include "string_ids.h"
#include "worldserver.h"
#include "zonedb.h"
#include "zone_store.h"
#include "position.h"
float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard)
@ -554,7 +555,7 @@ int Client::GetDiscSlotBySpellID(int32 spellid)
if(m_pp.disciplines.values[i] == spellid)
return i;
}
return -1;
}

View File

@ -30,6 +30,7 @@
#include "titles.h"
#include "water_map.h"
#include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h"
#include <iostream>

View File

@ -24,6 +24,7 @@
#include "guild_mgr.h"
#include "worldserver.h"
#include "zonedb.h"
#include "zone_store.h"
ZoneGuildManager guild_mgr;
GuildBankManager *GuildBanks;

View File

@ -23,6 +23,7 @@
#include "quest_parser_collection.h"
#include "worldserver.h"
#include "zonedb.h"
#include "zone_store.h"
extern WorldServer worldserver;
@ -231,7 +232,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
bool enforcewear = RuleB(Inventory, EnforceAugmentWear);
bool enforcerestr = RuleB(Inventory, EnforceAugmentRestriction);
bool enforceusable = RuleB(Inventory, EnforceAugmentUsability);
for (int iter = EQEmu::invaug::SOCKET_BEGIN; iter <= EQEmu::invaug::SOCKET_END; ++iter) {
const EQEmu::ItemData* augtest = database.GetItem(augments[iter]);
@ -249,7 +250,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(CheckLoreConflict(augtest)) {
// DuplicateLoreMessage(augtest->ID);
Message(Chat::Red, "You already have a lore %s (%u) in your inventory.", augtest->Name, augtest->ID);
return false;
}
// check that augment is an actual augment
@ -257,7 +258,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
Message(Chat::Red, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1);
LogInventory("Player [{}] on account [{}] attempted to use a non-augment item (Aug[{}]) as an augment.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n",
GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -504,7 +505,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// validation passed..so, set the charges and create the actual item
// if the item is stackable and the charge amount is -1 or 0 then set to 1 charge.
// removed && item->MaxCharges == 0 if -1 or 0 was passed max charges is irrelevant
// removed && item->MaxCharges == 0 if -1 or 0 was passed max charges is irrelevant
if(charges <= 0 && item->Stackable)
charges = 1;
@ -534,7 +535,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// attune item
if(attuned && inst->GetItem()->Attuneable)
inst->SetAttuned(true);
inst->SetOrnamentIcon(ornament_icon);
inst->SetOrnamentationIDFile(ornament_idfile);
inst->SetOrnamentHeroModel(ornament_hero_model);
@ -584,7 +585,7 @@ void Client::DropItem(int16 slot_id, bool recurse)
{
LogInventory("[{}] (char_id: [{}]) Attempting to drop item from slot [{}] on the ground",
GetCleanName(), CharacterID(), slot_id);
if(GetInv().CheckNoDrop(slot_id, recurse) && RuleI(World, FVNoDropFlag) == 0 ||
RuleI(Character, MinStatusForNoDropExemptions) < Admin() && RuleI(World, FVNoDropFlag) == 2)
{
@ -1016,7 +1017,7 @@ bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst,
SendItemPacket(slot_id, &inst, ((slot_id == EQEmu::invslot::slotCursor) ? ItemPacketLimbo : ItemPacketTrade));
//SendWearChange(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id));
}
if (slot_id == EQEmu::invslot::slotCursor) {
auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend();
return database.SaveCursor(this->CharacterID(), s, e);
@ -1054,7 +1055,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst,
else {
SendLootItemInPacket(&inst, slot_id);
}
if (bag_item_data) {
for (int index = EQEmu::invbag::SLOT_BEGIN; index <= EQEmu::invbag::SLOT_END; ++index) {
if (bag_item_data[index] == nullptr)
@ -1168,7 +1169,7 @@ bool Client::AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn, bo
if (worn_slot_material != EQEmu::textures::materialInvalid) {
SendWearChange(worn_slot_material);
}
parse->EventItem(EVENT_EQUIP_ITEM, this, &inst, nullptr, "", i);
return true;
}
@ -1245,7 +1246,7 @@ bool MakeItemLink(char* &ret_link, const ItemData *item, uint32 aug0, uint32 aug
//int hash = GetItemLinkHash(inst); //eventually this will work (currently crashes zone), but for now we'll skip the extra overhead
int hash = NOT_USED;
// Tested with UF and RoF..there appears to be a problem with using non-augment arguments below...
// Currently, enabling them causes misalignments in what the client expects. I haven't looked
// into it further to determine the cause..but, the function is setup to accept the parameters.
@ -1935,7 +1936,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
fail_message = "Your class, deity and/or race may not equip that item.";
else if (fail_state == EQEmu::InventoryProfile::swapLevel)
fail_message = "You are not sufficient level to use this item.";
if (fail_message)
Message(Chat::Red, "%s", fail_message);
@ -2203,7 +2204,7 @@ void Client::DyeArmor(EQEmu::TintProfile* dye){
EQEmu::ItemInstance* inst = this->m_inv.GetItem(slot2);
if(inst){
uint32 armor_color = ((uint32)dye->Slot[i].Red << 16) | ((uint32)dye->Slot[i].Green << 8) | ((uint32)dye->Slot[i].Blue);
inst->SetColor(armor_color);
inst->SetColor(armor_color);
database.SaveCharacterMaterialColor(this->CharacterID(), i, armor_color);
database.SaveInventory(CharacterID(),inst,slot2);
if(dye->Slot[i].UseTint)
@ -2225,7 +2226,7 @@ void Client::DyeArmor(EQEmu::TintProfile* dye){
auto outapp = new EQApplicationPacket(OP_Dye, 0);
QueuePacket(outapp);
safe_delete(outapp);
}
#if 0
@ -2318,7 +2319,7 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
for (x = EQEmu::invbag::CURSOR_BAG_BEGIN; x <= EQEmu::invbag::CURSOR_BAG_END; ++x) {
if (num >= amt)
break;
TempItem = nullptr;
ins = GetInv().GetItem(x);
if (ins)
@ -2343,7 +2344,7 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) {
TempItem = ins->GetItem();
if (TempItem && TempItem->ID != type)
continue;
if (ins->GetCharges() < amt) {
amt -= ins->GetCharges();
DeleteItemInInventory(x, amt, true);
@ -2534,7 +2535,7 @@ void Client::DisenchantSummonedBags(bool client_update)
if (!new_item) { continue; }
auto new_inst = database.CreateBaseItem(new_item);
if (!new_inst) { continue; }
if (CopyBagContents(new_inst, inst)) {
LogInventory("Disenchant Summoned Bags: Replacing [{}] with [{}] in slot [{}]", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id);
PutItemInInventory(slot_id, *new_inst, client_update);
@ -2708,7 +2709,7 @@ void Client::RemoveDuplicateLore(bool client_update)
}
safe_delete(inst);
}
for (auto slot_id = EQEmu::invslot::GENERAL_BEGIN; slot_id <= EQEmu::invslot::GENERAL_END; ++slot_id) {
if (((uint64)1 << slot_id) & GetInv().GetLookup()->PossessionsBitmask == 0)
continue;
@ -3002,7 +3003,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app)
LogInventory("Char: [{}] Creating Bandolier Set [{}], Set Name: [{}]", GetName(), bs->Number, bs->Name);
strcpy(m_pp.bandoliers[bs->Number].Name, bs->Name);
const EQEmu::ItemInstance* InvItem = nullptr;
const EQEmu::ItemInstance* InvItem = nullptr;
const EQEmu::ItemData *BaseItem = nullptr;
int16 WeaponSlot = 0;
@ -3033,7 +3034,7 @@ void Client::RemoveBandolier(const EQApplicationPacket *app)
memset(m_pp.bandoliers[bds->Number].Name, 0, 32);
for(int i = bandolierPrimary; i <= bandolierAmmo; i++) {
m_pp.bandoliers[bds->Number].Items[i].ID = 0;
m_pp.bandoliers[bds->Number].Items[i].Icon = 0;
m_pp.bandoliers[bds->Number].Items[i].Icon = 0;
}
database.DeleteCharacterBandolier(this->CharacterID(), bds->Number);
}

View File

@ -26,6 +26,7 @@
#include "mob.h"
#include "npc.h"
#include "zonedb.h"
#include "zone_store.h"
#include "global_loot_manager.h"
#include "../common/repositories/criteria/content_filter_criteria.h"

View File

@ -56,6 +56,7 @@
#include "bot_command.h"
#endif
#include "zonedb.h"
#include "zone_store.h"
#include "zone_config.h"
#include "titles.h"
#include "guild_mgr.h"
@ -318,11 +319,7 @@ int main(int argc, char** argv) {
LogInfo("Loading zone names");
// Load to both context for now... this needs to be cleaned up as this has always been cludgy
content_db.LoadZoneNames();
database.zonename_array = content_db.zonename_array;
zone_store.LoadZonesStore();
zone_store.LoadZones();
LogInfo("Loading items");
if (!database.LoadItems(hotfix_name)) {
@ -474,7 +471,7 @@ int main(int argc, char** argv) {
}
else if (!Zone::Bootup(ZoneID(zone_name), instance_id, true)) {
LogError("Zone Bootup failed :: Zone::Bootup");
zone = 0;
zone = nullptr;
}
//register all the patches we have avaliable with the stream identifier.

View File

@ -27,6 +27,7 @@
#include "mob.h"
#include "quest_parser_collection.h"
#include "zonedb.h"
#include "zone_store.h"
#ifdef BOTS
#include "bot.h"
@ -545,4 +546,4 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 h
entity_list.QueueClients(this, outapp);
safe_delete(outapp);
}
}

View File

@ -8,6 +8,7 @@
#include "zone.h"
#include "spawngroup.h"
#include "zonedb.h"
#include "zone_store.h"
#include "npc.h"
#include "mob.h"
#include "client.h"

View File

@ -23,6 +23,7 @@
#include "mob.h"
#include "qglobals.h"
#include "zonedb.h"
#include "zone_store.h"
#include "zonedump.h"
#include <deque>
@ -512,7 +513,7 @@ protected:
uint32 npc_spells_id;
uint8 casting_spell_AIindex;
uint32* pDontCastBefore_casting_spell;
std::vector<AISpells_Struct> AIspells;
bool HasAISpell;

View File

@ -26,6 +26,7 @@
#include "quest_parser_collection.h"
#include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h"
#include <iostream>

View File

@ -25,6 +25,7 @@
#include "client.h"
#include "zonedb.h"
#include "zone_store.h"
class Client;

View File

@ -27,6 +27,7 @@
#include "pets.h"
#include "zonedb.h"
#include "zone_store.h"
#include <string>
@ -230,7 +231,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
memcpy(npc_type, base, sizeof(NPCType));
// If pet power is set to -1 in the DB, use stat scaling
if ((this->IsClient()
if ((this->IsClient()
#ifdef BOTS
|| this->IsBot()
#endif
@ -620,7 +621,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) {
if (item2) {
bool noDrop=(item2->NoDrop == 0); // Field is reverse logic
bool petCanHaveNoDrop = (RuleB(Pets, CanTakeNoDrop) &&
bool petCanHaveNoDrop = (RuleB(Pets, CanTakeNoDrop) &&
_CLIENTPET(this) && GetPetType() <= petOther);
if (!noDrop || petCanHaveNoDrop) {

View File

@ -19,6 +19,7 @@
#define __QUEST_H__
#include "zonedb.h"
#include "zone_store.h"
typedef struct _tag_quest_entry{
char *m_pQuestName;

View File

@ -35,6 +35,7 @@
#include "worldserver.h"
#include "zone.h"
#include "zonedb.h"
#include "zone_store.h"
#include <iostream>
#include <limits.h>
@ -397,7 +398,7 @@ void QuestManager::Zone(const char *zone_name) {
ztz->response = 0;
ztz->current_zone_id = zone->GetZoneID();
ztz->current_instance_id = zone->GetInstanceID();
ztz->requested_zone_id = content_db.GetZoneID(zone_name);
ztz->requested_zone_id = ZoneID(zone_name);
ztz->admin = initiator->Admin();
strcpy(ztz->name, initiator->GetName());
ztz->guild_id = initiator->GuildID();
@ -639,9 +640,9 @@ void QuestManager::resumetimer(const char *timer_name) {
bool QuestManager::ispausedtimer(const char *timer_name) {
QuestManagerCurrentQuestVars();
std::list<PausedTimer>::iterator pcur = PTimerList.begin(), pend;
pend = PTimerList.end();
while (pcur != pend)
{
@ -1017,7 +1018,7 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
((spell_id >= 0 && spell_id < SPDAT_RECORDS) ? spells[spell_id].name : "Out-of-range"),
spell_id
);
break;
}
if (spell_id < 0 || spell_id >= SPDAT_RECORDS) {
@ -1940,7 +1941,7 @@ int QuestManager::getplayercorpsecount(uint32 char_id) {
return database.CountCharacterCorpses(char_id);
}
return 0;
}
int QuestManager::getplayercorpsecountbyzoneid(uint32 char_id, uint32 zone_id) {
@ -2628,7 +2629,7 @@ int QuestManager::countitem(uint32 item_id) {
{ EQEmu::invslot::SHARED_BANK_BEGIN, EQEmu::invslot::SHARED_BANK_END },
{ EQEmu::invbag::SHARED_BANK_BAGS_BEGIN, EQEmu::invbag::SHARED_BANK_BAGS_END },
};
const size_t size = sizeof(slots) / sizeof(slots[0]);
const size_t size = sizeof(slots) / sizeof(slots[0]);
for (int slot_index = 0; slot_index < size; ++slot_index) {
for (int slot_id = slots[slot_index][0]; slot_id <= slots[slot_index][1]; ++slot_id) {
item = initiator->GetInv().GetItem(slot_id);
@ -2753,7 +2754,7 @@ uint16 QuestManager::CreateInstance(const char *zone, int16 version, uint32 dura
QuestManagerCurrentQuestVars();
if(initiator)
{
uint32 zone_id = content_db.GetZoneID(zone);
uint32 zone_id = ZoneID(zone);
if(zone_id == 0)
return 0;
@ -2806,10 +2807,10 @@ uint32 QuestManager::GetInstanceTimer() {
uint32 QuestManager::GetInstanceTimerByID(uint16 instance_id) {
if (instance_id == 0)
return 0;
std::string query = StringFormat("SELECT ((start_time + duration) - UNIX_TIMESTAMP()) AS `remaining` FROM `instance_list` WHERE `id` = %lu", (unsigned long)instance_id);
auto results = database.QueryDatabase(query);
if (results.Success()) {
auto row = results.begin();
uint32 timer = atoi(row[0]);
@ -2823,13 +2824,13 @@ uint16 QuestManager::GetInstanceID(const char *zone, int16 version)
QuestManagerCurrentQuestVars();
if (initiator)
{
return database.GetInstanceID(zone, initiator->CharacterID(), version);
return database.GetInstanceID(ZoneID(zone), initiator->CharacterID(), version);
}
return 0;
}
uint16 QuestManager::GetInstanceIDByCharID(const char *zone, int16 version, uint32 char_id) {
return database.GetInstanceID(zone, char_id, version);
return database.GetInstanceID(ZoneID(zone), char_id, version);
}
void QuestManager::AssignToInstance(uint16 instance_id)
@ -3181,7 +3182,7 @@ uint16 QuestManager::CreateDoor(const char* model, float x, float y, float z, fl
}
int32 QuestManager::GetZoneID(const char *zone) {
return static_cast<int32>(content_db.GetZoneID(zone));
return static_cast<int32>(ZoneID(zone));
}
const char* QuestManager::GetZoneLongName(const char *zone) {

View File

@ -26,6 +26,7 @@
#include "worldserver.h"
#include "zone.h"
#include "zonedb.h"
#include "zone_store.h"
extern EntityList entity_list;
extern Zone* zone;
@ -461,7 +462,7 @@ bool ZoneDatabase::PopulateZoneSpawnListClose(uint32 zoneid, LinkedList<Spawn2*>
}
}
const char *zone_name = content_db.GetZoneName(zoneid);
const char *zone_name = ZoneName(zoneid);
std::string query = StringFormat(
"SELECT "
"id, "
@ -565,7 +566,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
}
}
const char *zone_name = content_db.GetZoneName(zoneid);
const char *zone_name = ZoneName(zoneid);
std::string query = StringFormat(
"SELECT "
"id, "
@ -1217,7 +1218,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance
auto pack = new ServerPacket(ServerOP_SpawnCondition, sizeof(ServerSpawnCondition_Struct));
ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*)pack->pBuffer;
ssc->zoneID = content_db.GetZoneID(zone_short);
ssc->zoneID = ZoneID(zone_short);
ssc->instanceID = instance_id;
ssc->condition_id = condition_id;
ssc->value = new_value;
@ -1349,7 +1350,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
auto pack = new ServerPacket(ServerOP_SpawnEvent, sizeof(ServerSpawnEvent_Struct));
ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*)pack->pBuffer;
sse->zoneID = content_db.GetZoneID(zone_short_name.c_str());
sse->zoneID = ZoneID(zone_short_name.c_str());
sse->event_id = event_id;
worldserver.SendPacket(pack);

View File

@ -24,6 +24,7 @@
#include "spawngroup.h"
#include "zone.h"
#include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/criteria/content_filter_criteria.h"
extern EntityList entity_list;

View File

@ -31,6 +31,7 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
#include "../common/string_util.h"
#include "../common/say_link.h"
#include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/goallists_repository.h"
#include "client.h"
#include "entity.h"

View File

@ -33,6 +33,7 @@
#include "string_ids.h"
#include "titles.h"
#include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/character_recipe_list_repository.h"
#include "../common/repositories/tradeskill_recipe_repository.h"

View File

@ -583,7 +583,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
case ServerOP_ZonePlayer: {
ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*)pack->pBuffer;
Client* client = entity_list.GetClientByName(szp->name);
printf("Zoning %s to %s(%u) - %u\n", client != nullptr ? client->GetCleanName() : "Unknown", szp->zone, content_db.GetZoneID(szp->zone), szp->instance_id);
printf("Zoning %s to %s(%u) - %u\n", client != nullptr ? client->GetCleanName() : "Unknown", szp->zone, ZoneID(szp->zone), szp->instance_id);
if (client != 0) {
if (strcasecmp(szp->adminname, szp->name) == 0)
client->Message(Chat::White, "Zoning to: %s", szp->zone);
@ -593,17 +593,17 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
SendEmoteMessage(szp->adminname, 0, 0, "Summoning %s to %s %1.1f, %1.1f, %1.1f", szp->name, szp->zone, szp->x_pos, szp->y_pos, szp->z_pos);
}
if (!szp->instance_id) {
client->MovePC(content_db.GetZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon);
client->MovePC(ZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon);
}
else {
if (database.GetInstanceID(client->CharacterID(), content_db.GetZoneID(szp->zone)) == 0) {
if (database.GetInstanceID(client->CharacterID(), ZoneID(szp->zone)) == 0) {
client->AssignToInstance(szp->instance_id);
client->MovePC(content_db.GetZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon);
client->MovePC(ZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon);
}
else {
client->RemoveFromInstance(database.GetInstanceID(client->CharacterID(), content_db.GetZoneID(szp->zone)));
client->RemoveFromInstance(database.GetInstanceID(client->CharacterID(), ZoneID(szp->zone)));
client->AssignToInstance(szp->instance_id);
client->MovePC(content_db.GetZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon);
client->MovePC(ZoneID(szp->zone), szp->instance_id, szp->x_pos, szp->y_pos, szp->z_pos, client->GetHeading(), szp->ignorerestrictions, GMSummon);
}
}
}

View File

@ -84,7 +84,7 @@ Zone* zone = 0;
void UpdateWindowTitle(char* iNewTitle);
bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
const char* zonename = content_db.GetZoneName(iZoneID);
const char* zonename = ZoneName(iZoneID);
if (iZoneID == 0 || zonename == 0)
return false;
@ -190,7 +190,7 @@ bool Zone::LoadZoneObjects()
for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[9]) == 0) {
// Type == 0 - Static Object
const char *shortname = content_db.GetZoneName(atoi(row[1]), false); // zoneid -> zone_shortname
const char *shortname = ZoneName(atoi(row[1]), false); // zoneid -> zone_shortname
if (!shortname)
continue;
@ -1158,7 +1158,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id)
map_name = nullptr;
if (!content_db.GetZoneCFG(
content_db.GetZoneID(filename),
ZoneID(filename),
instance_id,
&newzone_data,
can_bind,
@ -1177,7 +1177,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id)
if (instance_id != 0) {
safe_delete_array(map_name);
if (!content_db.GetZoneCFG(
content_db.GetZoneID(filename),
ZoneID(filename),
0,
&newzone_data,
can_bind,
@ -1799,7 +1799,7 @@ ZonePoint* Zone::GetClosestZonePoint(const glm::vec3& location, uint32 to, Clien
ZonePoint* Zone::GetClosestZonePoint(const glm::vec3& location, const char* to_name, Client* client, float max_distance) {
if(to_name == nullptr)
return GetClosestZonePointWithoutZone(location.x, location.y, location.z, client, max_distance);
return GetClosestZonePoint(location, content_db.GetZoneID(to_name), client, max_distance);
return GetClosestZonePoint(location, ZoneID(to_name), client, max_distance);
}
ZonePoint* Zone::GetClosestZonePointWithoutZone(float x, float y, float z, Client* client, float max_distance) {

View File

@ -25,6 +25,7 @@
#include "../common/random.h"
#include "../common/string_util.h"
#include "zonedb.h"
#include "zone_store.h"
#include "../common/repositories/grid_repository.h"
#include "../common/repositories/grid_entries_repository.h"
#include "qglobals.h"

View File

@ -23,7 +23,7 @@
ZoneStore::ZoneStore() = default;
ZoneStore::~ZoneStore() = default;
void ZoneStore::LoadZonesStore()
void ZoneStore::LoadZones()
{
zones = ZoneRepository::All();
}
@ -50,6 +50,11 @@ uint32 ZoneStore::GetZoneID(std::string zone_name)
return 0;
}
/**
* @param zone_id
* @param error_unknown
* @return
*/
const char *ZoneStore::GetZoneName(uint32 zone_id, bool error_unknown)
{
for (auto &z: zones) {
@ -65,6 +70,10 @@ const char *ZoneStore::GetZoneName(uint32 zone_id, bool error_unknown)
return nullptr;
}
/**
* @param zone_id
* @return
*/
std::string ZoneStore::GetZoneName(uint32 zone_id)
{
for (auto &z: zones) {
@ -75,3 +84,49 @@ std::string ZoneStore::GetZoneName(uint32 zone_id)
return std::string();
}
/**
* @param zone_id
* @return
*/
std::string ZoneStore::GetZoneLongName(uint32 zone_id)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id) {
return z.long_name;
}
}
return std::string();
}
/**
* @param zone_id
* @param version
* @return
*/
ZoneRepository::Zone ZoneStore::GetZone(uint32 zone_id, int version)
{
for (auto &z: zones) {
if (z.zoneidnumber == zone_id && z.version == version) {
return z;
}
}
return ZoneRepository::Zone();
}
/**
* @param in_zone_name
* @return
*/
ZoneRepository::Zone ZoneStore::GetZone(const char *in_zone_name)
{
for (auto &z: zones) {
if (z.short_name == in_zone_name) {
return z;
}
}
return ZoneRepository::Zone();
}

View File

@ -31,12 +31,15 @@ public:
std::vector<ZoneRepository::Zone> zones;
void LoadZonesStore();
void LoadZones();
ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0);
ZoneRepository::Zone GetZone(const char *in_zone_name);
uint32 GetZoneID(const char *in_zone_name);
uint32 GetZoneID(std::string zone_name);
std::string GetZoneName(uint32 zone_id);
const char *GetZoneName(uint32 zone_id, bool error_unknown);
std::string GetZoneLongName(uint32 zone_id);
const char *GetZoneName(uint32 zone_id, bool error_unknown = false);
};
extern ZoneStore zone_store;
@ -46,14 +49,15 @@ extern ZoneStore zone_store;
*/
inline uint32 ZoneID(const char *in_zone_name) { return zone_store.GetZoneID(in_zone_name); }
inline uint32 ZoneID(std::string zone_name) { return zone_store.GetZoneID(zone_name); }
inline std::string ZoneName(uint32 zone_id) { return zone_store.GetZoneName(zone_id); }
inline const char *ZoneName(uint32 zone_id, bool error_unknown)
inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
{
return zone_store.GetZoneName(
zone_id,
error_unknown
);
}
inline const char *ZoneLongName(uint32 zone_id) { return zone_store.GetZoneLongName(zone_id).c_str(); }
inline ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0) { return zone_store.GetZone(zone_id, version); };
inline ZoneRepository::Zone GetZone(const char *in_zone_name) { return zone_store.GetZone(in_zone_name); };
#endif //EQEMU_ZONE_STORE_H

View File

@ -11,6 +11,7 @@
#include "merc.h"
#include "zone.h"
#include "zonedb.h"
#include "zone_store.h"
#include "aura.h"
#include "../common/repositories/criteria/content_filter_criteria.h"
@ -3566,7 +3567,7 @@ void ZoneDatabase::ListAllInstances(Client* client, uint32 charid)
client->Message(Chat::White, "%s is part of the following instances:", name);
for (auto row = results.begin(); row != results.end(); ++row) {
client->Message(Chat::White, "%s - id: %lu, version: %lu", content_db.GetZoneName(atoi(row[1])),
client->Message(Chat::White, "%s - id: %lu, version: %lu", ZoneName(atoi(row[1])),
(unsigned long)atoi(row[0]), (unsigned long)atoi(row[2]));
}
}

View File

@ -159,7 +159,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
}
/* Check for Valid Zone */
const char *target_zone_name = content_db.GetZoneName(target_zone_id);
const char *target_zone_name = ZoneName(target_zone_id);
if(target_zone_name == nullptr) {
//invalid zone...
Message(Chat::Red, "Invalid target zone ID.");
@ -376,7 +376,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
if(this->GetPet())
entity_list.RemoveFromHateLists(this->GetPet());
LogInfo("Zoning [{}] to: [{}] ([{}]) - ([{}]) x [{}] y [{}] z [{}]", m_pp.name, content_db.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z);
LogInfo("Zoning [{}] to: [{}] ([{}]) - ([{}]) x [{}] y [{}] z [{}]", m_pp.name, ZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z);
//set the player's coordinates in the new zone so they have them
//when they zone into it
@ -430,7 +430,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
}
void Client::MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions, ZoneMode zm) {
ProcessMovePC(content_db.GetZoneID(zonename), 0, x, y, z, heading, ignorerestrictions, zm);
ProcessMovePC(ZoneID(zonename), 0, x, y, z, heading, ignorerestrictions, zm);
}
//designed for in zone moving
@ -510,7 +510,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
const char* pShortZoneName = nullptr;
char* pZoneName = nullptr;
pShortZoneName = content_db.GetZoneName(zoneID);
pShortZoneName = ZoneName(zoneID);
content_db.GetZoneLongName(pShortZoneName, &pZoneName);
if(!pZoneName) {
@ -856,7 +856,7 @@ void Client::SendZoneFlagInfo(Client *to) const {
for(; cur != end; ++cur) {
uint32 zoneid = *cur;
const char *short_name = content_db.GetZoneName(zoneid);
const char *short_name = ZoneName(zoneid);
char *long_name = nullptr;
content_db.GetZoneLongName(short_name, &long_name);