コード例 #1
0
 public void ReadPacket(PacketReader reader)
 {
     Unknown1 = reader.ReadBoolean();
     Unknown2 = reader.ReadBoolean();
     Unknown3 = reader.ReadInt32();
     Unknown4 = reader.ReadInt32();
 }
コード例 #2
0
ファイル: Npcs.cs プロジェクト: CarlosX/DarkEmu
        /////////////////////////////////////////////////////////////////////////////////
        // Open Npc
        /////////////////////////////////////////////////////////////////////////////////
        protected void Open_NPC()
        {
            #region Open Npc
            try
            {
                Character.State.Busy = true;
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                Reader.UInt32();
                byte type = Reader.Byte();

                if (type == 1)
                {
                    client.Send(Packet.OpenNPC(type));
                }
                else
                {
                    client.Send(Packet.OpenNPC(type));
                }
                Reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            #endregion
        }
コード例 #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void ZoneCluster_HandlerLoginZoneCluster( NetState netState, PacketReader packetReader )
        {
            ZoneCluster_ListenerExtendData extendData = netState.GetComponent<ZoneCluster_ListenerExtendData>( ZoneCluster_ListenerExtendData.COMPONENT_ID );
            if ( extendData == null )
                throw new Exception( "ZoneCluster_PacketHandlers.ZoneCluster_HandlerLoginZoneCluster(...) - extendData == null error!" );

            if ( extendData.IsLoggedIn == true )
            {
                LOGs.WriteLine( LogMessageType.MSG_ERROR, "ZoneCluster_PacketHandlers.ZoneCluster_HandlerLoginZoneCluster(...) - extendData.IsLoggedIn == true error!" );
                return;
            }

            string strZoneClusterPassword = packetReader.ReadUTF8String();
            string strZoneOrDomainPassword = packetReader.ReadUTF8String();

            if ( extendData.ConfigZoneCluster.ZoneClusterPassword == strZoneClusterPassword )
            {
                extendData.IsLoggedIn = true;

                // 检查是 Domain 服务端登陆 还是 Zone客户端登陆
                if ( extendData.ConfigZoneCluster.DomainPassword == strZoneOrDomainPassword )
                    extendData.IsDomainServer = true;
                else
                    extendData.IsZoneServer = true;

                extendData.ServerPassword = strZoneOrDomainPassword;
            }

            netState.Send( new ZoneCluster_LoginZoneClusterResult( extendData.IsLoggedIn ) );
        }
コード例 #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void LoginServerConnectFromCharServer( NetState netState, PacketReader packetReader )
        {
            // 错误 不可能有创建
            if ( netState.ExtendData is CharServerExtendData == true )
                return;
            else
                netState.ExtendData = null;

            if ( packetReader.Size < 14/*6 + 8 + ?*/ )
                return;

            // 不检查网络是否活动
            netState.IsCheckActivity = false;

            long l_iCharGUID = packetReader.ReadUInt32();
            long l_iCharPort = packetReader.ReadUInt32();
            string l_strLoginPassword = packetReader.ReadStringSafe();

            if ( l_strLoginPassword == Program.ConfigInfo.LoginPassword )
            {
                CharServerExtendData l_ExtendData = new CharServerExtendData();

                l_ExtendData.IsLoggedIn = true;
                l_ExtendData.CharGUID = l_iCharGUID;
                l_ExtendData.CharHost = netState.NetAddress.ToString();
                l_ExtendData.CharPort = l_iCharPort;

                netState.ExtendData = l_ExtendData;

                Program.CharServerList.Add(l_ExtendData);

                l_ExtendData.ConnectToCharServer( l_ExtendData.CharHost, l_ExtendData.CharPort );
            }
        }
コード例 #5
0
ファイル: Deletion.cs プロジェクト: CarlosX/DarkEmu
 //Void character delete
 void CharacterDelete()
 {
     //Wrap our function in a catcher
     try
     {
         //Create new packet reader
         PacketReader Reader = new PacketReader(PacketInformation.buffer);
         //Skip one not used byte
         Reader.Skip(1);
         //Get character name information
         string CharacterName = Reader.Text();
         //Close packet reader
         Reader.Close();
         //Update and set time + deletion state into the database
         MsSQL.InsertData("UPDATE character SET deletedtime=dateadd(dd,7,getdate()),deleted='1' WHERE name='" + CharacterName + "'");
         //Send visual state of character on screen sit down
         client.Send(Packet.ScreenSuccess(3));
     }
     //Catch bad exception errors
     catch (Exception ex)
     {
         //Write information to the console
         Console.WriteLine("Character deletion error {0}", ex);
         //Write information to debug logger
         Systems.Debugger.Write(ex);
     }
 }
コード例 #6
0
ファイル: ByteQueue.cs プロジェクト: GodLesZ/svn-dump
		public PacketReader GetPacketReader() {
			var reader = new PacketReader(mBuffer, mSize, 0);
			if (mSize >= 2) {
				reader.Seek(2, SeekOrigin.Begin);
			}
			return reader;
		}
コード例 #7
0
ファイル: MultiplayerServer.cs プロジェクト: ac682/TrueCraft
        public MultiplayerServer()
        {
            var reader = new PacketReader();
            PacketReader = reader;
            Clients = new List<IRemoteClient>();
            EnvironmentWorker = new Timer(DoEnvironment);
            PacketHandlers = new PacketHandler[0x100];
            Worlds = new List<IWorld>();
            EntityManagers = new List<IEntityManager>();
            LogProviders = new List<ILogProvider>();
            Scheduler = new EventScheduler(this);
            var blockRepository = new BlockRepository();
            blockRepository.DiscoverBlockProviders();
            BlockRepository = blockRepository;
            var itemRepository = new ItemRepository();
            itemRepository.DiscoverItemProviders();
            ItemRepository = itemRepository;
            BlockProvider.ItemRepository = ItemRepository;
            BlockProvider.BlockRepository = BlockRepository;
            var craftingRepository = new CraftingRepository();
            craftingRepository.DiscoverRecipes();
            CraftingRepository = craftingRepository;
            PendingBlockUpdates = new Queue<BlockUpdate>();
            EnableClientLogging = false;
            QueryProtocol = new TrueCraft.QueryProtocol(this);
            WorldLighters = new List<WorldLighting>();

            AccessConfiguration = Configuration.LoadConfiguration<AccessConfiguration>("access.yaml");

            reader.RegisterCorePackets();
            Handlers.PacketHandlers.RegisterHandlers(this);
        }
コード例 #8
0
        /// <summary>
        /// 登陆验证
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        public static void Auth_HandleAuthProof( NetState netState, PacketReader packetReader )
        {
            AuthExtendData extendData = netState.GetComponent<AuthExtendData>( AuthExtendData.COMPONENT_ID );
            if ( extendData == null )
            {
                Debug.WriteLine( "Auth_PacketHandlers.Auth_AuthProof(...) - extendData == null error!" );
                return;
            }

            if ( extendData.IsLoggedIn == false )
            {
                Debug.WriteLine( "Auth_PacketHandlers.Auth_AuthProof(...) - extendData.IsLoggedIn == false error!" );
                return;
            }

            extendData.AuthProof.AuthLogonProof = AuthLogonProof.ReadAuthLogonProof( packetReader );

            extendData.SRP.PublicEphemeralValueA = extendData.AuthProof.AuthLogonProof.PublicEphemeralValueA;

            if ( extendData.SRP.IsClientProofValid( extendData.AuthProof.AuthLogonProof.ClientProof ) == false )
            {
                // Authentication failed.
                //netState.Send( new RealmList_AuthProofResultError( RealmListErrorsInfo.LOGIN_NO_ACCOUNT ) );
                netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_NO_ACCOUNT ) );
                return;
            }

            // 添加到全局的Key中
            SrpHandler.AddSRP( extendData.WowAccount.AccountName, extendData.SRP );

            // we're authenticated now :)
            extendData.IsAuthenticated = true;

            netState.Send( new Auth_AuthProofResult( extendData.SRP ) );
        }
コード例 #9
0
ファイル: Entity.cs プロジェクト: JuixGames/K_Relay
        public IDataObject Read(PacketReader r)
        {
            ObjectType = r.ReadInt16();
            Status.Read(r);

            return this;
        }
