Exemplo n.º 1
0
        private static ReturnTypes CastIgnoreTargetSpell(SkillData skill, int level, CharacterInstance ch, object vo)
        {
            if (skill.Flags.IsSet(SkillFlags.Area) &&
                ((Macros.SPELL_ACTION(skill) == (int)SpellActTypes.Destroy &&
                  Macros.SPELL_CLASS(skill) == (int)SpellClassTypes.Life) ||
                 (Macros.SPELL_ACTION(skill) == (int)SpellActTypes.Create &&
                  Macros.SPELL_CLASS(skill) == (int)SpellClassTypes.Death)))
            {
                return(AreaAttack.spell_area_attack((int)skill.ID, level, ch, vo));
            }

            if (Macros.SPELL_ACTION(skill) == (int)SpellActTypes.Create)
            {
                if (skill.Flags.IsSet(SkillFlags.Object))
                {
                    return(CreateObject.spell_create_obj((int)skill.ID, level, ch, vo));
                }
                if (Macros.SPELL_CLASS(skill) == (int)SpellClassTypes.Life)
                {
                    return(CreateMob.spell_create_mob((int)skill.ID, level, ch, vo));
                }
            }

            if (skill.Flags.IsSet(SkillFlags.Distant))
            {
                var victim = ch.GetCharacterInWorld(Cast.TargetName);
                if (victim != null && !victim.CurrentRoom.Flags.IsSet(RoomFlags.NoAstral) &&
                    skill.Flags.IsSet(SkillFlags.Character))
                {
                    return(Affect.spell_affect((int)skill.ID, level, ch, victim));
                }
            }

            if (skill.Flags.IsSet(SkillFlags.Character))
            {
                var victim = ch.GetCharacterInWorld(Cast.TargetName);
                if (victim != null)
                {
                    return(Affect.spell_affect((int)skill.ID, level, ch, victim));
                }
            }

            if (skill.range > 0 &&
                ((Macros.SPELL_ACTION(skill) == (int)SpellActTypes.Destroy &&
                  Macros.SPELL_CLASS(skill) == (int)SpellClassTypes.Life) ||
                 (Macros.SPELL_ACTION(skill) == (int)SpellActTypes.Create &&
                  Macros.SPELL_CLASS(skill) == (int)SpellClassTypes.Death)))
            {
                return(skills.ranged_attack(ch, Cast.RangedTargetName, null, null, (int)skill.ID, skill.range));
            }

            return(Affect.spell_affect((int)skill.ID, level, ch, vo));
        }
Exemplo n.º 2
0
        public static void do_bestowarea(CharacterInstance ch, string argument)
        {
            ch.SetColor(ATTypes.AT_IMMORT);

            if (string.IsNullOrEmpty(argument))
            {
                ch.SendTo("Syntax:");
                ch.SendTo("bestowarea <victim> <filename>.are");
                ch.SendTo("bestowarea <victim> none (removes bestowed areas)");
                ch.SendTo("bestowarea <victim> list (lists bestowed areas)");
                ch.SendTo("bestowarea <victim>      (lists bestowed areas)");
                return;
            }

            var firstArg = argument.FirstWord();

            var victim = ch.GetCharacterInWorld(firstArg);

            if (CheckFunctions.CheckIfNullObject(ch, victim, "They aren't here."))
            {
                return;
            }
            if (CheckFunctions.CheckIfNpc(ch, victim, "You can't give special abilities to a mob!"))
            {
                return;
            }
            if (!victim.IsImmortal())
            {
                ch.SendTo("They aren't an immortal.");
                return;
            }

            var secondArg = argument.SecondWord();

            if (string.IsNullOrEmpty(secondArg) || secondArg.EqualsIgnoreCase("list"))
            {
                var areaNames = ((PlayerInstance)victim).PlayerData.Bestowments.Where(x => x.EndsWith(".are"));
                ch.SendTo($"Bestowed Areas: {string.Join(", ", areaNames)}");
                return;
            }

            if (secondArg.EqualsIgnoreCase("none"))
            {
                ((PlayerInstance)victim).PlayerData.Bestowments = ((PlayerInstance)victim).PlayerData.Bestowments.Where(x => !x.EndsWith(".are")).ToList();
                ch.SendTo("Done.");
                return;
            }

            if (!secondArg.EndsWith(".are"))
            {
                ch.SendTo("You can only bestow an area name.");
                ch.SendTo("e.g. bestow joe sam.are");
                return;
            }

            ((PlayerInstance)victim).PlayerData.Bestowments.Add(secondArg);
            victim.SetColor(ATTypes.AT_IMMORT);
            victim.SendTo($"{ch.Name} has bestowed on you the area: {secondArg}");
            ch.SendTo("Done.");
        }
