- Ported inspect_messages to character_inspect_messages

- Ported character leadership abilities to character_leadership_abilities
- Removed player profile debug printing
- Refactored total time entitled on account to load from the sum of time_played from all characters in character_data
This commit is contained in:
Akkadius 2014-09-06 21:50:29 -05:00
parent ca7dd7d741
commit e50cf5c4be
10 changed files with 935 additions and 1144 deletions

View File

@ -359,6 +359,8 @@ bool Database::DeleteCharacter(char *name) {
query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
query = StringFormat("DELETE FROM `character_bandolier` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); query = StringFormat("DELETE FROM `character_bandolier` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
query = StringFormat("DELETE FROM `character_potionbelt` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); query = StringFormat("DELETE FROM `character_potionbelt` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
query = StringFormat("DELETE FROM `character_inspect_messages` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
query = StringFormat("DELETE FROM `character_alt_currency` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); query = StringFormat("DELETE FROM `character_alt_currency` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query);
#ifdef BOTS #ifdef BOTS
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", charid); query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", charid);
@ -819,14 +821,11 @@ static inline void loadbar(unsigned int x, unsigned int n, unsigned int w = 50)
} }
bool Database::CheckDatabaseConversions() { bool Database::CheckDatabaseConversions() {
/* Set all of this ugliness */ unsigned int lengths;
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf2[MYSQL_ERRMSG_SIZE]; char errbuf3[MYSQL_ERRMSG_SIZE]; unsigned int lengths_e;
char *query = 0; char *query2 = 0; char *query3 = 0; std::string squery;
uint32 querylen; uint32 querylen2; uint32 querylen3;
MYSQL_RES *result; MYSQL_RES *result2; MYSQL_RES *result3;
MYSQL_ROW row; MYSQL_ROW row2; MYSQL_ROW row3;
unsigned long* lengths;
PlayerProfile_Struct* pp; PlayerProfile_Struct* pp;
ExtendedProfile_Struct* e_pp;
uint32 pplen = 0; uint32 pplen = 0;
uint32 i; uint32 i;
int character_id = 0; int character_id = 0;
@ -875,6 +874,14 @@ bool Database::CheckDatabaseConversions() {
"`account_id` int(11) NOT NULL DEFAULT '0', " "`account_id` int(11) NOT NULL DEFAULT '0', "
"`name` varchar(64) NOT NULL DEFAULT '', " "`name` varchar(64) NOT NULL DEFAULT '', "
"`last_name` varchar(64) NOT NULL DEFAULT '', " "`last_name` varchar(64) NOT NULL DEFAULT '', "
"`title` varchar(32) NOT NULL DEFAULT '', "
"`suffix` varchar(32) NOT NULL DEFAULT '', "
"`zone_id` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`zone_instance` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`y` float NOT NULL DEFAULT '0', "
"`x` float NOT NULL DEFAULT '0', "
"`z` float NOT NULL DEFAULT '0', "
"`heading` float NOT NULL DEFAULT '0', "
"`gender` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`gender` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`race` smallint(11) UNSIGNED NOT NULL DEFAULT 0, " "`race` smallint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`class` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`class` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
@ -883,27 +890,36 @@ bool Database::CheckDatabaseConversions() {
"`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, "
"`pvp_status` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`level2` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`level2` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`anon` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`anon` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`gm` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`gm` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`intoxication` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`face` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`hair_color` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`hair_color` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`hair_style` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`beard` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`beard_color` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`beard_color` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`eye_color_1` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`eye_color_1` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`eye_color_2` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`eye_color_2` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`hair_style` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`drakkin_heritage` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`beard` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`drakkin_tattoo` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`drakkin_details` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`ability_time_seconds` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`ability_time_seconds` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`ability_number` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`ability_number` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`ability_time_minutes` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`ability_time_minutes` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`ability_time_hours` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`ability_time_hours` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`title` varchar(32) NOT NULL DEFAULT '', "
"`suffix` varchar(32) NOT NULL DEFAULT '', "
"`exp` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`exp` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`aa_points_spent` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`aa_exp` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`aa_points` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`group_leadership_exp` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`raid_leadership_exp` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`group_leadership_points` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`raid_leadership_points` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`points` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`points` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`mana` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`cur_hp` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`cur_hp` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`mana` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`endurance` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`intoxication` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`str` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`str` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`sta` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`sta` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`cha` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`cha` int(11) UNSIGNED NOT NULL DEFAULT 0, "
@ -911,25 +927,11 @@ bool Database::CheckDatabaseConversions() {
"`int` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`int` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`agi` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`agi` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`wis` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`wis` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`face` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`y` float NOT NULL DEFAULT '0', "
"`x` float NOT NULL DEFAULT '0', "
"`z` float NOT NULL DEFAULT '0', "
"`heading` float NOT NULL DEFAULT '0', "
"`pvp2` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`pvp_type` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`autosplit_enabled` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`zone_change_count` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`zone_change_count` 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_details` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`toxicity` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`toxicity` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`hunger_level` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`hunger_level` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`thirst_level` int(11) UNSIGNED 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_instance` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`leadership_exp_on` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`ldon_points_guk` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`ldon_points_guk` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`ldon_points_mir` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`ldon_points_mir` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`ldon_points_mmc` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`ldon_points_mmc` int(11) UNSIGNED NOT NULL DEFAULT 0, "
@ -937,16 +939,10 @@ bool Database::CheckDatabaseConversions() {
"`ldon_points_tak` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`ldon_points_tak` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`ldon_points_available` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`ldon_points_available` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`tribute_time_remaining` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`tribute_time_remaining` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`show_helm` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`career_tribute_points` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`career_tribute_points` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`tribute_points` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`tribute_points` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`tribute_active` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`tribute_active` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`endurance` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`pvp_status` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`group_leadership_exp` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`raid_leadership_exp` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`group_leadership_points` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`raid_leadership_points` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`air_remaining` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`pvp_kills` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`pvp_kills` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`pvp_deaths` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`pvp_deaths` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`pvp_current_points` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`pvp_current_points` int(11) UNSIGNED NOT NULL DEFAULT 0, "
@ -954,13 +950,24 @@ bool Database::CheckDatabaseConversions() {
"`pvp_best_kill_streak` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`pvp_best_kill_streak` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`pvp_worst_death_streak` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`pvp_worst_death_streak` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`pvp_current_kill_streak` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`pvp_current_kill_streak` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`aa_points_spent` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`pvp2` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`aa_exp` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`pvp_type` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`aa_points` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`show_helm` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`group_auto_consent` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`group_auto_consent` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`raid_auto_consent` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`raid_auto_consent` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`guild_auto_consent` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, " "`guild_auto_consent` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`leadership_exp_on` tinyint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`RestTimer` int(11) UNSIGNED NOT NULL DEFAULT 0, " "`RestTimer` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`air_remaining` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`autosplit_enabled` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`lfp` tinyint(1) unsigned NOT NULL DEFAULT '0', "
"`lfg` tinyint(1) unsigned NOT NULL DEFAULT '0', "
"`mailkey` char(16) NOT NULL DEFAULT '', "
"`xtargets` tinyint(3) unsigned NOT NULL DEFAULT '5', "
"`firstlogon` tinyint(3) NOT NULL DEFAULT '0', "
"`e_aa_effects` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`e_percent_to_aa` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"`e_expended_aa_spent` int(11) UNSIGNED NOT NULL DEFAULT 0, "
"PRIMARY KEY(`id`), " "PRIMARY KEY(`id`), "
"UNIQUE KEY `name` (`name`), " "UNIQUE KEY `name` (`name`), "
"KEY `account_id` (`account_id`) " "KEY `account_id` (`account_id`) "
@ -1200,44 +1207,106 @@ bool Database::CheckDatabaseConversions() {
QueryDatabase(rquery); QueryDatabase(rquery);
printf(" done...\n"); printf(" done...\n");
} }
/* Check for table `character_potionbelt` */
rquery = StringFormat("SHOW TABLES LIKE 'character_inspect_messages'");
results = QueryDatabase(rquery);
if (results.RowCount() == 0){
printf("Table: `character_inspect_messages` doesn't exist... creating...");
rquery = StringFormat(
"CREATE TABLE `character_inspect_messages` ( "
"`id` int(11) unsigned NOT NULL AUTO_INCREMENT, "
"`inspect_message` varchar(255) NOT NULL DEFAULT '', "
"PRIMARY KEY(`id`), "
"KEY `id` (`id`) "
") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1;"
);
QueryDatabase(rquery);
printf(" done...\n");
}
/* Check for table `character_leadership_abilities` */
rquery = StringFormat("SHOW TABLES LIKE 'character_leadership_abilities'");
results = QueryDatabase(rquery);
if (results.RowCount() == 0){
printf("Table: `character_leadership_abilities` doesn't exist... creating...");
rquery = StringFormat(
"CREATE TABLE `character_leadership_abilities` ("
"`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, "
"`slot` smallint(11) UNSIGNED NOT NULL DEFAULT 0, "
"`rank` smallint(11) UNSIGNED NOT NULL DEFAULT 0, "
"PRIMARY KEY(`id`,`slot`), "
"KEY `id` (`id`) "
") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1; "
);
QueryDatabase(rquery);
printf(" done...\n");
}
/* Done */ /* Done */
printf("Starting conversion...\n\n"); printf("Starting conversion...\n\n");
} }
// querylen = MakeAnyLenString(&query, "SELECT `id` FROM `character_` WHERE `id` = 61238"); // WHERE `account_id` = 11001 // Testing account = 11001
int char_iter_count = 0; int char_iter_count = 0;
querylen = MakeAnyLenString(&query, "SELECT `id` FROM `character_` WHERE `account_id` = 11001"); rquery = StringFormat("SELECT `id` FROM `character_` WHERE `account_id` = 11001");
if (RunQuery(query, querylen, errbuf, &result)) { results = QueryDatabase(rquery);
safe_delete_array(query);
while (row = mysql_fetch_row(result)) { uint8 firstlogon = 0;
uint8 lfg = 0;
uint8 lfp = 0;
std::string mailkey;
uint8 xtargets = 0;
std::string inspectmessage;
for (auto row = results.begin(); row != results.end(); ++row) {
char_iter_count++; char_iter_count++;
querylen2 = MakeAnyLenString(&query2, "SELECT `id`, `profile`, `name`, `level`, `account_id` FROM `character_` WHERE `id` = %i", atoi(row[0])); squery = StringFormat("SELECT `id`, `profile`, `name`, `level`, `account_id`, `firstlogon`, `lfg`, `lfp`, `mailkey`, `xtargets`, `inspectmessage`, `extprofile` FROM `character_` WHERE `id` = %i", atoi(row[0]));
if (RunQuery(query2, querylen2, errbuf2, &result2)){ auto results2 = QueryDatabase(squery);
safe_delete_array(query2); auto row2 = results2.begin();
row2 = mysql_fetch_row(result2);
pp = (PlayerProfile_Struct*)row2[1]; pp = (PlayerProfile_Struct*)row2[1];
e_pp = (ExtendedProfile_Struct*)row2[11];
character_id = atoi(row[0]); character_id = atoi(row[0]);
account_id = atoi(row2[4]); account_id = atoi(row2[4]);
/* Convert some data from the character_ table that is still relevant */
firstlogon = atoi(row2[5]);
lfg = atoi(row2[6]);
lfp = atoi(row2[7]);
mailkey = row2[8];
xtargets = atoi(row2[9]);
inspectmessage = row2[10];
/* Verify PP Integrity */ /* Verify PP Integrity */
lengths = mysql_fetch_lengths(result2); lengths = results2.LengthOfColumn(1);
if (lengths[1] == sizeof(PlayerProfile_Struct)) { if (lengths == sizeof(PlayerProfile_Struct)) { /* If PP is the size it is expected to be */
memcpy(pp, row2[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]); // std::cout << "SIZE OK\n" << std::endl;
} }
/* Continue of PP Size does not match (Usually a created character never logged in) */ /* Continue of PP Size does not match (Usually a created character never logged in) */
else { else { continue; }
// printf("NO PP: Player profile '%s' %i length mismatch Expected: %i, Got: %i \n", row2[2], atoi(row2[3]), sizeof(PlayerProfile_Struct), lengths[1]);
continue; lengths_e = results2.LengthOfColumn(11);
if (lengths_e == sizeof(ExtendedProfile_Struct)) {
memcpy(e_pp, row2[11], sizeof(ExtendedProfile_Struct));
} }
if (e_pp->expended_aa > 4000000){ e_pp->expended_aa = 0; }
// std::cout << "Expended AA: " << e_pp->expended_aa << "\n" << std::endl;
/* Loading Status on conversion */ /* Loading Status on conversion */
if (runconvert == 1){ if (runconvert == 1){
std::cout << "\r" << char_iter_count << "/" << number_of_characters << " " << std::flush; std::cout << "\r" << char_iter_count << "/" << number_of_characters << " " << std::flush;
loadbar(char_iter_count, number_of_characters, 50); loadbar(char_iter_count, number_of_characters, 50);
/* Run inspect message convert */
if (inspectmessage != ""){
std::string rquery = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message)"
"VALUES (%u, '%s')",
character_id,
EscapeString(inspectmessage).c_str()
);
auto results = QueryDatabase(rquery);
if (!results.RowsAffected()){ std::cout << "ERROR Inspect Messages Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
}
/* Run Currency Convert */ /* Run Currency Convert */
std::string rquery = StringFormat("REPLACE INTO `character_currency` (id, platinum, gold, silver, copper," std::string rquery = StringFormat("REPLACE INTO `character_currency` (id, platinum, gold, silver, copper,"
"platinum_bank, gold_bank, silver_bank, copper_bank," "platinum_bank, gold_bank, silver_bank, copper_bank,"
@ -1358,7 +1427,16 @@ bool Database::CheckDatabaseConversions() {
"group_auto_consent," "group_auto_consent,"
"raid_auto_consent," "raid_auto_consent,"
"guild_auto_consent," "guild_auto_consent,"
"RestTimer)" "RestTimer,"
"firstlogon,"
"lfg,"
"lfp,"
"mailkey,"
"xtargets,"
"e_aa_effects,"
"e_percent_to_aa,"
"e_expended_aa_spent"
")"
"VALUES (" "VALUES ("
"%u," // id "%u," // id
"%u," // account_id "%u," // account_id
@ -1449,7 +1527,15 @@ bool Database::CheckDatabaseConversions() {
"%u," // group_auto_consent "%u," // group_auto_consent
"%u," // raid_auto_consent "%u," // raid_auto_consent
"%u," // guild_auto_consent "%u," // guild_auto_consent
"%u" // RestTimer "%u," // RestTimer
"%u," // First Logon - References online status for EVENT_CONNECT/EVENT_DISCONNECt
"%u," // Looking for Group
"%u," // Looking for P?
"'%s'," // Mailkey
"%u," // X Targets
"%u," // AA Effects
"%u," // Percent to AA
"%u" // e_expended_aa_spent
")", ")",
character_id, character_id,
account_id, account_id,
@ -1540,20 +1626,26 @@ bool Database::CheckDatabaseConversions() {
pp->groupAutoconsent, pp->groupAutoconsent,
pp->raidAutoconsent, pp->raidAutoconsent,
pp->guildAutoconsent, pp->guildAutoconsent,
pp->RestTimer pp->RestTimer,
firstlogon,
lfg,
lfp,
mailkey.c_str(),
xtargets,
e_pp->aa_effects,
e_pp->perAA,
e_pp->expended_aa
); );
results = QueryDatabase(rquery); results = QueryDatabase(rquery);
if (!results.RowsAffected()){ std::cout << "ERROR PP Data Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (!results.RowsAffected()){ std::cout << "ERROR PP Data Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
// str.append(str2);
/* Run AA Convert */
/* /*
We set a first entry variable because we need the first initial piece of the query to be declared We set a first entry variable because we need the first initial piece of the query to be declared
This is to speed up the INSERTS and trim down the amount of individual sends during the process. This is to speed up the INSERTS and trim down the amount of individual sends during the process.
The speed difference is dramatic The speed difference is dramatic
*/ */
int first_entry = 0; /* Run AA Convert */
int first_entry = 0; rquery = "";
for (i = 1; i < MAX_PP_AA_ARRAY; i++){ for (i = 1; i < MAX_PP_AA_ARRAY; i++){
if (pp->aa_array[i].AA > 0 && pp->aa_array[i].value > 0){ if (pp->aa_array[i].AA > 0 && pp->aa_array[i].value > 0){
if (first_entry != 1){ if (first_entry != 1){
@ -1564,22 +1656,22 @@ bool Database::CheckDatabaseConversions() {
rquery = rquery + StringFormat(", (%u, %u, %u, %u)", character_id, i, pp->aa_array[i].AA, pp->aa_array[i].value); rquery = rquery + StringFormat(", (%u, %u, %u, %u)", character_id, i, pp->aa_array[i].AA, pp->aa_array[i].value);
} }
} }
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR AA Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR AA Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
/* Run Bind Home Convert */ /* Run Bind Home Convert */
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 1)", " VALUES (%u, %u, %u, %f, %f, %f, %f, 1)",
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);
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Bind Home Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Bind Home Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
/* Run Bind Convert */ /* Run Bind Convert */
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 0)", " VALUES (%u, %u, %u, %f, %f, %f, %f, 0)",
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading); character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Bind Home Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (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 */
first_entry = 0; first_entry = 0; rquery = "";
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){
if (first_entry != 1){ if (first_entry != 1){
@ -1589,9 +1681,9 @@ bool Database::CheckDatabaseConversions() {
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]);
} }
} }
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Language Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Language Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
/* Run Skill Convert */ /* Run Skill Convert */
first_entry = 0; first_entry = 0; rquery = "";
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){
if (first_entry != 1){ if (first_entry != 1){
@ -1601,10 +1693,10 @@ bool Database::CheckDatabaseConversions() {
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]);
} }
} }
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Skill Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Skill Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
/* Run Spell Convert */ /* Run Spell Convert */
first_entry = 0; first_entry = 0; rquery = "";
for (i = 0; i < MAX_PP_SPELLBOOK; i++){ for (i = 0; i < MAX_PP_REF_SPELLBOOK; i++){
if (pp->spell_book[i] > 0 && pp->spell_book[i] != 4294967295 && pp->spell_book[i] < 40000 && pp->spell_book[i] != 1){ if (pp->spell_book[i] > 0 && pp->spell_book[i] != 4294967295 && pp->spell_book[i] < 40000 && pp->spell_book[i] != 1){
if (first_entry != 1){ if (first_entry != 1){
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]);
@ -1614,11 +1706,11 @@ bool Database::CheckDatabaseConversions() {
} }
} }
// std::cout << rquery << "\n"; // std::cout << rquery << "\n";
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Spell Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Spell Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
/* Run Max Memmed Spell Convert */ /* Run Max Memmed Spell Convert */
first_entry = 0; first_entry = 0; rquery = "";
for (i = 0; i < MAX_PP_MEMSPELL; i++){ for (i = 0; i < MAX_PP_REF_MEMSPELL; i++){
if (pp->mem_spells[i] > 0 && pp->mem_spells[i] != 65535){ if (pp->mem_spells[i] > 0 && pp->mem_spells[i] != 65535 && pp->mem_spells[i] != 4294967295){
if (first_entry != 1){ if (first_entry != 1){
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]);
first_entry = 1; first_entry = 1;
@ -1626,9 +1718,9 @@ bool Database::CheckDatabaseConversions() {
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->mem_spells[i]); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->mem_spells[i]);
} }
} }
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Memmed Spell Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Memmed Spell Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
/* Run Discipline Convert */ /* Run Discipline Convert */
first_entry = 0; first_entry = 0; rquery = "";
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){
if (first_entry != 1){ if (first_entry != 1){
@ -1638,9 +1730,9 @@ bool Database::CheckDatabaseConversions() {
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->disciplines.values[i]); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->disciplines.values[i]);
} }
} }
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Discipline Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = 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 */
first_entry = 0; first_entry = 0; rquery = "";
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 (first_entry != 1){ if (first_entry != 1){
@ -1650,9 +1742,9 @@ bool Database::CheckDatabaseConversions() {
rquery = rquery + StringFormat(", (%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 = rquery + StringFormat(", (%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);
} }
} }
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Color Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Color Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
/* Run Tribute Convert */ /* Run Tribute Convert */
first_entry = 0; first_entry = 0; rquery = "";
for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){ for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){
if (pp->tributes[i].tribute > 0){ if (pp->tributes[i].tribute > 0){
if (first_entry != 1){ if (first_entry != 1){
@ -1662,9 +1754,9 @@ bool Database::CheckDatabaseConversions() {
rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute);
} }
} }
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Tribute Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Tribute Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
/* Run Bandolier Convert */ /* Run Bandolier Convert */
first_entry = 0; first_entry = 0; rquery = "";
for (i = 0; i <= EmuConstants::BANDOLIERS_COUNT; i++){ for (i = 0; i <= EmuConstants::BANDOLIERS_COUNT; i++){
for (int si = 0; si < EmuConstants::BANDOLIER_SIZE; si++){ for (int si = 0; si < EmuConstants::BANDOLIER_SIZE; si++){
if (pp->bandoliers[i].items[si].item_id > 0){ if (pp->bandoliers[i].items[si].item_id > 0){
@ -1676,9 +1768,9 @@ bool Database::CheckDatabaseConversions() {
} }
} }
} }
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
/* Run Potion Belt Convert */ /* Run Potion Belt Convert */
first_entry = 0; first_entry = 0; rquery = "";
for (i = 0; i <= EmuConstants::POTION_BELT_SIZE; i++){ for (i = 0; i <= EmuConstants::POTION_BELT_SIZE; i++){
if (pp->potionbelt.items[i].item_id > 0){ if (pp->potionbelt.items[i].item_id > 0){
if (first_entry != 1){ if (first_entry != 1){
@ -1689,324 +1781,20 @@ bool Database::CheckDatabaseConversions() {
} }
} }
results = QueryDatabase(rquery); if (!results.RowsAffected()){ std::cout << "ERROR Potion Belt Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; } if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Potion Belt Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
} /* Run Leadership AA Convert */
first_entry = 0; rquery = "";
/* Print out the entire Player Profile for testing */
if (printppdebug == 1) {
printf("ID: %i \n", atoi(row[0]));
printf("checksum: %i \n", pp->checksum);
printf("name: %s \n", pp->name);
printf("last_name: %s \n", pp->last_name);
printf("gender: %i \n", pp->gender);
printf("race: %i \n", pp->race);
printf("class_: %i \n", pp->class_);
printf("unknown0112: %i \n", pp->unknown0112);
printf("level: %i \n", pp->level);
printf("\n=== BIND DATA (Array Size 5) ===\n");
for (i = 0; i < 5; i++){
printf("Bind Num: %i ZoneID: %u x: %f y: %f z: %f heading: %f \n", i, pp->binds[i].zoneId, pp->binds[i].x, pp->binds[i].y, pp->binds[i].z, pp->binds[i].heading);
}
printf("\n");
printf("deity: %u \n", pp->deity);
printf("guild_id: %u \n", pp->guild_id);
printf("birthday: %u \n", pp->birthday);
printf("lastlogin: %u \n", pp->lastlogin);
printf("timePlayedMin: %u \n", pp->timePlayedMin);
printf("pvp: %u \n", pp->pvp);
printf("level2: %u \n", pp->level2);
printf("anon: %u \n", pp->anon);
printf("gm: %u \n", pp->gm);
printf("guildrank: %u \n", pp->guildrank);
printf("guildbanker: %u \n", pp->guildbanker);
printf("unknown0246[6]: %u \n", pp->unknown0246[6]);
printf("intoxication: %u \n", pp->intoxication);
printf("\n=== Spell Slot Refresh spellSlotRefresh[MAX_PP_MEMSPELL] ===\n");
for (i = 0; i < MAX_PP_MEMSPELL; i++){
printf("Slot: %i Value: %u \n", i, pp->spellSlotRefresh[i]);
}
printf("\n\n");
printf("abilitySlotRefresh: %u \n", pp->abilitySlotRefresh);
printf("haircolor: %u \n", pp->haircolor);
printf("beardcolor: %u \n", pp->beardcolor);
printf("eyecolor1: %u \n", pp->eyecolor1);
printf("eyecolor2: %u \n", pp->eyecolor2);
printf("hairstyle: %u \n", pp->hairstyle);
printf("beard: %u \n", pp->beard);
printf("ability_time_seconds: %u \n", pp->ability_time_seconds);
printf("ability_number: %u \n", pp->ability_number);
printf("ability_time_minutes: %u \n", pp->ability_time_minutes);
printf("ability_time_hours: %u \n", pp->ability_time_hours);
printf("\n=== Color Material Data ===\n");
for (i = 0; i < 10; i++){
printf("Slot: %i Blue: %u Green: %u Red: %i Use_Tint: %u Color: %u \n", 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);
}
printf("\n\n");
printf("\n=== AA Data ===\n");
for (i = 0; i < MAX_PP_AA_ARRAY; i++){
printf("ID: %u Value %u\n", pp->aa_array[i].AA, pp->aa_array[i].value);
}
printf("\n\n");
printf("%i unknown2384\n", pp->unknown2384);
printf("servername: %s \n", pp->servername);
printf("title: %s \n", pp->title);
printf("suffix: %s \n", pp->suffix);
printf("guildid2: %u \n", pp->guildid2);
printf("exp: %u \n", pp->exp);
printf("unknown2492: %u \n", pp->unknown2492);
printf("points: %u \n", pp->points);
printf("mana: %u \n", pp->mana);
printf("cur_hp: %u \n", pp->cur_hp);
printf("unknown2508: %u \n", pp->unknown2508);
printf("STR: %u \n", pp->STR);
printf("STA: %u \n", pp->STA);
printf("CHA: %u \n", pp->CHA);
printf("DEX: %u \n", pp->DEX);
printf("INT: %u \n", pp->INT);
printf("AGI: %u \n", pp->AGI);
printf("WIS: %u \n", pp->WIS);
printf("face: %u \n", pp->face);
printf("unknown2541[47]: %u \n", pp->unknown2541[47]);
printf("languages[MAX_PP_LANGUAGE]: %u \n", pp->languages[MAX_PP_LANGUAGE]);
printf("\n=== languages[MAX_PP_LANGUAGE] ===\n");
for (i = 0; i < MAX_PP_LANGUAGE; i++){
printf("ID: %u Value: %u \n", i, pp->languages[i]);
}
printf("\n\n");
printf("unknown2616[4]: %u \n", pp->unknown2616[4]);
printf("\n=== Spell Book ===\n");
for (i = 0; i < MAX_PP_SPELLBOOK; i++){
printf("Spell Book Slot: %i Spell: %u \n", i, pp->spell_book[i]);
}
printf("\n\n");
printf("unknown4540[128]: %u \n", pp->unknown4540[128]);
printf("\n=== mem_spells[MAX_PP_MEMSPELL] ===\n");
for (i = 0; i < MAX_PP_MEMSPELL; i++){
printf("ID: %u Value: %u \n", i, pp->mem_spells[i]);
}
printf("\n\n");
printf("unknown4704[32]: %u \n", pp->unknown4704[32]);
printf("y: %4.2f \n", pp->y);
printf("x: %4.2f \n", pp->x);
printf("z: %4.2f \n", pp->z);
printf("heading: %4.2f \n", pp->heading);
printf("unknown4752[4]: %u \n", pp->unknown4752[4]);
printf("platinum: %u \n", pp->platinum);
printf("gold: %u \n", pp->gold);
printf("silver: %u \n", pp->silver);
printf("copper: %u \n", pp->copper);
printf("platinum_bank: %u \n", pp->platinum_bank);
printf("gold_bank: %u \n", pp->gold_bank);
printf("silver_bank: %u \n", pp->silver_bank);
printf("copper_bank: %u \n", pp->copper_bank);
printf("platinum_cursor: %u \n", pp->platinum_cursor);
printf("gold_cursor: %u \n", pp->gold_cursor);
printf("silver_cursor: %u \n", pp->silver_cursor);
printf("copper_cursor: %u \n", pp->copper_cursor);
printf("platinum_shared: %u \n", pp->platinum_shared);
printf("unknown4808[24]: %u \n", pp->unknown4808[24]);
printf("\n=== skills[MAX_PP_SKILL] ===\n");
for (i = 0; i < MAX_PP_SKILL; i++){
printf("ID: %u Value: %u \n", i, pp->skills[i]);
}
printf("\n\n");
printf("unknown5132[184]: %u \n", pp->unknown5132[184]);
printf("pvp2: %u \n", pp->pvp2);
printf("unknown5420: %u \n", pp->unknown5420);
printf("pvptype: %u \n", pp->pvptype);
printf("unknown5428: %u \n", pp->unknown5428);
printf("ability_down: %u \n", pp->ability_down);
printf("unknown5436[8]: %u \n", pp->unknown5436[8]);
printf("autosplit: %u \n", pp->autosplit);
printf("unknown5448[8]: %u \n", pp->unknown5448[8]);
printf("zone_change_count: %u \n", pp->zone_change_count);
printf("unknown5460[16]: %u \n", pp->unknown5460[16]);
printf("drakkin_heritage: %u \n", pp->drakkin_heritage);
printf("drakkin_tattoo: %u \n", pp->drakkin_tattoo);
printf("drakkin_details: %u \n", pp->drakkin_details);
printf("expansions: %u \n", pp->expansions);
printf("toxicity: %u \n", pp->toxicity);
printf("unknown5496: %s \n", pp->unknown5496);
printf("hunger_level: %i \n", pp->hunger_level);
printf("thirst_level: %i \n", pp->thirst_level);
printf("ability_up: %u \n", pp->ability_up);
printf("unknown5524: %s \n", pp->unknown5524);
printf("zone_id: %u \n", pp->zone_id);
printf("zoneInstance: %u \n", pp->zoneInstance);
// SpellBuff_Struct buffs[BUFF_COUNT];
printf("groupMembers: %s \n", pp->groupMembers);
printf("unknown6428: %s \n", pp->unknown6428);
printf("entityid: %u \n", pp->entityid);
printf("leadAAActive: %u \n", pp->leadAAActive);
printf("unknown7092: %u \n", pp->unknown7092);
printf("ldon_points_guk: %i \n", pp->ldon_points_guk);
printf("ldon_points_mir: %i \n", pp->ldon_points_mir);
printf("ldon_points_mmc: %i \n", pp->ldon_points_mmc);
printf("ldon_points_ruj: %i \n", pp->ldon_points_ruj);
printf("ldon_points_tak: %i \n", pp->ldon_points_tak);
printf("ldon_points_available: %i \n", pp->ldon_points_available);
printf("ldon_wins_guk: %i \n", pp->ldon_wins_guk);
printf("ldon_wins_mir: %i \n", pp->ldon_wins_mir);
printf("ldon_wins_mmc: %i \n", pp->ldon_wins_mmc);
printf("ldon_wins_ruj: %i \n", pp->ldon_wins_ruj);
printf("ldon_wins_tak: %i \n", pp->ldon_wins_tak);
printf("ldon_losses_guk: %i \n", pp->ldon_losses_guk);
printf("ldon_losses_mir: %i \n", pp->ldon_losses_mir);
printf("ldon_losses_mmc: %i \n", pp->ldon_losses_mmc);
printf("ldon_losses_ruj: %i \n", pp->ldon_losses_ruj);
printf("ldon_losses_tak: %i \n", pp->ldon_losses_tak);
printf("unknown7160[72]: %u \n", pp->unknown7160[72]);
printf("tribute_time_remaining: %u \n", pp->tribute_time_remaining);
printf("showhelm: %u \n", pp->showhelm);
printf("career_tribute_points: %u \n", pp->career_tribute_points);
printf("unknown7244: %u \n", pp->unknown7244);
printf("tribute_points: %u \n", pp->tribute_points);
printf("unknown7252: %u \n", pp->unknown7252);
printf("tribute_active: %u \n", pp->tribute_active);
printf("\n=== Tribute_Struct tributes[EmuConstants::TRIBUTE_SIZE] ===\n");
for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){
printf("ID: %u Tribute: %u Tier: %u \n", i, pp->tributes[i].tribute, pp->tributes[i].tier);
}
printf("\n\n");
// Tribute_Struct tributes[EmuConstants::TRIBUTE_SIZE];
// /*7264*/ Disciplines_Struct disciplines;
printf("\n=== Disciplines_Struct disciplines ===\n");
for (i = 0; i < MAX_PP_DISCIPLINES; i++){
printf("ID: %u Disc Value: %u \n", i, pp->disciplines.values[i]);
}
printf("\n\n");
printf("\n=== recastTimers[MAX_RECAST_TYPES] ===\n");
for (i = 0; i < MAX_RECAST_TYPES; i++){
printf("ID: %u Value: %u \n", i, pp->recastTimers[i]);
}
printf("\n\n");
printf("unknown7780: %s \n", pp->unknown7780);
printf("endurance: %u \n", pp->endurance);
printf("group_leadership_exp: %u \n", pp->group_leadership_exp);
printf("raid_leadership_exp: %u \n", pp->raid_leadership_exp);
printf("group_leadership_points: %u \n", pp->group_leadership_points);
printf("raid_leadership_points: %u \n", pp->raid_leadership_points);
// LeadershipAA_Struct leader_abilities;
printf("\n=== LeadershipAA_Struct leader_abilities ===\n");
for (i = 0; i <= MAX_LEADERSHIP_AA_ARRAY; i++){ for (i = 0; i <= MAX_LEADERSHIP_AA_ARRAY; i++){
printf("ID: %u Rank: %u \n", i, pp->leader_abilities.ranks[i]); if (pp->leader_abilities.ranks[i] > 0){
if (first_entry != 1){
rquery = StringFormat("REPLACE INTO `character_leadership_abilities` (id, slot, rank) VALUES (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
first_entry = 1;
} }
printf("\n\n"); rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
printf("unknown8088[132]: %u \n", pp->unknown8088[132]);
printf("air_remaining: %u \n", pp->air_remaining);
printf("PVPKills: %u \n", pp->PVPKills);
printf("PVPDeaths: %u \n", pp->PVPDeaths);
printf("PVPCurrentPoints: %u \n", pp->PVPCurrentPoints);
printf("PVPCareerPoints: %u \n", pp->PVPCareerPoints);
printf("PVPBestKillStreak: %u \n", pp->PVPBestKillStreak);
printf("PVPWorstDeathStreak: %u \n", pp->PVPWorstDeathStreak);
printf("PVPCurrentKillStreak: %u \n", pp->PVPCurrentKillStreak);
// PVPStatsEntry_Struct PVPLastKill;
printf("\n=== PVPStatsEntry_Struct PVPLastKill ===\n");
printf("Char Name: %s Level: %u Race: %u Class: %u Zone: %u Time: %u Points: %u \n", pp->PVPLastKill.Name, pp->PVPLastKill.Level, pp->PVPLastKill.Race, pp->PVPLastKill.Class, pp->PVPLastKill.Zone, pp->PVPLastKill.Time, pp->PVPLastKill.Points);
printf("\n\n");
// /*8304*/ PVPStatsEntry_Struct PVPLastDeath;
printf("\n=== PVPStatsEntry_Struct PVPLastDeath ===\n");
printf("Char Name: %s Level: %u Race: %u Class: %u Zone: %u Time: %u Points: %u \n", pp->PVPLastDeath.Name, pp->PVPLastDeath.Level, pp->PVPLastDeath.Race, pp->PVPLastDeath.Class, pp->PVPLastDeath.Zone, pp->PVPLastDeath.Time, pp->PVPLastDeath.Points);
printf("\n\n");
printf("PVPNumberOfKillsInLast24Hours: %u \n", pp->PVPNumberOfKillsInLast24Hours);
// PVPStatsEntry_Struct PVPRecentKills[50];
printf("\n===PVPStatsEntry_Struct PVPRecentKills[50] ===\n");
for (i = 0; i < 50; i++){
printf("ID: %u Char Name: %s Level: %u Race: %u Class: %u Zone: %u Time: %u Points: %u \n", i, pp->PVPRecentKills[i].Name, pp->PVPRecentKills[i].Level, pp->PVPRecentKills[i].Race, pp->PVPRecentKills[i].Class, pp->PVPRecentKills[i].Zone, pp->PVPRecentKills[i].Time, pp->PVPRecentKills[i].Points);
}
printf("\n\n");
printf("aapoints_spent: %u \n", pp->aapoints_spent);
printf("expAA: %u \n", pp->expAA);
printf("aapoints: %u \n", pp->aapoints);
printf("unknown12844[36]: %u \n", pp->unknown12844[36]);
// Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT];
printf("\n=== Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT] ===\n");
uint16 si = 0;
for (i = 0; i <= EmuConstants::BANDOLIERS_COUNT; i++){
// BandolierItem_Struct items[EmuConstants::BANDOLIER_SIZE];
for (si = 0; si < EmuConstants::BANDOLIER_SIZE; si++){
printf("ID: %u item_id: %u icon: %u items name: %s name: %s\n", i, pp->bandoliers[i].items[si].item_id, pp->bandoliers[i].items[si].icon, pp->bandoliers[i].items[si].item_name, pp->bandoliers[i].name);
} }
} }
printf("\n\n"); if (rquery != ""){ results = QueryDatabase(rquery); } if (!results.RowsAffected()){ std::cout << "ERROR Leadership AA Convert: " << results.ErrorMessage() << "\n\n" << rquery << "\n" << std::endl; }
printf("unknown14160[4506]: %u \n", pp->unknown14160[4506]);
// SuspendedMinion_Struct SuspendedMinion; // No longer in use (In DB)
// printf("\n=== SuspendedMinion_Struct SuspendedMinion ===\n");
// printf("SpellID: %u HP: %u Mana: %u \n", i, pp->leader_abilities.ranks[i]);
// printf("\n\n");
printf("timeentitledonaccount: %u \n", pp->timeentitledonaccount);
// PotionBelt_Struct potionbelt; //there should be 3 more of these
printf("\n=== PotionBelt_Struct potionbelt ===\n");
for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){
printf("ID: %u Icon: %u Item ID: %u Item Name: %s\n", i, pp->potionbelt.items[i].icon, pp->potionbelt.items[i].item_id, pp->potionbelt.items[i].item_name);
} }
printf("\n\n");
printf("unknown19568[8]: %u \n", pp->unknown19568[8]);
printf("currentRadCrystals: %u \n", pp->currentRadCrystals);
printf("careerRadCrystals: %u \n", pp->careerRadCrystals);
printf("currentEbonCrystals: %u \n", pp->currentEbonCrystals);
printf("careerEbonCrystals: %u \n", pp->careerEbonCrystals);
printf("groupAutoconsent: %u \n", pp->groupAutoconsent);
printf("raidAutoconsent: %u \n", pp->raidAutoconsent);
printf("guildAutoconsent: %u \n", pp->guildAutoconsent);
printf("unknown19595[5]: %u \n", pp->unknown19595[5]);
printf("RestTimer: %u \n", pp->RestTimer);
printf("\n");
}
mysql_free_result(result2);
}
}
mysql_free_result(result);
} }
if (runconvert == 1){ printf("\n\nCharacter blob conversion complete, continuing world bootup...\n"); } if (runconvert == 1){ printf("\n\nCharacter blob conversion complete, continuing world bootup...\n"); }

View File

@ -21,7 +21,6 @@
#include "eq_packet_structs.h" #include "eq_packet_structs.h"
#include "item.h" #include "item.h"
#pragma pack(1) #pragma pack(1)
/* /*
@ -37,24 +36,24 @@
*/ */
struct ExtendedProfile_Struct { struct ExtendedProfile_Struct {
// Pet stuff // Pet stuff
uint16 pet_id; uint16 pet_id; /* Not Used */
uint16 old_pet_hp; uint16 old_pet_hp; /* Not Used */
uint16 old_pet_mana; uint16 old_pet_mana; /* Not Used */
SpellBuff_Struct pet_buffs[BUFF_COUNT]; SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
uint32 pet_items[_MaterialCount]; uint32 pet_items[_MaterialCount]; /* Not Used */
char merc_name[64]; char merc_name[64]; /* Used */
uint32 aa_effects; uint32 aa_effects; /* Used */
uint32 perAA; //% of exp going to AAs uint32 perAA; /* Used: % of exp going to AAs */
uint32 expended_aa; // Total of expended AA uint32 expended_aa; /* Used: Total of expended AA */
uint32 pet_hp; uint32 pet_hp; /* Not Used */
uint32 pet_mana; uint32 pet_mana; /* Not Used */
uint32 mercTemplateID; uint32 mercTemplateID; /* Not Used */
uint32 mercSuspendedTime; uint32 mercSuspendedTime; /* Not Used */
bool mercIsSuspended; bool mercIsSuspended; /* Not Used */
uint32 mercTimerRemaining; uint32 mercTimerRemaining; /* Not Used */
uint8 mercGender; uint8 mercGender; /* Not Used */
int32 mercState; int32 mercState; /* Not Used */
}; };
#pragma pack() #pragma pack()

View File

@ -114,31 +114,12 @@ bool SharedDatabase::SetGMSpeed(uint32 account_id, uint8 gmspeed)
} }
uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) { uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) {
uint32 EntitledTime = 0; uint32 EntitledTime = 0;
std::string query = StringFormat("SELECT `time_played` FROM `character_data` WHERE `account_id` = %u", AccountID);
const char *EntitledQuery = "select sum(ascii(substring(profile, 237, 1)) + (ascii(substring(profile, 238, 1)) * 256) +" auto results = QueryDatabase(query);
"(ascii(substring(profile, 239, 1)) * 65536) + (ascii(substring(profile, 240, 1)) * 16777216))" for (auto row = results.begin(); row != results.end(); ++row) {
"from character_ where account_id = %i"; EntitledTime += atoi(row[0]);
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
if (RunQuery(query, MakeAnyLenString(&query, EntitledQuery, AccountID), errbuf, &result)) {
if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result);
EntitledTime = atoi(row[0]);
} }
mysql_free_result(result);
}
safe_delete_array(query);
return EntitledTime; return EntitledTime;
} }
@ -2003,38 +1984,19 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) {
return nullptr; return nullptr;
} }
void SharedDatabase::GetPlayerInspectMessage(char* playername, InspectMessage_Struct* message) { void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) {
char errbuf[MYSQL_ERRMSG_SIZE]; std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id);
char *query = 0; auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::LoadCharacterInspectMessage", query);
MYSQL_RES *result; auto row = results.begin();
MYSQL_ROW row; memcpy(message, "", sizeof(InspectMessage_Struct));
for (auto row = results.begin(); row != results.end(); ++row) {
if (RunQuery(query, MakeAnyLenString(&query, "SELECT inspectmessage FROM character_ WHERE name='%s'", playername), errbuf, &result)) {
safe_delete_array(query);
if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result);
memcpy(message, row[0], sizeof(InspectMessage_Struct)); memcpy(message, row[0], sizeof(InspectMessage_Struct));
} }
mysql_free_result(result);
}
else {
std::cerr << "Error in GetPlayerInspectMessage query '" << query << "' " << errbuf << std::endl;
safe_delete_array(query);
}
} }
void SharedDatabase::SetPlayerInspectMessage(char* playername, const InspectMessage_Struct* message) { void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) {
std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, EscapeString(message->text).c_str());
char errbuf[MYSQL_ERRMSG_SIZE]; auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::SaveCharacterInspectMessage", query);
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE character_ SET inspectmessage='%s' WHERE name='%s'", message->text, playername), errbuf)) {
std::cerr << "Error in SetPlayerInspectMessage query '" << query << "' " << errbuf << std::endl;
}
safe_delete_array(query);
} }
void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) { void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) {

View File

@ -42,8 +42,8 @@ public:
bool SetHideMe(uint32 account_id, uint8 hideme); bool SetHideMe(uint32 account_id, uint8 hideme);
int32 DeleteStalePlayerCorpses(); int32 DeleteStalePlayerCorpses();
int32 DeleteStalePlayerBackups(); int32 DeleteStalePlayerBackups();
void GetPlayerInspectMessage(char* playername, InspectMessage_Struct* message); void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message);
void SetPlayerInspectMessage(char* playername, const InspectMessage_Struct* message); void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message);
void GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message); void GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message);
void SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message); void SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message);
bool GetCommandSettings(std::map<std::string,uint8> &commands); bool GetCommandSettings(std::map<std::string,uint8> &commands);