コード例 #10
0
ファイル: StaffItems.cs プロジェクト: herculesjr/razor
        public override void OnFilter( PacketReader p, PacketHandlerEventArgs args )
        {
            uint serial = p.ReadUInt32();
            ushort itemID = p.ReadUInt16();

            if ( (serial & 0x80000000) != 0 )
                p.ReadUInt16(); // amount

            if ( (itemID & 0x8000) != 0 )
                itemID = (ushort)((itemID&0x7FFF) + p.ReadSByte()); // itemID offset

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();

            if ( (x & 0x8000) != 0 )
                p.ReadByte(); // direction

            short z = p.ReadSByte();

            if ( ( y & 0x8000 ) != 0 )
                p.ReadUInt16(); // hue

            bool visable = true;
            if ( ( y & 0x4000 ) != 0 )
            {
                int flags = p.ReadByte();

                visable = ( (flags&0x80) == 0 );
            }

            if ( IsStaffItem( itemID ) || !visable )
                args.Block = true;
        }
コード例 #11
0
ファイル: StartGame.cs プロジェクト: Zenohate/PolarisServer
        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            var reader = new PacketReader(data, position, size);
            var charId = reader.ReadUInt32();

            if (context.User == null)
                return;

            if (context.Character == null) // On character create, this is already set.
            {
                using (var db = new PolarisEf())
                {
                    var character = db.Characters.Find((int)charId);

                    if (character == null || character.Player.PlayerId != context.User.PlayerId)
                        return;

                    context.Character = character;
                }

            }

            // Transition to the loading screen
            context.SendPacket(new NoPayloadPacket(0x3, 0x4));

            // TODO Set area, Set character, possibly more. See PolarisLegacy for more.
        }
コード例 #12
0
 public void ReadPacket(PacketReader reader)
 {
     RankList = new List<MemberInfo>();
     var count = reader.ReadInt32();
     for (int i = 0; i < count; i++)
     {
         var memberInfo = new MemberInfo();
         memberInfo.Unknown1 = reader.ReadInt64();
         memberInfo.Name = reader.ReadString();
         memberInfo.Rank = reader.ReadInt32();
         memberInfo.Trophies = reader.ReadInt32();
         memberInfo.Unknown2 = reader.ReadInt32();
         memberInfo.Level = reader.ReadInt32();
         memberInfo.AttacksWon = reader.ReadInt32();
         memberInfo.AttacksLost = reader.ReadInt32();
         memberInfo.DefencesWon = reader.ReadInt32();
         memberInfo.DefencesLost = reader.ReadInt32();
         memberInfo.Unknown3 = reader.ReadInt32();
         memberInfo.CountryCode = reader.ReadString();
         memberInfo.Unknown4 = reader.ReadInt64();
         memberInfo.Unknown5 = reader.ReadInt64();
         if (reader.ReadBoolean())
         {
             memberInfo.Clan = new Clan();
             memberInfo.Clan.ID = reader.ReadInt64();
             memberInfo.Clan.Name = reader.ReadString();
             memberInfo.Clan.Badge = reader.ReadInt32();
         }
         RankList.Add(memberInfo);
     }
 }
コード例 #13
0
ファイル: MessageFilter.cs プロジェクト: herculesjr/razor
        public override void OnFilter( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( args.Block )
                return;

            // 0, 1, 2
            Serial serial = p.ReadUInt32(); // 3, 4, 5, 6
            ushort body = p.ReadUInt16(); // 7, 8
            MessageType type = (MessageType)p.ReadByte(); // 9

            if ( type != m_Type )
                return;

            ushort hue = p.ReadUInt16(); // 10, 11
            ushort font = p.ReadUInt16();
            string name = p.ReadStringSafe( 30 );
            string text = p.ReadStringSafe();

            for(int i=0;i<m_Strings.Length;i++)
            {
                if ( text.IndexOf( m_Strings[i] ) != -1 )
                {
                    args.Block = true;
                    return;
                }
            }
        }
コード例 #14
0
ファイル: OtherHitPacket.cs プロジェクト: Zeroeh/K_Relay
 public override void Read(PacketReader r)
 {
     Time = r.ReadInt32();
     BulletId = r.ReadByte();
     ObjectId = r.ReadInt32();
     TargetId = r.ReadInt32();
 }
コード例 #15
0
 public void ReadCommand(PacketReader reader)
 {
     BuildingID = reader.ReadInt32();
     Unknown1 = reader.ReadInt32();
     Unknown2 = reader.ReadInt32();
     Unknown3 = reader.ReadInt32();
 }
コード例 #16
0
ファイル: PacketReceiver.cs プロジェクト: xclouder/godbattle
	public PacketReceiver(INetworkInterface netInterface)
	{
		packetReader = new PacketReader();

		this.netInterface = netInterface;
		netInterface.onReceive += OnReceiveData;
	}
コード例 #17
0
ファイル: Union.cs プロジェクト: CarlosX/DarkEmu
        /////////////////////////////////////////////////////////////////////////
        // Union Apply
        /////////////////////////////////////////////////////////////////////////
        void unionapply()
        {
            try
            {
                //Open our packet reader
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                //Get target id (Targeted).
                int Target = Reader.Int32();
                //Close reader
                Reader.Close();

                //Get target details
                Systems targetplayer = GetPlayer(Target);
                //Make sure the target is still there
                if (targetplayer != null)
                {
                    //If allready in union
                    if (targetplayer.Character.Network.Guild.UnionActive) return;
                    //Set bools for both players
                    targetplayer.Character.State.UnionApply = true;
                    this.Character.State.UnionApply = true;
                    //Set target player to us
                    targetplayer.Character.Network.TargetID = this.Character.Information.UniqueID;
                    //Send request to targeted player
                    targetplayer.client.Send(Packet.PartyRequest(6, this.Character.Information.UniqueID, 0));
                }
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
        }
コード例 #18
0
ファイル: Packet.cs プロジェクト: dawnoble/blackcatproject
        //constructors
        public Packet(Packet rhs)
        {
            lock (rhs.m_lock)
            {
                m_lock = new object();

                m_opcode = rhs.m_opcode;
                m_encrypted = rhs.m_encrypted;
                m_massive = rhs.m_massive;

                m_locked = rhs.m_locked;
                if (!m_locked)
                {
                    m_writer = new PacketWriter();
                    m_reader = null;
                    m_reader_bytes = null;
                    m_writer.Write(rhs.m_writer.GetBytes());
                }
                else
                {
                    m_writer = null;
                    m_reader_bytes = rhs.m_reader_bytes;
                    m_reader = new PacketReader(m_reader_bytes);
                }
            }
        }
コード例 #19
0
ファイル: ChallengeParser.cs プロジェクト: AlexSbyshko/Barsik
 public int Parse(byte[] data)
 {
     var reader = new PacketReader(data);
     var header = reader.ReadByte();
     var number = reader.ReadLong();
     return number;
 }
コード例 #20
0
ファイル: IR_ERR.cs プロジェクト: maindefine/insimdotnet
 /// <summary>
 /// Creates a new InSim Relay error packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IR_ERR(byte[] buffer) {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     ErrNo = (RelayError)reader.ReadByte();
 }
コード例 #21
0
ファイル: PlayersParser.cs プロジェクト: AlexSbyshko/Barsik
        public IEnumerable<PlayerInfo> Parse(byte[] data)
        {
            var players = new List<PlayerInfo>();

            var reader = new PacketReader(data);

            var header = reader.ReadByte();
            var chard = Convert.ToChar(header);

            var numberOfPlayers = reader.ReadByte();

            for (byte i = 1; i <= numberOfPlayers; i++)
            {
                var player = new PlayerInfo();
                if (!reader.IsEnd)
                {
                    player.Index = reader.ReadByte(); // always returns 0
                    player.Index = i;
                    player.Name = reader.ReadUTFString();
                    player.Score = reader.ReadLong();
                    player.Duration = reader.ReadFloat();
                }
                players.Add(player);
            }

            return players;
        }
コード例 #22
0
 public void ReadCommand(PacketReader reader)
 {
     X = reader.ReadInt32();
     Y = reader.ReadInt32();
     UnitID = reader.ReadInt32();
     Unknown1 = reader.ReadInt32();
 }
