private void HandleShipmentAdded(int charShipmentID, ulong shipmentDBID) { if (charShipmentID == this.m_shipmentType.CharShipmentID) { TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(); TroopSlot[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { TroopSlot troopSlot = array[i]; if (troopSlot.GetDBID() == shipmentDBID) { return; } } TroopSlot[] array2 = componentsInChildren; for (int j = 0; j < array2.Length; j++) { TroopSlot troopSlot2 = array2[j]; if (troopSlot2.IsEmpty()) { troopSlot2.SetCharShipment(charShipmentID, shipmentDBID, 0, true, 0); break; } } this.UpdateRecruitButtonState(); } }
private void UpdateRecruitButtonState() { TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(); bool flag = false; TroopSlot[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { TroopSlot troopSlot = array[i]; if (troopSlot.IsEmpty()) { flag = true; break; } } bool flag2 = GarrisonStatus.Resources() >= this.m_shipmentCost; this.m_itemResourceCostText.set_color((!flag2) ? Color.get_red() : Color.get_white()); this.m_recruitButtonText.set_color(new Color(1f, 0.82f, 0f, 1f)); if (!flag) { this.m_recruitButtonText.set_text(StaticDB.GetString("SLOTS_FULL", null)); this.m_recruitButtonText.set_color(new Color(0.5f, 0.5f, 0.5f, 1f)); } else if (!flag2) { this.m_recruitButtonText.set_text(StaticDB.GetString("CANT_AFFORD", "Can't Afford")); this.m_recruitButtonText.set_color(new Color(0.5f, 0.5f, 0.5f, 1f)); } else if (this.m_isTroop) { this.m_recruitButtonText.set_text(StaticDB.GetString("RECRUIT", null)); } else { this.m_recruitButtonText.set_text(StaticDB.GetString("PLACE_ORDER", null)); } if (flag && flag2) { this.m_recruitTroopsButton.set_interactable(true); } else { this.m_recruitTroopsButton.set_interactable(false); } }
private void SetTroopSlotForPendingShipment(TroopSlot[] troopSlots, ulong shipmentDBID) { for (int i = 0; i < troopSlots.Length; i++) { TroopSlot troopSlot = troopSlots[i]; if (troopSlot.GetDBID() == shipmentDBID) { return; } } for (int j = 0; j < troopSlots.Length; j++) { TroopSlot troopSlot2 = troopSlots[j]; if (troopSlot2.IsEmpty()) { troopSlot2.SetCharShipment(this.m_shipmentType.CharShipmentID, shipmentDBID, 0, true, 0); return; } } }
private void SetTroopSlotForExistingFollower(TroopSlot[] troopSlots, JamGarrisonFollower follower) { if (follower.Durability <= 0) { return; } for (int i = 0; i < troopSlots.Length; i++) { TroopSlot troopSlot = troopSlots[i]; int ownedFollowerID = troopSlot.GetOwnedFollowerID(); if (ownedFollowerID != 0 && ownedFollowerID == follower.GarrFollowerID) { return; } } for (int j = 0; j < troopSlots.Length; j++) { TroopSlot troopSlot2 = troopSlots[j]; if (troopSlot2.IsCollected()) { GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int iconFileDataID = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceIconFileDataID : record.HordeIconFileDataID; troopSlot2.SetCharShipment(this.m_shipmentType.CharShipmentID, 0uL, follower.GarrFollowerID, false, iconFileDataID); return; } } for (int k = 0; k < troopSlots.Length; k++) { TroopSlot troopSlot3 = troopSlots[k]; if (troopSlot3.IsEmpty()) { GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); int iconFileDataID2 = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record2.AllianceIconFileDataID : record2.HordeIconFileDataID; troopSlot3.SetCharShipment(this.m_shipmentType.CharShipmentID, 0uL, follower.GarrFollowerID, false, iconFileDataID2); return; } } }