本文整理汇总了C#中MUDEngine.CharData.GetOrigRace方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.GetOrigRace方法的具体用法?C# CharData.GetOrigRace怎么用?C# CharData.GetOrigRace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.GetOrigRace方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Speak
/// <summary>
/// By Xangis. Currently only lists known languages
/// Can change current language too.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Speak(CharData ch, string[] str)
{
if( ch == null ) return;
string arg1 = String.Empty;
if (ch.IsNPC())
return;
if (String.IsNullOrEmpty(arg1))
{
int count;
string text;
for (count = 0; count < Race.MAX_LANG; ++count)
{
if (count == (int)Race.Language.unknown)
continue;
if (((PC)ch).LanguageAptitude[count] > 20)
{
if (((PC)ch).LanguageAptitude[count] < 40)
text = String.Format("You have a basic understanding of {0}.\r\n",
Race.LanguageTable[count]);
else if (((PC)ch).LanguageAptitude[count] < 60)
text = String.Format("You comprehend {0}.\r\n",
Race.LanguageTable[count]);
else if (((PC)ch).LanguageAptitude[count] < 90)
text = String.Format("You are quite fluent in {0}.\r\n",
Race.LanguageTable[count]);
else
text = String.Format("You are a master of {0}.\r\n",
Race.LanguageTable[count]);
ch.SendText(text);
}
}
if (((PC)ch).Speaking == Race.Language.unknown)
((PC)ch).Speaking = Race.RaceList[ch.GetOrigRace()].PrimaryLanguage;
text = String.Format("Currently speaking ");
text += Race.LanguageTable[(int)((PC)ch).Speaking];
text += ".\r\n";
ch.SendText(text);
}
else
{
Race.Language lang = StringLookup.LanguageLookup(ch, arg1);
if (ch.CanSpeakLanguage(lang))
{
string buf7 = String.Format("You begin speaking {0}.\r\n", Race.LanguageTable[(int)lang]);
((PC)ch).Speaking = lang;
ch.SendText(buf7);
}
else
{
ch.SendText("You don't know that language!\r\n");
}
}
}
示例2: Tell
/// <summary>
/// Direct telepathy-like communication with another individual.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Tell(CharData ch, string[] str)
{
if( ch == null ) return;
if (!ch.CanSpeak())
{
ch.SendText("Your lips move but no sound comes out.\r\n");
return;
}
if (str.Length < 2)
{
ch.SendText("Tell what to who?\r\n");
return;
}
/*
* PCs can receive a tell anywhere, but NPCs only can only hear them in the same room.
*
* get PC target first, if fails then get NPC
*/
CharData victim = ch.GetCharWorld(str[0]);
if (!victim || (victim.IsNPC() && victim.InRoom != ch.InRoom))
{
ch.SendText("They aren't here.\r\n");
return;
}
if (victim == ch)
{
ch.SendText("You listen to your own thoughts. *cricket* *cricket*\r\n");
return;
}
if ((ch.IsRacewar(victim)) && (!ch.IsImmortal() && !victim.IsImmortal())
&& (ch.InRoom != victim.InRoom))
{
ch.SendText("They aren't here.\r\n");
return;
}
/* Can tell to other side of racewar iff the opponent is in the same
room or one of the people are Immortals. */
if ((!ch.IsImmortal() && !victim.IsImmortal()) && (ch.IsRacewar(victim))
&& (victim.InRoom != ch.InRoom))
{
ch.SendText("They aren't here.\r\n");
return;
}
if ((!ch.IsNPC() && (ch.HasActionBit(PC.PLAYER_SILENCE) || !ch.HasActionBit(PC.PLAYER_TELL)
|| (!victim.IsNPC() && !victim.HasActionBit(PC.PLAYER_TELL))))
|| victim.InRoom.HasFlag(RoomTemplate.ROOM_SILENT))
{
ch.SendText("They can't hear you.\r\n");
return;
}
if (!victim.Socket && !victim.IsNPC())
{
SocketConnection.Act("$N&n is &+Llinkdead&n.", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
if (!ch.IsImmortal() && !victim.IsAwake())
{
SocketConnection.Act("$E isn't paying attention.", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
if (victim.IsIgnoring(ch))
{
SocketConnection.Act("$E is ignoring you.", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
string text = String.Join(" ", str, 1, (str.Length - 1));
text = DrunkSpeech.MakeDrunk(text, ch);
int position = victim.CurrentPosition;
victim.CurrentPosition = Position.standing;
Race.Language lang = ch.IsNPC() ? Race.RaceList[ch.GetOrigRace()].PrimaryLanguage :
((PC)ch).Speaking;
if (lang == Race.Language.god || lang == Race.Language.unknown)
{
text = String.Format("&+WYou tell $N&+W '$t&+W'&n");
}
else
{
text = String.Format("&+WYou tell $N&+W in {0} '$t&+W'&n", Race.LanguageTable[(int)lang]);
}
SocketConnection.Act(text, ch, text, victim, SocketConnection.MessageTarget.character);
if (lang == Race.Language.god || lang == Race.Language.unknown)
//.........这里部分代码省略.........
示例3: 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 );
//.........这里部分代码省略.........
示例4: Say
/// <summary>
/// Say something out loud.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Say(CharData ch, string[] str)
{
if( ch == null ) return;
if (str.Length == 0)
{
ch.SendText("Say 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);
text = DrunkSpeech.MakeDrunk(text, ch);
if (ch.InRoom != null)
{
foreach (CharData roomChar in ch.InRoom.People)
{
if (roomChar == ch || roomChar.IsNPC())
continue;
string output;
if (ch.IsNPC() || (!ch.IsNPC() && (((PC)ch).Speaking == Race.Language.god ||
((PC)ch).Speaking == Race.Language.unknown)))
{
output = String.Format("{0} says '&n$T&n'", ch.ShowNameTo(roomChar, true));
}
else
{
output = String.Format("{0} says in {1} '&n$T&n'", ch.ShowNameTo(roomChar, true),
ch.IsNPC() ? Race.LanguageTable[(int)Race.RaceList[ch.GetOrigRace()].PrimaryLanguage]
: Race.LanguageTable[(int)((PC)ch).Speaking]);
}
// Add foreign language filter.
SocketConnection.Act(output, roomChar, null, SocketConnection.TranslateText(text, ch, roomChar), SocketConnection.MessageTarget.character);
// Chatterbot code. May want to restrict chatterbots to tells, asks, and whispers.
if (roomChar.ChatBot != null)
{
roomChar.ChatBot.CheckConversation(roomChar, ch, text);
}
}
}
// MOBtrigger = false;
SocketConnection.Act("You say '&n$T&n'", ch, null, text, SocketConnection.MessageTarget.character);
// prog_speech_trigger( argument, ch );
ch.DoorTrigger(text);
return;
}
示例5: ComputeExperience
//.........这里部分代码省略.........
if( killer.Alignment <= -1000 )
killer.SendText( "&+RThe d&+rarkside t&+lakes over...&n\r\n" );
}
killer.Alignment = Macros.Range( -1000, killer.Alignment, 1000 );
// 25% bonus for sanctuary
if (victim.IsAffected(Affect.AFFECT_SANCTUARY))
{
percent = ( percent * 5 ) / 4;
}
// 10% bonus for fireshield
if( victim.IsAffected( Affect.AFFECT_FIRESHIELD ) )
{
percent = ( percent * 11 ) / 10;
}
// 12.5% bonus for an armed opponent
Object obj = Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_one );
if( obj )
{
percent = ( percent * 9 ) / 8;
}
// 8.25% bonus for secondary weapon
obj = Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_two );
if( obj )
{
percent = ( percent * 13 ) / 12;
}
// 10% bonus for racially hated mobs
if( MUDString.NameContainedIn( Race.RaceList[ victim.GetRace() ].Name, Race.RaceList[ killer.GetOrigRace() ].Hate ) )
{
percent = ( percent * 11 ) / 10;
}
// 10% penalty for killing same race
if( victim.GetRace() == killer.GetOrigRace() )
{
percent = ( percent * 9 ) / 10;
}
// Lowbie experience bonus was eliminated since the ExperienceTable.Table
// made it no longer necessary
if( victim.IsNPC() )
{
// 5% bonus for aggros
if( victim.HasActionBit(MobTemplate.ACT_AGGRESSIVE ) )
{
percent = ( percent * 21 ) / 20;
}
// 50% penalty for killing shopkeepers
if( victim.MobileTemplate.ShopData != null )
percent = percent / 2;
// No bonus for special function #1 because they get that by having a class.
// 10% bonus for each extra special function.
int count = victim.SpecialFunction.Count;
percent = ( percent * ( 10 + count ) ) / 10;
}
else
{
示例6: TranslateText
/// <summary>
/// Mangles text based on languages used by speaker and listener.
/// </summary>
/// <param name="sstring"></param>
/// <param name="ch"></param>
/// <param name="victim"></param>
/// <returns></returns>
public static string TranslateText( string sstring, CharData ch, CharData victim )
{
if (String.IsNullOrEmpty(sstring) || ch == null || victim == null)
{
return String.Empty;
}
const string alphabet = "ecdfighjaklmnpyqrstvowxzub ";
const string numbers = "1234567890";
int i;
Race.Language lang = ch.IsNPC() ? Race.RaceList[ ch.GetOrigRace() ].PrimaryLanguage : ( (PC)ch ).Speaking;
// Immortals have perfect speech & NPCs have perfect ears & nobody misunderstands themselves.
if (victim.IsImmortal() || ch.IsImmortal() || victim.IsNPC() || (ch == victim) || ch.IsNPC())
return sstring;
/* Step 1: Copy string. */
char[] buffer = sstring.ToCharArray();
/* Step 3: Check to see if ch says everything right.
* NPC's never say anything wrong.
*/
if( !ch.IsNPC() )
{
for( i = 0; i < buffer.Length; i++ )
{
if( MUDMath.NumberPercent() > ( (PC)ch ).LanguageAptitude[ (int)lang ]
&& MUDMath.NumberPercent() < 50 )
{
if( Char.IsLetter( buffer[ i ] ) )
{
if( Char.IsLower( buffer[ i ] ) )
buffer[ i ] = alphabet[ buffer[ i ] - 'a' ];
else
buffer[ i ] = Char.ToUpper( alphabet[ buffer[ i ] - 'A' ] );
}
else if( Char.IsDigit( buffer[ i ] ) )
buffer[ i ] = numbers[ buffer[ i ] - '0' ];
else
buffer[ i ] = buffer[ i ];
}
}
}
// Step 4: Check for comprehend languages. If so, victim understands perfectly.
if (victim.IsAffected(Affect.AFFECT_COMP_LANG) || (lang == Race.Language.unknown))
{
return new String(buffer);
}
victim.PracticeLanguage( lang );
// Step 5: Check to see if victim hears everything right.
for( i = 0; i < buffer.Length; i++ )
{
if( MUDMath.NumberPercent() > ( (PC)victim ).LanguageAptitude[ (int)lang ]
&& MUDMath.NumberPercent() < 50 )
{
if( Char.IsLetter( buffer[ i ] ) )
{
if (Char.IsLower(buffer[i]))
{
buffer[i] = alphabet[buffer[i] - 'a'];
}
else
{
buffer[i] = Char.ToUpper(alphabet[buffer[i] - 'A']);
}
}
else if (Char.IsDigit(buffer[i]))
{
buffer[i] = numbers[buffer[i] - '0'];
}
else
{
buffer[i] = buffer[i];
}
}
}
/* Step 6: return the (probably messed up if it got this far) string. */
return new String(buffer);
}
示例7: AdjustFaction
/// <summary>
/// When player ch kills victim, adjusts faction standings of the player, player's guild,
/// and the player's race.
///
/// Keep in mind that _raceFaction values are "how they feel about us" values and not
/// "how we feel about them" values.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
public static void AdjustFaction(CharData ch, CharData victim)
{
// Faction hits can only be had when a player kills a mob.
if (ch == null || victim == null || ch.IsNPC() || !victim.IsNPC())
{
return;
}
if (Macros.IsSet((int)Database.SystemData.ActFlags, (int)Sysdata.MudFlags.disablefaction))
{
return;
}
if (Macros.IsSet((int)Database.SystemData.ActFlags, (int)Sysdata.MudFlags.checkfactionbit) &&
victim.HasActionBit(MobTemplate.ACT_FACTION))
{
return;
}
// First we do player faction.
PC pc = (PC)ch;
int race = victim.GetOrigRace();
pc.RaceFaction[race] -= 1.0;
if (pc.RaceFaction[race] < Limits.MIN_FACTION)
{
pc.RaceFaction[race] = Limits.MIN_FACTION;
}
// Now we do guild faction at 1/10 the strength.
if (pc.GuildMembership != null)
{
pc.GuildMembership.RaceFactionStandings[race] -= 0.1;
if (pc.GuildMembership.RaceFactionStandings[race] < Limits.MIN_FACTION)
{
pc.GuildMembership.RaceFactionStandings[race] = Limits.MIN_FACTION;
}
}
// Now we do race faction at 1/100 the strength.
int pcrace = pc.GetOrigRace();
Race.RaceList[pcrace].RaceFaction[race] -= 0.01;
if (Race.RaceList[pcrace].RaceFaction[race] < Limits.MIN_FACTION)
{
Race.RaceList[pcrace].RaceFaction[race] = Limits.MIN_FACTION;
}
// Now we check rival races to see whether we get any faction bonuses.
for( int racenum = 0; racenum < Race.RaceList.Length; racenum++ )
{
// Already adjusted this one or it's our race.
if (racenum == race || racenum == pcrace )
continue;
// Adjustment is done in fractions of a percent of a point (-1% to 1% based on how strongly the
// opposing race feels). This may need to be increased.
double adjustment = (Race.RaceList[racenum].RaceFaction[race] / Limits.MAX_FACTION) * 0.01;
// Since a race that has high faction with the race that was just killed will result in a positive number
// we subtract it from the player's faction with that race.
pc.RaceFaction[racenum] -= adjustment;
if (pc.RaceFaction[racenum] < Limits.MIN_FACTION)
{
pc.RaceFaction[racenum] = Limits.MIN_FACTION;
}
else if (pc.RaceFaction[racenum] > Limits.MAX_FACTION)
{
pc.RaceFaction[racenum] = Limits.MAX_FACTION;
}
// Adjust the race faction rankings of the player's guild.
if (pc.GuildMembership != null)
{
// Guild takes 1/10 the adjustment.
pc.GuildMembership.RaceFactionStandings[racenum] -= (adjustment / 10.0);
if (pc.GuildMembership.RaceFactionStandings[racenum] < Limits.MIN_FACTION)
{
pc.GuildMembership.RaceFactionStandings[racenum] = Limits.MIN_FACTION;
}
else if (pc.GuildMembership.RaceFactionStandings[racenum] > Limits.MAX_FACTION)
{
pc.GuildMembership.RaceFactionStandings[racenum] = Limits.MAX_FACTION;
}
}
// Adjust the race faction rankings of the players race.
Race.RaceList[pcrace].RaceFaction[racenum] -= (adjustment / 100.0);
if (Race.RaceList[pcrace].RaceFaction[racenum] < Limits.MIN_FACTION)
{
Race.RaceList[pcrace].RaceFaction[racenum] = Limits.MIN_FACTION;
}
else if (Race.RaceList[pcrace].RaceFaction[racenum] > Limits.MAX_FACTION)
{
//.........这里部分代码省略.........
示例8: IsRacewar
/// <summary>
/// Checks whether the current character is at racewar with the supplied character.
/// </summary>
/// <param name="ch"></param>
/// <returns></returns>
public bool IsRacewar( CharData ch )
{
// Gods don't participate in racewars.
if( IsImmortal() || ch.IsImmortal() )
{
return false;
}
// NPCs are not a part of the war.
if( IsNPC() || ch.IsNPC() )
{
return false;
}
// We check using original race because racewars are based on the side a person is *really* on at heart.
if( Race.RaceList[ GetOrigRace() ].WarSide != Race.RaceList[ ch.GetOrigRace() ].WarSide )
{
return true;
}
return false;
}
示例9: GetFaction
/// <summary>
/// Gets the caller's faction standing with the victim.
/// </summary>
/// <param name="victim"></param>
/// <returns></returns>
public virtual double GetFaction(CharData victim)
{
int race = victim.GetOrigRace();
return GetFaction(race);
}
示例10: ExtractChar
//.........这里部分代码省略.........
if (worldChar.IsHating(ch))
worldChar.StopHating(ch);
if (worldChar.Hunting && worldChar.Hunting.Who == ch)
Combat.StopHunting(worldChar);
if (worldChar.Fearing && worldChar.Fearing.Who == ch)
Combat.StopFearing(worldChar);
// Remove from the active character list.
// BUG: TODO: FIXME: This invalidates the list for anyone iterating through
// a list that may kill characters, such as violence_update.
// it = CharList.erase( it );
}
if (ch.InRoom)
{
// This was placed *after* the act strings to be safe.
for (int iwch = ch.InRoom.People.Count - 1; iwch >= 0; iwch--)
{
if (ch.InRoom.People[iwch] == ch)
{
ch.RemoveFromRoom();
break;
}
}
}
// They're not being yanked from game, probably just dead and going to the menu.
if (!delete)
{
Room location;
if (ch.Level < 5 || Macros.IsSet((int)Database.SystemData.ActFlags, (int)Sysdata.MudFlags.alwaysequip))
ch.ReceiveNewbieEquipment();
if (!ch.IsNPC() && (ch.GetOrigRace() < Limits.MAX_PC_RACE) && ((int)ch.CharacterClass.ClassNumber < CharClass.ClassList.Length))
{
// Get the default respawn location based on currhome, then race/class default.
location = Room.GetRoom(((PC)ch).CurrentHome);
if (location == null)
{
int place;
List<RepopulationPoint> repoplist = ch.GetAvailableRepops();
if (repoplist.Count < 1)
{
place = StaticRooms.GetRoomNumber("ROOM_NUMBER_START");
}
else
{
place = repoplist[0].RoomIndexNumber;
}
location = Room.GetRoom(place);
if (location == null)
{
Log.Error("Starting room does not exist for class {0} of player's race! Calling ch.AddToRoom() for altar.", (int)ch.CharacterClass.ClassNumber);
ch.AddToRoom(Room.GetRoom(StaticRooms.GetRoomNumber("ROOM_NUMBER_ALTAR")));
}
}
else
{
ch.AddToRoom(location);
}
}
else
{
location = Room.GetRoom(StaticRooms.GetRoomNumber("ROOM_NUMBER_START"));
if (location == null)
{
示例11: GetFaction
/// <summary>
/// Gets the player's faction standing with the victim. Uses race, guild, and player standings in calculation.
/// </summary>
/// <param name="victim"></param>
/// <returns></returns>
public override double GetFaction(CharData victim)
{
int race = victim.GetOrigRace();
return GetFaction(race);
}