コード例 #23
0
ファイル: Program_Helpers.cs プロジェクト: TheScience/SMProxy
 static void LogPacket(StreamWriter sw, bool ClientToServer, byte PacketID, string name, PacketReader pr, params object[] args)
 {
     try
     {
         if (sw == null)
             return;
         bool Suppressed = (ClientToServer && ClientDenyPackets.Contains(PacketID)) ||
                           (!ClientToServer && ServerDenyPackets.Contains(PacketID));
         if (FilterOutput && !Filter.Contains(PacketID))
             return;
         if (ClientToServer && SuppressClient)
             return;
         if (!ClientToServer && SuppressServer)
             return;
         if (ClientToServer)
             sw.WriteLine("{" + DateTime.Now.ToLongTimeString() + "} [CUSTOM CLIENT->SERVER" + (Suppressed ? " SUPPRESSED" : "") + "]: " +
                 name + " (0x" + PacketID.ToString("x") + ")");
         else
             sw.WriteLine("{" + DateTime.Now.ToLongTimeString() + "} [CUSTOM SERVER->CLIENT" + (Suppressed ? " SUPPRESSED" : "") + "]: " +
                 name + " (0x" + PacketID.ToString("x") + ")");
         if (pr.Payload.Length == 0)
             return;
         sw.WriteLine("\t[" + DumpArray(pr.Payload) + "]");
         for (int i = 0; i < args.Length; i += 2)
         {
             if (args[i + 1] is byte[])
                 sw.WriteLine("\t" + args[i].ToString() + " (Byte[]): [" + DumpArray((byte[])args[i + 1]) + "]");
             else
                 sw.WriteLine("\t" + args[i].ToString() + " (" + args[i + 1].GetType().Name + "): " + args[i + 1]);
         }
         sw.Flush();
     }
     catch { }
 }
