Ejemplo n.º 1
0
        public void SendAbilities()
        {
            if (!HasPlayer())
                return;

            Log.Info("AbilityInterface", "Sending " + Abilities.Count + " Abilities");

            PacketOut Out = new PacketOut((byte)Opcodes.F_CHARACTER_INFO);
            Out.WriteByte(1); // Action
            Out.WriteByte((byte)Abilities.Count);
            Out.WriteUInt16(0x300);

            foreach (Ability_Info Info in Abilities)
            {
                Out.WriteUInt16(Info.Entry);
                Out.WriteByte(Info.Level);
            }

            GetPlayer().SendPacket(Out);

            PacketOut AutoAttack = new PacketOut((byte)Opcodes.F_CHARACTER_INFO);
            AutoAttack.WriteByte(1); // Action
            AutoAttack.WriteByte(1); // Count
            AutoAttack.WriteUInt16(0x300);
            AutoAttack.WriteUInt16(245);
            AutoAttack.WriteByte(1);
            GetPlayer().SendPacket(AutoAttack);
        }
Ejemplo n.º 2
0
        static public void CL_CHECK(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;
            uint Version = packet.GetUint32();

            Log.Debug("CL_CHECK", "Launcher Version : " + Version);

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

            if (Version != Program.Version)
            {
                Out.WriteByte((byte)CheckResult.LAUNCHER_VERSION); // Version incorrect + message
                Out.WriteString(Program.Message);
                client.SendPacket(Out);

                cclient.Disconnect();
                return;
            }

            byte File = packet.GetUint8();
            UInt64 Len = 0;

            if (File >= 1)
                Len = packet.GetUint64();

            if ((long)Len != Program.Info.Length)
            {
                Out.WriteByte((byte)CheckResult.LAUNCHER_FILE);
                Out.WriteString(Program.StrInfo);
            }
            else
                Out.WriteByte((byte)CheckResult.LAUNCHER_OK);

            cclient.SendPacket(Out);
        }