View File

@ -18,6 +18,8 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
// Test 1 // Test 1
#include <iostream>
#include "../common/debug.h" #include "../common/debug.h"
#include "aa.h" #include "aa.h"
#include "mob.h" #include "mob.h"
@ -316,13 +318,14 @@ void Client::ActivateAA(aaID activate){
} }
} }
// Check if AA is expendable // Check if AA is expendable
if (aas_send[activate - activate_val]->special_category == 7) if (aas_send[activate - activate_val]->special_category == 7) {
{
// Add the AA cost to the extended profile to track overall total // Add the AA cost to the extended profile to track overall total
m_epp.expended_aa += aas_send[activate]->cost; m_epp.expended_aa += aas_send[activate]->cost;
SetAA(activate, 0); SetAA(activate, 0);
Save(); SaveAA(); /* Save Character AA */
SendAA(activate); SendAA(activate);
SendAATable(); SendAATable();
} }
@ -1533,6 +1536,8 @@ void Client::ResetAA(){
m_pp.raid_leadership_points = 0; m_pp.raid_leadership_points = 0;
m_pp.group_leadership_exp = 0; m_pp.group_leadership_exp = 0;
m_pp.raid_leadership_exp = 0; m_pp.raid_leadership_exp = 0;
database.DeleteCharacterLeadershipAAs(this->CharacterID());
} }
int Client::GroupLeadershipAAHealthEnhancement() int Client::GroupLeadershipAAHealthEnhancement()

