本文整理汇总了C#中MUDEngine.CharData.SetActionBit方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.SetActionBit方法的具体用法?C# CharData.SetActionBit怎么用?C# CharData.SetActionBit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.SetActionBit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: Toggle
//.........这里部分代码省略.........
else if (("brief".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_BRIEF;
else if (("casttick".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_CAST_TICK;
else if (("combine".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_COMBINE;
else if (("color".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
{
if (ch.Socket.Terminal == SocketConnection.TerminalType.TERMINAL_ENHANCED)
{
ch.SendText("You cannot turn color off when using the enhanced client.\r\n");
return;
}
bit = PC.PLAYER_COLOR;
}
else if (("colorcon".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_COLOR_CON;
else if (("msp".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_MSP;
else if (("pager".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_PAGER;
else if (("shout".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_SHOUT;
else if (("prompt".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_PROMPT;
else if (("telnetga".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_TELNET_GA;
else if (("tell".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_TELL;
else if (("vicious".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_VICIOUS;
else if (("map".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_MAP;
else if (("vicious".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_VICIOUS;
else if (("compact".StartsWith(word, StringComparison.CurrentCultureIgnoreCase)))
bit = PC.PLAYER_BLANK;
else if (word.Contains("wimpy"))
{
CommandType.Interpret(ch, "wimpy " + word.Substring((word.IndexOf("wimpy") + 5)));
return;
}
else if ("mccp".StartsWith(word, StringComparison.CurrentCultureIgnoreCase))
{
ch.Socket.MCCPEnabled = !ch.Socket.MCCPEnabled;
if (ch.Socket.MCCPEnabled)
{
ch.SendText("MCCP is now enabled.");
}
else
{
ch.SendText("MCCP is now disabled.");
}
return;
}
else
{
ch.SendText("&nConfig which option?\r\n");
return;
}
if (ch.IsClass(CharClass.Names.paladin) && bit == PC.PLAYER_VICIOUS)
{
ch.SendText("Paladins may not toggle vicious.\r\n");
/* Just to make sure they don't have it toggled on. */
ch.RemoveActionBit(bit);
return;
}
if (fSet == 1)
{
if (bit != PC.PLAYER_NONE)
{
ch.SetActionBit(bit);
}
ch.SendText( (String.Format("&n{0} is now ON.\r\n", word.ToUpper())));
}
else if (fSet == 0)
{
if (bit != PC.PLAYER_NONE)
{
ch.RemoveActionBit(bit);
}
ch.SendText((String.Format("&n{0} is now OFF.\r\n", word.ToUpper())));
}
else if (fSet == 2)
{
if (bit != PC.PLAYER_NONE)
{
ch.ToggleActionBit(bit);
}
if (ch.HasActionBit(bit))
ch.SendText((String.Format("&n{0} is now ON.\r\n", word.ToUpper())));
else
ch.SendText((String.Format("&n{0} is now OFF.\r\n", word.ToUpper())));
}
}
return;
}
示例3: ColorCommand
/// <summary>
/// Lets a player turn ANSI color on and off.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void ColorCommand(CharData ch, string[] str)
{
if( ch == null ) return;
if (!ch.HasActionBit(PC.PLAYER_COLOR))
{
ch.SetActionBit(PC.PLAYER_COLOR);
ch.SendText("&+LThe world becomes more &n&+mco&+Ml&+Wor&+Cf&n&+cul&+L.&n\r\n");
}
else
{
SocketConnection.SendToCharBW("The color drains.\r\n", ch);
ch.RemoveActionBit(PC.PLAYER_COLOR);
}
return;
}
示例4: Bot
/// <summary>
/// Used to flag a player as running or not running a bot.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Bot(CharData ch, string[] str)
{
if( ch == null ) return;
if (ch.IsNPC())
return;
if (ch.HasActionBit(PC.PLAYER_BOTTING))
{
ch.RemoveActionBit(PC.PLAYER_BOTTING);
ch.SendText("&nYou are no longer running a bot.\r\n");
SocketConnection.Act("$n&n's soul has returned to $s body.", ch, null, ch, SocketConnection.MessageTarget.room);
}
else
{
ch.SetActionBit(PC.PLAYER_BOTTING);
ch.SendText("&nYou are now running a bot.\r\n");
SocketConnection.Act("$n&n's soul has left $s body.", ch, null, ch, SocketConnection.MessageTarget.room);
}
return;
}
示例5: Camp
/// <summary>
/// The camp function now simply creates a camp event.
/// The Command.Quit function handles quitters and campers, based
/// on the camping bit. The only goofy side effect of this is
/// that an immortal who is camping can quit and get the
/// "you roll up in your bedroll" message.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Camp(CharData ch, string[] str)
{
if( ch == null ) return;
if (ch.IsNPC())
return;
if (ch.CurrentPosition == Position.fighting || ch.Fighting)
{
ch.SendText("You're not gifted enough to make camp and fight at the same time.\r\n");
ch.RemoveActionBit(PC.PLAYER_CAMPING);
return;
}
if (ch.FlightLevel != 0)
{
ch.SendText("Perhaps it would be more comfortable on the ground.\r\n");
return;
}
if (ch.HasActionBit(PC.PLAYER_CAMPING))
{
ch.SendText("Your preparations are not quite complete.\r\n");
return;
}
if (ch.CurrentPosition < Position.stunned)
{
ch.SendText("Just lie still and finish &+RBle&+reding&n!\r\n");
return;
}
SocketConnection.Act("$n&n starts to set up camp.", ch, null, null, SocketConnection.MessageTarget.room);
ch.SendText("You start to set up camp.\r\n");
ch.SetActionBit(PC.PLAYER_CAMPING);
// Pass the character, the room they started camping in, and the
// number of cycles to camp for
// Pulse camp is 5 seconds, so make them wait for 1.5 minutes
Event.CreateEvent(Event.EventType.camp, Event.TICK_CAMP, ch, ch.InRoom, 18);
return;
}
示例6: AFK
/// <summary>
/// Command to set yourself as being away from keyboard.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void AFK(CharData ch, string[] str)
{
if( ch == null ) return;
if (ch.IsNPC())
return;
if (ch.HasActionBit(PC.PLAYER_AFK))
{
ch.RemoveActionBit(PC.PLAYER_AFK);
ch.SendText("&nYou are back at your keyboard.\r\n");
SocketConnection.Act("$n&n has returned to $s keyboard.", ch, null, ch, SocketConnection.MessageTarget.room);
}
else
{
ch.SetActionBit(PC.PLAYER_AFK);
ch.SendText("&nYou are away from keyboard.\r\n");
SocketConnection.Act("$n&n has left $s keyboard.", ch, null, ch, SocketConnection.MessageTarget.room);
}
return;
}
示例7: Meditate
/// <summary>
/// Meditate command.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Meditate(CharData ch, string[] str)
{
if( ch == null ) return;
if (ch.IsNPC())
return;
if (!ch.HasSkill("meditate"))
{
ch.SendText("You don't know how to meditate.\r\n");
return;
}
if (ch.HasActionBit(PC.PLAYER_MEDITATING))
{
ch.RemoveActionBit(PC.PLAYER_MEDITATING);
ch.SendText("You stop meditating.\r\n");
}
if (ch.CurrentPosition != Position.resting)
{
ch.SendText("You must be resting in order to meditate.\r\n");
return;
}
if (ch.Fighting != null)
{
ch.SendText("Meditation during battle leads to permenant inner peace.\r\n");
return;
}
ch.SetActionBit(PC.PLAYER_MEDITATING);
ch.WaitState(Skill.SkillList["meditate"].Delay);
ch.PracticeSkill("meditate");
ch.SendText("You start meditating...\r\n");
return;
}
示例8: Invis
/// <summary>
/// Immortal invisibility command.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Invis(CharData ch, string[] str)
{
if( ch == null ) return;
if (ch.IsNPC())
return;
if (!ch.Authorized("wizinvis"))
return;
if (ch.HasActionBit(PC.PLAYER_WIZINVIS))
{
ch.RemoveActionBit(PC.PLAYER_WIZINVIS);
ch.SendText("You slowly fade back into existence.\r\n");
SocketConnection.Act("$n slowly fades into existence.", ch, null, null, SocketConnection.MessageTarget.room);
}
else
{
ch.SendText("You slowly vanish into thin air.\r\n");
SocketConnection.Act("$n slowly fades into thin air.", ch, null, null, SocketConnection.MessageTarget.room);
ch.SetActionBit(PC.PLAYER_WIZINVIS);
}
return;
}
示例9: KillingBlow
//.........这里部分代码省略.........
if( victim.Riding )
{
SocketConnection.Act( "$n&n topples from you, &+Ldead&n.", victim, null, victim.Riding, SocketConnection.MessageTarget.victim );
victim.Riding.Rider = null;
victim.Riding = null;
}
if (!victim.IsNPC() && victim.IsAffected(Affect.AFFECT_VAMP_BITE))
{
victim.SetPermRace( Race.RACE_VAMPIRE );
}
for (int i = (victim.Affected.Count - 1); i >= 0; i--)
{
/* Keep the ghoul affect */
if (!victim.IsNPC() && victim.IsAffected(Affect.AFFECT_WRAITHFORM))
{
continue;
}
victim.RemoveAffect(victim.Affected[i]);
}
if( victim.IsNPC() )
{
victim.MobileTemplate.NumberKilled++;
// This may invalidate the char list.
CharData.ExtractChar( victim, true );
return;
}
CharData.ExtractChar( victim, false );
//save corpses, don't wait til next save_corpse event
Database.CorpseList.Save();
// Character has died in combat, extract them to repop point and put
// them at the menu.
/*
* Pardon crimes once justice system is complete
*/
// This is where we send them to the menu.
victim.DieFollower( victim.Name );
if( victim.InRoom )
{
room = victim.InRoom;
}
else
{
List<RepopulationPoint> repoplist = victim.GetAvailableRepops();
if( repoplist.Count < 1 )
{
victim.SendText( "There is no RepopPoint entry for your race and class. Sending you to limbo.\r\n" );
room = Room.GetRoom( StaticRooms.GetRoomNumber("ROOM_NUMBER_START") );
}
else
{
// Drop them at the first repop point in the list. We may want to be fancier about this later, such as dropping them
// at the repop for class none if their particular class isn't found.
room = Room.GetRoom(repoplist[0].Room);
if( !room )
{
victim.SendText( "The repop point for your race/class does not exist. Please bug this. Sending you to limbo.\r\n" );
room = Room.GetRoom( StaticRooms.GetRoomNumber("ROOM_NUMBER_START") );
}
if( !victim.IsNPC() && Room.GetRoom( ( (PC)victim ).CurrentHome ) )
{
room = Room.GetRoom( ( (PC)victim ).CurrentHome );
}
}
}
victim.RemoveFromRoom();
if( room )
{
victim.InRoom = room;
}
// Put them in the correct body
if( victim.Socket && victim.Socket.Original )
{
CommandType.Interpret(victim, "return");
}
// Reset reply pointers - handled by CharData.ExtractChar.
CharData.SavePlayer( victim );
// Remove from char list: handled by CharData.ExtractChar.
victim.Socket.ShowScreen(ModernMUD.Screen.MainMenuScreen);
if( victim.Socket != null )
{
victim.Socket.ConnectionStatus = SocketConnection.ConnectionState.menu;
}
// Just died flag used for safe time after re-login.
victim.SetActionBit( PC.PLAYER_JUST_DIED );
return;
}
示例10: Memorize
/// <summary>
/// This is called by Command.Memorize and Commandpray. This was originally
/// attached to each function, but it's silly to have two large blocks
/// of the same code
/// </summary>
/// <param name="ch"></param>
/// <param name="argument"></param>
/// <param name="pray"></param>
public static void Memorize( CharData ch, string argument, bool pray )
{
string text;
Dictionary<String, Int32> memmed = new Dictionary<String, Int32>();
int[] circle = new int[ Limits.MAX_CIRCLE ];
int[] circfree = new int[ Limits.MAX_CIRCLE ];
// with an argument they want to start memorizing a new spell.
if( !String.IsNullOrEmpty(argument) )
{
// Must be in the proper position
if( ch.CurrentPosition != Position.resting )
{
if( pray )
ch.SendText( "You can only pray for spells while resting.\r\n" );
else
ch.SendText( "You can memorize spells only when resting.\r\n" );
return;
}
// Find the spell they want
Spell spell = StringLookup.SpellLookup( argument );
if( spell == null )
{
ch.SendText( "Never heard of that spell...\r\n" );
return;
}
// Check to see that they can memorize another spell
// Immortals have no limits
if( !ch.IsImmortal() )
{
if( ( (PC)ch ).Hunger <= 0 || ( (PC)ch ).Thirst <= 0 )
{
ch.SendText( "You can't seem to concentrate on anything but your appetite.\r\n" );
}
if( !ch.HasSpell( argument ) )
{
ch.SendText( "That spell is beyond you.\r\n" );
return;
}
if (!pray && ((PC)ch).SpellAptitude[spell.Name] < 1)
{
ch.SendText( "You have not yet learned that spell. Find a place to scribe it.\r\n" );
return;
}
int lvltotal = 0;
foreach( MemorizeData mem in ((PC)ch).Memorized )
{
if (mem.Circle == spell.SpellCircle[(int)ch.CharacterClass.ClassNumber])
lvltotal += 1;
}
int numMemmable = 0;
if (ch.CharacterClass.MemType == CharClass.MemorizationType.Lesser)
{
numMemmable = LesserMemchart[(ch.Level - 1), (spell.SpellCircle[(int)ch.CharacterClass.ClassNumber] - 1)];
}
else
{
numMemmable = Memchart[(ch.Level - 1), (spell.SpellCircle[(int)ch.CharacterClass.ClassNumber] - 1)];
}
if (lvltotal >= numMemmable )
{
if( pray )
ch.SendText( "You can pray for no more spells of that level.\r\n" );
else
ch.SendText( "You can memorize no more spells of that circle.\r\n" );
return;
}
}
// If we know what they want and they can have it, let's create it.
MemorizeData memm = CreateMemorizeData( ch, spell );
if( !memm )
{
Log.Error( "Unable to create memorization (spell {0})", spell );
return;
}
// If they're not already memorizing, they are now.
ch.SetActionBit(PC.PLAYER_MEMORIZING );
if( pray )
text = String.Format( "You start praying for {0} which will take about {1} seconds.\r\n",
spell.Name, ( memm.Memtime / Event.TICK_PER_SECOND ) );
else
text = String.Format( "You start memorizing {0} which will take about {1} seconds.\r\n",
spell.Name, ( memm.Memtime / Event.TICK_PER_SECOND ) );
ch.SendText( text );
//.........这里部分代码省略.........