Esempio n. 1
0
 public void Invoke(ShPlayer player, float x, float y, float z, int placeIndex = 0)
 {
     if (placeIndex < 0 || placeIndex > (Core.Instance.SvManager.fixedPlaces.Count + Core.Instance.SvManager.apartments.Count))
     {
         player.TS("TeleportCoordinates_invalidPlaceIndex", placeIndex.ToString());
         return;
     }
     player.GetExtendedPlayer().ResetAndSavePosition(new Vector3(x, y, z), player.GetRotation(), placeIndex);
     player.TS("TeleportCoordinates", x.ToString(), y.ToString(), z.ToString(), placeIndex.ToString());
 }
Esempio n. 2
0
        private StringBuilder GetOnlineInfo(ShPlayer target)
        {
            var sb = new StringBuilder();

            sb
            .Append("ID: ").AppendLine(target.ID.ToString())
            .Append("SteamID64: ").AppendLine(target.steamID.ToString())
            .Append("Username: "******" (Sanitized)")
            .Append("Health: ").AppendLine(target.health.ToString())
            .Append("BankBalance: ").AppendLine(target.svPlayer.bankBalance.ToString())
            .Append("Position: ").AppendLine(target.GetPosition().ToString())
            .Append("Rotation: ").AppendLine(target.GetRotation().ToString())
            .Append("Stats: ").AppendLine(string.Join("\n    - ", target.stats))
            .Append("Expecting more info? Type '/info ").Append(target.steamID.ToString()).AppendLine("'.");
            return(sb);
        }
Esempio n. 3
0
        public void Invoke(ShPlayer player, string warp, int price = 0, int delay = 0)
        {
            if (delay < 0)
            {
                player.TS("delay_error_negative");
                return;
            }
            if (price < 0)
            {
                player.TS("price_error_negative");
                return;
            }
            if (player.svPlayer.InApartment())
            {
                player.TS("warpCreate_error_inApartment");
                return;
            }
            var file = Path.Combine(Core.Instance.Paths.WarpsFolder, $"{warp}.json");

            if (File.Exists(file))
            {
                player.TS("expFileHandler_create_error_alreadyExists", player.T(Core.Instance.WarpHandler.Name), warp);
                return;
            }
            var obj = new WarpHandler.JsonModel
            {
                Delay    = Math.Max(0, delay),
                Price    = Math.Max(0, price),
                Name     = warp,
                Position = new WarpHandler.Position {
                    SerializableVector3 = new SerializableVector3(player.GetPosition()), PlaceIndex = player.GetPlaceIndex()
                },
                SerializableQuaternion = new SerializableQuaternion(player.GetRotation())
            };

            Core.Instance.WarpHandler.CreateNew(obj, warp);
            player.TS("warpCreate_created", warp, price.ToString(), delay.ToString());
        }
Esempio n. 4
0
 public static void ResetAndSavePosition(this PlayerItem player, ShPlayer targetPlayer)
 {
     player.SavePosition();
     player.Client.svPlayer.SvReset(targetPlayer.GetPosition(), targetPlayer.GetRotation(), targetPlayer.GetPlaceIndex());
 }
Esempio n. 5
0
 public void Update(ShPlayer player)
 {
     Update(player.GetPosition(), player.GetRotation(), player.GetPlaceIndex());
 }
Esempio n. 6
0
        public void Invoke(ShPlayer player, string name)
        {
            var vehicle = Core.Instance.EntityHandler.Vehicles.OrderByDescending(x => LevenshteinDistance.CalculateSimilarity(x.Key, name)).FirstOrDefault().Value;
            var pos     = player.GetPosition();

            Core.Instance.SvManager.AddNewEntity(vehicle, player.GetPlace(), new Vector3(pos.x, pos.y + 7F, pos.z), player.GetRotation(), respawnable: false);
            player.TS("player_vehicle_spawned", vehicle.name);
        }