private static bool PlayerLogin(ClientInfo _cInfo, string _message, StringBuilder _stringBuild)//Initiating player login { try { Log.Out("[SERVERTOOLS] Player connected"); if (StopServer.NoEntry) { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Server is shutting down. Rejoin when it restarts\"", _cInfo.playerId), null); } if (NewPlayer.Block_During_Bloodmoon && PersistentOperations.BloodMoonSky()) { PlayerDataFile _pdf = PersistentOperations.GetPlayerDataFileFromSteamId(_cInfo.playerId); if (_pdf != null) { if (_pdf.totalTimePlayed < 5) { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Currently in bloodmoon. Please join when it finishes\"", _cInfo.playerId), null); } } else { SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Currently in bloodmoon. Please join when it finishes\"", _cInfo.playerId), null); } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerLogin: {0}", e.Message)); } return(true); }
public static void BloodmoonCheck() { try { if (PersistentOperations.BloodMoonSky() || PersistentOperations.BloodMoonDuskSky()) { Bloodmoon = true; return; } else if (Bloodmoon && PersistentOperations.BloodMoonOver()) { Bloodmoon = false; BloodmoonOver = true; return; } else { Stop(); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Shutdown.BloodmoonCheck: {0}", e.Message)); } }
public static void Exec() { try { if (!BloodmoonStarted) { if (PersistentOperations.BloodMoonSky()) { BloodmoonStarted = true; List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null) { if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId)) { EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player != null && _player.IsSpawned() && _player.IsAlive() && _player.Died > 0 && _player.Progression.GetLevel() >= 10 && random.Next(0, 100) < Chance) { WarriorList.Add(_cInfo.playerId); KilledZombies.Add(_cInfo.playerId, 0); string _response = "Hades has called upon you. Survive this night and kill {ZombieCount} zombies to be rewarded by the king of the underworld."; _response = _response.Replace("{ZombieCount}", Zombie_Kills.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _response + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); Thread.Sleep(TimeSpan.FromMilliseconds(30)); } } } } } } } else if (!PersistentOperations.BloodMoonSky()) { BloodmoonStarted = false; RewardWarriors(); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in BloodmoonWarrior.Exec: {0}", e.Message)); } }
public static void Exec() { try { if (!BloodmoonStarted) { if (PersistentOperations.BloodMoonSky()) { BloodmoonStarted = true; List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null) { if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId)) { EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player != null && _player.IsSpawned() && _player.IsAlive() && _player.Died > 0 && _player.Progression.GetLevel() >= 10 && random.Next(0, 100) < Chance) { WarriorList.Add(_cInfo.playerId); KilledZombies.Add(_cInfo.playerId, 0); Phrases.Dict.TryGetValue(691, out string _phrase691); _phrase691 = _phrase691.Replace("{Count}", Zombie_Kills.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase691 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } } } } } else if (!PersistentOperations.BloodMoonSky()) { BloodmoonStarted = false; RewardWarriors(); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in BloodmoonWarrior.Exec: {0}", e.Message)); } }
public static bool Bloodmoon() { try { if (PersistentOperations.BloodMoonSky() || PersistentOperations.BloodMoonDuskSky()) { return(true); } else { return(false); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Shutdown.Bloodmoon: {0}", e.Message)); } return(false); }
public static void Exec() { if (!BloodmoonStarted) { if (PersistentOperations.BloodMoonSky()) { BloodmoonStarted = true; List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; if (_cInfo != null && !string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId > 0) { EntityAlive _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null && _player.IsSpawned() && _player.IsAlive()) { WarriorList.Add(_cInfo.entityId); KilledZombies.Add(_cInfo.entityId, 0); if (_cInfo != null) { string _response = "Hades has called upon you. Survive this night and kill {ZombieCount} zombies to be rewarded by the king of the underworld."; _response = _response.Replace("{ZombieCount}", Zombie_Kills.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _response + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } } } } else if (!PersistentOperations.BloodMoonSky()) { BloodmoonStarted = false; RewardWarriors(); } }