本文整理汇总了C#中SpeechEventArgs.HasKeyword方法的典型用法代码示例。如果您正苦于以下问题:C# SpeechEventArgs.HasKeyword方法的具体用法?C# SpeechEventArgs.HasKeyword怎么用?C# SpeechEventArgs.HasKeyword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpeechEventArgs
的用法示例。
在下文中一共展示了SpeechEventArgs.HasKeyword方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSpeech
public override void OnSpeech(SpeechEventArgs e)
{
if (XmlScript.HasTrigger(this, TriggerName.onSpeech) &&
UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech))
{
return;
}
Mobile m = e.Mobile;
Faction fact = Faction.Find(m);
if (!e.Handled && m.Alive && e.HasKeyword(0x38)) // *appraise*
{
if (FactionAllegiance != null && fact != null && FactionAllegiance != fact)
{
Say("I will not do business with the enemy!");
}
else if (!TestCenter.Enabled)
{
PublicOverheadMessage(MessageType.Regular, 0x3B2, 500608); // Which deed would you like appraised?
m.BeginTarget(12, false, TargetFlags.None, Appraise_OnTarget);
e.Handled = true;
}
}
base.OnSpeech(e);
}
示例2: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
Mobile from = e.Mobile;
if ( !e.Handled && from is PlayerMobile && from.InRange( this.Location, 2 ) && WasNamed( e.Speech ) )
{
PlayerMobile pm = (PlayerMobile)from;
if ( e.HasKeyword( 0x0004 ) ) // *join* | *member*
{
if ( pm.NpcGuild == this.NpcGuild )
SayTo( from, 501047 ); // Thou art already a member of our guild.
else if ( pm.NpcGuild != NpcGuild.None )
SayTo( from, 501046 ); // Thou must resign from thy other guild first.
else if ( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.Now )
SayTo( from, 501048 ); // You are too young to join my guild...
else if ( CheckCustomReqs( pm ) )
SayPriceTo( from );
e.Handled = true;
}
else if ( e.HasKeyword( 0x0005 ) ) // *resign* | *quit*
{
if ( pm.NpcGuild != this.NpcGuild )
{
SayTo( from, 501052 ); // Thou dost not belong to my guild!
}
else if ( (pm.NpcGuildJoinTime + QuitAge) > DateTime.Now || (pm.NpcGuildGameTime + QuitGameAge) > pm.GameTime )
{
SayTo( from, 501053 ); // You just joined my guild! You must wait a week to resign.
}
else
{
SayTo( from, 501054 ); // I accept thy resignation.
pm.NpcGuild = NpcGuild.None;
}
e.Handled = true;
}
}
base.OnSpeech( e );
}
示例3: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
if ( !e.Handled && e.Mobile.Alive && e.HasKeyword( 0x38 ) ) // *appraise*
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, 500608 ); // Which deed would you like appraised?
e.Mobile.BeginTarget( 12, false, TargetFlags.None, Appraise_OnTarget );
e.Handled = true;
}
base.OnSpeech( e );
}
示例4: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
base.OnSpeech( e );
Mobile from = e.Mobile;
if ( m_Mobile is BaseVendor && from.InRange( m_Mobile, 4 ) && !e.Handled )
{
if ( e.HasKeyword( 0x14D ) ) // *vendor sell*
{
((BaseVendor)m_Mobile).VendorSell( from );
e.Handled = true;
m_Mobile.FocusMob = from;
}
else if ( e.HasKeyword( 0x3C ) ) // *vendor buy*
{
((BaseVendor)m_Mobile).VendorBuy( from );
e.Handled = true;
m_Mobile.FocusMob = from;
}
else if ( WasNamed( e.Speech ) || Insensitive.StartsWith( e.Speech, "hi " ) )
{
if ( e.HasKeyword( 0x177 ) ) // *sell*
{
((BaseVendor)m_Mobile).VendorSell( from );
e.Handled = true;
m_Mobile.FocusMob = from;
}
else if ( e.HasKeyword( 0x171 ) ) // *buy*
{
((BaseVendor)m_Mobile).VendorBuy( from );
e.Handled = true;
m_Mobile.FocusMob = from;
}
}
}
}
示例5: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
Mobile from = e.Mobile;
if ( !e.Handled && from is PlayerMobile && from.InRange( Location, 2 ) && e.HasKeyword( 0x1F ) ) // *disguise*
{
PlayerMobile pm = (PlayerMobile)from;
if ( pm.NpcGuild == NpcGuild.ThievesGuild )
SayTo( from, 501839 ); // That particular item costs 700 gold pieces.
else
SayTo( from, 501838 ); // I don't know what you're talking about.
e.Handled = true;
}
base.OnSpeech( e );
}
示例6: OnSpeech
public override void OnSpeech(SpeechEventArgs e)
{
if (!e.Handled && Active)
{
Mobile m = e.Mobile;
if (!m.InRange(GetWorldLocation(), m_Range))
{
return;
}
bool isMatch = false;
if (m_Keyword >= 0 && e.HasKeyword(m_Keyword))
{
isMatch = true;
}
else if (m_Substring != null && e.Speech.ToLower().IndexOf(m_Substring.ToLower()) >= 0)
{
isMatch = true;
}
if (!isMatch || !CanTeleport(m))
{
return;
}
e.Handled = true;
StartTeleport(m);
}
}
示例7: OnSpeech
public override void OnSpeech(SpeechEventArgs args)
{
base.OnSpeech(args);
if (IsDisabled())
{
return;
}
if (args.Mobile.Alive && args.HasKeyword(0x0007)) // *guards*
{
CallGuards(args.Mobile.Location);
}
}
示例8: OnSpeech
// Temporary
public override void OnSpeech( SpeechEventArgs e )
{
base.OnSpeech( e );
Mobile from = e.Mobile;
if ( m_Mobile is BaseVendor && from.InRange( m_Mobile, Core.AOS ? 1 : 4 ) && !e.Handled )
{
if ( e.HasKeyword( 0x14D ) ) // *vendor sell*
{
e.Handled = true;
((BaseVendor)m_Mobile).VendorSell( from );
m_Mobile.FocusMob = from;
}
else if ( e.HasKeyword( 0x3C ) )
{
e.Handled = true;
((BaseVendor)m_Mobile).VendorBuy( from );
m_Mobile.FocusMob = from;
}
else if ( WasNamed( e.Speech ) )
{
e.Handled = true;
if ( e.HasKeyword( 0x177 ) ) // *sell*
((BaseVendor)m_Mobile).VendorSell( from );
else if ( e.HasKeyword( 0x171 ) ) // *buy*
((BaseVendor)m_Mobile).VendorBuy( from );
m_Mobile.FocusMob = from;
}
//I added
else // sell bag
{
string speech = e.Speech.ToLower();
if (speech.EndsWith(" sell bag") || speech.StartsWith("sell bag ") || speech == "sell bag" || speech.Contains(" sell bag "))
{
e.Handled = true;
((BaseVendor)m_Mobile).VendorSellBag(from);
m_Mobile.FocusMob = from;
}
}
//I added
}
}
示例9: OnSpeech
// Temporary
public override void OnSpeech( SpeechEventArgs e )
{
base.OnSpeech( e );
var from = e.Mobile;
if ( m_Mobile is BaseVendor && from.InRange( m_Mobile, m_Mobile.RangePerception ) && !e.Handled )
{
if ( WasNamed( e.Speech ) )
{
e.Handled = true;
if ( e.HasKeyword( 0x177 ) ) // *sell*
((BaseVendor)m_Mobile).VendorSell( from );
else if ( e.HasKeyword( 0x171 ) ) // *buy*
((BaseVendor)m_Mobile).VendorBuy( from );
if (m_InteractTimer != null)
m_InteractTimer.Stop();
m_InteractTimer = new InteractTimer(from, (BaseVendor) m_Mobile);
m_InteractTimer.Start();
m_Mobile.FocusMob = from;
}
else if (e.HasKeyword(0x171) && !NamedInRange(from,e.Speech))//Buy
{
e.Handled = true;
((BaseVendor)m_Mobile).VendorBuy(from);
if (m_InteractTimer != null)
m_InteractTimer.Stop();
m_InteractTimer = new InteractTimer(from, (BaseVendor)m_Mobile);
m_InteractTimer.Start();
m_Mobile.FocusMob = from;
}
else if (e.HasKeyword(0x177) && !NamedInRange(from, e.Speech))//Sell
{
e.Handled = true;
((BaseVendor)m_Mobile).VendorSell(from);
if (m_InteractTimer != null)
m_InteractTimer.Stop();
m_InteractTimer = new InteractTimer(from, (BaseVendor)m_Mobile);
m_InteractTimer.Start();
m_Mobile.FocusMob = from;
}
}
}
示例10: OnSpeech
public override void OnSpeech(SpeechEventArgs e)
{
if (XmlScript.HasTrigger(this, TriggerName.onSpeech) &&
UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech))
{
return;
}
if (!e.Handled && e.HasKeyword(Keyword) && e.Mobile.InRange(Location, 2))
{
e.Handled = true;
Mobile from = e.Mobile;
var g = from.Guild as Guild;
var ethic = Ethics.Player.Find(e.Mobile);
if (g == null && ethic == null || g != null && g.Type != Type && ethic == null)
{
Say(SignupNumber);
}
else if (ethic != null && Shield is OrderShield && ethic.Ethic is EvilEthic ||
ethic != null && Shield is ChaosShield && ethic.Ethic is HeroEthic)
{
Say("Begone! You do not follow the proper ethic to wield one of our order's shields.");
}
else
{
Container pack = from.Backpack;
BaseShield shield = Shield;
Item twoHanded = from.FindItemOnLayer(Layer.TwoHanded);
if ((pack != null && pack.FindItemByType(shield.GetType()) != null) ||
(twoHanded != null && shield.GetType().IsInstanceOfType(twoHanded)))
{
Say(1007110); // Why dost thou ask about virtue guards when thou art one?
shield.Delete();
}
else if (from.PlaceInBackpack(shield))
{
Say(Utility.Random(1007101, 5));
Say(1007139); // I see you are in need of our shield, Here you go.
from.AddToBackpack(shield);
}
else
{
from.SendLocalizedMessage(502868); // Your backpack is too full.
shield.Delete();
}
}
}
base.OnSpeech(e);
}
示例11: OnSpeech
public override void OnSpeech(SpeechEventArgs e)
{
if (!e.Handled && e.HasKeyword(0x16D))
{
return;
}
else
{
base.OnSpeech(e);
}
}
示例12: OnSpeech
// Temporary
public override void OnSpeech( SpeechEventArgs e )
{
base.OnSpeech( e );
Mobile from = e.Mobile;
if ( m_Mobile is BaseVendor && from.InRange( m_Mobile, Core.AOS ? 1 : 4 ) && !e.Handled )
{
if ( e.HasKeyword( 0x14D ) ) // *vendor sell*
{
e.Handled = true;
((BaseVendor)m_Mobile).VendorSell( from );
m_Mobile.FocusMob = from;
}
else if ( e.HasKeyword( 0x3C ) ) // *vendor buy*
{
e.Handled = true;
((BaseVendor)m_Mobile).VendorBuy( from );
m_Mobile.FocusMob = from;
}
else if ( WasNamed( e.Speech ) )
{
if ( e.HasKeyword( 0x177 ) ) // *sell*
{
e.Handled = true;
((BaseVendor)m_Mobile).VendorSell( from );
}
else if ( e.HasKeyword( 0x171 ) ) // *buy*
{
e.Handled = true;
((BaseVendor)m_Mobile).VendorBuy( from );
}
m_Mobile.FocusMob = from;
}
}
}
示例13: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
base.OnSpeech( e );
if ( !e.Handled && this.InRange( e.Mobile, 3 ) )
{
if ( m_NewsTimer == null && e.HasKeyword( 0x30 ) ) // *news*
{
TownCrierEntry tce = GlobalTownCrierEntryList.Instance.GetRandomEntry();
if ( tce == null )
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1005643 ); // I have no news at this time.
}
else
{
m_NewsTimer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 3.0 ), new TimerStateCallback( ShoutNews_Callback ), new object[] { tce, 0 } );
PublicOverheadMessage( MessageType.Regular, 0x3B2, 502978 ); // Some of the latest news!
}
}
for ( int i = 0; i < m_Rumors.Length; ++i )
{
BarkeeperRumor rumor = m_Rumors[i];
if ( rumor == null )
{
continue;
}
string keyword = rumor.Keyword;
if ( keyword == null || ( keyword = keyword.Trim() ).Length == 0 )
{
continue;
}
if ( Insensitive.Equals( keyword, e.Speech ) )
{
string message = rumor.Message;
if ( message == null || ( message = message.Trim() ).Length == 0 )
{
continue;
}
PublicOverheadMessage( MessageType.Regular, 0x3B2, false, message );
}
}
}
}
示例14: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
if( !e.Handled && e.Mobile.InRange( this, 3 ) )
{
int[] keywords = e.Keywords;
string speech = e.Speech;
if( e.HasKeyword( 0x00FC ) )// how art thou
{
switch( Utility.Random( 4 ) )
{
case 0: this.Say( 502002 ); break; //Very well.
case 1: this.Say( 1014089 ); break; //I am well.
case 2: this.Say( 1014115 ); break; //Just fine.
case 3: this.Say( 1014110 ); break; //I'm doing relatively well.
}
}
if( e.HasKeyword( 0x003B ) )// Hail, Hello etc
{
switch( Utility.Random( 6 ) )
{
case 0: this.Say( 1007104 ); break; //Greetings, my friend.
case 1: this.Say( 1007105 ); break; //Hail, my friend.
case 2: this.Say( 1014085 ); break; //Greetings
case 3: this.Say( 1014495 ); break; //Greetings. What might I help thee with?
case 4: this.Say( 1014497 ); break; //Hello, my friend! How may I assist thee?
case 5: this.Say( 1014116 ); break; // Let's see... I remember the names of Shame...
}
}
//Where am I? Start
if( e.HasKeyword( 0x0122 ) && (Region.Name == "Britain"))// Where am i?
{
this.Say( 1014071 ); // Thou art in Britain
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Jhelom"))// Where am i?
{
this.Say( "Thou art in Jhelom." ); // Thou art in Jhelom
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Trinsic"))// Where am i?
{
this.Say( 1014359 ); // Thou'rt in Trinsic,near the Cape of Heros we are.
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Cove"))// Where am i?
{
this.Say( 1014182 ); // This is Cove, friend.
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Buccaneer's Den"))// Where am i?
{
this.Say( 1014171 ); // Thou'rt in Buccaneer's Den.
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Moonglow"))// Where am i?
{
this.Say( "Thou art in Moonglow." ); // Thou'rt in Moonglow
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Vesper"))// Where am i?
{
this.Say( "Thou'rt in Vesper, wonderful town, aye?" ); // Thou'rt in Vesper, wonderful town, aye?
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Minoc"))// Where am i?
{
this.Say( "Thou'rt in Minoc, friend." ); // Thou'rt in Minoc, friend.
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Nujel'm"))// Where am i?
{
this.Say( "Thou art in Nujel'm." ); // Thou art in Nujel'm.
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Ocllo"))// Where am i?
{
this.Say( "Thou'rt in the wonderful town of Ocllo!" ); // Thou'rt in the wonderful town of Ocllo!
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Serpent's Hold"))// Where am i?
{
this.Say( "Thou'rt in Serpent's Hold." ); // Thou'rt in Serpent's Hold
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Skara Brae"))// Where am i?
{
this.Say( "Thou'rt in Skara Brae." ); // Thou'rt in Skara Brae
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Papua"))// Where am i?
{
this.Say( "Thou art in Papua." ); // Thou art in Papua.
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Delucia"))// Where am i?
{
this.Say( "Thou'rt in Delucia." ); // Thou'rt Delucia.
}
else if( e.HasKeyword( 0x0122 ) && (Region.Name == "Haven"))// Where am i?
{
this.Say( "Thou'rt in Haven, young friend." ); // Thou'rt in Haven, young friend.
}
//Where am I? End
//Inns Start
if( e.HasKeyword( 0x00CC ) && (Region.Name == "Britain"))// Where is the inn
{
switch( Utility.Random( 3 ) )
{
case 0: this.Say( 1014003 ); break; // An inn called Sweet Deams lies next ...
case 1: this.Say( 1014032 ); break; // The Northside Inn is situated...
case 2: this.Say( 1014007 ); break; // Despite it's name...
//.........这里部分代码省略.........
示例15: OnSpeech
public override void OnSpeech(SpeechEventArgs e)
{
if (XmlScript.HasTrigger(this, TriggerName.onSpeech) &&
UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech))
{
return;
}
Mobile from = e.Mobile;
if (e.Handled || !from.Alive || from.GetDistanceToSqrt(this) > 3)
{
return;
}
if (e.HasKeyword(0x3C) || (e.HasKeyword(0x171) && WasNamed(e.Speech))) // vendor buy, *buy*
{
if (IsOwner(from))
{
SayTo(from, 503212); // You own this shop, just take what you want.
}
else if (House == null || !House.IsBanned(from))
{
from.SendLocalizedMessage(503213); // Select the item you wish to buy.
from.Target = new PVBuyTarget();
e.Handled = true;
}
}
else if (e.HasKeyword(0x3D) || (e.HasKeyword(0x172) && WasNamed(e.Speech))) // vendor browse, *browse
{
if (House != null && House.IsBanned(from) && !IsOwner(from))
{
SayTo(from, 1062674);
// You can't shop from this home as you have been banned from this establishment.
}
else
{
if (WasNamed(e.Speech))
{
OpenBackpack(from);
}
else
{
IPooledEnumerable mobiles = from.GetMobilesInRange(2);
foreach (
PlayerVendor m in mobiles.OfType<PlayerVendor>().Where(m => m.CanSee(from) && m.InLOS(from))
)
{
m.OpenBackpack(from);
}
mobiles.Free();
}
e.Handled = true;
}
}
else if (e.HasKeyword(0x3E) || (e.HasKeyword(0x173) && WasNamed(e.Speech))) // vendor collect, *collect
{
if (IsOwner(from))
{
CollectCurrency(from);
e.Handled = true;
}
}
else if (e.HasKeyword(0x3F) || (e.HasKeyword(0x174) && WasNamed(e.Speech))) // vendor status, *status
{
if (IsOwner(from))
{
SendOwnerGump(from);
e.Handled = true;
}
else
{
SayTo(from, 503226); // What do you care? You don't run this shop.
}
}
else if (e.HasKeyword(0x40) || (e.HasKeyword(0x175) && WasNamed(e.Speech))) // vendor dismiss, *dismiss
{
if (IsOwner(from))
{
Dismiss(from);
e.Handled = true;
}
}
else if (e.HasKeyword(0x41) || (e.HasKeyword(0x176) && WasNamed(e.Speech))) // vendor cycle, *cycle
{
if (IsOwner(from))
{
Direction = GetDirectionTo(from);
e.Handled = true;
}
}
}