示例#1
0
 void StartGame()
 {
     m_asking_list = AskingContainer.XmlToList(pathXmlAsking);
     m_npc_list    = NpcContainer.XmlToList(pathXmlNpc);
     m_npc_zone.GetComponent <Image>().sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Sprites/Npc/" + m_npc_list[0].image);
     m_ask_zone.GetComponent <Text>().text    = m_asking_list[0].ask;
 }
示例#2
0
        public StartDialogueInteraction(SpawnCommand p_command, Int32 p_parentID, Int32 p_commandIndex) : base(p_command, p_parentID, p_commandIndex)
        {
            InteractiveObject interactiveObject = Grid.FindInteractiveObject(m_targetSpawnID);

            m_npcs   = (interactiveObject as NpcContainer);
            m_parent = Grid.FindInteractiveObject(m_parentID);
        }
示例#3
0
        private void UpdateTarget()
        {
            var character = new Character(attachedGame.Game);
            var npcs      = new NpcContainer(attachedGame.Game);

            currentTarget = npcs.GetItemByID(character.SelectedTargetID);
        }
示例#4
0
        private void AutoCombatPerform()
        {
            try
            {
                var character = new Character(attachedGame.Game);
                var mobs      = new NpcContainer(attachedGame.Game).GetItems()
                                .Where(x => x.NpcType.Value == NpcType.Monster);
                IEnumerable <Npc> targets = null;

                switch (settingVM.SearchBehavior)
                {
                case AutoCombatSearchBehavior.SearchAndDestroy:
                    targets = mobs;
                    break;

                case AutoCombatSearchBehavior.SelfDefence:
                    targets = Enumerable.Empty <Npc>();
                    break;

                case AutoCombatSearchBehavior.Custom:
                    targets = mobs.Where(x => settingVM.TargetList.Contains(x.Name.Value.Value));
                    break;
                }

                // reacquire closest target, before attacking
                var mob = targets
                          .OrderBy(x => x.RelativeDistance.Value)
                          .FirstOrDefault();
                if (mob != null && mob.UniqueID != character.SelectedTargetID)
                {
                    mob.Target();
                }

                if (character.SelectedTargetID != 0)
                {
                    if (AutoSparkEnabled && character.Chi > 300)
                    {
                        var sparkBurstID = new SkillBook(attachedGame.Game).GetItems()
                                           .Select(x => x.SkillID.Value)
                                           .FirstOrDefault(x => 0x16A <= x && x <= 0x175); // skill id for holy/demonic spark burst

                        if (sparkBurstID != default(int))
                        {
                            Call.Cast(attachedGame.Game.Core, sparkBurstID);
                            return;
                        }
                    }

                    character.Attack();
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"An exception occured in {nameof(AutoLootPerform)} : {e}");
            }
        }
示例#5
0
        private void OnHirelingUpdated(Object sender, EventArgs args)
        {
            HirelingEventArgs hirelingEventArgs = (HirelingEventArgs)args;
            NpcContainer      npcContainer      = MyController as NpcContainer;

            if (npcContainer != null && npcContainer.Contains(hirelingEventArgs.Npc))
            {
                UpdateVisibility();
            }
        }
示例#6
0
        public override String GetLocalizedTooltipText()
        {
            m_TooltipLocaKey = null;
            NpcContainer npcContainer = MyController as NpcContainer;

            if (npcContainer != null)
            {
                m_TooltipLocaKey = npcContainer.MinimapTooltipLocaKey;
                if (String.IsNullOrEmpty(m_TooltipLocaKey) && npcContainer.Npcs.Count > 0 && npcContainer.Npcs[0].IsEnabled)
                {
                    m_TooltipLocaKey = npcContainer.Npcs[0].StaticData.NameKey;
                }
            }
            return(base.GetLocalizedTooltipText());
        }
示例#7
0
        private static void DebugCurrentTarget()
        {
            var character = new Character(game);
            var npcs      = new NpcContainer(game);

            var id = character.SelectedTargetID.Value;

            // check if target is a mob
            if (id >= 0x80000000)
            {
                var index = id % npcs.MaxSize.Value;
                var npc   = npcs[(int)index];

                if (npc.NpcBase.Value != 0)
                {
                }
            }
        }
