protected virtual bool loadCurrencyResult(ConfigNode node) { eventType = BARISEventTypes.currencyChange; //Type of currency change if (node.HasValue("currency")) { switch (node.GetValue("currency")) { case "funds": currencyType = BARISEventCurrencyTypes.funds; break; case "reputation": currencyType = BARISEventCurrencyTypes.reputation; break; case "science": currencyType = BARISEventCurrencyTypes.science; break; default: return(false); } } else { return(false); } //Multiplier takes precedence over modifier if (node.HasValue("multiplier")) { modifierType = BARISEventModifierTypes.multiplier; if (double.TryParse(node.GetValue("multiplier"), out value) == false) { return(false); } value = 1.0f + (value / 100.0f); } else if (node.HasValue("modifier")) { modifierType = BARISEventModifierTypes.modifier; if (double.TryParse(node.GetValue("modifier"), out value) == false) { return(false); } } else { return(false); } return(true); }
protected virtual bool loadPayIncreaseResult(ConfigNode node) { eventType = BARISEventTypes.workerPayIncrease; //worker type is optional if (node.HasValue("workerType")) { switch (node.GetValue("workerType")) { case "astronaut": workerType = BARISWorkerTypes.astronaut; break; case "construction": workerType = BARISWorkerTypes.construction; break; default: workerType = BARISWorkerTypes.both; break; } } else { workerType = BARISWorkerTypes.both; } //Multiplier takes precedence over modifier if (node.HasValue("multiplier")) { modifierType = BARISEventModifierTypes.multiplier; if (double.TryParse(node.GetValue("multiplier"), out value) == false) { return(false); } value = 1.0f + (value / 100.0f); } else if (node.HasValue("modifier")) { modifierType = BARISEventModifierTypes.modifier; if (double.TryParse(node.GetValue("modifier"), out value) == false) { return(false); } } else { return(false); } return(true); }
protected virtual bool loadQualityCheckResult(ConfigNode node) { eventType = BARISEventTypes.qualityCheck; bool boolValue = false; bool isValid = false; //Modifier is optional if (node.HasValue("modifier")) { if (!int.TryParse(node.GetValue("modifier"), out qualityCheckModifier)) { return(false); } else { return(true); } } //isSuccess is optional else if (node.HasValue("isSuccess")) { if (!bool.TryParse(node.GetValue("isSuccess"), out boolValue)) { return(false); } else if (boolValue) { modifierType = BARISEventModifierTypes.success; } else { modifierType = BARISEventModifierTypes.fail; } isValid = true; } //isCriticalFail is optional else if (node.HasValue("isCriticalFail")) { if (!bool.TryParse(node.GetValue("isCriticalFail"), out boolValue)) { return(false); } else if (boolValue) { modifierType = BARISEventModifierTypes.criticalFail; } else { modifierType = BARISEventModifierTypes.criticalSuccess; } isValid = true; } //performImmediately is optional if (node.HasValue("performImmediately")) { if (!bool.TryParse(node.GetValue("performImmediately"), out boolValue)) { return(false); } performImmediately = boolValue; isValid = true; } return(isValid); }