protected override void Init()
        {
            Mobs.Clear();
            Drops.Clear();
            bStarted = false;
            bChaos   = MapId % 2 == 1;
            int nTimeLeftSec;

            switch (MapId)
            {
            case 240060000:                     // normal
                nTimeLeftSec = 60 * 60;         // 1 hour
                break;

            case 240060001:                     // chaos
                nTimeLeftSec = 120 * 60;        // 2 hours
                break;

            default:
                nTimeLeftSec = (int)ParentInstance.CFieldMan
                               .GetField(MapId - 100, nInstanceID)
                               .tFieldTimerExpiration
                               .SecondsUntilEnd() + 2;
                if (nTimeLeftSec < 0)
                {
                    nTimeLeftSec = 0;
                }

                break;
            }
            CreateFieldClock(nTimeLeftSec);

            base.Init();             // doesnt currently do anything but might in the future
        }
示例#2
0
        protected override void OnClockEnd()
        {
            base.OnClockEnd();

            if (WarpToNextField)
            {
                WarpMap(NextFieldID(), nInstanceID, (byte)NextPortalID(), 0);
            }
            else
            {
                if (!bLost)                 // show animation, reset timer for warpout
                {
                    BroadcastWZMapEffect(TIMEOUT_EFFECT);

                    tFieldTimerExpiration = DateTime.Now.AddSeconds(4);                     // invisible timer
                    Mobs.Clear();
                    bLost = true;
                }
                else                                // warp out
                {
                    GiveRewards();                  // rewards are also distributed in OnMobDie() in all cases except timer expiring
                    WarpMap(WarpOutField, 0, 0, 0); // TODO portal & FH IDs
                    Reset();
                }
            }
        }
示例#3
0
 protected void SoftReset()
 {
     WarpToNextField = false;
     bStarted        = false;
     bLost           = false;
     StageExp        = 0;
     CumulativeExp   = 0;
     MobKills.Clear();
     Mobs.aMobGen.Clear();             // clear default spawns so we can add our own
     Mobs.Clear();
     Npcs.Clear();
 }
示例#4
0
        public static void Initialize()
        {
            using (Database.TemporarySchema(Database.SchemaMCDB))
            {
                IsInitialized = false;

                Styles?.Skins.Clear();
                Styles?.MaleHairs.Clear();
                Styles?.MaleFaces.Clear();
                Styles?.FemaleHairs.Clear();
                Styles?.FemaleFaces.Clear();

                Items?.Clear();

                Skills?.Clear();

                Mobs?.Clear();

                Maps?.Clear();

                Quests?.Clear();

                Database.Test();

                Stopwatch sw = new Stopwatch();

                sw.Start();

                Log.Inform("Loading data...");

                Styles       = new AvailableStyles();
                Items        = new CachedItems();
                Skills       = new CachedSkills();
                Mobs         = new CachedMobs();
                Reactors     = new CachedReactors();
                Quests       = new CachedQuests();
                CreationData = new CreationData();
                Maps         = new CachedMaps();

                CommandFactory.Initialize();

                sw.Stop();

                Log.SkipLine();
                Log.Success("Maple data loaded in {0}ms.", sw.ElapsedMilliseconds);
                Log.SkipLine();

                IsInitialized = true;
            }
        }
示例#5
0
 public void RemoveMobs()
 {
     foreach (Mobile target in Mobs.ToArray())
     {
         target.Delete();
     }
     if (Boss != null)
     {
         Boss.Delete();
     }
     if (Anim1 != null)
     {
         Anim1.Delete();
     }
     if (Anim2 != null)
     {
         Anim2.Delete();
     }
     Mobs.Clear();
     Mobs.TrimExcess();
 }