예제 #1
0
        public static void Send(LobbyClient client)
        {
            Log.Debug("LOGIN_SALT", "Send to " + client.Account.Email);
            MakeSalt(client);

            PacketOut Out = new PacketOut((UInt32)Opcodes.LOGIN_SALT);
            Out.WriteInt32R(client.Account.Id);
            Out.Write(client.B, 0, 64);
            Out.WriteByte(0x40);
            Out.WriteByte(0);
            Out.Write(client.Salt, 0, 10);
            client.SendTCP(Out);
        }
예제 #2
0
        static public void CMSG_VerifyProtocolReq(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;

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

            byte[] IV_HASH1 = { 0x01, 0x53, 0x21, 0x4d, 0x4a, 0x04, 0x27, 0xb7, 0xb4, 0x59, 0x0f, 0x3e, 0xa7, 0x9d, 0x29, 0xe9 };
            byte[] IV_HASH2 = { 0x49, 0x18, 0xa1, 0x2a, 0x64, 0xe1, 0xda, 0xbd, 0x84, 0xd9, 0xf4, 0x8a, 0x8b, 0x3c, 0x27, 0x20 };
            
            ByteString iv1 = ByteString.CopyFrom(IV_HASH1);
            ByteString iv2 = ByteString.CopyFrom(IV_HASH2);
            VerifyProtocolReply.Builder verify = VerifyProtocolReply.CreateBuilder();
            verify.SetResultCode(VerifyProtocolReply.Types.ResultCode.RES_SUCCESS);

            verify.SetIv1(ByteString.CopyFrom(IV_HASH1));
            verify.SetIv2(ByteString.CopyFrom(IV_HASH2));


            
            Out.Write(verify.Build().ToByteArray());
   

            cclient.SendTCPCuted(Out);

        }
예제 #3
0
        public override void OnWorldPlayerEvent(string EventName, Player Plr, object Data)
        {
            if (EventName == "SEND_PACKAGES")
            {
                List<PacketInfo> P;
                if (Packets.TryGetValue(Plr._Info.Career, out P))
                {
                    foreach (PacketInfo Packet in P)
                    {
                        PacketOut Out = new PacketOut(Packet.Opcode);
                        Out.Write(Packet.Data, 3, Packet.Data.Length - 3);
                        Plr.SendPacket(Out);
                    }
                }

                if (Plr._Info.FirstConnect && Plr.GmLevel == 0)
                {
                    Plr._Info.FirstConnect = false;
                    PacketInfo Packet = Intros[Plr._Info.Career];
                    PacketOut Out = new PacketOut(Packet.Opcode);
                    Out.Write(Packet.Data, 3, Packet.Data.Length - 3);
                    Plr.SendPacket(Out);
                }
            }
        }
예제 #4
0
        public static void HandlePacket(BaseClient client, PacketIn packet)
        {
            LobbyClient cclient = (LobbyClient)client;

            byte FileId = packet.GetUint8();
            UInt32 Version = packet.GetUint32R();

            byte[] File = new byte[packet.Length - packet.Position];
            packet.Read(File, 0, File.Length);

            File = ZlibMgr.Decompress(File);

            Log.Debug("ConfigSave", "Config saved : fileid=" + FileId + ", Version=" + Version + ",Size=" + File.Length);

            Program.FileMgr.SaveInfo(cclient.Account.Id, FileId, File);

            PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_SAVE);
            Out.WriteUInt32R(0);
            Out.WriteByte(FileId);
            Out.Write(File, 0, File.Length);
            cclient.SendTCP(Out);
        }
예제 #5
0
        static public void CMSG_AuthSessionTokenReq(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;

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

            AuthSessionTokenReq.Builder authReq = AuthSessionTokenReq.CreateBuilder();
            authReq.MergeFrom(packet.ToArray());

            string session = Encoding.ASCII.GetString(authReq.SessionToken.ToByteArray());
           // Log.Debug("AuthSession", "session " + session);
            cclient.Username = "";                                  //username is not important anymore in 1.4.8
            cclient.Token = session;



            AuthSessionTokenReply.Builder authReply = AuthSessionTokenReply.CreateBuilder();
            authReply.SetResultCode(AuthSessionTokenReply.Types.ResultCode.RES_SUCCESS);

          
            Out.Write(authReply.Build().ToByteArray());

            cclient.SendTCPCuted(Out);
       
            
        /*   //TODO: need auth check

            if (Result != AuthResult.AUTH_SUCCESS)
                cclient.Disconnect();
            else
            {
                cclient.Username = Username;
                cclient.Token = Token;
            }*/
        }
