Beispiel #1
0
        protected override void Remove()
        {
            ChampionSystem.AllSpawns.Where(s => s.Type == ChampionSpawnType.Khaldun && Region.Find(s.Location, s.Map).IsPartOf("Khaldun")).IterateReverse(s =>
            {
                s.Delete();
            });

            if (ChestSpawner.InstanceFel != null)
            {
                if (ChestSpawner.InstanceFel.Chests != null)
                {
                    ColUtility.SafeDelete(ChestSpawner.InstanceFel.Chests);
                }

                ChestSpawner.InstanceFel = null;
            }

            if (ChestSpawner.InstanceTram != null)
            {
                if (ChestSpawner.InstanceTram.Chests != null)
                {
                    ColUtility.SafeDelete(ChestSpawner.InstanceTram.Chests);
                }

                ChestSpawner.InstanceTram = null;
            }
        }
Beispiel #2
0
        public static void Initialize()
        {
            EventSink.WorldSave += OnWorldSave;

            if (Carey.Instance != null)
            {
                Carey.Instance.MoveToWorld(Carey.SpawnLocation, Map.Malas);
            }

            if (Elizabeth.Instance != null)
            {
                Elizabeth.Instance.MoveToWorld(Elizabeth.SpawnLocation, Map.Malas);
            }

            if (PointsSystem.TreasuresOfDoom.Enabled)
            {
                if (VaseSpawner.Instance == null)
                {
                    VaseSpawner.Instance = new VaseSpawner();
                }

                VaseSpawner.Instance.CheckVases();
            }
            else if (VaseSpawner.Instance != null)
            {
                if (VaseSpawner.Instance.Vases != null)
                {
                    ColUtility.SafeDelete(VaseSpawner.Instance.Vases);
                }

                VaseSpawner.Instance = null;
            }
        }
Beispiel #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            reader.ReadInt(); // version

            Tiles = reader.ReadStrongItemList <PuzzleTile>();

            if (Core.SA)
            {
                Instance = this;

                foreach (var tile in Tiles)
                {
                    tile.Puzzle = this;
                }

                RegisterRegion();
                DoSequence();
            }
            else
            {
                ColUtility.SafeDelete(Tiles);
                ColUtility.Free(Tiles);

                Delete();
            }
        }
Beispiel #4
0
        public static void Initialize()
        {
            if (Carey.Instance != null)
            {
                Carey.Instance.MoveToWorld(Carey.SpawnLocation, Map.Malas);
            }

            if (Elizabeth.Instance != null)
            {
                Elizabeth.Instance.MoveToWorld(Elizabeth.SpawnLocation, Map.Malas);
            }

            if (Instance.Running)
            {
                if (VaseSpawner.Instance == null)
                {
                    VaseSpawner.Instance = new VaseSpawner();
                }

                VaseSpawner.Instance.CheckVases();
            }
            else if (VaseSpawner.Instance != null)
            {
                if (VaseSpawner.Instance.Vases != null)
                {
                    ColUtility.SafeDelete(VaseSpawner.Instance.Vases);
                }

                VaseSpawner.Instance = null;
            }
        }
Beispiel #5
0
        public void DeleteItems()
        {
            ColUtility.SafeDelete(Items, item => item is ClonedItem || item is BaseWeapon);

            if (Backpack != null)
            {
                ColUtility.SafeDelete(Backpack.Items, item => item is ClonedItem || item is BaseWeapon);
            }
        }
