Some More Packets

Diskussion und Informationen über UO:KR
Nachricht
Autor
TheUndisputed

Some More Packets

#1 Beitrag von TheUndisputed » 02 Mär 2008 16:41

I Use RUnuo 2 SVN.
Face Packet:
VirtualHair.cs
Add:

Code: Alles auswählen

	public class FaceInfo : BaseHairInfo
	{
		public FaceInfo( int itemid )
			: base( itemid, 0 )
		{
		}

		public FaceInfo( int itemid, int hue )
			: base( itemid, hue )
		{
		}

		public FaceInfo( GenericReader reader )
			: base( reader )
		{
		}

		public static int FakeSerial( Mobile parent )
		{
			return (0x7FFFFFFF - 0x400 - 2 - (parent.Serial * 4));
		}
	}
In Packets.cs
I find KRCreateCharacter Packet here, but Facepacket was wrong. this is KRCreateCharacter that I use.

Code: Alles auswählen

        // KR Client Character Creation
        public static void KRCreateCharacter(NetState state, PacketReader pvSrc)
        {
            int flags = 0;

            int length = pvSrc.Size;

            int unk1 = pvSrc.ReadInt32();		// Pattern
            int charSlot = pvSrc.ReadInt32();
            string name = pvSrc.ReadString(30);
            string unknown1 = pvSrc.ReadString(30);

            int prof = pvSrc.ReadByte();
            uint unk3 = pvSrc.ReadByte();	// Fixed in 0x41

            int gender = pvSrc.ReadByte();
            int brace = pvSrc.ReadByte();	// Race

            int str = pvSrc.ReadByte();
            int dex = pvSrc.ReadByte();
            int intl = pvSrc.ReadByte();

            int hue = pvSrc.ReadUInt16();
            int unk5 = pvSrc.ReadInt32(); // 0x00 0x00 0x00 0x00
            int unk6 = pvSrc.ReadInt32(); // 0x00 0x00 0x00 0x00	

            int is1 = pvSrc.ReadByte();
            int vs1 = pvSrc.ReadByte();
            int is2 = pvSrc.ReadByte();
            int vs2 = pvSrc.ReadByte();
            int is3 = pvSrc.ReadByte();
            int vs3 = pvSrc.ReadByte();
            int is4 = pvSrc.ReadByte();
            int vs4 = pvSrc.ReadByte();

            string unknown2 = pvSrc.ReadString(24); // Pack of 0x00
            int unk7 = pvSrc.ReadInt16();				// Another 0x00

            int hairHue = pvSrc.ReadInt16();
            int hairVal = pvSrc.ReadInt16();

            int unk8 = pvSrc.ReadByte();
            int unk9 = pvSrc.ReadInt32();
            int unk10 = pvSrc.ReadByte();
            int shirtHue = pvSrc.ReadInt16();
            int unk12 = pvSrc.ReadInt16();
            int unk13 = pvSrc.ReadByte();

            int facecolor = pvSrc.ReadInt16();

            int face = pvSrc.ReadInt16();

            int hairHuef = pvSrc.ReadInt16();		// Beard Hue
            int hairValf = pvSrc.ReadInt16();		// Beard ID

            int cityIndex = 0;		// Obsolete=
            int pantsHue = shirtHue;		// Obsolete	

            bool female = (gender != 0);

            Race race = Race.Races[brace];

            if (race == null)
                race = Race.DefaultRace;

            CityInfo[] info = state.CityInfo;
            IAccount a = state.Account;

                        Console.WriteLine(face.ToString() );

            if (info == null || a == null || cityIndex <0>= info.Length)
            {
                state.Dispose();
            }
            else
            {
                // Check if anyone is using this account
                for (int i = 0; i < a.Length; ++i)
                {
                    Mobile check = a[i];

                    if (check != null && check.Map != Map.Internal)
                    {
                        Console.WriteLine("Login: {0}: Account in use", state);
                        state.Send(new PopupMessage(PMMessage.CharInWorld));
                        return;
                    }
                }

                state.Flags = flags;

                CharacterCreatedEventArgs args = new CharacterCreatedEventArgs(
                    state, a,
                    name, female, hue,
                    str, dex, intl,
                    info[cityIndex],
                    new SkillNameValue[3]
					{
						new SkillNameValue( (SkillName)is1, vs1 ),
						new SkillNameValue( (SkillName)is2, vs2 ),
						new SkillNameValue( (SkillName)is3, vs3 ),
					},
                    shirtHue, pantsHue,
                    hairVal, hairHue,
                    hairValf, hairHuef,
                    prof,
                    race,
		face,
		facecolor
                    );

                state.BlockAllPackets = true;

                EventSink.InvokeCharacterCreated(args);

                Mobile m = args.Mobile;

                if (m != null)
                {
                    state.Mobile = m;
                    m.NetState = state;

                    state.BlockAllPackets = false;
                    DoLogin(state, m);
                }
                else
                {
                    state.BlockAllPackets = false;
                    state.Dispose();
                }
            }
        }
MobileIncoming : Packet

Code: Alles auswählen

	public sealed class MobileIncoming : Packet
	{
		private static int[] m_DupedLayers = new int[256];
		private static int m_Version;

		public Mobile m_Beheld;

		public MobileIncoming( Mobile beholder, Mobile beheld ) : base( 0x78 )
		{
			m_Beheld = beheld;
			++m_Version;

			List<Item> eq = beheld.Items;
			int count = eq.Count;

			if( beheld.HairItemID > 0 )
				count++;
			if( beheld.FacialHairItemID > 0 )
				count++;
#region KR Face

			bool face = false;
			if (beholder.NetState!=null && beholder.NetState.IsKRClient)
				if ( beheld.FaceItemID > 0 ) 
				face = true;

			if( face )
				count++; 
#endregion KR Face
			this.EnsureCapacity( 23 + (count * 9) );

			int hue = beheld.Hue;

			if ( beheld.SolidHueOverride >= 0 )
				hue = beheld.SolidHueOverride;

			m_Stream.Write( (int) beheld.Serial );
			m_Stream.Write( (short) beheld.Body );
			m_Stream.Write( (short) beheld.X );
			m_Stream.Write( (short) beheld.Y );
			m_Stream.Write( (sbyte) beheld.Z );
			m_Stream.Write( (byte) beheld.Direction );
			m_Stream.Write( (short) hue );
			m_Stream.Write( (byte) beheld.GetPacketFlags() );
			m_Stream.Write( (byte) Notoriety.Compute( beholder, beheld ) );

			for ( int i = 0; i <eq>= 0 )
						hue = beheld.SolidHueOverride;

					int itemID = item.ItemID & 0x3FFF;
					bool writeHue = ( hue != 0 );

					if ( writeHue )
						itemID |= 0x8000;

					m_Stream.Write( (int) item.Serial );
					m_Stream.Write( (short) itemID );
					m_Stream.Write( (byte) layer );

					if ( writeHue )
						m_Stream.Write( (short) hue );
				}
			}

			if( beheld.HairItemID > 0 )
			{
				if( m_DupedLayers[(int)Layer.Hair] != m_Version )
				{
					m_DupedLayers[(int)Layer.Hair] = m_Version;
					hue = beheld.HairHue;

					if( beheld.SolidHueOverride >= 0 )
						hue = beheld.SolidHueOverride;

					int itemID = beheld.HairItemID & 0x3FFF;

					bool writeHue = (hue != 0);

					if( writeHue )
						itemID |= 0x8000;

					m_Stream.Write( (int)HairInfo.FakeSerial( beheld ) );
					m_Stream.Write( (short)itemID );
					m_Stream.Write( (byte)Layer.Hair );

					if( writeHue )
						m_Stream.Write( (short)hue );
				}
			}

			if( beheld.FacialHairItemID > 0 )
			{
				if( m_DupedLayers[(int)Layer.FacialHair] != m_Version )
				{
					m_DupedLayers[(int)Layer.FacialHair] = m_Version;
					hue = beheld.FacialHairHue;

					if( beheld.SolidHueOverride >= 0 )
						hue = beheld.SolidHueOverride;

					int itemID = beheld.FacialHairItemID & 0x3FFF;

					bool writeHue = (hue != 0);

					if( writeHue )
						itemID |= 0x8000;

					m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld ) );
					m_Stream.Write( (short)itemID );
					m_Stream.Write( (byte)Layer.FacialHair );

					if( writeHue )
						m_Stream.Write( (short)hue );
				}
			}