예제 #6
0
        public PacketOut Crypt(PacketOut packet)
        {
            if (m_crypts.Count <= 0)
            {
                return(packet);
            }

            byte[] Packet = packet.ToArray();

            Log.Tcp("SendTCP", Packet, 0, (int)Packet.Length);

            int Hpos = 0;

            Hpos += PacketOut.SizeLen;
            if (PacketOut.OpcodeInLen)
            {
                Hpos += packet.OpcodeLen;
            }

            byte[] Header  = new byte[Hpos];
            byte[] ToCrypt = new byte[(packet.Length - Hpos)];

            for (int i = 0; i < Hpos; ++i)
            {
                Header[i] = Packet[i];
            }

            for (int i = Hpos; i < Packet.Length; ++i)
            {
                ToCrypt[i - Hpos] = Packet[i];
            }

            try
            {
                foreach (KeyValuePair <ICryptHandler, CryptKey[]> Entry in m_crypts)
                {
                    ToCrypt = Entry.Key.Crypt(Entry.Value[0], ToCrypt);
                }
            }
            catch (Exception e)
            {
                Log.Error("BaseClient", "Crypt Error : " + e.ToString());
                return(packet);
            }

            PacketOut Out = new PacketOut((byte)0);

            Out.Opcode    = packet.Opcode;
            Out.OpcodeLen = packet.OpcodeLen;
            Out.Position  = 0;
            Out.SetLength(0);

            byte[] Total = new byte[Header.Length + ToCrypt.Length];

            for (int i = 0; i < Total.Length; ++i)
            {
                if (i < Header.Length)
                {
                    Total[i] = Header[i];
                }
                else
                {
                    Total[i] = ToCrypt[i - Header.Length];
                }
            }

            Out.Write(Total, 0, Total.Length);

            return(Out);
        }
예제 #7
0
파일: Group.cs 프로젝트: dzikun/WarEmu
        public void Update()
        {
            Log.Debug("Group", "Updating Group");

            if (Leader == null || Members.Count < 1 || (Members.Count == 1 && Leader == Members.First()))
            {
                Delete();
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_CHARACTER_INFO);
            Out.WriteUInt16(0x0602); // Group info
            Out.WriteUInt16(0xB536); // Group id
            Out.WriteByte((byte)Members.Count);
            foreach (Player Plr in Members)
            {
                Out.WriteUInt32(0xA8BF3B0C);
                Out.WriteByte((byte)Plr._Info.ModelId);
                Out.WriteByte((byte)Plr._Info.Race);
                Out.WriteByte((byte)Plr.Level);
                Out.WriteUInt16((ushort)Plr._Info.CareerLine);
                Out.WriteByte(1);
                Out.WriteByte(0); // Will be 1 for at least one member. Perhaps Leader?
                Out.WriteByte(0);
                Out.WriteByte(1); // Online = 1, Offline = 0
                Out.WriteByte((byte)Plr.Name.Length);
                Out.Fill(0, 3);
                Out.WriteStringBytes(Plr.Name);
                Out.WriteByte(0); // Name length. Pet? Target?
                Out.Fill(0, 3);
                //Out.WriteStringBytes(Pet name? Target?);

                Out.WriteByte(0x8B);
                Out.WriteUInt16R((ushort)650); // X ?
                Out.WriteByte(0xD3);
                Out.WriteUInt16R((ushort)650); // y ?
                byte[] data = { 0xC8, 0x50, 0x27, 0x25, 0x05, 0x40, 0x01, 0x02 };
                Out.Write(data);
                
                Out.WriteByte((byte)(Plr._Value.ZoneId*2));
                Out.WriteByte(1);
                Out.WriteByte(1);
 
                Out.WriteByte((byte)Plr.PctHealth);
                Out.WriteByte((byte)Plr.PctAp); // action points
                Out.WriteByte(0);
            }

            SendToGroup(Out);
        }
예제 #8
0
        static public void CMSG_GetCharSummaryListReq(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;


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

            Out.Write(new byte[2] { 0x08, 00 });
            cclient.SendTCPCuted(Out);
          
        }
예제 #9
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);
            }
        }
예제 #10
0
파일: Creature.cs 프로젝트: dzikun/WarEmu
        public override void SendMeTo(Player Plr)
        {
            //Log.Success("Creature", "SendMe " + Name);

            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER);
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);

            Out.WriteUInt16((UInt16)Heading);
            Out.WriteUInt16((UInt16)WorldPosition.Z);
            Out.WriteUInt32((UInt32)WorldPosition.X);
            Out.WriteUInt32((UInt32)WorldPosition.Y);
            Out.WriteUInt16(0); // Speed Z
            // 18
            Out.WriteUInt16(Spawn.Proto.Model1);
            Out.WriteByte((byte)Spawn.Proto.MinScale);
            Out.WriteByte(Level);
            Out.WriteByte(Faction);

            Out.Fill(0, 4);
            Out.WriteByte(Spawn.Emote);
            Out.WriteByte(0); // ?
            Out.WriteUInt16(Spawn.Proto._Unks[1]);
            Out.WriteByte(0);
            Out.WriteUInt16(Spawn.Proto._Unks[2]);
            Out.WriteUInt16(Spawn.Proto._Unks[3]);
            Out.WriteUInt16(Spawn.Proto._Unks[4]);
            Out.WriteUInt16(Spawn.Proto._Unks[5]);
            Out.WriteUInt16(Spawn.Proto._Unks[6]);
            Out.WriteUInt16(Spawn.Title);

            long TempPos = Out.Position;
            byte TempLen = (byte)(Spawn.bBytes.Length + States.Count);
            Out.WriteByte(TempLen);
            Out.Write(Spawn.bBytes, 0, Spawn.bBytes.Length);
            Out.Write(States.ToArray(), 0, States.Count);
            if (QtsInterface.CreatureHasStartQuest(Plr))
            {
                Out.WriteByte(5);
                Out.Position = TempPos;
                Out.WriteByte((byte)(TempLen + 1));
            }
            else if (QtsInterface.CreatureHasQuestToAchieve(Plr))
            {
                Out.WriteByte(4);
                Out.Position = TempPos;
                Out.WriteByte((byte)(TempLen + 1));
            }
            else if (QtsInterface.CreatureHasQuestToComplete(Plr))
            {
                Out.WriteByte(7);
                Out.Position = TempPos;
                Out.WriteByte((byte)(TempLen + 1));
            }

            Out.Position = Out.Length;

            Out.WriteByte(0);

            Out.WriteStringBytes(Name);

            Out.Fill(0, 48);
            Plr.SendPacket(Out);

            base.SendMeTo(Plr);
        }