Ejemplo n.º 3
0
        public void SendInteract(Player Plr, InteractMenu Menu)
        {
            if (Money > 0)
            {
                if (Plr.GetGroup() == null)
                {
                    Plr.AddMoney(Money);
                }
                else
                {
                    Plr.GetGroup().AddMoney(Money / (uint)Plr.GetGroup().Size());
                }
                Money = 0;
            }

            switch (Menu.Menu)
            {
                case 15: // Fermeture du loot

                    return;

                case 13: // Récupération de tous les items
                    if (Plr.ItmInterface.GetTotalFreeInventorySlot() < GetLootCount())
                        Plr.SendLocalizeString("", GameData.Localized_text.TEXT_OVERAGE_CANT_LOOT);
                    else
                    {
                        for (byte i = 0; i < Loots.Length; ++i)
                        {
                            if (Loots[i] == null)
                                continue;

                            TakeLoot(Plr, i);
                        }
                    }

                    break;

                case 12: // Récupération d'un item
                    TakeLoot(Plr, Menu.Num);
                    break;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
            Out.WriteByte(4);
            Out.WriteByte(GetLootCount());

            for (byte i = 0; i < Loots.Length; ++i)
            {
                if (Loots[i] == null)
                    continue;

                Out.WriteByte(i);
                Item.BuildItem(ref Out, null, Loots[i].Item, 0, 1);
            }

            Plr.SendPacket(Out);
        }
Ejemplo n.º 4
0
 public void BuildStats(ref PacketOut Out)
 {
     Out.WriteByte(0);
     for (byte i = 0; i < _BaseStats.Length; ++i)
     {
         Out.WriteByte(i);
         Out.WriteUInt16(_BaseStats[i]);
     }
 }
Ejemplo n.º 5
0
        public static void BuildObjectives(PacketOut Out, List<Quest_Objectives> Objs)
        {
            Out.WriteByte((byte)Objs.Count);

            foreach (Quest_Objectives Objective in Objs)
            {
                Out.WriteByte((byte)Objective.ObjCount);
                Out.WritePascalString(Objective.Description);
            }
        }
Ejemplo n.º 6
0
        // Change "Character_Objectives" for "Character_InProgressObjectives" for show Quest Objectives in F_QUEST_LIST
        public static void BuildObjectives(PacketOut Out, List<Character_InProgressObjectives> Objs)
        {
            Out.WriteByte((byte)Objs.Count);

            foreach (Character_InProgressObjectives Objective in Objs)
            {
                Out.WriteByte((byte)Objective.Count);
                Out.WriteByte((byte)Objective.Objective.ObjCount);
                Out.WriteUInt16(0);
                Out.WritePascalString(Objective.Objective.Description);
            }
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
        public static void Send(LobbyClient client)
        {
            PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_LOGIN_SUCCESS);
            Out.WriteUnicodeString(client.Account.RealTag,48);

            Out.WriteUInt32R(21); // Account Type

            Out.WriteInt64R(TCPManager.GetTimeStamp());

            // Temps avant expiration du compte
            Out.WriteByte(0x13); // ms
            Out.WriteByte(0x29); // sec
            Out.WriteUInt16R(0x12); // Hour

            // Date de création
            Out.WriteByte(0x0E); // day
            Out.WriteByte(0x07); // month
            Out.WriteUInt16R(2010); // Year

            Out.WriteInt32R(1450); // Temps de jeu (secondes)
            Out.WriteInt32R(client.Account.Points); // Points APB

            for(int i=1;i<6;++i)
                Out.WriteInt32R(
                    Program.FileMgr.GetFileVersion(client.Account.Id, i, true, "", "")); // Config file, Server Version

            Out.WriteInt32R(0);

            Out.WriteUInt16(0x957D);
            Out.WriteUInt16(0x0400);

            Out.WriteUInt16(0x5052);
            Out.WriteUInt16(0x4F45);
            Out.WriteUInt16(0x552E);
            Out.WriteUInt16(0x3232);
            Out.WriteUInt16(0x3738);
            Out.WriteUInt16(0x3031);
            Out.WriteUInt16(0);

            Out.WriteUInt16(0x0067);

            Out.WriteUInt64(0x526C624331313256);
            Out.WriteUInt64(0x486E314100000000);
            Out.WriteUInt16(0);
            Out.WriteStringBytes("");
            Out.WriteByte(0);

            client.SendTCP(Out);

            ANS_CHARACTER_INFO.Send(client);
        }
Ejemplo n.º 9
0
 public void SendReinitTime(Player Plr, ushort Time)
 {
     PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_INFO);
     Out.WriteUInt32(Info.Entry);
     Out.WriteByte(1);
     Out.WriteByte(2);
     Out.WriteByte(1);
     Out.WriteUInt16(0);
     Out.WritePascalString(Info.Name);
     Out.WriteUInt16(0);
     Out.WriteUInt16(Time); // Time in seconds
     Out.WriteUInt16(0);
     Out.WriteUInt16(0);
     Plr.SendPacket(Out);
 }