#region KR Face
			if( face )
			{
				if( m_DupedLayers[15] != m_Version )
				{
					m_DupedLayers[15] = m_Version;
					hue = beheld.Hue;
					if( beheld.SolidHueOverride >= 0 )
						hue = beheld.SolidHueOverride;

					int itemID2 = beheld.FaceItemID & 0x3FFF;
						itemID2 |= 0x8000;

					m_Stream.Write( (int) FaceInfo.FakeSerial( beheld ) );
					m_Stream.Write( (short) itemID2 );
					m_Stream.Write( (byte) 15 );
					m_Stream.Write( (short) hue );
				}
			}
#endregion KR Face


			m_Stream.Write( (int) 0 ); // terminate
		}
	}
In Mobile.cs

Code: Alles auswählen

	[Flags]
	public enum MobileDelta
	{
		None=0x00000000,
		Name=0x00000001,
		Flags=0x00000002,
		Hits=0x00000004,
		Mana=0x00000008,
		Stam=0x00000010,
		Stat=0x00000020,
		Noto=0x00000040,
		Gold=0x00000080,
		Weight=0x00000100,
		Direction=0x00000200,
		Hue=0x00000400,
		Body=0x00000800,
		Armor=0x00001000,
		StatCap=0x00002000,
		GhostUpdate=0x00004000,
		Followers=0x00008000,
		Properties=0x00010000,
		TithingPoints=0x00020000,
		Resistances=0x00040000,
		WeaponDamage=0x00080000,
		Hair=0x00100000,
		FacialHair=0x00200000,
		Race=0x00400000,
		Face=0x00800000,

		Attributes=0x0000001C
	}
In public virtual void Delete()
Under:

Code: Alles auswählen

	
		        m_Hair = null;
			m_FacialHair = null;
			m_MountItem = null;
Add:

Code: Alles auswählen

			m_Face = null;

In
public virtual void Kill()
After:

Code: Alles auswählen

			HairInfo hair = null;
			if( m_Hair != null )
				hair = new HairInfo( m_Hair.ItemID, m_Hair.Hue );

			FacialHairInfo facialhair = null;
			if( m_FacialHair != null )
				facialhair = new FacialHairInfo( m_FacialHair.ItemID, m_FacialHair.Hue );
Add this:

Code: Alles auswählen

			FaceInfo face = null;
			if( m_Face != null )
				face = new FaceInfo( m_Face.ItemID, m_Face.Hue );

In public virtual void Deserialize( GenericReader reader )
This:

Code: Alles auswählen

			byte hairflag = 0x00;

			if( m_Hair != null )
				hairflag |= 0x01;
			if( m_FacialHair != null )
				hairflag |= 0x02;

			writer.Write( (byte)hairflag );

			if( (hairflag & 0x01) != 0 )
				m_Hair.Serialize( writer );
			if( (hairflag & 0x02) != 0 )
				m_FacialHair.Serialize( writer );
Change to this:

Code: Alles auswählen

			byte hairflag = 0x00;

			if( m_Hair != null )
				hairflag |= 0x01;
			if( m_FacialHair != null )
				hairflag |= 0x02;
			if( m_Face != null )
				hairflag |= 0x04;

			writer.Write( (byte)hairflag );

			if( (hairflag & 0x01) != 0 )
				m_Hair.Serialize( writer );
			if( (hairflag & 0x02) != 0 )
				m_FacialHair.Serialize( writer );
			if( (hairflag & 0x04) != 0 )
				m_Face.Serialize( writer );
After this:

Code: Alles auswählen

		private HairInfo m_Hair;
		private FacialHairInfo m_FacialHair;

Add this:

Code: Alles auswählen

		private FaceInfo m_Face;

		[CommandProperty( AccessLevel.GameMaster )]
		public int FaceItemID
		{
			get
			{
				if( m_Face == null )
					return 0;

				return m_Face.ItemID;
			}
			set
			{
				if( m_Face == null && value > 0 )
					m_Face = new FaceInfo( value );
				else if( value <= 0 )
					m_Face = null;
				else
					m_Face.ItemID = value;

				Delta( MobileDelta.Face );
			}
		}
In ProcessDelta() need to add sendFace like sendHair
In EventSink.cs
CharacterCreatedEventArgs need to be changed to this:

Code: Alles auswählen

	public class CharacterCreatedEventArgs : EventArgs
	{
		private NetState m_State;
		private IAccount m_Account;
		private CityInfo m_City;
		private SkillNameValue[] m_Skills;
		private int m_ShirtHue, m_PantsHue;
		private int m_HairID, m_HairHue;
		private int m_BeardID, m_BeardHue;
		private string m_Name;
		private bool m_Female;
		private int m_Hue;
		private int m_Str, m_Dex, m_Int;
		private int m_Profession;
		private Mobile m_Mobile;

		private Race m_Race;

		private int m_Face;
		private int m_FaceHue;

		public NetState State{ get{ return m_State; } }
		public IAccount Account{ get{ return m_Account; } }
		public Mobile Mobile{ get{ return m_Mobile; } set{ m_Mobile = value; } }
		public string Name{ get{ return m_Name; } }
		public bool Female{ get{ return m_Female; } }
		public int Hue{ get{ return m_Hue; } }
		public int Str{ get{ return m_Str; } }
		public int Dex{ get{ return m_Dex; } }
		public int Int{ get{ return m_Int; } }
		public CityInfo City{ get{ return m_City; } }
		public SkillNameValue[] Skills{ get{ return m_Skills; } }
		public int ShirtHue{ get{ return m_ShirtHue; } }
		public int PantsHue{ get{ return m_PantsHue; } }
		public int HairID{ get{ return m_HairID; } }
		public int HairHue{ get{ return m_HairHue; } }
		public int BeardID{ get{ return m_BeardID; } }
		public int BeardHue{ get{ return m_BeardHue; } }
		public int Profession{ get{ return m_Profession; } set{ m_Profession = value; }}
		public Race Race { get { return m_Race; } }
		public int FaceID{ get{ return m_Face; } }
		public int FaceHue{ get{ return m_FaceHue; } }

		public CharacterCreatedEventArgs( NetState state, IAccount a, string name, bool female, int hue, int str, int dex, int intel, CityInfo city, SkillNameValue[] skills, int shirtHue, int pantsHue, int hairID, int hairHue, int beardID, int beardHue, int profession, Race race , int face ,int facehue)
		{
			m_State = state;
			m_Account = a;
			m_Name = name;
			m_Female = female;
			m_Hue = hue;
			m_Str = str;
			m_Dex = dex;
			m_Int = intel;
			m_City = city;
			m_Skills = skills;
			m_ShirtHue = shirtHue;
			m_PantsHue = pantsHue;
			m_HairID = hairID;
			m_HairHue = hairHue;
			m_BeardID = beardID;
			m_BeardHue = beardHue;
			m_Profession = profession;
			m_Race = race;
			m_Face = face;
			m_FaceHue = facehue;
		}
	}
