本文整理汇总了C#中Server.Network.PacketReader.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadByte方法的具体用法?C# PacketReader.ReadByte怎么用?C# PacketReader.ReadByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Network.PacketReader
的用法示例。
在下文中一共展示了PacketReader.ReadByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 );
}
示例2: 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();
}
}
}
}
示例3: ChangeOption
public static void ChangeOption(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
return;
pvSrc.ReadInt16();
pvSrc.ReadByte();
int options = pvSrc.ReadByte();
game.ShowScores = (options & 0x1) != 0;
game.SpectatorVision = (options & 0x2) != 0;
}
示例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);
}
}
}
示例5: 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;
}
}
示例6: 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();
}
示例7: TargetResponse
public static void TargetResponse( NetState state, PacketReader pvSrc )
{
int type = pvSrc.ReadByte();
int targetID = pvSrc.ReadInt32();
int flags = pvSrc.ReadByte();
Serial serial = pvSrc.ReadInt32();
int x = pvSrc.ReadInt16(), y = pvSrc.ReadInt16();
int z = pvSrc.ReadInt16();
int graphic = pvSrc.ReadInt16();
pvSrc.Seek( 1, System.IO.SeekOrigin.Begin );
Mobile from = state.Mobile;
if ( from == null || from.Target == null )
return;
if ( x == 0 && y == 0 && z == 0 && serial != from.Serial )
{
bool ok = false;
if ( serial.IsItem )
{
Item i = World.FindItem( serial );
if ( i != null && i.Location == Point3D.Zero )
ok = true;
}
else if ( serial.IsMobile )
{
Mobile m = World.FindMobile( serial );
if ( m != null && m.Location == Point3D.Zero )
ok = true;
}
object o = m_LastTarget[from];
if ( !ok && o != null && o is Serial && serial != (Serial)o )
{
from.SendAsciiMessage( "This EasyUO target has been blocked." );
from.Target.Cancel( from, TargetCancelType.Canceled );
return;
}
}
if ( from.Serial != serial )
m_LastTarget[from] = serial;
m_Real6C.OnReceive( state, pvSrc );
}
示例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);
}
示例9: MultiMouseMovementRequest
public static void MultiMouseMovementRequest(NetState state, PacketReader reader)
{
Serial playerSerial = reader.ReadInt32();
Direction movement = (Direction)reader.ReadByte();
reader.ReadByte(); // movement direction duplicated
int speed = reader.ReadByte();
Mobile mob = World.FindMobile(playerSerial);
if (mob == null || mob.NetState == null || !mob.Mounted)
return;
IMount multi = mob.Mount;
if (!(multi is BaseBoat))
return;
BaseBoat boat = (BaseBoat)multi;
boat.OnMousePilotCommand(mob, movement, speed);
}
示例10: 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"));
}
}
示例11: 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);
}
示例12: OnPacket
public static void OnPacket( NetState state, PacketReader pvSrc )
{
MahjongGame game = World.FindItem( pvSrc.ReadInt32() ) as MahjongGame;
if ( game != null )
game.Players.CheckPlayers();
pvSrc.ReadByte();
int cmd = pvSrc.ReadByte();
OnMahjongPacketReceive onReceive = GetSubCommandDelegate( cmd );
if ( onReceive != null )
{
onReceive( game, state, pvSrc );
}
else
{
pvSrc.Trace( state );
}
}
示例13: TargetResponse
public static void TargetResponse(NetState state, PacketReader pvSrc)
{
Mobile from = state.Mobile;
Target t = from.Target;
if (t == null || IgnoreRegex.IsMatch(t.GetType().FullName))
{
m_Target.OnReceive(state, pvSrc);
return;
}
int type = pvSrc.ReadByte();
int targetID = pvSrc.ReadInt32();
int flags = pvSrc.ReadByte();
Serial serial = pvSrc.ReadInt32();
pvSrc.Seek(1, System.IO.SeekOrigin.Begin);
if (targetID == unchecked((int)0xDEADBEEF))
return;
Mobile target = null;
if ( serial.IsMobile )
target = World.FindMobile(serial);
if (target == null || target == from)
{
m_Target.OnReceive(state, pvSrc);
return;
}
HandleTarget(new TargetInfo(from, target, t.GetType()));
m_Target.OnReceive(state, pvSrc);
}
示例14: OnGuildTrack
private static void OnGuildTrack( NetState state, PacketReader pvSrc )
{
Mobile from = state.Mobile;
Guild guild = from.Guild as Guild;
if ( guild != null )
{
bool locations = pvSrc.ReadByte() != 0;
Packets.GuildTrack packet = new Packets.GuildTrack( from, guild, locations );
if ( packet.UnderlyingStream.Length > ( locations ? 9 : 5 ) )
state.Send( packet );
}
else
state.Send( new Packets.GuildTrack() );
}
示例15: AsciiSpeechChat3
public static void AsciiSpeechChat3(NetState state, PacketReader pvSrc)
{
Mobile from = state.Mobile;
MessageType type = (MessageType)pvSrc.ReadByte();
int hue = pvSrc.ReadInt16();
pvSrc.ReadInt16(); // font
string text = pvSrc.ReadStringSafe().Trim();
if (text.Length <= 0 || text.Length > 128)
return;
if (!Enum.IsDefined(typeof(MessageType), type))
type = MessageType.Regular;
Channel c = Channel.GetByType(typeof(Guild));
if (RUOVersion.GuildChat(type) && c != null)
c.OnChat(from, text);
else
from.DoSpeech(text, c_EmptyInts, type, Utility.ClipDyedHue(hue));
}