示例#1
0
        public static void getCharactersData(OutPacket plew, Character chr)
        {
            plew.WriteString(chr != null ? chr.Name : "", 20);
            plew.WriteString(chr != null ? chr.Title : "", 20);
            plew.WriteByte(chr != null ? chr.Gender : 0);
            plew.WriteByte(chr != null ? chr.Level : 0);
            plew.WriteByte(chr != null ? chr.Class : 0);
            plew.WriteByte(chr != null ? chr.ClassLevel : 0);
            plew.WriteByte(0);
            plew.WriteByte(0);
            plew.WriteByte(0);
            plew.WriteByte(0);
            plew.WriteShort(0);
            plew.WriteShort(0);
            Dictionary <InventoryType.EquipType, int> equip = getEquip(chr);

            plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Weapon) ? equip[InventoryType.EquipType.Weapon] : 0); // 武器[Weapon] 8010101
            plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Outfit) ? equip[InventoryType.EquipType.Outfit] : 0); // [Outfit]     8160351
            plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Face) ? equip[InventoryType.EquipType.Face] : 0);     // 臉下[face2]  9410021
            plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Face2) ? equip[InventoryType.EquipType.Face2] : 0);   // 臉上[face]   8710013
            plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Hat) ? equip[InventoryType.EquipType.Hat] : 0);       // 帽子[hat]    8610011
            plew.WriteInt(chr != null ? chr.Eyes : 0);                                                                    // 眼睛[eye]    9110011
            plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Mantle) ? equip[InventoryType.EquipType.Mantle] : 0); // 服裝[outfit] 9510081
            plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Dress) ? equip[InventoryType.EquipType.Dress] : 0);   // 披風[mantle] 8493122
            plew.WriteInt(chr != null ? chr.Hair : 0);                                                                    // 頭髮[Hair]   9010011
        }
示例#2
0
 public static void getStatusInfo(Client c)
 {
     using (OutPacket plew = new OutPacket(ServerOpcode.CHAR_ALL))
     {
         var chr = c.Character;
         Dictionary <InventoryType.EquipType, int> equip = InventoryPacket.getEquip(chr);
         plew.WriteInt(0);                 // length + CRC
         plew.WriteInt(0);
         plew.WriteString(chr.Name, 20);
         plew.WriteString(chr.Title, 20);
         plew.WriteByte(chr.Gender);
         plew.WriteByte(chr.Level);
         plew.WriteByte(chr.Class);
         plew.WriteByte(chr.ClassLevel);
         plew.WriteByte(chr.Guild);
         plew.WriteByte(0);
         plew.WriteShort(chr.MaxHp);
         plew.WriteShort(chr.Hp);
         plew.WriteShort(chr.MaxMp);
         plew.WriteInt(chr.Mp);
         plew.WriteInt(GameConstants.getExpNeededForLevel(chr.Level));
         plew.WriteInt(0);
         plew.WriteInt(chr.Exp);
         plew.WriteInt(0);
         plew.WriteShort(chr.Rank);
         plew.WriteShort(chr.MaxFury);             // 憤怒值(Max)
         plew.WriteShort(chr.Fury);                // 憤怒值
         plew.WriteByte(3);
         plew.WriteByte(chr.JumpHeight);           // 跳躍高度
         plew.WriteShort(chr.Str);                 // 力量
         plew.WriteShort(chr.Dex);                 // 精力
         plew.WriteShort(chr.Vit);                 // 氣力
         plew.WriteShort(chr.Int);                 // 智力
         plew.WriteShort(chr.MaxAttack);           // 攻擊力(Max)
         plew.WriteShort(chr.Attack);              // 攻擊力(Min)
         plew.WriteShort(chr.MaxMagic);            // 魔攻力(Max)
         plew.WriteShort(chr.Magic);               // 魔攻力(Min)
         plew.WriteShort(chr.Defense);             // 防禦力
         plew.WriteByte(equip.ContainsKey(InventoryType.EquipType.Weapon)
                                 ? ItemFactory.weaponData[equip[InventoryType.EquipType.Weapon]].Speed
                                 : 0); // 攻擊速度 [Speed]
         plew.WriteByte(equip.ContainsKey(InventoryType.EquipType.Weapon)
                                 ? ItemFactory.weaponData[equip[InventoryType.EquipType.Weapon]].AttackRange
                                 : 0);        // 攻擊距離
         plew.WriteShort(chr.Avoid);          // 迴避率
         plew.WriteShort(chr.AbilityBonus);   // 能力上升值
         plew.WriteShort(chr.SkillBonus);     // 技能上升值
         plew.WriteShort(chr.UpgradeStr);     // 力量+
         plew.WriteShort(chr.UpgradeDex);     // 敏捷+
         plew.WriteShort(chr.UpgradeVit);     // 氣力+
         plew.WriteShort(chr.UpgradeInt);     // 智力+
         plew.WriteShort(chr.UpgradeAttack);  // 攻擊力+
         plew.WriteShort(chr.UpgradeMagic);   // 魔攻力+
         plew.WriteShort(chr.UpgradeDefense); // 防禦力+
         plew.WriteShort(0);
         plew.WriteShort(0);                  // Not read
         c.Send(plew);
     }
 }
示例#3
0
 public static void World_Ack(Client c)
 {
     using (var plew = new OutPacket(LoginServerOpcode.WORLD_ACK))
     {
         plew.WriteString("10.7.0.10");                 //Character Server
         plew.WriteString("15015");
         plew.WriteString("10.7.0.10");                 //Messenger Server
         plew.WriteString("15111");
         c.Send(plew);
     }
 }
