RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Basic ML & Elf functionality

RavonTUS

Sorceror
Greetings,

Thank you Arul, for this information. After several hours of doing this and that, experimenting and fixing my own typos, I did get this to work. It was quite fun "hacking" the source code.

-Ravon
 

PappaSmurf

Knight
Now I'm curious

I've mad ethe modifications recompiled the core but it's not aviable for a Pre AOS server...if I moved the additional flags to be read prior to the check for AOS and SE clients being inabled would that allow it to work for Pre AOS Shards?
 

jaynigs

Wanderer
Saved me some time, Thanks..

ive been trying to find the Character Race Changer from the client, i did all the quests on osi and that gump popped up, its very similiar to the one on character creation, you can select body color and hair style, now i had spy uo running when i did this on osi, but it didnt recognise any gumps, so i assume it is built in the client, anywhere know where it is? and how to call it?

On an additional note, ive tried to recreate this "gump" with gump studio, but i cannot seem to figure out how to do pulldown selection menus just like in character creation, and also the hue selection.

Any help appreciated, thanks..

Jay
 
I did the mods but I'm getting this:
RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (3 errors, 0 warnings)
- Error: Scripts\Misc\CharacterCreation.cs: CS0117: (line 629, column 8) 'Serve
r.CharacterCreatedEventArgs' does not contain a definition for 'Elf'
- Error: Scripts\Misc\CharacterCreation.cs: CS0117: (line 638, column 63) 'Serv
er.CharacterCreatedEventArgs' does not contain a definition for 'Elf'
- Error: Scripts\Misc\CharacterCreation.cs: CS0117: (line 668, column 90) 'Serv
er.CharacterCreatedEventArgs' does not contain a definition for 'Elf'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

I check my input, and it looks right. What can it be?
 

arul

Sorceror
jaynigs said:
Saved me some time, Thanks..

ive been trying to find the Character Race Changer from the client, i did all the quests on osi and that gump popped up, its very similiar to the one on character creation, you can select body color and hair style, now i had spy uo running when i did this on osi, but it didnt recognise any gumps, so i assume it is built in the client, anywhere know where it is? and how to call it?

On an additional note, ive tried to recreate this "gump" with gump studio, but i cannot seem to figure out how to do pulldown selection menus just like in character creation, and also the hue selection.

Any help appreciated, thanks..

Jay
Regrettably I don't have a ML account on OSI so I cannot do the final step of the heritage.
I'd suggest you one thing, change the packet filter to show every incoming packet and there should be something new.
Most likely it will be sub-command of the extended command packet ( 0xBF ).
 

arul

Sorceror
FreeshardNoob said:
I did the mods but I'm getting this:


I check my input, and it looks right. What can it be?

You didn't do everything I said. Look at the step 6 again please.
 

jaynigs

Wanderer
arul said:
Regrettably I don't have a ML account on OSI so I cannot do the final step of the heritage.
I'd suggest you one thing, change the packet filter to show every incoming packet and there should be something new.
Most likely it will be sub-command of the extended command packet ( 0xBF ).


Hmm, you could be right, ive not clicked accept yet so i can keep getting that gump back..

Here is some code packet receive BF

0000: BF 07 00 00 2A 00 FF -- -- -- -- -- -- -- -- -- ....*..

I guess this is the packet

Now gotta work out what to do with it lol
 

arul

Sorceror
This doesn't seem to be the correct one, try it multiple times and there should be some repetition of the one packet. Trial&error :)
 

jaynigs

Wanderer
arul said:
This doesn't seem to be the correct one, try it multiple times and there should be some repetition of the one packet. Trial&error :)


Ok did it 3 times and looked for 3 repititions.


Packet - 0000: BF 07 00 00 2A 00 02


Hope its right this time :D
 

jaynigs

Wanderer
i edited my post above earlier, that one appears the instant i click for the gump to appear.

Ive not even touched the stats in game
 

arul