コード例 #24
0
ファイル: Friends.cs プロジェクト: CarlosX/DarkEmu
        /////////////////////////////////////////////////////////////////////////////////
        // Friend add response
        /////////////////////////////////////////////////////////////////////////////////
        void FriendAddResponse()
        {
            try
            {
                PacketReader reader = new PacketReader(PacketInformation.buffer);
                int Inviterid = reader.Int32();
                int Myid = reader.Int32();
                byte State = reader.Byte();
                reader.Close();

                Systems sys = GetPlayer(Inviterid);
                if (sys != null)
                {
                    if (State == 0)
                    {
                        //Declined
                        client.Send(Packet.FriendDecline(Character.Information.Name));
                        sys.client.Send(Packet.FriendDecline(Character.Information.Name));
                    }
                    else
                    {
                        //Accepted
                        sys.client.Send(Packet.FriendData(Myid, 2, Character.Information.Name, Character, false));
                        client.Send(Packet.FriendData(Inviterid, 2, sys.Character.Information.Name, sys.Character, false));
                        MsSQL.InsertData("INSERT INTO friends (owner,friend_name,model_info) VALUES ('" + Character.Information.CharacterID + "','" + sys.Character.Information.CharacterID + "','" + sys.Character.Information.Model + "')");
                        MsSQL.InsertData("INSERT INTO friends (owner,friend_name,model_info) VALUES ('" + sys.Character.Information.CharacterID + "','" + Character.Information.CharacterID + "','" + Character.Information.Model + "')");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Friend Add Response Error {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }
コード例 #25
0
        public void ReadPacket(PacketReader reader)
        {
            UserID = reader.ReadInt64();
            UserToken = reader.ReadString();
            ClientMajorVersion = reader.ReadInt32();
            ClientContentVersion = reader.ReadInt32();
            ClientMinorVersion = reader.ReadInt32();
            FingerprintHash = reader.ReadString();

            Unknown1 = reader.ReadString();

            OpenUDID = reader.ReadString();
            MacAddress = reader.ReadString();
            DeviceModel = reader.ReadString();
            LocaleKey = reader.ReadInt32();
            Language = reader.ReadString();
            AdvertisingGUID = reader.ReadString();
            OsVersion = reader.ReadString();

            Unknown2 = (byte)reader.ReadByte();
            Unknown3 = reader.ReadString();

            AndroidDeviceID = reader.ReadString();
            FacebookDistributionID = reader.ReadString();
            IsAdvertisingTrackingEnabled = reader.ReadBoolean();
            VendorGUID = reader.ReadString();
            Seed = reader.ReadInt32();
        }
コード例 #26
0
 public void OnCreativeInventoryAction(ref PacketReader _pReader, PacketType pt, ref ClientManager _client)
 {
     short slot = _pReader.ReadShort();
     short item_id = _pReader.ReadShort();
     short Quanity = _pReader.ReadShort();
     short Damage = _pReader.ReadShort();
 }
コード例 #27
0
ファイル: Friends.cs プロジェクト: CarlosX/DarkEmu
 /////////////////////////////////////////////////////////////////////////////////
 // Add new friend
 /////////////////////////////////////////////////////////////////////////////////
 void FriendAdd()
 {
     try
     {
         PacketReader reader = new PacketReader(PacketInformation.buffer);
         short namelenght = reader.Int16();
         string name = reader.String(namelenght);
         reader.Close();
         if (name == Character.Information.Name) return;
         Systems sys = GetPlayerName(name);
         if (sys != null)
         {
             sys.client.Send(Packet.FriendInviteTarget(sys.Character));
         }
         else
         {
             //Packet cannot find user
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Friend Add error {0}", ex);
         Systems.Debugger.Write(ex);
     }
 }
コード例 #28
0
ファイル: CharacterLogin.cs プロジェクト: CarlosX/DarkEmu
 public void Connect()
 {
     //Wrap our function inside a catcher
     try
     {
         //Open our packet reader
         PacketReader Reader = new PacketReader(PacketInformation.buffer);
         byte type = Reader.Byte();
         Reader.Skip(3);
         string ID = Reader.Text();
         string PW = Reader.Text();
         Reader.Close();
         //Set login result information
         int LoginResult = LoginUser(ID, ref PW, ref Player, true);
         //If the login is succesfull
         if (LoginResult == 0)
         {
             //Send succes packet
             client.Send(Packet.ConnectSuccess());
         }
         //If the login is wrong
         else
         {
             //Disconnect the user
             client.Disconnect(PacketInformation.Client);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Client connect error {0}", ex);
         Systems.Debugger.Write(ex);
     }
 }
コード例 #29
0
 /// <summary>
 /// Creates a new admin response packet.
 /// </summary>
 /// <param name="buffer">A buffer contaning the packet data.</param>
 public IR_ARP(byte[] buffer) {
     PacketReader reader = new PacketReader(buffer);
     Size = reader.ReadByte();
     Type = (PacketType)reader.ReadByte();
     ReqI = reader.ReadByte();
     Admin = reader.ReadBoolean();
 }
コード例 #30
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="netState"></param>
        /// <param name="packetReader"></param>
        internal static void CharServerConnected( NetState netState, PacketReader packetReader )
        {
            // 错误 不可能有创建
            if ( netState.ExtendData is CharServerExtendData == true )
                return;
            else
                netState.ExtendData = null;

            if ( packetReader.Size < 6/*( 6 + 0 )*/ )
                return;

            // 不检查网络是否活动
            netState.IsCheckActivity = false;

            string l_strWorldPassword = packetReader.ReadStringSafe();

            if ( l_strWorldPassword == Program.ConfigInfo.WorldPassword )
            {
                CharServerExtendData l_ExtendData = new CharServerExtendData();

                l_ExtendData.IsLoggedIn = true;

                netState.ExtendData = l_ExtendData;
            }
        }
コード例 #31
0
        public override void Handle(GameSession session, PacketReader packet)
        {
            long itemUid = packet.ReadLong();

            if (!session.Player.Inventory.Items.ContainsKey(itemUid))
            {
                return;
            }

            Item item = session.Player.Inventory.Items[itemUid];

            switch (item.Function.Name)
            {
            case "CallAirTaxi":
                HandleCallAirTaxi(session, packet, item);
                break;

            case "ChatEmoticonAdd":
                HandleChatEmoticonAdd(session, item);
                break;

            case "SelectItemBox":     // Item box selection reward
                HandleSelectItemBox(session, packet, item);
                break;

            case "OpenItemBox":     // Item box random/fixed reward
                HandleOpenItemBox(session, packet, item);
                break;

            case "OpenMassive":     // Player hosted mini game
                HandleOpenMassive(session, packet, item);
                break;

            case "LevelPotion":
                HandleLevelPotion(session, item);
                break;

            case "TitleScroll":
                HandleTitleScroll(session, item);
                break;

            case "OpenInstrument":
                HandleOpenInstrument(item);
                break;

            case "VIPCoupon":
                HandleVIPCoupon(session, item);
                break;

            case "StoryBook":
                HandleStoryBook(session, item);
                break;

            case "HongBao":
                HandleHongBao(session, item);
                break;

            case "ItemRemakeScroll":
                HandleItemRemakeScroll(session, itemUid);
                break;

            case "OpenGachaBox":     // Gacha capsules
                HandleOpenGachaBox(session, packet, item);
                break;

            case "OpenCoupleEffectBox":     // Buddy badges
                HandleOpenCoupleEffectBox(session, packet, item);
                break;

            case "PetExtraction":     // Pet skin scroll
                HandlePetExtraction(session, packet, item);
                break;

            case "InstallBillBoard":     // ad balloons
                HandleInstallBillBoard(session, packet, item);
                break;

            case "ExpendCharacterSlot":
                HandleExpandCharacterSlot(session, item);
                break;

            case "ItemChangeBeauty":     // special beauty vouchers
                HandleBeautyVoucher(session, item);
                break;

            default:
                Console.WriteLine("Unhandled item function: " + item.Function.Name);
                break;
            }
        }
コード例 #32
0
 private static void OnDropRequest(PacketReader reader)
 {
     Engine.LastActionPacket = DateTime.Now;
 }
コード例 #33
0
        private static void OnEquipRequest(PacketReader reader)
        {
            AbilitiesManager manager = AbilitiesManager.GetInstance();

            manager.ResendGump(manager.Enabled);
        }
コード例 #34
0
 private static void OnNewClientVersion(PacketReader reader)
 {
     reader.ReadInt32();
     Engine.ClientVersion = new Version(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(),
                                        reader.ReadInt32());
 }
コード例 #35
0
ファイル: Chat.cs プロジェクト: silky/ModernUO
        public static void OpenChatWindowRequest(NetState state, PacketReader pvSrc)
        {
            var from = state.Mobile;

            if (!Enabled)
            {
                from.SendMessage("The chat system has been disabled.");
                return;
            }

            pvSrc.Seek(2, SeekOrigin.Begin);
            var chatName = pvSrc.ReadUnicodeStringSafe((0x40 - 2) >> 1).Trim();

            var acct = state.Account as Account;

            string accountChatName = null;

            if (acct != null)
            {
                accountChatName = acct.GetTag("ChatName");
            }

            accountChatName = accountChatName?.Trim();

            if (!string.IsNullOrEmpty(accountChatName))
            {
                if (chatName.Length > 0 && chatName != accountChatName)
                {
                    from.SendMessage("You cannot change chat nickname once it has been set.");
                }
            }
            else
            {
                if (chatName.Length == 0)
                {
                    SendCommandTo(from, ChatCommand.AskNewNickname);
                    return;
                }

                if (NameVerification.Validate(chatName, 2, 31, true, true, true, 0, NameVerification.SpaceDashPeriodQuote) &&
                    chatName.ToLower().IndexOf("system") == -1)
                {
                    // TODO: Optimize this search

                    foreach (Account checkAccount in Accounts.GetAccounts())
                    {
                        var existingName = checkAccount.GetTag("ChatName");

                        if (existingName != null)
                        {
                            existingName = existingName.Trim();

                            if (Insensitive.Equals(existingName, chatName))
                            {
                                from.SendMessage("Nickname already in use.");
                                SendCommandTo(from, ChatCommand.AskNewNickname);
                                return;
                            }
                        }
                    }

                    accountChatName = chatName;

                    acct?.AddTag("ChatName", chatName);
                }
                else
                {
                    from.SendLocalizedMessage(501173); // That name is disallowed.
                    SendCommandTo(from, ChatCommand.AskNewNickname);
                    return;
                }
            }

            SendCommandTo(from, ChatCommand.OpenChatWindow, accountChatName);
            ChatUser.AddChatUser(from);
        }
コード例 #36
0
 public PersonalLightLevelPacket(PacketReader reader)
     : base(0x4E, "Personal Light Level")
 {
     m_creatureSerial = reader.ReadInt32();
     m_lightLevel     = reader.ReadByte();
 }
コード例 #37
0
 public override void Deserialize(PacketReader reader)
 {
     base.Deserialize(reader);
     this.itemId        = reader.ReadInt32();
     this.remainingTime = reader.ReadSingle();
 }
コード例 #38
0
 public override void Read(PacketReader r)
 {
     TypeId = r.ReadInt32();
 }
コード例 #39
0
ファイル: RealmClass.cs プロジェクト: ternence-li/Arctium
 public void HandleAuthAuthenticator(RealmClass session, PacketReader data)
 {
     Log.Message(LogType.NORMAL, "AuthAuthenticator");
 }
コード例 #40
0
ファイル: EquipGearCommandBody.cs プロジェクト: Yothri/FLPH
 public override void Deserialize(PacketReader reader)
 {
     base.Deserialize(reader);
     this.accountHeroGearId = reader.ReadGuid();
     this.gearSlotId        = reader.ReadInt32();
 }
コード例 #41
0
        public static void HandleAuthChallenge(ref PacketReader packet, WorldClass session)
        {
            session.initiated = true;
            while (true)
            {
IL_145:
                uint arg_10C_0 = 2459053777u;
                while (true)
                {
                    uint num;
                    switch ((num = (arg_10C_0 ^ 4291803379u)) % 11u)
                    {
                    case 0u:
                        arg_10C_0 = (num * 3870351961u ^ 1505659660u);
                        continue;

                    case 1u:
                    {
                        int num2;
                        arg_10C_0 = ((num2 < 8) ? 3540268399u : 3313807745u);
                        continue;
                    }

                    case 2u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteBytes(Globals.ServerSalt, 0);
                        packetWriter.WriteUInt8(1);
                        arg_10C_0 = (num * 732999107u ^ 2252234520u);
                        continue;
                    }

                    case 3u:
                    {
                        int num2 = 0;
                        arg_10C_0 = (num * 1996418291u ^ 1021293114u);
                        continue;
                    }

                    case 4u:
                    {
                        Manager.WorldMgr.Sessions2.Clear();
                        PacketWriter packetWriter = new PacketWriter(ServerMessage.AuthChallenge, false);
                        arg_10C_0 = (num * 1186221898u ^ 2702994982u);
                        continue;
                    }

                    case 5u:
                    {
                        PacketWriter packetWriter;
                        session.Send(ref packetWriter);
                        arg_10C_0 = (num * 1648681476u ^ 2372259125u);
                        continue;
                    }

                    case 6u:
                        Globals.ServerSalt = new byte[0].GenerateRandomKey(16);
                        arg_10C_0          = (num * 1231038991u ^ 850751506u);
                        continue;

                    case 7u:
                        Manager.WorldMgr.Sessions.Clear();
                        arg_10C_0 = (num * 2198824245u ^ 80213818u);
                        continue;

                    case 8u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        int num2;
                        num2++;
                        arg_10C_0 = 3003786868u;
                        continue;
                    }

                    case 9u:
                        goto IL_145;
                    }
                    return;
                }
            }
        }
コード例 #42
0
ファイル: RealmClass.cs プロジェクト: ternence-li/Arctium
        public void HandleAuthLogonChallenge(RealmClass session, PacketReader data)
        {
            Log.Message(LogType.NORMAL, "AuthLogonChallenge");

            data.Skip(10);
            ushort ClientBuild = data.ReadUInt16();

            data.Skip(8);
            account.Language = data.ReadStringFromBytes(4);
            data.Skip(4);

            account.IP   = data.ReadIPAddress();
            account.Name = data.ReadAccountName();

            SQLResult result = DB.Realms.Select("SELECT id, name, password, expansion, gmlevel, securityFlags FROM accounts WHERE name = '{0}'", account.Name);

            PacketWriter logonChallenge = new PacketWriter();

            logonChallenge.WriteUInt8((byte)ClientLink.CMD_AUTH_LOGON_CHALLENGE);
            logonChallenge.WriteUInt8(0);

            if (result.Count != 0)
            {
                account.Id            = result.Read <Int32>(0, "id");
                account.Expansion     = result.Read <Byte>(0, "expansion");
                account.SecurityFlags = result.Read <Byte>(0, "securityFlags");

                DB.Realms.Execute("UPDATE accounts SET ip = '{0}', language = '{1}' WHERE id = {2}", account.IP, account.Language, account.Id);

                byte[] username = Encoding.ASCII.GetBytes(result.Read <String>(0, "name").ToUpper());
                byte[] password = Encoding.ASCII.GetBytes(result.Read <String>(0, "password").ToUpper());

                // WoW 5.1.0.16173 (5.1.0 PTR)
                if (ClientBuild == 16173)
                {
                    session.SecureRemotePassword.CalculateX(username, password);
                    byte[] buf = new byte[0x10];
                    SRP6.RAND_bytes(buf, 0x10);

                    logonChallenge.WriteUInt8((byte)AuthResults.WOW_SUCCESS);
                    logonChallenge.WriteBytes(session.SecureRemotePassword.B);
                    logonChallenge.WriteUInt8(1);
                    logonChallenge.WriteUInt8(session.SecureRemotePassword.g[0]);
                    logonChallenge.WriteUInt8(0x20);
                    logonChallenge.WriteBytes(session.SecureRemotePassword.N);
                    logonChallenge.WriteBytes(session.SecureRemotePassword.salt);
                    logonChallenge.WriteBytes(buf);

                    // Security flags
                    logonChallenge.WriteUInt8(account.SecurityFlags);

                    // Enable authenticator
                    if ((account.SecurityFlags & 4) != 0)
                    {
                        logonChallenge.WriteUInt8(1);
                    }
                }
            }
            else
            {
                logonChallenge.WriteUInt8((byte)AuthResults.WOW_FAIL_UNKNOWN_ACCOUNT);
            }

            session.Send(logonChallenge);
        }
コード例 #43
0
        public static void HandleAuthContinuedSession(ref PacketReader packet, WorldClass2 session)
        {
            AuthenticationHandler.session2 = session;
            Manager.WorldMgr.Sessions.SingleOrDefault <KeyValuePair <ulong, WorldClass> >();
            while (true)
            {
IL_1B7:
                uint arg_17D_0 = 2389353796u;
                while (true)
                {
                    uint num;
                    switch ((num = (arg_17D_0 ^ 2381408322u)) % 11u)
                    {
                    case 0u:
                        goto IL_1B7;

                    case 1u:
                    {
                        SHA1Managed expr_127 = AuthenticationHandler.smethod_18();
                        byte[]      array;
                        AuthenticationHandler.smethod_3(expr_127, array, 0, array.Length, array, 0);
                        byte[] array2;
                        AuthenticationHandler.smethod_3(expr_127, array2, 0, 40, array2, 0);
                        byte[] byte_;
                        AuthenticationHandler.smethod_4(expr_127, byte_, 0, 4);
                        AuthenticationHandler.smethod_5(expr_127);
                        new PacketWriter(ServerMessage.EnableCrypt, false);
                        PacketWriter packetWriter = new PacketWriter(ServerMessage.ResumeComms, true);
                        arg_17D_0 = (num * 3949002163u ^ 3941582883u);
                        continue;
                    }

                    case 2u:
                    {
                        PacketWriter packetWriter;
                        AuthenticationHandler.session2.Send(ref packetWriter);
                        arg_17D_0 = (num * 3904375768u ^ 568160447u);
                        continue;
                    }

                    case 3u:
                        packet.Read <ulong>();
                        packet.ReadBytes(20u);
                        arg_17D_0 = (((AuthenticationHandler.session2 != null) ? 2852424687u : 3500428177u) ^ num * 109821150u);
                        continue;

                    case 4u:
                    {
                        byte[] array2 = AuthenticationHandler.sessionKey;
                        arg_17D_0 = (num * 2163954332u ^ 1605872583u);
                        continue;
                    }

                    case 5u:
                        return;

                    case 6u:
                    {
                        byte[] byte_ = AuthenticationHandler.smethod_17(2549515048u);
                        arg_17D_0 = (num * 4131246918u ^ 2980239949u);
                        continue;
                    }

                    case 7u:
                        packet.Read <ulong>();
                        arg_17D_0 = (num * 3561050817u ^ 404291365u);
                        continue;

                    case 8u:
                        arg_17D_0 = ((Manager.WorldMgr.AddSession2(0uL, ref AuthenticationHandler.session2) ? 213636815u : 1576825925u) ^ num * 3435104658u);
                        continue;

                    case 9u:
                    {
                        byte[] array = AuthenticationHandler.smethod_12(AuthenticationHandler.smethod_16(), Module.smethod_34 <string>(1006528553u));
                        arg_17D_0 = 2341857576u;
                        continue;
                    }
                    }
                    goto Block_3;
                }
            }
            Block_3 :;
        }
コード例 #44
0
 public override void Read(PacketReader r)
 {
     Name = r.ReadString();
 }
コード例 #45
0
 public override void Read(PacketReader r)
 {
     CharacterId = r.ReadInt32();
     IsFromArena = r.ReadBoolean();
 }
コード例 #46
0
        public static void HandleAuthResponse(ref PacketReader packet, WorldClass session)
        {
            BitUnpack arg_28_0 = new BitUnpack(packet);

            packet.Skip(23);
            Globals.ClientSalt = packet.ReadBytes(16u);
            packet.ReadBytes(24u);
            arg_28_0.GetBit();
            packet.ReadBytes(AuthenticationHandler.smethod_1(packet));
            while (true)
            {
IL_921:
                uint arg_82F_0 = 2017539580u;
                while (true)
                {
                    uint num;
                    switch ((num = (arg_82F_0 ^ 973532324u)) % 57u)
                    {
                    case 0u:
                        TimeHandler.HandleSetTimezoneInformation(ref session);
                        arg_82F_0 = (num * 3644867839u ^ 4102176202u);
                        continue;

                    case 1u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        arg_82F_0 = (num * 3925958146u ^ 429357566u);
                        continue;
                    }

                    case 2u:
                    {
                        BitPack bitPack;
                        bitPack.Flush();
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        arg_82F_0 = (num * 3843609867u ^ 274333066u);
                        continue;
                    }

                    case 3u:
                    {
                        PacketWriter packetWriter;
                        byte[,] array;
                        int num2;
                        packetWriter.WriteUInt8(array[num2, 1]);
                        arg_82F_0 = (num * 2139226297u ^ 222787957u);
                        continue;
                    }

                    case 4u:
                    {
                        int num3 = 0;
                        arg_82F_0 = (num * 1275993637u ^ 3289780354u);
                        continue;
                    }

                    case 5u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        BitPack bitPack;
                        bool    flag;
                        bitPack.Write <bool>(flag);
                        bool bit;
                        bitPack.Write <bool>(bit);
                        bitPack.Flush();
                        arg_82F_0 = (num * 190331667u ^ 3544293151u);
                        continue;
                    }

                    case 6u:
                    {
                        PacketWriter packetWriter;
                        int          num3;
                        byte[,] array2;
                        packetWriter.WriteUInt8(array2[num3, 0]);
                        arg_82F_0 = 979003297u;
                        continue;
                    }

                    case 7u:
                    {
                        SHA256Managed hashAlgorithm_;
                        byte[]        array3;
                        AuthenticationHandler.smethod_4(hashAlgorithm_, array3, array3.Length >> 1, array3.Length - (array3.Length >> 1));
                        SHA256Managed hashAlgorithm_2;
                        SHA256Managed hashAlgorithm_3;
                        AuthenticationHandler.smethod_3(hashAlgorithm_2, AuthenticationHandler.smethod_5(hashAlgorithm_3), 0, 32, AuthenticationHandler.smethod_5(hashAlgorithm_3), 0);
                        arg_82F_0 = (num * 4247721102u ^ 2164875264u);
                        continue;
                    }

                    case 8u:
                        goto IL_921;

                    case 9u:
                    {
                        int num3;
                        byte[,] array2;
                        arg_82F_0 = ((num3 < AuthenticationHandler.smethod_9(array2) / 2) ? 942732371u : 402681424u);
                        continue;
                    }

                    case 10u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        arg_82F_0 = (num * 1272726928u ^ 3573012072u);
                        continue;
                    }

                    case 11u:
                    {
                        int num4;
                        arg_82F_0 = ((num4 != 32) ? 1613600137u : 94715230u);
                        continue;
                    }

                    case 12u:
                    {
                        SHA256Managed hashAlgorithm_;
                        SHA256Managed hashAlgorithm_2;
                        AuthenticationHandler.smethod_4(hashAlgorithm_2, AuthenticationHandler.smethod_5(hashAlgorithm_), 0, 32);
                        AuthenticationHandler.sha2_3_grml = AuthenticationHandler.smethod_5(hashAlgorithm_2);
                        int num4 = 0;
                        int num5 = 0;
                        arg_82F_0 = (num * 1594528258u ^ 4035022218u);
                        continue;
                    }

                    case 13u:
                        arg_82F_0 = (num * 3592674904u ^ 3437742173u);
                        continue;

                    case 14u:
                        AuthenticationHandler.HandleConnectTo(session, 3724, 1, null);
                        arg_82F_0 = (num * 4096365546u ^ 2720471261u);
                        continue;

                    case 15u:
                    {
                        bool         bit          = false;
                        PacketWriter packetWriter = new PacketWriter(ServerMessage.AuthResponse, true);
                        arg_82F_0 = (num * 1668503324u ^ 4008787019u);
                        continue;
                    }

                    case 16u:
                    {
                        int num4;
                        arg_82F_0 = ((num4 < 40) ? 1976385685u : 1159001732u);
                        continue;
                    }

                    case 17u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        arg_82F_0 = (num * 3445906520u ^ 4063066220u);
                        continue;
                    }

                    case 18u:
                    {
                        BitPack bitPack;
                        bitPack.Write <int>(0);
                        bitPack.Write <int>(0);
                        arg_82F_0 = (num * 621848300u ^ 3406194050u);
                        continue;
                    }

                    case 19u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        arg_82F_0 = (num * 3867729530u ^ 1908424397u);
                        continue;
                    }

                    case 20u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        arg_82F_0 = (num * 1394835192u ^ 145004486u);
                        continue;
                    }

                    case 21u:
                    {
                        PacketWriter packetWriter;
                        byte[,] array2;
                        packetWriter.WriteInt32(AuthenticationHandler.smethod_9(array2) / 2);
                        byte[,] array;
                        packetWriter.WriteInt32(AuthenticationHandler.smethod_9(array) / 2);
                        arg_82F_0 = (num * 3125389306u ^ 6579303u);
                        continue;
                    }

                    case 22u:
                    {
                        byte[,] array;
                        int num2;
                        arg_82F_0 = ((num2 < AuthenticationHandler.smethod_9(array) / 2) ? 248887578u : 276684735u);
                        continue;
                    }

                    case 23u:
                    {
                        int num4;
                        num4++;
                        int num5;
                        num5++;
                        arg_82F_0 = (num * 2780937424u ^ 1515612061u);
                        continue;
                    }

                    case 24u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        packetWriter.WriteUInt32(0u);
                        arg_82F_0 = (num * 192068700u ^ 4062459581u);
                        continue;
                    }

                    case 25u:
                    {
                        byte[,] expr_4C2 = new byte[12, 2];
                        AuthenticationHandler.smethod_8(expr_4C2, fieldof(< PrivateImplementationDetails >.struct7_0).FieldHandle);
                        byte[,] array    = expr_4C2;
                        byte[,] expr_4D7 = new byte[19, 2];
                        AuthenticationHandler.smethod_8(expr_4D7, fieldof(< PrivateImplementationDetails >.B1151C6C80B16E10C2CAD0E6524E20DB89985020).FieldHandle);
                        byte[,] array2 = expr_4D7;
                        arg_82F_0      = (num * 775829900u ^ 1086551519u);
                        continue;
                    }

                    case 26u:
                        Manager.WorldMgr.SendHotfixes(session);
                        arg_82F_0 = (num * 2297567052u ^ 3529457580u);
                        continue;

                    case 27u:
                    {
                        BitPack bitPack;
                        bitPack.Write <int>(0);
                        arg_82F_0 = (num * 2838081966u ^ 1401284309u);
                        continue;
                    }

                    case 28u:
                    {
                        BitPack bitPack;
                        bitPack.Write <int>(0);
                        arg_82F_0 = (num * 1276988104u ^ 1332711413u);
                        continue;
                    }

                    case 29u:
                        new PacketWriter(ServerMessage.EnableCrypt, false);
                        session.Account = new Account
                        {
                            Id               = 1,
                            Email            = Module.smethod_35 <string>(2737471542u),
                            PasswordVerifier = Module.smethod_36 <string>(1789483827u),
                            Salt             = Module.smethod_36 <string>(2533110280u),
                            IP               = "",
                            SessionKey       = "",
                            SecurityFlags    = 0,
                            OS               = Module.smethod_36 <string>(2605452825u),
                            Expansion        = 5,
                            IsOnline         = false
                        };
                        arg_82F_0 = (num * 3099364030u ^ 778753807u);
                        continue;

                    case 30u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt8(6);
                        arg_82F_0 = (num * 960037049u ^ 4251590658u);
                        continue;
                    }

                    case 31u:
                    {
                        int num3;
                        num3++;
                        arg_82F_0 = (num * 2647826660u ^ 3081572510u);
                        continue;
                    }

                    case 32u:
                    {
                        int num5 = 0;
                        arg_82F_0 = (num * 2855624283u ^ 1934999727u);
                        continue;
                    }

                    case 33u:
                    {
                        PacketWriter packetWriter;
                        session.Send(ref packetWriter);
                        arg_82F_0 = 394845639u;
                        continue;
                    }

                    case 34u:
                    {
                        PacketWriter packetWriter;
                        BitPack      bitPack = new BitPack(packetWriter, 0uL, 0uL, 0uL, 0uL);
                        arg_82F_0 = (num * 3839928679u ^ 2674270183u);
                        continue;
                    }

                    case 35u:
                    {
                        BitPack bitPack;
                        bitPack.Write <int>(0);
                        arg_82F_0 = (num * 1275983207u ^ 2624941272u);
                        continue;
                    }

                    case 36u:
                        new PacketWriter(ServerMessage.SuspendComms, true).WriteUInt32(20u);
                        arg_82F_0 = (num * 3412051023u ^ 3748987744u);
                        continue;

                    case 37u:
                    {
                        PacketWriter packetWriter;
                        byte[,] array;
                        int num2;
                        packetWriter.WriteUInt8(array[num2, 0]);
                        arg_82F_0 = 1152594217u;
                        continue;
                    }

                    case 38u:
                    {
                        BitPack bitPack;
                        bitPack.Write <int>(0);
                        arg_82F_0 = (num * 1357121348u ^ 1027085582u);
                        continue;
                    }

                    case 39u:
                    {
                        SHA256Managed hashAlgorithm_2 = AuthenticationHandler.smethod_6();
                        byte[]        array3;
                        SHA256Managed hashAlgorithm_3;
                        AuthenticationHandler.smethod_4(hashAlgorithm_3, array3, 0, array3.Length >> 1);
                        arg_82F_0 = (num * 3349724847u ^ 3826309419u);
                        continue;
                    }

                    case 40u:
                    {
                        bool flag = true;
                        arg_82F_0 = (num * 2469044217u ^ 389509509u);
                        continue;
                    }

                    case 41u:
                    {
                        int num4;
                        int num5;
                        AuthenticationHandler.sessionKey[num4] = AuthenticationHandler.sha2_3_grml[num5];
                        arg_82F_0 = 121248238u;
                        continue;
                    }

                    case 42u:
                    {
                        SHA256Managed hashAlgorithm_2;
                        AuthenticationHandler.sha2_3_grml = AuthenticationHandler.smethod_5(hashAlgorithm_2);
                        arg_82F_0 = (num * 3186781206u ^ 568291510u);
                        continue;
                    }

                    case 43u:
                    {
                        SHA256Managed hashAlgorithm_2;
                        AuthenticationHandler.smethod_7(hashAlgorithm_2);
                        SHA256Managed hashAlgorithm_3;
                        AuthenticationHandler.smethod_3(hashAlgorithm_2, AuthenticationHandler.smethod_5(hashAlgorithm_3), 0, 32, AuthenticationHandler.smethod_5(hashAlgorithm_3), 0);
                        arg_82F_0 = (num * 273351295u ^ 2423198895u);
                        continue;
                    }

                    case 44u:
                    {
                        PacketWriter packetWriter;
                        int          num3;
                        byte[,] array2;
                        packetWriter.WriteUInt8(array2[num3, 1]);
                        arg_82F_0 = (num * 3258273611u ^ 1239887723u);
                        continue;
                    }

                    case 46u:
                    {
                        HMACSHA256 expr_182 = AuthenticationHandler.smethod_2(Globals.SessionKey);
                        AuthenticationHandler.smethod_3(expr_182, Globals.ServerSalt, 0, Globals.ServerSalt.Length, Globals.ServerSalt, 0);
                        AuthenticationHandler.smethod_3(expr_182, Globals.ClientSalt, 0, Globals.ClientSalt.Length, Globals.ClientSalt, 0);
                        AuthenticationHandler.smethod_4(expr_182, AuthenticationHandler.arr1, 0, AuthenticationHandler.arr1.Length);
                        byte[]        array3          = AuthenticationHandler.smethod_5(expr_182);
                        SHA256Managed hashAlgorithm_3 = AuthenticationHandler.smethod_6();
                        SHA256Managed hashAlgorithm_  = AuthenticationHandler.smethod_6();
                        arg_82F_0 = (num * 1844584669u ^ 1891453460u);
                        continue;
                    }

                    case 47u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt32(0u);
                        arg_82F_0 = (num * 1008232628u ^ 30771472u);
                        continue;
                    }

                    case 48u:
                    {
                        int num2 = 0;
                        arg_82F_0 = (num * 1707978014u ^ 2368748458u);
                        continue;
                    }

                    case 49u:
                    {
                        SHA256Managed hashAlgorithm_2;
                        AuthenticationHandler.smethod_3(hashAlgorithm_2, AuthenticationHandler.sha2_3_grml, 0, 32, AuthenticationHandler.sha2_3_grml, 0);
                        SHA256Managed hashAlgorithm_;
                        AuthenticationHandler.smethod_4(hashAlgorithm_2, AuthenticationHandler.smethod_5(hashAlgorithm_), 0, 32);
                        arg_82F_0 = (num * 1428097193u ^ 1748239185u);
                        continue;
                    }

                    case 50u:
                    {
                        BitPack bitPack;
                        bitPack.Write <int>(0);
                        arg_82F_0 = (num * 2377469058u ^ 4212942142u);
                        continue;
                    }

                    case 51u:
                    {
                        SHA256Managed hashAlgorithm_2;
                        AuthenticationHandler.smethod_3(hashAlgorithm_2, AuthenticationHandler.sha2_3_grml, 0, 32, AuthenticationHandler.sha2_3_grml, 0);
                        arg_82F_0 = (num * 116417243u ^ 3699589835u);
                        continue;
                    }

                    case 52u:
                    {
                        bool flag;
                        arg_82F_0 = (((!flag) ? 1888186652u : 1737280166u) ^ num * 1515350310u);
                        continue;
                    }

                    case 53u:
                    {
                        PacketWriter packetWriter;
                        packetWriter.WriteUInt8(6);
                        arg_82F_0 = (num * 200448416u ^ 3957963237u);
                        continue;
                    }

                    case 54u:
                    {
                        BitPack bitPack;
                        bitPack.Flush();
                        arg_82F_0 = (num * 2761573231u ^ 325309565u);
                        continue;
                    }

                    case 55u:
                        arg_82F_0 = (num * 1571901877u ^ 4021021157u);
                        continue;

                    case 56u:
                    {
                        int num2;
                        num2++;
                        arg_82F_0 = (num * 3035465689u ^ 1114317311u);
                        continue;
                    }
                    }
                    return;
                }
            }
        }