示例#4
0
        public static byte[] MapleChatMessage(string sender, string text)
        {
            using (OutPacket p = new OutPacket(SendOps.MapleChat))
            {
                p.WriteByte(6); // NOTE: Mode.
                p.WriteString(sender);
                p.WriteString(text);

                return(p.ToArray());
            }
        }
示例#5
0
 public static void GameVersionInfoAck(Client c)
 {
     using (var plew = new OutPacket(LoginServerOpcode.PATCH_ACK))
     {
         plew.WriteInt(LoginServer.PatchVer);                 // Patch Version from patch.dat
         plew.WriteInt(0);
         plew.WriteString(LoginServer.PatchDownloadUrl);
         plew.WriteString("live/");
         c.Send(plew);
     }
 }
示例#6
0
        public static byte[] SelectCharacter(string pic, int characterId)
        {
            using (OutPacket p = new OutPacket(SendOps.SelectCharacter))
            {
                p.WriteString(pic);
                p.WriteInt(characterId);
                p.WriteString("6-4-3-2-1-5");
                p.WriteEmpty(10);

                return(p.ToArray());
            }
        }
示例#7
0
 public static void InvenUseSpendShout(Client c, Character chr, string message)
 {
     using (OutPacket plew = new OutPacket(ServerOpcode.INVEN_USESPEND_SHOUT_ACK))
     {
         plew.WriteInt(0);  // length + CRC
         plew.WriteInt(0);
         plew.WriteByte(1); // 頻道
         plew.WriteString(chr.Name, 20);
         plew.WriteString(message, 65);
         plew.WriteShort(1); // 類型
         c.Send(plew);
     }
 }
示例#8
0
        public static void ServerList_Ack(Client c)
        {
            using (var plew = new OutPacket(LoginServerOpcode.SERVERLIST_ACK))
            {
                for (int i = 0; i < 13; i++)
                {
                    plew.WriteByte(0xFF);
                }
                plew.WriteInt(LoginServer.Worlds.Count); // 伺服器數量
                foreach (World world in LoginServer.Worlds)
                {
                    plew.WriteShort(world.ID);    // 伺服器順序
                    plew.WriteInt(world.Channel); // 頻道數量

                    for (int i = 0; i < 18; i++)
                    {
                        plew.WriteShort(i + 1);
                        plew.WriteShort(i + 1);
                        plew.WriteString(ServerConstants.SERVER_IP);
                        plew.WriteInt(14101 + i);
                        plew.WriteInt(i < world.Count ? world[i].LoadProportion : 0); // 玩家數量
                        plew.WriteInt(ServerConstants.CHANNEL_LOAD);                  // 頻道人數上限
                        plew.WriteInt(12);                                            // 標章類型
                        plew.WriteInt(0);
                        plew.WriteByte(i < world.Count ? 1 : 2);
                        plew.WriteInt(14199);
                    }
                }

                c.Send(plew);
            }
        }
示例#9
0
        /// <summary>
        /// Sends the initial patch data packet to the socket.
        /// </summary>
        /// <param name="version">The version's information</param>
        /// <param name="patchLocation">The patch data URL</param>
        public void SendPatchData(Version version, string patchLocation)
        {
            //F**k!!!!!
            Random rnd = new Random();

            uint val_first  = 0; //(uint)rnd.Next();
            uint val_second = 0; //(uint)rnd.Next() ;

            using (OutPacket outPacket = new OutPacket())
            {
                outPacket.WriteHexString("80 05 2B 28"); // NOTE: Header. Do not change. Probably typeid() of handler.
                outPacket.WriteShort(version.Localisation);
                outPacket.WriteShort(version.Major);
                outPacket.WriteShort(version.Minor);
                outPacket.WriteString(patchLocation);
                outPacket.WriteInt((int)val_first); // NOTE: IV Keys. Should we do random stuffs?
                outPacket.WriteInt((int)val_second);
                outPacket.WriteByte(0xE0);          // NOTE: Some stuff used on Region / Service Area.
                outPacket.WriteHexString("03 00 09 03 00 00 03 00 00 00 00 00 83 A3 E5 47 00 00 15 00 0D 00 00 00 03 00 00 00 00 00 65");

                this.Send(outPacket);
            }

            riv = val_first ^ val_second;
            siv = val_first ^ val_second;
        }
示例#10
0
        public static void ServerList_Ack(Client c)
        {
            using (var plew = new OutPacket(LoginServerOpcode.SERVERLIST_ACK))
            {
                for (int i = 0; i < 13; i++)
                {
                    plew.WriteByte(0xFF);
                }
                plew.WriteInt(LoginServer.Worlds.Count);                 // Number of servers
                foreach (World world in LoginServer.Worlds)
                {
                    plew.WriteShort(world.ID);                     // Server order
                    plew.WriteInt(world.Channel);                  // Number of channels

                    for (int i = 0; i < 8; i++)
                    {
                        plew.WriteShort(i + 1);
                        plew.WriteShort(i + 1);
                        plew.WriteString(ServerConstants.SERVER_IP);
                        plew.WriteInt(15101 + i);
                        plew.WriteInt(i < world.Count ? world[i].LoadProportion : 0); // Number of players
                        plew.WriteInt(ServerConstants.CHANNEL_LOAD);                  // Maximum number of channels
                        plew.WriteInt(2);                                             // Type of seal
                        plew.WriteInt(0);
                        plew.WriteByte(i < world.Count ? 1 : 4);                      // Channel open
                        plew.WriteInt(15199);
                    }
                }

                c.Send(plew);
            }
        }