Beispiel #6
0
        public static void Initialize()
        {
            if (Core.EJ)
            {
                EventSink.WorldSave += OnWorldSave;

                if (!Siege.SiegeShard)
                {
                    KhaldunCampRegion.InstanceTram = new KhaldunCampRegion(Map.Trammel);
                }

                KhaldunCampRegion.InstanceFel = new KhaldunCampRegion(Map.Felucca);

                if (PointsSystem.Khaldun.Enabled)
                {
                    if (ChestSpawner.InstanceFel == null)
                    {
                        ChestSpawner.InstanceFel = new ChestSpawner();
                    }

                    ChestSpawner.InstanceFel.CheckChests();

                    if (!Siege.SiegeShard)
                    {
                        if (ChestSpawner.InstanceTram == null)
                        {
                            ChestSpawner.InstanceTram = new ChestSpawner();
                        }

                        ChestSpawner.InstanceTram.CheckChests();
                    }
                }
                else
                {
                    if (ChestSpawner.InstanceFel != null)
                    {
                        if (ChestSpawner.InstanceFel.Chests != null)
                        {
                            ColUtility.SafeDelete(ChestSpawner.InstanceFel.Chests);
                        }

                        ChestSpawner.InstanceFel = null;
                    }

                    if (ChestSpawner.InstanceTram != null)
                    {
                        if (ChestSpawner.InstanceTram.Chests != null)
                        {
                            ColUtility.SafeDelete(ChestSpawner.InstanceTram.Chests);
                        }

                        ChestSpawner.InstanceTram = null;
                    }
                }
            }
        }
Beispiel #7
0
        public virtual void OnPeerlessDeath()
        {
            SendMessage(1072681); // The master of this realm has been slain! You may only stay here so long.

            StopSlayTimer();

            // delete master keys
            ColUtility.SafeDelete(MasterKeys);

            ColUtility.Free(MasterKeys);
            m_DeadlineTimer = Timer.DelayCall(DelayAfterBossSlain, FinishSequence);
        }
Beispiel #8
0
        public static void Initialize()
        {
            if (!Siege.SiegeShard)
            {
                KhaldunCampRegion.InstanceTram = new KhaldunCampRegion(Map.Trammel);
            }

            KhaldunCampRegion.InstanceFel = new KhaldunCampRegion(Map.Felucca);

            if (Instance != null && Instance.Running)
            {
                if (ChestSpawner.InstanceFel == null)
                {
                    ChestSpawner.InstanceFel = new ChestSpawner();
                }

                ChestSpawner.InstanceFel.CheckChests();

                if (!Siege.SiegeShard)
                {
                    if (ChestSpawner.InstanceTram == null)
                    {
                        ChestSpawner.InstanceTram = new ChestSpawner();
                    }

                    ChestSpawner.InstanceTram.CheckChests();
                }
            }
            else
            {
                if (ChestSpawner.InstanceFel != null)
                {
                    if (ChestSpawner.InstanceFel.Chests != null)
                    {
                        ColUtility.SafeDelete(ChestSpawner.InstanceFel.Chests);
                    }

                    ChestSpawner.InstanceFel = null;
                }

                if (ChestSpawner.InstanceTram != null)
                {
                    if (ChestSpawner.InstanceTram.Chests != null)
                    {
                        ColUtility.SafeDelete(ChestSpawner.InstanceTram.Chests);
                    }

                    ChestSpawner.InstanceTram = null;
                }
            }
        }
Beispiel #9
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            if (version == 0)
            {
                Timer.DelayCall(() =>
                {
                    ColUtility.SafeDelete(Backpack.Items, null);
                });
            }

            Timer.DelayCall(TimeSpan.FromSeconds(5), StockInventory);
        }
Beispiel #10
0
        public static void Remove()
        {
            if (Carey.Instance != null)
            {
                Carey.Instance.Delete();
            }

            if (VaseSpawner.Instance != null)
            {
                if (VaseSpawner.Instance.Vases != null)
                {
                    ColUtility.SafeDelete(VaseSpawner.Instance.Vases);
                }

                VaseSpawner.Instance = null;
            }
        }
Beispiel #11
0
        protected override void Remove()
        {
            if (Carey.Instance != null)
            {
                Carey.Instance.Delete();
            }

            if (VaseSpawner.Instance != null)
            {
                if (VaseSpawner.Instance.Vases != null)
                {
                    ColUtility.SafeDelete(VaseSpawner.Instance.Vases);
                }

                VaseSpawner.Instance = null;
            }
        }
