示例#1
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);
            }
        }