In Packets.cs
Equip Unequip and Target By Resource macro:

Code: Alles auswählen

	#region Equip Unequip Macro
        public static void EquipMacro(NetState ns, PacketReader pvSrc)
        {

           	 	int length = pvSrc.Size;
			int count = pvSrc.ReadByte();
			List<int> serialList = new List<int>( count );

			for ( int i = 0; i < count; ++i )
			{
				Serial s = pvSrc.ReadInt32();
				serialList.Add( s );

			}

		EquipMacroEventArgs e = new EquipMacroEventArgs( ns, serialList );
            	EventSink.InvokeEquipMacro( e );

        }
        public static void UnequipMacro(NetState ns, PacketReader pvSrc)
        {

           	 	int length = pvSrc.Size;
			int count = pvSrc.ReadByte();
			List<int> layers = new List<int>( count );

			for ( int i = 0; i < count; ++i )
			{
				int s = pvSrc.ReadInt16();
				layers.Add( s );

			}

		UnequipMacroEventArgs e = new UnequipMacroEventArgs( ns, layers );
            	EventSink.InvokeUnequipMacro( e );

        }
	#endregion  Equip Unequip Macro
        public static void CharacterListUpdatrKR(NetState ns, PacketReader pvSrc)
        {

           	 	int length = pvSrc.Size;
			int awlays1 = pvSrc.ReadInt16();
			int clientflags = pvSrc.ReadInt16(); //aways 02


        }
	#region Target By Resource Macro
        public static void TargetByResourceMacro(NetState ns, PacketReader pvSrc)
        {

           	 	int length = pvSrc.Size;
			int Command = pvSrc.ReadInt16();
			Serial serial = pvSrc.ReadInt32();
			int resourcetype = pvSrc.ReadInt16(); //aways 02
            		if (serial.IsItem)
			{
				TargetByResourceMacroEventArgs e = new TargetByResourceMacroEventArgs( ns, World.FindItem(serial), resourcetype );
				EventSink.InvokeTargetByResourceMacro( e );
			}


        }
	#endregion Target By Resource Macro
In EventSink.cs
Add this:

Code: Alles auswählen

	#region Equip Unequip Macro
	public delegate void EquipMacroEventHandler( EquipMacroEventArgs e );
	public delegate void UnequipMacroEventHandler( UnequipMacroEventArgs e );
	#endregion Equip Unequip Macro
	#region Target By Resource Macro
	public delegate void TargetByResourceMacroEventHandler( TargetByResourceMacroEventArgs e );

    	public class TargetByResourceMacroEventArgs : EventArgs
    	{
        	private NetState state;
        	private Item m_tool;
        	private int m_resource_type;

        	public NetState NetState
        	{
        	    get { return state; }
        	}
	        public Item Tool
	        {
		    get { return m_tool; }
	        }
	        public int ResourceType
	        {
		    get { return m_resource_type; }
	        }

        	public TargetByResourceMacroEventArgs(NetState state, Item tool, int type)
        	{
            		this.state = state;
			this.m_tool = tool; 
			this.m_resource_type = type;
        	}
    	}
	#endregion Target By Resource Macro


	#region Equip Unequip Macro
    	public class EquipMacroEventArgs : EventArgs
    	{
        	private NetState state;
        	private List<int> m_list;

        	public NetState NetState
        	{
        	    get { return state; }
        	}
	        public List<int> List
	        {
		    get { return m_list; }
	        }

        	public EquipMacroEventArgs(NetState state, List<int> list)
        	{
            		this.state = state;
			this.m_list = list; 
        	}
    	}
    	public class UnequipMacroEventArgs : EventArgs
    	{
        	private NetState state;
        	private List<int> m_list;

        	public NetState NetState
        	{
        	    get { return state; }
        	}
	        public List<int> List
	        {
		    get { return m_list; }
	        }

        	public UnequipMacroEventArgs(NetState state, List<int> list)
        	{
            		this.state = state;
			this.m_list = list; 
        	}
    	}
	#endregion
in public class EventSink
Add this:

Code: Alles auswählen

		#region Equip Unequip Macro
        	public static event EquipMacroEventHandler EquipMacro;
        	public static event UnequipMacroEventHandler UnequipMacro;
		#endregion
		#region Target By Resource Macro
        	public static event TargetByResourceMacroEventHandler TargetByResourceMacro;

        	public static void InvokeTargetByResourceMacro( TargetByResourceMacroEventArgs e )
        	{
            		if (TargetByResourceMacro != null)
                		TargetByResourceMacro( e );
        	} 
		#endregion Target By Resource Macro

		#region Equip Unequip Macro
        	public static void InvokeEquipMacro( EquipMacroEventArgs e )
        	{
            		if (EquipMacro != null)
                		EquipMacro( e );
        	} 
        	public static void InvokeUnequipMacro( UnequipMacroEventArgs e )
        	{
            		if (UnequipMacro != null)
                		UnequipMacro( e );
        	} 
		#endregion
Way Point Packet

Code: Alles auswählen

	#region KR Way Points
	public sealed class HideWaypoint  : Packet
	{

		public HideWaypoint ( Serial serial) : base( 0xE6,5 )
		{

			m_Stream.Write( (int) serial );
		}
	}
	public sealed class DisplayWaypoint  : Packet
	{

		public DisplayWaypoint ( Serial serial,int x, int y, int z, int mapid,int type, string name) : base( 0xE5 )
		{

			this.EnsureCapacity( 25 );

			m_Stream.Write( (int) serial );

			m_Stream.Write( (short) x );
			m_Stream.Write( (short) y );
			m_Stream.Write( (sbyte) z );
			m_Stream.Write( (byte) mapid ); //map
			
			m_Stream.Write( (short) type ); //type

			m_Stream.Write( (short) 0 );

			if(type == 1 )
				m_Stream.Write( (int) 1046414 );
			else
				m_Stream.Write( (int) 1062613 );


			
			m_Stream.WriteLittleUniNull( name );


			m_Stream.Write( (short) 0 ); // terminate
		}
	}
	#endregion KR  Way Points
MobileStatusExtended

