示例#1
0
 protected override void ValidateFood(Food.Food food)
 {
     if (food.GetType().Name != nameof(Meat))
     {
         this.Throw(food);
     }
 }
示例#2
0
        public void BeginPlacingFoodFurni(Food.Food Food, GameClient Client, Point UserPoint)
        {
            if (Client == null)
            {
                return;
            }

            if (Client.GetRoomUser() == null)
            {
                return;
            }

            if (base.CachedBot.DRoom == null)
            {
                return;
            }

            double MaxHeight = 0.0;

            Item ItemInFront;

            if (base.CachedBot.DRoom.GetGameMap().GetHighestItemForSquare(Client.GetRoomUser().SquareInFront, out ItemInFront))
            {
                if (ItemInFront != null)
                {
                    MaxHeight = ItemInFront.TotalHeight;
                }
            }
            base.CachedBot.DRoomUser.SetRot(Client.GetRoomUser().RotBody, false);
            RoleplayManager.PlaceItemToRoom(Client, Food.ItemId, 0, Client.GetRoomUser().SquareInFront.X, Client.GetRoomUser().SquareInFront.Y, MaxHeight, Client.GetRoomUser().RotBody, false, base.CachedBot.DRoom.Id, false, Food.ExtraData);
        }
示例#3
0
        protected override void ValidateFood(Food.Food food)
        {
            string type = food.GetType().Name;

            if (type != nameof(Vegetable) && type != nameof(Fruit))
            {
                Throw(food);
            }
        }
示例#4
0
        protected override void ValidateFood(Food.Food food)
        {
            string type = food.GetType().Name;

            if (type != nameof(Meat))
            {
                Throw(food);
            }
        }
示例#5
0
        public void Feed(Food.Food food)
        {
            if (!this.PrefferedFoods.Contains(food.GetType()))
            {
                throw new InvalidOperationException($"{this.GetType().Name} does not eat {food.GetType().Name}!");
            }

            this.FoodEaten += food.Quantity;
            this.Weight    += food.Quantity * this.WeightAddOnMultiplier;
        }
示例#6
0
        public void BeginServingFood(Food.Food Food, GameClient Client)
        {
            #region Checks
            if (!OnDuty)
            {
                return;
            }

            if (Client.GetRoleplay() == null)
            {
                return;
            }

            if (Client.GetRoomUser() == null)
            {
                return;
            }

            if (Client.LoggingOut)
            {
                return;
            }

            if (Client.GetRoleplay().Hunger <= 0)
            {
                return;
            }
            #endregion

            string RealName = Food.Name.Substring(0, 1).ToUpper() + Food.Name.Substring(1);

            this.GetBotRoleplay().WalkingToItem = true;
            this.GetRoomUser().Chat("Espere aí " + Client.GetHabbo().Username + "! Estou indo te servir um(a) " + RealName + " !", true);

            var UserPoint  = new System.Drawing.Point(Client.GetRoomUser().X, Client.GetRoomUser().Y);
            var ServePoint = new System.Drawing.Point(Client.GetRoomUser().SquareBehind.X, Client.GetRoomUser().SquareBehind.Y);

            object[] Params = { Client, Food, ServePoint, UserPoint, RealName };


            IBotHandler ServingHandler;
            if (!this.GetBotRoleplay().TryGetHandler(Handlers.FOODSERVE, out ServingHandler))
            {
                this.GetBotRoleplay().StartHandler(Handlers.FOODSERVE, out ServingHandler, Params);
            }
            else
            {
                ServingHandler.Active = true;
            }


            this.GetRoomUser().MoveTo(ServePoint);

            GetBotRoleplay().TimerManager.CreateTimer("serving", GetBotRoleplay(), 10, true, Params);
        }
示例#7
0
 public override void Eat(Food.Food food)
 {
     if (food.GetType().Name == "Vegatable")
     {
         Console.WriteLine("Tigers are not eating that type of food!");
     }
     else
     {
         base.FoodEaten = food.Quantity;
     }
 }
示例#8
0
        public override void IsFoodAppropriate(Food.Food food)
        {
            var type = food.GetType().Name;

            if (type == "Vegetable" || type == "Meat")
            {
                this.EatFood(food.Quantity);
            }
            else
            {
                throw new ArgumentException($"{this.GetType().Name} does not eat {food.GetType().Name}!");
            }
        }
示例#9
0
        // GET: Home
        public ActionResult Index(int page = 1, int pagesize = 6)
        {
            var fo = new Food.Food();
            var sv = new FoodSVClient();

            ViewBag.Food_Slide = sv.ListSlideFood();

            var or     = Session[BookFoodSesstion];
            var FoodOr = new List <OrderFood>();

            if (or != null)
            {
                FoodOr = (List <OrderFood>)or;
            }
            ViewBag.MenuList = FoodOr;
            var model = sv.PageListFood().ToPagedList(page, pagesize);

            return(View(model));
        }
示例#10
0
        public virtual void eatFood(Food.Food food)
        {
            if (this.GetType().Name == "Zebra" || this.GetType().Name == "Mouse")
            {
                if (food.GetType().Name != "Vegetable")
                {
                    Console.WriteLine($"{this.GetType().Name}s are not eating that type of food!");
                    return;
                }
            }
            else if (this.GetType().Name == "Tiger")
            {
                if (food.GetType().Name == "Vegetable")
                {
                    Console.WriteLine($"{this.GetType().Name}s are not eating that type of food!");
                    return;
                }
            }

            this.FoodEaten += food.Quantity;
        }
