예제 #1
0
        protected override void OnExpansionChanged(Expansion old)
        {
            base.OnExpansionChanged(old);

            if (ExpansionInfo.GetInfo(Expansion).Name != "Third Dawn")
            {
                this.SendNotification <ExpansionNotifyGump>(
                    String.Format(
                        "You are now bound by the rules and physics of the [b]{0}[/b] era!",
                        ExpansionInfo.GetInfo(Expansion).Name),
                    true,
                    1.0,
                    10.0,
                    Color.LawnGreen);
            }
            else
            {
                this.SendNotification <ExpansionNotifyGump>(
                    String.Format(
                        "Welcome to Zombie Land!"),
                    true,
                    1.0,
                    10.0,
                    Color.LawnGreen);
            }

            if (Expansion <= Expansion.T2A && AccessLevel < AccessLevel.Counselor || Expansion == Expansion.UOTD && AccessLevel < AccessLevel.Counselor)
            {
                BaseMount.SetMountPrevention(this, BlockMountType.MapRestricted, TimeSpan.FromDays(365));
            }
            else
            {
                BaseMount.ClearMountPrevention(this);
            }

            if (!Snapshot.Pull(old))
            {
                return;
            }

            var leaveEquip = new List <Item>();

            if (Alive)
            {
                leaveEquip.AddRange(
                    Items.Where(i => i != null && !i.Deleted && i.IsPhased && i != BankBox && i != Backpack));
            }

            foreach (Item item in leaveEquip)
            {
                Backpack.DropItem(item);
            }

            Item holding = Holding;

            if (holding != null)
            {
                if (!holding.Deleted && holding.HeldBy == this && holding.Map == Map.Internal)
                {
                    Backpack.DropItem(holding);
                }

                Holding = null;
                holding.ClearBounce();
            }

            Dictionary <Item, Point3D> takePack = Backpack.FindItemsByType <Item>(true,
                                                                                  i => i != null && !i.Deleted && !i.IsPhased)
                                                  .ToDictionary(i => i, i => i.Location);

            if (!Snapshot.Push(Expansion))
            {
                foreach (Item item in leaveEquip)
                {
                    EquipItem(item);
                }

                return;
            }

            foreach (Item item in leaveEquip)
            {
                Send(item.RemovePacket);
            }

            foreach (KeyValuePair <Item, Point3D> kv in takePack)
            {
                Backpack.DropItem(kv.Key);
                kv.Key.Location = kv.Value;
            }

            UpdateTotals();
            ProcessDelta();

            SendMessage(0x22, "Character snapshots synced successfully.");
        }