Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var trace_DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
- var trace_bool = false
- DataManager.isDatabaseLoaded = function() {
- if (!trace_DataManager_isDatabaseLoaded.call(this)) return false;
- if (!trace_bool) {
- this.alchemyItemScan($dataItems);
- this.alchemyItemScan($dataWeapons);
- this.alchemyItemScan($dataArmors);
- trace_bool = true;
- }
- return true;
- };
- Trace.alchemyRecipe = {};
- DataManager.alchemyItemScan = function (group) {
- var recipe = /<alchemyRecipe:\s*([iwa]\d+(?:\s*,\s*[iwa]\d+)*)>/im;
- for (var n = 1; n < group.length; n++) {
- var obj = group[n];
- obj.alchemyRecipe = false;
- obj.alchemyExp = 0;
- obj.alchemyResult = false;
- if (obj.meta.alchemyCategory) {
- obj.alchemyCategory = obj.meta.alchemyCategory;
- };
- if (obj.meta.alchemyExp) {
- obj.alchemyExp = Number(obj.meta.alchemyExp);
- };
- if (obj.meta.alchemyResult) {
- obj.alchemyResult = obj.meta.alchemyResult;
- };
- var notedata = obj.note.split(/[\r\n]+/);
- for (var i = 0; i < notedata.length; i++) {
- var line = notedata[i];
- if (line.match(recipe)) {
- var arr = []
- var pieces = RegExp.$1.split(/,\s*/g);
- for (var i = 0; i < pieces.length; i++) {
- var piece = pieces[i];
- arr.push(piece);
- };
- obj.alchemyRecipe = arr;
- };
- };
- if (obj.meta.alchemyResult) {
- Trace.alchemyRecipe[obj.name] = {};
- Trace.alchemyRecipe[obj.name].recipe = obj.alchemyRecipe;
- Trace.alchemyRecipe[obj.name].result = obj.alchemyResult;
- Trace.alchemyRecipe[obj.name].exp = obj.alchemyExp;
- };
- };
- };
- console.log(Trace.alchemyRecipe);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement