本文整理汇总了C#中MUDEngine.CharData类的典型用法代码示例。如果您正苦于以下问题:C# CharData类的具体用法?C# CharData怎么用?C# CharData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CharData类属于MUDEngine命名空间,在下文中一共展示了CharData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Object
/// <summary>
/// Default constructor.
/// </summary>
public Object()
{
++_numObjects;
_createdBy = null;
_itemType = ObjTemplate.ObjectType.trash;
_material = 0;
_size = 0;
_volume = 0;
_craftsmanship = 0;
_wearLocation = 0;
_weight = 0;
_cost = 0;
_level = 1;
_timer = -1;
_condition = 100;
_flyLevel = CharData.FlyLevel.ground;
int count;
for( count = 0; count < Limits.NUM_ITEM_EXTRA_VECTORS; ++count )
_extraFlags[ count ] = 0;
for (count = 0; count < Limits.NUM_USE_FLAGS_VECTORS; ++count)
_antiFlags[count] = 0;
for (count = 0; count < Limits.NUM_WEAR_FLAGS_VECTORS; ++count)
_wearFlags[count] = 0;
for (count = 0; count < Limits.NUM_AFFECT_VECTORS; ++count)
_affectedBy[ count ] = 0;
for( count = 0; count < 8; ++count )
_values[ count ] = 0;
}
示例2: FindExit
/// <summary>
/// Finds an exit based on a keyword. Use FindDoor if you are looking for a door.
/// </summary>
/// <param name="ch"></param>
/// <param name="arg"></param>
/// <returns></returns>
public static Exit.Direction FindExit( CharData ch, string arg )
{
Exit exit;
Exit.Direction door = Exit.DoorLookup(arg);
if( door == Exit.Direction.invalid )
{
for (int doornum = 0; doornum < Limits.MAX_DIRECTION; doornum++)
{
if ((exit = ch.InRoom.ExitData[doornum]) && exit.HasFlag(Exit.ExitFlag.is_door)
&& !(ch.Level < Limits.LEVEL_AVATAR && exit.ExitFlags != 0
&& (exit.HasFlag(Exit.ExitFlag.secret) || exit.HasFlag(Exit.ExitFlag.blocked)))
&& exit.Keyword.Length != 0 && ("door".Equals(arg, StringComparison.CurrentCultureIgnoreCase)
|| MUDString.NameContainedIn(arg, exit.Keyword)))
{
return (Exit.Direction)doornum;
}
}
SocketConnection.Act( "I see no $T here.", ch, null, arg, SocketConnection.MessageTarget.character );
return Exit.Direction.invalid;
}
if( !( exit = ch.InRoom.ExitData[ (int)door ] ) )
{
SocketConnection.Act( "I see no door $T here.", ch, null, arg, SocketConnection.MessageTarget.character );
return Exit.Direction.invalid;
}
return door;
}
示例3: SongChaos
/// <summary>
/// Song of chaos.
/// </summary>
/// <param name="ch"></param>
/// <param name="spell"></param>
/// <param name="level"></param>
/// <param name="target"></param>
/// <returns></returns>
public static bool SongChaos( CharData ch, Spell spell, int level, Target target )
{
foreach( CharData victim in ch.InRoom.People )
{
}
return true;
}
示例4: FindDoor
/// <summary>
/// Finds a door based on a keyword or direction. Use FindExit if you only need to get an exit,
/// no door required. This should _not_ tell the character anything; it is an internal function.
/// </summary>
/// <param name="ch"></param>
/// <param name="arg"></param>
/// <returns></returns>
public static Exit.Direction FindDoor( CharData ch, string arg )
{
Exit exit;
Exit.Direction door = Exit.DoorLookup(arg);
if (door == Exit.Direction.invalid)
{
for( int doornum = 0; doornum < Limits.MAX_DIRECTION; doornum++ )
{
if ((exit = ch.InRoom.ExitData[doornum]) && exit.HasFlag(Exit.ExitFlag.is_door)
&& !(ch.Level < Limits.LEVEL_AVATAR && exit.ExitFlags != 0
&& (exit.HasFlag(Exit.ExitFlag.secret) || exit.HasFlag(Exit.ExitFlag.blocked)))
&& exit.Keyword.Length != 0 && ("door".Equals(arg, StringComparison.CurrentCultureIgnoreCase)
|| MUDString.NameContainedIn(arg, exit.Keyword)))
{
return (Exit.Direction)doornum;
}
}
return Exit.Direction.invalid;
}
exit = ch.InRoom.GetExit(door);
if( !exit )
{
return Exit.Direction.invalid;
}
if (!exit.HasFlag(Exit.ExitFlag.is_door))
{
return Exit.Direction.invalid;
}
return door;
}
示例5: SongCalming
/// <summary>
/// Song of calming.
/// </summary>
/// <param name="ch"></param>
/// <param name="spell"></param>
/// <param name="level"></param>
/// <param name="target"></param>
/// <returns></returns>
public static bool SongCalming( CharData ch, Spell spell, int level, Target target )
{
foreach( CharData victim in ch.InRoom.People )
{
Combat.StopFighting( victim, false );
victim.WaitState( 2 );
}
return true;
}
示例6: MakeDrunk
/// <summary>
/// Makes a string look drunk.
/// </summary>
/// <param name="inputString"></param>
/// <param name="ch"></param>
/// <returns></returns>
public static string MakeDrunk( string inputString, CharData ch )
{
int drunklevel = 0;
if (!ch.IsNPC())
{
drunklevel = ((PC)ch).Drunk;
}
// Nothing to do here.
if (drunklevel == 0)
{
return inputString;
}
string output = String.Empty;
// Check how drunk a person is...
for (int pos = 0; pos < inputString.Length; pos++)
{
char temp = inputString[pos];
if ((char.ToUpper(temp) >= 'A') && (char.ToUpper(temp) <= 'Z'))
{
int drunkpos = char.ToUpper(temp) - 'A';
if (drunklevel > _drunkSubstitution[drunkpos]._minDrunkLevel)
{
int randomnum = MUDMath.NumberRange(0, _drunkSubstitution[drunkpos]._numReplacements);
output += _drunkSubstitution[drunkpos]._replacement[randomnum];
}
else
{
output += temp;
}
}
else
{
if (drunklevel < 4)
{
output += MUDMath.FuzzyNumber(temp);
}
else if ((temp >= '0') && (temp <= '9'))
{
output += MUDMath.NumberRange(0, 9).ToString();
}
else
{
output += temp;
}
}
}
return ( output );
}
示例7: AppendFile
/// <summary>
/// Appends a string to a file.
/// </summary>
/// <param name="ch"></param>
/// <param name="file"></param>
/// <param name="str"></param>
public static void AppendFile( CharData ch, string file, string str )
{
if( ch == null || String.IsNullOrEmpty(file) || String.IsNullOrEmpty(str) || ch.IsNPC() )
{
return;
}
FileStream fp = File.OpenWrite( file );
StreamWriter sw = new StreamWriter( fp );
sw.WriteLine( "[{0}] {1}: {2}\n", ch.InRoom ? MUDString.PadInt(ch.InRoom.IndexNumber,5) : MUDString.PadInt(0,5),
ch.Name, str );
sw.Flush();
sw.Close();
return;
}
示例8: 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;
}
示例9: ShoutAndHunt
/// <summary>
/// Shout for one's minions to come and attack the victim.
/// </summary>
/// <param name="mob"></param>
/// <param name="victim"></param>
/// <param name="msg"></param>
/// <param name="helpers"></param>
/// <returns></returns>
static bool ShoutAndHunt( System.Object mob, CharData victim, string msg, int[] helpers )
{
if (mob == null) return false;
int count = 0;
CharData ch = (CharData)mob;
// Send the shout message
string buf = String.Format( msg, victim.Name );
CommandType.Interpret(ch, "shout " + buf);
if (helpers[0] == 0)
{
return false;
}
// Loop through all chars
foreach (CharData worldChar in Database.CharList)
{
if( !worldChar.InRoom )
continue;
if( !worldChar.MobileTemplate )
continue;
if( !worldChar.IsNPC() || worldChar.InRoom.Area != ch.InRoom.Area )
continue;
bool isHelper = false;
int i;
for( i = 0; helpers[ i ] > 0; i++ )
{
if (worldChar.MobileTemplate.IndexNumber == helpers[i])
{
isHelper = true;
}
}
if (!isHelper)
{
continue;
}
Combat.StartGrudge( worldChar, victim, true );
++count;
}
if (count > 0)
{
return true;
}
return false;
}
示例10: HealSelf
// Keep in mind that any healing spells that give affects to the mob
// will only be able to be cast if they are not affected by them because
// the CheckSpellup _function checks to see if they are affected by
// that spell, so a heal spell that heals *and* blesses will not work
// properly and we'll need to write a new _function for it -- Xangis
static bool HealSelf( CharData ch )
{
if (ch == null) return false;
if (CheckSpellup(ch, "heal", 75))
return true;
return false;
}
示例11: CheckSpellup
// This _function should prevent a mob from spamming
// spellups on itself if it is already affected by the spell.
// in the Spellup() _function, checks for Affect.AFFECT_WHATEVER
// still need to be done. - Xangis
static bool CheckSpellup( CharData ch, string name, int percent )
{
if (ch == null) return false;
if (String.IsNullOrEmpty(name))
return false;
Spell spell = Spell.SpellList[name];
if (spell == null)
{
return false;
}
// Keep mobs from casting spells they are affected by
if( ch.HasAffect( Affect.AffectType.spell, spell ) )
return false;
if( ( ch.HasSpell( name ) )
&& ( MUDMath.NumberPercent() < percent ) )
{
if (spell.ValidTargets != TargetType.singleCharacterDefensive &&
spell.ValidTargets != TargetType.self)
Log.Error( "CheckSpellup: Mob casting spell {0} which is neither TargetType.self nor TargetType.defensive.", spell );
SocketConnection.Act( "$n&n starts casting...", ch, null, null, SocketConnection.MessageTarget.room );
ch.SetAffectBit( Affect.AFFECT_CASTING );
CastData caster = new CastData();
caster.Who = ch;
caster.Eventdata = Event.CreateEvent(Event.EventType.spell_cast, spell.CastingTime, ch, ch, spell);
Database.CastList.Add( caster );
return true;
}
return false;
}
示例12: SummonIfHating
/*
* If a spell casting mob is hating someone, try to summon them.
*
* Xangis - Need to add code to also gate to the person if they can't be summoned
*/
static void SummonIfHating( CharData ch )
{
string name = String.Empty;
string buf = String.Empty;
if( ch.Fighting || ch.Fearing || ch.Hating.Count == 0 || ch.InRoom.HasFlag( RoomTemplate.ROOM_SAFE ) )
return;
/* If summoner is busy hunting someone aleady, don't summon. */
if( ch.Hunting )
return;
CharData victim = ch.GetRandomHateTarget( false );
// Pretty stupid to summon someone who's in the same room.
if( !victim || ch.InRoom == victim.InRoom )
return;
if( ( ch.HasSpell( "relocate" ) ))
{
if( !victim.IsNPC() )
buf += "relocate 0." + name;
else
buf += "relocate " + name;
}
else if( ch.HasSpell( "summon" ) )
{
if( !victim.IsNPC() )
buf += "summon 0." + name;
else
buf += "summon " + name;
}
else if ((ch.Level * 4 - 3) >= Spell.SpellList["spirit jump"].SpellCircle[(int)ch.CharacterClass.ClassNumber])
{
if( !victim.IsNPC() )
buf += "'spirit jump' 0." + name;
else
buf += "'spirit jump' " + name;
}
CommandType.Interpret(ch, "cast " + buf);
return;
}
示例13: SpellupOthers
static bool SpellupOthers( CharData ch )
{
if (ch == null) return false;
if (ch.InRoom.HasFlag(RoomTemplate.ROOM_NO_MAGIC))
return false;
if( !ch.IsAwake() || ch.Fighting )
return false;
if( !ch.CanSpeak() )
return false;
CharData victim = null;
foreach( CharData ivictim in ch.InRoom.People )
{
if (ivictim != ch && CharData.CanSee(ch, ivictim) && MUDMath.NumberBits(1) == 0 && ivictim.IsNPC())
{
victim = ivictim;
break;
}
}
if( !victim )
return false;
if( victim.Hitpoints < ( victim.GetMaxHit() - 10 ) )
{
if( CheckDefensive( ch, victim, "full heal", 75 ) )
return true;
if( CheckDefensive( ch, victim, "aid", 60 ) )
return true;
if( CheckDefensive( ch, victim, "heal", 75 ) )
return true;
if( CheckDefensive( ch, victim, "mending", 75 ) )
return true;
}
if (!victim.IsAffected(Affect.AFFECT_HASTE))
if( CheckDefensive( ch, victim, "haste", 45 ) )
return true;
return false;
}
示例14: SpecGrumbarShout
static bool SpecGrumbarShout( System.Object mob, int cmd )
{
if (mob == null) return false;
int[] helpers = new[] {9500, 9501, 9502, 9503, 9504, 9505, 9506, 9507,
9508, 9509, 9510, 0};
if( cmd == PROC_DEATH )
return false;
CharData ch = (CharData)mob;
if( !ch || !ch.IsAwake() )
return false;
if( !ch.Fighting )
{
_wasFighting = null;
return false;
}
if( ch.Fighting == _wasFighting )
return false;
_wasFighting = ch.Fighting;
return ShoutAndHunt( ch, ch.Fighting, "&+LDenizens of the Earth plane, {0} has trespassed upon us!", helpers );
}
示例15: FindPath
public static Exit.Direction FindPath( int inRoomIndexNumber, int outRoomIndexNumber, CharData ch, int depth, bool inZone )
{
RoomTemplate herep;
RoomTemplate startp;
Exit exitp;
RoomQ tmp_q;
RoomQ q_head;
RoomQ q_tail;
HashHeader x_room = null;
bool throughDoors;
int i;
int tmp_room;
int count = 0;
// TODO: Re-enable this.
return Exit.Direction.invalid;
if (depth < 0)
{
throughDoors = true;
depth = -depth;
}
else
{
throughDoors = false;
}
startp = Room.GetRoom(inRoomIndexNumber);
InitHashTable(x_room, sizeof(int), 2048);
//HashEnter(x_room, inRoomIndexNumber, null);
/* initialize queue */
q_head = new RoomQ();
q_tail = q_head;
q_tail.RoomNR = inRoomIndexNumber;
q_tail.NextQ = null;
while (q_head != null)
{
herep = Room.GetRoom(q_head.RoomNR);
/* for each room test all directions */
if (herep.Area == startp.Area || inZone == false)
{
/*
* only look in this zone...
* saves cpu time and makes world safer for players
*/
for (i = 0; i < Limits.MAX_DIRECTION; i++)
{
exitp = herep.ExitData[i];
if (ExitOk(exitp) != 0 && (throughDoors ? GO_OK_SMARTER :
Macros.IsSet((int)Room.GetRoom(q_head.RoomNR).ExitData[i].ExitFlags, (int)Exit.ExitFlag.closed)))
{
/* next room */
tmp_room = herep.ExitData[i].TargetRoom.IndexNumber;
if (tmp_room != outRoomIndexNumber)
{
/*
* shall we add room to queue ?
* count determines total breadth and depth
*/
if (!hash_find(x_room, tmp_room)
&& (count < depth))
/* && !IS_SET( RM_FLAGS(tmp_room), DEATH ) ) */
{
++count;
/* mark room as visted and put on queue */
tmp_q = new RoomQ();
tmp_q.RoomNR = tmp_room;
tmp_q.NextQ = null;
q_tail.NextQ = tmp_q;
q_tail = tmp_q;
/* Ancestor for first layer is the direction */
/*HashEnter(x_room, tmp_room,
((long)hash_find(x_room, q_head.RoomNR) == -1)
? (Object)(i + 1)
: hash_find(x_room, q_head.RoomNR));*/
}
}
else
{
/* have reached our goal so free queue */
tmp_room = q_head.RoomNR;
for (; q_head != null; q_head = tmp_q)
{
tmp_q = q_head.NextQ;
q_head = null;
}
/* return direction if first layer */
/*if ((long)hash_find(x_room, tmp_room) == -1)
{
if (x_room.Buckets)
{
// junk left over from a previous track
DestroyHashTable(x_room, null);
}
return (i);*/
//.........这里部分代码省略.........