private void SetCharShipmentItem(MobileClientShipmentType shipmentType, CharShipmentRec charShipmentRec)
    {
        this.m_isTroop         = false;
        this.m_charShipmentRec = charShipmentRec;
        this.m_troopSpecificArea.SetActive(false);
        this.m_itemSpecificArea.SetActive(true);
        this.m_troopName.get_gameObject().SetActive(false);
        this.m_itemName.get_gameObject().SetActive(true);
        ItemRec record = StaticDB.itemDB.GetRecord(charShipmentRec.DummyItemID);

        if (record == null)
        {
            Debug.LogError("Invalid Item ID: " + charShipmentRec.DummyItemID);
            this.m_troopName.set_text("Invalid Item ID: " + charShipmentRec.DummyItemID);
            return;
        }
        this.m_itemDisplay.InitReward(MissionRewardDisplay.RewardType.item, charShipmentRec.DummyItemID, 1, 0, record.IconFileDataID);
        this.m_itemName.set_text(record.Display);
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID);

        if (sprite != null)
        {
            this.m_troopSnapshotImage.set_sprite(sprite);
        }
        this.m_itemResourceCostText.set_text(string.Empty + shipmentType.CurrencyCost);
        Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID);

        if (sprite2 != null)
        {
            this.m_itemResourceIcon.set_sprite(sprite2);
        }
        this.UpdateItemSlots();
        this.UpdateRecruitButtonState();
    }
    private void SetCharShipmentTroop(MobileClientShipmentType shipmentType, CharShipmentRec charShipmentRec)
    {
        this.m_isTroop      = true;
        this.m_shipmentType = shipmentType;
        this.m_troopSpecificArea.SetActive(true);
        this.m_itemSpecificArea.SetActive(false);
        this.m_troopName.get_gameObject().SetActive(true);
        this.m_itemName.get_gameObject().SetActive(false);
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID);

        if (record == null)
        {
            Debug.LogError("Invalid Follower ID: " + charShipmentRec.GarrFollowerID);
            this.m_troopName.set_text("Invalid Follower ID: " + charShipmentRec.GarrFollowerID);
            return;
        }
        this.m_followerRec = record;
        int         num     = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID;
        CreatureRec record2 = StaticDB.creatureDB.GetRecord(num);

        if (record2 == null)
        {
            Debug.LogError("Invalid Creature ID: " + num);
            this.m_troopName.set_text("Invalid Creature ID: " + num);
            return;
        }
        string text   = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png";
        Sprite sprite = AssetBundleManager.portraitIcons.LoadAsset <Sprite>(text);

        if (sprite != null)
        {
            this.m_troopSnapshotImage.set_sprite(sprite);
        }
        for (int i = 0; i < record.Vitality; i++)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
            gameObject.get_transform().SetParent(this.m_troopHeartContainer.get_transform(), false);
        }
        this.m_troopName.set_text(record2.Name);
        StaticDB.garrFollowerXAbilityDB.EnumRecordsByParentID((int)charShipmentRec.GarrFollowerID, delegate(GarrFollowerXAbilityRec xAbilityRec)
        {
            if (xAbilityRec.FactionIndex == (int)GarrisonStatus.Faction())
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab);
                gameObject2.get_transform().SetParent(this.m_traitsAndAbilitiesRootObject.get_transform(), false);
                AbilityDisplay component = gameObject2.GetComponent <AbilityDisplay>();
                component.SetAbility(xAbilityRec.GarrAbilityID, true, true, null);
            }
            return(true);
        });
        this.UpdateTroopSlots();
        this.m_troopResourceCostText.set_text(string.Empty + shipmentType.CurrencyCost);
        Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID);

        if (sprite2 != null)
        {
            this.m_troopResourceIcon.set_sprite(sprite2);
        }
        this.UpdateRecruitButtonState();
    }
 public static bool ShipmentTypeForShipmentIsAvailable(int charShipmentID)
 {
     MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.instance.m_availableShipmentTypes;
     for (int i = 0; i < availableShipmentTypes.Length; i++)
     {
         MobileClientShipmentType mobileClientShipmentType = availableShipmentTypes[i];
         if (mobileClientShipmentType.CharShipmentID == charShipmentID)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 4
0
    public void SetCharShipment(MobileClientShipmentType shipmentType, bool isSealOfFateHack = false, CharShipmentRec sealOfFateHackCharShipmentRec = null)
    {
        if (isSealOfFateHack)
        {
            this.m_shipmentCost = 0;
        }
        else
        {
            this.m_shipmentCost = shipmentType.CurrencyCost;
        }
        Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true);
        Transform[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            Transform transform = array[i];
            if (transform != this.m_troopHeartContainer.get_transform())
            {
                Object.DestroyImmediate(transform.get_gameObject());
            }
        }
        AbilityDisplay[] componentsInChildren2 = this.m_traitsAndAbilitiesRootObject.GetComponentsInChildren <AbilityDisplay>(true);
        AbilityDisplay[] array2 = componentsInChildren2;
        for (int j = 0; j < array2.Length; j++)
        {
            AbilityDisplay abilityDisplay = array2[j];
            Object.DestroyImmediate(abilityDisplay.get_gameObject());
        }
        TroopSlot[] componentsInChildren3 = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        TroopSlot[] array3 = componentsInChildren3;
        for (int k = 0; k < array3.Length; k++)
        {
            TroopSlot troopSlot = array3[k];
            Object.DestroyImmediate(troopSlot.get_gameObject());
        }
        CharShipmentRec charShipmentRec = (!isSealOfFateHack) ? StaticDB.charShipmentDB.GetRecord(shipmentType.CharShipmentID) : sealOfFateHackCharShipmentRec;

        if (charShipmentRec == null)
        {
            Debug.LogError("Invalid Shipment ID: " + shipmentType.CharShipmentID);
            this.m_troopName.set_text("Invalid Shipment ID: " + shipmentType.CharShipmentID);
            return;
        }
        if (charShipmentRec.GarrFollowerID > 0u)
        {
            this.SetCharShipmentTroop(shipmentType, charShipmentRec);
        }
        else if (charShipmentRec.DummyItemID > 0)
        {
            this.SetCharShipmentItem(shipmentType, (!isSealOfFateHack) ? charShipmentRec : sealOfFateHackCharShipmentRec, isSealOfFateHack);
        }
    }
Esempio n. 5
0
    public void SetCharShipment(MobileClientShipmentType shipmentType, bool isSealOfFateHack = false, CharShipmentRec sealOfFateHackCharShipmentRec = null)
    {
        this.m_akHintText.gameObject.SetActive(false);
        if (isSealOfFateHack)
        {
            this.m_shipmentCost = 0;
        }
        else
        {
            this.m_shipmentCost = shipmentType.CurrencyCost;
        }
        Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true);
        foreach (Transform transform in componentsInChildren)
        {
            if (transform != this.m_troopHeartContainer.transform)
            {
                Object.DestroyImmediate(transform.gameObject);
            }
        }
        AbilityDisplay[] componentsInChildren2 = this.m_traitsAndAbilitiesRootObject.GetComponentsInChildren <AbilityDisplay>(true);
        foreach (AbilityDisplay abilityDisplay in componentsInChildren2)
        {
            Object.DestroyImmediate(abilityDisplay.gameObject);
        }
        TroopSlot[] componentsInChildren3 = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        foreach (TroopSlot troopSlot in componentsInChildren3)
        {
            Object.DestroyImmediate(troopSlot.gameObject);
        }
        CharShipmentRec charShipmentRec = (!isSealOfFateHack) ? StaticDB.charShipmentDB.GetRecord(shipmentType.CharShipmentID) : sealOfFateHackCharShipmentRec;

        if (charShipmentRec == null)
        {
            Debug.LogError("Invalid Shipment ID: " + shipmentType.CharShipmentID);
            this.m_troopName.text = "Invalid Shipment ID: " + shipmentType.CharShipmentID;
            return;
        }
        if (charShipmentRec.GarrFollowerID > 0u)
        {
            this.SetCharShipmentTroop(shipmentType, charShipmentRec);
        }
        else if (charShipmentRec.DummyItemID > 0)
        {
            this.SetCharShipmentItem(shipmentType, (!isSealOfFateHack) ? charShipmentRec : sealOfFateHackCharShipmentRec, isSealOfFateHack);
        }
    }
