private CrateSupplyVO GrantSingleSupplyCrateReward(string crateSupplyId, int hqLevel) { IDataController dataController = Service.Get <IDataController>(); CrateSupplyVO crateSupplyVO = dataController.Get <CrateSupplyVO>(crateSupplyId); switch (crateSupplyVO.Type) { case SupplyType.Currency: case SupplyType.Shard: { RewardVO vo = this.GenerateRewardFromSupply(crateSupplyVO, hqLevel); Service.Get <RewardManager>().TryAndGrantReward(vo, null, null, false); break; } case SupplyType.Troop: case SupplyType.Hero: case SupplyType.SpecialAttack: { RewardVO vo2 = this.GenerateRewardFromSupply(crateSupplyVO, hqLevel); GameUtils.AddRewardToInventory(vo2); break; } case SupplyType.ShardTroop: case SupplyType.ShardSpecialAttack: Service.Get <DeployableShardUnlockController>().GrantUnlockShards(crateSupplyVO.RewardUid, this.GetRewardAmount(crateSupplyVO, hqLevel)); break; case SupplyType.Invalid: Service.Get <StaRTSLogger>().Error("Supply Type Invalid: " + crateSupplyVO.Uid); break; } return(crateSupplyVO); }
public void GrantSingleSupplyCrateReward(CrateSupplyVO crateSupplyData, int hqLevel) { switch (crateSupplyData.Type) { case SupplyType.Currency: case SupplyType.Shard: { RewardVO vo = this.GenerateRewardFromSupply(crateSupplyData, hqLevel); Service.RewardManager.TryAndGrantReward(vo, null, null, false); break; } case SupplyType.Troop: case SupplyType.Hero: case SupplyType.SpecialAttack: { RewardVO vo2 = this.GenerateRewardFromSupply(crateSupplyData, hqLevel); GameUtils.AddRewardToInventory(vo2); break; } case SupplyType.ShardTroop: case SupplyType.ShardSpecialAttack: Service.DeployableShardUnlockController.GrantUnlockShards(crateSupplyData.RewardUid, this.GetRewardAmount(crateSupplyData, hqLevel)); break; case SupplyType.Invalid: Service.Logger.Error("Supply Type Invalid: " + crateSupplyData.Uid); break; } }
public static void GrantInAppPurchaseRewardToHQInventory(RewardVO reward) { UnlockController unlockController = Service.Get <UnlockController>(); unlockController.GrantBuildingUnlockReward(reward.BuildingUnlocks); unlockController.GrantTroopUnlockReward(reward.TroopUnlocks); unlockController.GrantTroopUnlockReward(reward.HeroUnlocks); unlockController.GrantSpecialAttackUnlockReward(reward.SpecialAttackUnlocks); GameUtils.AddRewardToInventory(reward); }
public void GrantShopSupply(CrateSupplyVO supplyData, int quantity) { RewardVO rewardVO = new RewardVO(); rewardVO.Uid = supplyData.RewardUid; string[] array = new string[] { supplyData.RewardUid + ":" + quantity }; switch (supplyData.Type) { case SupplyType.Currency: rewardVO.CurrencyRewards = array; Service.RewardManager.TryAndGrantReward(rewardVO, null, null, false); break; case SupplyType.Shard: rewardVO.ShardRewards = array; Service.RewardManager.TryAndGrantReward(rewardVO, null, null, false); break; case SupplyType.Troop: rewardVO.TroopRewards = array; GameUtils.AddRewardToInventory(rewardVO); break; case SupplyType.Hero: rewardVO.HeroRewards = array; GameUtils.AddRewardToInventory(rewardVO); break; case SupplyType.SpecialAttack: rewardVO.SpecialAttackRewards = array; GameUtils.AddRewardToInventory(rewardVO); break; case SupplyType.ShardTroop: Service.DeployableShardUnlockController.GrantUnlockShards(rewardVO.Uid, quantity); break; case SupplyType.ShardSpecialAttack: Service.DeployableShardUnlockController.GrantUnlockShards(rewardVO.Uid, quantity); break; } }
private void ClaimReward(string limitedTimeRewardUid, string contextUid) { if (!string.IsNullOrEmpty(contextUid)) { StaticDataController staticDataController = Service.StaticDataController; LimitedTimeRewardVO optional = staticDataController.GetOptional <LimitedTimeRewardVO>(limitedTimeRewardUid); if (optional == null) { Service.Logger.WarnFormat("No LimitedTimeReward data found for uid: {0}", new object[] { limitedTimeRewardUid }); return; } RewardVO optional2 = staticDataController.GetOptional <RewardVO>(optional.RewardUid); if (optional2 == null) { Service.Logger.WarnFormat("LimitedTimeReward {0} points to reward {1} but it was not found", new object[] { limitedTimeRewardUid, optional.RewardUid }); return; } HolonetClaimRewardRequest request = new HolonetClaimRewardRequest(limitedTimeRewardUid, contextUid); HolonetClaimRewardCommand command = new HolonetClaimRewardCommand(request); Service.ServerAPI.Sync(command); GameUtils.AddRewardToInventory(optional2); Service.CurrentPlayer.AddHolonetReward(limitedTimeRewardUid); Lang lang = Service.Lang; string text = lang.Get(optional.Title, new object[0]); AlertScreen.ShowModal(false, lang.Get("hn_reward_redeemed", new object[0]), lang.Get("hn_reward_claimed_desc", new object[] { text }), null, null); } }