Exemple #1
0
        /// <summary>
        /// Converts Yes No True False On Off to a bool string.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static bool TrueFalseLookup(string text)
        {
            if (!MUDString.StringsNotEqual(text, "yes"))
            {
                return(true);
            }
            if (!MUDString.StringsNotEqual(text, "true"))
            {
                return(true);
            }
            if (!MUDString.StringsNotEqual(text, "on"))
            {
                return(true);
            }
            if (!MUDString.StringsNotEqual(text, "no"))
            {
                return(false);
            }
            if (!MUDString.StringsNotEqual(text, "false"))
            {
                return(false);
            }
            if (!MUDString.StringsNotEqual(text, "off"))
            {
                return(false);
            }

            Log.Error("StringLookup.TrueFalseLookup: True false string not true/false yes/no on/off.", 0);

            return(false);
        }
        /// <summary>
        /// Translate area range values to ranges.
        /// </summary>
        /// <param name="area"></param>
        /// <returns></returns>
        public static string RangeString(Area area)
        {
            string text;

            if (area == null)
            {
                return("none");
            }

            if (area.MinRecommendedLevel == 0 && area.MaxRecommendedLevel == Limits.MAX_LEVEL)
            {
                text = " All ";
            }
            else
            {
                if (area.MinRecommendedLevel == 0 && area.MaxRecommendedLevel == 0)
                {
                    text = "None ";
                }
                else
                {
                    text = String.Format("{0} {1}", MUDString.PadInt(area.MinRecommendedLevel, 2),
                                         MUDString.PadInt(area.MaxRecommendedLevel, 2));
                }
            }
            return(text);
        }
Exemple #3
0
        /// <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);
        }
Exemple #4
0
        /// <summary>
        /// Converts the _name of a racewar side to a Race.RacewarSide value.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static Race.RacewarSide RacewarLookup(string text)
        {
            if (!MUDString.StringsNotEqual(text, "none"))
            {
                return(Race.RacewarSide.neutral);
            }
            if (!MUDString.StringsNotEqual(text, "good"))
            {
                return(Race.RacewarSide.good);
            }
            if (!MUDString.StringsNotEqual(text, "evil"))
            {
                return(Race.RacewarSide.evil);
            }
            if (!MUDString.StringsNotEqual(text, "enslaver"))
            {
                return(Race.RacewarSide.enslaver);
            }
            if (!MUDString.StringsNotEqual(text, "neutral"))
            {
                return(Race.RacewarSide.neutral);
            }

            Log.Error("StringLookup.RacewarLookup: Racewar string not none/good/neutral/evil/enslaver.", 0);

            return(Race.RacewarSide.neutral);
        }
Exemple #5
0
        /// <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);
        }
Exemple #6
0
        /// <summary>
        /// Gets a location based on its name.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="arg"></param>
        /// <returns></returns>
        public static Room FindLocation(CharData ch, string arg)
        {
            if (MUDString.IsNumber(arg))
            {
                int val;
                Int32.TryParse(arg, out val);
                return(GetRoom(val));
            }

            CharData victim = ch.GetCharWorld(arg);

            if (victim)
            {
                return(victim.InRoom);
            }

            Object obj = Object.GetObjectInWorld(ch, arg);

            if (obj)
            {
                return(obj.InRoom);
            }

            return(null);
        }
Exemple #7
0
        /// <summary>
        /// Counts the number of control points used by a necromancer's pets.
        /// </summary>
        /// <param name="ch"></param>
        /// <returns></returns>
        public static int CountUndeadPets(CharData ch)
        {
            CharData pet;
            int      count = 0;

            foreach (CharData flist in ch.Followers)
            {
                pet = flist;
                if (pet && pet.IsNPC())
                {
                    if ("skeleton undead".StartsWith(pet.Name, StringComparison.CurrentCultureIgnoreCase))
                    {
                        count += Table[UNDEAD_SKELETON].Slots;
                    }
                    if ("zombie undead".StartsWith(pet.Name, StringComparison.CurrentCultureIgnoreCase))
                    {
                        count += Table[UNDEAD_ZOMBIE].Slots;
                    }
                    if ("spectre undead".StartsWith(pet.Name, StringComparison.CurrentCultureIgnoreCase))
                    {
                        count += Table[UNDEAD_SPECTRE].Slots;
                    }
                    if ("wraith undead".StartsWith(pet.Name, StringComparison.CurrentCultureIgnoreCase))
                    {
                        count += Table[UNDEAD_WRAITH].Slots;
                    }
                    if ("vampire undead".StartsWith(pet.Name, StringComparison.CurrentCultureIgnoreCase))
                    {
                        count += Table[UNDEAD_VAMPIRE].Slots;
                    }
                    if ("lich undead".StartsWith(pet.Name, StringComparison.CurrentCultureIgnoreCase))
                    {
                        count += Table[UNDEAD_LICH].Slots;
                    }
                    if (!MUDString.IsSuffixOf("dracolich undead", pet.Name))
                    {
                        count += Table[UNDEAD_RED_DRACO].Slots;
                    }
                    if (!MUDString.IsSuffixOf("dracolich undead", pet.Name))
                    {
                        count += Table[UNDEAD_BLUE_DRACO].Slots;
                    }
                    if (!MUDString.IsSuffixOf("dracolich undead", pet.Name))
                    {
                        count += Table[UNDEAD_BLACK_DRACO].Slots;
                    }
                    if (!MUDString.IsSuffixOf("dracolich undead", pet.Name))
                    {
                        count += Table[UNDEAD_GREEN_DRACO].Slots;
                    }
                    if (!MUDString.IsSuffixOf("dracolich undead", pet.Name))
                    {
                        count += Table[UNDEAD_WHITE_DRACO].Slots;
                    }
                }
            }
            return(count);
        }
Exemple #8
0
        /// <summary>
        /// Generates a random sentence.
        /// </summary>
        /// <returns></returns>
        public static string RandomSentence()
        {
            string text;

            NounType noun = Table[MUDMath.NumberRange(0, Table.Length - 1)];
            VerbType verb = VerbType.Table[MUDMath.NumberRange(0, VerbType.Table.Length - 1)];

            while (noun.Animate == false)
            {
                noun = Table[MUDMath.NumberRange(0, Table.Length - 1)];
            }

            if (MUDMath.NumberPercent() > 50)
            {
                if (MUDString.IsVowel(noun.Name))
                {
                    text = String.Format("An ");
                }
                else
                {
                    text = String.Format("A ");
                }
            }
            else
            {
                text = String.Format("The ");
            }

            text += noun.Name;
            text += " ";
            text += verb.Name;
            if (verb.DirectObject != VerbType.DirectObjectType.none)
            {
                noun = Table[MUDMath.NumberRange(0, Table.Length - 1)];

                if (MUDString.IsVowel(noun.Name))
                {
                    text += " an ";
                }
                else
                {
                    text += " a ";
                }

                text += noun.Name;
            }

            if (MUDMath.NumberPercent() > 80)
            {
                text += "!";
            }
            else
            {
                text += ".";
            }

            return(text);
        }
