本文整理汇总了C#中MUDEngine.CharData.GetRacewarSide方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.GetRacewarSide方法的具体用法?C# CharData.GetRacewarSide怎么用?C# CharData.GetRacewarSide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.GetRacewarSide方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckForFrag
/// <summary>
/// Code to check if someone just fragged.
/// Will also have to add to race, class, and guild frag tables in
/// addition to the master frag table. This does not update any
/// lists yet and instead only updates the totals.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
public static void CheckForFrag( CharData ch, CharData victim )
{
// NPC's don't participate in fragging, can't frag yourself,
// have to be within 10 levels, no same side frags, no frags
// from races not participating in racewars, have to be level
// 20 to frag, and have to be a valid class.
// Check to see if kill qualifies for a frag.
if( ch.IsNPC() )
return;
if( victim.IsNPC() )
return;
if( ch == victim )
return;
if( ch.GetRacewarSide() == Race.RacewarSide.neutral )
return;
if( !ch.IsRacewar( victim ) )
return;
if( ch.IsImmortal() )
return;
if( victim.IsImmortal() )
return;
if( victim.Level < 20 )
return;
if( ch.Level < 20 )
return;
if( ( ch.Level - 10 ) > victim.Level )
return;
if (ch.IsClass(CharClass.Names.none) || victim.IsClass(CharClass.Names.none))
return;
if( victim.GetOrigRace() > Limits.MAX_PC_RACE )
return;
// Give frag to ch.
( (PC)ch ).Frags++;
// Protect against polymorphed character race frags.
if( ch.GetOrigRace() < Limits.MAX_PC_RACE )
{
_fraglist._totalFragsByRaceAndClass[ch.GetOrigRace()][ (int)ch.CharacterClass.ClassNumber]++;
_fraglist._totalFragsBySide[ (int)ch.GetRacewarSide() ]++;
}
if( ( (PC)ch ).GuildMembership != null )
( (PC)ch ).GuildMembership.Frags++;
// Take frag from victim.
( (PC)victim ).Frags--;
// Protect against polymorphed character race frags
if( victim.GetOrigRace() < Limits.MAX_PC_RACE )
{
_fraglist._totalFragsByRaceAndClass[victim.GetOrigRace()][ (int)victim.CharacterClass.ClassNumber]--;
_fraglist._totalFragsBySide[ (int)victim.GetRacewarSide() ]--;
}
if (((PC)victim).GuildMembership != null)
{
((PC)victim).GuildMembership.Frags--;
}
ch.SendText( "&+WYou gain a frag!&n\r\n" );
victim.SendText( "&+WYou lose a frag!&n\r\n" );
string text = ch.Name + " has fragged " + victim.Name + " in room " + ch.InRoom.IndexNumber + ".";
ImmortalChat.SendImmortalChat( ch, ImmortalChat.IMMTALK_DEATHS, Limits.LEVEL_AVATAR, text );
Log.Trace( text );
// Check to see if either person goes up or down on their particular lists.
if( ( (PC)ch ).Frags > 0 )
{
SortFraglist( ch, _fraglist._topFrags );
SortFraglist( ch, _fraglist._topRaceFrags[ ch.GetOrigRace() ] );
SortFraglist(ch, _fraglist._topClassFrags[(int)ch.CharacterClass.ClassNumber]);
}
else if( ( (PC)ch ).Frags < 0 )
{
SortFraglist( ch, _fraglist._bottomFrags );
SortFraglist( ch, _fraglist._bottomRaceFrags[ ch.GetOrigRace() ] );
SortFraglist(ch, _fraglist._bottomClassFrags[(int)ch.CharacterClass.ClassNumber]);
}
if( ( (PC)victim ).Frags > 0 )
{
SortFraglist( victim, _fraglist._topFrags );
SortFraglist( victim, _fraglist._topRaceFrags[ victim.GetOrigRace() ] );
SortFraglist(victim, _fraglist._topClassFrags[(int)victim.CharacterClass.ClassNumber]);
}
else if( ( (PC)victim ).Frags < 0 )
{
SortFraglist( victim, _fraglist._bottomFrags );
//.........这里部分代码省略.........
示例2: Who
/// <summary>
/// Displays the "who list" based on provided paramters.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Who(CharData ch, string[] str)
{
if( ch == null ) return;
if (ch.Fighting || (ch.CurrentPosition == Position.fighting))
{
ch.SendText("&nEnd the fight first!\r\n");
return;
}
// Set racewar side to check
Race.RacewarSide rws; // for RaceWarSide wholist
if (ch.IsImmortal())
{
rws = Race.RacewarSide.neutral;
}
else
{
rws = ch.GetRacewarSide();
}
// Initialize races and classes to false.
bool[] rgfClass = new bool[CharClass.ClassList.Length];
bool[] rgfRace = new bool[Limits.MAX_PC_RACE];
int iClass;
int iRace;
for (iClass = 0; iClass < CharClass.ClassList.Length; ++iClass)
{
rgfClass[iClass] = false;
}
for (iRace = 0; iRace < Limits.MAX_PC_RACE; ++iRace)
{
rgfRace[iRace] = false;
}
// Handle command arguments.
int iLevelLower = 0;
int iLevelUpper = Limits.MAX_LEVEL;
int numbers = 0;
bool immortalOnly = false;
bool sorted = false; /* for sorted list */
bool fClassRestrict = false;
bool fRaceRestrict = false;
string name = String.Empty;
for (int i = 0; i < str.Length; i++ )
{
// Level numbers.
if (MUDString.IsNumber(str[i]))
{
switch (++numbers)
{
case 1:
Int32.TryParse(str[i], out iLevelLower);
break;
case 2:
Int32.TryParse(str[i], out iLevelUpper);
break;
default:
ch.SendText("&nOnly two level numbers allowed.\r\n");
return;
}
}
else
{
// Look for classes to turn on.
if (!MUDString.IsPrefixOf(str[i], "immortals"))
{
immortalOnly = true;
}
else if (!MUDString.IsPrefixOf(str[i], "sort"))
{
sorted = true;
}
else if (ch.IsImmortal() && !MUDString.IsPrefixOf(str[i], "good"))
{
rws = Race.RacewarSide.good;
}
else if (ch.IsImmortal() && !MUDString.IsPrefixOf(str[i], "evil"))
{
rws = Race.RacewarSide.evil;
}
else
{
int iClass2;
for (iClass2 = 0; iClass2 < CharClass.ClassList.Length; ++iClass2)
{
if (!MUDString.IsPrefixOf(str[i], CharClass.ClassList[iClass2].Name))
{
rgfClass[iClass2] = true;
fClassRestrict = true;
break;
}
}
//.........这里部分代码省略.........
示例3: IsSafe
/// <summary>
/// Check to see if the char is able to attack the victim, and if not, give a message saying why they can't.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
/// <returns></returns>
public static bool IsSafe( CharData ch, CharData victim )
{
if (ch == null || victim == null) return false;
// Always safe to attack yourself.
if (ch == victim) return false;
if (!ch.IsNPC() && !victim.IsNPC() && victim.GetRacewarSide() == ch.GetRacewarSide() && !ch.IsImmortal())
{
SocketConnection.Act("You can't attack an ally.\r\n", ch, null, victim, SocketConnection.MessageTarget.character);
return true;
}
if( !ch.IsNPC() && ch.IsAffected( Affect.AFFECT_WRAITHFORM ) )
{
ch.SendText( "&+LYou may not participate in combat while in &+Cgh&n&+co&+Cu&n&+cl&+L form.&n\r\n" );
return true;
}
if( !victim.IsNPC() && victim.HasActionBit(PC.PLAYER_JUST_DIED ) )
{
ch.SendText( "&+cThey just died, try in a few seconds...&n\r\n" );
return true;
}
if (!victim.IsNPC() && victim.IsAffected(Affect.AFFECT_WRAITHFORM))
{
SocketConnection.Act( "Your attack passes through $N.", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "$n's attack passes through $N.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
SocketConnection.Act( "$n's attack passes through you.", ch, null, victim, SocketConnection.MessageTarget.victim );
return true;
}
// removed restriction allowing only registered players to pkill
if( victim.Level > Limits.LEVEL_HERO && victim != ch && !victim.IsNPC() )
{
SocketConnection.Act( "$N&n is an IMMORTAL and is automatically safe.", ch, null, victim, SocketConnection.MessageTarget.character );
return true;
}
if( victim.Fighting )
return false;
if( victim.InRoom.HasFlag( RoomTemplate.ROOM_SAFE ) )
{
SocketConnection.Act( "$N&n is in a safe room.", ch, null, victim, SocketConnection.MessageTarget.character );
return true;
}
if( IsBossMob( victim ) )
{
//keep fighting, but allow the boss to invoke his special function
// ensures the function will be called
string lbuf = String.Format( "{0} is a boss", victim.ShortDescription );
Log.Trace( lbuf );
victim.Fighting = ch;
if( victim.SpecialFunction.Count > 0 )
{
foreach( MobSpecial spec in victim.SpecialFunction )
{
if( spec.SpecFunction( victim, MobFun.PROC_NORMAL ) )
{
// Only execute one function.
break;
}
}
}
return false;
}
if( ch.IsNPC() || victim.IsNPC() )
return false;
return false;
}
示例4: CheckInvader
/// <summary>
/// Check whether the being entering the area is an enemy and needs to be dealt with.
/// </summary>
/// <param name="ch"></param>
public static void CheckInvader( CharData ch )
{
string lbuf;
if (ch == null || ch.IsNPC() || ch.IsImmortal())
return;
if( ch.InRoom == null || ch.InRoom.Area == null ||
ch.InRoom.Area.JusticeType == 0 )
return;
switch( ch.GetRacewarSide() )
{
case Race.RacewarSide.good:
if( ch.InRoom.Area.JusticeType == JusticeType.chaotic_evil
|| ch.InRoom.Area.JusticeType == JusticeType.chaotic_evil_only
|| ch.InRoom.Area.JusticeType == JusticeType.chaotic_neutral_only
|| ch.InRoom.Area.JusticeType == JusticeType.evil_only
|| ch.InRoom.Area.JusticeType == JusticeType.neutral_only
|| ch.InRoom.Area.JusticeType == JusticeType.evil )
{
lbuf = String.Format( "Check_invader: {0} invading !good justice", ch.Name );
ImmortalChat.SendImmortalChat( null, ImmortalChat.IMMTALK_SPAM, 0, lbuf );
StartInvasion( ch );
}
return;
case Race.RacewarSide.evil:
if( ch.InRoom.Area.JusticeType == JusticeType.chaotic_good
|| ch.InRoom.Area.JusticeType == JusticeType.chaotic_good_only
|| ch.InRoom.Area.JusticeType == JusticeType.chaotic_neutral_only
|| ch.InRoom.Area.JusticeType == JusticeType.good_only
|| ch.InRoom.Area.JusticeType == JusticeType.neutral_only
|| ch.InRoom.Area.JusticeType == JusticeType.good )
{
lbuf = String.Format( "Check_invader: {0} invading !evil justice", ch.Name );
ImmortalChat.SendImmortalChat( null, ImmortalChat.IMMTALK_SPAM, 0, lbuf );
StartInvasion( ch );
}
return;
case Race.RacewarSide.neutral:
if( ch.InRoom.Area.JusticeType == JusticeType.chaotic_good_only
|| ch.InRoom.Area.JusticeType == JusticeType.chaotic_evil_only
|| ch.InRoom.Area.JusticeType == JusticeType.evil_only
|| ch.InRoom.Area.JusticeType == JusticeType.good_only)
{
lbuf = String.Format( "Check_invader: {0} invading !neutral justice", ch.Name );
ImmortalChat.SendImmortalChat( null, ImmortalChat.IMMTALK_SPAM, 0, lbuf );
StartInvasion( ch );
}
return;
}
return;
}
示例5: IsAggressive
/// <summary>
/// Checks whether the caller is aggressive toward the victim.
/// </summary>
/// <param name="victim"></param>
/// <returns></returns>
public bool IsAggressive(CharData victim)
{
CharData ch = this;
Guild guild = null;
if (victim == null)
{
Log.Error("IsAggressive: called with null ch or victim.", 0);
return false;
}
if (ch == victim)
{
return false;
}
if (MUDString.NameContainedIn("_guildgolem_", ch.Name))
{
foreach (Guild it in Database.GuildList)
{
guild = it;
if (guild.ID == Guild.GolemGuildID(ch))
break;
}
if (guild != null && guild.Ostracized.Length != 0)
{
if (MUDString.NameContainedIn(victim.Name, guild.Ostracized))
return true;
}
}
if (MUDString.NameContainedIn(Race.RaceList[victim.GetRace()].Name, Race.RaceList[ch.GetOrigRace()].Hate))
{
Log.Trace("Returning true for IsAggressive due to race hatred.");
return true;
}
if (ch.HasActionBit(MobTemplate.ACT_AGGROGOOD) && victim.IsGood())
{
Log.Trace("Returning true for IsAggressive due to aggro good and good victim.");
return true;
}
if (ch.HasActionBit(MobTemplate.ACT_AGGROEVIL) && victim.IsEvil())
{
Log.Trace("Returning true for IsAggressive due to aggro evil and evil victim.");
return true;
}
if (ch.HasActionBit(MobTemplate.ACT_AGGRONEUT) && victim.IsNeutral())
{
Log.Trace("Returning true for IsAggressive due to aggro neutral and neutral victim.");
return true;
}
if (ch.HasActionBit(MobTemplate.ACT_AGGROEVILRACE) && victim.GetRacewarSide() == Race.RacewarSide.evil)
{
Log.Trace("Returning true for IsAggressive due to aggro evil race and victim evil racewar.");
return true;
}
if (ch.HasActionBit(MobTemplate.ACT_AGGROGOODRACE) && victim.GetRacewarSide() == Race.RacewarSide.good)
{
Log.Trace("Returning true for IsAggressive due to aggro good race and victim good racewar.");
return true;
}
if (ch.HasActionBit(MobTemplate.ACT_AGGRESSIVE))
{
Log.Trace("Returning true for IsAggressive due to aggressive flag on ch.");
return true;
}
return ch.IsHating(victim);
}
示例6: IsWearableBy
//.........这里部分代码省略.........
if (HasAntiFlag( ObjTemplate.USE_NODROW))
{
SocketConnection.Act("The design of $p&n is too inferior for use by a &n&+mdrow&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_TROLL:
if (HasAntiFlag( ObjTemplate.USE_NOTROLL))
{
SocketConnection.Act("You try to use $p&n, but become quickly frustrated.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_OGRE:
if (HasAntiFlag( ObjTemplate.USE_NOOGRE))
{
SocketConnection.Act("You can't quite figure out how to use $p&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_ORC:
if (HasAntiFlag( ObjTemplate.USE_NOORC))
{
SocketConnection.Act("Obviously, $p&n was not crafted for an &+Lorc&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_CENTAUR:
if (HasAntiFlag( ObjTemplate.USE_NOCENTAUR))
{
SocketConnection.Act("Your find $p&n's design unsuitable for a &n&+gcen&+Ltaur&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_GITHYANKI:
if (HasAntiFlag( ObjTemplate.USE_NOGITHYANKI))
{
SocketConnection.Act("You find $p&n to be unfitting for a &+Wgith&+Gyanki&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_GITHZERAI:
if (HasAntiFlag( ObjTemplate.USE_NOGITHZERAI))
{
SocketConnection.Act("Your nature prevents you from using $p&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_MINOTAUR:
if (HasAntiFlag( ObjTemplate.USE_NOMINOTAUR))
{
SocketConnection.Act("Your distinctive build prevents your use of $p&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_GOBLIN:
if (HasAntiFlag( ObjTemplate.USE_NOGOBLIN))
{
SocketConnection.Act("Your stature and build make it impossible for you to use $p&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_RAKSHASA:
if (HasAntiFlag( ObjTemplate.USE_NORAKSHASA))
{
SocketConnection.Act("Your feline structure inhibits you from using $p&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RACE_GNOLL:
if (HasAntiFlag( ObjTemplate.USE_NOGNOLL))
{
SocketConnection.Act("Your canine features hinder the use of $p&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
}
switch (ch.GetRacewarSide())
{
case Race.RacewarSide.good:
if (HasAntiFlag( ObjTemplate.USE_ANTIGOODRACE))
{
SocketConnection.Act("Your &n&+cs&+Co&n&+cu&+Cl&n is too &+Wpure&n to use $p&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
case Race.RacewarSide.evil:
if (HasAntiFlag( ObjTemplate.USE_ANTIEVILRACE))
{
SocketConnection.Act("Your &+Lblack &n&+rhe&+Ra&n&+rr&+Rt&n prevents use of $p&n.", ch, this, null, SocketConnection.MessageTarget.character);
return false;
}
break;
default:
break;
}
return true;
}
示例7: FormatObjectToCharacter
/// <summary>
/// Formats an object for display to a character.
/// </summary>
/// <param name="obj"></param>
/// <param name="ch"></param>
/// <param name="shortDisplay"></param>
/// <returns></returns>
public static string FormatObjectToCharacter(Object obj, CharData ch, bool shortDisplay)
{
string text = String.Empty;
if (obj == null || ch == null)
{
Log.Error("format_obj_to_char: null ch or obj.", 0);
return null;
}
if (shortDisplay)
{
if (obj.ShortDescription.Length > 0)
{
text += obj.ShortDescription;
}
text += " ";
}
if (obj.HasFlag(ObjTemplate.ITEM_NOSHOW) && ch.IsImmortal())
{
text += "&n(&+LNoshow&n) ";
}
else if (obj.HasFlag(ObjTemplate.ITEM_NOSHOW))
{
return text;
}
if (obj.HasFlag(ObjTemplate.ITEM_INVIS))
{
text += "&n(&+LInvis&n) ";
}
if ((ch.IsAffected( Affect.AFFECT_DETECT_EVIL) || ch.HasInnate(Race.RACE_DETECT_ALIGN)
|| ch.IsClass(CharClass.Names.antipaladin) || ch.IsClass(CharClass.Names.paladin))
&& obj.HasFlag(ObjTemplate.ITEM_EVIL))
{
text += "&n(&+LDark Aura&n) ";
}
if ((ch.IsAffected(Affect.AFFECT_DETECT_GOOD) || ch.HasInnate(Race.RACE_DETECT_ALIGN)
|| ch.IsClass(CharClass.Names.antipaladin) || ch.IsClass(CharClass.Names.paladin))
&& obj.HasFlag(ObjTemplate.ITEM_BLESS))
{
text += "&n(&+WLight Aura&n) ";
}
if (obj.HasFlag(ObjTemplate.ITEM_MAGIC) && (ch.IsAffected(Affect.AFFECT_DETECT_MAGIC) ||
(!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_GODMODE))))
{
text += "&n(&+BMagic&n) ";
}
if (obj.HasFlag(ObjTemplate.ITEM_GLOW))
{
text += "&n(&+CGlowing&n) ";
}
if (obj.HasFlag(ObjTemplate.ITEM_LIT))
{
text += "&n(&+WIlluminating&n) ";
}
if (obj.HasFlag(ObjTemplate.ITEM_SECRET) && (ch.IsAffected(Affect.AFFECT_DETECT_HIDDEN) ||
(!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_GODMODE))))
{
text += "&n(&+yHidden&n) ";
}
if (!shortDisplay)
{
if (obj.ItemType == ObjTemplate.ObjectType.pc_corpse && (ch.IsImmortal() || (int)ch.GetRacewarSide() == obj.Values[4]))
{
text += "The " + obj.ShortDescription + " is lying here.";
}
else if (obj.FullDescription.Length > 0)
{
text += obj.FullDescription;
}
}
text += "&n";
return text;
}