本文整理汇总了C#中Server.SpeechEventArgs.HasKeyword方法的典型用法代码示例。如果您正苦于以下问题:C# SpeechEventArgs.HasKeyword方法的具体用法?C# SpeechEventArgs.HasKeyword怎么用?C# SpeechEventArgs.HasKeyword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.SpeechEventArgs
的用法示例。
在下文中一共展示了SpeechEventArgs.HasKeyword方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
Mobile from = e.Mobile;
if (XmlScript.HasTrigger(this, TriggerName.onSpeech) && UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech))
{
return;
}
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.Young || pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.UtcNow)
{
SayTo(from, 501048); // You are too young to join my guild...
if (pm.GameTime < JoinGameAge)
{
pm.LocalOverheadMessage(MessageType.Regular, 38, false, "Your gametime (" + pm.GameTime + ") must reach " + JoinGameAge + " before you can join.");
}
else if ((pm.CreationTime + JoinAge) > DateTime.UtcNow)
{
pm.LocalOverheadMessage(MessageType.Regular, 38, false, "You must wait 7 days after creating your character to join. That will be at " + (pm.CreationTime + JoinAge) + " server time." );
}
}
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.UtcNow || (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 );
}
示例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.UtcNow )
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.UtcNow || (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, new TargetCallback( Appraise_OnTarget ) );
e.Handled = true;
}
base.OnSpeech( e );
}
示例4: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
Mobile from = e.Mobile;
if ( !e.Handled && from is PlayerMobile && from.InRange( this.Location, 4 ))
{
if ( e.HasKeyword( 0x0004 ) ) // *join*
{
SayPriceTo( from );
e.Handled = true;
}
}
base.OnSpeech( e );
}
示例5: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
Mobile from = e.Mobile;
if ( !e.Handled && from is PlayerMobile && from.InRange( this.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 ( m_NewsTimer == null && e.HasKeyword( 0x30 ) && e.Mobile.Alive && InRange( e.Mobile, 12 ) ) // *news*
{
Direction = GetDirectionTo( e.Mobile );
TownCrierEntry tce = 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!
}
}
}
示例7: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
base.OnSpeech( e );
Mobile from = e.Mobile;
Item sign = m_House.Sign;
bool isOwner = m_House.IsOwner( from );
bool isCoOwner = isOwner || m_House.IsCoOwner( from );
bool isFriend = isCoOwner || m_House.IsFriend( from );
if ( !isFriend )
return;
if ( !from.Alive )
return;
if ( Core.ML && Insensitive.Equals( e.Speech, "I wish to resize my house" ) )
{
if ( from.Map != sign.Map || !from.InRange( sign, 0 ) )
{
from.SendLocalizedMessage( 500295 ); // you are too far away to do that.
}
else if ( DateTime.Now <= m_House.BuiltOn.AddHours ( 1 ) )
{
from.SendLocalizedMessage( 1080178 ); // You must wait one hour between each house demolition.
}
else if ( isOwner )
{
from.CloseGump( typeof( ConfirmHouseResize ) );
from.CloseGump( typeof( HouseGumpAOS ) );
from.SendGump( new ConfirmHouseResize( from, m_House ) );
}
else
{
from.SendLocalizedMessage( 501320 ); // Only the house owner may do this.
}
}
if ( !m_House.IsInside( from ) || !m_House.IsActive )
return;
else if ( e.HasKeyword( 0x33 ) ) // remove thyself
{
if ( isFriend )
{
from.SendLocalizedMessage( 501326 ); // Target the individual to eject from this house.
from.Target = new HouseKickTarget( m_House );
}
else
{
from.SendLocalizedMessage( 502094 ); // You must be in your house to do this.
}
}
else if ( e.HasKeyword( 0x34 ) ) // I ban thee
{
if ( !isFriend )
{
from.SendLocalizedMessage( 502094 ); // You must be in your house to do this.
}
else if ( !m_House.Public && m_House.IsAosRules )
{
from.SendLocalizedMessage( 1062521 ); // You cannot ban someone from a private house. Revoke their access instead.
}
else
{
from.SendLocalizedMessage( 501325 ); // Target the individual to ban from this house.
from.Target = new HouseBanTarget( true, m_House );
}
}
else if ( e.HasKeyword( 0x23 ) ) // I wish to lock this down
{
if ( isCoOwner )
{
from.SendLocalizedMessage( 502097 ); // Lock what down?
from.Target = new LockdownTarget( false, m_House );
}
else if ( isFriend )
{
from.SendLocalizedMessage( 1010587 ); // You are not a co-owner of this house.
}
else
{
from.SendLocalizedMessage( 502094 ); // You must be in your house to do this.
}
}
else if ( e.HasKeyword( 0x24 ) ) // I wish to release this
{
if ( isCoOwner )
{
from.SendLocalizedMessage( 502100 ); // Choose the item you wish to release
from.Target = new LockdownTarget( true, m_House );
}
else if ( isFriend )
{
from.SendLocalizedMessage( 1010587 ); // You are not a co-owner of this house.
}
else
{
from.SendLocalizedMessage( 502094 ); // You must be in your house to do this.
//.........这里部分代码省略.........
示例8: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
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
{
OpenBackpack( from );
e.Handled = true;
}
}
else if ( e.HasKeyword( 0x3E ) || (e.HasKeyword( 0x173 ) && WasNamed( e.Speech )) ) // vendor collect, *collect
{
if ( IsOwner( from ) )
{
CollectGold( 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 ) )
{
this.Direction = this.GetDirectionTo( from );
e.Handled = true;
}
}
}
示例9: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
if ( !e.Handled && e.HasKeyword( 0x0008 ) ) // *stable*
{
e.Handled = true;
CloseClaimList( e.Mobile );
BeginStable( e.Mobile );
}
else if ( !e.Handled && e.HasKeyword( 0x0009 ) ) // *claim*
{
e.Handled = true;
CloseClaimList( e.Mobile );
int index = e.Speech.IndexOf( ' ' );
if ( index != -1 )
Claim( e.Mobile, e.Speech.Substring( index ).Trim() );
else
Claim( e.Mobile );
}
else
{
base.OnSpeech( e );
}
}
示例10: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
base.OnSpeech( e );
EDI dest = GetDestination();
if ( dest != null && !e.Handled && e.Mobile.InRange( this.Location, 3 ) )
{
if ( e.HasKeyword( 0x1D ) ) // *destination*
e.Handled = SayDestinationTo( e.Mobile );
else if ( e.HasKeyword( 0x1E ) ) // *i will take thee*
e.Handled = AcceptEscorter( e.Mobile );
}
}
示例11: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
if ( !e.Handled && e.Mobile.InRange( this.Location, 2 ) )
{
if ( e.HasKeyword( Keyword ) )
{
e.Handled = true;
Mobile from = e.Mobile;
Guild g = from.Guild as Server.Guilds.Guild;
if ( from.Karma < (int)Noto.Great )
{
Say( "Thou art not famous enough to join our ranks." );
return;
}
else if ( g != null && g.Type != GuildType.Regular && g.Type != Type )
{
Say( "Thou art not properly affiliated to join our ranks." );
return;
}
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().IsAssignableFrom( twoHanded.GetType() ) ) )
{
Say( "Why dost thou ask about virtue guards when thou art one?" );
shield.Delete();
}
else if ( from.PlaceInBackpack( shield ) )
{
Say( Utility.Random( 1007101, 5 ) );
Say( "Welcome to our ranks. Here is thy shield." );
from.AddToBackpack( shield );
}
else
{
from.SendLocalizedMessage( 502868 ); // Your backpack is too full.
shield.Delete();
}
}
}
else
{
if ( Utility.RandomBool() )
{
if ( SignupNumber > 0 )
Say( SignupNumber );
else if ( SignupString != "" )
Say( SignupString );
e.Handled = true;
}
}
}
base.OnSpeech( e );
}
示例12: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
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, true, "You own this shop, just take what you want." ); // You own this shop, just take what you want.
}
else if ( House == null || !House.IsBanned( from ) )
{
from.SendAsciiMessage( "Select the item you wish to buy." ); // 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
{
OpenBackpack( from );
e.Handled = true;
}
}
else if ( e.HasKeyword( 0x3E ) || (e.HasKeyword( 0x173 ) && WasNamed( e.Speech )) ) // vendor collect, *collect
{
if ( IsOwner( from ) )
{
CollectGold( from );
e.Handled = true;
}
}
else if ( e.HasKeyword( 0x3F ) || (e.HasKeyword( 0x174 ) && WasNamed( e.Speech )) ) // vendor status, *status
{
if ( IsOwner( from ) )
{
double days = (HoldGold + BankAccount) / ((double)ChargePerDay);
/*SayTo(from, true, String.Format("Amount of days I can work: {0}", ((int)days).ToString()));
SayTo(from, true, String.Format("Earth days: {0}", ((int)(days/12)).ToString()));
SayTo(from, true, String.Format("Gold held for you: {0}gp", HoldGold.ToString()));
SayTo(from, true, String.Format("Gold held in my account: {0}gp", BankAccount.ToString()));
SayTo(from, true, String.Format("My charge per day is: {0}gp", ChargePerDay.ToString()));*/
SayTo(from, true, String.Format("I am holding {0} gold for you.", HoldGold.ToString()));
SayTo(from, true, String.Format("My current charge is {0} gold per day.", ChargePerDay.ToString()));
if (((HoldGold + BankAccount) / ChargePerDay) > 0)
SayTo(from, true, String.Format("Including your gold I'm holding, I have enough gold to continue working for {0} days. ({1} earth days)", ((int)days).ToString(), ((int)(days / 12)).ToString()));
else
SayTo(from, true, String.Format("You need to give me {0} gold by the end of the day to retain my services.", (ChargePerDay - HoldGold - BankAccount).ToString()));
//SendOwnerGump( from );
e.Handled = true;
}
else
{
SayTo( from, true, "What do you care? You don't run this shop." ); // 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 ) )
{
this.Direction = this.GetDirectionTo( from );
e.Handled = true;
}
}
}
示例13: OnSpeech
public override void OnSpeech( SpeechEventArgs e )
{
if( !e.Handled && e.Mobile.InRange( this, 6 ) )
{
int[] keywords = e.Keywords;
string speech = e.Speech;
// Check for a greeting or 'Hire'
if( (e.HasKeyword( 0x003B ) == true) || (e.HasKeyword( 0x0162 ) == true) )
e.Handled = this.SayHireCost();
}
base.OnSpeech( e );
}
示例14: OnSpeech
public virtual void OnSpeech(SpeechEventArgs e)
{
if (e.Mobile.Alive && e.Mobile.InRange(m_Mobile.Location, 3) && m_Mobile.IsHumanInTown())
{
if (e.HasKeyword(0x9D) && WasNamed(e.Speech)) // *move*
{
if (m_Mobile.Combatant != null)
{
// I am too busy fighting to deal with thee!
m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 501482);
}
else
{
// Excuse me?
m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 501516);
WalkRandomInHome(2, 2, 1);
}
}
else if (e.HasKeyword(0x9E) && WasNamed(e.Speech)) // *time*
{
if (m_Mobile.Combatant != null)
{
// I am too busy fighting to deal with thee!
m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 501482);
}
else
{
int generalNumber;
string exactTime;
Clock.GetTime(m_Mobile, out generalNumber, out exactTime);
m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, generalNumber);
}
}
else if (e.HasKeyword(0x6C) && WasNamed(e.Speech)) // *train
{
if (m_Mobile.Combatant != null)
{
// I am too busy fighting to deal with thee!
m_Mobile.PublicOverheadMessage(MessageType.Regular, 0x3B2, 501482);
}
else
{
bool foundSomething = false;
Skills ourSkills = m_Mobile.Skills;
Skills theirSkills = e.Mobile.Skills;
for (int i = 0; i < ourSkills.Length && i < theirSkills.Length; ++i)
{
Skill skill = ourSkills[i];
Skill theirSkill = theirSkills[i];
if (skill != null && theirSkill != null && skill.Base >= 60.0 && m_Mobile.CheckTeach(skill.SkillName, e.Mobile))
{
double toTeach = skill.Base / 3.0;
if (toTeach > 42.0)
toTeach = 42.0;
if (toTeach > theirSkill.Base)
{
int number = 1043059 + i;
if (number > 1043107)
continue;
if (!foundSomething)
m_Mobile.Say(1043058); // I can train the following:
m_Mobile.Say(number);
foundSomething = true;
}
}
}
if (!foundSomething)
m_Mobile.Say(501505); // Alas, I cannot teach thee anything.
}
}
else
{
SkillName toTrain = (SkillName)(-1);
for (int i = 0; toTrain == (SkillName)(-1) && i < e.Keywords.Length; ++i)
{
int keyword = e.Keywords[i];
if (keyword == 0x154)
{
toTrain = SkillName.Anatomy;
}
else if (keyword >= 0x6D && keyword <= 0x9C)
{
int index = keyword - 0x6D;
if (index >= 0 && index < m_KeywordTable.Length)
toTrain = m_KeywordTable[index];
//.........这里部分代码省略.........
示例15: OnSpeech
public override void OnSpeech( SpeechEventArgs args )
{
base.OnSpeech( args );
if (IsDisabled())
return;
if ( args.Mobile.Alive && (args.HasKeyword( 0x0007 ) || args.Speech.ToLower().Contains("guards") || args.Speech.ToLower().Contains("guardas")) ) // *guards*
CallGuards( args.Mobile.Location );
}