private void OnDonateConfirm(UXButton button) { SquadMsg message; if (this.isWarRequest) { message = SquadMsgUtils.CreateWarDonateMessage(this.recipientId, this.troopsToDonate, this.GetNumberOfTroopsDonated(), this.requestId, new SquadController.ActionCallback(this.OnDonationComplete), null); } else { message = SquadMsgUtils.CreateDonateMessage(this.recipientId, this.troopsToDonate, this.GetNumberOfTroopsDonated(), this.requestId, new SquadController.ActionCallback(this.OnDonationComplete), null); } SquadController squadController = Service.Get <SquadController>(); squadController.TakeAction(message); ProcessingScreen.Show(); }
public override void Perform() { Service.BotRunner.Log("Donating Troops", new object[0]); Service.BotRunner.Performing = true; SquadMsg squadMsg = (SquadMsg)Service.BotRunner.BotProperties[(string)this.arg]; Dictionary <string, int> dictionary = new Dictionary <string, int>(); CurrentPlayer currentPlayer = Service.CurrentPlayer; string text = (currentPlayer.Faction != FactionType.Empire) ? "Soldier" : "Storm"; int level = currentPlayer.UnlockedLevels.Troops.GetLevel(text); TroopTypeVO byLevel = Service.TroopUpgradeCatalog.GetByLevel(text, level); int num = 4; dictionary.Add(byLevel.Uid, num); SquadMsg message = SquadMsgUtils.CreateDonateMessage(squadMsg.OwnerData.PlayerId, dictionary, num, squadMsg.NotifId, new SquadController.ActionCallback(this.OnComplete), squadMsg); SquadController squadController = Service.SquadController; squadController.TakeAction(message); }