示例#11
0
 public static void PartyUpdate(Client c)
 {
     using (OutPacket plew = new OutPacket(ServerOpcode.PARTY_UPDATE))
     {
         var chr = c.Character;
         plew.WriteInt(0); // length + CRC
         plew.WriteInt(0);
         for (int i = 0; i < 6; i++)
         {
             // 個人 + 其他 5 名隊員
             plew.WriteInt(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.CharacterID : -1);
             plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.Level : 0);
             plew.WriteString((i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.Name : ""), 20);
             plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.MaxHp : 0);
             plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.Hp : 0);
             plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.MaxMp : 0);
             plew.WriteShort(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.Mp : 0); // 尚未確認
             plew.WriteHexString("1F 40");
             plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[0] : 0);
             plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[1] : 0);
             plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[2] : 0);
             plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[3] : 0);
             plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[0] : 0);
             plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[1] : 0);
             plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[2] : 0);
             plew.WriteByte(i < chr.Party.getMembers().Count ? chr.Party.getMembers()[i].Character.IP.GetAddressBytes()[3] : 0);
         }
         c.Send(plew);
     }
 }
示例#12
0
        public static void ServerList_Ack(Client c)
        {
            using (var plew = new OutPacket(LoginServerOpcode.SERVERLIST_ACK))
            {
                for (int i = 0; i < 13; i++)
                {
                    plew.WriteByte(0xFF);
                }
                plew.WriteInt(LoginServer.Worlds.Count); // 伺服器數量 Number of servers
                Log.Inform("Number of servers LoginServer.Worlds.Count : {0}", LoginServer.Worlds.Count);
                foreach (World world in LoginServer.Worlds)
                {
                    Log.Inform("Server order world.ID : {0}", world.ID);
                    Log.Inform("Number of channels world.Channel : {0}", world.Channel);
                    plew.WriteShort(world.ID);    // 伺服器順序 Server order
                    plew.WriteInt(world.Channel); // 頻道數量 Number of channels

                    for (int i = 0; i < 18; i++)
                    {
                        plew.WriteShort(i + 1);
                        plew.WriteShort(i + 1);
                        plew.WriteString(ServerConstants.SERVER_IP);
                        plew.WriteInt(15101 + i);
                        plew.WriteInt(i < world.Count ? world[i].LoadProportion : 0); // Number of players
                        plew.WriteInt(ServerConstants.CHANNEL_LOAD);                  // Maximum number of channels
                        plew.WriteInt(12);                                            // 標章類型 Stamp type
                        plew.WriteInt(0);
                        plew.WriteByte(i < world.Count ? 1 : 2);
                        plew.WriteInt(15199);
                    }
                }

                c.Send(plew);
            }
        }
示例#13
0
        public static void getInvenPet5(Client c)
        {
            using (OutPacket plew = new OutPacket(ServerOpcode.INVEN_PET5))
            {
                var chr = c.Character;
                plew.WriteInt(0); // length + CRC
                plew.WriteInt(0);
                for (byte i = 0; i < 24; i++)
                {   // 寵物編號
                    plew.WriteInt(chr.Pets.ItemID((byte)InventoryType.ItemType.Pet5, i));
                }
                for (byte i = 0; i < 24; i++)
                {   // 寵物名稱
                    plew.WriteString(chr.Pets.Name((byte)InventoryType.ItemType.Pet5, i), 20);
                }
                for (byte i = 0; i < 24; i++)
                {   // 寵物等級
                    plew.WriteByte(chr.Pets.Level((byte)InventoryType.ItemType.Pet5, i));
                }
                for (byte i = 0; i < 24; i++)
                {   // 寵物血量
                    plew.WriteInt(chr.Pets.Hp((byte)InventoryType.ItemType.Pet5, i));
                }
                for (byte i = 0; i < 24; i++)
                {    // 寵物經驗值
                    plew.WriteInt(chr.Pets.Exp((byte)InventoryType.ItemType.Pet5, i));
                }
                for (int i = 0; i < 24; i++)
                {    //
                    plew.WriteInt(chr.Pets.Mp((byte)InventoryType.ItemType.Pet5, i));
                }
                for (int i = 0; i < 24; i++)
                {    // 截止日期
                    plew.WriteInt(-1);
                }
                for (byte i = 0; i < 24; i++)
                {   //
                    plew.WriteShort(chr.Pets.ItemID((byte)InventoryType.ItemType.Pet5, i) == 0 ? 0 : 1);
                }
                for (int i = 0; i < 24; i++)
                {   //
                    plew.WriteInt(0);
                }
                for (int i = 0; i < 24; i++)
                {   // 物品Lock
                    plew.WriteByte(0);
                }
                for (int i = 0; i < 24; i++)
                {   //
                    plew.WriteInt(0);
                }
                for (int i = 0; i < 24; i++)
                {   // 物品Icon
                    plew.WriteShort(0);
                }

                c.Send(plew);
            }
        }
示例#14
0
        public static byte[] Login(string password, string authenticationToken)
        {
            using (OutPacket p = new OutPacket(SendOps.Login))
            {
                p.WriteString(password);
                p.WriteString(authenticationToken);
                p.WriteInt();
                p.WriteShort();
                p.WriteInt(MapleConnection.User.HardwareID_1);
                p.WriteInt();
                p.WriteInt(MapleConnection.User.HardwareID_2);
                p.WriteShort();
                p.WriteLong(2);

                return(p.ToArray());
            }
        }
