Ejemplo n.º 1
0
        private static bool CastAbortTimer(PlayerInstance ch, string argument)
        {
            var sn = ch.tempnum;

            if (Macros.IS_VALID_SN(sn))
            {
                var skill = RepositoryManager.Instance.GetEntity <SkillData>(sn);
                if (skill == null)
                {
                    ch.SendTo("Something went wrong...");
                    return(false);
                }

                var skillLevel = skill.SkillLevels.ToList()[(int)ch.CurrentClass];
                var mana       = ch.IsNpc() ? 0 : Macros.UMAX(skill.MinimumMana, 100 / (2 + ch.Level - skillLevel));
                var blood      = Macros.UMAX(1, (mana + 4) / 8);

                if (ch.IsVampire())
                {
                    ch.GainCondition(ConditionTypes.Bloodthirsty, -1 * Macros.UMAX(1, blood / 3));
                }
                else if (!ch.IsImmortal())
                {
                    ch.CurrentMana -= mana / 3;
                }
            }

            ch.SetColor(ATTypes.AT_MAGIC);
            ch.SendTo("You stop chanting...");

            return(true);
        }
Ejemplo n.º 2
0
        private static void SupplicateForRecall(PlayerInstance ch, string argument)
        {
            var oldfavor = ch.PlayerData.Favor;

            if (CheckFunctions.CheckIfTrue(ch, ch.PlayerData.Favor < ch.PlayerData.CurrentDeity.SupplicateRecallCost,
                                           "Your favor is inadequate for such a supplication."))
            {
                return;
            }
            if (CheckFunctions.CheckIfSet(ch, ch.CurrentRoom.Flags, RoomFlags.NoSupplicate, "You have been forsaken!"))
            {
                return;
            }
            if (CheckFunctions.CheckIfTrue(ch, ch.HasTimer(TimerTypes.RecentFight) && !ch.IsImmortal(),
                                           "You cannot supplicate recall under adrenaline!"))
            {
                return;
            }

            RoomTemplate location = null;

            if (!ch.IsNpc() && ch.PlayerData.Clan != null)
            {
                location = RepositoryManager.Instance.ROOMS.Get(ch.PlayerData.Clan.RecallRoom);
            }

            if (!ch.IsNpc() && location == null && ch.Level >= 5 && ch.PlayerData.Flags.IsSet(PCFlags.Deadly))
            {
                location = RepositoryManager.Instance.ROOMS.Get(VnumConstants.ROOM_VNUM_DEADLY);
            }

            if (location == null)
            {
                var raceRecallRoom = RepositoryManager.Instance.RACES.Get(ch.CurrentRace.GetValue()).RaceRecallRoom;
                location = RepositoryManager.Instance.ROOMS.Get(raceRecallRoom);
            }

            if (location == null)
            {
                location = RepositoryManager.Instance.ROOMS.Get(VnumConstants.ROOM_VNUM_TEMPLE);
            }

            if (CheckFunctions.CheckIfNullObject(ch, location, "You are completely lost."))
            {
                return;
            }

            comm.act(ATTypes.AT_MAGIC, "$n disappears in a column of divine power.", ch, null, null, ToTypes.Room);

            var oldRoom = ch.CurrentRoom;

            oldRoom.RemoveFrom(ch);
            location.AddTo(ch);

            if (ch.CurrentMount != null)
            {
                oldRoom.RemoveFrom(ch.CurrentMount);
                location.AddTo(ch.CurrentMount);
            }

            comm.act(ATTypes.AT_MAGIC, "$n appears in the room from a column of divine power.", ch, null, null, ToTypes.Room);

            Look.do_look(ch, "auto");
            ch.PlayerData.Favor -= ch.PlayerData.CurrentDeity.SupplicateRecallCost;

            if (ch.PlayerData.Favor < ch.PlayerData.CurrentDeity.SusceptNum)
            {
                ch.Susceptibility.SetBit(ch.PlayerData.CurrentDeity.Suscept);
            }

            if ((oldfavor > ch.PlayerData.CurrentDeity.AffectedNum &&
                 ch.PlayerData.Favor <= ch.PlayerData.CurrentDeity.AffectedNum) ||
                (oldfavor > ch.PlayerData.CurrentDeity.ElementNum &&
                 ch.PlayerData.Favor <= ch.PlayerData.CurrentDeity.ElementNum) ||
                (oldfavor < ch.PlayerData.CurrentDeity.SusceptNum &&
                 ch.PlayerData.Favor >= ch.PlayerData.CurrentDeity.SusceptNum))
            {
                ch.update_aris();
            }
        }
