mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Migrate grids [skip ci]
This commit is contained in:
parent
262432f504
commit
6af1ae32ae
@ -1588,7 +1588,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
|
||||
|
||||
/* Starting Items inventory */
|
||||
database.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
|
||||
content_db.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
|
||||
|
||||
// now we give the pp and the inv we made to StoreCharacter
|
||||
// to see if we can store it
|
||||
|
||||
@ -2422,10 +2422,10 @@ void command_setlsinfo(Client *c, const Seperator *sep)
|
||||
void command_grid(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (strcasecmp("max", sep->arg[1]) == 0) {
|
||||
c->Message(Chat::White, "Highest grid ID in this zone: %d", database.GetHighestGrid(zone->GetZoneID()));
|
||||
c->Message(Chat::White, "Highest grid ID in this zone: %d", content_db.GetHighestGrid(zone->GetZoneID()));
|
||||
}
|
||||
else if (strcasecmp("add", sep->arg[1]) == 0) {
|
||||
database.ModifyGrid(c, false, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), zone->GetZoneID());
|
||||
content_db.ModifyGrid(c, false, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), zone->GetZoneID());
|
||||
}
|
||||
else if (strcasecmp("show", sep->arg[1]) == 0) {
|
||||
|
||||
@ -2445,7 +2445,7 @@ void command_grid(Client *c, const Seperator *sep)
|
||||
target->CastToNPC()->GetGrid()
|
||||
);
|
||||
|
||||
auto results = database.QueryDatabase(query);
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
c->Message(Chat::White, "Error querying database.");
|
||||
c->Message(Chat::White, query.c_str());
|
||||
@ -2485,7 +2485,7 @@ void command_grid(Client *c, const Seperator *sep)
|
||||
}
|
||||
}
|
||||
else if (strcasecmp("delete", sep->arg[1]) == 0) {
|
||||
database.ModifyGrid(c, true, atoi(sep->arg[2]), 0, 0, zone->GetZoneID());
|
||||
content_db.ModifyGrid(c, true, atoi(sep->arg[2]), 0, 0, zone->GetZoneID());
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Usage: #grid add/delete grid_num wandertype pausetype");
|
||||
@ -2500,18 +2500,18 @@ void command_wp(Client *c, const Seperator *sep)
|
||||
|
||||
if (strcasecmp("add", sep->arg[1]) == 0) {
|
||||
if (wp == 0) //default to highest if it's left blank, or we enter 0
|
||||
wp = database.GetHighestWaypoint(zone->GetZoneID(), atoi(sep->arg[2])) + 1;
|
||||
wp = content_db.GetHighestWaypoint(zone->GetZoneID(), atoi(sep->arg[2])) + 1;
|
||||
if (strcasecmp("-h", sep->arg[5]) == 0) {
|
||||
database.AddWP(c, atoi(sep->arg[2]),wp, c->GetPosition(), atoi(sep->arg[3]),zone->GetZoneID());
|
||||
content_db.AddWP(c, atoi(sep->arg[2]),wp, c->GetPosition(), atoi(sep->arg[3]),zone->GetZoneID());
|
||||
}
|
||||
else {
|
||||
auto position = c->GetPosition();
|
||||
position.w = -1;
|
||||
database.AddWP(c, atoi(sep->arg[2]),wp, position, atoi(sep->arg[3]),zone->GetZoneID());
|
||||
content_db.AddWP(c, atoi(sep->arg[2]),wp, position, atoi(sep->arg[3]),zone->GetZoneID());
|
||||
}
|
||||
}
|
||||
else if (strcasecmp("delete", sep->arg[1]) == 0)
|
||||
database.DeleteWaypoint(c, atoi(sep->arg[2]),wp,zone->GetZoneID());
|
||||
content_db.DeleteWaypoint(c, atoi(sep->arg[2]),wp,zone->GetZoneID());
|
||||
else
|
||||
c->Message(Chat::White,"Usage: #wp add/delete grid_num pause wp_num [-h]");
|
||||
}
|
||||
@ -7111,7 +7111,7 @@ void command_wpadd(Client *c, const Seperator *sep)
|
||||
position.w = -1;
|
||||
}
|
||||
|
||||
uint32 tmp_grid = database.AddWPForSpawn(c, s2info->GetID(), position, pause, type1, type2, zone->GetZoneID());
|
||||
uint32 tmp_grid = content_db.AddWPForSpawn(c, s2info->GetID(), position, pause, type1, type2, zone->GetZoneID());
|
||||
if (tmp_grid) {
|
||||
target->CastToNPC()->SetGrid(tmp_grid);
|
||||
}
|
||||
|
||||
@ -1832,7 +1832,7 @@ void QuestManager::showgrid(int grid) {
|
||||
std::string query = StringFormat("SELECT `x`,`y`,`z` FROM grid_entries "
|
||||
"WHERE `gridid` = %i AND `zoneid` = %i "
|
||||
"ORDER BY `number`", grid, zone->GetZoneID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogQuests("Error loading grid [{}] for showgrid(): [{}]", grid, results.ErrorMessage().c_str());
|
||||
return;
|
||||
|
||||
@ -239,7 +239,7 @@ bool Spawn2::Process() {
|
||||
if (spawn_group->wp_spawns && grid_ > 0)
|
||||
{
|
||||
glm::vec4 wploc;
|
||||
starting_wp = database.GetRandomWaypointLocFromGrid(wploc, zone->GetZoneID(), grid_);
|
||||
starting_wp = content_db.GetRandomWaypointLocFromGrid(wploc, zone->GetZoneID(), grid_);
|
||||
if (wploc.x != 0.0f || wploc.y != 0.0f || wploc.z != 0.0f)
|
||||
{
|
||||
loc = wploc;
|
||||
|
||||
@ -578,7 +578,7 @@ void NPC::AssignWaypoints(int32 grid, int start_wp)
|
||||
// Retrieve the wander and pause types for this grid
|
||||
std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid,
|
||||
zone->GetZoneID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
}
|
||||
@ -597,7 +597,7 @@ void NPC::AssignWaypoints(int32 grid, int start_wp)
|
||||
query = StringFormat("SELECT `x`,`y`,`z`,`pause`,`heading`, `centerpoint` "
|
||||
"FROM grid_entries WHERE `gridid` = %i AND `zoneid` = %i "
|
||||
"ORDER BY `number`", grid, zone->GetZoneID());
|
||||
results = database.QueryDatabase(query);
|
||||
results = content_db.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
}
|
||||
@ -1148,7 +1148,7 @@ int ZoneDatabase::GetRandomWaypointLocFromGrid(glm::vec4 &loc, uint16 zoneid, in
|
||||
|
||||
std::string query = StringFormat("SELECT `x`,`y`,`z`,`heading` "
|
||||
"FROM grid_entries WHERE `gridid` = %i AND `zoneid` = %u ORDER BY `number`", grid, zone->GetZoneID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "MySQL Error while trying get random waypoint loc from grid %i in zoneid %u; %s", grid, zoneid, results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user