예제 #11
0
        private void SendBuffer(Player Plr,ref PacketOut Buffer,ref byte Count)
        {
            // On Envoi le Packet des items
            byte[] ArrayBuf = Buffer.ToArray();
            PacketOut Packet = new PacketOut((byte)Opcodes.F_GET_ITEM);
            Packet.WriteByte(Count);
            Packet.Fill(0, 3);
            Packet.Write(ArrayBuf, 0, ArrayBuf.Length);
            Packet.WritePacketLength();

            Plr.SendPacket(Packet);

            // On Remet le compteur a zero
            Count = 0;

            // On Initalise un nouveau buffer
            Buffer = new PacketOut(0);
            Buffer.Position = 0;
        }
예제 #12
0
파일: Creature.cs 프로젝트: JeFawk/WarEmu
        public override void SendMeTo(Player Plr)
        {
            List<byte> TmpState = new List<byte>();

            if (QtsInterface.CreatureHasStartQuest(Plr))
                TmpState.Add(5);
            else if (QtsInterface.CreatureHasQuestToComplete(Plr))
                TmpState.Add(7);

            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER);
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);

            Out.WriteUInt16((UInt16)Heading);
            Out.WriteUInt16((UInt16)WorldPosition.Z);
            Out.WriteUInt32((UInt32)WorldPosition.X);
            Out.WriteUInt32((UInt32)WorldPosition.Y);
            Out.WriteUInt16(0); // Speed Z
            // 18
            Out.WriteUInt16(Spawn.Proto.Model1);
            Out.WriteByte((byte)Spawn.Proto.MinScale);
            Out.WriteByte(Spawn.Proto.MinLevel);
            Out.WriteByte(Faction);

            Out.Fill(0, 4);
            Out.WriteByte(Spawn.Emote);
            Out.WriteByte(0); // ?
            Out.WriteUInt16(Spawn.Proto._Unks[1]);
            Out.WriteByte(0);
            Out.WriteUInt16(Spawn.Proto._Unks[2]);
            Out.WriteUInt16(Spawn.Proto._Unks[3]);
            Out.WriteUInt16(Spawn.Proto._Unks[4]);
            Out.WriteUInt16(Spawn.Proto._Unks[5]);
            Out.WriteUInt16(Spawn.Proto._Unks[6]);
            Out.WriteUInt16(Spawn.Title);

            Out.WriteByte((byte)(Spawn.bBytes.Length + States.Count + TmpState.Count));
            Out.Write(Spawn.bBytes, 0, Spawn.bBytes.Length);
            Out.Write(States.ToArray(), 0, States.Count);
            Out.Write(TmpState.ToArray(), 0, TmpState.Count);

            Out.WriteByte(0);

            Out.WriteStringBytes(Name);

            Out.WriteByte(0); // ?
            Out.WriteByte(1); // ?
            Out.WriteByte(10); // ?

            Out.WriteByte(0); // ?

            Out.WriteUInt16(0); // ?
            Out.WriteByte(Spawn.Icone);
            Out.WriteByte((byte)Spawn.Proto._Unks[0]);

            Out.WriteByte(0);

            Out.Fill(0, 8); // Flags;

            Out.WriteByte(100); // Health %

            Out.WriteUInt16(Zone.ZoneId);

            Out.Fill(0, 48);

            Plr.SendPacket(Out);

            base.SendMeTo(Plr);
        }
예제 #13
0
        // 1.3.5
        public void SendMaxInventory(Player Plr)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_BAG_INFO);
            Out.WriteByte(0x0F);
            Out.WriteByte(GetTotalSlot()); // Nombre de slots disponibles
            Out.WriteUInt16((UInt16)INVENTORY_SLOT_COUNT);
            Out.WriteByte(0);
            Out.WriteUInt16R(GetBagPrice());

            byte[] Data = new byte[]
            {
                0x00,0x00,
                0x50,0x00,0x08,
                0x00,0x60,
                0xEA,
                0x00,0x00
            };

            Out.Write(Data, 0, Data.Length);
            Plr.SendPacket(Out);
        }
예제 #14
0
 public void SendCopy(PacketOut Out)
 {
     Out.WritePacketLength();
     PacketOut packet = new PacketOut(0);
     packet.Position = 0;
     packet.Write(Out.ToArray(), 0, Out.ToArray().Length);
     SendPacket(packet);
 }
