Merge remote-tracking branch 'remotes/origin/master' into web_interface

Conflicts:
	CMakeLists.txt
	common/logtypes.h
	common/shareddb.cpp
	world/net.cpp
	zone/client_logs.cpp
	zone/corpse.cpp
	zone/mob.cpp
	zone/net.cpp
This commit is contained in:
Akkadius
2015-02-02 23:11:31 -06:00
640 changed files with 45474 additions and 38161 deletions
-1
View File
@@ -27,7 +27,6 @@ SET(world_sources
ucs.cpp
web_interface.cpp
wguild_mgr.cpp
world_logsys.cpp
world_config.cpp
worlddb.cpp
zonelist.cpp
+16 -18
View File
@@ -1,4 +1,4 @@
#include "../common/debug.h"
#include "../common/global_define.h"
#include "../common/servertalk.h"
#include "../common/extprofile.h"
#include "../common/rulesys.h"
@@ -67,7 +67,7 @@ void Adventure::AddPlayer(std::string character_name, bool add_client_to_instanc
void Adventure::RemovePlayer(std::string character_name)
{
std::list<std::string>::iterator iter = players.begin();
auto iter = players.begin();
while(iter != players.end())
{
if((*iter).compare(character_name) == 0)
@@ -86,7 +86,7 @@ void Adventure::RemovePlayer(std::string character_name)
bool Adventure::PlayerExists(std::string character_name)
{
std::list<std::string>::iterator iter = players.begin();
auto iter = players.begin();
while(iter != players.end())
{
if(character_name.compare((*iter)) == 0)
@@ -172,7 +172,7 @@ void Adventure::SetStatus(AdventureStatus new_status)
safe_delete(current_timer);
current_timer = new Timer(adventure_template->duration * 1000);
database.SetInstanceDuration(instance_id, adventure_template->duration + 60);
ServerPacket *pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
auto pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer;
ut->instance_id = instance_id;
ut->new_duration = adventure_template->duration + 60;
@@ -187,7 +187,7 @@ void Adventure::SetStatus(AdventureStatus new_status)
safe_delete(current_timer);
current_timer = new Timer(1800000);
database.SetInstanceDuration(instance_id, 1860);
ServerPacket *pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
auto pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer;
ut->instance_id = instance_id;
ut->new_duration = 1860;
@@ -202,7 +202,7 @@ void Adventure::SetStatus(AdventureStatus new_status)
safe_delete(current_timer);
current_timer = new Timer(1800000);
database.SetInstanceDuration(instance_id, 1800);
ServerPacket *pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
auto pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer;
ut->instance_id = instance_id;
ut->new_duration = 1860;
@@ -216,7 +216,7 @@ void Adventure::SetStatus(AdventureStatus new_status)
return;
}
std::list<std::string>::iterator iter = players.begin();
auto iter = players.begin();
while(iter != players.end())
{
adventure_manager.GetAdventureData((*iter).c_str());
@@ -226,11 +226,11 @@ void Adventure::SetStatus(AdventureStatus new_status)
void Adventure::SendAdventureMessage(uint32 type, const char *msg)
{
ServerPacket *pack = new ServerPacket(ServerOP_EmoteMessage, sizeof(ServerEmoteMessage_Struct) + strlen(msg) + 1);
auto pack = new ServerPacket(ServerOP_EmoteMessage, sizeof(ServerEmoteMessage_Struct) + strlen(msg) + 1);
ServerEmoteMessage_Struct *sms = (ServerEmoteMessage_Struct*)pack->pBuffer;
sms->type = type;
strcpy(sms->message, msg);
std::list<std::string>::iterator iter = players.begin();
auto iter = players.begin();
while(iter != players.end())
{
ClientListEntry *current = client_list.FindCharacter((*iter).c_str());
@@ -284,7 +284,7 @@ void Adventure::IncrementAssassinationCount()
void Adventure::Finished(AdventureWinStatus ws)
{
std::list<std::string>::iterator iter = players.begin();
auto iter = players.begin();
while(iter != players.end())
{
ClientListEntry *current = client_list.FindCharacter((*iter).c_str());
@@ -293,7 +293,8 @@ void Adventure::Finished(AdventureWinStatus ws)
if(current->Online() == CLE_Status_InZone)
{
//We can send our packets only.
ServerPacket *pack = new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct));
auto pack =
new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct));
ServerAdventureFinish_Struct *af = (ServerAdventureFinish_Struct*)pack->pBuffer;
strcpy(af->player, (*iter).c_str());
af->theme = GetTemplate()->theme;
@@ -385,15 +386,13 @@ void Adventure::MoveCorpsesToGraveyard()
std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID());
auto results = database.QueryDatabase(query);
if(!results.Success())
LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
for(auto row = results.begin(); row != results.end(); ++row) {
dbid_list.push_back(atoi(row[0]));
charid_list.push_back(atoi(row[1]));
}
for (auto iter = dbid_list.begin(); iter != dbid_list.end(); ++iter)
{
for (auto &elem : dbid_list) {
float x = GetTemplate()->graveyard_x + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float y = GetTemplate()->graveyard_y + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float z = GetTemplate()->graveyard_z;
@@ -403,15 +402,14 @@ void Adventure::MoveCorpsesToGraveyard()
"x = %f, y = %f, z = %f WHERE instanceid = %d",
GetTemplate()->graveyard_zone_id,
x, y, z, GetInstanceID());
auto results = database.QueryDatabase(query);
if(!results.Success())
LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
database.QueryDatabase(query);
}
auto c_iter = charid_list.begin();
for (auto iter = dbid_list.begin(); iter != dbid_list.end(); ++iter, ++c_iter)
{
ServerPacket* pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct));
auto pack =
new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct));
ServerDepopAllPlayersCorpses_Struct *dpc = (ServerDepopAllPlayersCorpses_Struct*)pack->pBuffer;
dpc->CharacterID = (*c_iter);
dpc->InstanceID = 0;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef ADVENTURE_H
#define ADVENTURE_H
#include "../common/debug.h"
#include "../common/global_define.h"
#include "../common/types.h"
#include "../common/timer.h"
#include "adventure_template.h"
+85 -82
View File
@@ -1,4 +1,4 @@
#include "../common/debug.h"
#include "../common/global_define.h"
#include "../common/misc_functions.h"
#include "../common/string_util.h"
#include "../common/servertalk.h"
@@ -30,16 +30,15 @@ AdventureManager::~AdventureManager()
safe_delete(save_timer);
safe_delete(leaderboard_info_timer);
for (auto iter = adventure_templates.begin(); iter != adventure_templates.end(); ++iter) {
delete iter->second;
}
for (auto &elem : adventure_templates)
delete elem.second;
}
void AdventureManager::Process()
{
if(process_timer->Check())
{
std::list<Adventure*>::iterator iter = adventure_list.begin();
auto iter = adventure_list.begin();
while(iter != adventure_list.end())
{
if(!(*iter)->Process())
@@ -77,10 +76,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
/**
* This block checks to see if we actually have any adventures for the requested theme.
*/
std::map<uint32, std::list<AdventureTemplate*> >::iterator adv_list_iter = adventure_entries.find(sar->template_id);
auto adv_list_iter = adventure_entries.find(sar->template_id);
if(adv_list_iter == adventure_entries.end())
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
auto pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
strcpy(deny->reason, "There are currently no adventures set for this theme.");
@@ -95,7 +94,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
* Active being in progress, finished adventures that are still waiting to expire do not count
* Though they will count against you for which new adventure you can get.
*/
std::list<Adventure*>::iterator iter = adventure_list.begin();
auto iter = adventure_list.begin();
while(iter != adventure_list.end())
{
Adventure* current = (*iter);
@@ -105,7 +104,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
{
if(current->PlayerExists((data + sizeof(ServerAdventureRequest_Struct) + (64 * i))))
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
auto pack = new ServerPacket(ServerOP_AdventureRequestDeny,
sizeof(ServerAdventureRequestDeny_Struct));
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
@@ -159,7 +159,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
* Remove zones from eligible zones based on their difficulty and type.
* ie only use difficult zones for difficult, collect for collect, etc.
*/
std::list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
auto ea_iter = eligible_adventures.begin();
while(ea_iter != eligible_adventures.end())
{
if((*ea_iter)->is_hard != ((sar->risk == 2) ? true : false))
@@ -241,7 +241,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
if(valid_count == 0)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
auto pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
strcpy(deny->reason, "The number of found players for this adventure was zero.");
@@ -255,7 +255,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
if(max_level - min_level > RuleI(Adventure, MaxLevelRange))
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
auto pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
@@ -272,10 +272,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
/**
* Remove the zones from our eligible zones based on the exclusion above
*/
std::list<AdventureZones>::iterator ez_iter = excluded_zones.begin();
auto ez_iter = excluded_zones.begin();
while(ez_iter != excluded_zones.end())
{
std::list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
auto ea_iter = eligible_adventures.begin();
while(ea_iter != eligible_adventures.end())
{
if((*ez_iter).zone.compare((*ea_iter)->zone) == 0 && (*ez_iter).version == (*ea_iter)->zone_version)
@@ -288,10 +288,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
++ez_iter;
}
std::list<AdventureZoneIn>::iterator ezi_iter = excluded_zone_ins.begin();
auto ezi_iter = excluded_zone_ins.begin();
while(ezi_iter != excluded_zone_ins.end())
{
std::list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
auto ea_iter = eligible_adventures.begin();
while(ea_iter != eligible_adventures.end())
{
if((*ezi_iter).zone_id == (*ea_iter)->zone_in_zone_id && (*ezi_iter).door_id == (*ea_iter)->zone_in_object_id)
@@ -332,7 +332,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
{
++ea_iter;
}
ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestAccept, sizeof(ServerAdventureRequestAccept_Struct) + (sar->member_count * 64));
auto pack = new ServerPacket(ServerOP_AdventureRequestAccept,
sizeof(ServerAdventureRequestAccept_Struct) + (sar->member_count * 64));
ServerAdventureRequestAccept_Struct *sra = (ServerAdventureRequestAccept_Struct*)pack->pBuffer;
strcpy(sra->leader, sar->leader);
strcpy(sra->text, (*ea_iter)->text);
@@ -347,7 +348,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
}
else
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
auto pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct));
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
strcpy(deny->reason, "The number of adventures returned was zero.");
@@ -370,7 +371,7 @@ void AdventureManager::TryAdventureCreate(const char *data)
AdventureTemplate *adv_template = GetAdventureTemplate(src->theme, src->id);
if(!adv_template)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64);
auto pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64);
strcpy((char*)pack->pBuffer, src->leader);
pack->Deflate();
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
@@ -378,10 +379,10 @@ void AdventureManager::TryAdventureCreate(const char *data)
return;
}
Adventure *adv = new Adventure(adv_template);
auto adv = new Adventure(adv_template);
if(!adv->CreateInstance())
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64);
auto pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64);
strcpy((char*)pack->pBuffer, src->leader);
pack->Deflate();
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
@@ -395,7 +396,7 @@ void AdventureManager::TryAdventureCreate(const char *data)
Adventure *a = GetActiveAdventure((data + sizeof(ServerAdventureRequestCreate_Struct) + (64 * i)));
if(a)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64);
auto pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64);
strcpy((char*)pack->pBuffer, src->leader);
pack->Deflate();
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
@@ -416,8 +417,9 @@ void AdventureManager::TryAdventureCreate(const char *data)
{
int f_count = 0;
Adventure** finished_adventures = GetFinishedAdventures((data + sizeof(ServerAdventureRequestCreate_Struct) + (64 * i)), f_count);
ServerPacket *pack = new ServerPacket(ServerOP_AdventureData, sizeof(ServerSendAdventureData_Struct)
+ (sizeof(ServerFinishedAdventures_Struct) * f_count));
auto pack = new ServerPacket(ServerOP_AdventureData,
sizeof(ServerSendAdventureData_Struct) +
(sizeof(ServerFinishedAdventures_Struct) * f_count));
ServerSendAdventureData_Struct *sca = (ServerSendAdventureData_Struct*)pack->pBuffer;
strcpy(sca->player, (data + sizeof(ServerAdventureRequestCreate_Struct) + (64 * i)));
@@ -455,7 +457,7 @@ void AdventureManager::TryAdventureCreate(const char *data)
void AdventureManager::GetAdventureData(Adventure *adv)
{
std::list<std::string> player_list = adv->GetPlayers();
std::list<std::string>::iterator iter = player_list.begin();
auto iter = player_list.begin();
while(iter != player_list.end())
{
GetAdventureData((*iter).c_str());
@@ -471,8 +473,9 @@ void AdventureManager::GetAdventureData(const char *name)
int f_count = 0;
Adventure** finished_adventures = GetFinishedAdventures(name, f_count);
Adventure *current = GetActiveAdventure(name);
ServerPacket *pack = new ServerPacket(ServerOP_AdventureData, sizeof(ServerSendAdventureData_Struct)
+ (sizeof(ServerFinishedAdventures_Struct) * f_count));
auto pack =
new ServerPacket(ServerOP_AdventureData, sizeof(ServerSendAdventureData_Struct) +
(sizeof(ServerFinishedAdventures_Struct) * f_count));
ServerSendAdventureData_Struct *sca = (ServerSendAdventureData_Struct*)pack->pBuffer;
if(current)
@@ -501,7 +504,7 @@ void AdventureManager::GetAdventureData(const char *name)
if(f_count == 0)
{
delete pack;
ServerPacket *pack = new ServerPacket(ServerOP_AdventureDataClear, 64);
auto pack = new ServerPacket(ServerOP_AdventureDataClear, 64);
strcpy((char*)pack->pBuffer, name);
pack->Deflate();
zoneserver_list.SendPacket(player->zone(), player->instance(), pack);
@@ -532,7 +535,7 @@ void AdventureManager::GetAdventureData(const char *name)
bool AdventureManager::IsInExcludedZoneList(std::list<AdventureZones> excluded_zones, std::string zone_name, int version)
{
std::list<AdventureZones>::iterator iter = excluded_zones.begin();
auto iter = excluded_zones.begin();
while(iter != excluded_zones.end())
{
if(((*iter).zone.compare(zone_name) == 0) && ((*iter).version == version))
@@ -546,7 +549,7 @@ bool AdventureManager::IsInExcludedZoneList(std::list<AdventureZones> excluded_z
bool AdventureManager::IsInExcludedZoneInList(std::list<AdventureZoneIn> excluded_zone_ins, int zone_id, int door_object)
{
std::list<AdventureZoneIn>::iterator iter = excluded_zone_ins.begin();
auto iter = excluded_zone_ins.begin();
while(iter != excluded_zone_ins.end())
{
if(((*iter).zone_id == zone_id) && ((*iter).door_id == door_object))
@@ -563,7 +566,7 @@ Adventure **AdventureManager::GetFinishedAdventures(const char *player, int &cou
Adventure **ret = nullptr;
count = 0;
std::list<Adventure*>::iterator iter = adventure_list.begin();
auto iter = adventure_list.begin();
while(iter != adventure_list.end())
{
if((*iter)->PlayerExists(player))
@@ -572,7 +575,7 @@ Adventure **AdventureManager::GetFinishedAdventures(const char *player, int &cou
{
if(ret)
{
Adventure **t = new Adventure*[count + 1];
auto t = new Adventure *[count + 1];
for(int i = 0; i < count; i++)
{
t[i] = ret[i];
@@ -596,7 +599,7 @@ Adventure **AdventureManager::GetFinishedAdventures(const char *player, int &cou
Adventure *AdventureManager::GetActiveAdventure(const char *player)
{
std::list<Adventure*>::iterator iter = adventure_list.begin();
auto iter = adventure_list.begin();
while(iter != adventure_list.end())
{
if((*iter)->PlayerExists(player) && (*iter)->IsActive())
@@ -610,13 +613,13 @@ Adventure *AdventureManager::GetActiveAdventure(const char *player)
AdventureTemplate *AdventureManager::GetAdventureTemplate(int theme, int id)
{
std::map<uint32, std::list<AdventureTemplate*> >::iterator iter = adventure_entries.find(theme);
auto iter = adventure_entries.find(theme);
if(iter == adventure_entries.end())
{
return nullptr;
}
std::list<AdventureTemplate*>::iterator l_iter = (*iter).second.begin();
auto l_iter = (*iter).second.begin();
while(l_iter != (*iter).second.end())
{
if((*l_iter)->id == id)
@@ -630,7 +633,7 @@ AdventureTemplate *AdventureManager::GetAdventureTemplate(int theme, int id)
AdventureTemplate *AdventureManager::GetAdventureTemplate(int id)
{
std::map<uint32, AdventureTemplate*>::iterator iter = adventure_templates.find(id);
auto iter = adventure_templates.find(id);
if(iter == adventure_templates.end())
{
return nullptr;
@@ -649,12 +652,11 @@ bool AdventureManager::LoadAdventureTemplates()
"graveyard_radius FROM adventure_template";
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplate *aTemplate = new AdventureTemplate;
auto aTemplate = new AdventureTemplate;
aTemplate->id = atoi(row[0]);
strcpy(aTemplate->zone, row[1]);
aTemplate->zone_version = atoi(row[2]);
@@ -699,7 +701,6 @@ bool AdventureManager::LoadAdventureEntries()
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -729,7 +730,7 @@ bool AdventureManager::LoadAdventureEntries()
void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int door_id)
{
std::list<Adventure*>::iterator iter = adventure_list.begin();
auto iter = adventure_list.begin();
while(iter != adventure_list.end())
{
const AdventureTemplate *t = (*iter)->GetTemplate();
@@ -740,7 +741,9 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureClickDoorReply, sizeof(ServerPlayerClickedAdventureDoorReply_Struct));
auto pack =
new ServerPacket(ServerOP_AdventureClickDoorReply,
sizeof(ServerPlayerClickedAdventureDoorReply_Struct));
ServerPlayerClickedAdventureDoorReply_Struct *sr = (ServerPlayerClickedAdventureDoorReply_Struct*)pack->pBuffer;
strcpy(sr->player, player);
sr->zone_id = database.GetZoneID(t->zone);
@@ -767,7 +770,7 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureClickDoorError, 64);
auto pack = new ServerPacket(ServerOP_AdventureClickDoorError, 64);
strcpy((char*)pack->pBuffer, player);
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
@@ -785,7 +788,7 @@ void AdventureManager::LeaveAdventure(const char *name)
{
if(pc->instance() != 0 && pc->instance() == current->GetInstanceID())
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaveDeny, 64);
auto pack = new ServerPacket(ServerOP_AdventureLeaveDeny, 64);
strcpy((char*)pack->pBuffer, name);
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
@@ -799,7 +802,7 @@ void AdventureManager::LeaveAdventure(const char *name)
}
current->RemovePlayer(name);
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64);
auto pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64);
strcpy((char*)pack->pBuffer, name);
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
@@ -808,7 +811,7 @@ void AdventureManager::LeaveAdventure(const char *name)
}
else
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64);
auto pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64);
strcpy((char*)pack->pBuffer, name);
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
@@ -819,7 +822,7 @@ void AdventureManager::LeaveAdventure(const char *name)
void AdventureManager::IncrementCount(uint16 instance_id)
{
std::list<Adventure*>::iterator iter = adventure_list.begin();
auto iter = adventure_list.begin();
Adventure *current = nullptr;
while(iter != adventure_list.end())
{
@@ -835,8 +838,8 @@ void AdventureManager::IncrementCount(uint16 instance_id)
{
current->IncrementCount();
std::list<std::string> slist = current->GetPlayers();
std::list<std::string>::iterator siter = slist.begin();
ServerPacket *pack = new ServerPacket(ServerOP_AdventureCountUpdate, sizeof(ServerAdventureCountUpdate_Struct));
auto siter = slist.begin();
auto pack = new ServerPacket(ServerOP_AdventureCountUpdate, sizeof(ServerAdventureCountUpdate_Struct));
ServerAdventureCountUpdate_Struct *ac = (ServerAdventureCountUpdate_Struct*)pack->pBuffer;
ac->count = current->GetCount();
ac->total = current->GetTemplate()->type_count;
@@ -859,7 +862,7 @@ void AdventureManager::IncrementCount(uint16 instance_id)
void AdventureManager::IncrementAssassinationCount(uint16 instance_id)
{
std::list<Adventure*>::iterator iter = adventure_list.begin();
auto iter = adventure_list.begin();
Adventure *current = nullptr;
while(iter != adventure_list.end())
{
@@ -880,7 +883,7 @@ void AdventureManager::IncrementAssassinationCount(uint16 instance_id)
void AdventureManager::GetZoneData(uint16 instance_id)
{
std::list<Adventure*>::iterator iter = adventure_list.begin();
auto iter = adventure_list.begin();
Adventure *current = nullptr;
while(iter != adventure_list.end())
{
@@ -894,7 +897,7 @@ void AdventureManager::GetZoneData(uint16 instance_id)
if(current)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(ServerZoneAdventureDataReply_Struct));
auto pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(ServerZoneAdventureDataReply_Struct));
ServerZoneAdventureDataReply_Struct *zd = (ServerZoneAdventureDataReply_Struct*)pack->pBuffer;
const AdventureTemplate* temp = current->GetTemplate();
@@ -1074,7 +1077,6 @@ void AdventureManager::LoadLeaderboardInfo()
"AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;";
auto results = database.QueryDatabase(query);
if(!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
return;
}
@@ -1242,7 +1244,7 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1250,7 +1252,7 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins.begin();
auto iter = leaderboard_info_wins.begin();
while(i < 100 && iter != leaderboard_info_wins.end())
{
LeaderboardInfo li = (*iter);
@@ -1309,7 +1311,7 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1317,7 +1319,7 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage.begin();
auto iter = leaderboard_info_percentage.begin();
while(i < 100 && iter != leaderboard_info_percentage.end())
{
LeaderboardInfo li = (*iter);
@@ -1376,7 +1378,7 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1384,7 +1386,7 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_guk.begin();
auto iter = leaderboard_info_wins_guk.begin();
while(i < 100 && iter != leaderboard_info_wins_guk.end())
{
LeaderboardInfo li = (*iter);
@@ -1443,7 +1445,7 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1451,7 +1453,7 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_guk.begin();
auto iter = leaderboard_info_percentage_guk.begin();
while(i < 100 && iter != leaderboard_info_percentage_guk.end())
{
LeaderboardInfo li = (*iter);
@@ -1510,7 +1512,7 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1518,7 +1520,7 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_mir.begin();
auto iter = leaderboard_info_wins_mir.begin();
while(i < 100 && iter != leaderboard_info_wins_mir.end())
{
LeaderboardInfo li = (*iter);
@@ -1577,7 +1579,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1585,7 +1587,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_mir.begin();
auto iter = leaderboard_info_percentage_mir.begin();
while(i < 100 && iter != leaderboard_info_percentage_mir.end())
{
LeaderboardInfo li = (*iter);
@@ -1644,7 +1646,7 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1652,7 +1654,7 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_mmc.begin();
auto iter = leaderboard_info_wins_mmc.begin();
while(i < 100 && iter != leaderboard_info_wins_mmc.end())
{
LeaderboardInfo li = (*iter);
@@ -1711,7 +1713,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1719,7 +1721,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_mmc.begin();
auto iter = leaderboard_info_percentage_mmc.begin();
while(i < 100 && iter != leaderboard_info_percentage_mmc.end())
{
LeaderboardInfo li = (*iter);
@@ -1778,7 +1780,7 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1786,7 +1788,7 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_ruj.begin();
auto iter = leaderboard_info_wins_ruj.begin();
while(i < 100 && iter != leaderboard_info_wins_ruj.end())
{
LeaderboardInfo li = (*iter);
@@ -1845,7 +1847,7 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1853,7 +1855,7 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_ruj.begin();
auto iter = leaderboard_info_percentage_ruj.begin();
while(i < 100 && iter != leaderboard_info_percentage_ruj.end())
{
LeaderboardInfo li = (*iter);
@@ -1912,7 +1914,7 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1920,7 +1922,7 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_wins_ruj.begin();
auto iter = leaderboard_info_wins_ruj.begin();
while(i < 100 && iter != leaderboard_info_wins_ruj.end())
{
LeaderboardInfo li = (*iter);
@@ -1979,7 +1981,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player)
ClientListEntry *pc = client_list.FindCharacter(player);
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64);
strcpy((char*)pack->pBuffer, player);
@@ -1987,7 +1989,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player)
int our_successes = 0;
int our_failures = 0;
int i = 0;
std::list<LeaderboardInfo>::iterator iter = leaderboard_info_percentage_tak.begin();
auto iter = leaderboard_info_percentage_tak.begin();
while(i < 100 && iter != leaderboard_info_percentage_tak.end())
{
LeaderboardInfo li = (*iter);
@@ -2043,7 +2045,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player)
bool AdventureManager::PopFinishedEvent(const char *name, AdventureFinishEvent &fe)
{
std::list<AdventureFinishEvent>::iterator iter = finished_list.begin();
auto iter = finished_list.begin();
while(iter != finished_list.end())
{
if((*iter).name.compare(name) == 0)
@@ -2066,7 +2068,7 @@ void AdventureManager::SendAdventureFinish(AdventureFinishEvent fe)
ClientListEntry *pc = client_list.FindCharacter(fe.name.c_str());
if(pc)
{
ServerPacket *pack = new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct));
auto pack = new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct));
ServerAdventureFinish_Struct *af = (ServerAdventureFinish_Struct*)pack->pBuffer;
strcpy(af->player, fe.name.c_str());
af->theme = fe.theme;
@@ -2089,7 +2091,7 @@ void AdventureManager::Save()
ss.write((const char*)&number_of_elements, sizeof(int));
char null_term = 0;
std::list<Adventure*>::iterator a_iter = adventure_list.begin();
auto a_iter = adventure_list.begin();
while(a_iter != adventure_list.end())
{
int cur = (*a_iter)->GetCount();
@@ -2114,7 +2116,7 @@ void AdventureManager::Save()
cur = players.size();
ss.write((const char*)&cur, sizeof(int));
std::list<std::string>::iterator s_iter = players.begin();
auto s_iter = players.begin();
while(s_iter != players.end())
{
ss.write((const char*)(*s_iter).c_str(), (*s_iter).size());
@@ -2127,7 +2129,7 @@ void AdventureManager::Save()
number_of_elements = finished_list.size();
ss.write((const char*)&number_of_elements, sizeof(int));
std::list<AdventureFinishEvent>::iterator f_iter = finished_list.begin();
auto f_iter = finished_list.begin();
while(f_iter != finished_list.end())
{
ss.write((const char*)&(*f_iter).win, sizeof(bool));
@@ -2199,7 +2201,8 @@ void AdventureManager::Load()
AdventureTemplate *t = GetAdventureTemplate(template_id);
if(t)
{
Adventure *adv = new Adventure(t, count, a_count, (AdventureStatus)status, instance_id, rem_time);
auto adv =
new Adventure(t, count, a_count, (AdventureStatus)status, instance_id, rem_time);
for(int j = 0; j < num_players; ++j)
{
adv->AddPlayer((const char*)ptr, false);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef ADVENTURE_MANAGER_H
#define ADVENTURE_MANAGER_H
#include "../common/debug.h"
#include "../common/global_define.h"
#include "../common/types.h"
#include "../common/timer.h"
#include "adventure.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef ADVENTURE_TEMPLATE_H
#define ADVENTURE_TEMPLATE_H
#include "../common/debug.h"
#include "../common/global_define.h"
#include "../common/types.h"
#pragma pack(1)
+131 -138
View File
@@ -1,4 +1,4 @@
#include "../common/debug.h"
#include "../common/global_define.h"
#include "../common/eq_packet.h"
#include "../common/eq_stream_intf.h"
#include "../common/misc.h"
@@ -89,7 +89,8 @@ Client::Client(EQStreamInterface* ieqs)
ClientVersionBit = 0;
numclients++;
ClientVersionBit = 1 << (eqs->ClientVersion() - 1);
if (eqs->GetClientVersion() != ClientVersion::Unknown)
ClientVersionBit = 1 << (static_cast<unsigned int>(eqs->GetClientVersion()) - 1);
}
Client::~Client() {
@@ -101,11 +102,12 @@ Client::~Client() {
//let the stream factory know were done with this stream
eqs->Close();
eqs->ReleaseFromUse();
safe_delete(eqs);
}
void Client::SendLogServer()
{
EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogServer, sizeof(LogServer_Struct));
auto outapp = new EQApplicationPacket(OP_LogServer, sizeof(LogServer_Struct));
LogServer_Struct *l=(LogServer_Struct *)outapp->pBuffer;
const char *wsn=WorldConfig::get()->ShortName.c_str();
memcpy(l->worldshortname,wsn,strlen(wsn));
@@ -136,18 +138,18 @@ void Client::SendEnterWorld(std::string name)
eqs->Close();
return;
} else {
clog(WORLD__CLIENT,"Telling client to continue session.");
Log.Out(Logs::Detail, Logs::World_Server,"Telling client to continue session.");
}
}
EQApplicationPacket *outapp = new EQApplicationPacket(OP_EnterWorld, strlen(char_name)+1);
auto outapp = new EQApplicationPacket(OP_EnterWorld, strlen(char_name) + 1);
memcpy(outapp->pBuffer,char_name,strlen(char_name)+1);
QueuePacket(outapp);
safe_delete(outapp);
}
void Client::SendExpansionInfo() {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_ExpansionInfo, sizeof(ExpansionInfo_Struct));
auto outapp = new EQApplicationPacket(OP_ExpansionInfo, sizeof(ExpansionInfo_Struct));
ExpansionInfo_Struct *eis = (ExpansionInfo_Struct*)outapp->pBuffer;
eis->Expansions = (RuleI(World, ExpansionSettings));
QueuePacket(outapp);
@@ -171,7 +173,7 @@ void Client::SendCharInfo() {
// Send OP_SendCharInfo
EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendCharInfo, sizeof(CharacterSelect_Struct));
auto outapp = new EQApplicationPacket(OP_SendCharInfo, sizeof(CharacterSelect_Struct));
CharacterSelect_Struct* cs = (CharacterSelect_Struct*)outapp->pBuffer;
database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit);
@@ -181,7 +183,7 @@ void Client::SendCharInfo() {
}
void Client::SendMaxCharCreate(int max_chars) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendMaxCharacters, sizeof(MaxCharacters_Struct));
auto outapp = new EQApplicationPacket(OP_SendMaxCharacters, sizeof(MaxCharacters_Struct));
MaxCharacters_Struct* mc = (MaxCharacters_Struct*)outapp->pBuffer;
mc->max_chars = max_chars;
@@ -191,7 +193,7 @@ void Client::SendMaxCharCreate(int max_chars) {
}
void Client::SendMembership() {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendMembership, sizeof(Membership_Struct));
auto outapp = new EQApplicationPacket(OP_SendMembership, sizeof(Membership_Struct));
Membership_Struct* mc = (Membership_Struct*)outapp->pBuffer;
/*
@@ -248,7 +250,7 @@ void Client::SendMembership() {
}
void Client::SendMembershipSettings() {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendMembershipDetails, sizeof(Membership_Details_Struct));
auto outapp = new EQApplicationPacket(OP_SendMembershipDetails, sizeof(Membership_Details_Struct));
Membership_Details_Struct* mds = (Membership_Details_Struct*)outapp->pBuffer;
mds->membership_setting_count = 66;
@@ -357,7 +359,7 @@ void Client::SendMembershipSettings() {
}
void Client::SendPostEnterWorld() {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_PostEnterWorld, 1);
auto outapp = new EQApplicationPacket(OP_PostEnterWorld, 1);
outapp->size=0;
QueuePacket(outapp);
safe_delete(outapp);
@@ -378,7 +380,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) {
if (strlen(password) <= 1) {
// TODO: Find out how to tell the client wrong username/password
clog(WORLD__CLIENT_ERR,"Login without a password");
Log.Out(Logs::Detail, Logs::World_Server,"Login without a password");
return false;
}
@@ -408,37 +410,37 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) {
if ((cle = zoneserver_list.CheckAuth(inet_ntoa(tmpip), password)))
#else
if (loginserverlist.Connected() == false && !pZoning) {
clog(WORLD__CLIENT_ERR,"Error: Login server login while not connected to login server.");
Log.Out(Logs::Detail, Logs::World_Server,"Error: Login server login while not connected to login server.");
return false;
}
if (((cle = client_list.CheckAuth(name, password)) || (cle = client_list.CheckAuth(id, password))))
#endif
{
if (cle->AccountID() == 0 || (!minilogin && cle->LSID()==0)) {
clog(WORLD__CLIENT_ERR,"ID is 0. Is this server connected to minilogin?");
Log.Out(Logs::Detail, Logs::World_Server,"ID is 0. Is this server connected to minilogin?");
if(!minilogin)
clog(WORLD__CLIENT_ERR,"If so you forget the minilogin variable...");
Log.Out(Logs::Detail, Logs::World_Server,"If so you forget the minilogin variable...");
else
clog(WORLD__CLIENT_ERR,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table.");
Log.Out(Logs::Detail, Logs::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table.");
return false;
}
cle->SetOnline();
clog(WORLD__CLIENT,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)");
Log.Out(Logs::Detail, Logs::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)");
if(minilogin){
WorldConfig::DisableStats();
clog(WORLD__CLIENT,"MiniLogin Account #%d",cle->AccountID());
Log.Out(Logs::Detail, Logs::World_Server,"MiniLogin Account #%d",cle->AccountID());
}
else {
clog(WORLD__CLIENT,"LS Account #%d",cle->LSID());
Log.Out(Logs::Detail, Logs::World_Server,"LS Account #%d",cle->LSID());
}
const WorldConfig *Config=WorldConfig::get();
if(Config->UpdateStats){
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSPlayerJoinWorld;
pack->size = sizeof(ServerLSPlayerJoinWorld_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -465,7 +467,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) {
}
else {
// TODO: Find out how to tell the client wrong username/password
clog(WORLD__CLIENT_ERR,"Bad/Expired session key '%s'",name);
Log.Out(Logs::Detail, Logs::World_Server,"Bad/Expired session key '%s'",name);
return false;
}
@@ -479,7 +481,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) {
bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app)
{
if (GetAccountID() == 0) {
clog(WORLD__CLIENT_ERR,"Name approval request with no logged in account");
Log.Out(Logs::Detail, Logs::World_Server,"Name approval request with no logged in account");
return false;
}
@@ -487,7 +489,7 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app)
uchar race = app->pBuffer[64];
uchar clas = app->pBuffer[68];
clog(WORLD__CLIENT, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas));
Log.Out(Logs::Detail, Logs::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas));
EQApplicationPacket *outapp;
outapp = new EQApplicationPacket;
@@ -609,7 +611,7 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app)
len += sizeof(uint32);
len += sizeof(uint32);
EQApplicationPacket *outapp = new EQApplicationPacket(OP_CharacterCreateRequest, len);
auto outapp = new EQApplicationPacket(OP_CharacterCreateRequest, len);
unsigned char *ptr = outapp->pBuffer;
*((uint8*)ptr) = 0;
ptr += sizeof(uint8);
@@ -648,11 +650,11 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app)
bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
if (GetAccountID() == 0) {
clog(WORLD__CLIENT_ERR,"Account ID not set; unable to create character.");
Log.Out(Logs::Detail, Logs::World_Server,"Account ID not set; unable to create character.");
return false;
}
else if (app->size != sizeof(CharCreate_Struct)) {
clog(WORLD__CLIENT_ERR,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct));
Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct));
DumpPacket(app);
// the previous behavior was essentially returning true here
// but that seems a bit odd to me.
@@ -662,7 +664,7 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
CharCreate_Struct *cc = (CharCreate_Struct*)app->pBuffer;
if(OPCharCreate(char_name, cc) == false) {
database.DeleteCharacter(char_name);
EQApplicationPacket *outapp = new EQApplicationPacket(OP_ApproveName, 1);
auto outapp = new EQApplicationPacket(OP_ApproveName, 1);
outapp->pBuffer[0] = 0;
QueuePacket(outapp);
safe_delete(outapp);
@@ -679,14 +681,14 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if (GetAccountID() == 0) {
clog(WORLD__CLIENT_ERR,"Enter world with no logged in account");
Log.Out(Logs::Detail, Logs::World_Server,"Enter world with no logged in account");
eqs->Close();
return true;
}
if(GetAdmin() < 0)
{
clog(WORLD__CLIENT,"Account banned or suspended.");
Log.Out(Logs::Detail, Logs::World_Server,"Account banned or suspended.");
eqs->Close();
return true;
}
@@ -702,20 +704,20 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
uint32 tmpaccid = 0;
charid = database.GetCharacterInfo(char_name, &tmpaccid, &zoneID, &instanceID);
if (charid == 0 || tmpaccid != GetAccountID()) {
clog(WORLD__CLIENT_ERR,"Could not get CharInfo for '%s'",char_name);
Log.Out(Logs::Detail, Logs::World_Server,"Could not get CharInfo for '%s'",char_name);
eqs->Close();
return true;
}
// Make sure this account owns this character
if (tmpaccid != GetAccountID()) {
clog(WORLD__CLIENT_ERR,"This account does not own the character named '%s'",char_name);
Log.Out(Logs::Detail, Logs::World_Server,"This account does not own the character named '%s'",char_name);
eqs->Close();
return true;
}
if(!pZoning && ew->return_home && !ew->tutorial) {
CharacterSelect_Struct* cs = new CharacterSelect_Struct;
auto cs = new CharacterSelect_Struct;
memset(cs, 0, sizeof(CharacterSelect_Struct));
database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit);
bool home_enabled = false;
@@ -737,7 +739,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
zoneID = database.MoveCharacterToBind(charid,4);
}
else {
clog(WORLD__CLIENT_ERR,"'%s' is trying to go home before they're able...",char_name);
Log.Out(Logs::Detail, Logs::World_Server,"'%s' is trying to go home before they're able...",char_name);
database.SetHackerFlag(GetAccountName(), char_name, "MQGoHome: player tried to go home before they were able.");
eqs->Close();
return true;
@@ -745,7 +747,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
}
if(!pZoning && (RuleB(World, EnableTutorialButton) && (ew->tutorial || StartInTutorial))) {
CharacterSelect_Struct* cs = new CharacterSelect_Struct;
auto cs = new CharacterSelect_Struct;
memset(cs, 0, sizeof(CharacterSelect_Struct));
database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit);
bool tutorial_enabled = false;
@@ -770,7 +772,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
}
else
{
clog(WORLD__CLIENT_ERR,"'%s' is trying to go to tutorial but are not allowed...",char_name);
Log.Out(Logs::Detail, Logs::World_Server,"'%s' is trying to go to tutorial but are not allowed...",char_name);
database.SetHackerFlag(GetAccountName(), char_name, "MQTutorial: player tried to enter the tutorial without having tutorial enabled for this character.");
eqs->Close();
return true;
@@ -780,7 +782,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if (zoneID == 0 || !database.GetZoneName(zoneID)) {
// This is to save people in an invalid zone, once it's removed from the DB
database.MoveCharacterToZone(charid, "arena");
clog(WORLD__CLIENT_ERR, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name);
Log.Out(Logs::Detail, Logs::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name);
}
if(instanceID > 0)
@@ -810,7 +812,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
char* leader = 0;
char leaderbuf[64] = {0};
if((leader = database.GetGroupLeaderForLogin(char_name, leaderbuf)) && strlen(leader)>1){
EQApplicationPacket* outapp3 = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct));
auto outapp3 = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct));
GroupJoin_Struct* gj=(GroupJoin_Struct*)outapp3->pBuffer;
gj->action=8;
strcpy(gj->yourname, char_name);
@@ -844,14 +846,14 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
char ConnectionType;
if(ClientVersionBit & BIT_UnderfootAndLater)
if(ClientVersionBit & BIT_UFAndLater)
ConnectionType = 'U';
else if(ClientVersionBit & BIT_SoFAndLater)
ConnectionType = 'S';
else
ConnectionType = 'C';
EQApplicationPacket *outapp2 = new EQApplicationPacket(OP_SetChatServer);
auto outapp2 = new EQApplicationPacket(OP_SetChatServer);
char buffer[112];
const WorldConfig *Config = WorldConfig::get();
@@ -894,7 +896,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) {
uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer);
if(char_acct_id == GetAccountID()) {
clog(WORLD__CLIENT,"Delete character: %s",app->pBuffer);
Log.Out(Logs::Detail, Logs::World_Server,"Delete character: %s",app->pBuffer);
database.DeleteCharacter((char *)app->pBuffer);
SendCharInfo();
}
@@ -915,25 +917,24 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
EmuOpcode opcode = app->GetOpcode();
clog(WORLD__CLIENT_TRACE,"Recevied EQApplicationPacket");
_pkt(WORLD__CLIENT_TRACE,app);
Log.Out(Logs::Detail, Logs::World_Server,"Recevied EQApplicationPacket");
if (!eqs->CheckState(ESTABLISHED)) {
clog(WORLD__CLIENT,"Client disconnected (net inactive on send)");
Log.Out(Logs::Detail, Logs::World_Server,"Client disconnected (net inactive on send)");
return false;
}
// Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses
if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) {
if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) {
clog(WORLD__CLIENT,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID());
Log.Out(Logs::Detail, Logs::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID());
eqs->Close();
}
}
if (GetAccountID() == 0 && opcode != OP_SendLoginInfo) {
// Got a packet other than OP_SendLoginInfo when not logged in
clog(WORLD__CLIENT_ERR,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]);
Log.Out(Logs::Detail, Logs::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]);
return false;
}
else if (opcode == OP_AckPacket) {
@@ -1005,8 +1006,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
}
default:
{
clog(WORLD__CLIENT_ERR,"Received unknown EQApplicationPacket");
_pkt(WORLD__CLIENT_ERR,app);
Log.Out(Logs::Detail, Logs::World_Server,"Received unknown EQApplicationPacket");
return true;
}
}
@@ -1024,7 +1024,7 @@ bool Client::Process() {
to.sin_addr.s_addr = ip;
if (autobootup_timeout.Check()) {
clog(WORLD__CLIENT_ERR, "Zone bootup timer expired, bootup failed or too slow.");
Log.Out(Logs::Detail, Logs::World_Server, "Zone bootup timer expired, bootup failed or too slow.");
ZoneUnavail();
}
if(connect.Check()){
@@ -1047,7 +1047,7 @@ bool Client::Process() {
if (!eqs->CheckState(ESTABLISHED)) {
if(WorldConfig::get()->UpdateStats){
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSPlayerLeftWorld;
pack->size = sizeof(ServerLSPlayerLeftWorld_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -1058,7 +1058,7 @@ bool Client::Process() {
loginserverlist.SendPacket(pack);
safe_delete(pack);
}
clog(WORLD__CLIENT,"Client disconnected (not active in process)");
Log.Out(Logs::Detail, Logs::World_Server,"Client disconnected (not active in process)");
return false;
}
@@ -1103,40 +1103,43 @@ void Client::EnterWorld(bool TryBootup) {
const char *zone_name=database.GetZoneName(zoneID, true);
if (zs) {
// warn the world we're comming, so it knows not to shutdown
zs->IncommingClient(this);
zs->IncomingClient(this);
}
else {
if (TryBootup) {
clog(WORLD__CLIENT,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID);
Log.Out(Logs::Detail, Logs::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID);
autobootup_timeout.Start();
pwaitingforbootup = zoneserver_list.TriggerBootup(zoneID, instanceID);
if (pwaitingforbootup == 0) {
clog(WORLD__CLIENT_ERR,"No zoneserver available to boot up.");
Log.Out(Logs::Detail, Logs::World_Server,"No zoneserver available to boot up.");
ZoneUnavail();
}
return;
}
else {
clog(WORLD__CLIENT_ERR,"Requested zone %s is no running.",zone_name);
Log.Out(Logs::Detail, Logs::World_Server,"Requested zone %s is not running.",zone_name);
ZoneUnavail();
return;
}
}
pwaitingforbootup = 0;
if(!cle) {
return;
}
cle->SetChar(charid, char_name);
database.UpdateLiveChar(char_name, GetAccountID());
clog(WORLD__CLIENT,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID);
// database.SetAuthentication(account_id, char_name, zone_name, ip);
Log.Out(Logs::Detail, Logs::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID);
if (seencharsel) {
if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zoneID)) {
clog(WORLD__CLIENT_ERR,"Enter world failed. Zone is locked.");
Log.Out(Logs::Detail, Logs::World_Server,"Enter world failed. Zone is locked.");
ZoneUnavail();
return;
}
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_AcceptWorldEntrance;
pack->size = sizeof(WorldToZone_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -1169,9 +1172,9 @@ void Client::Clearance(int8 response)
{
if (zs == 0)
{
clog(WORLD__CLIENT_ERR,"Unable to find zoneserver in Client::Clearance!!");
Log.Out(Logs::Detail, Logs::World_Server,"Unable to find zoneserver in Client::Clearance!!");
} else {
clog(WORLD__CLIENT_ERR, "Invalid response %d in Client::Clearance", response);
Log.Out(Logs::Detail, Logs::World_Server, "Invalid response %d in Client::Clearance", response);
}
ZoneUnavail();
@@ -1181,20 +1184,20 @@ void Client::Clearance(int8 response)
EQApplicationPacket* outapp;
if (zs->GetCAddress() == nullptr) {
clog(WORLD__CLIENT_ERR, "Unable to do zs->GetCAddress() in Client::Clearance!!");
Log.Out(Logs::Detail, Logs::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!");
ZoneUnavail();
return;
}
if (zoneID == 0) {
clog(WORLD__CLIENT_ERR, "zoneID is nullptr in Client::Clearance!!");
Log.Out(Logs::Detail, Logs::World_Server, "zoneID is nullptr in Client::Clearance!!");
ZoneUnavail();
return;
}
const char* zonename = database.GetZoneName(zoneID);
if (zonename == 0) {
clog(WORLD__CLIENT_ERR, "zonename is nullptr in Client::Clearance!!");
Log.Out(Logs::Detail, Logs::World_Server, "zonename is nullptr in Client::Clearance!!");
ZoneUnavail();
return;
}
@@ -1225,7 +1228,7 @@ void Client::Clearance(int8 response)
}
strcpy(zsi->ip, zs_addr);
zsi->port =zs->GetCPort();
clog(WORLD__CLIENT,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port);
Log.Out(Logs::Detail, Logs::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port);
QueuePacket(outapp);
safe_delete(outapp);
@@ -1234,7 +1237,7 @@ void Client::Clearance(int8 response)
}
void Client::ZoneUnavail() {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZoneUnavail, sizeof(ZoneUnavail_Struct));
auto outapp = new EQApplicationPacket(OP_ZoneUnavail, sizeof(ZoneUnavail_Struct));
ZoneUnavail_Struct* ua = (ZoneUnavail_Struct*)outapp->pBuffer;
const char* zonename = database.GetZoneName(zoneID);
if (zonename)
@@ -1256,8 +1259,7 @@ bool Client::GenPassKey(char* key) {
}
void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) {
clog(WORLD__CLIENT_TRACE, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode());
_pkt(WORLD__CLIENT_TRACE, app);
Log.Out(Logs::Detail, Logs::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode());
ack_req = true; // It's broke right now, dont delete this line till fix it. =P
eqs->QueuePacket(app, ack_req);
@@ -1270,12 +1272,9 @@ void Client::SendGuildList() {
//ask the guild manager to build us a nice guild list packet
outapp->pBuffer = guild_mgr.MakeGuildList("", outapp->size);
if(outapp->pBuffer == nullptr) {
clog(GUILDS__ERROR, "Unable to make guild list!");
return;
}
clog(GUILDS__OUT_PACKETS, "Sending OP_GuildsList of length %d", outapp->size);
// _pkt(GUILDS__OUT_PACKET_TRACE, outapp);
eqs->FastQueuePacket((EQApplicationPacket **)&outapp);
}
@@ -1358,27 +1357,27 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
in.s_addr = GetIP();
clog(WORLD__CLIENT, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort());
clog(WORLD__CLIENT, "Name: %s", name);
clog(WORLD__CLIENT, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s",
Log.Out(Logs::Detail, Logs::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort());
Log.Out(Logs::Detail, Logs::World_Server, "Name: %s", name);
Log.Out(Logs::Detail, Logs::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s",
cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false");
clog(WORLD__CLIENT, "STR STA AGI DEX WIS INT CHA Total");
clog(WORLD__CLIENT, "%3d %3d %3d %3d %3d %3d %3d %3d",
Log.Out(Logs::Detail, Logs::World_Server, "STR STA AGI DEX WIS INT CHA Total");
Log.Out(Logs::Detail, Logs::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d",
cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA,
stats_sum);
clog(WORLD__CLIENT, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2);
clog(WORLD__CLIENT, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor);
clog(WORLD__CLIENT, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor);
Log.Out(Logs::Detail, Logs::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2);
Log.Out(Logs::Detail, Logs::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor);
Log.Out(Logs::Detail, Logs::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor);
/* Validate the char creation struct */
if (ClientVersionBit & BIT_SoFAndLater) {
if (!CheckCharCreateInfoSoF(cc)) {
clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)");
Log.Out(Logs::Detail, Logs::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)");
return false;
}
} else {
if (!CheckCharCreateInfoTitanium(cc)) {
clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)");
Log.Out(Logs::Detail, Logs::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)");
return false;
}
}
@@ -1439,33 +1438,27 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
pp.pvp = database.GetServerType() == 1 ? 1 : 0;
/* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */
if (ClientVersionBit & BIT_SoFAndLater && RuleI(World, SoFStartZoneID) > 0) {
clog(WORLD__CLIENT,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID));
pp.zone_id = RuleI(World, SoFStartZoneID);
if (pp.zone_id)
database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z);
else
clog(WORLD__CLIENT_ERR,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID));
} else {
/* if there's a startzone variable put them in there */
if (database.GetVariable("startzone", startzone, 50)) {
clog(WORLD__CLIENT,"Found 'startzone' variable setting: %s", startzone);
pp.zone_id = database.GetZoneID(startzone);
if (pp.zone_id)
database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z);
else
clog(WORLD__CLIENT_ERR,"Error getting zone id for '%s'", startzone);
} else { /* otherwise use normal starting zone logic */
bool ValidStartZone = false;
if (ClientVersionBit & BIT_TitaniumAndEarlier)
ValidStartZone = database.GetStartZone(&pp, cc);
else
ValidStartZone = database.GetStartZoneSoF(&pp, cc);
if (!ValidStartZone)
return false;
if (ClientVersionBit & BIT_SoFAndLater) {
Log.Out(Logs::Detail, Logs::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID));
if (RuleI(World, SoFStartZoneID) > 0) {
pp.zone_id = RuleI(World, SoFStartZoneID);
cc->start_zone = pp.zone_id;
}
}
else {
Log.Out(Logs::General, Logs::World_Server, "Found 'TitaniumStartZoneID' rule setting: %i", 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 = database.GetStartZone(&pp, cc, ClientVersionBit & BIT_TitaniumAndEarlier);
if (!ValidStartZone){
return false;
}
/* just in case */
if (!pp.zone_id) {
@@ -1493,11 +1486,11 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
pp.binds[0].z = pp.z;
pp.binds[0].heading = pp.heading;
clog(WORLD__CLIENT,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f",
Log.Out(Logs::Detail, Logs::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f",
database.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
clog(WORLD__CLIENT,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f",
Log.Out(Logs::Detail, Logs::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f",
database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
clog(WORLD__CLIENT,"Home location: %s (%d) %0.2f, %0.2f, %0.2f",
Log.Out(Logs::Detail, Logs::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f",
database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
/* Starting Items inventory */
@@ -1506,10 +1499,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
// now we give the pp and the inv we made to StoreCharacter
// to see if we can store it
if (!database.StoreCharacter(GetAccountID(), &pp, &inv)) {
clog(WORLD__CLIENT_ERR,"Character creation failed: %s", pp.name);
Log.Out(Logs::Detail, Logs::World_Server,"Character creation failed: %s", pp.name);
return false;
}
clog(WORLD__CLIENT,"Character creation successful: %s", pp.name);
Log.Out(Logs::Detail, Logs::World_Server,"Character creation successful: %s", pp.name);
return true;
}
@@ -1519,7 +1512,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
if (!cc)
return false;
_log(WORLD__CLIENT, "Validating char creation info...");
Log.Out(Logs::Detail, Logs::World_Server, "Validating char creation info...");
RaceClassCombos class_combo;
bool found = false;
@@ -1536,7 +1529,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
}
if (!found) {
_log(WORLD__CLIENT_ERR, "Could not find class/race/deity/start_zone combination");
Log.Out(Logs::Detail, Logs::World_Server, "Could not find class/race/deity/start_zone combination");
return false;
}
@@ -1553,7 +1546,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
}
if (!found) {
_log(WORLD__CLIENT_ERR, "Could not find starting stats for selected character combo, cannot verify stats");
Log.Out(Logs::Detail, Logs::World_Server, "Could not find starting stats for selected character combo, cannot verify stats");
return false;
}
@@ -1566,37 +1559,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
allocation.DefaultPointAllocation[6];
if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) {
_log(WORLD__CLIENT_ERR, "Strength out of range");
Log.Out(Logs::Detail, Logs::World_Server, "Strength out of range");
return false;
}
if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) {
_log(WORLD__CLIENT_ERR, "Dexterity out of range");
Log.Out(Logs::Detail, Logs::World_Server, "Dexterity out of range");
return false;
}
if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) {
_log(WORLD__CLIENT_ERR, "Agility out of range");
Log.Out(Logs::Detail, Logs::World_Server, "Agility out of range");
return false;
}
if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) {
_log(WORLD__CLIENT_ERR, "Stamina out of range");
Log.Out(Logs::Detail, Logs::World_Server, "Stamina out of range");
return false;
}
if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) {
_log(WORLD__CLIENT_ERR, "Intelligence out of range");
Log.Out(Logs::Detail, Logs::World_Server, "Intelligence out of range");
return false;
}
if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) {
_log(WORLD__CLIENT_ERR, "Wisdom out of range");
Log.Out(Logs::Detail, Logs::World_Server, "Wisdom out of range");
return false;
}
if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) {
_log(WORLD__CLIENT_ERR, "Charisma out of range");
Log.Out(Logs::Detail, Logs::World_Server, "Charisma out of range");
return false;
}
@@ -1609,7 +1602,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
current_stats += cc->WIS - allocation.BaseStats[5];
current_stats += cc->CHA - allocation.BaseStats[6];
if (current_stats > max_stats) {
_log(WORLD__CLIENT_ERR, "Current Stats > Maximum Stats");
Log.Out(Logs::Detail, Logs::World_Server, "Current Stats > Maximum Stats");
return false;
}
@@ -1623,7 +1616,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
int Charerrors = 0;
// solar: if this is increased you'll have to add a column to the classrace
// if this is increased you'll have to add a column to the classrace
// table below
#define _TABLE_RACES 16
@@ -1685,12 +1678,12 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
{ /*Enchanter*/ true, false, true, false, true, true, false, false, false, false, false, true, false, false, false, true},
{ /*Beastlord*/ false, true, false, false, false, false, false, false, true, true, false, false, true, true, false, false},
{ /*Berserker*/ false, true, false, false, false, false, false, true, true, true, false, false, false, true, false, false}
};//Initial table by kathgar, editted by Wiz for accuracy, solar too
};
if (!cc)
return false;
_log(WORLD__CLIENT,"Validating char creation info...");
Log.Out(Logs::Detail, Logs::World_Server,"Validating char creation info...");
classtemp = cc->class_ - 1;
racetemp = cc->race - 1;
@@ -1703,22 +1696,22 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
// if out of range looking it up in the table would crash stuff
// so we return from these
if (classtemp >= PLAYER_CLASS_COUNT) {
_log(WORLD__CLIENT_ERR," class is out of range");
Log.Out(Logs::Detail, Logs::World_Server," class is out of range");
return false;
}
if (racetemp >= _TABLE_RACES) {
_log(WORLD__CLIENT_ERR," race is out of range");
Log.Out(Logs::Detail, Logs::World_Server," race is out of range");
return false;
}
if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs?
_log(WORLD__CLIENT_ERR," invalid race/class combination");
Log.Out(Logs::Detail, Logs::World_Server," invalid race/class combination");
// we return from this one, since if it's an invalid combination our table
// doesn't have meaningful values for the stats
return false;
}
// solar: add up the base values for this class/race
// add up the base values for this class/race
// this is what they start with, and they have stat_points more
// that can distributed
bSTR = BaseClass[classtemp][0] + BaseRace[racetemp][0];
@@ -1732,7 +1725,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
bTOTAL = bSTR + bSTA + bAGI + bDEX + bWIS + bINT + bCHA;
cTOTAL = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA;
// solar: the first check makes sure the total is exactly what was expected.
// the first check makes sure the total is exactly what was expected.
// this will catch all the stat cheating, but there's still the issue
// of reducing CHA or INT or something, to use for STR, so we check
// that none are lower than the base or higher than base + stat_points
@@ -1740,43 +1733,43 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
// that are messed up not just the first hit
if (bTOTAL + stat_points != cTOTAL) {
_log(WORLD__CLIENT_ERR," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL);
Log.Out(Logs::Detail, Logs::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL);
Charerrors++;
}
if (cc->STR > bSTR + stat_points || cc->STR < bSTR) {
_log(WORLD__CLIENT_ERR," stat STR is out of range");
Log.Out(Logs::Detail, Logs::World_Server," stat STR is out of range");
Charerrors++;
}
if (cc->STA > bSTA + stat_points || cc->STA < bSTA) {
_log(WORLD__CLIENT_ERR," stat STA is out of range");
Log.Out(Logs::Detail, Logs::World_Server," stat STA is out of range");
Charerrors++;
}
if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) {
_log(WORLD__CLIENT_ERR," stat AGI is out of range");
Log.Out(Logs::Detail, Logs::World_Server," stat AGI is out of range");
Charerrors++;
}
if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) {
_log(WORLD__CLIENT_ERR," stat DEX is out of range");
Log.Out(Logs::Detail, Logs::World_Server," stat DEX is out of range");
Charerrors++;
}
if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) {
_log(WORLD__CLIENT_ERR," stat WIS is out of range");
Log.Out(Logs::Detail, Logs::World_Server," stat WIS is out of range");
Charerrors++;
}
if (cc->INT > bINT + stat_points || cc->INT < bINT) {
_log(WORLD__CLIENT_ERR," stat INT is out of range");
Log.Out(Logs::Detail, Logs::World_Server," stat INT is out of range");
Charerrors++;
}
if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) {
_log(WORLD__CLIENT_ERR," stat CHA is out of range");
Log.Out(Logs::Detail, Logs::World_Server," stat CHA is out of range");
Charerrors++;
}
/*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of)
I am NOT writing those tables - kathgar*/
_log(WORLD__CLIENT,"Found %d errors in character creation request", Charerrors);
Log.Out(Logs::Detail, Logs::World_Server,"Found %d errors in character creation request", Charerrors);
return Charerrors == 0;
}
+2 -2
View File
@@ -24,7 +24,7 @@
#include "../common/linked_list.h"
#include "../common/timer.h"
//#include "zoneserver.h"
#include "../common/logsys.h"
#include "../common/eq_packet_structs.h"
#include "cliententry.h"
@@ -109,7 +109,7 @@ private:
bool HandleDeleteCharacterPacket(const EQApplicationPacket *app);
bool HandleZoneChangePacket(const EQApplicationPacket *app);
EQStreamInterface* const eqs;
EQStreamInterface* eqs;
};
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);
+9 -4
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "cliententry.h"
#include "clientlist.h"
#include "login_server.h"
@@ -93,6 +93,8 @@ ClientListEntry::~ClientListEntry() {
Camp(); // updates zoneserver's numplayers
client_list.RemoveCLEReferances(this);
}
for (auto &elem : tell_queue)
safe_delete_array(elem);
tell_queue.clear();
}
@@ -121,7 +123,7 @@ void ClientListEntry::SetOnline(int8 iOnline) {
}
void ClientListEntry::LSUpdate(ZoneServer* iZS){
if(WorldConfig::get()->UpdateStats){
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSZoneInfo;
pack->size = sizeof(ZoneInfo_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -135,7 +137,7 @@ void ClientListEntry::LSUpdate(ZoneServer* iZS){
}
void ClientListEntry::LSZoneChange(ZoneToZone_Struct* ztz){
if(WorldConfig::get()->UpdateStats){
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSPlayerZoneChange;
pack->size = sizeof(ServerLSPlayerZoneChange_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -234,6 +236,8 @@ void ClientListEntry::ClearVars(bool iAll) {
pLFG = 0;
gm = 0;
pClientVersion = 0;
for (auto &elem : tell_queue)
safe_delete_array(elem);
tell_queue.clear();
}
@@ -267,7 +271,7 @@ bool ClientListEntry::CheckAuth(uint32 iLSID, const char* iKey) {
int16 tmpStatus = WorldConfig::get()->DefaultStatus;
paccountid = database.CreateAccount(plsname, 0, tmpStatus, LSID());
if (!paccountid) {
_log(WORLD__CLIENTLIST_ERR,"Error adding local account for LS login: '%s', duplicate name?" ,plsname);
Log.Out(Logs::Detail, Logs::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname);
return false;
}
strn0cpy(paccountname, plsname, sizeof(paccountname));
@@ -310,6 +314,7 @@ void ClientListEntry::ProcessTellQueue()
pack->Deflate();
Server()->SendPacket(pack);
safe_delete(pack);
safe_delete_array(*it);
it = tell_queue.erase(it);
}
return;
+17 -16
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "clientlist.h"
#include "zoneserver.h"
#include "zonelist.h"
@@ -56,7 +56,7 @@ void ClientList::Process() {
if (!iterator.GetData()->Process()) {
struct in_addr in;
in.s_addr = iterator.GetData()->GetIP();
_log(WORLD__CLIENTLIST,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort());
Log.Out(Logs::Detail, Logs::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort());
//the client destructor should take care of this.
// iterator.GetData()->Free();
iterator.RemoveCurrent();
@@ -116,7 +116,8 @@ void ClientList::EnforceSessionLimit(uint32 iLSAccountID) {
// If we have a char name, they are in a zone, so send a kick to the zone server
if(strlen(ClientEntry->name())) {
ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
auto pack =
new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer;
strcpy(skp->adminname, "SessionLimit");
strcpy(skp->name, ClientEntry->name());
@@ -223,7 +224,7 @@ void ClientList::DisconnectByIP(uint32 iIP) {
countCLEIPs = iterator.GetData();
if ((countCLEIPs->GetIP() == iIP)) {
if(strlen(countCLEIPs->name())) {
ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
auto pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer;
strcpy(skp->adminname, "SessionLimit");
strcpy(skp->name, countCLEIPs->name());
@@ -328,7 +329,7 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
void ClientList::CLEAdd(uint32 iLSID, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin, uint32 ip, uint8 local) {
ClientListEntry* tmp = new ClientListEntry(GetNextCLEID(), iLSID, iLoginName, iLoginKey, iWorldAdmin, ip, local);
auto tmp = new ClientListEntry(GetNextCLEID(), iLSID, iLoginName, iLoginKey, iWorldAdmin, ip, local);
clientlist.Append(tmp);
}
@@ -424,13 +425,13 @@ ClientListEntry* ClientList::CheckAuth(const char* iName, const char* iPassword)
}
int16 tmpadmin;
//_log(WORLD__ZONELIST,"Login with '%s' and '%s'", iName, iPassword);
//Log.LogDebugType(Logs::Detail, Logs::World_Server,"Login with '%s' and '%s'", iName, iPassword);
uint32 accid = database.CheckLogin(iName, iPassword, &tmpadmin);
if (accid) {
uint32 lsid = 0;
database.GetAccountIDByName(iName, &tmpadmin, &lsid);
ClientListEntry* tmp = new ClientListEntry(GetNextCLEID(), lsid, iName, tmpMD5, tmpadmin, 0, 0);
auto tmp = new ClientListEntry(GetNextCLEID(), lsid, iName, tmpMD5, tmpadmin, 0, 0);
clientlist.Append(tmp);
return tmp;
}
@@ -446,7 +447,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
if(!from)
{
_log(WORLD__CLIENT_ERR,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID);
Log.Out(Logs::Detail, Logs::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID);
return;
}
@@ -470,7 +471,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
Iterator.Reset();
ServerPacket* pack = new ServerPacket(ServerOP_OnlineGuildMembersResponse, PacketLength);
auto pack = new ServerPacket(ServerOP_OnlineGuildMembersResponse, PacketLength);
char *Buffer = (char *)pack->pBuffer;
@@ -572,7 +573,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
unknown44[1]=0;
uint32 unknown52=totalusers;
uint32 unknown56=1;
ServerPacket* pack2 = new ServerPacket(ServerOP_WhoAllReply,64+totallength+(49*totalusers));
auto pack2 = new ServerPacket(ServerOP_WhoAllReply, 64 + totallength + (49 * totalusers));
memset(pack2->pBuffer,0,pack2->size);
uchar *buffer=pack2->pBuffer;
uchar *bufptr=buffer;
@@ -750,7 +751,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
safe_delete(output);
}
catch(...){
_log(WORLD__ZONELIST_ERR,"Unknown error in world's SendWhoAll (probably mem error), ignoring...");
Log.Out(Logs::Detail, Logs::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring...");
return;
}
}
@@ -801,7 +802,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon
ClientListEntry* cle;
int FriendsOnline = FriendsCLEs.size();
int PacketLength = sizeof(WhoAllReturnStruct) + (47 * FriendsOnline) + TotalLength;
ServerPacket* pack2 = new ServerPacket(ServerOP_WhoAllReply, PacketLength);
auto pack2 = new ServerPacket(ServerOP_WhoAllReply, PacketLength);
memset(pack2->pBuffer,0,pack2->size);
uchar *buffer=pack2->pBuffer;
uchar *bufptr=buffer;
@@ -894,7 +895,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon
safe_delete(pack2);
}
catch(...){
_log(WORLD__ZONELIST_ERR,"Unknown error in world's SendFriendsWho (probably mem error), ignoring...");
Log.Out(Logs::Detail, Logs::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring...");
return;
}
}
@@ -931,7 +932,7 @@ void ClientList::SendLFGMatches(ServerLFGMatchesRequest_Struct *smrs) {
}
Iterator.Advance();
}
ServerPacket* Pack = new ServerPacket(ServerOP_LFGMatches, (sizeof(ServerLFGMatchesResponse_Struct) * Matches) + 4);
auto Pack = new ServerPacket(ServerOP_LFGMatches, (sizeof(ServerLFGMatchesResponse_Struct) * Matches) + 4);
char *Buf = (char *)Pack->pBuffer;
// FromID is the Entity ID of the player doing the search.
@@ -1129,7 +1130,7 @@ Client* ClientList::FindByAccountID(uint32 account_id) {
iterator.Reset();
while(iterator.MoreElements()) {
_log(WORLD__CLIENTLIST, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData());
Log.Out(Logs::Detail, Logs::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData());
if (iterator.GetData()->GetAccountID() == account_id) {
Client* tmp = iterator.GetData();
return tmp;
@@ -1144,7 +1145,7 @@ Client* ClientList::FindByName(char* charname) {
iterator.Reset();
while(iterator.MoreElements()) {
_log(WORLD__CLIENTLIST, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData());
Log.Out(Logs::Detail, Logs::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData());
if (iterator.GetData()->GetCharName() == charname) {
Client* tmp = iterator.GetData();
return tmp;
+24 -22
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
@@ -90,7 +90,7 @@ void Console::Die() {
state = CONSOLE_STATE_CLOSED;
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__CONSOLE,"Removing console from %s:%d",inet_ntoa(in),GetPort());
Log.Out(Logs::Detail, Logs::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort());
tcpc->Disconnect();
}
@@ -116,7 +116,8 @@ bool Console::SendChannelMessage(const ServerChannelMessage_Struct* scm) {
}
case 7: {
SendMessage(1, "[%s] tells you, '%s'", scm->from, scm->message);
ServerPacket* pack = new ServerPacket(ServerOP_ChannelMessage, sizeof(ServerChannelMessage_Struct) + strlen(scm->message) + 1);
auto pack = new ServerPacket(ServerOP_ChannelMessage,
sizeof(ServerChannelMessage_Struct) + strlen(scm->message) + 1);
memcpy(pack->pBuffer, scm, pack->size);
ServerChannelMessage_Struct* scm2 = (ServerChannelMessage_Struct*) pack->pBuffer;
strcpy(scm2->deliverto, scm2->from);
@@ -220,7 +221,7 @@ bool Console::Process() {
if (!tcpc->Connected()) {
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__CONSOLE,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort());
Log.Out(Logs::Detail, Logs::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort());
return false;
}
//if we have not gotten the special markers after this timer, send login prompt
@@ -235,7 +236,7 @@ bool Console::Process() {
SendMessage(1, "Timeout, disconnecting...");
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__CONSOLE,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort());
Log.Out(Logs::Detail, Logs::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort());
return false;
}
@@ -243,25 +244,25 @@ bool Console::Process() {
struct in_addr in;
in.s_addr = GetIP();
if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) {
ZoneServer* zs = new ZoneServer(tcpc);
_log(WORLD__CONSOLE,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort());
auto zs = new ZoneServer(tcpc);
Log.Out(Logs::Detail, Logs::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort());
zoneserver_list.Add(zs);
numzones++;
tcpc = 0;
} else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeLauncher) {
_log(WORLD__CONSOLE,"New launcher from %s:%d", inet_ntoa(in), GetPort());
Log.Out(Logs::Detail, Logs::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort());
launcher_list.Add(tcpc);
tcpc = 0;
}
else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS)
{
_log(WORLD__CONSOLE,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort());
Log.Out(Logs::Detail, Logs::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort());
UCSLink.SetConnection(tcpc);
tcpc = 0;
}
else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeQueryServ)
{
_log(WORLD__CONSOLE,"New QS Connection from %s:%d", inet_ntoa(in), GetPort());
Log.Out(Logs::Detail, Logs::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort());
QSLink.SetConnection(tcpc);
tcpc = 0;
}
@@ -272,7 +273,7 @@ bool Console::Process() {
tcpc = 0;
}
else {
_log(WORLD__CONSOLE,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort());
Log.Out(Logs::Detail, Logs::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort());
}
return false;
}
@@ -412,7 +413,7 @@ void Console::ProcessCommand(const char* command) {
state = CONSOLE_STATE_CLOSED;
return;
}
paccountid = database.CheckLogin(paccountname,command);
paccountid = database.CheckLogin(paccountname ,command);
if (paccountid == 0) {
SendMessage(1, 0);
SendMessage(2, "Login failed.");
@@ -429,7 +430,7 @@ void Console::ProcessCommand(const char* command) {
state = CONSOLE_STATE_CLOSED;
return;
}
_log(WORLD__CONSOLE,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin);
Log.Out(Logs::Detail, Logs::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin);
SendMessage(1, 0);
SendMessage(2, "Login accepted.");
state = CONSOLE_STATE_CONNECTED;
@@ -438,7 +439,7 @@ void Console::ProcessCommand(const char* command) {
break;
}
case CONSOLE_STATE_CONNECTED: {
_log(WORLD__CONSOLE,"TCP command: %s: \"%s\"",paccountname,command);
Log.Out(Logs::Detail, Logs::World_Server,"TCP command: %s: \"%s\"",paccountname ,command);
Seperator sep(command);
if (strcasecmp(sep.arg[0], "help") == 0 || strcmp(sep.arg[0], "?") == 0) {
SendMessage(1, " whoami");
@@ -485,7 +486,8 @@ void Console::ProcessCommand(const char* command) {
else if (strcasecmp(sep.arg[0], "signalcharbyname") == 0) {
SendMessage(1, "Signal Sent to %s with ID %i", (char*) sep.arg[1], atoi(sep.arg[2]));
uint32 message_len = strlen((char*) sep.arg[1]) + 1;
ServerPacket* pack = new ServerPacket(ServerOP_CZSignalClientByName, sizeof(CZClientSignalByName_Struct) + message_len);
auto pack = new ServerPacket(ServerOP_CZSignalClientByName,
sizeof(CZClientSignalByName_Struct) + message_len);
CZClientSignalByName_Struct* CZSC = (CZClientSignalByName_Struct*) pack->pBuffer;
strn0cpy(CZSC->Name, (char*) sep.arg[1], 64);
CZSC->data = atoi(sep.arg[2]);
@@ -511,7 +513,7 @@ void Console::ProcessCommand(const char* command) {
}
else if (strcasecmp(sep.arg[0], "uptime") == 0) {
if (sep.IsNumber(1) && atoi(sep.arg[1]) > 0) {
ServerPacket* pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer;
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", this->GetName());
sus->zoneserverid = atoi(sep.arg[1]);
@@ -636,7 +638,7 @@ void Console::ProcessCommand(const char* command) {
char tmpname[64];
tmpname[0] = '*';
strcpy(&tmpname[1], paccountname);
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_KickPlayer;
pack->size = sizeof(ServerKickPlayer_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -648,7 +650,7 @@ void Console::ProcessCommand(const char* command) {
delete pack;
}
else if (strcasecmp(sep.arg[0], "who") == 0) {
Who_All_Struct* whom = new Who_All_Struct;
auto whom = new Who_All_Struct;
memset(whom, 0, sizeof(Who_All_Struct));
whom->lvllow = 0xFFFF;
whom->lvlhigh = 0xFFFF;
@@ -689,7 +691,7 @@ void Console::ProcessCommand(const char* command) {
tmpname[0] = '*';
strcpy(&tmpname[1], paccountname);
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->size = sizeof(ServerZoneStateChange_struct);
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, sizeof(ServerZoneStateChange_struct));
@@ -725,7 +727,7 @@ void Console::ProcessCommand(const char* command) {
tmpname[0] = '*';
strcpy(&tmpname[1], paccountname);
_log(WORLD__CONSOLE,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]);
Log.Out(Logs::Detail, Logs::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]);
zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0));
}
}
@@ -809,7 +811,7 @@ void Console::ProcessCommand(const char* command) {
#endif
RunLoops = true;
SendMessage(1, " Login Server Reconnect manually restarted by Console");
_log(WORLD__CONSOLE,"Login Server Reconnect manually restarted by Console");
Log.Out(Logs::Detail, Logs::World_Server,"Login Server Reconnect manually restarted by Console");
}
else if (strcasecmp(sep.arg[0], "zonelock") == 0 && admin >= consoleZoneStatus) {
if (strcasecmp(sep.arg[1], "list") == 0) {
@@ -849,7 +851,7 @@ void Console::ProcessCommand(const char* command) {
else if (strcasecmp(sep.arg[0], "reloadworld") == 0 && admin > 101)
{
SendEmoteMessage(0,0,0,15,"Reloading World...");
ServerPacket* pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
ReloadWorld_Struct* RW = (ReloadWorld_Struct*) pack->pBuffer;
RW->Option = 1;
zoneserver_list.SendPacket(pack);
+5 -12
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "eql_config.h"
#include "worlddb.h"
#include "launcher_link.h"
@@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() {
std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf);
auto results = database.QueryDatabase(query);
if (!results.Success())
LogFile->write(EQEMuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
Log.Out(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
else {
auto row = results.begin();
m_dynamics = atoi(row[0]);
@@ -51,7 +51,7 @@ void EQLConfig::LoadSettings() {
query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf);
results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
Log.Out(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
return;
}
@@ -73,7 +73,6 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) {
std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str());
return nullptr;
}
@@ -118,14 +117,12 @@ void EQLConfig::DeleteLauncher() {
std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str());
return;
}
query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf);
results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str());
return;
}
}
@@ -173,7 +170,6 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
"VALUES('%s', '%s', %d)", namebuf, zonebuf, port);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str());
return false;
}
@@ -202,7 +198,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
res = m_zones.find(short_name);
if(res == m_zones.end()) {
//not found.
LogFile->write(EQEMuLog::Error, "Update for unknown zone %s", short_name);
Log.Out(Logs::General, Logs::Error, "Update for unknown zone %s", short_name);
return false;
}
@@ -217,7 +213,6 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
"launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str());
return false;
}
@@ -239,7 +234,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
res = m_zones.find(short_name);
if(res == m_zones.end()) {
//not found.
LogFile->write(EQEMuLog::Error, "Update for unknown zone %s", short_name);
Log.Out(Logs::General, Logs::Error, "Update for unknown zone %s", short_name);
return false;
}
@@ -254,7 +249,6 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
"launcher = '%s' AND zone = '%s'", namebuf, zonebuf);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str());
return false;
}
@@ -279,7 +273,6 @@ bool EQLConfig::SetDynamicCount(int count) {
std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str());
return false;
}
+4 -4
View File
@@ -18,7 +18,7 @@
#ifdef EMBPERL
#include "../common/debug.h"
#include "../common/global_define.h"
#include "eqw.h"
#include "eqw_parser.h"
#include "world_config.h"
@@ -75,11 +75,11 @@ EQW::EQW() {
void EQW::AppendOutput(const char *str) {
m_outputBuffer += str;
// _log(WORLD__EQW, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length());
// Log.LogDebugType(Logs::Detail, Logs::World_Server, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length());
}
const std::string &EQW::GetOutput() const {
// _log(WORLD__EQW, "Getting, length %d", m_outputBuffer.length());
// Log.LogDebugType(Logs::Detail, Logs::World_Server, "Getting, length %d", m_outputBuffer.length());
return(m_outputBuffer);
}
@@ -269,7 +269,7 @@ void EQW::LSReconnect() {
pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr);
#endif
RunLoops = true;
_log(WORLD__CONSOLE,"Login Server Reconnect manually restarted by Web Tool");
Log.Out(Logs::Detail, Logs::World_Server,"Login Server Reconnect manually restarted by Web Tool");
}
/*EQLConfig * EQW::FindLauncher(Const_char *zone_ref) {
+13 -14
View File
@@ -15,13 +15,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "eqw_http_handler.h"
#include "../common/SocketLib/Base64.h"
#include "eqw_parser.h"
#include "eqw.h"
#include "http_request.h"
#include "../common/logsys.h"
#include "worlddb.h"
#include "console.h"
@@ -139,11 +139,11 @@ bool EQWHTTPHandler::CheckAuth() const {
int16 status = 0;
uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status);
if(acctid == 0) {
_log(WORLD__HTTP_ERR, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str());
return(false);
}
if(status < httpLoginStatus) {
_log(WORLD__HTTP_ERR, "Login of %s failed: status too low.", m_username.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Login of %s failed: status too low.", m_username.c_str());
return(false);
}
@@ -178,8 +178,7 @@ void EQWHTTPHandler::SendPage(const std::string &file) {
}
#endif
char *buffer = new char[READ_BUFFER_LEN+1];
auto buffer = new char[READ_BUFFER_LEN + 1];
size_t len;
std::string to_process;
while((len = fread(buffer, 1, READ_BUFFER_LEN, f)) > 0) {
@@ -274,34 +273,34 @@ EQWHTTPServer::EQWHTTPServer()
}
void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort) {
EQWHTTPHandler *conn = new EQWHTTPHandler(ID, in_socket, irIP, irPort);
auto conn = new EQWHTTPHandler(ID, in_socket, irIP, irPort);
AddConnection(conn);
}
void EQWHTTPServer::Stop() {
_log(WORLD__HTTP, "Requesting that HTTP Service stop.");
Log.Out(Logs::Detail, Logs::World_Server, "Requesting that HTTP Service stop.");
m_running = false;
Close();
}
bool EQWHTTPServer::Start(uint16 port, const char *mime_file) {
if(m_running) {
_log(WORLD__HTTP_ERR, "HTTP Service is already running on port %d", m_port);
Log.Out(Logs::Detail, Logs::World_Server, "HTTP Service is already running on port %d", m_port);
return(false);
}
//load up our nice mime types
if(!EQWHTTPHandler::LoadMimeTypes(mime_file)) {
_log(WORLD__HTTP_ERR, "Failed to load mime types from '%s'", mime_file);
Log.Out(Logs::Detail, Logs::World_Server, "Failed to load mime types from '%s'", mime_file);
return(false);
} else {
_log(WORLD__HTTP, "Loaded mime types from %s", mime_file);
Log.Out(Logs::Detail, Logs::World_Server, "Loaded mime types from %s", mime_file);
}
//fire up the server thread
char errbuf[TCPServer_ErrorBufferSize];
if(!Open(port, errbuf)) {
_log(WORLD__HTTP_ERR, "Unable to bind to port %d for HTTP service: %s", port, errbuf);
Log.Out(Logs::Detail, Logs::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf);
return(false);
}
@@ -321,12 +320,12 @@ bool EQWHTTPServer::Start(uint16 port, const char *mime_file) {
/*
void EQWHTTPServer::Run() {
_log(WORLD__HTTP, "HTTP Processing thread started on port %d", m_port);
Log.LogDebugType(Logs::Detail, Logs::World_Server, "HTTP Processing thread started on port %d", m_port);
do {
#warning DELETE THIS IF YOU DONT USE IT
Sleep(10);
} while(m_running);
_log(WORLD__HTTP, "HTTP Processing thread terminating on port %d", m_port);
Log.LogDebugType(Logs::Detail, Logs::World_Server, "HTTP Processing thread terminating on port %d", m_port);
}
ThreadReturnType EQWHTTPServer::ThreadProc(void *data) {
+6 -7
View File
@@ -20,11 +20,11 @@
#ifdef EMBPERL
#include "../common/debug.h"
#include "../common/global_define.h"
#include "eqw_parser.h"
#include "eqw.h"
#include "../common/eqdb.h"
#include "../common/logsys.h"
#include "worlddb.h"
#ifndef GvCV_set
@@ -65,7 +65,7 @@ EQWParser::EQWParser() {
my_perl = perl_alloc();
_empty_sv = newSV(0);
if(!my_perl)
_log(WORLD__PERL_ERR, "Error: perl_alloc failed!");
Log.Out(Logs::Detail, Logs::World_Server, "Error: perl_alloc failed!");
else
DoInit();
}
@@ -182,10 +182,10 @@ void EQWParser::DoInit() {
#ifdef EMBPERL_PLUGIN
_log(WORLD__PERL, "Loading worldui perl plugins.");
Log.Out(Logs::Detail, Logs::World_Server, "Loading worldui perl plugins.");
std::string err;
if(!eval_file("world", "worldui.pl", err)) {
_log(WORLD__PERL_ERR, "Warning - world.pl: %s", err.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Warning - world.pl: %s", err.c_str());
}
eval_pv(
@@ -229,8 +229,7 @@ bool EQWParser::dosub(const char * subname, const std::vector<std::string> &args
PUSHMARK(SP); // remember the stack pointer
if(args.size() > 0)
{
for(std::vector<std::string>::const_iterator i = args.begin(); i != args.end(); ++i)
{/* push the arguments onto the perl stack */
for (auto i = args.begin(); i != args.end(); ++i) { /* push the arguments onto the perl stack */
XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length())));
}
}
+1 -1
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "http_request.h"
#include "eqw_http_handler.h"
#include "../common/eqdb.h"
+20 -21
View File
@@ -16,11 +16,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "launcher_link.h"
#include "launcher_list.h"
#include "world_config.h"
#include "../common/logsys.h"
#include "../common/md5.h"
#include "../common/packet_dump.h"
#include "../common/servertalk.h"
@@ -68,7 +68,6 @@ bool LauncherLink::Process() {
ServerPacket *pack = 0;
while((pack = tcpc->PopPacket())) {
_hex(WORLD__ZONE_TRACE,pack->pBuffer,pack->size);
if (!authenticated) {
if (WorldConfig::get()->SharedKey.length() > 0) {
if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) {
@@ -79,8 +78,8 @@ bool LauncherLink::Process() {
else {
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__LAUNCH_ERR, "Launcher authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
Log.Out(Logs::Detail, Logs::World_Server, "Launcher authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
Disconnect();
@@ -90,8 +89,8 @@ bool LauncherLink::Process() {
else {
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__LAUNCH_ERR, "Launcher authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
Log.Out(Logs::Detail, Logs::World_Server, "Launcher authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
Disconnect();
@@ -100,7 +99,7 @@ bool LauncherLink::Process() {
}
else
{
_log(WORLD__LAUNCH,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
Log.Out(Logs::Detail, Logs::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
authenticated = true;
}
delete pack;
@@ -114,25 +113,25 @@ bool LauncherLink::Process() {
break;
}
case ServerOP_ZAAuth: {
_log(WORLD__LAUNCH, "Got authentication from %s when they are already authenticated.", m_name.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str());
break;
}
case ServerOP_LauncherConnectInfo: {
const LauncherConnectInfo *it = (const LauncherConnectInfo *) pack->pBuffer;
if(HasName()) {
_log(WORLD__LAUNCH_ERR, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name);
Log.Out(Logs::Detail, Logs::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name);
break;
}
m_name = it->name;
EQLConfig *config = launcher_list.GetConfig(m_name.c_str());
if(config == nullptr) {
_log(WORLD__LAUNCH, "Unknown launcher '%s' connected. Disconnecting.", it->name);
Log.Out(Logs::Detail, Logs::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name);
Disconnect();
break;
}
_log(WORLD__LAUNCH, "Launcher Identified itself as '%s'. Loading zone list.", it->name);
Log.Out(Logs::Detail, Logs::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name);
std::vector<LauncherZone> result;
//database.GetLauncherZones(it->name, result);
@@ -146,7 +145,7 @@ bool LauncherLink::Process() {
zs.port = cur->port;
zs.up = false;
zs.starts = 0;
_log(WORLD__LAUNCH_TRACE, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port);
Log.Out(Logs::Detail, Logs::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port);
m_states[cur->name] = zs;
}
@@ -162,17 +161,17 @@ bool LauncherLink::Process() {
std::map<std::string, ZoneState>::iterator res;
res = m_states.find(it->short_name);
if(res == m_states.end()) {
_log(WORLD__LAUNCH_ERR, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name);
Log.Out(Logs::Detail, Logs::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name);
break;
}
_log(WORLD__LAUNCH, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count);
Log.Out(Logs::Detail, Logs::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count);
res->second.up = it->running;
res->second.starts = it->start_count;
break;
}
default:
{
_log(WORLD__LAUNCH_ERR, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size);
Log.Out(Logs::Detail, Logs::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
@@ -200,14 +199,14 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) {
zs.port = port;
zs.up = false;
zs.starts = 0;
_log(WORLD__LAUNCH_TRACE, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port);
Log.Out(Logs::Detail, Logs::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port);
m_states[short_name] = zs;
StartZone(short_name);
}
void LauncherLink::StartZone(const char *short_name) {
ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
auto pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer;
strn0cpy(s->short_name, short_name, 32);
@@ -218,7 +217,7 @@ void LauncherLink::StartZone(const char *short_name) {
}
void LauncherLink::RestartZone(const char *short_name) {
ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
auto pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer;
strn0cpy(s->short_name, short_name, 32);
@@ -229,7 +228,7 @@ void LauncherLink::RestartZone(const char *short_name) {
}
void LauncherLink::StopZone(const char *short_name) {
ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
auto pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer;
strn0cpy(s->short_name, short_name, 32);
@@ -329,7 +328,7 @@ void LauncherLink::GetZoneDetails(const char *short_name, std::map<std::string,s
}
void LauncherLink::Shutdown() {
ServerPacket* pack = new ServerPacket(ServerOP_ShutdownAll);
auto pack = new ServerPacket(ServerOP_ShutdownAll);
SendPacket(pack);
delete pack;
}
+8 -10
View File
@@ -17,10 +17,10 @@
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "launcher_list.h"
#include "launcher_link.h"
#include "../common/logsys.h"
#include "eql_config.h"
LauncherList::LauncherList()
@@ -57,10 +57,9 @@ void LauncherList::Process() {
cur = m_pendingLaunchers.begin();
while(cur != m_pendingLaunchers.end()) {
LauncherLink *l = *cur;
//printf("ProcP %d: %p\n", l->GetID(), l);
if(!l->Process()) {
//launcher has died before it identified itself.
_log(WORLD__LAUNCH, "Removing pending launcher %d", l->GetID());
Log.Out(Logs::Detail, Logs::World_Server, "Removing pending launcher %d", l->GetID());
cur = m_pendingLaunchers.erase(cur);
delete l;
} else if(l->HasName()) {
@@ -72,10 +71,10 @@ void LauncherList::Process() {
std::map<std::string, LauncherLink *>::iterator res;
res = m_launchers.find(name);
if(res != m_launchers.end()) {
_log(WORLD__LAUNCH, "Ghosting launcher %s", name.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Ghosting launcher %s", name.c_str());
delete res->second;
}
_log(WORLD__LAUNCH, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str());
//put the launcher in the list.
m_launchers[name] = l;
} else {
@@ -88,10 +87,9 @@ void LauncherList::Process() {
curl = m_launchers.begin();
while(curl != m_launchers.end()) {
LauncherLink *l = curl->second;
//printf("Proc %s(%d): %p\n", l->GetName(), l->GetID(), l);
if(!l->Process()) {
//launcher has died before it identified itself.
_log(WORLD__LAUNCH, "Removing launcher %s (%d)", l->GetName(), l->GetID());
Log.Out(Logs::Detail, Logs::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID());
curl = m_launchers.erase(curl);
delete l;
} else {
@@ -130,8 +128,8 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) {
}
void LauncherList::Add(EmuTCPConnection *conn) {
LauncherLink *it = new LauncherLink(nextID++, conn);
_log(WORLD__LAUNCH, "Adding pending launcher %d", it->GetID());
auto it = new LauncherLink(nextID++, conn);
Log.Out(Logs::Detail, Logs::World_Server, "Adding pending launcher %d", it->GetID());
m_pendingLaunchers.push_back(it);
}
+7 -7
View File
@@ -21,7 +21,7 @@
#include "clientlist.h"
#include "zoneserver.h"
#include "zonelist.h"
#include "../common/logsys.h"
#include "../common/misc_functions.h"
extern ClientList client_list;
@@ -30,11 +30,11 @@ extern ZSList zoneserver_list;
GroupLFP::GroupLFP(uint32 inLeaderID) {
LeaderID = inLeaderID;
for(unsigned int i=0; i<MAX_GROUP_MEMBERS; i++) {
Members[i].Name[0] = '\0';
Members[i].Class = 0;
Members[i].Level = 0;
Members[i].Zone = 0;
for (auto &member : Members) {
member.Name[0] = '\0';
member.Class = 0;
member.Level = 0;
member.Zone = 0;
}
FromLevel = 1;
ToLevel = 100;
@@ -228,7 +228,7 @@ void GroupLFPList::SendLFPMatches(ServerLFPMatchesRequest_Struct* smrs) {
}
}
ServerPacket* Pack = new ServerPacket(ServerOP_LFPMatches, (sizeof(ServerLFPMatchesResponse_Struct) * Matches) + 4);
auto Pack = new ServerPacket(ServerOP_LFPMatches, (sizeof(ServerLFPMatchesResponse_Struct) * Matches) + 4);
char *Buf = (char *)Pack->pBuffer;
+21 -22
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
@@ -96,8 +96,7 @@ bool LoginServer::Process() {
ServerPacket *pack = 0;
while((pack = tcpc->PopPacket()))
{
_log(WORLD__LS_TRACE,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode);
_hex(WORLD__LS_TRACE,pack->pBuffer,pack->size);
Log.Out(Logs::Detail, Logs::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode);
switch(pack->opcode) {
case 0:
@@ -111,7 +110,7 @@ bool LoginServer::Process() {
uint32 id = database.GetAccountIDFromLSID(utwr->lsaccountid);
int16 status = database.CheckStatus(id);
ServerPacket* outpack = new ServerPacket;
auto outpack = new ServerPacket;
outpack->opcode = ServerOP_UsertoWorldResp;
outpack->size = sizeof(UsertoWorldResponse_Struct);
outpack->pBuffer = new uchar[outpack->size];
@@ -160,12 +159,12 @@ bool LoginServer::Process() {
case ServerOP_LSFatalError: {
#ifndef IGNORE_LS_FATAL_ERROR
WorldConfig::DisableLoginserver();
_log(WORLD__LS_ERR, "Login server responded with FatalError. Disabling reconnect.");
Log.Out(Logs::Detail, Logs::World_Server, "Login server responded with FatalError. Disabling reconnect.");
#else
_log(WORLD__LS_ERR, "Login server responded with FatalError.");
Log.Out(Logs::Detail, Logs::World_Server, "Login server responded with FatalError.");
#endif
if (pack->size > 1) {
_log(WORLD__LS_ERR, " %s",pack->pBuffer);
Log.Out(Logs::Detail, Logs::World_Server, " %s",pack->pBuffer);
}
break;
}
@@ -177,18 +176,18 @@ bool LoginServer::Process() {
case ServerOP_LSRemoteAddr: {
if (!Config->WorldAddress.length()) {
WorldConfig::SetWorldAddress((char *)pack->pBuffer);
_log(WORLD__LS, "Loginserver provided %s as world address",pack->pBuffer);
Log.Out(Logs::Detail, Logs::World_Server, "Loginserver provided %s as world address",pack->pBuffer);
}
break;
}
case ServerOP_LSAccountUpdate: {
_log(WORLD__LS, "Received ServerOP_LSAccountUpdate packet from loginserver");
Log.Out(Logs::Detail, Logs::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver");
CanAccountUpdate = true;
break;
}
default:
{
_log(WORLD__LS_ERR, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size);
Log.Out(Logs::Detail, Logs::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
@@ -202,10 +201,10 @@ bool LoginServer::Process() {
bool LoginServer::InitLoginServer() {
if(Connected() == false) {
if(ConnectReady()) {
_log(WORLD__LS, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort);
Log.Out(Logs::Detail, Logs::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort);
Connect();
} else {
_log(WORLD__LS_ERR, "Not connected but not ready to connect, this is bad: %s:%d",
Log.Out(Logs::Detail, Logs::World_Server, "Not connected but not ready to connect, this is bad: %s:%d",
LoginServerAddress,LoginServerPort);
}
}
@@ -216,29 +215,29 @@ bool LoginServer::Connect() {
char tmp[25];
if(database.GetVariable("loginType",tmp,sizeof(tmp)) && strcasecmp(tmp,"MinILogin") == 0){
minilogin = true;
_log(WORLD__LS, "Setting World to MiniLogin Server type");
Log.Out(Logs::Detail, Logs::World_Server, "Setting World to MiniLogin Server type");
}
else
minilogin = false;
if (minilogin && WorldConfig::get()->WorldAddress.length()==0) {
_log(WORLD__LS_ERR, "**** For minilogin to work, you need to set the <address> element in the <world> section.");
Log.Out(Logs::Detail, Logs::World_Server, "**** For minilogin to work, you need to set the <address> element in the <world> section.");
return false;
}
char errbuf[TCPConnection_ErrorBufferSize];
if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) {
_log(WORLD__LS_ERR, "Unable to resolve '%s' to an IP.",LoginServerAddress);
Log.Out(Logs::Detail, Logs::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress);
return false;
}
if (LoginServerIP == 0 || LoginServerPort == 0) {
_log(WORLD__LS_ERR, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort);
Log.Out(Logs::Detail, Logs::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort);
return false;
}
if (tcpc->ConnectIP(LoginServerIP, LoginServerPort, errbuf)) {
_log(WORLD__LS, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort);
Log.Out(Logs::Detail, Logs::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort);
if (minilogin)
SendInfo();
else
@@ -248,14 +247,14 @@ bool LoginServer::Connect() {
return true;
}
else {
_log(WORLD__LS_ERR, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf);
Log.Out(Logs::Detail, Logs::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf);
return false;
}
}
void LoginServer::SendInfo() {
const WorldConfig *Config=WorldConfig::get();
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSInfo;
pack->size = sizeof(ServerLSInfo_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -275,7 +274,7 @@ void LoginServer::SendNewInfo() {
uint16 port;
const WorldConfig *Config=WorldConfig::get();
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_NewLSInfo;
pack->size = sizeof(ServerNewLSInfo_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -301,7 +300,7 @@ void LoginServer::SendNewInfo() {
void LoginServer::SendStatus() {
statusupdate_timer.Start();
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSStatus;
pack->size = sizeof(ServerLSStatus_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -324,7 +323,7 @@ void LoginServer::SendStatus() {
void LoginServer::SendAccountUpdate(ServerPacket* pack) {
ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer;
if(CanUpdate()) {
_log(WORLD__LS, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort);
Log.Out(Logs::Detail, Logs::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort);
strn0cpy(s->worldaccount, LoginAccount, 30);
strn0cpy(s->worldpassword, LoginPassword, 30);
SendPacket(pack);
+3 -3
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
@@ -51,7 +51,7 @@ LoginServerList::~LoginServerList() {
void LoginServerList::Add(const char* iAddress, uint16 iPort, const char* Account, const char* Password)
{
LoginServer* loginserver = new LoginServer(iAddress, iPort, Account, Password);
auto loginserver = new LoginServer(iAddress, iPort, Account, Password);
list.Insert(loginserver);
}
@@ -134,7 +134,7 @@ bool LoginServerList::SendPacket(ServerPacket* pack) {
bool LoginServerList::SendAccountUpdate(ServerPacket* pack) {
LinkedListIterator<LoginServer*> iterator(list);
_log(WORLD__LS, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers");
Log.Out(Logs::Detail, Logs::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers");
iterator.Reset();
while(iterator.MoreElements()){
if(iterator.GetData()->CanUpdate()) {
+78 -76
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include <iostream>
#include <string.h>
@@ -24,7 +24,8 @@
#include <signal.h>
#include "../common/debug.h"
#include "../common/global_define.h"
#include "../common/eqemu_logsys.h"
#include "../common/queue.h"
#include "../common/timer.h"
#include "../common/eq_stream_factory.h"
@@ -33,7 +34,7 @@
#include "../common/version.h"
#include "../common/eqtime.h"
#include "../common/timeoutmgr.h"
#include "../common/eqemu_error.h"
#include "../common/opcodemgr.h"
#include "../common/guilds.h"
#include "../common/eq_stream_ident.h"
@@ -113,6 +114,7 @@ void CatchSignal(int sig_num);
int main(int argc, char** argv) {
RegisterExecutablePlatform(ExePlatformWorld);
Log.LoadLogSettingsDefaults();
set_exception_handler();
register_remote_call_handlers();
@@ -126,36 +128,30 @@ int main(int argc, char** argv) {
}
// Load server configuration
_log(WORLD__INIT, "Loading server configuration..");
Log.Out(Logs::General, Logs::World_Server, "Loading server configuration..");
if (!WorldConfig::LoadConfig()) {
_log(WORLD__INIT_ERR, "Loading server configuration failed.");
Log.Out(Logs::General, Logs::World_Server, "Loading server configuration failed.");
return 1;
}
const WorldConfig *Config=WorldConfig::get();
if(!load_log_settings(Config->LogSettingsFile.c_str()))
_log(WORLD__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
else
_log(WORLD__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
_log(WORLD__INIT, "CURRENT_VERSION: %s", CURRENT_VERSION);
Log.Out(Logs::General, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
#ifdef _DEBUG
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
_log(WORLD__INIT_ERR, "Could not set signal handler");
Log.Out(Logs::General, Logs::World_Server, "Could not set signal handler");
return 1;
}
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
_log(WORLD__INIT_ERR, "Could not set signal handler");
Log.Out(Logs::General, Logs::World_Server, "Could not set signal handler");
return 1;
}
#ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
_log(WORLD__INIT_ERR, "Could not set signal handler");
Log.Out(Logs::General, Logs::World_Server, "Could not set signal handler");
return 1;
}
#endif
@@ -164,7 +160,7 @@ int main(int argc, char** argv) {
if (Config->LoginCount == 0) {
if (Config->LoginHost.length()) {
loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str());
_log(WORLD__INIT, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort);
Log.Out(Logs::General, Logs::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort);
}
} else {
LinkedList<LoginConfig*> loginlist=Config->loginlist;
@@ -172,23 +168,28 @@ int main(int argc, char** argv) {
iterator.Reset();
while(iterator.MoreElements()) {
loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str());
_log(WORLD__INIT, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort);
Log.Out(Logs::General, Logs::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort);
iterator.Advance();
}
}
_log(WORLD__INIT, "Connecting to MySQL...");
Log.Out(Logs::General, Logs::World_Server, "Connecting to MySQL...");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort)) {
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
Log.Out(Logs::General, Logs::World_Server, "Cannot continue without a database connection.");
return 1;
}
guild_mgr.SetDatabase(&database);
/* Register Log System and Settings */
database.LoadLogSettings(Log.log_settings);
Log.StartFileLogs();
bool ignore_db = false;
if (argc >= 2) {
char tmp[2];
if (strcasecmp(argv[1], "help") == 0 || strcasecmp(argv[1], "?") == 0 || strcasecmp(argv[1], "/?") == 0 || strcasecmp(argv[1], "-?") == 0 || strcasecmp(argv[1], "-h") == 0 || strcasecmp(argv[1], "-help") == 0) {
@@ -273,6 +274,9 @@ int main(int argc, char** argv) {
std::cout << "Usage: world startzone zoneshortname" << std::endl;
return 0;
}
else if(strcasecmp(argv[1], "ignore_db") == 0) {
ignore_db = true;
}
else {
std::cerr << "Error, unknown command line option" << std::endl;
return 1;
@@ -280,56 +284,58 @@ int main(int argc, char** argv) {
}
if(Config->WorldHTTPEnabled) {
_log(WORLD__INIT, "Starting HTTP world service...");
Log.Out(Logs::General, Logs::World_Server, "Starting HTTP world service...");
http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str());
} else {
_log(WORLD__INIT, "HTTP world service disabled.");
Log.Out(Logs::General, Logs::World_Server, "HTTP world service disabled.");
}
_log(WORLD__INIT, "Checking Database Conversions..");
database.CheckDatabaseConversions();
_log(WORLD__INIT, "Loading variables..");
if(!ignore_db) {
Log.Out(Logs::General, Logs::World_Server, "Checking Database Conversions..");
database.CheckDatabaseConversions();
}
Log.Out(Logs::General, Logs::World_Server, "Loading variables..");
database.LoadVariables();
_log(WORLD__INIT, "Loading zones..");
Log.Out(Logs::General, Logs::World_Server, "Loading zones..");
database.LoadZoneNames();
_log(WORLD__INIT, "Clearing groups..");
Log.Out(Logs::General, Logs::World_Server, "Clearing groups..");
database.ClearGroup();
_log(WORLD__INIT, "Clearing raids..");
Log.Out(Logs::General, Logs::World_Server, "Clearing raids..");
database.ClearRaid();
database.ClearRaidDetails();
database.ClearRaidLeader();
_log(WORLD__INIT, "Loading items..");
Log.Out(Logs::General, Logs::World_Server, "Loading items..");
if (!database.LoadItems())
_log(WORLD__INIT_ERR, "Error: Could not load item data. But ignoring");
_log(WORLD__INIT, "Loading skill caps..");
Log.Out(Logs::General, Logs::World_Server, "Error: Could not load item data. But ignoring");
Log.Out(Logs::General, Logs::World_Server, "Loading skill caps..");
if (!database.LoadSkillCaps())
_log(WORLD__INIT_ERR, "Error: Could not load skill cap data. But ignoring");
_log(WORLD__INIT, "Loading guilds..");
Log.Out(Logs::General, Logs::World_Server, "Error: Could not load skill cap data. But ignoring");
Log.Out(Logs::General, Logs::World_Server, "Loading guilds..");
guild_mgr.LoadGuilds();
//rules:
{
char tmp[64];
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
_log(WORLD__INIT, "Loading rule set '%s'", tmp);
Log.Out(Logs::General, Logs::World_Server, "Loading rule set '%s'", tmp);
if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
_log(WORLD__INIT_ERR, "Failed to load ruleset '%s', falling back to defaults.", tmp);
Log.Out(Logs::General, Logs::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp);
}
} else {
if(!RuleManager::Instance()->LoadRules(&database, "default")) {
_log(WORLD__INIT, "No rule set configured, using default rules");
Log.Out(Logs::General, Logs::World_Server, "No rule set configured, using default rules");
} else {
_log(WORLD__INIT, "Loaded default rule set 'default'", tmp);
Log.Out(Logs::General, Logs::World_Server, "Loaded default rule set 'default'", tmp);
}
}
}
if(RuleB(World, ClearTempMerchantlist)){
_log(WORLD__INIT, "Clearing temporary merchant lists..");
Log.Out(Logs::General, Logs::World_Server, "Clearing temporary merchant lists..");
database.ClearMerchantTemp();
}
_log(WORLD__INIT, "Loading EQ time of day..");
Log.Out(Logs::General, Logs::World_Server, "Loading EQ time of day..");
if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str()))
_log(WORLD__INIT_ERR, "Unable to load %s", Config->EQTimeFile.c_str());
_log(WORLD__INIT, "Loading launcher list..");
Log.Out(Logs::General, Logs::World_Server, "Unable to load %s", Config->EQTimeFile.c_str());
Log.Out(Logs::General, Logs::World_Server, "Loading launcher list..");
launcher_list.LoadList();
char tmp[20];
@@ -338,45 +344,45 @@ int main(int argc, char** argv) {
if ((strcasecmp(tmp, "1") == 0)) {
holdzones = true;
}
_log(WORLD__INIT, "Reboot zone modes %s",holdzones ? "ON" : "OFF");
Log.Out(Logs::General, Logs::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF");
_log(WORLD__INIT, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses());
Log.Out(Logs::General, Logs::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses());
_log(WORLD__INIT, "Loading adventures...");
Log.Out(Logs::General, Logs::World_Server, "Loading adventures...");
if(!adventure_manager.LoadAdventureTemplates())
{
_log(WORLD__INIT_ERR, "Unable to load adventure templates.");
Log.Out(Logs::General, Logs::World_Server, "Unable to load adventure templates.");
}
if(!adventure_manager.LoadAdventureEntries())
{
_log(WORLD__INIT_ERR, "Unable to load adventure templates.");
Log.Out(Logs::General, Logs::World_Server, "Unable to load adventure templates.");
}
adventure_manager.Load();
adventure_manager.LoadLeaderboardInfo();
_log(WORLD__INIT, "Purging expired instances");
Log.Out(Logs::General, Logs::World_Server, "Purging expired instances");
database.PurgeExpiredInstances();
Timer PurgeInstanceTimer(450000);
PurgeInstanceTimer.Start(450000);
_log(WORLD__INIT, "Loading char create info...");
Log.Out(Logs::General, Logs::World_Server, "Loading char create info...");
database.LoadCharacterCreateAllocations();
database.LoadCharacterCreateCombos();
char errbuf[TCPConnection_ErrorBufferSize];
if (tcps.Open(Config->WorldTCPPort, errbuf)) {
_log(WORLD__INIT,"Zone (TCP) listener started.");
Log.Out(Logs::General, Logs::World_Server,"Zone (TCP) listener started.");
} else {
_log(WORLD__INIT_ERR,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort);
_log(WORLD__INIT_ERR," %s",errbuf);
Log.Out(Logs::General, Logs::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort);
Log.Out(Logs::General, Logs::World_Server," %s",errbuf);
return 1;
}
if (eqsf.Open()) {
_log(WORLD__INIT,"Client (UDP) listener started.");
Log.Out(Logs::General, Logs::World_Server,"Client (UDP) listener started.");
} else {
_log(WORLD__INIT_ERR,"Failed to start client (UDP) listener (port 9000)");
Log.Out(Logs::General, Logs::World_Server,"Failed to start client (UDP) listener (port 9000)");
return 1;
}
@@ -390,7 +396,7 @@ int main(int argc, char** argv) {
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
InterserverTimer.Trigger();
uint8 ReconnectCounter = 100;
EQStream* eqs;
std::shared_ptr<EQStream> eqs;
EmuTCPConnection* tcpc;
EQStreamInterface *eqsi;
@@ -404,10 +410,12 @@ int main(int argc, char** argv) {
//structures and opcodes for that patch.
struct in_addr in;
in.s_addr = eqs->GetRemoteIP();
_log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort()));
Log.Out(Logs::General, Logs::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort()));
stream_identifier.AddStream(eqs); //takes the stream
}
eqs = nullptr;
//give the stream identifier a chance to do its work....
stream_identifier.Process();
@@ -417,20 +425,20 @@ int main(int argc, char** argv) {
struct in_addr in;
in.s_addr = eqsi->GetRemoteIP();
if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs.
_log(WORLD__CLIENT, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
Log.Out(Logs::General, Logs::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table.
_log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
Client* client = new Client(eqsi);
Log.Out(Logs::General, Logs::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
auto client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
} else {
_log(WORLD__CLIENT, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
Log.Out(Logs::General, Logs::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream.
}
}
if (!RuleB(World, UseBannedIPsTable)){
_log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Client* client = new Client(eqsi);
Log.Out(Logs::General, Logs::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
auto client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
}
@@ -441,7 +449,7 @@ int main(int argc, char** argv) {
while ((tcpc = tcps.NewQueuePop())) {
struct in_addr in;
in.s_addr = tcpc->GetrIP();
_log(WORLD__ZONE, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort());
Log.Out(Logs::General, Logs::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort());
console_list.Add(new Console(tcpc));
}
@@ -452,17 +460,11 @@ int main(int argc, char** argv) {
//check for timeouts in other threads
timeout_manager.CheckTimeouts();
loginserverlist.Process();
console_list.Process();
zoneserver_list.Process();
launcher_list.Process();
UCSLink.Process();
QSLink.Process();
WILink.Process();
@@ -494,26 +496,26 @@ int main(int argc, char** argv) {
}
Sleep(20);
}
_log(WORLD__SHUTDOWN,"World main loop completed.");
_log(WORLD__SHUTDOWN,"Shutting down console connections (if any).");
Log.Out(Logs::General, Logs::World_Server, "World main loop completed.");
Log.Out(Logs::General, Logs::World_Server, "Shutting down console connections (if any).");
console_list.KillAll();
_log(WORLD__SHUTDOWN,"Shutting down zone connections (if any).");
Log.Out(Logs::General, Logs::World_Server, "Shutting down zone connections (if any).");
zoneserver_list.KillAll();
_log(WORLD__SHUTDOWN,"Zone (TCP) listener stopped.");
Log.Out(Logs::General, Logs::World_Server, "Zone (TCP) listener stopped.");
tcps.Close();
_log(WORLD__SHUTDOWN,"Client (UDP) listener stopped.");
Log.Out(Logs::General, Logs::World_Server, "Client (UDP) listener stopped.");
eqsf.Close();
_log(WORLD__SHUTDOWN,"Signaling HTTP service to stop...");
Log.Out(Logs::General, Logs::World_Server, "Signaling HTTP service to stop...");
http_server.Stop();
Log.CloseFileLogs();
CheckEQEMuErrorAndPause();
return 0;
}
void CatchSignal(int sig_num) {
_log(WORLD__SHUTDOWN,"Caught signal %d",sig_num);
Log.Out(Logs::General, Logs::World_Server,"Caught signal %d",sig_num);
if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false)
_log(WORLD__SHUTDOWN,"Failed to save time file.");
Log.Out(Logs::General, Logs::World_Server,"Failed to save time file.");
RunLoops = false;
}
+1 -1
View File
@@ -28,7 +28,7 @@
typedef const char Const_char;
#ifdef EMBPERL
#include "../common/debug.h"
#include "../common/global_define.h"
#include "eqw_parser.h"
#include "eql_config.h"
+1 -1
View File
@@ -28,7 +28,7 @@
typedef const char Const_char;
#ifdef EMBPERL
#include "../common/debug.h"
#include "../common/global_define.h"
#include "eqw_parser.h"
#include "eqw.h"
+1 -1
View File
@@ -28,7 +28,7 @@
typedef const char Const_char;
#ifdef EMBPERL
#include "../common/debug.h"
#include "../common/global_define.h"
#include "eqw_parser.h"
#include "http_request.h"
+12 -11
View File
@@ -1,10 +1,11 @@
#include "../common/debug.h"
#include "../common/global_define.h"
#include "../common/eqemu_logsys.h"
#include "queryserv.h"
#include "world_config.h"
#include "clientlist.h"
#include "zonelist.h"
#include "../common/logsys.h"
#include "../common/logtypes.h"
#include "../common/md5.h"
#include "../common/emu_tcp_connection.h"
#include "../common/packet_dump.h"
@@ -22,7 +23,7 @@ void QueryServConnection::SetConnection(EmuTCPConnection *inStream)
{
if(Stream)
{
_log(QUERYSERV__ERROR, "Incoming QueryServ Connection while we were already connected to a QueryServ.");
Log.Out(Logs::Detail, Logs::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ.");
Stream->Disconnect();
}
@@ -56,8 +57,8 @@ bool QueryServConnection::Process()
{
struct in_addr in;
in.s_addr = GetIP();
_log(QUERYSERV__ERROR, "QueryServ authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
Log.Out(Logs::Detail, Logs::QS_Server, "QueryServ authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
Disconnect();
@@ -68,8 +69,8 @@ bool QueryServConnection::Process()
{
struct in_addr in;
in.s_addr = GetIP();
_log(QUERYSERV__ERROR, "QueryServ authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
Log.Out(Logs::Detail, Logs::QS_Server, "QueryServ authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
Disconnect();
@@ -78,7 +79,7 @@ bool QueryServConnection::Process()
}
else
{
_log(QUERYSERV__ERROR,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
Log.Out(Logs::Detail, Logs::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
authenticated = true;
}
delete pack;
@@ -96,7 +97,7 @@ bool QueryServConnection::Process()
}
case ServerOP_ZAAuth:
{
_log(QUERYSERV__ERROR, "Got authentication from QueryServ when they are already authenticated.");
Log.Out(Logs::Detail, Logs::QS_Server, "Got authentication from QueryServ when they are already authenticated.");
break;
}
case ServerOP_QueryServGeneric:
@@ -113,7 +114,7 @@ bool QueryServConnection::Process()
}
default:
{
_log(QUERYSERV__ERROR, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size);
Log.Out(Logs::Detail, Logs::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
+13 -12
View File
@@ -1,8 +1,9 @@
#include "../common/debug.h"
#include "../common/global_define.h"
#include "../common/eqemu_logsys.h"
#include "ucs.h"
#include "world_config.h"
#include "../common/logsys.h"
#include "../common/logtypes.h"
#include "../common/md5.h"
#include "../common/emu_tcp_connection.h"
#include "../common/packet_dump.h"
@@ -17,7 +18,7 @@ void UCSConnection::SetConnection(EmuTCPConnection *inStream)
{
if(Stream)
{
_log(UCS__ERROR, "Incoming UCS Connection while we were already connected to a UCS.");
Log.Out(Logs::Detail, Logs::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS.");
Stream->Disconnect();
}
@@ -51,8 +52,8 @@ bool UCSConnection::Process()
{
struct in_addr in;
in.s_addr = GetIP();
_log(UCS__ERROR, "UCS authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
Log.Out(Logs::Detail, Logs::UCS_Server, "UCS authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
Disconnect();
@@ -63,8 +64,8 @@ bool UCSConnection::Process()
{
struct in_addr in;
in.s_addr = GetIP();
_log(UCS__ERROR, "UCS authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
Log.Out(Logs::Detail, Logs::UCS_Server, "UCS authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
Disconnect();
@@ -73,7 +74,7 @@ bool UCSConnection::Process()
}
else
{
_log(UCS__ERROR,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
Log.Out(Logs::Detail, Logs::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
authenticated = true;
}
delete pack;
@@ -91,12 +92,12 @@ bool UCSConnection::Process()
}
case ServerOP_ZAAuth:
{
_log(UCS__ERROR, "Got authentication from UCS when they are already authenticated.");
Log.Out(Logs::Detail, Logs::UCS_Server, "Got authentication from UCS when they are already authenticated.");
break;
}
default:
{
_log(UCS__ERROR, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size);
Log.Out(Logs::Detail, Logs::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
@@ -117,7 +118,7 @@ bool UCSConnection::SendPacket(ServerPacket* pack)
void UCSConnection::SendMessage(const char *From, const char *Message)
{
ServerPacket* pack = new ServerPacket(ServerOP_UCSMessage, strlen(From) + strlen(Message) + 2);
auto pack = new ServerPacket(ServerOP_UCSMessage, strlen(From) + strlen(Message) + 2);
char *Buffer = (char *)pack->pBuffer;
+19 -17
View File
@@ -15,7 +15,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/eqemu_logsys.h"
#include "../common/global_define.h"
#include "wguild_mgr.h"
#include "../common/servertalk.h"
#include "clientlist.h"
@@ -32,8 +34,8 @@ WorldGuildManager guild_mgr;
void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) {
_log(GUILDS__REFRESH, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation);
ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct));
Log.Out(Logs::Detail, Logs::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation);
auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct));
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
s->guild_id = guild_id;
s->name_change = name;
@@ -45,8 +47,8 @@ void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd,
}
void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) {
_log(GUILDS__REFRESH, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id);
ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct));
Log.Out(Logs::Detail, Logs::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id);
auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct));
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
s->guild_id = guild_id;
s->old_guild_id = old_guild_id;
@@ -56,8 +58,8 @@ void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, ui
}
void WorldGuildManager::SendGuildDelete(uint32 guild_id) {
_log(GUILDS__REFRESH, "Broadcasting guild delete for guild %d to world", guild_id);
ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct));
Log.Out(Logs::Detail, Logs::Guilds, "Broadcasting guild delete for guild %d to world", guild_id);
auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct));
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
s->guild_id = guild_id;
zoneserver_list.SendPacket(pack);
@@ -69,18 +71,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
case ServerOP_RefreshGuild: {
if(pack->size != sizeof(ServerGuildRefresh_Struct)) {
_log(GUILDS__ERROR, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct));
Log.Out(Logs::Detail, Logs::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct));
return;
}
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
_log(GUILDS__REFRESH, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
Log.Out(Logs::Detail, Logs::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
//broadcast this packet to all zones.
zoneserver_list.SendPacket(pack);
//preform a local refresh.
if(!RefreshGuild(s->guild_id)) {
_log(GUILDS__ERROR, "Unable to preform local refresh on guild %d", s->guild_id);
Log.Out(Logs::Detail, Logs::Guilds, "Unable to preform local refresh on guild %d", s->guild_id);
//can we do anything?
}
@@ -89,11 +91,11 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
case ServerOP_GuildCharRefresh: {
if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) {
_log(GUILDS__ERROR, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct));
Log.Out(Logs::Detail, Logs::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct));
return;
}
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
_log(GUILDS__REFRESH, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id);
Log.Out(Logs::Detail, Logs::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id);
//preform the local update
client_list.UpdateClientGuild(s->char_id, s->guild_id);
@@ -108,18 +110,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
case ServerOP_DeleteGuild: {
if(pack->size != sizeof(ServerGuildID_Struct)) {
_log(GUILDS__ERROR, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct));
Log.Out(Logs::Detail, Logs::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct));
return;
}
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
_log(GUILDS__REFRESH, "Received and broadcasting guild delete for guild %d", s->guild_id);
Log.Out(Logs::Detail, Logs::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id);
//broadcast this packet to all zones.
zoneserver_list.SendPacket(pack);
//preform a local refresh.
if(!LocalDeleteGuild(s->guild_id)) {
_log(GUILDS__ERROR, "Unable to preform local delete on guild %d", s->guild_id);
Log.Out(Logs::Detail, Logs::Guilds, "Unable to preform local delete on guild %d", s->guild_id);
//can we do anything?
}
@@ -129,7 +131,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
case ServerOP_GuildMemberUpdate: {
if(pack->size != sizeof(ServerGuildMemberUpdate_Struct))
{
_log(GUILDS__ERROR, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct));
Log.Out(Logs::Detail, Logs::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct));
return;
}
@@ -139,7 +141,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
}
default:
_log(GUILDS__ERROR, "Unknown packet 0x%x received from zone??", pack->opcode);
Log.Out(Logs::Detail, Logs::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode);
break;
}
}
+1 -1
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "world_config.h"
WorldConfig *WorldConfig::_world_config = nullptr;
-59
View File
@@ -1,59 +0,0 @@
#include "../common/debug.h"
#include "../common/logsys.h"
#include "../common/string_util.h"
#include "zoneserver.h"
#include "client.h"
#include <stdarg.h>
#include <stdio.h>
void log_message_clientVA(LogType type, Client *who, const char *fmt, va_list args) {
std::string prefix_buffer = StringFormat("[%s] %s: ", log_type_info[type].name, who->GetAccountName());
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer.c_str(), fmt, args);
}
void log_message_client(LogType type, Client *who, const char *fmt, ...) {
va_list args;
va_start(args, fmt);
log_message_clientVA(type, who, fmt, args);
va_end(args);
}
void log_message_zoneVA(LogType type, ZoneServer *who, const char *fmt, va_list args) {
std::string prefix_buffer, zone_tag;
const char *zone_name=who->GetZoneName();
if (zone_name == nullptr)
zone_tag = StringFormat("[%d]", who->GetID());
else
zone_tag = StringFormat("[%d] [%s]",who->GetID(),zone_name);
prefix_buffer = StringFormat("[%s] %s ", log_type_info[type].name, zone_tag.c_str());
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer.c_str(), fmt, args);
}
void log_message_zone(LogType type, ZoneServer *who, const char *fmt, ...) {
va_list args;
va_start(args, fmt);
log_message_zoneVA(type, who, fmt, args);
va_end(args);
}
+117 -157
View File
@@ -32,7 +32,7 @@ extern std::vector<RaceClassAllocation> character_create_allocations;
extern std::vector<RaceClassCombos> character_create_race_class_combos;
// solar: the current stuff is at the bottom of this function
// the current stuff is at the bottom of this function
void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion) {
Inventory *inv;
uint8 has_home = 0;
@@ -282,120 +282,37 @@ int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) {
return zone_id;
}
bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc)
bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc,bool isTitanium)
{
// SoF doesn't send the player_choice field in character creation, it now sends the real zoneID instead.
//
// For SoF, search for an entry in start_zones with a matching zone_id, class, race and deity.
//
// For now, if no row matching row is found, send them to Crescent Reach, as that is probably the most likely
// reason for no match being found.
//
if(!in_pp || !in_cc)
return false;
in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0;
in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0;
std::string query = StringFormat("SELECT x, y, z, heading, zone_id, bind_id "
"FROM start_zones WHERE player_choice = % i "
"AND player_class = %i AND player_deity = %i "
"AND player_race = %i",
in_cc->start_zone, in_cc->class_, in_cc->deity,
in_cc->race);
// see if we have an entry for start_zone. We can support both titanium & SOF+ by having two entries per class/race/deity combo with different zone_ids
std::string query = StringFormat("SELECT x, y, z, heading, start_zone, bind_id FROM start_zones WHERE zone_id = %i "
"AND player_class = %i AND player_deity = %i AND player_race = %i",
in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race);
auto results = QueryDatabase(query);
if(!results.Success()) {
LogFile->write(EQEMuLog::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str());
return false;
}
LogFile->write(EQEMuLog::Status, "Start zone query: %s\n", query.c_str());
Log.Out(Logs::General, Logs::Status, "SoF Start zone query: %s\n", query.c_str());
if (results.RowCount() == 0) {
printf("No start_zones entry in database, using defaults\n");
switch(in_cc->start_zone)
{
case 0:
{
in_pp->zone_id = 24; // erudnext
in_pp->binds[0].zoneId = 38; // tox
break;
}
case 1:
{
in_pp->zone_id = 2; // qeynos2
in_pp->binds[0].zoneId = 2; // qeynos2
break;
}
case 2:
{
in_pp->zone_id = 29; // halas
in_pp->binds[0].zoneId = 30; // everfrost
break;
}
case 3:
{
in_pp->zone_id = 19; // rivervale
in_pp->binds[0].zoneId = 20; // kithicor
break;
}
case 4:
{
in_pp->zone_id = 9; // freportw
in_pp->binds[0].zoneId = 9; // freportw
break;
}
case 5:
{
in_pp->zone_id = 40; // neriaka
in_pp->binds[0].zoneId = 25; // nektulos
break;
}
case 6:
{
in_pp->zone_id = 52; // gukta
in_pp->binds[0].zoneId = 46; // innothule
break;
}
case 7:
{
in_pp->zone_id = 49; // oggok
in_pp->binds[0].zoneId = 47; // feerrott
break;
}
case 8:
{
in_pp->zone_id = 60; // kaladima
in_pp->binds[0].zoneId = 68; // butcher
break;
}
case 9:
{
in_pp->zone_id = 54; // gfaydark
in_pp->binds[0].zoneId = 54; // gfaydark
break;
}
case 10:
{
in_pp->zone_id = 61; // felwithea
in_pp->binds[0].zoneId = 54; // gfaydark
break;
}
case 11:
{
in_pp->zone_id = 55; // akanon
in_pp->binds[0].zoneId = 56; // steamfont
break;
}
case 12:
{
in_pp->zone_id = 82; // cabwest
in_pp->binds[0].zoneId = 78; // fieldofbone
break;
}
case 13:
{
in_pp->zone_id = 155; // sharvahl
in_pp->binds[0].zoneId = 155; // sharvahl
break;
}
}
isTitanium ? SetTitaniumDefaultStartZone(in_pp, in_cc) : SetSoFDefaultStartZone(in_pp, in_cc);
}
else {
LogFile->write(EQEMuLog::Status, "Found starting location in start_zones");
Log.Out(Logs::General, Logs::Status, "Found starting location in start_zones");
auto row = results.begin();
in_pp->x = atof(row[0]);
in_pp->y = atof(row[1]);
@@ -413,72 +330,115 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
return true;
}
bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc)
{
// SoF doesn't send the player_choice field in character creation, it now sends the real zoneID instead.
//
// For SoF, search for an entry in start_zones with a matching zone_id, class, race and deity.
//
// For now, if no row matching row is found, send them to Crescent Reach, as that is probably the most likely
// reason for no match being found.
//
if(!in_pp || !in_cc)
return false;
in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0;
in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0;
std::string query = StringFormat("SELECT x, y, z, heading, bind_id FROM start_zones WHERE zone_id = %i "
"AND player_class = %i AND player_deity = %i AND player_race = %i",
in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race);
auto results = QueryDatabase(query);
if(!results.Success()) {
LogFile->write(EQEMuLog::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str());
return false;
}
LogFile->write(EQEMuLog::Status, "SoF Start zone query: %s\n", query.c_str());
if (results.RowCount() == 0) {
printf("No start_zones entry in database, using defaults\n");
if(in_cc->start_zone == RuleI(World, TutorialZoneID))
in_pp->zone_id = in_cc->start_zone;
else {
in_pp->x = in_pp->binds[0].x = -51;
in_pp->y = in_pp->binds[0].y = -20;
in_pp->z = in_pp->binds[0].z = 0.79;
in_pp->zone_id = in_pp->binds[0].zoneId = 394; // Crescent Reach.
}
}
else {
LogFile->write(EQEMuLog::Status, "Found starting location in start_zones");
auto row = results.begin();
in_pp->x = atof(row[0]);
in_pp->y = atof(row[1]);
in_pp->z = atof(row[2]);
in_pp->heading = atof(row[3]);
void WorldDatabase::SetSoFDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc){
if (in_cc->start_zone == RuleI(World, TutorialZoneID)) {
in_pp->zone_id = in_cc->start_zone;
in_pp->binds[0].zoneId = atoi(row[4]);
}
else {
in_pp->x = in_pp->binds[0].x = -51;
in_pp->y = in_pp->binds[0].y = -20;
in_pp->z = in_pp->binds[0].z = 0.79;
in_pp->zone_id = in_pp->binds[0].zoneId = 394; // Crescent Reach.
}
if(in_pp->x == 0 && in_pp->y == 0 && in_pp->z == 0)
database.GetSafePoints(in_pp->zone_id, 0, &in_pp->x, &in_pp->y, &in_pp->z);
if(in_pp->binds[0].x == 0 && in_pp->binds[0].y == 0 && in_pp->binds[0].z == 0)
database.GetSafePoints(in_pp->binds[0].zoneId, 0, &in_pp->binds[0].x, &in_pp->binds[0].y, &in_pp->binds[0].z);
return true;
}
void WorldDatabase::SetTitaniumDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc)
{
switch (in_cc->start_zone)
{
case 0:
{
in_pp->zone_id = 24; // erudnext
in_pp->binds[0].zoneId = 38; // tox
break;
}
case 1:
{
in_pp->zone_id = 2; // qeynos2
in_pp->binds[0].zoneId = 2; // qeynos2
break;
}
case 2:
{
in_pp->zone_id = 29; // halas
in_pp->binds[0].zoneId = 30; // everfrost
break;
}
case 3:
{
in_pp->zone_id = 19; // rivervale
in_pp->binds[0].zoneId = 20; // kithicor
break;
}
case 4:
{
in_pp->zone_id = 9; // freportw
in_pp->binds[0].zoneId = 9; // freportw
break;
}
case 5:
{
in_pp->zone_id = 40; // neriaka
in_pp->binds[0].zoneId = 25; // nektulos
break;
}
case 6:
{
in_pp->zone_id = 52; // gukta
in_pp->binds[0].zoneId = 46; // innothule
break;
}
case 7:
{
in_pp->zone_id = 49; // oggok
in_pp->binds[0].zoneId = 47; // feerrott
break;
}
case 8:
{
in_pp->zone_id = 60; // kaladima
in_pp->binds[0].zoneId = 68; // butcher
break;
}
case 9:
{
in_pp->zone_id = 54; // gfaydark
in_pp->binds[0].zoneId = 54; // gfaydark
break;
}
case 10:
{
in_pp->zone_id = 61; // felwithea
in_pp->binds[0].zoneId = 54; // gfaydark
break;
}
case 11:
{
in_pp->zone_id = 55; // akanon
in_pp->binds[0].zoneId = 56; // steamfont
break;
}
case 12:
{
in_pp->zone_id = 82; // cabwest
in_pp->binds[0].zoneId = 78; // fieldofbone
break;
}
case 13:
{
in_pp->zone_id = 155; // sharvahl
in_pp->binds[0].zoneId = 155; // sharvahl
break;
}
}
}
void WorldDatabase::GetLauncherList(std::vector<std::string> &rl) {
rl.clear();
const std::string query = "SELECT name FROM launcher";
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str());
Log.Out(Logs::General, Logs::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str());
return;
}
@@ -500,7 +460,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) {
MailKeyString, CharID);
auto results = QueryDatabase(query);
if (!results.Success())
LogFile->write(EQEMuLog::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str());
Log.Out(Logs::General, Logs::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str());
}
@@ -509,7 +469,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str());
Log.Out(Logs::General, Logs::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str());
return false;
}
+4 -5
View File
@@ -28,9 +28,7 @@ struct CharacterSelect_Struct;
class WorldDatabase : public SharedDatabase {
public:
bool GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc);
bool GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc);
bool GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc, bool isTitanium);
void GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*, uint32 ClientVersion);
int MoveCharacterToBind(int CharID, uint8 bindnum = 0);
@@ -40,8 +38,9 @@ public:
bool LoadCharacterCreateAllocations();
bool LoadCharacterCreateCombos();
protected:
private:
void SetTitaniumDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc);
void SetSoFDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc);
};
extern WorldDatabase database;
+22 -22
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "zonelist.h"
#include "zoneserver.h"
#include "world_tcp_connection.h"
@@ -79,8 +79,8 @@ void ZSList::KillAll() {
void ZSList::Process() {
if(shutdowntimer && shutdowntimer->Check()){
_log(WORLD__ZONELIST, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)");
ServerPacket* pack2 = new ServerPacket;
Log.Out(Logs::Detail, Logs::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)");
auto pack2 = new ServerPacket;
pack2->opcode = ServerOP_ShutdownAll;
pack2->size=0;
SendPacket(pack2);
@@ -99,10 +99,10 @@ void ZSList::Process() {
ZoneServer* zs = iterator.GetData();
struct in_addr in;
in.s_addr = zs->GetIP();
_log(WORLD__ZONELIST,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort());
Log.Out(Logs::Detail, Logs::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort());
zs->LSShutDownUpdate(zs->GetZoneID());
if (holdzones){
_log(WORLD__ZONELIST,"Hold Zones mode is ON - rebooting lost zone");
Log.Out(Logs::Detail, Logs::World_Server,"Hold Zones mode is ON - rebooting lost zone");
if(!zs->IsStaticZone())
RebootZone(inet_ntoa(in),zs->GetCPort(),zs->GetCAddress(),zs->GetID());
else
@@ -246,16 +246,16 @@ ZoneServer* ZSList::FindByInstanceID(uint32 InstanceID)
}
bool ZSList::SetLockedZone(uint16 iZoneID, bool iLock) {
for (int i=0; i<MaxLockedZones; i++) {
for (auto &zone : pLockedZones) {
if (iLock) {
if (pLockedZones[i] == 0) {
pLockedZones[i] = iZoneID;
if (zone == 0) {
zone = iZoneID;
return true;
}
}
else {
if (pLockedZones[i] == iZoneID) {
pLockedZones[i] = 0;
if (zone == iZoneID) {
zone = 0;
return true;
}
}
@@ -264,8 +264,8 @@ bool ZSList::SetLockedZone(uint16 iZoneID, bool iLock) {
}
bool ZSList::IsZoneLocked(uint16 iZoneID) {
for (int i=0; i<MaxLockedZones; i++) {
if (pLockedZones[i] == iZoneID)
for (auto &zone : pLockedZones) {
if (zone == iZoneID)
return true;
}
return false;
@@ -273,9 +273,9 @@ bool ZSList::IsZoneLocked(uint16 iZoneID) {
void ZSList::ListLockedZones(const char* to, WorldTCPConnection* connection) {
int x = 0;
for (int i=0; i<MaxLockedZones; i++) {
if (pLockedZones[i]) {
connection->SendEmoteMessageRaw(to, 0, 0, 0, database.GetZoneName(pLockedZones[i], true));
for (auto &zone : pLockedZones) {
if (zone) {
connection->SendEmoteMessageRaw(to, 0, 0, 0, database.GetZoneName(zone, true));
x++;
}
}
@@ -399,7 +399,7 @@ void ZSList::SendChannelMessage(const char* from, const char* to, uint8 chan_num
void ZSList::SendChannelMessageRaw(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message) {
if (!message)
return;
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_ChannelMessage;
pack->size = sizeof(ServerChannelMessage_Struct)+strlen(message)+1;
@@ -453,7 +453,7 @@ void ZSList::SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_mins
void ZSList::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message) {
if (!message)
return;
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_EmoteMessage;
pack->size = sizeof(ServerEmoteMessage_Struct)+strlen(message)+1;
@@ -500,7 +500,7 @@ void ZSList::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_m
}
void ZSList::SendTimeSync() {
ServerPacket* pack = new ServerPacket(ServerOP_SyncWorldTime, sizeof(eqTimeOfDay));
auto pack = new ServerPacket(ServerOP_SyncWorldTime, sizeof(eqTimeOfDay));
eqTimeOfDay* tod = (eqTimeOfDay*) pack->pBuffer;
tod->start_eqtime=worldclock.getStartEQTime();
tod->start_realtime=worldclock.getStartRealTime();
@@ -554,7 +554,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip
}
if (x == 0)
return;
ZoneServer** tmp = new ZoneServer*[x];
auto tmp = new ZoneServer *[x];
uint32 y = 0;
iterator.Reset();
while(iterator.MoreElements()) {
@@ -569,14 +569,14 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip
}
uint32 z = emu_random.Int(0, y-1);
ServerPacket* pack = new ServerPacket(ServerOP_ZoneReboot, sizeof(ServerZoneReboot_Struct));
auto pack = new ServerPacket(ServerOP_ZoneReboot, sizeof(ServerZoneReboot_Struct));
ServerZoneReboot_Struct* s = (ServerZoneReboot_Struct*) pack->pBuffer;
// strcpy(s->ip1,ip1);
strcpy(s->ip2,ip2);
s->port = port;
s->zoneid = zoneid;
if(zoneid != 0)
_log(WORLD__ZONELIST,"Rebooting static zone with the ID of: %i",zoneid);
Log.Out(Logs::Detail, Logs::World_Server,"Rebooting static zone with the ID of: %i",zoneid);
tmp[z]->SendPacket(pack);
delete pack;
safe_delete_array(tmp);
@@ -734,7 +734,7 @@ void ZSList::WorldShutDown(uint32 time, uint32 interval)
}
else {
SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down, everyone log out now.");
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_ShutdownAll;
pack->size=0;
SendPacket(pack);
+65 -62
View File
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/global_define.h"
#include "zoneserver.h"
#include "clientlist.h"
#include "login_server.h"
@@ -79,7 +79,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
char* longname;
if (iZoneID)
zlog(WORLD__ZONE,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID,
Log.Out(Logs::Detail, Logs::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID,
iStaticZone ? " (Static)" : "");
zoneID = iZoneID;
@@ -119,7 +119,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
void ZoneServer::LSShutDownUpdate(uint32 zoneid){
if(WorldConfig::get()->UpdateStats){
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSZoneShutdown;
pack->size = sizeof(ZoneShutdown_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -136,7 +136,7 @@ void ZoneServer::LSShutDownUpdate(uint32 zoneid){
}
void ZoneServer::LSBootUpdate(uint32 zoneid, uint32 instanceid, bool startup){
if(WorldConfig::get()->UpdateStats){
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
if(startup)
pack->opcode = ServerOP_LSZoneStart;
else
@@ -157,7 +157,7 @@ void ZoneServer::LSBootUpdate(uint32 zoneid, uint32 instanceid, bool startup){
void ZoneServer::LSSleepUpdate(uint32 zoneid){
if(WorldConfig::get()->UpdateStats){
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSZoneSleep;
pack->size = sizeof(ServerLSZoneSleep_Struct);
pack->pBuffer = new uchar[pack->size];
@@ -179,7 +179,6 @@ bool ZoneServer::Process() {
}
ServerPacket *pack = 0;
while((pack = tcpc->PopPacket())) {
_hex(WORLD__ZONE_TRACE,pack->pBuffer,pack->size);
if (!authenticated) {
if (WorldConfig::get()->SharedKey.length() > 0) {
if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) {
@@ -190,8 +189,8 @@ bool ZoneServer::Process() {
else {
struct in_addr in;
in.s_addr = GetIP();
zlog(WORLD__ZONE_ERR,"Zone authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
Log.Out(Logs::Detail, Logs::World_Server,"Zone authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
Disconnect();
@@ -201,8 +200,8 @@ bool ZoneServer::Process() {
else {
struct in_addr in;
in.s_addr = GetIP();
zlog(WORLD__ZONE_ERR,"Zone authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
Log.Out(Logs::Detail, Logs::World_Server,"Zone authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
Disconnect();
@@ -211,7 +210,7 @@ bool ZoneServer::Process() {
}
else
{
_log(WORLD__ZONE,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
Log.Out(Logs::Detail, Logs::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
authenticated = true;
}
}
@@ -543,10 +542,10 @@ bool ZoneServer::Process() {
RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*) pack->pBuffer;
if (zoneserver_list.SendPacket(pack)){
zlog(WORLD__ZONE,"Sent Rez packet for %s",sRezz->rez.your_name);
Log.Out(Logs::Detail, Logs::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name);
}
else {
zlog(WORLD__ZONE,"Could not send Rez packet for %s",sRezz->rez.your_name);
Log.Out(Logs::Detail, Logs::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name);
}
break;
}
@@ -591,10 +590,10 @@ bool ZoneServer::Process() {
ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer;
sci->port = clientport;
SendPacket(&p);
zlog(WORLD__ZONE,"Auto zone port configuration. Telling zone to use port %d",clientport);
Log.Out(Logs::Detail, Logs::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport);
} else {
clientport=sci->port;
zlog(WORLD__ZONE,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport);
Log.Out(Logs::Detail, Logs::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport);
}
}
@@ -604,7 +603,7 @@ bool ZoneServer::Process() {
const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer;
launcher_name = ln->launcher_name;
launched_name = ln->zone_name;
zlog(WORLD__ZONE, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str());
Log.Out(Logs::Detail, Logs::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str());
break;
}
case ServerOP_ShutdownAll: {
@@ -668,7 +667,7 @@ bool ZoneServer::Process() {
}
case ServerOP_ZoneToZoneRequest: {
//
// solar: ZoneChange is received by the zone the player is in, then the
// ZoneChange is received by the zone the player is in, then the
// zone sends a ZTZ which ends up here. This code then find the target
// (ingress point) and boots it if needed, then sends the ZTZ to it.
// The ingress server will decide wether the player can enter, then will
@@ -687,12 +686,12 @@ bool ZoneServer::Process() {
if(WorldConfig::get()->UpdateStats)
client = client_list.FindCharacter(ztz->name);
zlog(WORLD__ZONE,"ZoneToZone request for %s current zone %d req zone %d\n",
Log.Out(Logs::Detail, Logs::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n",
ztz->name, ztz->current_zone_id, ztz->requested_zone_id);
/* This is a request from the egress zone */
if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) {
zlog(WORLD__ZONE,"Processing ZTZ for egress from zone for client %s\n", ztz->name);
Log.Out(Logs::Detail, Logs::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name);
if (ztz->admin < 80 && ztz->ignorerestrictions < 2 && zoneserver_list.IsZoneLocked(ztz->requested_zone_id)) {
ztz->response = 0;
@@ -710,20 +709,20 @@ bool ZoneServer::Process() {
/* Zone was already running*/
if(ingress_server) {
_log(WORLD__ZONE,"Found a zone already booted for %s\n", ztz->name);
Log.Out(Logs::Detail, Logs::World_Server,"Found a zone already booted for %s\n", ztz->name);
ztz->response = 1;
}
/* Boot the Zone*/
else {
int server_id;
if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){
_log(WORLD__ZONE,"Successfully booted a zone for %s\n", ztz->name);
Log.Out(Logs::Detail, Logs::World_Server,"Successfully booted a zone for %s\n", ztz->name);
// bootup successful, ready to rock
ztz->response = 1;
ingress_server = zoneserver_list.FindByID(server_id);
}
else {
_log(WORLD__ZONE_ERR,"FAILED to boot a zone for %s\n", ztz->name);
Log.Out(Logs::Detail, Logs::World_Server,"FAILED to boot a zone for %s\n", ztz->name);
// bootup failed, send back error code 0
ztz->response = 0;
}
@@ -738,7 +737,7 @@ bool ZoneServer::Process() {
/* Response from Ingress server, route back to egress */
else{
zlog(WORLD__ZONE,"Processing ZTZ for ingress to zone for client %s\n", ztz->name);
Log.Out(Logs::Detail, Logs::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name);
ZoneServer *egress_server = nullptr;
if(ztz->current_instance_id > 0) {
egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id);
@@ -756,7 +755,7 @@ bool ZoneServer::Process() {
}
case ServerOP_ClientList: {
if (pack->size != sizeof(ServerClientList_Struct)) {
zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct));
Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct));
break;
}
client_list.ClientUpdate(this, (ServerClientList_Struct*) pack->pBuffer);
@@ -765,7 +764,7 @@ bool ZoneServer::Process() {
case ServerOP_ClientListKA: {
ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*) pack->pBuffer;
if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) {
zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates)));
Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates)));
break;
}
client_list.CLEKeepAlive(sclka->numupdates, sclka->wid);
@@ -773,7 +772,7 @@ bool ZoneServer::Process() {
}
case ServerOP_Who: {
ServerWhoAll_Struct* whoall = (ServerWhoAll_Struct*) pack->pBuffer;
Who_All_Struct* whom = new Who_All_Struct;
auto whom = new Who_All_Struct;
memset(whom,0,sizeof(Who_All_Struct));
whom->gmlookup = whoall->gmlookup;
whom->lvllow = whoall->lvllow;
@@ -787,7 +786,6 @@ bool ZoneServer::Process() {
}
case ServerOP_RequestOnlineGuildMembers: {
ServerRequestOnlineGuildMembers_Struct *srogms = (ServerRequestOnlineGuildMembers_Struct*) pack->pBuffer;
zlog(GUILDS__IN_PACKETS, "ServerOP_RequestOnlineGuildMembers Recieved. FromID=%i GuildID=%i", srogms->FromID, srogms->GuildID);
client_list.SendOnlineGuildMembers(srogms->FromID, srogms->GuildID);
break;
}
@@ -796,6 +794,11 @@ bool ZoneServer::Process() {
client_list.SendClientVersionSummary(srcvss->Name);
break;
}
case ServerOP_ReloadLogs: {
zoneserver_list.SendPacket(pack);
database.LoadLogSettings(Log.log_settings);
break;
}
case ServerOP_ReloadRules: {
zoneserver_list.SendPacket(pack);
RuleManager::Instance()->LoadRules(&database, "default");
@@ -871,7 +874,7 @@ bool ZoneServer::Process() {
}
case ServerOP_GMGoto: {
if (pack->size != sizeof(ServerGMGoto_Struct)) {
zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct));
Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct));
break;
}
ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer;
@@ -891,7 +894,7 @@ bool ZoneServer::Process() {
}
case ServerOP_Lock: {
if (pack->size != sizeof(ServerLock_Struct)) {
zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct));
Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct));
break;
}
ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer;
@@ -916,7 +919,7 @@ bool ZoneServer::Process() {
}
case ServerOP_Motd: {
if (pack->size != sizeof(ServerMotd_Struct)) {
zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct));
Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct));
break;
}
ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer;
@@ -927,7 +930,7 @@ bool ZoneServer::Process() {
}
case ServerOP_Uptime: {
if (pack->size != sizeof(ServerUptime_Struct)) {
zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct));
Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct));
break;
}
ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer;
@@ -946,8 +949,8 @@ bool ZoneServer::Process() {
break;
}
case ServerOP_GetWorldTime: {
zlog(WORLD__ZONE,"Broadcasting a world time update");
ServerPacket* pack = new ServerPacket;
Log.Out(Logs::Detail, Logs::World_Server,"Broadcasting a world time update");
auto pack = new ServerPacket;
pack->opcode = ServerOP_SyncWorldTime;
pack->size = sizeof(eqTimeOfDay);
@@ -961,17 +964,17 @@ bool ZoneServer::Process() {
break;
}
case ServerOP_SetWorldTime: {
zlog(WORLD__ZONE,"Received SetWorldTime");
Log.Out(Logs::Detail, Logs::World_Server,"Received SetWorldTime");
eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer;
zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime);
zlog(WORLD__ZONE,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime);
Log.Out(Logs::Detail, Logs::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime);
zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str());
zoneserver_list.SendTimeSync();
break;
}
case ServerOP_IPLookup: {
if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) {
zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct));
Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct));
break;
}
ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*) pack->pBuffer;
@@ -983,7 +986,7 @@ bool ZoneServer::Process() {
}
case ServerOP_LockZone: {
if (pack->size < sizeof(ServerLockZone_Struct)) {
zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct));
Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct));
break;
}
ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer;
@@ -1028,10 +1031,10 @@ bool ZoneServer::Process() {
ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id);
if(zs) {
if (zs->SendPacket(pack)) {
zlog(WORLD__ZONE,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id);
Log.Out(Logs::Detail, Logs::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id);
}
else {
zlog(WORLD__ZONE_ERR,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id);
Log.Out(Logs::Detail, Logs::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id);
}
}
break;
@@ -1050,10 +1053,10 @@ bool ZoneServer::Process() {
zs = zoneserver_list.FindByInstanceID(cle->instance());
if(zs) {
if(zs->SendPacket(pack)) {
zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance());
Log.Out(Logs::Detail, Logs::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance());
}
else {
zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id);
Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id);
}
}
else
@@ -1070,10 +1073,10 @@ bool ZoneServer::Process() {
zs = zoneserver_list.FindByInstanceID(s->instance_id);
if(zs) {
if(!zs->SendPacket(pack))
zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID());
Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID());
}
else {
zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id);
Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id);
}
}
}
@@ -1082,10 +1085,10 @@ bool ZoneServer::Process() {
zs = zoneserver_list.FindByZoneID(cle->zone());
if(zs) {
if(zs->SendPacket(pack)) {
zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone());
Log.Out(Logs::Detail, Logs::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone());
}
else {
zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id);
Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id);
}
}
else {
@@ -1101,10 +1104,10 @@ bool ZoneServer::Process() {
zs = zoneserver_list.FindByZoneID(s->zone_id);
if(zs) {
if(!zs->SendPacket(pack))
zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName());
Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName());
}
else {
zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id);
Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id);
}
}
}
@@ -1122,10 +1125,10 @@ bool ZoneServer::Process() {
zs = zoneserver_list.FindByZoneID(s->zone_id);
if(zs) {
if(!zs->SendPacket(pack))
zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName());
Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName());
}
else {
zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id);
Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id);
}
}
break;
@@ -1141,10 +1144,10 @@ bool ZoneServer::Process() {
ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id);
if(zs) {
if(!zs->SendPacket(pack))
zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID());
Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID());
}
else {
zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id);
Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id);
}
}
else
@@ -1152,10 +1155,10 @@ bool ZoneServer::Process() {
ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id);
if(zs) {
if(!zs->SendPacket(pack))
zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName());
Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName());
}
else {
zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id);
Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id);
}
}
break;
@@ -1257,7 +1260,7 @@ bool ZoneServer::Process() {
case ServerOP_LSAccountUpdate:
{
zlog(WORLD__ZONE, "Received ServerOP_LSAccountUpdate packet from zone");
Log.Out(Logs::Detail, Logs::World_Server, "Received ServerOP_LSAccountUpdate packet from zone");
loginserverlist.SendAccountUpdate(pack);
break;
}
@@ -1316,7 +1319,7 @@ bool ZoneServer::Process() {
}
default:
{
zlog(WORLD__ZONE_ERR,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size);
Log.Out(Logs::Detail, Logs::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
@@ -1342,7 +1345,7 @@ void ZoneServer::SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_
void ZoneServer::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message) {
if (!message)
return;
ServerPacket* pack = new ServerPacket;
auto pack = new ServerPacket;
pack->opcode = ServerOP_EmoteMessage;
pack->size = sizeof(ServerEmoteMessage_Struct)+strlen(message)+1;
@@ -1368,7 +1371,7 @@ void ZoneServer::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16
}
void ZoneServer::SendGroupIDs() {
ServerPacket* pack = new ServerPacket(ServerOP_GroupIDReply, sizeof(ServerGroupIDReply_Struct));
auto pack = new ServerPacket(ServerOP_GroupIDReply, sizeof(ServerGroupIDReply_Struct));
ServerGroupIDReply_Struct* sgi = (ServerGroupIDReply_Struct*)pack->pBuffer;
zoneserver_list.NextGroupIDs(sgi->start, sgi->end);
SendPacket(pack);
@@ -1376,7 +1379,7 @@ void ZoneServer::SendGroupIDs() {
}
void ZoneServer::ChangeWID(uint32 iCharID, uint32 iWID) {
ServerPacket* pack = new ServerPacket(ServerOP_ChangeWID, sizeof(ServerChangeWID_Struct));
auto pack = new ServerPacket(ServerOP_ChangeWID, sizeof(ServerChangeWID_Struct));
ServerChangeWID_Struct* scw = (ServerChangeWID_Struct*) pack->pBuffer;
scw->charid = iCharID;
scw->newwid = iWID;
@@ -1390,7 +1393,7 @@ void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* a
zoneID = iZoneID;
instanceID = iInstanceID;
ServerPacket* pack = new ServerPacket(ServerOP_ZoneBootup, sizeof(ServerZoneStateChange_struct));
auto pack = new ServerPacket(ServerOP_ZoneBootup, sizeof(ServerZoneStateChange_struct));
ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer;
s->ZoneServerID = ID;
if (adminname != 0)
@@ -1408,10 +1411,10 @@ void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* a
LSBootUpdate(iZoneID, iInstanceID);
}
void ZoneServer::IncommingClient(Client* client) {
void ZoneServer::IncomingClient(Client* client) {
BootingUp = true;
ServerPacket* pack = new ServerPacket(ServerOP_ZoneIncClient, sizeof(ServerZoneIncommingClient_Struct));
ServerZoneIncommingClient_Struct* s = (ServerZoneIncommingClient_Struct*) pack->pBuffer;
auto pack = new ServerPacket(ServerOP_ZoneIncClient, sizeof(ServerZoneIncomingClient_Struct));
ServerZoneIncomingClient_Struct* s = (ServerZoneIncomingClient_Struct*) pack->pBuffer;
s->zoneid = GetZoneID();
s->instanceid = GetInstanceID();
s->wid = client->GetWID();
+1 -1
View File
@@ -40,7 +40,7 @@ public:
bool SetZone(uint32 iZoneID, uint32 iInstanceID = 0, bool iStaticZone = false);
void TriggerBootup(uint32 iZoneID = 0, uint32 iInstanceID = 0, const char* iAdminName = 0, bool iMakeStatic = false);
void Disconnect() { tcpc->Disconnect(); }
void IncommingClient(Client* client);
void IncomingClient(Client* client);
void LSBootUpdate(uint32 zoneid, uint32 iInstanceID = 0, bool startup = false);
void LSSleepUpdate(uint32 zoneid);
void LSShutDownUpdate(uint32 zoneid);