Ejemplo n.º 10
0
        static public void F_CONNECT(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            packet.Skip(8);
            UInt32 Tag = packet.GetUint32();
            string Token = packet.GetString(80);
            packet.Skip(21);
            string Username = packet.GetString(23);

            // TODO
            AuthResult Result = Program.AcctMgr.CheckToken(Username, Token);
            if (Result != AuthResult.AUTH_SUCCESS)
            {
                Log.Error("F_CONNECT", "Invalid Token =" + Username);
                cclient.Disconnect();
            }
            else
            {
                cclient._Account = Program.AcctMgr.GetAccount(Username);
                if (cclient._Account == null)
                {
                    Log.Error("F_CONNECT", "Invalid Account =" + Username);
                    cclient.Disconnect();
                }
                else
                {
                    //Log.Success("F_CONNECT", "MeId=" + cclient.Id);

                    GameClient Other = (cclient.Server as TCPServer).GetClientByAccount(cclient, cclient._Account.AccountId);
                    if (Other != null)
                        Other.Disconnect();

                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.S_CONNECTED);
                        Out.WriteUInt32(0);
                        Out.WriteUInt32(Tag);
                        Out.WriteByte(Program.Rm.RealmId);
                        Out.WriteUInt32(1);
                        Out.WritePascalString(Username);
                        Out.WritePascalString(Program.Rm.Name);
                        Out.WriteByte(0);
                        Out.WriteUInt16(0);
                        cclient.SendPacket(Out);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public void SendAbilityDone(ushort TargetOID)
        {
            Log.Success("Ability", "Send Done :" + Info.Entry);

            Player player = this.Caster.GetPlayer();
            PacketOut Out1 = new PacketOut((byte)Opcodes.F_USE_ABILITY);
            Out1.WriteUInt16(0);
            Out1.WriteUInt16(Info.Entry);
            Out1.WriteUInt16(Caster.Oid);
            Out1.WriteHexStringBytes("061022730601000001E601000000");
            player.DispatchPacket(Out1, true);

            PacketOut Out2 = new PacketOut((byte)Opcodes.F_USE_ABILITY);
            Out2.WriteUInt16(0);
            Out2.WriteUInt16(Info.Entry);
            Out2.WriteUInt16(Caster.Oid);
            Out2.WriteHexStringBytes("0610227302010000000001000000");
            player.DispatchPacket(Out2, true);

            PacketOut Out3 = new PacketOut((byte)Opcodes.F_SWITCH_ATTACK_MODE);
            Out3.WriteByte(1);
            Out3.Fill(0, 3);
            player.SendPacket(Out3);

            PacketOut Out4 = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER);
            Out4.WriteUInt16(Info.Entry);
            Out4.Fill(0, 10);
            player.SendPacket(Out4);
        }
Ejemplo n.º 12
0
 public void SendTok(ushort Entry, bool Print)
 {
     PacketOut Out = new PacketOut((byte)Opcodes.F_TOK_ENTRY_UPDATE);
     Out.WriteUInt32(1);
     Out.WriteUInt16((UInt16)Entry);
     Out.WriteByte(1);
     Out.WriteByte((byte)(Print ? 1 : 0));
     Out.WriteByte(1);
     GetPlayer().SendPacket(Out);
 }
Ejemplo n.º 13
0
        public static void BuildPlayerInfo(ref PacketOut Out,uint CharId, string Name, bool Online, byte Level, UInt16 Career, UInt16 Zone)
        {
            Out.WriteUInt32(CharId);
            Out.WriteByte(0);
            Out.WritePascalString(Name);
            Out.WriteByte(0);

            Out.WriteByte((byte)(Online ? 1 : 0));
            Out.WriteByte((byte)(Online ? 1 : 0));

            if (!Online)
                return;

            Out.WriteByte(Level);
            Out.WriteUInt16(0);
            Out.WriteUInt16(Career);
            Out.WriteUInt16(Zone);
            Out.WriteUInt16(1); // Guild Size
            Out.WriteByte(0);
        }
Ejemplo n.º 14
0
        static public void CL_START(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;

            string Username = packet.GetString();
            UInt32 Len = packet.GetUint32();
            byte[] Password = packet.Read((int)Len);

            bool result = Program.AcctMgr.CheckAccount(Username, Password);
            Log.Debug("CL_START", "Lancement du client : " + Username + " " + result);

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

            if (result == true)
            {
                Out.WriteByte(0);
                Out.WriteString(Program.AcctMgr.GenerateToken(Username));
            }
            else 
                Out.WriteByte(1);

            cclient.SendPacket(Out);
        }
Ejemplo n.º 15
0
        public static void Send(LobbyClient client)
        {
            List<WorldInfo> _Worlds = Program.CharMgr.GetWorlds();

            PacketOut Out = new PacketOut((UInt32)Opcodes.WORLD_LIST);
            Out.WriteInt32R(0); // Returned Code

            Out.WriteUInt16R((UInt16)_Worlds.Count); // World Count

            foreach (WorldInfo Info in _Worlds)
            {
                Out.WriteUInt32R((UInt32)Info._Info.Id); // WorldUid

                Out.WriteUnicodeString(Info._Info.Name, 32); // WorldName

                Out.WriteByte((byte)(Info.RpcID == 0 ? 0 : 1)); // Status
                Out.WriteByte(Info._Info.Population); // Pop  0:Low 1:Medium 2:High
                Out.WriteByte(Info._Info.Enf); // enf recommended , true or false
                Out.WriteByte(Info._Info.Crim); // crim recommended , true or false
            }

            client.SendTCP(Out);
        }
Ejemplo n.º 16
0
        public static void HandlePacket(BaseClient client, PacketIn packet)
        {
            WorldClient cclient = (WorldClient)client;
            UInt32 AcctId = packet.GetUint32R();

            Log.Debug("AskWorldEnter", "New client, Account = " + AcctId);

            cclient.Account = Program.CharMgr.GetAccount((int)AcctId);
            cclient.Character = Program.CharMgr.GetInfoForEnter((int)AcctId);

            PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_WORLD_ENTER);

            if (cclient.Account == null || cclient.Character == null)
                Out.WriteInt32R(1);
            else
            {
                Out.WriteInt32R(0);
                Out.WriteInt32R(cclient.Character.Character.Id);
                Out.WriteInt32R(cclient.Account.Points); // Points
                Out.WriteByte(1);
                Out.WriteInt64R(TCPManager.GetTimeStamp());
                Out.WriteFloat(5.00f); // fMarketPlaceMinimumBidPct
                Out.WriteByte(0); // GroupPublic
                Out.WriteByte(0); // GroupInvite

                Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 1, false, Program.Config.WorldName, cclient.Character.Character.Name)); // ConfigFileVersion
                Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 2, false, Program.Config.WorldName, cclient.Character.Character.Name));
                Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 3, false, Program.Config.WorldName, cclient.Character.Character.Name));
                Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 4, false, Program.Config.WorldName, cclient.Character.Character.Name));
                Out.WriteInt32R(Program.FileMgr.GetFileVersion(cclient.Account.Id, 5, false, Program.Config.WorldName, cclient.Character.Character.Name));

                Out.WriteByte(1); // Tutorial Complete
                Out.WriteByte(0); // lookInForGroup
            }

            cclient.SendTCP(Out);
        }