View File

@ -582,7 +582,7 @@ bool Client::Save(uint8 iCommitNow) {
database.SaveCharacterTribute(this->CharacterID(), &m_pp); database.SaveCharacterTribute(this->CharacterID(), &m_pp);
SaveTaskState(); /* Save Character Task */ SaveTaskState(); /* Save Character Task */
database.SaveCharacterData(this->CharacterID(), this->AccountID(), &m_pp); /* Save Character Data */ database.SaveCharacterData(this->CharacterID(), this->AccountID(), &m_pp, &m_epp); /* Save Character Data */
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);
return true; return true;
@ -4233,7 +4233,6 @@ void Client::VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber) {
} }
void Client::ClearGroupAAs() { void Client::ClearGroupAAs() {
for(unsigned int i = 0; i < MAX_GROUP_LEADERSHIP_AA_ARRAY; i++) for(unsigned int i = 0; i < MAX_GROUP_LEADERSHIP_AA_ARRAY; i++)
m_pp.leader_abilities.ranks[i] = 0; m_pp.leader_abilities.ranks[i] = 0;
@ -4243,28 +4242,18 @@ void Client::ClearGroupAAs() {
m_pp.raid_leadership_exp = 0; m_pp.raid_leadership_exp = 0;
Save(); Save();
database.SaveCharacterLeadershipAA(this->CharacterID(), &m_pp);
} }
void Client::UpdateGroupAAs(int32 points, uint32 type) { void Client::UpdateGroupAAs(int32 points, uint32 type) {
switch(type) {
switch(type) case 0: { m_pp.group_leadership_points += points; break; }
{ case 1: { m_pp.raid_leadership_points += points; break; }
case 0:
{
m_pp.group_leadership_points += points;
break;
}
case 1:
{
m_pp.raid_leadership_points += points;
break;
}
} }
SendLeadershipEXPUpdate(); SendLeadershipEXPUpdate();
} }
bool Client::IsLeadershipEXPOn() bool Client::IsLeadershipEXPOn() {
{
if(!m_pp.leadAAActive) if(!m_pp.leadAAActive)
return false; return false;

View File

@ -494,8 +494,7 @@ int Client::HandlePacket(const EQApplicationPacket *app)
return(true); return(true);
} }
void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) {
{
if(app->size != sizeof(ClientZoneEntry_Struct)) if(app->size != sizeof(ClientZoneEntry_Struct))
return; return;
ClientZoneEntry_Struct *cze = (ClientZoneEntry_Struct *) app->pBuffer; ClientZoneEntry_Struct *cze = (ClientZoneEntry_Struct *) app->pBuffer;
@ -543,7 +542,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
std::string query; std::string query;
unsigned long* lengths; unsigned long* lengths;
/* Set item materials */ /* Set item material tint */
for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++) for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++)
if (m_pp.item_tint[i].rgb.use_tint == 1) if (m_pp.item_tint[i].rgb.use_tint == 1)
m_pp.item_tint[i].rgb.use_tint = 0xFF; m_pp.item_tint[i].rgb.use_tint = 0xFF;
@ -569,24 +568,24 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
if (account_creation){ account_creation = atoul(row[6]); } if (account_creation){ account_creation = atoul(row[6]); }
} }
/* Load Character Legacy Data: Temp until I move */ /* Load Character Data */
query = StringFormat("SELECT id,profile,zonename,x,y,z,guild_id,rank,extprofile,class,level,lfp,lfg,instanceid,xtargets,firstlogon FROM character_ LEFT JOIN guild_members ON id=char_id WHERE id=%i", cid); query = StringFormat("SELECT `lfp`, `lfg`, `xtargets`, `firstlogon`, `guild_id`, `rank` FROM `character_data` LEFT JOIN `guild_members` ON `id` = `char_id` WHERE `id` = %i", cid);
results = database.QueryDatabase(query); results = database.QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
m_pp.lastlogin = time(nullptr); m_pp.lastlogin = time(nullptr);
if (row[6]){ if (row[4]){
guild_id = atoi(row[6]); guild_id = atoi(row[4]);
if (guildrank) { if (guildrank) {
if (row[7] != nullptr){ guildrank = atoi(row[7]); } if (row[5] != nullptr){ guildrank = atoi(row[5]); }
else{ guildrank = GUILD_RANK_NONE; } else{ guildrank = GUILD_RANK_NONE; }
} }
} }
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 (LFP){ LFP = atoi(row[11]); } if (LFP){ LFP = atoi(row[0]); }
if (LFG){ LFG = atoi(row[12]); } if (LFG){ LFG = atoi(row[1]); }
if (firstlogon){ firstlogon = atoi(row[15]); } if (firstlogon){ firstlogon = atoi(row[3]); }
} }
loaditems = database.GetInventory(cid, &m_inv); /* Load Character Inventory */ loaditems = database.GetInventory(cid, &m_inv); /* Load Character Inventory */
@ -595,13 +594,14 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
database.LoadCharacterMaterialColor(cid, &m_pp); /* Load Character Material */ database.LoadCharacterMaterialColor(cid, &m_pp); /* Load Character Material */
database.LoadCharacterPotions(cid, &m_pp); /* Load Character Potion Belt */ database.LoadCharacterPotions(cid, &m_pp); /* Load Character Potion Belt */
database.LoadCharacterCurrency(cid, &m_pp); /* Load Character Currency into PP */ database.LoadCharacterCurrency(cid, &m_pp); /* Load Character Currency into PP */
database.LoadCharacterData(cid, &m_pp); /* Load Character Data from DB into PP */ database.LoadCharacterData(cid, &m_pp, &m_epp); /* Load Character Data from DB into PP as well as E_PP */
database.LoadCharacterSkills(cid, &m_pp); /* Load Character Skills */ database.LoadCharacterSkills(cid, &m_pp); /* Load Character Skills */
database.GetPlayerInspectMessage(m_pp.name, &m_inspect_message); /* Move to another method when can, this is pointless... */ database.LoadCharacterInspectMessage(cid, &m_inspect_message); /* Load Character Inspect Message */
database.LoadCharacterSpellBook(cid, &m_pp); /* Load Character Spell Book */ database.LoadCharacterSpellBook(cid, &m_pp); /* Load Character Spell Book */
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 */
database.LoadCharacterLanguages(cid, &m_pp); /* Load Character Languages */ database.LoadCharacterLanguages(cid, &m_pp); /* Load Character Languages */
database.LoadCharacterLeadershipAA(cid, &m_pp); /* Load Character Leadership AA's */
if (level){ level = m_pp.level; } if (level){ level = m_pp.level; }
@ -619,7 +619,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
m_pp.intoxication = 0; m_pp.intoxication = 0;
strcpy(name, m_pp.name); strcpy(name, m_pp.name);
strcpy(lastname, m_pp.last_name); strcpy(lastname, m_pp.last_name);
/* If PP is set to wierd coordinates */ /* If PP is set to weird coordinates */
if ((m_pp.x == -1 && m_pp.y == -1 && m_pp.z == -1) || (m_pp.x == -2 && m_pp.y == -2 && m_pp.z == -2)) { if ((m_pp.x == -1 && m_pp.y == -1 && m_pp.z == -1) || (m_pp.x == -2 && m_pp.y == -2 && m_pp.z == -2)) {
m_pp.x = zone->safe_x(); m_pp.x = zone->safe_x();
m_pp.y = zone->safe_y(); m_pp.y = zone->safe_y();
@ -901,7 +901,6 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
m_pp.pvp = 1; m_pp.pvp = 1;
/* Time entitled on Account: Move to account */ /* Time entitled on Account: Move to account */
m_pp.timeentitledonaccount = database.GetTotalTimeEntitledOnAccount(AccountID()) / 1440; m_pp.timeentitledonaccount = database.GetTotalTimeEntitledOnAccount(AccountID()) / 1440;
/* Reset rest timer if the durations have been lowered in the database */ /* Reset rest timer if the durations have been lowered in the database */
if ((m_pp.RestTimer > RuleI(Character, RestRegenTimeToActivate)) && (m_pp.RestTimer > RuleI(Character, RestRegenRaidTimeToActivate))) if ((m_pp.RestTimer > RuleI(Character, RestRegenTimeToActivate)) && (m_pp.RestTimer > RuleI(Character, RestRegenRaidTimeToActivate)))
m_pp.RestTimer = 0; m_pp.RestTimer = 0;
@ -926,8 +925,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
in hopes that it adds more consistency... in hopes that it adds more consistency...
Remake pet Remake pet
*/ */
if (m_petinfo.SpellID > 1 && !GetPet() && m_petinfo.SpellID <= SPDAT_RECORDS) if (m_petinfo.SpellID > 1 && !GetPet() && m_petinfo.SpellID <= SPDAT_RECORDS) {
{
MakePoweredPet(m_petinfo.SpellID, spells[m_petinfo.SpellID].teleport_zone, m_petinfo.petpower, m_petinfo.Name, m_petinfo.size); MakePoweredPet(m_petinfo.SpellID, spells[m_petinfo.SpellID].teleport_zone, m_petinfo.petpower, m_petinfo.Name, m_petinfo.size);
if (GetPet() && GetPet()->IsNPC()) { if (GetPet() && GetPet()->IsNPC()) {
NPC *pet = GetPet()->CastToNPC(); NPC *pet = GetPet()->CastToNPC();
@ -1023,7 +1021,6 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
safe_delete(outapp); safe_delete(outapp);
SetAttackTimer(); SetAttackTimer();
conn_state = ZoneInfoSent; conn_state = ZoneInfoSent;
return; return;
@ -7312,7 +7309,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) {
InspectMessage_Struct* newmessage = (InspectMessage_Struct*) insr->text; InspectMessage_Struct* newmessage = (InspectMessage_Struct*) insr->text;
InspectMessage_Struct& playermessage = this->GetInspectMessage(); InspectMessage_Struct& playermessage = this->GetInspectMessage();
memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct)); memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct));
database.SetPlayerInspectMessage(name, &playermessage); database.SaveCharacterInspectMessage(this->CharacterID(), &playermessage);
if(tmp != 0 && tmp->IsClient()) { tmp->CastToClient()->QueuePacket(outapp); } // Send answer to requester if(tmp != 0 && tmp->IsClient()) { tmp->CastToClient()->QueuePacket(outapp); } // Send answer to requester
@ -7329,7 +7326,7 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) {
InspectMessage_Struct* newmessage = (InspectMessage_Struct*) app->pBuffer; InspectMessage_Struct* newmessage = (InspectMessage_Struct*) app->pBuffer;
InspectMessage_Struct& playermessage = this->GetInspectMessage(); InspectMessage_Struct& playermessage = this->GetInspectMessage();
memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct)); memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct));
database.SetPlayerInspectMessage(name, &playermessage); database.SaveCharacterInspectMessage(this->CharacterID(), &playermessage);
} }
#if 0 // I dont think there's an op for this now, and we check this #if 0 // I dont think there's an op for this now, and we check this
@ -9559,6 +9556,8 @@ void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) {
//sell them the ability. //sell them the ability.
m_pp.group_leadership_points -= cost; m_pp.group_leadership_points -= cost;
m_pp.leader_abilities.ranks[aaid]++; m_pp.leader_abilities.ranks[aaid]++;
database.SaveCharacterLeadershipAA(this->CharacterID(), &m_pp);
} }
//success, send them an update //success, send them an update