Exemple #9
0
        /// <summary>
        /// Checks whether the character is authorized to use a particular immortal skill.
        /// </summary>
        /// <param name="skllnm"></param>
        /// <returns></returns>
        public bool Authorized(string skllnm)
        {
            if (!MUDString.NameContainedIn(skllnm, _immortalSkills))
            {
                return(false);
            }

            return(true);
        }
Exemple #10
0
        /// <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;
        }
Exemple #11
0
        /// <summary>
        /// Gets a size value based on its name.
        /// </summary>
        /// <param name="size"></param>
        /// <returns></returns>
        public static Race.Size SizeLookup(string size)
        {
            int index;

            for (index = 0; index < Race.MAX_SIZE; index++)
            {
                if (!MUDString.IsPrefixOf(size, Race.SizeString((Race.Size)index)))
                {
                    return((Race.Size)index);
                }
            }

            Log.Error("SizeLookup: Unable to match size string " + size);
            return(Race.Size.medium);
        }
Exemple #12
0
        /// <summary>
        /// Get an extra description from a list.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="ed"></param>
        /// <returns></returns>
        public static string GetExtraDescription(string name, List <ExtendedDescription> ed)
        {
            if (String.IsNullOrEmpty(name) || ed == null || ed.Count < 1)
            {
                return(String.Empty);
            }

            foreach (ExtendedDescription desc in ed)
            {
                if (MUDString.NameContainedIn(name, desc.Keyword))
                {
                    return(desc.Description);
                }
            }
            return(String.Empty);
        }
Exemple #13
0
        /// <summary>
        /// Converts mob innate string to a value.
        /// </summary>
        /// <param name="innate"></param>
        /// <param name="text"></param>
        public static void InnateLookup(int[] innate, string text)
        {
            int index;

            if (!MUDString.StringsNotEqual(text, "none"))
            {
                return;
            }

            for (index = 0; BitvectorFlagType.InnateFlags[index].BitvectorData; index++)
            {
                if (MUDString.NameContainedIn(BitvectorFlagType.InnateFlags[index].Name, text))
                {
                    Macros.SetBit(ref innate[BitvectorFlagType.InnateFlags[index].BitvectorData.Group], BitvectorFlagType.InnateFlags[index].BitvectorData.Vector);
                }
            }
        }
Exemple #14
0
        /// <summary>
        /// Formats the spell information for a terminal window.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string text = String.Format("\r\nSpell: '{0}' ", Name);

            text += String.Format("Minimum mana: {0} Castable in battle: {1}\r\n",
                                  MinimumMana,
                                  CanCastInCombat ? "Yes" : "No");
            text += String.Format("Targets: {0}  Mana Type: {1}  School: {2}\r\n",
                                  ValidTargets, ManaType, StringConversion.SpellSchoolString(School));
            text += String.Format("Duration: {0}  Save: {1}  Stack: {2}\r\n",
                                  Duration, SavingThrowEffect, StackingType);
            text += String.Format("Dmg Type: {0}  Cast Time: {1}  Dmg: 1d{2}/lvl+{3} Cap: Lv {4}\r\n",
                                  DamageInflicted.ToString(), CastingTime, DamageDicePerLevel, BaseDamage, LevelCap);
            text += String.Format("AI Pwr: {0}  AI %: {1}  AI Type: {2}  Detriment: {3}  Scribe: {4}\r\n",
                                  AIPower, AIChance, AICategoryType, Detrimental, CanBeScribed);
            text += String.Format("Cast Msg: {0}\r\nCast To Vict: {1}\r\n",
                                  MessageCompleted, MessageCompletedToTarget);
            text += String.Format("Cast To Room: {0}\r\n",
                                  MessageCompletedToRoom);
            text += String.Format("Dmg To Room: {0}\r\nDmg To Vict: {1}\r\n",
                                  MessageDamageToRoom, MessageDamageToVictim);
            text += String.Format("Dmg To Room: {0}\r\nDmg To Self: {1}\r\n",
                                  MessageDamageSelfToRoom, MessageDamageToSelf);
            text += String.Format("Damage Msg: {0}\r\nKill Msg: {1}\r\n",
                                  MessageDamage, MessageKill);
            text += String.Format("Wear Off Msg: {0}\r\n",
                                  MessageWearOff);
            text += String.Format("Provides: {0}\r\n",
                                  BitvectorFlagType.AffectString(Provides, false));
            text += String.Format("Negates: {0}\r\n",
                                  BitvectorFlagType.AffectString(Negates, false));
            text += String.Format("Modifies: {0}\r\n",
                                  "");
            text += "\r\nClass Availability:\r\n";
            for (int count = 0; count < CharClass.ClassList.Length; ++count)
            {
                text += String.Format("  {0}: {1:00}", MUDString.PadStr(CharClass.ClassList[count].Name, 18),
                                      _spellCircle[count]);
                if (count % 3 == 2)
                {
                    text += "\r\n";
                }
            }
            text += "\r\n";
            return(text);
        }
Exemple #15
0
        /// <summary>
        /// Loads in all of the guild files.
        /// </summary>
        public static void LoadGuilds()
        {
            string filename;

            string guildsList = String.Format("{0}{1}", FileLocation.GuildDirectory, FileLocation.GuildLoadList);

            Log.Trace("Loading guilds: " + guildsList);
            try
            {
                FileStream   fpList = File.OpenRead(guildsList);
                StreamReader sw     = new StreamReader(fpList);

                // Read next guild ID.
                bool success = Int32.TryParse(sw.ReadLine(), out _nextGuildID);
                if (!success)
                {
                    Log.Error("Guild.LoadGuilds(): Unable to read next guild ID from guild list.");
                }

                while (!sw.EndOfStream)
                {
                    filename = sw.ReadLine();

                    if (filename.Length == 0 || !MUDString.StringsNotEqual(filename, "$"))
                    {
                        break;
                    }

                    Guild guild = Load(FileLocation.GuildDirectory + filename);
                    if (guild != null)
                    {
                        Database.GuildList.Add(guild);
                    }
                }
                sw.Close();
            }
            catch (Exception ex)
            {
                Log.Error("Exception in Guild.LoadGuilds(): " + ex);
            }
            return;
        }
