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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::HandlePacket(const EQApplicationPacket *app) {
|
bool Client::HandleEnterWorldPacket(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:
|
|
||||||
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) {
|
if (GetAccountID() == 0) {
|
||||||
clog(WORLD__CLIENT_ERR,"Enter world with no logged in account");
|
clog(WORLD__CLIENT_ERR,"Enter world with no logged in account");
|
||||||
eqs->Close();
|
eqs->Close();
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GetAdmin() < 0)
|
if(GetAdmin() < 0)
|
||||||
{
|
{
|
||||||
clog(WORLD__CLIENT,"Account banned or suspended.");
|
clog(WORLD__CLIENT,"Account banned or suspended.");
|
||||||
eqs->Close();
|
eqs->Close();
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RuleI(World, MaxClientsPerIP) >= 0) {
|
if (RuleI(World, MaxClientsPerIP) >= 0) {
|
||||||
@ -759,14 +704,14 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
|||||||
if (charid == 0 || tmpaccid != GetAccountID()) {
|
if (charid == 0 || tmpaccid != GetAccountID()) {
|
||||||
clog(WORLD__CLIENT_ERR,"Could not get CharInfo for '%s'",char_name);
|
clog(WORLD__CLIENT_ERR,"Could not get CharInfo for '%s'",char_name);
|
||||||
eqs->Close();
|
eqs->Close();
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure this account owns this character
|
// Make sure this account owns this character
|
||||||
if (tmpaccid != GetAccountID()) {
|
if (tmpaccid != GetAccountID()) {
|
||||||
clog(WORLD__CLIENT_ERR,"This account does not own the character named '%s'",char_name);
|
clog(WORLD__CLIENT_ERR,"This account does not own the character named '%s'",char_name);
|
||||||
eqs->Close();
|
eqs->Close();
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pZoning && ew->return_home)
|
if(!pZoning && ew->return_home)
|
||||||
@ -783,7 +728,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
|||||||
if(cs->gohome[x] == 1)
|
if(cs->gohome[x] == 1)
|
||||||
{
|
{
|
||||||
home_enabled = true;
|
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);
|
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.");
|
database.SetHackerFlag(GetAccountName(), char_name, "MQGoHome: player tried to go home before they were able.");
|
||||||
eqs->Close();
|
eqs->Close();
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,7 +760,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
|||||||
if(cs->tutorial[x] == 1)
|
if(cs->tutorial[x] == 1)
|
||||||
{
|
{
|
||||||
tutorial_enabled = true;
|
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);
|
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.");
|
database.SetHackerFlag(GetAccountName(), char_name, "MQTutorial: player tried to enter the tutorial without having tutorial enabled for this character.");
|
||||||
eqs->Close();
|
eqs->Close();
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -911,6 +856,9 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
|||||||
|
|
||||||
EQApplicationPacket *outapp2 = new EQApplicationPacket(OP_SetChatServer);
|
EQApplicationPacket *outapp2 = new EQApplicationPacket(OP_SetChatServer);
|
||||||
char buffer[112];
|
char buffer[112];
|
||||||
|
|
||||||
|
const WorldConfig *Config = WorldConfig::get();
|
||||||
|
|
||||||
sprintf(buffer,"%s,%i,%s.%s,%c%08X",
|
sprintf(buffer,"%s,%i,%s.%s,%c%08X",
|
||||||
Config->ChatHost.c_str(),
|
Config->ChatHost.c_str(),
|
||||||
Config->ChatPort,
|
Config->ChatPort,
|
||||||
@ -941,10 +889,74 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
|||||||
safe_delete(outapp2);
|
safe_delete(outapp2);
|
||||||
|
|
||||||
EnterWorld();
|
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:{
|
case OP_LoginComplete:{
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
case OP_DeleteCharacter: {
|
case OP_DeleteCharacter: {
|
||||||
uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer);
|
uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer);
|
||||||
@ -958,47 +970,53 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
|||||||
}
|
}
|
||||||
case OP_ApproveWorld:
|
case OP_ApproveWorld:
|
||||||
{
|
{
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
case OP_WorldClientReady:{
|
case OP_WorldClientReady:
|
||||||
break;
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
case OP_World_Client_CRC1:
|
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
|
// 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
|
// 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,
|
// before OP_World_Client_CRC1. Therefore, if we receive OP_World_Client_CRC1 before OP_EnterWorld,
|
||||||
// then 'Start Tutorial' was not chosen.
|
// then 'Start Tutorial' was not chosen.
|
||||||
StartInTutorial = false;
|
StartInTutorial = false;
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
case OP_WearChange: { // User has selected a different character
|
case OP_WearChange:
|
||||||
break;
|
{ // User has selected a different character
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
case OP_WorldComplete: {
|
case OP_WorldComplete:
|
||||||
|
{
|
||||||
eqs->Close();
|
eqs->Close();
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
case OP_LoginUnknown1:
|
case OP_LoginUnknown1:
|
||||||
case OP_LoginUnknown2:
|
case OP_LoginUnknown2:
|
||||||
break;
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
case OP_ZoneChange:
|
case OP_ZoneChange:
|
||||||
|
{
|
||||||
// HoT sends this to world while zoning and wants it echoed back.
|
// HoT sends this to world while zoning and wants it echoed back.
|
||||||
if(ClientVersionBit & BIT_RoFAndLater)
|
if(ClientVersionBit & BIT_RoFAndLater)
|
||||||
{
|
{
|
||||||
QueuePacket(app);
|
QueuePacket(app);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
|
}
|
||||||
|
default:
|
||||||
default: {
|
{
|
||||||
clog(WORLD__CLIENT_ERR,"Received unknown EQApplicationPacket");
|
clog(WORLD__CLIENT_ERR,"Received unknown EQApplicationPacket");
|
||||||
_pkt(WORLD__CLIENT_ERR,app);
|
_pkt(WORLD__CLIENT_ERR,app);
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::Process() {
|
bool Client::Process() {
|
||||||
|
|||||||
@ -104,6 +104,7 @@ private:
|
|||||||
bool HandleGenerateRandomNamePacket(const EQApplicationPacket *app);
|
bool HandleGenerateRandomNamePacket(const EQApplicationPacket *app);
|
||||||
bool HandleCharacterCreateRequestPacket(const EQApplicationPacket *app);
|
bool HandleCharacterCreateRequestPacket(const EQApplicationPacket *app);
|
||||||
bool HandleCharacterCreatePacket(const EQApplicationPacket *app);
|
bool HandleCharacterCreatePacket(const EQApplicationPacket *app);
|
||||||
|
bool HandleEnterWorldPacket(const EQApplicationPacket *app);
|
||||||
|
|
||||||
EQStreamInterface* const eqs;
|
EQStreamInterface* const eqs;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user