protected override void OnTick() { m_From.EndAction(typeof(CookableFood)); if (m_From.Map != m_Map || (m_Point != null && m_From.GetDistanceToSqrt(m_Point) > 3)) { m_From.SendLocalizedMessage(500686); // You burn the food to a crisp! It's ruined. return; } if (m_From.CheckSkill(SkillName.Cooking, m_CookableFood.CookingLevel, 100)) { Food cookedFood = m_CookableFood.Cook(); if (m_From.AddToBackpack(cookedFood)) { m_From.PlaySound(0x57); } } else { m_From.PlaySound(0x57); m_From.SendLocalizedMessage(500686); // You burn the food to a crisp! It's ruined. } }
protected override void OnTick() { m_From.EndAction(typeof(CookableFood)); if (m_From.Map != m_Map || (m_Point != null && m_From.GetDistanceToSqrt(m_Point) > 3)) { m_From.SendAsciiMessage("You burn the food to a crisp! It's ruined."); // You burn the food to a crisp! It's ruined. return; } if (m_From.CheckSkill(SkillName.Cooking, m_CookableFood.CookingLevel, 100)) { Food cookedFood = m_CookableFood.Cook(); if (Utility.RandomBool()) { m_From.SayTo(m_From, true, "Looks delicious."); } else { m_From.SayTo(m_From, true, "Mmmm, smells good."); } m_From.PlaySound(0x57); if (m_From.AddToBackpack(cookedFood)) { m_From.SendAsciiMessage("You put the cooked food into your backpack."); } else { cookedFood.MoveToWorld(m_From.Location, m_From.Map); m_From.SendAsciiMessage("You put the cooked food on the ground."); } } else { m_From.SendAsciiMessage("You burn the food to a crisp! It's ruined."); // You burn the food to a crisp! It's ruined. } }
protected override void OnTick() { //m_From.EndAction( typeof( CookableFood ) ); if (m_From.Map != m_Map || (m_Point != null && m_From.GetDistanceToSqrt(m_Point) > 3)) { m_From.SendLocalizedMessage(500686); // You burn the food to a crisp! It's ruined. if (m_From is PlayerMobile) { ((PlayerMobile)m_From).EndPlayerAction(); } return; } if (m_From.CheckSkill(SkillName.Cooking, m_CookableFood.CookingLevel, 100)) { Food cookedFood = m_CookableFood.Cook(); m_From.SendAsciiMessage("Mmm, smells good"); //Taran: Check to see if player is overweight. If they are and the item drops to the //ground then a check is made to see if more than 20 items of the same type exist in //the same tile. If that's the case the last item gets removed. This check is made so //thousands of items can't exist in 1 tile and crash people in the same area. if (m_From.AddToBackpack(cookedFood)) { m_From.SendAsciiMessage("You put the {0} in your pack.", cookedFood.Name ?? CliLoc.LocToString(cookedFood.LabelNumber)); } else { IPooledEnumerable eable = m_From.Map.GetItemsInRange(m_From.Location, 0); int amount = 0; Item toRemove = null; foreach (Item i in eable) { if (i != cookedFood && i.ItemID == cookedFood.ItemID) { if (i.StackWith(m_From, cookedFood, false)) { toRemove = cookedFood; break; } amount++; } } m_From.SendAsciiMessage("You are overweight and put the {0} on the ground.", cookedFood.Name ?? CliLoc.LocToString(cookedFood.LabelNumber)); if (toRemove != null) { toRemove.Delete(); } else if (amount >= 5 && amount < 20) { m_From.LocalOverheadMessage(MessageType.Regular, 906, true, string.Format("{0} identical items on the ground detected, no more than 20 is allowed!", amount)); } else if (amount >= 20) { m_From.LocalOverheadMessage(MessageType.Regular, 906, true, "Too many identical items on the ground, removing!"); cookedFood.Delete(); } eable.Free(); } } else { m_From.SendLocalizedMessage(500686); // You burn the food to a crisp! It's ruined. } if (m_From is PlayerMobile) { ((PlayerMobile)m_From).EndPlayerAction(); } }