本文整理汇总了C#中Server.Network.NetState类的典型用法代码示例。如果您正苦于以下问题:C# NetState类的具体用法?C# NetState怎么用?C# NetState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NetState类属于Server.Network命名空间,在下文中一共展示了NetState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnResponse
public override void OnResponse( NetState sender, RelayInfo info )
{
switch ( info.ButtonID )
{
case 0: // back
{
m_From.SendGump( new FactionStoneGump( m_From, m_Election.Faction ) );
break;
}
case 1: // vote
{
if ( m_Election.State == ElectionState.Election )
m_From.SendGump( new VoteGump( m_From, m_Election ) );
break;
}
case 2: // campaign
{
if ( m_Election.CanBeCandidate( m_From ) )
m_Election.AddCandidate( m_From );
break;
}
}
}
示例2: OnResponse
public override void OnResponse( NetState state, RelayInfo info )
{
m_Mobile.SendGump( new PageResponseGump( m_Mobile, m_Name, m_Text ) );
//m_Mobile.SendMessage( 0x482, "{0} tells you:", m_Name );
//m_Mobile.SendMessage( 0x482, m_Text );
}
示例3: OnResponse
public override void OnResponse(NetState state, RelayInfo info)
{
string bookName = "";
try
{
for (int x = 0; x < 51; x++)
{
bookName = GetString(info, x + 100);
if (!(string.IsNullOrEmpty(bookName)) && bookName.Length > 0) Book.Books[x].Name = bookName;
else Book.Books[x].Name = string.Format("Book #{0}", ((int)(x + 1)).ToString());
}
}
catch(Exception e)
{
Console.WriteLine("Caught Exception in MasterRunebookGump, during the 'for' loop.");
Console.WriteLine(e.ToString());
}
Mobile from = state.Mobile;
try
{
if (info.ButtonID > 0)
from.SendGump(new InternalRunebookGump(from, Book.Books[info.ButtonID - 16], Book, info.ButtonID - 16));
}
catch (Exception e)
{
Console.WriteLine("Caught Exception in MasterRunebookGump, when sending new InternalRunebookGump.");
Console.WriteLine(e.ToString());
}
}
示例4: RegisterInvalidAccess
public static void RegisterInvalidAccess( NetState ns )
{
if( ns == null || !Enabled )
return;
InvalidAccountAccessLog accessLog = FindAccessLog( ns );
if( accessLog == null )
m_List.Add( accessLog = new InvalidAccountAccessLog( ns.Address ) );
accessLog.Counts += 1;
accessLog.RefreshAccessTime();
if ( accessLog.Counts >= 3 ) {
try {
using ( StreamWriter op = new StreamWriter( "throttle.log", true ) ) {
op.WriteLine(
"{0}\t{1}\t{2}",
DateTime.Now,
ns,
accessLog.Counts
);
}
}
catch {
}
}
}
示例5: OnResponse
public override void OnResponse( NetState sender, RelayInfo info )
{
Item item = m_Addon as Item;
if ( item == null || item.Deleted )
return;
if ( info.ButtonID == (int) Buttons.Confirm )
{
Mobile m = sender.Mobile;
BaseHouse house = BaseHouse.FindHouseAt( m );
if ( house != null && house.IsOwner( m ) )
{
if ( m.InRange( item.Location, 2 ) )
{
Item deed = m_Addon.Deed;
if ( deed != null )
{
m.AddToBackpack( deed );
house.Addons.Remove( item );
item.Delete();
}
}
else
m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
}
else
m.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
}
}
示例6: SendInfoTo
public override void SendInfoTo(NetState state, bool sendOplPacket)
{
if (state == null || state.Mobile == null || state.Mobile.AccessLevel >= AccessLevel.Counselor)
{
base.SendInfoTo(state, sendOplPacket);
}
}
示例7: OnResponse
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed.Deleted || !m_Deed.IsChildOf(sender.Mobile.Backpack))
return;
switch (info.ButtonID)
{
case (int)Buttons.Exit:
return;
case (int)Buttons.Add:
m_Deed.BeginCombine(sender.Mobile);
return;
case (int)Buttons.PlaceInHouse:
if (m_Deed.NumOfPartsAdded > 0)
{
m_Deed.PlaceInHouse(sender.Mobile);
return;
}
else
sender.Mobile.SendMessage("You cannot add the pentagram to a house without any parts in the deed.");
break;
}
sender.Mobile.SendGump(new BloodPentagramPartGump(sender.Mobile, m_Deed));
}
示例8: OnResponse
public override void OnResponse( NetState sender, RelayInfo info )
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( !IsMember( pm, guild ) )
return;
switch( info.ButtonID )
{
case 1:
{
pm.SendGump( new GuildInfoGump( pm, guild ) );
break;
}
case 2:
{
pm.SendGump( new GuildRosterGump( pm, guild ) );
break;
}
case 3:
{
pm.SendGump( new GuildDiplomacyGump( pm, guild ) );
break;
}
}
}
示例9: OnResponse
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
if( info.IsSwitched( (int)Buttons.rdoYesJoin ) )
{
if( ScavengerSignup.signupEnabled && from is PlayerMobile )
{
ScavengerBasket newBasket = new ScavengerBasket( (PlayerMobile)from );
if( !from.Backpack.CheckHold( from, newBasket, false ) )
{
from.SendMessage( "Your backpack is too full to even consider entering this event!" );
newBasket.Delete();
return;
}
from.AddToBackpack( newBasket );
ScavengerSignup.ScavengerBaskets.Add( newBasket );
from.SendMessage( "You are now entered in the scavenger hunt. Use the supplied basket to gather the scavenger items!" );
}
else
{
from.SendMessage( "You have waited too long and signup for the scavenger hunt has ended" );
}
}
else
{
from.SendMessage( "You have not been entered into the scavenger hunt event" );
}
}
示例10: GetPacketFor
public override Packet GetPacketFor( NetState ns )
{
if ( ns.HighSeas )
return new MultiTargetReqHS( this );
else
return new MultiTargetReq( this );
}
示例11: OnResponse
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
switch(info.ButtonID)
{
default:
case 0: break;
case 1:
from.SendGump(new StallLeasingGump(from, m_Plot));
from.SendGump(new BazaarInformationGump(-1, 1150391));
break;
case 2: // SEE TOP BIDS
from.SendGump(new TopBidsGump(from, m_Plot));
break;
case 3: // MY STALL LEASE
if (m_Plot.IsOwner(from))
from.SendGump(new MyStallLeaseGump(from, m_Plot));
else
from.SendLocalizedMessage(1150685); // You are currently viewing a stall that you are not leasing. In order to set up or modify your stall, please use that stall's sign.
break;
case 4: // MY STALL BID
from.SendGump(new StallBidGump(from, m_Plot));
break;
case 5: // MY BID MATCHING
if(m_Plot.IsOwner(from))
from.SendGump(new MatchBidGump(from, m_Plot));
else
from.SendLocalizedMessage(1150685); // You are currently viewing a stall that you are not leasing. In order to set up or modify your stall, please use that stall's sign.
break;
}
}
示例12: OnResponse
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
if ( from == null )
return;
if ( info.ButtonID == 0 ) // Close
{
from.SendGump( new CityManagementGump( m_Stone, from ) );
}
if ( info.ButtonID == 1 ) // Previous page
{
if ( m_ListPage > 0 )
from.SendGump( new ChangeCitizenTitleGump( m_Stone, m_ListPage - 1, m_List, m_CountList ) );
}
if ( info.ButtonID == 2 ) // Next page
{
if ( (m_ListPage + 1) * 7 < m_List.Count )
from.SendGump( new ChangeCitizenTitleGump( m_Stone, m_ListPage + 1, m_List, m_CountList ) );
}
if ( info.ButtonID >= 100 && info.ButtonID <= 999 ) // Decline
{
Mobile mob = m_List[ info.ButtonID - 100 ] as Mobile;
from.SendMessage( "Please enter the members new title, You are limited to 25 charactors or less." );
from.Prompt = new CitizenTitleChangePrompt( m_Stone, mob, from );
}
}
示例13: OnResponse
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
if ( info.ButtonID == 1 )
{
if ( m_crop != null && !m_crop.Deleted )
{
if ( m_crop is WheatCrop )
((WheatCrop)m_crop).UpRoot( m_Owner );
else if ( m_crop is CottonCrop )
((CottonCrop)m_crop).UpRoot( m_Owner );
else if ( m_crop is CarrotCrop )
((CarrotCrop)m_crop).UpRoot( m_Owner );
else if ( m_crop is FlaxCrop )
((FlaxCrop)m_crop).UpRoot( m_Owner );
else if ( m_crop is LettuceCrop )
((LettuceCrop)m_crop).UpRoot( m_Owner );
else if ( m_crop is OnionCrop )
((OnionCrop)m_crop).UpRoot( m_Owner );
else if ( m_crop is GarlicCrop )
((GarlicCrop)m_crop).UpRoot( m_Owner );
else if ( m_crop is CabbageCrop )
((CabbageCrop)m_crop).UpRoot( m_Owner );
else if ( m_crop is CornCrop )
((CornCrop)m_crop).UpRoot( m_Owner );
}
}
}
示例14: OnResponse
public override void OnResponse( NetState sender, RelayInfo info )
{
int id = info.ButtonID;
if ( m_PetSummonBall.Deleted || id <= 0 )
return;
id --;
ArrayList pets = GetPetList( m_Mobile );
if ( id < pets.Count && id >= 0 )
{
if ( m_Mobile.BankBox.ConsumeTotal( typeof( Gold ), 75000 ) )
{
m_PetSummonBall.UseCharge();
SufferSkillLoss( (Mobile)pets[id], 10 );
((Mobile)pets[id]).MoveToWorld( m_Mobile.Location, m_Mobile.Map );
m_Mobile.SendMessage( "You pay the fee and your pet is returned to you. Your pet has suffered some skills from the travel." );
}
else
{
m_Mobile.SendMessage( "You need 75,000 gold in your bank to return your pet." );
}
}
}
示例15: OnResponse
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( info.ButtonID == 0 )
{
m_From.SendLocalizedMessage( 501235, "", 0x35 ); // Help request aborted.
}
else
{
TextRelay entry = info.GetTextEntry( 0 );
string text = ( entry == null ? "" : entry.Text.Trim() );
if ( text.Length == 0 )
{
m_From.SendMessage( 0x35, "You must enter a description." );
m_From.SendGump( new PagePromptGump( m_From, m_Type ) );
}
else
{
m_From.SendLocalizedMessage( 501234, "", 0x35 ); /* The next available Counselor/Game Master will respond as soon as possible.
* Please check your Journal for messages every few minutes.
*/
PageQueue.Enqueue( new PageEntry( m_From, text, m_Type ) );
}
}
}