示例#15
0
        public static void Char_Ack(Client c, ServerState.ChannelState state)
        {
            using (var plew = new OutPacket(LoginServerOpcode.CHAR_ACK))
            {
                //plew.WriteByte((byte)state);
                plew.WriteString(ServerConstants.SERVER_IP);

                /*plew.WriteByte(0x05);
                *  plew.WriteByte(0x00);*/
                plew.WriteString("15010");
                plew.WriteString(ServerConstants.SERVER_IP);
                plew.WriteString("15111");


                c.Send(plew);
            }
        }
示例#16
0
 public static void FriendOnline(Client c)
 {
     using (var plew = new OutPacket(MessengerServerOpcode.FRIEND_ONLINE))
     {
         plew.WriteInt(0);         // length + CRC
         plew.WriteInt(0);
         plew.WriteString("", 20); // 玩家名稱
         c.Send(plew);
     }
 }
示例#17
0
        public byte[] GetHashPacket()
        {
            using (OutPacket outPacket = new OutPacket(0x0999))
            {
                foreach (string path in Directory.GetFiles(this.Config.MapleStoryPath))
                {
                    string extension = Path.GetExtension(path);
                    string name      = Path.GetFileNameWithoutExtension(path);

                    if (extension.ToLower().Contains("wz"))
                    {
                        outPacket.WriteString(name);
                        outPacket.WriteString(HashUtilities.GetMD5HashFromFile(path));
                    }
                }

                return(outPacket.ToArray());
            }
        }
示例#18
0
        public bool IsNameTaken(string name)
        {
            using (OutPacket outPacket = new OutPacket(InteroperabilityMessage.CharacterNameCheckRequest))
            {
                outPacket.WriteString(name);

                this.RandomChannel.Send(outPacket);
            }

            return(this.CharacterNamePool.Dequeue(name));
        }
示例#19
0
        public void SendServerList(ClientSession cs)
        {
            /*string ServerName = Settings.GetString("GameServer/ServerName");
            *  string ServerDesc = Settings.GetString("GameServer/ServerDesc");
            *  string ServerIP = Settings.GetString("GameServer/ExternalIP");
            *  short ServerPort = Settings.GetShort("GameServer/Port");
            *
            *  string TestServerName = Settings.GetString("GameServerTest/ServerName");
            *  string TestServerDesc = Settings.GetString("GameServerTest/ServerDesc");
            *  string TestServerIP = Settings.GetString("GameServerTest/ExternalIP");
            *  short TestServerPort = Settings.GetShort("GameServerTest/Port");*/

            using (OutPacket oPacket = new OutPacket(CenterOpcodes.ENU_SERVER_LIST_NOT))
            {
                LoadServerList();
                oPacket.WriteInt(serverlist.Length); // 서버 개수
                int i = 0;
                for (int j = 0; j < serverlist.Length; j++)
                {
                    oPacket.WriteInt(i + 1); // 서버 번호
                    oPacket.WriteInt(i + 1); // 서버 번호 2
                    oPacket.WriteInt(serverlist[j].ServerName.Length * 2);
                    oPacket.WriteUnicodeString(serverlist[j].ServerName);
                    oPacket.WriteInt(serverlist[j].ServerIP.Length);
                    oPacket.WriteString(serverlist[j].ServerIP);
                    oPacket.WriteShort((short)serverlist[j].ServerPort);
                    oPacket.WriteInt(serverlist[j].Users);           // 현재 접속중인 인원
                    oPacket.WriteInt(serverlist[j].MaxUsers);        // 최대 접속가능 인원
                    oPacket.WriteInt(serverlist[j].Flag);            //00 00 01 43 //323
                    oPacket.WriteHexString("FF FF FF FF FF FF FF FF");
                    oPacket.WriteInt(serverlist[j].ServerIP.Length); // 아이피를 또 보낸다.
                    oPacket.WriteString(serverlist[j].ServerIP);     // ㅄ
                    oPacket.WriteInt(serverlist[j].ServerDesc.Length * 2);
                    oPacket.WriteUnicodeString(serverlist[j].ServerDesc);
                    oPacket.WriteInt(serverlist[j].ServerType);
                }

                oPacket.Assemble(cs.CRYPT_KEY, cs.CRYPT_HMAC, cs.CRYPT_PREFIX, ++cs.CRYPT_COUNT);
                cs.Send(oPacket);
            }
        }
示例#20
0
 public static void SellStart(Client c, Character chr, string Name)
 {
     using (OutPacket plew = new OutPacket(ServerOpcode.PSHOP_SELLSTARTACK))
     {
         plew.WriteInt(0);                 // length + CRC
         plew.WriteInt(0);
         plew.WriteInt(chr.CharacterID);
         plew.WriteInt(0);
         plew.WriteString(Name, 40);
         c.Send(plew);
     }
 }
示例#21
0
        public static void Game_Ack(Client c, ServerState.ChannelState state)
        {
            using (var plew = new OutPacket(LoginServerOpcode.GAME_ACK))
            {
                plew.WriteByte((byte)state);
                plew.WriteString(ServerConstants.SERVER_IP);
                plew.WriteInt(15101 + c.World.ID);
                plew.WriteInt(ServerConstants.UDP_PORT);

                c.Send(plew);
            }
        }
        protected override void Initialize(params object[] args)
        {
            using (OutPacket outPacket = new OutPacket(InteroperabilityMessage.RegistrationRequest))
            {
                outPacket.WriteByte((byte)ServerUtilities.ServerType.Char);
                outPacket.WriteString((string)args[0]);
                outPacket.WriteBytes(MessageServer.RemoteEndPoint.Address.GetAddressBytes());
                outPacket.WriteUShort((ushort)MessageServer.RemoteEndPoint.Port);

                this.Send(outPacket);
            }
        }