예제 #15
0
파일: Group.cs 프로젝트: javierz/WarEmu
        public void Update()
        {
            Log.Debug("Group", "Updating Group");

            if (Leader == null || Members.Count < 1 || (Members.Count == 1 && Leader == Members.First()))
            {
                Delete();
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_CHARACTER_INFO);
            Out.WriteUInt16(0x0602); // Group info
            Out.WriteUInt16(0xB536); // Group id
            Out.WriteByte((byte)Members.Count);
            foreach (Player Plr in Members)
            {
                Out.WriteUInt32(0xA8BF3B0C);
                Out.WriteByte((byte)Plr._Info.ModelId);
                Out.WriteByte((byte)Plr._Info.Race);
                Out.WriteByte((byte)Plr.Level);
                Out.WriteUInt16((ushort)Plr._Info.CareerLine);
                Out.WriteByte(1);
                Out.WriteUInt16(0);
                Out.WriteByte(1); // Online = 1, Offline = 0
                Out.WriteByte((byte)Plr.Name.Length);
                Out.Fill(0, 3);
                Out.WriteStringBytes(Plr.Name);
                Out.Fill(0, 4);

                // X/Y ....
                byte[] data =
                {
                    0x84,0x7A,0x90,0x95,0x03,0xE2,0x36,0x50,0xE2,0x50,
                    0x40,0x01,0x02,0xD4,0x01,0x01,
                };

                Out.Write(data);
                Out.WriteByte((byte)Plr.PctHealth);
                Out.WriteByte(0x64); // action points
                Out.WriteByte(0);
            }

            SendToGroup(Out);
        }
예제 #16
0
파일: Player.cs 프로젝트: dzikun/WarEmu
        public override void SendMeTo(Player Plr)
        {
            if (Plr == null || Plr.IsDisposed || Plr.Client == null)
                return;
 
            if (IsDisposed || Client == null)
                return;

            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_PLAYER);
            Out.WriteUInt16((UInt16)_Client.Id);
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(_Info.ModelId);
            Out.WriteUInt16(_Info.CareerLine);
            Out.WriteUInt16((UInt16)Z);
            Out.WriteUInt16(Zone.ZoneId);

            Out.WriteUInt16((UInt16)X);
            Out.WriteUInt16((UInt16)Y);
            Out.WriteUInt16(Heading);

            Out.WriteByte(0); // Level
            Out.WriteByte(_Value.Level); // Level

            Out.WriteByte(0x2B);
            Out.WriteByte((byte)(Faction + (IsDead ? 1 : 0))); // Faction
            Out.WriteByte(0);
            Out.WriteByte(0); // ?

            Out.Write(_Info.bTraits, 0, _Info.bTraits.Length);
            Out.Fill(0, 12);

            Out.WriteByte(_Info.Race);
            Out.WriteByte(0); //sometimes 1
            Out.WriteByte(0); // health/ap?
            Out.WriteByte(PctHealth);
            Out.Fill(0, 8);

            Out.WritePascalString(_Info.Name);
            Out.WritePascalString(""); // suffix. title?
            Out.WritePascalString(""); // guild name
            Out.Fill(0, 4);

            Plr.SendPacket(Out);
            base.SendMeTo(Plr);
        }
예제 #17
0
파일: Player.cs 프로젝트: dzikun/WarEmu
 public void SendCopy(PacketOut Out)
 {
     Out.WritePacketLength();
     byte[] Buf = Out.ToArray();
     PacketOut packet = new PacketOut(0);
     packet.Position = 0;
     packet.Write(Buf, 0, Buf.Length);
     SendPacket(packet);
     
 }
예제 #18
0
        static public void CMSG_GetAcctPropListReq(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;

            PacketOut Out = new PacketOut((byte)Opcodes.SMSG_GetAcctPropListReply);
            byte[] val = { 0x08, 0x00 };
            Out.Write(val);
            cclient.SendTCPCuted(Out);

        }
예제 #19
0
        public override void SendMeTo(Player Plr)
        {
            Log.Success("SendMeTo", "[" + Plr.Name + "] voit : " + Name);

            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_PLAYER);
            Out.WriteUInt16((UInt16)_Client.Id);
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(_Info.ModelId);
            Out.WriteUInt16(_Info.CareerLine);
            Out.WriteUInt16((UInt16)Z);
            Out.WriteUInt16(Zone.ZoneId);

            Out.WriteUInt16((UInt16)X);
            Out.WriteUInt16((UInt16)Y);
            Out.WriteUInt16(Heading);

            Out.WriteByte(_Value.Level); // Level
            Out.WriteByte(0); // Level

            Out.WriteByte(0);
            Out.WriteByte(Faction);
            Out.WriteByte(0);
            Out.WriteByte(Faction);

            Out.Write(_Info.bTraits, 0, _Info.bTraits.Length);
            Out.Fill(0, 12);

            Out.WriteByte(_Info.Race);
            Out.Fill(0, 11);
            Out.WritePascalString(_Info.Name);
            Out.WritePascalString("");
            Out.WriteByte(0);
            Out.Fill(0, 4);

            Plr.SendPacket(Out);

            base.SendMeTo(Plr);
        }
예제 #20
0
        static public void F_PLAYER_STATE2(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
                return;

            Player Plr = cclient.Plr;

            long Pos = packet.Position;

            PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2);
            Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size);
            Out.WriteByte(0);
            Plr.DispatchPacket(Out, false);

            packet.Position = Pos;

            UInt16 Key = packet.GetUint16();

            byte Type = packet.GetUint8();
            byte MoveingState = packet.GetUint8();
            byte CombatByte = packet.GetUint8();
            byte Strafe = packet.GetUint8();

            UInt16 Heading = packet.GetUint16R();
            UInt16 X = packet.GetUint16R();
            UInt16 Y = packet.GetUint16R();
            byte Unk1 = packet.GetUint8();
            UInt16 Z = packet.GetUint16R();

            if (packet.Size < 10)
                return;

            Heading /= 8;
            X /= 2;
            Y /= 2;
            Z /= 2;

            if (Type != (byte)MovementTypes.NotMoving)
                Plr.IsMoving = true;
            else
                Plr.IsMoving = false;

            //Log.Success("Movement Before ", X + "," + Y + "," + Z);
            if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF)
            {
                if (Plr.LastCX != 0 && Plr.LastCY != 0)
                {
                    if (Plr.LastCX > 12288 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (X > 12288 && Plr.LastCX < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastCY > 24576 && Y < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Y > 24576 && Plr.LastCY < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));
                }

                Plr.LastCX = X;
                Plr.LastCY = Y;

                X = Plr.Zone.CalculCombat(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false);
                Heading /= 2;
                Z += 32768;
                Z /= 4;
                Z /= 2;
            }
            else
            {
                if (Plr.LastX != 0 && Plr.LastY != 0)
                {
                    if (Plr.LastX > 24576 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (Plr.LastX < 4096 && X > 24576)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastY > 24576 && Y < 4096)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Plr.LastY < 4096 && Y > 24576)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));

                }

                Plr.LastX = X;
                Plr.LastY = Y;

                X = Plr.Zone.CalculPin(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculPin(Y, Plr.YOffset, false);
                Z /= 2;
            }

            if (Plr.IsInWorld() && Plr.Zone.ZoneId == 161)
                Z += 16384;

            //Log.Success("Movement after", "X=" + X + ",Y=" + Y + ",Z=" + Z + "," + Type + "," + Unk1 + "," + CombatByte);
            Plr.SetPosition(X, Y, Z, Heading);
        }
예제 #21
0
파일: Creature.cs 프로젝트: JeFawk/WarEmu
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            Log.Success("SendInteract", "" + Name + " -> " + Plr.Name + ",Type="+InteractType);

            Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_SPEACK_TO, Spawn.Entry, 1);

            if (!IsDead)
            {
                switch (InteractType)
                {
                    case GameData.InteractType.INTERACTTYPE_DYEMERCHANT:
                        {
                            string Text = WorldMgr.GetCreatureText(Spawn.Entry);

                            if (Menu.Menu == 9) // List des objets a vendre
                                WorldMgr.SendVendor(Plr, Spawn.Entry);
                            else if (Menu.Menu == 11) // Achat d'un item
                                WorldMgr.BuyItemVendor(Plr, Menu, Spawn.Entry);
                            else if (Menu.Menu == 14) // Vend un Item
                                Plr.ItmInterface.SellItem(Menu);
                            else if (Menu.Menu == 36) // Rachette un item
                                Plr.ItmInterface.BuyBackItem(Menu);
                            else
                            {
                                PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                                Out.WriteByte(0);
                                Out.WriteUInt16(Oid);
                                Out.WriteUInt16(0);
                                Out.WriteByte(0x40); // Dye
                                Out.WriteByte(0x22); // Vendors
                                Out.WriteByte(0);
                                Out.WritePascalString(Text);
                                Out.WriteByte(0);
                                Plr.SendPacket(Out);
                            }
                        } break;

                    case GameData.InteractType.INTERACTTYPE_FLIGHT_MASTER:
                        {
                            byte[] data = new byte[62]
                            {
                                0x01,0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x42,0x39,0x00,0x00,0x00,0xC0,0xE3,
                                0x03,0x39,0xA0,0xD1,0x6F,0x00,0xC8,0xA8,0x1D,0x37,0x28,0x94,0x79,0x33,0xB2,0x24,
                                0x32,0x44,0xDB,0xD7,0x1C,0x5D,0x18,0x5D,0xDD,0x1C,0xA4,0x0D,0x00,0x00,0xA8,0x6B,
                                0x21,0x36,0x11,0x00,0x00,0x00,0xC8,0xD0,0xAF,0x3A,0x78,0xD1,0x6F,0x00
                            };

                            UInt16 Counts = 1;
                            Zone_Info Info;

                            PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                            Out.WriteUInt16(0x0A12);
                            foreach (Zone_Taxi Taxi in WorldMgr.GetTaxis(Plr))
                            {
                                Out.WriteUInt16(Counts);
                                Out.WriteByte(2);
                                Out.WriteUInt16(Taxi.Info.Price);
                                Out.WriteUInt16(Taxi.Info.ZoneId);
                                Out.WriteByte(1);
                                ++Counts;
                            }
                            Out.Write(data);
                            Plr.SendPacket(Out);
                        }break;

                    default:
                        QtsInterface.HandleInteract(Plr, Menu);
                        break;
                };
            }

            base.SendInteract(Plr, Menu);
        }
예제 #22
0
        public static void F_PLAYER_STATE2(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
                return;

            Player Plr = cclient.Plr;

            try
            {
                long Pos = packet.Position;

                PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2);
                Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size);
                Out.WriteByte(0);
                Plr.DispatchPacket(Out, false);

                packet.Position = Pos;
            }
            catch (Exception e)
            {
                Log.Error("F_PLAYER_STATE2", e.ToString());
            }

            if (packet.Size < 17)
            {
                Plr.IsMoving = false;
                return;
            }

            UInt16 Key = packet.GetUint16();

            byte MoveByte = packet.GetUint8();
            byte UnkByte = packet.GetUint8();
            byte CombatByte = packet.GetUint8();
            byte RotateByte = packet.GetUint8();

            UInt16 Heading = packet.GetUint16R();
            UInt16 X = packet.GetUint16R();
            UInt16 Y = packet.GetUint16R();
            byte Unk1 = packet.GetUint8();
            UInt16 Z = packet.GetUint16R();
            //byte Unk2 = packet.GetUint8();

            Heading /= 8;
            X /= 2;
            Y /= 2;
            Z /= 2;

            if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF)
            {
                if (Plr.LastCX != 0 && Plr.LastCY != 0)
                {
                    if (Plr.LastCX > 12288 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (X > 12288 && Plr.LastCX < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastCY > 24576 && Y < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Y > 24576 && Plr.LastCY < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));
                }

                Plr.LastCX = X;
                Plr.LastCY = Y;

                X = Plr.Zone.CalculCombat(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false);
                Heading /= 2;
                Z += 32768;
                Z /= 4;
            }
            else
            {
                if (Plr.LastX != 0 && Plr.LastY != 0)
                {
                    if (Plr.LastX > 24576 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (Plr.LastX < 4096 && X > 24576)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastY > 24576 && Y < 4096)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Plr.LastY < 4096 && Y > 24576)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));

                }

                Plr.LastX = X;
                Plr.LastY = Y;

                X = Plr.Zone.CalculPin(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculPin(Y, Plr.YOffset, false);
            }

            Plr.SetPosition(X, Y, Z, Heading);
        }
예제 #23
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();
        }
예제 #24
0
        public static void F_PLAYER_STATE2(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
                return;

            Player Plr = cclient.Plr;

            long Pos = packet.Position;

            PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2);
            Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size);
            Out.WriteByte(0);
            Plr.DispatchPacket(Out, false);

            packet.Position = Pos;

            UInt16 Key = packet.GetUint16();

            byte Type = packet.GetUint8();
            byte MoveingState = packet.GetUint8();
            byte CombatByte = packet.GetUint8();
            byte Strafe = packet.GetUint8();

            UInt16 Heading = packet.GetUint16R();
            UInt16 X = packet.GetUint16R();
            UInt16 Y = packet.GetUint16R();
            byte Unk1 = packet.GetUint8();
            UInt16 Z = packet.GetUint16R();
            byte zmod = packet.GetUint8();

            //    Log.Success("zMod ",""+zmod);
            // zmod is somewhat strange what i found out so far
            // z mod is 255 while standing
            // z mod is 0 while running and z is below 65535
            // z mod is 1 while running and z is above 65535
            // z mod can be  113 / 97 / 115 / 99 while running and z is below 65535 and enemy in target
            // z mod is 99 / 100 / 116  while running and z is above 65535 and enemy in target

            // z mod is 4 while running in water
            // z mod is 68 while swimming in water
            // z mod is ticking with 255 7 times then 68 while standing in deep water
            // z mod is 12 while running in water (that should lower your health / kill you and reduce movement speed)
            // z mod is ticking with 255 7 times then 12 while standing in lava

            if (packet.Size < 10)
                return;

            int z_temp = Z;

            Heading /= 8;
            X /= 2;
            Y /= 2;

            // z update if z is higher then 65535

            if (zmod != 0 && zmod != 97 && zmod != 113 && zmod != 99 && zmod != 115)
                z_temp += 65535;

            if (Type != (byte)MovementTypes.NotMoving)
                Plr.IsMoving = true;
            else
                Plr.IsMoving = false;

             //   Log.Success("Movement Before ", X + "," + Y + "," + Z + "  ztemp"+ z_temp);
            if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF)
            {
                if (Plr.LastCX != 0 && Plr.LastCY != 0)
                {
                    if (Plr.LastCX > 12288 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (X > 12288 && Plr.LastCX < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastCY > 24576 && Y < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Y > 24576 && Plr.LastCY < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));
                }

                Plr.LastCX = X;
                Plr.LastCY = Y;

                X = Plr.Zone.CalculCombat(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false);
                Heading /= 2;
                z_temp /= 16;

                // combat offset z

                if (Plr._ZoneMgr.ZoneId == 161 || Plr._ZoneMgr.ZoneId == 162)
                {
                    z_temp += 12288;
                }
                else
                    z_temp += 4096;

            }
            else
            {
                if (Plr.LastX != 0 && Plr.LastY != 0)
                {
                    if (Plr.LastX > 24576 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (Plr.LastX < 4096 && X > 24576)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastY > 24576 && Y < 4096)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Plr.LastY < 4096 && Y > 24576)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));

                }

                Plr.LastX = X;
                Plr.LastY = Y;

                X = Plr.Zone.CalculPin(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculPin(Y, Plr.YOffset, false);
                Log.Success("4 ",""+z_temp);

                z_temp /= 4;
            }

              //  if (Plr.IsInWorld() && Plr.Zone.ZoneId == 161)
              //      Z += 16384;

             //   Log.Success("Movement after", "X=" + X + ",Y=" + Y + ",Z=" + Z + ",ztemp = " + z_temp + "," + Type + "," + Unk1 + "," + CombatByte);
            Plr.SetPosition(X, Y,(ushort) z_temp, Heading);
        }
