diff --git a/common/database.cpp b/common/database.cpp index 1058cc5e1..cd5693e89 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1130,7 +1130,7 @@ bool Database::CheckDatabaseConversions() { /* Verify PP Integrity */ lengths = mysql_fetch_lengths(result2); - if (lengths[1] > 0) { + if (lengths[1] == sizeof(PlayerProfile_Struct)) { memcpy(pp, row2[1], sizeof(PlayerProfile_Struct)); // printf("FINE: Player profile '%s' %i length Expected: %i, Got: %i \n", row2[2], atoi(row2[3]), sizeof(PlayerProfile_Struct), lengths[1]); } diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index d6ffd119b..c561e3a22 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -801,8 +801,8 @@ struct SuspendedMinion_Struct ** OpCode: 0x006a */ static const uint32 MAX_PP_LANGUAGE = 28; -static const uint32 MAX_PP_SPELLBOOK = 720; // Increased to 480 to support SoF -static const uint32 MAX_PP_MEMSPELL = 12; +static const uint32 MAX_PP_SPELLBOOK = 480; // Increased to 480 to support SoF +static const uint32 MAX_PP_MEMSPELL = 9; static const uint32 MAX_PP_SKILL = _SkillPacketArraySize; // 100 - actual skills buffer size static const uint32 MAX_PP_AA_ARRAY = 240; static const uint32 MAX_GROUP_MEMBERS = 6; diff --git a/world/worlddb.cpp b/world/worlddb.cpp index b07480031..81c99d022 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -124,61 +124,6 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* uint8 bind_heading_id = atoi(row_b[r]); r++; } - // if (pp->binds[4].zoneId == 0) { - // bool altered = false; - // MYSQL_RES *result2; - // MYSQL_ROW row2; - // char startzone[50] = { 0 }; - // - // // check for start zone variable (I didn't even know any variables were still being used...) - // if (database.GetVariable("startzone", startzone, 50)) { - // uint32 zoneid = database.GetZoneID(startzone); - // if (zoneid) { - // pp->binds[4].zoneId = zoneid; - // GetSafePoints(zoneid, 0, &pp->binds[4].x, &pp->binds[4].y, &pp->binds[4].z); - // altered = true; - // } - // } - // else { - // RunQuery(query, - // MakeAnyLenString(&query, - // "SELECT zone_id,bind_id,x,y,z FROM start_zones " - // "WHERE player_class=%i AND player_deity=%i AND player_race=%i", - // pp->class_, - // pp->deity, - // pp->race - // ), - // errbuf, - // &result2 - // ); - // safe_delete_array(query); - // - // // if there is only one possible start city, set it - // if (mysql_num_rows(result2) == 1) { - // row2 = mysql_fetch_row(result2); - // if (atoi(row2[1]) != 0) { // if a bind_id is specified, make them start there - // pp->binds[4].zoneId = (uint32)atoi(row2[1]); - // GetSafePoints(pp->binds[4].zoneId, 0, &pp->binds[4].x, &pp->binds[4].y, &pp->binds[4].z); - // } - // else { // otherwise, use the zone and coordinates given - // pp->binds[4].zoneId = (uint32)atoi(row2[0]); - // float x = atof(row2[2]); - // float y = atof(row2[3]); - // float z = atof(row2[4]); - // if (x == 0 && y == 0 && z == 0) - // GetSafePoints(pp->binds[4].zoneId, 0, &x, &y, &z); - // - // pp->binds[4].x = x; - // pp->binds[4].y = y; - // pp->binds[4].z = z; - // } - // altered = true; - // } - // - // mysql_free_result(result2); - // } - // } - /* Character's equipped items @merth: Haven't done bracer01/bracer02 yet. @@ -194,10 +139,6 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* slot = atoi(row_b[0]); if (atoi(row_b[1]) == 1){ pp.item_tint[slot].rgb.use_tint = 0xFF; } pp.item_tint[slot].color = atoul(row_b[2]); - printf("charid: %u \n", character_id); - printf("slot: %u \n", slot); - printf("use_tint: %u item_tint: %u \n", pp.item_tint[slot].rgb.use_tint, atoul(row_b[2])); - cs->cs_colors[char_num][slot].color = atoul(row_b[2]); } /* Load Inventory */ @@ -212,9 +153,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs->equip[char_num][material] = item->GetItem()->Material; - color = pp.item_tint[material].color; - // if (pp.item_tint[material].rgb.use_tint){ color = pp.item_tint[material].color; } - // else{ color = item->GetItem()->Color; } + if (pp.item_tint[material].rgb.use_tint){ color = pp.item_tint[material].color; } + else{ color = item->GetItem()->Color; } cs->cs_colors[char_num][material].color = color; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index bdd08b002..88425fade 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -597,7 +597,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) loaditems = database.GetInventory(cid, &m_inv); /* Load Character Inventory */ database.LoadCharacterBindPoint(cid, &m_pp); /* Load Character Bind */ - database.LoadCharacterMaterial(cid, &m_pp); /* Load Character Material */ + database.LoadCharacterMaterialColor(cid, &m_pp); /* Load Character Material */ database.LoadCharacterCurrency(cid, &m_pp); /* Load Character Currency into PP */ database.LoadCharacterData(cid, &m_pp); /* Load Character Data from DB into PP */ database.GetPlayerInspectMessage(m_pp.name, &m_inspect_message); /* Move to another method when can, this is pointless... */ diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 50b48fff9..02cf6e568 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -1878,8 +1878,8 @@ void Client::DyeArmor(DyeStruct* dye){ ItemInst* inst = this->m_inv.GetItem(slot2); if(inst){ uint32 armor_color = (dye->dye[i].rgb.red * 65536) + (dye->dye[i].rgb.green * 256) + (dye->dye[i].rgb.blue); - inst->SetColor(armor_color); - database.SaveCharacterMaterialColor(this->CharacterID(), slot2, armor_color); + inst->SetColor(armor_color); + database.SaveCharacterMaterialColor(this->CharacterID(), i, armor_color); database.SaveInventory(CharacterID(),inst,slot2); if(dye->dye[i].rgb.use_tint) m_pp.item_tint[i].rgb.use_tint = 0xFF; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index b998733c3..50a74c892 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1151,9 +1151,9 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i return true; } -bool ZoneDatabase::LoadCharacterMaterial(uint32 character_id, PlayerProfile_Struct* pp){ +bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile_Struct* pp){ std::string query = StringFormat("SELECT slot, blue, green, red, use_tint, color FROM `character_material` WHERE `id` = %u LIMIT 9", character_id); - auto results = database.QueryDatabase(query); int i = 0; int r = 0; + auto results = database.QueryDatabase(query); int i = 0; int r = 0; for (auto row = results.begin(); row != results.end(); ++row) { r = 0; i = atoi(row[r]); /* Slot */ r++; diff --git a/zone/zonedb.h b/zone/zonedb.h index d98749f5e..705377a39 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -266,7 +266,7 @@ public: bool LoadCharacterData(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Struct* pp); - bool LoadCharacterMaterial(uint32 character_id, PlayerProfile_Struct* pp); + bool LoadCharacterMaterialColor(uint32 character_id, PlayerProfile_Struct* pp); /* Character Data Saves */ bool SaveCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp);