示例#1
0
        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));
        }
示例#2
0
 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));
     });
 }
示例#3
0
 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));
     });
 }
示例#4
0
 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));
     });
 }
示例#5
0
 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));
     });
 }
示例#6
0
 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));
     });
 }
示例#7
0
 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));
     });
 }
示例#8
0
 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));
     }
 }
示例#9
0
 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));
     });
 }
示例#10
0
 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));
     }
 }
示例#11
0
 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));
     }
 }
示例#12
0
 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));
     }
 }
示例#13
0
 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));
     }
 }
示例#14
0
 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));
     }
 }
示例#15
0
 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));
     });
 }
示例#16
0
 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));
     }
 }
示例#17
0
        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);
            }
        }
示例#18
0
        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);
        }
示例#19
0
        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);
        }
示例#20
0
        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));
            });
        }
示例#21
0
        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));
            }
        }
示例#22
0
        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);
        }
示例#23
0
        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);
        }