コード例 #47
0
		public override void Deserialize(PacketReader reader)
		{
			base.Deserialize(reader);
			this.inventorySlotNo = reader.ReadInt32();
		}
コード例 #48
0
 internal EnumerableAdapter(PacketReader reader, Info info, int level)
 {
     this.reader = reader;
     this.info   = info;
     this.level  = level;
 }
コード例 #49
0
 public abstract void Handle(GameSession session, PacketReader packet);
コード例 #50
0
 public abstract void OnFilter(PacketReader p, PacketHandlerEventArgs args);
コード例 #51
0
        public static void HandleQueryCreature(ref PacketReader packet, ref WorldClass session)
        {
            var id = packet.Read <int>();

            PacketWriter queryCreatureResponse = new PacketWriter(ServerMessage.QueryCreatureResponse);
            BitPack      BitPack = new BitPack(queryCreatureResponse);

            queryCreatureResponse.WriteInt32(id);

            var creature = DataMgr.FindCreature(id);
            var hasData  = (creature != null);

            BitPack.Write(hasData);

            if (hasData)
            {
                var stats = creature.Stats;

                BitPack.Write(stats.SubName.Length != 0 ? stats.SubName.Length + 1 : 0, 11);
                BitPack.Write(stats.RacialLeader);

                for (int i = 0; i < 8; i++)
                {
                    if (i == 1)
                    {
                        BitPack.Write(stats.Name.Length + 1, 11);
                    }
                    else
                    {
                        BitPack.Write(0, 11);
                    }
                }

                BitPack.Write(stats.IconName.Length + 1, 6);
                BitPack.Write(0, 11);
                BitPack.Write(stats.QuestItemId.Count, 22);

                BitPack.Flush();

                queryCreatureResponse.WriteCString(stats.Name);
                queryCreatureResponse.WriteFloat(stats.HealthModifier);

                if (stats.SubName != "")
                {
                    queryCreatureResponse.WriteCString(stats.SubName);
                }

                queryCreatureResponse.WriteInt32(stats.Rank);

                foreach (var v in stats.QuestItemId)
                {
                    queryCreatureResponse.WriteInt32(v);
                }

                queryCreatureResponse.WriteInt32(stats.Type);
                queryCreatureResponse.WriteInt32(stats.QuestKillNpcId[0]);
                queryCreatureResponse.WriteInt32(stats.QuestKillNpcId[1]);
                queryCreatureResponse.WriteInt32(stats.Family);

                if (stats.IconName != "")
                {
                    queryCreatureResponse.WriteCString(stats.IconName);
                }

                queryCreatureResponse.WriteInt32(stats.DisplayInfoId[1]);
                queryCreatureResponse.WriteInt32(stats.DisplayInfoId[0]);
                queryCreatureResponse.WriteInt32(stats.MovementInfoId);
                queryCreatureResponse.WriteInt32(stats.DisplayInfoId[3]);

                foreach (var v in stats.Flag)
                {
                    queryCreatureResponse.WriteInt32(v);
                }

                queryCreatureResponse.WriteInt32(stats.DisplayInfoId[2]);
                queryCreatureResponse.WriteFloat(stats.PowerModifier);
                queryCreatureResponse.WriteInt32(stats.ExpansionRequired);
            }
            else
            {
                Log.Message(LogType.Debug, "Creature (Id: {0}) not found.", id);
            }

            session.Send(ref queryCreatureResponse);
        }
