当前位置: 首页>>代码示例>>C#>>正文


C# Network.PacketReader类代码示例

本文整理汇总了C#中Server.Network.PacketReader的典型用法代码示例。如果您正苦于以下问题:C# PacketReader类的具体用法?C# PacketReader怎么用?C# PacketReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PacketReader类属于Server.Network命名空间,在下文中一共展示了PacketReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HeritageTransform

        public static void HeritageTransform(NetState state, PacketReader reader)
        {
            Mobile m = state.Mobile;
			
            if (reader.Size == 5)
            {
                m.SendLocalizedMessage(1073645); // You may try this again later...	
				
                HeritageQuester.RemovePending(m);
            }
            else if (reader.Size == 15)
            { 
                if (HeritageQuester.IsPending(m))
                {
                    HeritageQuester quester = HeritageQuester.Pending(m);
				
                    m.Race = quester.Race;
					
                    m.Hue = reader.ReadUInt16();
                    m.HairItemID = reader.ReadUInt16();
                    m.HairHue = reader.ReadUInt16();
                    m.FacialHairItemID = reader.ReadUInt16();
                    m.FacialHairHue = reader.ReadUInt16();
				
                    HeritageQuester.RemovePending(m);
                    quester.CheckCompleted(m, true); // removes done quests
					
                    if (m.Race == Race.Elf)
                        m.SendLocalizedMessage(1073653); // You are now fully initiated into the Elven culture.
                    else if (m.Race == Race.Human)						
                        m.SendLocalizedMessage(1073654); // You are now fully human.
                }
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:34,代码来源:PacketOverrides.cs

示例2: BuildWalls

        public static void BuildWalls(MahjongGame game, NetState state, PacketReader pvSrc)
        {
            if (game == null || !game.Players.IsInGameDealer(state.Mobile))
                return;

            game.ResetWalls(state.Mobile);
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:7,代码来源:MahjongPacketHandlers.cs

示例3: CustomRunebookTravel

        private static void CustomRunebookTravel(NetState state, PacketReader pvSrc)
        {
            int RuneBookSerial = pvSrc.ReadInt32();

            byte recall = pvSrc.ReadByte();

            var X = pvSrc.ReadInt16();

            var Y = pvSrc.ReadInt16();

            var mapbyte = Convert.ToInt16(pvSrc.ReadByte());

            var runebook = World.FindItem(RuneBookSerial) as Runebook;

            var map = Map.Maps[mapbyte];

            if (runebook != null && runebook.RootParentEntity == state.Mobile && runebook.Entries != null)
            {
                var findentry = runebook.Entries.FirstOrDefault(x => x.Location.X == X && x.Location.Y == Y);
                if (findentry != null)
                {
                    var portentry = findentry.Location;
                    var entry = new RunebookEntry(portentry, findentry.Map, "", null);
                    if (recall == 0)
                    {
                        new RecallSpell(state.Mobile, null, entry, null).Cast();
                    }
                    else
                    {
                        new GateTravelSpell(state.Mobile, null, entry).Cast();
                    }
                }
            }
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:34,代码来源:MapUO.cs

示例4: DecodeBundledPacket

        public static void DecodeBundledPacket(NetState state, PacketReader pvSrc)
        {
            int packetID = pvSrc.ReadByte();

            PacketHandler ph = GetHandler(packetID);

            if (ph != null)
            {
                if (ph.Ingame && state.Mobile == null)
                {
                    Utility.PushColor(ConsoleColor.DarkRed);
                    Console.WriteLine("Client: {0}: Sent ingame packet (0xF0x{1:X2}) before having been attached to a mobile", state, packetID);
                    Utility.PopColor();
                    state.Dispose();
                }
                else if (ph.Ingame && state.Mobile.Deleted)
                {
                    state.Dispose();
                }
                else
                {
                    ph.OnReceive(state, pvSrc);
                }
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:25,代码来源:ProtocolExtensions.cs

示例5: OnReceive

        public static void OnReceive( GameClient state, PacketReader pvSrc )
        {
            if ( pvSrc.ReadByte() == 0xFF )
                state.Send( new UOGInfo( String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K", Environment.Config.ServerName, (int) ( DateTime.Now - Server.Items.Clock.ServerStart ).TotalHours, GameServer.Instance.ClientCount, World.Instance.ItemCount, World.Instance.MobileCount, (int) ( System.GC.GetTotalMemory( false ) / 1024 ) ) ) );

            state.Dispose();
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:7,代码来源:UOGQuery.cs

示例6: BBClientRequest

        public static void BBClientRequest(NetState state, PacketReader pvSrc)
        {
            Mobile from = state.Mobile;

            int packetID = pvSrc.ReadByte();
            BaseBulletinBoard board = World.FindItem(pvSrc.ReadInt32()) as BaseBulletinBoard;

            if (board == null || !board.CheckRange(from))
                return;

            switch ( packetID )
            {
                case 3:
                    BBRequestContent(from, board, pvSrc);
                    break;
                case 4:
                    BBRequestHeader(from, board, pvSrc);
                    break;
                case 5:
                    BBPostMessage(from, board, pvSrc);
                    break;
                case 6:
                    BBRemoveMessage(from, board, pvSrc);
                    break;
            }
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:26,代码来源:BulletinBoards.cs

示例7: BountyEntryResponse

        private static void BountyEntryResponse( NetState ns, PacketReader pvSrc )
        {
            Mobile from = ns.Mobile;
            if ( from == null )
                return;
            Mobile killer = World.FindMobile( (Serial)pvSrc.ReadInt32() );
            byte typeid = pvSrc.ReadByte();
            byte index = pvSrc.ReadByte();
            bool cancel = pvSrc.ReadByte() == 0;
            short responseLen = pvSrc.ReadInt16();
            string resp = pvSrc.ReadString();

            if ( killer != null && !cancel )
            {
                int bounty = Utility.ToInt32( resp );
                if ( bounty > 5000 )
                    bounty = 5000;
                bounty = from.BankBox.ConsumeUpTo( typeof( Gold ), bounty, true );

                killer.Kills++;
                if ( killer is PlayerMobile && bounty > 0 )
                {
                    PlayerMobile kpm = (PlayerMobile)killer;
                    kpm.Bounty += bounty;
                    killer.SendAsciiMessage( "{0} has placed a bounty of {1}gp on your head!", from.Name, bounty );
                    if ( kpm.Bounty >= 5000 && kpm.Kills > 1 && kpm.BankBox.Items.Count > 0 && kpm.Karma <= (int)Noto.Dark )
                    {
                        killer.SayTo( killer, true, "A bounty hath been issued for thee, and thy worldly goods are hereby confiscated!" );
                        kpm.Bounty += EmptyAndGetGold( killer.BankBox.Items );
                    }
                }
            }

            SendNext( from );
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:35,代码来源:ReportMurderer.cs

示例8: AssignDealer

        public static void AssignDealer(MahjongGame game, NetState state, PacketReader pvSrc)
        {
            if (game == null || !game.Players.IsInGameDealer(state.Mobile))
                return;

            int position = pvSrc.ReadByte();

            game.Players.AssignDealer(position);
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:9,代码来源:MahjongPacketHandlers.cs

示例9: AccountSearch

        private static void AccountSearch(NetState state, PacketReader pvSrc)
        {
            AcctSearchType type = (AcctSearchType)pvSrc.ReadByte();
            string term = pvSrc.ReadString();

            if (type == AcctSearchType.IP && !Utility.IsValidIP(term))
            {
                state.Send(new MessageBoxMessage("Invalid search term.\nThe IP sent was not valid.", "Invalid IP"));
                return;
            }
            else
            {
                term = term.ToUpper();
            }

            ArrayList list = new ArrayList();

            foreach (Account a in Accounts.GetAccounts())
            {
                if (!CanAccessAccount(state.Account, a))
                    continue;

                switch ( type )
                {
                    case AcctSearchType.Username:
                        {
                            if (a.Username.ToUpper().IndexOf(term) != -1)
                                list.Add(a);
                            break;
                        }
                    case AcctSearchType.IP:
                        {
                            for (int i = 0; i < a.LoginIPs.Length; i++)
                            {
                                if (Utility.IPMatch(term, a.LoginIPs[i]))
                                {
                                    list.Add(a);
                                    break;
                                }
                            }
                            break;
                        }
                }
            }

            if (list.Count > 0)
            {
                if (list.Count <= 25)
                    state.Send(AdminNetwork.Compress(new AccountSearchResults(list)));
                else
                    state.Send(new MessageBoxMessage("There were more than 25 matches to your search.\nNarrow the search parameters and try again.", "Too Many Results"));
            }
            else
            {
                state.Send(new MessageBoxMessage("There were no results to your search.\nPlease try again.", "No Matches"));
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:57,代码来源:PacketHandlers.cs

示例10: ExitGame

        public static void ExitGame(MahjongGame game, NetState state, PacketReader pvSrc)
        {
            if (game == null)
                return;

            Mobile from = state.Mobile;

            game.Players.LeaveGame(from);
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:9,代码来源:MahjongPacketHandlers.cs

示例11: WorldBroadcast

        private static void WorldBroadcast( NetState state, PacketReader pvSrc )
        {
            string message = pvSrc.ReadUTF8String();
            int hue = pvSrc.ReadInt16();
            bool ascii = pvSrc.ReadBoolean();

            World.Broadcast(hue, ascii, message);

            state.Send( new MessageBoxMessage( "Your message has been broadcasted.", "Message Broadcasted" ) );
        }
开发者ID:nydehi,项目名称:runuo-remote-admin-enrichment,代码行数:10,代码来源:CustomRemoteAdminPacketHandlers.cs

示例12: HookedPlayServer

        public static void HookedPlayServer(NetState state, PacketReader pvSrc)
        {
            // Call the original handler
            PacketHandlers.PlayServer(state, pvSrc);

            // Now indicate, that the state has been relayed already. If it's used again, 
            // it means we're entering a special encryption state
            Encryption context = (Encryption)(state.PacketEncoder);
            context.m_AlreadyRelayed = true;
        }
开发者ID:zerodowned,项目名称:JustUO-merged-with-EC-Support,代码行数:10,代码来源:Encryption.cs

示例13: GivePoints

        public static void GivePoints(MahjongGame game, NetState state, PacketReader pvSrc)
        {
            if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
                return;

            int to = pvSrc.ReadByte();
            int amount = pvSrc.ReadInt32();

            game.Players.TransferScore(state.Mobile, to, amount);
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:10,代码来源:MahjongPacketHandlers.cs

示例14: InvokeContentChangeParent

		public static void InvokeContentChangeParent(NetState state, PacketReader pvSrc)
		{
			if (ContentChangeParent != null)
			{
				ContentChangeParent.OnReceive(state, pvSrc);
			}
			else
			{
				BaseBook.ContentChange(state, pvSrc);
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:11,代码来源:PacketHandlerOverrides.cs

示例15: InvokeLookReqParent

		public static void InvokeLookReqParent(NetState state, PacketReader pvSrc)
		{
			if (LookReqParent != null)
			{
				LookReqParent.OnReceive(state, pvSrc);
			}
			else
			{
				PacketHandlers.LookReq(state, pvSrc);
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:11,代码来源:PacketHandlerOverrides.cs


注:本文中的Server.Network.PacketReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。