Code: Alles auswählen

	public sealed class MobileStatusExtended : Packet
	{
		public MobileStatusExtended( Mobile m ) : base( 0x11 )
		{
			string name = m.Name;
			if ( name == null ) name = "";

			bool sendMaxWeight = (Core.ML && m.NetState != null && m.NetState.SupportsExpansion( Expansion.ML ));

#region KR MobileStatus
			this.EnsureCapacity((m.NetState != null && m.NetState.IsKRClient) ? 161 : ( sendMaxWeight ? 91 :88 ));
#endregion  KR MobileStatus

			m_Stream.Write( (int) m.Serial );
			m_Stream.WriteAsciiFixed( name, 30 );

			//m_Stream.Write( (short) m.Hits );
			m_Stream.Write( (short) 999 );
			m_Stream.Write( (short) m.HitsMax );

			m_Stream.Write( m.CanBeRenamedBy( m ) );

#region KR MobileStatus
			m_Stream.Write( (byte)((m.NetState != null && m.NetState.IsKRClient) ? 0x06 : (sendMaxWeight ? 0x05 : Core.AOS ? 0x04 : 0x03)) ); // type
#endregion  KR MobileStatus

			m_Stream.Write( m.Female );

			m_Stream.Write( (short) m.Str );
			m_Stream.Write( (short) m.Dex );
			m_Stream.Write( (short) m.Int );

			m_Stream.Write( (short) m.Stam );
			m_Stream.Write( (short) m.StamMax );

			m_Stream.Write( (short) m.Mana );
			m_Stream.Write( (short) m.ManaMax );

			m_Stream.Write( (int) m.TotalGold );
			m_Stream.Write( (short) (Core.AOS ? m.PhysicalResistance : (int)(m.ArmorRating + 0.5)) );
			m_Stream.Write( (short) (Mobile.BodyWeight + m.TotalWeight) );

			if( sendMaxWeight )
			{
				m_Stream.Write( (short)m.MaxWeight );
				m_Stream.Write( (byte)(m.Race.RaceID + 1));	// Would be 0x00 if it's a non-ML enabled account but...
			}

			m_Stream.Write( (short) m.StatCap );

			m_Stream.Write( (byte) m.Followers );
			m_Stream.Write( (byte) m.FollowersMax );

			if ( Core.AOS )
			{
				m_Stream.Write( (short) m.FireResistance ); // Fire
				m_Stream.Write( (short) m.ColdResistance ); // Cold
				m_Stream.Write( (short) m.PoisonResistance ); // Poison
				m_Stream.Write( (short) m.EnergyResistance ); // Energy
				m_Stream.Write( (short) m.Luck ); // Luck

				IWeapon weapon = m.Weapon;

				int min = 0, max = 0;

				if ( weapon != null )
					weapon.GetStatusDamage( m, out min, out max );

				m_Stream.Write( (short) min ); // Damage min
				m_Stream.Write( (short) max ); // Damage max

				m_Stream.Write( (int) m.TithingPoints );
				
#region KR MobileStatus	
				if (m.NetState != null && m.NetState.IsKRClient)
				{
					m_Stream.Write( (short) m.AttackChance); // Hit Chance Increase 
					m_Stream.Write( (short) m.WeaponSpeed ); // Swing Speed Increase
					m_Stream.Write( (short) m.WeaponDamage ); // Damage Increase
					m_Stream.Write( (short) m.LowerRegCost ); // Lower Reagent Cost 
					m_Stream.Write( (short) m.RegenHits ); // Hit Points Regeneration 
					m_Stream.Write( (short) m.RegenStam ); // Stamina Regeneration 
					m_Stream.Write( (short) m.RegenMana ); // Mana Regeneration 
					m_Stream.Write( (short) m.ReflectPhysical ); // Reflect Physical Damage 
					m_Stream.Write( (short) m.EnhancePotions ); // Enhance Potions 
					m_Stream.Write( (short) m.DefendChance ); // Defense Chance Increase 
					m_Stream.Write( (short) m.SpellDamage ); // Spell Damage Increase 
					m_Stream.Write( (short) m.CastRecovery ); // Faster Cast Recovery 
					m_Stream.Write( (short) m.CastSpeed ); // Faster Casting 
					m_Stream.Write( (short) m.LowerManaCost ); // Lower Mana Cost 
					m_Stream.Write( (short) m.BonusStr ); // Strength Increase 
					m_Stream.Write( (short) m.BonusDex ); // Dexterity Increase 
					m_Stream.Write( (short) m.BonusInt ); // Intelligence Increase 
					m_Stream.Write( (short) m.BonusHits ); // Hit Points Increase 
					m_Stream.Write( (short) m.BonusStam ); // Stamina Increase 
					m_Stream.Write( (short) m.BonusMana ); // Mana Increase 
					m_Stream.Write( (short) m.MaxHitIncrease ); // Maximum Hit Points Increase 
					m_Stream.Write( (short) m.MaxStamIncrease ); // Maximum Stamina Increase 
					m_Stream.Write( (short) m.MaxManaIncrease  ); // Maximum Mana Increase 
				}
#endregion KR MobileStatus


			}
		}
	}
In Mobile.cs
After this:

Code: Alles auswählen

		public virtual int Luck
		{
			get { return 0; }
		}
Add this:

Code: Alles auswählen

		#region KR Status Mobile
		public virtual int AttackChance
		{
			get { return 0; }
		}
		public virtual int WeaponSpeed
		{
			get { return 0; }
		}
		public virtual int WeaponDamage
		{
			get { return 0; }
		}
		public virtual int LowerRegCost
		{
			get { return 0; }
		}
		public virtual int RegenHits
		{
			get { return 0; }
		}
		public virtual int RegenStam
		{
			get { return 0; }
		}
		public virtual int RegenMana
		{
			get { return 0; }
		}
		public virtual int ReflectPhysical
		{
			get { return 0; }
		}
		public virtual int EnhancePotions
		{
			get { return 0; }
		}
		public virtual int DefendChance
		{
			get { return 0; }
		}
		public virtual int SpellDamage
		{
			get { return 0; }
		}
		public virtual int CastRecovery
		{
			get { return 0; }
		}
		public virtual int CastSpeed
		{
			get { return 0; }
		}
		public virtual int LowerManaCost
		{
			get { return 0; }
		}
		public virtual int BonusStr
		{
			get { return 0; }
		}
		public virtual int BonusDex
		{
			get { return 0; }
		}
		public virtual int BonusInt
		{
			get { return 0; }
		}
		public virtual int BonusHits
		{
			get { return 0; }
		}
		public virtual int BonusStam
		{
			get { return 0; }
		}
		public virtual int BonusMana
		{
			get { return 0; }
		}
		public virtual int MaxHitIncrease 
		{
			get { return 0; }
		}
		public virtual int MaxStamIncrease
		{
			get { return 0; }
		}
		public virtual int MaxManaIncrease 
		{
			get { return 0; }
		}

		#endregion
In PlayerMobile.cs
After this:

Code: Alles auswählen

		public override int Luck{ get{ return AosAttributes.GetValue( this, AosAttribute.Luck ); } }
Add this:

