mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Commands] Cleanup #gassign Command. (#2101)
* [Commands] Cleanup #gassign Command. - Cleanup messages and logic. * Update gassign.cpp * Update gassign.cpp
This commit is contained in:
parent
8dcc810b43
commit
fc484d0b1c
@ -188,7 +188,7 @@ int command_init(void)
|
||||
command_add("flymode", "[0/1/2/3/4/5] - Set your or your player target's flymode to ground/flying/levitate/water/floating/levitate_running", AccountStatus::Guide, command_flymode) ||
|
||||
command_add("fov", "- Check wether you're behind or in your target's field of view", AccountStatus::QuestTroupe, command_fov) ||
|
||||
command_add("freeze", "- Freeze your target", AccountStatus::QuestTroupe, command_freeze) ||
|
||||
command_add("gassign", "[id] - Assign targetted NPC to predefined wandering grid id", AccountStatus::GMAdmin, command_gassign) ||
|
||||
command_add("gassign", "[Grid ID] - Assign targetted NPC to predefined wandering grid id", AccountStatus::GMAdmin, command_gassign) ||
|
||||
command_add("gearup", "Developer tool to quickly equip a character", AccountStatus::GMMgmt, command_gearup) ||
|
||||
command_add("gender", "[0/1/2] - Change your or your target's gender to male/female/neuter", AccountStatus::Guide, command_gender) ||
|
||||
command_add("getplayerburiedcorpsecount", "- Get your or your target's total number of buried player corpses.", AccountStatus::GMAdmin, command_getplayerburiedcorpsecount) ||
|
||||
|
||||
@ -2,13 +2,22 @@
|
||||
|
||||
void command_gassign(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (sep->IsNumber(1) && c->GetTarget() && c->GetTarget()->IsNPC() &&
|
||||
c->GetTarget()->CastToNPC()->GetSpawnPointID() > 0) {
|
||||
int spawn2id = c->GetTarget()->CastToNPC()->GetSpawnPointID();
|
||||
database.AssignGrid(c, atoi(sep->arg[1]), spawn2id);
|
||||
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
|
||||
c->Message(Chat::White, "You must target an NPC to use this command.");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Usage: #gassign [num] - must have an npc target!");
|
||||
|
||||
int arguments = sep->argnum;
|
||||
if (!arguments || !sep->IsNumber(1)) {
|
||||
c->Message(Chat::White, "Usage: #gassign [Grid ID]");
|
||||
return;
|
||||
}
|
||||
|
||||
auto grid_id = std::stoul(sep->arg[1]);
|
||||
|
||||
auto target = c->GetTarget()->CastToNPC();
|
||||
if (target->GetSpawnPointID() > 0) {
|
||||
database.AssignGrid(c, grid_id, target->GetID());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1041,18 +1041,31 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist*
|
||||
return true;
|
||||
}
|
||||
|
||||
void ZoneDatabase::AssignGrid(Client *client, int grid, int spawn2id) {
|
||||
std::string query = StringFormat("UPDATE spawn2 SET pathgrid = %d WHERE id = %d", grid, spawn2id);
|
||||
auto results = QueryDatabase(query);
|
||||
void ZoneDatabase::AssignGrid(Client *client, uint32 grid_id, uint32 entity_id) {
|
||||
auto target_npc = entity_list.GetNPCByID(entity_id);
|
||||
auto spawn2_id = target_npc ? target_npc->GetSpawnPointID() : 0;
|
||||
if (spawn2_id) {
|
||||
std::string query = fmt::format(
|
||||
"UPDATE spawn2 SET pathgrid = {} WHERE id = {}",
|
||||
grid_id,
|
||||
spawn2_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return;
|
||||
if (!results.Success() || results.RowsAffected() != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (results.RowsAffected() != 1) {
|
||||
return;
|
||||
client->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} (Spawn2 ID {}) will now use Grid ID {}.",
|
||||
target_npc->GetCleanName(),
|
||||
spawn2_id,
|
||||
grid_id
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
client->Message(Chat::White, "Grid assign: spawn2 id = %d updated", spawn2id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -480,7 +480,7 @@ public:
|
||||
uint8 GetGridType(uint32 grid, uint32 zoneid);
|
||||
uint8 GetGridType2(uint32 grid, uint16 zoneid);
|
||||
bool GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp);
|
||||
void AssignGrid(Client *client, int grid, int spawn2id);
|
||||
void AssignGrid(Client *client, uint32 grid_id, uint32 entity_id);
|
||||
int GetHighestGrid(uint32 zoneid);
|
||||
int GetHighestWaypoint(uint32 zoneid, uint32 gridid);
|
||||
int GetRandomWaypointLocFromGrid(glm::vec4 &loc, uint16 zoneid, int grid);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user