Exemplo n.º 1
0
 private TextDefinition RequiredExpansionMessage(Expansion expansion)
 {
     return(expansion switch
     {
         Expansion.SE => (TextDefinition)1063363, // * Requires the "Samurai Empire" expansion
         Expansion.ML => (TextDefinition)1072651, // * Requires the "Mondain's Legacy" expansion
         _ => (TextDefinition)$"* Requires the \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion"
     });
Exemplo n.º 2
0
 public bool CheckValidity(int val)
 {
     if (val == -1)
     {
         return(false);
     }
     //Taran: Allow SA tiles
     return(val == 0 || (ExpansionInfo.GetInfo(Expansion.SA).CustomHousingFlag & val) != 0);               //(ExpansionInfo.CurrentExpansion.CustomHousingFlag & val) != 0 );
 }
Exemplo n.º 3
0
 //Eventually convert to TextDefinition, but that requires that we convert all the gumps to ues it too.  Not that it wouldn't be a bad idea.
 private object RequiredExpansionMessage(Expansion expansion)
 {
     return(expansion switch
     {
         Expansion.SE => 1063307 // The "Samurai Empire" expansion is required to attempt this item.
         ,
         Expansion.ML => 1072650 // The "Mondain's Legacy" expansion is required to attempt this item.
         ,
         _ => $"The \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion is required to attempt this item."
     });
Exemplo n.º 4
0
        private TextDefinition RequiredExpansionMessage(Expansion expansion)
        {
            switch (expansion)
            {
            case Expansion.SE:
                return(1063363);                        // * Requires the "Samurai Empire" expansion

            case Expansion.ML:
                return(1072651);                        // * Requires the "Mondain's Legacy" expansion

            default:
                return(String.Format("* Requires the \"{0}\" expansion", ExpansionInfo.GetInfo(expansion).Name));
            }
        }
Exemplo n.º 5
0
		private object RequiredExpansionMessage(Expansion expansion)
			//Eventually convert to TextDefinition, but that requires that we convert all the gumps to ues it too.  Not that it wouldn't be a bad idea.
		{
			switch (expansion)
			{
				case Expansion.SE:
					return 1063307; // The "Samurai Empire" expansion is required to attempt this item.
				case Expansion.ML:
					return 1072650; // The "Mondain's Legacy" expansion is required to attempt this item.
				default:
					return String.Format(
						"The \"{0}\" expansion is required to attempt this item.", ExpansionInfo.GetInfo(expansion).Name);
			}
		}
Exemplo n.º 6
0
        public void TestMobileStatusExtendedSelf(
            ProtocolChanges changes,
            string version,
            ClientFlags clientFlags,
            Expansion expansion,
            int mobileStatusVersion
            )
        {
            var expansionInfo = ExpansionInfo.GetInfo(Core.Expansion);
            var oldExpansion  = Core.Expansion;
            var oldVersion    = expansionInfo.MobileStatusVersion;

            Core.Expansion = expansion;
            ExpansionInfo.GetInfo(Core.Expansion).MobileStatusVersion = mobileStatusVersion;

            var m = new Mobile((Serial)0x1)
            {
                Name = "Random Mobile 1"
            };

            m.DefaultMobileInit();
            m.Str  = 50;
            m.Hits = 100;
            m.Int  = 75;
            m.Mana = 100;
            m.Dex  = 25;
            m.Stam = 100;

            var ns = PacketTestUtilities.CreateTestNetState();

            ns.ProtocolChanges = changes;
            ns.Version         = new ClientVersion(version);
            ns.Flags           = clientFlags;

            var expected = new MobileStatusExtended(m, ns).Compile();

            ns.SendMobileStatus(m, m);

            var result = ns.SendPipe.Reader.TryRead();

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
            Core.Expansion = oldExpansion;
            expansionInfo.MobileStatusVersion = oldVersion;
        }
Exemplo n.º 7
0
        private TextDefinition RequiredExpansionMessage(Expansion expansion)
        {
            switch (expansion)
            {
            case Expansion.SE:
                return(1063363);    // * Requires the "Samurai Empire" expansion

            case Expansion.ML:
                return(1072651);    // * Requires the "Mondain's Legacy" expansion

            case Expansion.SA:
                return(1094732);    // * Requires the "Stygian Abyss" expansion

            case Expansion.HS:
                return(1116296);    // * Requires the "High Seas" booster

            case Expansion.TOL:
                return(1155876);    // * Requires the "Time of Legends" expansion.

            default:
                return(String.Format("* Requires the \"{0}\" expansion", ExpansionInfo.GetInfo(expansion).Name));
            }
        }
Exemplo n.º 8
0
 public bool SupportsExpansion(Expansion ex, bool checkCoreExpansion)
 {
     return(SupportsExpansion(ExpansionInfo.GetInfo(ex), checkCoreExpansion));
 }
Exemplo n.º 9
0
        public void TestCharacterListOld()
        {
            var firstMobile = new Mobile(0x1);

            firstMobile.DefaultMobileInit();
            firstMobile.Name = "Test Mobile";

            var account = new TestAccount(new[] { firstMobile, null, null, null, null });
            var info    = new[]
            {
                new CityInfo("Test City", "Test Building", 50, 100, 10, -10)
            };

            var data = new CharacterListOld(account, info).Compile();

            Span <byte> expectedData = stackalloc byte[9 + account.Length * 60 + info.Length * 63];

            var pos = 0;

            expectedData.Write(ref pos, (byte)0xA9);                  // Packet ID
            expectedData.Write(ref pos, (ushort)expectedData.Length); // Length

            var highSlot = -1;

            for (var i = account.Length - 1; i >= 0; i--)
            {
                if (account[i] != null)
                {
                    highSlot = i;
                    break;
                }
            }

            var count = Math.Max(Math.Max(highSlot + 1, account.Limit), 5);

            expectedData.Write(ref pos, (byte)count);

            for (var i = 0; i < count; i++)
            {
                var m = account[i];
                if (m != null)
                {
                    expectedData.WriteAsciiFixed(ref pos, m.Name, 30);
#if NO_LOCAL_INIT
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, 0);
                    expectedData.Write(ref pos, (ushort)0);
#else
                    pos += 30;
#endif
                }
                else
                {
#if NO_LOCAL_INIT
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, (ulong)0);
                    expectedData.Write(ref pos, 0);
#else
                    pos += 60;
#endif
                }
            }

            expectedData.Write(ref pos, (byte)info.Length);

            for (var i = 0; i < info.Length; i++)
            {
                var ci = info[i];
                expectedData.Write(ref pos, (byte)i);
                expectedData.WriteAsciiFixed(ref pos, ci.City, 31);
                expectedData.WriteAsciiFixed(ref pos, ci.Building, 31);
            }

            var flags = ExpansionInfo.GetInfo(Expansion.EJ).CharacterListFlags;
            if (count > 6)
            {
                flags |= CharacterListFlags.SeventhCharacterSlot |
                         CharacterListFlags.SixthCharacterSlot; // 7th Character Slot
            }
            else if (count == 6)
            {
                flags |= CharacterListFlags.SixthCharacterSlot; // 6th Character Slot
            }
            else if (account.Limit == 1)
            {
                flags |= CharacterListFlags.SlotLimit &
                         CharacterListFlags.OneCharacterSlot; // Limit Characters & One Character
            }

            expectedData.Write(ref pos, (int)flags);

            AssertThat.Equal(data, expectedData);
        }
Exemplo n.º 10
0
 public bool SupportsExpansion(Expansion ex)
 {
     return(SupportsExpansion(ExpansionInfo.GetInfo(ex)));
 }
Exemplo n.º 11
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.");
        }