mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Fix void Database::GetCharName(uint32 char_id, char* name)
Increased MAX_PP_SPELLBOOK to 720 for UF/RoF Increased MAX_PP_MEMSPELL to 12 Implemented up to 12 spell slots Fix for public_note default value in bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) Updated all CastSpell entries to use the appropriate slot type defines located now in zone/common.h Fixed Guild Loading from character_data Fixed #guild list Refactored Merchantlist loading Refactored Temp Merchantlist loading Gutted most of dbasync Added: LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Struct* pp); LoadCharacterMemmedSpells(uint32 character_id, PlayerProfile_Struct* pp); LoadCharacterLanguages(uint32 character_id, PlayerProfile_Struct* pp); LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Struct* pp); SaveCharacterSpellSwap(uint32 character_id, uint32 spell_id, uint32 from_slot, uint32 to_slot); SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); SaveCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); DeleteCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); Removed Zone::LoadTempMerchantData_result(MYSQL_RES* result) Removed Zone::LoadMerchantData_result(MYSQL_RES* result) Removed SharedDatabase::GetPlayerProfile Removed SharedDatabase::SetPlayerProfile Removed SharedDatabase::SetPlayerProfile_MQ Removed Zone::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) from zone.cpp
This commit is contained in:
@@ -1209,106 +1209,6 @@ bool SharedDatabase::LoadNPCFactionLists() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the player profile and inventory for the given account "account_id" and
|
||||
// character name "name". Return true if the character was found, otherwise false.
|
||||
// False will also be returned if there is a database error.
|
||||
bool SharedDatabase::GetPlayerProfile(uint32 account_id, char* name, PlayerProfile_Struct* pp, Inventory* inv, ExtendedProfile_Struct *ext, char* current_zone, uint32 *current_instance) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
MYSQL_RES* result;
|
||||
MYSQL_ROW row;
|
||||
bool ret = false;
|
||||
|
||||
unsigned long* lengths;
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT profile,zonename,x,y,z,extprofile,instanceid FROM character_ WHERE account_id=%i AND name='%s'", account_id, name), errbuf, &result)) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
lengths = mysql_fetch_lengths(result);
|
||||
if (lengths[0] == sizeof(PlayerProfile_Struct)) {
|
||||
memcpy(pp, row[0], sizeof(PlayerProfile_Struct));
|
||||
|
||||
if (current_zone)
|
||||
strcpy(current_zone, row[1]);
|
||||
pp->zone_id = GetZoneID(row[1]);
|
||||
pp->x = atof(row[2]);
|
||||
pp->y = atof(row[3]);
|
||||
pp->z = atof(row[4]);
|
||||
pp->zoneInstance = atoi(row[6]);
|
||||
if (pp->x == -1 && pp->y == -1 && pp->z == -1)
|
||||
GetSafePoints(pp->zone_id, GetInstanceVersion(pp->zoneInstance), &pp->x, &pp->y, &pp->z);
|
||||
|
||||
if(current_instance)
|
||||
*current_instance = pp->zoneInstance;
|
||||
|
||||
if(ext) {
|
||||
//SetExtendedProfile handles any conversion
|
||||
SetExtendedProfile(ext, row[5], lengths[5]);
|
||||
}
|
||||
|
||||
// Retrieve character inventory
|
||||
ret = GetInventory(account_id, name, inv);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Player profile length mismatch in GetPlayerProfile. Found: %i, Expected: %i",
|
||||
lengths[0], sizeof(PlayerProfile_Struct));
|
||||
}
|
||||
}
|
||||
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "GetPlayerProfile query '%s' %s", query, errbuf);
|
||||
}
|
||||
|
||||
safe_delete_array(query);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
clock_t t = std::clock(); /* Function timer start */
|
||||
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);
|
||||
}
|
||||
LogFile->write(EQEMuLog::Status, "SharedDatabase::SetPlayerProfile SetPlayerProfile_MQ done... Took %f seconds", ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
||||
|
||||
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, profile=\'", pp->name, GetZoneName(current_zone), current_zone, 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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Create appropriate ItemInst class
|
||||
ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user