PDA

View Full Version : #warpto


Tabasco
08-10-2010, 03:45 PM
I put this in as a sort of reverse summon since I typically find myself needing to travel to a player's exact location rather than the other way around.


Index: command.cpp
================================================== =================
--- command.cpp (revision 1612)
+++ command.cpp (working copy)
@@ -184,6 +184,7 @@
command_add("log","- Search character event log",80,command_log) ||
command_add("gm","- Turn player target's or your GM flag on or off",80,command_gm) ||
command_add("summon","[charname] - Summons your player/npc/corpse target, or charname if specified",80,command_summon) ||
+ command_add("warpto","[charname] - warps to player/npc/corpse target, or charname if specified",80,command_warpto) ||
command_add("zone","[zonename] [x] [y] [z] - Go to specified zone (coords optional)",50,command_zone) ||
command_add("zoneinstance","[instanceid] [x] [y] [z] - Go to specified instance zone (coords optional)",50,command_zone_instance) ||
command_add("peqzone","[zonename] - Go to specified zone, if you have > 75% health",0,command_peqzone) ||
@@ -305,7 +306,7 @@
command_add("nukebuffs","- Strip all buffs on you or your target",50,command_nukebuffs) ||
command_add("freeze","- Freeze your target",80,command_freeze) ||
command_add("unfreeze","- Unfreeze your target",80,command_unfreeze) ||
- command_add("pvp","[on/off] - Set your or your player target's PVP status",100,command_pvp) ||
+ command_add("pvp","[on/off] - Set you or your player target's PVP status",100,command_pvp) ||
command_add("setxp","[value] - Set your or your player target's experience",100,command_setxp) ||
command_add("setpvppoints","[value] - Set your or your player target's PVP points",100,command_setpvppoints) ||
command_add("setexp",NULL,0,command_setxp) ||
@@ -1406,6 +1407,59 @@
}
}

+// Adapted from command_summon
+void command_warpto(Client *c, const Seperator *sep)
+{
+ Mob *t;
+ int32 acc, zid, inst;
+ float px, py, pz;
+
+ if(sep->arg[1][0] != 0) // arg specified
+ {
+ Client* client = entity_list.GetClientByName(sep->arg[1]);
+ if (client != 0) // found player in zone
+ t=client->CastToMob();
+ else
+ {
+ if (!worldserver.Connected())
+ c->Message(0, "Error: World server disconnected.");
+ else
+ { // player is in another zone
+ database.GetCharacterInfo(sep->arg[1], &acc, &zid, &inst, &px, &py, &pz);
+ c->Message(0, "Warping to %s at %1.1f, %1.1f, %1.1f", sep->arg[1], px, py, pz);
+ c->MovePC(zid, px, py, pz, 0.0f, 0);
+ }
+ return;
+ }
+ }
+ else if(c->GetTarget()) // have target
+ t=c->GetTarget();
+ else
+ {
+ c->Message(0, "Usage: #warpto [charname] Either target or charname is required");
+ return;
+ }
+
+ if(!t)
+ return;
+
+ if (t->IsNPC())
+ { // npc target
+ c->Message(0, "Warping to %s at %1.1f, %1.1f, %1.1f", t->GetName(), t->GetX(), t->GetY(), t->GetZ());
+ c->MovePC(zone->GetZoneID(), t->GetX(), t->GetY(), t->GetZ(), 0.0f, 0);
+ }
+ else if (t->IsCorpse())
+ { // corpse target
+ c->Message(0, "Warping to %s at %1.1f, %1.1f, %1.1f", t->GetName(), t->GetX(), t->GetY(), t->GetZ());
+ c->MovePC(zone->GetZoneID(), t->GetX(), t->GetY(), t->GetZ(), 0.0f, 0);
+ }
+ else if (t->IsClient())
+ {
+ c->Message(0, "Warping to %s at %1.1f, %1.1f, %1.1f", t->GetName(), t->GetX(), t->GetY(), t->GetZ());
+ c->MovePC(zone->GetZoneID(), t->GetX(), t->GetY(), t->GetZ(), 0.0f, 0);
+ }
+}
+
void command_zone(Client *c, const Seperator *sep)
{
if(c->Admin() < commandZoneToCoords &&



Index: command.h
================================================== =================
--- command.h (revision 1612)
+++ command.h (working copy)
@@ -91,6 +91,7 @@
void command_log(Client *c, const Seperator *sep);
void command_gm(Client *c, const Seperator *sep);
void command_summon(Client *c, const Seperator *sep);
+void command_warpto(Client *c, const Seperator *sep);
void command_zone(Client *c, const Seperator *sep);
void command_zone_instance(Client *c, const Seperator *sep);
void command_peqzone(Client *c, const Seperator *sep);

Derision
08-10-2010, 04:00 PM
There is already a GM command, /goto (not #goto) which seems to do much the same thing (unless I am missing something, which is entirely possible :) ).

Tabasco
08-10-2010, 04:03 PM
I kept wondering why such a thing wouldn't have been implemented by now, especially since it's about 3 minutes worth of work. :oops:

This should allow you to target npc's and corpses like #summon, but /goto may already do that, I'd honestly never heard of it. Thanks!

KLS
08-10-2010, 05:54 PM
/goto requires a GM flag up but otherwise sounds like everything you want.

joligario
08-10-2010, 06:39 PM
#goto works just fine for me. Just target the player/npc and don't provide any coordinates...

Tabasco
08-10-2010, 07:33 PM
/goto appears have identical functionality, I just didn't know about it.
#goto only works with a target in the same zone.

Sorry for posting an essentially redundant command. I like not having to have the gm flag on, but if I'd know about /goto I doubt I would have messed with it. :)

KLS
08-11-2010, 02:53 AM
No need to be sorry, the code is big. Sometimes people try to fix things that don't need fixing. I appreciate it all the same.

Hmm
08-12-2010, 03:00 AM
I guess there's a room for non-GM goto command? It can be useful that way.

Anyone who wants goto without granting gm powers can add that.

joligario
08-12-2010, 04:24 AM
They can lower the status requirement for individual #commands.

Secrets
08-12-2010, 04:47 AM
They can lower the status requirement for individual #commands.

Not for /commands. /goto is a GM command in the client. Unless you give them #gm on and status above a certain point, you won't be able to warp anywhere. Furthermore anyone with #gm on can /kill NPCs.

If you try to use /goto without status, it gives a hacking report message.

If you try to use /goto without #gm, it gives a client error saying the command does not exist.

trevius
08-12-2010, 08:46 AM
Yeah, the /goto and #goto commands do not work exactly the same. The #goto command will either let you move to your current target or to a specified X Y Z. The /goto command will let you go to your target or any player on the server directly by doing /goto playername, and it will also let you go to NPCs by typing their full name such as /goto Soandso000.

Using the /target command with the #goto command works fine, but again the /target is limited to GM only as far as zone-wide targetting goes unless the player is using MQ to get around that limitation.

Tabasco
08-12-2010, 08:59 AM
Since it's available on my server I find myself using #warpto over /goto anyway just because it's convenient. I hadn't thought about it being handy for support staff though.