예제 #1
0
파일: CharMgr.cs 프로젝트: JeFawk/WarEmu
        public static byte[] BuildCharactersList(int AccountId)
        {
            Log.Debug("BuildCharactersList", "AcocuntId = " + AccountId);
            Character[] Chars = GetAccountChar(AccountId)._Chars;
            int count = 0;

            PacketOut Out = new PacketOut(0);
            Out.Position = 0;

            Character Char = null;
            for (int k = 0; k < MAX_SLOT; ++k)
            {
                Char = Chars[k];
                if (Char != null)
                {
                    List<Character_items> Items = CharMgr.GetItemChar(Char.CharacterId);

                    /****  char slot start ****/
                    Out.FillString(Char.Name, 48); // name
                    Out.WriteByte(Char.Value[0].Level); // Level
                    Out.WriteByte(Char.Career); //career
                    Out.WriteByte(Char.Realm); // realm
                    Out.WriteByte(Char.Sex); // gender
                    Out.WriteUInt16R(Char.ModelId); //model id
                    Out.WriteUInt16R(Char.Value[0].ZoneId); // zone id
                    Out.Fill(0, 12); // unk

                    Character_items Item = null;
                    for (UInt16 SlotId = 14; SlotId < 30; ++SlotId)
                    {
                        Item = Items.Find(item => item != null && item.SlotId == SlotId);

                        if (Item == null)
                        {
                            Out.WriteInt32(0);
                            Out.WriteInt32(0);
                        }
                        else
                        {

                            Out.WriteInt32((int)Item.ModelId);
                            Out.WriteUInt16R(0); // primary dye
                            Out.WriteUInt16R(0); // secondary dye
                        }
                    }
                    Out.WriteUInt32(0x00); // 0x00000000
                    for (int i = 0; i < 4; i++)
                    {
                        Out.WriteUInt32(0xFF000000);
                        Out.WriteUInt32(0x00);
                    }
                    Out.WriteUInt32(0xFF000000);

                    //weapons
                    for (UInt16 SlotId = 10; SlotId < 13; ++SlotId)
                    {
                        Item = Items.Find(item => item != null && item.SlotId == SlotId);

                        if (Item == null)
                            Out.WriteUInt32(0);
                        else
                        {
                            Out.WriteUInt16R((ushort)Item.ModelId);
                            Out.WriteUInt16(0);
                        }
                    }
                    Out.Fill(0, 8);
                    Out.WriteUInt16(0xFF00);
                    Out.WriteByte(0);
                    Out.WriteByte(Char.Race); // char slot position
                    Out.WriteUInt16(0x00); //unk

                   /* //Traits [8 bytes]
                    Out.WriteByte(1); //face
                    Out.WriteByte(4); //jewel
                    Out.WriteByte(4); //scar
                    Out.WriteByte(0); //hair
                    Out.WriteByte(3); //hair color
                    Out.WriteByte(2); //skin color
                    Out.WriteByte(0); //eye color
                    Out.WriteByte(5); //metal color
                    */
                    Out.Write(Char.bTraits, 0, Char.bTraits.Length);

                    Out.Fill(0, 14); //unk

                    count++;
                }
            }

            for (int i = 0; i < (MAX_SLOT - count); ++i)
                Out.Write(new byte[284], 0, 284);

            return Out.ToArray();
        }