예제 #25
0
파일: Item.cs 프로젝트: dzikun/WarEmu
        static public void BuildItem(ref PacketOut Out,Item Itm,Item_Info Info,ushort SlotId,ushort Count)
        {
            SlotId = SlotId == 0 ? (Itm == null ? SlotId : Itm.SlotId ) : SlotId;
            Count = Count == 0 ? (Itm == null ? Count : Itm.Count) : Count;
            Info = Info == null ? (Itm == null ? null : Itm.Info) : Info;
            

            if(SlotId != 0)
                Out.WriteUInt16(SlotId);

            Out.WriteByte(0);
            Out.WriteUInt32((uint)(Info != null ? Info.Entry : 0));

            if (Info == null)
                return;

            Out.WriteUInt16((ushort)Info.ModelId);  // Valid 1.4.8
            Out.Fill(0, 7);  // Valid 1.4.8
            Out.WriteUInt16(Info.SlotId);  // Valid 1.4.8
            Out.WriteByte(Info.Type);  // Valid 1.4.8

            Out.WriteByte(Info.MinRank); // Min Level
            Out.WriteByte(Info.ObjectLevel); // 1.3.5, Object Level
            Out.WriteByte(Info.MinRenown); // 1.3.5, Min Renown
            Out.WriteByte(Info.MinRenown); // ?
            Out.WriteByte(Info.UniqueEquiped); // Unique - Equiped

            Out.WriteByte(Info.Rarity);
            Out.WriteByte(Info.Bind);
            Out.WriteByte(Info.Race);

            // Trophys have some extra bytes
            if (Info.Type == (byte)GameData.ItemTypes.ITEMTYPES_TROPHY)
            {
                Out.WriteUInt32(0);
                Out.WriteUInt16(0x0080);
            }

            Out.WriteUInt32(Info.Career);
            Out.WriteUInt32(0);
            Out.WriteUInt32(Info.SellPrice);

            Out.WriteUInt16((UInt16)(Count > 0 ? Count : 1));
            Out.WriteUInt16((UInt16)(Count > 0 ? Count : 1));

            Out.WriteUInt32(0);

            Out.WriteUInt32(Info.Skills);  // Valid 1.4.8
            Out.WriteUInt16(Info.Dps > 0 ? Info.Dps : Info.Armor);  // Valid 1.4.8
            Out.WriteUInt16(Info.Speed);  // Valid 1.4.8
            Out.WritePascalString(Info.Name);  // Valid 1.4.8

            Out.WriteByte((byte)Info._Stats.Count);  // Valid 1.4.8
            foreach (KeyValuePair<byte, UInt16> Key in Info._Stats)
            {
                Out.WriteByte(Key.Key);
                Out.WriteUInt16(Key.Value);
                Out.Fill(0, 5);
            }

            Out.WriteByte(0); // Equip Effects

            Out.WriteByte((byte)Info._Spells.Count); // OK
            foreach (KeyValuePair<UInt32, UInt32> Kp in Info._Spells)
            {
                Out.WriteUInt32(Kp.Key);
                Out.WriteUInt32(Kp.Value);
            }
            // (uint32)Entry, uint16 X, uint16 Y

            Out.WriteByte((byte)Info._Crafts.Count); // OK
            foreach (KeyValuePair<byte, ushort> Kp in Info._Crafts)
            {
                Out.WriteByte(Kp.Key);
                Out.WriteUInt16(Kp.Value);
            }

            Out.WriteByte(0); // ??

            Out.WriteByte(Info.TalismanSlots);
            Item_Info TalismanInfo = null;
            for (int i = 0; i < Info.TalismanSlots; ++i)
            {
                if (Itm != null)
                    TalismanInfo = Itm.GetTalisman((byte)i);
 
                if (TalismanInfo == null)
                    Out.WriteUInt32(0); // Entry;
                else
                {
                    Out.WriteUInt32(TalismanInfo.Entry);
                    Out.WritePascalString(TalismanInfo.Name);
                    Out.Fill(0, 15);
                }
            }

            Out.WritePascalString(Info.Description);

            Out.Write(Info.Unk27);

            /*Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);

            Out.WriteUInt16(0x0302);

            Out.Fill(0, 8);
            Out.WriteByte(0); // Type , Culture, etc etc
            Out.WriteByte(0); // Type, Recipian , Soil , etc etc
            Out.Fill(0, 11);*/
        }
예제 #26
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);
            }
        }