コード例 #52
0
 public AddToBookmarkMessage(Packets.Client client, PacketReader br) : base(client, br)
 {
 }
コード例 #53
0
        public static void HandleQueryGameObject(ref PacketReader packet, ref WorldClass session)
        {
            byte[] guidMask  = { 3, 2, 5, 4, 6, 1, 7, 0 };
            byte[] guidBytes = { 6, 7, 3, 4, 0, 2, 5, 1 };

            BitUnpack BitUnpack = new BitUnpack(packet);

            var id   = packet.Read <int>();
            var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);

            PacketWriter queryGameObjectResponse = new PacketWriter(ServerMessage.QueryGameObjectResponse);
            BitPack      BitPack = new BitPack(queryGameObjectResponse);

            var gObject = DataMgr.FindGameObject(id);
            var hasData = (gObject != null);

            queryGameObjectResponse.WriteInt32(0);

            if (hasData)
            {
                var stats = gObject.Stats;

                queryGameObjectResponse.WriteInt32((int)stats.Type);
                queryGameObjectResponse.WriteInt32(stats.DisplayInfoId);

                queryGameObjectResponse.WriteCString(stats.Name);

                for (int i = 0; i < 3; i++)
                {
                    queryGameObjectResponse.WriteCString("");
                }

                queryGameObjectResponse.WriteCString(stats.IconName);
                queryGameObjectResponse.WriteCString(stats.CastBarCaption);
                queryGameObjectResponse.WriteCString("");

                foreach (var v in stats.Data)
                {
                    queryGameObjectResponse.WriteInt32(v);
                }

                queryGameObjectResponse.WriteFloat(stats.Size);
                queryGameObjectResponse.WriteUInt8((byte)stats.QuestItemId.Count);

                foreach (var v in stats.QuestItemId)
                {
                    queryGameObjectResponse.WriteInt32(v);
                }

                queryGameObjectResponse.WriteInt32(stats.ExpansionRequired);

                var size = (uint)queryGameObjectResponse.BaseStream.Length - 13;
                queryGameObjectResponse.WriteUInt32Pos(size, 9);

                session.Send(ref queryGameObjectResponse);
            }
            else
            {
                Log.Message(LogType.Debug, "Gameobject (Id: {0}) not found.", id);
            }

            queryGameObjectResponse.WriteInt32(id);

            BitPack.Write(hasData);
            BitPack.Flush();

            session.Send(ref queryGameObjectResponse);
        }
