public string[] EntityDebugData() { List <string> debugOut = new List <string>(); debugOut.Add("Position: " + Position); if (this is NPC) { NPC npc = (this as NPC); if (npc.NPCData.HasJob) { debugOut.Add("JobTitle: " + npc.NPCData.NPCJob.Title); } NPCKingdomData kData = npc.NPCKingdomData; if (kData != null) { debugOut.Add("Kingdom: " + kData.GetKingdom().ToString()); debugOut.Add("Settlement: " + kData.GetSettlement().ToString()); debugOut.Add("Rank: " + kData.Rank.ToString()); } } return(debugOut.ToArray()); }
/// <summary> /// Generates the kingdom data for each NPC - /// Tells the NPC which settlement and kingdom it belongs too, as well as its position in the settlement /// </summary> /// <param name="npcs"></param> /// <param name="settlement"></param> private void GenerateSettlementNPCKingdomData(List <NPC> npcs, Settlement settlement) { foreach (NPC npc in npcs) { KingdomHierarchy rank = KingdomHierarchy.Peasant; House h = npc.NPCData.House as House; if (h is Castle) //Check if the house is a Castle { //If this is a capital, then this NPC is a monarch if (settlement.SettlementType == SettlementType.CAPITAL) { rank = KingdomHierarchy.Monarch; } else {//If not, they're a noble rank = KingdomHierarchy.Noble; } //Either way, they'll be a leader of this settlement settlement.AddLeader(npc); } else if (h is Hold) { rank = KingdomHierarchy.LordLady; settlement.AddLeader(npc); } else if (h is VillageHall) { rank = KingdomHierarchy.Mayor; settlement.AddLeader(npc); } else { if (settlement.SettlementType == SettlementType.CAPITAL) { rank = KingdomHierarchy.Citizen; //All NPCs in capital are citizens } else { //Citizen or peasant based on house value float cutoff = 150; //The cutoff value. If house is worth less than this, peasant if (h.Value < cutoff) { rank = KingdomHierarchy.Peasant; } else { rank = KingdomHierarchy.Citizen; } } } //Create and appl. NPCKingdomData kData = new NPCKingdomData(rank, settlement.KingdomID, settlement.SettlementID); npc.SetKingdomData(kData); } }
public void SetKingdomData(NPCKingdomData npckdat) { NPCKingdomData = npckdat; }