public void Read(BinaryReader br) { NoLevelRestrictions = br.ReadBoolean(); int dictionaryCount = br.ReadInt32(); for (int i = 0; i < dictionaryCount; i++) { ActivityLocks.Add(br.ReadString(), br.ReadBoolean()); } dictionaryCount = br.ReadInt32(); for (int i = 0; i < dictionaryCount; i++) { FreeActivities.Add(br.ReadString(), br.ReadBoolean()); } dictionaryCount = br.ReadInt32(); for (int i = 0; i < dictionaryCount; i++) { ActivityCostModifiers.Add(br.ReadString(), br.ReadSingle()); } dictionaryCount = br.ReadInt32(); for (int i = 0; i < dictionaryCount; i++) { ProvisionCostModifiers.Add(br.ReadString(), br.ReadSingle()); } dictionaryCount = br.ReadInt32(); for (int i = 0; i < dictionaryCount; i++) { ProvisionAmountModifiers.Add(br.ReadString(), br.ReadSingle()); } dictionaryCount = br.ReadInt32(); for (int i = 0; i < dictionaryCount; i++) { UpgradeTagCostModifiers.Add(br.ReadString(), br.ReadSingle()); } dictionaryCount = br.ReadInt32(); for (int i = 0; i < dictionaryCount; i++) { FreeUpgradeTags.Add(br.ReadString(), br.ReadInt32()); } }
public void IncludeEvent(TownEvent townEvent) { for (int i = 0; i < townEvent.Data.Count; i++) { EventData.AddRange(townEvent.Data); switch (townEvent.Data[i].Type) { case TownEventDataType.ActivityCostChange: if (!ActivityCostModifiers.ContainsKey(townEvent.Data[i].StringData)) { ActivityCostModifiers.Add(townEvent.Data[i].StringData, 0); } ActivityCostModifiers[townEvent.Data[i].StringData] += townEvent.Data[i].NumberData; break; case TownEventDataType.ActivityLock: if (!ActivityLocks.ContainsKey(townEvent.Data[i].StringData)) { ActivityLocks.Add(townEvent.Data[i].StringData, true); } break; case TownEventDataType.FreeActivity: if (!FreeActivities.ContainsKey(townEvent.Data[i].StringData)) { FreeActivities.Add(townEvent.Data[i].StringData, true); } break; case TownEventDataType.NoLevelRestriction: NoLevelRestrictions = true; break; case TownEventDataType.ProvisionTypeAmountChange: if (!ProvisionAmountModifiers.ContainsKey(townEvent.Data[i].StringData)) { ProvisionAmountModifiers.Add(townEvent.Data[i].StringData, 0); } ProvisionAmountModifiers[townEvent.Data[i].StringData] += townEvent.Data[i].NumberData; break; case TownEventDataType.ProvisionTypeCostChange: if (!ProvisionCostModifiers.ContainsKey(townEvent.Data[i].StringData)) { ProvisionCostModifiers.Add(townEvent.Data[i].StringData, 0); } ProvisionCostModifiers[townEvent.Data[i].StringData] += townEvent.Data[i].NumberData; break; case TownEventDataType.UpgradeTagDiscount: if (!UpgradeTagCostModifiers.ContainsKey(townEvent.Data[i].StringData)) { UpgradeTagCostModifiers.Add(townEvent.Data[i].StringData, 0); } UpgradeTagCostModifiers[townEvent.Data[i].StringData] += townEvent.Data[i].NumberData; break; case TownEventDataType.UpgradeTagFree: if (!FreeUpgradeTags.ContainsKey(townEvent.Data[i].StringData)) { FreeUpgradeTags.Add(townEvent.Data[i].StringData, 0); } FreeUpgradeTags[townEvent.Data[i].StringData] += (int)townEvent.Data[i].NumberData; break; case TownEventDataType.BonusRecruit: DarkestDungeonManager.Campaign.Estate.RestockBonus(townEvent.Data[i].StringData, (int)townEvent.Data[i].NumberData); break; case TownEventDataType.DeadRecruit: DarkestDungeonManager.Campaign.Estate.RestockFromGrave((int)townEvent.Data[i].NumberData); break; default: break; } } }