Export upgrade list to use ingame

Topics: Rawr.Addon, Rawr.Base
Coordinator
Jun 1, 2009 at 3:03 AM

I got tired of alt-tabbing after each boss to see if the items dropped are an upgrade so I wrote a short program that opens the upgrade xml file and converts it into a lua saved variable file for LootPlan addon. It's not release quality as it is hardcoded for my case, but I've decided to share the source in case anyone finds it useful. All you need to do is add a reference to Rawr.Base.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rawr;
using Rawr.Optimizer;
using System.IO;
using System.Xml.Serialization;

namespace LootPlanImport
{
    [Serializable]
    public class SerializationData
    {
        public string[] CustomSubpoints;
        public List<string> Keys;
        public List<ComparisonCalculationUpgrades[]> ItemCalculations;
    }

    class Program
    {
        static void Main(string[] args)
        {
            string file = @"insert path to your upgrade xml";
            if (args.Length > 0) file = args[0];
            SerializationData data = new SerializationData();
            using (StreamReader reader = new StreamReader(file, Encoding.UTF8))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(SerializationData));
                data = (SerializationData)serializer.Deserialize(reader);
                reader.Close();
            }

            StreamWriter sw = new StreamWriter(@"insert path to LootPlan.lua");

            sw.WriteLine(@"LootPlanDB = {
 [""char""] = {
  [""Kavan - Kilrogg""] = {
   [""lootpercat""] = {
    [5] = {");
            foreach (var list in data.ItemCalculations)
            {
                foreach (var item in list)
                {
                    sw.WriteLine(item.ItemInstance.Id + ",");
                }
            }
            sw.WriteLine(@"    },
   },
   [""itemnotes""] = {");
            foreach (var list in data.ItemCalculations)
            {
                foreach (var item in list)
                {
                    sw.WriteLine(@"[""5:{0}""] = ""{1} Dps"",", item.ItemInstance.Id, item.OverallPoints);
                }
            }
            sw.WriteLine(@"   },
  },
 },
 [""profileKeys""] = {
  [""Kavan - Kilrogg""] = ""Kavan - Kilrogg"",
 },
 [""profiles""] = {
  [""Kavan - Kilrogg""] = {
   [""noteintooltip""] = true,
  },
 },
}");
            sw.Close();
        }
    }
}

Jun 1, 2009 at 8:29 PM

Hi Kavan,

This was something i metnioned as a "wishlist" in some other post i wrote a while ago. Unfortunately I simply lack the aptitude to do anything with the code above other that stare and perhaps drool a little. While I completley understand you have your hands full, is there any chance you could create an addon for this or perhaps someone else maybe?

This would be a a HUGE timesaver.

Jun 3, 2009 at 3:08 PM

I'm experimenting with this utility and find it very interesting.  First of all because I didn't know there was an addon like LootPlan.

As you note, the character name & realm are hardcoded, if the authors of the Optimizer module could add the characters name and realm to the output of the Build Upgrade List functionality then this could be a real fine utility.

How about it Optimizer authors, can we get the name and realm added to the output file?  

Thanks to all involved.

Coordinator
Jun 3, 2009 at 8:35 PM

Well I am the author of the optimizer :) Adding in name and realm is not really a problem, you can just make a form for the user to enter it and select the xml file. The real problem with making it useful for general public is having it work for people that use more than one character. It would have to load existing lua file and just change the part for the character that is being updated. Definitely doable, but I'm not sure that I have time to do it right now.

Jun 4, 2009 at 9:13 PM

<<fingers crossed>> I sure hope someone does have the time, i've even looked at how to write addons and to be honest after staring blankly at the guides i've read for 20 minutes i'd still had no clue.

Jun 7, 2009 at 10:25 AM

Hi.

In version 0.4.0 of LootPlan I have added functionality to import a list of items formatted like this:

itemID1:note;
itemID2:note;
itemID3:note;

In the in-game interface you can paste such a list and choose which category to add the items to.

So, instead of overwriting the LootPlan savedvariables file, you could try this form of input. This also 'solves' the multiple-character problem.

Arthic

Coordinator
Jun 7, 2009 at 7:56 PM

Sounds great, I'll add an export option for upgrade lists that exports in this format.

Coordinator
Jun 7, 2009 at 8:34 PM

I've added the export option to the export dropdown in upgrade list. It copies the list to clipboard in the above format. It seem to work ok except for items that haven't been seen yet. When I was setting them in saved variables directly they showed up in the interface fine with icon and information, but with the import it skips them and says item does not exist.

Developer
Jun 22, 2009 at 7:00 PM
Edited Jun 22, 2009 at 7:02 PM

I like the added LootPlan option, but could you make it to add the notes such as "Drops from Razorscale in Heroic Ulduar" instead of the "Upgrade Score" which would provide more useful information. Example:

45150:(235.06) Drops from Razorscale in Heroic Ulduar;
or
45150:[235.06] Drops from Razorscale in Heroic Ulduar;
or
45150:235.06 - Drops from Razorscale in Heroic Ulduar;

Also trunicate the Rawr Upgrade Score to the nearest 100ths would be nice... I am not sure of acceptable characters for LootPlan, but to have the Rawr Upgrade Score incased in parentheses or brackets or even fallowed by a hyphen would just make it look nice...

Jul 4, 2009 at 2:56 PM

Has there been any further work on this? or is it compelteld or shelved or what?

 

 

Developer
Jul 4, 2009 at 6:55 PM

For now I have created a Access Database that I import the Rawr Upgrade List into then export a text file with my above information, and it works very well in helping me to both find and track my desired upgrades...

I would still like to see it as a defualt format, due to the fact that for now, I am the only one that I know that has it in this format, and I consider it an advantage over everyone else and would just like to level the playing fields...

Not to mention, not everyone owns Microsoft Office, or has access to it...

Coordinator
Jul 4, 2009 at 8:29 PM

Why exactly do you need information about where it drops to be exported from Rawr? That information is already shown in LootPlan if you have LibPeriodicTable.

Jul 4, 2009 at 10:41 PM

could the export to lootplan option be added elsewhere to?

 

for example to the post-optimisation screens? (is it posible to export gem/enchant optimiseation with it?)

Jul 5, 2009 at 5:07 AM

Hello all,

I must be missing something.

I have been using rawr for a while now and am familiar with the program, am currently running 2.2.9.

Loaded my toon from a character profile, ran an optimization, made an upgrade list  and tried to export it to lootplan (got it installed and working in wow).

Doesn't seem to do anything.

 

Any thoughts?

 

Coordinator
Jul 5, 2009 at 6:15 AM

When you click on export to LootPlan it will copy the data to the clipboard. You should paste that data in the LootPlan import dialog.

Jul 5, 2009 at 6:54 AM

Ah thanks I will try that.

Developer
Jul 5, 2009 at 3:53 PM

I will add the LibPeriodicTable and give that a try too. I actually know where the items are, but just thought it would be more useful to have it in the information section that Rawr exports already...

 

Jan 10, 2010 at 5:32 PM

I just started using lootplan for viewing my RAWR upgrade lists in-game, and ran into the same issue with unseen items. Until the author returns, here's a small hack that works for me. *REPLACE* line 150 of Options_Import.lua with the following:

if not addon:tcontains(addon.db.char.lootpercat[addon.importCatId], itemId) then
  addon:AddItem(addon.importCatId, itemId, itemNote)
  addon:Print( itemId.. " (???): " ..L["import_log_succes"] )
else
  addon:Print( itemId.. " (???): " ..L["import_log_alreadyincat"] )
end

With this change, the import code will unconditionally add import items to the list, regardless of whether they are known to the game client. The practical result of this is that *until* an item becomes known to the client, it will be in the lootplan list but invisible. Once the item has been seen, it will become visible in the list. Most importantly, when the item drops it will then be seen by the client, and you'll get the lootplan notice in the tooltip.

I'm not familiar with addon packaging -- if somebody else wants to put together a "fan update" or something, feel free to use this.