예제 #1
0
    public void SetTalent(int garrTalentID)
    {
        this.m_garrTalentID = garrTalentID;
        this.m_talent       = null;
        if (PersistentTalentData.talentDictionary.ContainsKey(garrTalentID))
        {
            this.m_talent = (JamGarrisonTalent)PersistentTalentData.talentDictionary.get_Item(garrTalentID);
        }
        this.m_garrTalentRec = StaticDB.garrTalentDB.GetRecord(garrTalentID);
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, this.m_garrTalentRec.IconFileDataID);

        if (sprite != null)
        {
            this.m_missingIconText.get_gameObject().SetActive(false);
            this.m_abilityIcon.set_sprite(sprite);
        }
        else
        {
            this.m_missingIconText.get_gameObject().SetActive(true);
            this.m_missingIconText.set_text(string.Empty + this.m_garrTalentRec.IconFileDataID);
        }
        Material material = new Material(this.m_grayscaleShader);

        this.m_abilityIcon.set_material(material);
        this.m_abilityIcon.get_material().SetFloat("_GrayscaleAmount", 1f);
    }
예제 #2
0
 public static void AddOrUpdateTalent(JamGarrisonTalent talent)
 {
     if (PersistentTalentData.instance.m_talentDictionary.ContainsKey(talent.GarrTalentID))
     {
         PersistentTalentData.instance.m_talentDictionary.Remove(talent.GarrTalentID);
     }
     PersistentTalentData.instance.m_talentDictionary.Add(talent.GarrTalentID, talent);
 }
예제 #3
0
    private int GetMaxTroops(int garrClassSpecID)
    {
        GarrClassSpecRec record = StaticDB.garrClassSpecDB.GetRecord(garrClassSpecID);
        int maxTroops           = 0;

        if (record != null)
        {
            maxTroops = (int)record.FollowerClassLimit;
        }
        IEnumerator enumerator = PersistentTalentData.talentDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object            obj = enumerator.Current;
                JamGarrisonTalent jamGarrisonTalent = (JamGarrisonTalent)obj;
                if ((jamGarrisonTalent.Flags & 1) != 0)
                {
                    GarrTalentRec record2 = StaticDB.garrTalentDB.GetRecord(jamGarrisonTalent.GarrTalentID);
                    if (record2 != null)
                    {
                        StaticDB.garrAbilityEffectDB.EnumRecordsByParentID((int)record2.GarrAbilityID, delegate(GarrAbilityEffectRec effectRec)
                        {
                            if (effectRec.AbilityAction == 34u && (ulong)effectRec.ActionRecordID == (ulong)((long)garrClassSpecID))
                            {
                                maxTroops += (int)effectRec.ActionValueFlat;
                            }
                            return(true);
                        });
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        return(maxTroops);
    }
예제 #4
0
    public static float GetMissionDurationTalentMultiplier()
    {
        float       multiplier = 1f;
        IEnumerator enumerator = PersistentTalentData.talentDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object            obj = enumerator.Current;
                JamGarrisonTalent jamGarrisonTalent = (JamGarrisonTalent)obj;
                if ((jamGarrisonTalent.Flags & 1) != 0)
                {
                    GarrTalentRec record = StaticDB.garrTalentDB.GetRecord(jamGarrisonTalent.GarrTalentID);
                    if (record != null)
                    {
                        if (record.GarrAbilityID > 0u)
                        {
                            StaticDB.garrAbilityEffectDB.EnumRecordsByParentID((int)record.GarrAbilityID, delegate(GarrAbilityEffectRec garrAbilityEffectRec)
                            {
                                if (garrAbilityEffectRec.AbilityAction == 17u)
                                {
                                    multiplier *= garrAbilityEffectRec.ActionValueFlat;
                                }
                                return(true);
                            });
                        }
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        return(multiplier);
    }
예제 #5
0
 public void HandleCanResearchGarrisonTalentResult(int garrTalentID, int result, string whyCantResearch)
 {
     if (this.m_garrTalentID != garrTalentID)
     {
         return;
     }
     if (PersistentTalentData.talentDictionary.ContainsKey(garrTalentID))
     {
         this.m_talent = (JamGarrisonTalent)PersistentTalentData.talentDictionary.get_Item(garrTalentID);
     }
     this.m_garrTalentRec = StaticDB.garrTalentDB.GetRecord(garrTalentID);
     this.m_canResearch   = false;
     if (result == 0)
     {
         this.m_canResearch = true;
     }
     else
     {
         this.m_whyCantResearch = whyCantResearch;
     }
 }