View File

@ -821,7 +821,7 @@ void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity)
#define StructDist(in, f1, f2) (uint32(&in->f2)-uint32(&in->f1)) #define StructDist(in, f1, f2) (uint32(&in->f2)-uint32(&in->f1))
bool ZoneDatabase::LoadCharacterData(uint32 character_id, PlayerProfile_Struct* pp){ bool ZoneDatabase::LoadCharacterData(uint32 character_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp){
std::string query = StringFormat( std::string query = StringFormat(
"SELECT " "SELECT "
"`name`, " "`name`, "
@ -911,100 +911,106 @@ bool ZoneDatabase::LoadCharacterData(uint32 character_id, PlayerProfile_Struct*
"group_auto_consent, " "group_auto_consent, "
"raid_auto_consent, " "raid_auto_consent, "
"guild_auto_consent, " "guild_auto_consent, "
"RestTimer " "RestTimer, "
"`e_aa_effects`, "
"`e_percent_to_aa`, "
"`e_expended_aa_spent` "
"FROM " "FROM "
"character_data " "character_data "
"WHERE `id` = %i ", character_id); "WHERE `id` = %i ", character_id);
auto results = database.QueryDatabase(query); int r = 0; auto results = database.QueryDatabase(query); int r = 0;
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
strcpy(pp->name, row[r]); r++; strcpy(pp->name, row[r]); r++; // "`name`, "
strcpy(pp->last_name, row[r]); r++; strcpy(pp->last_name, row[r]); r++; // "last_name, "
pp->gender = atoi(row[r]); r++; pp->gender = atoi(row[r]); r++; // "gender, "
pp->race = atoi(row[r]); r++; pp->race = atoi(row[r]); r++; // "race, "
pp->class_ = atoi(row[r]); r++; pp->class_ = atoi(row[r]); r++; // "class, "
pp->level = atoi(row[r]); r++; pp->level = atoi(row[r]); r++; // "`level`, "
pp->deity = atoi(row[r]); r++; pp->deity = atoi(row[r]); r++; // "deity, "
pp->birthday = atoi(row[r]); r++; pp->birthday = atoi(row[r]); r++; // "birthday, "
pp->lastlogin = atoi(row[r]); r++; pp->lastlogin = atoi(row[r]); r++; // "last_login, "
pp->timePlayedMin = atoi(row[r]); r++; pp->timePlayedMin = atoi(row[r]); r++; // "time_played, "
pp->pvp = atoi(row[r]); r++; pp->pvp = atoi(row[r]); r++; // "pvp_status, "
pp->level2 = atoi(row[r]); r++; pp->level2 = atoi(row[r]); r++; // "level2, "
pp->anon = atoi(row[r]); r++; pp->anon = atoi(row[r]); r++; // "anon, "
pp->gm = atoi(row[r]); r++; pp->gm = atoi(row[r]); r++; // "gm, "
pp->intoxication = atoi(row[r]); r++; pp->intoxication = atoi(row[r]); r++; // "intoxication, "
pp->haircolor = atoi(row[r]); r++; pp->haircolor = atoi(row[r]); r++; // "hair_color, "
pp->beardcolor = atoi(row[r]); r++; pp->beardcolor = atoi(row[r]); r++; // "beard_color, "
pp->eyecolor1 = atoi(row[r]); r++; pp->eyecolor1 = atoi(row[r]); r++; // "eye_color_1, "
pp->eyecolor2 = atoi(row[r]); r++; pp->eyecolor2 = atoi(row[r]); r++; // "eye_color_2, "
pp->hairstyle = atoi(row[r]); r++; pp->hairstyle = atoi(row[r]); r++; // "hair_style, "
pp->beard = atoi(row[r]); r++; pp->beard = atoi(row[r]); r++; // "beard, "
pp->ability_time_seconds = atoi(row[r]); r++; pp->ability_time_seconds = atoi(row[r]); r++; // "ability_time_seconds, "
pp->ability_number = atoi(row[r]); r++; pp->ability_number = atoi(row[r]); r++; // "ability_number, "
pp->ability_time_minutes = atoi(row[r]); r++; pp->ability_time_minutes = atoi(row[r]); r++; // "ability_time_minutes, "
pp->ability_time_hours = atoi(row[r]); r++; pp->ability_time_hours = atoi(row[r]); r++; // "ability_time_hours, "
strcpy(pp->title, row[r]); r++; strcpy(pp->title, row[r]); r++; // "title, "
strcpy(pp->suffix, row[r]); r++; strcpy(pp->suffix, row[r]); r++; // "suffix, "
pp->exp = atoi(row[r]); r++; pp->exp = atoi(row[r]); r++; // "exp, "
pp->points = atoi(row[r]); r++; pp->points = atoi(row[r]); r++; // "points, "
pp->mana = atoi(row[r]); r++; pp->mana = atoi(row[r]); r++; // "mana, "
pp->cur_hp = atoi(row[r]); r++; pp->cur_hp = atoi(row[r]); r++; // "cur_hp, "
pp->STR = atoi(row[r]); r++; pp->STR = atoi(row[r]); r++; // "str, "
pp->STA = atoi(row[r]); r++; pp->STA = atoi(row[r]); r++; // "sta, "
pp->CHA = atoi(row[r]); r++; pp->CHA = atoi(row[r]); r++; // "cha, "
pp->DEX = atoi(row[r]); r++; pp->DEX = atoi(row[r]); r++; // "dex, "
pp->INT = atoi(row[r]); r++; pp->INT = atoi(row[r]); r++; // "`int`, "
pp->AGI = atoi(row[r]); r++; pp->AGI = atoi(row[r]); r++; // "agi, "
pp->WIS = atoi(row[r]); r++; pp->WIS = atoi(row[r]); r++; // "wis, "
pp->face = atoi(row[r]); r++; pp->face = atoi(row[r]); r++; // "face, "
pp->y = atof(row[r]); r++; pp->y = atof(row[r]); r++; // "y, "
pp->x = atof(row[r]); r++; pp->x = atof(row[r]); r++; // "x, "
pp->z = atof(row[r]); r++; pp->z = atof(row[r]); r++; // "z, "
pp->heading = atof(row[r]); r++; pp->heading = atof(row[r]); r++; // "heading, "
pp->pvp2 = atoi(row[r]); r++; pp->pvp2 = atoi(row[r]); r++; // "pvp2, "
pp->pvptype = atoi(row[r]); r++; pp->pvptype = atoi(row[r]); r++; // "pvp_type, "
pp->autosplit = atoi(row[r]); r++; pp->autosplit = atoi(row[r]); r++; // "autosplit_enabled, "
pp->zone_change_count = atoi(row[r]); r++; pp->zone_change_count = atoi(row[r]); r++; // "zone_change_count, "
pp->drakkin_heritage = atoi(row[r]); r++; pp->drakkin_heritage = atoi(row[r]); r++; // "drakkin_heritage, "
pp->drakkin_tattoo = atoi(row[r]); r++; pp->drakkin_tattoo = atoi(row[r]); r++; // "drakkin_tattoo, "
pp->drakkin_details = atoi(row[r]); r++; pp->drakkin_details = atoi(row[r]); r++; // "drakkin_details, "
pp->toxicity = atoi(row[r]); r++; pp->toxicity = atoi(row[r]); r++; // "toxicity, "
pp->hunger_level = atoi(row[r]); r++; pp->hunger_level = atoi(row[r]); r++; // "hunger_level, "
pp->thirst_level = atoi(row[r]); r++; pp->thirst_level = atoi(row[r]); r++; // "thirst_level, "
pp->ability_up = atoi(row[r]); r++; pp->ability_up = atoi(row[r]); r++; // "ability_up, "
pp->zone_id = atoi(row[r]); r++; pp->zone_id = atoi(row[r]); r++; // "zone_id, "
pp->zoneInstance = atoi(row[r]); r++; pp->zoneInstance = atoi(row[r]); r++; // "zone_instance, "
pp->leadAAActive = atoi(row[r]); r++; pp->leadAAActive = atoi(row[r]); r++; // "leadership_exp_on, "
pp->ldon_points_guk = atoi(row[r]); r++; pp->ldon_points_guk = atoi(row[r]); r++; // "ldon_points_guk, "
pp->ldon_points_mir = atoi(row[r]); r++; pp->ldon_points_mir = atoi(row[r]); r++; // "ldon_points_mir, "
pp->ldon_points_mmc = atoi(row[r]); r++; pp->ldon_points_mmc = atoi(row[r]); r++; // "ldon_points_mmc, "
pp->ldon_points_ruj = atoi(row[r]); r++; pp->ldon_points_ruj = atoi(row[r]); r++; // "ldon_points_ruj, "
pp->ldon_points_tak = atoi(row[r]); r++; pp->ldon_points_tak = atoi(row[r]); r++; // "ldon_points_tak, "
pp->ldon_points_available = atoi(row[r]); r++; pp->ldon_points_available = atoi(row[r]); r++; // "ldon_points_available, "
pp->tribute_time_remaining = atoi(row[r]); r++; pp->tribute_time_remaining = atoi(row[r]); r++; // "tribute_time_remaining, "
pp->showhelm = atoi(row[r]); r++; pp->showhelm = atoi(row[r]); r++; // "show_helm, "
pp->career_tribute_points = atoi(row[r]); r++; pp->career_tribute_points = atoi(row[r]); r++; // "career_tribute_points, "
pp->tribute_points = atoi(row[r]); r++; pp->tribute_points = atoi(row[r]); r++; // "tribute_points, "
pp->tribute_active = atoi(row[r]); r++; pp->tribute_active = atoi(row[r]); r++; // "tribute_active, "
pp->endurance = atoi(row[r]); r++; pp->endurance = atoi(row[r]); r++; // "endurance, "
pp->group_leadership_exp = atoi(row[r]); r++; pp->group_leadership_exp = atoi(row[r]); r++; // "group_leadership_exp, "
pp->raid_leadership_exp = atoi(row[r]); r++; pp->raid_leadership_exp = atoi(row[r]); r++; // "raid_leadership_exp, "
pp->group_leadership_points = atoi(row[r]); r++; pp->group_leadership_points = atoi(row[r]); r++; // "group_leadership_points, "
pp->raid_leadership_points = atoi(row[r]); r++; pp->raid_leadership_points = atoi(row[r]); r++; // "raid_leadership_points, "
pp->air_remaining = atoi(row[r]); r++; pp->air_remaining = atoi(row[r]); r++; // "air_remaining, "
pp->PVPKills = atoi(row[r]); r++; pp->PVPKills = atoi(row[r]); r++; // "pvp_kills, "
pp->PVPDeaths = atoi(row[r]); r++; pp->PVPDeaths = atoi(row[r]); r++; // "pvp_deaths, "
pp->PVPCurrentPoints = atoi(row[r]); r++; pp->PVPCurrentPoints = atoi(row[r]); r++; // "pvp_current_points, "
pp->PVPCareerPoints = atoi(row[r]); r++; pp->PVPCareerPoints = atoi(row[r]); r++; // "pvp_career_points, "
pp->PVPBestKillStreak = atoi(row[r]); r++; pp->PVPBestKillStreak = atoi(row[r]); r++; // "pvp_best_kill_streak, "
pp->PVPWorstDeathStreak = atoi(row[r]); r++; pp->PVPWorstDeathStreak = atoi(row[r]); r++; // "pvp_worst_death_streak, "
pp->PVPCurrentKillStreak = atoi(row[r]); r++; pp->PVPCurrentKillStreak = atoi(row[r]); r++; // "pvp_current_kill_streak, "
pp->aapoints_spent = atoi(row[r]); r++; pp->aapoints_spent = atoi(row[r]); r++; // "aa_points_spent, "
pp->expAA = atoi(row[r]); r++; pp->expAA = atoi(row[r]); r++; // "aa_exp, "
pp->aapoints = atoi(row[r]); r++; pp->aapoints = atoi(row[r]); r++; // "aa_points, "
pp->groupAutoconsent = atoi(row[r]); r++; pp->groupAutoconsent = atoi(row[r]); r++; // "group_auto_consent, "
pp->raidAutoconsent = atoi(row[r]); r++; pp->raidAutoconsent = atoi(row[r]); r++; // "raid_auto_consent, "
pp->guildAutoconsent = atoi(row[r]); r++; pp->guildAutoconsent = atoi(row[r]); r++; // "guild_auto_consent, "
pp->RestTimer = atoi(row[r]); r++; pp->RestTimer = atoi(row[r]); r++; // "RestTimer, "
m_epp->aa_effects = atoi(row[r]); r++; // "`e_aa_effects`, "
m_epp->perAA = atoi(row[r]); r++; // "`e_percent_to_aa`, "
m_epp->expended_aa = atoi(row[r]); r++; // "`e_expended_aa_spent` "
LogFile->write(EQEMuLog::Status, "Loading Character Data for character ID: %i, done", character_id); LogFile->write(EQEMuLog::Status, "Loading Character Data for character ID: %i, done", character_id);
} }
return true; return true;
@ -1060,6 +1066,16 @@ bool ZoneDatabase::LoadCharacterLanguages(uint32 character_id, PlayerProfile_Str
return true; return true;
} }
bool ZoneDatabase::LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp){
std::string query = StringFormat("SELECT slot, rank FROM character_leadership_abilities WHERE `id` = %u", character_id);
auto results = database.QueryDatabase(query); uint32 slot = 0;
for (auto row = results.begin(); row != results.end(); ++row) {
slot = atoi(row[0]);
pp->leader_abilities.ranks[slot] = atoi(row[1]);
}
return true;
}
bool ZoneDatabase::LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp){ bool ZoneDatabase::LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp){
std::string query = StringFormat( std::string query = StringFormat(
"SELECT " "SELECT "
@ -1288,7 +1304,23 @@ bool ZoneDatabase::SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id,
return true; return true;
} }
bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp){ bool ZoneDatabase::SaveCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp){
uint8 first_entry = 0; std::string query = "";
for (int i = 0; i <= MAX_LEADERSHIP_AA_ARRAY; i++){
if (pp->leader_abilities.ranks[i] > 0){
if (first_entry != 1){
query = StringFormat("REPLACE INTO `character_leadership_abilities` (id, slot, rank) VALUES (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
first_entry = 1;
}
query = query + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]);
}
}
auto results = QueryDatabase(query);
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterLeadershipAA", query);
return true;
}
bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp){
clock_t t = std::clock(); /* Function timer start */ clock_t t = std::clock(); /* Function timer start */
std::string query = StringFormat( std::string query = StringFormat(
"REPLACE INTO `character_data` (" "REPLACE INTO `character_data` ("
@ -1381,7 +1413,11 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla
" group_auto_consent, " " group_auto_consent, "
" raid_auto_consent, " " raid_auto_consent, "
" guild_auto_consent, " " guild_auto_consent, "
" RestTimer) " " RestTimer, "
" e_aa_effects, "
" e_percent_to_aa, "
" e_expended_aa_spent "
") "
"VALUES (" "VALUES ("
"%u," // id " id, " "%u," // id " id, "
"%u," // account_id " account_id, " "%u," // account_id " account_id, "
@ -1472,7 +1508,10 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla
"%u," // group_auto_consent pp->groupAutoconsent, " group_auto_consent, " "%u," // group_auto_consent pp->groupAutoconsent, " group_auto_consent, "
"%u," // raid_auto_consent pp->raidAutoconsent, " raid_auto_consent, " "%u," // raid_auto_consent pp->raidAutoconsent, " raid_auto_consent, "
"%u," // guild_auto_consent pp->guildAutoconsent, " guild_auto_consent, " "%u," // guild_auto_consent pp->guildAutoconsent, " guild_auto_consent, "
"%u" // RestTimer pp->RestTimer, " RestTimer) " "%u," // RestTimer pp->RestTimer, " RestTimer) "
"%u," // e_aa_effects
"%u," // e_percent_to_aa
"%u" // e_expended_aa_spent
")", ")",
character_id, // " id, " character_id, // " id, "
account_id, // " account_id, " account_id, // " account_id, "
@ -1563,7 +1602,10 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla
pp->groupAutoconsent, // " group_auto_consent, " pp->groupAutoconsent, // " group_auto_consent, "
pp->raidAutoconsent, // " raid_auto_consent, " pp->raidAutoconsent, // " raid_auto_consent, "
pp->guildAutoconsent, // " guild_auto_consent, " pp->guildAutoconsent, // " guild_auto_consent, "
pp->RestTimer // " RestTimer) " pp->RestTimer, // " RestTimer) "
m_epp->aa_effects,
m_epp->perAA,
m_epp->expended_aa
); );
auto results = database.QueryDatabase(query); auto results = database.QueryDatabase(query);
if (!results.RowsAffected()){ std::cout << "ERROR ZoneDatabase:SaveCharacterData: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } if (!results.RowsAffected()){ std::cout << "ERROR ZoneDatabase:SaveCharacterData: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
@ -1650,6 +1692,10 @@ bool ZoneDatabase::DeleteCharacterBandolier(uint32 character_id, uint32 band_id)
std::string query = StringFormat("DELETE FROM `character_bandolier` WHERE `bandolier_id` = %u AND `id` = %u", band_id, character_id); QueryDatabase(query); return true; std::string query = StringFormat("DELETE FROM `character_bandolier` WHERE `bandolier_id` = %u AND `id` = %u", band_id, character_id); QueryDatabase(query); return true;
} }
bool ZoneDatabase::DeleteCharacterLeadershipAAs(uint32 character_id){
std::string query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", character_id); QueryDatabase(query); return true;
}
bool ZoneDatabase::DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ bool ZoneDatabase::DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){
std::string query = StringFormat("DELETE FROM `character_memmed_spells` WHERE `slot_id` = %u AND `id` = %u", slot_id, character_id); QueryDatabase(query); return true; std::string query = StringFormat("DELETE FROM `character_memmed_spells` WHERE `slot_id` = %u AND `id` = %u", slot_id, character_id); QueryDatabase(query); return true;
} }

