Remove trailing whitespace

This commit is contained in:
j883376
2013-05-06 13:07:41 -04:00
parent 7a93966158
commit ffcff4aea1
548 changed files with 16397 additions and 16398 deletions
+5 -5
View File
@@ -125,7 +125,7 @@ bool Adventure::Process()
{
Finished(AWS_Lose);
}
MoveCorpsesToGraveyard();
database.DeleteInstance(instance_id);
return false;
@@ -378,9 +378,9 @@ void Adventure::MoveCorpsesToGraveyard()
MYSQL_RES *result;
MYSQL_ROW row;
if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT id, charid FROM player_corpses WHERE instanceid=%d", GetInstanceID()), errbuf, &result))
if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT id, charid FROM player_corpses WHERE instanceid=%d", GetInstanceID()), errbuf, &result))
{
while((row = mysql_fetch_row(result)))
while((row = mysql_fetch_row(result)))
{
dbid_list.push_back(atoi(row[0]));
charid_list.push_back(atoi(row[1]));
@@ -400,8 +400,8 @@ void Adventure::MoveCorpsesToGraveyard()
float x = GetTemplate()->graveyard_x + MakeRandomFloat(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float y = GetTemplate()->graveyard_y + MakeRandomFloat(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float z = GetTemplate()->graveyard_z;
if(database.RunQuery(query,MakeAnyLenString(&query, "UPDATE player_corpses SET zoneid=%d, instanceid=0, x=%f, y=%f, z=%f WHERE instanceid=%d",
GetTemplate()->graveyard_zone_id, x, y, z, GetInstanceID()), errbuf))
if(database.RunQuery(query,MakeAnyLenString(&query, "UPDATE player_corpses SET zoneid=%d, instanceid=0, x=%f, y=%f, z=%f WHERE instanceid=%d",
GetTemplate()->graveyard_zone_id, x, y, z, GetInstanceID()), errbuf))
{
safe_delete_array(query);
}
+30 -30
View File
@@ -67,7 +67,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
return;
}
/**
/**
* This block checks to see if we actually have any adventures for the requested theme.
*/
map<uint32, list<AdventureTemplate*> >::iterator adv_list_iter = adventure_entries.find(sar->template_id);
@@ -135,7 +135,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
adv.version = finished_adventures[i]->GetTemplate()->zone_version;
excluded_zones.push_back(adv);
}
if(!IsInExcludedZoneInList(excluded_zone_ins, finished_adventures[i]->GetTemplate()->zone_in_zone_id,
if(!IsInExcludedZoneInList(excluded_zone_ins, finished_adventures[i]->GetTemplate()->zone_in_zone_id,
finished_adventures[i]->GetTemplate()->zone_in_object_id))
{
AdventureZoneIn adv;
@@ -253,7 +253,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
strcpy(deny->leader, sar->leader);
stringstream ss(stringstream::out | stringstream::in);
ss << "The maximum level range for this adventure is " << RuleI(Adventure, MaxLevelRange);
ss << "The maximum level range for this adventure is " << RuleI(Adventure, MaxLevelRange);
ss << " but the level range calculated was " << (max_level - min_level) << ".";
strcpy(deny->reason, ss.str().c_str());
pack->Deflate();
@@ -396,7 +396,7 @@ void AdventureManager::TryAdventureCreate(const char *data)
delete adv;
return;
}
adv->AddPlayer((data + sizeof(ServerAdventureRequestCreate_Struct) + (64 * i)));
}
@@ -409,7 +409,7 @@ 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)
ServerPacket *pack = new ServerPacket(ServerOP_AdventureData, sizeof(ServerSendAdventureData_Struct)
+ (sizeof(ServerFinishedAdventures_Struct) * f_count));
ServerSendAdventureData_Struct *sca = (ServerSendAdventureData_Struct*)pack->pBuffer;
@@ -428,8 +428,8 @@ void AdventureManager::TryAdventureCreate(const char *data)
sca->finished_adventures = f_count;
for(int f = 0; f < f_count; ++f)
{
ServerFinishedAdventures_Struct *sfa = (ServerFinishedAdventures_Struct*)(pack->pBuffer
+ sizeof(ServerSendAdventureData_Struct)
ServerFinishedAdventures_Struct *sfa = (ServerFinishedAdventures_Struct*)(pack->pBuffer
+ sizeof(ServerSendAdventureData_Struct)
+ (sizeof(ServerFinishedAdventures_Struct) * f));
sfa->zone_in_id = finished_adventures[f]->GetTemplate()->zone_in_zone_id;
sfa->zone_in_object = finished_adventures[f]->GetTemplate()->zone_in_object_id;
@@ -464,7 +464,7 @@ 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)
ServerPacket *pack = new ServerPacket(ServerOP_AdventureData, sizeof(ServerSendAdventureData_Struct)
+ (sizeof(ServerFinishedAdventures_Struct) * f_count));
ServerSendAdventureData_Struct *sca = (ServerSendAdventureData_Struct*)pack->pBuffer;
@@ -508,8 +508,8 @@ void AdventureManager::GetAdventureData(const char *name)
sca->finished_adventures = f_count;
for(int i = 0; i < f_count; ++i)
{
ServerFinishedAdventures_Struct *sfa = (ServerFinishedAdventures_Struct*)(pack->pBuffer
+ sizeof(ServerSendAdventureData_Struct)
ServerFinishedAdventures_Struct *sfa = (ServerFinishedAdventures_Struct*)(pack->pBuffer
+ sizeof(ServerSendAdventureData_Struct)
+ (sizeof(ServerFinishedAdventures_Struct) * i));
sfa->zone_in_id = finished_adventures[i]->GetTemplate()->zone_in_zone_id;
sfa->zone_in_object = finished_adventures[i]->GetTemplate()->zone_in_object_id;
@@ -644,9 +644,9 @@ bool AdventureManager::LoadAdventureTemplates()
"assa_y, assa_z, assa_h, text, duration, zone_in_time, win_points, lose_points, "
"theme, zone_in_zone_id, zone_in_x, zone_in_y, zone_in_object_id, dest_x, dest_y,"
" dest_z, dest_h, graveyard_zone_id, graveyard_x, graveyard_y, graveyard_z, "
"graveyard_radius FROM adventure_template"), errbuf, &result))
"graveyard_radius FROM adventure_template"), errbuf, &result))
{
while((row = mysql_fetch_row(result)))
while((row = mysql_fetch_row(result)))
{
uint8 x = 0;
AdventureTemplate *t = new AdventureTemplate;
@@ -704,9 +704,9 @@ bool AdventureManager::LoadAdventureEntries()
MYSQL_RES *result;
MYSQL_ROW row;
if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT id, template_id FROM adventure_template_entry"), errbuf, &result))
if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT id, template_id FROM adventure_template_entry"), errbuf, &result))
{
while((row = mysql_fetch_row(result)))
while((row = mysql_fetch_row(result)))
{
int id = atoi(row[0]);
int template_id = atoi(row[1]);
@@ -862,7 +862,7 @@ void AdventureManager::IncrementCount(uint16 instance_id)
ServerAdventureCountUpdate_Struct *ac = (ServerAdventureCountUpdate_Struct*)pack->pBuffer;
ac->count = current->GetCount();
ac->total = current->GetTemplate()->type_count;
while(siter != slist.end())
{
ClientListEntry *pc = client_list.FindCharacter((*siter).c_str());
@@ -1097,9 +1097,9 @@ void AdventureManager::LoadLeaderboardInfo()
MYSQL_ROW row;
if(database.RunQuery(query,MakeAnyLenString(&query,"select ch.name, ch.id, adv_stats.* from adventure_stats "
"AS adv_stats ""left join character_ AS ch on adv_stats.player_id = ch.id;"), errbuf, &result))
"AS adv_stats ""left join character_ AS ch on adv_stats.player_id = ch.id;"), errbuf, &result))
{
while((row = mysql_fetch_row(result)))
while((row = mysql_fetch_row(result)))
{
if(row[0])
{
@@ -1329,7 +1329,7 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1396,7 +1396,7 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1463,7 +1463,7 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1530,7 +1530,7 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1597,7 +1597,7 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1664,7 +1664,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1731,7 +1731,7 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1798,7 +1798,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1865,7 +1865,7 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1932,7 +1932,7 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -1999,7 +1999,7 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -2066,7 +2066,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player)
al->success = our_successes;
al->failure = our_failures;
}
pack->Deflate();
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
@@ -2119,7 +2119,7 @@ void AdventureManager::Save()
int number_of_elements = adventure_list.size();
ss.write((const char*)&number_of_elements, sizeof(int));
char null_term = 0;
list<Adventure*>::iterator a_iter = adventure_list.begin();
while(a_iter != adventure_list.end())
+1 -1
View File
@@ -70,7 +70,7 @@ ADD_DEFINITIONS(-DWORLD)
TARGET_LINK_LIBRARIES(world Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
IF(MSVC)
SET_TARGET_PROPERTIES(world PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(world "Ws2_32.lib")
ENDIF(MSVC)
+13 -13
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -36,39 +36,39 @@ typedef struct {
class EQLConfig {
public:
EQLConfig(const char *launcher_name);
void LoadSettings();
static EQLConfig *CreateLauncher(const char *name, uint8 dynamic_count);
void GetZones(std::vector<LauncherZone> &result);
//BEGIN PERL EXPORT
Const_char * GetName() const { return(m_name.c_str()); }
int GetStaticCount() const { return(m_zones.size()); }
bool IsConnected() const; //is this launcher connected to world
void DeleteLauncher(); //kill this launcher and all its zones.
void RestartZone(Const_char *zone_ref);
void StopZone(Const_char *zone_ref);
void StartZone(Const_char *zone_ref);
bool BootStaticZone(Const_char *short_name, uint16 port);
bool ChangeStaticZone(Const_char *short_name, uint16 port);
bool DeleteStaticZone(Const_char *short_name);
bool SetDynamicCount(int count);
int GetDynamicCount() const;
vector<string> ListZones(); //returns an array of zone refs
map<string,string> GetZoneDetails(Const_char *zone_ref);
//END PERL EXPORT
protected:
const string m_name;
uint8 m_dynamics;
map<string, LauncherZone> m_zones; //static zones.
};
+24 -24
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -61,10 +61,10 @@ extern volatile bool RunLoops;
EQW EQW::s_EQW;
//IO Capture routine
XS(XS_EQWIO_PRINT); /* prototype to pass -Wmissing-prototypes */
XS(XS_EQWIO_PRINT)
XS(XS_EQWIO_PRINT); /* prototype to pass -Wmissing-prototypes */
XS(XS_EQWIO_PRINT)
{
dXSARGS;
dXSARGS;
if (items < 2)
return;
@@ -73,8 +73,8 @@ XS(XS_EQWIO_PRINT)
char *str = SvPV_nolen(ST(r));
EQW::Singleton()->AppendOutput(str);
}
XSRETURN_EMPTY;
XSRETURN_EMPTY;
}
EQW::EQW() {
@@ -120,29 +120,29 @@ int EQW::CountZones() {
//returns an array of zone_refs (opaque)
vector<string> EQW::ListBootedZones() {
vector<string> res;
vector<uint32> zones;
zoneserver_list.GetZoneIDList(zones);
vector<uint32>::iterator cur, end;
cur = zones.begin();
end = zones.end();
for(; cur != end; cur++) {
res.push_back(itoa(*cur));
}
return(res);
}
map<string,string> EQW::GetZoneDetails(Const_char *zone_ref) {
map<string,string> res;
ZoneServer *zs = zoneserver_list.FindByID(atoi(zone_ref));
if(zs == nullptr) {
res["error"] = "Invalid zone.";
return(res);
}
res["type"] = zs->IsStaticZone()?"static":"dynamic";
res["zone_id"] = itoa(zs->GetZoneID());
res["launch_name"] = zs->GetLaunchName();
@@ -151,7 +151,7 @@ map<string,string> EQW::GetZoneDetails(Const_char *zone_ref) {
res["long_name"] = zs->GetZoneLongName();
res["port"] = itoa(zs->GetCPort());
res["player_count"] = itoa(zs->NumPlayers());
//this isnt gunna work for dynamic zones...
res["launcher"] = "";
if(zs->GetZoneID() != 0) {
@@ -159,7 +159,7 @@ map<string,string> EQW::GetZoneDetails(Const_char *zone_ref) {
if(ll != nullptr)
res["launcher"] = ll->GetName();
}
return(res);
}
@@ -170,10 +170,10 @@ int EQW::CountPlayers() {
//returns an array of character names in the zone (empty=all zones)
vector<string> EQW::ListPlayers(Const_char *zone_name) {
vector<string> res;
vector<ClientListEntry *> list;
client_list.GetClients(zone_name, list);
vector<ClientListEntry *>::iterator cur, end;
cur = list.begin();
end = list.end();
@@ -185,13 +185,13 @@ vector<string> EQW::ListPlayers(Const_char *zone_name) {
map<string,string> EQW::GetPlayerDetails(Const_char *char_name) {
map<string,string> res;
ClientListEntry *cle = client_list.FindCharacter(char_name);
if(cle == nullptr) {
res["error"] = "1";
return(res);
}
res["character"] = cle->name();
res["account"] = cle->AccountName();
res["account_id"] = itoa(cle->AccountID());
@@ -208,14 +208,14 @@ map<string,string> EQW::GetPlayerDetails(Const_char *char_name) {
res["guild"] = guild_mgr.GetGuildName(cle->GuildID());
res["status"] = itoa(cle->Admin());
// res["patch"] = cle->DescribePatch();
return(res);
}
int EQW::CountLaunchers(bool active_only) {
if(active_only)
return(launcher_list.GetLauncherCount());
vector<string> it(EQW::ListLaunchers());
return(it.size());
}
@@ -232,13 +232,13 @@ vector<string> EQW::ListLaunchers() {
vector<string> launchers;
launcher_list.GetLauncherNameList(launchers);
return(launchers);
/* if(list.empty()) {
return(launchers);
} else if(launchers.empty()) {
return(list);
}
//union the two lists.
vector<string>::iterator curo, endo, curi, endi;
curo = list.begin();
@@ -286,7 +286,7 @@ void EQW::LSReconnect() {
/*
map<string,string> EQW::GetLaunchersDetails(Const_char *launcher_name) {
map<string,string> res;
LauncherLink *ll = launcher_list.Get(launcher_name);
if(ll == nullptr) {
res["name"] = launcher_name;
@@ -302,7 +302,7 @@ map<string,string> EQW::GetLaunchersDetails(Const_char *launcher_name) {
res["zone_count"] = itoa(ll->CountZones());
res["connected"] = "yes";
}
return(res);
}
+12 -12
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -31,35 +31,35 @@ class EQW {
EQW();
public:
static EQW *Singleton() { return(&s_EQW); }
void AppendOutput(const char *str);
const std::string &GetOutput() const;
void ClearOutput() { m_outputBuffer = ""; }
//BEGIN PERL EXPORT
//NOTE: you must have a space after the * of a return value
Const_char * GetConfig(Const_char *var_name);
void LockWorld();
void UnlockWorld();
bool LSConnected();
void LSReconnect();
int CountZones();
vector<string> ListBootedZones(); //returns an array of zone_refs (opaque)
map<string,string> GetZoneDetails(Const_char *zone_ref); //returns a hash ref of details
int CountPlayers();
vector<string> ListPlayers(Const_char *zone_name = ""); //returns an array of player refs (opaque)
map<string,string> GetPlayerDetails(Const_char *player_ref); //returns a hash ref of details
int CountLaunchers(bool active_only);
// vector<string> ListActiveLaunchers(); //returns an array of launcher names
vector<string> ListLaunchers(); //returns an array of launcher names
EQLConfig * GetLauncher(Const_char *launcher_name); //returns the EQLConfig object for the specified launcher.
void CreateLauncher(Const_char *launcher_name, int dynamic_count);
// EQLConfig * FindLauncher(Const_char *zone_ref);
//Guild routines, mostly wrappers around guild_mgr
uint32 CreateGuild(const char* name, uint32 leader_char_id);
bool DeleteGuild(uint32 guild_id);
@@ -71,7 +71,7 @@ public:
bool SetBankerFlag(uint32 charid, bool is_banker);
bool SetTributeFlag(uint32 charid, bool enabled);
bool SetPublicNote(uint32 charid, const char *note);
//bugs
int CountBugs();
vector<string> ListBugs(uint32 offset); //returns an array of zone_refs (opaque)
@@ -85,9 +85,9 @@ public:
protected:
std::string m_outputBuffer;
std::string m_returnBuffer;
bool m_worldLocked;
private:
static EQW s_EQW;
};
+29 -29
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -40,7 +40,7 @@ EQWHTTPHandler::EQWHTTPHandler(uint32 ID, SOCKET in_socket, uint32 irIP, uint16
}
EQWHTTPHandler::~EQWHTTPHandler() {
}
#ifdef EMBPERL
@@ -71,16 +71,16 @@ void EQWHTTPHandler::Exec() {
m_sentHeaders = false;
m_responseCode = "200";
// printf("Request: %s, %s, %s, %s.\n", GetMethod().c_str(), GetUrl().c_str(), GetUri().c_str(), GetQueryString().c_str());
SetHttpVersion("HTTP/1.0");
AddResponseHeader("Connection", "close");
if(GetUri().find("..") != string::npos) {
SendResponse("403", "Forbidden");
printf("%s is forbidden.\n", GetUri().c_str());
return;
}
if(!CheckAuth()) {
AddResponseHeader("Content-type", "text/plain");
AddResponseHeader("WWW-Authenticate", "Basic realm=\"EQEmulator\"");
@@ -110,23 +110,23 @@ void EQWHTTPHandler::Exec() {
void EQWHTTPHandler::OnHeader(const std::string& key,const std::string& value) {
HttpdSocket::OnHeader(key, value);
if (!strcasecmp(key.c_str(),"Authorization")) {
if(strncasecmp(value.c_str(), "Basic ", 6)) {
printf("Invalid auth type. Expected Basic: %s\n", value.c_str());
return;
}
std::string dec;
Base64::decode(value.c_str() + 6, dec);
std::string::size_type cpos;
cpos = dec.find_first_of(':');
if(cpos == string::npos) {
printf("Invalid auth string: %s\n", dec.c_str());
return;
}
m_username = dec.substr(0, cpos);
m_password = dec.substr(cpos+1);
}
@@ -137,7 +137,7 @@ void EQWHTTPHandler::OnHeader(const std::string& key,const std::string& value) {
bool EQWHTTPHandler::CheckAuth() const {
if(m_username.length() < 1)
return(false);
int16 status = 0;
uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status);
if(acctid == 0) {
@@ -148,15 +148,15 @@ bool EQWHTTPHandler::CheckAuth() const {
_log(WORLD__HTTP_ERR, "Login of %s failed: status too low.", m_username.c_str());
return(false);
}
return(true);
}
void EQWHTTPHandler::SendPage(const std::string &file) {
string path = "templates/";
path += file;
FILE *f = fopen(path.c_str(), "rb");
if(f == nullptr) {
SendResponse("404", "Not Found");
@@ -164,10 +164,10 @@ void EQWHTTPHandler::SendPage(const std::string &file) {
printf("%s not found.\n", file.c_str());
return;
}
string type = s_mime.GetMimeFromFilename(file);
AddResponseHeader("Content-type", type);
bool process = false;
#ifdef EMBPERL
if(type == "text/html")
@@ -180,7 +180,7 @@ void EQWHTTPHandler::SendPage(const std::string &file) {
}
#endif
char *buffer = new char[READ_BUFFER_LEN+1];
size_t len;
string to_process;
@@ -198,10 +198,10 @@ void EQWHTTPHandler::SendPage(const std::string &file) {
//convert the base form into a useful perl exportable form
HTTPRequest req(this, GetHttpForm());
GetParser()->SetHTTPRequest("testing", &req);
//parse out the page and potentially pass some stuff on to perl.
ProcessAndSend(to_process);
//clear out the form, just in case (since it gets destroyed next)
GetParser()->SetHTTPRequest("testing", nullptr);
}
@@ -217,7 +217,7 @@ void EQWHTTPHandler::ProcessAndSend(const string &str) {
string::size_type len = str.length();
string::size_type start = 0;
string::size_type pos, end;
while((pos = str.find("<?", start)) != string::npos) {
//send all the crap leading up to the script block
if(pos != start) {
@@ -239,7 +239,7 @@ void EQWHTTPHandler::ProcessAndSend(const string &str) {
start = end + 2;
}
}
//send whatever is left over
if(start != len)
ProcessText(str.c_str() + start, len-start);
@@ -249,9 +249,9 @@ void EQWHTTPHandler::ProcessScript(const std::string &script_body) {
const char *script = script_body.c_str();
if(strcmp("perl", script) == 0)
script += 4; //allow <?perl
// printf("Script: ''''%s''''\n\n", script_body.c_str());
GetParser()->EQW_eval("testing", script_body.c_str());
const string &res = EQW::Singleton()->GetOutput();
if(!res.empty()) {
@@ -291,7 +291,7 @@ bool EQWHTTPServer::Start(uint16 port, const char *mime_file) {
_log(WORLD__HTTP_ERR, "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);
@@ -299,25 +299,25 @@ bool EQWHTTPServer::Start(uint16 port, const char *mime_file) {
} else {
_log(WORLD__HTTP, "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);
return(false);
}
m_running = true;
m_port = port;
/*
#ifdef _WINDOWS
_beginthread(ThreadProc, 0, this);
#else
pthread_create(&m_thread, nullptr, ThreadProc, this);
#endif*/
return(true);
}
+21 -21
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -31,38 +31,38 @@ class EQWHTTPHandler : public HttpdSocket {
public:
EQWHTTPHandler(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort);
virtual ~EQWHTTPHandler();
void SetResponseCode(const char *code) { m_responseCode = code; }
//HttpdSocket interface:
virtual void Exec();
virtual void OnHeader(const std::string& key,const std::string& value);
static bool LoadMimeTypes(const char *filename);
protected:
bool CheckAuth() const;
void SendPage(const std::string &file);
//credentials
std::string m_username;
std::string m_password;
bool m_closeOnFinish;
std::string m_responseCode;
bool m_sentHeaders;
//our mime type manager
static Mime s_mime;
#ifdef EMBPERL
void ProcessAndSend(const std::string &entire_html_page);
void ProcessScript(const std::string &script_body);
void ProcessText(const char *txt, int len);
static EQWParser *GetParser();
private:
static EQWParser *s_parser;
#endif
@@ -71,24 +71,24 @@ private:
class EQWHTTPServer : protected TCPServer<EQWHTTPHandler> {
public:
EQWHTTPServer();
bool Start(uint16 port, const char *mime_file);
void Stop();
protected:
volatile bool m_running;
uint16 m_port;
virtual void CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort);
/* //I decided to put this into its own thread so that the HTTP pages
//cannot block the main world server's operation.
static ThreadReturnType ThreadProc(void* tmp);
void Run();
#ifndef WIN32
pthread_t m_thread;
#endif*/
+24 -24
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -44,16 +44,16 @@ EXTERN_C XS(boot_EQDBRes);
EXTERN_C XS(boot_HTTPRequest);
EXTERN_C XS(boot_EQLConfig);
EXTERN_C void xs_init(pTHX)
EXTERN_C void xs_init(pTHX)
{
char file[256];
strncpy(file, __FILE__, 256);
file[255] = '\0';
char buf[128]; //shouldent have any function names longer than this.
//add the strcpy stuff to get rid of const warnings....
newXS(strcpy(buf, "DynaLoader::boot_DynaLoader"), boot_DynaLoader, file);
newXS(strcpy(buf, "EQW::boot_EQW"), boot_EQW, file);
newXS(strcpy(buf, "EQDB::boot_EQDB"), boot_EQDB, file);
@@ -92,10 +92,10 @@ void EQWParser::DoInit() {
perl_parse(my_perl, xs_init, argc, argv, env);
perl_run(my_perl);
//a little routine we use a lot.
eval_pv("sub my_eval {eval $_[0];}", TRUE); //dies on error
//ruin the perl exit and command:
eval_pv("sub my_exit {}",TRUE);
eval_pv("sub my_sleep {}",TRUE);
@@ -107,7 +107,7 @@ void EQWParser::DoInit() {
GvCV_set(sleepgp, perl_get_cv("my_sleep", TRUE)); //dies on error
GvIMPORTED_CV_on(sleepgp);
}
//setup eval_file
eval_pv(
"our %Cache;"
@@ -125,7 +125,7 @@ void EQWParser::DoInit() {
"}"
"}"
,FALSE);
//make a tie-able class to capture IO and get it where it needs to go
eval_pv(
"package EQWIO; "
@@ -142,12 +142,12 @@ void EQWParser::DoInit() {
" tie *STDOUT, 'EQWIO';"
" tie *STDERR, 'EQWIO';"
,FALSE);
eval_pv(
"package world; "
,FALSE
);
//make sure the EQW pointer is set up in this package
EQW *curc = EQW::Singleton();
SV *l = get_sv("world::EQW", true);
@@ -157,7 +157,7 @@ void EQWParser::DoInit() {
//clear out the value, mainly to get rid of blessedness
sv_setsv(l, _empty_sv);
}
//make sure the EQDB pointer is set up in this package
EQDB::SetMySQL(database.getMySQL());
EQDB *curc_db = EQDB::Singleton();
@@ -168,7 +168,7 @@ void EQWParser::DoInit() {
//clear out the value, mainly to get rid of blessedness
sv_setsv(l_db, _empty_sv);
}
//load up EQW
eval_pv(
"package EQW;"
@@ -182,15 +182,15 @@ void EQWParser::DoInit() {
"package EQLConfig;"
"&boot_EQLConfig;" //load our EQLConfig XS
, FALSE );
#ifdef EMBPERL_PLUGIN
_log(WORLD__PERL, "Loading worldui perl plugins.");
string err;
if(!eval_file("world", "worldui.pl", err)) {
_log(WORLD__PERL_ERR, "Warning - world.pl: %s", err.c_str());
}
eval_pv(
"package world; "
"if(opendir(D,'worldui')) { "
@@ -234,7 +234,7 @@ bool EQWParser::dosub(const char * subname, const std::vector<std::string> &args
{
for(std::vector<std::string>::const_iterator i = args.begin(); i != args.end(); ++i)
{/* push the arguments onto the perl stack */
XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length())));
XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length())));
}
}
PUTBACK; /* make local stack pointer global */
@@ -245,7 +245,7 @@ bool EQWParser::dosub(const char * subname, const std::vector<std::string> &args
}
FREETMPS; /* free temp values */
LEAVE; /* ...and the XPUSHed "mortal" args.*/
if(err) {
error = "Perl runtime error: ";
error += SvPVX(ERRSV);
@@ -263,10 +263,10 @@ bool EQWParser::eval(const char * code, string &error) {
void EQWParser::EQW_eval(const char *pkg, const char *code) {
char namebuf[64];
snprintf(namebuf, 64, "package %s;", pkg);
eval_pv(namebuf, FALSE);
//make sure the EQW pointer is set up
EQW *curc = EQW::Singleton();
snprintf(namebuf, 64, "EQW");
@@ -289,7 +289,7 @@ void EQWParser::EQW_eval(const char *pkg, const char *code) {
//clear out the value, mainly to get rid of blessedness
sv_setsv(l_db, _empty_sv);
}
string err;
if(!eval(code, err)) {
EQW::Singleton()->AppendOutput(err.c_str());
@@ -298,10 +298,10 @@ void EQWParser::EQW_eval(const char *pkg, const char *code) {
void EQWParser::SetHTTPRequest(const char *pkg, HTTPRequest *it) {
char namebuf[64];
snprintf(namebuf, 64, "package %s;", pkg);
eval_pv(namebuf, FALSE);
snprintf(namebuf, 64, "request");
// snprintf(namebuf, 64, "%s::EQW", pkg);
SV *l = get_sv(namebuf, true);
+5 -5
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -36,10 +36,10 @@ class EQWParser {
public:
EQWParser();
~EQWParser();
void EQW_eval(const char *pkg, const char *code);
void SetHTTPRequest(const char *pkg, HTTPRequest *it);
//put an integer into a perl varable
void seti(const char *varname, int val) const {
SV *t = get_sv(varname, true);
@@ -55,7 +55,7 @@ public:
SV *t = get_sv(varname, true);
sv_setpv(t, val);
}
protected:
void DoInit();
bool eval(const char * code, std::string &error);
+2 -2
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+7 -7
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -34,19 +34,19 @@ using namespace std;
class HTTPRequest {
public:
HTTPRequest(EQWHTTPHandler *h, HttpdForm *form);
//BEGIN PERL EXPORT
Const_char * get(Const_char *name, Const_char *default_value = "") const;
int getInt(Const_char *name, int default_value = 0) const;
float getFloat(Const_char *name, float default_value = 0.0) const;
//returns a database-safe string
Const_char * getEscaped(Const_char *name, Const_char *default_value = "") const;
map<string,string> get_all() const;
void redirect(Const_char *URL);
void SetResponseCode(Const_char *code);
void header(Const_char *name, Const_char *value);
+26 -26
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -53,7 +53,7 @@ LauncherLink::~LauncherLink() {
bool LauncherLink::Process() {
if (!tcpc->Connected())
return false;
if(m_bootTimer.Check(false)) {
//force a boot on any zone which isnt running.
std::map<std::string, ZoneState>::iterator cur, end;
@@ -66,7 +66,7 @@ bool LauncherLink::Process() {
}
m_bootTimer.Disable();
}
ServerPacket *pack = 0;
while((pack = tcpc->PopPacket())) {
_hex(WORLD__ZONE_TRACE,pack->pBuffer,pack->size);
@@ -125,20 +125,20 @@ bool LauncherLink::Process() {
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);
Disconnect();
break;
}
_log(WORLD__LAUNCH, "Launcher Identified itself as '%s'. Loading zone list.", it->name);
std::vector<LauncherZone> result;
//database.GetLauncherZones(it->name, result);
config->GetZones(result);
std::vector<LauncherZone>::iterator cur, end;
cur = result.begin();
end = result.end();
@@ -150,12 +150,12 @@ bool LauncherLink::Process() {
_log(WORLD__LAUNCH_TRACE, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port);
m_states[cur->name] = zs;
}
//now we add all the dynamics.
BootDynamics(config->GetDynamicCount());
m_bootTimer.Start();
break;
}
case ServerOP_LauncherZoneStatus: {
@@ -186,7 +186,7 @@ bool LauncherLink::Process() {
bool LauncherLink::ContainsZone(const char *short_name) const {
return(m_states.find(short_name) != m_states.end());
/*
* std::map<std::string, bool>::const_iterator cur, end;
cur = m_states.begin();
@@ -203,17 +203,17 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) {
zs.starts = 0;
_log(WORLD__LAUNCH_TRACE, "%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));
LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer;
strn0cpy(s->short_name, short_name, 32);
s->command = ZR_Start;
SendPacket(pack);
delete pack;
}
@@ -221,10 +221,10 @@ void LauncherLink::StartZone(const char *short_name) {
void LauncherLink::RestartZone(const char *short_name) {
ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer;
strn0cpy(s->short_name, short_name, 32);
s->command = ZR_Restart;
SendPacket(pack);
delete pack;
}
@@ -232,10 +232,10 @@ void LauncherLink::RestartZone(const char *short_name) {
void LauncherLink::StopZone(const char *short_name) {
ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest));
LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer;
strn0cpy(s->short_name, short_name, 32);
s->command = ZR_Stop;
SendPacket(pack);
delete pack;
}
@@ -243,15 +243,15 @@ void LauncherLink::StopZone(const char *short_name) {
void LauncherLink::BootDynamics(uint8 new_count) {
if(m_dynamicCount == new_count)
return;
ZoneState zs;
if(m_dynamicCount < new_count) {
//we are booting more dynamics.
zs.port = 0;
zs.up = false;
zs.starts = 0;
int r;
char nbuf[20];
uint8 index;
@@ -278,7 +278,7 @@ void LauncherLink::BootDynamics(uint8 new_count) {
}
} else {
//need to get rid of some zones...
//quick and dirty way to do this.. should do better (like looking for idle zones)
int found = 0;
std::map<std::string, ZoneState>::iterator cur, end;
@@ -294,10 +294,10 @@ void LauncherLink::BootDynamics(uint8 new_count) {
}
}
}
m_dynamicCount = new_count;
}
}
@@ -312,7 +312,7 @@ void LauncherLink::GetZoneList(std::vector<std::string> &l) {
void LauncherLink::GetZoneDetails(const char *short_name, std::map<std::string,std::string> &res) {
res.clear();
std::map<std::string, ZoneState>::iterator r;
r = m_states.find(short_name);
if(r == m_states.end()) {
+11 -11
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -30,22 +30,22 @@ class LauncherLink {
public:
LauncherLink(int id, EmuTCPConnection *tcpc);
~LauncherLink();
bool Process();
bool SendPacket(ServerPacket* pack) { return tcpc->SendPacket(pack); }
// bool SendPacket(TCPConnection::TCPNetPacket_Struct* tnps) { return tcpc->SendPacket(tnps); }
int GetID() const { return(ID); }
void Disconnect() { tcpc->Disconnect(); }
inline bool HasName() const { return(m_name.length() > 0); }
inline uint32 GetIP() const { return tcpc->GetrIP(); }
inline uint16 GetPort() const { return tcpc->GetrPort(); }
inline const char * GetName() const { return(m_name.c_str()); }
inline int CountZones() const { return(m_states.size()); }
bool ContainsZone(const char *short_name) const;
//commands
void Shutdown();
void BootZone(const char *short_name, uint16 port);
@@ -53,19 +53,19 @@ public:
void RestartZone(const char *short_name);
void StopZone(const char *short_name);
void BootDynamics(uint8 new_total);
void GetZoneList(std::vector<std::string> &list);
void GetZoneDetails(const char *short_name, std::map<std::string,std::string> &result);
protected:
const int ID;
EmuTCPConnection*const tcpc;
bool authenticated;
std::string m_name;
Timer m_bootTimer;
uint8 m_dynamicCount;
typedef struct {
bool up;
uint32 starts; //number of times this zone has started
+10 -10
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -37,14 +37,14 @@ LauncherList::~LauncherList() {
for(; cur != end; cur++) {
delete *cur;
}
map<string, EQLConfig *>::iterator curc, endc;
curc = m_configs.begin();
endc = m_configs.end();
for(; curc != endc; curc++) {
delete curc->second;
}
map<string, LauncherLink *>::iterator curl, endl;
curl = m_launchers.begin();
endl = m_launchers.end();
@@ -52,7 +52,7 @@ LauncherList::~LauncherList() {
delete curl->second;
}
}
void LauncherList::Process() {
//process pending launchers..
vector<LauncherLink *>::iterator cur, end;
@@ -84,7 +84,7 @@ void LauncherList::Process() {
cur++;
}
}
//process active launchers.
map<string, LauncherLink *>::iterator curl, tmp;
curl = m_launchers.begin();
@@ -111,7 +111,7 @@ LauncherLink *LauncherList::Get(const char *name) {
return(nullptr);
return(res->second);
/* string goal(name);
vector<LauncherLink *>::iterator cur, end;
cur = m_launchers.begin();
end = m_launchers.end();
@@ -155,9 +155,9 @@ void LauncherList::GetLauncherNameList(std::vector<string> &res) {
void LauncherList::LoadList() {
vector<string> launchers;
database.GetLauncherList(launchers);
vector<string>::iterator cur, end;
cur = launchers.begin();
end = launchers.end();
@@ -186,7 +186,7 @@ void LauncherList::Remove(const char *name) {
delete resc->second;
m_configs.erase(resc);
}
map<string, LauncherLink *>::iterator resl;
resl = m_launchers.find(name);
if(resl != m_launchers.end()) {
+7 -7
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -31,21 +31,21 @@ class LauncherList {
public:
LauncherList();
~LauncherList();
void Process();
void LoadList();
EQLConfig *GetConfig(const char *name);
void CreateLauncher(const char *name, uint8 dynamic_count);
void Remove(const char *name);
void Add(EmuTCPConnection *conn);
LauncherLink *Get(const char *name);
LauncherLink *FindByZone(const char *short_name);
int GetLauncherCount();
void GetLauncherNameList(std::vector<std::string> &list);
protected:
std::map<std::string, EQLConfig *> m_configs; //we own these objects
std::map<std::string, LauncherLink *> m_launchers; //we own these objects
+4 -4
View File
@@ -96,7 +96,7 @@ bool LoginServer::Process() {
if (statusupdate_timer.Check()) {
this->SendStatus();
}
/************ Get all packets from packet manager out queue and process them ************/
ServerPacket *pack = 0;
while((pack = tcpc->PopPacket()))
@@ -112,7 +112,7 @@ bool LoginServer::Process() {
break;
}
case ServerOP_UsertoWorldReq: {
UsertoWorldRequest_Struct* utwr = (UsertoWorldRequest_Struct*) pack->pBuffer;
UsertoWorldRequest_Struct* utwr = (UsertoWorldRequest_Struct*) pack->pBuffer;
uint32 id = database.GetAccountIDFromLSID(utwr->lsaccountid);
int16 status = database.CheckStatus(id);
@@ -154,9 +154,9 @@ bool LoginServer::Process() {
ServerLSClientAuth* slsca = (ServerLSClientAuth*) pack->pBuffer;
if (RuleI(World, AccountSessionLimit) >= 0) {
// Enforce the limit on the number of characters on the same account that can be
// Enforce the limit on the number of characters on the same account that can be
// online at the same time.
client_list.EnforceSessionLimit(slsca->lsaccount_id);
client_list.EnforceSessionLimit(slsca->lsaccount_id);
}
client_list.CLEAdd(slsca->lsaccount_id, slsca->name, slsca->key, slsca->worldadmin, slsca->ip, slsca->local);
+4 -4
View File
@@ -21,7 +21,7 @@ class LoginServerList{
public:
LoginServerList();
~LoginServerList();
void Add(const char*, uint16, const char*, const char*);
void InitLoginServer();
@@ -31,13 +31,13 @@ public:
bool SendNewInfo();
bool SendStatus();
bool SendPacket(ServerPacket *pack);
bool SendAccountUpdate(ServerPacket *pack);
bool SendPacket(ServerPacket *pack);
bool SendAccountUpdate(ServerPacket *pack);
bool Connected();
bool AllConnected();
bool MiniLogin();
bool CanUpdate();
protected:
LinkedList<LoginServer*> list;
};
+1 -1
View File
@@ -17,7 +17,7 @@ struct RaceClassCombos {
unsigned int AllocationIndex;
unsigned int Zone;
};
/*struct SoFCCData {
unsigned char Unknown;
unsigned int RaceClassStatEntryCount;
+2 -2
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+4 -4
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -40,7 +40,7 @@ public:
// Produce a const singleton
static const WorldConfig *get() {
if (_world_config == nullptr)
if (_world_config == nullptr)
LoadConfig();
return(_world_config);
}
@@ -61,7 +61,7 @@ public:
static void DisableStats() { if (_world_config) _world_config->UpdateStats=false; }
static void EnableStats() { if (_world_config) _world_config->UpdateStats=true; }
static void DisableLoginserver() { if (_world_config) _world_config->LoginDisabled=true; }
static void EnableLoginserver() { if (_world_config) _world_config->LoginDisabled=false; }
+26 -26
View File
@@ -120,7 +120,7 @@ void Client::SendLogServer()
if(RuleB(Chat, EnableVoiceMacros))
l->enablevoicemacros = 1;
l->enable_pvp = (RuleI(World, PVPSettings));
if(RuleB(World, IsGMPetitionWindowEnabled))
@@ -188,7 +188,7 @@ void Client::SendCharInfo() {
void Client::SendMaxCharCreate(int max_chars) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendMaxCharacters, sizeof(MaxCharacters_Struct));
MaxCharacters_Struct* mc = (MaxCharacters_Struct*)outapp->pBuffer;
mc->max_chars = max_chars;
QueuePacket(outapp);
@@ -219,7 +219,7 @@ void Client::SendMembership() {
15. In-Game Popup Advertising
That is 15 possible fields, and there are 15 unknowns in the struct...Coincidence?
*/
mc->membership = 2; //Hardcode to gold for now. We don't use anything else.
mc->races = 0x1ffff; // Available Races (4110 for silver)
mc->classes = 0x1ffff; // Available Classes (4614 for silver) - Was 0x101ffff
@@ -236,7 +236,7 @@ void Client::SendMembership() {
mc->entries[9] = 0xffffffff; // Unknown - Maybe Loyalty Points every 12 hours? 60 per week for Silver
mc->entries[10] = 1; // 1 for Silver
mc->entries[11] = 0xffffffff; // Shared Bank Slots
mc->entries[12] = 0xffffffff; // Unknown - Maybe Max Active Tasks?
mc->entries[12] = 0xffffffff; // Unknown - Maybe Max Active Tasks?
mc->entries[13] = 1; // 1 for Silver
mc->entries[14] = 1; // 0 for Silver
mc->entries[15] = 1; // 0 for Silver
@@ -263,7 +263,7 @@ void Client::SendMembershipSettings() {
{
for (int setting_index=0; setting_index < 3; setting_index++)
{
mds->settings[entry_count].setting_index = setting_index;
mds->settings[entry_count].setting_id = setting_id;
mds->settings[entry_count].setting_value = gold_settings[setting_id];
@@ -327,7 +327,7 @@ void Client::SendMembershipSettings() {
mds->exit_url_length = 0; // Live uses 42
//strcpy(eq->exit_url, "http://www.everquest.com/free-to-play/exit");
mds->exit_url_length2 = 0; // Live uses 49
//strcpy(eq->exit_url2, "http://www.everquest.com/free-to-play/exit-silver");
//strcpy(eq->exit_url2, "http://www.everquest.com/free-to-play/exit-silver");
/*
Account Access Level Settings
@@ -658,7 +658,7 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
DumpPacket(app);
// the previous behavior was essentially returning true here
// but that seems a bit odd to me.
return true;
return true;
}
CharCreate_Struct *cc = (CharCreate_Struct*)app->pBuffer;
@@ -672,7 +672,7 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
}
else
SendCharInfo();
return true;
}
@@ -947,7 +947,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
switch(opcode)
{
case OP_World_Client_CRC1:
case OP_World_Client_CRC2:
case OP_World_Client_CRC2:
{
// There is no obvious entry in the CC struct to indicate that the 'Start Tutorial button
// is selected when a character is created. I have observed that in this case, OP_EnterWorld is sent
@@ -968,7 +968,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
{
return HandleGenerateRandomNamePacket(app);
}
case OP_CharacterCreateRequest:
case OP_CharacterCreateRequest:
{
// New OpCode in SoF
return HandleCharacterCreateRequestPacket(app);
@@ -981,11 +981,11 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
{
return HandleEnterWorldPacket(app);
}
case OP_DeleteCharacter:
case OP_DeleteCharacter:
{
return HandleDeleteCharacterPacket(app);
}
case OP_WorldComplete:
case OP_WorldComplete:
{
eqs->Close();
return true;
@@ -1002,12 +1002,12 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
case OP_LoginComplete:
case OP_ApproveWorld:
case OP_WorldClientReady:
{
{
// Essentially we are just 'eating' these packets, indicating
// they are handled.
return true;
}
default:
default:
{
clog(WORLD__CLIENT_ERR,"Received unknown EQApplicationPacket");
_pkt(WORLD__CLIENT_ERR,app);
@@ -1492,7 +1492,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
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)
@@ -1561,9 +1561,9 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
for(int i = 0; i < combos; ++i) {
if(character_create_race_class_combos[i].Class == cc->class_ &&
character_create_race_class_combos[i].Race == cc->race &&
character_create_race_class_combos[i].Deity == cc->deity) {
if(RuleB(World, EnableTutorialButton) &&
(RuleI(World, TutorialZoneID) == cc->start_zone ||
character_create_race_class_combos[i].Deity == cc->deity) {
if(RuleB(World, EnableTutorialButton) &&
(RuleI(World, TutorialZoneID) == cc->start_zone ||
(character_create_race_class_combos[i].Zone == cc->start_zone))) {
class_combo = character_create_race_class_combos[i];
found = true;
@@ -1599,11 +1599,11 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
}
max_stats = allocation.DefaultPointAllocation[0] +
allocation.DefaultPointAllocation[1] +
allocation.DefaultPointAllocation[2] +
allocation.DefaultPointAllocation[3] +
allocation.DefaultPointAllocation[4] +
allocation.DefaultPointAllocation[5] +
allocation.DefaultPointAllocation[1] +
allocation.DefaultPointAllocation[2] +
allocation.DefaultPointAllocation[3] +
allocation.DefaultPointAllocation[4] +
allocation.DefaultPointAllocation[5] +
allocation.DefaultPointAllocation[6];
if(cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) {
@@ -1845,11 +1845,11 @@ void Client::SetClassStartingSkills( PlayerProfile_Struct *pp )
i == RESEARCH ||
i == ALCHEMY ||
i == BAKING ||
i == TAILORING ||
i == TAILORING ||
i == BLACKSMITHING ||
i == FLETCHING ||
i == BREWING ||
i == POTTERY ||
i == BREWING ||
i == POTTERY ||
i == JEWELRY_MAKING ||
i == BEGGING) {
continue;
+3 -3
View File
@@ -37,7 +37,7 @@ class Client {
public:
Client(EQStreamInterface* ieqs);
~Client();
bool Process();
void ReceiveData(uchar* buf, int len);
void SendCharInfo();
@@ -72,10 +72,10 @@ public:
inline ClientListEntry* GetCLE() { return cle; }
inline void SetCLE(ClientListEntry* iCLE) { cle = iCLE; }
private:
uint32 ip;
uint16 port;
uint32 charid;
uint32 charid;
char char_name[64];
uint32 zoneID;
uint32 instanceID;
+3 -3
View File
@@ -34,7 +34,7 @@ ClientListEntry::ClientListEntry(uint32 in_id, uint32 iLSID, const char* iLoginN
: id(in_id)
{
ClearVars(true);
pIP = ip;
pLSID = iLSID;
if(iLSID > 0)
@@ -51,7 +51,7 @@ ClientListEntry::ClientListEntry(uint32 in_id, uint32 iAccID, const char* iAccNa
: id(in_id)
{
ClearVars(true);
pIP = 0;
pLSID = 0;
pworldadmin = 0;
@@ -68,7 +68,7 @@ ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer* iZS, ServerClientList
: id(in_id)
{
ClearVars(true);
pIP = 0;
pLSID = scl->LSAccountID;
strn0cpy(plsname, scl->name, sizeof(plsname));
+46 -46
View File
@@ -47,11 +47,11 @@ ClientList::~ClientList() {
void ClientList::Process() {
if (CLStale_timer.Check())
CLCheckStale();
LinkedListIterator<Client*> iterator(list);
iterator.Reset();
@@ -167,13 +167,13 @@ void ClientList::GetCLEIP(uint32 iIP) {
// If the number of connections exceeds the lower limit
if (IPInstances > (RuleI(World, MaxClientsPerIP))) {
// If MaxClientsSetByStatus is set to True, override other IP Limit Rules
if (RuleB(World, MaxClientsSetByStatus)) {
// The IP Limit is set by the status of the account if status > MaxClientsPerIP
if (IPInstances > countCLEIPs->Admin()) {
if(RuleB(World, IPLimitDisconnectAll)) {
DisconnectByIP(iIP);
return;
@@ -273,7 +273,7 @@ ClientListEntry* ClientList::FindCLEByAccountID(uint32 iAccID) {
ClientListEntry* ClientList::FindCLEByCharacterID(uint32 iCharID) {
LinkedListIterator<ClientListEntry*> iterator(clientlist);
iterator.Reset();
while(iterator.MoreElements()) {
if (iterator.GetData()->CharID() == iCharID) {
@@ -428,9 +428,9 @@ ClientListEntry* ClientList::CheckAuth(const char* iName, const char* iPassword)
iterator.Advance();
}
int16 tmpadmin;
_log(WORLD__ZONELIST,"Login with '%s' and '%s'", iName, iPassword);
uint32 accid = database.CheckLogin(iName, iPassword, &tmpadmin);
if (accid) {
ClientListEntry* tmp = new ClientListEntry(GetNextCLEID(), accid, iName, tmpMD5, tmpadmin);
@@ -531,16 +531,16 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
const char* tmpZone = database.GetZoneName(countcle->zone());
if (
(countcle->Online() >= CLE_Status_Zoning) &&
(!countcle->GetGM() || countcle->Anon() != 1 || admin >= countcle->Admin()) &&
(!countcle->GetGM() || countcle->Anon() != 1 || admin >= countcle->Admin()) &&
(whom == 0 || (
((countcle->Admin() >= 80 && countcle->GetGM()) || whom->gmlookup == 0xFFFF) &&
(whom->lvllow == 0xFFFF || (countcle->level() >= whom->lvllow && countcle->level() <= whom->lvlhigh && (countcle->Anon()==0 || admin > countcle->Admin()))) &&
(whom->wclass == 0xFFFF || (countcle->class_() == whom->wclass && (countcle->Anon()==0 || admin > countcle->Admin()))) &&
((countcle->Admin() >= 80 && countcle->GetGM()) || whom->gmlookup == 0xFFFF) &&
(whom->lvllow == 0xFFFF || (countcle->level() >= whom->lvllow && countcle->level() <= whom->lvlhigh && (countcle->Anon()==0 || admin > countcle->Admin()))) &&
(whom->wclass == 0xFFFF || (countcle->class_() == whom->wclass && (countcle->Anon()==0 || admin > countcle->Admin()))) &&
(whom->wrace == 0xFFFF || (countcle->race() == whom->wrace && (countcle->Anon()==0 || admin > countcle->Admin()))) &&
(whomlen == 0 || (
(tmpZone != 0 && strncasecmp(tmpZone, whom->whom, whomlen) == 0) ||
strncasecmp(countcle->name(),whom->whom, whomlen) == 0 ||
(strncasecmp(guild_mgr.GetGuildName(countcle->GuildID()), whom->whom, whomlen) == 0) ||
(tmpZone != 0 && strncasecmp(tmpZone, whom->whom, whomlen) == 0) ||
strncasecmp(countcle->name(),whom->whom, whomlen) == 0 ||
(strncasecmp(guild_mgr.GetGuildName(countcle->GuildID()), whom->whom, whomlen) == 0) ||
(admin >= 100 && strncasecmp(countcle->AccountName(), whom->whom, whomlen) == 0)
))
))
@@ -607,20 +607,20 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
int idx=-1;
while(iterator.MoreElements()) {
cle = iterator.GetData();
const char* tmpZone = database.GetZoneName(cle->zone());
if (
(cle->Online() >= CLE_Status_Zoning) &&
(!cle->GetGM() || cle->Anon() != 1 || admin >= cle->Admin()) &&
(!cle->GetGM() || cle->Anon() != 1 || admin >= cle->Admin()) &&
(whom == 0 || (
((cle->Admin() >= 80 && cle->GetGM()) || whom->gmlookup == 0xFFFF) &&
(whom->lvllow == 0xFFFF || (cle->level() >= whom->lvllow && cle->level() <= whom->lvlhigh && (cle->Anon()==0 || admin>cle->Admin()))) &&
(whom->wclass == 0xFFFF || (cle->class_() == whom->wclass && (cle->Anon()==0 || admin>cle->Admin()))) &&
((cle->Admin() >= 80 && cle->GetGM()) || whom->gmlookup == 0xFFFF) &&
(whom->lvllow == 0xFFFF || (cle->level() >= whom->lvllow && cle->level() <= whom->lvlhigh && (cle->Anon()==0 || admin>cle->Admin()))) &&
(whom->wclass == 0xFFFF || (cle->class_() == whom->wclass && (cle->Anon()==0 || admin>cle->Admin()))) &&
(whom->wrace == 0xFFFF || (cle->race() == whom->wrace && (cle->Anon()==0 || admin>cle->Admin()))) &&
(whomlen == 0 || (
(tmpZone != 0 && strncasecmp(tmpZone, whom->whom, whomlen) == 0) ||
strncasecmp(cle->name(),whom->whom, whomlen) == 0 ||
(strncasecmp(guild_mgr.GetGuildName(cle->GuildID()), whom->whom, whomlen) == 0) ||
(tmpZone != 0 && strncasecmp(tmpZone, whom->whom, whomlen) == 0) ||
strncasecmp(cle->name(),whom->whom, whomlen) == 0 ||
(strncasecmp(guild_mgr.GetGuildName(cle->GuildID()), whom->whom, whomlen) == 0) ||
(admin >= 100 && strncasecmp(cle->AccountName(), whom->whom, whomlen) == 0)
))
))
@@ -676,7 +676,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
formatstring=5023;//display guild
else if(cle->Anon()==2 && admin>=cle->Admin() && admin>0)
formatstring=5022;//display everything
//war* wars2 = (war*)pack2->pBuffer;
uint32 plclass_=0;
@@ -695,20 +695,20 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
zonestring=5006;
plzone=cle->zone();
}
if(admin>=cle->Admin() && admin>0)
unknown80[0]=cle->Admin();
else
unknown80[0]=0xFFFFFFFF;
unknown80[1]=0xFFFFFFFF;//1035
//char plstatus[20]={0};
//sprintf(plstatus, "Status %i",cle->Admin());
char plname[64]={0};
strcpy(plname,cle->name());
char placcount[30]={0};
if(admin>=cle->Admin() && admin>0)
strcpy(placcount,cle->AccountName());
@@ -803,7 +803,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon
try{
ClientListEntry* cle;
int FriendsOnline = FriendsCLEs.size();
int PacketLength = sizeof(WhoAllReturnStruct) + (47 * FriendsOnline) + TotalLength;
int PacketLength = sizeof(WhoAllReturnStruct) + (47 * FriendsOnline) + TotalLength;
ServerPacket* pack2 = new ServerPacket(ServerOP_WhoAllReply, PacketLength);
memset(pack2->pBuffer,0,pack2->size);
uchar *buffer=pack2->pBuffer;
@@ -833,7 +833,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon
for(int CLEEntry = 0; CLEEntry < FriendsOnline; CLEEntry++) {
cle = FriendsCLEs[CLEEntry];
char GuildName[67]={0};
if (cle->GuildID() != GUILD_NONE && cle->GuildID()>0)
sprintf(GuildName,"<%s>", guild_mgr.GetGuildName(cle->GuildID()));
@@ -855,11 +855,11 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon
PlayerRace=cle->race();
ZoneMSGID=5006; // 5006 ZONE: %1
PlayerZone=cle->zone();
}
}
char PlayerName[64]={0};
strcpy(PlayerName,cle->name());
WhoAllPlayerPart1* WAPP1 = (WhoAllPlayerPart1*)bufptr;
WAPP1->FormatMSGID = FormatMSGID;
@@ -895,7 +895,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon
pack2->Deflate();
SendPacket(FriendsWho->FromName,pack2);
safe_delete(pack2);
}
}
catch(...){
_log(WORLD__ZONELIST_ERR,"Unknown error in world's SendFriendsWho (probably mem error), ignoring...");
return;
@@ -1000,20 +1000,20 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
if (
(cle->Online() >= CLE_Status_Zoning)
&& (whom == 0 || (
((cle->Admin() >= 80 && cle->GetGM()) || whom->gmlookup == 0xFFFF) &&
(whom->lvllow == 0xFFFF || (cle->level() >= whom->lvllow && cle->level() <= whom->lvlhigh)) &&
(whom->wclass == 0xFFFF || cle->class_() == whom->wclass) &&
(whom->wrace == 0xFFFF || cle->race() == whom->wrace) &&
((cle->Admin() >= 80 && cle->GetGM()) || whom->gmlookup == 0xFFFF) &&
(whom->lvllow == 0xFFFF || (cle->level() >= whom->lvllow && cle->level() <= whom->lvlhigh)) &&
(whom->wclass == 0xFFFF || cle->class_() == whom->wclass) &&
(whom->wrace == 0xFFFF || cle->race() == whom->wrace) &&
(whomlen == 0 || (
(tmpZone != 0 && strncasecmp(tmpZone, whom->whom, whomlen) == 0) ||
strncasecmp(cle->name(),whom->whom, whomlen) == 0 ||
(strncasecmp(guild_mgr.GetGuildName(cle->GuildID()), whom->whom, whomlen) == 0) ||
(tmpZone != 0 && strncasecmp(tmpZone, whom->whom, whomlen) == 0) ||
strncasecmp(cle->name(),whom->whom, whomlen) == 0 ||
(strncasecmp(guild_mgr.GetGuildName(cle->GuildID()), whom->whom, whomlen) == 0) ||
(admin >= 100 && strncasecmp(cle->AccountName(), whom->whom, whomlen) == 0)
))
))
) {
line[0] = 0;
// MYRA - use new (5.x) Status labels in who for telnet connection
// MYRA - use new (5.x) Status labels in who for telnet connection
if (cle->Admin() >=250)
strcpy(tmpgm, "* GM-Impossible * ");
else if (cle->Admin() >= 200)
@@ -1046,7 +1046,7 @@ void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct*
strcpy(tmpgm, "* Steward * ");
else
tmpgm[0] = 0;
// end Myra
// end Myra
if (guild_mgr.GuildExists(cle->GuildID())) {
snprintf(tmpguild, 36, " <%s>", guild_mgr.GetGuildName(cle->GuildID()));
@@ -1180,7 +1180,7 @@ void ClientList::ZoneBootup(ZoneServer* zs) {
while(iterator.MoreElements())
{
if (iterator.GetData()->WaitingForBootup()) {
if (iterator.GetData()->GetZoneID() == zs->GetZoneID()
if (iterator.GetData()->GetZoneID() == zs->GetZoneID()
&& iterator.GetData()->GetInstanceID() == zs->GetInstanceID()) {
iterator.GetData()->EnterWorld(false);
}
@@ -1236,7 +1236,7 @@ bool ClientList::SendPacket(const char* to, ServerPacket* pack) {
void ClientList::SendGuildPacket(uint32 guild_id, ServerPacket* pack) {
set<uint32> zone_ids;
LinkedListIterator<ClientListEntry*> iterator(clientlist);
iterator.Reset();
@@ -1246,7 +1246,7 @@ void ClientList::SendGuildPacket(uint32 guild_id, ServerPacket* pack) {
}
iterator.Advance();
}
//now we know all the zones, send it to each one... this is kinda a shitty way to do this
//since its basically O(n^2)
set<uint32>::iterator cur, end;
@@ -1279,7 +1279,7 @@ int ClientList::GetClientCount() {
void ClientList::GetClients(const char *zone_name, vector<ClientListEntry *> &res) {
LinkedListIterator<ClientListEntry *> iterator(clientlist);
iterator.Reset();
if(zone_name[0] == '\0') {
while(iterator.MoreElements()) {
ClientListEntry* tmp = iterator.GetData();
+9 -9
View File
@@ -20,9 +20,9 @@ class ClientList {
public:
ClientList();
~ClientList();
void Process();
//from old ClientList
void Add(Client* client);
Client* Get(uint32 ip, uint16 port);
@@ -31,10 +31,10 @@ public:
void ZoneBootup(ZoneServer* zs);
void RemoveCLEReferances(ClientListEntry* cle);
//from ZSList
void SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_Struct* whom, WorldTCPConnection* connection);
void SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPConnection* connection);
void SendOnlineGuildMembers(uint32 FromID, uint32 GuildID);
@@ -45,7 +45,7 @@ public:
bool SendPacket(const char* to, ServerPacket* pack);
void SendGuildPacket(uint32 guild_id, ServerPacket* pack);
void ClientUpdate(ZoneServer* zoneserver, ServerClientList_Struct* scl);
void CLERemoveZSRef(ZoneServer* iZS);
ClientListEntry* CheckAuth(uint32 iLSID, const char* iKey);
@@ -62,16 +62,16 @@ public:
void CLEKeepAlive(uint32 numupdates, uint32* wid);
void CLEAdd(uint32 iLSID, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin = 0, uint32 ip = 0, uint8 local=0);
void UpdateClientGuild(uint32 char_id, uint32 guild_id);
int GetClientCount();
void GetClients(const char *zone_name, std::vector<ClientListEntry *> &into);
protected:
inline uint32 GetNextCLEID() { return NextCLEID++; }
//this is the list of people actively connected to zone
LinkedList<Client*> list;
//this is the list of people in any zone, not nescesarily connected to world
Timer CLStale_timer;
uint32 NextCLEID;
+4 -4
View File
@@ -230,7 +230,7 @@ bool Console::Process() {
if(tcpc->GetMode() == EmuTCPConnection::modeConsole)
tcpc->Send((const uchar*) "Username: ", strlen("Username: "));
}
if (timeout_timer.Check()) {
SendMessage(1, 0);
SendMessage(1, "Timeout, disconnecting...");
@@ -239,7 +239,7 @@ bool Console::Process() {
_log(WORLD__CONSOLE,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort());
return false;
}
if (tcpc->GetMode() == EmuTCPConnection::modePacket) {
struct in_addr in;
in.s_addr = GetIP();
@@ -498,7 +498,7 @@ void Console::ProcessCommand(const char* command) {
else if (database.SetLocalPassword(tmpid, sep.arg[2]))
SendMessage(1, "Password changed.");
else
SendMessage(1, "Error changing password.");
SendMessage(1, "Error changing password.");
}
}
else if (strcasecmp(sep.arg[0], "uptime") == 0) {
@@ -612,7 +612,7 @@ void Console::ProcessCommand(const char* command) {
// SCORPIOUS2K - reversed parameter order for flag
if(sep.arg[2][0]==0 || !sep.IsNumber(1))
SendMessage(1, "Usage: flag [status] [accountname]");
else
else
{
if (atoi(sep.arg[1]) > this->Admin())
SendMessage(1, "You cannot set people's status to higher than your own");
+1 -1
View File
@@ -92,7 +92,7 @@ class ConsoleList
public:
ConsoleList() {}
~ConsoleList() {}
void Add(Console* con);
void Process();
void KillAll();
+7 -7
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -58,7 +58,7 @@ void GroupLFP::SetDetails(ServerLFPUpdate_Struct *Update) {
}
for(unsigned int i=0; i<MAX_GROUP_MEMBERS; i++) {
strcpy(Members[i].Name,Update->Members[i].Name);
strcpy(Members[i].Name,Update->Members[i].Name);
// If we were passed the class/level and zone information, use that.
if(Update->Members[i].Class && Update->Members[i].Level && Update->Members[i].Zone) {
Members[i].Class = Update->Members[i].Class;
@@ -99,7 +99,7 @@ void GroupLFPList::Process() {
// Once a minute, check for clients in a LFP group who are no longer connected, and remove them.
// If the client that posted the LFP group has gone, remove the entire LFP entry.
//
// We also update the level, class and zone for each member of the group. Their class will usually
// We also update the level, class and zone for each member of the group. Their class will usually
// never change, but if the LFP group is posted while a member is zoning, it will initially be
// 'Unknown Class', so we will fill it in here.
@@ -129,7 +129,7 @@ void GroupLFPList::Process() {
// The first member entry is always the person who posted the LFP group, either
// a single ungrouped player, or the leader of the group. If (s)he is gone, remove
// the group from LFP.
if(i==0) break;
if(i==0) break;
Group->RemoveMember(i);
}
else {
@@ -266,12 +266,12 @@ void GroupLFPList::SendLFPMatches(ServerLFPMatchesRequest_Struct* smrs) {
ClientListEntry* CLE = client_list.FindCharacter(smrs->FromName);
if (CLE != nullptr) {
if (CLE->Server() != nullptr)
if (CLE->Server() != nullptr)
CLE->Server()->SendPacket(Pack);
}
else {
ZoneServer* zs = zoneserver_list.FindByName(smrs->FromName);
if (zs != nullptr)
if (zs != nullptr)
zs->SendPacket(Pack);
}
safe_delete(Pack);
+3 -3
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -37,7 +37,7 @@ public:
friend class GroupLFPList;
private:
uint32 LeaderID;
uint32 LeaderID;
uint8 MatchFilter;
uint32 FromLevel;
uint32 ToLevel;
+23 -23
View File
@@ -67,7 +67,7 @@ using namespace std;
ushort *array;
struct seminfo *__buf;
void *__pad;
};
};
#endif
#endif
@@ -141,11 +141,11 @@ int main(int argc, char** argv) {
_log(WORLD__INIT, "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");
return 0;
@@ -177,7 +177,7 @@ int main(int argc, char** argv) {
iterator.Advance();
}
}
_log(WORLD__INIT, "Connecting to MySQL...");
if (!database.Connect(
Config->DatabaseHost.c_str(),
@@ -190,7 +190,7 @@ int main(int argc, char** argv) {
}
dbasync = new DBAsync(&database);
guild_mgr.SetDatabase(&database);
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) {
@@ -270,14 +270,14 @@ int main(int argc, char** argv) {
return 0;
}
}
if(Config->WorldHTTPEnabled) {
_log(WORLD__INIT, "Starting HTTP world service...");
http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str());
} else {
_log(WORLD__INIT, "HTTP world service disabled.");
}
_log(WORLD__INIT, "Loading variables..");
database.LoadVariables();
_log(WORLD__INIT, "Loading zones..");
@@ -318,15 +318,15 @@ int main(int argc, char** argv) {
_log(WORLD__INIT_ERR, "Unable to load %s", Config->EQTimeFile.c_str());
_log(WORLD__INIT, "Loading launcher list..");
launcher_list.LoadList();
char tmp[20];
tmp[0] = '\0';
database.GetVariable("holdzones",tmp, 20);
database.GetVariable("holdzones",tmp, 20);
if ((strcasecmp(tmp, "1") == 0)) {
holdzones = true;
}
_log(WORLD__INIT, "Reboot zone modes %s",holdzones ? "ON" : "OFF");
_log(WORLD__INIT, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses());
if (RuleB(World, DeleteStaleCorpeBackups) == true) {
_log(WORLD__INIT, "Deleted %i stale player backups from database", database.DeleteStalePlayerBackups());
@@ -383,10 +383,10 @@ int main(int argc, char** argv) {
EQStream* eqs;
EmuTCPConnection* tcpc;
EQStreamInterface *eqsi;
while(RunLoops) {
Timer::SetCurrentTime();
//check the factory for any new incoming streams.
while ((eqs = eqsf.Pop())) {
//pull the stream out of the factory and give it to the stream identifier
@@ -397,10 +397,10 @@ int main(int argc, char** argv) {
_log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort()));
stream_identifier.AddStream(eqs); //takes the stream
}
//give the stream identifier a chance to do its work....
stream_identifier.Process();
//check the stream identifier for any now-identified streams
while((eqsi = stream_identifier.PopIdentified())) {
//now that we know what patch they are running, start up their client object
@@ -425,9 +425,9 @@ int main(int argc, char** argv) {
client_list.Add(client);
}
}
client_list.Process();
while ((tcpc = tcps.NewQueuePop())) {
struct in_addr in;
in.s_addr = tcpc->GetrIP();
@@ -439,26 +439,26 @@ int main(int argc, char** argv) {
{
database.PurgeExpiredInstances();
}
//check for timeouts in other threads
timeout_manager.CheckTimeouts();
loginserverlist.Process();
console_list.Process();
zoneserver_list.Process();
launcher_list.Process();
UCSLink.Process();
QSLink.Process();
LFPGroupList.Process();
adventure_manager.Process();
if (InterserverTimer.Check()) {
InterserverTimer.Start();
database.ping();
+4 -4
View File
@@ -37,7 +37,7 @@ typedef const char Const_char;
#endif
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#undef THIS
#endif
@@ -413,12 +413,12 @@ XS(XS_EQLConfig_GetZoneDetails)
RETVAL = THIS->GetZoneDetails(zone_ref);
ST(0) = sv_newmortal();
if (RETVAL.begin()!=RETVAL.end())
{
{
//NOTE: we are leaking the original ST(0) right now
HV *hv = newHV();
sv_2mortal((SV*)hv);
ST(0) = newRV((SV*)hv);
map<string,string>::const_iterator cur, end;
cur = RETVAL.begin();
end = RETVAL.end();
@@ -464,7 +464,7 @@ XS(boot_EQLConfig)
char file[256];
strncpy(file, __FILE__, 256);
file[255] = 0;
if(items != 1)
fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128];
+2 -2
View File
@@ -876,7 +876,7 @@ XS(XS_EQW_ListBugs)
Perl_croak(aTHX_ "THIS is not of type EQW");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->ListBugs(id);
ST(0) = sv_newmortal();
{
@@ -963,7 +963,7 @@ XS(XS_EQW_ResolveBug)
Perl_croak(aTHX_ "THIS is not of type EQW");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->ResolveBug(id);
}
XSRETURN_EMPTY;
+4 -4
View File
@@ -37,7 +37,7 @@ typedef const char Const_char;
#endif
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#undef THIS
#endif
@@ -199,12 +199,12 @@ XS(XS_HTTPRequest_get_all)
RETVAL = THIS->get_all();
ST(0) = sv_newmortal();
if (RETVAL.begin()!=RETVAL.end())
{
{
//NOTE: we are leaking the original ST(0) right now
HV *hv = newHV();
sv_2mortal((SV*)hv);
ST(0) = newRV((SV*)hv);
map<string,string>::const_iterator cur, end;
cur = RETVAL.begin();
end = RETVAL.end();
@@ -323,7 +323,7 @@ XS(boot_HTTPRequest)
char file[256];
strncpy(file, __FILE__, 256);
file[255] = 0;
if(items != 1)
fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128];
+3 -3
View File
@@ -25,7 +25,7 @@ void QueryServConnection::SetConnection(EmuTCPConnection *inStream)
_log(QUERYSERV__ERROR, "Incoming QueryServ Connection while we were already connected to a QueryServ.");
Stream->Disconnect();
}
Stream = inStream;
authenticated = false;
@@ -35,7 +35,7 @@ bool QueryServConnection::Process()
{
if (!Stream || !Stream->Connected())
return false;
ServerPacket *pack = 0;
while((pack = Stream->PopPacket()))
@@ -49,7 +49,7 @@ bool QueryServConnection::Process()
uint8 tmppass[16];
MD5::Generate((const uchar*) WorldConfig::get()->SharedKey.c_str(), WorldConfig::get()->SharedKey.length(), tmppass);
if (memcmp(pack->pBuffer, tmppass, 16) == 0)
authenticated = true;
else
+3 -3
View File
@@ -20,7 +20,7 @@ void UCSConnection::SetConnection(EmuTCPConnection *inStream)
_log(UCS__ERROR, "Incoming UCS Connection while we were already connected to a UCS.");
Stream->Disconnect();
}
Stream = inStream;
authenticated = false;
@@ -30,7 +30,7 @@ bool UCSConnection::Process()
{
if (!Stream || !Stream->Connected())
return false;
ServerPacket *pack = 0;
while((pack = Stream->PopPacket()))
@@ -44,7 +44,7 @@ bool UCSConnection::Process()
uint8 tmppass[16];
MD5::Generate((const uchar*) WorldConfig::get()->SharedKey.c_str(), WorldConfig::get()->SharedKey.length(), tmppass);
if (memcmp(pack->pBuffer, tmppass, 16) == 0)
authenticated = true;
else
+15 -15
View File
@@ -66,7 +66,7 @@ void WorldGuildManager::SendGuildDelete(uint32 guild_id) {
void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
switch(pack->opcode) {
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));
@@ -74,19 +74,19 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
}
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);
//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);
//can we do anything?
}
break;
}
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));
@@ -94,18 +94,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
}
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);
//preform the local update
client_list.UpdateClientGuild(s->char_id, s->guild_id);
//broadcast this update to any zone with a member in this guild.
//client_list.SendGuildPacket(s->guild_id, pack);
//because im sick of this not working, sending it to all zones, just spends a bit more bandwidth.
zoneserver_list.SendPacket(pack);
break;
}
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));
@@ -113,31 +113,31 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
}
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
_log(GUILDS__REFRESH, "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);
//can we do anything?
}
break;
}
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));
return;
}
zoneserver_list.SendPacket(pack);
break;
}
default:
_log(GUILDS__ERROR, "Unknown packet 0x%x received from zone??", pack->opcode);
break;
+4 -4
View File
@@ -9,18 +9,18 @@ class ServerPacket;
class WorldGuildManager : public BaseGuildManager {
public:
//called by zoneserver when it receives a guild message from zone.
void ProcessZonePacket(ServerPacket *pack);
uint8 *MakeGuildMembers(uint32 guild_id, const char *prefix_name, uint32 &length); //make a guild member list packet, returns ownership of the buffer.
protected:
virtual void SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation);
virtual void SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid);
virtual void SendRankUpdate(uint32 CharID) { return; }
virtual void SendGuildDelete(uint32 guild_id);
//map<uint32, uint32> m_tribute; //map from guild ID to current tribute ammount
};
+2 -2
View File
@@ -11,7 +11,7 @@ void log_message_clientVA(LogType type, Client *who, const char *fmt, va_list ar
char prefix_buffer[256];
snprintf(prefix_buffer, 255, "[%s] %s: ", log_type_info[type].name, who->GetAccountName());
prefix_buffer[255] = '\0';
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args);
}
@@ -34,7 +34,7 @@ void log_message_zoneVA(LogType type, ZoneServer *who, const char *fmt, va_list
snprintf(prefix_buffer, 255, "[%s] %s ", log_type_info[type].name, zone_tag);
prefix_buffer[255] = '\0';
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args);
}
+50 -50
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -41,7 +41,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
MYSQL_RES *result;
MYSQL_ROW row;
Inventory *inv;
for (int i=0; i<10; i++) {
strcpy(cs->name[i], "<none>");
cs->zone[i] = 0;
@@ -49,10 +49,10 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
cs->tutorial[i] = 0;
cs->gohome[i] = 0;
}
int char_num = 0;
unsigned long* lengths;
// Populate character info
if (RunQuery(query, MakeAnyLenString(&query, "SELECT name,profile,zonename,class,level FROM character_ WHERE account_id=%i order by name limit 10", account_id), errbuf, &result)) {
safe_delete_array(query);
@@ -66,7 +66,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
PlayerProfile_Struct* pp = (PlayerProfile_Struct*)row[1];
uint8 clas = atoi(row[3]);
uint8 lvl = atoi(row[4]);
// Character information
if(lvl == 0)
cs->level[char_num] = pp->level; //no level in DB, trust PP
@@ -214,7 +214,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
{
printf("Error loading inventory for %s\n", cs->name[char_num]);
}
safe_delete(inv);
safe_delete(inv);
if (++char_num > 10)
break;
}
@@ -233,7 +233,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
safe_delete_array(query);
return;
}
return;
}
@@ -268,15 +268,15 @@ int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) {
if(!strcmp(BindZoneName, "UNKNWN")) return pp.zone_id;
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET zonename = '%s',zoneid=%i,x=%f, y=%f, z=%f, instanceid=0 WHERE id='%i'",
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET zonename = '%s',zoneid=%i,x=%f, y=%f, z=%f, instanceid=0 WHERE id='%i'",
BindZoneName, pp.binds[bindnum].zoneId, pp.binds[bindnum].x, pp.binds[bindnum].y, pp.binds[bindnum].z,
CharID), errbuf, 0,&affected_rows)) {
return pp.zone_id;
}
safe_delete_array(query);
return pp.binds[bindnum].zoneId;
return pp.binds[bindnum].zoneId;
}
bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc)
@@ -301,26 +301,26 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
in_cc->race), errbuf, &result))
{
LogFile->write(EQEMuLog::Error, "Start zone query failed: %s : %s\n", query, errbuf);
safe_delete_array(query);
safe_delete_array(query);
return false;
}
LogFile->write(EQEMuLog::Status, "Start zone query: %s\n", query);
safe_delete_array(query);
safe_delete_array(query);
if((rows = mysql_num_rows(result)) > 0)
row = mysql_fetch_row(result);
if(row)
{
{
LogFile->write(EQEMuLog::Status, "Found starting location in start_zones");
in_pp->x = atof(row[0]);
in_pp->y = atof(row[1]);
in_pp->z = atof(row[2]);
in_pp->heading = atof(row[3]);
in_pp->zone_id = atoi(row[4]);
in_pp->binds[0].zoneId = atoi(row[5]);
}
in_pp->x = atof(row[0]);
in_pp->y = atof(row[1]);
in_pp->z = atof(row[2]);
in_pp->heading = atof(row[3]);
in_pp->zone_id = atoi(row[4]);
in_pp->binds[0].zoneId = atoi(row[5]);
}
else
{
printf("No start_zones entry in database, using defaults\n");
@@ -387,19 +387,19 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
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;
@@ -418,8 +418,8 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
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);
if(result)
mysql_free_result(result);
if(result)
mysql_free_result(result);
return true;
}
@@ -453,26 +453,26 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru
in_cc->race), errbuf, &result))
{
LogFile->write(EQEMuLog::Status, "SoF Start zone query failed: %s : %s\n", query, errbuf);
safe_delete_array(query);
safe_delete_array(query);
return false;
}
LogFile->write(EQEMuLog::Status, "SoF Start zone query: %s\n", query);
safe_delete_array(query);
safe_delete_array(query);
if((rows = mysql_num_rows(result)) > 0)
row = mysql_fetch_row(result);
if(row)
{
{
LogFile->write(EQEMuLog::Status, "Found starting location in start_zones");
in_pp->x = atof(row[0]);
in_pp->y = atof(row[1]);
in_pp->z = atof(row[2]);
in_pp->heading = atof(row[3]);
in_pp->x = atof(row[0]);
in_pp->y = atof(row[1]);
in_pp->z = atof(row[2]);
in_pp->heading = atof(row[3]);
in_pp->zone_id = in_cc->start_zone;
in_pp->binds[0].zoneId = atoi(row[4]);
}
in_pp->binds[0].zoneId = atoi(row[4]);
}
else
{
printf("No start_zones entry in database, using defaults\n");
@@ -493,8 +493,8 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru
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);
if(result)
mysql_free_result(result);
if(result)
mysql_free_result(result);
return true;
}
@@ -503,9 +503,9 @@ void WorldDatabase::GetLauncherList(std::vector<std::string> &rl) {
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
rl.clear();
if (RunQuery(query, MakeAnyLenString(&query,
"SELECT name FROM launcher" )
, errbuf, &result))
@@ -530,14 +530,14 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) {
if(RuleB(Chat, EnableMailKeyIPVerification) == true)
sprintf(MailKeyString, "%08X%08X", IPAddress, MailKey);
else
else
sprintf(MailKeyString, "%08X", MailKey);
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET mailkey = '%s' WHERE id='%i'",
MailKeyString, CharID), errbuf))
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET mailkey = '%s' WHERE id='%i'",
MailKeyString, CharID), errbuf))
LogFile->write(EQEMuLog::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, errbuf);
safe_delete_array(query);
}
@@ -548,7 +548,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if(RunQuery(query, MakeAnyLenString(&query, "SELECT level FROM character_ WHERE name='%s'", name), errbuf, &result))
{
if(row = mysql_fetch_row(result))
@@ -560,7 +560,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
}
mysql_free_result(result);
}
else
else
{
LogFile->write(EQEMuLog::Error, "WorldDatabase::GetCharacterLevel: %s", errbuf);
}
+6 -6
View File
@@ -4,13 +4,13 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -30,10 +30,10 @@ 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);
void GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*);
int MoveCharacterToBind(int CharID, uint8 bindnum = 0);
void GetLauncherList(std::vector<std::string> &result);
void SetMailKey(int CharID, int IPAddress, int MailKey);
bool GetCharacterLevel(const char *name, int &level);
@@ -41,10 +41,10 @@ public:
bool LoadCharacterCreateAllocations();
bool LoadCharacterCreateCombos();
protected:
};
extern WorldDatabase database;
extern WorldDatabase database;
#endif /*WORLDDB_H_*/
+9 -9
View File
@@ -75,7 +75,7 @@ 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;
@@ -118,7 +118,7 @@ void ZSList::Process() {
bool ZSList::SendPacket(ServerPacket* pack) {
LinkedListIterator<ZoneServer*> iterator(list);
iterator.Reset();
while(iterator.MoreElements()) {
iterator.GetData()->SendPacket(pack);
@@ -158,7 +158,7 @@ bool ZSList::SendPacket(uint32 ZoneID, uint16 instanceID, ServerPacket* pack) {
else
{
while(iterator.MoreElements()) {
if (iterator.GetData()->GetZoneID() == ZoneID
if (iterator.GetData()->GetZoneID() == ZoneID
&& iterator.GetData()->GetInstanceID() == 0) {
ZoneServer* tmp = iterator.GetData();
return(tmp->SendPacket(pack));
@@ -283,7 +283,7 @@ void ZSList::ListLockedZones(const char* to, WorldTCPConnection* connection) {
void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* connection) {
LinkedListIterator<ZoneServer*> iterator(list);
struct in_addr in;
iterator.Reset();
char locked[4];
if (WorldConfig::get()->Locked == true)
@@ -458,7 +458,7 @@ void ZSList::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_m
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, pack->size);
ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer;
if (to) {
if (to[0] == '*') {
Console* con = console_list.FindByAccountName(&to[1]);
@@ -566,7 +566,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip
return;
}
uint32 z = MakeRandomInt(0, y-1);
ServerPacket* pack = new ServerPacket(ServerOP_ZoneReboot, sizeof(ServerZoneReboot_Struct));
ServerZoneReboot_Struct* s = (ServerZoneReboot_Struct*) pack->pBuffer;
// strcpy(s->ip1,ip1);
@@ -592,7 +592,7 @@ uint16 ZSList::GetAvailableZonePort()
i=LastAllocatedPort+1;
while(i!=LastAllocatedPort && port==0) {
if (i>Config->ZonePortHigh)
if (i>Config->ZonePortHigh)
i=Config->ZonePortLow;
if (!FindByPort(i)) {
@@ -683,7 +683,7 @@ uint32 ZSList::TriggerBootup(uint32 iZoneID, uint32 iInstanceID) {
}
uint32 z = rand() % y;
tmp[z]->TriggerBootup(iZoneID);
uint32 ret = tmp[z]->GetID();
safe_delete(tmp);
@@ -713,7 +713,7 @@ void ZSList::GetZoneIDList(vector<uint32> &zones) {
zones.push_back(zs->GetID());
iterator.Advance();
}
}
void ZSList::WorldShutDown(uint32 time, uint32 interval)
+5 -5
View File
@@ -15,7 +15,7 @@ class ZSList
{
public:
enum { MaxLockedZones = 10 };
static void ShowUpTime(WorldTCPConnection* con, const char* adminname = 0);
ZSList();
@@ -25,7 +25,7 @@ public:
ZoneServer* FindByZoneID(uint32 ZoneID);
ZoneServer* FindByPort(uint16 port);
ZoneServer* FindByInstanceID(uint32 InstanceID);
void SendChannelMessage(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...);
void SendChannelMessageRaw(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message);
void SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message, ...);
@@ -33,7 +33,7 @@ public:
void SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* connection);
void SendTimeSync();
void SendTimeSync();
void Add(ZoneServer* zoneserver);
void Process();
void KillAll();
@@ -64,8 +64,8 @@ protected:
uint16 pLockedZones[MaxLockedZones];
uint32 CurGroupID;
uint16 LastAllocatedPort;
};
+22 -22
View File
@@ -48,7 +48,7 @@ extern UCSConnection UCSLink;
extern QueryServConnection QSLink;
void CatchSignal(int sig_num);
ZoneServer::ZoneServer(EmuTCPConnection* itcpc)
ZoneServer::ZoneServer(EmuTCPConnection* itcpc)
: WorldTCPConnection(), tcpc(itcpc), ls_zboot(5000) {
ID = zoneserver_list.GetNextID();
memset(zone_name, 0, sizeof(zone_name));
@@ -72,12 +72,12 @@ ZoneServer::~ZoneServer() {
bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
BootingUp = false;
const char* zn = MakeLowerString(database.GetZoneName(iZoneID));
char* longname;
if (iZoneID)
zlog(WORLD__ZONE,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID,
zlog(WORLD__ZONE,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID,
iStaticZone ? " (Static)" : "");
zoneID = iZoneID;
@@ -107,7 +107,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
{
strcpy(zone_name, "");
strcpy(long_name, "");
}
}
client_list.ZoneBootup(this);
ls_zboot.Start();
@@ -497,7 +497,7 @@ bool ZoneServer::Process() {
case ServerOP_VoiceMacro: {
ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer;
if(svm->Type == VoiceMacroTell) {
ClientListEntry* cle = client_list.FindCharacter(svm->To);
@@ -548,7 +548,7 @@ bool ZoneServer::Process() {
if(pack->size != sizeof(SetZone_Struct))
break;
SetZone_Struct* szs = (SetZone_Struct*) pack->pBuffer;
SetZone_Struct* szs = (SetZone_Struct*) pack->pBuffer;
if (szs->zoneid != 0) {
if(database.GetZoneName(szs->zoneid))
SetZone(szs->zoneid, szs->instanceid, szs->staticzone);
@@ -661,7 +661,7 @@ bool ZoneServer::Process() {
// called, so it will be available when they ask to zone.
//
if(pack->size != sizeof(ZoneToZone_Struct))
break;
ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
@@ -783,7 +783,7 @@ 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);
zlog(GUILDS__IN_PACKETS, "ServerOP_RequestOnlineGuildMembers Recieved. FromID=%i GuildID=%i", srogms->FromID, srogms->GuildID);
client_list.SendOnlineGuildMembers(srogms->FromID, srogms->GuildID);
break;
}
@@ -825,8 +825,8 @@ bool ZoneServer::Process() {
break;
}
case ServerOP_LFPUpdate: {
ServerLFPUpdate_Struct* sus = (ServerLFPUpdate_Struct*) pack->pBuffer;
if(sus->Action)
ServerLFPUpdate_Struct* sus = (ServerLFPUpdate_Struct*) pack->pBuffer;
if(sus->Action)
LFPGroupList.UpdateGroup(sus);
else
LFPGroupList.RemoveGroup(sus);
@@ -845,7 +845,7 @@ bool ZoneServer::Process() {
zoneserver_list.SendPacket(pack);
break;
}
case ServerOP_GuildRankUpdate:
{
zoneserver_list.SendPacket(pack);
@@ -859,7 +859,7 @@ bool ZoneServer::Process() {
guild_mgr.ProcessZonePacket(pack);
break;
}
case ServerOP_FlagUpdate: {
ClientListEntry* cle = client_list.FindCLEByAccountID(*((uint32*) pack->pBuffer));
if (cle)
@@ -893,7 +893,7 @@ bool ZoneServer::Process() {
break;
}
ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer;
if (slock->mode >= 1)
if (slock->mode >= 1)
WorldConfig::LockWorld();
else
WorldConfig::UnlockWorld();
@@ -907,7 +907,7 @@ bool ZoneServer::Process() {
else {
if (slock->mode >= 1)
this->SendEmoteMessage(slock->myname, 0, 0, 13, "World locked, but login server not connected.");
else
else
this->SendEmoteMessage(slock->myname, 0, 0, 13, "World unlocked, but login server not conencted.");
}
break;
@@ -946,7 +946,7 @@ bool ZoneServer::Process() {
case ServerOP_GetWorldTime: {
zlog(WORLD__ZONE,"Broadcasting a world time update");
ServerPacket* pack = new ServerPacket;
pack->opcode = ServerOP_SyncWorldTime;
pack->size = sizeof(eqTimeOfDay);
pack->pBuffer = new uchar[pack->size];
@@ -1177,7 +1177,7 @@ bool ZoneServer::Process() {
}
zoneserver_list.SendPacket(pack);
break;
break;
}
case ServerOP_QGlobalDelete:
@@ -1188,7 +1188,7 @@ bool ZoneServer::Process() {
}
zoneserver_list.SendPacket(pack);
break;
break;
}
case ServerOP_AdventureRequest:
@@ -1260,7 +1260,7 @@ bool ZoneServer::Process() {
break;
}
case ServerOP_UCSMailMessage:
case ServerOP_UCSMailMessage:
{
UCSLink.SendPacket(pack);
break;
@@ -1325,7 +1325,7 @@ bool ZoneServer::Process() {
}
delete pack;
}
}
return true;
}
@@ -1351,7 +1351,7 @@ void ZoneServer::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, pack->size);
ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer;
if (to != 0) {
strcpy((char *) sem->to, to);
}
@@ -1363,7 +1363,7 @@ void ZoneServer::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16
sem->minstatus = to_minstatus;
sem->type = type;
strcpy(&sem->message[0], message);
pack->Deflate();
SendPacket(pack);
delete pack;
@@ -1397,7 +1397,7 @@ void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* a
s->ZoneServerID = ID;
if (adminname != 0)
strcpy(s->adminname, adminname);
if (iZoneID == 0)
s->zoneid = this->GetZoneID();
else
+1 -1
View File
@@ -32,7 +32,7 @@ public:
ZoneServer(EmuTCPConnection* itcpc);
~ZoneServer();
virtual inline bool IsZoneServer() { return true; }
bool Process();
bool SendPacket(ServerPacket* pack) { return tcpc->SendPacket(pack); }
void SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message, ...);