Reading bag contents/writing to a file menu

Shout-Out

User Tag List

Results 1 to 7 of 7
  1. #1
    Gankenstein's Avatar Member
    Reputation
    16
    Join Date
    Sep 2008
    Posts
    82
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reading bag contents/writing to a file

    How would I go about reading bag contents from a character such as:

    Saronite Ore - 562
    Adder's Tongue - 233
    Frost Lotus - 17

    Then writing it to a file, either in the above format or maybe in an XML such as:

    Code:
    <harvest time_in_hours="8">
             <mining>
                      <saronite_ore>562</saronite_ore>
             </mining>
             <herbing>
                       <adders_tongue>233</adders_tongue>
                       <frost_lotus>17</frost_lotus>
              </herbing>
    </harvest>
    Trying to make a program to track harvest data so I can later compare. Is this possible? Thank you.

    Reading bag contents/writing to a file
  2. #2
    schlumpf's Avatar Retired Noggit Developer

    Reputation
    755
    Join Date
    Nov 2006
    Posts
    2,759
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes its possible. The bag structures are documented and there are enough XML implementations in common languages. Have fun combining both.

  3. #3
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Code:
      
    <Configuration>
      <Harvest>
        <RunTime>8</RunTime>
        <Mining>
          <SaroniteOre>562</SaroniteOre>
        </Mining>
        <Herbing>
          <AddersTongue>233</AddersTongue>
          <FrostLotus>17</FrostLotus>
        </Herbing>
      </Harvest>
    </Configuration>
    Code:
     public class XmlExample
        {
            private XDocument Document { get; set; }
    
            public XmlExample(string fileName)
            {
                try
                {
                    Document = XDocument.Load(fileName);
                }
                catch(Exception ex)
                {
                    Logging.WriteException(ex);
                }
            }
    
            public int RunTime
            {
                get
                {
                    try
                    {
                        return Convert.ToInt32(Document.Descendants("Configuration").Elements("Harvest").FirstOrDefault().Elements("RunTime").FirstOrDefault().Value);
                    }
                    catch
                    {
                        return 1;
                    }
                }
            }
        }
    Last edited by Nesox; 01-10-2010 at 08:35 AM.

  4. #4
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're using C++ I recommend RapidXML. It's sexy.

    EDIT:
    Or if you store all your data in STL containers, then Boost.Seralization or Boost.PropertyTree (probably the preference) will do most of the work for you.

  5. #5
    Gankenstein's Avatar Member
    Reputation
    16
    Join Date
    Sep 2008
    Posts
    82
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers very much. I also like the XML structure that Nesox suggested.

    As for reading the bags themselves, the correct functions would be found in World of Warcraft API - WoWWiki - Your guide to the World of Warcraft , correct?

  6. #6
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Correct. That would be the easiest way.

  7. #7
    Gankenstein's Avatar Member
    Reputation
    16
    Join Date
    Sep 2008
    Posts
    82
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The reading, tracking and comparison of different XML data files (of harvests) will be made in C++/C#, however, to get the bag data/etc would I be using LUA to access the WoW API functions and actually write the XML?

Similar Threads

  1. Replies: 0
    Last Post: 06-08-2010, 10:29 AM
  2. LUA Help (reading from/writing to files)
    By tagala in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 10-05-2009, 06:48 PM
  3. [Help]Reading bag slots used/remaining slots, gold
    By weber7655 in forum WoW Memory Editing
    Replies: 0
    Last Post: 09-21-2009, 06:09 PM
  4. [Help] vb6 Reading from a random file
    By Murdok in forum Programming
    Replies: 3
    Last Post: 10-20-2008, 12:39 PM
  5. Not related to model editing but I need a file, please read
    By kody in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 07-26-2007, 01:40 PM
All times are GMT -5. The time now is 12:26 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search