public void SetGroupInitWork(Socket sender, byte[] data)
        {
            byte groupSequence = data[0x10];

            if (groupSequence == 0x01)
            {
                PartyGroup.InitWork(sender);
            }
            else
            {
                RetainerGroup.InitWork(sender);
            }
        }
        public void Setup(byte[] data)
        {
            //Character ID
            Id    = NewId();
            IsNew = true;

            ClassPath = "/Chara/Player/Player_work";

            State.Type = MainStateType.Player;

            //speeds
            Speeds.Walking = ActorSpeed.Walking; //Walking speed
            Speeds.Running = ActorSpeed.Running; // 0x40a00000;  //Running speed
            Speeds.Active  = ActorSpeed.Active;  //Acive

            //prepare packet info for decoding
            byte[] info = new byte[0x90];
            Buffer.BlockCopy(data, 0x30, info, 0, info.Length);
            string tmp = Encoding.ASCII.GetString(info).Trim(new[] { '\0' }).Replace('-', '+').Replace('_', '/');

            //decoded packet info
            data = Convert.FromBase64String(tmp);

            //General
            Appearance.Size  = data[0x09];
            Appearance.Voice = data[0x26];
            SkinColor        = (ushort)(data[0x23] >> 8 | data[0x22]);

            //Head
            HairStyle          = (ushort)(data[0x0b] >> 8 | data[0x0a]);
            HairColor          = (ushort)(data[0x1d] >> 8 | data[0x1c]);
            HairHighlightColor = data[0x0c];
            HairVariation      = data[0x0d];
            EyeColor           = (ushort)(data[0x25] >> 8 | data[0x24]);

            //Face
            Face = new Face
            {
                Characteristics      = data[0x0f],
                CharacteristicsColor = data[0x10],
                Type     = data[0x0e],
                Ears     = data[0x1b],
                Mouth    = data[0x1a],
                Features = data[0x19],
                Nose     = data[0x18],
                EyeShape = data[0x17],
                IrisSize = data[0x16],
                EyeBrows = data[0x15],
                Unknown  = 0
            };

            //Background
            Guardian    = data[0x27];
            BirthMonth  = data[0x28];
            BirthDay    = data[0x29];
            InitialTown = data[0x48];
            Tribe       = data[0x08];
            GetBaseModel(Tribe);
            GeneralParameters = GeneralParameter.Get(Tribe);

            //Starting class
            CurrentClassId                 = data[0x2a];
            Jobs[CurrentClassId].Level     = 1;    //having a class level > 0 makes it active.
            Jobs[CurrentClassId].IsCurrent = true; //current class the player will start with.
            LoadInitialEquipment();

            Position = Position.GetInitialPosition(InitialTown);

            //Lua
            LuaParameters = new LuaParameters
            {
                ActorName = string.Format("_pc{0:00000000}", Id),
                ClassName = "Player"
            };

            //Actor Lua parameters
            LuaParameters.Add(ClassPath);
            LuaParameters.Add(true);
            LuaParameters.Add(false);
            LuaParameters.Add(false);
            LuaParameters.Add(true);
            LuaParameters.Add(0);
            LuaParameters.Add(false);

            //add timer placeholders
            for (int i = 0; i < 20; i++)
            {
                LuaParameters.Add(0);
            }

            LuaParameters.Add(true);

            PartyGroup    = new PartyGroup();
            RetainerGroup = new RetainerGroup();
        }
 public void SendGroupPackets(Socket sender)
 {
     PartyGroup.SendPackets(sender);
     RetainerGroup.SendPackets(sender);
     SendActiveLinkshell(sender);
 }