Sup ladies? Well i rewrote parts of Pntzyou's (credits given in code) code. Now its using incremental xyzo orientation instead of rlfbudo (xD) Well i added orientation, enabled decimal values for teleportation, changed so you use xyzo etc...
X=Left and right
Y=Forward and backward
Z=Up and down
O=Rotation
Example of what you can do with this shit:
Another Warp Test!
Command example if properly implented:
Code:
.warp y 13.678
.warp y -13.678
Code:
bool ChatHandler::HandleWarpCommand(char* args)
{
// Based on a concept by Pwntzyou
if (!*args)
return false;
Player* _player = m_session->GetPlayer();
char* arg1 = strtok((char*)args, " ");
char* arg2 = strtok(NULL, " ");
if (!arg1 || !arg2)
return false;
char dir = arg1[0];
float value = float(atof(arg2));
float x = _player->GetPositionX();
float y = _player->GetPositionY();
float z = _player->GetPositionZ();
float o = _player->GetOrientation();
if ((dir != 'x' && dir != 'y' && dir != 'z' && dir != 'o') || value == 0.f)
{
ChatHandler(_player).PSendSysMessage("%s[Warp Info]%s Incorrect values, correct direction parameters is: x,y,z and o. Correct range/degree parameter is everything above or under 0.",MSG_COLOR_MAGENTA,MSG_COLOR_WHITE,value);
return true;
}
switch (dir)
{
case 'x':
{
x = x + cos(o-(M_PI/2))*value;
y = y + sin(o-(M_PI/2))*value;
_player->NearTeleportTo(x,y,z,o);
ChatHandler(_player).PSendSysMessage("%s[Warp Info]%s You teleported %g yards in x direction",MSG_COLOR_MAGENTA,MSG_COLOR_WHITE,value);
}
break;
case 'y':
{
x = x + cosf(o)*value;
y = y + sinf(o)*value;
_player->NearTeleportTo(x,y,z,o);
ChatHandler(_player).PSendSysMessage("%s[Warp Info]%s You teleported %g yards in y direction",MSG_COLOR_MAGENTA,MSG_COLOR_WHITE,value);
}
break;
case 'z':
{
_player->NearTeleportTo(x,y,z+value,o);
ChatHandler(_player).PSendSysMessage("%s[Warp Info]%s You teleported %g yards in z direction",MSG_COLOR_MAGENTA,MSG_COLOR_WHITE,value);
}
break;
case 'o':
{
o = MapManager::NormalizeOrientation((value * M_PI_F/180.0f)+o);
_player->NearTeleportTo(x,y,z,o);
ChatHandler(_player).PSendSysMessage("%s[Warp Info]%s You rotated %g degrees (%g radians)",MSG_COLOR_MAGENTA,MSG_COLOR_WHITE,value,value * M_PI / 180.0f);
ChatHandler(_player).PSendSysMessage("%sCurrent radian/degree: %g %g",MSG_COLOR_WHITE,o,o*180.0f/M_PI);
}
break;
}
return true;
}
If you need help with how to install it, ask someone else. I didn't write this to be your personal assistant, i wrote this because i wanted to write some code.
PS: Written for MaNGOS but easily portable to: OregonCore, TrinityCore, SkyFire. Portable to arcemu with a lil more modification