Пример #1
0
        public void ClientEvent_acceptEdit(Client player, float X, float Y, float Z, float XX, float YY, float ZZ)
        {
            try
            {
                if (!player.HasData("IS_EDITING"))
                {
                    return;
                }
                House house = HouseManager.GetHouse(player, true);
                if (house == null)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас нет дома", 3000);
                    return;
                }
                int id = player.GetData("EDIT_ID");
                HouseFurnitures[house.ID][id].IsSet = true;
                Vector3 pos = new Vector3(X, Y, Z);
                Vector3 rot = new Vector3(XX, YY, ZZ);

                HouseFurnitures[house.ID][id].Position = pos;
                HouseFurnitures[house.ID][id].Rotation = rot;
                house.DestroyFurnitures();
                house.CreateAllFurnitures();
                player.ResetData("IS_EDITING");
                return;
            } catch (Exception e) { Log.Write("acceptEdit: " + e.Message, nLog.Type.Error); }
        }
Пример #2
0
 //库区
 public void housedetail()
 {
     this.DropDownList2.DataSource     = HouseManager.GetHouse(Convert.ToInt32(this.DropDownList1.SelectedValue));
     this.DropDownList2.DataTextField  = "SubareaName";
     this.DropDownList2.DataValueField = "ID";
     this.DropDownList2.DataBind();
 }
Пример #3
0
        public void Player_Tick(double currentUnixTime)
        {
            actionQueue.RunActions();

            if (nextAgeUpdateTime <= currentUnixTime)
            {
                nextAgeUpdateTime = currentUnixTime + ageUpdateInterval;

                if (initialAgeTime == DateTime.MinValue)
                {
                    initialAge     = Age ?? 1;
                    initialAgeTime = DateTime.UtcNow;
                }

                Age = initialAge + (int)(DateTime.UtcNow - initialAgeTime).TotalSeconds;

                // In retail, this is sent every 7 seconds. If you adjust ageUpdateInterval from 7, you'll need to re-add logic to send this every 7s (if you want to match retail)
                Session.Network.EnqueueSend(new GameMessagePrivateUpdatePropertyInt(this, PropertyInt.Age, Age ?? 1));
            }

            if (FellowVitalUpdate && Fellowship != null)
            {
                Fellowship.OnVitalUpdate(this);
                FellowVitalUpdate = false;
            }

            if (House != null && PropertyManager.GetBool("house_rent_enabled").Item)
            {
                if (houseRentWarnTimestamp > 0 && currentUnixTime > houseRentWarnTimestamp)
                {
                    HouseManager.GetHouse(House.Guid.Full, (house) =>
                    {
                        if (house != null && house.HouseStatus == HouseStatus.Active && !house.SlumLord.IsRentPaid())
                        {
                            Session.Network.EnqueueSend(new GameMessageSystemChat($"Warning!  You have not paid your maintenance costs for the last {(house.IsApartment ? "90" : "30")} day maintenance period.  Please pay these costs by this deadline or you will lose your house, and all your items within it.", ChatMessageType.Broadcast));
                        }
                    });

                    houseRentWarnTimestamp = Time.GetFutureUnixTime(houseRentWarnInterval);
                }
                else if (houseRentWarnTimestamp == 0)
                {
                    houseRentWarnTimestamp = Time.GetFutureUnixTime(houseRentWarnInterval);
                }
            }
        }
Пример #4
0
    public void LoadHouse()
    {
        GameObject      o    = EventSystem.current.currentSelectedGameObject;
        TextMeshProUGUI t    = o.GetComponentInChildren <TextMeshProUGUI>();
        string          name = t.text;

        try
        {
            currentHouse = households.GetHouse(name);
        }
        catch (InvalidOperationException i)
        {
            Debug.LogError(i.Message);
        }
        houseTitle.text = currentHouse.name;
        UpdateLoadedHouse.Invoke(currentHouse);
    }
