mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-21 02:18:26 +00:00
More work to actually make this usable
This commit is contained in:
+66
-33
@@ -17,7 +17,7 @@
|
||||
#include "../common/clientversions.h"
|
||||
#include "../common/random.h"
|
||||
#include "../common/shareddb.h"
|
||||
#include "../common/file_verify.h"
|
||||
#include "../common/file_verify_manager.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "worlddb.h"
|
||||
@@ -61,11 +61,6 @@
|
||||
std::vector<RaceClassAllocation> character_create_allocations;
|
||||
std::vector<RaceClassCombos> character_create_race_class_combos;
|
||||
|
||||
EQEmu::FileVerify spell_verify("verify/spells_us.txt");
|
||||
EQEmu::FileVerify skills_verify("verify/SkillCaps.txt");
|
||||
EQEmu::FileVerify basedata_verify("verify/BaseData.txt");
|
||||
EQEmu::FileVerify eqgame_verify("verify/eqgame.exe");
|
||||
|
||||
extern ZSList zoneserver_list;
|
||||
extern LoginServerList loginserverlist;
|
||||
extern ClientList client_list;
|
||||
@@ -96,7 +91,7 @@ Client::Client(EQStreamInterface* ieqs)
|
||||
|
||||
m_ClientVersion = eqs->GetClientVersion();
|
||||
m_ClientVersionBit = ClientBitFromVersion(m_ClientVersion);
|
||||
|
||||
|
||||
numclients++;
|
||||
}
|
||||
|
||||
@@ -611,6 +606,10 @@ bool Client::HandleGenerateRandomNamePacket(const EQApplicationPacket *app) {
|
||||
}
|
||||
|
||||
bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app) {
|
||||
if(!CanTakeAction()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// New OpCode in SoF
|
||||
uint32 allocs = character_create_allocations.size();
|
||||
uint32 combos = character_create_race_class_combos.size();
|
||||
@@ -658,6 +657,10 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app)
|
||||
}
|
||||
|
||||
bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
|
||||
if(!CanTakeAction()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GetAccountID() == 0) {
|
||||
Log.Out(Logs::Detail, Logs::World_Server,"Account ID not set; unable to create character.");
|
||||
return false;
|
||||
@@ -689,6 +692,11 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
|
||||
}
|
||||
|
||||
bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
if(!CanTakeAction()) {
|
||||
ZoneUnavail();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GetAccountID() == 0) {
|
||||
Log.Out(Logs::Detail, Logs::World_Server,"Enter world with no logged in account");
|
||||
eqs->Close();
|
||||
@@ -908,6 +916,9 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
}
|
||||
|
||||
bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) {
|
||||
if(!CanTakeAction()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer);
|
||||
if(char_acct_id == GetAccountID()) {
|
||||
@@ -960,49 +971,66 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
{
|
||||
case OP_World_SpellFileCheck:
|
||||
{
|
||||
if(spell_verify.Verify((char*)app->pBuffer, app->Size())) {
|
||||
Log.Out(Logs::General, Logs::Status, "Spell file verified.");
|
||||
if(EQEmu::FileVerifyManager::Get().VerifySpellFile(app, eqs->GetClientVersion())) {
|
||||
if(cle) {
|
||||
cle->SetSpellFileVerified(true);
|
||||
}
|
||||
} else {
|
||||
Log.Out(Logs::General, Logs::Status, "Spell file not verified.");
|
||||
if(cle) {
|
||||
cle->SetSpellFileVerified(false);
|
||||
}
|
||||
}
|
||||
StartInTutorial = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
case OP_World_SkillFileCheck:
|
||||
{
|
||||
if(skills_verify.Verify((char*)app->pBuffer, app->Size())) {
|
||||
Log.Out(Logs::General, Logs::Status, "Skill file verified.");
|
||||
if(EQEmu::FileVerifyManager::Get().VerifySkillFile(app, eqs->GetClientVersion())) {
|
||||
if(cle) {
|
||||
cle->SetSkillFileVerified(true);
|
||||
}
|
||||
} else {
|
||||
Log.Out(Logs::General, Logs::Status, "Skill file not verified.");
|
||||
if(cle) {
|
||||
cle->SetSkillFileVerified(false);
|
||||
}
|
||||
}
|
||||
StartInTutorial = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
case OP_World_BaseDataFileCheck:
|
||||
{
|
||||
if(basedata_verify.Verify((char*)app->pBuffer, app->Size())) {
|
||||
Log.Out(Logs::General, Logs::Status, "BaseData file verified.");
|
||||
if(EQEmu::FileVerifyManager::Get().VerifyBaseDataFile(app, eqs->GetClientVersion())) {
|
||||
if(cle) {
|
||||
cle->SetBaseDataFileVerified(true);
|
||||
}
|
||||
} else {
|
||||
Log.Out(Logs::General, Logs::Status, "BaseData file not verified.");
|
||||
if(cle) {
|
||||
cle->SetBaseDataFileVerified(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StartInTutorial = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
case OP_World_ExeFileCheck:
|
||||
{
|
||||
if(eqgame_verify.Verify((char*)app->pBuffer, app->Size())) {
|
||||
Log.Out(Logs::General, Logs::Status, "eqgame.exe verified.");
|
||||
if(EQEmu::FileVerifyManager::Get().VerifyEQGame(app, eqs->GetClientVersion())) {
|
||||
if(cle) {
|
||||
cle->SetEQGameVerified(true);
|
||||
}
|
||||
} else {
|
||||
Log.Out(Logs::General, Logs::Status, "eqgame.exe not verified.");
|
||||
if(cle) {
|
||||
cle->SetEQGameVerified(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StartInTutorial = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
case OP_SendLoginInfo:
|
||||
{
|
||||
return HandleSendLoginInfoPacket(app);
|
||||
@@ -1048,21 +1076,15 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
||||
case OP_ApproveWorld:
|
||||
case OP_WorldClientReady:
|
||||
{
|
||||
//char buffer[64];
|
||||
//app->build_header_dump(buffer);
|
||||
//Log.Out(Logs::General, Logs::Status, "%s %s", buffer, DumpPacketToString(app).c_str());
|
||||
|
||||
// Essentially we are just 'eating' these packets, indicating
|
||||
// they are handled.
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Log.Out(Logs::Detail, Logs::World_Server,"Received unknown EQApplicationPacket");
|
||||
|
||||
//char buffer[64];
|
||||
//app->build_header_dump(buffer);
|
||||
//Log.Out(Logs::General, Logs::Status, "%s %s", buffer, DumpPacketToString(app).c_str());
|
||||
char buffer[64];
|
||||
app->build_header_dump(buffer);
|
||||
Log.Out(Logs::General, Logs::Status, "%s %s", buffer, DumpPacketToString(app).c_str());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2035,3 +2057,14 @@ void Client::SetClassLanguages(PlayerProfile_Struct *pp)
|
||||
}
|
||||
}
|
||||
|
||||
bool Client::CanTakeAction() {
|
||||
if(RuleB(World, AllowActionWithBadFiles)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!cle) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return cle->GetBaseDataFileVerified() && cle->GetEQGameVerified() && cle->GetSkillFileVerified() && cle->GetSpellFileVerified();
|
||||
}
|
||||
|
||||
@@ -100,6 +100,8 @@ private:
|
||||
bool seencharsel;
|
||||
bool realfirstlogin;
|
||||
|
||||
bool CanTakeAction();
|
||||
|
||||
bool HandlePacket(const EQApplicationPacket *app);
|
||||
bool HandleNameApprovalPacket(const EQApplicationPacket *app);
|
||||
bool HandleSendLoginInfoPacket(const EQApplicationPacket *app);
|
||||
|
||||
@@ -46,6 +46,11 @@ ClientListEntry::ClientListEntry(uint32 in_id, uint32 iLSID, const char* iLoginN
|
||||
plocal=(local==1);
|
||||
|
||||
pinstance = 0;
|
||||
|
||||
spell_file_verified = true;
|
||||
skill_file_verified = true;
|
||||
base_data_file_verified = true;
|
||||
eqgame_file_verified = true;
|
||||
}
|
||||
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, uint32 iAccID, const char* iAccName, MD5& iMD5Pass, int16 iAdmin)
|
||||
@@ -63,6 +68,11 @@ ClientListEntry::ClientListEntry(uint32 in_id, uint32 iAccID, const char* iAccNa
|
||||
padmin = iAdmin;
|
||||
|
||||
pinstance = 0;
|
||||
|
||||
spell_file_verified = true;
|
||||
skill_file_verified = true;
|
||||
base_data_file_verified = true;
|
||||
eqgame_file_verified = true;
|
||||
}
|
||||
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer* iZS, ServerClientList_Struct* scl, int8 iOnline)
|
||||
@@ -86,6 +96,11 @@ ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer* iZS, ServerClientList
|
||||
Update(iZS, scl, iOnline);
|
||||
else
|
||||
SetOnline(iOnline);
|
||||
|
||||
spell_file_verified = true;
|
||||
skill_file_verified = true;
|
||||
base_data_file_verified = true;
|
||||
eqgame_file_verified = true;
|
||||
}
|
||||
|
||||
ClientListEntry::~ClientListEntry() {
|
||||
|
||||
@@ -87,6 +87,16 @@ public:
|
||||
inline void PushToTellQueue(ServerChannelMessage_Struct *scm) { tell_queue.push_back(scm); }
|
||||
void ProcessTellQueue();
|
||||
|
||||
bool GetSpellFileVerified() { return spell_file_verified; }
|
||||
bool GetSkillFileVerified() { return skill_file_verified; }
|
||||
bool GetBaseDataFileVerified() { return base_data_file_verified; }
|
||||
bool GetEQGameVerified() { return eqgame_file_verified; }
|
||||
|
||||
void SetSpellFileVerified(bool v) { spell_file_verified = v; }
|
||||
void SetSkillFileVerified(bool v) { skill_file_verified = v; }
|
||||
void SetBaseDataFileVerified(bool v) { base_data_file_verified = v; }
|
||||
void SetEQGameVerified(bool v) { eqgame_file_verified = v; }
|
||||
|
||||
private:
|
||||
void ClearVars(bool iAll = false);
|
||||
|
||||
@@ -128,6 +138,11 @@ private:
|
||||
bool pLFGMatchFilter;
|
||||
char pLFGComments[64];
|
||||
|
||||
bool spell_file_verified;
|
||||
bool skill_file_verified;
|
||||
bool base_data_file_verified;
|
||||
bool eqgame_file_verified;
|
||||
|
||||
// Tell Queue -- really a vector :D
|
||||
std::vector<ServerChannelMessage_Struct *> tell_queue;
|
||||
};
|
||||
|
||||
@@ -1311,6 +1311,25 @@ bool ZoneServer::Process() {
|
||||
cle->ProcessTellQueue();
|
||||
break;
|
||||
}
|
||||
case ServerOP_ClientFileStatus:
|
||||
{
|
||||
ServerRequestClientFileStatus *req = (ServerRequestClientFileStatus*) pack->pBuffer;
|
||||
ClientListEntry *cle = client_list.FindCharacter(req->name);
|
||||
|
||||
if(cle) {
|
||||
ServerPacket pack(ServerOP_ClientFileStatus, sizeof(ServerResponseClientFileStatus));
|
||||
ServerResponseClientFileStatus *resp = (ServerResponseClientFileStatus*)pack.pBuffer;
|
||||
|
||||
strcpy(resp->name, req->name);
|
||||
resp->spells = cle->GetSpellFileVerified();
|
||||
resp->skills = cle->GetSkillFileVerified();
|
||||
resp->base_data = cle->GetBaseDataFileVerified();
|
||||
resp->eqgame = cle->GetEQGameVerified();
|
||||
zoneserver_list.SendPacket(req->zone_id, req->instance_id, &pack);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Log.Out(Logs::Detail, Logs::World_Server, "Unknown ServerOPcode from zone 0x%04x, size %d", pack->opcode, pack->size);
|
||||
|
||||
Reference in New Issue
Block a user