本文整理汇总了C#中Server.Network.PacketReader.ReadBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadBoolean方法的具体用法?C# PacketReader.ReadBoolean怎么用?C# PacketReader.ReadBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Network.PacketReader
的用法示例。
在下文中一共展示了PacketReader.ReadBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Shutdown
private static void Shutdown( NetState state, PacketReader pvSrc )
{
bool restart = pvSrc.ReadBoolean();
bool save = pvSrc.ReadBoolean();
Console.WriteLine( "RemoteAdmin: shutting down server (Restart: {0}) (Save: {1}) [{2}]", restart, save, DateTime.Now );
if ( save && !AutoRestart.Restarting )
Misc.AutoSave.Save();
Core.Kill( restart );
}
示例2: 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" ) );
}
示例3: UpdateAccount
private static void UpdateAccount( NetState state, PacketReader pvSrc )
{
string username = pvSrc.ReadString();
string pass = pvSrc.ReadString();
Account a = Accounts.GetAccount( username );
if ( a == null )
a = Accounts.AddAccount( username, pass );
else if ( pass != "(hidden)" )
a.SetPassword( pass );
if ( a != state.Account )
{
a.AccessLevel = (AccessLevel)pvSrc.ReadByte();
a.Banned = pvSrc.ReadBoolean();
}
else
{
pvSrc.ReadInt16();//skip both
state.Send( new MessageBoxMessage( "Warning: When editing your own account, account status and accesslevel cannot be changed.", "Editing Own Account" ) );
}
ArrayList list = new ArrayList();
ushort length = pvSrc.ReadUInt16();
bool invalid = false;
for (int i=0;i<length;i++)
{
string add = pvSrc.ReadString();
if ( Utility.IsValidIP( add ) )
list.Add( add );
else
invalid = true;
}
if ( list.Count > 0 )
a.IPRestrictions = (string[])list.ToArray( typeof( string ) );
else
a.IPRestrictions = new string[0];
if ( invalid )
state.Send( new MessageBoxMessage( "Warning: one or more of the IP Restrictions you specified was not valid.", "Invalid IP Restriction" ) );
state.Send( new MessageBoxMessage( "Account updated successfully.", "Account Updated" ) );
}
示例4: GodModeRequest
public static void GodModeRequest( NetState state, PacketReader pvSrc )
{
if ( VerifyGC( state ) )
{
state.Send( new GodModeReply( pvSrc.ReadBoolean() ) );
}
}
示例5: PartyMessage_SetCanLoot
public static void PartyMessage_SetCanLoot( NetState state, PacketReader pvSrc )
{
if ( PartyCommands.Handler != null )
PartyCommands.Handler.OnSetCanLoot( state.Mobile, pvSrc.ReadBoolean() );
}
示例6: QuestArrow
public static void QuestArrow( NetState state, PacketReader pvSrc )
{
bool rightClick = pvSrc.ReadBoolean();
Mobile from = state.Mobile;
if ( from != null && from.QuestArrow != null )
from.QuestArrow.OnClick( rightClick );
}
示例7: SetWarMode
public static void SetWarMode( NetState state, PacketReader pvSrc )
{
state.Mobile.DelayChangeWarmode( pvSrc.ReadBoolean() );
}
示例8: UpdateAccount
private static void UpdateAccount(NetState state, PacketReader pvSrc)
{
if (state.Account.AccessLevel < AccessLevel.Administrator)
{
state.Send(new MessageBoxMessage("You do not have permission to edit accounts.", "Account Access Exception"));
return;
}
string username = pvSrc.ReadString();
string pass = pvSrc.ReadString();
Account a = Accounts.GetAccount(username) as Account;
if (a != null && !CanAccessAccount(state.Account, a))
{
state.Send(new MessageBoxMessage("You cannot edit an account with an access level greater than or equal to your own.", "Account Access Exception"));
}
else
{
bool CreatedAccount = false;
bool UpdatedPass = false;
bool oldbanned = a == null ? false : a.Banned;
AccessLevel oldAcessLevel = a == null ? 0 : a.AccessLevel;
if (a == null)
{
a = new Account(username, pass);
CreatedAccount = true;
}
else if (pass != "(hidden)")
{
a.SetPassword(pass);
UpdatedPass = true;
}
if (a != state.Account)
{
AccessLevel newAccessLevel = (AccessLevel)pvSrc.ReadByte();
if (a.AccessLevel != newAccessLevel)
{
if (newAccessLevel >= state.Account.AccessLevel)
state.Send(new MessageBoxMessage("Warning: You may not set an access level greater than or equal to your own.", "Account Access Level update denied."));
else
a.AccessLevel = newAccessLevel;
}
bool newBanned = pvSrc.ReadBoolean();
if (newBanned != a.Banned)
{
oldbanned = a.Banned;
a.Banned = newBanned;
a.Comments.Add(new AccountComment(state.Account.Username, newBanned ? "Banned via Remote Admin" : "Unbanned via Remote Admin"));
}
}
else
{
pvSrc.ReadInt16();//skip both
state.Send(new MessageBoxMessage("Warning: When editing your own account, Account Status and Access Level cannot be changed.", "Editing Own Account"));
}
ArrayList list = new ArrayList();
ushort length = pvSrc.ReadUInt16();
bool invalid = false;
for (int i = 0; i < length; i++)
{
string add = pvSrc.ReadString();
if (Utility.IsValidIP(add))
list.Add(add);
else
invalid = true;
}
if (list.Count > 0)
a.IPRestrictions = (string[])list.ToArray(typeof(string));
else
a.IPRestrictions = new string[0];
if (invalid)
state.Send(new MessageBoxMessage("Warning: one or more of the IP Restrictions you specified was not valid.", "Invalid IP Restriction"));
if (CreatedAccount)
RemoteAdminLogging.WriteLine(state, "Created account {0} with Access Level {1}", a.Username, a.AccessLevel);
else
{
string changes = string.Empty;
if (UpdatedPass)
changes += " Password Changed.";
if (oldAcessLevel != a.AccessLevel)
changes = string.Format("{0} Access level changed from {1} to {2}.", changes, oldAcessLevel, a.AccessLevel);
if (oldbanned != a.Banned)
changes += a.Banned ? " Banned." : " Unbanned.";
RemoteAdminLogging.WriteLine(state, "Updated account {0}:{1}", a.Username, changes);
}
state.Send(new MessageBoxMessage("Account updated successfully.", "Account Updated"));
}
}
示例9: StringQueryResponse
public static void StringQueryResponse( NetState state, PacketReader pvSrc )
{
int serial = pvSrc.ReadInt32();
pvSrc.ReadUInt16(); // unknown
bool ok = pvSrc.ReadBoolean();
int length = pvSrc.ReadUInt16();
string str = null;
if ( length > 0 )
str = pvSrc.ReadString(length - 1);
StringQueryCollection stringqueries = state.StringQueries;
for ( int i = 0; i < stringqueries.Count; ++i )
{
StringQuery stringquery = stringqueries[i];
if ( stringquery.Serial == serial )
{
stringquery.OnResponse( state, ok, str );
state.RemoveStringQuery( i );
return;
}
}
}
示例10: MoveTile
public static void MoveTile( MahjongGame game, NetState state, PacketReader pvSrc )
{
if ( game == null || !game.Players.IsInGamePlayer( state.Mobile ) )
return;
int number = pvSrc.ReadByte();
if ( number < 0 || number >= game.Tiles.Length )
return;
pvSrc.ReadByte(); // Current direction
MahjongPieceDirection direction = GetDirection( pvSrc.ReadByte() );
pvSrc.ReadByte();
bool flip = pvSrc.ReadBoolean();
pvSrc.ReadInt16(); // Current Y
pvSrc.ReadInt16(); // Current X
pvSrc.ReadByte();
int y = pvSrc.ReadInt16();
int x = pvSrc.ReadInt16();
pvSrc.ReadByte();
game.Tiles[number].Move( new Point2D( x, y ), direction, flip, game.Players.GetPlayerIndex( state.Mobile ) );
}
示例11: TogglePublicHand
public static void TogglePublicHand( MahjongGame game, NetState state, PacketReader pvSrc )
{
if ( game == null || !game.Players.IsInGamePlayer( state.Mobile ) )
return;
pvSrc.ReadInt16();
pvSrc.ReadByte();
bool publicHand = pvSrc.ReadBoolean();
game.Players.SetPublic( game.Players.GetPlayerIndex( state.Mobile ), publicHand );
}
示例12: CreateCharacter
public static void CreateCharacter( NetState state, PacketReader pvSrc )
{
int unk1 = pvSrc.ReadInt32();
int unk2 = pvSrc.ReadInt32();
int unk3 = pvSrc.ReadByte();
string name = pvSrc.ReadString( 30 );
pvSrc.Seek( 2, SeekOrigin.Current );
int flags = pvSrc.ReadInt32();
pvSrc.Seek( 8, SeekOrigin.Current );
int prof = pvSrc.ReadByte();
pvSrc.Seek( 15, SeekOrigin.Current );
bool female = pvSrc.ReadBoolean();
int str = pvSrc.ReadByte();
int dex = pvSrc.ReadByte();
int intl= pvSrc.ReadByte();
int is1 = pvSrc.ReadByte();
int vs1 = pvSrc.ReadByte();
int is2 = pvSrc.ReadByte();
int vs2 = pvSrc.ReadByte();
int is3 = pvSrc.ReadByte();
int vs3 = pvSrc.ReadByte();
int hue = pvSrc.ReadUInt16();
int hairVal = pvSrc.ReadInt16();
int hairHue = pvSrc.ReadInt16();
int hairValf= pvSrc.ReadInt16();
int hairHuef= pvSrc.ReadInt16();
pvSrc.ReadByte();
int cityIndex = pvSrc.ReadByte();
int charSlot = pvSrc.ReadInt32();
int clientIP = pvSrc.ReadInt32();
int shirtHue = pvSrc.ReadInt16();
int pantsHue = pvSrc.ReadInt16();
CityInfo[] info = state.CityInfo;
IAccount a = state.Account;
if ( info == null || a == null || cityIndex < 0 || cityIndex >= info.Length )
{
Console.WriteLine( cityIndex );
Console.WriteLine( info.Length );
state.Dispose();
}
else
{
// Check if anyone is using this account
for ( int i = 0; i < a.Length; ++i )
{
Mobile check = a[i];
if ( check != null && check.Map != Map.Internal )
{
Console.WriteLine( "Login: {0}: Account in use", state );
state.Send( new PopupMessage( PMMessage.CharInWorld ) );
return;
}
}
state.Flags = flags;
CharacterCreatedEventArgs args = new CharacterCreatedEventArgs(
state, a,
name, female, hue,
str, dex, intl,
info[cityIndex],
new SkillNameValue[3]
{
new SkillNameValue( (SkillName)is1, vs1 ),
new SkillNameValue( (SkillName)is2, vs2 ),
new SkillNameValue( (SkillName)is3, vs3 ),
},
shirtHue, pantsHue,
hairVal, hairHue,
hairValf, hairHuef,
prof );
state.BlockAllPackets = true;
EventSink.InvokeCharacterCreated( args );
Mobile m = args.Mobile;
if ( m != null )
{
state.Mobile = m;
m.NetState = state;
state.BlockAllPackets = false;
DoLogin( state, m );
}
else
{
state.BlockAllPackets = false;
state.Dispose();
}
}
}
示例13: SetWarMode
public void SetWarMode( GameClient state, PacketReader pvSrc )
{
state.Mobile.DelayChangeWarmode( pvSrc.ReadBoolean() );
}
示例14: QuestArrow
public void QuestArrow( GameClient state, PacketReader pvSrc )
{
Mobile from = state.Mobile;
bool rightClick = pvSrc.ReadBoolean();
if ( from.QuestArrow != null )
from.QuestArrow.OnClick( rightClick );
}
示例15: GodModeRequest
public void GodModeRequest( GameClient state, PacketReader pvSrc )
{
if ( VerifyGC( state ) )
state.Send( new GodModeReply( pvSrc.ReadBoolean() ) );
}