Exemple #16
0
        /// <summary>
        /// Translates a dragon breath type _name into its special function.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        static MobSpecial GetBreathType(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            if (MUDString.NameContainedIn("br_f", name))
            {
                return(MobSpecial.SpecMobLookup("spec_breath_fire")[0]);
            }
            if (MUDString.NameContainedIn("br_a", name))
            {
                return(MobSpecial.SpecMobLookup("spec_breath_acid")[0]);
            }
            if (MUDString.NameContainedIn("br_c", name))
            {
                return(MobSpecial.SpecMobLookup("spec_breath_frost")[0]);
            }
            if (MUDString.NameContainedIn("br_g", name))
            {
                return(MobSpecial.SpecMobLookup("spec_breath_gas")[0]);
            }
            if (MUDString.NameContainedIn("br_l", name))
            {
                return(MobSpecial.SpecMobLookup("spec_breath_lightning")[0]);
            }
            if (MUDString.NameContainedIn("br_w", name))
            {
                return(MobSpecial.SpecMobLookup("spec_breath_water")[0]);
            }
            if (MUDString.NameContainedIn("br_s", name))
            {
                return(MobSpecial.SpecMobLookup("spec_breath_shadow")[0]);
            }

            return(MobSpecial.SpecMobLookup("spec_breath_any")[0]);
        }