示例#23
0
        public static void getNotice(Client c, byte type, string message)
        {
            using (OutPacket plew = new OutPacket(ServerOpcode.NOTICE))
            {
                plew.WriteInt(0); // length + CRC
                plew.WriteInt(0);
                plew.WriteByte(type);
                plew.WriteString(message, 60);
                plew.WriteHexString("00 00 00 00 00 00 00");

                c.Send(plew);
            }
        }
示例#24
0
        public static void Refresh(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Hooked guild.Refresh with null of activeCharacter");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            OutPacket op = new OutPacket(40);

            op.WriteInt(40);
            op.WriteShort(5);
            op.WriteShort(0x41);
            op.WriteInt(1);
            op.WriteShort(13413);
            c.WriteRawPacket(op.ToArray());

            op = new OutPacket(32);
            op.WriteInt(32);
            op.WriteShort(4);
            op.WriteShort(97);
            op.WriteInt(1);
            op.WriteShort(-15349);
            op.WriteShort((short)chr.getuID());
            op.WriteLong();
            op.WriteLong();
            c.WriteRawPacket(op.ToArray());

            op = new OutPacket(136);
            op.WriteInt(136);
            op.WriteShort(4);
            op.WriteShort(81);
            op.WriteInt(1);
            op.WriteShort(-15349);
            op.WriteShort((short)chr.getuID());
            op.WriteShort(1);
            op.WriteShort(30726);
            op.WriteString("PolishPoverty");
            c.WriteRawPacket(op.ToArray());

            op = new OutPacket(20);
            op.WriteInt(20);
            op.WriteInt(5);
            op.WriteInt(937683714);             // those values.. lelellele
            op.WriteInt(680);
            op.WriteInt(939117056);
            c.WriteRawPacket(op.ToArray());
        }
示例#25
0
        public static void ShopInfo(Client c, Character Seller, int CharacterID)
        {
            using (OutPacket plew = new OutPacket(ServerOpcode.PSHOP_INFOACK))
            {
                plew.WriteInt(0);                 // length + CRC
                plew.WriteInt(0);
                plew.WriteInt(CharacterID);
                plew.WriteString(Seller.Shop.Name, 40);
                for (int i = 0; i < 12; i++)
                {
                    plew.WriteInt(i < Seller.Shop.Count ? Seller.Shop.ItemID(i) : 0);
                    plew.WriteShort(i < Seller.Shop.Count ? Seller.Shop.Spirit(i) : 0);
                    plew.WriteShort(i < Seller.Shop.Count ? Seller.Shop.Quantity(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level1(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level2(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level3(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level4(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level5(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level6(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level7(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level8(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level9(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Level10(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.Fusion(i) : 0);
                    plew.WriteByte(i < Seller.Shop.Count ? Seller.Shop.IsLocked(i) : 0);
                    plew.WriteInt(i < Seller.Shop.Count ? Seller.Shop.Price(i) : 0);
                    plew.WriteByte(0);                     // 力量+
                    plew.WriteByte(0);                     // 氣力+
                    plew.WriteByte(0);                     // 精力+
                    plew.WriteByte(0);                     // 智力+
                    plew.WriteByte(0);
                    plew.WriteByte(0);
                    plew.WriteByte(0);                     // 防禦力+
                    plew.WriteByte(0);                     // 物理攻擊力+
                    plew.WriteInt(0);
                    plew.WriteInt(0);
                    plew.WriteInt(0);
                }

                c.Send(plew);
            }
        }
示例#26
0
        public static void AddCharStats(OutPacket p, MapleCharacter chr)
        {
            p.WriteInt(chr.Id); // character id
            p.WriteString(chr.Name);
            // 填充名字字符
            // p.WriteZero(13 - Encoding.Default.GetByteCount(chr.CharacterName));
            for (var x = Encoding.Default.GetByteCount(chr.Name); x < 13; x++)
            {
                // fill to maximum name length
                p.WriteByte(0);
            }

            p.WriteBool(chr.Gender);       // gender (0 = male, 1 = female)
            p.WriteByte(chr.Skin.ColorId); // skin color
            p.WriteInt(chr.Face);          // face
            p.WriteInt(chr.Hair);          // hair
            p.WriteLong(0);
            p.WriteLong(0);
            p.WriteLong(0);
            p.WriteByte(chr.Level);        // level
            p.WriteShort(chr.Job.JobId);   // job
            p.WriteShort(chr.Str);         // str
            p.WriteShort(chr.Dex);         // dex
            p.WriteShort(chr.Int);         // int
            p.WriteShort(chr.Luk);         // luk
            p.WriteShort(chr.Hp);          // hp (?)
            p.WriteShort(chr.MaxHp);       // maxhp
            p.WriteShort(chr.Mp);          // mp (?)
            p.WriteShort(chr.MaxMp);       // maxmp
            p.WriteShort(chr.RemainingAp); // remaining ap
            p.WriteShort(chr.RemainingSp); // remaining sp
            p.WriteInt(chr.Exp.Value);     // current exp
            p.WriteShort(chr.Fame);        // fame
            p.WriteInt(0);
            p.WriteLong(DateUtiliy.GetFileTimestamp(DateTime.Now.GetTimeMilliseconds()));
            p.WriteInt(chr.Map?.MapId ?? 10000); // current map id
            p.WriteByte(chr.InitialSpawnPoint);  // spawnpoint
        }
示例#27
0
        public static void warpToMap(Client c, Character chr, int CharacterID, short MapX, short MapY, short PositionX, short PositionY)
        {
            using (OutPacket plew = new OutPacket(ServerOpcode.ENTER_WARP_ACK))
            {
                Dictionary <InventoryType.EquipType, int> equip = InventoryPacket.getEquip(chr);

                int WeaponUpgradeAttack = 0;
                if (equip.ContainsKey(InventoryType.EquipType.Weapon))
                {
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level1 * 10;
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level2 * 9;
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level3 * 8;
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level4 * 7;
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level5 * 6;
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level6 * 5;
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level7 * 4;
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level8 * 3;
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level9 * 2;
                    WeaponUpgradeAttack += chr.Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level10 * 1;
                }

                plew.WriteInt(0);           // length + CRC
                plew.WriteInt(0);
                plew.WriteInt(CharacterID); // 角色編號
                plew.WriteString(chr.Name, 20);
                plew.WriteString(chr.Title, 20);
                plew.WriteShort(MapX);
                plew.WriteShort(MapY);
                plew.WriteShort(PositionX);
                plew.WriteShort(PositionY);
                plew.WriteByte(chr.Gender);
                plew.WriteByte(chr.Level);
                plew.WriteByte(chr.Class);
                plew.WriteByte(chr.ClassLevel);
                plew.WriteByte(chr.Guild);
                plew.WriteByte(0); // 光圈
                plew.WriteByte(chr.IsHiding == false ? 0 : 1);
                plew.WriteByte(chr.IsFuring == false ? 0 : chr.FuringType);
                plew.WriteInt(0);                                                                                             // (byte)
                plew.WriteInt(chr.Hair);                                                                                      // 頭髮
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Face) ? equip[InventoryType.EquipType.Face] : 0);     // 臉上
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Face2) ? equip[InventoryType.EquipType.Face2] : 0);   // 臉下
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Hat) ? equip[InventoryType.EquipType.Hat] : 0);       // 帽子
                plew.WriteInt(chr.Eyes);                                                                                      // 眼睛
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Outfit) ? equip[InventoryType.EquipType.Outfit] : 0); // 衣服
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Dress) ? equip[InventoryType.EquipType.Dress] : 0);   // 服裝
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Weapon) ? equip[InventoryType.EquipType.Weapon] : 0); // 武器
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Mantle) ? equip[InventoryType.EquipType.Mantle] : 0); // 披風
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Pet) ? equip[InventoryType.EquipType.Pet] : 0);       // 靈物
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Toy) ? equip[InventoryType.EquipType.Toy] : 0);       // 玩物
                // 寵物
                plew.WriteString(chr.Pets.Name((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet), 20);   // PetName
                plew.WriteInt(chr.Pets.Level((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet));         // PetLevel
                plew.WriteInt(chr.Pets.Hp((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet));            // PetHP
                plew.WriteInt(chr.Pets.Mp((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet));
                plew.WriteInt(chr.Pets.Exp((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet));
                plew.WriteInt(chr.Pets.DecorateID((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet));
                plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Pet) ? chr.UseSlot[(byte)InventoryType.ItemType.Pet5] : 0);
                // 玩物
                plew.WriteString("", 20); // ToyName
                plew.WriteInt(0);         // ToyLevel
                plew.WriteInt(0);
                plew.WriteInt(0);
                plew.WriteInt(0);
                //
                plew.WriteShort(0);                   // (byte)
                plew.WriteShort(WeaponUpgradeAttack); // 武器 Glow ++
                plew.WriteShort(0);
                plew.WriteByte(int.Parse(chr.Client.Title.Split('.')[0]));
                plew.WriteByte(int.Parse(chr.Client.Title.Split('.')[1]));
                plew.WriteByte(int.Parse(chr.Client.Title.Split('.')[2]));
                plew.WriteByte(int.Parse(chr.Client.Title.Split('.')[3]));
                plew.WriteByte(chr.IP.GetAddressBytes()[0]);
                plew.WriteByte(chr.IP.GetAddressBytes()[1]);
                plew.WriteByte(chr.IP.GetAddressBytes()[2]);
                plew.WriteByte(chr.IP.GetAddressBytes()[3]);
                plew.WriteHexString("1F 40"); // Port
                plew.WriteShort(0);           // (byte)
                plew.WriteShort(0);
                plew.WriteHexString("00 00 00 00 00 00 00 00");
                plew.WriteInt(-1);
                plew.WriteByte(0);
                plew.WriteByte(0);
                plew.WriteByte(0);
                plew.WriteByte(0);
                plew.WriteByte(0);
                plew.WriteByte(0);
                plew.WriteShort(-1);
                plew.WriteByte(-1);
                plew.WriteByte(0); // 觀戰
                plew.WriteByte(0);
                plew.WriteByte(0);
                //Log.Inform("(My) MapX = {0} , MapY = {1}", MapX, MapY);
                //Log.Inform("(My) CharacterID = {0} 遠端IP = {1}.{2}.{3}.{4} , 虛擬IP = {5}.{6}.{7}.{8}", chr.CharacterID, int.Parse(chr.Client.Title.Split('.')[0]), int.Parse(chr.Client.Title.Split('.')[1]), int.Parse(chr.Client.Title.Split('.')[2]), int.Parse(chr.Client.Title.Split('.')[3]), chr.IP.GetAddressBytes()[0], chr.IP.GetAddressBytes()[1], chr.IP.GetAddressBytes()[2], chr.IP.GetAddressBytes()[3]);
                c.Send(plew);
            }
        }
        private void OnRegistrationRequest(InPacket inPacket)
        {
            ServerUtilities.ServerType type = (ServerUtilities.ServerType)inPacket.ReadByte();
            string     securityCode         = inPacket.ReadString();
            IPEndPoint endPoint             = new IPEndPoint(inPacket.ReadIPAddress(), inPacket.ReadUShort());
            World      world = LoginServer.Worlds.Next(type);

            bool worked = false;

            using (OutPacket outPacket = new OutPacket(InteroperabilityMessage.RegistrationResponse))
            {
                if (securityCode != LoginServer.SecurityCode)
                {
                    outPacket.WriteByte((byte)ServerUtilities.ServerRegistrationResponse.InvalidCode);

                    Log.Error(ServerUtilities.RegistrationResponseResolver.Explain(ServerUtilities
                                                                                   .ServerRegistrationResponse.InvalidCode));
                }
                else if (world == null)
                {
                    outPacket.WriteByte((byte)ServerUtilities.ServerRegistrationResponse.WorldsFull);

                    Log.Error(ServerUtilities.RegistrationResponseResolver.Explain(ServerUtilities
                                                                                   .ServerRegistrationResponse.WorldsFull));
                }
                else
                {
                    if (world.HostIP.ToString() != endPoint.Address.ToString())
                    {
                        outPacket.WriteByte((byte)ServerUtilities.ServerRegistrationResponse.InvalidIP);

                        Log.Error(ServerUtilities.RegistrationResponseResolver.Explain(ServerUtilities
                                                                                       .ServerRegistrationResponse.InvalidIP));
                    }
                    else
                    {
                        this._type          = type;
                        this.RemoteEndPoint = endPoint;
                        this.WorldID        = world.ID;

                        switch (this._type)
                        {
                        case ServerUtilities.ServerType.Char:
                        {
                            this.World.CharServer = this;

                            outPacket.WriteByte((byte)ServerUtilities.ServerRegistrationResponse.Valid);
                            outPacket.WriteByte(this.WorldID);

                            worked = true;
                        }
                        break;

                        case ServerUtilities.ServerType.Game:
                        {
                            this.World.Add(this);
                            this._id = (byte)this.World.Count;

                            outPacket.WriteByte((byte)ServerUtilities.ServerRegistrationResponse.Valid);
                            outPacket.WriteByte(this.WorldID);
                            outPacket.WriteByte(this.ExternalID);
                            outPacket.WriteString(this.World.ScrollingHeader);
                            outPacket.WriteInt(this.World.Rates.Experience);
                            outPacket.WriteInt(this.World.Rates.QuestExperience);
                            outPacket.WriteInt(this.World.Rates.PartyQuestExperience);
                            outPacket.WriteInt(this.World.Rates.Meso);
                            outPacket.WriteInt(this.World.Rates.Loot);

                            worked = true;
                        }
                        break;

                        case ServerUtilities.ServerType.Message:
                        {
                            this.World.MessageServer = this;

                            outPacket.WriteByte((byte)ServerUtilities.ServerRegistrationResponse.Valid);
                            outPacket.WriteByte(this.WorldID);

                            worked = true;
                        }
                        break;

                        case ServerUtilities.ServerType.Shop:
                        {
                            this.World.ShopServer = this;

                            outPacket.WriteByte((byte)ServerUtilities.ServerRegistrationResponse.Valid);
                            outPacket.WriteByte(this.WorldID);

                            worked = true;
                        }
                        break;
                        }
                    }
                }

                this.Send(outPacket);
            }

            if (worked)
            {
                switch (this._type)
                {
                case ServerUtilities.ServerType.Char:
                {
                    Log.Success("Registered Char {0} at {1}.", this.World.Name, this.RemoteEndPoint);
                }
                break;

                case ServerUtilities.ServerType.Game:
                {
                    Log.Success("Registered Game {0}-{1} at {2}.", this.World.Name, this.ExternalID,
                                this.RemoteEndPoint);
                }
                break;

                case ServerUtilities.ServerType.Message:
                {
                    Log.Success("Registered Message {0} at {1}.", this.World.Name, this.RemoteEndPoint);
                }
                break;

                case ServerUtilities.ServerType.Shop:
                {
                    Log.Success("Registered Shop {0} at {1}.", this.World.Name, this.RemoteEndPoint);
                }
                break;
                }
            }
            else
            {
                Log.Warn("Server registration failed.");

                this.Stop();
            }
        }
示例#29
0
        public static void createUser(Client c, Map Map)
        {
            using (OutPacket plew = new OutPacket(ServerOpcode.USER_CREATE))
            {
                var chr = Map.Characters;
                plew.WriteInt(0);                           // length + CRC
                plew.WriteInt(0);
                plew.WriteInt(Map.GetMapCharactersTotal()); // 玩家數量
                for (int i = 0; i < Map.GetMapCharactersTotal(); i++)
                {
                    Dictionary <InventoryType.EquipType, int> equip = null;
                    try
                    {
                        equip = InventoryPacket.getEquip(chr[i]);
                    }
                    catch
                    {
                        equip = null;
                    }

                    int WeaponUpgradeAttack = 0;
                    if (equip.ContainsKey(InventoryType.EquipType.Weapon))
                    {
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level1 * 10;
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level2 * 9;
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level3 * 8;
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level4 * 7;
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level5 * 6;
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level6 * 5;
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level7 * 4;
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level8 * 3;
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level9 * 2;
                        WeaponUpgradeAttack += chr[i].Items[InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Weapon].Level10 * 1;
                    }

                    plew.WriteInt(chr[i].CharacterID);  // 玩家ID(-1)
                    plew.WriteString(chr[i].Name, 20);  // 玩家名稱
                    plew.WriteString(chr[i].Title, 20); // 玩家稱號
                    plew.WriteShort(chr[i].PlayerX);    // 玩家 PositionX
                    plew.WriteShort(chr[i].PlayerY);    // 玩家 PositionY
                    plew.WriteByte(chr[i].Gender);      // 性別(1)
                    plew.WriteByte(chr[i].Level);       // 等級
                    plew.WriteByte(chr[i].Class);       // 職業
                    plew.WriteByte(chr[i].ClassLevel);
                    plew.WriteByte(chr[i].Guild);
                    plew.WriteByte(0); // 光圈
                    plew.WriteByte(0); // 隱形
                    plew.WriteByte(chr[i].Shop != null ? 1 : 0);
                    plew.WriteInt(chr[i].IsFuring == true ? chr[i].FuringType : 0);
                    plew.WriteInt(chr[i].Hair);                                                                                   // 頭髮[Hair]
                    plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Face) ? equip[InventoryType.EquipType.Face] : 0);     // 臉上[Face]
                    plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Face2) ? equip[InventoryType.EquipType.Face2] : 0);   // 臉下[Face2]
                    plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Hat) ? equip[InventoryType.EquipType.Hat] : 0);       // 頭部[Hat]
                    plew.WriteInt(chr[i].Eyes);                                                                                   // 眼睛[Eyes]
                    plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Outfit) ? equip[InventoryType.EquipType.Outfit] : 0); // 衣服[Outfit]
                    plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Dress) ? equip[InventoryType.EquipType.Dress] : 0);   // 服裝[Dress]
                    plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Weapon) ? equip[InventoryType.EquipType.Weapon] : 0); // 武器[Weapon]
                    plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Mantle) ? equip[InventoryType.EquipType.Mantle] : 0); // 披風[Mantle]
                    plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Pet) ? equip[InventoryType.EquipType.Pet] : 0);       // 靈物[Pet]
                    //plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.HairAcc) ? equip[InventoryType.EquipType.HairAcc] : 0);
                    plew.WriteInt(equip.ContainsKey(InventoryType.EquipType.Toy) ? equip[InventoryType.EquipType.Toy] : 0);       // 玩物[Toy]

                    // 寵物
                    plew.WriteString(chr[i].Pets.Name((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet), 20); // PetName
                    plew.WriteInt(chr[i].Pets.Level((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet));
                    plew.WriteInt(chr[i].Pets.Hp((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet));
                    plew.WriteInt(chr[i].Pets.Mp((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet));
                    plew.WriteInt(chr[i].Pets.Exp((byte)InventoryType.ItemType.Equip, (byte)InventoryType.EquipType.Pet));
                    plew.WriteInt(0);

                    // 玩物
                    plew.WriteString("", 20);             // ToyName
                    plew.WriteInt(0);                     // ToyLevel
                    plew.WriteInt(0);                     // ToyHP
                    plew.WriteInt(0);                     // ToyMaxMP

                    plew.WriteShort(WeaponUpgradeAttack); // 武器 Glow ++
                    plew.WriteShort(0);

                    // 遠端IP位置
                    plew.WriteByte(int.Parse(chr[i].Client.Title.Split('.')[0]));
                    plew.WriteByte(int.Parse(chr[i].Client.Title.Split('.')[1]));
                    plew.WriteByte(int.Parse(chr[i].Client.Title.Split('.')[2]));
                    plew.WriteByte(int.Parse(chr[i].Client.Title.Split('.')[3]));

                    // 遠端虛擬IP位置
                    plew.WriteByte(chr[i].IP.GetAddressBytes()[0]);
                    plew.WriteByte(chr[i].IP.GetAddressBytes()[1]);
                    plew.WriteByte(chr[i].IP.GetAddressBytes()[2]);
                    plew.WriteByte(chr[i].IP.GetAddressBytes()[3]);

                    plew.WriteHexString("1F 40");
                    // 個人商店
                    plew.WriteString(chr[i].Shop != null ? chr[i].Shop.Name : "", 40); // 個人商店名稱

                    plew.WriteShort(0);
                    plew.WriteShort(-1);
                    plew.WriteShort(0);
                    plew.WriteInt(0);
                    plew.WriteInt(0);
                    plew.WriteInt(-1);

                    plew.WriteString("", 20);

                    plew.WriteByte(0);
                    plew.WriteByte(0); // Like Warp On Player Effect
                    plew.WriteByte(0);
                    plew.WriteByte(0); // 泡泡效果
                    plew.WriteByte(0); // 泡泡效果
                    plew.WriteByte(0);
                    plew.WriteShort(0);
                    plew.WriteShort(chr[i].CharacterID);// 玩家ID [Map Number]
                    plew.WriteByte(-1);
                    plew.WriteByte(0);
                    plew.WriteByte(0);
                    plew.WriteByte(0);
                    plew.WriteShort(0);
                    //Log.Inform("(Other) CharacterID = {0} 遠端IP = {1}.{2}.{3}.{4} , 虛擬IP = {5}.{6}.{7}.{8}", chr[i].CharacterID, int.Parse(chr[i].Client.Title.Split('.')[0]), int.Parse(chr[i].Client.Title.Split('.')[1]), int.Parse(chr[i].Client.Title.Split('.')[2]), int.Parse(chr[i].Client.Title.Split('.')[3]), chr[i].IP.GetAddressBytes()[0], chr[i].IP.GetAddressBytes()[1], chr[i].IP.GetAddressBytes()[2], chr[i].IP.GetAddressBytes()[3]);
                }
                c.Send(plew);
            }
        }
示例#30
0
 public void WriteToPacket(OutPacket packet)
 {
     packet.WriteString(username);
     packet.WriteString(password);
 }