Exemple #1
0
        public override void Load(SerializationReader Reader)
        {
            this.village = HistoricEntity.Load(Reader, XRLCore.Core.Game.sultanHistory).GetCurrentSnapshot();
            this.amount  = Reader.ReadSingle();
            this.faction = Factions.FactionList[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());
            }
        }
Exemple #2
0
        public acegiak_PatriotPreference(acegiak_Romancable romancable)
        {
            Romancable = romancable;


            List <HistoricEntity> villages = HistoryAPI.GetVillages();
            // .Name.Contains("villagers")
            int high = 0;

            foreach (KeyValuePair <string, int> item in  romancable.ParentObject.pBrain.FactionMembership)
            {
                if (item.Key.Contains("villagers"))
                {
                    if (item.Value > high && villages.Select(v => v.GetCurrentSnapshot()).Where(v => item.Key.Contains(v.Name)).Count() > 0)
                    {
                        village = villages.Select(v => v.GetCurrentSnapshot()).Where(v => item.Key.Contains(v.Name)).FirstOrDefault();
                        high    = item.Value;
                        faction = Factions.get(item.Key);
                    }
                }
            }



            amount = (float)((Stat.Rnd2.NextDouble() * 1.5) - 0.5);



            if (village == null || faction == null)
            {
                throw new Exception("Not a villager.");
            }
            //IPart.AddPlayerMessage("They "+(amount>0?"like":"dislike")+" "+this.interestedFaction);
            List <JournalVillageNote> notesForVillage = JournalAPI.GetNotesForVillage(village.entity.id);

            while (this.historytales.Count < 2)
            {
                this.historytales.Add(notesForVillage[Stat.Rnd2.Next(0, notesForVillage.Count)]);
            }
        }