else if (command.length() == 4 && command.compare(0,4,"warp") == 0)
{
if(arguments.size() > 0)
{
std::string loc = arguments[0];
if (this->player->character->mapid == static_cast<int>(this->server->world->config["JailMap"]))
{
break;
}
if(static_cast<int>(this->server->world->warps_config[loc + ".map"]) > 0)
{
short id = 1;
int amount = static_cast<int>(this->server->world->warps_config[loc + ".cost"]);
int Lvl = static_cast<int>(this->server->world->warps_config[loc + ".lvl"]);
int Map = static_cast<int>(this->server->world->warps_config[loc + ".map"]);
int X = static_cast<int>(this->server->world->warps_config[loc + ".x"]);
int Y = static_cast<int>(this->server->world->warps_config[loc + ".y"]);
if(X > 0 && Y > 0)
{
if(this->player->character->level < Lvl && this->player->character->admin < 1)
{
this->player->character->ShowHint(" You need lvl " + util::to_string(Lvl) + " to warp there");
break;
}
if (this->player->character->HasItem(id) < amount)
{
this->player->character->ShowHint("You need " + util::to_string(amount) + " gold to warp there! ");
break;
}
if(static_cast<std::string>(this->server->world->warps_config["WarpsAnimation"]) == "none")
{
this->player->character->Warp(Map, X, Y, WARP_ANIMATION_NONE);
this->player->character->DelItem(id, amount);
PacketBuilder b;
b.SetID(PACKET_ITEM, PACKET_KICK);
b.AddShort(id);
b.AddInt(this->player->character->HasItem(id));
b.AddChar(this->player->character->weight);
b.AddChar(this->player->character->maxweight);
this->player->character->client->SendBuilder(b);
}
else
{
this->player->character->Warp(Map, X, Y, WARP_ANIMATION_ADMIN);
this->player->character->DelItem(id, amount);
PacketBuilder b;
b.SetID(PACKET_ITEM, PACKET_KICK);
b.AddShort(id);
b.AddInt(this->player->character->HasItem(id));
b.AddChar(this->player->character->weight);
b.AddChar(this->player->character->maxweight);
this->player->character->client->SendBuilder(b);
}
}
}
}
}
//config example
desert.cost = 10
desert.lvl = 1
desert.map = 140
desert.x = 10
desert.y = 8*/