示例#1
0
        public static string GetExamineInfo(IItemOfInterest targetObject)
        {
            string               examineString = string.Empty;
            WorldItem            worlditem     = null;
            List <WIExamineInfo> info          = new List <WIExamineInfo>();

            if (targetObject.IOIType == ItemOfInterestType.WorldItem)
            {
                worlditem = targetObject.worlditem;
                Examinable examinable = null;
                if (worlditem.Is <Examinable>(out examinable))
                {
                    examineString = examinable.State.StaticExamineMessage;
                }
                else
                {
                    worlditem.Examine(info);
                    //get all the examine info from each script
                    //if we have enough skill, add it to the introspection
                    if (info.Count == 0)
                    {
                        //TODO this sucks come up with a better line
                        if (worlditem.Props.Global.MaterialType != WIMaterialType.None && worlditem.Props.Global.Flags.Size != WISize.NoLimit)
                        {
                            examineString = "It's " + Colors.ColorWrap(worlditem.Props.Global.Flags.Size.ToString(), Colors.Get.MessageSuccessColor)
                                            + " and is made mostly of " + Colors.ColorWrap(worlditem.Props.Global.MaterialType.ToString(), Colors.Get.MessageSuccessColor);
                        }
                    }

                    examineString = worlditem.DisplayName;

                    for (int i = 0; i < info.Count; i++)
                    {
                        WIExamineInfo examineInfo    = info[i];
                        bool          displaySuccess = true;
                        if (!string.IsNullOrEmpty(examineInfo.RequiredSkill))
                        {
                            displaySuccess = false;
                            float skillUsageLevel = 0f;
                            if (Skills.Get.HasLearnedSkill(examineInfo.RequiredSkill, out skillUsageLevel) && skillUsageLevel >= examineInfo.RequiredSkillUsageLevel)
                            {
                                displaySuccess = true;
                            }
                        }
                        if (displaySuccess)
                        {
                            examineString = examineInfo.StaticExamineMessage;
                        }
                        else if (!string.IsNullOrEmpty(examineInfo.ExamineMessageOnFail))
                        {
                            examineString = examineInfo.ExamineMessageOnFail;
                        }
                    }
                }
            }
            return(examineString);
        }
示例#2
0
        protected static WIExamineInfo gHeadstoneExamineInfo; // = new WIExamineInfo ();

        public override void OnInitialized()
        {
            if (gNoPropsInfo == null)
            {
                gNoPropsInfo          = new WIExamineInfo("The engraving has worn away");
                gHeadstoneExamineInfo = new WIExamineInfo();
            }

            examinable = worlditem.GetOrAdd <Examinable> ();
            RefreshProps();
        }
示例#3
0
        public override void PopulateExamineList(List <WIExamineInfo> examine)
        {
            Book book = null;

            if (Books.Get.BookByName(State.BookName, out book))
            {
                WIExamineInfo examineInfo = new WIExamineInfo();
                worlditem.Props.Global.ExamineInfo.OverrideDescriptionName = book.CleanTitle;
                examineInfo.StaticExamineMessage    = book.ContentsSummary;
                examineInfo.OverrideDescriptionName = book.CleanTitle;
                examine.Add(examineInfo);
            }
        }
示例#4
0
文件: Purse.cs 项目: yazici/FRONTIERS
        public override void PopulateExamineList(System.Collections.Generic.List <WIExamineInfo> examine)
        {
            FillStackContainer fsc = null;

            if (worlditem.Has <FillStackContainer>(out fsc))
            {
                if (!fsc.State.HasBeenFilled)
                {
                    fsc.TryToFillContainer(true);
                }
            }
            WIExamineInfo e = new WIExamineInfo("It's worth $" + State.TotalValue.ToString());

            examine.Add(e);
        }
示例#5
0
        public override void PopulateExamineList(List <WIExamineInfo> examine)
        {
            WIExamineInfo examineInfo = new WIExamineInfo();

            examineInfo.RequiredSkill        = "AppraiseArtifact";
            examineInfo.StaticExamineMessage = "This artifact is " + Colors.ColorWrap(State.Age.ToString(), Colors.Get.GenericHighValue)
                                               + " and it is of "
                                               + Colors.ColorWrap(State.Quality.ToString(), Colors.Get.GenericHighValue) + " quality.";
            if (State.HasBeenAppraised)
            {
                examineInfo.StaticExamineMessage += " It has been appraised.";
            }
            examineInfo.ExamineMessageOnFail = "I have no idea what kind of artifact it is.";
            examine.Add(examineInfo);
        }
示例#6
0
        public override void OnInitialized()
        {
            if (mAbandonedExamineInfo == null)
            {
                mAbandonedExamineInfo    = new WIExamineInfo("This property is abandoned");
                mPlayerOwnExamineInfo    = new WIExamineInfo("You own this property");
                mDestroyedExamineInfo    = new WIExamineInfo();
                mCharacterOwnExamineInfo = new WIExamineInfo();
                mBuyExamineInfo          = new WIExamineInfo();
            }

            worlditem.OnInvisible += OnInvisible;
            worlditem.OnVisible   += OnVisible;
            Player.Get.AvatarActions.Subscribe(AvatarAction.LocationAquire, new ActionListener(LocationAquire));
        }