Ejemplo n.º 3
0
        public static void show_char_to_char_1(CharacterInstance victim, PlayerInstance ch)
        {
            if (victim.CanSee(ch) && !ch.IsNpc() &&
                !ch.Act.IsSet((int)PlayerFlags.WizardInvisibility))
            {
                comm.act(ATTypes.AT_ACTION, "$n looks at you.", ch, null, victim, ToTypes.Victim);
                comm.act(ATTypes.AT_ACTION, victim != ch ? "$n looks at $N." : "$n looks at $mself.", ch, null, victim,
                         ToTypes.NotVictim);
            }

            if (!string.IsNullOrEmpty(victim.Description))
            {
                ch.SendTo(victim.CurrentMorph?.Morph != null
                    ? victim.CurrentMorph.Morph.Description
                    : victim.Description);
            }
            else
            {
                if (victim.CurrentMorph?.Morph != null)
                {
                    ch.SendTo(victim.CurrentMorph.Morph.Description);
                }
                else if (victim.IsNpc())
                {
                    comm.act(ATTypes.AT_PLAIN, "You see nothing special about $M.", ch, null, victim, ToTypes.Character);
                }
                else if (ch != victim)
                {
                    comm.act(ATTypes.AT_PLAIN, "$E isn't much to look at...", ch, null, victim, ToTypes.Character);
                }
                else
                {
                    comm.act(ATTypes.AT_PLAIN, "You're not much to look at...", ch, null, null, ToTypes.Character);
                }
            }

            ch.ShowRaceOf(victim);
            ch.ShowConditionTo(victim);

            var found = false;

            for (var i = 0; i < GameConstants.MaximumWearLocations; i++)
            {
                var wearLoc = EnumerationExtensions.GetEnum <WearLocations>(i);
                var obj     = victim.GetEquippedItem(wearLoc);
                if (obj != null && ch.CanSee(obj))
                {
                    if (!found)
                    {
                        ch.SendTo("\r\n");
                        if (victim != ch)
                        {
                            comm.act(ATTypes.AT_PLAIN, "$n is using:", ch, null, victim, ToTypes.Character);
                        }
                        else
                        {
                            comm.act(ATTypes.AT_PLAIN, "You are using:", ch, null, null, ToTypes.Character);
                        }
                        found = true;
                    }

                    if (!victim.IsNpc())
                    {
                        var race = RepositoryManager.Instance.GetRace(victim.CurrentRace);
                        ch.SendTo(race.WhereNames.ToList()[i]);
                    }
                    else
                    {
                        ch.SendTo(LookupManager.Instance.GetLookup("WhereNames", i));
                    }
                    ch.SendTo(obj.GetFormattedDescription(ch, true));
                    ch.SendTo("\r\n");
                }
            }

            if (ch.IsNpc() || victim == ch)
            {
                return;
            }

            if (ch.IsImmortal())
            {
                if (victim.IsNpc())
                {
                    ch.Printf("\r\nMobile #%d '%s' ", ((MobileInstance)victim).MobIndex.ID, victim.Name);
                }
                else
                {
                    ch.Printf("\r\n%s ", victim.Name);
                }

                ch.Printf("is a level %d %s %s.\r\n", victim.Level,
                          RepositoryManager.Instance.GetRace(victim.CurrentRace).Name,
                          RepositoryManager.Instance.GetClass(victim.CurrentClass).Name);
            }

            var skill = RepositoryManager.Instance.GetEntity <SkillData>("peek");

            if (skill == null)
            {
                throw new ObjectNotFoundException("Skill 'peek' not found");
            }

            if (SmaugRandom.D100() < Macros.LEARNED(ch, (int)skill.ID))
            {
                ch.Printf("\r\nYou peek at %s inventory:\r\n", victim.Gender.PossessivePronoun());
                show_list_to_char(victim.Carrying.ToList(), ch, true, true);
                skill.LearnFromSuccess(ch);
            }
            else if (ch.PlayerData.GetSkillMastery(skill.ID) > skill.GetMasteryLevel(ch))
            {
                skill.LearnFromFailure(ch);
            }
        }
 public override bool Verify(ChannelTypes channelType, PlayerInstance ch, int minTrust = 0)
 => ch.IsImmortal() && base.Verify(channelType, ch, minTrust);
