mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Turn EnterWorldPacket handling into a method.
This commit is contained in:
parent
cc07d511a5
commit
27493c3d75
186
world/client.cpp
186
world/client.cpp
@ -676,74 +676,19 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
const WorldConfig *Config=WorldConfig::get();
|
||||
EmuOpcode opcode = app->GetOpcode();
|
||||
bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
|
||||
clog(WORLD__CLIENT_TRACE,"Recevied EQApplicationPacket");
|
||||
_pkt(WORLD__CLIENT_TRACE,app);
|
||||
|
||||
bool ret = true;
|
||||
|
||||
if (!eqs->CheckState(ESTABLISHED)) {
|
||||
clog(WORLD__CLIENT,"Client disconnected (net inactive on send)");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses
|
||||
if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) {
|
||||
if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) {
|
||||
clog(WORLD__CLIENT,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID());
|
||||
eqs->Close();
|
||||
}
|
||||
}
|
||||
|
||||
if (GetAccountID() == 0 && opcode != OP_SendLoginInfo) {
|
||||
// Got a packet other than OP_SendLoginInfo when not logged in
|
||||
clog(WORLD__CLIENT_ERR,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]);
|
||||
return false;
|
||||
}
|
||||
else if (opcode == OP_AckPacket) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch(opcode)
|
||||
{
|
||||
case OP_CrashDump:
|
||||
break;
|
||||
case OP_SendLoginInfo:
|
||||
{
|
||||
return HandleSendLoginInfoPacket(app);
|
||||
}
|
||||
case OP_ApproveName: //Name approval
|
||||
{
|
||||
return HandleNameApprovalPacket(app);
|
||||
}
|
||||
case OP_RandomNameGenerator:
|
||||
{
|
||||
return HandleGenerateRandomNamePacket(app);
|
||||
}
|
||||
case OP_CharacterCreateRequest:
|
||||
{
|
||||
// New OpCode in SoF
|
||||
return HandleCharacterCreateRequestPacket(app);
|
||||
}
|
||||
case OP_CharacterCreate: //Char create
|
||||
{
|
||||
return HandleCharacterCreatePacket(app);
|
||||
}
|
||||
case OP_EnterWorld: // Enter world
|
||||
{
|
||||
if (GetAccountID() == 0) {
|
||||
clog(WORLD__CLIENT_ERR,"Enter world with no logged in account");
|
||||
eqs->Close();
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(GetAdmin() < 0)
|
||||
{
|
||||
clog(WORLD__CLIENT,"Account banned or suspended.");
|
||||
eqs->Close();
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (RuleI(World, MaxClientsPerIP) >= 0) {
|
||||
@ -759,14 +704,14 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
if (charid == 0 || tmpaccid != GetAccountID()) {
|
||||
clog(WORLD__CLIENT_ERR,"Could not get CharInfo for '%s'",char_name);
|
||||
eqs->Close();
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make sure this account owns this character
|
||||
if (tmpaccid != GetAccountID()) {
|
||||
clog(WORLD__CLIENT_ERR,"This account does not own the character named '%s'",char_name);
|
||||
eqs->Close();
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!pZoning && ew->return_home)
|
||||
@ -783,7 +728,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
if(cs->gohome[x] == 1)
|
||||
{
|
||||
home_enabled = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -798,7 +743,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
clog(WORLD__CLIENT_ERR,"'%s' is trying to go home before they're able...",char_name);
|
||||
database.SetHackerFlag(GetAccountName(), char_name, "MQGoHome: player tried to go home before they were able.");
|
||||
eqs->Close();
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -815,7 +760,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
if(cs->tutorial[x] == 1)
|
||||
{
|
||||
tutorial_enabled = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -831,7 +776,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
clog(WORLD__CLIENT_ERR,"'%s' is trying to go to tutorial but are not allowed...",char_name);
|
||||
database.SetHackerFlag(GetAccountName(), char_name, "MQTutorial: player tried to enter the tutorial without having tutorial enabled for this character.");
|
||||
eqs->Close();
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -911,6 +856,9 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
|
||||
EQApplicationPacket *outapp2 = new EQApplicationPacket(OP_SetChatServer);
|
||||
char buffer[112];
|
||||
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
|
||||
sprintf(buffer,"%s,%i,%s.%s,%c%08X",
|
||||
Config->ChatHost.c_str(),
|
||||
Config->ChatPort,
|
||||
@ -941,10 +889,74 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
safe_delete(outapp2);
|
||||
|
||||
EnterWorld();
|
||||
break;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
const WorldConfig *Config=WorldConfig::get();
|
||||
EmuOpcode opcode = app->GetOpcode();
|
||||
|
||||
clog(WORLD__CLIENT_TRACE,"Recevied EQApplicationPacket");
|
||||
_pkt(WORLD__CLIENT_TRACE,app);
|
||||
|
||||
bool ret = true;
|
||||
|
||||
if (!eqs->CheckState(ESTABLISHED)) {
|
||||
clog(WORLD__CLIENT,"Client disconnected (net inactive on send)");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses
|
||||
if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) {
|
||||
if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) {
|
||||
clog(WORLD__CLIENT,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID());
|
||||
eqs->Close();
|
||||
}
|
||||
}
|
||||
|
||||
if (GetAccountID() == 0 && opcode != OP_SendLoginInfo) {
|
||||
// Got a packet other than OP_SendLoginInfo when not logged in
|
||||
clog(WORLD__CLIENT_ERR,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]);
|
||||
return false;
|
||||
}
|
||||
else if (opcode == OP_AckPacket) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch(opcode)
|
||||
{
|
||||
case OP_CrashDump:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
case OP_SendLoginInfo:
|
||||
{
|
||||
return HandleSendLoginInfoPacket(app);
|
||||
}
|
||||
case OP_ApproveName: //Name approval
|
||||
{
|
||||
return HandleNameApprovalPacket(app);
|
||||
}
|
||||
case OP_RandomNameGenerator:
|
||||
{
|
||||
return HandleGenerateRandomNamePacket(app);
|
||||
}
|
||||
case OP_CharacterCreateRequest:
|
||||
{
|
||||
// New OpCode in SoF
|
||||
return HandleCharacterCreateRequestPacket(app);
|
||||
}
|
||||
case OP_CharacterCreate: //Char create
|
||||
{
|
||||
return HandleCharacterCreatePacket(app);
|
||||
}
|
||||
case OP_EnterWorld: // Enter world
|
||||
{
|
||||
return HandleEnterWorldPacket(app);
|
||||
}
|
||||
case OP_LoginComplete:{
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
case OP_DeleteCharacter: {
|
||||
uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer);
|
||||
@ -958,47 +970,53 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
}
|
||||
case OP_ApproveWorld:
|
||||
{
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
case OP_WorldClientReady:{
|
||||
break;
|
||||
case OP_WorldClientReady:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
case OP_World_Client_CRC1:
|
||||
case OP_World_Client_CRC2: {
|
||||
case OP_World_Client_CRC2:
|
||||
{
|
||||
// There is no obvious entry in the CC struct to indicate that the 'Start Tutorial button
|
||||
// is selected when a character is created. I have observed that in this case, OP_EnterWorld is sent
|
||||
// before OP_World_Client_CRC1. Therefore, if we receive OP_World_Client_CRC1 before OP_EnterWorld,
|
||||
// then 'Start Tutorial' was not chosen.
|
||||
StartInTutorial = false;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
case OP_WearChange: { // User has selected a different character
|
||||
break;
|
||||
case OP_WearChange:
|
||||
{ // User has selected a different character
|
||||
return true;
|
||||
}
|
||||
case OP_WorldComplete: {
|
||||
case OP_WorldComplete:
|
||||
{
|
||||
eqs->Close();
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
case OP_LoginUnknown1:
|
||||
case OP_LoginUnknown2:
|
||||
break;
|
||||
|
||||
{
|
||||
return true;
|
||||
}
|
||||
case OP_ZoneChange:
|
||||
{
|
||||
// HoT sends this to world while zoning and wants it echoed back.
|
||||
if(ClientVersionBit & BIT_RoFAndLater)
|
||||
{
|
||||
QueuePacket(app);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default: {
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
clog(WORLD__CLIENT_ERR,"Received unknown EQApplicationPacket");
|
||||
_pkt(WORLD__CLIENT_ERR,app);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Client::Process() {
|
||||
|
||||
@ -104,6 +104,7 @@ private:
|
||||
bool HandleGenerateRandomNamePacket(const EQApplicationPacket *app);
|
||||
bool HandleCharacterCreateRequestPacket(const EQApplicationPacket *app);
|
||||
bool HandleCharacterCreatePacket(const EQApplicationPacket *app);
|
||||
bool HandleEnterWorldPacket(const EQApplicationPacket *app);
|
||||
|
||||
EQStreamInterface* const eqs;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user