mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
Turn GenerateRandomNamePacket handling into a method.
This commit is contained in:
parent
211248b50e
commit
18da8fe44d
@ -520,52 +520,7 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) {
|
||||
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:
|
||||
break;
|
||||
case OP_SendLoginInfo:
|
||||
{
|
||||
return HandleSendLoginInfoPacket(app);
|
||||
}
|
||||
case OP_ApproveName: //Name approval
|
||||
{
|
||||
return HandleNameApprovalPacket(app);
|
||||
}
|
||||
case OP_RandomNameGenerator:
|
||||
{
|
||||
bool Client::HandleGenerateRandomNamePacket(const EQApplicationPacket *app) {
|
||||
// creates up to a 10 char name
|
||||
char vowels[18]="aeiouyaeiouaeioe";
|
||||
char cons[48]="bcdfghjklmnpqrstvwxzybcdgklmnprstvwbcdgkpstrkd";
|
||||
@ -646,8 +601,55 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
// strncpy(ngs->name,"Notcreated",64);
|
||||
|
||||
QueuePacket(app);
|
||||
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:
|
||||
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
|
||||
|
||||
@ -97,9 +97,11 @@ private:
|
||||
bool firstlogin;
|
||||
bool seencharsel;
|
||||
bool realfirstlogin;
|
||||
|
||||
bool HandlePacket(const EQApplicationPacket *app);
|
||||
bool HandleNameApprovalPacket(const EQApplicationPacket *app);
|
||||
bool HandleSendLoginInfoPacket(const EQApplicationPacket *app);
|
||||
bool HandleGenerateRandomNamePacket(const EQApplicationPacket *app);
|
||||
|
||||
EQStreamInterface* const eqs;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user