public static void incrementMissionCount() { if (companyStats != null) { int currentValue = companyStats.GetValue <int>(MISSION_COUNT_STAT); currentValue++; companyStats.Set <int>(MISSION_COUNT_STAT, currentValue); } }
public void updateDropAverage(int cost) { int idx = companyStats.GetValue <int>(DropCostIdxStat); string statName = $"{DropCostStatPrefix}{idx}"; if (companyStats.ContainsStatistic(statName)) { companyStats.Set <int>(statName, cost); } idx += 1; idx %= DCECore.settings.averagedDrops; companyStats.Set <int>(DropCostIdxStat, idx); DCECore.modLog.Info?.Write($"Updating drop stat: {statName} to value: {cost}, new Idx: {idx}"); }
static void Postfix(ref BallisticEffect __instance, float __state) { try { Weapon weapon = __instance.weapon; StatCollection collection = weapon.StatCollection; collection.Set <float>("DamagePerShot", __state); } catch (Exception e) { Logger.LogError(e); } }
private void updateStat(string trackerStat, string cStat, float trackerValue) { int cValue = companyStats.GetValue <int>(cStat); Main.modLog.LogMessage($"possible update to {cStat}, current {cValue}, tracker: {trackerValue}"); int trackerInt = (int)trackerValue; trackerValue -= trackerInt; if (trackerInt != 0) { cValue += trackerInt; } if (trackerValue < 0) { cValue -= 1; trackerValue = 1.0f + trackerValue; } Main.modLog.LogMessage($"Updating: {cStat} => {cValue}, tracker => {trackerValue}"); companyStats.Set <int>(cStat, cValue); companyStats.Set <float>(trackerStat, trackerValue); }