private void CreateEmergencyReport(DeathModel death) { // Get the server time int totalSeconds = Globals.GetTotalSeconds(); if (death.killer.Value == Constants.ENVIRONMENT_KILL) { // Check if the player was dead int databaseKiller = NAPI.Data.GetEntityData(death.player, EntityData.PLAYER_KILLED); if (databaseKiller == 0) { // There's no killer, we set the environment as killer NAPI.Data.SetEntityData(death.player, EntityData.PLAYER_KILLED, Constants.ENVIRONMENT_KILL); } } else { int killerId = NAPI.Data.GetEntityData(death.killer, EntityData.PLAYER_SQL_ID); NAPI.Data.SetEntityData(death.player, EntityData.PLAYER_KILLED, killerId); } NAPI.Entity.SetEntityInvincible(death.player, true); NAPI.Data.SetEntityData(death.player, EntityData.TIME_HOSPITAL_RESPAWN, totalSeconds + 240); NAPI.Chat.SendChatMessageToPlayer(death.player, Constants.COLOR_INFO + Messages.INF_EMERGENCY_WARN); }
private void CreateEmergencyReport(DeathModel death) { // Get the server time int totalSeconds = Globals.GetTotalSeconds(); if (death.killer.Value == Constants.ENVIRONMENT_KILL) { // Check if the player was dead int databaseKiller = death.player.GetData(EntityData.PLAYER_KILLED); if (databaseKiller == 0) { // There's no killer, we set the environment as killer death.player.SetData(EntityData.PLAYER_KILLED, Constants.ENVIRONMENT_KILL); } } else { int killerId = death.killer.GetData(EntityData.PLAYER_SQL_ID); death.player.SetData(EntityData.PLAYER_KILLED, killerId); } death.player.Invincible = true; death.player.SetData(EntityData.TIME_HOSPITAL_RESPAWN, totalSeconds + 240); death.player.SendChatMessage(Constants.COLOR_INFO + InfoRes.emergency_warn); }
public CreateDeathViewModel(int animalID, StayEndViewModel parent) { Prnt1 = parent; Prnt1.IsWorking = true; Death = new DeathModel(); AnimalID = animalID; }
private void OnPlayerDeathHandler(Client player, Client killer, uint weapon, CancelEventArgs cancel) { DeathModel death = new DeathModel(player, killer, weapon); // Creamos las variables para dar el aviso Vector3 deathPosition = null; String deathPlace = String.Empty; String deathHour = DateTime.Now.ToString("h:mm:ss tt"); // Miramos el lugar donde ha muerto if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED) > 0) { int houseId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED); HouseModel house = House.GetHouseById(houseId); deathPosition = house.position; deathPlace = house.name; } else if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED) > 0) { int businessId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED); BusinessModel business = Business.GetBusinessById(businessId); deathPosition = business.position; deathPlace = business.name; } else { deathPosition = NAPI.Entity.GetEntityPosition(player); } // Creamos el aviso y lo añadimos a la lista FactionWarningModel factionWarning = new FactionWarningModel(Constants.FACTION_EMERGENCY, player.Value, deathPlace, deathPosition, -1, deathHour); Faction.factionWarningList.Add(factionWarning); // Creamos el mensaje de aviso String warnMessage = String.Format(Messages.INF_EMERGENCY_WARNING, Faction.factionWarningList.Count - 1); // Damos el aviso a todos los médicos de servicio foreach (Client target in NAPI.Pools.GetAllPlayers()) { if (NAPI.Data.GetEntityData(target, EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY && NAPI.Data.GetEntityData(target, EntityData.PLAYER_ON_DUTY) > 0) { NAPI.Chat.SendChatMessageToPlayer(target, Constants.COLOR_INFO + warnMessage); } } // Creamos el timer para poner el estado de muerto Timer deathTimer = new Timer(OnDeathTimer, death, 2500, Timeout.Infinite); deathTimerList.Add(player.Value, deathTimer); // Evitamos el respawn cancel.Spawn = false; }
public void OnPlayerDeath(Client player, Client killer, uint weapon) { if (player.GetData(EntityData.PLAYER_KILLED) == 0) { var death = new DeathModel(player, killer, weapon); Vector3 deathPosition = null; var deathPlace = string.Empty; var deathHour = DateTime.Now.ToString("h:mm:ss tt"); // Checking if player died into a house or business if (player.GetData(EntityData.PLAYER_HOUSE_ENTERED) > 0) { int houseId = player.GetData(EntityData.PLAYER_HOUSE_ENTERED); var house = House.GetHouseById(houseId); deathPosition = house.position; deathPlace = house.name; } else if (player.GetData(EntityData.PLAYER_BUSINESS_ENTERED) > 0) { int businessId = player.GetData(EntityData.PLAYER_BUSINESS_ENTERED); var business = Business.GetBusinessById(businessId); deathPosition = business.position; deathPlace = business.name; } else { deathPosition = player.Position; } // We add the report to the list var factionWarning = new FactionWarningModel(Constants.FACTION_EMERGENCY, player.Value, deathPlace, deathPosition, -1, deathHour); Faction.factionWarningList.Add(factionWarning); // Report message var warnMessage = string.Format(InfoRes.emergency_warning, Faction.factionWarningList.Count - 1); // Sending the report to all the emergency department's members foreach (var target in NAPI.Pools.GetAllPlayers()) { if (target.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY && target.GetData(EntityData.PLAYER_ON_DUTY) > 0) { target.SendChatMessage(Constants.COLOR_INFO + warnMessage); } } // Create the emergency report CreateEmergencyReport(death); } }
private async Task LoadData() { IsWorking = true; await Task.Delay(150); await Task.Run(() => { Escapes = EscapeModel.GetDatedEscapes(DateTime.Now.AddYears(-100), DateTime.Now.AddYears(100)); Deaths = DeathModel.GetDatedDeaths(DateTime.Now.AddYears(-100), DateTime.Now.AddYears(100)); }); IsWorking = false; }
public void OnPlayerDeath(Client player, Client killer, uint weapon) { DeathModel death = new DeathModel(player, killer, weapon); Vector3 deathPosition = null; String deathPlace = String.Empty; String deathHour = DateTime.Now.ToString("h:mm:ss tt"); // Checking if player died into a house or business if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED) > 0) { int houseId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED); HouseModel house = House.GetHouseById(houseId); deathPosition = house.position; deathPlace = house.name; } else if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED) > 0) { int businessId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED); BusinessModel business = Business.GetBusinessById(businessId); deathPosition = business.position; deathPlace = business.name; } else { deathPosition = NAPI.Entity.GetEntityPosition(player); } // We add the report to the list FactionWarningModel factionWarning = new FactionWarningModel(Constants.FACTION_EMERGENCY, player.Value, deathPlace, deathPosition, -1, deathHour); Faction.factionWarningList.Add(factionWarning); // Report message String warnMessage = String.Format(Messages.INF_EMERGENCY_WARNING, Faction.factionWarningList.Count - 1); // Sending the report to all the emergency department's members foreach (Client target in NAPI.Pools.GetAllPlayers()) { if (NAPI.Data.GetEntityData(target, EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY && NAPI.Data.GetEntityData(target, EntityData.PLAYER_ON_DUTY) > 0) { NAPI.Chat.SendChatMessageToPlayer(target, Constants.COLOR_INFO + warnMessage); } } // Timer to process player's death Timer deathTimer = new Timer(OnDeathTimer, death, 2500, Timeout.Infinite); deathTimerList.Add(player.Value, deathTimer); }
public void FilterDeaths() { if (DeathSince == null || DeathTo == null) { IsWorking = true; Deaths = DeathModel.GetDatedDeaths(DateTime.Now.AddYears(-100), DateTime.Now.AddYears(100)); IsWorking = false; } else { IsWorking = true; Deaths = DeathModel.GetDatedDeaths(DeathSince, DeathTo); IsWorking = false; } }
public void DeleteDeath() { MessageBoxResult result = MessageBox.Show("Opravdu chcete vymazat zvolený úhyn?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { DeathModel.MarkAsDeleted((int)SelectedDeath.ID); SelectedDeath = null; FilterDeaths(); } }
private void CreateEmergencyReport(DeathModel death) { if (death.killer.Value == Constants.ENVIRONMENT_KILL) { // Check if the player was dead int databaseKiller = death.player.GetSharedData(EntityData.PLAYER_KILLED); if (databaseKiller == 0) { // There's no killer, we set the environment as killer death.player.SetSharedData(EntityData.PLAYER_KILLED, Constants.ENVIRONMENT_KILL); } } else { int killerId = death.killer.GetData(EntityData.PLAYER_SQL_ID); death.player.SetSharedData(EntityData.PLAYER_KILLED, killerId); } // Warn the player death.player.SendChatMessage(Constants.COLOR_INFO + InfoRes.emergency_warn); }
public async void Restore() { if (Since == null || To == null || (Since > To)) { MessageBox.Show("Zvolte prosím platné datum."); } else { IsWorking = true; await Task.Delay(150); await Task.Run(() => { AdoptionModel.RestoreDeleted((DateTime)Since, (DateTime)To); AnimalModel.RestoreDeleted((DateTime)Since, (DateTime)To); BreedModel.RestoreDeleted((DateTime)Since, (DateTime)To); CoatTypeModel.RestoreDeleted((DateTime)Since, (DateTime)To); CostModel.RestoreDeleted((DateTime)Since, (DateTime)To); DeathModel.RestoreDeleted((DateTime)Since, (DateTime)To); DiaryModel.RestoreDeleted((DateTime)Since, (DateTime)To); DonationModel.RestoreDeleted((DateTime)Since, (DateTime)To); EscapeModel.RestoreDeleted((DateTime)Since, (DateTime)To); FurColorModel.RestoreDeleted((DateTime)Since, (DateTime)To); IncidentModel.RestoreDeleted((DateTime)Since, (DateTime)To); PersonModel.RestoreDeleted((DateTime)Since, (DateTime)To); MedicalRecordModel.RestoreDeleted((DateTime)Since, (DateTime)To); SpeciesModel.RestoreDeleted((DateTime)Since, (DateTime)To); StayModel.RestoreDeleted((DateTime)Since, (DateTime)To); WalkModel.RestoreDeleted((DateTime)Since, (DateTime)To); }); ComboBoxSettings(); IsWorking = false; MessageBox.Show("Záznamy od " + Since + " do " + To + " obnoveny."); } }
public void OnPlayerDeath(Client player, Client killer, uint weapon) { if (player.GetSharedData(EntityData.PLAYER_KILLED) == 0) { DeathModel death = new DeathModel(player, killer, weapon); Vector3 deathPosition = null; string deathPlace = string.Empty; string deathHour = DateTime.Now.ToString("h:mm:ss tt"); // Checking if player died into a house or business if (player.GetData(EntityData.PLAYER_HOUSE_ENTERED) > 0) { int houseId = player.GetData(EntityData.PLAYER_HOUSE_ENTERED); HouseModel house = House.GetHouseById(houseId); deathPosition = house.position; deathPlace = house.name; } else if (player.GetData(EntityData.PLAYER_BUSINESS_ENTERED) > 0) { int businessId = player.GetData(EntityData.PLAYER_BUSINESS_ENTERED); BusinessModel business = Business.GetBusinessById(businessId); deathPosition = business.position; deathPlace = business.name; } else { deathPosition = player.Position; } if (killer.Value == Constants.ENVIRONMENT_KILL || killer == player) { // We add the report to the list FactionWarningModel factionWarning = new FactionWarningModel(Constants.FACTION_EMERGENCY, player.Value, deathPlace, deathPosition, -1, deathHour); Faction.factionWarningList.Add(factionWarning); // Report message string warnMessage = string.Format(InfoRes.emergency_warning, Faction.factionWarningList.Count - 1); // Sending the report to all the emergency department's members foreach (Client target in NAPI.Pools.GetAllPlayers()) { if (target.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY && target.GetData(EntityData.PLAYER_ON_DUTY) > 0) { target.SendChatMessage(Constants.COLOR_INFO + warnMessage); } } // Create the emergency report CreateEmergencyReport(death); } else { int killerId = killer.GetData(EntityData.PLAYER_SQL_ID); player.SetSharedData(EntityData.PLAYER_KILLED, killerId); } // Time to let player accept his dead player.SetData(EntityData.TIME_HOSPITAL_RESPAWN, Globals.GetTotalSeconds() + 240); // Set the player into dead state player.TriggerEvent("togglePlayerDead", true); } }