コード例 #54
0
        public static void HandleDBQueryBulk(ref PacketReader packet, ref WorldClass session)
        {
            List <int> IdList    = new List <int>();
            BitUnpack  BitUnpack = new BitUnpack(packet);

            var type  = (DBTypes)packet.Read <uint>();
            var count = BitUnpack.GetBits <uint>(21);

            bool[][] Mask  = new bool[count][];
            byte[][] Bytes = new byte[count][];

            for (int i = 0; i < count; i++)
            {
                Mask[i]  = new bool[8];
                Bytes[i] = new byte[8];
            }

            for (int i = 0; i < count; i++)
            {
                Mask[i][5] = BitUnpack.GetBit();
                Mask[i][7] = BitUnpack.GetBit();
                Mask[i][6] = BitUnpack.GetBit();
                Mask[i][1] = BitUnpack.GetBit();
                Mask[i][4] = BitUnpack.GetBit();
                Mask[i][3] = BitUnpack.GetBit();
                Mask[i][2] = BitUnpack.GetBit();
                Mask[i][0] = BitUnpack.GetBit();
            }

            for (int i = 0; i < count; i++)
            {
                if (Mask[i][3])
                {
                    Bytes[i][3] = (byte)(packet.Read <byte>() ^ 1);
                }

                if (Mask[i][7])
                {
                    Bytes[i][7] = (byte)(packet.ReadByte() ^ 1);
                }

                if (Mask[i][1])
                {
                    Bytes[i][1] = (byte)(packet.ReadByte() ^ 1);
                }

                if (Mask[i][6])
                {
                    Bytes[i][6] = (byte)(packet.ReadByte() ^ 1);
                }

                if (Mask[i][4])
                {
                    Bytes[i][4] = (byte)(packet.ReadByte() ^ 1);
                }

                if (Mask[i][0])
                {
                    Bytes[i][0] = (byte)(packet.ReadByte() ^ 1);
                }

                if (Mask[i][5])
                {
                    Bytes[i][5] = (byte)(packet.ReadByte() ^ 1);
                }

                IdList.Add(packet.Read <int>());

                if (Mask[i][2])
                {
                    Bytes[i][2] = (byte)(packet.ReadByte() ^ 1);
                }
            }

            switch (type)
            {
            case DBTypes.BroadcastText:
            {
                foreach (var id in IdList)
                {
                    HandleBroadcastText(ref session, id);
                }

                break;
            }

            default:
                break;
            }
        }
