Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Penguin of Doooooooom
    Join Date
    16.01.2010
    Posts
    1,516

    Default [Tool] Pirox to Honorbuddy Profile Converter

    Just a simple exe file to convert Pirox's .ini profile format, to HB's XML format.

    Please keep in mind; this does NOT support vendors, as pirox profiles don't hold enough information to create the vendor tags with. (And I'm not going to write a WoWHead parser to pull the required info)

    It will insert some default tags. If you want to change the sell/mail behaviors, edit the XML it spits out.

    Instructions:

    Drop the Pirox .ini profile on the exe, and... thats it. A file with a .xml extension will be created (with the same name as the .ini version).

    EXE is attached below for those not wanting to play with code.

    Actual code is as follows;

    Code:
    using System;using System.Collections.Generic;
    using System.Globalization;
    using System.IO;
    using System.Linq;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Xml.Linq;
    
    
    namespace PiroxToHonorbuddy
    {
        internal class Program
        {
            private static void Main(string[] args)
            {
                try
                {
                    if (args.Length == 0)
                    {
                        Console.WriteLine("Please specify a Pirox profile.");
                        return;
                    }
                    if (!File.Exists(args[0]))
                    {
                        Console.WriteLine("File does not exist.");
                        return;
                    }
    
    
                    // Quick wrapper to make reading easier. Win32 API is annoying...
                    var file = new IniFile(args[0]);
    
    
                    // TODO: Sanit-check these for "0" values
                    string minLevel = file.Read("Profile", "MinLevel");
                    string maxLevel = file.Read("Profile", "MaxLevel");
                    // Just use the filename as the name. Don't bother parsing the name in the profile
                    string name = Path.GetFileNameWithoutExtension(args[0]);
    
    
                    // Pirox profiles continue the "z#" count throughout ini sections. So we need to store the "i" counter globally
                    // to ensure we can read in the next sections on the profile properly.
                    int i;
    
    
                    // Get WPs
                    var pts = new List<Point>();
                    // 10k just to make sure we get everything. This is seriously overkill, but pirox profiles really have no "count" type variable
                    // to optimize reading. Then again, .ini format for profiles in general is terrible
                    for (i = 1; i < 10000; i++) 
                    {
                        string tmp = file.Read("GoTo", "z" + i);
                        if (tmp == null)
                        {
                            continue;
                        }
    
    
                        if (!tmp.StartsWith("WPX"))
                        {
                            continue;
                        }
    
    
                        // Remove Pirox's call stuff
                        tmp = tmp.Replace("WPX", "").Replace("(", "").Replace(")", "").Trim();
    
    
                        // Split it. X, Y, Z
                        string[] split = tmp.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
    
    
                        // Parse it to a "Point"
                        var p = new Point(
                            float.Parse(split[0], CultureInfo.InvariantCulture),
                            float.Parse(split[1], CultureInfo.InvariantCulture),
                            float.Parse(split[2], CultureInfo.InvariantCulture));
    
    
                        pts.Add(p);
                    }
    
    
                    // TODO: Add vendor shit.
    
    
                    var root = new XElement(
                        "HBProfile",
                        new XElement("Name", name),
    
    
                        // Defaults
                        new XElement("MinDurability", "0.4"),
                        new XElement("MinFreeBagSlots", "1"),
                        new XElement("MailGrey", false),
                        new XElement("MailWhite", true),
                        new XElement("MailGreen", true),
                        new XElement("MailBlue", true),
                        new XElement("MailPurple", true),
                        new XElement("SellGrey", false),
                        new XElement("SellWhite", false),
                        new XElement("SellGreen", false),
                        new XElement("SellBlue", false),
                        new XElement("SellPurple", false),
    
    
                        // From profile
                        new XElement("MinLevel", minLevel),
                        new XElement("MaxLevel", maxLevel),
    
    
                        // [GoTo] points
                        new XElement(
                            "Hotspots",
                            pts.Select(p => p.ToXml()).ToArray()));
    
    
                    File.WriteAllText(Path.ChangeExtension(args[0], ".xml"), root.ToString());
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }
    
    
            #region Nested type: IniFile
    
    
            public class IniFile
            {
                private readonly string _path;
    
    
                public IniFile(string iniPath)
                {
                    _path = iniPath;
                }
    
    
                [DllImport("kernel32")]
                private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
    
    
                public string Read(string section, string key)
                {
                    var temp = new StringBuilder(255);
                    int i = GetPrivateProfileString(section, key, "", temp, 255, _path);
                    if (i == 0)
                    {
                        return null;
                    }
    
    
                    return temp.ToString();
                }
            }
    
    
            #endregion
    
    
            #region Nested type: Point
    
    
            private struct Point
            {
                public float X, Y, Z;
    
    
                public Point(float x, float y, float z)
                {
                    X = x;
                    Y = y;
                    Z = z;
                }
    
    
                public XElement ToXml()
                {
                    return new XElement(
                        "Hotspot",
                        new XAttribute("X", X),
                        new XAttribute("Y", Y),
                        new XAttribute("Z", Z));
                }
            }
    
    
            #endregion
        }
    }
    Attached Files Attached Files
    Last edited by Apoc; 11.12.2011 at 13:28.

  2. #2
    Staff
    Join Date
    15.01.2010
    Posts
    15,417
    Blog Entries
    7

    Default

    copied thread link to my useful stuff for new guys blog

    http://www.thebuddyforum.com/blogs/k...new-users.html
    Kick's Profiles SVN :: New Users Click Me!

    Kick Fights for the Users!
    We are the Kick, Resistance is Futile!



    If you want to buy the guy lunch who helped you out!

  3. #3
    Buddy
    Join Date
    03.12.2011
    Posts
    601
    Blog Entries
    1

    Default

    Doesn't work and I want to release many profiles, sample here

    Code:
    [Info]
    Author=
    Version=
    Date=02.05.2011
    pTVersion=2.9.0.0
    Description=
    Mobs & Lvl Range=
    Drops=
    Ghost=
    Vendor=
    Spirithealer=
    Start Place=Alabaster Shelf
    Zone=Alabaster Shelf
    ZoneId=5042
    MapId=646
    pvpTool pack requirement=
    Forum Profile Link=
    
    
    
    [Profile]
    Faction=Both
    StartPath=;multiple paths possible, e.g: 'goto,vendor,ghost'
    MinLevel=0
    MaxLevel=0
    Loop=0
    Reversible=0
    NaturalRun=1
    DisableSearchTargets=1
    DisableCombat=1
    UseFlyMount=1
    SearchFishPools=0
    MaxObjectDistance_Min=0
    MaxObjectDistance_Max=0
    [BeforeStart]
    z0=IgnoreFaction() ;ignore human players
    [GoTo]
    z1=UseBuff() ;default
    z2=Loop() ;default
    z45=WPX( -0.54, 1134.17, 280, 0 )
    z46=WPX( -24.19, 1146.35, 280, 0 )
    z47=WPX( -53.74, 1161.59, 280, 0 )
    z48=WPX( -63.27, 1181.71, 280, 0 )
    z49=WPX( -46.71, 1202.52, 280, 0 )
    z50=WPX( -30.14, 1223.33, 280, 0 )
    z51=WPX( -13.58, 1244.15, 280, 0 )
    z52=WPX( 2.99, 1264.96, 280, 0 )
    z53=WPX( 19.56, 1285.77, 280, 0 )
    z54=WPX( 40.26, 1311.78, 280, 0 )
    z55=WPX( 60.97, 1337.8, 280, 0 )
    z56=WPX( 81.68, 1363.81, 280, 0 )
    z57=WPX( 98.24, 1384.62, 280, 0 )
    It can't find the profile, I think it's got something to do with Path class.
    Last edited by Giwin; 11.12.2011 at 13:30.

  4. #4
    Penguin of Doooooooom
    Join Date
    16.01.2010
    Posts
    1,516

    Default

    Quote Originally Posted by Giwin View Post
    Doesn't work and I want to release many profiles, sample here

    Code:
    [Info]
    Author=
    Version=
    Date=02.05.2011
    pTVersion=2.9.0.0
    Description=
    Mobs & Lvl Range=
    Drops=
    Ghost=
    Vendor=
    Spirithealer=
    Start Place=Alabaster Shelf
    Zone=Alabaster Shelf
    ZoneId=5042
    MapId=646
    pvpTool pack requirement=
    Forum Profile Link=
    
    
    
    [Profile]
    Faction=Both
    StartPath=;multiple paths possible, e.g: 'goto,vendor,ghost'
    MinLevel=0
    MaxLevel=0
    Loop=0
    Reversible=0
    NaturalRun=1
    DisableSearchTargets=1
    DisableCombat=1
    UseFlyMount=1
    SearchFishPools=0
    MaxObjectDistance_Min=0
    MaxObjectDistance_Max=0
    [BeforeStart]
    z0=IgnoreFaction() ;ignore human players
    [GoTo]
    z1=UseBuff() ;default
    z2=Loop() ;default
    z45=WPX( -0.54, 1134.17, 280, 0 )
    z46=WPX( -24.19, 1146.35, 280, 0 )
    z47=WPX( -53.74, 1161.59, 280, 0 )
    z48=WPX( -63.27, 1181.71, 280, 0 )
    z49=WPX( -46.71, 1202.52, 280, 0 )
    z50=WPX( -30.14, 1223.33, 280, 0 )
    z51=WPX( -13.58, 1244.15, 280, 0 )
    z52=WPX( 2.99, 1264.96, 280, 0 )
    z53=WPX( 19.56, 1285.77, 280, 0 )
    z54=WPX( 40.26, 1311.78, 280, 0 )
    z55=WPX( 60.97, 1337.8, 280, 0 )
    z56=WPX( 81.68, 1363.81, 280, 0 )
    z57=WPX( 98.24, 1384.62, 280, 0 )
    Redownload and try again. Made a small change. (There's really no consistency with his profile format =\)

  5. #5
    Buddy
    Join Date
    03.12.2011
    Posts
    601
    Blog Entries
    1

    Default

    still not finding the profile, definitly something to do with the Path.GetName i think

    I tried in drive C: and Y:, although it seems to work in Downloads folder though

    EDIT1: It converted 1 profile once and didn't work again out of many many profiles
    Last edited by Giwin; 11.12.2011 at 13:39.

  6. #6
    Buddy
    Join Date
    03.12.2011
    Posts
    601
    Blog Entries
    1

    Default



    Sample.ini is the same as the one above (in code tags)

    Managed to screenshot it within the second that the window was open, no readline function for me

    using latest version of your program that you just updated (7.50KB)
    Last edited by Giwin; 11.12.2011 at 14:07.

  7. #7
    Buddy
    Join Date
    05.12.2011
    Posts
    37

    Default

    Still not working for me.

  8. #8
    Buddy
    Join Date
    03.12.2011
    Posts
    601
    Blog Entries
    1

    Default

    Keep trying though, they're many profiles in PiroxBots.com that can be used in Honorbuddy.

    A for Effort
    Please attach a log in your post if you're having issues with my plugin/profile because my English is not so good.

    SimpleAuction - A Simple AH Plugin, Coming Soon! (uses the Auctioneer addon) 99% complete

  9. #9
    Buddy
    Join Date
    11.12.2011
    Posts
    224

    Default

    // Pirox profiles continue the "z#" count throughout ini sections. So we need to store the "i" counter globally
    // to ensure we can read in the next sections on the profile properly.
    int i;
    it's a comment in your code-snippet.

    the numbers at the 'z' are not a counter. this means they are NOT in ascending order.
    they can be left away and so on.

    the only fixed thing for the Profile is the 'z' at the beginning of the line, follow by a number or not, and then the '='




    //sorry for bad english -.-

  10. #10
    Buddy
    Join Date
    03.12.2011
    Posts
    601
    Blog Entries
    1

    Default

    Yes, z= is exactly the same as with numbers... i personally hated it but pirox never changed it back, you could have z=25 and then z=84 and it would still work fine.
    Please attach a log in your post if you're having issues with my plugin/profile because my English is not so good.

    SimpleAuction - A Simple AH Plugin, Coming Soon! (uses the Auctioneer addon) 99% complete

 

 
Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •