本文整理汇总了C#中Server.Network.NetState.Send方法的典型用法代码示例。如果您正苦于以下问题:C# NetState.Send方法的具体用法?C# NetState.Send怎么用?C# NetState.Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Network.NetState
的用法示例。
在下文中一共展示了NetState.Send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendInfoTo
public override void SendInfoTo( NetState state, bool sendOplPacket )
{
Mobile mob = state.Mobile;
if ( mob != null && mob.AccessLevel > AccessLevel.Player )
state.Send(new SpecialWorldItemPacket(this,0x241a));//Display as stone to GMs
else
state.Send(new SpecialWorldItemPacket(this, 0x21A3));//Display as blocker to Players
if ( sendOplPacket )
state.Send( OPLPacket );
}
示例2: RejectNoEncryption
public void RejectNoEncryption(NetState ns)
{
// Log it on the console
Console.WriteLine("Client: {0}: Unencrypted client detected, disconnected", ns);
// Send the client the typical "Bad communication" packet and also a sysmessage stating the error
ns.Send(new AsciiMessage(Server.Serial.MinusOne, -1, MessageType.Label, 0x35, 3, "System", "Unencrypted connections are not allowed on this server."));
ns.Send(new AccountLoginRej(ALRReason.BadComm));
// Disconnect the client
ns.Dispose(true);
}
示例3: SendInfoTo
public override void SendInfoTo( NetState state )
{
Mobile mob = state.Mobile;
if ( mob != null && mob.AccessLevel >= AccessLevel.GameMaster )
state.Send( new GMItemPacket( this ) );
else
state.Send( WorldPacket );
if ( ObjectPropertyList.Enabled )
state.Send( OPLPacket );
}
示例4: 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() );
}
示例5: SendInfoTo
public override void SendInfoTo( NetState state )
{
Mobile mob = state.Mobile;
//Al: It seems that older clients display 0x21A3 as unused tile
// Since we modify the flags of 0x21A3 we have to use this itemid
// Hence we display this item as 0x21A4 (==normal blocker) to the
// UO client. This is extremely ugly :)
if (mob != null && mob.AccessLevel >= AccessLevel.GameMaster)
state.Send(new SpecialWorldItemPacket(this,0x241a));//Display as stone to GMs
else
state.Send(new SpecialWorldItemPacket(this, 0x21A4));//Display as blocker to Players
if ( ObjectPropertyList.Enabled )
state.Send( OPLPacket );
}
示例6: 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"));
}
}
示例7: 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" ) );
}
示例8: statusServer_packetReceived
private static void statusServer_packetReceived( NetState state, PacketReader reader )
{
string status = BuildStatus();
int currBufferSize = SendQueue.CoalesceBufferSize;
SendQueue.CoalesceBufferSize = Math.Max( (status.Length + 2), currBufferSize );
state.Send( new StatusInfo( status ) );
SendQueue.CoalesceBufferSize = currBufferSize;
}
示例9: OnPartyTrack
private static void OnPartyTrack( NetState state, PacketReader pvSrc )
{
Mobile from = state.Mobile;
Party party = Party.Get( from );
if ( party != null )
{
Packets.PartyTrack packet = new Packets.PartyTrack( from, party );
if ( packet.UnderlyingStream.Length > 8 )
state.Send( packet );
}
}
示例10: QueryPartyLocations
public static void QueryPartyLocations(NetState state, PacketReader pvSrc)
{
Mobile from = state.Mobile;
Party party = Party.Get(from);
if (party != null)
{
AckPartyLocations ack = new AckPartyLocations(from, party);
if (ack.UnderlyingStream.Length > 8)
state.Send(ack);
}
}
示例11: CustomRunebook
private static void CustomRunebook(NetState state, PacketReader pvSrc)
{
int RuneBookSerial = pvSrc.ReadInt32();
var runebook = World.FindItem(RuneBookSerial) as Runebook;
if (runebook != null)
{
Packets.SallosRunebook packet = new Packets.SallosRunebook(runebook);
if (packet.UnderlyingStream.Length > 7)
state.Send(packet);
}
}
示例12: OnResponse
public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
switch (info.ButtonID)
{
case 0:
{
break;
}
case 1:
{
sender.Send(new LaunchBrowser(url));
break;
}
}
}
示例13: PrivateOverheadMessage
public static void PrivateOverheadMessage(this Item item, MessageType type, int hue, int number, NetState state, string args = "")
{
if (item.Map != null && state != null)
{
Packet p = null;
Point3D worldLoc = item.GetWorldLocation();
Mobile m = state.Mobile;
if (m != null && m.CanSee(item) && m.InRange(worldLoc, item.GetUpdateRange(m)))
{
if (p == null)
p = Packet.Acquire(new MessageLocalized(item.Serial, item.ItemID, type, hue, 3, number, item.Name, args));
state.Send(p);
}
Packet.Release(p);
}
}
示例14: Authenticate
public static void Authenticate( NetState state, PacketReader pvSrc )
{
string user = pvSrc.ReadString( 30 );
string pw = pvSrc.ReadString( 30 );
Account a = Accounts.GetAccount( user );
if ( a == null )
{
state.Send( new Login( LoginResponse.NoUser ) );
log.Warn(String.Format("ADMIN: Invalid username '{0}' from {1}",
user, state));
DelayedDisconnect( state );
}
else if ( !a.HasAccess( state ) )
{
state.Send( new Login( LoginResponse.BadIP ) );
log.Warn(String.Format("ADMIN: Access to '{0}' from {1} denied.",
user, state));
DelayedDisconnect( state );
}
else if ( !a.CheckPassword( pw ) )
{
state.Send( new Login( LoginResponse.BadPass ) );
log.Warn(String.Format("ADMIN: Invalid password '{0}' for user '{1}' from {2}",
pw, user, state));
DelayedDisconnect( state );
}
else if ( a.AccessLevel != AccessLevel.Administrator || a.Banned )
{
log.Warn(String.Format("ADMIN: Account '{0}' does not have admin access. Connection Denied.",
user));
state.Send( new Login( LoginResponse.NoAccess ) );
DelayedDisconnect( state );
}
else
{
log.Warn(String.Format("ADMIN: Access granted to '{0}' from {1}",
user, state));
state.Account = a;
a.LogAccess( state );
a.LastLogin = DateTime.Now;
state.Send( new Login( LoginResponse.OK ) );
state.Send( Compress( new ConsoleData( m_ConsoleData.ToString() ) ) );
m_Auth.Add( state );
}
}
示例15: LoginServerSeed
public static void LoginServerSeed(NetState state, PacketReader pvSrc)
{
int seed = pvSrc.ReadInt32(); // Seed
int clientMaj = pvSrc.ReadInt32();
int clientMin = pvSrc.ReadInt32();
int clientRev = pvSrc.ReadInt32();
int clientPat = pvSrc.ReadInt32();
if ((seed == 0) && (clientMaj == 0) && (clientMin == 0) && (clientPat == 0) && (clientRev == 0))
{
state.SentFirstPacket = true;
// This is UOExt. Cheers!
state.Send(m_UOExtSupport);
state.Flush();
return;
}
// Enroute to old EF handler
pvSrc.Seek(0, System.IO.SeekOrigin.Begin);
m_OldEFHandler.OnReceive(state, pvSrc);
}