示例#1
0
        public static SquadMsg GenerateMessageFromTroopDonateResponse(TroopDonateResponse response)
        {
            SqmDonationData sqmDonationData = new SqmDonationData();

            sqmDonationData.Donations = response.TroopsDonated;
            return(new SquadMsg
            {
                DonationData = sqmDonationData
            });
        }
示例#2
0
        public void UpdateTroopDonationProgress(TroopDonateResponse response)
        {
            CurrentPlayer currentPlayer = Service.CurrentPlayer;

            currentPlayer.UpdateTroopDonationProgress(response.DonationCount, response.LastTrackedDonationTime, response.DonationCooldownEndTime);
            EventManager eventManager = Service.EventManager;

            eventManager.SendEvent(EventId.TroopDonationTrackProgressUpdated, null);
            if (response.ReputationAwarded)
            {
                Inventory inventory = currentPlayer.Inventory;
                inventory.ModifyReputation(GameConstants.SQUADPERK_DONATION_REPUTATION_AWARD);
                Lang   lang   = Service.Lang;
                string status = lang.Get("PERK_TROOP_DONATE_REP_REWARD_AMOUNT", new object[]
                {
                    GameConstants.SQUADPERK_DONATION_REPUTATION_AWARD
                });
                string toast = lang.Get("PERK_TROOP_DONATE_REP_REWARD_DESC", new object[0]);
                Service.UXController.MiscElementsManager.ShowToast(toast, status, string.Empty);
                eventManager.SendEvent(EventId.TroopDonationTrackRewardReceived, null);
            }
        }