示例#8
0
        private void UpdateVisibility()
        {
            NpcContainer npcContainer = MyController as NpcContainer;

            if (npcContainer != null)
            {
                UISprite uisprite = (UISprite)MyUIWidget;
                NGUITools.SetActiveSelf(uisprite.gameObject, npcContainer.IsEnabled && npcContainer.Enabled);
                if (uisprite.enabled)
                {
                    switch (npcContainer.MinimapSymbol)
                    {
                    case ENpcMinimapSymbol.HOUSE:
                        uisprite.spriteName = m_SpriteHouse;
                        m_asymmetricSymbol  = m_SpriteHouseAsymmetric;
                        goto IL_104;

                    case ENpcMinimapSymbol.INN:
                        uisprite.spriteName = m_SpriteInn;
                        m_asymmetricSymbol  = m_SpriteInnAsymmetric;
                        goto IL_104;

                    case ENpcMinimapSymbol.SMITH:
                        uisprite.spriteName = m_SpriteSmith;
                        m_asymmetricSymbol  = m_SpriteSmithAsymmetric;
                        goto IL_104;

                    case ENpcMinimapSymbol.SHRINE:
                        uisprite.spriteName = m_SpriteShrine;
                        m_asymmetricSymbol  = m_SpriteShrineAsymmetric;
                        goto IL_104;
                    }
                    uisprite.spriteName = m_SpriteNormal;
                    m_asymmetricSymbol  = m_SpriteNormalAsymmetric;
IL_104:
                    uisprite.MakePixelPerfect();
                    NGUITools.AddWidgetCollider(gameObject);
                }
            }
        }
        private void UpdateName(InteractiveObject p_interactiveObject)
        {
            Boolean flag = false;
            IEnumerable <InteractiveObjectTooltipStaticData> iterator = StaticDataHandler.GetIterator <InteractiveObjectTooltipStaticData>(EDataType.INTERACTIVE_OBJECT_TOOLTIPS);
            KeyCode keyCode = KeyConfigManager.KeyBindings[EHotkeyType.INTERACT].Key1;

            if (keyCode == KeyCode.None)
            {
                keyCode = KeyConfigManager.KeyBindings[EHotkeyType.INTERACT].AltKey1;
            }
            String text = m_actionColorHex + "[" + LocaManager.GetText("OPTIONS_INPUT_KEYNAME_" + keyCode.ToString().ToUpper()) + "][-]";

            if (!String.IsNullOrEmpty(p_interactiveObject.Prefab))
            {
                String directoryName = Path.GetDirectoryName(p_interactiveObject.Prefab);
                foreach (InteractiveObjectTooltipStaticData interactiveObjectTooltipStaticData in iterator)
                {
                    if (interactiveObjectTooltipStaticData.PrefabFolder == directoryName || interactiveObjectTooltipStaticData.PrefabFolder == p_interactiveObject.Prefab)
                    {
                        m_label.text = LocaManager.GetText(interactiveObjectTooltipStaticData.LocaKey, text);
                        flag         = true;
                        break;
                    }
                }
            }
            if (p_interactiveObject is Button)
            {
                if (!flag)
                {
                    m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_BUTTON", text);
                }
                return;
            }
            if (p_interactiveObject is Lever)
            {
                if (!flag)
                {
                    m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_LEVER", text);
                }
                return;
            }
            if (!(p_interactiveObject is Barrel))
            {
                if (p_interactiveObject is Container)
                {
                    Container container = p_interactiveObject as Container;
                    if (!container.IsEmpty())
                    {
                        if (!flag)
                        {
                            m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_CONTAINER", text);
                        }
                    }
                    else
                    {
                        foreach (SpawnCommand spawnCommand in container.Commands)
                        {
                            if (spawnCommand.Type == EInteraction.CHANGE_ATTRIBUTE)
                            {
                                m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_CONTAINER", text);
                                return;
                            }
                        }
                        m_label.text = String.Empty;
                    }
                    return;
                }
                if (p_interactiveObject is Door)
                {
                    if (LegacyLogic.Instance.WorldManager.Party.SelectedInteractiveObject == null || p_interactiveObject.IsSecret)
                    {
                        m_label.text = String.Empty;
                        return;
                    }
                    if (((Door)p_interactiveObject).State == EInteractiveObjectState.DOOR_OPEN)
                    {
                        m_label.text = String.Empty;
                    }
                    else
                    {
                        m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_DOOR", text);
                    }
                    return;
                }
                else
                {
                    if (p_interactiveObject is Sign)
                    {
                        if (!flag)
                        {
                            m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_SIGN", text);
                        }
                        return;
                    }
                    if (p_interactiveObject is Entrance)
                    {
                        if (flag)
                        {
                            return;
                        }
                        Entrance entrance = (Entrance)p_interactiveObject;
                        String   text2    = entrance.MinimapTooltipLocaKey;
                        if (!String.IsNullOrEmpty(text2))
                        {
                            text2        = LocaManager.GetText(entrance.MinimapTooltipLocaKey);
                            m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_ENTRANCE", text, text2);
                            return;
                        }
                        text2 = null;
                        foreach (SpawnCommand spawnCommand2 in entrance.Commands)
                        {
                            if (spawnCommand2.Type == EInteraction.USE_ENTRANCE)
                            {
                                String[] array = spawnCommand2.Extra.Split(new Char[]
                                {
                                    ','
                                });
                                text2 = array[0].Replace(".xml", String.Empty);
                                break;
                            }
                        }
                        if (text2 != null)
                        {
                            GridInfo gridInfo = LegacyLogic.Instance.MapLoader.FindGridInfo(text2);
                            if (gridInfo != null)
                            {
                                text2 = LocaManager.GetText(gridInfo.LocationLocaName);
                                if (LegacyLogic.Instance.MapLoader.Grid.Type == EMapType.DUNGEON)
                                {
                                    text2 = text2.Replace("@", ", ");
                                }
                                else if (text2.LastIndexOf('@') != -1)
                                {
                                    text2 = text2.Remove(text2.LastIndexOf('@'));
                                }
                                m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_ENTRANCE", text, text2);
                                return;
                            }
                            Debug.LogError("Grid Info not found " + text2);
                        }
                    }
                    else if (p_interactiveObject is NpcContainer)
                    {
                        NpcContainer npcContainer = (NpcContainer)p_interactiveObject;
                        if (!npcContainer.IsEnabled)
                        {
                            m_label.text = String.Empty;
                            return;
                        }
                        String minimapTooltipLocaKey = npcContainer.MinimapTooltipLocaKey;
                        if (!String.IsNullOrEmpty(npcContainer.IndoorScene))
                        {
                            if (!String.IsNullOrEmpty(minimapTooltipLocaKey))
                            {
                                String text3 = LocaManager.GetText(minimapTooltipLocaKey);
                                m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_BUILDING_DEFAULT", text, text3);
                                return;
                            }
                            foreach (InteractiveObjectTooltipStaticData interactiveObjectTooltipStaticData2 in iterator)
                            {
                                if (interactiveObjectTooltipStaticData2.PrefabFolder == npcContainer.IndoorScene)
                                {
                                    m_label.text = LocaManager.GetText(interactiveObjectTooltipStaticData2.LocaKey, text);
                                    return;
                                }
                            }
                            m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_INDOOR_CONTEXT", text);
                            return;
                        }
                        else
                        {
                            if (!npcContainer.Npcs[0].IsEnabled)
                            {
                                m_label.text = String.Empty;
                                return;
                            }
                            foreach (SpawnCommand spawnCommand3 in npcContainer.Commands)
                            {
                                if (spawnCommand3.Type == EInteraction.START_DEFINED_DIALOG && !String.IsNullOrEmpty(spawnCommand3.Precondition) && spawnCommand3.Precondition.StartsWith("PARTY_CHECK"))
                                {
                                    BasePrecondition basePrecondition = BaseInteraction.ParsePrecondition(spawnCommand3.Precondition);
                                    if (basePrecondition is PartyCheckPrecondition && !((PartyCheckPrecondition)basePrecondition).Evaluate())
                                    {
                                        m_label.text = String.Empty;
                                        return;
                                    }
                                }
                            }
                            if (flag)
                            {
                                return;
                            }
                            if (!String.IsNullOrEmpty(minimapTooltipLocaKey))
                            {
                                m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_NPC", text, minimapTooltipLocaKey);
                                return;
                            }
                            if (npcContainer.Npcs[0].StaticID != 224 && npcContainer.Npcs[0].StaticID != 225)
                            {
                                String text4 = LocaManager.GetText(npcContainer.Npcs[0].StaticData.NameKey);
                                m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_NPC", text, text4);
                                return;
                            }
                        }
                    }
                    else if (p_interactiveObject is RechargingObject)
                    {
                        RechargingObject rechargingObject = (RechargingObject)p_interactiveObject;
                        if (rechargingObject.IsFountain())
                        {
                            m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_FOUNTAIN", text);
                        }
                        else if (rechargingObject.IsCrystal())
                        {
                            m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_CRYSTAL", text);
                        }
                        else
                        {
                            m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_STATUE", text);
                        }
                        return;
                    }
                    m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_FALLBACK", text);
                }
                return;
            }
            Barrel barrel = p_interactiveObject as Barrel;

            if (barrel.State == EInteractiveObjectState.BARREL_EMPTY)
            {
                m_label.text = String.Empty;
                return;
            }
            if (barrel.State == EInteractiveObjectState.BARREL_OPEN)
            {
                m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_FALLBACK", text);
                return;
            }
            m_label.text = LocaManager.GetText("INTERACT_TOOLTIP_BARREL", text);
        }