本文整理汇总了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.
}
}
}
示例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);
}
示例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();
}
}
}
}
示例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: 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();
}
示例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;
}
}
示例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 );
}
示例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: 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"));
}
}
示例10: ExitGame
public static void ExitGame(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null)
return;
Mobile from = state.Mobile;
game.Players.LeaveGame(from);
}
示例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" ) );
}
示例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;
}
示例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);
}
示例14: InvokeContentChangeParent
public static void InvokeContentChangeParent(NetState state, PacketReader pvSrc)
{
if (ContentChangeParent != null)
{
ContentChangeParent.OnReceive(state, pvSrc);
}
else
{
BaseBook.ContentChange(state, pvSrc);
}
}
示例15: InvokeLookReqParent
public static void InvokeLookReqParent(NetState state, PacketReader pvSrc)
{
if (LookReqParent != null)
{
LookReqParent.OnReceive(state, pvSrc);
}
else
{
PacketHandlers.LookReq(state, pvSrc);
}
}