public static Reward GetRewardForProgressionLevel(int level) { Reward reward = new Reward(); Dictionary <ProgressionUnlockCategory, string[]> unlockedIDsForLevel = Service.Get <ProgressionService>().GetUnlockedIDsForLevel(level); Dictionary <ProgressionUnlockCategory, ProgressionService.UnlockDefinition> unlockedDefinitionsForLevel = Service.Get <ProgressionService>().GetUnlockedDefinitionsForLevel(level); Dictionary <ProgressionUnlockCategory, int> unlockedCountsForLevel = Service.Get <ProgressionService>().GetUnlockedCountsForLevel(level); foreach (KeyValuePair <ProgressionUnlockCategory, string[]> item in unlockedIDsForLevel) { if (RewardableLoader.RewardableTypeMap.ContainsKey(item.Key.ToString())) { for (int i = 0; i < item.Value.Length; i++) { reward.Add(RewardableLoader.GenerateRewardable(item.Key.ToString(), item.Value)); } } } foreach (KeyValuePair <ProgressionUnlockCategory, ProgressionService.UnlockDefinition> item2 in unlockedDefinitionsForLevel) { string text = item2.Key.ToString(); Type elementType = typeof(ProgressionUnlockDefinition).GetField(text).FieldType.GetElementType(); if (elementType != null) { FieldInfo attributedField = StaticGameDataDefinitionIdAttribute.GetAttributedField(elementType); if (attributedField != null) { if (RewardableLoader.RewardableTypeMap.ContainsKey(text) && item2.Value.Definitions.Length > 0) { Type type = attributedField.GetValue(item2.Value.Definitions[0]).GetType(); Type type2 = typeof(List <>).MakeGenericType(type); IList list = (IList)Activator.CreateInstance(type2); for (int i = 0; i < item2.Value.Definitions.Length; i++) { list.Add(attributedField.GetValue(item2.Value.Definitions[i])); } for (int i = 0; i < list.Count; i++) { reward.Add(RewardableLoader.GenerateRewardable(text, list[i])); } } } else { Log.LogErrorFormatted(typeof(RewardUtils), "Could not find a StaticGameDataDefinitionId field on type {0}", elementType); } } else { Log.LogErrorFormatted(typeof(RewardUtils), "Could not find an element type for the field {0}, the field must be an array", text); } } foreach (KeyValuePair <ProgressionUnlockCategory, int> item3 in unlockedCountsForLevel) { if (RewardableLoader.RewardableTypeMap.ContainsKey(item3.Key.ToString())) { reward.Add(RewardableLoader.GenerateRewardable(item3.Key.ToString(), item3.Value)); } } return(reward); }
public static void QA_SetMascotXP([NamedToggleValue(typeof(MascotService.MascotNameGenerator), 0u)] string mascot, int xp) { Reward reward = new Reward(); reward.Add(new MascotXPReward(mascot, xp)); Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward); }
public static void QA_SetCoins(int coins) { Reward reward = new Reward(); reward.Add(new CoinReward(coins)); Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward); }
public static void QA_SetCollectibleCount([NamedToggleValue(typeof(CollectibleDefinitionService.CollectibleTypeGenerator), 0u)] string type, int count) { Reward reward = new Reward(); reward.Add(new CollectibleReward(type, count)); Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward); }
void Update() { float z = agent.transform.position.z; if (range.start <= z && z <= range.end) { if (!rewardShown && waited >= 2 * 60) { rewardCount += 1; Reward.Add(2.0F); GameObject rewardObj = (GameObject)GameObject.Instantiate( reward, new Vector3(0.0F, 0.5F, 23.0F), Quaternion.identity ); rewardObj.transform.parent = transform; rewardShown = true; } waited += 1; } else { waited = 0; } }
public Reward ToReward() { Reward reward = new Reward(); using (IEnumerator <IRewardableDefinition> enumerator = GetEnumerator()) { while (enumerator.MoveNext()) { IRewardableDefinition current = enumerator.Current; if (current == null) { Log.LogErrorFormatted(this, "Contains null reward definition {0}", current); } try { reward.Add(current.Reward); } catch (Exception ex) { Log.LogErrorFormatted(this, "Skipping bad reward component {0}, in {1}, throwing exception {2}", current, base.name, ex.Message); Log.LogException(this, ex); } } } return(reward); }
private static void setXpForAllMascots(int xp) { Reward reward = new Reward(); foreach (Mascot mascot in Service.Get <MascotService>().Mascots) { reward.Add(new MascotXPReward(mascot.Name, xp)); } Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward); }
private void qaSetFurnitureCount(int count = 10) { Dictionary <int, int> dictionary = new Dictionary <int, int>(); Dictionary <int, int> dictionary2 = new Dictionary <int, int>(); Reward reward = new Reward(); foreach (int key in Service.Get <IGameData>().Get <Dictionary <int, DecorationDefinition> >().Keys) { reward.Add(new DecorationInstanceReward(key, count)); dictionary.Add(key, count); } foreach (int key2 in Service.Get <IGameData>().Get <Dictionary <int, StructureDefinition> >().Keys) { reward.Add(new StructureInstanceReward(key2, count)); dictionary2.Add(key2, count); } Service.Get <INetworkServicesManager>().RewardService.QA_SetReward(reward); if (decorationInventory != null && structureInventory != null) { decorationInventory.Decorations = dictionary; structureInventory.Structures = dictionary2; } }
public override void OnEnter() { EventDispatcher eventDispatcher = Service.Get <EventDispatcher>(); if (Xp > 0) { Reward reward = new Reward(); reward.Add(new MascotXPReward(MascotName, Xp)); eventDispatcher.DispatchEvent(new RewardServiceEvents.MyRewardEarned(RewardSource.QUEST_OBJECTIVE, base.Name, reward)); } if (Coins > 0) { Service.Get <CPDataEntityCollection>().GetComponent <CoinsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle).AddCoins(Coins); } Finish(); }
void Update() { float x = agent.transform.position.x; if (0.0f <= x && x <= 4.0f) { if (!waited && (waitedTime >= 2 * 60)) { Reward.Add(2.0F); waited = true; } waitedTime += 1; } else { waitedTime = 0; } }
public Reward ToReward() { Reward reward = new Reward(); using (Enumerator enumerator = GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <string, JsonData> current = enumerator.Current; if (RewardableLoader.RewardableTypeMap.ContainsKey(current.Key) && current.Value != null) { IRewardable rewardable = RewardableLoader.GenerateRewardable(current.Key); rewardable.FromJson(current.Value); reward.Add(rewardable); } } } return(reward); }
void Update() { float z = agent.transform.position.z; if (11.5F <= z && z <= 15.5F) { if (!rewardShown) { rewardCount += 1; Reward.Add(2.0F); GameObject rewardObj = (GameObject)GameObject.Instantiate( reward, new Vector3(0.0F, 0.5F, 23.0F), Quaternion.identity ); rewardObj.transform.parent = transform; rewardShown = true; } } }
private void onGetInventoryComplete() { Reward reward = item.Definition.Reward.ToReward(); if (reward.TryGetValue <EquipmentInstanceReward>(out var rewardable)) { CustomEquipment[] array = rewardable.EquipmentInstances.ToArray(); reward.ClearReward(typeof(EquipmentInstanceReward)); for (int i = 0; i < array.Length; i++) { if (InventoryUtils.TryGetDCustomEquipment(array[i], out var equipmentData)) { array[i].equipmentId = equipmentData.Id; } reward.Add(new EquipmentInstanceReward(array[i])); } } Service.Get <EventDispatcher>().DispatchEvent(new DisneyStoreEvents.PurchaseComplete(reward)); hidePurchaseModal(); }
void FixedUpdate() { base.FixedUpdate(); float z = agent.transform.position.z; if (elapsed < 130) { agent.controller.Paralyzed = true; selector.Visible = true; elapsed += 1; } else { agent.controller.Paralyzed = false; selector.Visible = false; } if (range.start <= z && z <= range.end) { if (!rewardShown && waited >= 2 * 60) { rewardCount += 1; Reward.Add(2.0F); GameObject rewardObj = (GameObject)GameObject.Instantiate( reward, new Vector3(0.0F, 0.5F, 23.0F), Quaternion.identity ); rewardObj.transform.parent = transform; rewardShown = true; } waited += 1; } else { waited = 0; } }
void Update() { float x = agent.transform.position.x; if (0.0f <= x && x <= 4.0f) { if (!waited && (waitedTime >= 2 * 60)) { Reward.Add(2.0F); GameObject rewardObj = (GameObject)GameObject.Instantiate( reward, new Vector3(10.56F, 0.5F, 8.05F), Quaternion.identity ); waited = true; } waitedTime += 1; } else { waitedTime = 0; } }
protected virtual void Punishment() { Reward.Add(-0.001F); }
protected virtual void OnRewardCollision() { rewardCount += 1; Reward.Add(2.0F); }