Exemple #17
0
        /// <summary>
        /// The main social action processing routine.  Sends the social strings and any associated sounds.
        /// </summary>
        /// <param name="ch">Character acting out the social.</param>
        /// <param name="command">Command entered by the character.</param>
        /// <param name="argument">Additional modifiers to the command entered.</param>
        /// <returns></returns>
        public bool CheckSocial(CharData ch, string command, string argument)
        {
            string arg = String.Empty;

            Social soc = FindSocial(command);

            if (soc == null)
            {
                return(false);
            }

            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_NO_EMOTE))
            {
                ch.SendText("You are anti-social!\r\n");
                return(true);
            }

            if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEDITATING))
            {
                ch.RemoveActionBit(PC.PLAYER_MEDITATING);
                ch.SendText("You stop meditating.\r\n");
            }

            // Performing a social action removes hide and conceal.
            if (ch.IsAffected(Affect.AFFECT_MINOR_INVIS))
            {
                ch.SendText("You appear.\r\n");
            }
            ch.AffectStrip(Affect.AffectType.skill, "shadow form");
            ch.AffectStrip(Affect.AffectType.spell, "concealment");
            ch.RemoveAffect(Affect.AFFECT_MINOR_INVIS);
            ch.RemoveAffect(Affect.AFFECT_HIDE);

            switch (ch.CurrentPosition)
            {
            case Position.dead:
                ch.SendText("Lie still; you are DEAD.\r\n");
                return(true);

            case Position.incapacitated:
            case Position.mortally_wounded:
                ch.SendText("You are hurt far too badly for that.\r\n");
                return(true);

            case Position.stunned:
                ch.SendText("You are too stunned to do that.\r\n");
                return(true);

            case Position.sleeping:
                // Special exception - only social when you're using when asleep is "snore".
                if (!"snore".StartsWith(soc.Name, StringComparison.CurrentCultureIgnoreCase))
                {
                    break;
                }
                ch.SendText("In your dreams, or what?\r\n");
                return(true);
            }

            MUDString.OneArgument(argument, ref arg);
            CharData victim = null;

            if (arg.Length == 0)
            {
                SocketConnection.Act(soc.CharNoArgument, ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act(soc.OthersNoArgument, ch, null, victim, SocketConnection.MessageTarget.room);
                if (!String.IsNullOrEmpty(soc.AudioFile) && ch.InRoom != null)
                {
                    foreach (CharData cd in ch.InRoom.People)
                    {
                        cd.SendSound(soc.AudioFile);
                    }
                }
                return(true);
            }
            victim = ch.GetCharWorld(arg);
            if (!victim || (ch.IsRacewar(victim) && ch.InRoom != victim.InRoom))
            {
                ch.SendText("They aren't here.\r\n");
            }
            else if (victim == ch)
            {
                SocketConnection.Act(soc.CharSelf, ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act(soc.OthersSelf, ch, null, victim, SocketConnection.MessageTarget.room);
                if (!String.IsNullOrEmpty(soc.AudioFile) && ch.InRoom != null)
                {
                    foreach (CharData cd in ch.InRoom.People)
                    {
                        cd.SendSound(soc.AudioFile);
                    }
                }
            }
            else if (!ch.GetCharRoom(arg) && CharData.CanSee(ch, victim) &&
                     soc.CharFound.Length > 0 && soc.VictimFound.Length > 0)
            {
                if (!ch.IsImmortal())
                {
                    ch.SendText("You don't see them here.\r\n");
                    return(true);
                }
                if (!victim.IsNPC())
                {
                    const string ldbase = "From far away, ";

                    if (victim.IsIgnoring(ch))
                    {
                        ch.SendText("They are ignoring you.\r\n");
                        return(false);
                    }
                    Room original = ch.InRoom;
                    ch.RemoveFromRoom();
                    ch.AddToRoom(victim.InRoom);

                    string ldmsg = ldbase;
                    ldmsg += soc.CharFound;
                    SocketConnection.Act(ldmsg, ch, null, victim, SocketConnection.MessageTarget.character);

                    ldmsg  = ldbase;
                    ldmsg += soc.VictimFound;
                    SocketConnection.Act(ldmsg, ch, null, victim, SocketConnection.MessageTarget.victim);

                    if (!String.IsNullOrEmpty(soc.AudioFile) && ch.InRoom != null)
                    {
                        foreach (CharData cd in ch.InRoom.People)
                        {
                            cd.SendSound(soc.AudioFile);
                        }
                    }

                    ch.RemoveFromRoom();
                    ch.AddToRoom(original);
                }
                else
                {
                    ch.SendText("They aren't here.\r\n");
                }
            }
            else
            {
                SocketConnection.Act(soc.CharFound, ch, null, victim, SocketConnection.MessageTarget.character);
                SocketConnection.Act(soc.VictimFound, ch, null, victim, SocketConnection.MessageTarget.victim);
                SocketConnection.Act(soc.OthersFound, ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                if (!String.IsNullOrEmpty(soc.AudioFile) && ch.InRoom != null)
                {
                    foreach (CharData cd in ch.InRoom.People)
                    {
                        cd.SendSound(soc.AudioFile);
                    }
                }

                // If mobs are to respond to socials, it should be inserted here.
                // This might be useful for some quests, mob functions, or other things.
            }

            return(true);
        }
Exemple #18
0
        /// <summary>
        /// Show a character to another character. This is the abbreviated version used in "look room"
        /// </summary>
        /// <param name="victim"></param>
        /// <param name="ch"></param>
        public static void ShowCharacterToCharacterAbbreviated(CharData victim, CharData ch)
        {
            string text = String.Empty;

            if (!victim || !ch)
            {
                Log.Error("ShowCharacterToCharacter0(): null ch or victim.", 0);
                return;
            }

            if (victim.Rider && victim.Rider.InRoom == ch.InRoom)
            {
                return;
            }

            // If invis, show char invis symbol first.
            if (victim.IsAffected(Affect.AFFECT_INVISIBLE))
            {
                text += "&+L*&n ";
            }

            // Show the player's description.
            if (((!ch.IsNPC() && victim.CurrentPosition == Position.standing) ||
                 (victim.IsNPC() && victim.MobileTemplate != null &&
                  victim.CurrentPosition == victim.MobileTemplate.DefaultPosition)) &&
                (!String.IsNullOrEmpty(victim.FullDescription)) && !victim.Riding)
            {
                // Added long description does not have \r\n removed.  We may want to.
                text += victim.Description + "&n";
            }
            else
            {
                // Show the player's name.
                text += victim.ShowNameTo(ch, true) + "&n";

                // Show the player's title.
                // Show the player's race, only if PC, and on the same side of the racewar or a god.
                if (!victim.IsNPC() && ((PC)victim).Title.Length > 0)
                {
                    if (MUDString.StringsNotEqual(((PC)victim).Title, " &n") && (ch.IsNPC()))
                    {
                        text += ((PC)victim).Title;
                    }
                    if (victim.IsGuild() && (ch.IsNPC()))
                    {
                        text += " " + ((PC)victim).GuildMembership.WhoName;
                    }

                    if (!ch.IsRacewar(victim) || victim.IsImmortal() || ch.IsImmortal())
                    {
                        text += " (" + Race.RaceList[victim.GetRace()].ColorName + ")";
                    }
                }

                // Show the player's condition.
                text += " is ";
                if (victim.CurrentPosition == Position.standing && victim.CanFly())
                {
                    text += "flying";
                }
                else
                {
                    text += Position.PositionString(victim.CurrentPosition);
                }
                text += " here";
                if (victim.Fighting != null)
                {
                    text += "&n fighting ";
                    if (victim.Fighting == ch)
                    {
                        text += "&nyou!";
                    }
                    else if (victim.InRoom == victim.Fighting.InRoom)
                    {
                        text += victim.Fighting.ShowNameTo(ch, false);
                    }
                    else
                    {
                        text += "&nsomeone who left??";
                    }
                }

                if (victim.Riding && victim.Riding.InRoom == victim.InRoom)
                {
                    text += "&n, mounted on " + victim.Riding.ShowNameTo(ch, false);
                }
                text += "&n.";
            }

            if (victim.IsAffected(Affect.AFFECT_CASTING))
            {
                text += "&n&+y (casting)&n";
            }

            if (victim.IsAffected(Affect.AFFECT_MINOR_PARA))
            {
                text += "&n (&+Yparalyzed)&n";
            }
            if (!victim.IsNPC() && victim.HasActionBit(PC.PLAYER_WIZINVIS) &&
                victim.GetTrust() <= ch.GetTrust())
            {
                text += " &n&+g*&n";
            }
            if (victim.IsAffected(Affect.AFFECT_HIDE) && (ch.IsAffected(Affect.AFFECT_DETECT_HIDDEN) ||
                                                          ch.HasInnate(Race.RACE_DETECT_HIDDEN)))
            {
                text += " &n(&+LHiding&n)";
            }
            if (victim.IsAffected(Affect.AFFECT_CHARM) && ch.HasActionBit(PC.PLAYER_GODMODE))
            {
                text += " &n(&n&+mCharmed&n)";
            }
            if ((victim.IsAffected(Affect.AFFECT_PASS_DOOR) || victim.HasInnate(Race.RACE_PASSDOOR)) &&
                ch.HasActionBit(PC.PLAYER_GODMODE))
            {
                text += " &n(&+WTranslucent&n)";
            }
            if ((victim.GetRace() == Race.RACE_UNDEAD || victim.GetRace() == Race.RACE_VAMPIRE) &&
                (ch.IsAffected(Affect.AFFECT_DETECT_UNDEAD) || ch.HasActionBit(PC.PLAYER_GODMODE)))
            {
                text += " &n(&+WPale&n)";
            }
            if (victim.IsAffected(Affect.AFFECT_FAERIE_FIRE))
            {
                text += " &n(&n&+mFa&+Me&n&+mr&+Mie&+L Aura&n)";
            }
            if (victim.IsEvil() && (ch.IsAffected(Affect.AFFECT_DETECT_EVIL) ||
                                    ch.HasInnate(Race.RACE_DETECT_ALIGN) ||
                                    ch.IsClass(CharClass.Names.paladin) ||
                                    ch.IsClass(CharClass.Names.antipaladin)))
            {
                text += " &n(&+rBlood&+L Aura&n)";
            }
            if (victim.IsGood() && (ch.IsAffected(Affect.AFFECT_DETECT_GOOD) ||
                                    ch.HasInnate(Race.RACE_DETECT_ALIGN) ||
                                    ch.IsClass(CharClass.Names.paladin) ||
                                    ch.IsClass(CharClass.Names.antipaladin)))
            {
                text += " &n(&+CLight&+L Aura&n)";
            }
            if (victim.IsAffected(Affect.AFFECT_SANCTUARY))
            {
                text += " &n(&+WWhite&+L Aura&n)";
            }
            if (!victim.IsNPC() && victim.HasActionBit(PC.PLAYER_AFK))
            {
                text += " &n&+b(&+RAFK&n&+b)&n";
            }
            if (!victim.IsNPC() && victim.HasActionBit(PC.PLAYER_BOTTING))
            {
                text += " &n&+b(&+YBot&n&+b)&n";
            }
            text += "\r\n";
            ch.SendText(text);
            return;
        }
Exemple #19
0
        /// <summary>
        /// Show a character to another character.
        /// </summary>
        /// <param name="victim"></param>
        /// <param name="ch"></param>
        public static void ShowCharacterToCharacterFull(CharData victim, CharData ch)
        {
            Object obj;
            string text = String.Empty;
            int    percent;

            if (CharData.CanSee(victim, ch))
            {
                SocketConnection.Act("$n&n looks at you.", ch, null, victim, SocketConnection.MessageTarget.victim);
                if (victim != ch)
                {
                    SocketConnection.Act("$n&n looks at $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                }
                else
                {
                    SocketConnection.Act("$n&n looks at $mself.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
                }
            }

            if (victim.Riding != null)
            {
                text += String.Format("&nMounted on {0}, ", victim.Riding.ShowNameTo(ch, false));
            }
            else if (victim.Rider != null)
            {
                text += String.Format("&nRidden by {0}, ", victim.Rider.ShowNameTo(ch, false));
            }

            if (!victim.IsNPC() && victim.IsGuild())
            {
                text += String.Format("&n{0} of {1}.\r\n", ((PC)victim).GuildRank.ToString().ToUpper(),
                                      ((PC)victim).GuildMembership.Name);
            }

            SocketConnection.Act(text, ch, null, victim, SocketConnection.MessageTarget.character);

            if (!String.IsNullOrEmpty(victim.Description))
            {
                ch.SendText(victim.Description);
            }
            else
            {
                SocketConnection.Act("&nYou see nothing special about $M.", ch, null, victim, SocketConnection.MessageTarget.character);
            }

            if (victim.GetMaxHit() > 0)
            {
                percent = (100 * victim.Hitpoints) / victim.GetMaxHit();
            }
            else
            {
                percent = -1;
            }

            text = victim.ShowNameTo(ch, true);

            if (percent >= 100)
            {
                text += " &nis in perfect &n&+ghealth&n.  ";
            }
            else if (percent >= 90)
            {
                text += " &nis slightly &n&+yscratched&n.  ";
            }
            else if (percent >= 80)
            {
                text += " &nhas a &+yfew bruises&n.  ";
            }
            else if (percent >= 70)
            {
                text += " &nhas &+Ysome cuts&n.  ";
            }
            else if (percent >= 60)
            {
                text += " &nhas &+Mseveral wounds&n.  ";
            }
            else if (percent >= 50)
            {
                text += " &nhas &+mmany nasty wounds&n.  ";
            }
            else if (percent >= 40)
            {
                text += " &nis &+Rbleeding freely&n.  ";
            }
            else if (percent >= 30)
            {
                text += " &nis &+Rcovered in blood&n.  ";
            }
            else if (percent >= 20)
            {
                text += " &nis &+rleaking guts&n.  ";
            }
            else if (percent >= 10)
            {
                text += " &nis &+ralmost dead&n.  ";
            }
            else
            {
                text += " &nis &+rDYING&n.  ";
            }

            ch.SendText(text);

            // Show size on look at someone.
            text = MUDString.CapitalizeANSIString(String.Format("{0}&n is a {1} of {2} size.\r\n", victim.GetSexPronoun(),
                                                                Race.RaceList[victim.GetRace()].ColorName, Race.SizeString(victim.CurrentSize)));
            ch.SendText(text);

            ShowAffectLines(ch, victim);

            bool found = false;

            foreach (ObjTemplate.WearLocation location in ObjTemplate.TopDownEquipment)
            {
                obj = Object.GetEquipmentOnCharacter(victim, location);
                if (obj && CharData.CanSeeObj(ch, obj))
                {
                    if (!found)
                    {
                        ch.SendText("\r\n");
                        SocketConnection.Act("&n$E is using:", ch, null, victim, SocketConnection.MessageTarget.character);
                        found = true;
                    }
                    if (obj.ItemType == ObjTemplate.ObjectType.weapon &&
                        (location == ObjTemplate.WearLocation.hand_one ||
                         location == ObjTemplate.WearLocation.hand_three ||
                         location == ObjTemplate.WearLocation.hand_four ||
                         location == ObjTemplate.WearLocation.hand_two) &&
                        obj.HasWearFlag(ObjTemplate.WEARABLE_WIELD))
                    {
                        if (obj.HasFlag(ObjTemplate.ITEM_TWOHANDED) &&
                            !ch.HasInnate(Race.RACE_EXTRA_STRONG_WIELD))
                        {
                            ch.SendText("&+y(wielding twohanded)  &n");
                        }
                        else
                        {
                            ch.SendText("&+y(wielding)            &n");
                        }
                    }
                    else
                    {
                        if (obj.ItemType == ObjTemplate.ObjectType.shield &&
                            (location == ObjTemplate.WearLocation.hand_one ||
                             location == ObjTemplate.WearLocation.hand_three ||
                             location == ObjTemplate.WearLocation.hand_four ||
                             location == ObjTemplate.WearLocation.hand_two) &&
                            obj.HasWearFlag(ObjTemplate.WEARABLE_SHIELD))
                        {
                            ch.SendText("&+y(worn as shield)      &n");
                        }
                        else
                        {
                            ch.SendText(StringConversion.EquipmentLocationDisplay[(int)location]);
                        }
                    }
                    ch.SendText(FormatObjectToCharacter(obj, ch, true));
                    ch.SendText("\r\n");
                }
            }

            // Keep in mind that players can spam looking at someone in order
            // to increase their skill in peek - this will need to be fixed.
            if ((victim != ch && !ch.IsNPC() &&
                 ((((PC)ch).SkillAptitude.ContainsKey("peek") && MUDMath.NumberPercent() < ((PC)ch).SkillAptitude["peek"]) ||
                  ch.Level >= Limits.LEVEL_AVATAR)) || ch.Riding == victim || ch.Rider == victim)
            {
                ch.SendText("\r\n&nYou peek at the inventory:\r\n");
                ch.PracticeSkill("peek");
                ShowListToCharacter(victim.Carrying, ch, true, true);
            }

            return;
        }
Exemple #20
0
        /// <summary>
        /// Converts the _name of a language to a Race.Language value.
        /// </summary>
        /// <param name="lang"></param>
        /// <returns></returns>
        public static Race.Language LanguageLookup(string lang)
        {
            if (!MUDString.StringsNotEqual(lang, "unknown"))
            {
                return(Race.Language.unknown);
            }
            if (!MUDString.StringsNotEqual(lang, "common"))
            {
                return(Race.Language.common);
            }
            if (!MUDString.StringsNotEqual(lang, "elven"))
            {
                return(Race.Language.elven);
            }
            if (!MUDString.StringsNotEqual(lang, "dwarven"))
            {
                return(Race.Language.dwarven);
            }
            if (!MUDString.StringsNotEqual(lang, "centaur"))
            {
                return(Race.Language.centaur);
            }
            if (!MUDString.StringsNotEqual(lang, "ogre"))
            {
                return(Race.Language.ogre);
            }
            if (!MUDString.StringsNotEqual(lang, "orc") || !MUDString.StringsNotEqual(lang, "orcish"))
            {
                return(Race.Language.orcish);
            }
            if (!MUDString.StringsNotEqual(lang, "troll"))
            {
                return(Race.Language.troll);
            }
            if (!MUDString.StringsNotEqual(lang, "aquaticelf"))
            {
                return(Race.Language.aquaticelf);
            }
            if (!MUDString.StringsNotEqual(lang, "neogi"))
            {
                return(Race.Language.neogi);
            }
            if (!MUDString.StringsNotEqual(lang, "thri-kreen"))
            {
                return(Race.Language.thri);
            }
            if (!MUDString.StringsNotEqual(lang, "dragon"))
            {
                return(Race.Language.dragon);
            }
            if (!MUDString.StringsNotEqual(lang, "magic") || !MUDString.StringsNotEqual(lang, "magical"))
            {
                return(Race.Language.magical);
            }
            if (!MUDString.StringsNotEqual(lang, "goblin"))
            {
                return(Race.Language.goblin);
            }
            if (!MUDString.StringsNotEqual(lang, "god"))
            {
                return(Race.Language.god);
            }
            if (!MUDString.StringsNotEqual(lang, "halfling"))
            {
                return(Race.Language.halfling);
            }
            if (!MUDString.StringsNotEqual(lang, "githyanki"))
            {
                return(Race.Language.githyanki);
            }
            if (!MUDString.StringsNotEqual(lang, "drow"))
            {
                return(Race.Language.drow);
            }
            if (!MUDString.StringsNotEqual(lang, "kobold"))
            {
                return(Race.Language.kobold);
            }
            if (!MUDString.StringsNotEqual(lang, "gnome"))
            {
                return(Race.Language.gnome);
            }
            if (!MUDString.StringsNotEqual(lang, "animal"))
            {
                return(Race.Language.animal);
            }
            if (!MUDString.StringsNotEqual(lang, "duergar"))
            {
                return(Race.Language.duergar);
            }
            if (!MUDString.StringsNotEqual(lang, "githzerai"))
            {
                return(Race.Language.githzerai);
            }
            if (!MUDString.StringsNotEqual(lang, "gnoll"))
            {
                return(Race.Language.gnoll);
            }
            if (!MUDString.StringsNotEqual(lang, "rakshasa"))
            {
                return(Race.Language.rakshasa);
            }
            if (!MUDString.StringsNotEqual(lang, "minotaur"))
            {
                return(Race.Language.minotaur);
            }
            if (!MUDString.StringsNotEqual(lang, "illithid"))
            {
                return(Race.Language.illithid);
            }
            if (!MUDString.StringsNotEqual(lang, "barbarian"))
            {
                return(Race.Language.barbarian);
            }

            Log.Error("StringLookup.LanguageLookup: Language string not found.", 0);

            return(0);
        }
Exemple #21
0
        /// <summary>
        /// Look a damage type based on its name.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static Race.DamageType DamageTypeLookup(string text)
        {
            int value = 0;

            if (!MUDString.StringsNotEqual(text, "none"))
            {
                return(0);
            }

            if (MUDString.NameContainedIn("fire", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.fire);
            }
            if (MUDString.NameContainedIn("cold", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.cold);
            }
            if (MUDString.NameContainedIn("electricity", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.electricity);
            }
            if (MUDString.NameContainedIn("energy", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.energy);
            }
            if (MUDString.NameContainedIn("acid", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.acid);
            }
            if (MUDString.NameContainedIn("poison", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.poison);
            }
            if (MUDString.NameContainedIn("charm", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.charm);
            }
            if (MUDString.NameContainedIn("mental", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.mental);
            }
            if (MUDString.NameContainedIn("white_mana", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.whiteMana);
            }
            if (MUDString.NameContainedIn("black_mana", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.blackMana);
            }
            if (MUDString.NameContainedIn("disease", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.disease);
            }
            if (MUDString.NameContainedIn("drowning", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.drowning);
            }
            if (MUDString.NameContainedIn("light", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.light);
            }
            if (MUDString.NameContainedIn("sound", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.sound);
            }
            if (MUDString.NameContainedIn("magic", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.magic);
            }
            if (MUDString.NameContainedIn("nonmagic", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.nonmagic);
            }
            if (MUDString.NameContainedIn("silver", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.silver);
            }
            if (MUDString.NameContainedIn("iron", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.iron);
            }
            if (MUDString.NameContainedIn("wood", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.wood);
            }
            if (MUDString.NameContainedIn("weapon", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.weapon);
            }
            if (MUDString.NameContainedIn("bash", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.bash);
            }
            if (MUDString.NameContainedIn("pierce", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.pierce);
            }
            if (MUDString.NameContainedIn("slash", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.slash);
            }
            if (MUDString.NameContainedIn("gas", text))
            {
                Macros.SetBit(ref value, (int)Race.DamageType.gas);
            }

            return((Race.DamageType)value);
        }
Exemple #22
0
        /// <summary>
        /// Convert parts string to a value
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static Race.Parts PartsLookup(string text)
        {
            int part = 0;

            if (!MUDString.StringsNotEqual(text, "none"))
            {
                return(Race.Parts.none);
            }

            if (MUDString.NameContainedIn("skull", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.skull);
            }
            if (MUDString.NameContainedIn("arms", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.arms);
            }
            if (MUDString.NameContainedIn("legs", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.legs);
            }
            if (MUDString.NameContainedIn("heart", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.heart);
            }
            if (MUDString.NameContainedIn("brains", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.brains);
            }
            if (MUDString.NameContainedIn("guts", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.guts);
            }
            if (MUDString.NameContainedIn("hands", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.hands);
            }
            if (MUDString.NameContainedIn("feet", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.feet);
            }
            if (MUDString.NameContainedIn("fingers", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.fingers);
            }
            if (MUDString.NameContainedIn("ears", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.ears);
            }
            if (MUDString.NameContainedIn("eyes", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.eyes);
            }
            if (MUDString.NameContainedIn("hooves", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.hooves);
            }
            if (MUDString.NameContainedIn("tongue", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.tongue);
            }
            if (MUDString.NameContainedIn("eyestalks", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.eyestalks);
            }
            if (MUDString.NameContainedIn("tentacles", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.tentacles);
            }
            if (MUDString.NameContainedIn("fins", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.fins);
            }
            if (MUDString.NameContainedIn("wings", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.wings);
            }
            if (MUDString.NameContainedIn("tail", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.tail);
            }
            if (MUDString.NameContainedIn("claws", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.claws);
            }
            if (MUDString.NameContainedIn("fangs", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.fangs);
            }
            if (MUDString.NameContainedIn("horns", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.horns);
            }
            if (MUDString.NameContainedIn("scales", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.scales);
            }
            if (MUDString.NameContainedIn("tusks", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.tusks);
            }
            if (MUDString.NameContainedIn("bark", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.bark);
            }
            if (MUDString.NameContainedIn("leaves", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.leaves);
            }
            if (MUDString.NameContainedIn("branches", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.branches);
            }
            if (MUDString.NameContainedIn("trunk", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.trunk);
            }
            if (MUDString.NameContainedIn("scalp", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.scalp);
            }
            if (MUDString.NameContainedIn("cranial_chitin", text))
            {
                Macros.SetBit(ref part, (int)Race.Parts.cranial_chitin);
            }

            return((Race.Parts)part);
        }
Exemple #23
0
        /// <summary>
        /// Get the language ID from a language name.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="lang"></param>
        /// <returns></returns>
        public static Race.Language LanguageLookup(CharData ch, string lang)
        {
            if (ch == null)
            {
                return(0);
            }

            if (ch.IsImmortal() && MUDString.IsNumber(lang))
            {
                int ilang;
                Int32.TryParse(lang, out ilang);
                if (ilang >= 0 && ilang < Race.MAX_LANG)
                {
                    return((Race.Language)ilang);
                }
                string buf = String.Format("{0} is not within valid language range(0 to {1})!\r\n", ilang, (Race.MAX_LANG - 1));
                ch.SendText(buf);
                return(Race.Language.unknown);
            }

            if (!MUDString.IsPrefixOf(lang, "unknown"))
            {
                return(Race.Language.unknown);
            }
            if (!MUDString.IsPrefixOf(lang, "common"))
            {
                return(Race.Language.common);
            }
            if (!MUDString.IsPrefixOf(lang, "elven"))
            {
                return(Race.Language.elven);
            }
            if (!MUDString.IsPrefixOf(lang, "dwarven"))
            {
                return(Race.Language.dwarven);
            }
            if (!MUDString.IsPrefixOf(lang, "centaur"))
            {
                return(Race.Language.centaur);
            }
            if (!MUDString.IsPrefixOf(lang, "ogre"))
            {
                return(Race.Language.ogre);
            }
            if (!MUDString.IsPrefixOf(lang, "orc"))
            {
                return(Race.Language.orcish);
            }
            if (!MUDString.IsPrefixOf(lang, "troll"))
            {
                return(Race.Language.troll);
            }
            if (!MUDString.IsPrefixOf(lang, "aquatic elf"))
            {
                return(Race.Language.aquaticelf);
            }
            if (!MUDString.IsPrefixOf(lang, "neogi"))
            {
                return(Race.Language.neogi);
            }
            if (!MUDString.IsPrefixOf(lang, "thri-kreen"))
            {
                return(Race.Language.thri);
            }
            if (!MUDString.IsPrefixOf(lang, "dragon"))
            {
                return(Race.Language.dragon);
            }
            if (!MUDString.IsPrefixOf(lang, "magic"))
            {
                return(Race.Language.magical);
            }
            if (!MUDString.IsPrefixOf(lang, "goblin"))
            {
                return(Race.Language.goblin);
            }
            if (!MUDString.IsPrefixOf(lang, "god"))
            {
                return(Race.Language.god);
            }
            if (!MUDString.IsPrefixOf(lang, "halfling"))
            {
                return(Race.Language.halfling);
            }
            if (!MUDString.IsPrefixOf(lang, "githyanki"))
            {
                return(Race.Language.githyanki);
            }
            if (!MUDString.IsPrefixOf(lang, "drow"))
            {
                return(Race.Language.drow);
            }
            if (!MUDString.IsPrefixOf(lang, "kobold"))
            {
                return(Race.Language.kobold);
            }
            if (!MUDString.IsPrefixOf(lang, "gnome"))
            {
                return(Race.Language.gnome);
            }
            if (!MUDString.IsPrefixOf(lang, "animal"))
            {
                return(Race.Language.animal);
            }
            if (!MUDString.IsPrefixOf(lang, "duergar"))
            {
                return(Race.Language.duergar);
            }
            if (!MUDString.IsPrefixOf(lang, "githzerai"))
            {
                return(Race.Language.githzerai);
            }
            if (!MUDString.IsPrefixOf(lang, "gnoll"))
            {
                return(Race.Language.gnoll);
            }
            if (!MUDString.IsPrefixOf(lang, "rakshasa"))
            {
                return(Race.Language.rakshasa);
            }
            if (!MUDString.IsPrefixOf(lang, "minotaur"))
            {
                return(Race.Language.minotaur);
            }
            if (!MUDString.IsPrefixOf(lang, "illithid"))
            {
                return(Race.Language.illithid);
            }
            if (!MUDString.IsPrefixOf(lang, "barbarian"))
            {
                return(Race.Language.barbarian);
            }

            return(Race.Language.unknown);
        }
Exemple #24
0
        /// <summary>
        /// Shows a list of objects to the character.  Can combine duplicate items.
        /// </summary>
        /// <param name="list"></param>
        /// <param name="ch"></param>
        /// <param name="shortDisplay"></param>
        /// <param name="showNothing"></param>
        public static void ShowListToCharacter(List <Object> list, CharData ch, bool shortDisplay, bool showNothing)
        {
            // This is called every time someone looks at the room.  If there are no mobs, objects, etc. we skip out.
            if (!ch || ch.Socket == null)
            {
                return;
            }

            string text     = String.Empty; // The output buffer.
            int    iterator = 0;

            string[] showStrings = new string[list.Count];
            int[]    showCounts  = new int[list.Count];
            int      numShown    = 0;

            // Format the list of objects.
            foreach (Object obj in list)
            {
                if (!obj.CarriedBy && !obj.InObject)
                {
                    if (ch.FlightLevel != obj.FlyLevel && obj.ItemType != ObjTemplate.ObjectType.wall)
                    {
                        continue;
                    }
                }
                // Skip no-show objects if not immortal.
                if (!obj.HasFlag(ObjTemplate.ITEM_NOSHOW) || (obj.HasFlag(ObjTemplate.ITEM_NOSHOW) && ch.IsImmortal()))
                {
                    if (obj.WearLocation == ObjTemplate.WearLocation.none && CharData.CanSeeObj(ch, obj))
                    {
                        string pstrShow = FormatObjectToCharacter(obj, ch, shortDisplay); // Temporary string containing current line.
                        bool   fCombine = false;

                        if (ch.IsNPC() || ch.HasActionBit(PC.PLAYER_COMBINE))
                        {
                            // Look for duplicates, case sensitive.
                            // Matches tend to be near end so run loop backwords.
                            for (iterator = numShown - 1; iterator >= 0; iterator--)
                            {
                                if (!MUDString.StringsNotEqual(showStrings[iterator], pstrShow))
                                {
                                    ++showCounts[iterator];
                                    fCombine = true;
                                    break;
                                }
                            }
                        }

                        // Couldn't combine, or didn't want to.
                        if (!fCombine)
                        {
                            showStrings[numShown] = pstrShow;
                            showCounts[numShown]  = 1;
                            ++numShown;
                        }
                    }
                }
            }

            // Output the formatted list.
            for (iterator = 0; iterator < numShown; ++iterator)
            {
                if (ch.IsNPC() || ch.HasActionBit(PC.PLAYER_COMBINE))
                {
                    if (showCounts[iterator] != 1)
                    {
                        text += "(" + showCounts[iterator] + ") ";
                    }
                }
                text += showStrings[iterator] + "\r\n";
            }

            if (showNothing && numShown == 0)
            {
                if (ch.IsNPC() || ch.HasActionBit(PC.PLAYER_COMBINE))
                {
                    text += "     ";
                }
                text += "Nothing.\r\n";
            }

            ch.SendText(text);
            return;
        }
Exemple #25
0
        /// <summary>
        /// Converts spell school string to a value.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static TargetType TargetLookup(string text)
        {
            if (!MUDString.StringsNotEqual(text, "none"))
            {
                Log.Error("Spell _targetType type set to 'none'.  Please correct this.", 0);
                return(0);
            }

            if (!MUDString.StringsNotEqual("TargetType.none", text))
            {
                return(TargetType.none);
            }
            if (!MUDString.StringsNotEqual("TargetType.singleCharacterOffensive", text))
            {
                return(TargetType.singleCharacterOffensive);
            }
            if (!MUDString.StringsNotEqual("TargetType.singleCharacterDefensive", text))
            {
                return(TargetType.singleCharacterDefensive);
            }
            if (!MUDString.StringsNotEqual("TargetType.self", text))
            {
                return(TargetType.self);
            }
            if (!MUDString.StringsNotEqual("TargetType.objectInInventory", text))
            {
                return(TargetType.objectInInventory);
            }
            if (!MUDString.StringsNotEqual("TargetType.objectInRoom", text))
            {
                return(TargetType.objectInRoom);
            }
            if (!MUDString.StringsNotEqual("TargetType.trap", text))
            {
                return(TargetType.trap);
            }
            if (!MUDString.StringsNotEqual("TargetType.objectCorpse", text))
            {
                return(TargetType.objectCorpse);
            }
            if (!MUDString.StringsNotEqual("TargetType.objectOrCharacter", text))
            {
                return(TargetType.objectOrCharacter);
            }
            if (!MUDString.StringsNotEqual("TargetType.singleCharacterRanged", text))
            {
                return(TargetType.singleCharacterRanged);
            }
            if (!MUDString.StringsNotEqual("TargetType.singleCharacterWorld", text))
            {
                return(TargetType.singleCharacterWorld);
            }
            if (!MUDString.StringsNotEqual("TargetType.ritual", text))
            {
                return(TargetType.ritual);
            }
            if (!MUDString.StringsNotEqual("TargetType.multipleCharacterOffensive", text))
            {
                return(TargetType.multipleCharacterOffensive);
            }

            Log.Error("StringLookup.TargetLookup: Target type not found:", 0);
            Log.Trace(text);

            return(0);
        }
Exemple #26
0
        /// <summary>
        /// Converts spell mana string to a value.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static int ManaLookup(string text)
        {
            int mana = 0;

            if (!MUDString.StringsNotEqual(text, "none"))
            {
                return(0);
            }

            if (!MUDString.StringsNotEqual(text, "any"))
            {
                return(-1);
            }

            if (MUDString.NameContainedIn("earth", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_EARTH);
            }
            if (MUDString.NameContainedIn("air", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_AIR);
            }
            if (MUDString.NameContainedIn("fire", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_FIRE);
            }
            if (MUDString.NameContainedIn("water", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_WATER);
            }
            if (MUDString.NameContainedIn("time", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_TIME);
            }
            if (MUDString.NameContainedIn("horn", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_HORN);
            }
            if (MUDString.NameContainedIn("flute", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_FLUTE);
            }
            if (MUDString.NameContainedIn("mandolin", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_MANDOLIN);
            }
            if (MUDString.NameContainedIn("lyre", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_LYRE);
            }
            if (MUDString.NameContainedIn("drums", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_DRUMS);
            }
            if (MUDString.NameContainedIn("harp", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_HARP);
            }
            if (MUDString.NameContainedIn("pipes", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_PIPES);
            }
            if (MUDString.NameContainedIn("fiddle", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_FIDDLE);
            }
            if (MUDString.NameContainedIn("dulcimer", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_DULCIMER);
            }
            if (MUDString.NameContainedIn("instrument", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_INSTRUMENT);
            }
            if (MUDString.NameContainedIn("voice", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_VOICE);
            }
            if (MUDString.NameContainedIn("dance", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_DANCE);
            }
            if (MUDString.NameContainedIn("instr_augment", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_INSTR_AUGMENT);
            }
            if (MUDString.NameContainedIn("dance_augment", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_DANCE_AUGMENT);
            }
            if (MUDString.NameContainedIn("voice_augment", text))
            {
                Macros.SetBit(ref mana, Magic.MANA_VOICE_AUGMENT);
            }

            if (mana == 0)
            {
                Log.Error("Mana keyword not found:", 0);
                Log.Trace(text);
            }

            return(mana);
        }
Exemple #27
0
        /// <summary>
        /// Converts spell school string to a value.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static int SchoolLookup(string text)
        {
            int school = 0;

            if (!MUDString.StringsNotEqual(text, "none"))
            {
                return(0);
            }

            if (MUDString.NameContainedIn("abjuration", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_ABJURATION);
            }
            if (MUDString.NameContainedIn("alteration", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_ALTERATION);
            }
            if (MUDString.NameContainedIn("conjuration", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_CONJURATION);
            }
            if (MUDString.NameContainedIn("summoning", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_SUMMONING);
            }
            if (MUDString.NameContainedIn("illusion", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_ILLUSION);
            }
            if (MUDString.NameContainedIn("phantasm", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_PHANTASM);
            }
            if (MUDString.NameContainedIn("invocation", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_INVOCATION);
            }
            if (MUDString.NameContainedIn("evocation", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_EVOCATION);
            }
            if (MUDString.NameContainedIn("enchantment", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_ENCHANTMENT);
            }
            if (MUDString.NameContainedIn("charm", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_CHARM);
            }
            if (MUDString.NameContainedIn("divination", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_DIVINATION);
            }
            if (MUDString.NameContainedIn("necromancy", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_NECROMANCY);
            }
            if (MUDString.NameContainedIn("martial_offensive", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_OFFENSIVE);
            }
            if (MUDString.NameContainedIn("martial_defensive", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_DEFENSIVE);
            }
            if (MUDString.NameContainedIn("skill_stealth", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_STEALTH);
            }
            if (MUDString.NameContainedIn("skill_survival", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_SURVIVAL);
            }
            if (MUDString.NameContainedIn("sham_elemental", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_ELEMENTAL);
            }
            if (MUDString.NameContainedIn("sham_spiritual", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_SPIRITUAL);
            }
            if (MUDString.NameContainedIn("sham_animal", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_ANIMAL);
            }
            if (MUDString.NameContainedIn("instr_horn", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_HORN);
            }
            if (MUDString.NameContainedIn("instr_flute", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_FLUTE);
            }
            if (MUDString.NameContainedIn("instr_mandolin", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_MANDOLIN);
            }
            if (MUDString.NameContainedIn("instr_lyre", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_LYRE);
            }
            if (MUDString.NameContainedIn("instr_drums", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_DRUMS);
            }
            if (MUDString.NameContainedIn("instr_harp", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_HARP);
            }
            if (MUDString.NameContainedIn("instr_pipes", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_PIPES);
            }
            if (MUDString.NameContainedIn("instr_fiddle", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_FIDDLE);
            }
            if (MUDString.NameContainedIn("instr_dulcimer", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_DULCIMER);
            }
            if (MUDString.NameContainedIn("chronomancy", text))
            {
                Macros.SetBit(ref school, Magic.SCHOOL_CHRONOMANCY);
            }

            if (school == 0)
            {
                Log.Error("School/realm keyword not found:", 0);
                Log.Trace(text);
            }

            return(school);
        }