Ejemplo n.º 5
0
        public static void ShowToCharacter(this CharacterInstance victim, PlayerInstance ch)
        {
            var buffer = string.Empty;

            ch.SetColor(ATTypes.AT_PERSON);
            if (!victim.IsNpc())
            {
                if (victim.Switched == null)
                {
                    ch.SendTo("&P[(Link Dead)]");
                }
                else if (!victim.IsAffected(AffectedByTypes.Possess))
                {
                    buffer += "(Switched) ";
                }
            }

            if (victim.IsNpc() &&
                victim.IsAffected(AffectedByTypes.Possess) &&
                ch.IsImmortal() && ch.Switched != null)
            {
                buffer += "(" + victim.Switched.Name + ")";
            }

            if (!victim.IsNpc() && victim.Act.IsSet((int)PlayerFlags.AwayFromKeyboard))
            {
                buffer += PlayerFlags.AwayFromKeyboard.GetAttribute <DescriptorAttribute>().Messages.ToList()[0];
            }

            if ((!victim.IsNpc() && victim.Act.IsSet((int)PlayerFlags.WizardInvisibility)) ||
                (victim.IsNpc() && victim.Act.IsSet((int)ActFlags.MobInvisibility)))
            {
                if (!victim.IsNpc())
                {
                    buffer += $"(Invis {((PlayerInstance)victim).PlayerData.WizardInvisible}) ";
                }
                else
                {
                    buffer += $"(MobInvis {victim.MobInvisible}) ";
                }
            }

            if (!victim.IsNpc())
            {
                var vict = (PlayerInstance)victim;
                if (vict.IsImmortal() && vict.Level > LevelConstants.GetLevel(ImmortalTypes.Avatar))
                {
                    ch.SendTo("&P(&WImmortal&P) ");
                }
                if (vict.PlayerData.Clan != null &&
                    vict.PlayerData.Flags.IsSet(PCFlags.Deadly) &&
                    !string.IsNullOrEmpty(vict.PlayerData.Clan.Badge) &&
                    (vict.PlayerData.Clan.ClanType != ClanTypes.Order ||
                     vict.PlayerData.Clan.ClanType != ClanTypes.Guild))
                {
                    ch.PrintfColor("%s ", vict.PlayerData.Clan.Badge);
                }
                else if (vict.CanPKill() && vict.Level < LevelConstants.ImmortalLevel)
                {
                    ch.SendTo("&P(&wUnclanned&P) ");
                }
            }

            ch.SetColor(ATTypes.AT_PERSON);

            buffer += GenerateBufferForAffectedBy(victim, ch);

            ch.SetColor(ATTypes.AT_PERSON);
            if ((victim.CurrentPosition == victim.CurrentDefensivePosition && !string.IsNullOrEmpty(victim.LongDescription)) ||
                (victim.CurrentMorph?.Morph != null && victim.CurrentMorph.Morph.Position == (int)victim.CurrentPosition))
            {
                if (victim.CurrentMorph != null)
                {
                    if (!ch.IsImmortal())
                    {
                        if (victim.CurrentMorph.Morph != null)
                        {
                            buffer += victim.CurrentMorph.Morph.LongDescription;
                        }
                        else
                        {
                            buffer += victim.LongDescription;
                        }
                    }
                    else
                    {
                        buffer += Macros.PERS(victim, ch);
                        if (!victim.IsNpc() && !ch.Act.IsSet((int)PlayerFlags.Brief))
                        {
                            buffer += ((PlayerInstance)victim).PlayerData.Title;
                        }
                        buffer += ".\r\n";
                    }
                }
                else
                {
                    buffer += victim.LongDescription;
                }
                ch.SendTo(buffer);
                ch.ShowVisibleAffectsOn(victim);
                return;
            }

            if (victim.CurrentMorph?.Morph != null && !ch.IsImmortal())
            {
                buffer += Macros.MORPHERS(victim, ch);
            }
            else
            {
                buffer += Macros.PERS(victim, ch);
            }

            if (!victim.IsNpc() && !ch.Act.IsSet((int)PlayerFlags.Brief))
            {
                buffer += ((PlayerInstance)victim).PlayerData.Title;
            }

            var timer = ch.GetTimer(TimerTypes.DoFunction);

            if (timer != null)
            {
                var attributes = timer.Action.Value.Method.GetCustomAttributes(typeof(DescriptorAttribute), false);
                var attrib     =
                    (DescriptorAttribute)attributes.FirstOrDefault(x => x is DescriptorAttribute);
                buffer += attrib == null ? " is looking rather lost." : attrib.Messages.First();
            }
            else
            {
                buffer += GenerateBufferDescriptorFromVictimPosition(victim, ch);
            }

            buffer += "\r\n";
            buffer  = buffer.CapitalizeFirst();
            ch.SendTo(buffer);
            ch.ShowVisibleAffectsOn(victim);
        }
