Pre-purposed prep-work

This commit is contained in:
Uleat
2015-02-14 21:36:54 -05:00
parent dedbb3f6c8
commit 20249cec67
8 changed files with 86 additions and 34 deletions
+16 -16
View File
@@ -86,11 +86,11 @@ Client::Client(EQStreamInterface* ieqs)
charid = 0;
pwaitingforbootup = 0;
StartInTutorial = false;
ClientVersionBit = 0;
numclients++;
if (eqs->GetClientVersion() != ClientVersion::Unknown)
ClientVersionBit = 1 << (static_cast<unsigned int>(eqs->GetClientVersion()) - 1);
m_ClientVersion = eqs->GetClientVersion();
m_ClientVersionBit = ClientBitFromVersion(m_ClientVersion);
numclients++;
}
Client::~Client() {
@@ -161,7 +161,7 @@ void Client::SendCharInfo() {
cle->SetOnline(CLE_Status_CharSelect);
}
if (ClientVersionBit & BIT_RoFAndLater)
if (m_ClientVersionBit & BIT_RoFAndLater)
{
// Can make max char per account into a rule - New to VoA
SendMaxCharCreate(10);
@@ -176,7 +176,7 @@ void Client::SendCharInfo() {
auto outapp = new EQApplicationPacket(OP_SendCharInfo, sizeof(CharacterSelect_Struct));
CharacterSelect_Struct* cs = (CharacterSelect_Struct*)outapp->pBuffer;
database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit);
database.GetCharSelectInfo(GetAccountID(), cs, m_ClientVersionBit);
QueuePacket(outapp);
safe_delete(outapp);
@@ -671,7 +671,7 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) {
}
else
{
if(ClientVersionBit & BIT_TitaniumAndEarlier)
if (m_ClientVersionBit & BIT_TitaniumAndEarlier)
StartInTutorial = true;
SendCharInfo();
}
@@ -719,7 +719,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if(!pZoning && ew->return_home && !ew->tutorial) {
auto cs = new CharacterSelect_Struct;
memset(cs, 0, sizeof(CharacterSelect_Struct));
database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit);
database.GetCharSelectInfo(GetAccountID(), cs, m_ClientVersionBit);
bool home_enabled = false;
for(int x = 0; x < 10; ++x)
@@ -749,7 +749,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if(!pZoning && (RuleB(World, EnableTutorialButton) && (ew->tutorial || StartInTutorial))) {
auto cs = new CharacterSelect_Struct;
memset(cs, 0, sizeof(CharacterSelect_Struct));
database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit);
database.GetCharSelectInfo(GetAccountID(), cs, m_ClientVersionBit);
bool tutorial_enabled = false;
for(int x = 0; x < 10; ++x)
@@ -846,9 +846,9 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
char ConnectionType;
if(ClientVersionBit & BIT_UFAndLater)
if (m_ClientVersionBit & BIT_UFAndLater)
ConnectionType = 'U';
else if(ClientVersionBit & BIT_SoFAndLater)
else if (m_ClientVersionBit & BIT_SoFAndLater)
ConnectionType = 'S';
else
ConnectionType = 'C';
@@ -872,7 +872,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
outapp2 = new EQApplicationPacket(OP_SetChatServer2);
if(ClientVersionBit & BIT_TitaniumAndEarlier)
if (m_ClientVersionBit & BIT_TitaniumAndEarlier)
ConnectionType = 'M';
sprintf(buffer,"%s,%i,%s.%s,%c%08X",
@@ -906,7 +906,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) {
bool Client::HandleZoneChangePacket(const EQApplicationPacket *app) {
// HoT sends this to world while zoning and wants it echoed back.
if(ClientVersionBit & BIT_RoFAndLater)
if (m_ClientVersionBit & BIT_RoFAndLater)
{
QueuePacket(app);
}
@@ -1370,7 +1370,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
Log.Out(Logs::Detail, Logs::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor);
/* Validate the char creation struct */
if (ClientVersionBit & BIT_SoFAndLater) {
if (m_ClientVersionBit & BIT_SoFAndLater) {
if (!CheckCharCreateInfoSoF(cc)) {
Log.Out(Logs::Detail, Logs::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)");
return false;
@@ -1438,7 +1438,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
pp.pvp = database.GetServerType() == 1 ? 1 : 0;
/* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */
if (ClientVersionBit & BIT_SoFAndLater) {
if (m_ClientVersionBit & BIT_SoFAndLater) {
Log.Out(Logs::Detail, Logs::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID));
if (RuleI(World, SoFStartZoneID) > 0) {
pp.zone_id = RuleI(World, SoFStartZoneID);
@@ -1454,7 +1454,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
}
}
/* use normal starting zone logic to either get defaults, or if startzone was set, load that from the db table.*/
bool ValidStartZone = database.GetStartZone(&pp, cc, ClientVersionBit & BIT_TitaniumAndEarlier);
bool ValidStartZone = database.GetStartZone(&pp, cc, m_ClientVersionBit & BIT_TitaniumAndEarlier);
if (!ValidStartZone){
return false;
+2 -1
View File
@@ -84,7 +84,8 @@ private:
uint32 pwaitingforbootup;
bool StartInTutorial;
uint32 ClientVersionBit;
ClientVersion m_ClientVersion;
uint32 m_ClientVersionBit;
bool OPCharCreate(char *name, CharCreate_Struct *cc);
void SetClassStartingSkills( PlayerProfile_Struct *pp );
+5 -8
View File
@@ -33,8 +33,9 @@ extern std::vector<RaceClassCombos> character_create_race_class_combos;
// the current stuff is at the bottom of this function
void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion) {
Inventory *inv;
void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion)
{
Inventory *inv = nullptr;
uint8 has_home = 0;
uint8 has_bind = 0;
@@ -74,7 +75,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
"character_data "
"WHERE `account_id` = %i ORDER BY `name` LIMIT 10 ", account_id);
auto results = database.QueryDatabase(cquery); int char_num = 0;
for (auto row = results.begin(); row != results.end(); ++row) {
for (auto row = results.begin(); row != results.end() && char_num < 10; ++row, ++char_num) {
PlayerProfile_Struct pp;
memset(&pp, 0, sizeof(PlayerProfile_Struct));
@@ -167,6 +168,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
}
/* Load Inventory */
// If we ensure that the material data is updated appropriately, we can do away with inventory loads
inv = new Inventory;
if (GetInventory(account_id, cs->name[char_num], inv))
{
@@ -237,11 +239,6 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
}
safe_delete(inv);
if (++char_num > 10)
{
break;
}
}
return;