mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Fixed Character select to be loaded from new character data tables
This commit is contained in:
parent
e0a99730e5
commit
e0db3c0b60
@ -798,7 +798,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
int character_id = 0;
|
int character_id = 0;
|
||||||
int account_id = 0;
|
int account_id = 0;
|
||||||
int number_of_characters = 0;
|
int number_of_characters = 0;
|
||||||
int printppdebug = 0;
|
int printppdebug = 0; /* Prints Player Profile */
|
||||||
int runconvert = 0;
|
int runconvert = 0;
|
||||||
|
|
||||||
/* Check For Legacy Storage Method */
|
/* Check For Legacy Storage Method */
|
||||||
@ -842,7 +842,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
" `race` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `race` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `class` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `class` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `level` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `level` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `deity` tinyint(11) UNSIGNED NOT NULL, "
|
" `deity` int(11) UNSIGNED NOT NULL, "
|
||||||
" `birthday` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `birthday` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `last_login` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `last_login` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `time_played` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `time_played` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
@ -886,9 +886,9 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
" `drakkin_heritage` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `drakkin_heritage` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `drakkin_tattoo` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `drakkin_tattoo` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `drakkin_details` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `drakkin_details` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `toxicity` int(11) NOT NULL DEFAULT 0, "
|
" `toxicity` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `hunger_level` int(11) NOT NULL DEFAULT 0, "
|
" `hunger_level` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `thirst_level` int(11) NOT NULL DEFAULT 0, "
|
" `thirst_level` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `ability_up` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `ability_up` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `zone_id` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `zone_id` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
" `zone_instance` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
" `zone_instance` int(11) UNSIGNED NOT NULL DEFAULT 0, "
|
||||||
@ -1113,9 +1113,9 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
printf("Starting conversion...\n\n");
|
printf("Starting conversion...\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// querylen = MakeAnyLenString(&query, "SELECT `id` FROM `character_` WHERE `id` = 61238");
|
// querylen = MakeAnyLenString(&query, "SELECT `id` FROM `character_` WHERE `id` = 61238"); // WHERE `account_id` = 11001
|
||||||
int char_iter_count = 0;
|
int char_iter_count = 0;
|
||||||
querylen = MakeAnyLenString(&query, "SELECT `id` FROM `character_` WHERE `id` >= 61238 LIMIT 10");
|
querylen = MakeAnyLenString(&query, "SELECT `id` FROM `character_` WHERE `account_id` = 11001");
|
||||||
if (RunQuery(query, querylen, errbuf, &result)) {
|
if (RunQuery(query, querylen, errbuf, &result)) {
|
||||||
safe_delete_array(query);
|
safe_delete_array(query);
|
||||||
while (row = mysql_fetch_row(result)) {
|
while (row = mysql_fetch_row(result)) {
|
||||||
@ -1176,96 +1176,96 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
/* Run Character Data Convert */
|
/* Run Character Data Convert */
|
||||||
rquery = StringFormat(
|
rquery = StringFormat(
|
||||||
"REPLACE INTO `character_data` ("
|
"REPLACE INTO `character_data` ("
|
||||||
" id, "
|
"id,"
|
||||||
" account_id, "
|
"account_id,"
|
||||||
" `name`, "
|
"`name`,"
|
||||||
" last_name, "
|
"last_name,"
|
||||||
" gender, "
|
"gender,"
|
||||||
" race, "
|
"race,"
|
||||||
" class, "
|
"class,"
|
||||||
" `level`, "
|
"`level`,"
|
||||||
" deity, "
|
"deity,"
|
||||||
" birthday, "
|
"birthday,"
|
||||||
" last_login, "
|
"last_login,"
|
||||||
" time_played, "
|
"time_played,"
|
||||||
" pvp_status, "
|
"pvp_status,"
|
||||||
" level2, "
|
"level2,"
|
||||||
" anon, "
|
"anon,"
|
||||||
" gm, "
|
"gm,"
|
||||||
" intoxication, "
|
"intoxication,"
|
||||||
" hair_color, "
|
"hair_color,"
|
||||||
" beard_color, "
|
"beard_color,"
|
||||||
" eye_color_1, "
|
"eye_color_1,"
|
||||||
" eye_color_2, "
|
"eye_color_2,"
|
||||||
" hair_style, "
|
"hair_style,"
|
||||||
" beard, "
|
"beard,"
|
||||||
" ability_time_seconds, "
|
"ability_time_seconds,"
|
||||||
" ability_number, "
|
"ability_number,"
|
||||||
" ability_time_minutes, "
|
"ability_time_minutes,"
|
||||||
" ability_time_hours, "
|
"ability_time_hours,"
|
||||||
" title, "
|
"title,"
|
||||||
" suffix, "
|
"suffix,"
|
||||||
" exp, "
|
"exp,"
|
||||||
" points, "
|
"points,"
|
||||||
" mana, "
|
"mana,"
|
||||||
" cur_hp, "
|
"cur_hp,"
|
||||||
" str, "
|
"str,"
|
||||||
" sta, "
|
"sta,"
|
||||||
" cha, "
|
"cha,"
|
||||||
" dex, "
|
"dex,"
|
||||||
" `int`, "
|
"`int`,"
|
||||||
" agi, "
|
"agi,"
|
||||||
" wis, "
|
"wis,"
|
||||||
" face, "
|
"face,"
|
||||||
" y, "
|
"y,"
|
||||||
" x, "
|
"x,"
|
||||||
" z, "
|
"z,"
|
||||||
" heading, "
|
"heading,"
|
||||||
" pvp2, "
|
"pvp2,"
|
||||||
" pvp_type, "
|
"pvp_type,"
|
||||||
" autosplit_enabled, "
|
"autosplit_enabled,"
|
||||||
" zone_change_count, "
|
"zone_change_count,"
|
||||||
" drakkin_heritage, "
|
"drakkin_heritage,"
|
||||||
" drakkin_tattoo, "
|
"drakkin_tattoo,"
|
||||||
" drakkin_details, "
|
"drakkin_details,"
|
||||||
" toxicity, "
|
"toxicity,"
|
||||||
" hunger_level, "
|
"hunger_level,"
|
||||||
" thirst_level, "
|
"thirst_level,"
|
||||||
" ability_up, "
|
"ability_up,"
|
||||||
" zone_id, "
|
"zone_id,"
|
||||||
" zone_instance, "
|
"zone_instance,"
|
||||||
" leadership_exp_on, "
|
"leadership_exp_on,"
|
||||||
" ldon_points_guk, "
|
"ldon_points_guk,"
|
||||||
" ldon_points_mir, "
|
"ldon_points_mir,"
|
||||||
" ldon_points_mmc, "
|
"ldon_points_mmc,"
|
||||||
" ldon_points_ruj, "
|
"ldon_points_ruj,"
|
||||||
" ldon_points_tak, "
|
"ldon_points_tak,"
|
||||||
" ldon_points_available, "
|
"ldon_points_available,"
|
||||||
" tribute_time_remaining, "
|
"tribute_time_remaining,"
|
||||||
" show_helm, "
|
"show_helm,"
|
||||||
" career_tribute_points, "
|
"career_tribute_points,"
|
||||||
" tribute_points, "
|
"tribute_points,"
|
||||||
" tribute_active, "
|
"tribute_active,"
|
||||||
" endurance, "
|
"endurance,"
|
||||||
" group_leadership_exp, "
|
"group_leadership_exp,"
|
||||||
" raid_leadership_exp, "
|
"raid_leadership_exp,"
|
||||||
" group_leadership_points, "
|
"group_leadership_points,"
|
||||||
" raid_leadership_points, "
|
"raid_leadership_points,"
|
||||||
" air_remaining, "
|
"air_remaining,"
|
||||||
" pvp_kills, "
|
"pvp_kills,"
|
||||||
" pvp_deaths, "
|
"pvp_deaths,"
|
||||||
" pvp_current_points, "
|
"pvp_current_points,"
|
||||||
" pvp_career_points, "
|
"pvp_career_points,"
|
||||||
" pvp_best_kill_streak, "
|
"pvp_best_kill_streak,"
|
||||||
" pvp_worst_death_streak, "
|
"pvp_worst_death_streak,"
|
||||||
" pvp_current_kill_streak, "
|
"pvp_current_kill_streak,"
|
||||||
" aa_points_spent, "
|
"aa_points_spent,"
|
||||||
" aa_exp, "
|
"aa_exp,"
|
||||||
" aa_points, "
|
"aa_points,"
|
||||||
" group_auto_consent, "
|
"group_auto_consent,"
|
||||||
" raid_auto_consent, "
|
"raid_auto_consent,"
|
||||||
" guild_auto_consent, "
|
"guild_auto_consent,"
|
||||||
" RestTimer) "
|
"RestTimer)"
|
||||||
"VALUES ("
|
"VALUES ("
|
||||||
"%u," // id
|
"%u," // id
|
||||||
"%u," // account_id
|
"%u," // account_id
|
||||||
@ -1450,6 +1450,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
pp->RestTimer
|
pp->RestTimer
|
||||||
);
|
);
|
||||||
results = QueryDatabase(rquery);
|
results = QueryDatabase(rquery);
|
||||||
|
if (!results.RowsAffected()){ std::cout << "ERROR PP Data Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
|
||||||
|
|
||||||
/* Run AA Convert */
|
/* Run AA Convert */
|
||||||
for (i = 0; i < MAX_PP_AA_ARRAY; i++){
|
for (i = 0; i < MAX_PP_AA_ARRAY; i++){
|
||||||
@ -1457,7 +1458,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = StringFormat("REPLACE INTO `character_alternate_abilities` (id, slot, aa_id, aa_value)"
|
rquery = StringFormat("REPLACE INTO `character_alternate_abilities` (id, slot, aa_id, aa_value)"
|
||||||
" VALUES (%u, %u, %u, %u)",
|
" VALUES (%u, %u, %u, %u)",
|
||||||
character_id, i, pp->aa_array[i].AA, pp->aa_array[i].value);
|
character_id, i, pp->aa_array[i].AA, pp->aa_array[i].value);
|
||||||
QueryDatabase(rquery);
|
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR AA Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1465,13 +1466,13 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
rquery = StringFormat("REPLACE INTO `character_bind_home` (id, zone_id, instance_id, x, y, z, heading)"
|
rquery = StringFormat("REPLACE INTO `character_bind_home` (id, zone_id, instance_id, x, y, z, heading)"
|
||||||
" VALUES (%u, %u, %u, %f, %f, %f, %f)",
|
" VALUES (%u, %u, %u, %f, %f, %f, %f)",
|
||||||
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
|
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
|
||||||
QueryDatabase(rquery);
|
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Bind Home Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
|
||||||
|
|
||||||
/* Run Language Convert */
|
/* Run Language Convert */
|
||||||
for (i = 0; i < MAX_PP_LANGUAGE; i++){
|
for (i = 0; i < MAX_PP_LANGUAGE; i++){
|
||||||
if (pp->languages[i] > 0){
|
if (pp->languages[i] > 0){
|
||||||
rquery = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, i, pp->languages[i]);
|
rquery = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, i, pp->languages[i]);
|
||||||
QueryDatabase(rquery);
|
QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Language Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1479,7 +1480,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
for (i = 0; i < MAX_PP_SKILL; i++){
|
for (i = 0; i < MAX_PP_SKILL; i++){
|
||||||
if (pp->skills[i] > 0){
|
if (pp->skills[i] > 0){
|
||||||
rquery = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, i, pp->skills[i]);
|
rquery = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, i, pp->skills[i]);
|
||||||
QueryDatabase(rquery);
|
QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Skill Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1487,7 +1488,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
for (i = 0; i < MAX_PP_SPELLBOOK; i++){
|
for (i = 0; i < MAX_PP_SPELLBOOK; i++){
|
||||||
if (pp->spell_book[i] > 0 && pp->spell_book[i] != 4294967295){
|
if (pp->spell_book[i] > 0 && pp->spell_book[i] != 4294967295){
|
||||||
rquery = StringFormat("REPLACE INTO `character_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->spell_book[i]);
|
rquery = StringFormat("REPLACE INTO `character_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->spell_book[i]);
|
||||||
QueryDatabase(rquery);
|
QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Spell Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1495,7 +1496,7 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
for (i = 0; i < MAX_PP_MEMSPELL; i++){
|
for (i = 0; i < MAX_PP_MEMSPELL; i++){
|
||||||
if (pp->mem_spells[i] > 0){
|
if (pp->mem_spells[i] > 0){
|
||||||
rquery = StringFormat("REPLACE INTO `character_memmed_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->mem_spells[i]);
|
rquery = StringFormat("REPLACE INTO `character_memmed_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->mem_spells[i]);
|
||||||
QueryDatabase(rquery);
|
QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Memmed Spell Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1503,15 +1504,15 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
for (i = 0; i < MAX_PP_DISCIPLINES; i++){
|
for (i = 0; i < MAX_PP_DISCIPLINES; i++){
|
||||||
if (pp->disciplines.values[i] > 0){
|
if (pp->disciplines.values[i] > 0){
|
||||||
rquery = StringFormat("REPLACE INTO `character_disciplines` (id, disc_id) VALUES (%u, %u)", character_id, pp->disciplines.values[i]);
|
rquery = StringFormat("REPLACE INTO `character_disciplines` (id, disc_id) VALUES (%u, %u)", character_id, pp->disciplines.values[i]);
|
||||||
QueryDatabase(rquery);
|
QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Discipline Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Run Material Color Convert */
|
/* Run Material Color Convert */
|
||||||
for (i = 0; i < _MaterialCount; i++){
|
for (i = 0; i < _MaterialCount; i++){
|
||||||
if (pp->item_tint[i].color > 0){
|
if (pp->item_tint[i].color > 0){
|
||||||
if (pp->item_tint[i].rgb.use_tint > 0){ pp->item_tint[i].rgb.use_tint = 1; }
|
|
||||||
rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
|
rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
|
||||||
QueryDatabase(rquery);
|
// printf("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u);\n", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
|
||||||
|
QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Color Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2569,12 +2570,12 @@ uint8 Database::GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 Database::GetCharacterInfo(const char* iName, uint32* oAccID, uint32* oZoneID, uint32* oInstanceID, float* oX, float* oY, float* oZ) {
|
uint32 Database::GetCharacterInfo(const char* iName, uint32* oAccID, uint32* oZoneID, uint32* oInstanceID, float* oX, float* oY, float* oZ) {
|
||||||
|
std::string query = StringFormat("SELECT `id`, `account_id`, `zone_id`, `zone_instance`, `x`, `y`, `z` FROM `character_data` WHERE `name` = '%s'", iName);
|
||||||
std::string query = StringFormat("SELECT id, account_id, zonename, instanceid, x, y, z FROM character_ WHERE name='%s'", iName);
|
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
if (!results.Success())
|
printf("Calling Database::GetCharacterInfo: ACCID: %u ZONEID: %u INSTANCEID: %u \n", oAccID, oZoneID, oInstanceID);
|
||||||
{
|
|
||||||
|
if (!results.Success()) {
|
||||||
std::cerr << "Error in GetCharacterInfo query '" << query << "' " << results.ErrorMessage() << std::endl;
|
std::cerr << "Error in GetCharacterInfo query '" << query << "' " << results.ErrorMessage() << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2583,20 +2584,15 @@ uint32 Database::GetCharacterInfo(const char* iName, uint32* oAccID, uint32* oZo
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
uint32 charid = atoi(row[0]);
|
uint32 charid = atoi(row[0]);
|
||||||
if (oAccID)
|
if (oAccID){ *oAccID = atoi(row[1]); }
|
||||||
*oAccID = atoi(row[1]);
|
if (oZoneID){ *oZoneID = atoi(row[2]); }
|
||||||
if (oZoneID)
|
if (oInstanceID){ *oInstanceID = atoi(row[3]); }
|
||||||
*oZoneID = GetZoneID(row[2]);
|
if (oX){ *oX = atof(row[4]); }
|
||||||
if(oInstanceID)
|
if (oY){ *oY = atof(row[5]); }
|
||||||
*oInstanceID = atoi(row[3]);
|
if (oZ){ *oZ = atof(row[6]); }
|
||||||
if (oX)
|
|
||||||
*oX = atof(row[4]);
|
printf("Calling Database::GetCharacterInfo: ACCID: %u ZONEID: %u INSTANCEID: %u \n", oAccID, oZoneID, oInstanceID);
|
||||||
if (oY)
|
|
||||||
*oY = atof(row[5]);
|
|
||||||
if (oZ)
|
|
||||||
*oZ = atof(row[6]);
|
|
||||||
|
|
||||||
return charid;
|
return charid;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,6 +61,46 @@ bool SharedDatabase::SetHideMe(uint32 account_id, uint8 hideme)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
bool SharedDatabase::SetPlayerProfile(uint32 account_id, uint32 charid, PlayerProfile_Struct* pp, Inventory* inv, ExtendedProfile_Struct *ext, uint32 current_zone, uint32 current_instance, uint8 MaxXTargets) {
|
||||||
|
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||||
|
char* query = 0;
|
||||||
|
uint32 affected_rows = 0;
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
|
if (RunQuery(query, SetPlayerProfile_MQ(&query, account_id, charid, pp, inv, ext, current_zone, current_instance, MaxXTargets), errbuf, 0, &affected_rows)) {
|
||||||
|
ret = (affected_rows != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "SetPlayerProfile query '%s' %s", query, errbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
safe_delete_array(query);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate SQL for updating player profile
|
||||||
|
uint32 SharedDatabase::SetPlayerProfile_MQ(char** query, uint32 account_id, uint32 charid, PlayerProfile_Struct* pp, Inventory* inv, ExtendedProfile_Struct *ext, uint32 current_zone, uint32 current_instance, uint8 MaxXTargets) {
|
||||||
|
*query = new char[396 + sizeof(PlayerProfile_Struct)* 2 + sizeof(ExtendedProfile_Struct)* 2 + 4];
|
||||||
|
char* end = *query;
|
||||||
|
if (!current_zone)
|
||||||
|
current_zone = pp->zone_id;
|
||||||
|
|
||||||
|
if (!current_instance)
|
||||||
|
current_instance = pp->zoneInstance;
|
||||||
|
|
||||||
|
if (strlen(pp->name) == 0) // Sanity check in case pp never loaded
|
||||||
|
return false;
|
||||||
|
|
||||||
|
end += sprintf(end, "UPDATE character_ SET timelaston=unix_timestamp(now()),name=\'%s\', zonename=\'%s\', zoneid=%u, instanceid=%u, x = %f, y = %f, z = %f, ", pp->name, "halas", 29, current_instance, pp->x, pp->y, pp->z);
|
||||||
|
// end += DoEscapeString(end, (char*)pp, sizeof(PlayerProfile_Struct));
|
||||||
|
end += sprintf(end, " extprofile=\'");
|
||||||
|
end += DoEscapeString(end, (char*)ext, sizeof(ExtendedProfile_Struct));
|
||||||
|
end += sprintf(end, "\',class=%d,level=%d,xtargets=%u WHERE id=%u", pp->class_, pp->level, MaxXTargets, charid);
|
||||||
|
|
||||||
|
return (uint32)(end - (*query));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8 SharedDatabase::GetGMSpeed(uint32 account_id)
|
uint8 SharedDatabase::GetGMSpeed(uint32 account_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,6 +34,9 @@ public:
|
|||||||
SharedDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
SharedDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||||
virtual ~SharedDatabase();
|
virtual ~SharedDatabase();
|
||||||
|
|
||||||
|
/* Temp */
|
||||||
|
uint32 SetPlayerProfile_MQ(char** query, uint32 account_id, uint32 charid, PlayerProfile_Struct* pp, Inventory* inv, ExtendedProfile_Struct *ext, uint32 current_zone, uint32 current_instance, uint8 MaxXTargets);
|
||||||
|
bool SetPlayerProfile(uint32 account_id, uint32 charid, PlayerProfile_Struct* pp, Inventory* inv, ExtendedProfile_Struct *ext, uint32 current_zone, uint32 current_instance, uint8 MaxXTargets);
|
||||||
/*
|
/*
|
||||||
* General Character Related Stuff
|
* General Character Related Stuff
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -35,9 +35,7 @@ extern std::vector<RaceClassCombos> character_create_race_class_combos;
|
|||||||
|
|
||||||
// solar: the current stuff is at the bottom of this function
|
// solar: the current stuff is at the bottom of this function
|
||||||
void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs) {
|
void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs) {
|
||||||
/* Initialize Player Profile for the small time it is being used for item material */
|
Inventory *inv;
|
||||||
PlayerProfile_Struct pp;
|
|
||||||
memset(&pp, 0, sizeof(PlayerProfile_Struct));
|
|
||||||
|
|
||||||
/* Initialize Variables */
|
/* Initialize Variables */
|
||||||
for (int i=0; i<10; i++) {
|
for (int i=0; i<10; i++) {
|
||||||
@ -73,10 +71,12 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
|
|||||||
"zone_id " // 19
|
"zone_id " // 19
|
||||||
"FROM "
|
"FROM "
|
||||||
"character_data "
|
"character_data "
|
||||||
"WHERE `account_id` = %i LIMIT 10 ", account_id);
|
"WHERE `account_id` = %i ORDER BY `name` LIMIT 10 ", account_id);
|
||||||
auto results = database.QueryDatabase(cquery); uint16 char_num = 0;
|
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(); ++row) {
|
||||||
printf("id is %i \n", atoi(row[0]));
|
PlayerProfile_Struct pp;
|
||||||
|
memset(&pp, 0, sizeof(PlayerProfile_Struct));
|
||||||
|
|
||||||
uint32 character_id = atoi(row[0]);
|
uint32 character_id = atoi(row[0]);
|
||||||
strcpy(cs->name[char_num], row[1]);
|
strcpy(cs->name[char_num], row[1]);
|
||||||
uint8 lvl = atoi(row[5]);
|
uint8 lvl = atoi(row[5]);
|
||||||
@ -133,16 +133,17 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Load Character Material Data for Char Select */
|
/* Load Character Material Data for Char Select */
|
||||||
cquery = StringFormat("SELECT slot, use_tint, color FROM `character_material` WHERE `id` = %u", character_id);
|
cquery = StringFormat("SELECT slot, red, green, blue, use_tint, color FROM `character_material` WHERE `id` = %u", character_id);
|
||||||
auto results_b = database.QueryDatabase(cquery); uint8 slot = 0;
|
auto results_b = database.QueryDatabase(cquery); uint8 slot = 0;
|
||||||
for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) {
|
for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) {
|
||||||
slot = atoi(row_b[0]);
|
slot = atoi(row_b[0]);
|
||||||
if (atoi(row_b[1]) == 1){ pp.item_tint[slot].rgb.use_tint = 0xFF; }
|
pp.item_tint[slot].rgb.red = atoi(row_b[1]);
|
||||||
pp.item_tint[slot].color = atoul(row_b[2]);
|
pp.item_tint[slot].rgb.green = atoi(row_b[2]);
|
||||||
|
pp.item_tint[slot].rgb.blue = atoi(row_b[3]);
|
||||||
|
pp.item_tint[slot].rgb.use_tint = atoi(row_b[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load Inventory */
|
/* Load Inventory */
|
||||||
Inventory *inv;
|
|
||||||
inv = new Inventory;
|
inv = new Inventory;
|
||||||
if (GetInventory(account_id, cs->name[char_num], inv)) {
|
if (GetInventory(account_id, cs->name[char_num], inv)) {
|
||||||
for (uint8 material = 0; material <= 8; material++) {
|
for (uint8 material = 0; material <= 8; material++) {
|
||||||
@ -158,7 +159,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
|
|||||||
|
|
||||||
cs->cs_colors[char_num][material].color = color;
|
cs->cs_colors[char_num][material].color = color;
|
||||||
|
|
||||||
// the weapons are kept elsewhere
|
/* Weapons are handled a bit differently */
|
||||||
if ((material == MaterialPrimary) || (material == MaterialSecondary)) {
|
if ((material == MaterialPrimary) || (material == MaterialSecondary)) {
|
||||||
if (strlen(item->GetItem()->IDFile) > 2) {
|
if (strlen(item->GetItem()->IDFile) > 2) {
|
||||||
uint32 idfile = atoi(&item->GetItem()->IDFile[2]);
|
uint32 idfile = atoi(&item->GetItem()->IDFile[2]);
|
||||||
|
|||||||
@ -588,35 +588,35 @@ bool Client::Save(uint8 iCommitNow) {
|
|||||||
/* Save Character Task */
|
/* Save Character Task */
|
||||||
SaveTaskState();
|
SaveTaskState();
|
||||||
|
|
||||||
|
if (iCommitNow <= 1) {
|
||||||
|
// char* query = 0;
|
||||||
|
// uint32_breakdown workpt;
|
||||||
|
// workpt.b4() = DBA_b4_Entity;
|
||||||
|
// workpt.w2_3() = GetID();
|
||||||
|
// workpt.b1() = DBA_b1_Entity_Client_Save;
|
||||||
|
// DBAsyncWork* dbaw = new DBAsyncWork(&database, &MTdbafq, workpt, DBAsync::Write, 0xFFFFFFFF);
|
||||||
|
// dbaw->AddQuery(iCommitNow == 0 ? true : false, &query, database.SetPlayerProfile_MQ(&query, account_id, character_id, &m_pp, &m_inv, &m_epp, 0, 0, MaxXTargets), false);
|
||||||
|
// if (iCommitNow == 0){
|
||||||
|
// pQueuedSaveWorkID = dbasync->AddWork(&dbaw, 2500);
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// dbasync->AddWork(&dbaw, 0);
|
||||||
|
// SaveBackup();
|
||||||
|
// }
|
||||||
|
// safe_delete_array(query);
|
||||||
|
// return true;
|
||||||
|
}
|
||||||
|
else if (database.SetPlayerProfile(account_id, character_id, &m_pp, &m_inv, &m_epp, 0, 0, MaxXTargets)) {
|
||||||
|
SaveBackup();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::cerr << "Failed to update player profile" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Save Character Data */
|
/* Save Character Data */
|
||||||
database.SaveCharacterData(this->CharacterID(), this->AccountID(), &m_pp);
|
database.SaveCharacterData(this->CharacterID(), this->AccountID(), &m_pp);
|
||||||
|
|
||||||
// if (iCommitNow <= 1) {
|
|
||||||
// char* query = 0;
|
|
||||||
// uint32_breakdown workpt;
|
|
||||||
// workpt.b4() = DBA_b4_Entity;
|
|
||||||
// workpt.w2_3() = GetID();
|
|
||||||
// workpt.b1() = DBA_b1_Entity_Client_Save;
|
|
||||||
// DBAsyncWork* dbaw = new DBAsyncWork(&database, &MTdbafq, workpt, DBAsync::Write, 0xFFFFFFFF);
|
|
||||||
// dbaw->AddQuery(iCommitNow == 0 ? true : false, &query, database.SetPlayerProfile_MQ(&query, account_id, character_id, &m_pp, &m_inv, &m_epp, 0, 0, MaxXTargets), false);
|
|
||||||
// if (iCommitNow == 0){
|
|
||||||
// pQueuedSaveWorkID = dbasync->AddWork(&dbaw, 2500);
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// dbasync->AddWork(&dbaw, 0);
|
|
||||||
// SaveBackup();
|
|
||||||
// }
|
|
||||||
// safe_delete_array(query);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// else if (database.SetPlayerProfile(account_id, character_id, &m_pp, &m_inv, &m_epp, 0, 0, MaxXTargets)) {
|
|
||||||
// SaveBackup();
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// std::cerr << "Failed to update player profile" << std::endl;
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/* Mirror Character Data */
|
/* Mirror Character Data */
|
||||||
database.StoreCharacterLookup(this->CharacterID());
|
database.StoreCharacterLookup(this->CharacterID());
|
||||||
LogFile->write(EQEMuLog::Status, "Client::Save %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
LogFile->write(EQEMuLog::Status, "Client::Save %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
||||||
|
|||||||
@ -553,7 +553,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
|||||||
m_pp.item_tint[i].rgb.use_tint = 0xFF;
|
m_pp.item_tint[i].rgb.use_tint = 0xFF;
|
||||||
|
|
||||||
uint32 cid = CharacterID();
|
uint32 cid = CharacterID();
|
||||||
character_id = cid;
|
character_id = cid; /* Global character_id reference */
|
||||||
|
|
||||||
/* Flush and reload factions */
|
/* Flush and reload factions */
|
||||||
database.RemoveTempFactions(this);
|
database.RemoveTempFactions(this);
|
||||||
@ -588,8 +588,6 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
|||||||
if (RuleB(Character, SharedBankPlat))
|
if (RuleB(Character, SharedBankPlat))
|
||||||
m_pp.platinum_shared = database.GetSharedPlatinum(database.GetAccountIDByChar(cid));
|
m_pp.platinum_shared = database.GetSharedPlatinum(database.GetAccountIDByChar(cid));
|
||||||
|
|
||||||
// if (ext) { SetExtendedProfile(ext, row[8], lengths[8]); }
|
|
||||||
if (level){ level = atoi(row[10]); }
|
|
||||||
if (LFP){ LFP = atoi(row[11]); }
|
if (LFP){ LFP = atoi(row[11]); }
|
||||||
if (LFG){ LFG = atoi(row[12]); }
|
if (LFG){ LFG = atoi(row[12]); }
|
||||||
if (firstlogon){ firstlogon = atoi(row[15]); }
|
if (firstlogon){ firstlogon = atoi(row[15]); }
|
||||||
@ -608,6 +606,8 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
|||||||
database.LoadCharacterMemmedSpells(cid, &m_pp); /* Load Character Memorized Spells */
|
database.LoadCharacterMemmedSpells(cid, &m_pp); /* Load Character Memorized Spells */
|
||||||
database.LoadCharacterDisciplines(cid, &m_pp); /* Load Character Disciplines */
|
database.LoadCharacterDisciplines(cid, &m_pp); /* Load Character Disciplines */
|
||||||
|
|
||||||
|
if (level){ level = m_pp.level; }
|
||||||
|
|
||||||
/* If GM, not trackable */
|
/* If GM, not trackable */
|
||||||
if (gmhideme) { trackable = false; }
|
if (gmhideme) { trackable = false; }
|
||||||
/* Set Con State for Reporting */
|
/* Set Con State for Reporting */
|
||||||
@ -632,9 +632,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
|||||||
m_pp.z = zone->safe_z();
|
m_pp.z = zone->safe_z();
|
||||||
}
|
}
|
||||||
/* If too far below ground, then fix */
|
/* If too far below ground, then fix */
|
||||||
float ground_z = GetGroundZ(m_pp.x, m_pp.y, m_pp.z);
|
// float ground_z = GetGroundZ(m_pp.x, m_pp.y, m_pp.z);
|
||||||
if (m_pp.z < (ground_z - 500))
|
// if (m_pp.z < (ground_z - 500))
|
||||||
m_pp.z = ground_z;
|
// m_pp.z = ground_z;
|
||||||
|
|
||||||
/* Set Mob variables for spawn */
|
/* Set Mob variables for spawn */
|
||||||
class_ = m_pp.class_;
|
class_ = m_pp.class_;
|
||||||
@ -1019,8 +1019,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
|||||||
outapp = new EQApplicationPacket(OP_Weather, 12);
|
outapp = new EQApplicationPacket(OP_Weather, 12);
|
||||||
Weather_Struct *ws = (Weather_Struct *)outapp->pBuffer;
|
Weather_Struct *ws = (Weather_Struct *)outapp->pBuffer;
|
||||||
ws->val1 = 0x000000FF;
|
ws->val1 = 0x000000FF;
|
||||||
if (zone->zone_weather == 1)
|
if (zone->zone_weather == 1){ ws->type = 0x31; } // Rain
|
||||||
ws->type = 0x31; // Rain
|
|
||||||
if (zone->zone_weather == 2) {
|
if (zone->zone_weather == 2) {
|
||||||
outapp->pBuffer[8] = 0x01;
|
outapp->pBuffer[8] = 0x01;
|
||||||
ws->type = 0x02;
|
ws->type = 0x02;
|
||||||
|
|||||||
@ -1146,7 +1146,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_id, uint32 color){
|
bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_id, uint32 color){
|
||||||
std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, color) VALUES (%u, %u, %u)", character_id, slot_id, color); QueryDatabase(query);
|
std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, color, use_tint) VALUES (%u, %u, %u, 255)", character_id, slot_id, color); QueryDatabase(query);
|
||||||
LogFile->write(EQEMuLog::Status, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color);
|
LogFile->write(EQEMuLog::Status, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1160,9 +1160,8 @@ bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile
|
|||||||
pp->item_tint[i].rgb.blue = atoi(row[r]); r++;
|
pp->item_tint[i].rgb.blue = atoi(row[r]); r++;
|
||||||
pp->item_tint[i].rgb.green = atoi(row[r]); r++;
|
pp->item_tint[i].rgb.green = atoi(row[r]); r++;
|
||||||
pp->item_tint[i].rgb.red = atoi(row[r]); r++;
|
pp->item_tint[i].rgb.red = atoi(row[r]); r++;
|
||||||
if (row[r] && atoi(row[r]) > 0){ pp->item_tint[i].rgb.use_tint = 0xFF; } r++;
|
pp->item_tint[i].rgb.use_tint = atoi(row[r]);
|
||||||
pp->item_tint[i].color = atoi(row[r]); r++;
|
printf("Material Load: %u %u %u %u\n", pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint);
|
||||||
printf("Loading color: %u tint: %u \n", pp->item_tint[i].color, pp->item_tint[i].rgb.use_tint);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1446,12 +1445,8 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla
|
|||||||
pp->RestTimer
|
pp->RestTimer
|
||||||
);
|
);
|
||||||
auto results = database.QueryDatabase(query);
|
auto results = database.QueryDatabase(query);
|
||||||
//if (results.RowsAffected() != 2) {
|
if (!results.RowsAffected()){ std::cout << "ERROR ZoneDatabase:SaveCharacterData: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
|
||||||
// LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::SaveCharacterData Error! Query: %s \n", query); return false;
|
LogFile->write(EQEMuLog::Status, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
||||||
//}
|
|
||||||
//else{
|
|
||||||
LogFile->write(EQEMuLog::Status, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
|
||||||
//}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user