private FixedReward GetFixedReward(int rewardID, int rewardCount) { FixedReward reward = new FixedReward(); DbfRecord dbfRecReward = GameDbf.FixedReward.GetRecord(rewardID); if (dbfRecReward != null) { FixedRewardType type; if (!EnumUtils.TryGetEnum <FixedRewardType>(dbfRecReward.GetString("TYPE"), out type)) { return(reward); } switch (type) { case FixedRewardType.CARD: { NetCache.CardDefinition cardDefinition = this.GetCardDefinition(dbfRecReward); if (cardDefinition != null) { reward.FixedCardRewardData = new CardRewardData(cardDefinition.Name, cardDefinition.Premium, rewardCount); } return(reward); } case FixedRewardType.CARD_BACK: { int @int = dbfRecReward.GetInt("CARD_BACK_ID"); reward.FixedCardBackRewardData = new CardBackRewardData(@int); return(reward); } case FixedRewardType.CRAFTABLE_CARD: { NetCache.CardDefinition definition2 = this.GetCardDefinition(dbfRecReward); if (definition2 != null) { reward.FixedCraftableCardRewardData = definition2; } return(reward); } case FixedRewardType.META_ACTION_FLAGS: { int metaActionID = dbfRecReward.GetInt("META_ACTION_ID"); ulong uLong = dbfRecReward.GetULong("META_ACTION_FLAGS"); reward.FixedMetaActionRewardData = new FixedMetaActionReward(metaActionID); reward.FixedMetaActionRewardData.UpdateFlags(uLong, 0L); return(reward); } } } return(reward); }
private List <RewardData> GetRewardsForAction(int actionID, HashSet <RewardVisualTiming> rewardTimings) { List <RewardData> list = new List <RewardData>(); foreach (DbfRecord record in GameUtils.GetFixedRewardMapRecordsForAction(actionID)) { RewardVisualTiming timing; int @int = record.GetInt("REWARD_COUNT"); if (((@int > 0) && EnumUtils.TryGetEnum <RewardVisualTiming>(record.GetString("REWARD_TIMING"), out timing)) && rewardTimings.Contains(timing)) { int rewardID = record.GetInt("REWARD_ID"); FixedReward fixedReward = this.GetFixedReward(rewardID, @int); if (fixedReward.FixedCardRewardData != null) { list.Add(fixedReward.FixedCardRewardData); } else if (fixedReward.FixedCardBackRewardData != null) { list.Add(fixedReward.FixedCardBackRewardData); } } } return(list); }