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(); } } }
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(); } } }