private static void ReturnPets(Mobile m, UndressedPlayer ud) { foreach (BaseCreature pet in ud.PetList) { pet.SetControlMaster(m); if (pet.Summoned) pet.SummonMaster = m; pet.ControlTarget = m; pet.ControlOrder = OrderType.Follow; pet.MoveToWorld(m.Location, m.Map); pet.IsStabled = false; m.Stabled.Remove(pet); } m.SendMessage("Your pets have been returned to you."); }
private static void StablePets(Mobile m, UndressedPlayer ud) { if (m.Mount != null) m.Mount.Rider = null; if (m.Followers > 0) { int nonstabled = 0; List<BaseCreature> stable = new List<BaseCreature>(); List<BaseCreature> delete = new List<BaseCreature>(); foreach (Mobile i in m.GetMobilesInRange(20)) { if (i is BaseCreature) { BaseCreature pet = (BaseCreature)i; if (pet.Summoned && pet.SummonMaster == m) delete.Add(pet); else if (pet.Controlled && pet.ControlMaster == m) stable.Add(pet); } } foreach (Mobile pet in delete) pet.Delete(); int max = AnimalTrainer.GetMaxStabled(m); foreach (BaseCreature pet in stable) { if (m.Stabled.Count >= max && ud == null) { pet.MoveToWorld(m_PetRemLoc, Map.Felucca); nonstabled++; } else { if (ud != null) ud.PetList.Add(pet); pet.ControlTarget = null; pet.ControlOrder = OrderType.Stay; pet.Internalize(); pet.SetControlMaster(null); pet.SummonMaster = null; pet.IsStabled = true; m.Stabled.Add(pet); } } if (nonstabled > 0) m.SendMessage("While trying to stable your pets, you reached your maximum stable capacity. {0} Pets have been moved to Britain Bank.", nonstabled); else m.SendMessage("Your pets have been stabled."); } }
public static bool Undress(Mobile m, Predicate<Item> pred) { if (!m.Alive) { m.Resurrect(); m.Hits = m.HitsMax; } if (m.Backpack != null) { Bag bag; UndressedPlayer ud; if (!m_UndressedDictionary.TryGetValue(m, out ud)) { bag = new Bag(); m.BankBox.DropItem(bag); ud = new UndressedPlayer(bag); m_UndressedDictionary[m] = ud; } else return false; if (m.Holding != null) m.Backpack.DropItem(m.Holding); StablePets(m, ud); for (int i = m.Items.Count - 1; i >= 0; --i) { Item item = (Item)m.Items[i]; if (Array.BinarySearch(m_ExcludedLayers, item.Layer) < 0) { if (pred == null || pred(item)) { ud.WornList.Add(item); bag.DropItem(item); } } } for (int i = m.Backpack.Items.Count; i > 0; i--) { Item item = m.Backpack.Items[i - 1]; if (pred == null || pred(item)) { ud.BackPackList.Add(item); bag.DropItem(item); } } return true; } else { m.SendMessage("Unfortunately we could not undress you, as you have no backpack, please contact the staff."); return false; } }