View File

@ -255,18 +255,19 @@ public:
bool LoadCharacterLanguages(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterLanguages(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterSkills(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterSkills(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterData(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterData(uint32 character_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp);
bool LoadCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterMaterialColor(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterMaterialColor(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp);
bool LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp);
/* Character Data Saves */ /* Character Data Saves */
bool SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home); bool SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home);
bool SaveCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp); bool SaveCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp);
bool SaveCharacterData(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp); bool SaveCharacterData(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp);
bool SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 current_level); bool SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 current_level);
bool SaveCharacterSpellSwap(uint32 character_id, uint32 spell_id, uint32 from_slot, uint32 to_slot); bool SaveCharacterSpellSwap(uint32 character_id, uint32 spell_id, uint32 from_slot, uint32 to_slot);
bool SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); bool SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
@ -278,12 +279,14 @@ public:
bool SaveCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp); bool SaveCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp);
bool SaveCharacterBandolier(uint32 character_id, uint8 bandolier_id, uint8 bandolier_slot, uint32 item_id, uint32 icon, const char* bandolier_name); bool SaveCharacterBandolier(uint32 character_id, uint8 bandolier_id, uint8 bandolier_slot, uint32 item_id, uint32 icon, const char* bandolier_name);
bool SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon); bool SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon);
bool SaveCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp);
/* Character Data Deletes */ /* Character Data Deletes */
bool DeleteCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); bool DeleteCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
bool DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); bool DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
bool DeleteCharacterDisc(uint32 character_id, uint32 slot_id); bool DeleteCharacterDisc(uint32 character_id, uint32 slot_id);
bool DeleteCharacterBandolier(uint32 character_id, uint32 band_id); bool DeleteCharacterBandolier(uint32 character_id, uint32 band_id);
bool DeleteCharacterLeadershipAAs(uint32 character_id);
/* Character Inventory */ /* Character Inventory */
bool NoRentExpired(const char* name); bool NoRentExpired(const char* name);