protected override bool Allow(SimDescription sim) { if (Households.AllowGuardian(sim)) { IncStat("Too Old"); return(false); } /* * else if (!Households.Allow(this, sim)) * { * IncStat("User Denied"); * return false; * }*/ else if (Deaths.IsDying(sim)) { IncStat("Dying"); return(false); } return(base.Allow(sim)); }
public void ResetStats() { KillCount = 0; DeathCount = 0; AssistCount = 0; HeadshotCount = 0; TeamKillCount = 0; RoundMvpCount = 0; OneKillCount = 0; TwoKillCount = 0; ThreeKillCount = 0; FourKillCount = 0; FiveKillCount = 0; BombDefusedCount = 0; BombPlantedCount = 0; Score = 0; RatingHltv = 0; RoundPlayedCount = 0; FlashDurationTemp = 0; CrouchKillCount = 0; JumpKillCount = 0; TradeKillCount = 0; TradeDeathCount = 0; EseaRws = 0; EseaRwsPointCount = 0; HasEntryKill = false; HasEntryHoldKill = false; Kills.Clear(); Deaths.Clear(); Assists.Clear(); EntryKills.Clear(); EntryHoldKills.Clear(); PlayersHurted.Clear(); Clutches.Clear(); StartMoneyRounds.Clear(); EquipementValueRounds.Clear(); RoundsMoneyEarned.Clear(); }
protected override bool Allow(SimDescription sim) { if (sim.LotHome == null) { IncStat("No Home"); return(false); } else if (!GetValue <IsAncestralOption, bool>(sim.Household)) { IncStat("Not Ancestral"); return(false); } else if (sim.Genealogy == null) { IncStat("No Genealogy"); return(false); } foreach (SimDescription other in HouseholdsEx.Humans(sim.Household)) { if (other == sim) { continue; } if (Deaths.IsDying(other)) { continue; } if (other.YoungAdultOrAbove) { return(false); } } return(base.Allow(sim)); }
public void SetValues() { Title.GetComponent <TextMeshProUGUI>().text = ProfileManager.GetComponent <ProfileMgr>()._Username; Kills.GetComponent <TextMeshProUGUI>().text = "Kills: " + ProfileManager.GetComponent <ProfileMgr>()._kills.ToString(); Deaths.GetComponent <TextMeshProUGUI>().text = "Deaths: " + ProfileManager.GetComponent <ProfileMgr>()._deaths.ToString(); Matches.GetComponent <TextMeshProUGUI>().text = "Matches: " + ProfileManager.GetComponent <ProfileMgr>()._matches.ToString(); Ratio.GetComponent <TextMeshProUGUI>().text = "Kill/Death Ratio: " + ProfileManager.GetComponent <ProfileMgr>()._kdleft.ToString() + " / " + ProfileManager.GetComponent <ProfileMgr>()._kdright.ToString(); PrestigeText.GetComponent <TextMeshProUGUI>().text = "Prestige Level " + ProfileManager.GetComponent <ProfileMgr>()._level.ToString(); PrestigeExpBar.GetComponent <Transform>().localScale = new Vector3(ProfileManager.GetComponent <ProfileMgr>()._exp, 1, 1); }
protected override bool Allow(SimDescription sim) { if (sim.Household != null) { IncStat("Immigrant"); return(false); } Household house = GetData <StoredNetWorthSimData>(sim).Household; if ((house != null) && (house.IsSpecialHousehold)) { IncStat("Service"); return(false); } else if (Deaths.WasCleansed(sim)) { IncStat("Cleansed"); return(false); } return(base.Allow(sim)); }
public void CreateDeath() { try { using (ShelterDatabaseLINQDataContext db = new ShelterDatabaseLINQDataContext()) { Deaths death = new Deaths { AnimalID = AnimalID, Date = Date, Description = Description, Euthanasia = Euthanasia, Natural = Natural, Other = Other }; db.Deaths.InsertOnSubmit(death); db.SubmitChanges(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected override bool PrivateUpdate(ScenarioFrame frame) { Household house = Sim.Household; Sim sim = Sim.CreatedSim; Dictionary <SimDescription, float> inheritors = Deaths.GetInheritors(Sim, GetValue <InheritCashScenario.InheritorsOption, ManagerDeath.Inheritors>(), false); List <Sim> choices = new List <Sim>(); foreach (SimDescription other in inheritors.Keys) { if (other.CreatedSim == null) { continue; } if (!other.ChildOrAbove) { continue; } choices.Add(other.CreatedSim); } if (choices.Count == 0) { foreach (Sim other in HouseholdsEx.AllHumans(house)) { if (other == sim) { continue; } choices.Add(other); } if (choices.Count == 0) { IncStat("No Choices"); return(false); } } bool found = false; if (HouseholdsEx.NumHumans(house) == 1) { if (house.RealEstateManager.AllProperties.Count > 0) { Dictionary <Household, Sim> houses = new Dictionary <Household, Sim>(); foreach (Sim choice in choices) { if (choice.Household == null) { continue; } houses[choice.Household] = choice; } if (houses.Count > 0) { List <KeyValuePair <Household, Sim> > houseChoices = new List <KeyValuePair <Household, Sim> >(houses); foreach (PropertyData data in house.RealEstateManager.AllProperties) { KeyValuePair <Household, Sim> choice = RandomUtil.GetRandomObjectFromList(houseChoices); ManagerMoney.TransferProperty(house, choice.Key, data); mInheritors[choice.Value.SimDescription] = true; IncStat("Property Transferred"); found = true; } } } } if (!SimTypes.IsSelectable(Sim)) { Lots.PackupVehicles(sim, (HouseholdsEx.NumHumans(house) > 1)); foreach (GameObject obj in Inventories.QuickFind <GameObject>(sim.Inventory)) { Sim choice = RandomUtil.GetRandomObjectFromList(choices); if ((obj is INotTransferableOnDeath) || (obj is IHiddenInInventory) || (obj is DeathFlower) || (obj is Diploma)) { IncStat("NonTrans " + obj.GetLocalizedName()); continue; } found = true; if (Inventories.TryToMove(obj, choice)) { IncStat("Transferred " + obj.GetLocalizedName()); mInheritors[choice.SimDescription] = true; } else { IncStat("Unremovable " + obj.GetLocalizedName()); } } } Writing oldSkill = Sim.SkillManager.GetSkill <Writing>(SkillNames.Writing); if (oldSkill != null) { Writing.RoyaltyAlarm alarm = oldSkill.mRoyaltyAlarm; if (alarm != null) { List <Sim> royaltyChoices = new List <Sim>(choices); while (royaltyChoices.Count > 0) { Sim choice = RandomUtil.GetRandomObjectFromList(royaltyChoices); royaltyChoices.Remove(choice); Writing newSkill = choice.SkillManager.GetSkill <Writing>(SkillNames.Writing); if ((newSkill != null) && (newSkill.mRoyaltyAlarm != null)) { continue; } newSkill = choice.SkillManager.AddElement(SkillNames.Writing) as Writing; if (newSkill != null) { alarm.RemoveRoyaltyAlarm(); alarm.mAlarmHandle = AlarmManager.Global.AddAlarmDay(Writing.kRoyaltyPayHour, DaysOfTheWeek.Sunday, new AlarmTimerCallback(alarm.AlarmCallBack), "Royalty Alarm", AlarmType.AlwaysPersisted, newSkill.SkillOwner); alarm.mSkill = newSkill; newSkill.mRoyaltyAlarm = alarm; IncStat("Transferred Royalties"); mInheritors[choice.SimDescription] = true; found = true; } break; } } } if (!found) { return(false); } return(mInheritors.Count > 0); }
protected override bool PrivateUpdate(ScenarioFrame frame) { if (Sim.CreatedSim == null) { Sims.Instantiate(Sim, Sim.LotHome, false); } if (Target.CreatedSim == null) { Sims.Instantiate(Target, Target.LotHome, false); } if ((Sim.CreatedSim == null) || (Target.CreatedSim == null)) { IncStat("Uninstantiated"); return(false); } else { if (Sim.IsRobot) { if ((Sim.LotHome == null) || ((Sim.LotHome.CountObjects <BotMakingStation> () + Sim.LotHome.CountObjects <InventionWorkbench>()) == 0)) { IncStat("No Workbench"); return(false); } SimDescription child = null; if (Sim.IsFrankenstein) { bool reward = Sim.OccultManager.mIsLifetimeReward; if ((Target.IsFrankenstein) && (RandomUtil.CoinFlip())) { reward = Target.OccultManager.mIsLifetimeReward; } Sim childSim = OccultFrankenstein.CreateFrankenStein(Sim.CreatedSim, CASAgeGenderFlags.None, reward); if (childSim == null) { IncStat("Creation Fail"); return(false); } child = childSim.SimDescription; } else { child = OccultRobot.MakeRobot(CASAgeGenderFlags.Adult, CASAgeGenderFlags.None, RobotForms.MaxType); if (child == null) { IncStat("Creation Fail"); return(false); } CASRobotData supernaturalData = child.SupernaturalData as CASRobotData; if (supernaturalData != null) { supernaturalData.CreatorSim = Sim.SimDescriptionId; int quality = 0; int count = 0; CASRobotData parentData = Sim.SupernaturalData as CASRobotData; if (parentData != null) { quality = parentData.BotQualityLevel; count++; } parentData = Target.SupernaturalData as CASRobotData; if (parentData != null) { quality += parentData.BotQualityLevel; count++; } if (count == 2) { quality /= count; } supernaturalData.BotQualityLevel = quality; } } if (child.Genealogy.Parents.Count == 0) { Sim.Genealogy.AddChild(child.Genealogy); } Target.Genealogy.AddChild(child.Genealogy); if (!Households.MoveSim(child, Sim.Household)) { IncStat("Move Fail"); Deaths.CleansingKill(child, true); return(false); } return(true); } else if (Target.IsRobot) { IncStat("Simbot Partner"); return(false); } else { if (CommonSpace.Helpers.Pregnancies.Start(Sim.CreatedSim, Target, false) != null) { ManagerSim.ForceRecount(); if (Sim.IsHuman) { if (OnGatheringScenario != null) { OnGatheringScenario(this, frame); } } if ((!Sim.IsHuman) && (Sim.Partner != Target)) { if ((GetValue <AllowMarriageOption, bool>(Sim)) && (GetValue <AllowMarriageOption, bool>(Target))) { if ((Romances.AllowBreakup(this, Sim, Managers.Manager.AllowCheck.None)) && (Romances.AllowBreakup(this, Target, Managers.Manager.AllowCheck.None))) { RemoveAllPetMateFlags(Sim); RemoveAllPetMateFlags(Target); Relationship.Get(Sim, Target, false).LTR.AddInteractionBit(LongTermRelationship.InteractionBits.Marry); } } } } return(true); } } }
public void Save(string Key) { bool found = false; string OutputFile = "./Database/Users/" + Name + "/Info.Dat"; Utilities.IO.PrepareDirectory("./Database/"); Utilities.IO.PrepareDirectory("./Database/Users/"); Utilities.IO.PrepareDirectory("./Database/Users/" + Name); Utilities.IO.PrepareFile(OutputFile); string[] OutputFileContents = Utilities.IO.ReadAllLines(OutputFile); string OutTime = Utilities.DateTimeUtilities.ToYearTimeDescending(Utilities.DateTimeUtilities.FormatDateTime(DateTime.Now)); List <String> Output = new List <String>(); foreach (string line in OutputFileContents) { #region GetDataCouplets string ThisLine = line; if (!(ThisLine.Contains("\t"))) { Output.Add(line); continue; } while (ThisLine.Contains("\t\t")) { ThisLine = ThisLine.Replace("\t\t", "\t"); } string Header = ThisLine.Split('\t')[0]; string Data = ThisLine.Remove(0, ((Header.Length) + 1)); var Converted = Utilities.IO.StringToVariable(Data); //NOTE: These WILL Bypass GUI mode if enabled, as the GUI setting is turned on until it is read. //if (Converted is Boolean) Logger.Console.WriteLine(String.Format("Bool: {0}", Data)); //if (Converted is IPAddress) Logger.Console.WriteLine(String.Format("IPAddress: {0}", Data)); //if (Converted is Decimal) Logger.Console.WriteLine(String.Format("Decimal: {0}", Data)); //if (Converted is Int32) Logger.Console.WriteLine(String.Format("Int32: {0}", Data)); //if (Converted is String) Logger.Console.WriteLine(String.Format("String: {0}", Data)); #endregion if (Key.ToUpperInvariant() != Header.ToUpperInvariant()) { Output.Add(line); continue; } switch (Header.ToUpperInvariant()) { #region Switches case Strings.Name: Output.Add(Strings.Name + "\t\t" + Name); found = true; break; case Strings.DisplayedName: Output.Add(Strings.DisplayedName + "\t\t" + DisplayedName.ToString()); found = true; break; case Strings.LastIP: Output.Add(Strings.LastIP + "\t\t\t" + LastIP.ToString()); found = true; break; case Strings.LoginCount: Output.Add(Strings.LoginCount + "\t\t" + LoginCount.ToString()); found = true; break; case Strings.MessagesTyped: Output.Add(Strings.MessagesTyped + "\t\t" + MessagesTyped.ToString()); found = true; break; case Strings.DateJoined: Output.Add(Strings.DateJoined + "\t\t" + DateJoined.ToString()); found = true; break; case Strings.DateLastVisited: Output.Add(Strings.DateLastVisited + "\t\t" + DateLastVisited.ToString()); found = true; break; case Strings.PlayTime: Output.Add(Strings.PlayTime + "\t\t" + PlayTime.ToString()); found = true; break; case Strings.Kills: Output.Add(Strings.Kills + "\t\t\t" + Kills.ToString()); found = true; break; case Strings.Deaths: Output.Add(Strings.Deaths + "\t\t\t" + Deaths.ToString()); found = true; break; case Strings.FlightsFlown: Output.Add(Strings.FlightsFlown + "\t\t" + FlightsFlown.ToString()); found = true; break; case Strings.FlightHours: Output.Add(Strings.FlightHours + "\t\t" + FlightHours.ToString()); found = true; break; case Strings.Banned: Output.Add(Strings.Banned + "\t\t\t" + Banned.ToString()); found = true; break; case Strings.BannedBy: Output.Add(Strings.BannedBy + "\t\t" + BannedBy.ToString()); found = true; break; case Strings.DateBanned: Output.Add(Strings.DateBanned + "\t\t" + DateBanned.ToString()); found = true; break; case Strings.BanExpires: Output.Add(Strings.BanExpires + "\t\t" + BanExpires.ToString()); found = true; break; case Strings.BanReason: Output.Add(Strings.BanReason + "\t\t" + BanReason.ToString()); found = true; break; case Strings.TimesBanned: Output.Add(Strings.TimesBanned + "\t\t" + TimesBanned.ToString()); found = true; break; case Strings.Frozen: Output.Add(Strings.Frozen + "\t\t\t" + Frozen.ToString()); found = true; break; case Strings.FrozenBy: Output.Add(Strings.FrozenBy + "\t\t" + FrozenBy.ToString()); found = true; break; case Strings.DateFrozen: Output.Add(Strings.DateFrozen + "\t\t" + DateFrozen.ToString()); found = true; break; case Strings.FreezeExpires: Output.Add(Strings.FreezeExpires + "\t\t" + FreezeExpires.ToString()); found = true; break; case Strings.FreezeReason: Output.Add(Strings.FreezeReason + "\t\t" + FreezeReason.ToString()); found = true; break; case Strings.TimesFrozen: Output.Add(Strings.TimesFrozen + "\t\t" + TimesFrozen.ToString()); found = true; break; case Strings.Muted: Output.Add(Strings.Muted + "\t\t\t" + Muted.ToString()); found = true; break; case Strings.MutedBy: Output.Add(Strings.MutedBy + "\t\t\t" + MutedBy.ToString()); found = true; break; case Strings.DateMuted: Output.Add(Strings.DateMuted + "\t\t" + DateMuted.ToString()); found = true; break; case Strings.MuteExpires: Output.Add(Strings.MuteExpires + "\t\t" + MuteExpires.ToString()); found = true; break; case Strings.MuteReason: Output.Add(Strings.MuteReason + "\t\t" + MuteReason.ToString()); found = true; break; case Strings.TimesMuted: Output.Add(Strings.TimesMuted + "\t\t" + TimesMuted.ToString()); found = true; break; case Strings.Kicked: Output.Add(Strings.Kicked + "\t\t\t" + Kicked.ToString()); found = true; break; case Strings.KickedBy: Output.Add(Strings.KickedBy + "\t\t" + KickedBy.ToString()); found = true; break; case Strings.DateKicked: Output.Add(Strings.DateKicked + "\t\t" + DateKicked.ToString()); found = true; break; case Strings.KickReason: Output.Add(Strings.KickReason + "\t\t" + KickReason.ToString()); found = true; break; case Strings.TimesKicked: Output.Add(Strings.TimesKicked + "\t\t" + TimesKicked.ToString()); found = true; break; case Strings.OthersBanned: Output.Add(Strings.OthersBanned + "\t\t" + OthersBanned.ToString()); found = true; break; case Strings.OthersFrozen: Output.Add(Strings.OthersFrozen + "\t\t" + OthersFrozen.ToString()); found = true; break; case Strings.OthersMuted: Output.Add(Strings.OthersMuted + "\t\t" + OthersMuted.ToString()); found = true; break; case Strings.OthersKicked: Output.Add(Strings.OthersKicked + "\t\t" + OthersKicked.ToString()); found = true; break; case Strings.GroupRepresented: Output.Add(Strings.GroupRepresented + "\t" + GroupRepresented.ToString()); found = true; break; #endregion default: Logger.Log.SystemMessage(String.Format("Unrecognised Value: {0}", Header)); //Unrecognised Value. break; } } if (!found) { switch (Key) { #region Switches case Strings.Name: Output.Add(Strings.Name + "\t\t" + Name); found = true; break; case Strings.DisplayedName: Output.Add(Strings.DisplayedName + "\t\t" + DisplayedName.ToString()); found = true; break; case Strings.LastIP: Output.Add(Strings.LastIP + "\t\t\t" + LastIP.ToString()); found = true; break; case Strings.LoginCount: Output.Add(Strings.LoginCount + "\t\t" + LoginCount.ToString()); found = true; break; case Strings.MessagesTyped: Output.Add(Strings.MessagesTyped + "\t\t" + MessagesTyped.ToString()); found = true; break; case Strings.DateJoined: Output.Add(Strings.DateJoined + "\t\t" + DateJoined.ToString()); found = true; break; case Strings.DateLastVisited: Output.Add(Strings.DateLastVisited + "\t\t" + DateLastVisited.ToString()); found = true; break; case Strings.PlayTime: Output.Add(Strings.PlayTime + "\t\t" + PlayTime.ToString()); found = true; break; case Strings.Kills: Output.Add(Strings.Kills + "\t\t\t" + Kills.ToString()); found = true; break; case Strings.Deaths: Output.Add(Strings.Deaths + "\t\t\t" + Deaths.ToString()); found = true; break; case Strings.FlightsFlown: Output.Add(Strings.FlightsFlown + "\t\t" + FlightsFlown.ToString()); found = true; break; case Strings.FlightHours: Output.Add(Strings.FlightHours + "\t\t" + FlightHours.ToString()); found = true; break; case Strings.Banned: Output.Add(Strings.Banned + "\t\t\t" + Banned.ToString()); found = true; break; case Strings.BannedBy: Output.Add(Strings.BannedBy + "\t\t" + BannedBy.ToString()); found = true; break; case Strings.DateBanned: Output.Add(Strings.DateBanned + "\t\t" + DateBanned.ToString()); found = true; break; case Strings.BanExpires: Output.Add(Strings.BanExpires + "\t\t" + BanExpires.ToString()); found = true; break; case Strings.BanReason: Output.Add(Strings.BanReason + "\t\t" + BanReason.ToString()); found = true; break; case Strings.TimesBanned: Output.Add(Strings.TimesBanned + "\t\t" + TimesBanned.ToString()); found = true; break; case Strings.Frozen: Output.Add(Strings.Frozen + "\t\t\t" + Frozen.ToString()); found = true; break; case Strings.FrozenBy: Output.Add(Strings.FrozenBy + "\t\t" + FrozenBy.ToString()); found = true; break; case Strings.DateFrozen: Output.Add(Strings.DateFrozen + "\t\t" + DateFrozen.ToString()); found = true; break; case Strings.FreezeExpires: Output.Add(Strings.FreezeExpires + "\t\t" + FreezeExpires.ToString()); found = true; break; case Strings.FreezeReason: Output.Add(Strings.FreezeReason + "\t\t" + FreezeReason.ToString()); found = true; break; case Strings.TimesFrozen: Output.Add(Strings.TimesFrozen + "\t\t" + TimesFrozen.ToString()); found = true; break; case Strings.Muted: Output.Add(Strings.Muted + "\t\t\t" + Muted.ToString()); found = true; break; case Strings.MutedBy: Output.Add(Strings.MutedBy + "\t\t\t" + MutedBy.ToString()); found = true; break; case Strings.DateMuted: Output.Add(Strings.DateMuted + "\t\t" + DateMuted.ToString()); found = true; break; case Strings.MuteExpires: Output.Add(Strings.MuteExpires + "\t\t" + MuteExpires.ToString()); found = true; break; case Strings.MuteReason: Output.Add(Strings.MuteReason + "\t\t" + MuteReason.ToString()); found = true; break; case Strings.TimesMuted: Output.Add(Strings.TimesMuted + "\t\t" + TimesMuted.ToString()); found = true; break; case Strings.Kicked: Output.Add(Strings.Kicked + "\t\t\t" + Kicked.ToString()); found = true; break; case Strings.KickedBy: Output.Add(Strings.KickedBy + "\t\t" + KickedBy.ToString()); found = true; break; case Strings.DateKicked: Output.Add(Strings.DateKicked + "\t\t" + DateKicked.ToString()); found = true; break; case Strings.KickReason: Output.Add(Strings.KickReason + "\t\t" + KickReason.ToString()); found = true; break; case Strings.TimesKicked: Output.Add(Strings.TimesKicked + "\t\t" + TimesKicked.ToString()); found = true; break; case Strings.OthersBanned: Output.Add(Strings.OthersBanned + "\t\t" + OthersBanned.ToString()); found = true; break; case Strings.OthersFrozen: Output.Add(Strings.OthersFrozen + "\t\t" + OthersFrozen.ToString()); found = true; break; case Strings.OthersMuted: Output.Add(Strings.OthersMuted + "\t\t" + OthersMuted.ToString()); found = true; break; case Strings.OthersKicked: Output.Add(Strings.OthersKicked + "\t\t" + OthersKicked.ToString()); found = true; break; case Strings.GroupRepresented: Output.Add(Strings.GroupRepresented + "\t" + GroupRepresented.ToString()); found = true; break; #endregion default: Logger.Log.SystemMessage(String.Format("Unrecognised Value: {0}", Key)); //Unrecognised Value. break; } } try { File.WriteAllLines(OutputFile, Output.ToList()); } catch { } }
public void CountDeath() => Deaths.Add((int)RegionManager.Main.TimeElapsed);
protected override bool Sort(List <Household> houses) { Dictionary <Household, int> candidates = new Dictionary <Household, int>(); AddStat("Potentials", houses.Count); SimDescription oldestSim = Sim; foreach (SimDescription sim in Movers) { if ((oldestSim == null) || (SimTypes.IsOlderThan(sim, oldestSim))) { oldestSim = sim; } } foreach (Household house in houses) { bool olderFound = false; foreach (SimDescription other in HouseholdsEx.All(house)) { if (Deaths.IsDying(other)) { continue; } if (SimTypes.IsOlderThan(other, oldestSim)) { olderFound = true; } int count = 0; if (Flirts.IsCloselyRelated(Sim, other)) { if (Sim.Genealogy.Parents.Contains(other.Genealogy)) { count += 10; } else { count++; } } else if (OnlyFamilyMoveIn) { continue; } bool checkRel = false; if (other.YoungAdultOrAbove) { checkRel = true; } else if ((Households.AllowSoloMove(Sim)) && (other.TeenOrAbove)) { checkRel = true; } if (checkRel) { int rel = 0; Relationship relation = Relationship.Get(Sim, other, false); if (relation != null) { rel = (int)(relation.LTR.Liking / 25); if ((relation.AreRomantic()) && (rel > 0)) { rel += 5; } count += rel; } if (Households.AllowSoloMove(Sim)) { if (rel < 3) { continue; } } } if (Sim.Partner == other) { count += 10; } if (!candidates.ContainsKey(house)) { candidates.Add(house, count); } else { candidates[house] += count; } } if (!olderFound) { candidates.Remove(house); } } houses.Clear(); if (candidates.Count > 0) { ScoringList <Household> scoring = new ScoringList <Household>(); foreach (KeyValuePair <Household, int> candidate in candidates) { AddScoring("", candidate.Value); scoring.Add(candidate.Key, candidate.Value); } houses.AddRange(scoring.GetBestByMinScore(1)); } else { IncStat("No Candidates"); } return(true); }
public IEnumerable <Death> GetNpcDeaths() { return(Deaths .Where(d => d.MatchId == this.Id && d.MindKey == null)); }
public override async Task PerformAction() { // is corpse visible if (this.playerReader.CorpseX < 1 && this.playerReader.CorpseX < 1) { await this.stopMoving.Stop(); logger.LogInformation($"Waiting for corpse location to update update before performing action. Corpse is @ {playerReader.CorpseX},{playerReader.CorpseY}"); await Task.Delay(5000); NeedsToReset = true; return; } if (NeedsToReset) { await this.stopMoving.Stop(); while (this.playerReader.PlayerBitValues.DeadStatus) { this.corpseLocation = new WowPoint(playerReader.CorpseX, playerReader.CorpseY); if (this.corpseLocation.X >= 1 || this.corpseLocation.Y > 0) { break; } logger.LogInformation($"Waiting for corpse location to update {playerReader.CorpseX},{playerReader.CorpseY}"); await Task.Delay(1000); } logger.LogInformation($"Corpse location is {playerReader.CorpseX},{playerReader.CorpseY}"); await Reset(); Deaths.Add(this.corpseLocation); } var timeSinceResetSeconds = (DateTime.Now - LastReset).TotalSeconds; if (timeSinceResetSeconds > 80) { await this.stopMoving.Stop(); logger.LogInformation("We have been dead for over 1 minute, trying to path a new route."); await this.Reset(); } await Task.Delay(200); if (!this.playerReader.PlayerBitValues.DeadStatus) { return; } var location = new WowPoint(playerReader.XCoord, playerReader.YCoord); double distance = 0; double heading = 0; if (points.Count == 0) { await Reset(); if (!points.Any()) { points.Push(this.playerReader.CorpseLocation); distance = DistanceTo(location, corpseLocation); heading = DirectionCalculator.CalculateHeading(location, corpseLocation); this.logger.LogInformation("no more points, heading to corpse"); await playerDirection.SetDirection(heading, this.playerReader.CorpseLocation, "Heading to corpse"); input.SetKeyState(ConsoleKey.UpArrow, true, false, "WalkToCorpse"); this.stuckDetector.SetTargetLocation(points.Peek()); } } else { distance = DistanceTo(location, points.Peek()); heading = DirectionCalculator.CalculateHeading(location, points.Peek()); } if (lastDistance < distance) { await playerDirection.SetDirection(heading, points.Peek(), "Further away"); } else if (!this.stuckDetector.IsGettingCloser()) { // stuck so jump input.SetKeyState(ConsoleKey.UpArrow, true, false, "WalkToCorpseAction"); await Task.Delay(100); if (HasBeenActiveRecently()) { await stuckDetector.Unstick(); // give up if we have been dead for 10 minutes var timeDeadSeconds = (DateTime.Now - LastEventReceived).TotalSeconds; if (timeDeadSeconds > 600) { logger.LogInformation("We have been dead for 10 minutes and seem to be stuck."); SendActionEvent(new ActionEventArgs(GOAP.GoapKey.abort, true)); await Task.Delay(10000); return; } distance = DistanceTo(location, points.Peek()); } else { await Task.Delay(1000); logger.LogInformation("Resuming movement"); } } else // distance closer { var diff1 = Math.Abs(RADIAN + heading - playerReader.Direction) % RADIAN; var diff2 = Math.Abs(heading - playerReader.Direction - RADIAN) % RADIAN; if (Math.Min(diff1, diff2) > 0.3) { await playerDirection.SetDirection(heading, points.Peek(), "Correcting direction"); } } lastDistance = distance; if (distance < PointReachedDistance() && points.Any()) { while (distance < PointReachedDistance() && points.Any()) { points.Pop(); if (points.Any()) { distance = WowPoint.DistanceTo(location, points.Peek()); } } lastDistance = 999; if (points.Count > 0) { heading = DirectionCalculator.CalculateHeading(location, points.Peek()); await playerDirection.SetDirection(heading, points.Peek(), "Move to next point"); this.stuckDetector.SetTargetLocation(points.Peek()); } } LastActive = DateTime.Now; }
public void Death() { Deaths?.Invoke($"{name} проиграл"); }
protected override bool PrivateUpdate(ScenarioFrame frame) { SimDescription newSim = null; using (SimFromBin <ManagerSim> bin = new SimFromBin <ManagerSim>(this, Sims)) { CASAgeGenderFlags gender = Sim.Gender; switch (GetValue <GenderOption, BabyGenderScenario.FirstBornGender>()) { case BabyGenderScenario.FirstBornGender.Male: gender = CASAgeGenderFlags.Male; break; case BabyGenderScenario.FirstBornGender.Female: gender = CASAgeGenderFlags.Female; break; } newSim = bin.CreateNewSim(Sim.Age, gender, CASAgeGenderFlags.Human); if (newSim == null) { IncStat("Creation Fail"); return(false); } } bool genderChanged = (Sim.Gender != newSim.Gender); bool result = FacialBlends.CopyGenetics(newSim, Sim, false, false); Sim.VoiceVariation = newSim.VoiceVariation; Sim.VoicePitchModifier = newSim.VoicePitchModifier; Sim.FirstName = newSim.FirstName; if (genderChanged) { Sim.Gender = newSim.Gender; SavedOutfit.Cache cache = new SavedOutfit.Cache(newSim); Dictionary <OutfitCategories, bool> replaced = new Dictionary <OutfitCategories, bool>(); Sim.RemoveOutfits(OutfitCategories.Career, true); SimOutfit geneOutfit = CASParts.GetOutfit(Sim, CASParts.sPrimary, false); foreach (SavedOutfit.Cache.Key outfit in cache.Outfits) { using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(Sim, outfit.mKey, geneOutfit)) { builder.Builder.Gender = Sim.Gender; outfit.Apply(builder, false, null, null); if (!replaced.ContainsKey(outfit.Category)) { replaced.Add(outfit.Category, true); CASParts.RemoveOutfits(Sim, outfit.Category, false); } } } if (Sim.CreatedSim != null) { Sim.CreatedSim.UpdateOutfitInfo(); Sim.CreatedSim.RefreshCurrentOutfit(true); SwitchOutfits.SwitchNoSpin(Sim.CreatedSim, new CASParts.Key(OutfitCategories.Everyday, 0)); } } else { new SavedOutfit.Cache(Sim).PropagateGenetics(Sim, CASParts.sPrimary); } if (newSim.OccultManager.CurrentOccultTypes != OccultTypes.None) { if (Instantiation.PerformOffLot(Sim, Household.ActiveHousehold.LotHome, null) != null) { List <OccultTypes> occults = OccultTypeHelper.CreateList(newSim, true); foreach (OccultTypes occult in occults) { switch (occult) { case OccultTypes.Frankenstein: Sim.TraitManager.AddElement(TraitNames.Brave); Sim.TraitManager.AddElement(TraitNames.Hydrophobic); break; } } Sims.ApplyOccultChance(this, Sim, occults, 100, int.MaxValue); } if (Sim.GetOutfitCount(OutfitCategories.Everyday) > 1) { Sim.RemoveOutfit(OutfitCategories.Everyday, 1, true); } SimOutfit currentOutfit = Sim.GetOutfit(OutfitCategories.Everyday, 0); if (currentOutfit != null) { try { ThumbnailManager.GenerateHouseholdSimThumbnail(currentOutfit.Key, currentOutfit.Key.InstanceId, 0x0, ThumbnailSizeMask.Large | ThumbnailSizeMask.ExtraLarge | ThumbnailSizeMask.Medium | ThumbnailSizeMask.Small, ThumbnailTechnique.Default, true, false, Sim.AgeGenderSpecies); } catch (Exception e) { Common.Exception(Sim, e); } } } Deaths.CleansingKill(newSim, true); if (!result) { return(false); } if (Common.kDebugging) { Common.DebugNotify(GetTitlePrefix(PrefixType.Pure) + ": " + Sim.FullName, Sim.CreatedSim); } SpeedTrap.Sleep(); return(true); }
public void AddData(IEntity data, EntityType entityType) { switch (entityType) { case EntityType.Person: { Persons.Add((Person)data); break; } case EntityType.Death: { Deaths.Add((Death)data); break; } case EntityType.PayerPlanPeriod: { PayerPlanPeriods.Add((PayerPlanPeriod)data); break; } case EntityType.ConditionOccurrence: { ConditionOccurrences.Add((ConditionOccurrence)data); break; } case EntityType.DrugExposure: { DrugExposures.Add((DrugExposure)data); break; } case EntityType.ProcedureOccurrence: { ProcedureOccurrences.Add((ProcedureOccurrence)data); break; } case EntityType.Observation: { Observations.Add((Observation)data); break; } case EntityType.VisitOccurrence: { VisitOccurrences.Add((VisitOccurrence)data); break; } case EntityType.VisitDetail: { VisitDetails.Add((VisitDetail)data); break; } case EntityType.Cohort: { Cohort.Add((Cohort)data); break; } case EntityType.Measurement: { Measurements.Add((Measurement)data); break; } case EntityType.DeviceExposure: { DeviceExposure.Add((DeviceExposure)data); break; } case EntityType.ObservationPeriod: { ObservationPeriods.Add((ObservationPeriod)data); break; } case EntityType.DrugEra: { DrugEra.Add((EraEntity)data); break; } case EntityType.ConditionEra: { ConditionEra.Add((EraEntity)data); break; } case EntityType.Note: { Note.Add((Note)data); break; } } }
public override async Task PerformAction() { if (NeedsToReset) { while (true && this.playerReader.PlayerBitValues.DeadStatus) { this.corpseLocation = new WowPoint(playerReader.CorpseX, playerReader.CorpseY); if (this.corpseLocation.X > 0) { break; } logger.LogInformation($"Waiting for corpse location to update {playerReader.CorpseX},{playerReader.CorpseY}"); await Task.Delay(1000); } logger.LogInformation($"Corpse location is {playerReader.CorpseX},{playerReader.CorpseY}"); await Reset(); this.stuckDetector.SetTargetLocation(points.Peek()); Deaths.Add(this.corpseLocation); } await Task.Delay(200); if (!this.playerReader.PlayerBitValues.DeadStatus) { return; } var location = new WowPoint(playerReader.XCoord, playerReader.YCoord); double distance = 0; double heading = 0; if (points.Count == 0) { points.Push(this.playerReader.CorpseLocation); distance = DistanceTo(location, corpseLocation); heading = DirectionCalculator.CalculateHeading(location, corpseLocation); this.logger.LogInformation("no more points, heading to corpse"); await playerDirection.SetDirection(heading, this.playerReader.CorpseLocation, "Heading to corpse"); wowProcess.SetKeyState(ConsoleKey.UpArrow, true, false, "WalkToCorpse"); this.stuckDetector.SetTargetLocation(points.Peek()); } else { distance = DistanceTo(location, points.Peek()); heading = DirectionCalculator.CalculateHeading(location, points.Peek()); } if (lastDistance < distance) { await playerDirection.SetDirection(heading, points.Peek(), "Further away"); } else if (!this.stuckDetector.IsGettingCloser()) { // stuck so jump wowProcess.SetKeyState(ConsoleKey.UpArrow, true, false, "WalkToCorpseAction"); await Task.Delay(100); if (HasBeenActiveRecently()) { await stuckDetector.Unstick(); } else { await Task.Delay(1000); logger.LogInformation("Resuming movement"); } } else // distance closer { var diff1 = Math.Abs(RADIAN + heading - playerReader.Direction) % RADIAN; var diff2 = Math.Abs(heading - playerReader.Direction - RADIAN) % RADIAN; if (Math.Min(diff1, diff2) > 0.3) { await playerDirection.SetDirection(heading, points.Peek(), "Correcting direction"); } } lastDistance = distance; if (distance < 40 && points.Any()) { logger.LogInformation($"Move to next point"); points.Pop(); lastDistance = 999; if (points.Count > 0) { heading = DirectionCalculator.CalculateHeading(location, points.Peek()); await playerDirection.SetDirection(heading, points.Peek(), "Move to next point"); this.stuckDetector.SetTargetLocation(points.Peek()); } } LastActive = DateTime.Now; }
private void Timer_Tick(object sender, EventArgs e) { if (Window == null) { LoadWindows(); return; } int size = GetWindowTextLength(Window.hwnd); if (size++ > 0 && IsWindowVisible(Window.hwnd)) { StringBuilder sb = new StringBuilder(size); GetWindowText(Window.hwnd, sb, size); var currentTime = Regex.Match(sb.ToString(), "([0-9]+\\s*:\\s*[0-9]+\\s*:\\s*[0-9]+)", RegexOptions.IgnoreCase).Value; if (string.IsNullOrEmpty(currentTime)) { currentTime = Regex.Match(sb.ToString(), "(Time\\s*\\[\\s*[0-9]\\s*\\]\\s*:\\s*[0-9]+)", RegexOptions.IgnoreCase).Value; } if (!string.IsNullOrEmpty(currentTime)) { GameTime = currentTime.Replace("Time", ""); var tempDeaths = Regex.Match(sb.ToString(), DeathsRegex, RegexOptions.IgnoreCase).Value; var temp = Regex.Match(tempDeaths, "\\[[0-9]\\]").Value; Deaths = !string.IsNullOrEmpty(temp) ? tempDeaths.Replace(temp, "") : tempDeaths; Deaths = Deaths.ToUpper() .Replace(" ", "") .Replace(":", "") .Replace("DEATHS", "") .Replace("DEATH", ""); string tempGameName = sb.ToString().Replace(currentTime, "").Replace(tempDeaths, ""); gameName = Regex.Replace(tempGameName, "[^A-Za-zА-Яа-я0-9 _.]", "_") + ".txt"; if (!File.Exists(folder + gameName)) { var fs = File.Create(folder + gameName); fs.Close(); Stats = new Stats { Values = new List <StatsValue>(), Parallels = new ObservableCollection <Parallels>() }; var json = Serializer.Serialize(Stats); File.WriteAllText(folder + gameName, json); } if (Stats == null) { var json = File.ReadAllText(folder + gameName); Stats = Serializer.Deserialize <Stats>(json); } var currentDeaths = GetDeaths(); foreach (var parallel in Stats.Parallels) // для ситуаций, когда текущее время меньше чем записаное в файл { if (parallel.OffTime > new ComplexTime { Hours = GetHours(), Minutes = GetMinutes(), Seconds = GetSeconds() }) { parallel.OffTime = new ComplexTime { Hours = GetHours(), Minutes = GetMinutes(), Seconds = GetSeconds() }; parallel.ElapsedTime = GTC.CalculateSum(GTC.CalculateDifference(parallel.BackTime, parallel.OffTime), parallel.ElapsedTime); } if (parallel.BackTime > new ComplexTime { Hours = GetHours(), Minutes = GetMinutes(), Seconds = GetSeconds() }) { parallel.BackTime = new ComplexTime { Hours = GetHours(), Minutes = GetMinutes(), Seconds = GetSeconds() }; } if (parallel.OffDeaths > currentDeaths) { parallel.OffDeaths = currentDeaths.Value; parallel.ElapsedDeaths = parallel.OffDeaths - parallel.BackDeaths + parallel.ElapsedDeaths; } if (parallel.BackDeaths > currentDeaths) { parallel.BackDeaths = currentDeaths.Value; } ParallelsVisibility = Visibility.Visible; } foreach (var statsValue in Stats.Values) { if (statsValue.Time > new ComplexTime { Hours = GetHours(), Minutes = GetMinutes(), Seconds = GetSeconds() }) { statsValue.Time = new ComplexTime { Hours = GetHours(), Minutes = GetMinutes(), Seconds = GetSeconds() }; } if (statsValue.Deaths.HasValue && statsValue.Deaths.Value > currentDeaths) { statsValue.Deaths = currentDeaths.Value; } } foreach (var parallel in Stats.Parallels) { if (Stats.Values.Last().Time > parallel.OffTime) { ParallelsVisibility = Visibility.Collapsed; } } if (Stats.SelectedParallel == null) { if (Stats.Values.Count == 0) { Current = $"Time: {GetHours():0}:{GetMinutes():00}:{GetSeconds():00}\nDeaths: {GetDeaths()}"; } else { var idk = GTC.CalculateDifference(Stats.Values.Last().Time, new ComplexTime { Hours = GetHours(), Minutes = GetMinutes(), Seconds = GetSeconds() }); Current = $"Time: {idk.Hours:0}:{idk.Minutes:00}:{idk.Seconds:00}\nDeaths: {GetDeaths() - Stats.Values.Last().Deaths}"; } if (Stats.Values.Count == 0) { Last = ""; } else if (Stats.Values.Count == 1) { Last = $"Time: {Stats.Values.Last().Time.Hours}:{Stats.Values.Last().Time.Minutes}:{Stats.Values.Last().Time.Seconds}\nDeaths: {Stats.Values.Last().Deaths}"; } else { var idk = GTC.CalculateDifference(Stats.Values[Stats.Values.Count - 2].Time, Stats.Values.Last().Time); Last = $"Time:{idk.Hours:0}:{idk.Minutes:00}:{idk.Seconds:00}\nDeaths: {Stats.Values.Last().Deaths - Stats.Values[Stats.Values.Count - 2].Deaths}"; } } else { var currentParallel = Stats.Parallels.FirstOrDefault(i => i.ID.Equals(Stats.SelectedParallel)); if (!currentParallel.Cleared) { var timenow = new ComplexTime { Hours = GetHours(), Minutes = GetMinutes(), Seconds = GetSeconds() }; var idk = GTC.CalculateSum(GTC.CalculateDifference(currentParallel.BackTime, timenow), currentParallel.ElapsedTime); currentParallel.ElapsedTimeString = idk.Hours + ":" + idk.Minutes + ":" + idk.Seconds; var idk2 = currentDeaths - currentParallel.BackDeaths + currentParallel.ElapsedDeaths; currentParallel.ElapsedDeathsString = idk2.ToString(); } } } } else { Stats = null; LoadWindows(); } }
public void AddData(IEntity data, EntityType entityType) { switch (entityType) { case EntityType.Person: { Persons.Enqueue((Person)data); break; } case EntityType.Death: { Deaths.Enqueue((Death)data); break; } case EntityType.PayerPlanPeriod: { PayerPlanPeriods.Enqueue((PayerPlanPeriod)data); break; } case EntityType.ConditionOccurrence: { ConditionOccurrences.Enqueue((ConditionOccurrence)data); break; } case EntityType.DrugExposure: { DrugExposures.Enqueue((DrugExposure)data); break; } case EntityType.ProcedureOccurrence: { ProcedureOccurrences.Enqueue((ProcedureOccurrence)data); break; } case EntityType.Observation: { Observations.Enqueue((Observation)data); break; } case EntityType.VisitOccurrence: { VisitOccurrences.Enqueue((VisitOccurrence)data); break; } case EntityType.Cohort: { Cohort.Enqueue((Cohort)data); break; } case EntityType.Measurement: { Measurements.Enqueue((Measurement)data); break; } case EntityType.DeviceExposure: { DeviceExposure.Enqueue((DeviceExposure)data); break; } case EntityType.DeviceCost: { DeviceCost.Enqueue((DeviceCost)data); break; } case EntityType.DrugCost: { DrugCost.Enqueue((DrugCost)data); break; } case EntityType.VisitCost: { VisitCost.Enqueue((VisitCost)data); break; } //case EntityType.Cost: //{ // break; //} case EntityType.ProcedureCost: { ProcedureCost.Enqueue((ProcedureCost)data); break; } case EntityType.ObservationPeriod: { ObservationPeriods.Enqueue((ObservationPeriod)data); break; } case EntityType.DrugEra: { DrugEra.Enqueue((EraEntity)data); break; } case EntityType.ConditionEra: { ConditionEra.Enqueue((EraEntity)data); break; } } }
public void AddDeath() { Deaths++; DeathsText.text = Deaths.ToString(); }
/// <summary> /// Restore player's data from a Player object /// </summary> /// <param name="player"></param> public void BackupFromPlayer(Player player) { Kills.Clear(); foreach (KillEvent e in player.Kills) { Kills.Add(e); } Deaths.Clear(); foreach (KillEvent e in player.Deaths) { Deaths.Add(e); } Assists.Clear(); foreach (KillEvent e in player.Assists) { Assists.Add(e); } Clutches.Clear(); foreach (ClutchEvent e in player.Clutches) { Clutches.Add(e); } EntryHoldKills.Clear(); foreach (EntryHoldKillEvent e in player.EntryHoldKills) { EntryHoldKills.Add(e); } EntryKills.Clear(); foreach (EntryKillEvent e in player.EntryKills) { EntryKills.Add(e); } PlayersHurted.Clear(); foreach (PlayerHurtedEvent e in player.PlayersHurted) { PlayersHurted.Add(e); } RoundsMoneyEarned.Clear(); foreach (KeyValuePair <int, int> kvp in player.RoundsMoneyEarned) { RoundsMoneyEarned.Add(kvp.Key, kvp.Value); } StartMoneyRounds.Clear(); foreach (KeyValuePair <int, int> kvp in player.StartMoneyRounds) { StartMoneyRounds.Add(kvp.Key, kvp.Value); } EquipementValueRounds.Clear(); foreach (KeyValuePair <int, int> kvp in player.EquipementValueRounds) { EquipementValueRounds.Add(kvp.Key, kvp.Value); } AssistCount = player.AssistCount; BombDefusedCount = player.BombDefusedCount; BombExplodedCount = player.BombExplodedCount; BombPlantedCount = player.BombPlantedCount; CrouchKillCount = player.CrouchKillCount; DeathCount = player.DeathCount; DecoyThrownCount = player.DecoyThrownCount; EseaRws = player.EseaRws; EseaRwsPointCount = player.EseaRwsPointCount; FiveKillCount = player.FiveKillCount; FlashbangThrownCount = player.FlashbangThrownCount; FlashDurationTemp = player.FlashDurationTemp; FourKillCount = player.FourKillCount; HasBomb = player.HasBomb; HasEntryHoldKill = player.HasEntryHoldKill; HasEntryKill = player.HasEntryKill; HeadshotCount = player.HeadshotCount; HeGrenadeThrownCount = player.HeGrenadeThrownCount; IsAlive = player.IsAlive; IncendiaryThrownCount = player.IncendiaryThrownCount; IsConnected = player.IsConnected; IsControllingBot = player.IsControllingBot; JumpKillCount = player.JumpKillCount; KillCount = player.KillCount; MolotovThrownCount = player.MolotovThrownCount; OneKillCount = player.OneKillCount; RatingHltv = player.RatingHltv; RoundMvpCount = player.RoundMvpCount; RoundPlayedCount = player.RoundPlayedCount; Score = player.Score; Side = player.Side; SmokeThrownCount = player.SmokeThrownCount; TeamKillCount = player.TeamKillCount; TeamName = player.TeamName; ThreeKillCount = player.ThreeKillCount; TradeDeathCount = player.TradeDeathCount; TradeKillCount = player.TradeKillCount; TwoKillCount = player.TwoKillCount; }
public void OnGet() { Deaths = diagnosisService.Deaths(); Recovered = diagnosisService.Recovered(); Diagnoses = diagnosisService.GetDiagnosesWithCorona(); var newDiagnosis = Diagnoses .Where(x => (x.Death == true && x.Recovered == true) || (x.Death == true && x.Recovered == false) || (x.Death == false && x.Recovered == true)) .GroupBy(d => d.Recovered); foreach (var item in newDiagnosis) { RecoveryRate.Add(new StatisticsCore { Recovered = item.Key == true ? "Recovered " + String.Format("{0:0.00}", ((double)item.Count() / (Deaths.Count() + Recovered.Count())) * 100) + "%" : "Deaths " + String.Format("{0:0.00}", ((double)item.Count() / (Deaths.Count() + Recovered.Count())) * 100) + "%", TotalPatients = item.GroupBy(x => x.Patient.Name).Count() }); } }