public static void VoteCount() { if (Night.Count >= Votes_Needed) { int _dawn = (int)SkyManager.GetDawnTime(); ulong _worldTime = GameManager.Instance.World.worldTime; int _worldHours = (int)(_worldTime / 1000UL) % 24; int _newTime = (24 - _worldHours + _dawn) * 1000; ulong _newWorldTime = _worldTime + Convert.ToUInt64(_newTime); GameManager.Instance.World.worldTime = _newWorldTime; string _phrase934; if (!Phrases.Dict.TryGetValue(934, out _phrase934)) { _phrase934 = "Players voted yes to skip this night. Good morning."; } ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase934 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); } Night.Clear(); VoteOpen = false; }
public static void VoteCount() { VoteOpen = false; if (Night.Count > 7) { int _dawn = (int)SkyManager.GetDawnTime(); ulong _worldTime = GameManager.Instance.World.worldTime; int _worldHours = (int)(_worldTime / 1000UL) % 24; int _newTime = (24 - _worldHours + _dawn) * 1000; ulong _newWorldTime = _worldTime + Convert.ToUInt64(_newTime); GameManager.Instance.World.worldTime = _newWorldTime; string _phrase934; if (!Phrases.Dict.TryGetValue(934, out _phrase934)) { _phrase934 = "Players voted yes to skip this night. Good morning."; } GameManager.Instance.GameMessageServer((ClientInfo)null, EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase934), Config.Server_Response_Name, false, "", false); } Night.Clear(); }
static bool Prefix() { ulong worldtime = GameManager.Instance.World.GetWorldTime(); float dawntime = SkyManager.GetDawnTime(); if (GameUtils.WorldTimeToHours(worldtime) == dawntime && GameUtils.WorldTimeToMinutes(worldtime) < 1) { for (int i = 0; i < GameManager.Instance.World.Entities.list.Count; i++) { EntityAlive entityalive = GameManager.Instance.World.Entities.list[i] as EntityAlive; Entity entity = GameManager.Instance.World.Entities.list[i] as Entity; if (entity.GetSpawnerSource() == EnumSpawnerSource.Biome && entityalive.GetMaxHealth() == entityalive.Health && (entityalive is EntityZombie || entityalive is EntityEnemyAnimal)) { entityalive.IsDespawned = true; entityalive.MarkToUnload(); } } Debug.Log("Cleaned up entities"); } return(true); }