private static bool Prefix(GameData __instance) { __instance.TotalTasks = 0; __instance.CompletedTasks = 0; for (int i = 0; i < __instance.AllPlayers.Count; i++) { GameData.PlayerInfo playerInfo = __instance.AllPlayers[i]; // PlayerInfo if (!playerInfo.Disconnected && playerInfo.Tasks != null && // Disconnected | // Tasks playerInfo.Object && // Object -> PlayerControl (PlayerControl.GameOptions.GhostsDoTasks || !playerInfo.IsDead) && // GhostsDoTasks | IsDead !playerInfo.IsImpostor && // IsImpostor !Helpers.hasFakeTasks(playerInfo.Object) ) { for (int j = 0; j < playerInfo.Tasks.Count; j++) { __instance.TotalTasks++; if (playerInfo.Tasks[j].Complete) // Complete { __instance.CompletedTasks++; } } } } return(false); }
private static bool Prefix(ref float __result, Console __instance, [HarmonyArgument(0)] GameData.PlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse) { canUse = couldUse = false; if (__instance.AllowImpostor) { return(true); } if (!Helpers.hasFakeTasks(pc.Object)) { return(true); } __result = float.MaxValue; return(false); }
public static bool Prefix(ref float __result, Console __instance, [HarmonyArgument(0)] GameData.PlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse) { canUse = couldUse = false; if (Swapper.swapper != null && Swapper.swapper == PlayerControl.LocalPlayer) { return(!__instance.TaskTypes.Any(x => x == TaskTypes.FixLights || x == TaskTypes.FixComms)); } if (__instance.AllowImpostor) { return(true); } if (!Helpers.hasFakeTasks(pc.Object)) { return(true); } __result = float.MaxValue; return(false); }
public static Tuple <int, int> taskInfo(GameData.PlayerInfo playerInfo) { int TotalTasks = 0; int CompletedTasks = 0; if (!playerInfo.Disconnected && playerInfo.Tasks != null && playerInfo.Object && (PlayerControl.GameOptions.GhostsDoTasks || !playerInfo.IsDead) && !playerInfo.IsImpostor && !Helpers.hasFakeTasks(playerInfo.Object) ) { for (int j = 0; j < playerInfo.Tasks.Count; j++) { TotalTasks++; if (playerInfo.Tasks[j].Complete) { CompletedTasks++; } } } return(Tuple.Create(CompletedTasks, TotalTasks)); }