Example #1
0
        public void OnPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seat)
        {
            if (vehicle.GetData(EntityData.VEHICLE_FACTION) == Constants.JOB_FASTFOOD + Constants.MAX_FACTION_VEHICLES)
            {
                if (player.GetData(EntityData.PLAYER_DELIVER_ORDER) == null && player.GetData(EntityData.PLAYER_JOB_VEHICLE) == null)
                {
                    player.WarpOutOfVehicle();
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_delivering_order);
                }
                else if (player.GetData(EntityData.PLAYER_JOB_VEHICLE) != null && player.GetData(EntityData.PLAYER_JOB_VEHICLE) != vehicle)
                {
                    player.WarpOutOfVehicle();
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_your_job_vehicle);
                }
                else
                {
                    if (fastFoodTimerList.TryGetValue(player.Value, out Timer fastFoodTimer) == true)
                    {
                        fastFoodTimer.Dispose();
                        fastFoodTimerList.Remove(player.Value);
                    }

                    if (player.GetData(EntityData.PLAYER_JOB_VEHICLE) == null)
                    {
                        int orderId = player.GetData(EntityData.PLAYER_DELIVER_ORDER);
                        FastfoodOrderModel order = GetFastfoodOrderFromId(orderId);

                        player.SetData(EntityData.PLAYER_JOB_VEHICLE, vehicle);

                        player.TriggerEvent("fastFoodDestinationCheckPoint", order.position);
                    }
                }
            }
        }
Example #2
0
        private void OnMinute()
        {
            var totalSeconds = Scheduler.GetTotalSeconds();

            if (orderGenerationTime <= totalSeconds && House.houseList.Count > 0)
            {
                var rnd             = new Random();
                var generatedOrders = rnd.Next(7, 20);
                for (var i = 0; i < generatedOrders; i++)
                {
                    var order = new FastfoodOrderModel();
                    {
                        order.id          = fastFoodId;
                        order.pizzas      = rnd.Next(0, 4);
                        order.hamburgers  = rnd.Next(0, 4);
                        order.sandwitches = rnd.Next(0, 4);
                        order.position    = GetPlayerFastFoodDeliveryDestination();
                        order.limit       = totalSeconds + 300;
                        order.taken       = false;
                    }

                    FastFoodOrderList.Add(order);
                    fastFoodId++;
                }

                // Update the new timer time
                orderGenerationTime = totalSeconds + rnd.Next(2, 5) * 60;
            }

            // Remove old orders
            FastFoodOrderList.RemoveAll(order => !order.taken && order.limit <= totalSeconds);
        }
Example #3
0
        public void OnPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seat)
        {
            if (vehicle.GetData(EntityData.VEHICLE_FACTION) == Constants.JOB_FASTFOOD + Constants.MAX_FACTION_VEHICLES)
            {
                if (player.HasData(EntityData.PLAYER_DELIVER_ORDER) == false && player.HasData(EntityData.PLAYER_JOB_VEHICLE) == false)
                {
                    player.WarpOutOfVehicle();
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_delivering_order);
                }
                else if (player.HasData(EntityData.PLAYER_JOB_VEHICLE) && player.GetData(EntityData.PLAYER_JOB_VEHICLE) != vehicle)
                {
                    player.WarpOutOfVehicle();
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.not_your_job_vehicle);
                }
                else
                {
                    if (fastFoodTimerList.TryGetValue(player.Value, out Timer fastFoodTimer) == true)
                    {
                        fastFoodTimer.Dispose();
                        fastFoodTimerList.Remove(player.Value);
                    }
                    if (player.HasData(EntityData.PLAYER_JOB_VEHICLE) == false)
                    {
                        int orderId = player.GetData(EntityData.PLAYER_DELIVER_ORDER);
                        FastfoodOrderModel order = GetFastfoodOrderFromId(orderId);
                        Checkpoint         playerFastFoodCheckpoint = NAPI.Checkpoint.CreateCheckpoint(4, order.position, new Vector3(0.0f, 0.0f, 0.0f), 2.5f, new Color(198, 40, 40, 200));

                        player.SetData(EntityData.PLAYER_JOB_CHECKPOINT, playerFastFoodCheckpoint);
                        player.SetData(EntityData.PLAYER_JOB_VEHICLE, vehicle);

                        player.TriggerEvent("fastFoodDestinationCheckPoint", order.position);
                    }
                }
            }
        }
Example #4
0
        private FastfoodOrderModel GetFastfoodOrderFromId(int orderId)
        {
            FastfoodOrderModel order = null;

            foreach (FastfoodOrderModel orderModel in Globals.fastFoodOrderList)
            {
                if (orderModel.id == orderId)
                {
                    order = orderModel;
                    break;
                }
            }

            return(order);
        }