Exemplo n.º 3
0
        public static void do_track(CharacterInstance ch, string argument)
        {
            var skill = RepositoryManager.Instance.GetEntity <SkillData>("track");

            if (CheckFunctions.CheckIfTrue(ch, !ch.IsNpc() && ((PlayerInstance)ch).PlayerData.GetSkillMastery(skill.ID) <= 0,
                                           "You do not know of this skill yet."))
            {
                return;
            }

            var arg = argument.FirstWord();

            if (CheckFunctions.CheckIfEmptyString(ch, arg, "Whom are you trying to track?"))
            {
                return;
            }

            Macros.WAIT_STATE(ch, skill.Rounds);

            var victim = ch.GetCharacterInWorld(arg);

            if (CheckFunctions.CheckIfNullObject(ch, victim, "You can't find a trail of anyone like that."))
            {
                return;
            }
        }
Exemplo n.º 4
0
        public static ReturnTypes spell_astral_walk(int sn, int level, CharacterInstance ch, object vo)
        {
            var skill  = RepositoryManager.Instance.GetEntity <SkillData>(sn);
            var victim = ch.GetCharacterInWorld(Cast.TargetName);

            if (CheckFunctions.CheckIfTrueCasting(victim == null ||
                                                  !ch.CanAstral(victim) ||
                                                  !victim.CurrentRoom.Area.IsInHardRange(ch), skill, ch,
                                                  CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }


            if (!string.IsNullOrEmpty(skill.HitCharacterMessage))
            {
                comm.act(ATTypes.AT_MAGIC, skill.HitCharacterMessage, ch, null, victim, ToTypes.Character);
            }
            if (!string.IsNullOrEmpty(skill.HitVictimMessage))
            {
                comm.act(ATTypes.AT_MAGIC, skill.HitVictimMessage, ch, null, victim, ToTypes.Victim);
            }

            if (!string.IsNullOrEmpty(skill.HitRoomMessage))
            {
                comm.act(ATTypes.AT_MAGIC, skill.HitRoomMessage, ch, null, victim, ToTypes.NotVictim);
            }
            else
            {
                comm.act(ATTypes.AT_MAGIC, "$n disappears in a flash of light!", ch, null, victim, ToTypes.Room);
            }

            ch.CurrentRoom.RemoveFrom(ch);
            victim.CurrentRoom.AddTo(ch);

            if (!string.IsNullOrEmpty(skill.HitDestinationMessage))
            {
                comm.act(ATTypes.AT_MAGIC, skill.HitDestinationMessage, ch, null, victim, ToTypes.NotVictim);
            }
            else
            {
                comm.act(ATTypes.AT_MAGIC, "$n appears in a flash of light!", ch, null, victim, ToTypes.Room);
            }

            Look.do_look(ch, "auto");

            return(ReturnTypes.None);
        }
Exemplo n.º 5
0
        private static void ViewIndividualPlayer(CharacterInstance ch, string firstArg)
        {
            var victim = ch.GetCharacterInWorld(firstArg);

            if (victim?.CurrentRoom != null &&
                victim.CurrentRoom.Area == ch.CurrentRoom.Area &&
                !victim.IsAffected(AffectedByTypes.Hide) &&
                !victim.IsAffected(AffectedByTypes.Sneak) &&
                ch.CanSee(victim))
            {
                ch.PagerPrintf("{0} {1}", Macros.PERS(victim, ch).PadRight(28, ' '), victim.CurrentRoom.Name);
                return;
            }

            comm.act(ATTypes.AT_PLAIN, "You didn't find any $T.", ch, null, firstArg, ToTypes.Character);
        }
Exemplo n.º 6
0
        public static RoomTemplate find_location(CharacterInstance ch, string arg)
        {
            if (arg.IsNumber())
            {
                return(RepositoryManager.Instance.ROOMS.CastAs <Repository <long, RoomTemplate> >().Get(arg.ToInt32()));
            }
            if (arg.Equals("pk"))
            {
                return(RepositoryManager.Instance.ROOMS.CastAs <Repository <long, RoomTemplate> >().Get(db.LastPKRoom));
            }

            var victim = ch.GetCharacterInWorld(arg);

            if (victim != null)
            {
                return(victim.CurrentRoom);
            }

            var obj = ch.GetObjectInWorld(arg);

            return(obj?.InRoom);
        }
Exemplo n.º 7
0
        public static ReturnTypes spell_solar_flight(int sn, int level, CharacterInstance ch, object vo)
        {
            var skill = RepositoryManager.Instance.GetEntity <SkillData>(sn);
            var cell  = WeatherManager.Instance.GetWeather(ch.CurrentRoom.Area);

            var victim = ch.GetCharacterInWorld(Cast.TargetName);

            var lvl = GetModdedLevel(level);

            if (CheckFunctions.CheckIfTrueCasting(victim == null || victim == ch, skill, ch, CastingFunctionType.Failed,
                                                  victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(GameManager.Instance.GameTime.Hour > 18 ||
                                                  GameManager.Instance.GameTime.Hour < 8, skill, ch, CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfNullObjectCasting(victim.CurrentRoom, skill, ch, CastingFunctionType.Failed,
                                                        victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(!ch.IsOutside() && !victim.IsOutside(), skill, ch,
                                                  CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(cell.CloudCover >= 20, skill, ch, CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(AreInvalidRoomFlagsSet(victim.CurrentRoom), skill, ch,
                                                  CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(ch.CurrentRoom.Flags.IsSet(RoomFlags.NoRecall), skill, ch,
                                                  CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(victim.Level >= lvl, skill, ch, CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(victim.CanPKill() && !ch.IsNpc() && !ch.IsPKill(), skill, ch,
                                                  CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(victim.IsNpc() &&
                                                  victim.SavingThrows.CheckSaveVsSpellStaff(level, victim), skill, ch, CastingFunctionType.Failed,
                                                  victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(!victim.CurrentRoom.Area.IsInHardRange(ch), skill, ch,
                                                  CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }
            if (CheckFunctions.CheckIfTrueCasting(
                    victim.CurrentRoom.Area.Flags.IsSet(AreaFlags.NoPlayerVsPlayer) && ch.IsPKill(), skill, ch,
                    CastingFunctionType.Failed, victim))
            {
                return(ReturnTypes.SpellFailed);
            }

            comm.act(ATTypes.AT_MAGIC, "$n disappears in a blinding flash of light!", ch, null, null, ToTypes.Room);
            ch.CurrentRoom.RemoveFrom(ch);
            victim.CurrentRoom.AddTo(ch);
            comm.act(ATTypes.AT_MAGIC, "$n appears in a blinding flash of light!", ch, null, null, ToTypes.Room);
            Look.do_look(ch, "auto");
            return(ReturnTypes.None);
        }
Exemplo n.º 8
0
        public static void do_bodybag(CharacterInstance ch, string argument)
        {
            if (CheckFunctions.CheckIfEmptyString(ch, argument, "&PSyntax: bodybag <character> | bodybag <character> yes/bag/now"))
            {
                return;
            }

            var firstWord  = $"the corpse of {argument.FirstWord()}";
            var secondWord = argument.SecondWord();

            if (!string.IsNullOrEmpty(secondWord) && !(secondWord.EqualsIgnoreCase("yes") ||
                                                       secondWord.EqualsIgnoreCase("bag") || secondWord.EqualsIgnoreCase("now")))
            {
                ch.SendTo("&PSyntax: bodybag <character> | bodybag <character> yes/bag/now");
                return;
            }

            var bag    = secondWord.EqualsIgnoreCase("yes") || secondWord.EqualsIgnoreCase("bag") || secondWord.EqualsIgnoreCase("now");
            var phrase = bag ? "Retrieving" : "Searching for";

            ch.SendToPagerColor($"&P{phrase} remains of {firstWord.CapitalizeFirst()}");

            var obj = ch.CurrentRoom.Contents.FirstOrDefault(x => x.ItemType == ItemTypes.PlayerCorpse &&
                                                             (x.Name.Equals(firstWord) || x.ShortDescription.ContainsIgnoreCase(firstWord)));

            if (obj == null)
            {
                ch.SendToPagerColor("&PNo corpse was found.");
                return;
            }

            phrase = bag ? "Bagging" : "Corpse";
            var color      = bag ? "&Y" : "&w";
            var clanPhrase = obj.ExtraFlags.IsSet((int)ItemExtraFlags.ClanCorpse) ? "&RPK" : "&R";
            var areaPhrase = $"&PIn: &w{ch.CurrentRoom.Area.Name} &P[&w{ch.CurrentRoom.Area.ID}&P]";

            var timerPhrase = $"&PTimer: ";

            if (obj.Timer < 1)
            {
                timerPhrase += "&w";
            }
            else if (obj.Timer < 5)
            {
                timerPhrase += "&R";
            }
            else if (obj.Timer < 10)
            {
                timerPhrase += "&Y";
            }
            else
            {
                timerPhrase += "&w";
            }
            timerPhrase += obj.Timer.ToString();

            // act_wiz lines 2524-2531
            ch.SendToPagerColor($"&P{phrase}: {color}{firstWord.CapitalizeFirst()} {clanPhrase} {areaPhrase} {timerPhrase}");

            if (bag)
            {
                ch.CurrentRoom.Contents.Remove(obj);
                ch.Carrying.Add(obj);
                obj.Timer = -1;
                // TODO save_char_obj(ch)
            }

            var owner = ch.GetCharacterInWorld(obj.Owner);

            if (owner == null)
            {
                ch.SendToPagerColor($"&P{obj.Owner.CapitalizeFirst()} is not currently online.");
                return;
            }

            if (owner.IsNpc())
            {
                return;
            }

            var ownerPc = (PlayerInstance)owner;

            if (ownerPc.PlayerData.CurrentDeity != null)
            {
                ch.SendToPagerColor($"&P{owner.Name} ({owner.Level}) has {ownerPc.PlayerData.Favor} favor with " +
                                    $"{ownerPc.PlayerData.CurrentDeity.Name} (needed to supplicate: {ownerPc.PlayerData.CurrentDeity.SupplicateCorpseCost}");
                return;
            }

            ch.SendToPagerColor($"&P{owner.Name} ({owner.Level}) has no deity");
        }
Exemplo n.º 9
0
        public static void do_tell(CharacterInstance ch, string argument)
        {
#if !SCRAMBLE
            var speaking = -1;

            /*foreach (int key in GameConstants.LanguageTable.Keys
             *  .Where(key => (key & ch.Speaking) > 0))
             * {
             *  speaking = key;
             *  break;
             * }*/
#endif

            ch.Deaf.RemoveBit(ChannelTypes.Tells);
            if (ch.CurrentRoom.Flags.IsSet(RoomFlags.Silence))
            {
                ch.SendTo("You can't do that here.\r\n");
                return;
            }

            if (!ch.IsNpc() &&
                (ch.Act.IsSet((int)PlayerFlags.Silence) || ch.Act.IsSet((int)PlayerFlags.NoTell)))
            {
                ch.SendTo("You can't do that.\r\n");
                return;
            }

            var firstArgument  = argument.FirstWord();
            var argumentString = argument.RemoveWord(1);
            if (string.IsNullOrWhiteSpace(argumentString))
            {
                ch.SendTo("Tell whom what?\r\n");
                return;
            }

            var victim = ch.GetCharacterInWorld(firstArgument);
            if (victim == null ||
                (victim.IsNpc() && victim.CurrentRoom != ch.CurrentRoom) ||
                (!ch.IsNotAuthorized() && victim.IsNotAuthorized() && !ch.IsImmortal()))
            {
                ch.SendTo("They aren't here.\r\n");
                return;
            }

            if (ch == victim)
            {
                ch.SendTo("You have a nice little chat with yourself.\r\n");
                return;
            }

            if (ch.IsNotAuthorized() && !victim.IsNotAuthorized() && !victim.IsImmortal())
            {
                ch.SendTo("They can't hear you because you are not authorized.\r\n");
                return;
            }

            if (!victim.IsNpc() && victim.Switched != null &&
                (ch.Trust > LevelConstants.AvatarLevel) &&
                !victim.Switched.IsAffected(AffectedByTypes.Possess))
            {
                ch.SendTo("That player is switched.\r\n");
                return;
            }

            CharacterInstance switchedVictim = null;
            if (!victim.IsNpc() && victim.Switched != null &&
                victim.Switched.IsAffected(AffectedByTypes.Possess))
            {
                switchedVictim = victim.Switched;
            }
            else if (!victim.IsNpc() && ((PlayerInstance)victim).Descriptor == null)
            {
                ch.SendTo("That player is link-dead.\r\n");
                return;
            }

            if (!victim.IsNpc() && victim.Act.IsSet((int)PlayerFlags.AwayFromKeyboard))
            {
                ch.SendTo("That player is afk.");
                return;
            }

            if (victim.Deaf.IsSet((int)ChannelTypes.Tells) &&
                (!ch.IsImmortal() || ch.Trust < victim.Trust))
            {
                comm.act(ATTypes.AT_PLAIN, "$E has $S tells turned off.", ch, null, victim, ToTypes.Character);
                return;
            }

            if (!victim.IsNpc() && victim.Act.IsSet((int)PlayerFlags.Silence))
            {
                ch.SendTo("That player is silenced. They will receive your message but cannot respond.");
            }

            if (!ch.IsImmortal() && !victim.IsAwake())
            {
                comm.act(ATTypes.AT_PLAIN, "$E is too tired to discuss such matters with you.", ch, null, victim, ToTypes.Character);
                return;
            }

            if (!victim.IsNpc() && victim.CurrentRoom.Flags.IsSet((int)RoomFlags.Silence))
            {
                comm.act(ATTypes.AT_PLAIN, "A magic force prevents your message from being heard.", ch, null, victim, ToTypes.Character);
                return;
            }

            if (((PlayerInstance)victim).Descriptor != null &&
                ((PlayerInstance)victim).Descriptor.ConnectionStatus == ConnectionTypes.Editing &&
                ch.Trust < LevelConstants.GetLevel(ImmortalTypes.God))
            {
                comm.act(ATTypes.AT_PLAIN, "$E is currently in a writing buffer. Please try again later.", ch, null, victim, ToTypes.Character);
                return;
            }

            if (victim.IsIgnoring(ch))
            {
                if (!ch.IsImmortal() || victim.Trust > ch.Trust)
                {
                    ch.SetColor(ATTypes.AT_IGNORE);
                    ch.Printf("%s is ignoring you.\r\n", victim.Name);
                    return;
                }

                victim.SetColor(ATTypes.AT_IGNORE);
                victim.Printf("You attempt to ignore %s, but are unable to do so.\r\n", ch.Name);
            }

            ((PlayerInstance)ch).RetellTo = victim;

            if (!victim.IsNpc() && victim.IsImmortal() &&
                ((PlayerInstance)victim).PlayerData.TellHistory != null &&
                char.IsLetter(ch.IsNpc() ? ch.ShortDescription.ToCharArray()[0] : ch.Name.ToCharArray()[0]))
            {
                var buffer =
                    $"{(ch.IsNpc() ? ch.ShortDescription.CapitalizeFirst() : ch.Name.CapitalizeFirst())} told you '{argumentString}'\r\n";
                ((PlayerInstance)victim).PlayerData.TellHistory.Add(buffer);
            }

            if (switchedVictim != null)
            {
                victim = switchedVictim;
            }

            //MOBTrigger = false;

            comm.act(ATTypes.AT_TELL, "You tell $N '$t'", ch, argumentString, victim, ToTypes.Character);
            var position = victim.CurrentPosition;
            victim.CurrentPosition = PositionTypes.Standing;

            /*if (speaking != -1 && (!ch.IsNpc() || ch.Speaking > 0))
             * {
             *  int speakswell = victim.KnowsLanguage(ch.Speaking, ch).GetLowestOfTwoNumbers(ch.KnowsLanguage(ch.Speaking, victim));
             *  if (speakswell < 85)
             *      comm.act(ATTypes.AT_TELL, "$n tells you '$t'", ch, act_comm.TranslateLanguage(speakswell, argumentString,
             *          GameConstants.LanguageTable[speaking]), victim, ToTypes.Victim);
             *  else
             *      comm.act(ATTypes.AT_TELL, "$n tells you '$t'", ch, argumentString, victim, ToTypes.Victim);
             * }
             * else
             *  comm.act(ATTypes.AT_TELL, "$n tells you '$t'", ch, argumentString, victim, ToTypes.Victim);*/

            //MOBtrigger = true;

            victim.CurrentPosition           = position;
            ((PlayerInstance)victim).ReplyTo = ch;

            if (ch.CurrentRoom.Flags.IsSet((int)RoomFlags.LogSpeech))
            {
                var buffer =
                    $"{(ch.IsNpc() ? ch.ShortDescription : ch.Name)}: {argumentString} (tell to) {(victim.IsNpc() ? victim.ShortDescription : victim.Name)}";
                db.append_to_file(SystemConstants.GetSystemFile(SystemFileTypes.Log), buffer);
            }

            MudProgHandler.ExecuteMobileProg(MudProgTypes.Tell, argumentString, ch);
        }
Exemplo n.º 10
0
        public static void do_bestow(CharacterInstance ch, string argument)
        {
            ch.SetColor(ATTypes.AT_IMMORT);

            var firstArg = argument.FirstWord();

            if (CheckFunctions.CheckIfEmptyString(ch, firstArg, "Bestow whom with what?"))
            {
                return;
            }

            var victim = ch.GetCharacterInWorld(firstArg);

            if (CheckFunctions.CheckIfNullObject(ch, victim, "They aren't here."))
            {
                return;
            }
            if (CheckFunctions.CheckIfNpc(ch, victim, "You can't give special abilities to a mob!"))
            {
                return;
            }
            if (CheckFunctions.CheckIfInsufficientTrust(ch, victim, "You aren't powerful enough..."))
            {
                return;
            }

            if (!((PlayerInstance)victim).PlayerData.Bestowments.Any())
            {
                ((PlayerInstance)victim).PlayerData.Bestowments.Clear();
            }

            var secondArg = argument.SecondWord();

            if (string.IsNullOrEmpty(secondArg) || secondArg.EqualsIgnoreCase("show list"))
            {
                ch.SendTo($"Current bestowed commands on {victim.Name}: {string.Join(", ", ((PlayerInstance)victim).PlayerData.Bestowments)}");
                return;
            }

            if (secondArg.EqualsIgnoreCase("none"))
            {
                ((PlayerInstance)victim).PlayerData.Bestowments.Clear();
                ch.SendTo($"Bestowments removed from {victim.Name}");
                victim.SendTo($"{ch.Name} has removed your bestowed commands.");
                handler.check_switch(victim, false);
                return;
            }

            var allArgsExceptFirst = argument.RemoveWord(0).Split(' ');

            if (!allArgsExceptFirst.Any())
            {
                ch.SendTo("Good job, knucklehead... you just bestowed them with that master command called 'NOTHING!'");
                return;
            }

            foreach (var arg in allArgsExceptFirst)
            {
                var command = CommandManager.Instance.FindCommand(arg);
                if (command == null)
                {
                    ch.SendTo($"No such command as {arg}!");
                    continue;
                }

                if (command.Level > ch.Trust)
                {
                    ch.SendTo($"You can't bestow the {arg} command!");
                    continue;
                }

                if (!((PlayerInstance)victim).PlayerData.Bestowments.Any(x => x.EqualsIgnoreCase(arg)))
                {
                    ((PlayerInstance)victim).PlayerData.Bestowments.Add(command.Name);
                    continue;
                }
            }

            victim.SetColor(ATTypes.AT_IMMORT);
            victim.SendTo($"{ch.Name} has bestowed on you the command(s): {string.Join(", ", allArgsExceptFirst)}");
            ch.SendTo("Done.");
        }
Exemplo n.º 11
0
        public static void do_balzhur(CharacterInstance ch, string argument)
        {
            ch.SetColor(ATTypes.AT_BLOOD);

            var firstArg = argument.FirstWord();

            if (CheckFunctions.CheckIfEmptyString(ch, firstArg, "Who is deserving of such a fate?"))
            {
                return;
            }

            var victim = ch.GetCharacterInWorld(firstArg);

            if (CheckFunctions.CheckIfNullObject(ch, victim, "They aren't currently playing."))
            {
                return;
            }
            if (CheckFunctions.CheckIfNpc(ch, victim, "This will do little good on mobiles."))
            {
                return;
            }
            if (CheckFunctions.CheckIf(ch, () => ch.Trust <= victim.Level || ch == victim, "I wouldn't even think of that if I were you..."))
            {
                return;
            }

            victim.Level = 2;
            victim.Trust = 0;
            // TODO check_switch(victim, true)

            ch.SetColor(ATTypes.AT_WHITE);
            ch.SendTo("You summon the demon Balzhur to wreak your wrath!");
            ch.SendTo("Balzhur sneers at you evilly, then vanishes in a puff of smoke");

            victim.SetColor(ATTypes.AT_IMMORT);
            victim.SendTo("You hear an ungodly sound in the distance that makes your blood run cold!");
            victim.SendTo($"Balzhur screams, 'You are MINE {victim.Name}!!!");

            // echo_to_all(AT_IMMORT, ECHOTAR_ALL)

            victim.Experience      = 2000;
            victim.MaximumHealth   = 10;
            victim.MaximumMana     = 100;
            victim.MaximumMovement = 100;
            ((PlayerInstance)victim).PlayerData.ClearLearnedSkills();
            victim.Practice        = 0;
            victim.CurrentHealth   = victim.MaximumHealth;
            victim.CurrentMana     = victim.MaximumMana;
            victim.CurrentMovement = victim.MaximumMovement;

            //snprintf(buf, MAX_STRING_LENGTH, "%s%s", GOD_DIR, capitalize(victim->name));

            ch.SetColor(ATTypes.AT_RED);

            // TODO act_wiz.c lines 3527 to 3556 (writing it out to data file)

            ((PlayerInstance)victim).AdvanceLevel();
            Help.do_help(victim, "M_BALZHUR_");
            victim.SetColor(ATTypes.AT_WHITE);
            victim.SendTo("You awake after a long period of time...");
            if (victim.Carrying.Any())
            {
                //extract_obj(victim.Carrying.First());
            }
        }