Code: Alles auswählen

		#region KR Status
		public override int AttackChance	{ get{ return AosAttributes.GetValue( this, AosAttribute.AttackChance 	); } }
		public override int WeaponSpeed		{ get{ return AosAttributes.GetValue( this, AosAttribute.WeaponSpeed 	); } }
		public override int WeaponDamage	{ get{ return AosAttributes.GetValue( this, AosAttribute.WeaponDamage 	); } }
		public override int LowerRegCost	{ get{ return AosAttributes.GetValue( this, AosAttribute.LowerRegCost 	); } }
		public override int RegenHits		{ get{ return AosAttributes.GetValue( this, AosAttribute.RegenHits 	); } }
		public override int RegenStam		{ get{ return AosAttributes.GetValue( this, AosAttribute.RegenStam 	); } }
		public override int RegenMana		{ get{ return AosAttributes.GetValue( this, AosAttribute.RegenMana 	); } }
		public override int ReflectPhysical	{ get{ return AosAttributes.GetValue( this, AosAttribute.ReflectPhysical); } }
		public override int EnhancePotions	{ get{ return AosAttributes.GetValue( this, AosAttribute.EnhancePotions ); } }
		public override int DefendChance	{ get{ return AosAttributes.GetValue( this, AosAttribute.DefendChance 	); } }
		public override int SpellDamage		{ get{ return AosAttributes.GetValue( this, AosAttribute.SpellDamage 	); } }
		public override int CastRecovery	{ get{ return AosAttributes.GetValue( this, AosAttribute.CastRecovery 	); } }
		public override int CastSpeed		{ get{ return AosAttributes.GetValue( this, AosAttribute.CastSpeed 	); } }
		public override int LowerManaCost	{ get{ return AosAttributes.GetValue( this, AosAttribute.LowerManaCost 	); } }
		public override int BonusStr		{ get{ return AosAttributes.GetValue( this, AosAttribute.BonusStr 	); } }
		public override int BonusDex		{ get{ return AosAttributes.GetValue( this, AosAttribute.BonusDex 	); } }
		public override int BonusInt		{ get{ return AosAttributes.GetValue( this, AosAttribute.BonusInt 	); } }
		public override int BonusHits		{ get{ return AosAttributes.GetValue( this, AosAttribute.BonusHits 	); } }
		public override int BonusStam		{ get{ return AosAttributes.GetValue( this, AosAttribute.BonusStam 	); } }
		public override int BonusMana		{ get{ return AosAttributes.GetValue( this, AosAttribute.BonusMana 	); } }
		/*
		/Need to Set  MaxHitIncrease , MaxStamIncrease  , MaxManaIncrease 
		public override int MaxHitIncrease 	{ get{ return 0; } }
		public override int MaxStamIncrease	{ get{ return 0; } }
		public override int MaxManaIncrease	{ get{ return 0; } }
		*/
	
		#endregion
In PacketHandlers.cs

Code: Alles auswählen

	#region Equip Unequip Macro
        public static void EquipMacro(NetState ns, PacketReader pvSrc)
        {

           	 	int length = pvSrc.Size;
			int count = pvSrc.ReadByte();
			List<int> serialList = new List<int>( count );

			for ( int i = 0; i < count; ++i )
			{
				Serial s = pvSrc.ReadInt32();
				serialList.Add( s );

			}

		EquipMacroEventArgs e = new EquipMacroEventArgs( ns, serialList );
            	EventSink.InvokeEquipMacro( e );

        }
        public static void UnequipMacro(NetState ns, PacketReader pvSrc)
        {

           	 	int length = pvSrc.Size;
			int count = pvSrc.ReadByte();
			List<int> layers = new List<int>( count );

			for ( int i = 0; i < count; ++i )
			{
				int s = pvSrc.ReadInt16();
				layers.Add( s );

			}

		UnequipMacroEventArgs e = new UnequipMacroEventArgs( ns, layers );
            	EventSink.InvokeUnequipMacro( e );

        }
	#endregion  Equip Unequip Macro
        public static void CharacterListUpdatrKR(NetState ns, PacketReader pvSrc)
        {

           	 	int length = pvSrc.Size;
			int awlays1 = pvSrc.ReadInt16();
			int clientflags = pvSrc.ReadInt16(); //aways 02


        }
	#region Target By Resource Macro
        public static void TargetByResourceMacro(NetState ns, PacketReader pvSrc)
        {

           	 	int length = pvSrc.Size;
			int Command = pvSrc.ReadInt16();
			Serial serial = pvSrc.ReadInt32();
			int resourcetype = pvSrc.ReadInt16(); //aways 02
            		if (serial.IsItem)
			{
				TargetByResourceMacroEventArgs e = new TargetByResourceMacroEventArgs( ns, World.FindItem(serial), resourcetype );
				EventSink.InvokeTargetByResourceMacro( e );
			}


        }
	#endregion Target By Resource Macro
Now Grid System:

In PacketHandlers.cs *
Change

Code: Alles auswählen

DropReq6017
to

Code: Alles auswählen

		public static void DropReq6017( NetState state, PacketReader pvSrc )
		{
			Serial m_item = pvSrc.ReadInt32(); // serial, ignored
			int x = pvSrc.ReadInt16();
			int y = pvSrc.ReadInt16();
			int z = pvSrc.ReadSByte();
			int GridLocation = pvSrc.ReadByte(); // Grid Location?

			Serial dest = pvSrc.ReadInt32();

			Point3D loc = new Point3D( x, y, z );

			Mobile from = state.Mobile;

			if ( dest.IsMobile )
				from.Drop( World.FindMobile( dest ), loc );
			else if ( dest.IsItem )
			{
					
					if (World.FindItem( dest ) is Container)
					{
						Container m_container = World.FindItem( dest ) as Container;
						Item[] items = m_container.FindItemsByType( typeof(Item) );
						bool candropgrid = true;
						foreach ( Item itemdropon in items )
						{ 
							if(itemdropon.GridLocation == GridLocation && itemdropon.Parent!=null && itemdropon.Parent == m_container)
							{
								candropgrid = false;
								break;
							}
						}
						if ( candropgrid )  
							World.FindItem( m_item ).GridLocation = GridLocation;
						else
						{

							bool m_sadd = true;
							for (int i=0;i<=items.Length; i++)
							{
								foreach ( Item itemdropon in items )
								{ 
									if(itemdropon.GridLocation == i && itemdropon.Parent!=null  && itemdropon.Parent == m_container)
									{	
										m_sadd = false;
									}
								}
								if ( m_sadd )  
								{
									World.FindItem( m_item ).GridLocation = i;
									break;
								}
								if ( i!=items.Length )
									m_sadd = true;
							}
							if(!m_sadd && (items.Length < 125))
								World.FindItem( m_item ).GridLocation = items.Length;
						}
					}
					
					//World.FindItem( m_item ).GridLocation = GridLocation;
					from.Drop( World.FindItem( dest ), loc );
			}
			else
				from.Drop( loc );
			if(state!=null)
				state.Send(new KRDropConfirm());
		}
ContainerContent6017 Fix*

Code: Alles auswählen

	public sealed class ContainerContent6017 : Packet
	{
		public ContainerContent6017( Mobile beholder, Item beheld ) : base( 0x3C )
		{
			List<Item> items = beheld.Items;
			int count = items.Count;

			this.EnsureCapacity( 5 + (count * 20) );

			long pos = m_Stream.Position;

			int written = 0;

			m_Stream.Write( (ushort) 0 );

			for ( int i = 0; i <count> 0x3FFF )
						cid = 0x9D7;

					m_Stream.Write( (int) child.Serial );
					m_Stream.Write( (ushort) cid );
					m_Stream.Write( (byte) 0 ); // signed, itemID offset
					m_Stream.Write( (ushort) child.Amount );
					m_Stream.Write( (short) loc.m_X );
					m_Stream.Write( (short) loc.m_Y );
					m_Stream.Write( (byte) child.GridLocation ); // Grid Location?
					m_Stream.Write( (int) beheld.Serial );
					m_Stream.Write( (ushort) child.Hue );

					++written;
				}
			}

			m_Stream.Seek( pos, SeekOrigin.Begin );
			m_Stream.Write( (ushort) written );
		}
	}
In Container.cs

Code: Alles auswählen

		public virtual bool OnDragDropInto( Mobile from, Item item, Point3D p )
		{
			if ( !CheckHold( from, item, true, true ) )
				return false;

			item.Location = new Point3D( p.m_X, p.m_Y, 0 );
			#region griding
			if ( item.GridLocation == 0 )
			{
				Item[] items = this.FindItemsByType( typeof( Item ) );
				int grid = 0;
				for (int i=0;i<=items.Length; i++)
				{
					foreach ( Item itemdropon in items )
					{ 
						if(itemdropon.GridLocation == i && itemdropon.Parent!=null && itemdropon.Parent == this)
						{
							grid++;	
						}
					}
					if ( grid == 0 )  
					{
						item.GridLocation = i;
						break;
					}
					if ( i!=items.Length )
						grid = 0;
					else
						item.GridLocation = items.Length;
				}
			}
			#endregion
			AddItem( item );

			from.SendSound( GetDroppedSound( item ), GetWorldLocation() );

			return true;
		}

