protected override void OnTick() { foreach (Item ps in m_Owner.GetItemsInRange(m_Owner.Hue)) { if (ps != null && ps is XmlSpawner) { XmlSpawner sp = (XmlSpawner)ps; if (ps.Hue == 10) { sp.Running = true; } } } if (m_Owner.Weight == 1.0) { Orc orc = new Orc(); orc.MoveToWorld(m_Owner.Location, m_Owner.Map); orc.Hidden = true; Regions.GuardedRegion reg = (Regions.GuardedRegion)orc.Region.GetRegion(typeof(Regions.GuardedRegion)); if (reg != null && reg.Disabled) { reg.Disabled = false; } orc.Delete(); } StopTimer(m_Owner); m_Owner.Delete(); }
public static void Cleanup(Item spot) { ArrayList clean = new ArrayList(); foreach (Item item in spot.GetItemsInRange(0)) { if (!(item is WorkingSpots) && item.Location == spot.Location) { clean.Add(item); } } foreach (Mobile mobile in spot.GetMobilesInRange(0)) { if (mobile.Location == spot.Location && ( mobile is SpellCritter || mobile is TradesmanAlchemist || mobile is TradesmanLeather || mobile is TradesmanLogger || mobile is TradesmanLumber || mobile is TradesmanMiner || mobile is TradesmanSmelter || mobile is TradesmanSmith || mobile is TrainingBow || mobile is TrainingFishing || mobile is TrainingMagery || mobile is TrainingSingle || mobile is Warriors)) { clean.Add(mobile); } } for (int i = 0; i < clean.Count; ++i) { if (clean[i] is Item) { ((Item)clean[i]).Delete(); } else if (clean[i] is Mobile) { ((Mobile)clean[i]).Delete(); } } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { Item i = (Item)targeted; bool isGrave = false; foreach (int check in m_Grave) { if (check == i.ItemID) { isGrave = true; } } if (isGrave == true) { bool isNearPumpkins = false; foreach (Item item in i.GetItemsInRange(2)) { if (item is PumpkinheadGraveAddon) { isNearPumpkins = true; } } if (isNearPumpkins == true) { if (m_From != null) { m_From.SendMessage("You start to dig."); } DigTimer dt = new DigTimer(m_From, m_Item, TimeSpan.FromSeconds(5.0)); dt.Start(); m_From.PlaySound(Utility.RandomList(0x125, 0x126)); m_From.Animate(11, 5, 1, true, false, 0); m_Item.IsDigging = true; } else { if (m_From != null) { m_From.SendMessage("That is not Pumpkinhead's grave."); } } } else { if (m_From != null) { m_From.SendMessage("That is not a grave."); } } } else if (targeted is StaticTarget) { StaticTarget i = (StaticTarget)targeted; bool isGrave = false; foreach (int check in m_Grave) { if (check == i.ItemID) { isGrave = true; } } if (isGrave == true) { bool isNearPumpkins = false; foreach (Item item in m_From.GetItemsInRange(2)) { if (item is PumpkinheadGraveAddon) { isNearPumpkins = true; } } if (isNearPumpkins == true) { if (m_From != null) { m_From.SendMessage("You start to dig."); } DigTimer dt = new DigTimer(m_From, m_Item, TimeSpan.FromSeconds(10.0)); dt.Start(); m_From.PlaySound(Utility.RandomList(0x125, 0x126)); m_From.Animate(11, 5, 1, true, false, 0); m_Item.IsDigging = true; } else { if (m_From != null) { m_From.SendMessage("That is not Pumpkinhead's grave."); } } } else { if (m_From != null) { m_From.SendMessage("That is not a grave."); } } } else { m_From.SendMessage("That is not a grave."); } }
public static void Add(Mobile citizen, Item spots, int range) { bool hasCitizen = false; ArrayList items = new ArrayList(); foreach (Item item in spots.GetItemsInRange(range)) { if (item is WorkingSpots && item != spots) { hasCitizen = true; items.Add(item); } } for (int i = 0; i < items.Count; ++i) { if (hasCitizen) { Item spot = ( Item )items[i]; if (spot.Name == "anvil" && (citizen is TradesmanSmelter || citizen is TradesmanSmith)) { Item item = new AnvilHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0; } else if (spot.Name == "dummy" && citizen is TrainingSingle) { Item item = new TrainingDummy(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0; } else if (spot.Name == "forge" && (citizen is TradesmanSmelter || citizen is TradesmanSmith)) { Item item = new ForgeHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0; } else if (spot.Name == "hidden anvil" && (citizen is TradesmanSmelter || citizen is TradesmanSmith)) { Item item = new AnvilHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0; } else if (spot.Name == "hidden forge" && (citizen is TradesmanSmelter || citizen is TradesmanSmith)) { Item item = new ForgeHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0; } else if (spot.Name == "hidden hide" && citizen is TradesmanLeather) { Item item = new LeatherHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0; } else if (spot.Name == "hide" && citizen is TradesmanLeather) { Item item = new LeatherHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0; } else if (spot.Name == "pentagram" && citizen is TrainingMagery) { Item item = new MagicHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.OnAfterSpawn(); item.Weight = -2.0; } else if (spot.Name == "potion" && citizen is TradesmanAlchemist) { Item item = new CauldronHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0; } else if (spot.Name == "rock" && citizen is TradesmanMiner) { Item item = new RockHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0; } else if (spot.Name == "saw" && citizen is TradesmanLumber) { Item item = new SawHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0; } else if (spot.Name == "target" && citizen is TrainingBow) { Item item = new ArcheryButte(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0; } else if (spot.Name == "tree" && citizen is TradesmanLogger) { Item item = new TreeHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0; } else if (spot.Name == "water" && citizen is TrainingFishing) { Item item = new WaterHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0; } else if (spot.Name == "knight" && citizen is Warriors) { Mobile knight = new Warriors(); knight.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)knight).Home = spot.Location; ((BaseCreature)knight).RangeHome = 0; knight.OnAfterSpawn(); } } } //if ( !hasCitizen && spots.Name != "fighter" && spots.Name != "archer" ){ Console.WriteLine("" + spots.Name + " " + spots.X + ", " + spots.Y + ""); } }