void WriteFish(string lang) { foreach (var spot in _db.FishingSpots) { var wrapper = new JsWrapper(lang, "fishing", spot); AddPartials(wrapper, spot); _update.IncludeDocument((string)spot.id, "fishing", lang, 2, Wrapper(wrapper)); } // Garland Bell and FFXIVFisher data. var parts = new List <string>(); // Bait var baitData = new JObject(); foreach (var bait in _db.Baits) { baitData.Add((string)bait.name, bait); } parts.Add("gt.bell.bait = " + Json(baitData, Formatting.Indented)); // Fish var fishData = new JArray(); foreach (var fish in _db.Fish) { fishData.Add(fish); } parts.Add("gt.bell.fish = " + Json(fishData, Formatting.Indented)); parts.Add(""); FileDatabase.Write("bell\\fish.js", string.Join(";\r\n\r\n", parts)); }
void WriteFates(string lang) { Parallel.ForEach(_db.Fates, fate => { var wrapper = new JsWrapper(lang, "fate", fate); AddPartials(wrapper, fate); _update.IncludeDocument((string)fate.id, "fate", lang, 2, Wrapper(wrapper)); }); }
void WriteInstances(string lang) { Parallel.ForEach(_db.Instances, instance => { var wrapper = new JsWrapper(lang, "instance", instance); AddPartials(wrapper, instance); _update.IncludeDocument((string)instance.id, "instance", lang, 2, Wrapper(wrapper)); }); }
void WriteAchievements(string lang) { Parallel.ForEach(_db.Achievements, achievement => { var wrapper = new JsWrapper(lang, "achievement", achievement); AddPartials(wrapper, achievement); _update.IncludeDocument((string)achievement.id, "achievement", lang, 2, Wrapper(wrapper)); }); }
void WriteNpcs(string lang) { Parallel.ForEach(_db.Npcs, npc => { var wrapper = new JsWrapper(lang, "npc", npc); AddPartials(wrapper, npc); _update.IncludeDocument((string)npc.id, "npc", lang, 2, Wrapper(wrapper)); }); }
void WriteActions(string lang) { Parallel.ForEach(_db.Actions, action => { var wrapper = new JsWrapper(lang, "action", action); AddPartials(wrapper, action); _update.IncludeDocument((string)action.id, "action", lang, 2, Wrapper(wrapper)); }); }
void WriteMobs(string lang) { Parallel.ForEach(_db.Mobs, mob => { var wrapper = new JsWrapper(lang, "mob", mob); AddPartials(wrapper, mob); _update.IncludeDocument((string)mob.id, "mob", lang, 2, Wrapper(wrapper)); }); }
void WriteActions(string lang) { foreach (var action in _db.Actions) { var wrapper = new JsWrapper(lang, "action", action); AddPartials(wrapper, action); _update.IncludeDocument((string)action.id, "action", lang, 2, Wrapper(wrapper)); } }
void WriteStatuses(string lang) { Parallel.ForEach(_db.Statuses, status => { var wrapper = new JsWrapper(lang, "status", status); AddPartials(wrapper, status); _update.IncludeDocument((string)status.id, "status", lang, 2, Wrapper(wrapper)); }); }
void WriteFates(string lang) { foreach (var fate in _db.Fates) { var wrapper = new JsWrapper(lang, "fate", fate); AddPartials(wrapper, fate); _update.IncludeDocument((string)fate.id, "fate", lang, 2, Wrapper(wrapper)); } }
void WriteMobs(string lang) { foreach (var mob in _db.Mobs) { var wrapper = new JsWrapper(lang, "mob", mob); AddPartials(wrapper, mob); _update.IncludeDocument((string)mob.id, "mob", lang, 2, Wrapper(wrapper)); } }
void WriteAchievements(string lang) { foreach (var achievement in _db.Achievements) { var wrapper = new JsWrapper(lang, "achievement", achievement); AddPartials(wrapper, achievement); _update.IncludeDocument((string)achievement.id, "achievement", lang, 2, Wrapper(wrapper)); } }
void WriteInstances(string lang) { foreach (var instance in _db.Instances) { var wrapper = new JsWrapper(lang, "instance", instance); AddPartials(wrapper, instance); _update.IncludeDocument((string)instance.id, "instance", lang, 2, Wrapper(wrapper)); } }
void WriteNpcs(string lang) { foreach (var npc in _db.Npcs) { var wrapper = new JsWrapper(lang, "npc", npc); AddPartials(wrapper, npc); _update.IncludeDocument((string)npc.id, "npc", lang, 2, Wrapper(wrapper)); } }
void WriteQuests(string lang) { Parallel.ForEach(_db.Quests, quest => { var wrapper = new JsWrapper(lang, "quest", quest); AddPartials(wrapper, quest); _update.IncludeDocument((string)quest.id, "quest", lang, 2, Wrapper(wrapper)); }); }
void WriteQuests(string lang) { foreach (var quest in _db.Quests) { var wrapper = new JsWrapper(lang, "quest", quest); AddPartials(wrapper, quest); _update.IncludeDocument((string)quest.id, "quest", lang, 2, Wrapper(wrapper)); } }
void AddPartials(JsWrapper wrapper, object source) { var partials = GetPartials(source, wrapper.Lang, false); if (partials != null && partials.Count > 0) { if (wrapper.Partials == null) { wrapper.Partials = partials; return; } CombinePartials(wrapper.Partials, partials); } }
void WriteNodes(string lang) { foreach (var node in _db.Nodes) { var wrapper = new JsWrapper(lang, "node", node); AddPartials(wrapper, node); _update.IncludeDocument((string)node.id, "node", lang, 2, Wrapper(wrapper)); } // Garland Bell node data. var contents = "gt.bell.nodes = " + Json(_db.NodeViews, Formatting.Indented) + ";\r\n"; FileDatabase.Write("bell\\nodes.js", contents); }
void WriteNodes(string lang) { Parallel.ForEach(_db.Nodes, node => { var wrapper = new JsWrapper(lang, "node", node); AddPartials(wrapper, node); _update.IncludeDocument((string)node.id, "node", lang, 2, Wrapper(wrapper)); }); // Garland Bell node data. var contents = "gt.bell.nodes = " + Json(_db.NodeViews, Formatting.Indented) + ";\r\n"; FileDatabase.WriteFile("Garland.Web\\bell\\nodes.js", contents); }
void WriteEquipmentCalculators(string lang) { Parallel.ForEach(_db.LevelingEquipmentByJob, pair => { var wrapper = new JsWrapper(lang, "equip", pair.Value); AddPartials(wrapper, pair.Value); _update.IncludeDocument("leveling-" + pair.Key, "equip", lang, 2, Wrapper(wrapper)); }); Parallel.ForEach(_db.EndGameEquipmentByJob, pair => { var wrapper = new JsWrapper(lang, "equip", pair.Value); AddPartials(wrapper, pair.Value); _update.IncludeDocument("end-" + pair.Key, "equip", lang, 2, Wrapper(wrapper)); }); }
void WriteEquipmentCalculators(string lang) { foreach (var pair in _db.LevelingEquipmentByJob) { var wrapper = new JsWrapper(lang, "equip", pair.Value); AddPartials(wrapper, pair.Value); _update.IncludeDocument("leveling-" + pair.Key, "equip", lang, 2, Wrapper(wrapper)); } foreach (var pair in _db.EndGameEquipmentByJob) { var wrapper = new JsWrapper(lang, "equip", pair.Value); AddPartials(wrapper, pair.Value); _update.IncludeDocument("end-" + pair.Key, "equip", lang, 2, Wrapper(wrapper)); } }
JsWrapper GetLeveData(dynamic leve, string lang) { var wrapper = new JsWrapper(lang, "leve", leve); if (leve.rewards != null) { wrapper.Rewards = _db.LeveRewardsById[(int)leve.rewards]; } if (leve.requires != null) { wrapper.Ingredients = new List <JObject>(); var partials = new List <JsPartial>(); foreach (var req in leve.requires) { object item = _db.ItemsById[(int)req.item]; wrapper.Ingredients.Add(GetIngredientData(item)); var itemData = GetItemData(item, lang); if (itemData.Ingredients != null) { wrapper.Ingredients.AddRange(itemData.Ingredients); } if (itemData.Partials != null) { partials.AddRange(itemData.Partials); } } if (partials.Count > 0) { wrapper.Partials = partials; } } AddPartials(wrapper, leve); return(wrapper); }
JsWrapper GetItemData(dynamic item, string lang) { var wrapper = new JsWrapper(lang, "item", item); // Fill recipe components. var componentIds = GetItemComponents(Utils.Unbox(item.id)); var partials = new List <JsPartial>(); var ingredients = new List <JObject>(); foreach (var id in componentIds) { object ingredientItem = _db.ItemsById[id]; var ingredient = GetIngredientData(ingredientItem); if (ingredient == null) { continue; } ingredients.Add(ingredient); var ingredientPartials = GetPartials(ingredientItem, lang, true); CombinePartials(partials, ingredientPartials); } if (ingredients.Count > 0) { wrapper.Ingredients = ingredients; } if (partials.Count > 0) { wrapper.Partials = partials; } AddPartials(wrapper, item); return(wrapper); }