Esempio n. 6
0
    private void SetCharShipmentItem(MobileClientShipmentType shipmentType, CharShipmentRec charShipmentRec, bool isSealOfFateHack = false)
    {
        this.m_rightStackLayoutElement.minHeight = 120f;
        this.m_isTroop         = false;
        this.m_charShipmentRec = charShipmentRec;
        this.m_troopSpecificArea.SetActive(false);
        this.m_itemSpecificArea.SetActive(true);
        this.m_troopName.gameObject.SetActive(false);
        this.m_itemName.gameObject.SetActive(true);
        ItemRec record = StaticDB.itemDB.GetRecord(charShipmentRec.DummyItemID);

        if (record == null)
        {
            Debug.LogError("Invalid Item ID: " + charShipmentRec.DummyItemID);
            this.m_troopName.text = "Invalid Item ID: " + charShipmentRec.DummyItemID;
            return;
        }
        this.m_itemDisplay.InitReward(MissionRewardDisplay.RewardType.item, charShipmentRec.DummyItemID, 1, 0, record.IconFileDataID);
        this.m_isArtifactResearch = (record.ID == 139390 || record.ID == 146745);
        this.m_itemName.text      = record.Display + ((!this.m_isArtifactResearch) ? string.Empty : this.GetCurrentArtifactPowerText());
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID);

        if (sprite != null)
        {
            this.m_troopSnapshotImage.sprite = sprite;
        }
        this.m_itemResourceCostText.gameObject.SetActive(!isSealOfFateHack);
        this.m_itemResourceIcon.gameObject.SetActive(!isSealOfFateHack);
        if (!isSealOfFateHack)
        {
            this.m_itemResourceCostText.text = string.Empty + shipmentType.CurrencyCost;
            Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID);
            if (sprite2 != null)
            {
                this.m_itemResourceIcon.sprite = sprite2;
            }
        }
        this.UpdateAKStatus();
        this.UpdateItemSlots();
        this.UpdateRecruitButtonState();
    }
