コード例 #1
0
        public static void Cook(TreeResourceItem resource, Mobile from, HarvestSuccessRating rating, TreeProduct product,
                                Container pack)
        {
            switch (rating)
            {
            case HarvestSuccessRating.PartialSuccess:
            case HarvestSuccessRating.Success:
            {
                TreeProductItem item = new TreeProductItem(product);
                if (item.ItemID == 0x183B && !pack.ConsumeTotal(typeof(LargeEmptyFlask), 1))
                {
                    from.SendMessage(
                        "You need an empty flask in your pack to store the {0}. The resource was lost.", item.Name);
                    resource.Consume(1);
                    item.Delete();
                }
                else if (item.ItemID == 0x1604 && !pack.ConsumeTotal(typeof(EmptyWoodenBowl), 1))
                {
                    from.SendMessage(
                        "You need an empty bowl in your pack to store the {0}. The resource was lost.", item.Name);
                    resource.Consume(1);
                    item.Delete();
                }
                else if (from.AddToBackpack(item) || item.DropToWorld(from, from.Location))
                {
                    from.SendMessage("You cook the resource and turn it in to {0}.", item.Name);
                    resource.Consume(1);
                }
                else
                {
                    from.SendMessage("Unable to create the {0}.", item.Name);
                    item.Delete();
                }
                break;
            }

            case HarvestSuccessRating.Failure:
            {
                from.SendMessage("You fail to cook the resource.");
                break;
            }
            }
        }
コード例 #2
0
ファイル: TreeResources.cs プロジェクト: greeduomacro/RuneUO
 public static void Cook(TreeResourceItem resource, Mobile from, HarvestSuccessRating rating, TreeProduct product,
     Container pack)
 {
     switch (rating)
     {
         case HarvestSuccessRating.PartialSuccess:
         case HarvestSuccessRating.Success:
         {
             TreeProductItem item = new TreeProductItem(product);
             if (item.ItemID == 0x183B && !pack.ConsumeTotal(typeof (LargeEmptyFlask), 1))
             {
                 from.SendMessage(
                     "You need an empty flask in your pack to store the {0}. The resource was lost.", item.Name);
                 resource.Consume(1);
                 item.Delete();
             }
             else if (item.ItemID == 0x1604 && !pack.ConsumeTotal(typeof (EmptyWoodenBowl), 1))
             {
                 from.SendMessage(
                     "You need an empty bowl in your pack to store the {0}. The resource was lost.", item.Name);
                 resource.Consume(1);
                 item.Delete();
             }
             else if (from.AddToBackpack(item) || item.DropToWorld(from, from.Location))
             {
                 from.SendMessage("You cook the resource and turn it in to {0}.", item.Name);
                 resource.Consume(1);
             }
             else
             {
                 from.SendMessage("Unable to create the {0}.", item.Name);
                 item.Delete();
             }
             break;
         }
         case HarvestSuccessRating.Failure:
         {
             from.SendMessage("You fail to cook the resource.");
             break;
         }
     }
 }