Ejemplo n.º 1
0
        public void WarehouseDeliverOrder(IPlayer player)
        {
            CharacterEntity characterEntity = player.GetAccountEntity().characterEntity;

            if (characterEntity == null)
            {
                return;
            }

            if (characterEntity.CurrentDeliveryOrder != null)
            {
                WarehouseOrderEntity entityOrder = characterEntity.CurrentDeliveryOrder;

                player.RemoveDrawText($"WAREHOUSE_ORDER_DRAW_TEXT{entityOrder.DbModel.Id}");
                Task.Run(async() =>
                {
                    await player.DeleteBlip($"WAREHOUSE_ORDER_BLIP{entityOrder.DbModel.Id}");
                });
                player.CallNative("clearGpsMultiRoute");

                entityOrder.Delivier(characterEntity);

                player.SendChatMessageInfo("Dostarczyłeś paczkę pomyślnie!");

                characterEntity.CasualJob.ChargeMoney(characterEntity, 20);
                player.SendChatMessageInfo("Otrzymałeś 20$ za dostarczoną przesyłkę");
            }
        }
Ejemplo n.º 2
0
        public static async Task LoadServerEntity()
        {
            RoleplayContext ctx = Singleton.GetDatabaseInstance();

            using (UnitOfWork unit = new UnitOfWork(ctx))
            {
                await BuildingEntity.LoadBuildingsAsync(unit);

                await AtmEntity.LoadAtmsAsync(unit);

                await BusEntity.LoadBusAsync(unit);

                await ShopEntity.LoadShopAsync(unit);

                await GroupEntity.LoadGroupsAsync(unit);

                await WarehouseOrderEntity.LoadWarehouseOrdersAsync();
            }

            JobEntity courierJob = new JobEntity(new JobEntityModel()
            {
                JobName                = "Kurier",
                VehicleModel           = AltV.Net.Enums.VehicleModel.Boxville2,
                RespawnVehicle         = true,
                Position               = new Position(26.1626f, -1300.59f, 29.2124f),
                RespawnVehiclePosition = new Position(36.9495f, -1283.84f, 29.2799f),
                RespawnVehicleRotation = new Rotation(0, 0, 1.53369f),
                JobType                = JobType.Courier,
                MaxSalary              = 400
            });

            courierJob.Create();

            JobEntity junkerJob = new JobEntity(new JobEntityModel()
            {
                JobName                = "Śmieciarz",
                VehicleModel           = AltV.Net.Enums.VehicleModel.Trash,
                RespawnVehicle         = true,
                Position               = new Position(500.334f, -652.009f, 24.8989f),
                RespawnVehiclePosition = new Position(508.286f, -609.771f, 25.1348f),
                RespawnVehicleRotation = new Rotation(0, 0, 1.63264f),
                JobType                = JobType.Junker,
                MaxSalary              = 400
            });

            junkerJob.Create();

            JobCenterEntity jobCenter = new JobCenterEntity(new JobCenterModel()
            {
                Id       = 0,
                Position = new Position(104.73f, -934.075f, 29.8022f),
                Jobs     = EntityHelper.GetJobs()
            });

            jobCenter.Spawn();
        }
Ejemplo n.º 3
0
 public static void Remove(WarehouseOrderEntity warehouseOrderEntity) => WarehouseOrders.Remove(warehouseOrderEntity);
Ejemplo n.º 4
0
 public static void Add(WarehouseOrderEntity warehouseOrderEntity) => WarehouseOrders.Add(warehouseOrderEntity);
Ejemplo n.º 5
0
        public void StartDelivieryOrder(IPlayer player, int orderId)
        {
            CharacterEntity worker = player.GetAccountEntity().characterEntity;

            WarehouseOrderEntity orderEntity = EntityHelper.GetWarehouseOrderById(orderId);

            if (orderEntity == null)
            {
                return;
            }

            if (worker.DbModel.JobEarned >= worker.CasualJob.JobEntityModel.MaxSalary)
            {
                player.SendChatMessageInfo("Zarobiłeś już maksymalną ilość pieniędzy. Przyjedź jutro");
                return;
            }

            if (!orderEntity.IsDelivered)
            {
                if (worker.CurrentDeliveryOrder == null)
                {
                    orderEntity.StartDeliviery(worker);


                    player.CreateDrawText(new DrawTextModel()
                    {
                        Text      = "Kliknij ~g~E ~w~ aby odlożyć paczkę",
                        X         = orderEntity.DbModel.Warehouse.PosX,
                        Y         = orderEntity.DbModel.Warehouse.PosY,
                        Z         = orderEntity.DbModel.Warehouse.PosZ,
                        Dimension = 0,
                        UniqueID  = $"WAREHOUSE_ORDER_DRAW_TEXT{orderEntity.DbModel.Id}"
                    });

                    Task.Run(async() =>
                    {
                        await player.CreateBlip(new BlipModel()
                        {
                            Name       = $"Paczka ({orderEntity.DbModel.Name})",
                            Blip       = 478,
                            Color      = 76,
                            PosX       = orderEntity.DbModel.Warehouse.PosX,
                            PosY       = orderEntity.DbModel.Warehouse.PosY,
                            PosZ       = orderEntity.DbModel.Warehouse.PosZ,
                            ShortRange = false,
                            Size       = EBlipSize.Medium,
                            UniqueID   = $"WAREHOUSE_ORDER_BLIP{orderEntity.DbModel.Id}"
                        });
                    });

                    player.CallNative("addPointToGpsCustomRoute", new object[] { orderEntity.DbModel.Warehouse.PosX, orderEntity.DbModel.Warehouse.PosY, orderEntity.DbModel.Warehouse.PosZ });
                    player.CallNative("setGpsMultiRouteRender", new object[] { true });

                    player.SendChatMessageInfo("Twoja paczka została zapakowana do wozu, miejsce dostarczenia zostało oznaczone na mapie.");
                }
                else
                {
                    player.SendChatMessageError("Dostarczasz już jakąś paczkę!");
                }
            }
            else
            {
                player.SendChatMessageInfo("Ktoś już dostarcza tą paczkę do zamawiającego");
            }
        }