diff --git a/Scripts/Accounting/Account.cs b/Scripts/Accounting/Account.cs index f32d3650e..c001dc032 100644 --- a/Scripts/Accounting/Account.cs +++ b/Scripts/Accounting/Account.cs @@ -1114,7 +1114,7 @@ namespace Server.Accounting /// public int Limit { - get { return ( /* Core.SA ? 7 : */ Core.AOS ? 6 : 5 ); } //TODO: complete SA core support and uncomment + get { return ( Core.SA ? 7 : Core.AOS ? 6 : 5 ); } } /// diff --git a/Scripts/Commands/VisibilityList.cs b/Scripts/Commands/VisibilityList.cs index 484f8f9eb..796f9c06b 100644 --- a/Scripts/Commands/VisibilityList.cs +++ b/Scripts/Commands/VisibilityList.cs @@ -120,7 +120,7 @@ namespace Server.Commands if ( ns != null ) { if ( targ.CanSee( from ) ) { - if ( ns.IsPost7000 ) + if ( ns.StygianAbyss ) ns.Send( new MobileIncoming( targ, from ) ); else ns.Send( new MobileIncomingOld( targ, from ) ); diff --git a/Scripts/Gumps/ClientGump.cs b/Scripts/Gumps/ClientGump.cs index 3373d783f..e25b8a101 100644 --- a/Scripts/Gumps/ClientGump.cs +++ b/Scripts/Gumps/ClientGump.cs @@ -219,9 +219,6 @@ namespace Server.Gumps ExpansionInfo info = state.ExpansionInfo; string expansionName = info.Name; - if ( info.ID == (int)Expansion.None ) - expansionName = (((state.Flags & 0x04) != 0) ? "Blackthorn's Revenge" : ((state.Flags & 0x02) != 0) ? "Third Dawn" : ((state.Flags & 0x01) != 0) ? "Renaissance" : "The Second Age" ); - AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( expansionName, LabelColor32 ), false, false ); Account a = state.Account as Account; diff --git a/Scripts/Items/Misc/BulletinBoards.cs b/Scripts/Items/Misc/BulletinBoards.cs index ef2600440..965c7a5b0 100644 --- a/Scripts/Items/Misc/BulletinBoards.cs +++ b/Scripts/Items/Misc/BulletinBoards.cs @@ -161,7 +161,7 @@ namespace Server.Items NetState state = from.NetState; state.Send( new BBDisplayBoard( this ) ); - if ( state.IsPost6017 ) + if ( state.ContainerGridLines ) state.Send( new ContainerContent6017( from, this ) ); else state.Send( new ContainerContent( from, this ) ); diff --git a/Scripts/Items/Misc/PublicMoongate.cs b/Scripts/Items/Misc/PublicMoongate.cs index 8b64fc690..414ce3403 100644 --- a/Scripts/Items/Misc/PublicMoongate.cs +++ b/Scripts/Items/Misc/PublicMoongate.cs @@ -321,14 +321,14 @@ namespace Server.Items } else { - int flags = mobile.NetState == null ? 0 : mobile.NetState.Flags; + ClientFlags flags = mobile.NetState == null ? ClientFlags.None : mobile.NetState.Flags; bool young = mobile is PlayerMobile ? ((PlayerMobile)mobile).Young : false; - if ( Core.SE && (flags & 0x10) != 0 ) + if ( Core.SE && (flags & ClientFlags.Tokuno) != 0 ) checkLists = young ? PMList.SEListsYoung : PMList.SELists; - else if ( Core.AOS && (flags & 0x8) != 0 ) + else if ( Core.AOS && (flags & ClientFlags.Malas) != 0 ) checkLists = young ? PMList.AOSListsYoung : PMList.AOSLists; - else if ( (flags & 0x4) != 0 ) + else if ( (flags & ClientFlags.Ilshenar) != 0 ) checkLists = young ? PMList.LBRListsYoung : PMList.LBRLists; else checkLists = young ? PMList.UORListsYoung : PMList.UORLists; diff --git a/Scripts/Items/Skill Items/Magical/Misc/Moongate.cs b/Scripts/Items/Skill Items/Magical/Misc/Moongate.cs index 0e1170313..57196c32a 100644 --- a/Scripts/Items/Skill Items/Magical/Misc/Moongate.cs +++ b/Scripts/Items/Skill Items/Magical/Misc/Moongate.cs @@ -112,7 +112,7 @@ namespace Server.Items public virtual void UseGate( Mobile m ) { - int flags = m.NetState == null ? 0 : m.NetState.Flags; + ClientFlags flags = m.NetState == null ? ClientFlags.None : m.NetState.Flags; if ( Factions.Sigil.ExistsOn( m ) ) { @@ -122,7 +122,7 @@ namespace Server.Items { m.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young. } - else if ( (m.Kills >= 5 && m_TargetMap != Map.Felucca) || ( m_TargetMap == Map.Tokuno && (flags & 0x10) == 0 ) || ( m_TargetMap == Map.Malas && (flags & 0x8) == 0 ) || ( m_TargetMap == Map.Ilshenar && (flags & 0x4) == 0 ) ) + else if ( (m.Kills >= 5 && m_TargetMap != Map.Felucca) || ( m_TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ) || ( m_TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ) || ( m_TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0 ) ) { m.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there. } diff --git a/Scripts/Items/Skill Items/Magical/Spellbook.cs b/Scripts/Items/Skill Items/Magical/Spellbook.cs index 53a795f6e..b2c45b9cd 100644 --- a/Scripts/Items/Skill Items/Magical/Spellbook.cs +++ b/Scripts/Items/Skill Items/Magical/Spellbook.cs @@ -490,8 +490,6 @@ namespace Server.Items { } - private static readonly ClientVersion Version_400a = new ClientVersion( "4.0.0a" ); - public void DisplayTo( Mobile to ) { // The client must know about the spellbook or it will crash! @@ -506,7 +504,7 @@ namespace Server.Items return; // What will happen if the client doesn't know about our parent? - if ( to.NetState.IsPost6017 ) + if ( to.NetState.ContainerGridLines ) to.Send( new ContainerContentUpdate6017( this ) ); else to.Send( new ContainerContentUpdate( this ) ); @@ -523,14 +521,14 @@ namespace Server.Items return; if ( Core.AOS ) { - if ( to.NetState.Version != null && to.NetState.Version >= Version_400a ) { + if ( to.NetState.NewSpellbook ) { to.Send( new NewSpellbookContent( this, ItemID, BookOffset + 1, m_Content ) ); } else { to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) ); } } else { - if ( to.NetState.IsPost6017 ) { + if ( to.NetState.ContainerGridLines ) { to.Send( new SpellbookContent6017( m_Count, BookOffset + 1, m_Content, this ) ); } else { to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) ); diff --git a/Scripts/Items/Weapons/Abilities/WeaponAbility.cs b/Scripts/Items/Weapons/Abilities/WeaponAbility.cs index 496897490..2ecc9504c 100644 --- a/Scripts/Items/Weapons/Abilities/WeaponAbility.cs +++ b/Scripts/Items/Weapons/Abilities/WeaponAbility.cs @@ -166,9 +166,12 @@ namespace Server.Items if ( !from.Player ) return true; - int flags = (from.NetState == null) ? 0 : from.NetState.Flags; + NetState state = from.NetState; - if( RequiresSE && (flags & 0x10) == 0 ) //TODO: Convert to expansionInfo + if ( state == null ) + return false; + + if( RequiresSE && state.SupportsExpansion( Expansion.SE ) ) { from.SendLocalizedMessage( 1063456 ); // You must upgrade to Samurai Empire in order to use that ability. return false; diff --git a/Scripts/Misc/BuffIcons.cs b/Scripts/Misc/BuffIcons.cs index 957324825..8443d8cc2 100644 --- a/Scripts/Misc/BuffIcons.cs +++ b/Scripts/Misc/BuffIcons.cs @@ -24,9 +24,6 @@ namespace Server } } - private static readonly ClientVersion m_RequiredClient = new ClientVersion( "5.0.2b" ); - public static ClientVersion RequiredClient { get { return m_RequiredClient; } } - #region Properties private BuffIcon m_ID; public BuffIcon ID { get { return m_ID; } } diff --git a/Scripts/Misc/CharacterCreation.cs b/Scripts/Misc/CharacterCreation.cs index 60bde5cf0..2b6ddaa91 100644 --- a/Scripts/Misc/CharacterCreation.cs +++ b/Scripts/Misc/CharacterCreation.cs @@ -734,14 +734,13 @@ namespace Server.Misc } } - private static readonly ClientVersion m_NewHavenClient = new ClientVersion( "6.0.0.0" ); private static readonly CityInfo m_NewHavenInfo = new CityInfo( "New Haven", "The Bountiful Harvest Inn", 3503, 2574, 14, Map.Trammel ); private static CityInfo GetStartLocation( CharacterCreatedEventArgs args, bool isYoung ) { if( Core.ML ) { - //if( args.State != null && args.State.Version >= m_NewHavenClient ) + //if( args.State != null && args.State.NewHaven ) return m_NewHavenInfo; //We don't get the client Version until AFTER Character creation //return args.City; TODO: Uncomment when the old quest system is actually phased out @@ -749,14 +748,14 @@ namespace Server.Misc bool useHaven = isYoung; - int flags = args.State == null ? 0 : args.State.Flags; + ClientFlags flags = args.State == null ? ClientFlags.None : args.State.Flags; Mobile m = args.Mobile; switch ( args.Profession ) { case 4: //Necro { - if ( (flags & 0x8) != 0 ) + if ( (flags & ClientFlags.Malas) != 0 ) { return new CityInfo( "Umbra", "Mardoth's Tower", 2114, 1301, -50, Map.Malas ); } @@ -782,7 +781,7 @@ namespace Server.Misc } case 6: //Samurai { - if ( (flags & 0x10) != 0 ) + if ( (flags & ClientFlags.Tokuno) != 0 ) { return new CityInfo( "Samurai DE", "Haoti's Grounds", 368, 780, -1, Map.Malas ); } @@ -804,7 +803,7 @@ namespace Server.Misc } case 7: //Ninja { - if ( (flags & 0x10) != 0 ) + if ( (flags & ClientFlags.Tokuno) != 0 ) { return new CityInfo( "Ninja DE", "Enimo's Residence", 414, 823, -1, Map.Malas ); } diff --git a/Scripts/Misc/CurrentExpansion.cs b/Scripts/Misc/CurrentExpansion.cs index 82a8d8227..e70be1de7 100644 --- a/Scripts/Misc/CurrentExpansion.cs +++ b/Scripts/Misc/CurrentExpansion.cs @@ -5,7 +5,7 @@ namespace Server { public class CurrentExpansion { - private static readonly Expansion Expansion = Expansion.ML; + private static readonly Expansion Expansion = Expansion.SA; public static void Configure() { diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index 0827cd0f7..234f5a0b8 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -3426,7 +3426,7 @@ namespace Server.Mobiles NetState ns = this.NetState; if ( ns != null ) { - if ( ns.IsPost7000 ) { + if ( ns.StygianAbyss ) { ns.Send( new MobileMoving( m, Notoriety.Compute( this, m ) ) ); } else { ns.Send( new MobileMovingOld( m, Notoriety.Compute( this, m ) ) ); @@ -4108,7 +4108,7 @@ namespace Server.Mobiles NetState state = this.NetState; - if( state != null && state.Version >= BuffInfo.RequiredClient ) + if( state != null && state.BuffIcon ) { foreach( BuffInfo info in m_BuffTable.Values ) { @@ -4133,7 +4133,7 @@ namespace Server.Mobiles NetState state = this.NetState; - if( state != null && state.Version >= BuffInfo.RequiredClient ) + if( state != null && state.BuffIcon ) { state.Send( new AddBuffPacket( this, b ) ); } @@ -4161,7 +4161,7 @@ namespace Server.Mobiles NetState state = this.NetState; - if( state != null && state.Version >= BuffInfo.RequiredClient ) + if( state != null && state.BuffIcon ) { state.Send( new RemoveBuffPacket( this, b ) ); } diff --git a/Scripts/Mobiles/Vendors/BaseVendor.cs b/Scripts/Mobiles/Vendors/BaseVendor.cs index 53e04149b..ccf96ee94 100644 --- a/Scripts/Mobiles/Vendors/BaseVendor.cs +++ b/Scripts/Mobiles/Vendors/BaseVendor.cs @@ -637,7 +637,7 @@ namespace Server.Mobiles if ( from.NetState == null ) return; - if ( from.NetState.IsPost6017 ) + if ( from.NetState.ContainerGridLines ) from.Send( new VendorBuyContent6017( list ) ); else from.Send( new VendorBuyContent( list ) ); diff --git a/Scripts/Spells/Bushido/SamuraiSpell.cs b/Scripts/Spells/Bushido/SamuraiSpell.cs index 35caf7779..850f2a86d 100644 --- a/Scripts/Spells/Bushido/SamuraiSpell.cs +++ b/Scripts/Spells/Bushido/SamuraiSpell.cs @@ -36,7 +36,6 @@ namespace Server.Spells.Bushido if ( from.NetState == null ) return false; - //return ( (from.NetState.Flags & 0x10) != 0 ); return from.NetState.SupportsExpansion( Expansion.SE ); } diff --git a/Scripts/Spells/Ninjitsu/NinjaSpell.cs b/Scripts/Spells/Ninjitsu/NinjaSpell.cs index d5de7f748..d04ac8103 100644 --- a/Scripts/Spells/Ninjitsu/NinjaSpell.cs +++ b/Scripts/Spells/Ninjitsu/NinjaSpell.cs @@ -37,7 +37,6 @@ namespace Server.Spells.Ninjitsu if ( from.NetState == null ) return false; - //return ( (from.NetState.Flags & 0x10) != 0 ); return from.NetState.SupportsExpansion( Expansion.SE ); } diff --git a/Server/ClientVersion.cs b/Server/ClientVersion.cs index c1fe80e44..d580f776f 100644 --- a/Server/ClientVersion.cs +++ b/Server/ClientVersion.cs @@ -28,7 +28,8 @@ namespace Server { Regular, UOTD, - God + God, + SA } public class ClientVersion : IComparable, IComparer diff --git a/Server/ExpansionInfo.cs b/Server/ExpansionInfo.cs index c639cb204..fbbb04613 100644 --- a/Server/ExpansionInfo.cs +++ b/Server/ExpansionInfo.cs @@ -22,45 +22,139 @@ using System; namespace Server { - public enum Expansion + public enum Expansion { None, - /* T2A, UOR, - LBR, UOTD, - */ + LBR, AOS, SE, - ML + ML, + SA } + + public enum ClientFlags + { + None = 0x00000000, + Felucca = 0x00000001, + Trammel = 0x00000002, + Ilshenar = 0x00000004, + Malas = 0x00000008, + Tokuno = 0x00000010, + TerMur = 0x00000020, + Unk1 = 0x00000040, + Unk2 = 0x00000080, + UOTD = 0x00000100 + } + + public enum FeatureFlags + { + None = 0x00000000, + T2A = 0x00000001, + UOR = 0x00000002, + UOTD = 0x00000004, + LBR = 0x00000008, + AOS = 0x00000010, + SixthCharacterSlot = 0x00000020, + SE = 0x00000040, + ML = 0x00000080, + Unk1 = 0x00000100, + Unk2 = 0x00000200, + Unk3 = 0x00000400, + Unk4 = 0x00000800, + SeventhCharacterSlot = 0x00001000, + Unk5 = 0x00002000, + Unk6 = 0x00004000, + Unk7 = 0x00008000, + SA = 0x00010000, + + + ExpansionNone = None, + ExpansionT2A = T2A, + ExpansionUOR = ExpansionT2A | UOR, + ExpansionUOTD = ExpansionUOR | UOTD, + ExpansionLBR = ExpansionUOTD | LBR, + ExpansionAOS = ExpansionLBR | AOS | Unk7, + ExpansionSE = ExpansionAOS | SE, + ExpansionML = ExpansionSE | ML | Unk2, + ExpansionSA = ExpansionML | SA + } + + public enum CharacterListFlags + { + None = 0x00000000, + Unk1 = 0x00000001, + Unk2 = 0x00000002, + OneCharacterSlot = 0x00000004, + ContextMenus = 0x00000008, + SlotLimit = 0x00000010, + AOS = 0x00000020, + SixthCharacterSlot = 0x00000040, + SE = 0x00000080, + ML = 0x00000100, + Unk4 = 0x00000200, + Unk5 = 0x00000400, + Unk6 = 0x00000800, + SeventhCharacterSlot = 0x00001000, + Unk7 = 0x00002000, + + ExpansionNone = ContextMenus, // + ExpansionT2A = ContextMenus, // + ExpansionUOR = ContextMenus, // None + ExpansionUOTD = ContextMenus, // + ExpansionLBR = ContextMenus, // + ExpansionAOS = ContextMenus | AOS, + ExpansionSE = ExpansionAOS | SE, + ExpansionML = ExpansionSE | ML, + ExpansionSA = ExpansionML + } + public class ExpansionInfo { - private string m_Name; - private int m_ID, m_NetStateFlag, m_SupportedFeatures, m_CharListFlags, m_CustomHousingFlag; + public static ExpansionInfo[] Table { get { return m_Table; } } + private static ExpansionInfo[] m_Table = new ExpansionInfo[] + { + new ExpansionInfo( 0, "None" , ClientFlags.None, FeatureFlags.ExpansionNone, CharacterListFlags.ExpansionNone, 0x0000 ), + new ExpansionInfo( 1, "The Second Age" , ClientFlags.Felucca, FeatureFlags.ExpansionT2A, CharacterListFlags.ExpansionT2A, 0x0000 ), + new ExpansionInfo( 2, "Renaissance" , ClientFlags.Trammel, FeatureFlags.ExpansionUOR, CharacterListFlags.ExpansionUOR, 0x0000 ), + new ExpansionInfo( 3, "Third Dawn" , ClientFlags.Ilshenar, FeatureFlags.ExpansionUOTD, CharacterListFlags.ExpansionUOTD, 0x0000 ), + new ExpansionInfo( 4, "Blackthorn's Revenge", ClientFlags.Ilshenar, FeatureFlags.ExpansionLBR, CharacterListFlags.ExpansionLBR, 0x0000 ), + new ExpansionInfo( 5, "Age of Shadows" , ClientFlags.Malas, FeatureFlags.ExpansionAOS, CharacterListFlags.ExpansionAOS, 0x0020 ), + new ExpansionInfo( 6, "Samurai Empire" , ClientFlags.Tokuno, FeatureFlags.ExpansionSE, CharacterListFlags.ExpansionSE, 0x0060 ), // 0x40 | 0x20 = 0x60 + new ExpansionInfo( 7, "Mondain's Legacy" , new ClientVersion( "5.0.0a" ), FeatureFlags.ExpansionML, CharacterListFlags.ExpansionML, 0x02E0 ), // 0x280 | 0x60 = 0x2E0 + new ExpansionInfo( 8, "Stygian Abyss" , ClientFlags.TerMur, FeatureFlags.ExpansionSA, CharacterListFlags.ExpansionSA, 0x02E0 ) // ?? + }; - private ClientVersion m_RequiredClient; //Used as an alternative to the flags + private string m_Name; + private int m_ID, m_CustomHousingFlag; + + private ClientFlags m_ClientFlags; + private FeatureFlags m_SupportedFeatures; + private CharacterListFlags m_CharListFlags; + + private ClientVersion m_RequiredClient; // Used as an alternative to the flags public string Name{ get{ return m_Name; } } public int ID{ get{ return m_ID; } } - public int NetStateFlag{ get{ return m_NetStateFlag; } } - public int SupportedFeatures{ get{ return m_SupportedFeatures; } } - public int CharacterListFlags { get { return m_CharListFlags; } } + public ClientFlags ClientFlags{ get{ return m_ClientFlags; } } + public FeatureFlags SupportedFeatures{ get{ return m_SupportedFeatures; } } + public CharacterListFlags CharacterListFlags { get { return m_CharListFlags; } } public int CustomHousingFlag { get{ return m_CustomHousingFlag; } } public ClientVersion RequiredClient { get { return m_RequiredClient; } } - public ExpansionInfo( int id, string name, int netStateFlag, int supportedFeatures, int charListFlags, int customHousingFlag ) + public ExpansionInfo( int id, string name, ClientFlags clientFlags, FeatureFlags supportedFeatures, CharacterListFlags charListFlags, int customHousingFlag ) { m_Name = name; m_ID = id; - m_NetStateFlag = netStateFlag; + m_ClientFlags = clientFlags; m_SupportedFeatures = supportedFeatures; m_CharListFlags = charListFlags; m_CustomHousingFlag = customHousingFlag; } - public ExpansionInfo( int id, string name, ClientVersion requiredClient, int supportedFeatures, int charListFlags, int customHousingFlag ) + public ExpansionInfo( int id, string name, ClientVersion requiredClient, FeatureFlags supportedFeatures, CharacterListFlags charListFlags, int customHousingFlag ) { m_Name = name; m_ID = id; @@ -70,17 +164,6 @@ namespace Server m_RequiredClient = requiredClient; } - public static ExpansionInfo[] Table { get { return m_Table; } } - private static ExpansionInfo[] m_Table = new ExpansionInfo[] - { - new ExpansionInfo( 0, "None" , 0x00, 0x0003, 0x008, 0x00 ), - new ExpansionInfo( 1, "Age of Shadows" , 0x08, 0x801F, 0x028, 0x20 ), - new ExpansionInfo( 2, "Samurai Empire" , 0x10, 0x805F, 0x0A8, 0x60 ), //0x40 | 0x20 = 0x60 - new ExpansionInfo( 3, "Mondain's Legacy", new ClientVersion( "5.0.0a" ), 0x82DF, 0x1A8, 0x2E0 ) //0x280 | 0x60 = 0x2E0 - - //0x200 + 0x400 for KR? - }; - public static ExpansionInfo GetInfo( Expansion ex ) { return GetInfo( (int)ex ); diff --git a/Server/Gumps/Gump.cs b/Server/Gumps/Gump.cs index 3e751f750..0e0710ea7 100644 --- a/Server/Gumps/Gump.cs +++ b/Server/Gumps/Gump.cs @@ -365,8 +365,6 @@ namespace Server.Gumps private static byte[] m_NoDispose = StringToBuffer( "{ nodispose }" ); private static byte[] m_NoResize = StringToBuffer( "{ noresize }" ); - public static readonly ClientVersion UnpackVersion = new ClientVersion( "5.0.0a" ); - private Packet Compile() { return Compile( null ); @@ -376,7 +374,7 @@ namespace Server.Gumps { IGumpWriter disp; - if ( ns != null && ns.Version != null && ns.Version >= UnpackVersion ) + if ( ns != null && ns.Unpack ) disp = new DisplayGumpPacked( this ); else disp = new DisplayGumpFast( this ); diff --git a/Server/Item.cs b/Server/Item.cs index a63e6b6a7..457c01cb7 100644 --- a/Server/Item.cs +++ b/Server/Item.cs @@ -602,6 +602,7 @@ namespace Server #region Packet caches private Packet m_WorldPacket; + private Packet m_WorldPacketSA; private Packet m_RemovePacket; private Packet m_OPLPacket; @@ -1363,7 +1364,7 @@ namespace Server m_Location = location; this.OnLocationChange( oldRealLocation ); - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); List items = LookupItems(); @@ -1431,7 +1432,7 @@ namespace Server m_Location = location; this.OnLocationChange( oldRealLocation ); - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); eable = m_Map.GetClientsInRange( m_Location, GetMaxUpdateRange() ); @@ -1724,6 +1725,34 @@ namespace Server } } + public Packet WorldPacketSA + { + get + { + // This needs to be invalidated when any of the following changes: + // - ItemID + // - Amount + // - Location + // - Hue + // - Packet Flags + // - Direction + + if ( m_WorldPacketSA == null ) + { + m_WorldPacketSA = new WorldItemSA( this ); + m_WorldPacketSA.SetStatic(); + } + + return m_WorldPacketSA; + } + } + + public void ReleaseWorldPackets() + { + Packet.Release( ref m_WorldPacket ); + Packet.Release( ref m_WorldPacketSA ); + } + [CommandProperty( AccessLevel.GameMaster )] public bool Visible { @@ -1733,7 +1762,7 @@ namespace Server if ( GetFlag( ImplFlag.Visible ) != value ) { SetFlag( ImplFlag.Visible, value ); - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); if ( m_Map != null ) { @@ -1772,7 +1801,7 @@ namespace Server if ( GetFlag( ImplFlag.Movable ) != value ) { SetFlag( ImplFlag.Movable, value ); - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); Delta( ItemDelta.Update ); } } @@ -2778,7 +2807,7 @@ namespace Server if ( m_Hue != value ) { m_Hue = value; - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); Delta( ItemDelta.Update ); } @@ -2994,7 +3023,7 @@ namespace Server { if ( rootParent.CanSee( this ) && rootParent.InRange( worldLoc, GetUpdateRange( rootParent ) ) ) { - if ( ns.IsPost6017 ) + if ( ns.ContainerGridLines ) ns.Send( new ContainerContentUpdate6017( this ) ); else ns.Send( new ContainerContentUpdate( this ) ); @@ -3031,7 +3060,7 @@ namespace Server { if ( tradeRecip.CanSee( this ) && tradeRecip.InRange( worldLoc, GetUpdateRange( tradeRecip ) ) ) { - if ( ns.IsPost6017 ) + if ( ns.ContainerGridLines ) ns.Send( new ContainerContentUpdate6017( this ) ); else ns.Send( new ContainerContentUpdate( this ) ); @@ -3069,7 +3098,7 @@ namespace Server { if ( mob.CanSee( this ) ) { - if ( ns.IsPost6017 ) + if ( ns.ContainerGridLines ) ns.Send( new ContainerContentUpdate6017( this ) ); else ns.Send( new ContainerContentUpdate( this ) ); @@ -3104,7 +3133,7 @@ namespace Server } else { if ( p == null ) { if ( m_Parent is Item ) { - if ( state.IsPost6017 ) + if ( state.ContainerGridLines ) state.Send( new ContainerContentUpdate6017( this ) ); else state.Send( new ContainerContentUpdate( this ) ); @@ -3215,8 +3244,8 @@ namespace Server public virtual void FreeCache() { + ReleaseWorldPackets(); Packet.Release( ref m_RemovePacket ); - Packet.Release( ref m_WorldPacket ); Packet.Release( ref m_OPLPacket ); Packet.Release( ref m_PropertyList ); } @@ -3473,7 +3502,7 @@ namespace Server } m_Location = value; - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); SetLastMoved(); @@ -3494,14 +3523,14 @@ namespace Server else if ( m_Parent is Item ) { m_Location = value; - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); Delta( ItemDelta.Update ); } else { m_Location = value; - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); } if ( m_Parent == null ) @@ -3510,7 +3539,7 @@ namespace Server else { m_Location = value; - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); } this.OnLocationChange( oldLocation ); @@ -3554,7 +3583,7 @@ namespace Server int oldPileWeight = this.PileWeight; m_ItemID = value; - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); int newPileWeight = this.PileWeight; @@ -3636,7 +3665,7 @@ namespace Server if ( (LightType)m_Direction != value ) { m_Direction = (Direction)value; - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); Delta( ItemDelta.Update ); } @@ -3655,7 +3684,7 @@ namespace Server if ( m_Direction != value ) { m_Direction = value; - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); Delta( ItemDelta.Update ); } @@ -3678,7 +3707,7 @@ namespace Server int oldPileWeight = this.PileWeight; m_Amount = value; - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); int newPileWeight = this.PileWeight; @@ -4455,7 +4484,7 @@ namespace Server InvalidateProperties(); - Packet.Release( ref m_WorldPacket ); + ReleaseWorldPackets(); Delta( ItemDelta.Update ); } diff --git a/Server/Items/Container.cs b/Server/Items/Container.cs index 9459663ad..0a2217d95 100644 --- a/Server/Items/Container.cs +++ b/Server/Items/Container.cs @@ -1624,7 +1624,7 @@ namespace Server.Items to.Send( new ContainerDisplay( this ) ); - if ( to.NetState != null && to.NetState.IsPost6017 ) + if ( to.NetState != null && to.NetState.ContainerGridLines ) to.Send( new ContainerContent6017( to, this ) ); else to.Send( new ContainerContent( to, this ) ); diff --git a/Server/Main.cs b/Server/Main.cs index 0127ad8b8..05d3053ba 100644 --- a/Server/Main.cs +++ b/Server/Main.cs @@ -155,6 +155,26 @@ namespace Server set { m_Expansion = value; } } + public static bool T2A + { + get { return m_Expansion >= Expansion.T2A; } + } + + public static bool UOR + { + get { return m_Expansion >= Expansion.UOR; } + } + + public static bool UOTD + { + get { return m_Expansion >= Expansion.UOTD; } + } + + public static bool LBR + { + get { return m_Expansion >= Expansion.LBR; } + } + public static bool AOS { get { return m_Expansion >= Expansion.AOS; } @@ -170,6 +190,11 @@ namespace Server get { return m_Expansion >= Expansion.ML; } } + public static bool SA + { + get { return m_Expansion >= Expansion.SA; } + } + #endregion public static string ExePath diff --git a/Server/Mobile.cs b/Server/Mobile.cs index c8210f01e..8abd39cc6 100644 --- a/Server/Mobile.cs +++ b/Server/Mobile.cs @@ -1157,7 +1157,7 @@ namespace Server info.Free(); if( m_NetState != null && this.CanSee( attacker ) && Utility.InUpdateRange( m_Location, attacker.m_Location ) ) { - if ( m_NetState.IsPost7000 ) { + if ( m_NetState.StygianAbyss ) { m_NetState.Send( new MobileIncoming( this, attacker ) ); } else { m_NetState.Send( new MobileIncomingOld( this, attacker ) ); @@ -1182,7 +1182,7 @@ namespace Server info.Free(); if( m_NetState != null && this.CanSee( defender ) && Utility.InUpdateRange( m_Location, defender.m_Location ) ) { - if ( m_NetState.IsPost7000 ) { + if ( m_NetState.StygianAbyss ) { m_NetState.Send( new MobileIncoming( this, defender ) ); } else { m_NetState.Send( new MobileIncomingOld( this, defender ) ); @@ -2386,7 +2386,7 @@ namespace Server m_Aggressors.Add( AggressorInfo.Create( aggressor, this, criminal ) ); // new AggressorInfo( aggressor, this, criminal, true ) ); if( this.CanSee( aggressor ) && m_NetState != null ) { - if ( m_NetState.IsPost7000 ) { + if ( m_NetState.StygianAbyss ) { m_NetState.Send( new MobileIncoming( this, aggressor ) ); } else { m_NetState.Send( new MobileIncomingOld( this, aggressor ) ); @@ -2404,7 +2404,7 @@ namespace Server aggressor.m_Aggressed.Add( AggressorInfo.Create( aggressor, this, criminal ) ); // new AggressorInfo( aggressor, this, criminal, false ) ); if( this.CanSee( aggressor ) && m_NetState != null ) { - if ( m_NetState.IsPost7000 ) { + if ( m_NetState.StygianAbyss ) { m_NetState.Send( new MobileIncoming( this, aggressor ) ); } else { m_NetState.Send( new MobileIncomingOld( this, aggressor ) ); @@ -2440,7 +2440,7 @@ namespace Server info.Free(); if( m_NetState != null && this.CanSee( aggressed ) ) { - if ( m_NetState.IsPost7000 ) { + if ( m_NetState.StygianAbyss ) { m_NetState.Send( new MobileIncoming( this, aggressed ) ); } else { m_NetState.Send( new MobileIncomingOld( this, aggressed ) ); @@ -2471,7 +2471,7 @@ namespace Server info.Free(); if( m_NetState != null && this.CanSee( aggressor ) ) { - if ( m_NetState.IsPost7000 ) { + if ( m_NetState.StygianAbyss ) { m_NetState.Send( new MobileIncoming( this, aggressor ) ); } else { m_NetState.Send( new MobileIncomingOld( this, aggressor ) ); @@ -3253,7 +3253,7 @@ namespace Server { Packet p = null; - if ( ns.IsPost7000 ) { + if ( ns.StygianAbyss ) { int noto = Notoriety.Compute( m, this ); p = cache[0][noto]; @@ -4278,7 +4278,7 @@ namespace Server foreach( NetState ns in eable ) { - if( !ns.IsPost7000 && ns.Mobile != from && ns.Mobile.CanSee( from ) ) + if( !ns.StygianAbyss && ns.Mobile != from && ns.Mobile.CanSee( from ) ) { if( p == null ) { @@ -4342,7 +4342,7 @@ namespace Server state.Send( new LiftRej( reject ) ); if( item.Parent is Item ) { - if ( state.IsPost6017 ) + if ( state.ContainerGridLines ) state.Send( new ContainerContentUpdate6017( item ) ); else state.Send( new ContainerContentUpdate( item ) ); @@ -4413,7 +4413,7 @@ namespace Server foreach( NetState ns in eable ) { - if( !ns.IsPost7000 && ns.Mobile != this && ns.Mobile.CanSee( this ) ) + if( !ns.StygianAbyss && ns.Mobile != this && ns.Mobile.CanSee( this ) ) { if( p == null ) { @@ -5146,9 +5146,7 @@ namespace Server if( ourState != null ) { - bool newPacket = (ourState.Version != null && ourState.Version >= DamagePacket.Version); - - if( newPacket ) + if( ourState.DamagePacket ) p = Packet.Acquire( new DamagePacket( this, amount ) ); else p = Packet.Acquire( new DamagePacketOld( this, amount ) ); @@ -5158,7 +5156,7 @@ namespace Server if( theirState != null && theirState != ourState ) { - bool newPacket = (theirState.Version != null && theirState.Version >= DamagePacket.Version); + bool newPacket = theirState.DamagePacket; if( newPacket && (p == null || !(p is DamagePacket)) ) { @@ -5227,10 +5225,9 @@ namespace Server { if( ns.Mobile.CanSee( this ) ) { - bool newPacket = (ns.Version != null && ns.Version >= DamagePacket.Version); Packet p; - if( newPacket ) + if( ns.DamagePacket ) { if( pNew == null ) pNew = Packet.Acquire( new DamagePacket( this, amount ) ); @@ -6172,7 +6169,7 @@ namespace Server { state.Mobile.ProcessDelta(); - //if ( state.IsPost7000 ) { + //if ( state.StygianAbyss ) { //if( pNew == null ) //pNew = Packet.Acquire( new NewMobileAnimation( this, action, frameCount, delay ) ); @@ -6728,7 +6725,7 @@ namespace Server if( CanSee( m ) && Utility.InUpdateRange( m_Location, m.m_Location ) ) { - if ( ns.IsPost7000 ) { + if ( ns.StygianAbyss ) { ns.Send( new MobileIncoming( this, m ) ); if ( m.Poisoned ) @@ -6804,7 +6801,7 @@ namespace Server ns.Send( new MapPatches() ); ns.Send( SeasonChange.Instantiate( GetSeason(), true ) ); - if ( ns.IsPost7000 ) + if ( ns.StygianAbyss ) ns.Send( new MobileUpdate( this ) ); else ns.Send( new MobileUpdateOld( this ) ); @@ -6820,7 +6817,7 @@ namespace Server ns.Sequence = 0; ClearFastwalkStack(); - if ( ns.IsPost7000 ) { + if ( ns.StygianAbyss ) { Send( new MobileIncoming( this, this ) ); Send( new MobileUpdate( this ) ); CheckLightLevels( true ); @@ -6841,7 +6838,7 @@ namespace Server ns.Sequence = 0; ClearFastwalkStack(); - if ( ns.IsPost7000 ) { + if ( ns.StygianAbyss ) { Send( new MobileIncoming( this, this ) ); Send( SupportedFeatures.Instantiate( ns ) ); Send( new MobileUpdate( this ) ); @@ -7894,7 +7891,7 @@ namespace Server } else { - if ( state.IsPost7000 ) + if ( state.StygianAbyss ) state.Send( new MobileIncoming( state.Mobile, this ) ); else state.Send( new MobileIncomingOld( state.Mobile, this ) ); @@ -8910,7 +8907,7 @@ namespace Server ns.Send( new MapPatches() ); ns.Send( SeasonChange.Instantiate( GetSeason(), true ) ); - if ( ns.IsPost7000 ) + if ( ns.StygianAbyss ) ns.Send( new MobileUpdate( this ) ); else ns.Send( new MobileUpdateOld( this ) ); @@ -8931,7 +8928,7 @@ namespace Server ns.Sequence = 0; ClearFastwalkStack(); - if ( ns.IsPost7000 ) { + if ( ns.StygianAbyss ) { Send( new MobileIncoming( this, this ) ); Send( new MobileUpdate( this ) ); CheckLightLevels( true ); @@ -8952,7 +8949,7 @@ namespace Server ns.Sequence = 0; ClearFastwalkStack(); - if ( ns.IsPost7000 ) { + if ( ns.StygianAbyss ) { Send( new MobileIncoming( this, this ) ); Send( SupportedFeatures.Instantiate( ns ) ); Send( new MobileUpdate( this ) ); @@ -8999,7 +8996,7 @@ namespace Server { m_NetState.Sequence = 0; - if ( m_NetState.IsPost7000 ) + if ( m_NetState.StygianAbyss ) m_NetState.Send( new MobileUpdate( this ) ); else m_NetState.Send( new MobileUpdateOld( this ) ); @@ -9060,7 +9057,7 @@ namespace Server if( (isTeleport || !inOldRange) && m.m_NetState != null && m.CanSee( this ) ) { - if ( m.m_NetState.IsPost7000 ) { + if ( m.m_NetState.StygianAbyss ) { m.m_NetState.Send( new MobileIncoming( m, this ) ); if ( m_Poison != null ) @@ -9086,7 +9083,7 @@ namespace Server if( !inOldRange && CanSee( m ) ) { - if ( ourState.IsPost7000 ) { + if ( ourState.StygianAbyss ) { ourState.Send( new MobileIncoming( this, m ) ); if ( m.Poisoned ) @@ -9123,7 +9120,7 @@ namespace Server { if( (isTeleport || !Utility.InUpdateRange( oldLocation, ns.Mobile.Location )) && ns.Mobile.CanSee( this ) ) { - if ( ns.IsPost7000 ) { + if ( ns.StygianAbyss ) { ns.Send( new MobileIncoming( ns.Mobile, this ) ); if ( m_Poison != null ) @@ -9462,7 +9459,7 @@ namespace Server { if( state.Mobile.CanSee( this ) ) { - if ( state.IsPost7000 ) { + if ( state.StygianAbyss ) { state.Send( new MobileIncoming( state.Mobile, this ) ); if ( m_Poison != null ) @@ -10011,7 +10008,7 @@ namespace Server { ourState.Sequence = 0; - if ( ourState.IsPost7000 ) + if ( ourState.StygianAbyss ) ourState.Send( new MobileUpdate( m ) ); else ourState.Send( new MobileUpdateOld( m ) ); @@ -10019,7 +10016,7 @@ namespace Server ClearFastwalkStack(); } - if ( ourState.IsPost7000 ) { + if ( ourState.StygianAbyss ) { if( sendIncoming ) ourState.Send( new MobileIncoming( m, m ) ); @@ -10123,7 +10120,7 @@ namespace Server if( sendIncoming ) { - if ( state.IsPost7000 ) { + if ( state.StygianAbyss ) { state.Send( new MobileIncoming( beholder, m ) ); } else { state.Send( new MobileIncomingOld( beholder, m ) ); @@ -10138,7 +10135,7 @@ namespace Server } } - if ( state.IsPost7000 ) { + if ( state.StygianAbyss ) { if( sendMoving ) { int noto = Notoriety.Compute( beholder, m ); diff --git a/Server/Network/NetState.cs b/Server/Network/NetState.cs index 7e23eea3a..2114f9f46 100644 --- a/Server/Network/NetState.cs +++ b/Server/Network/NetState.cs @@ -90,7 +90,7 @@ namespace Server.Network { } } - private int m_Flags; + private ClientFlags m_Flags; private static bool m_Paused; @@ -185,7 +185,7 @@ namespace Server.Network { } } - public int Flags { + public ClientFlags Flags { get { return m_Flags; } @@ -202,51 +202,74 @@ namespace Server.Network { m_Version = value; if ( value >= m_Version7000 ) { - m_Post7000 = m_Post60142 = m_Post6017 = true; + _ProtocolChanges = ProtocolChanges.Version7000; } else if ( value >= m_Version60142 ) { - m_Post60142 = m_Post6017 = true; + _ProtocolChanges = ProtocolChanges.Version60142; } else if ( value >= m_Version6017 ) { - m_Post6017 = true; + _ProtocolChanges = ProtocolChanges.Version6017; + } else if ( value >= m_Version6000 ) { + _ProtocolChanges = ProtocolChanges.Version6000; + } else if ( value >= m_Version502b ) { + _ProtocolChanges = ProtocolChanges.Version502b; + } else if ( value >= m_Version500a ) { + _ProtocolChanges = ProtocolChanges.Version500a; + } else if ( value >= m_Version407a ) { + _ProtocolChanges = ProtocolChanges.Version407a; + } else if ( value >= m_Version400a ) { + _ProtocolChanges = ProtocolChanges.Version400a; } } } - public bool ExtendedSupportedFeatures - { - get { return m_Post60142; } + private static ClientVersion m_Version400a = new ClientVersion( "4.0.0a" ); + private static ClientVersion m_Version407a = new ClientVersion( "4.0.7a" ); + private static ClientVersion m_Version500a = new ClientVersion( "5.0.0a" ); + private static ClientVersion m_Version502b = new ClientVersion( "5.0.2b" ); + private static ClientVersion m_Version6000 = new ClientVersion( "6.0.0.0" ); + private static ClientVersion m_Version6017 = new ClientVersion( "6.0.1.7" ); + private static ClientVersion m_Version60142 = new ClientVersion( "6.0.14.2" ); + private static ClientVersion m_Version7000 = new ClientVersion( "7.0.0.0" ); + + private ProtocolChanges _ProtocolChanges; + + private enum ProtocolChanges { + NewSpellbook = 0x00000001, + DamagePacket = 0x00000002, + Unpack = 0x00000004, + BuffIcon = 0x00000008, + NewHaven = 0x00000010, + ContainerGridLines = 0x00000020, + ExtendedSupportedFeatures = 0x00000040, + StygianAbyss = 0x00000080, + + Version400a = NewSpellbook, + Version407a = Version400a | DamagePacket, + Version500a = Version407a | Unpack, + Version502b = Version500a | BuffIcon, + Version6000 = Version502b | NewHaven, + Version6017 = Version6000 | ContainerGridLines, + Version60142 = Version6017 | ExtendedSupportedFeatures, + Version7000 = Version60142 | StygianAbyss } - public bool IsUOTDClient - { - get - { - return ((m_Flags & 0x100) != 0 || (m_Version != null && m_Version.Type == ClientType.UOTD)); + public bool NewSpellbook { get { return ((_ProtocolChanges & ProtocolChanges.NewSpellbook) != 0); } } + public bool DamagePacket { get { return ((_ProtocolChanges & ProtocolChanges.DamagePacket) != 0); } } + public bool Unpack { get { return ((_ProtocolChanges & ProtocolChanges.Unpack) != 0); } } + public bool BuffIcon { get { return ((_ProtocolChanges & ProtocolChanges.BuffIcon) != 0); } } + public bool NewHaven { get { return ((_ProtocolChanges & ProtocolChanges.NewHaven) != 0); } } + public bool ContainerGridLines { get { return ((_ProtocolChanges & ProtocolChanges.ContainerGridLines) != 0); } } + public bool ExtendedSupportedFeatures { get { return ((_ProtocolChanges & ProtocolChanges.ExtendedSupportedFeatures) != 0); } } + public bool StygianAbyss { get { return ((_ProtocolChanges & ProtocolChanges.StygianAbyss) != 0); } } + + public bool IsUOTDClient { + get { + return ( (m_Flags & ClientFlags.UOTD) != 0 || m_Version.Type == ClientType.UOTD ); } } - private static ClientVersion m_Version6017 = new ClientVersion( "6.0.1.7" ); - private static ClientVersion m_Version60142 = new ClientVersion( "6.0.14.2" ); - private static ClientVersion m_Version7000 = new ClientVersion( "7.0.0.0" ); - - private bool m_Post6017; - private bool m_Post60142; - private bool m_Post7000; - - public bool IsPost6017 { - get { - return m_Post6017; - } - } - - public bool IsPost60142 { - get { - return m_Post60142; - } - } - - public bool IsPost7000 { - get { - return m_Post7000; + public bool IsSAClient { + get { + return ( m_Version.Type == ClientType.SA ); } } @@ -574,7 +597,7 @@ namespace Server.Network { public PacketHandler GetHandler( int packetID ) { - if ( IsPost6017 ) + if ( ContainerGridLines ) return PacketHandlers.Get6017Handler( packetID ); else return PacketHandlers.GetHandler( packetID ); @@ -949,7 +972,7 @@ namespace Server.Network { for ( int i = ExpansionInfo.Table.Length - 1; i >= 0; i-- ) { ExpansionInfo info = ExpansionInfo.Table[i]; - if ( ( info.RequiredClient != null && this.Version >= info.RequiredClient ) || ( ( this.Flags & info.NetStateFlag ) != 0 ) ) { + if ( ( info.RequiredClient != null && this.Version >= info.RequiredClient ) || ( ( this.Flags & info.ClientFlags ) != 0 ) ) { return info; } } @@ -971,7 +994,7 @@ namespace Server.Network { if ( info.RequiredClient != null ) return ( this.Version >= info.RequiredClient ); - return ( ( this.Flags & info.NetStateFlag ) != 0 ); + return ( ( this.Flags & info.ClientFlags ) != 0 ); } public bool SupportsExpansion( Expansion ex, bool checkCoreExpansion ) { diff --git a/Server/Network/PacketHandlers.cs b/Server/Network/PacketHandlers.cs index e0ff4db0f..89d2f38f5 100644 --- a/Server/Network/PacketHandlers.cs +++ b/Server/Network/PacketHandlers.cs @@ -147,6 +147,7 @@ namespace Server.Network Register( 0xD1, 2, true, new OnPacketReceive( LogoutReq ) ); Register( 0xD6, 0, true, new OnPacketReceive( BatchQueryProperties ) ); Register( 0xD7, 0, true, new OnPacketReceive( EncodedCommand ) ); + Register( 0xE1, 0, false, new OnPacketReceive( ClientType ) ); Register( 0xEF, 21, false, new OnPacketReceive( LoginServerSeed ) ); Register6017( 0x08, 15, true, new OnPacketReceive( DropReq6017 ) ); @@ -1235,7 +1236,7 @@ namespace Server.Network { Mobile m = state.Mobile; - if ( state.IsPost7000 ) { + if ( state.StygianAbyss ) { state.Send( new MobileUpdate( m ) ); state.Send( new MobileIncoming( m, m ) ); } else { @@ -1823,6 +1824,16 @@ namespace Server.Network EventSink.InvokeClientVersionReceived( new ClientVersionReceivedArgs( state, version ) ); } + public static void ClientType( NetState state, PacketReader pvSrc ) + { + pvSrc.ReadUInt16(); + + int type = pvSrc.ReadUInt16(); + CV version = state.Version = new CV( pvSrc.ReadString() ); + + //EventSink.InvokeClientVersionReceived( new ClientVersionReceivedArgs( state, version ) );//todo + } + public static void MobileQuery( NetState state, PacketReader pvSrc ) { Mobile from = state.Mobile; @@ -1936,7 +1947,7 @@ namespace Server.Network state.BlockAllPackets = true; - state.Flags = flags; + state.Flags = (ClientFlags)flags; state.Mobile = m; m.NetState = state; @@ -1961,7 +1972,7 @@ namespace Server.Network state.Sequence = 0; - if ( state.IsPost7000 ) { + if ( state.StygianAbyss ) { state.Send( new MobileUpdate( m ) ); state.Send( new MobileUpdate( m ) ); @@ -2069,7 +2080,7 @@ namespace Server.Network Race race = null; - if ( state.IsPost7000 ) { + if ( state.StygianAbyss ) { byte raceID = (byte)(genderRace < 4 ? 0 : ((genderRace / 2) - 1)); race = Race.Races[raceID]; } else { @@ -2101,7 +2112,7 @@ namespace Server.Network } } - state.Flags = flags; + state.Flags = (ClientFlags)flags; CharacterCreatedEventArgs args = new CharacterCreatedEventArgs( state, a, diff --git a/Server/Network/Packets.cs b/Server/Network/Packets.cs index 828d586ea..1daadb768 100644 --- a/Server/Network/Packets.cs +++ b/Server/Network/Packets.cs @@ -89,8 +89,6 @@ namespace Server.Network public sealed class DamagePacket : Packet { - public static readonly ClientVersion Version = new ClientVersion( "4.0.7a" ); - public DamagePacket( Mobile m, int amount ) : base( 0x0B, 7 ) { m_Stream.Write( (int) m.Serial ); @@ -1075,6 +1073,45 @@ namespace Server.Network } } + public sealed class WorldItemSA : Packet + { + public WorldItemSA( Item item ) : base( 0xF3, 24 ) + { + m_Stream.Write( (short) 0x1 ); + + int itemID = item.ItemID; + + if ( item is BaseMulti ) { + m_Stream.Write( (byte) 0x02 ); + itemID &= 0x3FFF; + } else { + m_Stream.Write( (byte) 0x00 ); + itemID &= 0x7FFF; + } + + m_Stream.Write( (int) item.Serial ); + + m_Stream.Write( (short) itemID ); + + m_Stream.Write( (byte) item.Direction ); + + int amount = item.Amount; + m_Stream.Write( (short) amount ); + m_Stream.Write( (short) amount ); + + Point3D loc = item.Location; + int x = loc.m_X & 0x7FFF; + int y = loc.m_Y & 0x3FFF; + m_Stream.Write( (short) x ); + m_Stream.Write( (short) y ); + m_Stream.Write( (sbyte) loc.m_Z ); + + m_Stream.Write( (byte) item.Light ); + m_Stream.Write( (short) item.Hue ); + m_Stream.Write( (byte) item.GetPacketFlags() ); + } + } + public sealed class LiftRej : Packet { public LiftRej( LRReason reason ) : base( 0x27, 2 ) @@ -2515,9 +2552,9 @@ namespace Server.Network public sealed class SupportedFeatures : Packet { - private static int m_AdditionalFlags; + private static FeatureFlags m_AdditionalFlags; - public static int Value{ get{ return m_AdditionalFlags; } set{ m_AdditionalFlags = value; } } + public static FeatureFlags Value{ get{ return m_AdditionalFlags; } set{ m_AdditionalFlags = value; } } public static SupportedFeatures Instantiate( NetState ns ) { @@ -2526,25 +2563,21 @@ namespace Server.Network public SupportedFeatures( NetState ns ) : base( 0xB9, ns.ExtendedSupportedFeatures ? 5 : 3 ) { - int flags = ExpansionInfo.CurrentExpansion.SupportedFeatures; + FeatureFlags flags = ExpansionInfo.CurrentExpansion.SupportedFeatures; flags |= m_AdditionalFlags; - /* - int flags = 0x3 | m_AdditionalFlags; - - if ( Core.SE ) - flags |= 0x0040; - - if ( Core.AOS ) - flags |= 0x801C; - * */ IAccount acct = ns.Account as IAccount; if ( acct != null && acct.Limit >= 6 ) { - flags |= 0x8020; - flags &= ~0x004; + flags |= FeatureFlags.Unk7; + flags &= ~FeatureFlags.UOTD; + + if ( acct.Limit > 6 ) + flags |= FeatureFlags.SeventhCharacterSlot; + else + flags |= FeatureFlags.SixthCharacterSlot; } if ( ns.ExtendedSupportedFeatures ) { @@ -2552,8 +2585,6 @@ namespace Server.Network } else { m_Stream.Write( (ushort) flags ); } - - //m_Stream.Write( (ushort) m_Value ); // 0x01 = T2A, 0x02 = LBR } } @@ -3591,28 +3622,22 @@ namespace Server.Network m_Stream.WriteAsciiFixed( ci.City, 31 ); m_Stream.WriteAsciiFixed( ci.Building, 31 ); } -/* - int flags = 0x08; //Context Menus - if ( Core.SE ) - flags |= 0xA0; //SE & AOS - else if ( Core.AOS ) - flags |= 0x20; //AOS - * */ + CharacterListFlags flags = ExpansionInfo.CurrentExpansion.CharacterListFlags; - int flags = ExpansionInfo.CurrentExpansion.CharacterListFlags; - - if ( count >= 6 ) - flags |= 0x40; // 6th character slot + if ( count > 6 ) + flags |= (CharacterListFlags.SeventhCharacterSlot | CharacterListFlags.SixthCharacterSlot); // 7th Character Slot - TODO: Is SixthCharacterSlot Required? + else if ( count == 6 ) + flags |= CharacterListFlags.SixthCharacterSlot; // 6th Character Slot else if ( a.Limit == 1 ) - flags |= 0x14; // Limit characters & one character + flags |= (CharacterListFlags.SlotLimit & CharacterListFlags.OneCharacterSlot); // Limit Characters & One Character - m_Stream.Write( (int)(flags | m_AdditionalFlags) ); // flags + m_Stream.Write( (int)(flags | m_AdditionalFlags) ); // Additional Flags } - private static int m_AdditionalFlags; + private static CharacterListFlags m_AdditionalFlags; - public static int AdditionalFlags + public static CharacterListFlags AdditionalFlags { get{ return m_AdditionalFlags; } set{ m_AdditionalFlags = value; } @@ -3633,12 +3658,12 @@ namespace Server.Network public enum ALRReason : byte { - Invalid = 0x00, - InUse = 0x01, - Blocked = 0x02, - BadPass = 0x03, - Idle = 0xFE, - BadComm = 0xFF + Invalid = 0x00, + InUse = 0x01, + Blocked = 0x02, + BadPass = 0x03, + Idle = 0xFE, + BadComm = 0xFF } public sealed class AccountLoginRej : Packet diff --git a/Server/SecureTrade.cs b/Server/SecureTrade.cs index 7a58c7cb4..598fcaa73 100644 --- a/Server/SecureTrade.cs +++ b/Server/SecureTrade.cs @@ -209,8 +209,8 @@ namespace Server m_From = new SecureTradeInfo( this, from, new SecureTradeContainer( this ) ); m_To = new SecureTradeInfo( this, to, new SecureTradeContainer( this ) ); - bool from6017 = ( from.NetState == null ? false : from.NetState.IsPost6017 ); - bool to6017 = ( to.NetState == null ? false : to.NetState.IsPost6017 ); + bool from6017 = ( from.NetState == null ? false : from.NetState.ContainerGridLines ); + bool to6017 = ( to.NetState == null ? false : to.NetState.ContainerGridLines ); from.Send( new MobileStatus( from, to ) ); from.Send( new UpdateSecureTrade( m_From.Container, false, false ) );