Beispiel #12
0
        public override void Delete()
        {
            base.Delete();

            if (IsKrampusEncounter)
            {
                KrampusEvent.Instance.OnKrampusKilled();
            }

            if (SummonedHelpers != null)
            {
                ColUtility.SafeDelete(SummonedHelpers);
                ColUtility.Free(SummonedHelpers);
            }

            if (InitialSpawn != null)
            {
                ColUtility.SafeDelete(InitialSpawn);
                ColUtility.Free(InitialSpawn);
            }
        }
Beispiel #13
0
        private void DoRestock(bool wipe)
        {
            int count;

            if (Backpack == null)
            {
                var pack = new BuyBackpack();

                AddItem(pack);
            }

            if (wipe)
            {
                count = ItemCount;
                ColUtility.SafeDelete(Backpack.Items);
            }
            else
            {
                count = ItemCount - Backpack.Items.Count;
            }

            if (count > 0)
            {
                for (var i = 0; i < count; i++)
                {
                    Item item;

                    switch (Utility.Random(3))
                    {
                    default:
                    case 0: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(false, false, true); break;

                    case 1: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(false, true, false); break;

                    case 2: item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(true, false, false); break;
                    }

                    var  failSafe = 0;
                    bool success  = true;

                    do
                    {
                        RunicReforging.GenerateRandomItem(item, null, Utility.RandomMinMax(MinBudget, MaxBudget), 0, ReforgedPrefix.None, ReforgedSuffix.None);

                        if (++failSafe == 25 && Imbuing.GetTotalWeight(item, -1, false, true) == 0)
                        {
                            item.Delete();
                            success = false;
                            i--;
                            break;
                        }
                    }while (Imbuing.GetTotalWeight(item, -1, false, true) == 0);

                    if (success)
                    {
                        item.Movable = false;
                        PackItem(item);
                    }
                }
            }
        }
Beispiel #14
0
        internal void ClearVault()
        {
            if (_Container != null)
            {
                var auctionVault = AuctionVault.GetFirstAvailable();

                if (auctionVault != null)
                {
                    var auction = auctionVault.Auction;

                    auction.AuctionItem = _Container;

                    _Container.AuctionItem = true;
                    _Container.Movable     = false;
                    _Container.MoveToWorld(new Point3D(auctionVault.X, auctionVault.Y, auctionVault.Z + 7), auctionVault.Map);

                    auction.Description = "Contents of an unpaid vault.";
                    auction.Duration    = SystemSettings.AuctionDuration;
                    auction.StartBid    = 1000;
                    auction.OnBegin();

                    var m = GetAccountMobile();

                    if (m != null)
                    {
                        var region = Region.Find(GetWorldLocation(), Map).Name;

                        if (!string.IsNullOrEmpty(region))
                        {
                            MaginciaLottoSystem.SendMessageTo(
                                m,
                                new NewMaginciaMessage(
                                    1158081, // Rent Past Due
                                    1158053, // Your vault contents have been put up for auction and no longer can be claimed. This vault was located in ~1_CITY~.
                                    SystemSettings.PastDuePeriod,
                                    region,
                                    true));
                        }
                        else
                        {
                            MaginciaLottoSystem.SendMessageTo(
                                m,
                                new NewMaginciaMessage(
                                    1158081, // Rent Past Due
                                    string.Format("Your vault contents have been put up for auction and no longer can be claimed. This vault is located at {0} [{1}].", GetWorldLocation().ToString(), Map.ToString()),
                                    SystemSettings.PastDuePeriod,
                                    true));
                        }
                    }

                    _Container = null;
                }
                else
                {
                    // None available, so we'll delay a day
                    NextRent = DateTime.UtcNow + TimeSpan.FromDays(1);
                }
            }

            Account  = null;
            NextRent = DateTime.MinValue;

            ColUtility.SafeDelete(Items);

            InvalidateProperties();
            Hue     = 0;
            Balance = 0;
            PastDue = false;
        }