Ejemplo n.º 6
0
        private static string GenerateBufferForAffectedBy(CharacterInstance victim, PlayerInstance ch)
        {
            if (victim.IsAffected(AffectedByTypes.Invisible))
            {
                return(AffectedByTypes.Invisible.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (victim.IsAffected(AffectedByTypes.Hide))
            {
                return(AffectedByTypes.Hide.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (victim.IsAffected(AffectedByTypes.PassDoor))
            {
                return(AffectedByTypes.PassDoor.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (victim.IsAffected(AffectedByTypes.FaerieFire))
            {
                return(AffectedByTypes.FaerieFire.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if ((ch.IsAffected(AffectedByTypes.DetectEvil) && victim.IsEvil()) ||
                ch.CurrentClass == ClassTypes.Paladin)
            {
                return(ClassTypes.Paladin.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (victim.IsNeutral() && ch.CurrentClass == ClassTypes.Paladin)
            {
                return(ClassTypes.Paladin.GetAttribute <DescriptorAttribute>().Messages.ToList()[1]);
            }
            if (victim.IsGood() && ch.CurrentClass == ClassTypes.Paladin)
            {
                return(ClassTypes.Paladin.GetAttribute <DescriptorAttribute>().Messages.ToList()[2]);
            }

            if (victim.IsAffected(AffectedByTypes.Berserk))
            {
                return(AffectedByTypes.Berserk.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (!victim.IsNpc() && victim.Act.IsSet((int)PlayerFlags.Attacker))
            {
                return(PlayerFlags.Attacker.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (!victim.IsNpc() && victim.Act.IsSet((int)PlayerFlags.Killer))
            {
                return(PlayerFlags.Killer.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (!victim.IsNpc() && victim.Act.IsSet((int)PlayerFlags.Thief))
            {
                return(PlayerFlags.Thief.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (!victim.IsNpc() && victim.Act.IsSet((int)PlayerFlags.Litterbug))
            {
                return(PlayerFlags.Litterbug.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (victim.IsNpc() && ch.IsImmortal() && victim.Act.IsSet((int)ActFlags.Prototype))
            {
                return(ActFlags.Prototype.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            if (victim.IsNpc() && ch.CurrentMount != null &&
                ch.CurrentMount == victim && ch.CurrentRoom == ch.CurrentMount.CurrentRoom)
            {
                return("(Mount) ");
            }
            if (victim.Switched != null && ((PlayerInstance)victim.Switched).Descriptor.ConnectionStatus == ConnectionTypes.Editing)
            {
                return(ConnectionTypes.Editing.GetAttribute <DescriptorAttribute>().Messages.First());
            }
            return(victim.CurrentMorph != null ? "(Morphed) " : string.Empty);
        }