Ejemplo n.º 17
0
        public static void CL_INFO(BaseClient client, PacketIn packet)
        {
            Client cclient = client as Client;

            if (cclient.LastInfoRequest == 0 || cclient.LastInfoRequest <= TCPServer.GetTimeStampMS()+10000)
            {
                cclient.LastInfoRequest = TCPServer.GetTimeStampMS();

                List<Realm> Rms = Program.AcctMgr.GetRealms();

                PacketOut Out = new PacketOut((byte)Opcodes.LCR_INFO);
                Out.WriteByte((byte)Rms.Count);
                foreach (Realm Rm in Rms)
                {
                    Out.WriteByte(Convert.ToByte(Rm.Info != null));
                    Out.WriteString(Rm.Name);
                    Out.WriteUInt32(Rm.OnlinePlayers);
                    Out.WriteUInt32(Rm.OrderCount);
                    Out.WriteUInt32(Rm.DestructionCount);
                }

                cclient.SendTCP(Out);
            }
        }
Ejemplo n.º 18
0
        public static void Send(LobbyClient client)
        {
            PacketOut Out = new PacketOut((UInt32)Opcodes.LOGIN_PUZZLE);
            Out.WriteInt32R(Program.Version[0]);
            Out.WriteInt32R(Program.Version[1]);
            Out.WriteInt32R(Program.Version[2]);
            Out.WriteInt32R(Program.Build);

            Out.WriteByte(0x05);

            Out.WriteInt64R(-313054979819954861);

            Out.WriteUInt32R(0);
            Out.WriteUInt32R(0);
            Out.WriteUInt32R(0);
            client.SendTCP(Out);
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
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);
            }
        }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
0
        static public void F_DELETE_NAME(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            string CharName = packet.GetString(30);
            string UserName = packet.GetString(20);

            byte Bad = 0;

            if (CharName.Length <= 0 || CharMgr.NameIsUsed(CharName))
                Bad = 1;

            Log.Debug("F_DELETE_NAME", "Bad=" + Bad + ",Name=" + CharName);

            PacketOut Out = new PacketOut((byte)Opcodes.F_CHECK_NAME);
            Out.WriteString(CharName, 30);
            Out.WriteString(UserName, 20);
            Out.WriteByte(Bad);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            cclient.SendPacket(Out);
        }
Ejemplo n.º 23
0
        public static void SendVendorPage(Player Plr, ref List<Creature_vendor> Vendors, byte Count,byte Page)
        {
            Count = (byte)Math.Min(Count, Vendors.Count);

            Log.Success("SendVendorPage", "Count=" + Count + ",Page=" + Page + ",ItmC=" + Vendors.Count);

            PacketOut Out = new PacketOut((byte)Opcodes.F_INIT_STORE);
            Out.WriteByte(3);
            Out.WriteByte(0);
            Out.WriteByte(Page);
            Out.WriteByte(Count);
            Out.WriteByte((byte)(Page > 0 ? 0 : 1));
            Out.WriteByte(1);
            Out.WriteUInt16(0);

            for (byte i = 0; i < Count; ++i)
            {
                Out.WriteByte(i);
                Out.WriteByte(3); // sometimes 1
                Out.WriteUInt32(Vendors[i].Price);
                Item.BuildItem(ref Out, null, Vendors[i].Info, 0, 1);

                Out.WriteByte((byte)Vendors[i].ItemsReqInfo.Count); // ReqItemSize
                foreach (KeyValuePair<UInt16, Item_Info> Kp in Vendors[i].ItemsReqInfo)
                {
                    Out.WriteUInt32(Kp.Value.Entry);
                    Out.WriteUInt16((UInt16)Kp.Value.ModelId);
                    Out.WritePascalString(Kp.Value.Name);
                    Out.WriteUInt16(Kp.Key);
                    Out.Fill(0, 18);
                }
            }

            Out.WriteByte(0);
            Plr.SendPacket(Out);

            Vendors.RemoveRange(0, Count);
        }
