private void OnPerkUpgraded(SquadMsg msg) { StaticDataController staticDataController = Service.StaticDataController; Squad currentSquad = Service.SquadController.StateManager.GetCurrentSquad(); if (currentSquad == null) { Service.Logger.Error("SquadController.OnPerkUpgraded: Current Squad Null"); return; } SquadPerks perks = currentSquad.Perks; string perkUId = msg.PerkData.PerkUId; PerkVO optional = staticDataController.GetOptional <PerkVO>(perkUId); if (optional == null) { Service.Logger.ErrorFormat("SquadController.OnPerkUpgraded: Given Perk is Null {0}", new object[] { perkUId }); return; } perks.UpdateUnlockedPerk(perkUId); Service.PerkViewController.AddToPerkBadgeList(perkUId); Service.EventManager.SendEvent(EventId.SquadPerkUpdated, null); Service.EventManager.SendEvent(EventId.PerkUpgraded, optional); }
private void OnInvestClicked(UXButton btn) { Lang lang = Service.Lang; if (this.nextInvestAmt <= 0) { if (this.GetCurrentReputation() < 1) { string instructions = lang.Get("PERK_UPGRADE_INVEST_NOT_ENOUGH_REPUTATION", new object[0]); Service.UXController.MiscElementsManager.ShowPlayerInstructionsError(instructions); } return; } this.internalInvestCount += this.nextInvestAmt; this.UpdateRemainingPerkCost(); Squad squad = Service.CurrentPlayer.Squad; if (squad == null) { return; } SquadPerks perks = squad.Perks; string squadLevelUIDFromSquad = GameUtils.GetSquadLevelUIDFromSquad(squad); Service.PerkManager.InvestInPerk(this.nextInvestAmt, this.perkToInvestIn.Uid, perks.Available, squadLevelUIDFromSquad); Service.EventManager.SendEvent(EventId.PerkInvested, null); this.nextInvestAmt = 0; this.UpdateInvestUIBasedOnNewAmt(); }
private void OnPerkInvestment(SquadMsg msg) { Squad currentSquad = this.StateManager.GetCurrentSquad(); SquadPerks perks = currentSquad.Perks; SqmSquadData squadData = msg.SquadData; SqmPerkData perkData = msg.PerkData; int level = squadData.Level; if (level > currentSquad.Level) { currentSquad.Level = level; } currentSquad.TotalRepInvested = squadData.TotalRepInvested; perks.UpdatePerkInvestedAmt(perkData.PerkUId, perkData.PerkInvestedAmt); Service.EventManager.SendEvent(EventId.SquadPerkUpdated, null); Service.EventManager.SendEvent(EventId.PerkInvestment, null); }