private void SetCharShipmentItem(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec, bool isSealOfFateHack = false) { 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_itemName.text = record.Display; Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record.IconFileDataID); 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.UpdateItemSlots(); this.UpdateRecruitButtonState(); }
public static bool CanPickupShipmentType(int charShipmentID) { bool canPickup; List <WrapperShipmentType> .Enumerator enumerator = PersistentShipmentData.instance.m_availableShipmentTypes.GetEnumerator(); try { while (enumerator.MoveNext()) { WrapperShipmentType current = enumerator.Current; if (current.CharShipmentID != charShipmentID) { continue; } canPickup = current.CanPickup; return(canPickup); } return(false); } finally { ((IDisposable)enumerator).Dispose(); } return(canPickup); }
private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_rightStackLayoutElement.minHeight = 170f; this.m_isTroop = true; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(true); this.m_itemSpecificArea.SetActive(false); this.m_troopName.gameObject.SetActive(true); this.m_itemName.gameObject.SetActive(false); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { this.m_troopName.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) { this.m_troopName.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.sprite = sprite; } for (int i = 0; i < record.Vitality; i++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false); } this.m_troopName.text = record2.Name; foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID) where rec.FactionIndex == (int)GarrisonStatus.Faction() select rec) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject2.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component = gameObject2.GetComponent <AbilityDisplay>(); component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null); } this.UpdateTroopSlots(); this.m_troopResourceCostText.text = string.Empty + shipmentType.CurrencyCost; Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite2 != null) { this.m_troopResourceIcon.sprite = sprite2; } this.UpdateRecruitButtonState(); }
private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_isTroop = true; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(true); this.m_itemSpecificArea.SetActive(false); this.m_troopName.gameObject.SetActive(true); this.m_itemName.gameObject.SetActive(false); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { Debug.LogError(string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID)); this.m_troopName.text = string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID); return; } this.m_followerRec = record; int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID); CreatureRec creatureRec = StaticDB.creatureDB.GetRecord(num); if (creatureRec == null) { Debug.LogError(string.Concat("Invalid Creature ID: ", num)); this.m_troopName.text = string.Concat("Invalid Creature ID: ", num); return; } int d = creatureRec.ID; string str = string.Concat("Assets/BundleAssets/PortraitIcons/cid_", d.ToString("D8"), ".png"); AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(str); for (int i = 0; i < record.Vitality; i++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false); } this.m_troopName.text = creatureRec.Name; foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID) where rec.FactionIndex == (int)GarrisonStatus.Faction() select rec) { GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject1.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component = gameObject1.GetComponent <AbilityDisplay>(); component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null); } this.UpdateTroopSlots(); this.m_troopResourceCostText.text = string.Concat(string.Empty, shipmentType.CurrencyCost); Sprite sprite = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite != null) { this.m_troopResourceIcon.sprite = sprite; } this.UpdateRecruitButtonState(); }
public void SetCharShipment(WrapperShipmentType?shipmentType, bool isSealOfFateHack = false, CharShipmentRec sealOfFateHackCharShipmentRec = null) { this.m_akHintText.gameObject.SetActive(false); if (!isSealOfFateHack) { this.m_shipmentCost = shipmentType.Value.CurrencyCost; } else { this.m_shipmentCost = 0; } Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { Transform transforms = componentsInChildren[i]; if (transforms != this.m_troopHeartContainer.transform) { transforms.transform.SetParent(null); UnityEngine.Object.Destroy(transforms.gameObject); } } AbilityDisplay[] abilityDisplayArray = this.m_traitsAndAbilitiesRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int j = 0; j < (int)abilityDisplayArray.Length; j++) { AbilityDisplay abilityDisplay = abilityDisplayArray[j]; abilityDisplay.transform.SetParent(null); UnityEngine.Object.Destroy(abilityDisplay.gameObject); } TroopSlot[] troopSlotArray = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true); for (int k = 0; k < (int)troopSlotArray.Length; k++) { TroopSlot troopSlot = troopSlotArray[k]; troopSlot.transform.SetParent(null); UnityEngine.Object.Destroy(troopSlot.gameObject); } CharShipmentRec charShipmentRec = (!isSealOfFateHack ? StaticDB.charShipmentDB.GetRecord(shipmentType.Value.CharShipmentID) : sealOfFateHackCharShipmentRec); if (charShipmentRec == null) { WrapperShipmentType value = shipmentType.Value; Debug.LogError(string.Concat("Invalid Shipment ID: ", value.CharShipmentID)); Text mTroopName = this.m_troopName; WrapperShipmentType wrapperShipmentType = shipmentType.Value; mTroopName.text = string.Concat("Invalid Shipment ID: ", wrapperShipmentType.CharShipmentID); return; } if (charShipmentRec.GarrFollowerID > 0) { this.SetCharShipmentTroop(shipmentType.Value, charShipmentRec); } else if (charShipmentRec.DummyItemID > 0) { this.SetCharShipmentItem(shipmentType.Value, (!isSealOfFateHack ? charShipmentRec : sealOfFateHackCharShipmentRec), isSealOfFateHack); } }