示例#7
0
        public override bool Use(IItemOfInterest targetObject, int flavorIndex)
        {
            WorldItem            worlditem            = null;
            List <string>        introspectionStrings = new List <string>();
            List <WIExamineInfo> info = new List <WIExamineInfo>();
            int numLocationsRevealed  = 0;

            if (targetObject.IOIType == ItemOfInterestType.WorldItem)
            {
                worlditem = targetObject.worlditem;
                Examinable examinable = null;
                if (worlditem.Is <Examinable>(out examinable))
                {
                    Frontiers.GUI.GUIIntrospectionDisplay.IntrospectionMessage message = new Frontiers.GUI.GUIIntrospectionDisplay.IntrospectionMessage();
                    message.CenterText      = false;
                    message.Delay           = 0f;
                    message.FocusItem       = worlditem;
                    message.SkipOnLoseFocus = worlditem.Is(WIMode.World | WIMode.Frozen);
                    message.LongForm        = examinable.State.LongFormDisplay;
                    message.Message         = examinable.State.StaticExamineMessage;
                    message.IconName        = string.Empty;

                    GUIManager.Get.NGUIIntrospectionDisplay.AddMessage(message, true);

                    for (int i = 0; i < examinable.State.LocationsToReveal.Count; i++)
                    {
                        if (Player.Local.Surroundings.Reveal(examinable.State.LocationsToReveal[i]))
                        {
                            Profile.Get.CurrentGame.MarkedLocations.SafeAdd(examinable.State.LocationsToReveal[i]);
                            numLocationsRevealed++;
                        }
                    }
                }
                else
                {
                    worlditem.Examine(info);
                    //get all the examine info from each script
                    //if we have enough skill, add it to the introspection
                    if (info.Count == 0)
                    {
                        //TODO this sucks come up with a better line
                        if (worlditem.Props.Global.MaterialType != WIMaterialType.None && worlditem.Props.Global.Flags.Size != WISize.NoLimit)
                        {
                            introspectionStrings.Insert(0, "It's " + Colors.ColorWrap(worlditem.Props.Global.Flags.Size.ToString(), Colors.Get.MessageSuccessColor)
                                                        + " and is made mostly of " + Colors.ColorWrap(worlditem.Props.Global.MaterialType.ToString(), Colors.Get.MessageSuccessColor));
                        }
                    }

                    introspectionStrings.Insert(0, worlditem.DisplayName);

                    for (int i = 0; i < info.Count; i++)
                    {
                        WIExamineInfo examineInfo    = info[i];
                        bool          displaySuccess = true;
                        if (!string.IsNullOrEmpty(examineInfo.RequiredSkill))
                        {
                            displaySuccess = false;
                            float skillUsageLevel = 0f;
                            if (Skills.Get.HasLearnedSkill(examineInfo.RequiredSkill, out skillUsageLevel) && skillUsageLevel >= examineInfo.RequiredSkillUsageLevel)
                            {
                                displaySuccess = true;
                            }
                        }
                        if (displaySuccess)
                        {
                            if (examineInfo.LocationsToReveal.Count > 0)
                            {
                                for (int j = 0; j < examineInfo.LocationsToReveal.Count; j++)
                                {
                                    if (Player.Local.Surroundings.Reveal(examineInfo.LocationsToReveal[j]))
                                    {
                                        Profile.Get.CurrentGame.MarkedLocations.SafeAdd(examineInfo.LocationsToReveal[j]);
                                        numLocationsRevealed++;
                                    }
                                }
                            }
                            introspectionStrings.Add(examineInfo.StaticExamineMessage);
                        }
                        else if (!string.IsNullOrEmpty(examineInfo.ExamineMessageOnFail))
                        {
                            introspectionStrings.Add(examineInfo.ExamineMessageOnFail);
                        }
                    }

                    Frontiers.GUI.GUIIntrospectionDisplay.IntrospectionMessage message = new Frontiers.GUI.GUIIntrospectionDisplay.IntrospectionMessage();
                    message.CenterText      = false;
                    message.Delay           = 0f;
                    message.FocusItem       = worlditem;
                    message.SkipOnLoseFocus = worlditem.Is(WIMode.World | WIMode.Frozen);
                    message.Message         = introspectionStrings.JoinToString("\n");
                    message.LongForm        = introspectionStrings.Count > 4 || message.Message.Length > 220;
                    message.IconName        = string.Empty;

                    GUIManager.Get.NGUIIntrospectionDisplay.AddMessage(message, true);
                }
                if (numLocationsRevealed > 0)
                {
                    GUIManager.PostSuccess(numLocationsRevealed.ToString() + " locations revealed on World Map");
                    Player.Get.AvatarActions.ReceiveAction(AvatarAction.LocationReveal, WorldClock.AdjustedRealTime);
                }
                worlditem.OnExamine.SafeInvoke();
                return(true);
            }
            return(false);
        }