public override bool EvaluateUpdate() { int storage = Service.BuildingLookupController.SquadBuildingNodeList.Head.BuildingComp.BuildingType.Storage; int donatedTroopStorageUsedByWorldOwner = SquadUtils.GetDonatedTroopStorageUsedByWorldOwner(); Service.BotRunner.Log("Squad Center Capacity: {0} > {1} : {2}", new object[] { storage, donatedTroopStorageUsedByWorldOwner, storage >= donatedTroopStorageUsedByWorldOwner }); return(storage > donatedTroopStorageUsedByWorldOwner); }
private void UpdateHousingSpace() { int donatedTroopStorageUsedByWorldOwner = SquadUtils.GetDonatedTroopStorageUsedByWorldOwner(); int storage = this.buildingInfo.Storage; UXLabel currentLabel = this.sliders[1].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(donatedTroopStorageUsedByWorldOwner), this.lang.ThousandsSeparated(storage) }); UXSlider currentSlider = this.sliders[1].CurrentSlider; float value = (storage != 0) ? ((float)donatedTroopStorageUsedByWorldOwner / (float)storage) : 0f; currentSlider.Value = value; }
protected void InitTroopGrid() { base.InitGrid(); GamePlayer worldOwner = GameUtils.GetWorldOwner(); List <SquadDonatedTroop> worldOwnerSquadBuildingTroops = SquadUtils.GetWorldOwnerSquadBuildingTroops(); int count = worldOwnerSquadBuildingTroops.Count; if (count > 0) { Dictionary <string, string> dictionary = null; if (worldOwner.Squad != null) { dictionary = new Dictionary <string, string>(); List <SquadMember> memberList = worldOwner.Squad.MemberList; int i = 0; int count2 = memberList.Count; while (i < count2) { SquadMember squadMember = memberList[i]; dictionary.Add(squadMember.MemberID, squadMember.MemberName); i++; } } StaticDataController staticDataController = Service.StaticDataController; for (int j = 0; j < count; j++) { SquadDonatedTroop squadDonatedTroop = worldOwnerSquadBuildingTroops[j]; TroopTypeVO troopTypeVO = staticDataController.Get <TroopTypeVO>(squadDonatedTroop.TroopUid); int totalAmount = squadDonatedTroop.GetTotalAmount(); if (totalAmount > 0) { string tooltipString = this.GetTooltipString(troopTypeVO, squadDonatedTroop, dictionary); base.AddTroopItem(troopTypeVO, totalAmount, tooltipString); } } } if (!this.inVisitMode && worldOwner.Squad != null && SquadUtils.GetDonatedTroopStorageUsedByWorldOwner() < this.buildingInfo.Storage) { this.AddTroopRequestItem(); } else { this.requestResendCost = null; } base.RepositionGridItems(); }
private string GetBubbleText(SmartEntity building, bool homeState, bool editState, bool isSelected) { string result = null; GamePlayer worldOwner = GameUtils.GetWorldOwner(); if (homeState) { BuildingTypeVO buildingType = building.BuildingComp.BuildingType; BuildingType type = buildingType.Type; switch (type) { case BuildingType.HQ: { int numInventoryItemsNotViewed = GameUtils.GetNumInventoryItemsNotViewed(); if (!Service.CurrentPlayer.CampaignProgress.FueInProgress && numInventoryItemsNotViewed > 0) { result = Service.Lang.Get("HQ_BADGE", new object[0]); } return(result); } case BuildingType.Barracks: case BuildingType.Factory: case BuildingType.DefenseResearch: goto IL_2DD; case BuildingType.FleetCommand: { int totalStorageCapacity = worldOwner.Inventory.SpecialAttack.GetTotalStorageCapacity(); int totalStorageAmount = worldOwner.Inventory.SpecialAttack.GetTotalStorageAmount(); if (totalStorageAmount >= totalStorageCapacity) { result = Service.Lang.Get("FULL", new object[0]); } else { result = LangUtils.GetBuildingVerb(buildingType.Type); } return(result); } case BuildingType.HeroMobilizer: { int totalStorageCapacity2 = worldOwner.Inventory.Hero.GetTotalStorageCapacity(); int totalStorageAmount2 = worldOwner.Inventory.Hero.GetTotalStorageAmount(); if (totalStorageAmount2 >= totalStorageCapacity2) { result = Service.Lang.Get("FULL", new object[0]); } else { result = LangUtils.GetBuildingVerb(buildingType.Type); } return(result); } case BuildingType.ChampionPlatform: case BuildingType.Housing: case BuildingType.DroidHut: case BuildingType.Wall: case BuildingType.Turret: IL_63: switch (type) { case BuildingType.Cantina: case BuildingType.NavigationCenter: goto IL_2DD; case BuildingType.ScoutTower: return(result); case BuildingType.Armory: if (this.ShouldBadgeArmoryBuilding()) { result = Service.Lang.Get("HQ_BADGE", new object[0]); } else if (ArmoryUtils.IsArmoryFull(Service.CurrentPlayer)) { result = Service.Lang.Get("ARMORY_TOOLTIP_FULL", new object[0]); } else if (ArmoryUtils.IsArmoryEmpty(Service.CurrentPlayer)) { result = Service.Lang.Get("ARMORY_TOOLTIP_EMPTY", new object[0]); } else { result = LangUtils.GetBuildingVerb(buildingType.Type); } return(result); default: return(result); } break; case BuildingType.Squad: if (worldOwner.Squad != null) { int donatedTroopStorageUsedByWorldOwner = SquadUtils.GetDonatedTroopStorageUsedByWorldOwner(); int storage = buildingType.Storage; if (donatedTroopStorageUsedByWorldOwner >= storage) { result = Service.Lang.Get("FULL", new object[0]); } else { result = Service.Lang.Get("context_RequestTroops", new object[0]); } } else { result = Service.Lang.Get("context_Join", new object[0]); } return(result); case BuildingType.Starport: if (!isSelected) { int donatedTroopStorageUsedByWorldOwner; int storage; GameUtils.GetStarportTroopCounts(out donatedTroopStorageUsedByWorldOwner, out storage); if (donatedTroopStorageUsedByWorldOwner >= storage) { result = Service.Lang.Get("FULL", new object[0]); } } return(result); case BuildingType.TroopResearch: if (this.ShouldBadgeResearchBuilding()) { result = Service.Lang.Get("HQ_BADGE", new object[0]); } else { result = LangUtils.GetBuildingVerb(buildingType.Type); } return(result); } goto IL_63; IL_2DD: result = LangUtils.GetBuildingVerb(buildingType.Type); } return(result); }