示例#1
0
        public void AddBusStop(Client sender, string name)
        {
            if (!sender.HasRank(ServerRank.AdministratorRozgrywki2))
            {
                sender.SendError("Nie posiadasz uprawnień do usuwania przystanku autobusowego.");
                return;
            }

            sender.SendInfo("Ustaw się w wybranej pozycji, a następnie wpisz tu użyj ctrl + alt + shift + d aby poznać swoją obecną pozycję.");

            Vector3 center = null;

            void Handler(Client o, string command)
            {
                if (center == null && o == sender && command == "tu")
                {
                    center = o.Position;
                    BusStopModel data = new BusStopModel
                    {
                        Name             = name,
                        Center           = center,
                        CreatorForumName = o.GetAccountEntity().DbModel.Name,
                    };
                    XmlHelper.AddXmlObject(data, Path.Combine(Utils.XmlDirectory, nameof(BusStopModel), data.Name));

                    sender.SendError("Dodawanie przystanku zakończyło się pomyślnie.");
                    BusStopEntity busStop = new BusStopEntity(data);
                    busStop.Spawn();
                    EntityHelper.Add(busStop);
                }
            }
        }
示例#2
0
        public void DeleteBusStop(Client sender)
        {
            if (!sender.HasRank(ServerRank.AdministratorRozgrywki2))
            {
                sender.SendWarning("Nie posiadasz uprawnień do usuwania przystanku autobusowego.");
                return;
            }

            if (!EntityHelper.GetBusStops().Any())
            {
                sender.SendError("Nie znaleziono przystanku autobusowego który można usunąć.");
                return;
            }

            BusStopEntity busStop = EntityHelper.GetBusStop(sender.Position, 5f);

            if (busStop == null)
            {
                sender.SendWarning("Nie znaleziono przystanku autobusowego w Twoim otoczeniu.");
                return;
            }

            if (XmlHelper.TryDeleteXmlObject(busStop.Data.FilePath))
            {
                sender.SendInfo("Usuwanie przystanku autobusowego zakończyło się pomyślnie.");
                EntityHelper.Remove(busStop);
                busStop.Dispose();
            }
            else
            {
                sender.SendError("Usuwanie przystanku autobusowego zakończyło się niepowodzeniem.");
            }
        }
示例#3
0
        public void RequestBusHandler(Client sender, params object[] arguments)
        {
            //args[0] Czas
            //args[1] Koszt
            //args[2] Indeks przystanku na jaki chce się udać

            BusStopEntity busStop = EntityHelper.GetBusStops().ElementAt(Convert.ToInt32(arguments[2]));

            BusStopEntity.StartTransport(sender.GetAccountEntity().CharacterEntity, Convert.ToDecimal(arguments[1]), Convert.ToInt32(arguments[0]),
                                         busStop.Data.Center, busStop.Data.Name);
        }