Code: Alles auswählen

		public virtual void DropItem( Item dropped )
		{
			if ( dropped == null )
				return;
			#region griding
			if ( dropped.GridLocation == 0 )
			{
				Item[] items = this.FindItemsByType( typeof( Item ) );
				int grid = 0;
				for (int i=0;i<items>= ourBounds.Width )
				x = (ourBounds.Width - bounds.Width) / 2;
			else
				x = Utility.Random( ourBounds.Width - bounds.Width );

			if ( bounds.Height >= ourBounds.Height )
				y = (ourBounds.Height - bounds.Height) / 2;
			else
				y = Utility.Random( ourBounds.Height - bounds.Height );

			x += ourBounds.X;
			x -= bounds.X;

			y += ourBounds.Y;
			y -= bounds.Y;

			dropped.Location = new Point3D( x, y, 0 );
		}
Script for some Packets:
In PlayerMobile.cs
After this:

Code: Alles auswählen

		public static void Initialize()
		{
			if ( FastwalkPrevention )
			{
				PacketHandler ph = PacketHandlers.GetHandler( 0x02 );

				ph.ThrottleCallback = new ThrottlePacketCallback( MovementThrottle_Callback );
			}

			EventSink.Login += new LoginEventHandler( OnLogin );
			EventSink.Logout += new LogoutEventHandler( OnLogout );
			EventSink.Connected += new ConnectedEventHandler( EventSink_Connected );
			EventSink.Disconnected += new DisconnectedEventHandler( EventSink_Disconnected );
Add this:

Code: Alles auswählen

#region Hot bar KR
			EventSink.TargetedSkillUse += new TargetedSkillEventHandler( Targeted_Skill );
			EventSink.TargetedItemUse += new TargetedItemUseEventHandler( Targeted_Item );
#endregion
#region Equip Macro
			EventSink.EquipMacro += new  EquipMacroEventHandler( Equip_Macro );
			EventSink.UnequipMacro += new  UnequipMacroEventHandler( Unequip_Macro );
		}
		private static void Unequip_Macro( UnequipMacroEventArgs e )
		{
			try{
			
				if(e.NetState!=null && e.NetState.Mobile!=null && e.List!=null)
				{
					for( int i = 0; i < e.List.Count; ++i )
					{
						//Layer layer = Layer.GetAt( e.List[i] );
						Item item = e.NetState.Mobile.FindItemOnLayer(  (Layer)( e.List[i] ) );
					
						if( item != null && item.Layer!=Layer.Hair && item.Layer!=Layer.FacialHair)
							e.NetState.Mobile.Backpack.DropItem( item );

					}
				}	
			}
			catch{}
		}
		private static void Equip_Macro( EquipMacroEventArgs e )
		{
			try{
			
				if(e.NetState!=null && e.NetState.Mobile!=null && e.List!=null)
				{
					for( int i = 0; i < e.List.Count; ++i )
					{
						//Item item = World.FindItem( e.List[i] );
						Item item = World.FindItem( e.List[i] );
						if(item!=null && item.IsChildOf( e.NetState.Mobile ) )
							e.NetState.Mobile.EquipItem( item );
					}
				}
			}
			catch{}
		}
#endregion
#region Hot bar KR
		private static void Targeted_Item( TargetedItemUseEventArgs e )
		{
			try{
					Item from = World.FindItem( e.Source.Serial );
					Mobile to = World.FindMobile( e.Target.Serial );
					Item toI = World.FindItem( e.Target.Serial );
			
					if (from != null )
					{
						if( to!=null)
						{
							e.NetState.Mobile.TargetLocked = true;
							e.NetState.Mobile.Use( from );
							e.NetState.Mobile.Target.Invoke( e.NetState.Mobile, to );
							e.NetState.Mobile.TargetLocked = false;
						}
						else if ( toI!=null )
						{
							e.NetState.Mobile.TargetLocked = true;
							e.NetState.Mobile.Use( from );
							e.NetState.Mobile.Target.Invoke( e.NetState.Mobile, toI );
							e.NetState.Mobile.TargetLocked = false;
						}
					}
			}
			catch{}
		}
		private static void Targeted_Skill( TargetedSkillEventArgs e )
		{
			try{

				Mobile from = e.NetState.Mobile;
				int SkillId = e.SkillId;
				Mobile to = World.FindMobile( e.Target.Serial );
				Item toI = World.FindItem( e.Target.Serial );



				if(to!= null )
				{
					from.TargetLocked = true;

					if ( from.UseSkill( e.SkillId ) )
						from.Target.Invoke( from, to );
					from.TargetLocked = false;
				}
				else if(toI!= null )
				{
					from.TargetLocked = true;

					if ( from.UseSkill( e.SkillId ) )
						from.Target.Invoke( from, toI );
					from.TargetLocked = false;
				}
			}
			catch{}

		}
#endregion
in public override void Resurrect()

Code: Alles auswählen


#region KR Way Points
			if( this.NetState!=null && this.NetState.IsKRClient )
			{
				if(this.Corpse!=null)
					this.NetState.Send( new DisplayWaypoint( this.Corpse.Serial, this.Corpse.X , this.Corpse.Y ,this.Corpse.Z , this.Corpse.Map.MapID, 1, this.Name ) );

				if(m_healers!=null)
				{

					foreach ( BaseHealer healer in m_healers )
						this.NetState.Send( new HideWaypoint( healer.Serial ) );
					m_healers.Clear();

				}
// if you use ML script from Runuo
				ArrayList m_questers = new ArrayList();
				foreach ( Mobile m_mobile in World.Mobiles.Values )
				{ 
					if ( m_mobile is MondainQuester )
						m_questers.Add( m_mobile );

				}
				foreach ( MondainQuester quester in m_questers )
				{

						string name = "";
						if(quester.Name!=null)
							name += quester.Name;
						if(quester.Title!=null)
							name += " "+quester.Title;
						this.Send( new DisplayWaypoint( quester.Serial, quester.X , quester.Y ,quester.Z , quester.Map.MapID,4, name ) );

				}
			}
#endregion KR Way Points
in public override void OnDeath( Container c )
Add this:

Code: Alles auswählen

#region KR Way Points
			if( this.NetState!=null && this.NetState.IsKRClient )
			{

				foreach ( Mobile m_mobile in World.Mobiles.Values )
				{ 
 					if ( m_mobile is BaseHealer )
					{
						if(this.Kills < 5 )
							m_healers.Add( m_mobile );
						else if(m_mobile is EvilHealer || m_mobile is  EvilWanderingHealer)
							m_healers.Add( m_mobile );
					}

				}
				foreach ( BaseHealer healer in m_healers )
				{

					string name = "";
					if(healer.Name!=null)
						name += healer.Name;
					if(healer.Title!=null)
					name += " "+healer.Title;
					this.NetState.Send( new DisplayWaypoint( healer.Serial, healer.X , healer.Y ,healer.Z , healer.Map.MapID, 6, name ) );

				}
				ArrayList m_questers = new ArrayList();
				foreach ( Mobile m_mobile in World.Mobiles.Values )
				{ 
					if ( m_mobile is MondainQuester )
						m_questers.Add( m_mobile );

				}
				foreach ( MondainQuester quester in m_questers )
					this.NetState.Send( new HideWaypoint( quester.Serial ) );


				if(this.Corpse!=null )
					this.NetState.Send( new HideWaypoint( this.Corpse.Serial ) );
			}
#endregion KR Way Points
In protected override bool OnMove( Direction d )
Add this:

Code: Alles auswählen

			#endregion


#region KR Way Points
				if(this.Party is Party)
				{
					Party party = this.Party as Party;	
			
					if ( party != null )
					{
				
						foreach( PartyMemberInfo info in party.Members )
						{
							Mobile m = info.Mobile;
							if( m.NetState!=null && m.NetState.IsKRClient && m!=this)
								m.NetState.Send( new DisplayWaypoint( this.Serial, this.X , this.Y , this.Z , this.Map.MapID, 2, this.Name ) );
						}
					}
				}
#endregion KR Way Points
In Party.cs
In public void Add( Mobile m )
After this:

Code: Alles auswählen

 						f.Send( new MobileStatusCompact( m.CanBeRenamedBy( f ), m ) );
						f.Send( attrs );
						m.Send( new MobileStatusCompact( f.CanBeRenamedBy( m ), f ) );
						m.Send( new MobileAttributesN( f ) );
Add this:

Code: Alles auswählen

#region KR Way Points

						for ( int i2 = 0; i2 < m_Members.Count; ++i2 )
						{
							Mobile f2 = ((PartyMemberInfo)m_Members[i2]).Mobile;
							if( f2.NetState!=null && f2.NetState.IsKRClient )
								f2.NetState.Send( new DisplayWaypoint( f.Serial, f.X , f.Y , f.Z , f.Map.MapID, 2, f.Name ) );
						}
#endregion KR Way Points
Change public void Remove( Mobile m )
To this:

Code: Alles auswählen

		public void Remove( Mobile m )
		{
			if ( m == m_Leader )
			{
#region KR Way Points
					for ( int i = 0; i < m_Members.Count; ++i )
					{
						Mobile f =((PartyMemberInfo)m_Members[i]).Mobile;
						SendToAll( new HideWaypoint( f.Serial )  );
					}
#endregion KR Way Points

				Disband();
			}
			else
			{
				for ( int i = 0; i < m_Members.Count; ++i )
				{
					if ( ((PartyMemberInfo)m_Members[i]).Mobile == m )
					{
						//Mobile f =((PartyMemberInfo)m_Members[i]).Mobile;

						m_Members.RemoveAt( i );

						m.Party = null;
						m.Send( new PartyEmptyList( m ) );

						m.SendLocalizedMessage( 1005451 ); // You have been removed from the party.

						SendToAll( new PartyRemoveMember( m, this ) );
						SendToAll( 1005452 ); // A player has been removed from your party.
#region KR Way Points
						SendToAll( new HideWaypoint( m.Serial )  );
#endregion KR Way Points

						break;
					}
				}

				if ( m_Members.Count == 1 )
				{
					SendToAll( 1005450 ); // The last person has left the party...
					Disband();
				}
			}
		}

In SpellBook.cs
After this:

Code: Alles auswählen

		public static void Initialize()
		{
			EventSink.OpenSpellbookRequest += new OpenSpellbookRequestEventHandler( EventSink_OpenSpellbookRequest );
			EventSink.CastSpellRequest += new CastSpellRequestEventHandler( EventSink_CastSpellRequest );

			CommandSystem.Register( "AllSpells", AccessLevel.GameMaster, new CommandEventHandler( AllSpells_OnCommand ) );
Add this:

Code: Alles auswählen

#region Hot bar KR
			EventSink.TargetedSpellCast += new TargetedSpellEventHandler( Targeted_Spell );
#endregion

		}


		private static void Targeted_Spell( TargetedSpellEventArgs e )
		{
			try{
				Mobile from = e.NetState.Mobile;
				int spellID = e.SpellID;



				if ( !Multis.DesignContext.Check( from ) )
					return; // They are customizing


					SpecialMove move = SpellRegistry.GetSpecialMove( spellID );

					if ( move != null )
					{
						SpecialMove.SetCurrentMove( from, move );
					}
					else
					{
						if(e.NetState.Mobile is PlayerMobile)
						{
							PlayerMobile m_player = e.NetState.Mobile as PlayerMobile;
							//m_player.TargetSerial = e.Target.Serial;


							Spell spell = SpellRegistry.NewSpell( spellID, from, null );
	
							if ( spell != null )
							{
								e.NetState.Mobile.TargetLocked = true;
								spell.Cast(e.Target.Serial);
			
							}
							else
									from.SendLocalizedMessage( 502345 ); // This spell has been temporarily disabled.
						}
					}
			}
			catch{}

			
		}

If you use ML script from runuo.
in LoginStats.cs
add this:

Code: Alles auswählen

			ArrayList m_questers = new ArrayList();
			foreach ( Mobile m_mobile in World.Mobiles.Values )
			{ 
				if ( m_mobile is MondainQuester )
					m_questers.Add( m_mobile );

			}
			foreach ( MondainQuester quester in m_questers )
			{


				if ( args.Mobile.NetState!= null )
				{
					string name = "";
					if(quester.Name!=null)
						name += quester.Name;
					if(quester.Title!=null)
					name += " "+quester.Title;
				args.Mobile.NetState.Send( new DisplayWaypoint( quester.Serial, quester.X , quester.Y ,quester.Z , quester.Map.MapID,4, name ) );
				}

			}
Zuletzt geändert von TheUndisputed am 05 Mär 2008 20:27, insgesamt 5-mal geändert.

Aka

#2 Beitrag von Aka » 03 Mär 2008 16:25

Well, really thnk u ;)

