Conflicts:
	common/debug.cpp
	common/debug.h
	zone/PlayerCorpse.cpp
	zone/beacon.cpp
	zone/client.cpp
	zone/net.cpp
	zone/tribute.cpp
This commit is contained in:
Arthur Ice
2013-05-19 16:19:22 -07:00
618 changed files with 38296 additions and 39038 deletions
+9 -8
View File
@@ -115,8 +115,8 @@ bool Adventure::Process()
else if(status == AS_WaitingForPrimaryEndTime)
{
//Do partial failure: send a message to the clients that they can only get a certain amount of points.
SendAdventureMessage(13, "You failed to complete your adventure in time. Complete your adventure goal within 30 minutes to "
"receive a lesser reward. This adventure will end in 30 minutes and your party will be ejected from the dungeon.");
SendAdventureMessage(13, "You failed to complete your adventure in time. Complete your adventure goal within 30 minutes to "
"receive a lesser reward. This adventure will end in 30 minutes and your party will be ejected from the dungeon.");
SetStatus(AS_WaitingForSecondaryEndTime);
}
else
@@ -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);
}
@@ -435,4 +435,5 @@ void Adventure::MoveCorpsesToGraveyard()
iter++;
c_iter++;
}
}
}
+50 -50
View File
@@ -67,9 +67,9 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
return;
}
/**
* This block checks to see if we actually have any adventures for the requested theme.
*/
/**
* 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);
if(adv_list_iter == adventure_entries.end())
{
@@ -84,10 +84,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
}
/**
* This block checks to see if our requested group has anyone with an "Active" adventure
* Active being in progress, finished adventures that are still waiting to expire do not count
* Though they will count against you for which new adventure you can get.
*/
* This block checks to see if our requested group has anyone with an "Active" adventure
* Active being in progress, finished adventures that are still waiting to expire do not count
* Though they will count against you for which new adventure you can get.
*/
list<Adventure*>::iterator iter = adventure_list.begin();
while(iter != adventure_list.end())
{
@@ -117,9 +117,9 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
}
/**
* Now we need to get every available adventure for our selected theme and exclude ones we can't use.
* ie. the ones that would cause overlap issues for new adventures with the old unexpired adventures.
*/
* Now we need to get every available adventure for our selected theme and exclude ones we can't use.
* ie. the ones that would cause overlap issues for new adventures with the old unexpired adventures.
*/
list<AdventureZones> excluded_zones;
list<AdventureZoneIn> excluded_zone_ins;
for(int i = 0; i < sar->member_count; ++i)
@@ -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;
@@ -149,9 +149,9 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
list<AdventureTemplate*> eligible_adventures = adventure_entries[sar->template_id];
/**
* Remove zones from eligible zones based on their difficulty and type.
* ie only use difficult zones for difficult, collect for collect, etc.
*/
* Remove zones from eligible zones based on their difficulty and type.
* ie only use difficult zones for difficult, collect for collect, etc.
*/
list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
while(ea_iter != eligible_adventures.end())
{
@@ -170,8 +170,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
}
/**
* Get levels for this group.
*/
* Get levels for this group.
*/
int valid_count = 0;
int avg_level = 0;
int min_level = 40000;
@@ -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();
@@ -263,8 +263,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
}
/**
* Remove the zones from our eligible zones based on the exclusion above
*/
* Remove the zones from our eligible zones based on the exclusion above
*/
list<AdventureZones>::iterator ez_iter = excluded_zones.begin();
while(ez_iter != excluded_zones.end())
{
@@ -282,7 +282,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
}
list<AdventureZoneIn>::iterator ezi_iter = excluded_zone_ins.begin();
while(ezi_iter != excluded_zone_ins.end())
while(ezi_iter != excluded_zone_ins.end())
{
list<AdventureTemplate*>::iterator ea_iter = eligible_adventures.begin();
while(ea_iter != eligible_adventures.end())
@@ -297,9 +297,9 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
ezi_iter++;
}
/**
* Remove Zones based on level
*/
/**
* Remove Zones based on level
*/
ea_iter = eligible_adventures.begin();
while(ea_iter != eligible_adventures.end())
{
@@ -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())
+70 -67
View File
@@ -1,66 +1,66 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(world_sources
Adventure.cpp
AdventureManager.cpp
client.cpp
cliententry.cpp
clientlist.cpp
CMakeLists.txt
console.cpp
EQLConfig.cpp
EQW.cpp
EQWHTTPHandler.cpp
EQWParser.cpp
HTTPRequest.cpp
LauncherLink.cpp
LauncherList.cpp
lfplist.cpp
LoginServer.cpp
LoginServerList.cpp
net.cpp
perl_EQLConfig.cpp
perl_EQW.cpp
perl_HTTPRequest.cpp
queryserv.cpp
ucs.cpp
wguild_mgr.cpp
world_logsys.cpp
WorldConfig.cpp
worlddb.cpp
zonelist.cpp
zoneserver.cpp
Adventure.cpp
AdventureManager.cpp
client.cpp
cliententry.cpp
clientlist.cpp
CMakeLists.txt
console.cpp
EQLConfig.cpp
EQW.cpp
EQWHTTPHandler.cpp
EQWParser.cpp
HTTPRequest.cpp
LauncherLink.cpp
LauncherList.cpp
lfplist.cpp
LoginServer.cpp
LoginServerList.cpp
net.cpp
perl_EQLConfig.cpp
perl_EQW.cpp
perl_HTTPRequest.cpp
queryserv.cpp
ucs.cpp
wguild_mgr.cpp
world_logsys.cpp
WorldConfig.cpp
worlddb.cpp
zonelist.cpp
zoneserver.cpp
)
SET(world_headers
Adventure.h
AdventureManager.h
AdventureTemplate.h
client.h
cliententry.h
clientlist.h
CMakeLists.txt
console.h
EQLConfig.h
EQW.h
EQWHTTPHandler.h
EQWParser.h
HTTPRequest.h
LauncherLink.h
LauncherList.h
lfplist.h
LoginServer.h
LoginServerList.h
net.h
queryserv.h
SoFCharCreateData.h
ucs.h
wguild_mgr.h
WorldConfig.h
worlddb.h
WorldTCPConnection.h
zonelist.h
zoneserver.h
Adventure.h
AdventureManager.h
AdventureTemplate.h
client.h
cliententry.h
clientlist.h
CMakeLists.txt
console.h
EQLConfig.h
EQW.h
EQWHTTPHandler.h
EQWParser.h
HTTPRequest.h
LauncherLink.h
LauncherList.h
lfplist.h
LoginServer.h
LoginServerList.h
net.h
queryserv.h
SoFCharCreateData.h
ucs.h
wguild_mgr.h
WorldConfig.h
worlddb.h
WorldTCPConnection.h
zonelist.h
zoneserver.h
)
ADD_EXECUTABLE(world ${world_sources} ${world_headers})
@@ -70,22 +70,25 @@ 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")
SET_TARGET_PROPERTIES(world PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
TARGET_LINK_LIBRARIES(world "Ws2_32.lib")
ENDIF(MSVC)
IF(MINGW)
TARGET_LINK_LIBRARIES(world "WS2_32")
TARGET_LINK_LIBRARIES(world "WS2_32")
ENDIF(MINGW)
IF(UNIX)
TARGET_LINK_LIBRARIES(world "dl")
TARGET_LINK_LIBRARIES(world "z")
TARGET_LINK_LIBRARIES(world "m")
TARGET_LINK_LIBRARIES(world "rt")
TARGET_LINK_LIBRARIES(world "pthread")
ADD_DEFINITIONS(-fPIC)
IF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(world "dl")
ENDIF(NOT FREEBSD)
TARGET_LINK_LIBRARIES(world "z")
TARGET_LINK_LIBRARIES(world "m")
TARGET_LINK_LIBRARIES(world "rt")
TARGET_LINK_LIBRARIES(world "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
SET(EXECUTABLE_OUTPUT_PATH ../Bin)
+31 -56
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "EQLConfig.h"
@@ -39,7 +39,7 @@ void EQLConfig::LoadSettings() {
MYSQL_ROW row;
LauncherZone tmp;
char namebuf[128];
char namebuf[128];
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
namebuf[127] = '\0';
@@ -77,15 +77,15 @@ void EQLConfig::LoadSettings() {
EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
char namebuf[128];
char namebuf[128];
database.DoEscapeString(namebuf, name, strlen(name)&0x3F); //limit len to 64
namebuf[127] = '\0';
if (!database.RunQuery(query, MakeAnyLenString(&query,
"INSERT INTO launcher (name,dynamics) VALUES('%s', %d)",
namebuf, dynamic_count), errbuf)) {
namebuf, dynamic_count), errbuf)) {
LogFile->write(EQEMuLog::Error, "Error in CreateLauncher query: %s", errbuf);
safe_delete_array(query);
return nullptr;
@@ -127,9 +127,9 @@ void EQLConfig::DeleteLauncher() {
launcher_list.Remove(m_name.c_str());
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
char namebuf[128];
char namebuf[128];
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
namebuf[127] = '\0';
@@ -185,18 +185,18 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
//database update
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
char namebuf[128];
char namebuf[128];
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
namebuf[127] = '\0';
char zonebuf[32];
char zonebuf[32];
database.DoEscapeString(zonebuf, short_name, strlen(short_name)&0xF); //limit len to 16
zonebuf[31] = '\0';
if (!database.RunQuery(query, MakeAnyLenString(&query,
"INSERT INTO launcher_zones (launcher,zone,port) VALUES('%s', '%s', %d)",
namebuf, zonebuf, port), errbuf)) {
namebuf, zonebuf, port), errbuf)) {
LogFile->write(EQEMuLog::Error, "Error in BootStaticZone query: %s", errbuf);
safe_delete_array(query);
return false;
@@ -235,18 +235,18 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
//database update
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
char namebuf[128];
char namebuf[128];
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
namebuf[127] = '\0';
char zonebuf[32];
char zonebuf[32];
database.DoEscapeString(zonebuf, short_name, strlen(short_name)&0xF); //limit len to 16
zonebuf[31] = '\0';
if (!database.RunQuery(query, MakeAnyLenString(&query,
"UPDATE launcher_zones SET port=%d WHERE launcher='%s' AND zone='%s'",
port, namebuf, zonebuf), errbuf)) {
port, namebuf, zonebuf), errbuf)) {
LogFile->write(EQEMuLog::Error, "Error in ChangeStaticZone query: %s", errbuf);
safe_delete_array(query);
return false;
@@ -278,12 +278,12 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
//database update
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
char namebuf[128];
char namebuf[128];
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
namebuf[127] = '\0';
char zonebuf[32];
char zonebuf[32];
database.DoEscapeString(zonebuf, short_name, strlen(short_name)&0xF); //limit len to 16
zonebuf[31] = '\0';
@@ -310,15 +310,15 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
bool EQLConfig::SetDynamicCount(int count) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
char *query = 0;
char namebuf[128];
char namebuf[128];
database.DoEscapeString(namebuf, m_name.c_str(), m_name.length()&0x3F); //limit len to 64
namebuf[127] = '\0';
if (!database.RunQuery(query, MakeAnyLenString(&query,
"UPDATE launcher SET dynamics=%d WHERE name='%s'",
count, namebuf), errbuf)) {
count, namebuf), errbuf)) {
LogFile->write(EQEMuLog::Error, "Error in SetDynamicCount query: %s", errbuf);
safe_delete_array(query);
return false;
@@ -357,28 +357,3 @@ map<string,string> EQLConfig::GetZoneDetails(Const_char *zone_ref) {
return(res);
}
+25 -31
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EQLCONFIG_H_
#define EQLCONFIG_H_
@@ -36,47 +36,41 @@ 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;
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.
};
#endif /*EQLCONFIG_H_*/
+82 -100
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
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
*/
#ifdef EMBPERL
@@ -55,26 +55,23 @@ extern LoginServerList loginserverlist;
extern LauncherList launcher_list;
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;
if (items < 2)
return;
dXSARGS;
if (items < 2)
return;
int r;
for(r = 1; r < items; r++) {
char *str = SvPV_nolen(ST(r));
EQW::Singleton()->AppendOutput(str);
}
XSRETURN_EMPTY;
}
XSRETURN_EMPTY;
}
EQW::EQW() {
@@ -120,29 +117,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 +148,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 +156,7 @@ map<string,string> EQW::GetZoneDetails(Const_char *zone_ref) {
if(ll != nullptr)
res["launcher"] = ll->GetName();
}
return(res);
}
@@ -170,10 +167,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 +182,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 +205,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 +229,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 +283,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 +299,7 @@ map<string,string> EQW::GetLaunchersDetails(Const_char *launcher_name) {
res["zone_count"] = itoa(ll->CountZones());
res["connected"] = "yes";
}
return(res);
}
@@ -341,7 +338,7 @@ bool EQW::SetDynamicCount(Const_char *launcher_name, int count) {
return(false);
}
int EQW::GetDynamicCount(Const_char *launcher_name) {
int EQW::GetDynamicCount(Const_char *launcher_name) {
return(0);
}
*/
@@ -391,72 +388,72 @@ bool EQW::SetPublicNote(uint32 charid, const char *note) {
}
int EQW::CountBugs() {
char errbuf[MYSQL_ERRMSG_SIZE];
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT count(*) FROM bugs where status = 0"), errbuf, &result)) {
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT count(*) FROM bugs where status = 0"), errbuf, &result)) {
safe_delete_array(query);
if((row = mysql_fetch_row(result))) {
int count = atoi(row[0]);
mysql_free_result(result);
return count;
}
mysql_free_result(result);
}
safe_delete_array(query);
return 0;
if((row = mysql_fetch_row(result))) {
int count = atoi(row[0]);
mysql_free_result(result);
return count;
}
mysql_free_result(result);
}
safe_delete_array(query);
return 0;
}
vector<string> EQW::ListBugs(uint32 offset) {
vector<string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
vector<string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM bugs WHERE status = 0 limit %d, 30", offset), errbuf, &result)) {
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM bugs WHERE status = 0 limit %d, 30", offset), errbuf, &result)) {
safe_delete_array(query);
while((row = mysql_fetch_row(result))) {
res.push_back(row[0]);
}
mysql_free_result(result);
}
safe_delete_array(query);
return res;
while((row = mysql_fetch_row(result))) {
res.push_back(row[0]);
}
mysql_free_result(result);
}
safe_delete_array(query);
return res;
}
map<string,string> EQW::GetBugDetails(Const_char *id) {
map<string,string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
map<string,string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if(database.RunQuery(query, MakeAnyLenString(&query, "select name, zone, x, y, z, target, bug from bugs where id = %s", id), errbuf, &result)) {
if(database.RunQuery(query, MakeAnyLenString(&query, "select name, zone, x, y, z, target, bug from bugs where id = %s", id), errbuf, &result)) {
safe_delete_array(query);
while((row = mysql_fetch_row(result))) {
res["name"] = row[0];
res["zone"] = row[1];
res["x"] = row[2];
res["y"] = row[3];
res["z"] = row[4];
res["target"] = row[5];
res["bug"] = row[6];
res["id"] = id;
}
mysql_free_result(result);
}
safe_delete_array(query);
return res;
while((row = mysql_fetch_row(result))) {
res["name"] = row[0];
res["zone"] = row[1];
res["x"] = row[2];
res["y"] = row[3];
res["z"] = row[4];
res["target"] = row[5];
res["bug"] = row[6];
res["id"] = id;
}
mysql_free_result(result);
}
safe_delete_array(query);
return res;
}
void EQW::ResolveBug(const char *id) {
vector<string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
vector<string> res;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE bugs SET status=1 WHERE id=%s", id), errbuf)) {
if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE bugs SET status=1 WHERE id=%s", id), errbuf)) {
safe_delete_array(query);
}
safe_delete_array(query);
}
safe_delete_array(query);
}
void EQW::SendMessage(uint32 type, const char *msg) {
@@ -469,18 +466,3 @@ void EQW::WorldShutDown(uint32 time, uint32 interval) {
#endif //EMBPERL
+29 -29
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EQW_H_
#define EQW_H_
@@ -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();
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();
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);
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,10 +71,10 @@ 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)
//bugs
int CountBugs();
vector<string> ListBugs(uint32 offset); //returns an array of zone_refs (opaque)
map<string,string> GetBugDetails(const char *id);
void ResolveBug(const char *id);
@@ -85,9 +85,9 @@ public:
protected:
std::string m_outputBuffer;
std::string m_returnBuffer;
bool m_worldLocked;
private:
static EQW s_EQW;
};
+43 -45
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "EQWHTTPHandler.h"
@@ -34,13 +34,13 @@ EQWParser *EQWHTTPHandler::s_parser = nullptr;
const int EQWHTTPHandler::READ_BUFFER_LEN = 1024; //for page IO, was a static const member, but VC6 got mad.
EQWHTTPHandler::EQWHTTPHandler(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort)
: HttpdSocket(ID,in_socket,irIP,irPort),
m_closeOnFinish(false)
: HttpdSocket(ID,in_socket,irIP,irPort),
m_closeOnFinish(false)
{
}
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;
@@ -192,16 +192,16 @@ void EQWHTTPHandler::SendPage(const std::string &file) {
SendBuf(buffer, len);
}
delete[] buffer;
fclose(f);
fclose(f);
#ifdef EMBPERL
if(process) {
//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);
}
@@ -336,5 +336,3 @@ ThreadReturnType EQWHTTPServer::ThreadProc(void *data) {
THREAD_RETURN(nullptr);
}*/
+32 -35
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EQWHTTPHandler_H
#define EQWHTTPHandler_H
@@ -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*/
@@ -96,6 +96,3 @@ protected:
#endif
+69 -71
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
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
*/
//a lot of this is copied from embperl.cpp, but I didnt feel like factoring the common stuff out
@@ -30,7 +30,7 @@
using namespace std;
#ifndef GvCV_set
#define GvCV_set(gv,cv) (GvCV(gv) = (cv))
#define GvCV_set(gv,cv) (GvCV(gv) = (cv))
#endif
@@ -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,29 +125,29 @@ void EQWParser::DoInit() {
"}"
"}"
,FALSE);
//make a tie-able class to capture IO and get it where it needs to go
eval_pv(
"package EQWIO; "
// "&boot_EQEmuIO;"
"sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '.$me); return($me); } "
"sub WRITE { } "
"sub PRINTF { my $me = shift; my $fmt = shift; $me->PRINT(sprintf($fmt, @_)); } "
"sub CLOSE { my $me = shift; $me->PRINT('Closing '.$me); } "
"sub DESTROY { my $me = shift; $me->PRINT('Destroying '.$me); } "
"sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '.$me); return($me); } "
"sub WRITE { } "
"sub PRINTF { my $me = shift; my $fmt = shift; $me->PRINT(sprintf($fmt, @_)); } "
"sub CLOSE { my $me = shift; $me->PRINT('Closing '.$me); } "
"sub DESTROY { my $me = shift; $me->PRINT('Destroying '.$me); } "
//this ties us for all packages
"package MAIN;"
" if(tied *STDOUT) { untie(*STDOUT); }"
" if(tied *STDERR) { untie(*STDERR); }"
" tie *STDOUT, 'EQWIO';"
" tie *STDERR, 'EQWIO';"
,FALSE);
"package MAIN;"
" if(tied *STDOUT) { untie(*STDOUT); }"
" if(tied *STDERR) { untie(*STDERR); }"
" 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,29 +168,29 @@ 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;"
"&boot_EQW;" //load our EQW XS
"package EQDB;"
"&boot_EQDB;" //load our EQW XS
"package EQDBRes;"
"&boot_EQDBRes;" //load our EQW XS
"package HTTPRequest;"
"&boot_HTTPRequest;" //load our HTTPRequest XS
"package EQLConfig;"
"&boot_EQLConfig;" //load our EQLConfig XS
"package EQW;"
"&boot_EQW;" //load our EQW XS
"package EQDB;"
"&boot_EQDB;" //load our EQW XS
"package EQDBRes;"
"&boot_EQDBRes;" //load our EQW XS
"package HTTPRequest;"
"&boot_HTTPRequest;" //load our HTTPRequest XS
"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')) { "
@@ -211,7 +211,7 @@ EQWParser::~EQWParser() {
"package quest;"
" untie *STDOUT;"
" untie *STDERR;"
,FALSE);
,FALSE);
*/
perl_free(my_perl);
}
@@ -226,26 +226,26 @@ bool EQWParser::eval_file(const char * packagename, const char * filename, std::
bool EQWParser::dosub(const char * subname, const std::vector<std::string> &args, string &error, int mode) {
bool err = false;
dSP; /* initialize stack pointer */
ENTER; /* everything created after here */
SAVETMPS; /* ...is a temporary variable. */
PUSHMARK(SP); /* remember the stack pointer */
dSP; // initialize stack pointer
ENTER; // everything created after here
SAVETMPS; // ...is a temporary variable
PUSHMARK(SP); // remember the stack pointer
if(args.size() > 0)
{
for(std::vector<std::string>::const_iterator i = args.begin(); i != args.end(); ++i)
{/* push the arguments onto the perl stack */
XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length())));
{/* push the arguments onto the perl stack */
XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length())));
}
}
PUTBACK; /* make local stack pointer global */
call_pv(subname, mode); /*eval our code*/
SPAGAIN; /* refresh stack pointer */
PUTBACK; // make local stack pointer global
call_pv(subname, mode); /*eval our code*/
SPAGAIN; // refresh stack pointer
if(SvTRUE(ERRSV)) {
err = true;
}
FREETMPS; /* free temp values */
LEAVE; /* ...and the XPUSHed "mortal" args.*/
FREETMPS; // free temp values
LEAVE; // ...and the XPUSHed "mortal" args.
if(err) {
error = "Perl runtime error: ";
error += SvPVX(ERRSV);
@@ -260,13 +260,12 @@ bool EQWParser::eval(const char * code, string &error) {
return(dosub("my_eval", arg, error, G_SCALAR|G_DISCARD|G_EVAL|G_KEEPERR));
}
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 +288,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 +297,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);
@@ -330,7 +329,6 @@ class MerchantEditor extends BaseEditor {
}
}
function dispatch() {
my $dispatcher = $this->_dispatchers[$action];
$body = new Template($dispatcher["template"]);
@@ -348,5 +346,5 @@ function dispatch() {
*/
#endif //EMBPERL
+17 -24
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EQWPARSER_H_
#define EQWPARSER_H_
@@ -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);
@@ -68,12 +68,5 @@ protected:
};
#endif //EMBPERL
#endif /*EQWPARSER_H_*/
+13 -24
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "HTTPRequest.h"
@@ -80,14 +80,3 @@ void HTTPRequest::redirect(Const_char *URL) {
SetResponseCode("302");
}
+17 -21
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef HTTPREQUEST_H_
#define HTTPREQUEST_H_
@@ -34,19 +34,18 @@ 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);
@@ -57,8 +56,5 @@ protected:
std::map<std::string, std::string> m_values;
};
#endif /*HTTPREQUEST_H_*/
+44 -44
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
@@ -37,10 +37,10 @@ extern LauncherList launcher_list;
LauncherLink::LauncherLink(int id, EmuTCPConnection *c)
: ID(id),
tcpc(c),
authenticated(false),
m_name(""),
m_bootTimer(2000)
tcpc(c),
authenticated(false),
m_name(""),
m_bootTimer(2000)
{
m_dynamicCount = 0;
m_bootTimer.Disable();
@@ -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);
@@ -78,7 +78,7 @@ bool LauncherLink::Process() {
if (memcmp(pack->pBuffer, tmppass, 16) == 0)
authenticated = true;
else {
struct in_addr in;
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__LAUNCH_ERR, "Launcher authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
@@ -89,7 +89,7 @@ bool LauncherLink::Process() {
}
}
else {
struct in_addr in;
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__LAUNCH_ERR, "Launcher authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
@@ -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,9 +186,9 @@ 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;
* std::map<std::string, bool>::const_iterator cur, end;
cur = m_states.begin();
end = m_states.end();
for(; cur != end; cur++) {
@@ -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()) {
+26 -29
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LAUNCHERLINK_H_
#define LAUNCHERLINK_H_
@@ -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()); }
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;
const int ID;
EmuTCPConnection*const tcpc;
bool authenticated;
std::string m_name;
std::string m_name;
Timer m_bootTimer;
uint8 m_dynamicCount;
typedef struct {
bool up;
uint32 starts; //number of times this zone has started
@@ -74,8 +74,5 @@ protected:
std::map<std::string, ZoneState> m_states;
};
#endif /*LAUNCHERLINK_H_*/
+21 -47
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
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()) {
@@ -194,29 +194,3 @@ void LauncherList::Remove(const char *name) {
}
}
+19 -28
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LAUNCHERLIST_H_
#define LAUNCHERLIST_H_
@@ -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
@@ -54,14 +54,5 @@ protected:
int nextID;
};
#endif /*LAUNCHERLIST_H_*/
+96 -97
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <iostream>
@@ -93,7 +93,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()))
@@ -102,100 +102,99 @@ bool LoginServer::Process() {
_hex(WORLD__LS_TRACE,pack->pBuffer,pack->size);
switch(pack->opcode) {
case 0:
break;
case ServerOP_KeepAlive: {
// ignore this
break;
}
case ServerOP_UsertoWorldReq: {
UsertoWorldRequest_Struct* utwr = (UsertoWorldRequest_Struct*) pack->pBuffer;
uint32 id = database.GetAccountIDFromLSID(utwr->lsaccountid);
int16 status = database.CheckStatus(id);
case 0:
break;
case ServerOP_KeepAlive: {
// ignore this
break;
}
case ServerOP_UsertoWorldReq: {
UsertoWorldRequest_Struct* utwr = (UsertoWorldRequest_Struct*) pack->pBuffer;
uint32 id = database.GetAccountIDFromLSID(utwr->lsaccountid);
int16 status = database.CheckStatus(id);
ServerPacket* outpack = new ServerPacket;
outpack->opcode = ServerOP_UsertoWorldResp;
outpack->size = sizeof(UsertoWorldResponse_Struct);
outpack->pBuffer = new uchar[outpack->size];
memset(outpack->pBuffer, 0, outpack->size);
UsertoWorldResponse_Struct* utwrs = (UsertoWorldResponse_Struct*) outpack->pBuffer;
utwrs->lsaccountid = utwr->lsaccountid;
utwrs->ToID = utwr->FromID;
ServerPacket* outpack = new ServerPacket;
outpack->opcode = ServerOP_UsertoWorldResp;
outpack->size = sizeof(UsertoWorldResponse_Struct);
outpack->pBuffer = new uchar[outpack->size];
memset(outpack->pBuffer, 0, outpack->size);
UsertoWorldResponse_Struct* utwrs = (UsertoWorldResponse_Struct*) outpack->pBuffer;
utwrs->lsaccountid = utwr->lsaccountid;
utwrs->ToID = utwr->FromID;
if(Config->Locked == true)
{
if((status == 0 || status < 100) && (status != -2 || status != -1))
utwrs->response = 0;
if(status >= 100)
if(Config->Locked == true)
{
if((status == 0 || status < 100) && (status != -2 || status != -1))
utwrs->response = 0;
if(status >= 100)
utwrs->response = 1;
}
else {
utwrs->response = 1;
}
int32 x = Config->MaxClients;
if( (int32)numplayers >= x && x != -1 && x != 255 && status < 80)
utwrs->response = -3;
if(status == -1)
utwrs->response = -1;
if(status == -2)
utwrs->response = -2;
utwrs->worldid = utwr->worldid;
SendPacket(outpack);
delete outpack;
break;
}
else {
utwrs->response = 1;
case ServerOP_LSClientAuth: {
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
// online at the same time.
client_list.EnforceSessionLimit(slsca->lsaccount_id);
}
client_list.CLEAdd(slsca->lsaccount_id, slsca->name, slsca->key, slsca->worldadmin, slsca->ip, slsca->local);
break;
}
int32 x = Config->MaxClients;
if( (int32)numplayers >= x && x != -1 && x != 255 && status < 80)
utwrs->response = -3;
if(status == -1)
utwrs->response = -1;
if(status == -2)
utwrs->response = -2;
utwrs->worldid = utwr->worldid;
SendPacket(outpack);
delete outpack;
break;
}
case ServerOP_LSClientAuth: {
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
// online at the same time.
client_list.EnforceSessionLimit(slsca->lsaccount_id);
case ServerOP_LSFatalError: {
#ifndef IGNORE_LS_FATAL_ERROR
WorldConfig::DisableLoginserver();
_log(WORLD__LS_ERR, "Login server responded with FatalError. Disabling reconnect.");
#else
_log(WORLD__LS_ERR, "Login server responded with FatalError.");
#endif
if (pack->size > 1) {
_log(WORLD__LS_ERR, " %s",pack->pBuffer);
}
break;
}
client_list.CLEAdd(slsca->lsaccount_id, slsca->name, slsca->key, slsca->worldadmin, slsca->ip, slsca->local);
break;
}
case ServerOP_LSFatalError: {
#ifndef IGNORE_LS_FATAL_ERROR
WorldConfig::DisableLoginserver();
_log(WORLD__LS_ERR, "Login server responded with FatalError. Disabling reconnect.");
#else
_log(WORLD__LS_ERR, "Login server responded with FatalError.");
#endif
if (pack->size > 1) {
_log(WORLD__LS_ERR, " %s",pack->pBuffer);
case ServerOP_SystemwideMessage: {
ServerSystemwideMessage* swm = (ServerSystemwideMessage*) pack->pBuffer;
zoneserver_list.SendEmoteMessageRaw(0, 0, 0, swm->type, swm->message);
break;
}
break;
}
case ServerOP_SystemwideMessage: {
ServerSystemwideMessage* swm = (ServerSystemwideMessage*) pack->pBuffer;
zoneserver_list.SendEmoteMessageRaw(0, 0, 0, swm->type, swm->message);
break;
}
case ServerOP_LSRemoteAddr: {
if (!Config->WorldAddress.length()) {
WorldConfig::SetWorldAddress((char *)pack->pBuffer);
_log(WORLD__LS, "Loginserver provided %s as world address",pack->pBuffer);
case ServerOP_LSRemoteAddr: {
if (!Config->WorldAddress.length()) {
WorldConfig::SetWorldAddress((char *)pack->pBuffer);
_log(WORLD__LS, "Loginserver provided %s as world address",pack->pBuffer);
}
break;
}
case ServerOP_LSAccountUpdate: {
_log(WORLD__LS, "Received ServerOP_LSAccountUpdate packet from loginserver");
CanAccountUpdate = true;
break;
}
default:
{
_log(WORLD__LS_ERR, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
break;
}
case ServerOP_LSAccountUpdate: {
_log(WORLD__LS, "Received ServerOP_LSAccountUpdate packet from loginserver");
CanAccountUpdate = true;
break;
}
default:
{
_log(WORLD__LS_ERR, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
}
delete pack;
}
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LOGINSERVER_H
#define LOGINSERVER_H
+13 -13
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <iostream>
@@ -69,9 +69,9 @@ bool LoginServerList::Process() {
}
#ifdef _WINDOWS
void AutoInitLoginServer(void *tmp) {
void AutoInitLoginServer(void *tmp) {
#else
void *AutoInitLoginServer(void *tmp) {
void *AutoInitLoginServer(void *tmp) {
#endif
loginserverlist.InitLoginServer();
#ifndef WIN32
+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;
+13 -13
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "WorldConfig.h"
+15 -15
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WorldConfig_H
#define __WorldConfig_H
@@ -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; }
+11 -11
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WorldTCPCONNECTION_H
#define WorldTCPCONNECTION_H
+538 -537
View File
File diff suppressed because it is too large Load Diff
+15 -16
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CLIENT_H
#define CLIENT_H
@@ -36,8 +36,8 @@ class EQStreamInterface;
class Client {
public:
Client(EQStreamInterface* ieqs);
~Client();
~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;
@@ -111,7 +111,6 @@ private:
EQStreamInterface* const eqs;
};
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);
bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc);
+14 -43
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "cliententry.h"
@@ -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));
@@ -295,32 +295,3 @@ bool ClientListEntry::CheckAuth(uint32 id, const char* iKey, uint32 ip) {
return false;
}
+4 -4
View File
@@ -34,11 +34,11 @@ public:
void SetOnline(int8 iOnline = CLE_Status_Online);
void SetChar(uint32 iCharID, const char* iCharName);
inline int8 Online() { return pOnline; }
inline const uint32 GetID() const { return id; }
inline const uint32 GetIP() const { return pIP; }
inline const uint32 GetID() const { return id; }
inline const uint32 GetIP() const { return pIP; }
inline void SetIP(const uint32& iIP) { pIP = iIP; }
inline void KeepAlive() { stale = 0; }
inline uint8 GetStaleCounter() const { return stale; }
inline uint8 GetStaleCounter() const { return stale; }
void LeavingZone(ZoneServer* iZS = 0, int8 iOnline = CLE_Status_Offline);
void Camp(ZoneServer* iZS = 0);
@@ -122,5 +122,5 @@ private:
char pLFGComments[64];
};
#endif /*CLIENTENTRY_H_*/
+80 -79
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "clientlist.h"
@@ -47,17 +47,17 @@ ClientList::~ClientList() {
void ClientList::Process() {
if (CLStale_timer.Check())
CLCheckStale();
LinkedListIterator<Client*> iterator(list);
iterator.Reset();
while(iterator.MoreElements()) {
if (!iterator.GetData()->Process()) {
struct in_addr in;
struct in_addr in;
in.s_addr = iterator.GetData()->GetIP();
_log(WORLD__CLIENTLIST,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort());
//the client destructor should take care of this.
@@ -113,7 +113,7 @@ void ClientList::EnforceSessionLimit(uint32 iLSAccountID) {
ClientEntry = iterator.GetData();
if ((ClientEntry->LSAccountID() == iLSAccountID) &&
((ClientEntry->Admin() <= (RuleI(World, ExemptAccountLimitStatus))) || (RuleI(World, ExemptAccountLimitStatus) < 0))) {
((ClientEntry->Admin() <= (RuleI(World, ExemptAccountLimitStatus))) || (RuleI(World, ExemptAccountLimitStatus) < 0))) {
CharacterCount++;
@@ -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;
@@ -227,15 +227,15 @@ void ClientList::DisconnectByIP(uint32 iIP) {
while(iterator.MoreElements()) {
countCLEIPs = iterator.GetData();
if ((countCLEIPs->GetIP() == iIP)) {
if(strlen(countCLEIPs->name())) {
ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer;
strcpy(skp->adminname, "SessionLimit");
strcpy(skp->name, countCLEIPs->name());
skp->adminrank = 255;
zoneserver_list.SendPacket(pack);
safe_delete(pack);
}
if(strlen(countCLEIPs->name())) {
ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer;
strcpy(skp->adminname, "SessionLimit");
strcpy(skp->name, countCLEIPs->name());
skp->adminrank = 255;
zoneserver_list.SendPacket(pack);
safe_delete(pack);
}
countCLEIPs->SetOnline(CLE_Status_Offline);
iterator.RemoveCurrent();
}
@@ -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) {
@@ -301,7 +301,7 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
while(iterator.MoreElements()) {
ClientListEntry* cle = iterator.GetData();
if (admin >= cle->Admin() && (iName == 0 || namestrlen == 0 || strncasecmp(cle->name(), iName, namestrlen) == 0 || strncasecmp(cle->AccountName(), iName, namestrlen) == 0 || strncasecmp(cle->LSName(), iName, namestrlen) == 0)) {
struct in_addr in;
struct in_addr in;
in.s_addr = cle->GetIP();
if (addnewline) {
AppendAnyLenString(&output, &outsize, &outlen, newline);
@@ -395,7 +395,7 @@ void ClientList::CLEKeepAlive(uint32 numupdates, uint32* wid) {
ClientListEntry* ClientList::CheckAuth(uint32 id, const char* iKey, uint32 ip ) {
LinkedListIterator<ClientListEntry*> iterator(clientlist);
LinkedListIterator<ClientListEntry*> iterator(clientlist);
iterator.Reset();
while(iterator.MoreElements()) {
@@ -406,7 +406,7 @@ ClientListEntry* ClientList::CheckAuth(uint32 id, const char* iKey, uint32 ip )
return 0;
}
ClientListEntry* ClientList::CheckAuth(uint32 iLSID, const char* iKey) {
LinkedListIterator<ClientListEntry*> iterator(clientlist);
LinkedListIterator<ClientListEntry*> iterator(clientlist);
iterator.Reset();
while(iterator.MoreElements()) {
@@ -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;
@@ -880,7 +880,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon
WAPP3->ZoneMSGID = ZoneMSGID;
WAPP3->Zone = PlayerZone;
WAPP3->Class_ = PlayerClass;
WAPP3->Level = PlayerLevel;
WAPP3->Level = PlayerLevel;
WAPP3->Race = PlayerRace;
WAPP3->Account[0] = 0;
@@ -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;
@@ -920,16 +920,16 @@ void ClientList::SendLFGMatches(ServerLFGMatchesRequest_Struct *smrs) {
// First we check that the player meets the level and class criteria of the person
// doing the search.
if((CLE->level() >= smrs->FromLevel) && (CLE->level() <= smrs->ToLevel) &&
(BitMask & smrs->Classes))
// Then we check if if the player doing the search meets the level criteria specified
(BitMask & smrs->Classes))
// Then we check if if the player doing the search meets the level criteria specified
// by the player who is LFG.
//
// GetLFGMatchFilter returns the setting of the 'Only players who match my posted filters
// can query me' checkbox.
// can query me' checkbox.
//
// FromLevel and ToLevel are the settings of the 'Want group levels:' boxes.
if(!CLE->GetLFGMatchFilter() || ((smrs->QuerierLevel >= CLE->GetLFGFromLevel()) &&
(smrs->QuerierLevel <= CLE->GetLFGToLevel())))
if(!CLE->GetLFGMatchFilter() || ((smrs->QuerierLevel >= CLE->GetLFGFromLevel()) &&
(smrs->QuerierLevel <= CLE->GetLFGToLevel())))
Matches++;
}
Iterator.Advance();
@@ -950,7 +950,7 @@ void ClientList::SendLFGMatches(ServerLFGMatchesRequest_Struct *smrs) {
if(CLE->LFG()) {
unsigned int BitMask = 1 << CLE->class_();
if((CLE->level() >= smrs->FromLevel) && (CLE->level() <= smrs->ToLevel) &&
(BitMask & smrs->Classes)) {
(BitMask & smrs->Classes)) {
Matches--;
strcpy(Buffer->Name, CLE->name());
Buffer->Class_ = CLE->class_();
@@ -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();
@@ -1358,5 +1358,6 @@ void ClientList::SendClientVersionSummary(const char *Name)
}
zoneserver_list.SendEmoteMessage(Name, 0, 0, 13, "There are %i 6.2, %i Titanium, %i SoF, %i SoD, %i UF, %i RoF clients currently connected.",
Client62Count, ClientTitaniumCount, ClientSoFCount, ClientSoDCount, ClientUnderfootCount, ClientRoFCount);
Client62Count, ClientTitaniumCount, ClientSoFCount, ClientSoDCount, ClientUnderfootCount, ClientRoFCount);
}
+11 -13
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,21 +31,21 @@ 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);
void SendClientVersionSummary(const char *Name);
void SendLFGMatches(ServerLFGMatchesRequest_Struct *LFGMatchesRequest);
void ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct* whom, WorldTCPConnection* connection);
void ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct* whom, WorldTCPConnection* connection);
void SendCLEList(const int16& admin, const char* to, WorldTCPConnection* connection, const char* iName = 0);
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;
@@ -79,7 +79,5 @@ protected:
};
#endif /*CLIENTLIST_H_*/
+33 -32
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <iostream>
@@ -50,7 +50,7 @@ using namespace std;
#ifdef _WINDOWS
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#endif
extern ZSList zoneserver_list;
@@ -66,9 +66,9 @@ ConsoleList console_list;
void CatchSignal(int sig_num);
Console::Console(EmuTCPConnection* itcpc)
: WorldTCPConnection(),
timeout_timer(RuleI(Console, SessionTimeOut)),
prompt_timer(1000)
: WorldTCPConnection(),
timeout_timer(RuleI(Console, SessionTimeOut)),
prompt_timer(1000)
{
tcpc = itcpc;
tcpc->SetEcho(true);
@@ -86,7 +86,7 @@ Console::~Console() {
void Console::Die() {
state = CONSOLE_STATE_CLOSED;
struct in_addr in;
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__CONSOLE,"Removing console from %s:%d",inet_ntoa(in),GetPort());
tcpc->Disconnect();
@@ -97,17 +97,17 @@ bool Console::SendChannelMessage(const ServerChannelMessage_Struct* scm) {
return false;
switch (scm->chan_num) {
if(RuleB(Chat, ServerWideAuction)){
case 4: {
SendMessage(1, "%s auctions, '%s'", scm->from, scm->message);
break;
case 4: {
SendMessage(1, "%s auctions, '%s'", scm->from, scm->message);
break;
}
}
}
if(RuleB(Chat, ServerWideOOC)){
case 5: {
SendMessage(1, "%s says ooc, '%s'", scm->from, scm->message);
break;
if(RuleB(Chat, ServerWideOOC)){
case 5: {
SendMessage(1, "%s says ooc, '%s'", scm->from, scm->message);
break;
}
}
}
case 6: {
SendMessage(1, "%s BROADCASTS, '%s'", scm->from, scm->message);
break;
@@ -216,7 +216,7 @@ bool Console::Process() {
return false;
if (!tcpc->Connected()) {
struct in_addr in;
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__CONSOLE,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort());
return false;
@@ -227,16 +227,16 @@ 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...");
struct in_addr in;
struct in_addr in;
in.s_addr = GetIP();
_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();
@@ -304,7 +304,7 @@ void ConsoleList::KillAll() {
void ConsoleList::SendConsoleWho(WorldTCPConnection* connection, const char* to, int16 admin, char** output, uint32* outsize, uint32* outlen) {
LinkedListIterator<Console*> iterator(list);
iterator.Reset();
struct in_addr in;
struct in_addr in;
int x = 0;
while(iterator.MoreElements()) {
@@ -495,7 +495,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) {
@@ -609,7 +609,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");
@@ -852,3 +852,4 @@ void Console::SendPrompt() {
if (tcpc->GetEcho())
SendMessage(0, "%s> ", paccountname);
}
+13 -12
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CONSOLE_H
#define CONSOLE_H
@@ -92,7 +92,7 @@ class ConsoleList
public:
ConsoleList() {}
~ConsoleList() {}
void Add(Console* con);
void Process();
void KillAll();
@@ -106,3 +106,4 @@ private:
LinkedList<Console*> list;
};
#endif
+13 -13
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "lfplist.h"
@@ -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.
@@ -115,7 +115,7 @@ void GroupLFPList::Process() {
Group = Iterator.GetData();
int MemberCount = 0;
if(Group) {
GroupLFPMemberEntry* GroupMembers = Group->Members;
GroupLFPMemberEntry* GroupMembers = Group->Members;
if(!GroupMembers) {
Iterator.Advance();
continue;
@@ -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 {
@@ -193,7 +193,7 @@ void GroupLFPList::UpdateGroup(ServerLFPUpdate_Struct *Update) {
Group = new GroupLFP(Update->LeaderID);
if(Group) {
if(Group) {
Group->SetDetails(Update);
LFPGroupList.Append(Group);
}
@@ -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);
+8 -7
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net)
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LFPENTRY_H
@@ -37,7 +37,7 @@ public:
friend class GroupLFPList;
private:
uint32 LeaderID;
uint32 LeaderID;
uint8 MatchFilter;
uint32 FromLevel;
uint32 ToLevel;
@@ -64,3 +64,4 @@ private:
};
#endif
+65 -65
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
@@ -48,7 +48,7 @@ using namespace std;
#include <process.h>
#define snprintf _snprintf
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define strcasecmp _stricmp
#include <conio.h>
#else
#include <pthread.h>
@@ -59,12 +59,12 @@ using namespace std;
#include <sys/shm.h>
#ifndef FREEBSD
union semun {
int val;
struct semid_ds *buf;
ushort *array;
struct seminfo *__buf;
void *__pad;
};
int val;
struct semid_ds *buf;
ushort *array;
struct seminfo *__buf;
void *__pad;
};
#endif
#endif
@@ -120,8 +120,8 @@ extern ConsoleList console_list;
void CatchSignal(int sig_num);
int main(int argc, char** argv) {
RegisterExecutablePlatform(ExePlatformWorld);
set_exception_handler();
RegisterExecutablePlatform(ExePlatformWorld);
set_exception_handler();
// Load server configuration
_log(WORLD__INIT, "Loading server configuration..");
@@ -138,11 +138,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;
@@ -174,7 +174,7 @@ int main(int argc, char** argv) {
iterator.Advance();
}
}
_log(WORLD__INIT, "Connecting to MySQL...");
if (!database.Connect(
Config->DatabaseHost.c_str(),
@@ -187,7 +187,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) {
@@ -267,14 +267,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..");
@@ -286,7 +286,7 @@ int main(int argc, char** argv) {
database.ClearRaidDetails();
_log(WORLD__INIT, "Loading items..");
if (!database.LoadItems()) {
_log(WORLD__INIT_ERR, "Error: Could not load item data. But ignoring");
_log(WORLD__INIT_ERR, "Error: Could not load item data. But ignoring");
}
_log(WORLD__INIT, "Loading guilds..");
guild_mgr.LoadGuilds();
@@ -307,23 +307,23 @@ int main(int argc, char** argv) {
}
}
if(RuleB(World, ClearTempMerchantlist)){
_log(WORLD__INIT, "Clearing temporary merchant lists..");
_log(WORLD__INIT, "Clearing temporary merchant lists..");
database.ClearMerchantTemp();
}
}
_log(WORLD__INIT, "Loading EQ time of day..");
if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str()))
_log(WORLD__INIT_ERR, "Unable to load %s", Config->EQTimeFile.c_str());
_log(WORLD__INIT, "Loading launcher list..");
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());
@@ -348,9 +348,9 @@ int main(int argc, char** argv) {
Timer PurgeInstanceTimer(450000);
PurgeInstanceTimer.Start(450000);
_log(WORLD__INIT, "Loading char create info...");
database.LoadCharacterCreateAllocations();
database.LoadCharacterCreateCombos();
_log(WORLD__INIT, "Loading char create info...");
database.LoadCharacterCreateAllocations();
database.LoadCharacterCreateCombos();
char errbuf[TCPConnection_ErrorBufferSize];
if (tcps.Open(Config->WorldTCPPort, errbuf)) {
@@ -380,10 +380,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
@@ -394,37 +394,37 @@ 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
struct in_addr in;
in.s_addr = eqsi->GetRemoteIP();
if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs.
if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs.
_log(WORLD__CLIENT, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table.
_log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
Client* client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
} else {
_log(WORLD__CLIENT, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream.
}
}
if (!RuleB(World, UseBannedIPsTable)){
_log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Client* client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
}
if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table.
_log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
Client* client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
} else {
_log(WORLD__CLIENT, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream.
}
}
if (!RuleB(World, UseBannedIPsTable)){
_log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Client* client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
}
}
client_list.Process();
while ((tcpc = tcps.NewQueuePop())) {
struct in_addr in;
in.s_addr = tcpc->GetrIP();
@@ -436,26 +436,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();
+12 -12
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WIN32
#include <sys/socket.h>
@@ -83,6 +83,6 @@ private:
char worldpassword[31];
char worldaddress[255];
char chataddress[255];
uint8 DEFAULTSTATUS;
uint8 DEFAULTSTATUS;
};
+15 -34
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -18,11 +18,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef const char Const_char;
@@ -36,8 +36,8 @@ typedef const char Const_char;
#undef seed
#endif
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#ifdef THIS /* this macro seems to leak out on some systems */
#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();
@@ -433,23 +433,6 @@ XS(XS_EQLConfig_GetZoneDetails)
sv_setpvn(*ele, cur->second.c_str(), cur->second.length());
}
}
}
XSRETURN(1);
}
@@ -464,15 +447,13 @@ 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];
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "GetName"), XS_EQLConfig_GetName, file, "$");
+58 -94
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -16,13 +16,13 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef const char Const_char;
@@ -36,7 +36,7 @@ typedef const char Const_char;
#undef seed
#endif
#ifdef THIS /* this macro seems to leak out on some systems */
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
@@ -272,23 +272,6 @@ XS(XS_EQW_GetZoneDetails)
sv_setpvn(*ele, cur->second.c_str(), cur->second.length());
}
}
}
XSRETURN(1);
}
@@ -409,23 +392,6 @@ XS(XS_EQW_GetPlayerDetails)
sv_setpvn(*ele, cur->second.c_str(), cur->second.length());
}
}
}
XSRETURN(1);
}
@@ -864,7 +830,7 @@ XS(XS_EQW_ListBugs)
Perl_croak(aTHX_ "Usage: EQW::ListBugs(THIS, id)");
{
EQW * THIS;
uint32 id = (uint32)SvUV(ST(1));
uint32 id = (uint32)SvUV(ST(1));
vector<string> RETVAL;
@@ -876,7 +842,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();
{
@@ -953,7 +919,7 @@ XS(XS_EQW_ResolveBug)
Perl_croak(aTHX_ "Usage: EQW::ResolveBug(THIS, id)");
{
EQW * THIS;
const char *id = (const char*)SvPV_nolen(ST(1));
const char *id = (const char*)SvPV_nolen(ST(1));
if (sv_derived_from(ST(0), "EQW")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
@@ -963,7 +929,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;
@@ -972,53 +938,53 @@ XS(XS_EQW_ResolveBug)
XS(XS_EQW_SendMessage); /* prototype to pass -Wmissing-prototypes */
XS(XS_EQW_SendMessage)
{
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: EQW::SendMessage(THIS, type, message)");
{
EQW * THIS;
dXSTARG;
uint32 msgtype = (uint32)SvUV(ST(1));
char* msg = (char *)SvPV_nolen(ST(2));
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: EQW::SendMessage(THIS, type, message)");
{
EQW * THIS;
dXSTARG;
uint32 msgtype = (uint32)SvUV(ST(1));
char* msg = (char *)SvPV_nolen(ST(2));
if (sv_derived_from(ST(0), "EQW")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQW *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type EQW");
if(THIS == NULL)
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
if (sv_derived_from(ST(0), "EQW")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQW *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type EQW");
if(THIS == NULL)
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
THIS->SendMessage(msgtype, msg);
}
XSRETURN_EMPTY;
THIS->SendMessage(msgtype, msg);
}
XSRETURN_EMPTY;
}
XS(XS_EQW_WorldShutDown); /* prototype to pass -Wmissing-prototypes */
XS(XS_EQW_WorldShutDown)
{
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: EQW::WorldShutDown(THIS, time, interval)");
{
EQW * THIS;
dXSTARG;
uint32 time = (uint32)SvUV(ST(1));
uint32 interval = (uint32)SvUV(ST(2));
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: EQW::WorldShutDown(THIS, time, interval)");
{
EQW * THIS;
dXSTARG;
uint32 time = (uint32)SvUV(ST(1));
uint32 interval = (uint32)SvUV(ST(2));
if (sv_derived_from(ST(0), "EQW")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQW *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type EQW");
if(THIS == NULL)
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
if (sv_derived_from(ST(0), "EQW")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(EQW *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type EQW");
if(THIS == NULL)
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
THIS->WorldShutDown(time, interval);
}
XSRETURN_EMPTY;
THIS->WorldShutDown(time, interval);
}
XSRETURN_EMPTY;
}
#ifdef __cplusplus
@@ -1038,8 +1004,6 @@ XS(boot_EQW)
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "GetConfig"), XS_EQW_GetConfig, file, "$$");
@@ -1067,10 +1031,10 @@ XS(boot_EQW)
newXSproto(strcpy(buf, "SetBankerFlag"), XS_EQW_SetBankerFlag, file, "$$$");
newXSproto(strcpy(buf, "SetTributeFlag"), XS_EQW_SetTributeFlag, file, "$$$");
newXSproto(strcpy(buf, "SetPublicNote"), XS_EQW_SetPublicNote, file, "$$$");
newXSproto(strcpy(buf, "CountBugs"), XS_EQW_CountBugs, file, "$");
newXSproto(strcpy(buf, "ListBugs"), XS_EQW_ListBugs, file, "$$");
newXSproto(strcpy(buf, "CountBugs"), XS_EQW_CountBugs, file, "$");
newXSproto(strcpy(buf, "ListBugs"), XS_EQW_ListBugs, file, "$$");
newXSproto(strcpy(buf, "GetBugDetails"), XS_EQW_GetBugDetails, file, "$$");
newXSproto(strcpy(buf, "ResolveBug"), XS_EQW_ResolveBug, file, "$$");
newXSproto(strcpy(buf, "ResolveBug"), XS_EQW_ResolveBug, file, "$$");
newXSproto(strcpy(buf, "SendMessage"), XS_EQW_SendMessage, file, "$$$");
newXSproto(strcpy(buf, "WorldShutDown"), XS_EQW_WorldShutDown, file, "$$$");
XSRETURN_YES;
+15 -34
View File
@@ -1,14 +1,14 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
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
@@ -18,11 +18,11 @@
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.
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
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef const char Const_char;
@@ -36,8 +36,8 @@ typedef const char Const_char;
#undef seed
#endif
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#ifdef THIS /* this macro seems to leak out on some systems */
#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();
@@ -219,23 +219,6 @@ XS(XS_HTTPRequest_get_all)
sv_setpvn(*ele, cur->second.c_str(), cur->second.length());
}
}
}
XSRETURN(1);
}
@@ -323,15 +306,13 @@ 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];
//add the strcpy stuff to get rid of const warnings....
XS_VERSION_BOOTCHECK ;
newXSproto(strcpy(buf, "get"), XS_HTTPRequest_get, file, "$$;$");
+6 -5
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,12 +49,12 @@ 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
{
struct in_addr in;
struct in_addr in;
in.s_addr = GetIP();
_log(QUERYSERV__ERROR, "QueryServ authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
@@ -66,7 +66,7 @@ bool QueryServConnection::Process()
}
else
{
struct in_addr in;
struct in_addr in;
in.s_addr = GetIP();
_log(QUERYSERV__ERROR, "QueryServ authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
@@ -131,3 +131,4 @@ bool QueryServConnection::SendPacket(ServerPacket* pack)
return Stream->SendPacket(pack);
}
+6 -5
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,12 +44,12 @@ 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
{
struct in_addr in;
struct in_addr in;
in.s_addr = GetIP();
_log(UCS__ERROR, "UCS authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
@@ -61,7 +61,7 @@ bool UCSConnection::Process()
}
else
{
struct in_addr in;
struct in_addr in;
in.s_addr = GetIP();
_log(UCS__ERROR, "UCS authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
@@ -127,3 +127,4 @@ void UCSConnection::SendMessage(const char *From, const char *Message)
SendPacket(pack);
safe_delete(pack);
}
+26 -52
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "wguild_mgr.h"
@@ -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,60 +113,34 @@ 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);
}
+127 -129
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "worlddb.h"
@@ -41,18 +41,18 @@ 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;
cs->level[i] = 0;
cs->tutorial[i] = 0;
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
@@ -83,8 +83,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
cs->face[char_num] = pp->face;
cs->haircolor[char_num] = pp->haircolor;
cs->beardcolor[char_num] = pp->beardcolor;
cs->eyecolor2[char_num] = pp->eyecolor2;
cs->eyecolor1[char_num] = pp->eyecolor1;
cs->eyecolor2[char_num] = pp->eyecolor2;
cs->eyecolor1[char_num] = pp->eyecolor1;
cs->hairstyle[char_num] = pp->hairstyle;
cs->beard[char_num] = pp->beard;
cs->drakkin_heritage[char_num] = pp->drakkin_heritage;
@@ -102,7 +102,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
// This part creates home city entries for characters created before the home bind point was tracked.
// Do it here because the player profile is already loaded and it's as good a spot as any. This whole block should
// Do it here because the player profile is already loaded and it's as good a spot as any. This whole block should
// probably be removed at some point, when most accounts are safely converted.
if(pp->binds[4].zoneId == 0) {
bool altered = false;
@@ -177,7 +177,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
// @merth: Haven't done bracer01/bracer02 yet.
// Also: this needs a second look after items are a little more solid
// NOTE: items don't have a color, players MAY have a tint, if the
// use_tint part is set. otherwise use the regular color
// use_tint part is set. otherwise use the regular color
inv = new Inventory;
if(GetInventory(account_id, cs->name[char_num], inv))
{
@@ -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'",
BindZoneName, pp.binds[bindnum].zoneId, pp.binds[bindnum].x, pp.binds[bindnum].y, pp.binds[bindnum].z,
CharID), errbuf, 0,&affected_rows)) {
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,19 +493,19 @@ 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;
}
void WorldDatabase::GetLauncherList(std::vector<std::string> &rl) {
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
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);
}
@@ -545,10 +545,10 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) {
bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
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);
}
@@ -569,71 +569,69 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
}
bool WorldDatabase::LoadCharacterCreateAllocations() {
character_create_allocations.clear();
character_create_allocations.clear();
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if(RunQuery(query, MakeAnyLenString(&query, "SELECT * FROM char_create_point_allocations order by id"), errbuf, &result)) {
safe_delete_array(query);
while(row = mysql_fetch_row(result)) {
RaceClassAllocation allocate;
int r = 0;
allocate.Index = atoi(row[r++]);
allocate.BaseStats[0] = atoi(row[r++]);
allocate.BaseStats[3] = atoi(row[r++]);
allocate.BaseStats[1] = atoi(row[r++]);
allocate.BaseStats[2] = atoi(row[r++]);
allocate.BaseStats[4] = atoi(row[r++]);
allocate.BaseStats[5] = atoi(row[r++]);
allocate.BaseStats[6] = atoi(row[r++]);
allocate.DefaultPointAllocation[0] = atoi(row[r++]);
allocate.DefaultPointAllocation[3] = atoi(row[r++]);
allocate.DefaultPointAllocation[1] = atoi(row[r++]);
allocate.DefaultPointAllocation[2] = atoi(row[r++]);
allocate.DefaultPointAllocation[4] = atoi(row[r++]);
allocate.DefaultPointAllocation[5] = atoi(row[r++]);
allocate.DefaultPointAllocation[6] = atoi(row[r++]);
character_create_allocations.push_back(allocate);
}
mysql_free_result(result);
} else {
safe_delete_array(query);
return false;
}
MYSQL_ROW row;
if(RunQuery(query, MakeAnyLenString(&query, "SELECT * FROM char_create_point_allocations order by id"), errbuf, &result)) {
safe_delete_array(query);
while(row = mysql_fetch_row(result)) {
RaceClassAllocation allocate;
int r = 0;
allocate.Index = atoi(row[r++]);
allocate.BaseStats[0] = atoi(row[r++]);
allocate.BaseStats[3] = atoi(row[r++]);
allocate.BaseStats[1] = atoi(row[r++]);
allocate.BaseStats[2] = atoi(row[r++]);
allocate.BaseStats[4] = atoi(row[r++]);
allocate.BaseStats[5] = atoi(row[r++]);
allocate.BaseStats[6] = atoi(row[r++]);
allocate.DefaultPointAllocation[0] = atoi(row[r++]);
allocate.DefaultPointAllocation[3] = atoi(row[r++]);
allocate.DefaultPointAllocation[1] = atoi(row[r++]);
allocate.DefaultPointAllocation[2] = atoi(row[r++]);
allocate.DefaultPointAllocation[4] = atoi(row[r++]);
allocate.DefaultPointAllocation[5] = atoi(row[r++]);
allocate.DefaultPointAllocation[6] = atoi(row[r++]);
character_create_allocations.push_back(allocate);
}
mysql_free_result(result);
} else {
safe_delete_array(query);
return false;
}
return true;
return true;
}
bool WorldDatabase::LoadCharacterCreateCombos() {
character_create_race_class_combos.clear();
character_create_race_class_combos.clear();
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if(RunQuery(query, MakeAnyLenString(&query, "select * from char_create_combinations order by race, class, deity, start_zone"), errbuf, &result)) {
safe_delete_array(query);
while(row = mysql_fetch_row(result)) {
RaceClassCombos combo;
int r = 0;
combo.AllocationIndex = atoi(row[r++]);
combo.Race = atoi(row[r++]);
combo.Class = atoi(row[r++]);
combo.Deity = atoi(row[r++]);
combo.Zone = atoi(row[r++]);
combo.ExpansionRequired = atoi(row[r++]);
character_create_race_class_combos.push_back(combo);
}
mysql_free_result(result);
} else {
safe_delete_array(query);
return false;
}
MYSQL_ROW row;
if(RunQuery(query, MakeAnyLenString(&query, "select * from char_create_combinations order by race, class, deity, start_zone"), errbuf, &result)) {
safe_delete_array(query);
while(row = mysql_fetch_row(result)) {
RaceClassCombos combo;
int r = 0;
combo.AllocationIndex = atoi(row[r++]);
combo.Race = atoi(row[r++]);
combo.Class = atoi(row[r++]);
combo.Deity = atoi(row[r++]);
combo.Zone = atoi(row[r++]);
combo.ExpansionRequired = atoi(row[r++]);
character_create_race_class_combos.push_back(combo);
}
mysql_free_result(result);
} else {
safe_delete_array(query);
return false;
}
return true;
return true;
}
+19 -20
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
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
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
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WORLDDB_H_
#define WORLDDB_H_
@@ -30,21 +30,20 @@ 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);
bool LoadCharacterCreateAllocations();
bool LoadCharacterCreateCombos();
bool LoadCharacterCreateAllocations();
bool LoadCharacterCreateCombos();
protected:
};
extern WorldDatabase database;
extern WorldDatabase database;
#endif /*WORLDDB_H_*/
+33 -34
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "zonelist.h"
@@ -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;
@@ -87,7 +87,7 @@ void ZSList::Process() {
CatchSignal(2);
}
if(reminder && reminder->Check()){
SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down, everyone log out now. World will shut down in %i seconds...",shutdowntimer->GetRemainingTime()/1000);
SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down, everyone log out now. World will shut down in %i seconds...",shutdowntimer->GetRemainingTime()/1000);
}
LinkedListIterator<ZoneServer*> iterator(list);
@@ -95,7 +95,7 @@ void ZSList::Process() {
while(iterator.MoreElements()) {
if (!iterator.GetData()->Process()) {
ZoneServer* zs = iterator.GetData();
struct in_addr in;
struct in_addr in;
in.s_addr = zs->GetIP();
_log(WORLD__ZONELIST,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort());
zs->LSShutDownUpdate(zs->GetZoneID());
@@ -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));
@@ -204,7 +204,7 @@ ZoneServer* ZSList::FindByZoneID(uint32 ZoneID) {
while(iterator.MoreElements())
{
ZoneServer* tmp = iterator.GetData();
if (tmp->GetZoneID() == ZoneID && tmp->GetInstanceID() == 0) {
if (tmp->GetZoneID() == ZoneID && tmp->GetInstanceID() == 0) {
return tmp;
}
iterator.Advance();
@@ -282,8 +282,8 @@ 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;
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,12 +713,11 @@ void ZSList::GetZoneIDList(vector<uint32> &zones) {
zones.push_back(zs->GetID());
iterator.Advance();
}
}
void ZSList::WorldShutDown(uint32 time, uint32 interval)
{
if( time > 0 ) {
if( time > 0 ) {
SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down in %i seconds, everyone log out before this time.",time);
time *= 1000;
@@ -730,15 +729,15 @@ void ZSList::WorldShutDown(uint32 time, uint32 interval)
reminder->SetAtTrigger(interval);
shutdowntimer->Start();
reminder->Start();
}
else {
SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down, everyone log out now.");
ServerPacket* pack = new ServerPacket;
pack->opcode = ServerOP_ShutdownAll;
pack->size=0;
SendPacket(pack);
safe_delete(pack);
}
else {
SendEmoteMessage(0,0,0,15,"<SYSTEMWIDE MESSAGE>:SYSTEM MSG:World coming down, everyone log out now.");
ServerPacket* pack = new ServerPacket;
pack->opcode = ServerOP_ShutdownAll;
pack->size=0;
SendPacket(pack);
safe_delete(pack);
Process();
CatchSignal(2);
}
}
}
+7 -18
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();
@@ -52,7 +52,7 @@ public:
Timer* reminder;
void NextGroupIDs(uint32 &start, uint32 &end);
void SendLSZones();
uint16 GetAvailableZonePort();
uint16 GetAvailableZonePort();
int GetZoneCount();
void GetZoneIDList(std::vector<uint32> &zones);
@@ -64,20 +64,9 @@ protected:
uint16 pLockedZones[MaxLockedZones];
uint32 CurGroupID;
uint16 LastAllocatedPort;
};
#endif /*ZONELIST_H_*/
+1051 -1052
View File
File diff suppressed because it is too large Load Diff
+16 -16
View File
@@ -1,19 +1,19 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
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 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
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.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ZONESERVER_H
#define ZONESERVER_H
@@ -30,14 +30,14 @@ class ServerPacket;
class ZoneServer : public WorldTCPConnection {
public:
ZoneServer(EmuTCPConnection* itcpc);
~ZoneServer();
~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, ...);
void SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message);
bool SetZone(uint32 iZoneID, uint32 iInstanceID = 0, bool iStaticZone = false);
bool SetZone(uint32 iZoneID, uint32 iInstanceID = 0, bool iStaticZone = false);
void TriggerBootup(uint32 iZoneID = 0, uint32 iInstanceID = 0, const char* iAdminName = 0, bool iMakeStatic = false);
void Disconnect() { tcpc->Disconnect(); }
void IncommingClient(Client* client);
@@ -62,7 +62,7 @@ public:
inline bool IsStaticZone() const{ return staticzone; }
inline uint32 NumPlayers() const { return pNumPlayers; }
inline void AddPlayer() { pNumPlayers++; }
inline void RemovePlayer() { pNumPlayers--; }
inline void RemovePlayer() { pNumPlayers--; }
inline const char * GetLaunchName() const { return(launcher_name.c_str()); }
inline const char * GetLaunchedName() const { return(launched_name.c_str()); }
@@ -89,5 +89,5 @@ private:
std::string launched_name; //the name of the zone we launched.
};
#endif