コード例 #55
0
 public override void readPacketData(PacketReader r)
 {
     _Amount = r.ReadInt32();
 }
コード例 #56
0
        public static void HandleQueryPlayerName(ref PacketReader packet, ref WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            var guidMask  = new bool[8];
            var guidBytes = new byte[8];

            guidMask[3] = BitUnpack.GetBit();
            guidMask[1] = BitUnpack.GetBit();
            guidMask[4] = BitUnpack.GetBit();
            guidMask[2] = BitUnpack.GetBit();
            guidMask[7] = BitUnpack.GetBit();
            guidMask[0] = BitUnpack.GetBit();
            guidMask[5] = BitUnpack.GetBit();

            var hasUnknown = BitUnpack.GetBit();

            guidMask[6] = BitUnpack.GetBit();

            var hasUnknown2 = BitUnpack.GetBit();

            if (guidMask[6])
            {
                guidBytes[6] = (byte)(packet.Read <byte>() ^ 1);
            }
            if (guidMask[0])
            {
                guidBytes[0] = (byte)(packet.Read <byte>() ^ 1);
            }
            if (guidMask[2])
            {
                guidBytes[2] = (byte)(packet.Read <byte>() ^ 1);
            }
            if (guidMask[3])
            {
                guidBytes[3] = (byte)(packet.Read <byte>() ^ 1);
            }
            if (guidMask[4])
            {
                guidBytes[4] = (byte)(packet.Read <byte>() ^ 1);
            }
            if (guidMask[5])
            {
                guidBytes[5] = (byte)(packet.Read <byte>() ^ 1);
            }
            if (guidMask[7])
            {
                guidBytes[7] = (byte)(packet.Read <byte>() ^ 1);
            }
            if (guidMask[1])
            {
                guidBytes[1] = (byte)(packet.Read <byte>() ^ 1);
            }

            if (hasUnknown2)
            {
                packet.Read <uint>();
            }

            if (hasUnknown)
            {
                packet.Read <uint>();
            }

            var guid = BitConverter.ToUInt64(guidBytes, 0);

            var pSession = WorldMgr.GetSession(guid);

            if (pSession != null)
            {
                var pChar = pSession.Character;

                if (pChar != null)
                {
                    PacketWriter queryPlayerNameResponse = new PacketWriter(ServerMessage.QueryPlayerNameResponse);
                    BitPack      BitPack = new BitPack(queryPlayerNameResponse, guid);

                    BitPack.Write(0);
                    BitPack.WriteGuidMask(1, 3, 2);
                    BitPack.Write(pChar.Name.Length, 6);
                    BitPack.WriteGuidMask(6, 4, 0);
                    BitPack.Write(0);
                    BitPack.WriteGuidMask(5, 7);

                    BitPack.Flush();

                    BitPack.WriteGuidBytes(1);

                    queryPlayerNameResponse.WriteString(pChar.Name);

                    BitPack.WriteGuidBytes(0, 7);

                    queryPlayerNameResponse.WriteUInt8(pChar.Race);
                    queryPlayerNameResponse.WriteUInt8(0);
                    queryPlayerNameResponse.WriteUInt8(pChar.Gender);
                    queryPlayerNameResponse.WriteUInt8(pChar.Class);

                    BitPack.WriteGuidBytes(4, 6, 5);

                    queryPlayerNameResponse.WriteUInt32(1);

                    BitPack.WriteGuidBytes(3, 2);

                    session.Send(ref queryPlayerNameResponse);
                }
            }
        }
コード例 #57
0
 public OpenWebBrowserPacket(PacketReader reader)
     : base(0xA5, "Open Web Browser")
 {
     m_url = reader.ReadString(reader.Size);
 }
コード例 #58
0
        private static void RaceChangeReply(NetState state, PacketReader pvSrc)
        {
            RaceChangeState raceChangeState;

            if (!m_Pending.TryGetValue(state, out raceChangeState))
            {
                return;
            }

            CloseCurrent(state);

            PlayerMobile pm = state.Mobile as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            IRaceChanger owner      = raceChangeState.m_Owner;
            Race         targetRace = raceChangeState.m_TargetRace;

            if (pvSrc.Size == 5)
            {
                if (owner != null)
                {
                    owner.OnCancel(pm);
                }

                return;
            }

            if (!CanChange(pm, targetRace) || (owner != null && !owner.CheckComplete(pm)))
            {
                return;
            }

            int hue              = pvSrc.ReadUInt16();
            int hairItemId       = pvSrc.ReadUInt16();
            int hairHue          = pvSrc.ReadUInt16();
            int facialHairItemId = pvSrc.ReadUInt16();
            int facialHairHue    = pvSrc.ReadUInt16();

            pm.Race = targetRace;
            pm.Hue  = targetRace.ClipSkinHue(hue) | 0x8000;

            if (targetRace.ValidateHair(pm, hairItemId))
            {
                pm.HairItemID = hairItemId;
                pm.HairHue    = targetRace.ClipHairHue(hairHue);
            }
            else
            {
                pm.HairItemID = 0;
            }

            if (targetRace.ValidateFacialHair(pm, facialHairItemId))
            {
                pm.FacialHairItemID = facialHairItemId;
                pm.FacialHairHue    = targetRace.ClipHairHue(facialHairHue);
            }
            else
            {
                pm.FacialHairItemID = 0;
            }

            if (targetRace == Race.Human)
            {
                pm.SendLocalizedMessage(1073654);                   // You are now fully human.
            }
            else if (targetRace == Race.Elf)
            {
                pm.SendLocalizedMessage(1073653);                   // You are now fully initiated into the Elven culture.
            }
            else
            {
                pm.SendMessage("You have fully changed your race to {0}.", targetRace.Name);
            }

            if (owner != null)
            {
                owner.ConsumeNeeded(pm);
            }
        }
コード例 #59
0
 public CharacterListEntry(PacketReader reader)
 {
     name     = reader.ReadString(30);
     password = reader.ReadString(30);
 }
コード例 #60
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="netState"></param>
 /// <param name="packetReader"></param>
 internal static void World_HandleQuestgiverChooseReward(NetState netState, PacketReader packetReader)
 {
 }