Exemplo n.º 1
0
        private static Equipment CreateShield(Int32 p_modelLevel, ESubModel p_subModel, EEquipmentType[] p_specificationList, Int32 p_prefixLevel, Int32 p_suffixLevel)
        {
            IEnumerable <ShieldStaticData> iterator = StaticDataHandler.GetIterator <ShieldStaticData>(EDataType.SHIELD_MODEL);
            EEquipmentType eequipmentType           = DetermineType(SHIELD_TYPES, p_specificationList);

            foreach (ShieldStaticData shieldStaticData in iterator)
            {
                if (shieldStaticData.Type == eequipmentType && shieldStaticData.ModelLevel == p_modelLevel && shieldStaticData.SubModel == p_subModel)
                {
                    Int32 p_suffixId = -1;
                    Int32 p_prefixId = -1;
                    if (p_prefixLevel > 0)
                    {
                        m_prefixProbabilities[EEquipmentType.SHIELD].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_prefixId = m_prefixProbabilities[EEquipmentType.SHIELD].GetRandomId();
                    }
                    if (p_suffixLevel > 0)
                    {
                        m_suffixProbabilities[EEquipmentType.SHIELD].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_suffixId = m_suffixProbabilities[EEquipmentType.SHIELD].GetRandomId();
                    }
                    Shield shield = new Shield();
                    shield.InitFromModel(shieldStaticData, p_prefixId, p_suffixId);
                    shield.PrefixLevel = p_prefixLevel;
                    shield.SuffixLevel = p_suffixLevel;
                    return(shield);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        private static Equipment CreateJewelry(Int32 p_modelLevel, ESubModel p_subModel, EEquipmentType[] p_specificationList, Int32 p_prefixLevel, Int32 p_suffixLevel)
        {
            IEnumerable <JewelryStaticData> iterator = StaticDataHandler.GetIterator <JewelryStaticData>(EDataType.JEWELRY_MODEL);
            EEquipmentType eequipmentType            = DetermineType(JEWELRY_TYPES, p_specificationList);

            foreach (JewelryStaticData jewelryStaticData in iterator)
            {
                if (jewelryStaticData.Type == eequipmentType && jewelryStaticData.ModelLevel == p_modelLevel && jewelryStaticData.SubModel == p_subModel)
                {
                    Int32 p_suffixId = -1;
                    Int32 p_prefixId = -1;
                    if (p_prefixLevel > 0)
                    {
                        m_prefixProbabilities[EEquipmentType.JEWELRY].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_prefixId = m_prefixProbabilities[EEquipmentType.JEWELRY].GetRandomId();
                    }
                    if (p_suffixLevel > 0)
                    {
                        m_suffixProbabilities[EEquipmentType.JEWELRY].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_suffixId = m_suffixProbabilities[EEquipmentType.JEWELRY].GetRandomId();
                    }
                    Jewelry jewelry = new Jewelry();
                    jewelry.InitFromModel(jewelryStaticData, p_prefixId, p_suffixId);
                    jewelry.PrefixLevel = p_prefixLevel;
                    jewelry.SuffixLevel = p_suffixLevel;
                    return(jewelry);
                }
            }
            return(null);
        }
Exemplo n.º 3
0
        public static Potion CreatePotion(EPotionType p_type, Int32 p_modelLevel)
        {
            List <PotionStaticData> list = new List <PotionStaticData>(StaticDataHandler.GetIterator <PotionStaticData>(EDataType.POTION));

            if (m_potionTempFilter == null)
            {
                m_potionTempFilter = new List <Int32>();
            }
            m_potionTempFilter.Clear();
            for (Int32 i = 0; i < list.Count; i++)
            {
                PotionStaticData potionStaticData = list[i];
                if (potionStaticData.Type == p_type && potionStaticData.ModelLevel == p_modelLevel)
                {
                    m_potionTempFilter.Add(i);
                }
            }
            if (m_potionTempFilter.Count > 0)
            {
                Int32 index  = Random.Range(0, m_potionTempFilter.Count);
                Int32 index2 = m_potionTempFilter[index];
                return(CreateItem <Potion>(list[index2].StaticID));
            }
            throw new NotSupportedException("Potion Data not found! " + p_type);
        }
Exemplo n.º 4
0
        private static Equipment CreateMagicFocus(Int32 p_modelLevel, ESubModel p_subModel, EEquipmentType[] p_specificationList, Int32 p_prefixLevel, Int32 p_suffixLevel)
        {
            IEnumerable <MagicFocusStaticData> iterator = StaticDataHandler.GetIterator <MagicFocusStaticData>(EDataType.MAGIC_FOCUS_MODEL);
            EEquipmentType eequipmentType = DetermineType(MAGIC_FOCUS_TYPES, p_specificationList);

            foreach (MagicFocusStaticData magicFocusStaticData in iterator)
            {
                if (magicFocusStaticData.Type == eequipmentType && magicFocusStaticData.ModelLevel == p_modelLevel && magicFocusStaticData.SubModel == p_subModel)
                {
                    Int32 p_suffixId = -1;
                    Int32 p_prefixId = -1;
                    if (p_prefixLevel > 0)
                    {
                        m_prefixProbabilities[EEquipmentType.MAGIC_FOCUS].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_prefixId = m_prefixProbabilities[EEquipmentType.MAGIC_FOCUS].GetRandomId();
                    }
                    if (p_suffixLevel > 0)
                    {
                        m_suffixProbabilities[EEquipmentType.MAGIC_FOCUS].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_suffixId = m_suffixProbabilities[EEquipmentType.MAGIC_FOCUS].GetRandomId();
                    }
                    MagicFocus magicFocus = new MagicFocus();
                    magicFocus.InitFromModel(magicFocusStaticData, p_prefixId, p_suffixId);
                    magicFocus.PrefixLevel = p_prefixLevel;
                    magicFocus.SuffixLevel = p_suffixLevel;
                    return(magicFocus);
                }
            }
            return(null);
        }
Exemplo n.º 5
0
        private void OnEnable()
        {
            if (m_categoryList != null)
            {
                m_categoryList.items.Clear();
                m_staticIdList = new List <Int32>();
                m_categoryList.items.Add("Armor");
                m_categoryList.items.Add("Jewelry");
                m_categoryList.items.Add("Shields");
                m_categoryList.items.Add("Melee Weapons");
                m_categoryList.items.Add("Magic Focus");
                m_categoryList.items.Add("Ranged Weapons");
                m_categoryList.items.Add("Potions");
                m_categoryList.items.Add("Scrolls");
            }
            m_prefixList.items.Clear();
            m_suffixList.Clear();
            IEnumerable <PrefixStaticData> iterator  = StaticDataHandler.GetIterator <PrefixStaticData>(EDataType.PREFIX);
            IEnumerable <SuffixStaticData> iterator2 = StaticDataHandler.GetIterator <SuffixStaticData>(EDataType.SUFFIX);

            m_prefixList.items.Add("0: NONE");
            foreach (PrefixStaticData prefixStaticData in iterator)
            {
                m_prefixList.items.Add(prefixStaticData.StaticID + ": " + prefixStaticData.Name);
            }
            m_suffixList.AddItem("0: NONE");
            foreach (SuffixStaticData suffixStaticData in iterator2)
            {
                m_suffixList.AddItemWithoutReposition(suffixStaticData.StaticID + ": " + suffixStaticData.Name);
            }
            m_suffixList.ReposItems();
            SelectItemCategory("Armor");
        }
Exemplo n.º 6
0
        public List <LoreBookStaticData> GetBooksForCategory(ELoreBookCategories category, Boolean p_all)
        {
            List <LoreBookStaticData> list;

            if (p_all)
            {
                list = new List <LoreBookStaticData>(StaticDataHandler.GetIterator <LoreBookStaticData>(EDataType.LOREBOOK));
            }
            else
            {
                list = m_foundBooks;
            }
            if (category == ELoreBookCategories.SHOW_ALL)
            {
                return(list);
            }
            List <LoreBookStaticData> list2 = new List <LoreBookStaticData>();

            foreach (LoreBookStaticData loreBookStaticData in list)
            {
                if (loreBookStaticData.Category == category)
                {
                    list2.Add(loreBookStaticData);
                }
            }
            return(list2);
        }
Exemplo n.º 7
0
        private void CheckSet(TokenStaticData p_newToken)
        {
            Boolean      flag = true;
            List <Int32> list = new List <Int32>();

            foreach (TokenStaticData tokenStaticData in StaticDataHandler.GetIterator <TokenStaticData>(EDataType.TOKEN))
            {
                if (tokenStaticData.SetID == p_newToken.SetID)
                {
                    if (GetTokens(tokenStaticData.StaticID) == 0)
                    {
                        flag = false;
                    }
                    else
                    {
                        list.Add(tokenStaticData.StaticID);
                    }
                }
            }
            if (flag)
            {
                foreach (Int32 p_id in list)
                {
                    RemoveToken(p_id);
                }
                AddToken(p_newToken.Replacement);
            }
        }
Exemplo n.º 8
0
        private static Equipment CreateRangedWeapon(Int32 p_modelLevel, ESubModel p_subModel, EEquipmentType[] p_specificationList, Int32 p_prefixLevel, Int32 p_suffixLevel)
        {
            IEnumerable <RangedWeaponStaticData> iterator = StaticDataHandler.GetIterator <RangedWeaponStaticData>(EDataType.RANGED_WEAPON_MODEL);
            EEquipmentType eequipmentType = DetermineType(RANGED_WEAPON_TYPES, p_specificationList);

            foreach (RangedWeaponStaticData rangedWeaponStaticData in iterator)
            {
                if (rangedWeaponStaticData.Type == eequipmentType && rangedWeaponStaticData.ModelLevel == p_modelLevel && rangedWeaponStaticData.SubModel == p_subModel)
                {
                    Int32 p_suffixId = -1;
                    Int32 p_prefixId = -1;
                    if (p_prefixLevel > 0)
                    {
                        m_prefixProbabilities[EEquipmentType.RANGED_WEAPON].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_prefixId = m_prefixProbabilities[EEquipmentType.RANGED_WEAPON].GetRandomId();
                    }
                    if (p_suffixLevel > 0)
                    {
                        m_suffixProbabilities[EEquipmentType.RANGED_WEAPON].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_suffixId = m_suffixProbabilities[EEquipmentType.RANGED_WEAPON].GetRandomId();
                    }
                    RangedWeapon rangedWeapon = new RangedWeapon();
                    rangedWeapon.InitFromModel(rangedWeaponStaticData, p_prefixId, p_suffixId);
                    rangedWeapon.PrefixLevel = p_prefixLevel;
                    rangedWeapon.SuffixLevel = p_suffixLevel;
                    return(rangedWeapon);
                }
            }
            return(null);
        }
Exemplo n.º 9
0
 public void OnAddAllButtonClick(GameObject p_sender)
 {
     foreach (LoreBookStaticData loreBookStaticData in StaticDataHandler.GetIterator <LoreBookStaticData>(EDataType.LOREBOOK))
     {
         LegacyLogic.Instance.WorldManager.LoreBookHandler.AddLoreBook(loreBookStaticData.StaticID);
     }
 }
Exemplo n.º 10
0
        private void LoadWorlMapPoints()
        {
            IEnumerable <WorldMapPointStaticData> iterator = StaticDataHandler.GetIterator <WorldMapPointStaticData>(EDataType.WORLD_MAP);

            foreach (WorldMapPointStaticData worldMapPointStaticData in iterator)
            {
                m_worldMapPoints.Add(worldMapPointStaticData.StaticID, new WorldMapPoint(worldMapPointStaticData));
            }
        }
Exemplo n.º 11
0
 public void Initialize()
 {
     m_hints.Clear();
     foreach (HintStaticData sd in StaticDataHandler.GetIterator <HintStaticData>(EDataType.HINTS))
     {
         Hint item = new Hint(sd);
         m_hints.Add(item);
     }
     m_active = ConfigManager.Instance.Options.ShowHints;
 }
Exemplo n.º 12
0
        internal void LoadDefaultQuestSteps()
        {
            m_quests.Clear();
            IEnumerable <QuestStepStaticData> iterator = StaticDataHandler.GetIterator <QuestStepStaticData>(EDataType.QUEST_STEPS);

            foreach (QuestStepStaticData p_data in iterator)
            {
                QuestStep item = new QuestStep(p_data);
                m_quests.Add(item);
            }
        }
Exemplo n.º 13
0
        private void Initialize()
        {
            m_list.items.Clear();
            m_list.items.Add("Select...");
            List <AchievementStaticData> list = new List <AchievementStaticData>(StaticDataHandler.GetIterator <AchievementStaticData>(EDataType.ACHIEVEMENT));

            for (Int32 i = 0; i < list.Count; i++)
            {
                m_list.items.Add(list[i].StaticID + ". " + LocaManager.GetText(list[i].NameKey));
            }
        }
Exemplo n.º 14
0
        public void OnUnlockBestiaryButtonClick()
        {
            IEnumerable <MonsterStaticData> iterator = StaticDataHandler.GetIterator <MonsterStaticData>(EDataType.MONSTER);

            foreach (MonsterStaticData monsterStaticData in iterator)
            {
                if (monsterStaticData.BestiaryEntry)
                {
                    LegacyLogic.Instance.WorldManager.BestiaryHandler.AddKilledMonster(monsterStaticData.StaticID, 50, false);
                }
            }
        }
Exemplo n.º 15
0
        public static Scroll CreateScroll(Int32 p_modelLevel)
        {
            ETier etier = ETier.NOVICE;

            switch (p_modelLevel)
            {
            case 3:
                etier = ETier.EXPERT;
                break;

            case 4:
                etier = ETier.MASTER;
                break;

            case 5:
                etier = ETier.GRAND_MASTER;
                break;
            }
            List <ScrollStaticData> list = new List <ScrollStaticData>(StaticDataHandler.GetIterator <ScrollStaticData>(EDataType.SCROLL));

            if (m_scrollTempFilter == null)
            {
                m_scrollTempFilter = new List <Int32>();
            }
            m_scrollTempFilter.Clear();
            ETier  etier2 = (ETier)Random.Range(1, (Int32)(etier + 1));
            Single num    = 0f;

            for (Int32 i = 0; i < list.Count; i++)
            {
                ScrollStaticData scrollStaticData = list[i];
                if (scrollStaticData.ScrollTier == etier && scrollStaticData.SpellTier == etier2 && scrollStaticData.StaticID < 1000)
                {
                    m_scrollTempFilter.Add(i);
                    num += m_currentEnchantmentMultiplicators[scrollStaticData.MagicSchool];
                }
            }
            if (m_scrollTempFilter.Count > 0)
            {
                Single num2 = Random.Range(0f, num);
                Single num3 = 0f;
                for (Int32 j = 0; j < m_scrollTempFilter.Count; j++)
                {
                    Int32 index = m_scrollTempFilter[j];
                    num3 += m_currentEnchantmentMultiplicators[list[index].MagicSchool];
                    if (num2 < num3)
                    {
                        return(CreateItem <Scroll>(list[index].StaticID));
                    }
                }
            }
            return(null);
        }
Exemplo n.º 16
0
        public void RemoveSet(Int32 m_setID)
        {
            List <TokenStaticData> list = new List <TokenStaticData>(StaticDataHandler.GetIterator <TokenStaticData>(EDataType.TOKEN));

            for (Int32 i = 0; i < list.Count; i++)
            {
                if (list[i].SetID == m_setID)
                {
                    RemoveToken(list[i].StaticID);
                }
            }
        }
Exemplo n.º 17
0
 private void OnEnable()
 {
     if (m_mapList != null)
     {
         m_mapList.items.Clear();
         String   searchPattern = "*.xml";
         String   path          = Application.streamingAssetsPath + "/Maps/";
         String[] files         = Directory.GetFiles(path, searchPattern);
         foreach (String path2 in files)
         {
             String fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path2);
             m_mapList.items.Add(fileNameWithoutExtension);
         }
         if (m_mapList.items.Count > 0)
         {
             m_mapList.selection = m_mapList.items[0];
         }
         else
         {
             m_mapList.selection = String.Empty;
         }
     }
     if (m_tokenList != null)
     {
         m_tokenIdList = new List <Int32>();
         IEnumerable <TokenStaticData> iterator = StaticDataHandler.GetIterator <TokenStaticData>(EDataType.TOKEN);
         m_tokenList.items.Clear();
         foreach (TokenStaticData tokenStaticData in iterator)
         {
             m_tokenList.items.Add(tokenStaticData.Name);
             m_tokenIdList.Add(tokenStaticData.StaticID);
         }
         if (m_tokenList.items.Count > 0)
         {
             m_tokenList.selection = m_tokenList.items[0];
         }
         else
         {
             m_tokenList.selection = String.Empty;
         }
     }
     if (m_inputPosX != null && m_inputPosY != null)
     {
         Party party = LegacyLogic.Instance.WorldManager.Party;
         m_inputPosX.text = party.Position.X.ToString();
         m_inputPosY.text = party.Position.Y.ToString();
     }
     m_partySpawnerID.text = (-1).ToString();
 }
Exemplo n.º 18
0
 public void Initialize()
 {
     if (m_initialized)
     {
         return;
     }
     m_initialized = true;
     if (m_allMonsters.Count < 1)
     {
         foreach (MonsterStaticData monsterStaticData in StaticDataHandler.GetIterator <MonsterStaticData>(EDataType.MONSTER))
         {
             m_allMonsters.Add(monsterStaticData.StaticID, 0);
         }
     }
     LegacyLogic.Instance.EventManager.UnregisterEvent(EEventType.MONSTER_DIED, new EventHandler(OnMonsterDied));
     LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.MONSTER_DIED, new EventHandler(OnMonsterDied));
 }
Exemplo n.º 19
0
        private void UpdateOpenQuestList()
        {
            m_openQuestsList.items.Clear();
            m_openQuestIDs.Clear();
            IEnumerable <QuestStepStaticData> iterator = StaticDataHandler.GetIterator <QuestStepStaticData>(EDataType.QUEST_STEPS);

            foreach (QuestStepStaticData questStepStaticData in iterator)
            {
                QuestStep step = LegacyLogic.Instance.WorldManager.QuestHandler.GetStep(questStepStaticData.StaticID);
                if (step != null && step.QuestState == EQuestState.ACTIVE)
                {
                    m_openQuestsList.items.Add(LocaManager.GetText(step.StaticData.Name));
                    m_openQuestIDs.Add(step.StaticData.StaticID);
                }
            }
            SelectDefaultOpenQuestEntry();
        }
Exemplo n.º 20
0
        private void InitBookCounterDict()
        {
            List <LoreBookStaticData> list = new List <LoreBookStaticData>(StaticDataHandler.GetIterator <LoreBookStaticData>(EDataType.LOREBOOK));

            foreach (LoreBookStaticData loreBookStaticData in list)
            {
                Int32 num = 0;
                if (m_bookCounter.TryGetValue(loreBookStaticData.Category, out num))
                {
                    m_bookCounter[loreBookStaticData.Category] = num + 1;
                }
                else
                {
                    m_bookCounter.Add(loreBookStaticData.Category, 1);
                }
            }
            m_bookCounter[ELoreBookCategories.SHOW_ALL] = list.Count;
        }
Exemplo n.º 21
0
 public void Open()
 {
     NGUITools.SetActiveSelf(this.gameObject, true);
     m_isVisible = true;
     if (!m_initialised)
     {
         IEnumerable <UnlockableContentStaticData> iterator = StaticDataHandler.GetIterator <UnlockableContentStaticData>(EDataType.UNLOCKABLE_CONTENT);
         foreach (UnlockableContentStaticData p_data in iterator)
         {
             GameObject         gameObject = NGUITools.AddChild(m_grid.gameObject, m_entryPrefab);
             UnlockContentEntry component  = gameObject.GetComponent <UnlockContentEntry>();
             component.Init(p_data);
             component.OnClicked += OnEntryClicked;
             m_entries.Add(component);
         }
         m_initialised = true;
     }
     SelectEntry(m_entries[0]);
 }
Exemplo n.º 22
0
 private void Start()
 {
     m_texture.alpha = 0f;
     m_text.alpha    = 0f;
     m_state         = new TimeStateMachine <EState>();
     m_state.AddState(new TimeState <EState>(EState.START_DELAY, m_startDelayTime, new State <EState, Transition <EState> > .StateUpdateMethod(StateStartDelay)));
     m_state.AddState(new TimeState <EState>(EState.FADEIN_BACKGROUND, m_fadeinBackgroundTime, new State <EState, Transition <EState> > .StateUpdateMethod(StateFadeinBackground)));
     m_state.AddState(new TimeState <EState>(EState.FADEIN_TEXT, m_fadeinTextTime, new State <EState, Transition <EState> > .StateUpdateMethod(StateFadeinText)));
     m_state.AddState(new TimeState <EState>(EState.ACTIVE, 0f, new State <EState, Transition <EState> > .StateUpdateMethod(StateActive)));
     m_state.AddState(new TimeState <EState>(EState.FADEOUT_DELAY, m_fadeoutDelay, new State <EState, Transition <EState> > .StateUpdateMethod(StateFadeoutDelay)));
     m_state.AddState(new TimeState <EState>(EState.FADEOUT, m_fadeoutTime, new State <EState, Transition <EState> > .StateUpdateMethod(StateFadeout)));
     m_state.ChangeState(EState.START_DELAY);
     m_iterator = StaticDataHandler.GetIterator <EndingSlidesStaticData>(EDataType.ENDING_SLIDES).GetEnumerator();
     if (LegacyLogic.Instance.WorldManager.IsShowingDLCEndingSequences)
     {
         MoveToDLCSlides();
     }
     InputManager.RegisterHotkeyEvent(EHotkeyType.OPEN_CLOSE_MENU, new EventHandler <HotkeyEventArgs>(OnCloseKeyPressed));
 }
Exemplo n.º 23
0
        private static Equipment CreateMeleeWeapon(Int32 p_modelLevel, ESubModel p_subModel, EEquipmentType[] p_specificationList, Int32 p_prefixLevel, Int32 p_suffixLevel)
        {
            IEnumerable <MeleeWeaponStaticData> iterator = StaticDataHandler.GetIterator <MeleeWeaponStaticData>(EDataType.MELEE_WEAPON_MODEL);
            EEquipmentType eequipmentType = DetermineType(MELEE_WEAPON_TYPES, p_specificationList);
            EEquipmentType eequipmentType2;

            if (eequipmentType == EEquipmentType.DAGGER)
            {
                eequipmentType2 = EEquipmentType.ONEHANDED;
            }
            else if (eequipmentType == EEquipmentType.SPEAR)
            {
                eequipmentType2 = EEquipmentType.TWOHANDED;
            }
            else
            {
                eequipmentType2 = DetermineType(MELEE_WEAPON_SUBTYPES, p_specificationList);
            }
            foreach (MeleeWeaponStaticData meleeWeaponStaticData in iterator)
            {
                if (meleeWeaponStaticData.Type == eequipmentType && meleeWeaponStaticData.Subtype == eequipmentType2 && meleeWeaponStaticData.ModelLevel == p_modelLevel && meleeWeaponStaticData.SubModel == p_subModel)
                {
                    Int32 p_suffixId = -1;
                    Int32 p_prefixId = -1;
                    if (p_prefixLevel > 0)
                    {
                        m_prefixProbabilities[EEquipmentType.MELEE_WEAPON].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_prefixId = m_prefixProbabilities[EEquipmentType.MELEE_WEAPON].GetRandomId();
                    }
                    if (p_suffixLevel > 0)
                    {
                        m_suffixProbabilities[EEquipmentType.MELEE_WEAPON].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_suffixId = m_suffixProbabilities[EEquipmentType.MELEE_WEAPON].GetRandomId();
                    }
                    MeleeWeapon meleeWeapon = new MeleeWeapon();
                    meleeWeapon.InitFromModel(meleeWeaponStaticData, p_prefixId, p_suffixId);
                    meleeWeapon.PrefixLevel = p_prefixLevel;
                    meleeWeapon.SuffixLevel = p_suffixLevel;
                    return(meleeWeapon);
                }
            }
            return(null);
        }
Exemplo n.º 24
0
        private static Equipment CreateArmor(Int32 p_modelLevel, ESubModel p_subModel, EEquipmentType[] p_specificationList, Int32 p_prefixLevel, Int32 p_suffixLevel)
        {
            IEnumerable <ArmorStaticData> iterator = StaticDataHandler.GetIterator <ArmorStaticData>(EDataType.ARMOR_MODEL);
            EEquipmentType eequipmentType          = DetermineType(ARMOR_TYPES, p_specificationList);
            EEquipmentType eequipmentType2;

            if (eequipmentType == EEquipmentType.GARMENT)
            {
                eequipmentType2 = DetermineType(GARMENT_SUBTYPES, p_specificationList);
            }
            else
            {
                eequipmentType2 = DetermineType(ARMOR_SUBTYPES, p_specificationList);
            }
            foreach (ArmorStaticData armorStaticData in iterator)
            {
                if (armorStaticData.Type == eequipmentType && armorStaticData.Subtype == eequipmentType2 && armorStaticData.ModelLevel == p_modelLevel && armorStaticData.SubModel == p_subModel)
                {
                    Int32 p_suffixId = -1;
                    Int32 p_prefixId = -1;
                    if (p_prefixLevel > 0)
                    {
                        m_prefixProbabilities[eequipmentType2].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_prefixId = m_prefixProbabilities[eequipmentType2].GetRandomId();
                    }
                    if (p_suffixLevel > 0)
                    {
                        m_suffixProbabilities[eequipmentType2].Multiplicators = m_currentEnchantmentMultiplicators;
                        p_suffixId = m_suffixProbabilities[eequipmentType2].GetRandomId();
                    }
                    Armor armor = new Armor();
                    armor.InitFromModel(armorStaticData, p_prefixId, p_suffixId);
                    armor.PrefixLevel = p_prefixLevel;
                    armor.SuffixLevel = p_suffixLevel;
                    return(armor);
                }
            }
            return(null);
        }
Exemplo n.º 25
0
        public static Equipment CreateEquipment(ModelProbability[] p_modelLevels, Single p_prefixChance, Single p_suffixChance, EnchantmentProbability[] p_prefixProbabilities, EnchantmentProbability[] p_suffixProbabilities, EEquipmentType[] p_specificationList)
        {
            if (m_itemProbabilities == null)
            {
                InitItemProbabilities();
            }
            if (m_prefixProbabilities == null)
            {
                IEnumerable <PrefixStaticData> iterator = StaticDataHandler.GetIterator <PrefixStaticData>(EDataType.PREFIX);
                m_prefixProbabilities = new Dictionary <EEquipmentType, EnchantmentProbabilityList>();
                m_prefixProbabilities[EEquipmentType.MELEE_WEAPON]  = new EnchantmentProbabilityList(iterator, EEquipmentType.MELEE_WEAPON, EEquipmentType.NONE);
                m_prefixProbabilities[EEquipmentType.RANGED_WEAPON] = new EnchantmentProbabilityList(iterator, EEquipmentType.RANGED_WEAPON, EEquipmentType.NONE);
                m_prefixProbabilities[EEquipmentType.JEWELRY]       = new EnchantmentProbabilityList(iterator, EEquipmentType.JEWELRY, EEquipmentType.NONE);
                m_prefixProbabilities[EEquipmentType.SHIELD]        = new EnchantmentProbabilityList(iterator, EEquipmentType.SHIELD, EEquipmentType.NONE);
                m_prefixProbabilities[EEquipmentType.MAGIC_FOCUS]   = new EnchantmentProbabilityList(iterator, EEquipmentType.MAGIC_FOCUS, EEquipmentType.NONE);
                m_prefixProbabilities[EEquipmentType.CLOTHING]      = new EnchantmentProbabilityList(iterator, EEquipmentType.ARMOR, EEquipmentType.CLOTHING);
                m_prefixProbabilities[EEquipmentType.LIGHT_ARMOR]   = new EnchantmentProbabilityList(iterator, EEquipmentType.ARMOR, EEquipmentType.LIGHT_ARMOR);
                m_prefixProbabilities[EEquipmentType.HEAVY_ARMOR]   = new EnchantmentProbabilityList(iterator, EEquipmentType.ARMOR, EEquipmentType.HEAVY_ARMOR);
                m_prefixProbabilities[EEquipmentType.ARCANE]        = new EnchantmentProbabilityList(iterator, EEquipmentType.ARMOR, EEquipmentType.ARCANE);
                m_prefixProbabilities[EEquipmentType.MARTIAL]       = new EnchantmentProbabilityList(iterator, EEquipmentType.ARMOR, EEquipmentType.MARTIAL);
            }
            if (m_suffixProbabilities == null)
            {
                IEnumerable <SuffixStaticData> iterator2 = StaticDataHandler.GetIterator <SuffixStaticData>(EDataType.SUFFIX);
                m_suffixProbabilities = new Dictionary <EEquipmentType, EnchantmentProbabilityList>();
                m_suffixProbabilities[EEquipmentType.MELEE_WEAPON]  = new EnchantmentProbabilityList(iterator2, EEquipmentType.MELEE_WEAPON, EEquipmentType.NONE);
                m_suffixProbabilities[EEquipmentType.RANGED_WEAPON] = new EnchantmentProbabilityList(iterator2, EEquipmentType.RANGED_WEAPON, EEquipmentType.NONE);
                m_suffixProbabilities[EEquipmentType.JEWELRY]       = new EnchantmentProbabilityList(iterator2, EEquipmentType.JEWELRY, EEquipmentType.NONE);
                m_suffixProbabilities[EEquipmentType.SHIELD]        = new EnchantmentProbabilityList(iterator2, EEquipmentType.SHIELD, EEquipmentType.NONE);
                m_suffixProbabilities[EEquipmentType.MAGIC_FOCUS]   = new EnchantmentProbabilityList(iterator2, EEquipmentType.MAGIC_FOCUS, EEquipmentType.NONE);
                m_suffixProbabilities[EEquipmentType.CLOTHING]      = new EnchantmentProbabilityList(iterator2, EEquipmentType.ARMOR, EEquipmentType.CLOTHING);
                m_suffixProbabilities[EEquipmentType.LIGHT_ARMOR]   = new EnchantmentProbabilityList(iterator2, EEquipmentType.ARMOR, EEquipmentType.LIGHT_ARMOR);
                m_suffixProbabilities[EEquipmentType.HEAVY_ARMOR]   = new EnchantmentProbabilityList(iterator2, EEquipmentType.ARMOR, EEquipmentType.HEAVY_ARMOR);
                m_suffixProbabilities[EEquipmentType.ARCANE]        = new EnchantmentProbabilityList(iterator2, EEquipmentType.ARMOR, EEquipmentType.ARCANE);
                m_suffixProbabilities[EEquipmentType.MARTIAL]       = new EnchantmentProbabilityList(iterator2, EEquipmentType.ARMOR, EEquipmentType.MARTIAL);
            }

            return(CreateRandomEquipment(p_modelLevels, p_prefixChance, p_suffixChance, p_prefixProbabilities, p_suffixProbabilities, p_specificationList));
        }
Exemplo n.º 26
0
        public static void InitItemProbabilities()
        {
            if (m_itemProbabilities == null)
            {
                m_itemProbabilities = new Dictionary <EEquipmentType, Single>();
            }
            else
            {
                m_itemProbabilities.Clear();
            }
            IEnumerable <ItemProbabilityStaticData> iterator = StaticDataHandler.GetIterator <ItemProbabilityStaticData>(EDataType.ITEM_PROBABILITIES);

            foreach (ItemProbabilityStaticData itemProbabilityStaticData in iterator)
            {
                Single num = 0f;
                for (Int32 i = 0; i < 4; i++)
                {
                    num += GetProbabilityForCharacter(itemProbabilityStaticData, LegacyLogic.Instance.WorldManager.Party.GetMember(i));
                }
                m_itemProbabilities.Add(itemProbabilityStaticData.Type, num);
            }
        }
Exemplo n.º 27
0
        public void RepairObeliskQuest()
        {
            QuestStep step = GetStep(83);

            if (step.QuestState == EQuestState.INACTIVE)
            {
                return;
            }
            step = GetStep(90);
            if (step.QuestState != EQuestState.INACTIVE)
            {
                LegacyLogic.Instance.WorldManager.Party.TokenHandler.AddTokenIfNull(790);
                LegacyLogic.Instance.WorldManager.Party.TokenHandler.AddTokenIfNull(791);
                LegacyLogic.Instance.WorldManager.Party.TokenHandler.AddTokenIfNull(792);
                LegacyLogic.Instance.WorldManager.Party.TokenHandler.AddTokenIfNull(793);
                LegacyLogic.Instance.WorldManager.Party.TokenHandler.AddTokenIfNull(794);
                LegacyLogic.Instance.WorldManager.Party.TokenHandler.AddTokenIfNull(795);
                LegacyLogic.Instance.WorldManager.Party.TokenHandler.AddTokenIfNull(796);
                LegacyLogic.Instance.WorldManager.Party.TokenHandler.AddTokenIfNull(797);
                return;
            }
            Int32 num = 0;

            step = GetStep(83);
            if (step.QuestState == EQuestState.ACTIVE)
            {
                num++;
            }
            step = GetStep(84);
            if (step.QuestState == EQuestState.ACTIVE)
            {
                num++;
            }
            step = GetStep(85);
            if (step.QuestState == EQuestState.ACTIVE)
            {
                num++;
            }
            step = GetStep(86);
            if (step.QuestState == EQuestState.ACTIVE)
            {
                num++;
            }
            step = GetStep(87);
            if (step.QuestState == EQuestState.ACTIVE)
            {
                num++;
            }
            step = GetStep(88);
            if (step.QuestState == EQuestState.ACTIVE)
            {
                num++;
            }
            step = GetStep(89);
            if (step.QuestState == EQuestState.ACTIVE)
            {
                num++;
            }
            MapData mapData = LegacyLogic.Instance.WorldManager.MapData["theworld"];
            List <ObelisksStaticData> list = new List <ObelisksStaticData>(StaticDataHandler.GetIterator <ObelisksStaticData>(EDataType.OBELISKS));

            foreach (ObelisksStaticData obelisksStaticData in list)
            {
                if (num > 0)
                {
                    if (mapData.GetTerrainData(obelisksStaticData.Position).Visited)
                    {
                        LegacyLogic.Instance.WorldManager.Party.TokenHandler.AddTokenIfNull(obelisksStaticData.TokenID);
                    }
                    num--;
                }
            }
        }
Exemplo n.º 28
0
        private void SelectItemCategory(String p_category)
        {
            m_categoryList.selection = p_category;
            if (m_itemList != null)
            {
                m_itemList.items.Clear();
                m_staticIdList.Clear();
                IEnumerable enumerable = null;
                switch (p_category)
                {
                case "Armor":
                    enumerable        = StaticDataHandler.GetIterator <ArmorStaticData>(EDataType.ARMOR);
                    m_currentDataType = EDataType.ARMOR;
                    m_isEquipment     = true;
                    break;

                case "Jewelry":
                    enumerable        = StaticDataHandler.GetIterator <JewelryStaticData>(EDataType.JEWELRY);
                    m_currentDataType = EDataType.JEWELRY;
                    m_isEquipment     = true;
                    break;

                case "Shields":
                    enumerable        = StaticDataHandler.GetIterator <ShieldStaticData>(EDataType.SHIELD);
                    m_currentDataType = EDataType.SHIELD;
                    m_isEquipment     = true;
                    break;

                case "Melee Weapons":
                    enumerable        = StaticDataHandler.GetIterator <MeleeWeaponStaticData>(EDataType.MELEE_WEAPON);
                    m_currentDataType = EDataType.MELEE_WEAPON;
                    m_isEquipment     = true;
                    break;

                case "Magic Focus":
                    enumerable        = StaticDataHandler.GetIterator <MagicFocusStaticData>(EDataType.MAGIC_FOCUS);
                    m_currentDataType = EDataType.MAGIC_FOCUS;
                    m_isEquipment     = true;
                    break;

                case "Ranged Weapons":
                    enumerable        = StaticDataHandler.GetIterator <RangedWeaponStaticData>(EDataType.RANGED_WEAPON);
                    m_currentDataType = EDataType.RANGED_WEAPON;
                    m_isEquipment     = true;
                    break;

                case "Potions":
                    enumerable        = StaticDataHandler.GetIterator <PotionStaticData>(EDataType.POTION);
                    m_currentDataType = EDataType.POTION;
                    m_isEquipment     = false;
                    break;

                case "Scrolls":
                    enumerable        = StaticDataHandler.GetIterator <ScrollStaticData>(EDataType.SCROLL);
                    m_currentDataType = EDataType.SCROLL;
                    m_isEquipment     = false;
                    break;
                }
                IEnumerator enumerator = enumerable.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        Object             obj = enumerator.Current;
                        BaseItemStaticData baseItemStaticData = (BaseItemStaticData)obj;
                        m_itemList.items.Add(baseItemStaticData.NameKey);
                        m_staticIdList.Add(baseItemStaticData.StaticID);
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                if (m_itemList.items.Count > 0)
                {
                    m_itemList.selection = m_itemList.items[0];
                }
                else
                {
                    m_itemList.selection = String.Empty;
                }
                NGUITools.SetActive(m_prefixList.gameObject, m_isEquipment);
                NGUITools.SetActive(m_suffixList.gameObject, m_isEquipment);
            }
        }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 30
0
        private Int32 UpdateAbilities(EClass p_class)
        {
            for (Int32 i = 0; i < 2; i++)
            {
                m_abilityDesc[i].text   = String.Empty;
                m_abilityHeader[i].text = String.Empty;
                NGUITools.SetActive(m_abilityIcon[i].gameObject, false);
                NGUITools.SetActive(m_abilityBorder[i].gameObject, false);
            }
            Int32 num = 0;
            List <ParagonAbilitiesStaticData> list = new List <ParagonAbilitiesStaticData>(StaticDataHandler.GetIterator <ParagonAbilitiesStaticData>(EDataType.PARAGON_ABILITES));

            foreach (ParagonAbilitiesStaticData paragonAbilitiesStaticData in list)
            {
                if (paragonAbilitiesStaticData.Class == p_class)
                {
                    m_abilityDesc[num].text       = paragonAbilitiesStaticData.GetDescription();
                    m_abilityHeader[num].text     = LocaManager.GetText(paragonAbilitiesStaticData.NameKey);
                    m_abilityIcon[num].spriteName = paragonAbilitiesStaticData.Icon;
                    NGUITools.SetActive(m_abilityIcon[num].gameObject, true);
                    NGUITools.SetActive(m_abilityBorder[num].gameObject, true);
                    num++;
                }
            }
            return(num);
        }