Ejemplo n.º 24
0
        public void SendEquiped(Player Plr, List<UInt16> Itms)
        {
            int Invalide = Itms.Count(slot => !IsEquipedSlot(slot));
            if (Invalide >= Itms.Count)
                return;

            PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_INVENTORY);
            Out.WriteUInt16(_Owner.Oid);
            Out.WriteUInt16((UInt16)(Itms.Count - Invalide)); // Count
            foreach (UInt16 Slot in Itms)
            {
                if (!IsEquipedSlot(Slot))
                    continue;

                Out.WriteUInt16(Slot);
                Out.WriteUInt16((UInt16)(Items[Slot] != null ? Items[Slot].ModelId : 0));
            }
            Out.WriteByte(0);

            if (Plr != null)
                Plr.SendPacket(Out);
            else
                _Owner.DispatchPacket(Out, false);
        }
Ejemplo n.º 25
0
        static public void F_ENCRYPTKEY(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            sEncrypt Result = BaseClient.ByteToType<sEncrypt>(packet);

            string Version = Result.major + "." + Result.minor + "." + Result.revision;

            Log.Debug("F_ENCRYPTKEY", "Version = " + Version);

            if (Result.cipher == 0)
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_RECEIVE_ENCRYPTKEY);
                Out.WriteByte(1);
                cclient.SendPacket(Out);
            }
            else if (Result.cipher == 1)
            {
                byte[] EncryptKey = new byte[256];
                packet.Read(EncryptKey, 0, EncryptKey.Length);
                cclient.AddCrypt("RC4Crypto", new CryptKey(EncryptKey), new CryptKey(EncryptKey));
            }
        }
Ejemplo n.º 26
0
        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);
        }
Ejemplo n.º 27
0
        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);
        }
Ejemplo n.º 28
0
        public override void SendMeTo(Player Plr)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_STATIC);
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);

            Out.WriteUInt16((UInt16)Spawn.WorldO);
            Out.WriteUInt16((UInt16)Spawn.WorldZ);
            Out.WriteUInt32((UInt32)Spawn.WorldX);
            Out.WriteUInt32((UInt32)Spawn.WorldY);
            Out.WriteUInt16((ushort)Spawn.DisplayID);

            Out.WriteUInt16(Spawn.Proto.GetUnk(0));
            Out.WriteUInt16(Spawn.Proto.GetUnk(1));
            Out.WriteUInt16(Spawn.Proto.GetUnk(2));
            Out.WriteByte(0);
            Out.WriteUInt16(Spawn.Proto.GetUnk(3));
            Out.Fill(0, 5);
            Out.WriteUInt16(Spawn.Proto.GetUnk(4));
            Out.WriteUInt16(Spawn.Proto.GetUnk(5));

            Out.WriteUInt32(0);

            Out.WritePascalString(Name);
            Out.WriteByte(0);

            Plr.SendPacket(Out);

            base.SendMeTo(Plr);
        }
Ejemplo n.º 29
0
        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);*/
        }
Ejemplo n.º 30
0
        public void SendInspect(Player Plr)
        {
            byte Count = 0;
            for (UInt16 i = 0; i < MAX_EQUIPED_SLOT; ++i)
                if (Items[i] != null)
                    ++Count;

            PacketOut Out = new PacketOut((byte)Opcodes.F_SOCIAL_NETWORK);
            Out.WriteUInt16(_Owner.Oid);
            Out.WriteByte(7); // Inspect Code
            Out.WriteByte(Count);

            for (UInt16 i = 0; i < MAX_EQUIPED_SLOT; ++i)
                if (Items[i] != null)
                    Item.BuildItem(ref Out, Items[i], null, 0, 0);
            Out.WriteByte(0);
            Plr.SendPacket(Out);
        }