protected override void OnTick() { if (m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime) { Stop(); m_From.EndAction(typeof(TreasureMap)); m_Chest.Delete(); } else if (m_LastMoveTime != m_From.LastMoveTime) { m_From.SendLocalizedMessage(503023); // You cannot move around while digging up treasure. You will need to start digging anew. Stop(); m_From.EndAction(typeof(TreasureMap)); m_Chest.Delete(); } /*else if ( !m_Map.CanFit( m_Chest.X, m_Chest.Y, m_Z, 16, true, true ) ) * { * m_From.SendLocalizedMessage( 503024 ); // You stop digging because something is directly on top of the treasure chest. * * Stop(); * m_From.EndAction( typeof( TreasureMap ) ); * m_Chest.Delete(); * }*/ else { m_From.RevealingAction(); m_Count++; m_Chest.Location = new Point3D(m_Chest.Location.X, m_Chest.Location.Y, m_Chest.Location.Z + 1); m_From.Direction = m_From.GetDirectionTo(m_Chest.GetWorldLocation()); if (m_Count == 14) { Stop(); m_From.EndAction(typeof(TreasureMap)); m_TreasureMap.Completed = true; // checks to see if the map is a themed map and if so gets the theme type based on level of map // and sends appropriate theme message/warning // checks to see if the map is a themed map and already has a theme set // and sends appropriate theme message/warning if (themed == true && type != ChestThemeType.None) { m_From.SendMessage(TreasureTheme.GetThemeMessage(type)); } if (m_TreasureMap.Level >= 2) { //generates 1 of the highest mobs for pirate or undead iob chests TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, true); //generates guardian spawn numbers based on if themed or not for (int i = 0; i < TreasureTheme.GetGuardianSpawn(themed, type); ++i) { if (type == ChestThemeType.Undead || type == ChestThemeType.Pirate) { //spawns rest of pirate or undead initial guardian spawn with out highest rank mobs appereing TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, false); } else { //not pirate or undead chest spawn as per normal random guardians TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, false, false); } } // 25% chance to spawn a a tax collector on a regular chest, 100% on themed chests if (m_TreasureMap.Level > 3 && (Utility.RandomChance(25) || themed == true)) { TaxCollector tc = new TaxCollector(m_Chest); Point3D px = Spawner.GetSpawnPosition(m_Chest.Map, m_Chest.Location, 25, false, true, Spawner.SpawnFlags.SpawnFar, tc); if (px != m_Chest.Location) { // got a good location tc.MoveToWorld(px, m_Chest.Map); } // if we get a tax collector, add a chance to get an additional rare. The chance is calc in the rare drop code // this chest 'hides' another treasure m_Chest.SetFlag(TreasureMapChest.iFlags.Hides, true); } } } else { if (m_From.Body.IsHuman && !m_From.Mounted) { m_From.Animate(11, 5, 1, true, false, 0); } new SoundTimer(m_From, 0x125 + (m_Count % 2)).Start(); } } }
protected override void OnTick() { if (m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime) { Stop(); m_From.EndAction(typeof(TreasureMap)); m_Chest.Delete(); } else if (m_LastMoveTime != m_From.LastMoveTime) { m_From.SendLocalizedMessage(503023); // You cannot move around while digging up treasure. You will need to start digging anew. Stop(); m_From.EndAction(typeof(TreasureMap)); m_Chest.Delete(); } /*else if ( !m_Map.CanFit( m_Chest.X, m_Chest.Y, m_Z, 16, true, true ) ) * { * m_From.SendLocalizedMessage( 503024 ); // You stop digging because something is directly on top of the treasure chest. * * Stop(); * m_From.EndAction( typeof( TreasureMap ) ); * m_Chest.Delete(); * }*/ else { m_From.RevealingAction(); m_Count++; m_Chest.Location = new Point3D(m_Chest.Location.X, m_Chest.Location.Y, m_Chest.Location.Z + 1); m_From.Direction = m_From.GetDirectionTo(m_Chest.GetWorldLocation()); if (m_Count == 14) { Stop(); m_From.EndAction(typeof(TreasureMap)); m_TreasureMap.Completed = true; // checks to see if the map is a themed map and if so gets the theme type based on level of map // and sends appropriate theme message/warning // checks to see if the map is a themed map and already has a theme set // and sends appropriate theme message/warning if (themed == true && type != ChestThemeType.None) { m_From.SendMessage(TreasureTheme.GetThemeMessage(type)); } if (m_TreasureMap.Level >= 2) { //generates 1 of the highest mobs for pirate or undead iob chests TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, true); //generates guardian spawn numbers based on if themed or not for (int i = 0; i < TreasureTheme.GetGuardianSpawn(themed, type); ++i) { if (type == ChestThemeType.Undead || type == ChestThemeType.Pirate) { //spawns rest of pirate or undead initial guardian spawn with out highest rank mobs appereing TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, false); } else { //not pirate or undead chest spawn as per normal random guardians TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, false, false); } } } } else { if (m_From.Body.IsHuman && !m_From.Mounted) { m_From.Animate(11, 5, 1, true, false, 0); } new SoundTimer(m_From, 0x125 + (m_Count % 2)).Start(); } } }
public override void OnItemLifted(Mobile from, Item item) { bool notYetLifted = !m_Lifted.Contains(item); from.RevealingAction(); // prevent the player from milking the chest by removing 'one from a stack' if (notYetLifted) { ArrayList tx = new ArrayList(FindItemsByType(item.GetType(), true)); tx.Remove(item); if (tx.Count > 0) { foreach (Item ix in tx) { if (ix.Amount > 1) { // player looks to be removing one from a stack // disqualify the one they lifted m_Lifted.Add(item); notYetLifted = false; break; } } // if they lifted >= 1, and left 1 disqualify the one they lifted if (notYetLifted) { if (item.Amount > 1) { m_Lifted.Add(item); notYetLifted = false; } } } } if (notYetLifted) { m_Lifted.Add(item); double chance = 0.1 * (Level * .5); if (IsThemed == true && 0.1 >= Utility.RandomDouble()) { // 10% chance to spawn 2 monsters as is a Themed chest TreasureTheme.Spawn(m_Level, GetWorldLocation(), Map, from, IsThemed, m_type, false, false); TreasureTheme.Spawn(m_Level, GetWorldLocation(), Map, from, IsThemed, m_type, false, false); } else if (IsThemed == false && chance >= Utility.RandomDouble()) { TreasureTheme.Spawn(m_Level, GetWorldLocation(), Map, from, IsThemed, m_type, false, false); } // Adam: Insure IOB wearers are not stealing from their kin BaseCreature witness = null; if (CheckThief(from, out witness)) { from.SendMessage("You have been discovered stealing from your kin!"); if (from.Hidden) { from.RevealingAction(); } // attack kin to make them come after you from.DoHarmful(witness); } } base.OnItemLifted(from, item); }