示例#11
0
        public void BeginServingFood(Food.Food Food, GameClient Client)
        {
            if (!OnDuty)
            {
                return;
            }

            if (Client.GetRoleplay() == null)
            {
                return;
            }

            if (Client.GetRoomUser() == null)
            {
                return;
            }

            if (Client.LoggingOut)
            {
                return;
            }

            if (Client.GetRoleplay().CurEnergy >= Client.GetRoleplay().MaxEnergy)
            {
                return;
            }

            string RealName = Food.Name.Substring(0, 1).ToUpper() + Food.Name.Substring(1);

            GetBotRoleplay().WalkingToItem = true;
            GetRoomUser().Chat("Servindo " + Client.GetHabbo().Username + "! Um copo de " + RealName + " estou indo aí!", true);

            var UserPoint  = new System.Drawing.Point(Client.GetRoomUser().X, Client.GetRoomUser().Y);
            var ServePoint = new System.Drawing.Point(Client.GetRoomUser().SquareBehind.X, Client.GetRoomUser().SquareBehind.Y);

            object[] Params = { Client, Food, ServePoint, UserPoint, RealName };

            GetRoomUser().MoveTo(ServePoint);
            GetBotRoleplay().TimerManager.CreateTimer("serving", GetBotRoleplay(), 10, true, Params);
        }
 public ActionResult Edit(Food.Food food)
 {
     if (IsNum(food.Price.ToString()))
     {
         var res = new FoodSVClient().EditFood(food);
         if (res)
         {
             SetAlert("Sửa món ăn thành công", "success");
             return(RedirectToAction("Index", "Fooder"));
         }
         else
         {
             SetAlert("Sửa món ăn KHÔNG thành công", "error");
             return(RedirectToAction("Edit", "Fooder"));
         }
     }
     else
     {
         SetAlert("Sửa món ăn KHÔNG thành công, Giá của món ăn KHÔNG HỢP LỆ", "error");
         return(RedirectToAction("Edit", "Fooder"));
     }
 }
示例#13
0
 public abstract void AddFood(Food.Food food);
示例#14
0
        /// <summary>
        /// Begins serving food/drink process
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (base.CachedBot == null || base.CachedBot.DRoomUser == null || base.CachedBot.DRoom == null)
                {
                    base.EndTimer();
                    return;
                }

                GameClient Client     = (GameClient)Params[0];
                Food.Food  Food       = (Food.Food)Params[1];
                Point      ServePoint = (Point)Params[2];
                Point      UserPoint  = (Point)Params[3];
                string     RealName   = (string)Params[4];

                bool StatCheck = false;
                if (base.CachedBot.DRoomUser.GetBotRoleplay().AIType == RoleplayBotAIType.DRINKSERVER)
                {
                    if (Client.GetRoleplay().CurEnergy < Client.GetRoleplay().MaxEnergy)
                    {
                        StatCheck = true;
                    }
                }
                else
                {
                    if (Client.GetRoleplay().Hunger > 0)
                    {
                        StatCheck = true;
                    }
                }

                if (Client != null && Client.GetRoomUser() != null && Client.GetRoleplay() != null && !Client.LoggingOut && StatCheck)
                {
                    if (Client.GetRoomUser().Coordinate != UserPoint)
                    {
                        base.CachedBot.DRoomUser.GetBotRoleplay().WalkingToItem = false;
                        InitiateGoHome();
                        base.EndTimer();
                    }

                    if (base.CachedBot.DRoomUser.Coordinate != ServePoint)
                    {
                        return;
                    }

                    int Rot = Rotation.Calculate(Client.GetRoomUser().Coordinate.X, Client.GetRoomUser().Coordinate.Y, base.CachedBot.DRoomUser.Coordinate.X, base.CachedBot.DRoomUser.Coordinate.Y);
                    base.CachedBot.DRoomUser.SetRot(Rot, false);
                    base.CachedBot.DRoomUser.Chat("Aqui está " + Client.GetHabbo().Username + "! Espero que você goste da sua " + RealName + ".", true);

                    BeginPlacingFoodFurni(Food, Client, UserPoint);
                    InitiateGoHome();
                }

                base.CachedBot.DRoomUser.GetBotRoleplay().WalkingToItem = false;
                InitiateGoHome();
                base.EndTimer();
            }
            catch
            {
                base.EndTimer();
            }
        }
示例#15
0
 protected void Throw(Food.Food food)
 {
     throw new ArgumentException($"{this.GetType().Name} does not eat {food.GetType().Name}!");
 }
示例#16
0
 protected abstract void ValidateFood(Food.Food food);
示例#17
0
 public virtual void EatFoood(Food.Food food)
 {
     ValidateFood(food);
     this.FoodEaten += food.Quantity;
 }
示例#18
0
 public override void Eat(Food.Food food)
 {
     base.FoodEaten = food.Quantity;
 }
示例#19
0
 public override void IsFoodAppropriate(Food.Food food)
 {
     this.EatFood(food.Quantity);
 }
示例#20
0
 protected override void ValidateFood(Food.Food food)
 {
 }