Add proximity show to devtools

This commit is contained in:
Akkadius
2018-12-28 02:39:08 -06:00
parent e96539e6a8
commit 9059efe98e
6 changed files with 104 additions and 16 deletions
+44
View File
@@ -312,6 +312,7 @@ int command_init(void)
#endif
command_add("push", "Lets you do spell push", 150, command_push) ||
command_add("proximity", "Shows NPC proximity", 150, command_proximity) ||
command_add("pvp", "[on/off] - Set your or your player target's PVP status", 100, command_pvp) ||
command_add("qglobal", "[on/off/view] - Toggles qglobal functionality on an NPC", 100, command_qglobal) ||
command_add("questerrors", "Shows quest errors.", 100, command_questerrors) ||
@@ -4930,6 +4931,49 @@ void command_push(Client *c, const Seperator *sep)
}
}
void command_proximity(Client *c, const Seperator *sep)
{
if (!c->GetTarget() && !c->GetTarget()->IsNPC()) {
c->Message(0, "You must target an NPC");
return;
}
for (auto &iter : entity_list.GetNPCList()) {
auto npc = iter.second;
std::string name = npc->GetName();
if (name.find("Proximity") != std::string::npos) {
npc->Depop();
}
}
NPC *npc = c->GetTarget()->CastToNPC();
if (npc->IsProximitySet()) {
glm::vec4 position;
position.w = npc->GetHeading();
position.x = npc->GetProximityMinX();
position.y = npc->GetProximityMinY();
position.z = npc->GetZ();
position.x = npc->GetProximityMinX();
position.y = npc->GetProximityMinY();
NPC::SpawnNodeNPC("Proximity", "", position);
position.x = npc->GetProximityMinX();
position.y = npc->GetProximityMaxY();
NPC::SpawnNodeNPC("Proximity", "", position);
position.x = npc->GetProximityMaxX();
position.y = npc->GetProximityMinY();
NPC::SpawnNodeNPC("Proximity", "", position);
position.x = npc->GetProximityMaxX();
position.y = npc->GetProximityMaxY();
NPC::SpawnNodeNPC("Proximity", "", position);
}
}
void command_pvp(Client *c, const Seperator *sep)
{
bool state=atobool(sep->arg[1]);