public static QuestTask Load(GomObjectData obj, QuestStep step) { QuestTask task = new QuestTask(); task.Step = step; task.Id = (int)obj.ValueOrDefault <long>("qstTaskId", 0); task.CountMax = (int)obj.ValueOrDefault <long>("qstTaskCountMax", 0); task.ShowTracking = obj.ValueOrDefault <bool>("qstTaskShowTracking", false); task.ShowCount = obj.ValueOrDefault <bool>("qstTaskShowTrackingCount", false); task.Hook = QuestHookExtensions.ToQuestHook((string)obj.ValueOrDefault <string>("qstHook", null)); long stringId = 0; long.TryParse(obj.ValueOrDefault <string>("qstTaskStringid", null), out stringId); var txtLookup = step.Branch.Quest.TextLookup; if (txtLookup.ContainsKey(stringId)) { task.String = StringTable.TryGetString(step.Branch.Quest.Fqn, (GomObjectData)txtLookup[stringId]); } task.TaskQuests = new List <Quest>(); task.TaskNpcs = new List <Npc>(); var qstTaskObjects = (Dictionary <object, object>)obj.ValueOrDefault <Dictionary <object, object> >("qstTaskObjects", null); if (qstTaskObjects != null) { foreach (var taskObj in qstTaskObjects) { string fqn = (string)taskObj.Key; if (fqn.StartsWith("qst.")) { var qst = QuestLoader.Load(fqn); task.TaskQuests.Add(qst); } else if (fqn.StartsWith("npc.")) { var npc = NpcLoader.Load(fqn); task.TaskNpcs.Add(npc); } else if (fqn.StartsWith("plc.")) { } } } return(task); }
static Npc CompanionBySimpleNameId(long nameId) { if (companionShortNameMap.Count == 0) { var cmpInfo = DataObjectModel.GetObject("chrCompanionInfo_Prototype"); var chrCompanionSimpleNameToSpec = cmpInfo.Data.Get <Dictionary <object, object> >("chrCompanionSimpleNameToSpec"); foreach (var kvp in chrCompanionSimpleNameToSpec) { var simpleNameId = (long)kvp.Key; Npc npc = NpcLoader.Load((ulong)kvp.Value); companionShortNameMap[simpleNameId] = npc; } } return(companionShortNameMap[nameId]); }
public static Models.Companion Load(Models.Companion cmp, ulong npcId, GomObjectData obj) { if (obj == null) { return(cmp); } if (cmp == null) { return(null); } IDictionary <string, object> objAsDict = obj.Dictionary; cmp.Npc = NpcLoader.Load(npcId); cmp.Name = cmp.Npc.Name; cmp.Id = cmp.Npc.Id; cmp.Portrait = ParsePortrait((string)obj.Dictionary["chrCompanionInfo_portrait"]); cmp.ConversationMultiplier = (float)obj.Dictionary["chrCompanionInfo_affectionMultiplier"]; cmp.Classes = new List <ClassSpec>(); Dictionary <object, object> profMods = (Dictionary <object, object>)obj.Dictionary["chrCompanionInfo_profession_modifiers"]; cmp.ProfessionModifiers = new List <CompanionProfessionModifier>(); foreach (var profKvp in profMods) { CompanionProfessionModifier mod = new CompanionProfessionModifier(); mod.Companion = cmp; mod.Stat = StatExtensions.ToStat((ScriptEnum)profKvp.Key); mod.Modifier = (int)(long)profKvp.Value; cmp.ProfessionModifiers.Add(mod); } Dictionary <object, object> giftInterestMap = (Dictionary <object, object>)obj.Dictionary["chrCompanionInfo_gift_interest_unromanced_map"]; cmp.GiftInterest = new List <CompanionGiftInterest>(); foreach (var giftKvp in giftInterestMap) { CompanionGiftInterest cgi = new CompanionGiftInterest(); cgi.Companion = cmp; cgi.GiftType = GiftTypeExtensions.ToGiftType((ScriptEnum)giftKvp.Key); cgi.Reaction = GiftInterestExtensions.ToGiftInterest((ScriptEnum)giftKvp.Value); cmp.GiftInterest.Add(cgi); } giftInterestMap = (Dictionary <object, object>)obj.Dictionary["chrCompanionInfo_gift_interest_romanced_map"]; foreach (var giftKvp in giftInterestMap) { GiftType gftType = GiftTypeExtensions.ToGiftType((ScriptEnum)giftKvp.Key); var cgi = cmp.GiftInterest.First(x => x.GiftType == gftType); cgi.RomancedReaction = GiftInterestExtensions.ToGiftInterest((ScriptEnum)giftKvp.Value); cmp.IsRomanceable = true; } if (!cmp.IsRomanceable) { // Force Malavai Quinn and Lt. Pierce to be listed as romanceable if (cmp.Name.Contains("Quinn") || (cmp.Name.Contains("Pierce"))) { cmp.IsRomanceable = true; } } cmp.AffectionRanks = new List <CompanionAffectionRank>(); List <object> affectionRanks = (List <object>)obj.Dictionary["chrCompanionInfo_threshold_list"]; int rank = 0; foreach (long aff in affectionRanks) { CompanionAffectionRank car = new CompanionAffectionRank(); car.Companion = cmp; car.Rank = rank; car.Affection = (int)aff; cmp.AffectionRanks.Add(car); rank++; } return(cmp); }