本文整理汇总了C#中MUDEngine.CharData.SendText方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.SendText方法的具体用法?C# CharData.SendText怎么用?C# CharData.SendText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.SendText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SongArmor
/// <summary>
/// Song of armor.
/// </summary>
/// <param name="ch"></param>
/// <param name="spell"></param>
/// <param name="level"></param>
/// <param name="target"></param>
/// <returns></returns>
public static bool SongArmor( CharData ch, Spell spell, int level, Target target )
{
ch.SendText( "You Sing a song of protection.\r\n" );
foreach( CharData victim in ch.InRoom.People )
{
if (victim.IsAffected( Affect.AFFECT_ARMOR))
continue;
Affect af = new Affect( Affect.AffectType.song, spell.Name, 4, Affect.Apply.ac, ( 0 - ( 10 + ( level / 5 ) ) ), Affect.AFFECT_ARMOR );
victim.CombineAffect( af );
victim.SendText( "You feel someone protecting you.\r\n" );
}
return true;
}
示例2: GodMode
public static void GodMode(CharData ch, string[] str)
{
if( ch == null ) return;
if (ch.IsNPC())
return;
if (!ch.Authorized("godmode"))
return;
if (ch.HasActionBit(PC.PLAYER_GODMODE))
{
ch.RemoveActionBit(PC.PLAYER_GODMODE);
ch.SendText("God mode off.\r\n");
}
else
{
ch.SetActionBit(PC.PLAYER_GODMODE);
ch.SendText("God mode on.\r\n");
}
return;
}
示例3: StringAdd
/// <summary>
/// Old-style clunky long-form text editing.
///
/// TODO: Make this work better.
/// </summary>
/// <param name="ch"></param>
/// <param name="argument"></param>
public static void StringAdd( CharData ch, string argument )
{
string text = String.Empty;
int buflen = ch.Socket.EditingString.Length;
int arglen = argument.Length;
if( argument[ 0 ] == '.' )
{
string arg1 = String.Empty;
string arg2 = String.Empty;
string arg3 = String.Empty;
argument = OneArgument( argument, ref arg1 );
argument = OneArgument( argument, ref arg2 );
argument = OneArgument( argument, ref arg3 );
if( !StringsNotEqual( arg1, ".c" ) )
{
ch.SendText( "String cleared.\r\n" );
ch.Socket.EditingString = String.Empty;
return;
}
if( !StringsNotEqual( arg1, ".s" ) )
{
ch.SendText( "String so far:\r\n" );
ch.SendText( ch.Socket.EditingString );
ch.SendText( String.Empty );
return;
}
if( !StringsNotEqual( arg1, ".r" ) )
{
if( String.IsNullOrEmpty(arg2) )
{
ch.SendText( "Usage: .r \"old string\" \"new string\"\r\n" );
return;
}
ch.Socket.EditingString = ch.Socket.EditingString.Replace( arg2, arg3 );
text += "'" + arg2 + "' replaced with '" + arg3 + "'.\r\n";
ch.SendText( text );
return;
}
if( !StringsNotEqual( arg1, ".h" ) )
{
ch.SendText( "Sedit help (commands on blank line):\r\n" );
ch.SendText( ".r 'old' 'new' Replace a subpublic string (requires '', \"\").\r\n" );
ch.SendText( ".h Get help (this info).\r\n" );
ch.SendText( ".s Show public string so far.\r\n" );
ch.SendText( ".c Clear public string so far.\r\n" );
ch.SendText( "@ End public string.\r\n" );
return;
}
ch.SendText( "StringAdd: Invalid dot command.\r\n" );
return;
}
if( argument[ 0 ] == '@' )
{
ch.Socket.EditingString = String.Empty;
return;
}
// Truncate strings to 4096.
if( buflen + arglen >= ( 4096 - 4 ) )
{
string buf1 = ch.Name;
ch.SendText( "The string was too long, the last line has been skipped.\r\n" );
buf1 += " is trying to write a description that's too long.";
Log.Trace( buf1 );
// Force character out of editing mode.
ch.Socket.EditingString = String.Empty;
return;
}
if( ch.IsImmortal() )
{
string message = String.Format( "\r\n&+gAdding {0} chars to {1} chars leaving {2} left.&n\r\n",
arglen, buflen, ( 4096 - 4 - buflen - arglen ) );
ch.SendText( message );
}
text += ch.Socket.EditingString + argument + "\r\n";
ch.Socket.EditingString = text;
return;
}
示例4: FoundPrey
/// <summary>
/// Tracking mob has found the person its after. Attack or react accordingly.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
public static void FoundPrey( CharData ch, CharData victim )
{
string victname = String.Empty;
string text = String.Empty;
string lbuf = String.Empty;
if (!victim)
{
Log.Error("FoundPrey: null victim", 0);
return;
}
if (!victim.InRoom)
{
Log.Error("FoundPrey: null victim._inRoom", 0);
return;
}
ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_HUNTING, 0, string.Format("{0}&n has found {1}.", ch.ShortDescription, victim.Name));
if (ch.IsAffected(Affect.AFFECT_TRACK))
{
ch.RemoveAffect(Affect.AFFECT_TRACK);
Combat.StopHunting(ch);
return;
}
if (ch.IsAffected(Affect.AFFECT_JUSTICE_TRACKER))
{
/* Give Justice the ability to ground flying culprits */
if (victim.FlightLevel != 0)
{
SocketConnection.Act("$n&n forces you to land!", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n forces $N&n to land!", ch, null, victim, SocketConnection.MessageTarget.room_vict);
victim.FlightLevel = 0;
}
SocketConnection.Act("$n&n says, 'Stop, $N&n, you're under ARREST!'", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n says, 'Stop, $N&n, you're under ARREST!'", ch, null, victim, SocketConnection.MessageTarget.room);
SocketConnection.Act("$n&n chains you up.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n binds $N&n so $E can't move.", ch, null, victim, SocketConnection.MessageTarget.room);
victim.SetAffectBit(Affect.AFFECT_BOUND);
victim.RemoveFromRoom();
if (ch.InRoom.Area.JailRoom != 0)
{
victim.AddToRoom(Room.GetRoom(victim.InRoom.Area.JailRoom));
}
else
{
victim.SendText("Justice is broken in this town - there is no jail and you're screwed.\r\n");
}
Combat.StopHunting(ch);
return;
}
victname = victim.IsNPC() ? victim.ShortDescription : victim.Name;
if (ch.FlightLevel != victim.FlightLevel)
{
if (ch.CanFly())
{
if (ch.FlightLevel < victim.FlightLevel && ch.FlightLevel < CharData.FlyLevel.high)
{
Command.Fly(ch, new string[] { "up" });
}
else
{
Command.Fly(ch, new string[] { "down" });
}
}
else
{
SocketConnection.Act("$n peers around looking for something.", ch, null, null, SocketConnection.MessageTarget.room);
}
return;
}
if (!CharData.CanSee(ch, victim))
{
if (MUDMath.NumberPercent() < 90)
return;
switch (MUDMath.NumberBits(5))
{
case 0:
text = String.Format("You can't hide forever, {0}!", victname);
Command.Say(ch, new string[]{text});
break;
case 1:
SocketConnection.Act("$n&n sniffs around the room.", ch, null, victim, SocketConnection.MessageTarget.room);
text = "I can smell your blood!";
Command.Say(ch, new string[]{text});
break;
case 2:
text = String.Format("I'm going to tear {0} apart!", victname);
Command.Yell(ch, new string[]{text});
break;
case 3:
//.........这里部分代码省略.........
示例5: SongSlowness
/// <summary>
/// Song of slowness.
/// </summary>
/// <param name="ch"></param>
/// <param name="spell"></param>
/// <param name="level"></param>
/// <param name="target"></param>
/// <returns></returns>
public static bool SongSlowness( CharData ch, Spell spell, int level, Target target )
{
Affect af = new Affect();
foreach( CharData victim in ch.InRoom.People )
{
if( Magic.SpellSavingThrow( level, victim, AttackType.DamageType.magic_other ) )
{
ch.SendText( "You failed!\r\n" );
continue;
}
// Removes haste, takes two castings to make a hasted person slowed
if (victim.IsAffected( Affect.AFFECT_HASTE))
{
victim.RemoveAffect(Affect.AFFECT_HASTE);
victim.SendText( "You slow to your normal speed.\r\n" );
continue;
}
if (victim.IsAffected(Affect.AFFECT_SLOWNESS))
continue;
af.Type = Affect.AffectType.song;
af.Value = spell.Name;
af.Duration = 6;
af.SetBitvector( Affect.AFFECT_SLOWNESS );
victim.AddAffect(af);
SocketConnection.Act( "&+R$n&+R moves much more slowly.&n", victim, null, null, SocketConnection.MessageTarget.room );
victim.SendText( "&+RYou feel yourself slowing down.&n\r\n" );
}
return true;
}
示例6: SongNightmares
/// <summary>
/// Song of nightmares.
/// </summary>
/// <param name="ch"></param>
/// <param name="spell"></param>
/// <param name="level"></param>
/// <param name="target"></param>
/// <returns></returns>
public static bool SongNightmares( CharData ch, Spell spell, int level, Target target )
{
Affect af = new Affect();
foreach( CharData victim in ch.InRoom.People )
{
if (victim.IsAffected(Affect.AFFECT_FEAR) || Magic.SpellSavingThrow(level, victim,
AttackType.DamageType.black_magic ) )
{
ch.SendText( "You have failed.\r\n" );
ch.SendText( "You resist the urge to panic.\r\n" );
continue;
}
af.Type = Affect.AffectType.song;
af.Value = spell.Name;
af.Duration = 1 + ( level / 7 );
af.SetBitvector( Affect.AFFECT_FEAR );
victim.AddAffect(af);
SocketConnection.Act( "$N&n is scared!", ch, null, victim, SocketConnection.MessageTarget.character );
victim.SendText( "You are scared!\r\n" );
SocketConnection.Act( "$N&n is scared!", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim );
CommandType.Interpret( victim, "flee" );
if( victim.IsNPC() )
Combat.StartFearing( victim, ch );
}
return true;
}
示例7: History
/// <summary>
/// Prints a player's command history.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void History(CharData ch, string[] str)
{
if (ch == null || ch.Socket == null)
{
return;
}
int num = 0;
foreach (HistoryData history in ch.Socket.CommandHistory)
{
++num;
string text = " " + MUDString.PadInt(Math.Abs(num), 4) + ": " + history.Command + "\r\n";
ch.SendText(text);
}
return;
}
示例8: GuildChat
/// <summary>
/// Say something on the guild chat channel.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void GuildChat(CharData ch, string[] str)
{
if( ch == null ) return;
CharData realChar = ch.GetChar();
if (realChar.IsNPC() || !realChar.IsGuild())
{
ch.SendText("You aren't a guildmember!\r\n");
return;
}
SocketConnection.SendToChannel(ch, String.Join(" ", str), TalkChannel.guild, "guild");
return;
}
示例9: GuildDonate
public static void GuildDonate(CharData ch, string[] str)
{
if( ch == null ) return;
Coins coin = new Coins();
int coinage;
bool success = false;
if (ch.IsNPC())
{
return;
}
Guild guild = ((PC)ch).GuildMembership;
if (guild == null)
{
ch.SendText("You're not in a guild!\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Deposit what?\r\n");
return;
}
if (!coin.FillFromString(str, ch))
{
ch.SendText("&+LSyntax: &+RSoc deposit &n&+r<&+L# of coins&n&+r> <&+Lcoin type&n&+r>&n\r\n");
return;
}
if (coin.Copper == 0 && coin.Silver == 0 && coin.Gold == 0 && coin.Platinum == 0)
{
ch.SendText("You have none of that type of &+Lcoin&n yet.\r\n");
return;
}
for (coinage = 0; coinage < 4; coinage++)
{
switch (coinage)
{
case 0: //copper
if (coin.Copper < 0)
{
ch.SendText("You can't deposit a debt!\r\n");
continue;
}
if (coin.Copper > ch.GetCopper())
{
ch.SendText("You don't have that much &+ycopper&n coin!\r\n");
continue;
}
if (coin.Copper == 0)
continue;
ch.SpendCopper(coin.Copper);
success = true;
break;
case 1: //silver
if (coin.Silver < 0)
{
ch.SendText("You can't deposit a debt!\r\n");
continue;
}
if (coin.Silver > ch.GetSilver())
{
ch.SendText("You don't have that much &+wsilver&n coin!\r\n");
continue;
}
if (coin.Silver == 0)
continue;
ch.SpendSilver(coin.Silver);
success = true;
break;
case 2: //gold
if (coin.Gold < 0)
{
ch.SendText("You can't deposit a debt!\r\n");
continue;
}
if (coin.Gold > ch.GetGold())
{
ch.SendText("You don't have that much &+Ygold&n coin!\r\n");
continue;
}
if (coin.Gold == 0)
continue;
ch.SpendGold(coin.Gold);
success = true;
break;
case 3: //platinum
if (coin.Platinum < 0)
{
ch.SendText("You can't deposit a debt!\r\n");
continue;
}
if (coin.Platinum > ch.GetPlatinum())
{
ch.SendText("You don't have that much &+Wplatinum&n coin!\r\n");
continue;
}
if (coin.Platinum == 0)
continue;
//.........这里部分代码省略.........
示例10: Bandage
/// <summary>
/// Bandage someone's wounds.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Bandage(CharData ch, string[] str)
{
if( ch == null ) return;
if (ch.IsNPC() || !ch.HasSkill("bandage"))
{
ch.SendText("You don't know how to bandage!\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Bandage whom?\r\n");
return;
}
CharData victim = ch.GetCharRoom(str[0]);
if (victim == null)
{
ch.SendText("They're not here.\r\n");
return;
}
if (victim.Hitpoints > 0)
{
ch.SendText("They do not need your help.\r\n");
return;
}
int chance = ((PC)ch).SkillAptitude["bandage"];
if (ch.IsClass(CharClass.Names.cleric))
chance += 4;
else if (ch.IsClass(CharClass.Names.antipaladin))
chance -= 4;
/* Don't allow someone doing more than 1 pt. of damage with bandage. */
int change = (Math.Max(chance - MUDMath.NumberPercent(), -1) / 20) + 1;
// Bandage is rarely used, make it likely to increase
ch.PracticeSkill("bandage");
ch.PracticeSkill("bandage");
ch.PracticeSkill("bandage");
ch.WaitState(Skill.SkillList["bandage"].Delay);
if (change < 0)
{
ch.SendText("You just made the problem worse!\r\n");
SocketConnection.Act("$n&n tries bandage you but your condition only worsens.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n tries bandage $N&n but $S condition only worsens.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
}
else if (change > 0)
{
ch.SendText("You manage to fix them up a _bitvector.\r\n");
SocketConnection.Act("$n&n bandages you.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n bandages $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
}
else
{
ch.SendText("Your bandaging attempt had no effect.\r\n");
SocketConnection.Act("$n&n tries to bandage you but the wounds are too great.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n tries to bandage $N&n but is unable to have any effect.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
}
victim.Hitpoints += change;
victim.UpdatePosition();
return;
}
示例11: Guard
/// <summary>
/// Guard someone - try to prevent them from becoming the target of attacks.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Guard(CharData ch, string[] str)
{
if( ch == null ) return;
CharData worldChar;
if (ch.IsNPC())
return;
if (!ch.HasSkill("guard"))
{
ch.SendText("Guard!? You can't even protect yourself!\r\n");
return;
}
if (str.Length == 0)
{
if (!((PC)ch).Guarding)
{
ch.SendText("Guard who?\r\n");
return;
}
if (!((PC)ch).Guarding)
{
string buf = "You are guarding " + (((PC)ch).Guarding.IsNPC() ?
((PC)ch).Guarding.ShortDescription : ((PC)ch).Guarding.Name) + ".\r\n";
ch.SendText(buf);
return;
}
}
if (!MUDString.StringsNotEqual(str[0], "who"))
{
if (!((PC)ch).Guarding)
{
ch.SendText("You are not guarding anyone.\r\n");
}
else
{
SocketConnection.Act("You are guarding $N&n.", ch, null, ((PC)ch).Guarding, SocketConnection.MessageTarget.character);
}
foreach (CharData it in Database.CharList)
{
worldChar = it;
if (worldChar.IsNPC())
{
continue;
}
if (((PC)worldChar).Guarding && ((PC)worldChar).Guarding == ch)
{
SocketConnection.Act("$N&n is guarding you.", ch, null, worldChar, SocketConnection.MessageTarget.character);
}
}
return;
}
CharData victim = ch.GetCharRoom(str[0]);
if (!victim)
{
ch.SendText("You don't see them here.\r\n");
return;
}
if (victim == ch)
{
ch.SendText("You no longer guard anyone.\r\n");
((PC)ch).Guarding = null;
return;
}
if (ch.IsClass(CharClass.Names.paladin) && victim.IsEvil())
{
ch.SendText("Their blackened soul is hardly worth the effort.\r\n");
return;
}
if (((PC)ch).Guarding)
{
SocketConnection.Act("$N&n stops guarding you.", ((PC)ch).Guarding, null, ch, SocketConnection.MessageTarget.character);
SocketConnection.Act("You stop guarding $N&n.", ch, null, ((PC)ch).Guarding, SocketConnection.MessageTarget.character);
}
((PC)ch).Guarding = victim;
SocketConnection.Act("You now guard $N&n.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n is now guarding you.", ch, null, victim, SocketConnection.MessageTarget.victim);
return;
}
示例12: GroupChat
/// <summary>
/// Say something to the members of your group.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void GroupChat(CharData ch, string[] str)
{
if( ch == null ) return;
// No arguments, no leader, no chance.
if (!ch.GroupLeader)
{
ch.SendText("Tell who, yourself? You are not in a group!\r\n");
return;
}
if (str.Length < 1)
{
ch.SendText("Tell your group what?\r\n");
return;
}
if (!ch.CanSpeak())
{
ch.SendText("Your lips move but no sound comes out.\r\n");
return;
}
String text = String.Join(" ", str, 1, (str.Length - 1));
text = DrunkSpeech.MakeDrunk(text, ch);
foreach (CharData groupChar in Database.CharList)
{
string buf;
if (groupChar == ch)
{
buf = String.Format("&+GYou tell the group '&n&+G{0}&+G'.&n\r\n", text);
ch.SendText(buf);
continue;
}
if (groupChar.IsSameGroup(ch)
&& !groupChar.InRoom.HasFlag(RoomTemplate.ROOM_SILENT)
&& !groupChar.HasInnate(Race.RACE_MUTE)
&& !groupChar.IsAffected(Affect.AFFECT_MUTE)
&& groupChar.IsAwake())
{
buf = String.Format("&+G{0}&n&+G tells the group '&n&+G{1}&+G'.&n\r\n",
ch.ShowNameTo(groupChar, true), SocketConnection.TranslateText(text, ch, groupChar));
groupChar.SendText(buf);
}
}
return;
}
示例13: Group
public static void Group(CharData ch, string[] str)
{
if( ch == null ) return;
// Group with no arguments should show group staus.
if (str.Length == 0)
{
ch.ShowGroup();
return;
}
if (!MUDString.IsPrefixOf(str[0], "all"))
{
int added = 0;
foreach (CharData ivictim in ch.InRoom.People)
{
if (ivictim == ch
|| ivictim.FlightLevel != ch.FlightLevel
|| ch.IsRacewar(ivictim))
continue;
if (((ivictim.IsNPC() && ivictim.HasActionBit(MobTemplate.ACT_PET))
|| (!ivictim.IsNPC() && ivictim.IsConsenting(ch)))
&& ivictim.Master == ch && !ivictim.GroupLeader)
{
ch.AddGroupMember(ivictim);
++added;
}
}
if (added < 1)
{
ch.SendText("No new group members.\r\n");
}
return;
}
CharData victim = ch.GetCharRoom(str[0]);
if (!victim)
{
ch.SendText("They aren't here.\r\n");
return;
}
if (ch == victim)
{
ch.RemoveFromGroup(victim);
return;
}
if (ch.IsRacewar(victim) && !victim.IsNPC())
{
ch.SendText("You can't group with such slime!\r\n");
return;
}
if (ch.IsSameGroup(victim))
{
if (ch.GroupLeader == ch)
{
ch.RemoveFromGroup(victim);
}
else
{
ch.SendText("Only the leader of a group may kick someone out.\r\n");
}
return;
}
if (ch.GroupLeader == null || ch.GroupLeader == ch)
{
string buf;
if (victim.GroupLeader == null)
{
if ((!victim.IsNPC() && !victim.IsConsenting(ch)) || (victim.IsNPC() && victim.Master != ch))
{
buf = String.Format("{0} doesn't want to be in your group.\r\n", victim.ShowNameTo(ch, true));
ch.SendText(buf);
}
else
{
ch.GroupLeader = ch;
ch.AddGroupMember(victim);
}
}
else
{
buf = String.Format("{0} is in another group.\r\n", victim.ShowNameTo(ch, true));
ch.SendText(buf);
}
}
else
{
ch.SendText("You must be the head of the group to add someone.\r\n");
}
return;
}
示例14: Goto
/// <summary>
/// Teleport to another location.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Goto(CharData ch, string[] str)
{
if( ch == null ) return;
CharData realChar = ch.GetChar();
if (!realChar.Authorized("goto") || !ch.IsImmortal())
{
return;
}
if (str.Length == 0)
{
ch.SendText("Goto where?\r\n");
return;
}
Room location = Room.FindLocation(ch, str[0]);
if (!location)
{
ch.SendText("No such location.\r\n");
return;
}
if (location.IsPrivate())
{
ch.SendText("That room is private right now.\r\n");
return;
}
if (ch.Fighting)
{
Combat.StopFighting(ch, true);
}
if (!ch.HasActionBit(PC.PLAYER_WIZINVIS))
{
if (!ch.IsNPC() && ((PC)ch).ImmortalData.DisappearMessage.Length > 0)
{
SocketConnection.Act("$T", ch, null, ((PC)ch).ImmortalData.DisappearMessage, SocketConnection.MessageTarget.room);
}
else
{
SocketConnection.Act("$n disappears in a puff of smoke.", ch, null, null, SocketConnection.MessageTarget.room);
}
}
ch.RemoveFromRoom();
ch.AddToRoom(location);
if (!ch.HasActionBit(PC.PLAYER_WIZINVIS))
{
if (!ch.IsNPC() && ((PC)ch).ImmortalData.AppearMessage.Length > 0)
{
SocketConnection.Act("$T", ch, null, ((PC)ch).ImmortalData.AppearMessage, SocketConnection.MessageTarget.room);
}
else
{
SocketConnection.Act("$n appears in a swirling mist", ch, null, null, SocketConnection.MessageTarget.room);
}
}
CommandType.Interpret(ch, "look auto");
return;
}
示例15: Hide
/// <summary>
/// Hide yourself or an object.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Hide(CharData ch, string[] str)
{
if( ch == null ) return;
/* Check player's skill */
if (!ch.HasSkill("hide"))
{
if(str.Length != 0)
{
HideItem(ch, new[] { str[0] });
return;
}
ch.SendText("You're far too obvious to hide anywhere.\r\n");
return;
}
if (ch.Riding)
{
ch.SendText("You can't do that while mounted.\r\n");
return;
}
if (ch.CurrentPosition <= Position.sleeping)
{
return;
}
ch.SendText("You attempt to hide.\r\n");
if (ch.IsAffected(Affect.AFFECT_HIDE))
{
ch.RemoveAffect(Affect.AFFECT_HIDE);
}
if (ch.CheckSkill("hide"))
{
ch.SetAffectBit(Affect.AFFECT_HIDE);
}
ch.WaitState(12);
return;
}