public override void Load(SerializationReader Reader) { this.village = HistoricEntity.Load(Reader, XRLCore.Core.Game.sultanHistory).GetCurrentSnapshot(); this.amount = Reader.ReadSingle(); this.faction = Factions.get(Reader.ReadString()); int countTales = Reader.ReadInt32(); this.historytales = new List <JournalVillageNote>(); List <JournalVillageNote> allnotes = JournalAPI.GetNotesForVillage(village.entity.id); for (int i = 0; i < countTales; i++) { string thissecretid = Reader.ReadString(); JournalVillageNote note = allnotes.FirstOrDefault(c => c.secretid == thissecretid); if (note != null) { this.historytales.Add(note); } } int counttales = Reader.ReadInt32(); this.tales = new List <string>(); for (int i = 0; i < counttales; i++) { this.tales.Add(Reader.ReadString()); } }
public acegiak_SultanInterestPreference(acegiak_Romancable romancable) { Romancable = romancable; amount = (float)((Stat.Rnd2.NextDouble() * 2) - 0.9); History sultanHistory = XRLCore.Core.Game.sultanHistory; HistoricEntityList entitiesWherePropertyEquals = sultanHistory.GetEntitiesWherePropertyEquals("type", "sultan"); this.faveSultan = entitiesWherePropertyEquals.GetRandomElement(Stat.Rand); List <HistoricEvent> list = new List <HistoricEvent>(); for (int i = 0; i < this.faveSultan.events.Count; i++) { if (this.faveSultan.events[i].hasEventProperty("gospel")) { list.Add(this.faveSultan.events[i]); } } if (list.Count > 0) { while (this.tales.Count < 2) { this.tales.Add(list[Stat.Random(0, list.Count - 1)]); } } //IPart.AddPlayerMessage("They "+(amount>0?"like":"dislike")+" "+this.faveSultan.GetCurrentSnapshot().GetProperty("name","sultan")); }
public HistoricEntity[] GetPetHistoric(int id) { if (id <= 0) { throw new ArgumentNullException("id", "ID is null"); } var arrayOfHistoricEntity = new List <HistoricEntity>(); CompaniesController companyController = new CompaniesController(); using (Petz_dbEntities db = new Petz_dbEntities()) { var arrayHistoric = db.petz_Pet_Historic.Where(x => x.pet_id == id).ToArray(); foreach (var hist in arrayHistoric) { HistoricEntity entity = new HistoricEntity { Comments = hist.history_comments }; if (hist.history_date != null) { entity.Date = hist.history_date.Value; } entity.Id = hist.history_id; entity.Employee = companyController.GetEmployees(hist.employees_id); arrayOfHistoricEntity.Add(entity); } } return(arrayOfHistoricEntity.ToArray()); }
public override void Load(SerializationReader Reader) { this.faveSultan = HistoricEntity.Load(Reader, XRLCore.Core.Game.sultanHistory); this.amount = Reader.ReadSingle(); int countTales = Reader.ReadInt32(); this.tales = new List <HistoricEvent>(); for (int i = 0; i < countTales; i++) { this.tales.Add(HistoricEvent.Load(Reader)); } int countmytales = Reader.ReadInt32(); this.mytales = new List <string>(); for (int i = 0; i < countmytales; i++) { this.mytales.Add(Reader.ReadString()); } }
/// <summary> /// Saves the history. /// </summary> /// <param name="entity">The entity.</param> /// <param name="state">The state.</param> /// <param name="lastEventApplied">The last event applied.</param> /// <param name="appliedEvents">The applied events.</param> /// <param name="processedAt">The processed at.</param> /// <param name="version">The version.</param> public void SaveHistory(TEntity entity, string state, IDomainEvent <TEntity> lastEventApplied, List <IDomainEvent <TEntity> > appliedEvents, DateTime processedAt, long version) { if (!_storeHistory) { return; } var item = new HistoricEntity <TEntity> { AppliedEvent = appliedEvents, ProcessedAt = processedAt, State = state ?? "Sin Estado", LastEventApplied = lastEventApplied, Version = version }; if (_maxHistory > 0) { var entityEventSource = _repository.FindById(entity.Id); if (entityEventSource.History.Count > _maxHistory) { _repository.Update ( new { entity.Id }, x => ((UpdateBuilder)x.GetUpdateBuilder()) .PopFirst("History") .Push("History", BsonDocumentWrapper.Create(item)) ); return; } } _repository.Update ( new { entity.Id }, x => ((UpdateBuilder)x.GetUpdateBuilder()) .Push("History", BsonDocumentWrapper.Create(item)) ); }