A lil note:

In public virtual void Deserialize( GenericReader reader )
This:
byte hairflag = 0x00;

if( m_Hair != null )
hairflag |= 0x01;
if( m_FacialHair != null )
hairflag |= 0x02;

writer.Write( (byte)hairflag );

if( (hairflag & 0x01) != 0 )
m_Hair.Serialize( writer );
if( (hairflag & 0x02) != 0 )
m_FacialHair.Serialize( writer );


maybe u mean Serialize ;)

Kons

#3 Beitrag von Kons » 04 Mär 2008 01:17

Ty man ;)

TheUndisputed

#4 Beitrag von TheUndisputed » 04 Mär 2008 10:20

Aka
yes
this is one script for face:
in CharacterCreation.cs
in private static void EventSink_CharacterCreated( CharacterCreatedEventArgs args )

need to add:

Code: Alles auswählen

			newChar.FaceItemID = args.FaceID;
			newChar.FaceHue = args.FaceHue;
May i miss some code , but i have customizated server and it`s big mess.
:)

Kons

#5 Beitrag von Kons » 04 Mär 2008 12:21

First error is : GridLocation not defined in Server.Item :P

Kons

#6 Beitrag von Kons » 04 Mär 2008 13:13

after that :

Code: Alles auswählen

for (int i=0;i<items>= ourBounds.Width )
					x = (ourBounds.Width - bounds.Width) / 2;
in container.cs

in DropReq6017
cid, m_stream, item do not exist

mhh if other i'll see later :)

TheUndisputed

#7 Beitrag von TheUndisputed » 04 Mär 2008 21:56

In Item.cs
After this:

Code: Alles auswählen

		[CommandProperty( AccessLevel.GameMaster )]
		public Direction Direction
		{
			get
			{
				return m_Direction;
			}
			set
			{
				if ( m_Direction != value )
				{
					m_Direction = value;
					Packet.Release( ref m_WorldPacket );

					Delta( ItemDelta.Update );
				}
			}
		}
Add this:

Code: Alles auswählen

		#region Griding
		private int m_Gird; 
		[CommandProperty( AccessLevel.GameMaster )]
		public int GridLocation
		{
			get
			{
				return m_Gird;
			}
			set
			{
				if(value >=0 && value < 126)
					m_Gird = value;
			}
		}
		#endregion
In Deserialize

Code: Alles auswählen

				case 10:
				{
					m_Gird = reader.ReadEncodedInt();
					goto case 9;
				}
				case 9:
In Serialize

Code: Alles auswählen

			writer.Write( 10 ); // version

			writer.WriteEncodedInt( m_Gird );

koomaluola

#8 Beitrag von koomaluola » 04 Mär 2008 23:41

Kons hat geschrieben:after that :

Code: Alles auswählen

for (int i=0;i<items>= ourBounds.Width )
					x = (ourBounds.Width - bounds.Width) / 2;
in container.cs

in DropReq6017
cid, m_stream, item do not exist

mhh if other i'll see later :)
Same errors to me.

in PacketHandlers.cs

error CS0103: The name 'm_Stream' does not exist in the current context
error CS0103: The name 'item' does not exist in the current context
......

TheUndisputed

#9 Beitrag von TheUndisputed » 05 Mär 2008 00:45

DropReq6017 is in Packets.cs my bad.

Some other scripts:
In NetState.cs
in public bool SupportsExpansion
Change this:

Code: Alles auswählen

			if ( info.RequiredClient != null )
				return ( this.Version >= info.RequiredClient );
To this:

Code: Alles auswählen

			if ( info.RequiredClient != null )
				return ( IsKRClient || this.Version >= info.RequiredClient );
(need for animations)
Change public bool IsPost6017 to:

Code: Alles auswählen

		public bool IsPost6017 {
			get { 
				if ( m_Post6017 || m_KRClient )
					return true;
				else
					return false;
				//return m_Post6017; 
				//return m_KRClient;
			}
		}
In PacketHandlers.cs
After this:

Code: Alles auswählen

		public static void EquipReq( NetState state, PacketReader pvSrc )
		{
			Mobile from = state.Mobile;
Add this:

Code: Alles auswählen

			if (from.NetState!=null && from.NetState.IsKRClient)
				from.NetState.Send(new KRDropConfirm());
For correct loging:
Change this:

Code: Alles auswählen

		private class LoginTimer : Timer
		{

			private NetState m_State;
			private Mobile m_Mobile;

			public LoginTimer( NetState state, Mobile m ) : base( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ) )
			{
				m_State = state;
				m_Mobile = m;
			}

			protected override void OnTick()
			{
				if ( m_State == null )
					Stop();
				if ( m_State.Version != null )
				{
					m_State.BlockAllPackets = false;
					DoLogin( m_State, m_Mobile );
					Stop();
				}
			}
		}
To this:

Code: Alles auswählen

		private class LoginTimer : Timer
		{

			private NetState m_State;
			private Mobile m_Mobile;

			public LoginTimer( NetState state, Mobile m ) : base( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ) )
			{
				m_State = state;
				m_Mobile = m;
			}

			protected override void OnTick()
			{
				if ( m_State == null )
					Stop();
				if ( m_State.Version != null || m_State.IsKRClient)
				{
					m_State.BlockAllPackets = false;
					DoLogin( m_State, m_Mobile );
					Stop();
				}
			}
		}

koomaluola

#10 Beitrag von koomaluola » 05 Mär 2008 01:31

Actually DropReq6017 is in PacketHandlers.cs

But all m_Stream stuff is in Packets.cs

That DropReq6017 code is just not right.
Zuletzt geändert von koomaluola am 05 Mär 2008 03:33, insgesamt 1-mal geändert.

koomaluola

#11 Beitrag von koomaluola » 05 Mär 2008 02:42

for (int i=0;i<items>= ourBounds.Width )

for ( int i = 0; i <count> 0x3FFF )

Hows that in container.cs and other in packets.cs suppose to work?

Gives error
; expected

Could you post your packets.cs container.cs and packethandlers.cs here?



if you change
m_Stream.Write((byte)0);
to
m_Stream.Write((byte)i);

in packets.cs in ContainerContent6017 fucntion it shows your container items right.

Kons

#12 Beitrag von Kons » 05 Mär 2008 10:26

what kind of implementator are supposed to use those for?

Code: Alles auswählen

for (int i=0;i<items>= ourBounds.Width ) 
            x = (ourBounds.Width - bounds.Width) / 2;
u forgot ;i++ o_O

second problem, there should be some function like "items.numberofitems" in condition as
int i=0;i<items>= ourBounds.Width

TheUndisputed

#13 Beitrag von TheUndisputed » 05 Mär 2008 17:33

Code: Alles auswählen

		public static void DropReq6017( NetState state, PacketReader pvSrc )
		{
			Serial m_item = pvSrc.ReadInt32(); // serial, ignored
			int x = pvSrc.ReadInt16();
			int y = pvSrc.ReadInt16();
			int z = pvSrc.ReadSByte();
			int GridLocation = pvSrc.ReadByte(); // Grid Location?

			Serial dest = pvSrc.ReadInt32();

			Point3D loc = new Point3D( x, y, z );

			Mobile from = state.Mobile;

			if ( dest.IsMobile )
				from.Drop( World.FindMobile( dest ), loc );
			else if ( dest.IsItem )
			{
					
					if (World.FindItem( dest ) is Container)
					{
						Container m_container = World.FindItem( dest ) as Container;
						Item[] items = m_container.FindItemsByType( typeof(Item) );
						bool candropgrid = true;
						foreach ( Item itemdropon in items )
						{ 
							if(itemdropon.GridLocation == GridLocation && itemdropon.Parent!=null && itemdropon.Parent == m_container)
							{
								candropgrid = false;
								break;
							}
						}
						if ( candropgrid )  
							World.FindItem( m_item ).GridLocation = GridLocation;
						else
						{

							bool m_sadd = true;
							for (int i=0;i<=items.Length; i++)
							{
								foreach ( Item itemdropon in items )
								{ 
									if(itemdropon.GridLocation == i && itemdropon.Parent!=null  && itemdropon.Parent == m_container)
									{	
										m_sadd = false;
									}
								}
								if ( m_sadd )  
								{
									World.FindItem( m_item ).GridLocation = i;
									break;
								}
								if ( i!=items.Length )
									m_sadd = true;
							}
							if(!m_sadd && (items.Length < 125))
								World.FindItem( m_item ).GridLocation = items.Length;
						}
					}
					
					//World.FindItem( m_item ).GridLocation = GridLocation;
					from.Drop( World.FindItem( dest ), loc );
			}
			else
				from.Drop( loc );
			if(state!=null)
				state.Send(new KRDropConfirm());
		}
I don`t know why i post in first variant.

koomaluola

#14 Beitrag von koomaluola » 05 Mär 2008 17:47

What about ContainerContent6017 ?
same thing there.

Kons

#15 Beitrag von Kons » 05 Mär 2008 19:34

Ok i managed to compile Server, now i got many errors in compiling scripts :) let's see..

Antworten