mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Fix character creation tenancy operations
This commit is contained in:
@@ -750,61 +750,6 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
||||
return true;
|
||||
}
|
||||
|
||||
/* This only for new Character creation storing */
|
||||
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv) {
|
||||
uint32 charid = 0;
|
||||
char zone[50];
|
||||
float x, y, z;
|
||||
charid = GetCharacterID(pp->name);
|
||||
|
||||
if(!charid) {
|
||||
LogError("StoreCharacter: no character id");
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *zname = GetZoneName(pp->zone_id);
|
||||
if(zname == nullptr) {
|
||||
/* Zone not in the DB, something to prevent crash... */
|
||||
strn0cpy(zone, "qeynos", 49);
|
||||
pp->zone_id = 1;
|
||||
}
|
||||
else{ strn0cpy(zone, zname, 49); }
|
||||
|
||||
x = pp->x;
|
||||
y = pp->y;
|
||||
z = pp->z;
|
||||
|
||||
/* Saves Player Profile Data */
|
||||
SaveCharacterCreate(charid, account_id, pp);
|
||||
|
||||
/* Insert starting inventory... */
|
||||
std::string invquery;
|
||||
for (int16 i = EQEmu::invslot::EQUIPMENT_BEGIN; i <= EQEmu::invbag::BANK_BAGS_END;) {
|
||||
const EQEmu::ItemInstance* newinv = inv->GetItem(i);
|
||||
if (newinv) {
|
||||
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
|
||||
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
|
||||
|
||||
auto results = QueryDatabase(invquery);
|
||||
}
|
||||
|
||||
if (i == EQEmu::invslot::slotCursor) {
|
||||
i = EQEmu::invbag::GENERAL_BAGS_BEGIN;
|
||||
continue;
|
||||
}
|
||||
else if (i == EQEmu::invbag::CURSOR_BAG_END) {
|
||||
i = EQEmu::invslot::BANK_BEGIN;
|
||||
continue;
|
||||
}
|
||||
else if (i == EQEmu::invslot::BANK_END) {
|
||||
i = EQEmu::invbag::BANK_BAGS_BEGIN;
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 Database::GetCharacterID(const char *name) {
|
||||
std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
@@ -115,7 +115,6 @@ public:
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
||||
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
|
||||
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
|
||||
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv);
|
||||
bool UpdateName(const char* oldname, const char* newname);
|
||||
|
||||
/* General Information Queries */
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
static CharacterRecipeList GetDefaults()
|
||||
static CharacterRecipeList NewEntity()
|
||||
{
|
||||
CharacterRecipeList character_recipe_list_entry;
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
return GetDefaults();
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
static GridEntry Default()
|
||||
static GridEntry NewEntity()
|
||||
{
|
||||
GridEntry entry{};
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
static Grid Default()
|
||||
static Grid NewEntity()
|
||||
{
|
||||
Grid entry{};
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
return Default();
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
static SpawnGroup New()
|
||||
static SpawnGroup NewEntity()
|
||||
{
|
||||
SpawnGroup entry;
|
||||
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
return New();
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
static TradeskillRecipe New()
|
||||
static TradeskillRecipe NewEntity()
|
||||
{
|
||||
TradeskillRecipe entry;
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
)
|
||||
);
|
||||
|
||||
TradeskillRecipe tradeskill_recipe = New();
|
||||
TradeskillRecipe tradeskill_recipe = NewEntity();
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 0) {
|
||||
|
||||
Reference in New Issue
Block a user