예제 #1
0
        static public void F_REQUEST_CHAR(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            cclient.State = (int)eClientState.CharScreen;

            UInt16 Operation = packet.GetUint16();

            if (Operation == 0x2D58)
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_ERROR);
                Out.WriteByte((byte)CharMgr.GetAccountRealm(cclient._Account.AccountId));
                cclient.SendPacket(Out);
            }
            else
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_RESPONSE);
                Out.FillString(cclient._Account.Username, 21);
                Out.WriteByte(0);
                Out.WriteByte(0);
                Out.WriteByte(0);
                Out.WriteByte(4);

                if (cclient._Account.GmLevel == 0 && !Program.Config.CreateBothRealms)
                    Out.WriteByte((byte)CharMgr.GetAccountRealm(cclient._Account.AccountId));
                else
                    Out.WriteByte(0);

                byte[] Chars = CharMgr.BuildCharacters(cclient._Account.AccountId);
                Out.Write(Chars, 0, Chars.Length);
                Out.WritePacketLength();
                cclient.SendPacket(Out);
            }
        }
예제 #2
0
        static public void F_RANDOM_NAME_LIST_INFO(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;
            RandomNameInfo Info = BaseClient.ByteToType<RandomNameInfo>(packet);

            List<Random_name> Names = CharMgr.GetRandomNames();

            PacketOut Out = new PacketOut((byte)Opcodes.F_RANDOM_NAME_LIST_INFO);
            Out.WriteByte(0);
            Out.WriteByte(Info.Unk);
            Out.WriteByte(Info.Slot);
            Out.WriteUInt16(0);
            Out.WriteByte((byte)Names.Count);

            for (int i = Names.Count - 1; i >= 0; --i)
                Out.FillString(Names[i].Name, Names[i].Name.Length + 1);

            cclient.SendPacket(Out);
        }
예제 #3
0
        static public void F_DELETE_CHARACTER(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            byte Slot = packet.GetUint8();

            if (cclient._Account == null)
            {
                cclient.Disconnect();
                return;
            }

            CharMgr.RemoveCharacter(Slot, cclient._Account.AccountId);

            PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE);
            Out.FillString(cclient._Account.Username, 21);
            Out.Fill(0, 3);
            cclient.SendPacket(Out);
        }
예제 #4
0
파일: CharMgr.cs 프로젝트: oldSerge/WarEmu
        public static byte[] BuildCharacters(int AccountId)
        {
            Log.Debug("BuildCharacters", "AcocuntId = " + AccountId);

            Character[] Chars = GetAccountChar(AccountId)._Chars;
            UInt16 Count = 0;

            // On Compte le nombre de personnages existant du joueur
            for (UInt16 c = 0; c < Chars.Length; ++c)
                if (Chars[c] != null) ++Count;

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

            Out.WriteByte(MAX_SLOT);
            Out.WriteUInt32(0xFF);
            Out.WriteByte(0x14);

            Character Char = null;
            for (int i = 0; i < MAX_SLOT; ++i)
            {
                Char = Chars[i];

                if (Char == null)
                    Out.Fill(0, 284); // 284
                else
                {
                    List<Character_item> Items = CharMgr.GetItemChar(Char.CharacterId);

                    Out.FillString(Char.Name, 48);
                    Out.WriteByte(Char.Value.Level);
                    Out.WriteByte(Char.Career);
                    Out.WriteByte(Char.Realm);
                    Out.WriteByte(Char.Sex);
                    Out.WriteByte(Char.ModelId);
                    Out.WriteUInt16(Char.Value.ZoneId);
                    Out.Fill(0, 5);

                    Character_item Item = null;
                    for (UInt16 SlotId = 14; SlotId < 30; ++SlotId)
                    {
                        Item = Items.Find(item => item != null && item.SlotId == SlotId);
                        if (Item == null)
                            Out.WriteUInt32(0);
                        else
                            Out.WriteUInt32R(Item.ModelId);

                        Out.Fill(0, 4);
                    }

                    Out.Fill(0, 6);

                    for (int j = 0; j < 5; ++j)
                    {
                        Out.Fill(0, 6);
                        Out.WriteUInt16(0xFF00);
                    }

                    for (UInt16 SlotId = 10; SlotId < 13; ++SlotId)
                    {
                        Item = Items.Find(item => item != null && item.SlotId == SlotId);
                        Out.WriteUInt16(0);
                        if (Item == null)
                            Out.WriteUInt16(0);
                        else
                            Out.WriteUInt16R((ushort)Item.ModelId);
                    }

                    Out.Fill(0, 10);
                    Out.WriteUInt16(0xFF00);
                    Out.WriteByte(0);
                    Out.WriteByte(Char.Race);
                    Out.WriteUInt16(0);
                    Out.Write(Char.bTraits, 0, Char.bTraits.Length);
                    Out.Fill(0, 14);// 272
                }
            }
            return Out.ToArray();
        }
예제 #5
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();
        }
예제 #6
0
        public static void F_REQUEST_CHAR(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            cclient.State = (int)eClientState.CharScreen;

            UInt16 Operation = packet.GetUint16();

            if (Operation == 0x2D58)
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_ERROR);
                Out.WriteByte((byte)CharMgr.GetAccountRealm(cclient._Account.AccountId));
                cclient.SendTCP(Out);
            }

            else{

                 PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_RESPONSE);

                 Out.FillString(cclient._Account.Username, 25); // account name
                 Out.WriteByte(0xFF);
                 Out.WriteByte(CharMgr.MAX_SLOT); // Max characters 20
                 Out.WriteUInt16(0); // unk
                 Out.WriteByte(0); // name changing tokens, 1 will enable button
                 Out.WriteUInt16(0); //unk

                 byte[] Chars = CharMgr.BuildCharactersList(cclient._Account.AccountId);
                 Out.Write(Chars, 0, Chars.Length);
                 cclient.SendTCP(Out);
            }
        }