Esempio n. 7
0
 private void InitList()
 {
     MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes();
     if (availableShipmentTypes == null || availableShipmentTypes.Length == 0)
     {
         this.m_noRecruitsYetMessage.get_gameObject().SetActive(true);
     }
     else
     {
         this.m_noRecruitsYetMessage.get_gameObject().SetActive(false);
     }
     TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>();
     TroopsListItem[] array = componentsInChildren;
     for (int i = 0; i < array.Length; i++)
     {
         TroopsListItem troopsListItem = array[i];
         bool           flag           = true;
         if (availableShipmentTypes != null)
         {
             MobileClientShipmentType[] array2 = availableShipmentTypes;
             for (int j = 0; j < array2.Length; j++)
             {
                 MobileClientShipmentType mobileClientShipmentType = array2[j];
                 if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID)
                 {
                     flag = false;
                     break;
                 }
             }
         }
         if (flag)
         {
             Object.DestroyImmediate(troopsListItem.get_gameObject());
         }
     }
     if (availableShipmentTypes == null)
     {
         return;
     }
     componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>();
     for (int k = 0; k < availableShipmentTypes.Length; k++)
     {
         bool             flag2  = false;
         TroopsListItem[] array3 = componentsInChildren;
         for (int l = 0; l < array3.Length; l++)
         {
             TroopsListItem troopsListItem2 = array3[l];
             if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID)
             {
                 flag2 = true;
                 break;
             }
         }
         if (!flag2)
         {
             GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab);
             gameObject.get_transform().SetParent(this.m_troopsListContents.get_transform(), false);
             TroopsListItem component = gameObject.GetComponent <TroopsListItem>();
             component.SetCharShipment(availableShipmentTypes[k]);
             FancyEntrance component2 = component.GetComponent <FancyEntrance>();
             component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k;
             component2.Activate();
         }
     }
 }
Esempio n. 8
0
    private void InitList()
    {
        MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes();
        if (availableShipmentTypes == null || availableShipmentTypes.Length == 0)
        {
            this.m_noRecruitsYetMessage.get_gameObject().SetActive(true);
        }
        else
        {
            this.m_noRecruitsYetMessage.get_gameObject().SetActive(false);
        }
        TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true);
        TroopsListItem[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            TroopsListItem troopsListItem = array[i];
            bool           flag           = true;
            if (availableShipmentTypes != null)
            {
                MobileClientShipmentType[] array2 = availableShipmentTypes;
                for (int j = 0; j < array2.Length; j++)
                {
                    MobileClientShipmentType mobileClientShipmentType = array2[j];
                    if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID)
                    {
                        flag = false;
                        break;
                    }
                }
            }
            if (flag)
            {
                Object.DestroyImmediate(troopsListItem.get_gameObject());
            }
        }
        if (availableShipmentTypes == null)
        {
            return;
        }
        componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true);
        for (int k = 0; k < availableShipmentTypes.Length; k++)
        {
            bool             flag2  = false;
            TroopsListItem[] array3 = componentsInChildren;
            for (int l = 0; l < array3.Length; l++)
            {
                TroopsListItem troopsListItem2 = array3[l];
                if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID)
                {
                    flag2 = true;
                    break;
                }
            }
            if (!flag2)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab);
                gameObject.get_transform().SetParent(this.m_troopsListContents.get_transform(), false);
                TroopsListItem component = gameObject.GetComponent <TroopsListItem>();
                component.SetCharShipment(availableShipmentTypes[k], false, null);
                FancyEntrance component2 = component.GetComponent <FancyEntrance>();
                component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k;
                component2.Activate();
            }
        }
        IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)enumerator.get_Current();
                if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(jamCharacterShipment.ShipmentRecID))
                {
                    CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID);
                    if (record != null)
                    {
                        GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab);
                        gameObject2.get_transform().SetParent(this.m_troopsListContents.get_transform(), false);
                        TroopsListItem component3 = gameObject2.GetComponent <TroopsListItem>();
                        component3.SetCharShipment(null, true, record);
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
    }