Sorceror
Server sends:
Code:
BYTE 0xBF
WORD Length ( 7 )
WORD Subcommand - 0x2A
BYTE Gender ( 0 = male, 1 = female )
BYTE Race ( 1 = human, 2 = elf )

Client response:
Code:
BYTE 0xBF - subcommand
WORD Length ( 15 )
WORD Subcommand - 0x2A
WORD BodyHue
WORD HairId
WORD HairHue
WORD BeardId
WORD BeardHue
 

arul

Sorceror
So, here is the code.
If you want to use it, you have to add boolean Elf property to the Mobile class and, of course, remove the command and send the packet after clicking the "do you really want to..." gump.

Code:
using System;
using Server.Items;

namespace Server.Network
{
    public sealed class ChangeRace : Packet
    {
        public static void Initialize()
        {
            Commands.Register("Race", AccessLevel.Player, new CommandEventHandler(OnCommand));
            PacketHandlers.RegisterExtended(0x2A, true, new OnPacketReceive(Change));
        }

        private static void Change( NetState state, PacketReader pvSrc )
        {
            short bodyHue  = pvSrc.ReadInt16();
            short hairId   = pvSrc.ReadInt16();
            short hairHue  = pvSrc.ReadInt16();
            short beardId  = pvSrc.ReadInt16();
            short beardHue = pvSrc.ReadInt16();

            if ( ( bodyHue
                | hairId
                | hairHue
                | beardId
                | beardHue )
                    == 0 ) return;

            Mobile sender     = state.Mobile;

            Item currentHair  = sender.FindItemOnLayer( Layer.Hair );
            Item currentBeard = sender.FindItemOnLayer( Layer.FacialHair );

            if ( currentBeard != null ) currentBeard.Delete();
            if ( currentHair  != null ) currentHair.Delete();

            sender.Body     = sender.Female ? ( sender.Elf ? 0x191 : 0x25E ) : ( sender.Elf ? 0x190 : 0x25D );
            sender.Hue      = bodyHue;
            sender.Elf      ^= true;

            sender.AddItem( Hair.CreateByID( hairId, hairHue ) );

            if ( !sender.Female && !sender.Elf ) sender.AddItem( Beard.CreateByID( beardId, beardHue ) );
        }

        public static void OnCommand(CommandEventArgs e)
        {
            Mobile m = e.Mobile;

            if (m != null)
            {
                m.Send(new ChangeRace( (byte)(m.Female ? 1 : 0), (byte)(m.Elf ? 1 : 2)));
            }
        }

        public ChangeRace(byte gender, byte race)
            : base(0xBF)
        {
            EnsureCapacity(7);

            m_Stream.Write( (short) 0x2A     );
            m_Stream.Write( (byte)  gender   );
            m_Stream.Write( (byte)  race     );
        }
    }
}
 

jaynigs

Wanderer
Great work! i applaud your efforts :)

Maybe the dev team could use your talents.

I just wanted to add that the race change gump should timeout after 60 seconds, and also when closed it says..

Cliloc = 1073645 // You may try this again later...

This message appears for both cases.

Also on changing to elf you receive this message - 1073653 // You are now fully initiated into the Elven culture.

Just wanted to let you know for osi correctness.

Regards!

jay
 
arul said:
You didn't do everything I said. Look at the step 6 again please.

Arul I double check it and this is what I have.
Code:
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, m_Elf;
		private int m_Hue;
		private int m_Str, m_Dex, m_Int;
		private int m_Profession;
		private Mobile m_Mobile;

		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 bool Elf { get { return m_Elf; } }
		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 CharacterCreatedEventArgs( NetState state, IAccount a, string name, bool female, bool elf, 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 )
		{
			m_State = state;
			m_Account = a;
			m_Name = name;
			m_Female = female;
	m_Elf = elf;
			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;
		}
	}

This part I do have correct right?
 

jaynigs

Wanderer
yes that part is fine, the problem sounds like you havent recompiled the core, or you have and forgot to copy the server.exe to your server directory.
 
Top