Пример #5
0
        public void Spawn(Client player)
        {
            try
            {
                NAPI.Task.Run(() =>
                {
                    try
                    {
                        player.SetSharedData("IS_MASK", false);

                        // Logged in state, money, phone init
                        Trigger.ClientEvent(player, "loggedIn");
                        player.SetData("LOGGED_IN", true);

                        Trigger.ClientEvent(player, "UpdateMoney", Money);
                        Trigger.ClientEvent(player, "UpdateBank", MoneySystem.Bank.Accounts[Bank].Balance);
                        Trigger.ClientEvent(player, "initPhone");
                        Jobs.WorkManager.load(player);

                        // Skin, Health, Armor, RemoteID
                        player.SetSkin((Gender) ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);
                        player.Health = (Health > 5) ? Health : 5;
                        player.Armor  = Armor;

                        player.SetSharedData("REMOTE_ID", player.Value);

                        Voice.Voice.PlayerJoin(player);

                        player.SetSharedData("voipmode", -1);

                        if (Fractions.Manager.FractionTypes[FractionID] == 1 || AdminLVL > 0)
                        {
                            Fractions.GangsCapture.LoadBlips(player);
                        }
                        if (WantedLVL != null)
                        {
                            Trigger.ClientEvent(player, "setWanted", WantedLVL.Level);
                        }

                        player.SetData("RESIST_STAGE", 0);
                        player.SetData("RESIST_TIME", 0);
                        if (AdminLVL > 0)
                        {
                            player.SetSharedData("IS_ADMIN", true);
                        }

                        Dashboard.sendStats(player);
                        Dashboard.sendItems(player);
                        if (Main.Players[player].LVL == 0)
                        {
                            NAPI.Task.Run(() => { try { Trigger.ClientEvent(player, "disabledmg", true); } catch { } }, 5000);
                        }

                        House house = HouseManager.GetHouse(player);
                        if (house != null)
                        {
                            // House blips & checkpoints
                            house.PetName = Main.Players[player].PetName;

                            Trigger.ClientEvent(player, "changeBlipColor", house.blip, 73);

                            Trigger.ClientEvent(player, "createCheckpoint", 333, 1, GarageManager.Garages[house.GarageID].Position - new Vector3(0, 0, 1.12), 1, NAPI.GlobalDimension, 220, 220, 0);
                            Trigger.ClientEvent(player, "createGarageBlip", GarageManager.Garages[house.GarageID].Position);
                        }

                        if (!Customization.CustomPlayerData.ContainsKey(UUID) || !Customization.CustomPlayerData[UUID].IsCreated)
                        {
                            Trigger.ClientEvent(player, "spawnShow", false);
                            Customization.CreateCharacter(player);
                        }
                        else
                        {
                            try
                            {
                                NAPI.Entity.SetEntityPosition(player, Main.Players[player].SpawnPos);
                                List <bool> prepData = new List <bool>
                                {
                                    true,
                                    (FractionID > 0) ? true : false,
                                    (house != null || HotelID != -1) ? true : false,
                                };
                                Trigger.ClientEvent(player, "spawnShow", JsonConvert.SerializeObject(prepData));
                                Customization.ApplyCharacter(player);
                            }
                            catch { }
                        }
                    }
                    catch (Exception e)
                    {
                        Log.Write($"EXCEPTION AT \"Spawn.NAPI.Task.Run\":\n" + e.ToString(), nLog.Type.Error);
                    }
                });

                if (Warns > 0 && DateTime.Now > Unwarn)
                {
                    Warns--;

                    if (Warns > 0)
                    {
                        Unwarn = DateTime.Now.AddDays(14);
                    }
                    Notify.Send(player, NotifyType.Warning, NotifyPosition.BottomCenter, $"Одно предупреждение было снято. У Вас осталось {Warns}", 3000);
                }

                if (!Dashboard.isopen.ContainsKey(player))
                {
                    Dashboard.isopen.Add(player, false);
                }

                nInventory.Check(UUID);
                if (nInventory.Find(UUID, ItemType.BagWithMoney) != null)
                {
                    nInventory.Remove(player, ItemType.BagWithMoney, 1);
                }
                if (nInventory.Find(UUID, ItemType.BagWithDrill) != null)
                {
                    nInventory.Remove(player, ItemType.BagWithDrill, 1);
                }

                if (FractionID == 15)
                {
                    Trigger.ClientEvent(player, "enableadvert", true);
                    Fractions.LSNews.onLSNPlayerLoad(player);
                }
                if (AdminLVL > 0)
                {
                    ReportSys.onAdminLoad(player);
                }
            }
            catch (Exception e)
            {
                Log.Write("EXCEPTION AT \"Spawn\":\n" + e.ToString());
            }
        }
Пример #6
0
        public static void interactionPressed(Client player, int id)
        {
            try
            {
                switch (id)
                {
                case 40:
                    if (!player.HasData("GARAGEID") || Houses.HouseManager.GetHouse(player) == null)
                    {
                        return;
                    }
                    Garage garage = Garages[player.GetData("GARAGEID")];
                    if (garage == null)
                    {
                        return;
                    }
                    var house = HouseManager.GetHouse(player);
                    if (house == null || house.GarageID != garage.ID)
                    {
                        return;
                    }

                    var vehicles = VehicleManager.getAllPlayerVehicles(house.Owner);
                    if (player.IsInVehicle && !vehicles.Contains(player.Vehicle.NumberPlate))
                    {
                        Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Вы не можете въехать в гараж на этой машине", 3000);
                        return;
                    }
                    else if (player.IsInVehicle && vehicles.Contains(player.Vehicle.NumberPlate))
                    {
                        var vehicle = player.Vehicle;
                        var number  = vehicle.NumberPlate;
                        VehicleManager.Vehicles[number].Fuel     = (!NAPI.Data.HasEntitySharedData(player.Vehicle, "PETROL")) ? VehicleManager.VehicleTank[player.Vehicle.Class] : NAPI.Data.GetEntitySharedData(player.Vehicle, "PETROL");
                        VehicleManager.Vehicles[number].Items    = player.Vehicle.GetData("ITEMS");
                        VehicleManager.Vehicles[number].Position = null;
                        VehicleManager.WarpPlayerOutOfVehicle(player);
                        NAPI.Task.Run(() => { try { NAPI.Entity.DeleteEntity(vehicle); } catch { } });

                        garage.SendVehicleIntoGarage(number);
                    }

                    if (garage.Type == -1)
                    {
                        if (vehicles.Count == 0)
                        {
                            return;
                        }
                        if (garage.CheckCar(false, vehicles[0]))
                        {
                            Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Ваша машина сейчас где-то в штате, вы можете эвакуировать её", 3000);
                            return;
                        }
                        if (player.IsInVehicle)
                        {
                            return;
                        }

                        if (VehicleManager.Vehicles[vehicles[0]].Health < 1)
                        {
                            Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Вы должны восстановить машину", 3000);
                            return;
                        }
                        garage.GetVehicleFromGarage(player, vehicles[0]);
                    }
                    else
                    {
                        garage.SendPlayer(player);
                    }
                    return;

                case 41:
                    if (Main.Players[player].InsideGarageID == -1)
                    {
                        return;
                    }
                    garage = Garages[Main.Players[player].InsideGarageID];
                    garage.RemovePlayer(player);
                    return;
                }
            }
            catch (Exception e)
            {
                Log.Write("EXCEPTION AT \"GARAGE_INTERACTION\":\n" + e.ToString(), nLog.Type.Error);
            }
        }