예제 #27
0
파일: Creature.cs 프로젝트: dzikun/WarEmu
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_SPEACK_TO, Spawn.Entry, 1);

            if (!IsDead)
            {
                switch (InteractType)
                {
                    case GameData.InteractType.INTERACTTYPE_DYEMERCHANT:
                        {
                            string Text = WorldMgr.GetCreatureText(Spawn.Entry);

                            if (Menu.Menu == 9) // List des objets a vendre
                                WorldMgr.SendVendor(Plr, Spawn.Entry);
                            else if (Menu.Menu == 11) // Achat d'un item
                                WorldMgr.BuyItemVendor(Plr, Menu, Spawn.Entry);
                            else if (Menu.Menu == 14) // Vend un Item
                                Plr.ItmInterface.SellItem(Menu);
                            else if (Menu.Menu == 36) // Rachette un item
                                Plr.ItmInterface.BuyBackItem(Menu);
                            else
                            {
                                PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                                Out.WriteByte(0);
                                Out.WriteUInt16(Oid);
                                Out.WriteUInt16(0);
                                Out.WriteByte(0x40); // Dye
                                Out.WriteByte(0x22); // Vendors
                                Out.WriteByte(0);
                                Out.WritePascalString(Text);
                                Out.WriteByte(0);
                                Plr.SendPacket(Out);
                            }
                        } break;

                    case GameData.InteractType.INTERACTTYPE_FLIGHT_MASTER:
                        {
                            byte[] data = new byte[62]
		                    {
			                    0x01,0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x42,0x39,0x00,0x00,0x00,0xC0,0xE3,
			                    0x03,0x39,0xA0,0xD1,0x6F,0x00,0xC8,0xA8,0x1D,0x37,0x28,0x94,0x79,0x33,0xB2,0x24,
			                    0x32,0x44,0xDB,0xD7,0x1C,0x5D,0x18,0x5D,0xDD,0x1C,0xA4,0x0D,0x00,0x00,0xA8,0x6B,
			                    0x21,0x36,0x11,0x00,0x00,0x00,0xC8,0xD0,0xAF,0x3A,0x78,0xD1,0x6F,0x00
		                    };

                            UInt16 Counts = 1;

                            PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                            Out.WriteUInt16(0x0A12);
                            foreach (Zone_Taxi Taxi in WorldMgr.GetTaxis(Plr))
                            {
                                Out.WriteUInt16(Counts);
                                Out.WriteByte(2);
                                Out.WriteUInt16(Taxi.Info.Price);
                                Out.WriteUInt16(Taxi.Info.ZoneId);
                                Out.WriteByte(1);
                                ++Counts;
                            }
                            Out.Write(data);
                            Plr.SendPacket(Out);
                        }break;

                    case GameData.InteractType.INTERACTTYPE_TRAINER:
                        {
                            if (Menu.Menu == 7)
                            {
                                PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                                Out.WriteByte(5);
                                Out.WriteByte(0x0F);
                                Out.WriteByte(6);
                                Out.WriteUInt16(0);
                                Plr.SendPacket(Out);
                            }
                            else
                            {
                                PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                                Out.WriteByte(0);
                                Out.WriteUInt16(Oid);

                                if (Plr.Realm == GameData.Realms.REALMS_REALM_ORDER)
                                {
                                    Out.WritePacketString(@"|00 00 00 21 00 94 48 61 69 6C |.........!..Hail|
|20 64 65 66 65 6E 64 65 72 20 6F 66 20 74 68 65 | defender of the|
|20 45 6D 70 69 72 65 21 20 20 59 6F 75 72 20 70 | Empire!  Your p|
|65 72 66 6F 72 6D 61 6E 63 65 20 69 6E 20 62 61 |erformance in ba|
|74 74 6C 65 20 69 73 20 74 68 65 20 6F 6E 6C 79 |ttle is the only|
|20 74 68 69 6E 67 20 74 68 61 74 20 6B 65 65 70 | thing that keep|
|73 20 74 68 65 20 68 6F 72 64 65 73 20 6F 66 20 |s the hordes of |
|43 68 61 6F 73 20 61 74 20 62 61 79 2E 20 4C 65 |Chaos at bay. Le|
|74 27 73 20 62 65 67 69 6E 20 79 6F 75 72 20 74 |t's begin your t|
|72 61 69 6E 69 6E 67 20 61 74 20 6F 6E 63 65 21 |raining at once!|
|00                                              |.               |");
                                }
                                else
                                {
                                    Out.WritePacketString(@"|00 00 00 21 00 AA 4C 65 61 72 |.........!..Lear|
|6E 20 74 68 65 73 65 20 6C 65 73 73 6F 6E 73 20 |n these lessons |
|77 65 6C 6C 2C 20 66 6F 72 20 67 61 69 6E 69 6E |well, for gainin|
|67 20 74 68 65 20 66 61 76 6F 72 20 6F 66 20 74 |g the favor of t|
|68 65 20 52 61 76 65 6E 20 67 6F 64 20 73 68 6F |he Raven god sho|
|75 6C 64 20 62 65 20 6F 66 20 75 74 6D 6F 73 74 |uld be of utmost|
|20 69 6D 70 6F 72 74 61 6E 63 65 20 74 6F 20 79 | importance to y|
|6F 75 2E 20 4F 74 68 65 72 77 69 73 65 2E 2E 2E |ou. Otherwise...|
|20 54 68 65 72 65 20 69 73 20 61 6C 77 61 79 73 | There is always|
|20 72 6F 6F 6D 20 66 6F 72 20 6D 6F 72 65 20 53 | room for more S|
|70 61 77 6E 20 77 69 74 68 69 6E 20 6F 75 72 20 |pawn within our |
|72 61 6E 6B 73 2E 00                            |.......         |");
                                }
                                Plr.SendPacket(Out);
                            }
                        } break;
                    case GameData.InteractType.INTERACTTYPE_BANKER:
                        {
                            PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                            Out.WriteByte(0x1D);
                            Out.WriteByte(0);
                            Plr.SendPacket(Out);
                        } break;
                    default:
                        QtsInterface.HandleInteract(Plr, this, Menu);
                        break;
                };
            }

            base.SendInteract(Plr, Menu);
        }
예제 #28
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();
        }
예제 #29
0
        static public void F_REQUEST_CHAR_TEMPLATES(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_TEMPLATES);
            Out.Write(new byte[0x11], 0, 0x11);
            cclient.SendPacket(Out);
        }
예제 #30
0
        static public void CMSG_GetClusterListReq(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;
            PacketOut Out = new PacketOut((byte)Opcodes.SMSG_GetClusterListReply);
            byte[] ClustersList = Program.AcctMgr.BuildClusterList();

            Out.Write(ClustersList);
            cclient.SendTCPCuted(Out);

        }