Page 8 of 9 FirstFirst ... 6789 LastLast
Results 106 to 120 of 124

Thread: SEQ Borked with 8/15 patch.

  1. #106
    Registered User
    Join Date
    Mar 2012
    Posts
    21

    Re: SEQ Borked with 8/15 patch.

    Quote Originally Posted by rogues View Post
    It had been unreachable for me too.

    I think there are just a couple issues outstanding - for instances and sometimes normal zones it doesn't seem to figure out the map. Targetting doesn't target in showeq, but I will try to find the opcode for that tonight. I think some spawn is still showing up wrong in a couple zones because in Sep the map had to be zoomed in to 12x to make it look normal, so I assume a spawn was picked up incorrectly but I'm not sure. Other than that it seems to be as good as it was prior to the patch.
    OP_Consider = 2ad3
    OP_TargetMouse = 5401
    OP_Corpse = 2f00

    Do you need any others?

    Regarding the intermittent zone/map issue, that's related to the playerProfileStruct changes that were made over the summer. I haven't bothered to re-align all of it so occasionally some random non zero values get set into the player x/y and zoneId struct members, causing the zoom and wrong map issue.
    Last edited by r6express; 10-19-2012 at 12:38 PM.

  2. #107
    Registered User
    Join Date
    Mar 2012
    Posts
    21

    Re: SEQ Borked with 8/15 patch.

    I finally spent some time rewriting the PlayerProfile logic. It is now dynamically populated. It populates nearly all of playerProfileStruct and charProfileStruct, except I stopped short of the last part of charProfileStruct related to tribute and leadership. I don't see the importance of knowing that in seq. But if anyone wants to finish those, it's pretty easy to do by comparing numbers in your tribute window with what's in the OP_PlayerProfile packet dump. It also would be nice if someone wanted to clean up the two structs so that they no longer have hardcoded array lengths and instead use the counts I'm parsing from the packet. The MAX_* constants could then be discarded and any future changes to this struct would be more dynamically handled.


    zonemgr.cpp
    Code:
    /*
     * zonemgr.h
     * 
     * ShowEQ Distributed under GPL
     * http://seq.sourceforge.net/
     *
     * Copyright 2001,2007 Zaphod ([email protected]). All Rights Reserved.
     *
     * Contributed to ShowEQ by Zaphod ([email protected]) 
     * for use under the terms of the GNU General Public License, 
     * incorporated herein by reference.
     *
     * modified by Fee ([email protected])
     *
     */
    
    
    #include "zonemgr.h"
    #include "packet.h"
    #include "main.h"
    #include "everquest.h"
    #include "diagnosticmessages.h"
    #include "netstream.h"
    
    
    #include <qfile.h>
    #include <qdatastream.h>
    #include <qregexp.h>
    
    
    //----------------------------------------------------------------------
    // constants
    static const char magicStr[5] = "zon2"; // magic is the size of uint32_t + a null
    static const uint32_t* magic = (uint32_t*)magicStr;
    const float defaultZoneExperienceMultiplier = 0.75;
    
    
    // Sequence of signals on initial entry into eq from character select screen
    // EQPacket                              ZoneMgr                       isZoning
    // ----------                            -------                       --------
    // zoneEntry(ClientZoneEntryStruct)      zoneBegin()                   true
    // PlayerProfile(charProfileStruct)      zoneBegin(shortName)          false
    // zoneNew(newZoneStruct)                zoneEnd(shortName, longName)  false
    //
    // Sequence of signals on when zoning from zone A to zone B
    // EQPacket                              ZoneMgr                       isZoning
    // ----------                            -------                       --------
    // zoneChange(zoneChangeStruct, client)                                true
    // zoneChange(zoneChangeStruct, server)  zoneChanged(shortName)        true
    // zoneEntry(ClientZoneEntryStruct)      zoneBegin()                   false
    // PlayerProfile(charProfileStruct)      zoneBegin(shortName)          false
    // zoneNew(newZoneStruct)                zoneEnd(shortName, longName)  false
    //
    ZoneMgr::ZoneMgr(QObject* parent, const char* name)
      : QObject(parent, name),
        m_zoning(false),
        m_zone_exp_multiplier(defaultZoneExperienceMultiplier),
        m_zonePointCount(0),
        m_zonePoints(0)
    {
      m_shortZoneName = "unknown";
      m_longZoneName = "unknown";
      m_zoning = false;
      m_dzID = 0;
    
    
      if (showeq_params->restoreZoneState)
        restoreZoneState();
    }
    
    
    ZoneMgr::~ZoneMgr()
    {
      if (m_zonePoints)
        delete [] m_zonePoints;
    }
    
    
    struct ZoneNames
    {
      const char* shortName;
      const char* longName;
    };
    
    
    static const ZoneNames zoneNames[] =
    {
    #include "zones.h"
    };
    
    
    QString ZoneMgr::zoneNameFromID(uint16_t zoneId)
    {
       const char* zoneName = NULL;
       if (zoneId < (sizeof(zoneNames) / sizeof (ZoneNames)))
           zoneName = zoneNames[zoneId].shortName;
    
    
       if (zoneName != NULL)
          return zoneName;
    
    
       QString tmpStr;
       tmpStr.sprintf("unk_zone_%d", zoneId);
       return tmpStr;
    }
    
    
    QString ZoneMgr::zoneLongNameFromID(uint16_t zoneId)
    {
    
    
       const char* zoneName = NULL;
       if (zoneId < (sizeof(zoneNames) / sizeof (ZoneNames)))
           zoneName = zoneNames[zoneId].longName;
    
    
       if (zoneName != NULL)
          return zoneName;
    
    
       QString tmpStr;
       tmpStr.sprintf("unk_zone_%d", zoneId);
       return tmpStr;
    }
    
    
    const zonePointStruct* ZoneMgr::zonePoint(uint32_t zoneTrigger)
    {
      if (!m_zonePoints)
        return 0;
    
    
      for (size_t i = 0; i < m_zonePointCount; i++)
        if (m_zonePoints[i].zoneTrigger == zoneTrigger)
          return &m_zonePoints[i];
    
    
      return 0;
    }
    
    
    void ZoneMgr::saveZoneState(void)
    {
      QFile keyFile(showeq_params->saveRestoreBaseFilename + "Zone.dat");
      if (keyFile.open(IO_WriteOnly))
      {
        QDataStream d(&keyFile);
        // write the magic string
        d << *magic;
    
    
        d << m_longZoneName;
        d << m_shortZoneName;
      }
    }
    
    
    void ZoneMgr::restoreZoneState(void)
    {
      QString fileName = showeq_params->saveRestoreBaseFilename + "Zone.dat";
      QFile keyFile(fileName);
      if (keyFile.open(IO_ReadOnly))
      {
        QDataStream d(&keyFile);
    
    
        // check the magic string
        uint32_t magicTest;
        d >> magicTest;
    
    
        if (magicTest != *magic)
        {
          seqWarn("Failure loading %s: Bad magic string!",
    	      (const char*)fileName);
          return;
        }
    
    
        d >> m_longZoneName;
        d >> m_shortZoneName;
    
    
        seqInfo("Restored Zone: %s (%s)!",
    	    (const char*)m_shortZoneName,
    	    (const char*)m_longZoneName);
      }
      else
      {
        seqWarn("Failure loading %s: Unable to open!", 
    	    (const char*)fileName);
      }
    }
    
    
    void ZoneMgr::zoneEntryClient(const uint8_t* data, size_t len, uint8_t dir)
    {
      const ClientZoneEntryStruct* zsentry = (const ClientZoneEntryStruct*)data;
    
    
      m_shortZoneName = "unknown";
      m_longZoneName = "unknown";
      m_zone_exp_multiplier = defaultZoneExperienceMultiplier;
      m_zoning = false;
    
    
      emit zoneBegin();
      emit zoneBegin(zsentry, len, dir);
    
    
      if (showeq_params->saveZoneState)
        saveZoneState();
    }
    
    
    int32_t ZoneMgr::fillProfileStruct(charProfileStruct *player, const uint8_t *data, size_t len, bool checkLen)
    {
      /*
      This reads data from the variable-length charPlayerProfile struct
      */
      NetStream netStream(data, len);
      int32_t retVal;
      QString name;
    
    
      player->checksum = netStream.readUInt32NC();
      
      player->profile.gender = netStream.readUInt16();
      player->profile.race = netStream.readUInt32NC();
      player->profile.class_ = netStream.readUInt32NC();
    
    
      // Unknown  
      netStream.skipBytes(44);
      
      player->profile.level = netStream.readUInt8();
      player->profile.level1 = netStream.readUInt8();
    
    
      // Really, everything after the level is not critical for operation.  If 
      // needed, skip the rest to get up and running quickly after patch day.
    #if 1
      // Bind points
      int bindCount = netStream.readUInt32NC();
      for (int i = 0; i < bindCount; i++) {
        memcpy(&player->profile.binds[i], netStream.pos(), sizeof(player->profile.binds[i]));
        netStream.skipBytes(sizeof(player->profile.binds[i]));
      }
    
    
      player->profile.deity = netStream.readUInt32NC();
      player->profile.intoxication = netStream.readUInt32NC();
      
      // Spell slot refresh
      int spellRefreshCount = netStream.readUInt32NC();
      for (int i = 0; i < spellRefreshCount; i++) {
        player->profile.spellSlotRefresh[i] = netStream.readUInt32NC();
      }
      
      player->profile.haircolor = netStream.readUInt8();
      player->profile.beardcolor = netStream.readUInt8();
    
    
      // Unknown
      netStream.skipBytes(6);
      
      player->profile.eyecolor1 = netStream.readUInt8();
      player->profile.eyecolor2 = netStream.readUInt8();
      player->profile.hairstyle = netStream.readUInt8();
      player->profile.beard = netStream.readUInt8();
    
    
      // Unknown
      netStream.skipBytes(11);
    
    
      // Equipment
      int equipCount = netStream.readUInt32NC();
      for (int i = 0; i < equipCount; i++) {
        memcpy(&player->profile.equipment[i], netStream.pos(), sizeof(player->profile.equipment[i]));
        netStream.skipBytes(sizeof(player->profile.equipment[i]));
      }
    
    
      // Visible equipment tints (dye color)
      int tintCount = netStream.readUInt32NC();
      for (int i = 0; i < tintCount; i++) {
        player->profile.item_tint[i].color = netStream.readUInt32NC();
      }
    
    
      // AAs
      int aaCount = netStream.readUInt32NC();
      for (int i = 0; i < aaCount; i++) {
        player->profile.aa_array[i].AA = netStream.readUInt32NC();
        player->profile.aa_array[i].value = netStream.readUInt32NC();
        player->profile.aa_array[i].unknown008 = netStream.readUInt32NC();
      }
    
    
      player->profile.points = netStream.readUInt32NC();
      player->profile.MANA = netStream.readUInt32NC();
      player->profile.curHp = netStream.readUInt32NC();
      player->profile.STR = netStream.readUInt32NC();
      player->profile.STA = netStream.readUInt32NC();
      player->profile.CHA = netStream.readUInt32NC();
      player->profile.DEX = netStream.readUInt32NC();
      player->profile.INT = netStream.readUInt32NC();
      player->profile.AGI = netStream.readUInt32NC();
      player->profile.WIS = netStream.readUInt32NC();
    
    
      // Unknown
      netStream.skipBytes(28);
      
      player->profile.face = netStream.readUInt32NC();
    
    
      // Unknown
      netStream.skipBytes(221);
      
      // Spellbook
      int spellBookSlots = netStream.readUInt32NC();
      for (int i = 0; i < spellBookSlots; i++) {
        player->profile.sSpellBook[i] = netStream.readInt32();
      }
    
    
      int spellMemSlots = netStream.readUInt32NC();
      for (int i = 0; i < spellMemSlots; i++) {
        player->profile.sMemSpells[i] = netStream.readInt32();
      }
      
      int coinCounts = netStream.readUInt8();
      player->profile.platinum = netStream.readUInt32NC();
      player->profile.gold = netStream.readUInt32NC();
      player->profile.silver = netStream.readUInt32NC();
      player->profile.copper = netStream.readUInt32NC();
    
    
      player->profile.platinum_cursor = netStream.readUInt32NC();
      player->profile.gold_cursor = netStream.readUInt32NC();
      player->profile.silver_cursor = netStream.readUInt32NC();
      player->profile.copper_cursor = netStream.readUInt32NC();
    
    
      int skillCount = netStream.readUInt32NC();
      for (int i = 0; i < skillCount; i++) {
        player->profile.skills[i] = netStream.readUInt32NC();
      }
    
    
      int innateSkillCount = netStream.readUInt32NC();
      for (int i = 0; i < innateSkillCount; i++) {
        player->profile.innateSkills[i] = netStream.readUInt32NC();
      }
    
    
      // Unknown
      netStream.skipBytes(16);
      
      player->profile.toxicity = netStream.readUInt32NC();
      player->profile.thirst = netStream.readUInt32NC();
      player->profile.hunger = netStream.readUInt32NC();
    
    
      // Unknown
      netStream.skipBytes(20);
      
      int buffCount = netStream.readUInt32NC();
      for (int i = 0; i < buffCount; i++) {
        netStream.skipBytes(80);
      }
    
    
      int disciplineCount = netStream.readUInt32NC();
      for (int i = 0; i < disciplineCount; i++) {
        player->profile.disciplines[i] = netStream.readUInt32NC();
      }
    
    
      int recastTypes = netStream.readUInt32NC();
      for (int i = 0; i < recastTypes; i++) {
        player->profile.recastTimers[i] = netStream.readUInt32NC();
      }
    
    
      int somethingCount = netStream.readUInt32NC();
      for (int i = 0; i < somethingCount; i++) {
        int something = netStream.readUInt32NC();
      }
    
    
      int somethingElseCount = netStream.readUInt32NC();
      for (int i = 0; i < somethingElseCount; i++) {
        int something = netStream.readUInt32NC();
      }
    
    
      player->profile.endurance = netStream.readUInt32NC();
      player->profile.aa_spent = netStream.readUInt32NC();
    
    
      // Unknown  
      netStream.skipBytes(4);
        
      player->profile.aa_assigned = netStream.readUInt32NC();
    
    
      // Unknown
      netStream.skipBytes(22);
      
      int bandolierCount = netStream.readUInt32NC();
      for (int i = 0; i < bandolierCount; i++) {
        name = netStream.readText();
        if(name.length()) {
          strncpy(player->profile.bandoliers[i].bandolierName, name.latin1(), 32);
        }
    
    
        // Mainhand
        name = netStream.readText();
        if(name.length()) {
          strncpy(player->profile.bandoliers[i].mainHand.itemName, name.latin1(), 64);
        }
        player->profile.bandoliers[i].mainHand.itemId = netStream.readUInt32NC();
        player->profile.bandoliers[i].mainHand.icon = netStream.readUInt32NC();
    
    
        // Offhand
        name = netStream.readText();
        if(name.length()) {
          strncpy(player->profile.bandoliers[i].offHand.itemName, name.latin1(), 64);
        }
        player->profile.bandoliers[i].offHand.itemId = netStream.readUInt32NC();
        player->profile.bandoliers[i].offHand.icon = netStream.readUInt32NC();
    
    
        // Range
        name = netStream.readText();
        if(name.length()) {
          strncpy(player->profile.bandoliers[i].range.itemName, name.latin1(), 64);
        }
        player->profile.bandoliers[i].range.itemId = netStream.readUInt32NC();
        player->profile.bandoliers[i].range.icon = netStream.readUInt32NC();
    
    
        // Ammo
        name = netStream.readText();
        if(name.length()) {
          strncpy(player->profile.bandoliers[i].ammo.itemName, name.latin1(), 64);
        }
        player->profile.bandoliers[i].ammo.itemId = netStream.readUInt32NC();
        player->profile.bandoliers[i].ammo.icon = netStream.readUInt32NC();
      }
    
    
      int potionCount = netStream.readUInt32NC();
      for (int i = 0; i < potionCount; i++) {
        name = netStream.readText();
        if(name.length()) {
          strncpy(player->profile.potionBelt[i].itemName, name.latin1(), 64);
        }
        player->profile.potionBelt[i].itemId = netStream.readUInt32NC();
        player->profile.potionBelt[i].icon = netStream.readUInt32NC();
      }
    
    
      // Unknown
      netStream.skipBytes(96);
    
    
      memcpy(player->name, netStream.pos(), 64);
      netStream.skipBytes(64);
    
    
      memcpy(player->lastName, netStream.pos(), 32);
      netStream.skipBytes(32);
      
      // Unknown
      netStream.skipBytes(8);
    
    
      player->guildID = netStream.readInt32();
      player->birthdayTime = netStream.readUInt32NC();
      player->lastSaveTime = netStream.readUInt32NC();
      player->timePlayedMin = netStream.readUInt32NC();
    
    
      // Unknown
      netStream.skipBytes(4);
      
      player->pvp = netStream.readUInt8();
      player->anon = netStream.readUInt8();
      player->gm = netStream.readUInt8();
      player->guildstatus = netStream.readInt8();
      
      // Unknown
      netStream.skipBytes(14);
    
    
      player->exp = netStream.readUInt32NC();
    
    
      // Unknown
      netStream.skipBytes(8);
      
      int langCount = netStream.readUInt32NC();
      for (int i = 0; i < langCount; i++) {
        player->languages[i] = netStream.readUInt8();
      }
    
    
      memcpy(&player->x, netStream.pos(), sizeof(player->x));
      netStream.skipBytes(sizeof(player->x));
    
    
      memcpy(&player->y, netStream.pos(), sizeof(player->y));
      netStream.skipBytes(sizeof(player->y));
    
    
      memcpy(&player->z, netStream.pos(), sizeof(player->z));
      netStream.skipBytes(sizeof(player->z));
    
    
      memcpy(&player->heading, netStream.pos(), sizeof(player->heading));
      netStream.skipBytes(sizeof(player->heading));
      
      player->standState = netStream.readUInt8();
      player->platinum_bank = netStream.readUInt32NC();
      player->gold_bank = netStream.readUInt32NC();
      player->silver_bank = netStream.readUInt32NC();
      player->copper_bank = netStream.readUInt32NC();
      player->platinum_shared = netStream.readUInt32NC();
    
    
      // Unknown
      netStream.skipBytes(12);
    
    
      // Unknown (41)
      int doubleIntCount = netStream.readUInt32NC();
      for (int i = 0; i < doubleIntCount; i++) {
        int something = netStream.readUInt32NC();
        int somethingElse = netStream.readUInt32NC();
      }
    
    
      // Unknown (64)
      int byteCount = netStream.readUInt32NC();
      for (int i = 0; i < byteCount; i++) {
        char something = netStream.readUInt8();
      }
      
      player->expansions = netStream.readUInt32NC();
    
    
      // Unknown
      netStream.skipBytes(11);
    
    
      player->autosplit = netStream.readUInt8();
    
    
      // Unknown
      netStream.skipBytes(14);
    
    
      player->zoneId = netStream.readUInt16NC();
      player->zoneInstance = netStream.readUInt16NC();
    
    
      // Still more to do, but it's really of little value
    #endif
    
    
      retVal = netStream.pos() - netStream.data();
      if (checkLen && (int32_t)len != retVal)
      {
        seqDebug("SpawnShell::fillProfileStruct - expected length: %d, read: %d for player '%s'", len, retVal, player->name);
      }
    
    
      return retVal;
    }
    
    
    
    
    void ZoneMgr::zonePlayer(const uint8_t* data, size_t len)
    {
      charProfileStruct *player = new charProfileStruct;
    
    
      memset(player,0,sizeof(charProfileStruct));
    
    
      fillProfileStruct(player,data,len,true);
    
    
      m_shortZoneName = zoneNameFromID(player->zoneId);
      m_longZoneName = zoneLongNameFromID(player->zoneId);
      m_zone_exp_multiplier = defaultZoneExperienceMultiplier;
      m_zoning = false;
    
    
      emit zoneBegin(m_shortZoneName);
      emit playerProfile(player);
    
    
      if (showeq_params->saveZoneState)
        saveZoneState();
    }
    
    
    void ZoneMgr::zoneChange(const uint8_t* data, size_t len, uint8_t dir)
    {
      const zoneChangeStruct* zoneChange = (const zoneChangeStruct*)data;
      m_shortZoneName = zoneNameFromID(zoneChange->zoneId);
      m_longZoneName = zoneLongNameFromID(zoneChange->zoneId);
      m_zone_exp_multiplier = defaultZoneExperienceMultiplier;
      m_zoning = true;
    
    
      if (dir == DIR_Server)
        emit zoneChanged(m_shortZoneName);
        emit zoneChanged(zoneChange, len, dir);
    
    
      if (showeq_params->saveZoneState)
        saveZoneState();
    }
    
    
    void ZoneMgr::zoneNew(const uint8_t* data, size_t len, uint8_t dir)
    {
      const newZoneStruct* zoneNew = (const newZoneStruct*)data;
      m_safePoint.setPoint(lrintf(zoneNew->safe_x), lrintf(zoneNew->safe_y),
    		       lrintf(zoneNew->safe_z));
      m_zone_exp_multiplier = zoneNew->zone_exp_multiplier;
    
    
      // ZBNOTE: Apparently these come in with the localized names, which means we 
      //         may not wish to use them for zone short names.  
      //         An example of this is: shortZoneName 'ecommons' in German comes 
      //         in as 'OGemeinl'.  OK, now that we have figured out the zone id
      //         issue, we'll only use this short zone name if there isn't one or
      //         it is an unknown zone.
      if (m_shortZoneName.isEmpty() || m_shortZoneName.startsWith("unk"))
      {
        m_shortZoneName = zoneNew->shortName;
    
    
        // LDoN likes to append a _262 to the zonename. Get rid of it.
        QRegExp rx("_\\d+$");
        m_shortZoneName.replace( rx, "");
      }
    
    
      m_longZoneName = zoneNew->longName;
      m_zoning = false;
    
    
    #if 1 // ZBTEMP
      seqDebug("Welcome to lovely downtown '%s' with an experience multiplier of %f",
    	 zoneNew->longName, zoneNew->zone_exp_multiplier);
      seqDebug("Safe Point (%f, %f, %f)", 
    	 zoneNew->safe_x, zoneNew->safe_y, zoneNew->safe_z);
    #endif // ZBTEMP
      
    //   seqDebug("zoneNew: m_short(%s) m_long(%s)",
    //      (const char*)m_shortZoneName,
    //      (const char*)m_longZoneName);
      
      emit zoneEnd(m_shortZoneName, m_longZoneName);
    
    
      if (showeq_params->saveZoneState)
        saveZoneState();
    }
    
    
    void ZoneMgr::zonePoints(const uint8_t* data, size_t len, uint8_t)
    {
      const zonePointsStruct* zp = (const zonePointsStruct*)data;
      // note the zone point count
      m_zonePointCount = zp->count;
    
    
      // delete the previous zone point set
      if (m_zonePoints)
        delete [] m_zonePoints;
      
      // allocate storage for zone points
      m_zonePoints = new zonePointStruct[m_zonePointCount];
    
    
      // copy the zone point information
      memcpy((void*)m_zonePoints, zp->zonePoints, 
    	 sizeof(zonePointStruct) * m_zonePointCount);
    }
    
    
    void ZoneMgr::dynamicZonePoints(const uint8_t *data, size_t len, uint8_t)
    {
       const dzSwitchInfo *dz = (const dzSwitchInfo*)data;
    
    
       if(len == sizeof(dzSwitchInfo))
       {
          m_dzPoint.setPoint(lrintf(dz->x), lrintf(dz->y), lrintf(dz->z));
          m_dzID = dz->zoneID;
          m_dzLongName = zoneLongNameFromID(m_dzID);
          if(dz->type != 1 && dz->type > 2 && dz->type <= 5)
             m_dzType = 0; // green
          else
             m_dzType = 1; // pink
       }
       else if(len == 8)
       {
          // we quit the expedition
          m_dzPoint.setPoint(0, 0, 0);
          m_dzID = 0;
          m_dzLongName = "";
       }
    }
    
    
    void ZoneMgr::dynamicZoneInfo(const uint8_t* data, size_t len, uint8_t)
    {
       const dzInfo *dz = (const dzInfo*)data;
    
    
       if(!dz->newDZ)
       {
          m_dzPoint.setPoint(0, 0, 0);
          m_dzID = 0;
          m_dzLongName = "";
       }
    }
    
    
    #ifndef QMAKEBUILD
    #include "zonemgr.moc"
    #endif

    zonemgr.h
    Code:
    /*
     * zonemgr.h
     * 
     * ShowEQ Distributed under GPL
     * http://seq.sourceforge.net/
     *
     * Copyright 2001 Zaphod ([email protected]). All Rights Reserved.
     *
     * Contributed to ShowEQ by Zaphod ([email protected]) 
     * for use under the terms of the GNU General Public License, 
     * incorporated herein by reference.
     *
     */
    
    
    #ifndef ZONEMGR_H
    #define ZONEMGR_H
    
    
    #include <qobject.h>
    #include <qstring.h>
    
    
    #include "point.h"
    
    
    //----------------------------------------------------------------------
    // forward declarations
    struct ClientZoneEntryStruct;
    struct ServerZoneEntryStruct;
    struct charProfileStruct;
    struct zoneChangeStruct;
    struct newZoneStruct;
    struct zonePointsStruct;
    struct zonePointStruct;
    struct dzSwitchInfo;
    
    
    class ZoneMgr : public QObject
    {
      Q_OBJECT
    
    
     public:
      ZoneMgr(QObject* parent = 0, const char* name =0);
      virtual ~ZoneMgr();
    
    
      QString zoneNameFromID(uint16_t zoneId);
      QString zoneLongNameFromID(uint16_t zoneId);
      bool isZoning() const { return m_zoning; }
      const QString& shortZoneName() const { return m_shortZoneName; }
      const QString& longZoneName() const { return m_longZoneName; }
      const Point3D<int16_t>& safePoint() const { return m_safePoint; }
      float zoneExpMultiplier() { return m_zone_exp_multiplier; }
      const zonePointStruct* zonePoint(uint32_t zoneTrigger);
      uint32_t dzID() { return m_dzID; }
      const Point3D<int16_t>& dzPoint() const { return m_dzPoint; }
      QString dzLongName() { return m_dzLongName; }
      uint32_t dzType() { return m_dzType; }
    
    
     public slots:
      void saveZoneState(void);
      void restoreZoneState(void);
    
    
     protected slots:
      void zoneEntryClient(const uint8_t* zsentry, size_t, uint8_t);
      void zonePlayer(const uint8_t* zsentry, size_t len);
      void zoneChange(const uint8_t* zoneChange, size_t, uint8_t);
      void zoneNew(const uint8_t* zoneNew, size_t, uint8_t);
      void zonePoints(const uint8_t* zp, size_t, uint8_t);
      void dynamicZonePoints(const uint8_t *data, size_t len, uint8_t);
      void dynamicZoneInfo(const uint8_t *data, size_t len, uint8_t);
      int32_t fillProfileStruct(charProfileStruct *player, const uint8_t *data, size_t len, bool checkLen);
    
    
     signals:
      void zoneBegin();
      void zoneBegin(const QString& shortZoneName);
      void zoneBegin(const ClientZoneEntryStruct* zsentry, size_t len, uint8_t dir);
      void playerProfile(const charProfileStruct* player);
      void zoneChanged(const QString& shortZoneName);
      void zoneChanged(const zoneChangeStruct*, size_t, uint8_t);
      void zoneEnd(const QString& shortZoneName, const QString& longZoneName);
      
     private:
      QString m_longZoneName;
      QString m_shortZoneName;
      bool m_zoning;
      Point3D<int16_t>  m_safePoint;
      float m_zone_exp_multiplier;
      size_t m_zonePointCount;
      zonePointStruct* m_zonePoints;
      Point3D<int16_t>  m_dzPoint;
      uint32_t m_dzID;
      QString m_dzLongName;
      uint32_t m_dzType;
    };
    
    
    #endif // ZONEMGR

    interface.cpp
    Code:
    /*
     * interface.cpp
     *
     *  ShowEQ Distributed under GPL
     *  http://seq.sourceforge.net/
     *
     *  Copyright 2000-2007 by the respective ShowEQ Developers
     */
    
    
    #include "interface.h"
    #include "util.h"
    #include "main.h"
    #include "editor.h"
    #include "packet.h"
    #include "zonemgr.h"
    #include "compassframe.h"
    #include "map.h"
    #include "experiencelog.h"
    #include "combatlog.h"
    #include "filtermgr.h"
    #include "spellshell.h"
    #include "spawnlist.h"
    #include "spelllist.h"
    #include "player.h"
    #include "skilllist.h"
    #include "statlist.h"
    #include "group.h"
    #include "netdiag.h"
    #include "spawnmonitor.h"
    #include "spawnpointlist.h"
    #include "spawnlist2.h"
    #include "logger.h"
    #include "spawnlog.h"
    #include "packetlog.h"
    #include "bazaarlog.h"
    #include "category.h"
    #include "guild.h"
    #include "guildshell.h"
    #include "guildlist.h"
    #include "spells.h"
    #include "datetimemgr.h"
    #include "datalocationmgr.h"
    #include "eqstr.h"
    #include "messagefilter.h"
    #include "messages.h"
    #include "messageshell.h"
    #include "messagewindow.h"
    #include "terminal.h"
    #include "filteredspawnlog.h"
    #include "messagefilterdialog.h"
    #include "diagnosticmessages.h"
    #include "filternotifications.h"
    
    
    #include <sys/stat.h>
    #include <sys/types.h>
    #include <sys/time.h>
    #include <fcntl.h>
    #include <unistd.h>
    #include <stdlib.h>
    #include <stdio.h>
    
    
    #include <qfont.h>
    #include <qapplication.h>
    #include <qlabel.h>
    #include <qpushbutton.h>
    #include <qvaluelist.h>
    #include <qvaluevector.h>
    #include <qstatusbar.h>
    #include <qvaluelist.h>
    #include <qlineedit.h>
    #include <qmessagebox.h>
    #include <qfiledialog.h>
    #include <qaccel.h>
    #include <qfileinfo.h>
    #include <qfile.h>
    #include <qtextstream.h>
    #include <qinputdialog.h>
    #include <qfontdialog.h>
    #include <qcolordialog.h>
    #include <qdockarea.h>
    #include <qwindowsstyle.h>
    #include <qplatinumstyle.h>
    #include <qmotifstyle.h>
    #include <qcdestyle.h>
    #include <qsgistyle.h>
    
    
    // this define is used to diagnose the order with which zone packets are rcvd
    #define ZONE_ORDER_DIAG
    
    
    /* The main interface widget */
    EQInterface::EQInterface(DataLocationMgr* dlm, 
    			 QWidget * parent, const char *name) 
      : QMainWindow (parent, name),
        m_player(0),
        m_dataLocationMgr(dlm),
        m_mapMgr(0),
        m_spawnList(0),
        m_spawnList2(0),
        m_spellList(0),
        m_skillList(0),
        m_statList(0),
        m_spawnPointList(0),
        m_packet(0),
        m_zoneMgr(0),
        m_filterMgr(0),
        m_categoryMgr(0),
        m_spawnShell(0),
        m_spellShell(0),
        m_groupMgr(0),
        m_spawnMonitor(0),
        m_guildmgr(0),
        m_guildShell(0),
        m_dateTimeMgr(0),
        m_eqStrings(0),
        m_messageFilters(0),
        m_messages(0),
        m_messageShell(0),
        m_terminal(0),
        m_filteredSpawnLog(0),
        m_filterNotifications(0),
        m_spawnLogger(0),
        m_globalLog(0),
        m_worldLog(0),
        m_zoneLog(0),
        m_bazaarLog(0),
        m_unknownZoneLog(0),
        m_opcodeMonitorLog(0),
        m_selectedSpawn(0),
        m_windowsMenus(11),
        m_compass(0),
        m_expWindow(0),
        m_combatWindow(0),
        m_netDiag(0),
        m_messageFilterDialog(0),
        m_guildListWindow(0)
    {
      // disable the dock menu
      setDockMenuEnabled(false);
      
      // make sure the windows menus list autodeletes
      m_windowsMenus.setAutoDelete(true);
    
    
      setCentralWidget(new QWidget(this, "filler"));
      
      setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum, false));
    
    
      for (int l = 0; l < maxNumMaps; l++)
        m_map[l] = 0;
    
    
      for (int l = 0; l < maxNumMessageWindows; l++)
        m_messageWindow[l] = 0;
    
    
      QString tempStr;
      QString section = "Interface";
    
    
      m_selectOnConsider = pSEQPrefs->getPrefBool("SelectOnCon", section, false);
      m_selectOnTarget = pSEQPrefs->getPrefBool("SelectOnTarget", section, false);
    
    
      const char* player_classes[] = {"Warrior", "Cleric", "Paladin", "Ranger",
    				  "Shadow Knight", "Druid", "Monk", "Bard",
    				  "Rogue", "Shaman", "Necromancer", "Wizard",
    				  "Magician", "Enchanter", "Beastlord",
    				  "Berserker"
      };
      const char* player_races[] = {"Human", "Barbarian", "Erudite", "Wood elf",
    				"High Elf", "Dark Elf", "Half Elf", "Dwarf",
    				"Troll", "Ogre", "Halfling", "Gnome", "Iksar",
    				"Vah Shir", "Froglok"
      };
    
    
       // set the applications default font
       if (pSEQPrefs->isPreference("Font", section))
       {
         QFont appFont = pSEQPrefs->getPrefFont("Font", section, qApp->font());
         qApp->setFont( appFont, true );
       }
    
    
       // initialize packet count
       m_initialcount = 0;
       m_packetStartTime = 0;
    
    
       // Create the date/time manager
       m_dateTimeMgr = new DateTimeMgr(this, "datetimemgr");
    
    
       // Create Message Filters object
       m_messageFilters = new MessageFilters(this, "messagefilters");
    
    
       // Create Messages storage
       m_messages = new Messages(m_dateTimeMgr, m_messageFilters, 
    			     this, "messages");
    
    
       // Create the terminal object
       m_terminal = new Terminal(m_messages, this, "terminal");
    
    
       QString fileName, fileName2;
       QFileInfo fileInfo, fileInfo2;
    
    
       // Create the packet object
       section = "Network";
       QString vpsection = "VPacket";
    
    
       fileName = pSEQPrefs->getPrefString("WorldOPCodes", section, 
    				       "worldopcodes.xml");
    
    
       fileInfo = m_dataLocationMgr->findExistingFile(".", fileName);
    
    
       fileName2 = pSEQPrefs->getPrefString("ZoneOPCodes", section, 
    					"zoneopcodes.xml");
    
    
       fileInfo2 = m_dataLocationMgr->findExistingFile(".", fileName2);
    
    
       m_packet = new EQPacket(fileInfo.absFilePath(),
    			   fileInfo2.absFilePath(),
    			   pSEQPrefs->getPrefInt("ArqSeqGiveUp", section, 512),
    			   pSEQPrefs->getPrefString("Device", section, "eth0"),
    			   pSEQPrefs->getPrefString("IP", section,
    						    AUTOMATIC_CLIENT_IP),
    			   pSEQPrefs->getPrefString("MAC", section, "0"),
    			   pSEQPrefs->getPrefBool("RealTimeThread", section,
    						  false),
    			   pSEQPrefs->getPrefBool("SessionTracking", 
    						  section, false),
    			   pSEQPrefs->getPrefBool("Record", vpsection, false),
    			   pSEQPrefs->getPrefInt("Playback", vpsection,
    						  PLAYBACK_OFF),
    			   pSEQPrefs->getPrefInt("PlaybackRate", vpsection, 
    						 false),
           			   this, "packet");
       
      ipstr[0] = m_packet->ip();	//Retrieves last IP used in previous session 
      for( int i = 1; i < 5; i++) 
      ipstr[i] = "0.0.0.0";
    
    
      macstr[0] = m_packet->mac();	//Retrieves last MAC used in previous session
      for( int i = 1; i < 5; i++)  
      macstr[i] = "00:00:00:00:00:00";
    
    
      
       // setup the user directory
       m_dataLocationMgr->setupUserDirectory();
    
    
       section = "Interface";
    			      
       // Create the Spells object
       fileName = pSEQPrefs->getPrefString("SpellsFile", section,
    					       "spells_us.txt");
    
    
       fileInfo = m_dataLocationMgr->findExistingFile(".", fileName);
       
       m_spells = new Spells(fileInfo.absFilePath());
       
       // Create the EQStr storage
       m_eqStrings = new EQStr(8009); // increase if the number of strings exeeds
    
    
       // Create the Zone Manager
       m_zoneMgr = new ZoneMgr(this, "zonemgr");
    
    
       // Create GuildMgr object
       fileName = pSEQPrefs->getPrefString("GuildsFile", "Interface",
    				       "guilds2.dat");
       
       fileInfo = m_dataLocationMgr->findWriteFile("tmp", fileName);
    
    
       m_guildmgr = new GuildMgr(fileInfo.absFilePath(), 
    			     this, "guildmgr");
    
    
       // Create our player object
       m_player = new Player(this, m_zoneMgr, m_guildmgr);
    
    
       // Create the filter manager
       m_filterMgr = new FilterMgr(m_dataLocationMgr,
    			       pSEQPrefs->getPrefString("FilterFile", 
    							section, "global.xml"),
    			       pSEQPrefs->getPrefBool("IsCaseSensitive", 
    						      section, false));
    
    
       // if there is a short zone name already, try to load its filters
       QString shortZoneName = m_zoneMgr->shortZoneName();
       if (!shortZoneName.isEmpty())
         m_filterMgr->loadZone(shortZoneName);
       
       m_guildShell = new GuildShell(m_zoneMgr, this, "GuildShell");
    
    
       // Create the spawn shell
       m_spawnShell = new SpawnShell(*m_filterMgr, m_zoneMgr, m_player, m_guildmgr);
    
    
       // Create the Category manager
       m_categoryMgr = new CategoryMgr();
    
    
       // Create the map manager
       m_mapMgr = new MapMgr(m_dataLocationMgr, m_spawnShell, m_player, m_zoneMgr,
    			 this);
    
    
       // Create the spell shell
       m_spellShell = new SpellShell(m_player, m_spawnShell, m_spells);
    
    
       // Create the Spawn Monitor
       m_spawnMonitor = new SpawnMonitor(m_dataLocationMgr, 
    				     m_zoneMgr, m_spawnShell);
    
    
       // Create the Group Manager
       m_groupMgr = new GroupMgr(m_spawnShell, m_player, this, "groupmgr");
    
    
       // Create the message shell
       m_messageShell = new MessageShell(m_messages, m_eqStrings, m_spells, 
    				     m_zoneMgr, m_spawnShell, m_player,
    				     this, "messageshell");
    
    
       // Create the Filter Notifications object
       m_filterNotifications = new FilterNotifications(this, "filternotifications");
       
       // Create log objects as necessary
       if (pSEQPrefs->getPrefBool("LogAllPackets", "PacketLogging", false))
         createGlobalLog();
    
    
       if (pSEQPrefs->getPrefBool("LogZonePackets", "PacketLogging", false))
         createZoneLog();
    
    
       if (pSEQPrefs->getPrefBool("LogBazaarPackets", "PacketLogging", false))
         createBazaarLog();
    
    
       if (pSEQPrefs->getPrefBool("LogWorldPackets", "PacketLogging", false))
         createWorldLog();
    
    
       if (pSEQPrefs->getPrefBool("LogUnknownZonePackets", "PacketLogging", false))
         createUnknownZoneLog();
    
    
       section = "OpCodeMonitoring";
       if (pSEQPrefs->getPrefBool("Enable", section, false))
         createOPCodeMonitorLog(pSEQPrefs->getPrefString("OpCodeList", section, ""));
    
    
       // create the filtered spawn log object if any filters are to be logged
       uint32_t filters = pSEQPrefs->getPrefInt("Log", "Filters", 0);
       if (filters)
       {
         // create the filtered spawn log object
         createFilteredSpawnLog();
    
    
         // set the filters to log
         m_filteredSpawnLog->setFilters(filters);
       }
    
    
       // if the user wants spawns logged, create the spawn logger
       if (pSEQPrefs->getPrefBool("LogSpawns", "Misc", false))
         createSpawnLog();
    
    
       section = "Interface";
    
    
       // create window menu
       m_windowMenu = new QPopupMenu;
    
    
       // Initialize the experience window;
       m_expWindow = new ExperienceWindow(m_dataLocationMgr, m_player, m_groupMgr,
    				      m_zoneMgr);
       setDockEnabled(m_expWindow, 
    		  pSEQPrefs->getPrefBool("DockableExperienceWindow",
    					 section, false));
       Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					   m_expWindow->preferenceName(),
    					   DockUnmanaged);
       addDockWindow(m_expWindow, edge, false);
       m_expWindow->undock();
    
    
       m_expWindow->restoreSize();
    
    
       // move window to new position
       if (pSEQPrefs->getPrefBool("UseWindowPos", section, true))
         m_expWindow->restorePosition();
       
       if (pSEQPrefs->getPrefBool("ShowExpWindow", section, false))
         m_expWindow->show();
    
    
        // insert its menu into the window menu
       insertWindowMenu(m_expWindow);
    
    
       // Initialize the combat window
       m_combatWindow = new CombatWindow(m_player);
       setDockEnabled(m_combatWindow, 
    		  pSEQPrefs->getPrefBool("DockableCombatWindow",
    					 section, false));
       edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    				      m_combatWindow->preferenceName(),
    				      DockUnmanaged);
       addDockWindow(m_combatWindow, edge, false);
       m_combatWindow->undock();
    
    
       m_combatWindow->restoreSize();
    
    
       // move window to new position
       if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
         m_combatWindow->restorePosition();
    
    
       if (pSEQPrefs->getPrefBool("ShowCombatWindow", section, false))
         m_combatWindow->show();
    
    
        // insert its menu into the window menu
       insertWindowMenu(m_combatWindow);
    
    
    /////////////////
    // Main widgets
       // Make a VBox to use as central widget
       // Create/display the Map(s)
       for (int i = 0; i < maxNumMaps; i++)
       {
         QString tmpPrefSuffix = "";
         if (i > 0)
           tmpPrefSuffix = QString::number(i + 1);
         
         // construct the preference name
         QString tmpPrefName = QString("DockedMap") + tmpPrefSuffix;
    
    
         // retrieve if the map should be docked
         m_isMapDocked[i] = pSEQPrefs->getPrefBool(tmpPrefName, section, (i == 0));
    
    
         // construct the preference name
         tmpPrefName = QString("ShowMap") + tmpPrefSuffix;
    
    
         // and as appropriate, craete the map
         if (pSEQPrefs->getPrefBool(tmpPrefName, section, (i == 0)))
           showMap(i);
       }
    
    
       // Create/display the MessageWindow(s)
       for (int i = 0; i < maxNumMessageWindows; i++)
       {
         QString tmpPrefSuffix = "";
         if (i > 0)
           tmpPrefSuffix = QString::number(i + 1);
         
         // construct the preference name
         QString tmpPrefName = QString("DockedMessageWindow") + tmpPrefSuffix;
    
    
         // retrieve if the message window should be docked
         m_isMessageWindowDocked[i] = 
           pSEQPrefs->getPrefBool(tmpPrefName, section, false);
    
    
         // construct the preference name
         tmpPrefName = QString("ShowMessageWindow") + tmpPrefSuffix;
    
    
         // and as appropriate, craete the message window
         if (pSEQPrefs->getPrefBool(tmpPrefName, section, false))
           showMessageWindow(i);
       }
    
    
       // should the compass be docked if it's created
       m_isCompassDocked = pSEQPrefs->getPrefBool("DockedCompass", section, true);
    
    
       //
       // Create the Player Skills listview (ONLY CREATED WHEN NEEDED FLOYD!!!!)
       //
       m_isSkillListDocked = pSEQPrefs->getPrefBool("DockedPlayerSkills", section, true);
       if (pSEQPrefs->getPrefBool("ShowPlayerSkills", section, true))
         showSkillList();
    
    
       //
       // Create the Player Status listview (ONLY CREATED WHEN NEEDED FLOYD!!!!)
       //
       m_isStatListDocked = pSEQPrefs->getPrefBool("DockedPlayerStats", section, true);
       if (pSEQPrefs->getPrefBool("ShowPlayerStats", section, true))
         showStatList();
    
    
       //
       // Create the compass as required
       //
       if (pSEQPrefs->getPrefBool("ShowCompass", section, false))
           showCompass();
    
    
       //
       // Create the spells listview as required (dynamic object)
       //
       m_isSpellListDocked = pSEQPrefs->getPrefBool("DockedSpellList", section, true);
       if (pSEQPrefs->getPrefBool("ShowSpellList", section, false))
           showSpellList();
    
    
    
    
       //
       // Create the Spawn List listview (always exists, just hidden if not specified)
       //
       m_isSpawnListDocked = pSEQPrefs->getPrefBool("DockedSpawnList", section, true);
       if (pSEQPrefs->getPrefBool("ShowSpawnList", section, false))
         showSpawnList();
    
    
       //
       // Create the Spawn List2 listview (always exists, just hidden if not specified)
       //
       m_isSpawnList2Docked = pSEQPrefs->getPrefBool("DockedSpawnList2", section, true);
       if (pSEQPrefs->getPrefBool("ShowSpawnList2", section, true))
         showSpawnList2();
    
    
       //
       // Create the Spawn List listview (always exists, just hidden if not specified)
       //
       m_isSpawnPointListDocked = pSEQPrefs->getPrefBool("DockedSpawnPointList", section, false);
       if (pSEQPrefs->getPrefBool("ShowSpawnPointList", section, false))
         showSpawnPointList();
    
    
       //
       // Create the Net Statistics window as required
       // 
       if (pSEQPrefs->getPrefBool("ShowNetStats", section, false))
         showNetDiag();
    
    
       //
       // Create the Guild member List window as required
       if (pSEQPrefs->getPrefBool("ShowGuildList", section, false))
         showGuildList();
    
    
    /////////////////////
    // QMenuBar
    
    
       // The first call to menuBar() makes it exist
       menuBar()->setSeparator(QMenuBar::InWindowsStyle);
    
    
       // File Menu
       //pFileMenu = new QPopupMenu;
       QPopupMenu* pFileMenu = new QPopupMenu;
       menuBar()->insertItem("&File", pFileMenu);
       pFileMenu->insertItem("&Save Preferences", this, SLOT(savePrefs()), CTRL+Key_S);
       pFileMenu->insertItem("Open &Map", m_mapMgr, SLOT(loadMap()), Key_F1);
       pFileMenu->insertItem("&Import &Map", m_mapMgr, SLOT(importMap()));
       pFileMenu->insertItem("Sa&ve Map", m_mapMgr, SLOT(saveMap()), Key_F2);
       pFileMenu->insertItem("Save SOE Map", m_mapMgr, SLOT(saveSOEMap()));
       pFileMenu->insertItem("Reload Guilds File", m_guildmgr, SLOT(readGuildList()));
       pFileMenu->insertItem("Add Spawn Category", this, SLOT(addCategory()) , ALT+Key_C);
       pFileMenu->insertItem("Rebuild SpawnList", this, SLOT(rebuildSpawnList()) , ALT+Key_R);
       pFileMenu->insertItem("Reload Categories", this, SLOT(reloadCategories()) , CTRL+Key_R);
       pFileMenu->insertItem("Select Next", this, SLOT(selectNext()), CTRL+Key_Right);
       pFileMenu->insertItem("Select Prev", this, SLOT(selectPrev()), CTRL+Key_Left);
       pFileMenu->insertItem("Save Selected Spawns Path", 
    			 this, SLOT(saveSelectedSpawnPath(void)));
       pFileMenu->insertItem("Save NPC Spawn Paths",
    			 this, SLOT(saveSpawnPaths(void)));
       if (m_packet->playbackPackets() != PLAYBACK_OFF)
       {
         pFileMenu->insertItem("Inc Playback Speed", m_packet, SLOT(incPlayback()), CTRL+Key_X);
         pFileMenu->insertItem("Dec Playback Speed", m_packet, SLOT(decPlayback()), CTRL+Key_Z);
       }
       pFileMenu->insertItem("&Quit", qApp, SLOT(quit()));
    
    
       // View menu
       QPopupMenu* pViewMenu = new QPopupMenu;
       menuBar()->insertItem("&View", pViewMenu);
       pViewMenu->setCheckable(true);
       m_id_view_ExpWindow = pViewMenu->insertItem("Experience Window", this, SLOT(toggle_view_ExpWindow()));
       m_id_view_CombatWindow = pViewMenu->insertItem("Combat Window", this, SLOT(toggle_view_CombatWindow()));
       pViewMenu->insertSeparator(-1);
       m_id_view_SpellList = pViewMenu->insertItem("Spell List", this, SLOT(toggle_view_SpellList()));
       m_id_view_SpawnList = pViewMenu->insertItem("Spawn List", this, SLOT(toggle_view_SpawnList()));
       m_id_view_SpawnList2 = pViewMenu->insertItem("Spawn List 2", this, SLOT(toggle_view_SpawnList2()));
       m_id_view_SpawnPointList = pViewMenu->insertItem("Spawn Point List", this, SLOT(toggle_view_SpawnPointList()));
       m_id_view_PlayerStats = pViewMenu->insertItem("Player Stats", this, SLOT(toggle_view_PlayerStats()));
       m_id_view_PlayerSkills = pViewMenu->insertItem("Player Skills", this,SLOT(toggle_view_PlayerSkills()));
       m_id_view_Compass = pViewMenu->insertItem("Compass", this, SLOT(toggle_view_Compass()));
       menuBar()->setItemChecked(m_id_view_PlayerStats, (m_statList != 0));
    
    
       QPopupMenu* subMenu = new QPopupMenu;
       for (int i = 0; i < maxNumMaps; i++)
       {     
            QString mapName = "Map ";
            if (i > 0)
                mapName += QString::number(i + 1);
            m_id_view_Map[i] = subMenu->insertItem(mapName, this, SLOT(toggle_view_Map(int)));
            subMenu->setItemParameter(m_id_view_Map[i], i);
            subMenu->setItemChecked(m_id_view_Map[i], (m_map[i] != 0));
       }
       pViewMenu->insertItem("Maps", subMenu);
    
    
       subMenu = new QPopupMenu;
       QString messageWindowName;
       for (int i = 0; i < maxNumMessageWindows; i++)
       {     
            messageWindowName = "Channel Messages ";
            if (i > 0)
    	  messageWindowName += QString::number(i + 1);
            m_id_view_MessageWindow[i] = subMenu->insertItem(messageWindowName, this, SLOT(toggle_view_ChannelMsgs(int)));
            subMenu->setItemParameter(m_id_view_MessageWindow[i], i);
            subMenu->setItemChecked(m_id_view_MessageWindow[i],
    				(m_messageWindow[i] != 0));
       }
       pViewMenu->insertItem("Channel Mesages", subMenu);
    
    
    
    
       m_id_view_NetDiag = pViewMenu->insertItem("Network Diagnostics", this, SLOT(toggle_view_NetDiag()));
    
    
       m_id_view_GuildListWindow = 
         pViewMenu->insertItem("Guild Member List", this, 
    			   SLOT(toggle_view_GuildList()));
    
    
       pViewMenu->insertSeparator(-1);
    
    
       // View -> PlayerStats
       m_statWinMenu = new QPopupMenu;
       m_id_view_PlayerStats_Options = pViewMenu->insertItem( "&Player Stats", m_statWinMenu);
       m_statWinMenu->setCheckable(TRUE);
    
    
       m_id_view_PlayerStats_Stats
    [LIST_HP] = m_statWinMenu->insertItem("Hit Points");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_HP], LIST_HP);
        
       m_id_view_PlayerStats_Stats
    [LIST_MANA] = m_statWinMenu->insertItem("Mana");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_MANA], LIST_MANA);
        
       m_id_view_PlayerStats_Stats
    [LIST_STAM] = m_statWinMenu->insertItem("Stamina");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_STAM], LIST_STAM);
        
       m_id_view_PlayerStats_Stats
    [LIST_EXP] = m_statWinMenu->insertItem("Experience");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_EXP], LIST_EXP);
        
       m_id_view_PlayerStats_Stats
    [LIST_ALTEXP] = m_statWinMenu->insertItem("Alt Experience");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_ALTEXP], LIST_ALTEXP);
    
    
       m_id_view_PlayerStats_Stats
    [LIST_FOOD] = m_statWinMenu->insertItem("Food");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_FOOD], LIST_FOOD);
        
       m_id_view_PlayerStats_Stats
    [LIST_WATR] = m_statWinMenu->insertItem("Water");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_WATR], LIST_WATR);
       
       m_statWinMenu->insertSeparator(-1);
        
       m_id_view_PlayerStats_Stats
    [LIST_STR] = m_statWinMenu->insertItem("Strength");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_STR], LIST_STR);
        
       m_id_view_PlayerStats_Stats
    [LIST_STA] = m_statWinMenu->insertItem("Stamina");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_STA], LIST_STA);
        
       m_id_view_PlayerStats_Stats
    [LIST_CHA] = m_statWinMenu->insertItem("Charisma");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_CHA], LIST_CHA);
        
       m_id_view_PlayerStats_Stats
    [LIST_DEX] = m_statWinMenu->insertItem("Dexterity");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_DEX], LIST_DEX);
        
       m_id_view_PlayerStats_Stats
    [LIST_INT] = m_statWinMenu->insertItem("Intelligence");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_INT], LIST_INT);
        
       m_id_view_PlayerStats_Stats
    [LIST_AGI] = m_statWinMenu->insertItem("Agility");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_AGI], LIST_AGI);
        
       m_id_view_PlayerStats_Stats
    [LIST_WIS] = m_statWinMenu->insertItem("Wisdom");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_WIS], LIST_WIS);
        
       m_statWinMenu->insertSeparator(-1);
        
       m_id_view_PlayerStats_Stats
    [LIST_MR] = m_statWinMenu->insertItem("Magic Res");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_MR], LIST_MR);
       m_statWinMenu->setItemEnabled(m_id_view_PlayerStats_Stats
    [LIST_MR], false);
        
       m_id_view_PlayerStats_Stats
    [LIST_FR] = m_statWinMenu->insertItem("Fire Res");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_FR], LIST_FR);
       m_statWinMenu->setItemEnabled(m_id_view_PlayerStats_Stats
    [LIST_FR], false);
        
       m_id_view_PlayerStats_Stats
    [LIST_CR] = m_statWinMenu->insertItem("Cold Res");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_CR], LIST_CR);
       m_statWinMenu->setItemEnabled(m_id_view_PlayerStats_Stats
    [LIST_CR], false);
        
       m_id_view_PlayerStats_Stats
    [LIST_DR] = m_statWinMenu->insertItem("Disease Res");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_DR], LIST_DR);
       m_statWinMenu->setItemEnabled(m_id_view_PlayerStats_Stats
    [LIST_DR], false);
        
       m_id_view_PlayerStats_Stats
    [LIST_PR] = m_statWinMenu->insertItem("Poison Res");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_PR], LIST_PR);
       m_statWinMenu->setItemEnabled(m_id_view_PlayerStats_Stats
    [LIST_PR], false);
    
    
       m_statWinMenu->insertSeparator(-1);
        
       m_id_view_PlayerStats_Stats
    [LIST_AC] = m_statWinMenu->insertItem("Armor Class");
       m_statWinMenu->setItemParameter(m_id_view_PlayerStats_Stats
    [LIST_AC], LIST_AC);
       m_statWinMenu->setItemEnabled(m_id_view_PlayerStats_Stats
    [LIST_AC], false);
       connect (m_statWinMenu, SIGNAL(activated(int)), this, SLOT(toggle_view_StatWin(int)));
    
    
       // View -> PlayerSkills
       m_skillWinMenu = new QPopupMenu;
       m_id_view_PlayerSkills_Options = pViewMenu->insertItem( "Player &Skills", m_skillWinMenu);
       pViewMenu->setItemEnabled(m_id_view_PlayerSkills_Options, (m_skillList != 0));
       m_skillWinMenu->setCheckable(TRUE);
       
       m_id_view_PlayerSkills_Languages = m_skillWinMenu->insertItem("&Langauges");
       m_skillWinMenu->setItemParameter(m_id_view_PlayerSkills_Languages,0);
    
    
       connect (m_skillWinMenu, SIGNAL(activated(int)), this, SLOT(toggle_view_SkillWin(int)));
    
    
       // View -> SpawnList
        m_spawnListMenu = new QPopupMenu;
        m_id_view_SpawnList_Options = pViewMenu->insertItem( "Spawn &List", m_spawnListMenu);
        pViewMenu->setItemEnabled(m_id_view_SpawnList_Options, (m_spawnList != 0));
        m_spawnListMenu->setCheckable(TRUE);
    
    
        m_id_view_SpawnList_Cols[tSpawnColName] = m_spawnListMenu->insertItem("&Name");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColName], tSpawnColName);
    
    
        m_id_view_SpawnList_Cols[tSpawnColLevel] = m_spawnListMenu->insertItem("&Level");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColLevel], tSpawnColLevel);
    
    
        m_id_view_SpawnList_Cols[tSpawnColHP] = m_spawnListMenu->insertItem("&HP");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColHP], tSpawnColHP);
    
    
        m_id_view_SpawnList_Cols[tSpawnColGuildID] = m_spawnListMenu->insertItem("Guild Tag");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColGuildID], tSpawnColGuildID);
        m_id_view_SpawnList_Cols[tSpawnColMaxHP] = m_spawnListMenu->insertItem("&Max HP");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColMaxHP], tSpawnColMaxHP);
    
    
        m_id_view_SpawnList_Cols[tSpawnColXPos] = m_spawnListMenu->insertItem("Coord &1");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColXPos], tSpawnColXPos);
    
    
        m_id_view_SpawnList_Cols[tSpawnColYPos] = m_spawnListMenu->insertItem("Coord &2");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColYPos], tSpawnColYPos);
    
    
        m_id_view_SpawnList_Cols[tSpawnColZPos] = m_spawnListMenu->insertItem("Coord &3");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColZPos], tSpawnColZPos);
    
    
        m_id_view_SpawnList_Cols[tSpawnColID] = m_spawnListMenu->insertItem("I&D");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColID], tSpawnColID);
    
    
        m_id_view_SpawnList_Cols[tSpawnColDist] = m_spawnListMenu->insertItem("&Dist");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColDist], tSpawnColDist);
    
    
        m_id_view_SpawnList_Cols[tSpawnColRace] = m_spawnListMenu->insertItem("&Race");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColRace], tSpawnColRace);
    
    
        m_id_view_SpawnList_Cols[tSpawnColClass] = m_spawnListMenu->insertItem("&Class");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColClass], tSpawnColClass);
    
    
        m_id_view_SpawnList_Cols[tSpawnColInfo] = m_spawnListMenu->insertItem("&Info");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColInfo], tSpawnColInfo);
    
    
        m_id_view_SpawnList_Cols[tSpawnColSpawnTime] = m_spawnListMenu->insertItem("Spawn &Time");
        m_spawnListMenu->setItemParameter(m_id_view_SpawnList_Cols[tSpawnColSpawnTime], tSpawnColSpawnTime);
    
    
        connect (m_spawnListMenu, SIGNAL(activated(int)), 
    	     this, SLOT(toggle_view_SpawnListCol(int)));
    
    
       pViewMenu->insertSeparator(-1);
    
    
       int x;
       // View -> DockedWin
       m_dockedWinMenu = new QPopupMenu;
       pViewMenu->insertItem( "&Docked", m_dockedWinMenu);
       m_dockedWinMenu->setCheckable(true);
        
       x = m_dockedWinMenu->insertItem("Spawn &List");
       m_dockedWinMenu->setItemParameter(x, 0);
       m_dockedWinMenu->setItemChecked(x, m_isSpawnListDocked);
    
    
       x = m_dockedWinMenu->insertItem("Spawn &List 2");
       m_dockedWinMenu->setItemParameter(x, 6);
       m_dockedWinMenu->setItemChecked(x, m_isSpawnListDocked);
        
       x = m_dockedWinMenu->insertItem("Spawn P&oint List");
       m_dockedWinMenu->setItemParameter(x, 5);
       m_dockedWinMenu->setItemChecked(x, m_isSpawnPointListDocked);
        
       x = m_dockedWinMenu->insertItem("&Player Stats");
       m_dockedWinMenu->setItemParameter(x, 1);
       m_dockedWinMenu->setItemChecked(x, m_isStatListDocked);
        
       x = m_dockedWinMenu->insertItem("Player &Skills");
       m_dockedWinMenu->setItemParameter(x, 2);
       m_dockedWinMenu->setItemChecked(x, m_isSkillListDocked);
        
       x = m_dockedWinMenu->insertItem("Sp&ell List");
       m_dockedWinMenu->setItemParameter(x, 3);
       m_dockedWinMenu->setItemChecked(x, m_isSpellListDocked);
        
       x = m_dockedWinMenu->insertItem("&Compass");
       m_dockedWinMenu->setItemParameter(x, 4);
       m_dockedWinMenu->setItemChecked(x, m_isCompassDocked);
    
    
       // insert Map docking options 
       // NOTE: Always insert Map docking options at the end of the Docked menu
       for (int i = 0; i < maxNumMaps; i++)
       {     
            QString mapName = "Map ";
            if (i > 0)
                mapName += QString::number(i + 1);
            x = m_dockedWinMenu->insertItem(mapName);
            m_dockedWinMenu->setItemParameter(x, i + mapDockBase);
            m_dockedWinMenu->setItemChecked(x, m_isMapDocked[i]);
       }
        
       connect (m_dockedWinMenu, SIGNAL(activated(int)), this, SLOT(toggle_view_DockedWin(int)));
    
    
       // View -> DockableWin
       m_dockableWinMenu = new QPopupMenu;
       pViewMenu->insertItem( "&Dockable", m_dockableWinMenu);
       m_dockableWinMenu->setCheckable(true);
        
       x = m_dockableWinMenu->insertItem("Spawn &List");
       m_dockableWinMenu->setItemParameter(x, 0);
       m_dockableWinMenu->setItemChecked(x, 
    				     pSEQPrefs->getPrefBool("DockableSpawnList",
    							    section, true));
    
    
       x = m_dockableWinMenu->insertItem("Spawn &List 2");
       m_dockableWinMenu->setItemParameter(x, 6);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockableSpawnList2",
    							    section, true));
        
       x = m_dockableWinMenu->insertItem("Spawn P&oint List");
       m_dockableWinMenu->setItemParameter(x, 5);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockableSpawnPointList",
    							    section, true));
        
       x = m_dockableWinMenu->insertItem("&Player Stats");
       m_dockableWinMenu->setItemParameter(x, 1);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockablePlayerStats",
    							    section, true));
        
       x = m_dockableWinMenu->insertItem("Player &Skills");
       m_dockableWinMenu->setItemParameter(x, 2);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockablePlayerSkills",
    							    section, true));
        
       x = m_dockableWinMenu->insertItem("Sp&ell List");
       m_dockableWinMenu->setItemParameter(x, 3);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockableSpellList",
    							    section, true));
        
       x = m_dockableWinMenu->insertItem("&Compass");
       m_dockableWinMenu->setItemParameter(x, 4);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockableCompass",
    							    section, true));
    
    
       x = m_dockableWinMenu->insertItem("E&xperience Window");
       m_dockableWinMenu->setItemParameter(x, 7);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockableExperienceWindow",
    							    section, false));
    
    
       x = m_dockableWinMenu->insertItem("Com&bat Window");
       m_dockableWinMenu->setItemParameter(x, 8);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockableCombatWindow",
    							    section, false));
    
    
       x = m_dockableWinMenu->insertItem("&Guild List");
       m_dockableWinMenu->setItemParameter(x, 9);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockableGuildListWindow",
    							    section, true));
    
    
       x = m_dockableWinMenu->insertItem("&Net Diag");
       m_dockableWinMenu->setItemParameter(x, 10);
       m_dockableWinMenu->setItemChecked(x,  
    				     pSEQPrefs->getPrefBool("DockableNetDiag",
    							    section, true));
    
    
       // insert Map docking options 
       subMenu = new QPopupMenu;
       for (int i = 0; i < maxNumMaps; i++)
       {     
            QString mapName = "Map ";
    	QString mapPrefName = "Map";
            if (i > 0)
    	{
                mapName += QString::number(i + 1);
    	    mapPrefName + QString::number(i + 1);
    	}
            x = subMenu->insertItem(mapName);
            subMenu->setItemParameter(x, i + mapDockBase);
    	subMenu->setItemChecked(x, pSEQPrefs->getPrefBool(QString("Dockable")
    							  + mapName,
    							  section, true));
       }
       connect (subMenu, SIGNAL(activated(int)), this, 
    	    SLOT(toggle_view_DockableWin(int)));
       m_dockableWinMenu->insertItem("Maps", subMenu);
    
    
       // insert Message Window docking options 
       subMenu = new QPopupMenu;
       QString messagePrefName = "DockableMessageWindow";
       for (int i = 0; i < maxNumMessageWindows; i++)
       {     
            QString messageWindowName = "Channel Messages ";
    	if (i > 0)
    	  messageWindowName += QString::number(i + 1);
            x = subMenu->insertItem(messageWindowName);
            subMenu->setItemParameter(x, i + messageWindowDockBase);
    	subMenu->setItemChecked(x, pSEQPrefs->getPrefBool(messagePrefName + 
    							  QString::number(i),
    							  section, false));
       }
       connect (subMenu, SIGNAL(activated(int)), this, 
    	    SLOT(toggle_view_DockableWin(int)));
       m_dockableWinMenu->insertItem("Channel Messages", subMenu);
        
       connect (m_dockableWinMenu, SIGNAL(activated(int)), this, SLOT(toggle_view_DockableWin(int)));
    
    
    
    
       // view menu checks are set by init_view_menu
      connect(pViewMenu, SIGNAL(aboutToShow()),
    	  this, SLOT(init_view_menu()));
    
    
    
    
       // Options Menu
       QPopupMenu* pOptMenu = new QPopupMenu;
       menuBar()->insertItem("&Options", pOptMenu);
       pOptMenu->setCheckable(TRUE);
       m_id_opt_Fast     = pOptMenu->insertItem("Fast Machine?", this, SLOT(toggle_opt_Fast()));
       m_id_opt_ConSelect = pOptMenu->insertItem("Select on Consider?", this, SLOT(toggle_opt_ConSelect()));
       m_id_opt_TarSelect = pOptMenu->insertItem("Select on Target?", this, SLOT(toggle_opt_TarSelect()));
       m_id_opt_KeepSelectedVisible =
                      pOptMenu->insertItem("Keep Selected Visible?"  , this, SLOT(toggle_opt_KeepSelectedVisible()));
       m_id_opt_LogSpawns = pOptMenu->insertItem("Log Spawns", this, SLOT(toggle_opt_LogSpawns()));
       m_id_opt_BazaarData    = pOptMenu->insertItem("Bazaar Searches", this, SLOT(toggle_opt_BazaarData()));
       menuBar()->setItemChecked (m_id_opt_BazaarData, (m_bazaarLog != 0));
       m_id_opt_ResetMana = pOptMenu->insertItem("Reset Max Mana", this, SLOT(resetMaxMana()));
       m_id_opt_PvPTeams  = pOptMenu->insertItem("PvP Teams", this, SLOT(toggle_opt_PvPTeams()));
       m_id_opt_PvPDeity  = pOptMenu->insertItem("PvP Deity", this, SLOT(toggle_opt_PvPDeity()));
       x = pOptMenu->insertItem("Create Unknown Spawns", 
    			    this, SLOT(toggle_opt_CreateUnknownSpawns(int)));
       menuBar()->setItemChecked (x, showeq_params->createUnknownSpawns);
       x = pOptMenu->insertItem("Use EQ Retarded Coordinates", 
    			    this, SLOT(toggle_opt_RetardedCoords(int)));
       menuBar()->setItemChecked (x, showeq_params->retarded_coords);
       x = pOptMenu->insertItem("Use Unix System Time for Spawn Time", 
    			    this, SLOT(toggle_opt_SystimeSpawntime(int)));
       menuBar()->setItemChecked (x, showeq_params->systime_spawntime);
       x = pOptMenu->insertItem("Record Spawn Walk Paths", 
    			    this, SLOT(toggle_opt_WalkPathRecord(int)));
       menuBar()->setItemChecked (x, showeq_params->walkpathrecord);
    
    
       subMenu = new QPopupMenu;
       QSpinBox* walkPathLengthSpinBox = new QSpinBox(0, 8192, 1, subMenu);
       walkPathLengthSpinBox->setValue(showeq_params->walkpathlength);
       connect(walkPathLengthSpinBox, SIGNAL(valueChanged(int)),
    	   this, SLOT(set_opt_WalkPathLength(int)));
       subMenu->insertItem(walkPathLengthSpinBox);
       pOptMenu->insertItem("Walk Path Length", 
    			subMenu);
       
       menuBar()->setItemChecked (m_id_opt_Fast, showeq_params->fast_machine);
       menuBar()->setItemChecked (m_id_opt_ConSelect, m_selectOnConsider);
       menuBar()->setItemChecked (m_id_opt_TarSelect, m_selectOnTarget);
       menuBar()->setItemChecked (m_id_opt_KeepSelectedVisible, showeq_params->keep_selected_visible);
       menuBar()->setItemChecked (m_id_opt_LogSpawns, (m_spawnLogger != 0));
       menuBar()->setItemChecked (m_id_opt_PvPTeams, showeq_params->pvp);
       menuBar()->setItemChecked (m_id_opt_PvPDeity, showeq_params->deitypvp);
    
    
       // SaveState SubMenu
       QPopupMenu* pSaveStateMenu = new QPopupMenu;
       pOptMenu->insertItem("&Save State", pSaveStateMenu);
       pSaveStateMenu->setCheckable(true);
       x = pSaveStateMenu->insertItem("&Player", this, 
    				  SLOT(toggle_opt_save_PlayerState(int)));
       pSaveStateMenu->setItemChecked(x, showeq_params->savePlayerState);
       x = pSaveStateMenu->insertItem("&Zone", this, 
    				  SLOT(toggle_opt_save_ZoneState(int)));
       pSaveStateMenu->setItemChecked(x, showeq_params->saveZoneState);
       x = pSaveStateMenu->insertItem("&Spawns", this, 
    				  SLOT(toggle_opt_save_Spawns(int)));
       pSaveStateMenu->setItemChecked(x, showeq_params->saveSpawns);
       pSaveStateMenu->insertItem("Base &Filename...", this, 
    			      SLOT(set_opt_save_BaseFilename(void)));
    
    
       pSaveStateMenu->insertSeparator(-1);
       subMenu = new QPopupMenu;
       QSpinBox* saveFrequencySpinBox = new QSpinBox(1, 320, 1, subMenu);
       saveFrequencySpinBox->setValue(showeq_params->saveSpawnsFrequency / 1000);
       connect(saveFrequencySpinBox, SIGNAL(valueChanged(int)),
    	   this, SLOT(set_opt_save_SpawnFrequency(int)));
       subMenu->insertItem(saveFrequencySpinBox);
       pSaveStateMenu->insertItem("Spawn Save Frequency (s)", 
    			      subMenu);
    
    
       pOptMenu->insertItem("Clear Channel Messages", 
    			this, SLOT(opt_clearChannelMsgs(int)));
    
    
       // Con Color base menu
       QPopupMenu* conColorBaseMenu = new QPopupMenu;
       x = conColorBaseMenu->insertItem("Gray Spawn Base...");
       conColorBaseMenu->setItemParameter(x, tGraySpawn);
       x = conColorBaseMenu->insertItem("Green Spawn Base...");
       conColorBaseMenu->setItemParameter(x, tGreenSpawn);
       x = conColorBaseMenu->insertItem("Light Blue Spawn Base...");
       conColorBaseMenu->setItemParameter(x, tCyanSpawn);
       x = conColorBaseMenu->insertItem("Blue Spawn Base...");
       conColorBaseMenu->setItemParameter(x, tBlueSpawn);
       x = conColorBaseMenu->insertItem("Even Spawn...");
       conColorBaseMenu->setItemParameter(x, tEvenSpawn);
       x = conColorBaseMenu->insertItem("Yellow Spawn Base...");
       conColorBaseMenu->setItemParameter(x, tYellowSpawn);
       x = conColorBaseMenu->insertItem("Red Spawn Base...");
       conColorBaseMenu->setItemParameter(x, tRedSpawn);
       x = conColorBaseMenu->insertItem("Unknown Spawn...");
       conColorBaseMenu->setItemParameter(x, tUnknownSpawn);
       connect(conColorBaseMenu, SIGNAL(activated(int)),
               this, SLOT(select_opt_conColorBase(int)));
       pOptMenu->insertItem("Con &Colors", conColorBaseMenu);
       m_id_opt_useUpdateRadius = pOptMenu->insertItem("Use EQ's Update Radius",
               this, SLOT(toggle_opt_UseUpdateRadius()));
       menuBar()->setItemChecked (m_id_opt_useUpdateRadius, showeq_params->useUpdateRadius);
    
    
       // Network Menu
       m_netMenu = new QPopupMenu;
       menuBar()->insertItem("&Network", m_netMenu);
       m_netMenu->insertItem("Monitor &Next EQ Client Seen", this, SLOT(set_net_monitor_next_client()));
       m_netMenu->insertItem("Monitor EQ Client &IP Address...", this, SLOT(set_net_client_IP_address()));
       m_netMenu->insertItem("Monitor EQ Client &MAC Address...", this, SLOT(set_net_client_MAC_address()));
       m_netMenu->insertItem("Set &Device...", this, SLOT(set_net_device()));
       m_id_net_sessiontrack = m_netMenu->insertItem("Session Tracking", this, SLOT(toggle_net_session_tracking()));
       m_netMenu->setItemChecked(m_id_net_sessiontrack, m_packet->session_tracking());
       x = m_netMenu->insertItem("&Real Time Thread", this, SLOT(toggle_net_real_time_thread(int)));
       m_netMenu->setItemChecked(x, m_packet->realtime());
    
    
       m_netMenu->insertSeparator(-1);
    
    
       // Log menu
       QPopupMenu* pLogMenu = new QPopupMenu;
       m_netMenu->insertItem("Lo&g", pLogMenu);
       pLogMenu->setCheckable(true);
       m_id_log_AllPackets  = pLogMenu->insertItem("All Packets", this, SLOT(toggle_log_AllPackets()), Key_F5);
       m_id_log_WorldData   = pLogMenu->insertItem("World Data", this, SLOT(toggle_log_WorldData()), Key_F6);
       m_id_log_ZoneData    = pLogMenu->insertItem("Zone Data", this, SLOT(toggle_log_ZoneData()), Key_F7);
       m_id_log_UnknownData = pLogMenu->insertItem("Unknown Data", this, SLOT(toggle_log_UnknownData()), Key_F8);
       m_id_view_UnknownData = pLogMenu->insertItem("View Unknown Data", this, 
    						 SLOT(toggle_view_UnknownData()) , 
    						 Key_F9);
       m_id_log_RawData     = pLogMenu->insertItem("Raw Data", this, SLOT(toggle_log_RawData()), Key_F10);
    
    
       m_filterZoneDataMenu = new QPopupMenu;
       pLogMenu->insertItem("Filter Zone Data", m_filterZoneDataMenu);
       m_id_log_Filter_ZoneData_Client = m_filterZoneDataMenu->insertItem("Client", this,
             SLOT(toggle_log_Filter_ZoneData_Client()));
       m_id_log_Filter_ZoneData_Server = m_filterZoneDataMenu->insertItem("Server", this,
             SLOT(toggle_log_Filter_ZoneData_Server()));
    
    
       menuBar()->setItemChecked (m_id_log_AllPackets, (m_globalLog != 0));
       menuBar()->setItemChecked (m_id_log_WorldData, (m_worldLog != 0));
       menuBar()->setItemChecked (m_id_log_ZoneData, (m_zoneLog != 0));
       menuBar()->setItemChecked (m_id_log_UnknownData, (m_unknownZoneLog != 0));
       menuBar()->setItemChecked(m_id_view_UnknownData,
    			     pSEQPrefs->getPrefBool("ViewUnknown", 
    						    "PacketLogging", 
    						    false));
       menuBar()->setItemChecked (m_id_log_RawData,
    			      pSEQPrefs->getPrefBool("LogRawPackets", 
    						     "PacketLogging",
    						     false));
    
    
       // OpCode Monitor
       QPopupMenu* pOpCodeMenu = new QPopupMenu;
       m_netMenu->insertItem("OpCode Monitor", pOpCodeMenu);
       x = pOpCodeMenu->insertItem("&OpCode Monitoring", this,
    			      SLOT(toggle_opcode_monitoring(int)), CTRL+ALT+Key_O);
       
       pOpCodeMenu->setItemChecked(x, (m_opcodeMonitorLog != 0));
       pOpCodeMenu->insertItem("&Reload Monitored OpCode List..", this,
    			  SLOT(set_opcode_monitored_list()), CTRL+ALT+Key_R);
      section = "OpCodeMonitoring";
       x =pOpCodeMenu->insertItem("&View Monitored OpCode Matches", this,
    			      SLOT(toggle_opcode_view(int)));
       pOpCodeMenu->setItemChecked(x, pSEQPrefs->getPrefBool("View", 
    							 section,
    							 false));
       x =pOpCodeMenu->insertItem("&Log Monitored OpCode Matches", this,
    			      SLOT(toggle_opcode_log(int)));
       pOpCodeMenu->setItemChecked(x, pSEQPrefs->getPrefBool("Log", 
    							 section,
    							 false));
       pOpCodeMenu->insertItem("Log &Filename...", this,
    			  SLOT(select_opcode_file()));
       m_netMenu->insertSeparator(-1);
    
    
       section = "Interface";
    
    
       // Advanced menu
       subMenu = new QPopupMenu;
       QPopupMenu* subSubMenu = new QPopupMenu;
       QSpinBox* arqSeqGiveUpSpinBox = new QSpinBox(32, 1024, 8, subSubMenu);
       arqSeqGiveUpSpinBox->setValue(m_packet->arqSeqGiveUp());
       connect(arqSeqGiveUpSpinBox, SIGNAL(valueChanged(int)),
    	   this, SLOT(set_net_arq_giveup(int)));
       subSubMenu->insertItem(arqSeqGiveUpSpinBox);
       subMenu->insertItem("Arq Seq Give Up", 
    			 subSubMenu);
       m_netMenu->insertItem("Advanced", subMenu);
    
    
       // Character Menu 
       m_charMenu = new QPopupMenu;
       menuBar()->insertItem("&Character", m_charMenu);
       int yx = m_charMenu->insertItem("Use Auto Detected Settings", this, 
    				   SLOT(toggleAutoDetectPlayerSettings(int)));
       m_charMenu->setItemChecked(yx, m_player->useAutoDetectedSettings());
    
    
       // Character -> Level
       m_charLevelMenu = new QPopupMenu;
       m_charMenu->insertItem("Choose &Level", m_charLevelMenu);
       m_levelSpinBox = new QSpinBox(1, 80, 1, this, "m_levelSpinBox");
       m_charLevelMenu->insertItem( m_levelSpinBox );
       m_levelSpinBox->setWrapping( true );
       m_levelSpinBox->setButtonSymbols(QSpinBox::PlusMinus);
       m_levelSpinBox->setPrefix("Level: ");
       connect(m_levelSpinBox, SIGNAL(valueChanged(int)), this, SLOT(SetDefaultCharacterLevel(int)));
       m_levelSpinBox->setValue(m_player->defaultLevel());
    
    
       // Character -> Class
       m_charClassMenu = new QPopupMenu;
       m_charMenu->insertItem("Choose &Class", m_charClassMenu);
       for( int i = 0; i < PLAYER_CLASSES; i++)
       {
           char_ClassID[i] = m_charClassMenu->insertItem(player_classes[i]);
           m_charClassMenu->setItemParameter(char_ClassID[i],i+1);
           if(i+1 == m_player->defaultClass())
              m_charMenu->setItemChecked(char_ClassID[i], true);
       }
       connect (m_charClassMenu, SIGNAL(activated(int)), this, SLOT(SetDefaultCharacterClass(int)));
    
    
       // Character -> Race
       m_charRaceMenu = new QPopupMenu;
       m_charMenu->insertItem("Choose &Race", m_charRaceMenu);
       for( int i = 0; i < PLAYER_RACES; i++)
       {
           char_RaceID[i] = m_charRaceMenu->insertItem(player_races[i]);
           if(i != 12 || i != 13)
              m_charRaceMenu->setItemParameter(char_RaceID[i],i+1);
           if(i == 12)
              m_charRaceMenu->setItemParameter(char_RaceID[i],128);
           else if(i == 13)
              m_charRaceMenu->setItemParameter(char_RaceID[i],130);
           else if(i == 14)
              m_charRaceMenu->setItemParameter(char_RaceID[i],330);
    
    
           if(m_charRaceMenu->itemParameter(char_RaceID[i]) == m_player->defaultRace())
              m_charRaceMenu->setItemChecked(char_RaceID[i], true);
       }
       connect (m_charRaceMenu, SIGNAL(activated(int)), this, SLOT(SetDefaultCharacterRace(int)));
    
    
       // Filters Menu
       QPopupMenu* filterMenu = new QPopupMenu;
       menuBar()->insertItem( "Fi&lters" , filterMenu);
       filterMenu->setCheckable(true);
    
    
       filterMenu->insertItem("&Reload Filters", m_filterMgr, SLOT(loadFilters()), Key_F3);
       filterMenu->insertItem("&Save Filters", m_filterMgr, SLOT(saveFilters()), Key_F4);
       filterMenu->insertItem("&Edit Filters", this, SLOT(launch_editor_filters()));
       filterMenu->insertItem("Select Fil&ter File", this, SLOT(select_filter_file()));
    
    
       filterMenu->insertItem("Reload &Zone Filters", m_filterMgr, SLOT(loadZoneFilters()), SHIFT+Key_F3);
       filterMenu->insertItem("S&ave Zone Filters", m_filterMgr, SLOT(saveZoneFilters()), SHIFT+Key_F4);
       filterMenu->insertItem("Edit Zone Fi&lters", this, SLOT(launch_editor_zoneFilters()));
    
    
       filterMenu->insertItem("Re&filter Spawns", m_spawnShell, SLOT(refilterSpawns()));
       x = filterMenu->insertItem("&Is Case Sensitive", this, SLOT(toggle_filter_Case(int)));
       filterMenu->setItemChecked(x, m_filterMgr->caseSensitive());
       x = filterMenu->insertItem("&Display Alert Info", this, SLOT(toggle_filter_AlertInfo(int)));
       filterMenu->setItemChecked(x, 
    			      pSEQPrefs->getPrefBool("AlertInfo", "Filters"));
       x = filterMenu->insertItem("&Use System Beep", this, SLOT(toggle_filter_UseSystemBeep(int)));
       filterMenu->setItemChecked(x, m_filterNotifications->useSystemBeep());
       x = filterMenu->insertItem("Use &Commands", this, SLOT(toggle_filter_UseCommands(int)));
       filterMenu->setItemChecked(x, m_filterNotifications->useCommands());
    
    
       // Filter -> Log
       QPopupMenu* filterLogMenu = new QPopupMenu;
       filterLogMenu->setCheckable(true);
       filterMenu->insertItem("&Log", filterLogMenu);
       x = filterLogMenu->insertItem( "Alerts");
       filterLogMenu->setItemParameter(x, FILTER_FLAG_ALERT);
       filterLogMenu->setItemChecked(x, ((filters & FILTER_FLAG_ALERT) != 0));
       x = filterLogMenu->insertItem( "Locates");
       filterLogMenu->setItemParameter(x, FILTER_FLAG_LOCATE);
       filterLogMenu->setItemChecked(x, ((filters & FILTER_FLAG_LOCATE) != 0));
       x = filterLogMenu->insertItem( "Hunts");
       filterLogMenu->setItemParameter(x, FILTER_FLAG_HUNT);
       filterLogMenu->setItemChecked(x, ((filters & FILTER_FLAG_HUNT) != 0));
       x = filterLogMenu->insertItem( "Cautions");
       filterLogMenu->setItemParameter(x, FILTER_FLAG_CAUTION);
       filterLogMenu->setItemChecked(x, ((filters & FILTER_FLAG_CAUTION) != 0));
       x = filterLogMenu->insertItem( "Dangers");
       filterLogMenu->setItemParameter(x, FILTER_FLAG_DANGER);
       filterLogMenu->setItemChecked(x, ((filters & FILTER_FLAG_DANGER) != 0));
       connect(filterLogMenu, SIGNAL(activated(int)),
    	   this, SLOT(toggle_filter_Log(int)));
    
    
       // Filter -> Commands
       QPopupMenu* filterCmdMenu = new QPopupMenu;
       filterMenu->insertItem("&Audio Commands", filterCmdMenu);
       x = filterCmdMenu->insertItem( "Spawn...");
       filterCmdMenu->setItemParameter(x, 1);
       x = filterCmdMenu->insertItem( "DeSpawn...");
       filterCmdMenu->setItemParameter(x, 2);
       x = filterCmdMenu->insertItem( "Death...");
       filterCmdMenu->setItemParameter(x, 3);
       x = filterCmdMenu->insertItem( "Locate...");
       filterCmdMenu->setItemParameter(x, 4);
       x = filterCmdMenu->insertItem( "Caution...");
       filterCmdMenu->setItemParameter(x, 5);
       x = filterCmdMenu->insertItem( "Hunt...");
       filterCmdMenu->setItemParameter(x, 6);
       x = filterCmdMenu->insertItem( "Danger...");
       filterCmdMenu->setItemParameter(x, 7);
       connect(filterCmdMenu, SIGNAL(activated(int)),
    	   this, SLOT(set_filter_AudioCommand(int)));
    
    
       // Interface Menu
       QPopupMenu* pInterfaceMenu = new QPopupMenu;
       menuBar()->insertItem( "&Interface" , pInterfaceMenu);
    
    
       pInterfaceMenu->insertItem("Hide MenuBar", this, SLOT(toggle_view_menubar()));
    
    
       // Interface -> Style
       //pStyleMenu = new QPopupMenu;
       QPopupMenu* pStyleMenu = new QPopupMenu;
       pInterfaceMenu->insertItem( "&Style", pStyleMenu);
       pStyleMenu->setCheckable(TRUE);
       x = pStyleMenu->insertItem( "Platinum (Macintosh)");
       pStyleMenu->setItemParameter(x, 1);
       IDList_StyleMenu.append(x);
       x = pStyleMenu->insertItem( "Windows (Default)");
       pStyleMenu->setItemParameter(x, 2);
       IDList_StyleMenu.append(x);
       x = pStyleMenu->insertItem( "CDE");
       pStyleMenu->setItemParameter(x, 3);
       IDList_StyleMenu.append(x);
       x = pStyleMenu->insertItem( "CDE Polished");
       pStyleMenu->setItemParameter(x, 4);
       IDList_StyleMenu.append(x);
       x = pStyleMenu->insertItem( "Motif");
       pStyleMenu->setItemParameter(x, 5);
       IDList_StyleMenu.append(x);
       x = pStyleMenu->insertItem( "SGI");
       pStyleMenu->setItemParameter(x, 6);
       IDList_StyleMenu.append(x);
       connect (pStyleMenu, SIGNAL(activated(int)), this, SLOT(selectTheme(int)));
    
    
       setTheme(pSEQPrefs->getPrefInt("Theme", section, 2));
    
    
       // Interface -> Status Bar
       QPopupMenu* statusBarMenu = new QPopupMenu;
       statusBarMenu->setCheckable(true);
       pInterfaceMenu->insertItem("&Status Bar", statusBarMenu);
       statusBarMenu->insertItem("Show/Hide", 
    			      this, SLOT(toggle_view_statusbar()));
       x = statusBarMenu->insertItem( "Status");
       statusBarMenu->setItemParameter(x, 1);
       statusBarMenu->setItemChecked(x, pSEQPrefs->getPrefBool("ShowStatus",
    							   "Interface_StatusBar", false));
       x = statusBarMenu->insertItem( "Zone");
       statusBarMenu->setItemParameter(x, 2);
       statusBarMenu->setItemChecked(x, pSEQPrefs->getPrefBool("ShowZone",
    							   "Interface_StatusBar", false));
       x = statusBarMenu->insertItem( "Spawns");
       statusBarMenu->setItemParameter(x, 3);
       statusBarMenu->setItemChecked(x, pSEQPrefs->getPrefBool("ShowSpawns",
    							   "Interface_StatusBar", false));
       x = statusBarMenu->insertItem( "Experience");
       statusBarMenu->setItemParameter(x, 4);
       statusBarMenu->setItemChecked(x, pSEQPrefs->getPrefBool("ShowExp",
    							   "Interface_StatusBar", false));
       x = statusBarMenu->insertItem( "AA Experience");
       statusBarMenu->setItemParameter(x, 5);
       statusBarMenu->setItemChecked(x, pSEQPrefs->getPrefBool("ShowExpAA",
    							   "Interface_StatusBar", false));
       x = statusBarMenu->insertItem( "Packet Counter");
       statusBarMenu->setItemParameter(x, 6);
       statusBarMenu->setItemChecked(x, pSEQPrefs->getPrefBool("ShowPacketCounter",
    							   "Interface_StatusBar", false));
       x = statusBarMenu->insertItem( "EQ Time");
       statusBarMenu->setItemParameter(x, 7);
       statusBarMenu->setItemChecked(x, pSEQPrefs->getPrefBool("ShowEQTime",
    							   "Interface_StatusBar", false));
       x = statusBarMenu->insertItem( "Run Speed");
       statusBarMenu->setItemParameter(x, 8);
       statusBarMenu->setItemChecked(x, pSEQPrefs->getPrefBool("ShowSpeed",
    							   "Interface_StatusBar", false));
       // ZEM code
       x = statusBarMenu->insertItem( "ZEM");
       statusBarMenu->setItemParameter(x, 9);
       statusBarMenu->setItemChecked(x, pSEQPrefs->getPrefBool("ShowZEM",
    							   "Interface_StatusBar", false));
        
       connect (statusBarMenu, SIGNAL(activated(int)), 
    	    this, SLOT(toggle_main_statusbar_Window(int)));
    
    
       m_terminalMenu = new QPopupMenu;
       pInterfaceMenu->insertItem("&Terminal", m_terminalMenu);
    
    
       m_terminalTypeFilterMenu = new QPopupMenu;
       m_terminalMenu->insertItem("MessageTypeFilter", m_terminalTypeFilterMenu);
       m_terminalTypeFilterMenu->insertItem("&Enable All", 
    					this, SLOT(enableAllTypeFilters()), 0, 64);
       m_terminalTypeFilterMenu->insertItem("&Disable All", 
    					this, SLOT(disableAllTypeFilters()), 0, 65);
      
       m_terminalTypeFilterMenu->insertSeparator(-1);
    
    
       QString typeName;
       uint64_t enabledTypes = m_terminal->enabledTypes();
    
    
       // iterate over the message types, filling in various menus and getting 
       // font color preferences
       for (int i = MT_Guild; i <= MT_Max; i++)
       {
         typeName = MessageEntry::messageTypeString((MessageType)i);
         if (!typeName.isEmpty())
         {
           m_terminalTypeFilterMenu->insertItem(typeName, i);
           m_terminalTypeFilterMenu->setItemChecked(i, (((uint64_t(1) << i) & enabledTypes) != 0));
         }
       }
    
    
       connect(m_terminalTypeFilterMenu, SIGNAL(activated(int)),
    	   this, SLOT(toggleTypeFilter(int)));
    
    
      m_terminalShowUserFilterMenu = new QPopupMenu;
      m_terminalMenu->insertItem("User Message Filter - &Show", m_terminalShowUserFilterMenu);
    
    
      m_terminalShowUserFilterMenu->insertItem("&Enable All", 
    			       this, SLOT(enableAllShowUserFilters()), 0, 66);
      m_terminalShowUserFilterMenu->insertItem("&Disable All", 
    			       this, SLOT(disableAllShowUserFilters()), 0, 67);
      m_terminalShowUserFilterMenu->insertSeparator(-1);
    
    
      m_terminalHideUserFilterMenu = new QPopupMenu;
      m_terminalMenu->insertItem("User Message Filter - &Hide", m_terminalHideUserFilterMenu);
    
    
      m_terminalHideUserFilterMenu->insertItem("&Enable All", 
    			       this, SLOT(enableAllHideUserFilters()), 0, 66);
      m_terminalHideUserFilterMenu->insertItem("&Disable All", 
    			       this, SLOT(disableAllHideUserFilters()), 0, 67);
      m_terminalHideUserFilterMenu->insertSeparator(-1);
    
    
      uint32_t enabledShowUserFilters = m_terminal->enabledShowUserFilters();
      uint32_t enabledHideUserFilters = m_terminal->enabledHideUserFilters();
      const MessageFilter* filter;
      for(int i = 0; i < maxMessageFilters; i++)
      {
        filter = m_messageFilters->filter(i);
        if (filter)
        {
          m_terminalShowUserFilterMenu->insertItem(filter->name(), i);
          m_terminalShowUserFilterMenu->setItemChecked(i, (1 << i) & enabledShowUserFilters);
    
    
          m_terminalHideUserFilterMenu->insertItem(filter->name(), i);
          m_terminalHideUserFilterMenu->setItemChecked(i, (1 << i) & enabledHideUserFilters);
        }
      }
    
    
      connect(m_terminalShowUserFilterMenu, SIGNAL(activated(int)),
    	  this, SLOT(toggleShowUserFilter(int)));
      connect(m_terminalHideUserFilterMenu, SIGNAL(activated(int)),
    	  this, SLOT(toggleHideUserFilter(int)));
      m_terminalMenu->insertItem("Edit User &Message Filters...", 
    			     this, SLOT(showMessageFilterDialog()));
    
    
       m_terminalMenu->insertSeparator(-1);
    
    
       x = m_terminalMenu->insertItem("&Display Type", this, SLOT(toggleDisplayType(int)));
       m_terminalMenu->setItemChecked(x, m_terminal->displayType());
       x = m_terminalMenu->insertItem("Display T&ime/Date", this,
    				  SLOT(toggleDisplayTime(int)));
       m_terminalMenu->setItemChecked(x, m_terminal->displayDateTime());
       x = m_terminalMenu->insertItem("Display &EQ Date/Time", this,
    				  SLOT(toggleEQDisplayTime(int)));
       m_terminalMenu->setItemChecked(x, m_terminal->displayEQDateTime());
       x = m_terminalMenu->insertItem("&Use Color", this,
    				  SLOT(toggleUseColor(int)));
       m_terminalMenu->setItemChecked(x, m_terminal->useColor());
    
    
    
    
       pInterfaceMenu->insertItem( "Formatted Messages File...", 
    			       this, SLOT(select_main_FormatFile(int)));
       pInterfaceMenu->insertItem( "Spells File...", 
    			       this, SLOT(select_main_SpellsFile(int)));
    
    
       // insert Window menu
       menuBar()->insertItem("&Window", m_windowMenu);
    
    
       // All of the Window menu items that don't automatically get inserted
       // have to be manually placed in the right positions.
    
    
       // Interface -> WindowCaption
       m_windowCaptionMenu = new QPopupMenu;
       m_windowMenu->insertItem( "Window &Caption", m_windowCaptionMenu, -1, 0);
       
       x = m_windowCaptionMenu->insertItem("&Main Window...");
       m_windowCaptionMenu->setItemParameter(x, 5);
        
       x = m_windowCaptionMenu->insertItem("Spawn &List...");
       m_windowCaptionMenu->setItemParameter(x, 0);
        
       x = m_windowCaptionMenu->insertItem("Spawn List &2...");
       m_windowCaptionMenu->setItemParameter(x, 10);
        
       x = m_windowCaptionMenu->insertItem("Spawn P&oint List...");
       m_windowCaptionMenu->setItemParameter(x, 9);
        
       x = m_windowCaptionMenu->insertItem("&Player Stats...");
       m_windowCaptionMenu->setItemParameter(x, 1);
        
       x = m_windowCaptionMenu->insertItem("Player &Skills...");
       m_windowCaptionMenu->setItemParameter(x, 2);
        
       x = m_windowCaptionMenu->insertItem("Spell L&ist...");
       m_windowCaptionMenu->setItemParameter(x, 3);
        
       x = m_windowCaptionMenu->insertItem("&Compass...");
       m_windowCaptionMenu->setItemParameter(x, 4);
        
       x = m_windowCaptionMenu->insertItem("&Experience Window...");
       m_windowCaptionMenu->setItemParameter(x, 6);
        
       x = m_windowCaptionMenu->insertItem("Comb&at Window...");
       m_windowCaptionMenu->setItemParameter(x, 7);
        
       x = m_windowCaptionMenu->insertItem("&Network Diagnostics...");
       m_windowCaptionMenu->setItemParameter(x, 8);
    
    
       // insert Map docking options 
       // NOTE: Always insert Map docking options at the end of the Docked menu
       for (int i = 0; i < maxNumMaps; i++)
       {     
            QString mapName = "Map";
            if (i > 0)
                mapName += QString::number(i + 1);
            x = m_windowCaptionMenu->insertItem(mapName);
            m_windowCaptionMenu->setItemParameter(x, i + mapCaptionBase);
       }
        
       connect (m_windowCaptionMenu, SIGNAL(activated(int)), 
    	    this, SLOT(set_main_WindowCaption(int)));
    
    
       // Interface -> Window Font
       QPopupMenu* windowFontMenu = new QPopupMenu;
       m_windowMenu->insertItem( "&Font", windowFontMenu, -1, 1);
        
       windowFontMenu->insertItem( "&Application Default...", 
    			       this, SLOT(set_main_Font(int)));
    
    
       windowFontMenu->insertItem( "Main Window Status Font...", 
    			      this, SLOT(set_main_statusbar_Font(int)));
       //   x = windowFontMenu->insertItem("&Main Window");
       //   windowFontMenu->setItemParameter(x, 5);
        
       x = windowFontMenu->insertItem("Spawn &List...");
       windowFontMenu->setItemParameter(x, 0);
        
       x = windowFontMenu->insertItem("Spawn List &2...");
       windowFontMenu->setItemParameter(x, 10);
        
       x = windowFontMenu->insertItem("Spawn P&oint List...");
       windowFontMenu->setItemParameter(x, 9);
        
       x = windowFontMenu->insertItem("&Player Stats...");
       windowFontMenu->setItemParameter(x, 1);
        
       x = windowFontMenu->insertItem("Player &Skills...");
       windowFontMenu->setItemParameter(x, 2);
        
       x = windowFontMenu->insertItem("Spell L&ist...");
       windowFontMenu->setItemParameter(x, 3);
        
       x = windowFontMenu->insertItem("&Compass...");
       windowFontMenu->setItemParameter(x, 4);
        
       x = windowFontMenu->insertItem("&Experience Window...");
       windowFontMenu->setItemParameter(x, 6);
        
       x = windowFontMenu->insertItem("Comb&at Window...");
       windowFontMenu->setItemParameter(x, 7);
        
       x = windowFontMenu->insertItem("&Network Diagnostics...");
       windowFontMenu->setItemParameter(x, 8);
    
    
       // insert Map docking options 
       // NOTE: Always insert Map docking options at the end of the Docked menu
       for (int i = 0; i < maxNumMaps; i++)
       {     
            QString mapName = "Map";
            if (i > 0)
                mapName += QString::number(i + 1);
            x = m_windowCaptionMenu->insertItem(mapName);
            m_windowCaptionMenu->setItemParameter(x, i + mapCaptionBase);
       }
    
    
       connect (windowFontMenu, SIGNAL(activated(int)), 
    	    this, SLOT(set_main_WindowFont(int)));
    
    
    
    
       x = m_windowMenu->insertItem("Save Window Sizes && Positions", 
    				  this, SLOT(toggle_main_SavePosition(int)),
    				  0, -1, 2);
       m_windowMenu->setItemChecked (x, pSEQPrefs->getPrefBool("SavePosition", 
    							"Interface",
    							true));
       x = m_windowMenu->insertItem("Restore Window Positions", 
    				  this, SLOT(toggle_main_UseWindowPos(int)),
    				  0, -1, 3);
       m_windowMenu->setItemChecked (x, pSEQPrefs->getPrefBool("UseWindowPos", 
    							"Interface",
    							true));
    
    
       m_windowMenu->insertSeparator(4);
    
    
       // Debug menu
       QPopupMenu* pDebugMenu = new QPopupMenu;
       menuBar()->insertItem("&Debug", pDebugMenu);
       pDebugMenu->insertItem("List I&nterface", this, SLOT(listInterfaceInfo()));
       pDebugMenu->insertItem("List S&pawns", this, SLOT(listSpawns()), ALT+CTRL+Key_P);
       pDebugMenu->insertItem("List &Drops", this, SLOT(listDrops()), ALT+CTRL+Key_D);
       pDebugMenu->insertItem("List &Map Info", this, SLOT(listMapInfo()), ALT+CTRL+Key_M);
       pDebugMenu->insertItem("List G&uild Info", m_guildmgr, SLOT(listGuildInfo()));
       pDebugMenu->insertItem("List &Group", this, SLOT(listGroup()), ALT+CTRL+Key_G);
       pDebugMenu->insertItem("List Guild M&embers", this, SLOT(listGuild()), ALT+CTRL+Key_E);
       pDebugMenu->insertItem("Dump Spawns", this, SLOT(dumpSpawns()), ALT+SHIFT+CTRL+Key_P);
       pDebugMenu->insertItem("Dump Drops", this, SLOT(dumpDrops()), ALT+SHIFT+CTRL+Key_D);
       pDebugMenu->insertItem("Dump Map Info", this, SLOT(dumpMapInfo()), ALT+SHIFT+CTRL+Key_M);
       pDebugMenu->insertItem("Dump Guild Info", this , SLOT(dumpGuildInfo()));
       pDebugMenu->insertItem("Dump SpellBook Info", this , SLOT(dumpSpellBook()));
       pDebugMenu->insertItem("Dump Group", this, SLOT(dumpGroup()), ALT+CTRL+SHIFT+Key_G);
       pDebugMenu->insertItem("Dump Guild Members", this, SLOT(dumpGuild()), ALT+CTRL+SHIFT+Key_E);
       pDebugMenu->insertItem("List &Filters", m_filterMgr, SLOT(listFilters()), ALT+CTRL+Key_F);
       pDebugMenu->insertItem("List &Zone Filters", m_filterMgr, SLOT(listZoneFilters()));
    
    
    ////////////////////
    // QStatusBar creation
       
       QString statusBarSection = "Interface_StatusBar";
       int sts_widget_count = 0; // total number of widgets visible on status bar
    
    
       //Status widget
         m_stsbarStatus = new QLabel(statusBar(), "Status");
         m_stsbarStatus->setMinimumWidth(80);
         m_stsbarStatus->setText(QString("ShowEQ %1").arg(VERSION));
         statusBar()->addWidget(m_stsbarStatus, 8);
    
    
       //Zone widget
         m_stsbarZone = new QLabel(statusBar(), "Zone");
         m_stsbarZone->setText("Zone: [unknown]");
         statusBar()->addWidget(m_stsbarZone, 2);
    
    
       //Mobs widget
         m_stsbarSpawns = new QLabel(statusBar(), "Mobs");
         m_stsbarSpawns->setText("Mobs:");
         statusBar()->addWidget(m_stsbarSpawns, 1);
    
    
       //Exp widget
         m_stsbarExp = new QLabel(statusBar(), "Exp");
         m_stsbarExp->setText("Exp [unknown]");
         statusBar()->addWidget(m_stsbarExp, 2);
    
    
       //ExpAA widget
         m_stsbarExpAA = new QLabel(statusBar(), "ExpAA");
         m_stsbarExpAA->setText("ExpAA [unknown]");
         statusBar()->addWidget(m_stsbarExpAA, 2);
       
       //Pkt widget
         m_stsbarPkt = new QLabel(statusBar(), "Pkt");
         m_stsbarPkt->setText("Pkt 0");
         statusBar()->addWidget(m_stsbarPkt, 1);
    
    
       //EQTime widget
         m_stsbarEQTime = new QLabel(statusBar(), "EQTime");
         m_stsbarEQTime->setText("EQTime");
         statusBar()->addWidget(m_stsbarEQTime, 1);
    
    
       // Run Speed widget
         m_stsbarSpeed = new QLabel(statusBar(), "Speed");
         m_stsbarSpeed->setText("Run Speed:");
         statusBar()->addWidget(m_stsbarSpeed, 1);
    
    
       // ZEM code
       // Zone Exp Mult widget
         m_stsbarZEM = new QLabel(statusBar(), "ZEM");
         m_stsbarZEM->setText("ZEM: [unknown]");
         statusBar()->addWidget(m_stsbarZEM, 1);
    
    
         // setup the status fonts correctly
         restoreStatusFont();
    
    
       if (!pSEQPrefs->getPrefBool("ShowStatus", statusBarSection, true))
         m_stsbarStatus->hide();
       else
         sts_widget_count++;
      
       if (!pSEQPrefs->getPrefBool("ShowZone", statusBarSection, true))
         m_stsbarZone->hide();
       else
         sts_widget_count++;
    
    
       if (!pSEQPrefs->getPrefBool("ShowSpawns", statusBarSection, false))
         m_stsbarSpawns->hide();
       else
         sts_widget_count++;
    
    
       if (!pSEQPrefs->getPrefBool("ShowExp", statusBarSection, false))
         m_stsbarExp->hide();
       else
         sts_widget_count++;
    
    
       if (!pSEQPrefs->getPrefBool("ShowExpAA", statusBarSection, false))
         m_stsbarExpAA->hide();
       else
         sts_widget_count++;
    
    
       if (!pSEQPrefs->getPrefBool("ShowPacketCounter", statusBarSection, false))
         m_stsbarPkt->hide();
       else
         sts_widget_count++;
    
    
       if (!pSEQPrefs->getPrefBool("ShowEQTime", statusBarSection, true))
         m_stsbarEQTime->hide();
       else
         sts_widget_count++;
    
    
       if (!pSEQPrefs->getPrefBool("ShowSpeed", statusBarSection, false))
         m_stsbarSpeed->hide();
       else
         sts_widget_count++;
    
    
       // ZEM code
       if (!pSEQPrefs->getPrefBool("ShowZEM", statusBarSection, false))
         m_stsbarZEM->hide();
       else
         sts_widget_count++;
    
    
    
    
       //hide the statusbar if no visible widgets
       if (!sts_widget_count || !pSEQPrefs->getPrefBool("StatusBarActive", statusBarSection, 1))
          statusBar()->hide();
    
    
    
    
    /////////////////
    // interface connections
       // connect EQInterface slots to its own signals
       connect(this, SIGNAL(restoreFonts(void)),
    	   this, SLOT(restoreStatusFont(void)));
    
    
       // connect MapMgr slots to interface signals
       connect(this, SIGNAL(saveAllPrefs(void)),
    	   m_mapMgr, SLOT(savePrefs(void)));
    
    
       // connect CategoryMgr slots to interface signals
       connect(this, SIGNAL(saveAllPrefs(void)),
    	   m_categoryMgr, SLOT(savePrefs(void)));
    
    
       if (m_zoneMgr)
       {
         m_packet->connect2("OP_ZoneEntry", SP_Zone, DIR_Client,
    			"ClientZoneEntryStruct", SZC_Match,
    			m_zoneMgr, SLOT(zoneEntryClient(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_PlayerProfile", SP_Zone, DIR_Server,
    			"uint8_t", SZC_None,
    			m_zoneMgr, SLOT(zonePlayer(const uint8_t*, size_t)));
         m_packet->connect2("OP_ZoneChange", SP_Zone, DIR_Client|DIR_Server,
    			"zoneChangeStruct", SZC_Match,
    			m_zoneMgr, SLOT(zoneChange(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_NewZone", SP_Zone, DIR_Server,
    			"newZoneStruct", SZC_Match,
    			m_zoneMgr, SLOT(zoneNew(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_SendZonePoints", SP_Zone, DIR_Server,
    			"zonePointsStruct", SZC_None,
    			m_zoneMgr, SLOT(zonePoints(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_DzSwitchInfo", SP_Zone, DIR_Server,
                            "dzSwitchInfo", SZC_None,
                            m_zoneMgr, SLOT(dynamicZonePoints(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_DzInfo", SP_Zone, DIR_Server,
                            "dzInfo", SZC_Match,
                            m_zoneMgr, SLOT(dynamicZoneInfo(const uint8_t*, size_t, uint8_t)));
       }
    
    
       if (m_groupMgr != 0)
       {
         connect(m_zoneMgr, SIGNAL(playerProfile(const charProfileStruct*)),
                            m_groupMgr, SLOT(player(const charProfileStruct*)));
         m_packet->connect2("OP_GroupUpdate", SP_Zone, DIR_Server,
                            "uint8_t", SZC_None,
                            m_groupMgr, SLOT(groupUpdate(const uint8_t*, size_t)));
         m_packet->connect2("OP_GroupFollow", SP_Zone, DIR_Server,
                            "groupFollowStruct", SZC_Match,
                            m_groupMgr, SLOT(addGroupMember(const uint8_t*)));
         m_packet->connect2("OP_GroupDisband", SP_Zone, DIR_Server,
                            "groupDisbandStruct", SZC_Match,
                            m_groupMgr, SLOT(removeGroupMember(const uint8_t*)));
         m_packet->connect2("OP_GroupDisband2", SP_Zone, DIR_Server,
                            "groupDisbandStruct", SZC_Match,
                            m_groupMgr, SLOT(removeGroupMember(const uint8_t*)));
         // connect GroupMgr slots to SpawnShell signals
         connect(m_spawnShell, SIGNAL(addItem(const Item*)),
    	     m_groupMgr, SLOT(addItem(const Item*)));
         // connect GroupMgr slots to SpawnShell signals
         connect(m_spawnShell, SIGNAL(delItem(const Item*)),
    	     m_groupMgr, SLOT(delItem(const Item*)));
         // connect GroupMgr slots to SpawnShell signals
         connect(m_spawnShell, SIGNAL(killSpawn(const Item*, const Item*, uint16_t)),
    	     m_groupMgr, SLOT(killSpawn(const Item*)));
       }
    
    
       if (m_dateTimeMgr)
       {
         // connect DateTimeMgr slots to EQPacket signals
         m_packet->connect2("OP_TimeOfDay", SP_Zone, DIR_Server,
    			"timeOfDayStruct", SZC_Match, 
    			m_dateTimeMgr, SLOT(timeOfDay(const uint8_t*)));
    
    
         // connect interface slots to DateTimeMgr signals
         connect(m_dateTimeMgr, SIGNAL(updatedDateTime(const QDateTime&)),
    	     this, SLOT(updatedDateTime(const QDateTime&)));
    
    
         connect(m_dateTimeMgr, SIGNAL(syncDateTime(const QDateTime&)),
    	     this, SLOT(syncDateTime(const QDateTime&)));
       }
    
    
       if (m_filterMgr)
       {
         connect(m_zoneMgr, SIGNAL(zoneBegin(const QString&)),
    	     m_filterMgr, SLOT(loadZone(const QString&)));
         connect(m_zoneMgr, SIGNAL(zoneEnd(const QString&, const QString&)),
    	     m_filterMgr, SLOT(loadZone(const QString&)));
         connect(m_zoneMgr, SIGNAL(zoneChanged(const QString&)),
    	     m_filterMgr, SLOT(loadZone(const QString&)));
       }
    
    
       if (m_guildmgr)
       {
         m_packet->connect2("OP_GuildList", SP_World, DIR_Server, 
    			"worldGuildListStruct", SZC_None,
    			m_guildmgr, 
    			SLOT(worldGuildList(const uint8_t*, size_t)));
    
    
         connect(this, SIGNAL(guildList2text(QString)),
    	     m_guildmgr, SLOT(guildList2text(QString)));
       }
    
    
       if (m_guildShell)
       {
         m_packet->connect2("OP_GuildMemberList", SP_Zone, DIR_Server,
    			"uint8_t", SZC_None,
    			m_guildShell,
    			SLOT(guildMemberList(const uint8_t*, size_t)));
         m_packet->connect2("OP_GuildMemberUpdate", SP_Zone, DIR_Server,
    			"GuildMemberUpdate", SZC_Match,
    			m_guildShell,
    			SLOT(guildMemberUpdate(const uint8_t*, size_t)));
       }
    
    
       if (m_messageShell)
       {
         m_packet->connect2("OP_CommonMessage", SP_Zone, DIR_Client|DIR_Server,
    			"channelMessageStruct", SZC_None,
    			m_messageShell,
    			SLOT(channelMessage(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_FormattedMessage", SP_Zone, DIR_Server,
    			"formattedMessageStruct", SZC_None,
    			m_messageShell,
    			SLOT(formattedMessage(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_SimpleMessage", SP_Zone, DIR_Server,
    			"simpleMessageStruct", SZC_Match,
    			m_messageShell,
    			SLOT(simpleMessage(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_SpecialMesg", SP_Zone, DIR_Server,
    			"specialMessageStruct", SZC_None,
    			m_messageShell,
    			SLOT(specialMessage(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_GuildMOTD", SP_Zone, DIR_Server,
    			"guildMOTDStruct", SZC_None,
    			m_messageShell,
    			SLOT(guildMOTD(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_RandomReq", SP_Zone, DIR_Client,
    			"randomReqStruct", SZC_Match,
    			m_messageShell, SLOT(randomRequest(const uint8_t*)));
         m_packet->connect2("OP_RandomReply", SP_Zone, DIR_Server,
    			"randomStruct", SZC_Match,
    			m_messageShell, SLOT(random(const uint8_t*)));
         m_packet->connect2("OP_ConsentResponse", SP_Zone, DIR_Server,
    			"consentResponseStruct", SZC_Match,
    			m_messageShell, SLOT(consent(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_DenyResponse", SP_Zone, DIR_Server,
    			"consentResponseStruct", SZC_Match,
    			m_messageShell, SLOT(consent(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_Emote", SP_Zone, DIR_Server|DIR_Client,
    			"emoteTextStruct", SZC_None,
    			m_messageShell, SLOT(emoteText(const uint8_t*)));
         m_packet->connect2("OP_InspectAnswer", SP_Zone, DIR_Server,
    			"inspectDataStruct", SZC_Match,
    			m_messageShell, SLOT(inspectData(const uint8_t*)));
         m_packet->connect2("OP_MoneyOnCorpse", SP_Zone, DIR_Server,
    			"moneyOnCorpseStruct", SZC_Match,
    			m_messageShell, SLOT(moneyOnCorpse(const uint8_t*)));
         m_packet->connect2("OP_Logout", SP_Zone, DIR_Server,
    			"none", SZC_Match,
    			m_messageShell, SLOT(logOut(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_NewZone", SP_Zone, DIR_Server,
    			"newZoneStruct", SZC_Match,
    			m_messageShell, SLOT(zoneNew(const uint8_t*, size_t, uint8_t)));
         connect(m_zoneMgr, SIGNAL(zoneBegin(const ClientZoneEntryStruct*, size_t, uint8_t)),
    	     m_messageShell, SLOT(zoneEntryClient(const ClientZoneEntryStruct*)));
         connect(m_zoneMgr, SIGNAL(zoneChanged(const zoneChangeStruct*, size_t, uint8_t)),
    	     m_messageShell, SLOT(zoneChanged(const zoneChangeStruct*, size_t, uint8_t)));
         connect(m_zoneMgr, SIGNAL(zoneBegin(const QString&)),
    	     m_messageShell, SLOT(zoneBegin(const QString&)));
         connect(m_zoneMgr, SIGNAL(zoneEnd(const QString&, const QString&)),
    	     m_messageShell, SLOT(zoneEnd(const QString&, const QString&)));
         connect(m_zoneMgr, SIGNAL(zoneChanged(const QString&)),
    	     m_messageShell, SLOT(zoneChanged(const QString&)));
    
    
         m_packet->connect2("OP_MOTD", SP_World, DIR_Server,
    			"worldMOTDStruct", SZC_None,
    			m_messageShell, SLOT(worldMOTD(const uint8_t*)));
         m_packet->connect2("OP_MemorizeSpell", SP_Zone, DIR_Server|DIR_Client,
    			"memSpellStruct", SZC_Match,
    			m_messageShell, SLOT(handleSpell(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_BeginCast", SP_Zone, DIR_Server|DIR_Client,
    			"beginCastStruct", SZC_Match,
    			m_messageShell, SLOT(beginCast(const uint8_t*)));
         m_packet->connect2("OP_BuffFadeMsg", SP_Zone, DIR_Server|DIR_Client,
    			"spellFadedStruct", SZC_None,
    			m_messageShell, SLOT(spellFaded(const uint8_t*)));
         m_packet->connect2("OP_CastSpell", SP_Zone, DIR_Server|DIR_Client,
    			"startCastStruct", SZC_Match,
    			m_messageShell, SLOT(startCast(const uint8_t*)));
         connect(m_zoneMgr, SIGNAL(playerProfile(const charProfileStruct*)),
            m_messageShell, SLOT(player(const charProfileStruct*)));
         m_packet->connect2("OP_SkillUpdate", SP_Zone, DIR_Server,
    			"skillIncStruct", SZC_Match,
    			m_messageShell, SLOT(increaseSkill(const uint8_t*)));
         m_packet->connect2("OP_LevelUpdate", SP_Zone, DIR_Server,
    			"levelUpUpdateStruct", SZC_Match,
    			m_messageShell, SLOT(updateLevel(const uint8_t*)));
    
    
         m_packet->connect2("OP_Consider", SP_Zone, DIR_Server,
    			"considerStruct", SZC_Match,
    			m_messageShell, SLOT(consMessage(const uint8_t*, size_t, uint8_t)));
    
    
         connect(m_player, SIGNAL(setExp(uint32_t, uint32_t, uint32_t, uint32_t, 
    				     uint32_t)),
    	     m_messageShell, SLOT(setExp(uint32_t, uint32_t, uint32_t, 
    					 uint32_t, uint32_t)));
         connect(m_player, SIGNAL(newExp(uint32_t, uint32_t, uint32_t, uint32_t, 
    				     uint32_t, uint32_t)),
    	     m_messageShell, SLOT(newExp(uint32_t, uint32_t, uint32_t,  
    					 uint32_t, uint32_t, uint32_t)));
         connect(m_player, SIGNAL(setAltExp(uint32_t, uint32_t, uint32_t, uint32_t)),
    	     m_messageShell, SLOT(setAltExp(uint32_t, uint32_t, uint32_t, uint32_t)));
         connect(m_player, SIGNAL(newAltExp(uint32_t, uint32_t, uint32_t, uint32_t,
    					uint32_t, uint32_t)),
    	     m_messageShell, SLOT(newAltExp(uint32_t, uint32_t, uint32_t, uint32_t,
    					    uint32_t, uint32_t)));
    
    
         connect(m_spawnShell, SIGNAL(addItem(const Item*)),
    	     m_messageShell, SLOT(addItem(const Item*)));
         connect(m_spawnShell, SIGNAL(delItem(const Item*)),
    	     m_messageShell, SLOT(delItem(const Item*)));
         connect(m_spawnShell, SIGNAL(killSpawn(const Item*, const Item*, uint16_t)),
    	     m_messageShell, SLOT(killSpawn(const Item*)));
    
    
         connect(m_dateTimeMgr, SIGNAL(syncDateTime(const QDateTime&)),
    	     m_messageShell, SLOT(syncDateTime(const QDateTime&)));
    
    
    // 9/3/2008 - Removed.  Serialized packet now.
    //      m_packet->connect2("OP_GroupUpdate", SP_Zone, DIR_Server,
    // 			"groupUpdateStruct", SZC_None,
    // 			m_messageShell, SLOT(groupUpdate(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_GroupInvite", SP_Zone, DIR_Client|DIR_Server,
    			               "groupInviteStruct", SZC_None,
    			               m_messageShell, SLOT(groupInvite(const uint8_t*, size_t, uint8_t)));
    //      m_packet->connect2("OP_GroupInvite", SP_Zone, DIR_Server,
    //                         "groupAltInviteStruct", SZC_Match,
    //                         m_messageShell, SLOT(groupInvite(const uint8_t*)));
         m_packet->connect2("OP_GroupInvite2", SP_Zone, DIR_Client,
                            "groupInviteStruct", SZC_Match,
                            m_messageShell, SLOT(groupInvite(const uint8_t*, size_t, uint8_t)));
         m_packet->connect2("OP_GroupFollow", SP_Zone, DIR_Server,
    			"groupFollowStruct", SZC_Match,
                            m_messageShell, SLOT(groupFollow(const uint8_t*)));
         m_packet->connect2("OP_GroupFollow2", SP_Zone, DIR_Server,
                            "groupFollowStruct", SZC_Match,
                            m_messageShell, SLOT(groupFollow(const uint8_t*)));
         m_packet->connect2("OP_GroupDisband", SP_Zone, DIR_Server,
    			"groupDisbandStruct", SZC_Match,
                            m_messageShell, SLOT(groupDisband(const uint8_t*)));
         m_packet->connect2("OP_GroupDisband2", SP_Zone, DIR_Server,
                            "groupDisbandStruct", SZC_Match,
                            m_messageShell, SLOT(groupDisband(const uint8_t*)));
         m_packet->connect2("OP_GroupCancelInvite", SP_Zone, DIR_Server|DIR_Client,
    			"groupDeclineStruct", SZC_Match,
    			m_messageShell, SLOT(groupDecline(const uint8_t*)));
         m_packet->connect2("OP_GroupLeader", SP_Zone, DIR_Server,
                            "groupLeaderChangeStruct", SZC_Match,
                            m_messageShell, SLOT(groupLeaderChange(const uint8_t*)));
       }
    
    
       if (m_filterNotifications)
       {
         connect(m_spawnShell, SIGNAL(addItem(const Item*)),
    	     m_filterNotifications, SLOT(addItem(const Item*)));
         connect(m_spawnShell, SIGNAL(delItem(const Item*)),
    	     m_filterNotifications, SLOT(delItem(const Item*)));
         connect(m_spawnShell, SIGNAL(killSpawn(const Item*, const Item*, uint16_t)),
    	     m_filterNotifications, SLOT(killSpawn(const Item*)));
         connect(m_spawnShell, SIGNAL(changeItem(const Item*, uint32_t)),
    	     m_filterNotifications, 
    	     SLOT(changeItem(const Item*, uint32_t)));
       }
    
    
       // connect interface slots to Packet signals
       m_packet->connect2("OP_TargetMouse", SP_Zone, DIR_Client|DIR_Server,
    		      "clientTargetStruct", SZC_Match,
    		      this, SLOT(clientTarget(const uint8_t*)));
    #if 0 // ZBTEMP
       connect(m_packet, SIGNAL(attack2Hand1(const uint8_t*, size_t, uint8_t)), 
    	   this, SLOT(attack2Hand1(const uint8_t*)));
    #endif
       m_packet->connect2("OP_Action2", SP_Zone, DIR_Client|DIR_Server,
    		      "action2Struct", SZC_Match,
    		      this, SLOT(action2Message(const uint8_t*)));
       m_packet->connect2("OP_Death", SP_Zone, DIR_Server,
    		      "newCorpseStruct", SZC_Match,
    		      this, SLOT(combatKillSpawn(const uint8_t*)));
    #if 0 // ZBTEMP
       connect(m_packet, SIGNAL(interruptSpellCast(const uint8_t*, size_t, uint8_t)),
    	   this, SLOT(interruptSpellCast(const uint8_t*)));
       connect(m_packet, SIGNAL(moneyUpdate(const uint8_t*, size_t, uint8_t)),
    	   this, SLOT(moneyUpdate(const uint8_t*)));
       connect(m_packet, SIGNAL(moneyThing(const uint8_t*, size_t, uint8_t)),
    	   this, SLOT(moneyThing(const uint8_t*)));
    #endif // ZBTEMP
    
    
       connect(m_packet, SIGNAL(toggle_session_tracking()),
    	   this, SLOT(toggle_net_session_tracking()));
       
       // connect EQInterface slots to ZoneMgr signals
      connect(m_zoneMgr, SIGNAL(zoneBegin(const QString&)),
    	  this, SLOT(zoneBegin(const QString&)));
      connect(m_zoneMgr, SIGNAL(zoneEnd(const QString&, const QString&)),
    	  this, SLOT(zoneEnd(const QString&, const QString&)));
      connect(m_zoneMgr, SIGNAL(zoneChanged(const QString&)),
    	  this, SLOT(zoneChanged(const QString&)));
    
    
       // connect the SpellShell slots to EQInterface signals
       connect(this, SIGNAL(spellMessage(QString&)),
    	   m_spellShell, SLOT(spellMessage(QString&)));
    
    
       // connect EQInterface slots to SpawnShell signals
       connect(m_spawnShell, SIGNAL(addItem(const Item*)),
    	   this, SLOT(addItem(const Item*)));
       connect(m_spawnShell, SIGNAL(delItem(const Item*)),
    	   this, SLOT(delItem(const Item*)));
       connect(m_spawnShell, SIGNAL(killSpawn(const Item*, const Item*, uint16_t)),
    	   this, SLOT(killSpawn(const Item*)));
       connect(m_spawnShell, SIGNAL(changeItem(const Item*, uint32_t)),
    	   this, SLOT(changeItem(const Item*)));
       connect(m_spawnShell, SIGNAL(spawnConsidered(const Item*)),
    	   this, SLOT(spawnConsidered(const Item*)));
    
    
       // connect the SpawnShell slots to Packet signals
       m_packet->connect2("OP_GroundSpawn", SP_Zone, DIR_Server,
    		      "makeDropStruct", SZC_None,
    		      m_spawnShell, SLOT(newGroundItem(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_ClickObject", SP_Zone, DIR_Server,
    		      "remDropStruct", SZC_Match,
    		      m_spawnShell, SLOT(removeGroundItem(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_SpawnDoor", SP_Zone, DIR_Server,
    		      "doorStruct", SZC_Modulus,
    		      m_spawnShell, SLOT(newDoorSpawns(const uint8_t*, size_t, uint8_t)));
    // OP_NewSpawn is deprecated in the client
    //    m_packet->connect2("OP_NewSpawn", SP_Zone, DIR_Server,
    // 		      "spawnStruct", SZC_Match,
    // 		      m_spawnShell, SLOT(newSpawn(const uint8_t*)));
       m_packet->connect2("OP_ZoneEntry", SP_Zone, DIR_Server,
                          "uint8_t", SZC_None,
    		      m_spawnShell, SLOT(zoneEntry(const uint8_t*, size_t)));
       m_packet->connect2("OP_MobUpdate", SP_Zone, DIR_Server|DIR_Client,
    		      "spawnPositionUpdate", SZC_Match,
    		      m_spawnShell, SLOT(updateSpawns(const uint8_t*)));
       m_packet->connect2("OP_WearChange", SP_Zone, DIR_Server|DIR_Client,
    		      "SpawnUpdateStruct", SZC_Match,
    		      m_spawnShell, SLOT(updateSpawnInfo(const uint8_t*)));
       m_packet->connect2("OP_HPUpdate", SP_Zone, DIR_Server|DIR_Client,
    		      "hpNpcUpdateStruct", SZC_Match,
    		      m_spawnShell, SLOT(updateNpcHP(const uint8_t*)));
       m_packet->connect2("OP_DeleteSpawn", SP_Zone, DIR_Server|DIR_Client,
                          "deleteSpawnStruct", SZC_Match,
                          m_spawnShell, SLOT(deleteSpawn(const uint8_t*)));
       m_packet->connect2("OP_SpawnRename", SP_Zone, DIR_Server,
    		      "spawnRenameStruct", SZC_Match,
    		      m_spawnShell, SLOT(renameSpawn(const uint8_t*)));
       m_packet->connect2("OP_Illusion", SP_Zone, DIR_Server|DIR_Client,
    		      "spawnIllusionStruct", SZC_Match,
    		      m_spawnShell, SLOT(illusionSpawn(const uint8_t*)));
       m_packet->connect2("OP_SpawnAppearance", SP_Zone, DIR_Server|DIR_Client,
    		      "spawnAppearanceStruct", SZC_Match,
    		      m_spawnShell, SLOT(updateSpawnAppearance(const uint8_t*)));
       m_packet->connect2("OP_Death", SP_Zone, DIR_Server,
    		      "newCorpseStruct", SZC_Match,
    		      m_spawnShell, SLOT(killSpawn(const uint8_t*)));
    //    m_packet->connect2("OP_RespawnFromHover", SP_Zone, DIR_Server|DIR_Client,
    // 		      "uint8_t", SZC_None,
    //                       m_spawnShell, SLOT(respawnFromHover(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_Shroud", SP_Zone, DIR_Server,
                          "spawnShroudSelf", SZC_None,
                          m_spawnShell, SLOT(shroudSpawn(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_RemoveSpawn", SP_Zone, DIR_Server|DIR_Client,
                          "removeSpawnStruct", SZC_None,
                          m_spawnShell, SLOT(removeSpawn(const uint8_t*, size_t, uint8_t)));
    #if 0 // ZBTEMP
       connect(m_packet, SIGNAL(spawnWearingUpdate(const uint8_t*, size_t, uint8_t)),
    	   m_spawnShell, SLOT(spawnWearingUpdate(const uint8_t*)));
    #endif
       m_packet->connect2("OP_Consider", SP_Zone, DIR_Server|DIR_Client,
    		      "considerStruct", SZC_Match,
    		      m_spawnShell, SLOT(consMessage(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_NpcMoveUpdate", SP_Zone, DIR_Server,
    		      "uint8_t", SZC_None,
    		      m_spawnShell, SLOT(npcMoveUpdate(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_ClientUpdate", SP_Zone, DIR_Server,
    		      "playerSpawnPosStruct", SZC_Match,
    		      m_spawnShell, SLOT(playerUpdate(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_CorpseLocResponse", SP_Zone, DIR_Server,
    		      "corpseLocStruct", SZC_Match,
    		      m_spawnShell, SLOT(corpseLoc(const uint8_t*)));
    #if 0 // No longer used as of 5-22-2008
       m_packet->connect2("OP_ZoneSpawns", SP_Zone, DIR_Server,
    		      "spawnStruct", SZC_None,
    		      m_spawnShell, SLOT(zoneSpawns(const uint8_t*, size_t)));
    #endif
                                
       // connect the SpellShell slots to ZoneMgr signals
       connect(m_zoneMgr, SIGNAL(zoneChanged(const QString&)),
    	   m_spellShell, SLOT(zoneChanged()));
       
       // connect the SpellShell slots to SpawnShell signals
       connect(m_spawnShell, SIGNAL(killSpawn(const Item*, const Item*, uint16_t)),
    	   m_spellShell, SLOT(killSpawn(const Item*)));
       
       // connect the SpellShell slots to Player signals
       connect(m_player, SIGNAL(newPlayer(void)),
    	   m_spellShell, SLOT(clear()));
       connect(m_player, SIGNAL(buffLoad(const spellBuff *)), 
    	   m_spellShell, SLOT(buffLoad(const spellBuff *)));
    
    
       // connect the SpellShell slots to EQPacket signals
       m_packet->connect2("OP_CastSpell", SP_Zone, DIR_Server|DIR_Client,
    		      "startCastStruct", SZC_Match,
    		      m_spellShell, SLOT(selfStartSpellCast(const uint8_t*)));
       m_packet->connect2("OP_Buff", SP_Zone, DIR_Server|DIR_Client,
    		      "buffStruct", SZC_Match,
    		      m_spellShell, SLOT(buff(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_Action", SP_Zone, DIR_Server|DIR_Client,
    		      "actionStruct", SZC_Match,
    		      m_spellShell, SLOT(action(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_Action", SP_Zone, DIR_Server|DIR_Client,
    		      "actionAltStruct", SZC_Match,
    		      m_spellShell, SLOT(action(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_SimpleMessage", SP_Zone, DIR_Server,
    		      "simpleMessageStruct", SZC_Match,
    		      m_spellShell,
    		      SLOT(simpleMessage(const uint8_t*, size_t, uint8_t)));
    
    
    
    
       // connect Player slots to EQPacket signals
       connect(m_zoneMgr, SIGNAL(playerProfile(const charProfileStruct*)),
           m_player, SLOT(player(const charProfileStruct*)));
       m_packet->connect2("OP_SkillUpdate", SP_Zone, DIR_Server,
    		      "skillIncStruct", SZC_Match,
    		      m_player, SLOT(increaseSkill(const uint8_t*)));
       m_packet->connect2("OP_ManaChange", SP_Zone, DIR_Server,
    		      "manaDecrementStruct", SZC_Match,
    		      m_player, SLOT(manaChange(const uint8_t*)));
       m_packet->connect2("OP_ClientUpdate", SP_Zone, DIR_Server|DIR_Client,
    		      "playerSelfPosStruct", SZC_Match,
    		      m_player, SLOT(playerUpdateSelf(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_ExpUpdate", SP_Zone, DIR_Server,
    		      "expUpdateStruct", SZC_Match,
    		      m_player, SLOT(updateExp(const uint8_t*)));
       m_packet->connect2("OP_AAExpUpdate", SP_Zone, DIR_Server,
    		      "altExpUpdateStruct", SZC_Match,
    		      m_player, SLOT(updateAltExp(const uint8_t*)));
       m_packet->connect2("OP_LevelUpdate", SP_Zone, DIR_Server,
    		      "levelUpUpdateStruct", SZC_Match,
    		      m_player, SLOT(updateLevel(const uint8_t*)));
       m_packet->connect2("OP_HPUpdate", SP_Zone, DIR_Server|DIR_Client,
    		      "hpNpcUpdateStruct", SZC_Match,
    		      m_player, SLOT(updateNpcHP(const uint8_t*)));
       m_packet->connect2("OP_WearChange", SP_Zone, DIR_Server|DIR_Client,
    		      "SpawnUpdateStruct", SZC_Match,
    		      m_player, SLOT(updateSpawnInfo(const uint8_t*)));
       m_packet->connect2("OP_Stamina", SP_Zone, DIR_Server,
    		      "staminaStruct", SZC_Match,
    		      m_player, SLOT(updateStamina(const uint8_t*)));
       m_packet->connect2("OP_Consider", SP_Zone, DIR_Server|DIR_Client,
    		      "considerStruct", SZC_Match,
    		      m_player, SLOT(consMessage(const uint8_t*, size_t, uint8_t)));
       m_packet->connect2("OP_SwapSpell", SP_Zone, DIR_Server,
    		      "tradeSpellBookSlotsStruct", SZC_Match,
    	   m_player, SLOT(tradeSpellBookSlots(const uint8_t*, size_t, uint8_t)));
    
    
       // interface statusbar slots
       connect (this, SIGNAL(newZoneName(const QString&)),
                m_stsbarZone, SLOT(setText(const QString&)));
       connect (m_packet, SIGNAL(stsMessage(const QString &, int)),
                this, SLOT(stsMessage(const QString &, int)));
       connect (m_spawnShell, SIGNAL(numSpawns(int)),
                this, SLOT(numSpawns(int)));
       connect (m_packet, SIGNAL(numPacket(int, int)),
                this, SLOT(numPacket(int, int)));
       connect (m_packet, SIGNAL(resetPacket(int, int)),
                this, SLOT(resetPacket(int, int)));
       connect (m_player, SIGNAL(newSpeed(double)),
                this, SLOT(newSpeed(double)));
       connect(m_player, SIGNAL(setExp(uint32_t, uint32_t, uint32_t, uint32_t, 
    				   uint32_t)),
    	   this, SLOT(setExp(uint32_t, uint32_t, uint32_t, 
    			     uint32_t, uint32_t)));
       connect(m_player, SIGNAL(newExp(uint32_t, uint32_t, uint32_t, uint32_t, 
    				   uint32_t, uint32_t)),
    	   this, SLOT(newExp(uint32_t, uint32_t, uint32_t,  
    			     uint32_t, uint32_t, uint32_t)));
       connect(m_player, SIGNAL(setAltExp(uint32_t, uint32_t, uint32_t, uint32_t)),
    	   this, SLOT(setAltExp(uint32_t, uint32_t, uint32_t, uint32_t)));
       connect(m_player, SIGNAL(newAltExp(uint32_t, uint32_t, uint32_t, uint32_t,
    				      uint32_t, uint32_t)),
    	   this, SLOT(newAltExp(uint32_t, uint32_t, uint32_t, uint32_t,
    				uint32_t, uint32_t)));
       connect(m_player, SIGNAL(levelChanged(uint8_t)),
    	   this, SLOT(levelChanged(uint8_t)));
    
    
       if (m_expWindow != 0)
       {
         // connect ExperienceWindow slots to Player signals
         connect(m_player, SIGNAL(newPlayer(void)),
    	     m_expWindow, SLOT(clear(void)));
         connect(m_player, SIGNAL(expGained(const QString &, int, long, QString )),
    	     m_expWindow, SLOT(addExpRecord(const QString &, int, long,QString )));
         
         // connect ExperienceWindow slots to EQInterface signals
         connect(this, SIGNAL(restoreFonts(void)),
    	     m_expWindow, SLOT(restoreFont(void)));
         connect(this, SIGNAL(saveAllPrefs(void)),
    	     m_expWindow, SLOT(savePrefs(void)));
       }
    
    
       if (m_combatWindow != 0)
       {
         // connect CombatWindow slots to the signals
         connect(m_player, SIGNAL(newPlayer(void)),
    	     m_combatWindow, SLOT(clear(void)));
         connect (this, SIGNAL(combatSignal(int, int, int, int, int, QString, QString)),
    	      m_combatWindow, SLOT(addCombatRecord(int, int, int, int, int, QString, QString)));
         connect (m_spawnShell, SIGNAL(spawnConsidered(const Item*)),
    	      m_combatWindow, SLOT(resetDPS()));
         connect(this, SIGNAL(restoreFonts(void)),
    	     m_combatWindow, SLOT(restoreFont(void)));
         connect(this, SIGNAL(saveAllPrefs(void)),
    	     m_combatWindow, SLOT(savePrefs(void)));
       }
    
    
       
       //
       // Geometry Configuration
       //
       
       QSize s;
       QPoint p;
    
    
    
    
       // interface components
    
    
       // set mainwindow Geometry
       section = "Interface";
       s = pSEQPrefs->getPrefSize("WindowSize", section, size());
       resize(s);
       if (pSEQPrefs->getPrefBool("UseWindowPos", section, true)) 
       {
         p = pSEQPrefs->getPrefPoint("WindowPos", section, pos());
         move(p);
       }
       show();
    
    
       QAccel *accel = new QAccel(this);
       accel->connectItem( accel->insertItem(CTRL+ALT+Key_S), this, SLOT(toggle_view_statusbar()));
       accel->connectItem( accel->insertItem(CTRL+ALT+Key_T), this, SLOT(toggle_view_menubar()));
    
    
       // load in the docking preferences if any have been saved
       QString dockPrefs = pSEQPrefs->getPrefString("DockingInfo", section, 
    						QString());
       if (!dockPrefs.isEmpty())
       {
         QTextStream ts(&dockPrefs, IO_ReadOnly);
         ts >> *this;
       }
    
    
       // Set main window title
       // TODO: Add % replacement values and a signal to update, for ip address currently
       // TODO: being monitored.
    
    
       QMainWindow::setCaption(pSEQPrefs->getPrefString("Caption", section, 
    						    "ShowEQ - Main (ctrl+alt+t to toggle menubar)"));
    
    
       // load the format strings for display
       loadFormatStrings();
    
    
       /* Start the packet capturing */
       m_packet->start (10);
    }// end constructor
    ////////////////////
    
    
    EQInterface::~EQInterface()
    {
      if (m_netDiag != 0)
        delete m_netDiag;
    
    
      if (m_spawnPointList != 0)
        delete m_spawnPointList;
    
    
      if (m_statList != 0)
        delete m_statList;
    
    
      if (m_guildListWindow != 0)
        delete m_guildListWindow;
    
    
      if (m_skillList != 0)
        delete m_skillList;
    
    
      if (m_spellList != 0)
        delete m_spellList;
    
    
      if (m_spawnList2 != 0)
        delete m_spawnList2;
    
    
      if (m_spawnList != 0)
        delete m_spawnList;
    
    
      for (int i = 0; i < maxNumMaps; i++)
        if (m_map[i] != 0)
          delete m_map[i];
    
    
      for (int i = 0; i < maxNumMessageWindows; i++)
        if (m_messageWindow[i] != 0)
          delete m_messageWindow[i];
    
    
      if (m_combatWindow != 0)
        delete m_combatWindow;
    
    
      if (m_expWindow != 0)
        delete m_expWindow;
    
    
      if (m_spawnLogger != 0)
        delete m_spawnLogger;
    
    
      if (m_spawnMonitor != 0)
        delete m_spawnMonitor;
    
    
      if (m_groupMgr != 0)
        delete m_groupMgr;
    
    
      if (m_spellShell != 0)
        delete m_spellShell;
      
      if (m_spells != 0)
        delete m_spells;
    
    
      if (m_mapMgr != 0)
        delete m_mapMgr;
    
    
      if (m_spawnShell != 0)
        delete m_spawnShell;
    
    
      if (m_categoryMgr != 0)
        delete m_categoryMgr;
    
    
      if (m_filterMgr != 0)
        delete m_filterMgr;
    
    
      if (m_dateTimeMgr != 0)
        delete m_dateTimeMgr;
    
    
      if (m_eqStrings != 0)
        delete m_eqStrings;
    
    
      if (m_player != 0)
        delete m_player;
    
    
      if (m_guildShell != 0)
        delete m_guildShell;
    
    
      if (m_zoneMgr != 0)
        delete m_zoneMgr;
      
      if (m_packet != 0)
        delete m_packet;
    }
    
    
    void EQInterface::restoreStatusFont()
    {
       QFont defFont;
       defFont.setPointSize(8);
       QFont statusFont = pSEQPrefs->getPrefFont("StatusFont", "Interface", 
    					     defFont);
    				  
       int statusFixedHeight = statusFont.pointSize() + 6;
    
    
       // set the correct font information and sizes of the status bar widgets
       m_stsbarStatus->setFont(statusFont);
       m_stsbarStatus->setFixedHeight(statusFixedHeight);
       m_stsbarZone->setFont(statusFont);
       m_stsbarZone->setFixedHeight(statusFixedHeight);
       m_stsbarSpawns->setFont(statusFont);
       m_stsbarSpawns->setFixedHeight(statusFixedHeight);
       m_stsbarExp->setFont(statusFont);
       m_stsbarExp->setFixedHeight(statusFixedHeight);
       m_stsbarExpAA->setFont(statusFont);
       m_stsbarExpAA->setFixedHeight(statusFixedHeight);
       m_stsbarPkt->setFont(statusFont);
       m_stsbarPkt->setFixedHeight(statusFixedHeight);
       m_stsbarEQTime->setFont(statusFont);
       m_stsbarEQTime->setFixedHeight(statusFixedHeight);
       m_stsbarSpeed->setFont(statusFont);
       m_stsbarSpeed->setFixedHeight(statusFixedHeight);
       // ZEM code
       m_stsbarZEM->setFont(statusFont);
       m_stsbarZEM->setFixedHeight(statusFixedHeight);
    }
    
    
    void EQInterface::toggle_view_StatWin( int id )
    {
       int statnum;
    
    
       statnum = m_statWinMenu->itemParameter(id);
    
    
       if (m_statWinMenu->isItemChecked(id))
       {
           m_statWinMenu->setItemChecked(id, FALSE);
           if (m_statList != 0)
    	 m_statList->statList()->enableStat(statnum, false);
       }
       else
       {
           m_statWinMenu->setItemChecked(id, TRUE);
           if (m_statList != 0)
    	 m_statList->statList()->enableStat(statnum, true);
       }
    }
    
    
    void EQInterface::toggle_view_SkillWin( int id )
    {
      int skillnum;
    
    
      skillnum = m_skillWinMenu->itemParameter(id);
    
    
      if (m_skillWinMenu->isItemChecked(id))
      {
        m_skillWinMenu->setItemChecked(id, FALSE);
    
    
        if ((id == m_id_view_PlayerSkills_Languages) &&
    	(m_skillList != 0))
          m_skillList->skillList()->showLanguages(false);
       }
       else
       {
           m_skillWinMenu->setItemChecked(id, TRUE);
    
    
        if ((id == m_id_view_PlayerSkills_Languages) &&
    	(m_skillList != 0))
          m_skillList->skillList()->showLanguages(true);
       }
    }
    
    
    void EQInterface::toggle_view_SpawnListCol( int id )
    {
      int colnum;
    
    
      colnum = m_spawnListMenu->itemParameter(id);
      
      if (m_spawnListMenu->isItemChecked(id))
      {
        m_spawnListMenu->setItemChecked(id, FALSE);
        
        if (m_spawnList != 0)
          m_spawnList->spawnList()->setColumnVisible(colnum, false);
      }
      else
      {
        m_spawnListMenu->setItemChecked(id, TRUE);
        
        if (m_spawnList != 0)
          m_spawnList->spawnList()->setColumnVisible(colnum, true);
       }
    }
    
    
    void EQInterface::toggle_view_DockedWin( int id )
    {
      SEQWindow* widget = 0;
      int winnum;
      QString preference;
    
    
      // get the window number parameter
      winnum = m_dockedWinMenu->itemParameter(id);
    
    
      // get the current menu item state
      bool checked = m_dockedWinMenu->isItemChecked(id);
    
    
      // flip the menu item state
      m_dockedWinMenu->setItemChecked(id, !checked);
    
    
      switch(winnum)
      {
      case 0: // Spawn List
        // note the new setting
        m_isSpawnListDocked = !checked;
    
    
        // reparent the Spawn List
        widget = m_spawnList;
    
    
        // preference
        preference = "DockedSpawnList";
        break;
      case 1: // Player Stats
        // note the new setting
        m_isStatListDocked = !checked;
    
    
        // reparent the Stat List
        widget = m_statList;
    
    
        // preference
        preference = "DockedPlayerStats";
        break;
      case 2: // Player Skills
        // note the new setting
        m_isSkillListDocked = !checked;
        
        // reparent the Skill List
        widget = m_skillList;
    
    
        // preference
        preference = "DockedPlayerSkills";
        break;
      case 3: // Spell List
        // note the new setting
        m_isSpellListDocked = !checked;
        
        // reparent the Skill List
        widget = m_spellList;
    
    
        // preference
        preference = "DockedSpellList";
        break;
      case 4: // Compass
        // note the new setting
        m_isCompassDocked = !checked;
        
        // reparent the Skill List
        widget = m_compass;
    
    
        // preference
        preference = "DockedCompass";
        break;
      case 5: // Spawn Point List
        // note the new setting
        m_isSpawnPointListDocked = !checked;
    
    
        // reparent the Spawn List
        widget = m_spawnPointList;
    
    
        // preference
        preference = "DockedSpawnPointList";
        break;
      case 6: // Spawn List 2
        // note the new setting
        m_isSpawnList2Docked = !checked;
    
    
        // reparent the Spawn List
        widget = m_spawnList2;
    
    
        // preference
        preference = "DockedSpawnList2";
        break;
      default:
        // use default for maps since the number of them can be changed via a 
        // constant (maxNumMaps)
        if ((winnum >= mapDockBase) && (winnum < (mapDockBase + maxNumMaps)))
        {
          int i = winnum - mapDockBase;
    
    
          // note the new setting
          m_isMapDocked[i] = !checked;
          
          // reparent teh appropriate map
          widget = m_map[i];
    
    
          QString tmpPrefSuffix = "";
          if (i > 0)
    	tmpPrefSuffix = QString::number(i + 1);
    
    
          // preference
          preference = "DockedMap" + tmpPrefSuffix;
        }
    
    
        break;
        };
    
    
      // save new setting
      pSEQPrefs->setPrefBool(preference, "Interface", !checked);
    
    
      // attempt to undock the window
      if (widget)
      {
        if (checked)
          widget->undock();
        else
          widget->dock();
    
    
        // make the widget update it's geometry
        widget->updateGeometry();
      }
    }
    
    
    
    
    void EQInterface::toggle_view_DockableWin( int id )
    {
      SEQWindow* widget = 0;
      int winnum;
      QString preference;
    
    
      // get the window number parameter
      winnum = m_dockableWinMenu->itemParameter(id);
    
    
      // get the current menu item state
      bool dockable = !m_dockableWinMenu->isItemChecked(id);
    
    
      // flip the menu item state
      m_dockableWinMenu->setItemChecked(id, dockable);
    
    
      switch(winnum)
      {
      case 0: // Spawn List
        widget = m_spawnList;
    
    
        // preference
        preference = "DockableSpawnList";
        break;
      case 1: // Player Stats
        widget = m_statList;
    
    
        // preference
        preference = "DockablePlayerStats";
        break;
      case 2: // Player Skills
        widget = m_skillList;
    
    
        // preference
        preference = "DockablePlayerSkills";
        break;
      case 3: // Spell List
        widget = m_spellList;
    
    
        // preference
        preference = "DockableSpellList";
        break;
      case 4: // Compass
        widget = m_compass;
    
    
        // preference
        preference = "DockableCompass";
        break;
      case 5: // Spawn Point List
        widget = m_spawnPointList;
    
    
        // preference
        preference = "DockableSpawnPointList";
        break;
      case 6: // Spawn List 2
        widget = m_spawnList2;
    
    
        // preference
        preference = "DockableSpawnList2";
        break;
      case 7: // Experience Window
        widget = m_expWindow;
    
    
        preference = "DockableExperienceWindow";
        break;
      case 8: // Combat Window
        widget = m_combatWindow;
    
    
        preference = "DockableCombatWindow";
        break;
      case 9: // Guild List Window
        widget = m_guildListWindow;
    
    
        preference = "DockableGuildListWindow";
        break;
      case 10: // NetDiag
        widget = m_netDiag;
        
        preference = "DockableNetDiag";
        break;
      default:
        // use default for maps since the number of them can be changed via a 
        // constant (maxNumMaps)
        if ((winnum >= mapDockBase) && (winnum < (mapDockBase + maxNumMaps)))
        {
          int i = winnum - mapDockBase;
    
    
          // reparent teh appropriate map
          widget = m_map[i];
    
    
          QString tmpPrefSuffix = "";
          if (i > 0)
    	tmpPrefSuffix = QString::number(i + 1);
    
    
          // preference
          preference = "DockableMap" + tmpPrefSuffix;
        }
        else if ((winnum >= messageWindowDockBase) && 
    	     (winnum < (messageWindowDockBase + maxNumMessageWindows)))
        {
          int i = winnum - messageWindowDockBase;
    
    
          // reparent teh appropriate map
          widget = m_messageWindow[i];
    
    
          QString tmpPrefSuffix = "";
          tmpPrefSuffix = QString::number(i);
    
    
          // preference
          preference = "DockableMessageWindow" + tmpPrefSuffix;
        }
    
    
        break;
        };
    
    
      // save new setting
      pSEQPrefs->setPrefBool(preference, "Interface", dockable);
    
    
      // attempt to undock the window
      if (widget)
        setDockEnabled(widget, dockable);
    }
    
    
    void EQInterface::set_main_WindowCaption( int id )
    {
      QWidget* widget = 0;
      int winnum;
      QString window;
    
    
      // get the window number parameter
      winnum = menuBar()->itemParameter(id);
    
    
      switch(winnum)
      {
      case 0: // Spawn List
        widget = m_spawnList;
    
    
        window = "Spawn List";
        break;
      case 1: // Player Stats
        widget = m_statList;
    
    
        window = "Player Stats";
        break;
      case 2: // Player Skills
        widget = m_skillList;
    
    
        window = "Player Skills";
        break;
      case 3: // Spell List
        widget = m_spellList;
    
    
        window = "Spell List";
        break;
      case 4: // Compass
        widget = m_compass;
    
    
        window = "Compass";
        break;
      case 5: // Interface
        widget = this;
    
    
        window = "Main Window";
        break;
      case 6: // Experience Window
        widget = m_expWindow;
    
    
        window = "Experience Window";
        break;
      case 7: // Combat Window
        widget = m_combatWindow;
    
    
        window = "Combat Window";
        break;
      case 8: // Network Diagnostics
        widget = m_netDiag;
    
    
        window = "Network Diagnostics";
        break;
      case 9: // Spawn Point List
        widget = m_spawnPointList;
    
    
        window = "Spawn Point List";
      case 10: // Spawn List
        widget = m_spawnList2;
    
    
        window = "Spawn List 2";
        break;
      default:
        // use default for maps since the number of them can be changed via a 
        // constant (maxNumMaps)
        if ((winnum >= mapCaptionBase) && (winnum < (mapCaptionBase + maxNumMaps)))
        {
          int i = winnum - mapCaptionBase;
    
    
          widget = m_map[i];
        }
    
    
        break;
      };
    
    
      // attempt to undock the window
      if (widget != 0)
      {
        bool ok = false;
        QString caption = 
          QInputDialog::getText("ShowEQ " + window + "Caption",
    			    "Enter caption for the " + window + ":",
    			    QLineEdit::Normal, widget->caption(),
    			    &ok, this);
    					    
        // if the user entered a caption and clicked ok, set the windows caption
        if (ok)
          widget->setCaption(caption);
      }
    }
    
    
    
    
    void EQInterface::set_main_WindowFont( int id )
    {
      int winnum;
    
    
      // get the window number parameter
      winnum = menuBar()->itemParameter(id);
    
    
      bool ok = false;
      QFont newFont;
      SEQWindow* window = 0;
      QString title;
      
      //
      // NOTE: Yeah, this sucks for now, but until the architecture gets cleaned
      // up it will have to do
      switch(winnum)
      {
      case 0: // Spawn List
        title = "Spawn List";
        
        window = m_spawnList;
        break;
      case 1: // Player Stats
        title = "Player Stats";
        
        window = m_statList;
        break;
      case 2: // Player Skills
        title = "Player Skills";
    
    
        window = m_skillList;
        break;
      case 3: // Spell List
        title = "Spell List";
        
        window = m_spellList;
        break;
      case 4: // Compass
        title = "Compass";
        
        window = m_compass;
        break;
      case 5: // Interface
        // window = "Main Window";
        break;
      case 6: // Experience Window
        title = "Experience Window";
        
        window = m_expWindow;
        break;
      case 7: // Combat Window
        title = "Combat Window";
    
    
        window = m_combatWindow;
        break;
      case 8: // Network Diagnostics
        title = "Network Diagnostics";
    
    
        window = m_netDiag;
        break;
      case 9: // Spawn Point List
        title = "Spawn Point List";
    
    
        window = m_spawnPointList;
      case 10: // Spawn List
        title = "Spawn List 2";
        
        window = m_spawnList2;
        break;
      default:
        // use default for maps since the number of them can be changed via a 
        // constant (maxNumMaps)
        if ((winnum >= mapCaptionBase) && (winnum < (mapCaptionBase + maxNumMaps)))
        {
          int i = winnum - mapCaptionBase;
          if (i)
    	title.sprintf("Map %d", i);
          else
    	title = "Map";
    
    
          window = m_map[i];
        }
        break;
      };
    
    
      if (window != 0)
      {
        // get a new font
        newFont = QFontDialog::getFont(&ok, window->font(), 
    				   this, "ShowEQ " + title + " Font");
        
        
        // if the user entered a font and clicked ok, set the windows font
        if (ok)
          window->setWindowFont(newFont);
      }
    }
    
    
    void EQInterface::set_main_Font(int id)
    {
      QString name = "ShowEQ - Application Font";
      bool ok = false;
    
    
      // get a new application font
      QFont newFont;
      newFont = QFontDialog::getFont(&ok, QApplication::font(), 
    				 this, name);
    
    
      // if the user clicked ok and selected a valid font, set it
      if (ok)
      {
        // set the new application font
        qApp->setFont( newFont, true );
    
    
        // set the preference for future sessions
        pSEQPrefs->setPrefFont("Font", "Interface", 
    			   newFont);
    
    
        // make sure the windows that override the application font, do so
        emit restoreFonts();
      }
    }
    
    
    
    
    void EQInterface::select_main_FormatFile(int id)
    {
      QString formatFile = pSEQPrefs->getPrefString("FormatFile", "Interface", 
    						"eqstr_us.txt");
    
    
      QFileInfo fileInfo = m_dataLocationMgr->findExistingFile(".", formatFile);
    
    
      QString newFormatFile = 
        QFileDialog::getOpenFileName(fileInfo.absFilePath(), "*.txt", 
    				 this, "FormatFile", "Select Format File");
    
    
      // if the newFormatFile name is not empty, then the user selected a file
      if (!newFormatFile.isEmpty())
      {
        // set the new format file to use
        pSEQPrefs->setPrefString("FormatFile", "Interface", newFormatFile);
    			     
        // reload the format strings
        loadFormatStrings();
      }
    }
    
    
    void EQInterface::select_main_SpellsFile(int id)
    {
      QString spellsFile = pSEQPrefs->getPrefString("SpellsFile", "Interface", 
    						"spells_us.txt");
    
    
      QFileInfo fileInfo = m_dataLocationMgr->findExistingFile(".", spellsFile);
    
    
      QString newSpellsFile = 
        QFileDialog::getOpenFileName(fileInfo.absFilePath(), "*.txt", 
    				 this, "FormatFile", "Select Format File");
    
    
      // if the newFormatFile name is not empty, then the user selected a file
      if (!newSpellsFile.isEmpty())
      {
        // set the new format file to use
        pSEQPrefs->setPrefString("SpellsFile", "Interface", newSpellsFile);
    
    
        // reload the spells
        m_spells->loadSpells(newSpellsFile);
      }
    }
    
    
    void EQInterface::toggle_main_statusbar_Window(int id)
    {
      QWidget* window = 0;
      QString preference;
    
    
      switch (menuBar()->itemParameter(id))
      {
      case 1:
        window = m_stsbarStatus;
    
    
        preference = "ShowStatus";
        break;
      case 2:
        window = m_stsbarZone;
    
    
        preference = "ShowZone";
        break;
      case 3:
        window = m_stsbarSpawns;
    
    
        preference = "ShowSpawns";
        break;
      case 4:
        window = m_stsbarExp;
    
    
        preference = "ShowExp";
        break;
      case 5:
        window = m_stsbarExpAA;
    
    
        preference = "ShowExpAA";
        break;
      case 6:
        window = m_stsbarPkt;
    
    
        preference = "ShowPacketCounter";
        break;
      case 7:
        window = m_stsbarEQTime;
    
    
        preference = "ShowEQTime";
        break;
      case 8:
        window = m_stsbarSpeed;
    
    
        preference = "ShowSpeed";
        break;
      // ZEM code
      case 9:
        window = m_stsbarZEM;
    
    
        preference = "ShowZEM";
        break;
    
    
      default:
        return;
      }
    
    
      if (window == 0)
        return;
    
    
      // should the window be visible
      bool show = !window->isVisible();
    
    
      // show or hide the window as necessary
      if (show)
        window->show();
      else
        window->hide();
    
    
      // check/uncheck the menu item
      menuBar()->setItemChecked(id, show); 
    
    
      // set the preference for future sessions
      pSEQPrefs->setPrefBool(preference, "Interface_StatusBar", show);
    }
    
    
    void EQInterface::set_main_statusbar_Font(int id)
    {
      QString name = "ShowEQ - Status Font";
      bool ok = false;
    
    
      // setup a default new status font
      QFont newFont = QApplication::font();
      newFont.setPointSize(8);
    
    
      // get new status font
      newFont = QFontDialog::getFont(&ok, 
    				 pSEQPrefs->getPrefFont("StatusFont",
    							"Interface",
    							newFont),
    				 this, name);
    
    
      // if the user clicked ok and selected a valid font, set it
      if (ok)
      {
        // set the preference for future sessions
        pSEQPrefs->setPrefFont("StatusFont", "Interface", 
    			   newFont);
    
    
        // make sure to reset the status font since the previous call may have 
        // changed it
        restoreStatusFont();
      }
    }
    
    
    void
    EQInterface::toggle_main_SavePosition (int id)
    {
        pSEQPrefs->setPrefBool("SavePosition", "Interface", 
    			   !pSEQPrefs->getPrefBool("SavePosition", 
    						   "Interface"));
    
    
        m_windowMenu->setItemChecked(id, pSEQPrefs->getPrefBool("SavePosition", 
    							 "Interface"));
    }
    
    
    void
    EQInterface::toggle_main_UseWindowPos (int id)
    {
        pSEQPrefs->setPrefBool("UseWindowPos", "Interface", 
    			   !pSEQPrefs->getPrefBool("UseWindowPos", 
    						   "Interface"));
        m_windowMenu->setItemChecked(id, pSEQPrefs->getPrefBool("UseWindowPos", 
    							 "Interface"));
    }
    
    
    //
    // save prefs
    //
    void
    EQInterface::savePrefs(void)
    {
      seqDebug("==> EQInterface::savePrefs()");
       
       if( isVisible() ) 
       {
         seqDebug("\tisVisible()");
         QString section;
         QString interfaceSection = "Interface";
         QString tempStr;
    
    
         QString dockPrefs;
         QTextStream ts(&dockPrefs, IO_WriteOnly);
    
    
         ts << *this;
    
    
         pSEQPrefs->setPrefString("DockingInfo", interfaceSection, dockPrefs);
    
    
         // send savePrefs signal out
         emit saveAllPrefs();
         
         section = "Interface";
         if (pSEQPrefs->getPrefBool("SavePosition", interfaceSection, true)) 
         {
           pSEQPrefs->setPrefPoint("WindowPos", section, 
    			       topLevelWidget()->pos());
           pSEQPrefs->setPrefSize("WindowSize", section, 
    			      topLevelWidget()->size());
         }
         
         // save prefs to file
         pSEQPrefs->save();
       }
    } // end savePrefs
    
    
    void EQInterface::saveDockAreaPrefs(QDockArea* a, Dock edge)
    {
      QPtrList<QDockWindow> l = a->dockWindowList();
      for (QDockWindow *dw = l.first(); dw; dw = l.next())
      {
        if (dw->inherits("SEQWindow"))
          pSEQPrefs->setPrefInt("Dock", ((SEQWindow*)dw)->preferenceName(), edge);
      }
    }
    
    
    
    
    void EQInterface::setCaption(const QString& text)
    {
      QMainWindow::setCaption(text);
    
    
      pSEQPrefs->setPrefString("Caption", "Interface", caption());
    }
    
    
    
    
    void EQInterface::loadFormatStrings()
    {
      // get the name of the format file
      QString formatFileName = pSEQPrefs->getPrefString("FormatFile", "Interface", 
    						    "eqstr_us.txt");
    
    
      QFileInfo fileInfo = m_dataLocationMgr->findExistingFile(".", 
    							   formatFileName);
    
    
      // load the strings
      m_eqStrings->load(fileInfo.absFilePath());
    }
    
    
    void
    EQInterface::select_filter_file(void)
    {
      QString filterFile = QFileDialog::getOpenFileName(m_filterMgr->filterFile(),
                                                         QString("ShowEQ Filter Files (*.xml)"),
                                                         0,
                                                         "Select Filter Config..."
                                                       );
      if (!filterFile.isEmpty())
        m_filterMgr->loadFilters(filterFile);
    }
    
    
    void EQInterface::toggle_filter_Case(int id)
    {
      m_filterMgr->setCaseSensitive(!m_filterMgr->caseSensitive());
      menuBar()->setItemChecked(id, m_filterMgr->caseSensitive());
      pSEQPrefs->setPrefBool("IsCaseSensitive", "Filters", 
    			 m_filterMgr->caseSensitive());
    }
    
    
    void EQInterface::toggle_filter_AlertInfo(int id)
    {
      pSEQPrefs->setPrefBool("AlertInfo", "Filters", 
    			 !pSEQPrefs->getPrefBool("AlertInfo", "Filters"));
      menuBar()->setItemChecked(id, 
    			    pSEQPrefs->getPrefBool("AlertInfo", "Filters"));
    }
    
    
    void EQInterface::toggle_filter_UseSystemBeep(int id)
    {
      m_filterNotifications->setUseSystemBeep(!m_filterNotifications->useSystemBeep());
      menuBar()->setItemChecked(id, m_filterNotifications->useSystemBeep());
    }
    
    
    void EQInterface::toggle_filter_UseCommands(int id)
    {
      m_filterNotifications->setUseCommands(!m_filterNotifications->useCommands());
      menuBar()->setItemChecked(id, m_filterNotifications->useCommands());
    }
    
    
    void EQInterface::toggle_filter_Log(int id)
    {
      if (!m_filteredSpawnLog)
        createFilteredSpawnLog();
    
    
      uint32_t filters = m_filteredSpawnLog->filters();
      uint32_t filter = menuBar()->itemParameter(id);
      
      if (filters & filter)
        filters &= ~filter;
      else
        filters |= filter;
    
    
      m_filteredSpawnLog->setFilters(filters);
    
    
      menuBar()->setItemChecked(id, ((filters & filter) != 0));
      pSEQPrefs->setPrefBool("Log", "Filters", filters);
    }
    
    
    void EQInterface::set_filter_AudioCommand(int id)
    {
      QString property;
      QString prettyName;
      switch(menuBar()->itemParameter(id))
      {
      case 1:
        property = "SpawnAudioCommand";
        prettyName = "Spawn";
        break;
      case 2:
        property = "DeSpawnAudioCommand";
        prettyName = "DeSpawn";
        break;
      case 3:
        property = "DeathAudioCommand";
        prettyName = "Death";
        break;
      case 4:
        property = "LocateSpawnAudioCommand";
        prettyName = "Locate Spawn";
        break;
      case 5:
        property = "CautionSpawnAudioCommand";
        prettyName = "Caution Spawn";
        break;
      case 6:
        property = "HuntSpawnAudioCommand";
        prettyName = "Hunt Spawn";
        break;
      case 7:
        property = "DangerSpawnAudioCommand";
        prettyName = "Danger Spawn";
        break;
      default: 
        return;
      }
    
    
      QString value = pSEQPrefs->getPrefString(property, "Filters",
    					   "/usr/bin/esdplay " PKGDATADIR "/spawn.wav &");
    
    
      bool ok = false;
      QString command = 
        QInputDialog::getText("ShowEQ " + prettyName + "Command",
    			  "Enter command line to use for " + prettyName + "'s:",
    			  QLineEdit::Normal, value,
    			  &ok, this);
    
    
      if (ok)
        pSEQPrefs->setPrefString(property, "Filters", command);
    }
    
    
    void EQInterface::listSpawns (void)
    {
    #ifdef DEBUG
      debug ("listSpawns()");
    #endif /* DEBUG */
    
    
      QString outText;
    
    
      // open the output data stream
      QTextStream out(&outText, IO_WriteOnly);
      
       // dump the spawns 
      m_spawnShell->dumpSpawns(tSpawn, out);
    
    
      seqInfo((const char*)outText);
    }
    
    
    void EQInterface::listDrops (void)
    {
    #ifdef DEBUG
      debug ("listDrops()");
    #endif /* DEBUG */
      QString outText;
    
    
      // open the output data stream
      QTextStream out(&outText, IO_WriteOnly);
    
    
      // dump the drops
      m_spawnShell->dumpSpawns(tDrop, out);
    
    
      seqInfo((const char*)outText);
    }
    
    
    void EQInterface::listMapInfo(void)
    {
    #ifdef DEBUG
      debug ("listMapInfo()");
    #endif /* DEBUG */
      QString outText;
    
    
      // open the output data stream
      QTextStream out(&outText, IO_WriteOnly);
    
    
      // dump map managers info
      m_mapMgr->dumpInfo(out);
    
    
      // iterate over all the maps
      for (int i = 0; i < maxNumMaps; i++)
      {
        // if this map has been instantiated, dump it's info
        if (m_map[i] != 0)
          m_map[i]->dumpInfo(out);
      }
    
    
      seqInfo((const char*)outText);
    }
    
    
    void EQInterface::listInterfaceInfo(void)
    {
    #ifdef DEBUG
      debug ("listMapInfo()");
    #endif /* DEBUG */
    
    
      QString outText;
    
    
      // open the output data stream
      QTextStream out(&outText, IO_WriteOnly);
    
    
      out << "Map window layout info:" << endl;
      out << "-----------------------" << endl;
      out << *this;
      out << "-----------------------" << endl;
    
    
    
    
      seqInfo((const char*)outText);
    }
    
    
    void EQInterface::listGroup(void)
    {
    #ifdef DEBUG
      debug ("listGroup()");
    #endif /* DEBUG */
      QString outText;
    
    
      // open the output data stream
      QTextStream out(&outText, IO_WriteOnly);
    
    
      // dump the drops
      m_groupMgr->dumpInfo(out);
    
    
      seqInfo((const char*)outText);
    }
    
    
    
    
    void EQInterface::listGuild(void)
    {
    #ifdef DEBUG
      debug ("listGuild()");
    #endif /* DEBUG */
      QString outText;
    
    
      // open the output data stream
      QTextStream out(&outText, IO_WriteOnly);
    
    
      // dump the drops
      m_guildShell->dumpMembers(out);
    
    
      seqInfo((const char*)outText);
    }
    
    
    void EQInterface::dumpSpawns (void)
    {
    #ifdef DEBUG
      debug ("dumpSpawns()");
    #endif /* DEBUG */
      
      QString logFile = pSEQPrefs->getPrefString("DumpSpawnsFilename", "Interface",
    					     "dumpspawns.txt");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
    
    
      // open the output data stream
      QFile file(logFileInfo.absFilePath());
      file.open(IO_WriteOnly);
      QTextStream out(&file);
      
      // dump the spawns 
      m_spawnShell->dumpSpawns(tSpawn, out);
    }
    
    
    void EQInterface::dumpDrops (void)
    {
    #ifdef DEBUG
      debug ("dumpDrops()");
    #endif /* DEBUG */
    
    
      QString logFile = pSEQPrefs->getPrefString("DumpDropsFilename", "Interface",
    					     "dumpdrops.txt");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
    
    
      // open the output data stream
      QFile file(logFileInfo.absFilePath());
      file.open(IO_WriteOnly);
      QTextStream out(&file);
    
    
      // dump the drops
      m_spawnShell->dumpSpawns(tDrop, out);
    }
    
    
    void EQInterface::dumpMapInfo(void)
    {
    #ifdef DEBUG
      debug ("dumpMapInfo()");
    #endif /* DEBUG */
    
    
      QString logFile = pSEQPrefs->getPrefString("DumpMapInfoFilename", 
    					     "Interface",
    					     "mapinfo.txt");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
    
    
      // open the output data stream
      QFile file(logFileInfo.absFilePath());
      file.open(IO_WriteOnly);
      QTextStream out(&file);
    
    
      // dump map managers info
      m_mapMgr->dumpInfo(out);
    
    
      // iterate over all the maps
      for (int i = 0; i < maxNumMaps; i++)
      {
        // if this map has been instantiated, dump it's info
        if (m_map[i] != 0)
          m_map[i]->dumpInfo(out);
      }
    }
    
    
    void EQInterface::dumpGuildInfo(void)
    {
      QString logFile = pSEQPrefs->getPrefString("GuildsDumpFile", 
    					     "Interface", 
    					     "guilds.txt");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
    
    
      emit guildList2text(logFileInfo.absFilePath());
    }
    
    
    void EQInterface::dumpSpellBook(void)
    {
    #ifdef DEBUG
      debug ("dumpSpellBook");
    #endif /* DEBUG */
    
    
      QString logFile = pSEQPrefs->getPrefString("DumpSpellBookFilename", 
    					     "Interface", 
    					     "spellbook.txt");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
    
    
      // open the output data stream
      QFile file(logFileInfo.absFilePath());
      file.open(IO_WriteOnly);
      QTextStream out(&file);
      QString txt;
    
    
      seqInfo("Dumping Spell Book to '%s'\n", 
    	  (const char*)file.name().utf8());
      out << "Spellbook of " << m_player->name() << " a level " 
          << m_player->level() << " " << m_player->raceString() 
          << " " << m_player->classString()
          << endl;
    
    
      uint8_t playerClass = m_player->classVal();
    
    
      uint32_t spellid;
      for (uint32_t i = 0; i < MAX_SPELLBOOK_SLOTS; i++)
      {
        spellid = m_player->getSpellBookSlot(i);
        if (spellid == 0xffffffff)
          continue;
    
    
        const Spell* spell = m_spells->spell(spellid);
    
    
        QString spellName;
    
    
        if (spell)
        {
          txt.sprintf("%.3d %.2d %.2d %#4.04x %02d\t%s", 
    		  i, ((i / 8) + 1), ((i % 8) + 1), 
    		  spellid, spell->level(playerClass),
    		  spell->name().latin1());
        }
        else
        {
          txt.sprintf("%.3d %.2d %.2d %#4.04x   \t%s", 
    		  i, ((i / 8) + 1), ((i % 8) + 1), 
    		  spellid, 
    		  spell_name(spellid).latin1());
        }
    
    
        out << txt << endl;
      }
    }
    
    
    void EQInterface::dumpGroup(void)
    {
    #ifdef DEBUG
      debug ("dumpGroup()");
    #endif /* DEBUG */
    
    
      QString logFile = pSEQPrefs->getPrefString("DumpGroupFilename", "Interface",
    					     "dumpgroup.txt");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
    
    
      // open the output data stream
      QFile file(logFileInfo.absFilePath());
      file.open(IO_WriteOnly);
      QTextStream out(&file);
    
    
      // dump the drops
      m_groupMgr->dumpInfo(out);
    }
    
    
    void EQInterface::dumpGuild(void)
    {
    #ifdef DEBUG
      debug ("dumpGuild()");
    #endif /* DEBUG */
    
    
      QString logFile = pSEQPrefs->getPrefString("DumpGuildFilename", "Interface",
    					     "dumpguild.txt");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("dumps", logFile);
    
    
      // open the output data stream
      QFile file(logFileInfo.absFilePath());
      file.open(IO_WriteOnly);
      QTextStream out(&file);
    
    
      // dump the drops
      m_guildShell->dumpMembers(out);
    }
    
    
    void
    EQInterface::launch_editor_filters(void)
    {
      EditorWindow * ew = new EditorWindow(m_filterMgr->filterFile());
      ew->setCaption(m_filterMgr->filterFile());
      ew->show();
    }
    
    
    void
    EQInterface::launch_editor_zoneFilters(void)
    {
      EditorWindow * ew = new EditorWindow(m_filterMgr->zoneFilterFile());
      ew->setCaption(m_filterMgr->zoneFilterFile());
      ew->show();
    }
    
    
    void
    EQInterface::toggle_opt_ConSelect (void)
    {
      m_selectOnConsider = !(m_selectOnConsider);
      menuBar()->setItemChecked (m_id_opt_ConSelect, m_selectOnConsider);
      pSEQPrefs->setPrefBool("SelectOnCon", "Interface", m_selectOnConsider);
    }
    
    
    void
    EQInterface::toggle_opt_TarSelect (void)
    {
      m_selectOnTarget = !(m_selectOnTarget);
      menuBar()->setItemChecked (m_id_opt_TarSelect, m_selectOnTarget);
      pSEQPrefs->setPrefBool("SelectOnTarget", "Interface", m_selectOnTarget);
    }
    
    
    void
    EQInterface::toggle_opt_Fast (void)
    {
      showeq_params->fast_machine = !(showeq_params->fast_machine);
      menuBar()->setItemChecked (m_id_opt_Fast, showeq_params->fast_machine);
      pSEQPrefs->setPrefBool("FastMachine", "Misc", showeq_params->fast_machine);
    }
    
    
    void
    EQInterface::toggle_opt_KeepSelectedVisible (void)
    {
      showeq_params->keep_selected_visible = !(showeq_params->keep_selected_visible);
      menuBar()->setItemChecked (m_id_opt_KeepSelectedVisible, showeq_params->keep_selected_visible);
      pSEQPrefs->setPrefBool("KeepSelected", "Interface", showeq_params->keep_selected_visible);
    }
    
    
    void
    EQInterface::toggle_opt_UseUpdateRadius (void)
    {
      showeq_params->useUpdateRadius = !(showeq_params->useUpdateRadius);
      menuBar()->setItemChecked (m_id_opt_useUpdateRadius, showeq_params->useUpdateRadius);
      pSEQPrefs->setPrefBool("UseUpdateRadius", "Interface", showeq_params->useUpdateRadius);
    }
    
    
    /* Check and uncheck Log menu options & set EQPacket logging flags */
    void EQInterface::toggle_log_AllPackets (void)
    {
      if (m_globalLog)
      {
        delete m_globalLog;
        m_globalLog = 0;
      }
      else
        createGlobalLog();
    
    
      bool state = (m_globalLog != 0);
      menuBar()->setItemChecked (m_id_log_AllPackets, state);
      pSEQPrefs->setPrefBool("LogAllPackets", "PacketLogging", state);
    }
    
    
    void EQInterface::toggle_log_WorldData (void)
    {
      if (m_worldLog)
      {
        delete m_worldLog;
        m_worldLog = 0;
      }
      else
        createWorldLog();
    
    
      bool state = (m_worldLog != 0);
      menuBar()->setItemChecked (m_id_log_WorldData, state);
      pSEQPrefs->setPrefBool("LogWorldPackets", "PacketLogging", state);
    }
    
    
    void EQInterface::toggle_log_ZoneData (void)
    {
      if (m_zoneLog)
      {
        delete m_zoneLog;
        m_zoneLog = 0;
      }
      else
        createZoneLog();
    
    
      bool state = (m_zoneLog != 0);
      menuBar()->setItemChecked (m_id_log_ZoneData, state);
      pSEQPrefs->setPrefBool("LogZonePackets", "PacketLogging", state);
    }
    
    
    void EQInterface::toggle_log_Filter_ZoneData_Client (void)
    {
       bool state = true;
       if(showeq_params->filterZoneDataLog == DIR_Client)
       {
          showeq_params->filterZoneDataLog = 0;
          state = false;
       }
       else
       {
          showeq_params->filterZoneDataLog = DIR_Client;
       }
       m_filterZoneDataMenu->setItemChecked(m_id_log_Filter_ZoneData_Client, state);
       m_filterZoneDataMenu->setItemChecked(m_id_log_Filter_ZoneData_Server, false);
    }
    
    
    void EQInterface::toggle_log_Filter_ZoneData_Server (void)
    {
       bool state = true;
       if(showeq_params->filterZoneDataLog == DIR_Server)
       {
          showeq_params->filterZoneDataLog = 0;
          state = false;
       }
       else
       {
          showeq_params->filterZoneDataLog = DIR_Server;
       }
       m_filterZoneDataMenu->setItemChecked(m_id_log_Filter_ZoneData_Server, state);
       m_filterZoneDataMenu->setItemChecked(m_id_log_Filter_ZoneData_Client, false);
    }
    
    
    void EQInterface::toggle_opt_BazaarData (void)
    {
      if (m_bazaarLog)
      {
        disconnect(m_bazaarLog,0,0,0);
        delete m_bazaarLog;
        m_bazaarLog = 0;
      }
      else
        createBazaarLog();
    
    
      bool state = (m_bazaarLog != 0);
      menuBar()->setItemChecked(m_id_opt_BazaarData, state);
      pSEQPrefs->setPrefBool("LogBazaarPackets", "PacketLogging", state);
    }
    
    
    void EQInterface::toggle_log_UnknownData (void)
    {
      if (m_unknownZoneLog)
      {
        delete m_unknownZoneLog;
        m_unknownZoneLog = 0;
      }
      else
        createUnknownZoneLog();
    
    
      bool state = (m_unknownZoneLog != 0);
      menuBar()->setItemChecked (m_id_log_UnknownData, state);
      pSEQPrefs->setPrefBool("LogUnknownZonePackets", "PacketLogging", state);
    }
    
    
    void EQInterface::toggle_log_RawData (void)
    {
      bool state = !pSEQPrefs->getPrefBool("LogRawPackets", "PacketLogging",
    				       false);
    
    
      if (m_worldLog)
        m_worldLog->setRaw(state);
      
      if (m_zoneLog)
        m_zoneLog->setRaw(state);
    
    
      menuBar()->setItemChecked(m_id_log_RawData, state);
      pSEQPrefs->setPrefBool("LogRawPackets", "PacketLogging", state);
    }
    
    
    /* Check and uncheck View menu options */
    void
    EQInterface::toggle_view_ChannelMsgs(int id)
    {
      int winNum = menuBar()->itemParameter(id);
    
    
      bool wasVisible = ((m_messageWindow[winNum] != 0) && 
    		     (m_messageWindow[winNum]->isVisible()));
    
    
      if (!wasVisible)
        showMessageWindow(winNum);
      else
      {
        // save any preference changes
        m_messageWindow[winNum]->savePrefs();
    
    
        // hide it 
        m_messageWindow[winNum]->hide();
    
    
        // remove its window menu
        removeWindowMenu(m_messageWindow[winNum]);
    
    
        // then delete it
        delete m_messageWindow[winNum];
    
    
        // make sure to clear it's variable
        m_messageWindow[winNum] = 0;
      }
    
    
      QString tmpPrefSuffix = "";
      if (winNum > 0)
        tmpPrefSuffix = QString::number(winNum + 1);
      
      QString tmpPrefName = QString("ShowMessageWindow") + tmpPrefSuffix;
    
    
      pSEQPrefs->setPrefBool(tmpPrefName, "Interface", !wasVisible); 
    }
    
    
    void
    EQInterface::toggle_view_UnknownData (void)
    {
      bool state = !pSEQPrefs->getPrefBool("ViewUnknown", "PacketLogging", 
    				       false);
    
    
      if (m_unknownZoneLog)
        m_unknownZoneLog->setView(state);
    
    
      menuBar()->setItemChecked (m_id_view_UnknownData, state);
      pSEQPrefs->setPrefBool("ViewUnknown", "PacketLogging", state);
    }
    
    
    void EQInterface::toggle_view_ExpWindow (void)
    {
        if (!m_expWindow->isVisible())
           m_expWindow->show();
        else
           m_expWindow->hide();
    
    
        pSEQPrefs->setPrefBool("ShowExpWindow", "Interface",
    			   m_expWindow->isVisible());
    }
    
    
    void EQInterface::toggle_view_CombatWindow (void)
    {
      if (!m_combatWindow->isVisible())
        m_combatWindow->show();
      else
        m_combatWindow->hide();
    
    
      pSEQPrefs->setPrefBool("ShowCombatWindow", "Interface", 
    			 m_combatWindow->isVisible());
    }
    
    
    void
    EQInterface::toggle_view_SpawnList(void)
    {
      bool wasVisible = ((m_spawnList != 0) && m_spawnList->isVisible());
    
    
      if (!wasVisible)
      {
        showSpawnList();
    
    
        // enable it's options sub-menu
        menuBar()->setItemEnabled(m_id_view_SpawnList_Options, true);
      }
      else 
      {
        // save it's preferences
        m_spawnList->savePrefs();
    
    
        // hide it
        m_spawnList->hide();
    
    
        // disable it's options sub-menu
        menuBar()->setItemEnabled(m_id_view_SpawnList_Options, false);
    
    
        // remove its window menu
        removeWindowMenu(m_spawnList);
    
    
        // delete the window
        delete m_spawnList;
    
    
        // make sure to clear it's variable
        m_spawnList = 0;
      }
    
    
      pSEQPrefs->setPrefBool("ShowSpawnList", "Interface", !wasVisible);
    }
    
    
    void
    EQInterface::toggle_view_SpawnList2(void)
    {
      bool wasVisible = ((m_spawnList2 != 0) && m_spawnList2->isVisible());
    
    
      if (!wasVisible)
        showSpawnList2();
      else 
      {
        // save it's preferences
        m_spawnList2->savePrefs();
    
    
        // hide it
        m_spawnList2->hide();
    
    
        // remove its window menu
        removeWindowMenu(m_spawnList2);
    
    
        // delete the window
        delete m_spawnList2;
    
    
        // make sure to clear it's variable
        m_spawnList2 = 0;
      }
    
    
      pSEQPrefs->setPrefBool("ShowSpawnList2", "Interface", !wasVisible);
    }
    
    
    void
    EQInterface::toggle_view_SpawnPointList(void)
    {
      bool wasVisible = ((m_spawnPointList != 0) && 
    		     m_spawnPointList->isVisible());
    
    
      if (!wasVisible)
        showSpawnPointList();
      else 
      {
        // save it's preferences
        m_spawnPointList->savePrefs();
    
    
        // hide it
        m_spawnPointList->hide();
    
    
        // remove its window menu
        removeWindowMenu(m_spawnPointList);
    
    
        // delete the window
        delete m_spawnPointList;
    
    
        // make sure to clear it's variable
        m_spawnPointList = 0;
      }
    
    
      pSEQPrefs->setPrefBool("ShowSpawnPointList", "Interface", !wasVisible);
    }
    
    
    void EQInterface::toggle_view_SpellList(void)
    {
      bool wasVisible = ((m_spellList != 0) && (m_spellList->isVisible()));
    
    
      if (!wasVisible)
        showSpellList();
      else
      {
        // save it's preferences
        m_spellList->savePrefs();
        
        // hide it
        m_spellList->hide();
    
    
        // remove its window menu
        removeWindowMenu(m_spellList);
    
    
        // delete it
        delete m_spellList;
        
        // make sure to clear it's variable
        m_spellList = 0;
      }
    
    
      pSEQPrefs->setPrefBool("ShowSpellList", "Interface", !wasVisible); 
    }
    
    
    void EQInterface::toggle_view_PlayerStats(void)
    {
      bool wasVisible = ((m_statList != 0) && m_statList->isVisible());
    
    
      if (!wasVisible)
      {
        showStatList();
    
    
        // enable it's options sub-menu
        menuBar()->setItemEnabled(m_id_view_PlayerStats_Options, true);
      }
      else 
      {
        // save it's preferences
        m_statList->savePrefs();
    
    
        // hide it
        m_statList->hide();
    
    
        // disable it's options sub-menu
        menuBar()->setItemEnabled(m_id_view_PlayerStats_Options, false);
    
    
        // remove its window menu
        removeWindowMenu(m_statList);
    
    
        // then delete it
        delete m_statList;
    
    
        // make sure to clear it's variable
        m_statList = 0;
      }
      
      pSEQPrefs->setPrefBool("ShowPlayerStats", "Interface", !wasVisible);
    }
    
    
    void EQInterface::toggle_view_PlayerSkills(void)
    {
      bool wasVisible = ((m_skillList != 0) && m_skillList->isVisible());
    
    
      if (!wasVisible)
      {
        showSkillList();
    
    
        menuBar()->setItemEnabled(m_id_view_PlayerSkills_Options, true);
      }
      else
      {
        // save any preference changes
        m_skillList->savePrefs();
    
    
        // if it's not visible, hide it
        m_skillList->hide();
    
    
        // disable it's options sub-menu
        menuBar()->setItemEnabled(m_id_view_PlayerSkills_Options, false);
    
    
        // remove its window menu
        removeWindowMenu(m_skillList);
    
    
        // then delete it
        delete m_skillList;
    
    
        // make sure to clear it's variable
        m_skillList = 0;
      }
    
    
      pSEQPrefs->setPrefBool("ShowPlayerSkills", "Interface", !wasVisible);
    }
    
    
    void
    EQInterface::toggle_view_Compass(void)
    {
      bool wasVisible = ((m_compass != 0) && (m_compass->isVisible()));
    
    
      if (!wasVisible)
        showCompass();
      else
      {
        // if it's not visible, hide it
        m_compass->hide();
    
    
        // remove its window menu
        removeWindowMenu(m_compass);
    
    
        // then delete it
        delete m_compass;
    
    
        // make sure to clear it's variable
        m_compass = 0;
      }
    
    
      pSEQPrefs->setPrefBool("ShowCompass", "Interface", !wasVisible);
    }
    
    
    void EQInterface::toggle_view_Map(int id)
    {
      int mapNum = menuBar()->itemParameter(id);
    
    
      bool wasVisible = ((m_map[mapNum] != 0) && 
    		     (m_map[mapNum]->isVisible()));
    
    
      if (!wasVisible)
        showMap(mapNum);
      else
      {
        // save any preference changes
        m_map[mapNum]->savePrefs();
    
    
        // hide it 
        m_map[mapNum]->hide();
    
    
        // remove its window menu
        removeWindowMenu(m_map[mapNum]);
    
    
        // then delete it
        delete m_map[mapNum];
    
    
        // make sure to clear it's variable
        m_map[mapNum] = 0;
      }
    
    
      QString tmpPrefSuffix = "";
      if (mapNum > 0)
        tmpPrefSuffix = QString::number(mapNum + 1);
      
      QString tmpPrefName = QString("ShowMap") + tmpPrefSuffix;
    
    
      pSEQPrefs->setPrefBool(tmpPrefName, "Interface", !wasVisible); 
    }
    
    
    void
    EQInterface::toggle_view_NetDiag(void)
    {
      bool wasVisible = ((m_netDiag != 0) && (m_netDiag->isVisible()));
    
    
      if (!wasVisible)
        showNetDiag();
      else
      {
        // if it's not visible, hide it
        m_netDiag->hide();
    
    
        // remove its window menu
        removeWindowMenu(m_netDiag);
    
    
        // then delete it
        delete m_netDiag;
    
    
        // make sure to clear it's variable
        m_netDiag = 0;
      }
    
    
      pSEQPrefs->setPrefBool("ShowNetStats", "Interface", !wasVisible);
    }
    
    
    void
    EQInterface::toggle_view_GuildList(void)
    {
      bool wasVisible = ((m_guildListWindow != 0) && 
    		     (m_guildListWindow->isVisible()));
    
    
      if (!wasVisible)
        showGuildList();
      else
      {
        // if it's not visible, hide it
        m_guildListWindow->hide();
    
    
        // remove its window menu
        removeWindowMenu(m_guildListWindow);
    
    
        // then delete it
        delete m_guildListWindow;
    
    
        // make sure to clear it's variable
        m_guildListWindow = 0;
      }
    
    
      pSEQPrefs->setPrefBool("ShowGuildList", "Interface", !wasVisible);
    }
    
    
    bool 
    EQInterface::getMonitorOpCodeList(const QString& title, 
    				  QString& opCodeList)
    {
      bool ok = false;
      QString newMonitorOpCode_List = 
        QInputDialog::getText(title,
    			  "A list of OpCodes seperated by commas...\n"
    			  "\n"
    			  "Each Opcode has 4 arguments, only one of which is actually necessary...\n"
    			  "They are:\n"
    			  "OpCode:    16-bit HEX value of the OpCode\n"
    			  "            (REQUIRED - No Default)\n"
    			  "\n"
    			  "Alias:     Name used when displaying the Opcode\n"
    			  "            (DEFAULT: Monitored OpCode)\n"
    			  "\n"
    			  "Direction: 1 = Client ---> Server\n"
    			  "           2 = Client <--- Server\n"
    			  "           3 = Client <--> Server (BOTH)\n"
    			  "            (DEFAULT: 3)\n"
    			  "\n"
    			  "Show known 1 = Show if OpCode is marked as known.\n"
    			  "           0 = Ignore if OpCode is known.\n"
    			  "            (DEFAULT: 0)\n"
    			  "\n"
    			  "The way which you include the arguments in the list of OpCodes is:\n"
    			  "adding a ':' inbetween arguments and a ',' after the last OpCode\n"
    			  "argument.\n"
    			  "\n"
    			  "(i.e. 7F21:Mana Changed:3:1, 7E21:Unknown Spell Event(OUT):1,\n"
    			  "      7E21:Unknown Spell Event(IN):2 )\n",
    			  QLineEdit::Normal,
    			  opCodeList,
    			  &ok, this);
    
    
      if (ok)
        opCodeList = newMonitorOpCode_List;
    
    
      return ok;
    }
    
    
    void
    EQInterface::toggle_opcode_monitoring(int id)
    {
      if(m_opcodeMonitorLog == 0)
      {
        QString section = "OpCodeMonitoring";
        QString opCodeList = pSEQPrefs->getPrefString("OpCodeList", section, "");
        bool ok = getMonitorOpCodeList("ShowEQ - Enable OpCode Monitor",
    				   opCodeList);
    
    
        if (ok && !opCodeList.isEmpty())
        {
          createOPCodeMonitorLog(opCodeList);
    
    
          // set the list of monitored opcodes
          pSEQPrefs->setPrefString("OpCodeList", section, opCodeList);
          
    
    
          seqInfo("OpCode monitoring is now ENABLED...\nUsing list:\t%s", 
    	     (const char*)opCodeList);
        }
      }
      else
      {
        delete m_opcodeMonitorLog;
        m_opcodeMonitorLog = 0;
    
    
        seqInfo("OpCode monitoring has been DISABLED...");
      }
    
    
      bool state = (m_opcodeMonitorLog != 0);
      menuBar()->setItemChecked(id, state);
      pSEQPrefs->setPrefBool("Enable", "OpCodeMonitoring", state);
    }
    
    
    void EQInterface::set_opcode_monitored_list(void)
    {
      QString section = "OpCodeMonitoring";
      QString opCodeList = pSEQPrefs->getPrefString("OpCodeList", section, "");
      bool ok = getMonitorOpCodeList("ShowEQ - Reload OpCode Monitor", 
    				 opCodeList);
    
    
      if (ok && m_opcodeMonitorLog)
      {
        m_opcodeMonitorLog->init(opCodeList);
        
        seqInfo("The monitored OpCode list has been reloaded...\nUsing list:\t%s", 
    	   (const char*)opCodeList);
        
        // set the list of monitored opcodes
        pSEQPrefs->setPrefString("OpCodeList", section, opCodeList);
      }
    }
    
    
    
    
    void EQInterface::toggle_opcode_log(int id)
    {
      QString section = "OpCodeMonitoring";
      bool state = !pSEQPrefs->getPrefBool("Log", section, false);
    
    
      if (m_opcodeMonitorLog)
      {
        m_opcodeMonitorLog->setLog(state);
    
    
        state = m_opcodeMonitorLog->log();
      }
    
    
      menuBar()->setItemChecked (id, state);
      pSEQPrefs->setPrefBool("Log", section, state);
    }
    
    
    void EQInterface::toggle_opcode_view(int id)
    {
      QString section = "OpCodeMonitoring";
      bool state = !pSEQPrefs->getPrefBool("View", section, false);
    
    
      if (m_opcodeMonitorLog)
        m_opcodeMonitorLog->setView(state);
    
    
      menuBar()->setItemChecked (id, state);
      pSEQPrefs->setPrefBool("View", section, state);
    }
    
    
    
    
    void
    EQInterface::select_opcode_file(void)
    {
      QString section = "OpCodeMonitoring";
    
    
      QString logFile = pSEQPrefs->getPrefString("LogFilename",
    					     section,
    					     "opcodemonitor.log");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
      
      logFile = 
        QFileDialog::getSaveFileName(logFileInfo.absFilePath(),
    				 "*.log",
    				 this,
    				 "ShowEQ - OpCode Log File");
    
    
      // set log filename
      if (!logFile.isEmpty())
        pSEQPrefs->setPrefString("LogFilename", section, logFile);
    }
    
    
    void EQInterface::resetMaxMana(void)
    {
      if (m_statList != 0)
        m_statList->statList()->resetMaxMana();
    }
    
    
    void
    EQInterface::toggle_opt_LogSpawns (void)
    {
      bool state = (m_spawnLogger == 0);
    
    
        if (state)
          createSpawnLog();
        else
        {
          // delete the spawn logger
          delete m_spawnLogger;
    
    
          // make sure to clear it's varialbe
          m_spawnLogger = 0;
        }
    
    
        menuBar()->setItemChecked (m_id_opt_LogSpawns, state);
        pSEQPrefs->setPrefBool("LogSpawns", "Misc", state);
    }
    
    
    void
    EQInterface::toggle_opt_PvPTeams (void)
    {
        showeq_params->pvp = !(showeq_params->pvp);
        menuBar()->setItemChecked (m_id_opt_PvPTeams, showeq_params->pvp);
        pSEQPrefs->setPrefBool("PvPTeamColoring", "Interface", showeq_params->pvp);
    }
    
    
    void
    EQInterface::toggle_opt_PvPDeity (void)
    {
        showeq_params->deitypvp = !(showeq_params->deitypvp);
        menuBar()->setItemChecked (m_id_opt_PvPDeity, showeq_params->deitypvp);
        pSEQPrefs->setPrefBool("DeityPvPTeamColoring", "Interface", showeq_params->deitypvp);
    }
    
    
    void
    EQInterface::toggle_opt_CreateUnknownSpawns (int id)
    {
        showeq_params->createUnknownSpawns = !showeq_params->createUnknownSpawns;
        menuBar()->setItemChecked(id, showeq_params->createUnknownSpawns);
        pSEQPrefs->setPrefBool("CreateUnknownSpawns", "Misc", showeq_params->createUnknownSpawns);
    }
    
    
    void
    EQInterface::toggle_opt_WalkPathRecord (int id)
    {
        showeq_params->walkpathrecord = !showeq_params->walkpathrecord;
        menuBar()->setItemChecked(id, showeq_params->walkpathrecord);
        pSEQPrefs->setPrefBool("WalkPathRecording", "Misc", showeq_params->walkpathrecord);
    }
    
    
    void
    EQInterface::set_opt_WalkPathLength(int len)
    {
      if ((len > 0) && (len <= 8192))
        showeq_params->walkpathlength = len;
    
    
        pSEQPrefs->setPrefInt("WalkPathLength", "Misc", showeq_params->walkpathlength);
    }
    
    
    void
    EQInterface::toggle_opt_RetardedCoords (int id)
    {
        showeq_params->retarded_coords = !showeq_params->retarded_coords;
        menuBar()->setItemChecked(id, showeq_params->retarded_coords);
        pSEQPrefs->setPrefBool("RetardedCoords", "Interface", showeq_params->retarded_coords);
    }
    
    
    void
    EQInterface::toggle_opt_SystimeSpawntime (int id)
    {
        showeq_params->systime_spawntime = !showeq_params->systime_spawntime;
        menuBar()->setItemChecked(id, showeq_params->systime_spawntime);
        pSEQPrefs->setPrefBool("SystimeSpawntime", "Interface", showeq_params->systime_spawntime);
    }
    
    
    void 
    EQInterface::select_opt_conColorBase(int id)
    {
      ColorLevel level = (ColorLevel)menuBar()->itemParameter(id);
      
      // get the current color
      QColor color = m_player->conColorBase(level);
    
    
      // get the new color
      QColor newColor = QColorDialog::getColor(color, this, "ShowEQ - Con Color");
    
    
      // only set if the user selected a valid color and clicked ok
      if (newColor.isValid())
      {
        // set the new con color
        m_player->setConColorBase(level, newColor);
        
        // force the spawn lists to get rebuilt with the new colors
        rebuildSpawnList();
      }
    }
    
    
    void EQInterface::setExp(uint32_t totalExp, uint32_t totalTick,
    			  uint32_t minExpLevel, uint32_t maxExpLevel, 
    			  uint32_t tickExpLevel)
    {
      if (m_stsbarExp)
      {
        char expperc[32];
        sprintf(expperc, "%.2f", totalTick*100.0/330.0);
    
    
        m_stsbarExp->setText(QString("Exp: %1 (%2/330, %3%)")
          .arg(Commanate(totalExp)).arg(totalTick).arg(expperc));
      }
    }
    
    
    void EQInterface::newExp(uint32_t newExp, uint32_t totalExp, 
    			 uint32_t totalTick,
    			 uint32_t minExpLevel, uint32_t maxExpLevel, 
    			 uint32_t tickExpLevel)
    {
      uint32_t leftExp = maxExpLevel - totalExp;
    
    
      if (newExp)
      {
        uint32_t needKills = leftExp / newExp;
        // format a string for the status bar
        if (m_stsbarStatus)
          m_stsbarStatus->setText(QString("Exp: %1; %2 (%3/330); %4 left [~ %5 kills]")
    			      .arg(Commanate(newExp))
    			      .arg(Commanate(totalExp - minExpLevel))
    			      .arg(totalTick)
    			      .arg(Commanate(leftExp))
    			      .arg(needKills));
    
    
        if (m_stsbarExp)
        {
          char expperc[32];
          sprintf(expperc, "%.2f", totalTick*100.0/330.0);
    
    
          m_stsbarExp->setText(QString("Exp: %1 (%2/330, %3%)")
            .arg(Commanate(totalExp)).arg(totalTick).arg(expperc));
        }
      }
      else
      {
        if (m_stsbarStatus)
          m_stsbarStatus->setText(QString("Exp: <%1; %2 (%3/330); %4 left")
    			      .arg(Commanate(tickExpLevel))
    			      .arg(Commanate(totalExp - minExpLevel))
    			      .arg(totalTick).arg(Commanate(leftExp)));
    
    
        if (m_stsbarExp)
        {
          char expperc[32];
          sprintf(expperc, "%.2f", totalTick*100.0/330.0);
    
    
          m_stsbarExp->setText(QString("Exp: %1 (%2/330, %3%)")
            .arg(Commanate(totalExp)).arg(totalTick).arg(expperc));
        }
      }
    }
    
    
    void EQInterface::setAltExp(uint32_t totalExp,
    			    uint32_t maxExp, uint32_t tickExp, 
    			    uint32_t aapoints)
    {
      if (m_stsbarExpAA)
        m_stsbarExpAA->setText(QString("ExpAA: %1").arg(totalExp));
    }
    
    
    void EQInterface::newAltExp(uint32_t newExp, uint32_t totalExp, 
    			    uint32_t totalTick, 
    			    uint32_t maxExp, uint32_t tickExp, 
    			    uint32_t aapoints)
    {
      if (m_stsbarExpAA)
      {
        char aaperc[32];
        sprintf(aaperc, "%.2f", totalTick*100.0/330.0);
    
    
        m_stsbarExpAA->setText(QString("ExpAA: %1 (%2/330, %3%)")
            .arg(Commanate(totalExp)).arg(totalTick).arg(aaperc));
      }
    }
    
    
    void EQInterface::levelChanged(uint8_t level)
    {
      QString tempStr;
      tempStr.sprintf("New Level: %u", level);
      if (m_stsbarStatus)
        m_stsbarStatus->setText(tempStr);
    }
    
    
    //
    // TODO:  clear after timeout miliseconds
    //
    void
    EQInterface::stsMessage(const QString &string, int timeout)
    {
      if (m_stsbarStatus)
        m_stsbarStatus->setText(string);
    }
    
    
    void
    EQInterface::numSpawns(int num)
    {
      // only update once per sec
      static int lastupdate = 0;
      if ( (mTime() - lastupdate) < 1000)
        return;
      lastupdate = mTime();
    
    
       QString tempStr;
       tempStr.sprintf("Mobs: %d", num);
       m_stsbarSpawns->setText(tempStr);
    }
    
    
    void
    EQInterface::newSpeed(double speed)
    {
      // update twice per sec
      static int lastupdate = 0;
      if ( (mTime() - lastupdate) < 500)
        return;
      lastupdate = mTime();
    
    
       QString tempStr;
       tempStr.sprintf("Run Speed: %3.1f", speed);
       m_stsbarSpeed->setText(tempStr);
    }
    
    
    void 
    EQInterface::resetPacket(int num, int stream)
    {
      if(stream != (int)zone2client);
      // if passed 0 reset the average
      m_packetStartTime = mTime();
      m_initialcount = num;
    }
    
    
    void
    EQInterface::numPacket(int num, int stream)
    {
    
    
      if(stream != (int)zone2client)
        return;
      // start the timer of not started
      if (!m_packetStartTime)
        m_packetStartTime = mTime();
    
    
      // only update once per sec
      static int lastupdate = 0;
      if ( (mTime() - lastupdate) < 1000)
        return;
      lastupdate = mTime();
      
    
    
       QString tempStr;
       int delta = mTime() - m_packetStartTime;
       num -= m_initialcount;
       if (num && delta)
         tempStr.sprintf("Pkt: %d (%2.1f)", num, (float) (num<<10) / (float) delta);
       else   
         tempStr.sprintf("Pkt: %d", num);
    
    
       m_stsbarPkt->setText(tempStr);
    }
    
    
    void EQInterface::attack2Hand1(const uint8_t* data)
    {
      // const attack2Struct * atk2 = (const attack2Struct*)data;
    }
    
    
    void EQInterface::action2Message(const uint8_t* data)
    {
      action2Struct *action2 = (action2Struct*)data;
      const Item* target = m_spawnShell->findID(tSpawn, action2->target);
      const Item* source = m_spawnShell->findID(tSpawn, action2->source);
      emit combatSignal(action2->target, action2->source, action2->type, action2->spell, action2->damage, 
    		    (target != 0) ? target->name() : QString("Unknown"), (source != 0) ? source->name() : QString("Unknown"));
    }
    
    
    // belith - combatKillSpawn, fix for the combat window
    //          this displays a killing shot on a mob in combat records
    void EQInterface::combatKillSpawn(const uint8_t* data)
    {
      const newCorpseStruct *deadspawn = (const newCorpseStruct *)data;
      // only show my kills
      if (deadspawn && deadspawn->killerId == m_player->id())
      {
        const Item* target = m_spawnShell->findID(tSpawn, deadspawn->spawnId);
        const Item* source = m_spawnShell->findID(tSpawn, deadspawn->killerId);
        emit combatSignal(deadspawn->spawnId, deadspawn->killerId,
    		      (deadspawn->type == -25) ? 231 : deadspawn->type,
    		      deadspawn->spellId, deadspawn->damage,
    		      (target != 0) ? target->name() : QString("Unknown"),
    		      (source != 0) ? source->name() : QString("Unknown"));
      }
    }
    
    
    void EQInterface::updatedDateTime(const QDateTime& dt)
    {
      
      m_stsbarEQTime->setText(dt.toString(pSEQPrefs->getPrefString("DateTimeFormat", "Interface", "ddd MMM dd,yyyy - hh:mm ap")));
    }
    
    
    void EQInterface::syncDateTime(const QDateTime& dt)
    {
      QString dateString = dt.toString(pSEQPrefs->getPrefString("DateTimeFormat", "Interface", "ddd MMM dd,yyyy - hh:mm ap"));
    
    
      m_stsbarEQTime->setText(dateString);
    }
    
    
    void EQInterface::zoneBegin(const QString& shortZoneName)
    {
      emit newZoneName(shortZoneName);
      float percentZEM = ((float)(m_zoneMgr->zoneExpMultiplier()-0.75)/0.75)*100;
      QString tempStr;
      tempStr.sprintf("ZEM: %3.2f%%", percentZEM);
      if (m_stsbarZEM)
        m_stsbarZEM->setText(tempStr);
    }
    
    
    void EQInterface::zoneEnd(const QString& shortZoneName, 
    			  const QString& longZoneName)
    {
      emit newZoneName(longZoneName);
      stsMessage("");
      float percentZEM = ((float)(m_zoneMgr->zoneExpMultiplier()-0.75)/0.75)*100;
      QString tempStr;
      tempStr.sprintf("ZEM: %3.2f%%", percentZEM);
      if (m_stsbarZEM)
        m_stsbarZEM->setText(tempStr);
    }
    
    
    void EQInterface::zoneChanged(const QString& shortZoneName)
    {
      QString tempStr;
      stsMessage("- Busy Zoning -");
      emit newZoneName(shortZoneName);
      float percentZEM = ((float)(m_zoneMgr->zoneExpMultiplier()-0.75)/0.75)*100;
      tempStr.sprintf("ZEM: %3.2f%%", percentZEM);
      if (m_stsbarZEM)
        m_stsbarZEM->setText(tempStr);
    }
    
    
    void EQInterface::clientTarget(const uint8_t* data)
    {
      if (!m_selectOnTarget)
        return;
    
    
      const clientTargetStruct* cts = (const clientTargetStruct*)data;
    
    
      // try to find the targeted spawn in the spawn shell
      const Item* item = m_spawnShell->findID(tSpawn, cts->newTarget);
    
    
      // if found, make it the currently selected target
      if (item)
      {
        // note the new selection
        m_selectedSpawn = item;
        
        // notify others of the new selected spawn
        emit selectSpawn(m_selectedSpawn);
    
    
        // update the spawn status
        updateSelectedSpawnStatus(m_selectedSpawn);
      }
    }
    
    
    void EQInterface::spawnSelected(const Item* item)
    {
      if (item == 0)
        return;
    
    
      // note the new selection
      m_selectedSpawn = item;
      
      // notify others of the new selected spawn
      emit selectSpawn(m_selectedSpawn);
    
    
      // update the spawn status
      updateSelectedSpawnStatus(m_selectedSpawn);
    }
    
    
    void EQInterface::spawnConsidered(const Item* item)
    {
      if (item == 0)
        return;
    
    
      if (!m_selectOnConsider)
        return;
    
    
      // note the new selection
      m_selectedSpawn = item;
      
      // notify others of the new selected spawn
      emit selectSpawn(m_selectedSpawn);
      
      // update the spawn status
      updateSelectedSpawnStatus(m_selectedSpawn);
    }
    
    
    void EQInterface::addItem(const Item* item)
    {
      uint32_t filterFlags = item->filterFlags();
    
    
      if (filterFlags & FILTER_FLAG_LOCATE)
      {
        // note the new selection
        m_selectedSpawn = item;
        
        // notify others of the new selected spawn
        emit selectSpawn(m_selectedSpawn);
        
        // update the spawn status
        updateSelectedSpawnStatus(m_selectedSpawn);
      } // End LOCATE Filter alerting
    }
    
    
    
    
    void EQInterface::delItem(const Item* item)
    {
      // if this is the selected spawn, then there isn't a selected spawn anymore
      if (m_selectedSpawn == item)
      {
        m_selectedSpawn = 0;
      
        // notify others of the new selected spawn
        emit selectSpawn(m_selectedSpawn);
      }
    }
    
    
    void EQInterface::killSpawn(const Item* item)
    {
      if (m_selectedSpawn != item)
        return;
    
    
      // update status message, notifying that selected spawn has died
      QString string = m_selectedSpawn->name() + " died";
    
    
      stsMessage(string);
    }
    
    
    void EQInterface::changeItem(const Item* item)
    {
      // if this isn't the selected spawn, nothing more to do
      if (item != m_selectedSpawn)
        return;
    
    
      updateSelectedSpawnStatus(item);
    }
    
    
    void EQInterface::updateSelectedSpawnStatus(const Item* item)
    {
      if (item == 0)
        return;
    
    
      const Spawn* spawn = 0;
    
    
      if ((item->type() == tSpawn) || (item->type() == tPlayer))
        spawn = (const Spawn*)item;
    
    
      // construct a message for the status message display
      QString string("");
      if (spawn != 0)
        string.sprintf("%d: %s:%d (%d/%d) Pos:", // "%d/%d/%d (%d) %s %s Item:%s", 
    		   item->id(),
    		   (const char*)item->name().utf8(),
    		   spawn->level(), spawn->HP(),
    		   spawn->maxHP());
      else
        string.sprintf("%d: %s: Pos:", // "%d/%d/%d (%d) %s %s Item:%s", 
    		   item->id(),
    		   (const char*)item->name().utf8());
    
    
      if (showeq_params->retarded_coords)
        string += QString::number(item->y()) + "/" 
          + QString::number(item->x()) + "/" 
          + QString::number(item->z());
      else
        string += QString::number(item->x()) + "/" 
          + QString::number(item->y()) + "/" 
          + QString::number(item->z());
    
    
      string += QString(" (") 
        + QString::number(item->calcDist(m_player->x(),
    				     m_player->y(),
    				     m_player->z()))
        + ") " + item->raceString() + " " + item->classString();
    
    
      // just call the status message method
      stsMessage(string);
    }
    
    
    void EQInterface::addCategory(void)
    {
      if (m_categoryMgr)
        m_categoryMgr->addCategory();
    }
    
    
    void EQInterface::reloadCategories(void)
    {
      if (m_categoryMgr)
        m_categoryMgr->reloadCategories();
    }
    
    
    void EQInterface::rebuildSpawnList()
    {
      if (m_spawnList)
        m_spawnList->spawnList()->rebuildSpawnList();
    
    
      if (m_spawnList2)
        m_spawnList2->rebuildSpawnList();
    }
    
    
    void EQInterface::selectNext(void)
    {
      if (m_spawnList)
        m_spawnList->spawnList()->selectNext();
    }
    
    
    void EQInterface::selectPrev(void)
    {
      if (m_spawnList)
        m_spawnList->spawnList()->selectPrev();
    }
    
    
    void EQInterface::saveSelectedSpawnPath(void)
    {
      QString fileName;
      fileName.sprintf("%s_mobpath.map", 
    		   (const char*)m_zoneMgr->shortZoneName());
    
    
      QFileInfo fileInfo = m_dataLocationMgr->findWriteFile("maps", fileName, 
    							false);
    
    
      QFile mobPathFile(fileInfo.absFilePath());
      if (mobPathFile.open(IO_Append | IO_WriteOnly))
      {
        QTextStream out(&mobPathFile);
        // append the selected spawns path to the end
        saveSpawnPath(out, m_selectedSpawn);
    
    
        seqInfo("Finished appending '%s'!\n", (const char*)fileName);
      }
    }
    
    
    void EQInterface::saveSpawnPaths(void)
    {
      QString fileName;
      fileName.sprintf("%s_mobpath.map", 
    		   (const char*)m_zoneMgr->shortZoneName());
    
    
      QFileInfo fileInfo = m_dataLocationMgr->findWriteFile("maps", fileName, 
    							false);
    
    
      QFile mobPathFile(fileInfo.absFilePath());
      if (mobPathFile.open(IO_Truncate | IO_WriteOnly))
      {
        QTextStream out(&mobPathFile);
        // map header line
        out << m_zoneMgr->longZoneName() << ","
    	<< m_zoneMgr->shortZoneName() << ",0,0" << endl;
    
    
        // iterate over the spawns adding their paths to the file
        ItemConstIterator it(m_spawnShell->getConstMap(tSpawn));
        const Item* item;
        for (item = it.current(); item != 0; item = ++it)
        {
          if ((item->NPC() == SPAWN_NPC) || 
    	  (item->NPC() == SPAWN_NPC_CORPSE) ||
    	  (item->NPC() == SPAWN_NPC_UNKNOWN))
    	saveSpawnPath(out, it.current());
        }
    
    
        seqInfo("Finished writing '%s'!\n", (const char*)fileName);
      }
    }
    
    
    void EQInterface::saveSpawnPath(QTextStream& out, const Item* item)
    {
      if (item == 0)
        return;
    
    
      const Spawn* spawn = spawnType(item);
    
    
      if (spawn == 0)
        return;
    
    
       const SpawnTrackList& trackList = spawn->trackList();
       SpawnTrackListIterator trackIt(spawn->trackList());
       int cnt = trackList.count();
    
    
       // only make a line if there is more then one point
       if (cnt < 2)
         return;
    
    
       const SpawnTrackPoint* trackPoint;
       
       out << "M," << spawn->realName() << ",blue," << trackList.count();
       //iterate over the track, writing out the points
       for (trackPoint = trackIt.current();
    	trackPoint;
    	trackPoint = ++trackIt)
         {
           out << "," << trackPoint->x() 
    	   << "," <<  trackPoint->y()
    	   << "," << trackPoint->z();
         }
       out << endl;
    }
    
    
    void EQInterface::toggle_net_real_time_thread(int id)
    {
      bool realtime = !m_packet->realtime();
      m_packet->setRealtime(realtime);
       m_netMenu->setItemChecked(id, realtime);
       pSEQPrefs->setPrefBool("RealTimeThread", "Network", realtime);
    }
    
    
    void EQInterface::set_net_monitor_next_client()
    {
      // start monitoring the next client seen
      m_packet->monitorNextClient();
    
    
      // set it as the address to monitor next session
      pSEQPrefs->setPrefString("IP", "Network", m_packet->ip());
    }
    
    
    void EQInterface::set_net_client_IP_address()
    {
      QStringList iplst;
      for( int l = 0; l < 5; l++)
      iplst += ipstr[l];    
      bool ok = false;
      QString address = 
         QInputDialog::getItem("ShowEQ - EQ Client IP Address",
          			   "Enter IP address of EQ client",
    			    iplst, 0, TRUE, &ok, this );
      if (ok)
      {
    	for (int i = 4; i > 0; i--)
    	ipstr[i] = ipstr[ i - 1 ];
    	ipstr[0] = address;
        // start monitoring the new address
        m_packet->monitorIPClient(address);
    
    
        // set it as the address to monitor next session
        pSEQPrefs->setPrefString("IP", "Network", m_packet->ip());
      }
    }
    
    
    void EQInterface::set_net_client_MAC_address()
    {
      QStringList maclst;
      for( int l = 0; l < 5; l++)  
      maclst += macstr[l];
      bool ok = false;
      QString address = 
         QInputDialog::getItem("ShowEQ - EQ Client MAC Address",
         			   "Enter MAC address of EQ client",
    			    maclst, 0, TRUE, &ok, this );
      if (ok)
      {
        if (address.length() != 17)
        {
          seqWarn("Invalid MAC Address (%s)! Ignoring!",
    	      (const char*)address);
          return;
        }
     	for (int i = 4; i > 0; i--)
    	macstr[i] = macstr[ i - 1 ];
    	macstr[0] = address;
        // start monitoring the new address
        m_packet->monitorMACClient(address);
    
    
        // set it as the address to monitor next session
        pSEQPrefs->setPrefString("MAC", "Network", m_packet->mac());
      }
    }
    
    
    void EQInterface::set_net_device()
    {
      bool ok = false;
      QString dev = 
        QInputDialog::getText("ShowEQ - Device",
    			  "Enter the device to sniff for EQ Packets:",
    			  QLineEdit::Normal, m_packet->device(),
    			  &ok, this);
    
    
      if (ok)
      {
        // start monitoring the device
        m_packet->monitorDevice(dev);
    
    
        // set it as the device to monitor next session
        pSEQPrefs->setPrefString("Device", "Network", m_packet->device());
      }
    }
    
    
    void EQInterface::set_net_arq_giveup(int giveup)
    {
      // set the Arq Seq Give Up length
      m_packet->setArqSeqGiveUp(uint16_t(giveup));
    
    
      // set it as the value to use next session
      pSEQPrefs->setPrefInt("ArqSeqGiveUp", "Network", m_packet->arqSeqGiveUp());
    }
    
    
    void EQInterface::toggle_net_session_tracking()
    {
      bool enable = !m_packet->session_tracking();
    
    
      m_packet->session_tracking(enable);
      m_netMenu->setItemChecked(m_id_net_sessiontrack, enable);
      pSEQPrefs->setPrefBool("SessionTracking", "Network", enable);
    }
    
    
    void EQInterface::toggleAutoDetectPlayerSettings (int id)
    {
      m_player->setUseAutoDetectedSettings(!m_player->useAutoDetectedSettings());
      menuBar()->setItemChecked (id, m_player->useAutoDetectedSettings());
    }
    
    
    /* Choose the character's level */
    void EQInterface::SetDefaultCharacterLevel(int level)
    {
      m_player->setDefaultLevel(level);
    }
    
    
    /* Choose the character's class */
    void EQInterface::SetDefaultCharacterClass(int id)
    {
       for (int i = 0; i < PLAYER_CLASSES; i++)
           m_charClassMenu->setItemChecked(char_ClassID[i], char_ClassID[i] == id);
       m_player->setDefaultClass(m_charClassMenu->itemParameter(id));
    }
    
    
    /* Choose the character's race */
    void EQInterface::SetDefaultCharacterRace(int id)
    {   
       for (int i = 0; i < PLAYER_RACES; i++)
         m_charRaceMenu->setItemChecked(char_RaceID[i], char_RaceID[i] == id);
       m_player->setDefaultRace(m_charRaceMenu->itemParameter(id));
    }
    
    
    void EQInterface::toggle_view_menubar()
    {
       if (menuBar()->isVisible())
           menuBar()->hide();
       else
           menuBar()->show();
    }
    
    
    void EQInterface::toggle_view_statusbar()
    {
       if (statusBar()->isVisible())
           statusBar()->hide();
       else
           statusBar()->show();
       pSEQPrefs->setPrefBool("StatusBarActive", "Interface_StatusBar", statusBar()->isVisible());
    }
    
    
    void EQInterface::init_view_menu()
    {
      // need to check for 0 before checking if is visible for dynamicly
      // created windows
      menuBar()->setItemChecked(m_id_view_PlayerSkills, 
    			    (m_skillList != 0) && 
    			    m_skillList->isVisible());
      menuBar()->setItemChecked(m_id_view_PlayerStats, 
    			    (m_statList != 0) && 
    			    m_statList->isVisible());
      menuBar()->setItemChecked(m_id_view_SpawnList, 
    			    (m_spawnList != 0) && 
    			    m_spawnList->isVisible());
      menuBar()->setItemChecked(m_id_view_SpawnList2, 
    			    (m_spawnList2 != 0) && 
    			    m_spawnList2->isVisible());
      menuBar()->setItemChecked(m_id_view_SpawnPointList, 
    			    (m_spawnPointList != 0) &&
    			    m_spawnPointList->isVisible());
      menuBar()->setItemChecked(m_id_view_Compass, 
    			    (m_compass != 0) &&
    			    m_compass->isVisible());
      menuBar()->setItemChecked(m_id_view_NetDiag, 
    			    (m_netDiag != 0) &&
    			    m_netDiag->isVisible());
      menuBar()->setItemChecked(m_id_view_GuildListWindow, 
    			    (m_guildListWindow != 0) &&
    			    m_guildListWindow->isVisible());
      menuBar()->setItemChecked (m_id_view_SpellList, 
    			     (m_spellList != 0) &&
    			     m_spellList->isVisible());
    
    
      // loop over the maps
      for (int i = 0; i < maxNumMaps; i++)
        menuBar()->setItemChecked(m_id_view_Map[i], 
    			      (m_map[i] != 0) &&
    			      m_map[i]->isVisible());
    
    
      // loop over the message windows
      for (int i = 0; i < maxNumMessageWindows; i++)
        menuBar()->setItemChecked(m_id_view_MessageWindow[i], 
    			      (m_messageWindow[i] != 0) &&
    			      m_messageWindow[i]->isVisible());
    
    
      // set the checkmarks for windows that are always created, but not always
      // visible
      menuBar()->setItemChecked(m_id_view_ExpWindow, 
    			    (m_expWindow != 0) && 
    			    m_expWindow->isVisible()); 
      menuBar()->setItemChecked (m_id_view_CombatWindow, 
    			     (m_combatWindow != 0) &&
    			     m_combatWindow->isVisible());
       
       // set initial view options
      if (m_spawnList != 0)
      {
        SEQListView* spawnList = m_spawnList->spawnList();
    
    
        // make sure the menu bar settings are correct
        for (int i = 0; i < tSpawnColMaxCols; i++)
          m_spawnListMenu->setItemChecked(m_id_view_SpawnList_Cols[i], 
    				      spawnList->columnVisible(i));
      }
    
    
      if (m_statList != 0)
      {
        StatList* statList = m_statList->statList();
        // make sure the menu items are checked
        for (int i = 0; i < LIST_MAXLIST; i++)
          m_statWinMenu->setItemChecked(m_id_view_PlayerStats_Stats[i], 
    				    statList->statShown(i));
    
    
      }
    
    
      if (m_skillList != 0)
      {
        // make sure the proper menu items are checked
        menuBar()->setItemChecked(m_id_view_PlayerSkills_Languages, 
    			      m_skillList->skillList()->showLanguages());
    
    
      }
    }
    
    
    void EQInterface::toggle_opt_save_PlayerState(int id)
    {
      showeq_params->savePlayerState = !showeq_params->savePlayerState;
      menuBar()->setItemChecked(id, showeq_params->savePlayerState);
      pSEQPrefs->setPrefBool("PlayerState", "SaveState", 
    			 showeq_params->savePlayerState);
    }
    
    
    void EQInterface::toggle_opt_save_ZoneState(int id)
    {
      showeq_params->saveZoneState = !showeq_params->saveZoneState;
      menuBar()->setItemChecked(id, showeq_params->saveZoneState);
      pSEQPrefs->setPrefBool("ZoneState", "SaveState", 
    			 showeq_params->saveZoneState);
    }
    
    
    void EQInterface::toggle_opt_save_Spawns(int id)
    {
      showeq_params->saveSpawns = !showeq_params->saveSpawns;
      menuBar()->setItemChecked(id, showeq_params->saveSpawns);
      pSEQPrefs->setPrefBool("Spawns", "SaveState", 
    			 showeq_params->saveSpawns);
    
    
      if (showeq_params->saveSpawns)
        m_spawnShell->saveSpawns();
    }
    
    
    void EQInterface::set_opt_save_SpawnFrequency(int frequency)
    {
      showeq_params->saveSpawnsFrequency = frequency * 1000;
      pSEQPrefs->setPrefInt("SpawnsFrequency", "SaveState", 
    			showeq_params->saveSpawnsFrequency);
    }
    
    
    void EQInterface::set_opt_save_BaseFilename()
    {
      QString fileName = 
        QFileDialog::getSaveFileName(showeq_params->saveRestoreBaseFilename, 
    				 QString::null, this, "SaveBaseFilename",
    				 "Save State Base Filename");
      if (!fileName.isEmpty())
      {
        // set it to be the new base filename
        showeq_params->saveRestoreBaseFilename = fileName;
        
        // set preference to use for next session
        pSEQPrefs->setPrefString("BaseFilename", "SaveState", 
    			     showeq_params->saveRestoreBaseFilename);
      }
    }
    
    
    void EQInterface::opt_clearChannelMsgs(int id)
    {
      // clear the messages
      m_messages->clear();
    }
    
    
    
    
    void EQInterface::showMessageFilterDialog(void)
    {
      // create the filter dialog, if necessary
      if (!m_messageFilterDialog)
        m_messageFilterDialog = new MessageFilterDialog(m_messageFilters, 
    						    "ShowEQ Message Filters",
    						    this, "messagefilterdialog");
    
    
      // show the message filter dialog
      m_messageFilterDialog->show();
    }
    
    
    void EQInterface::toggleTypeFilter(int id)
    {
      uint64_t enabledTypes = m_terminal->enabledTypes();
    
    
      if (((uint64_t(1) << id) & enabledTypes) != 0)
        enabledTypes &= ~(uint64_t(1) << id);
      else
        enabledTypes |= (uint64_t(1) << id);
    
    
      m_terminal->setEnabledTypes(enabledTypes);
    
    
      // (un)check the appropriate menu item
      m_terminalTypeFilterMenu->setItemChecked(id, ((enabledTypes & (uint64_t(1) << id))));
    }
    
    
    void EQInterface::disableAllTypeFilters()
    {
      m_terminal->setEnabledTypes(0);
      // make sure the All menu items are unchecked
      m_terminalTypeFilterMenu->setItemChecked(64, false);
      m_terminalTypeFilterMenu->setItemChecked(65, false);
    
    
      // uncheck all the menu items
      QString typeName;
      for (int i = MT_Guild; i <= MT_Max; i++)
      {
        typeName = MessageEntry::messageTypeString((MessageType)i);
        if (!typeName.isEmpty())
          m_terminalTypeFilterMenu->setItemChecked(i, false);
      }
    }
    
    
    void EQInterface::enableAllTypeFilters()
    {
      m_terminal->setEnabledTypes(0xFFFFFFFFFFFFFFFFULL);
    
    
      // make sure the All menu items are unchecked
      m_terminalTypeFilterMenu->setItemChecked(64, false);
      m_terminalTypeFilterMenu->setItemChecked(65, false);
    
    
      // check all the menu items
      QString typeName;
      for (int i = MT_Guild; i <= MT_Max; i++)
      {
        typeName = MessageEntry::messageTypeString((MessageType)i);
        if (!typeName.isEmpty())
          m_terminalTypeFilterMenu->setItemChecked(i, true);
      }
    }
    
    
    void EQInterface::toggleShowUserFilter(int id)
    {
      uint32_t enabledShowUserFilters = m_terminal->enabledShowUserFilters();
      // toggle whether the filter is enabled/disabled
      if (((1 << id) & enabledShowUserFilters) != 0)
        enabledShowUserFilters &= ~(1 << id);
      else
        enabledShowUserFilters |= (1 << id);
    
    
      m_terminal->setEnabledShowUserFilters(enabledShowUserFilters);
     
      // (un)check the appropriate menu item
      m_terminalShowUserFilterMenu->setItemChecked(id, ((enabledShowUserFilters & (1 << id)) != 0));
    }
    
    
    void EQInterface::disableAllShowUserFilters()
    {
      // set and save all filters disabled setting
      m_terminal->setEnabledShowUserFilters(0);
      
      // make sure the All menu items are unchecked
      m_terminalShowUserFilterMenu->setItemChecked(66, false);
      m_terminalShowUserFilterMenu->setItemChecked(67, false);
    
    
      // uncheck all the menu items
      QString typeName;
      for (int i = 0; i <= maxMessageFilters; i++)
      {
        if (m_messageFilters->filter(i))
          m_terminalShowUserFilterMenu->setItemChecked(i, false);
      }
    }
    
    
    void EQInterface::enableAllShowUserFilters()
    {
      // set and save all filters enabled flag
      m_terminal->setEnabledShowUserFilters(0xFFFFFFFF);
    
    
      // make sure the All menu items are unchecked
      m_terminalShowUserFilterMenu->setItemChecked(66, false);
      m_terminalShowUserFilterMenu->setItemChecked(67, false);
    
    
      // check all the menu items
      QString typeName;
      for (int i = 0; i <= maxMessageFilters; i++)
      {
        if (m_messageFilters->filter(i))
          m_terminalShowUserFilterMenu->setItemChecked(i, true);
      }
    }
    
    
    void EQInterface::toggleHideUserFilter(int id)
    {
      uint32_t enabledHideUserFilters = m_terminal->enabledHideUserFilters();
    
    
      // toggle whether the filter is enabled/disabled
      if (((1 << id) & enabledHideUserFilters) != 0)
        enabledHideUserFilters &= ~(1 << id);
      else
        enabledHideUserFilters |= (1 << id);
    
    
      m_terminal->setEnabledHideUserFilters(enabledHideUserFilters);
    
    
      // (un)check the appropriate menu item
      m_terminalHideUserFilterMenu->setItemChecked(id, ((enabledHideUserFilters & (1 << id)) != 0));
    }
    
    
    void EQInterface::disableAllHideUserFilters()
    {
      // set and save all filters disabled setting
      m_terminal->setEnabledHideUserFilters(0);
      
      // make sure the All menu items are unchecked
      m_terminalHideUserFilterMenu->setItemChecked(66, false);
      m_terminalHideUserFilterMenu->setItemChecked(67, false);
    
    
      // uncheck all the menu items
      QString typeName;
      for (int i = 0; i <= maxMessageFilters; i++)
      {
        if (m_messageFilters->filter(i))
          m_terminalHideUserFilterMenu->setItemChecked(i, false);
      }
    }
    
    
    void EQInterface::enableAllHideUserFilters()
    {
      // set and save all filters enabled flag
      m_terminal->setEnabledHideUserFilters(0xFFFFFFFF);
    
    
      // make sure the All menu items are unchecked
      m_terminalHideUserFilterMenu->setItemChecked(66, false);
      m_terminalHideUserFilterMenu->setItemChecked(67, false);
    
    
      // check all the menu items
      QString typeName;
      for (int i = 0; i <= maxMessageFilters; i++)
      {
        if (m_messageFilters->filter(i))
          m_terminalHideUserFilterMenu->setItemChecked(i, true);
      }
    }
    
    
    void EQInterface::toggleDisplayType(int id)
    {
      // toggle the display of message types
      m_terminal->setDisplayType(m_terminal->displayType());
      m_terminalMenu->setItemChecked(id, m_terminal->displayType());
    }
    
    
    void EQInterface::toggleDisplayTime(int id)
    {
      // toggle the display of message time
      m_terminal->setDisplayDateTime(!m_terminal->displayDateTime());
      m_terminalMenu->setItemChecked(id, m_terminal->displayDateTime());  
    }
    
    
    void EQInterface::toggleEQDisplayTime(int id)
    {
      m_terminal->setDisplayEQDateTime(!m_terminal->displayEQDateTime());
      m_terminalMenu->setItemChecked(id, m_terminal->displayEQDateTime());
    }
    
    
    void EQInterface::toggleUseColor(int id)
    {
      m_terminal->setUseColor(!m_terminal->useColor());
      m_terminalMenu->setItemChecked(id, m_terminal->useColor());
    }
    
    
    int EQInterface::setTheme(int id)
    {
        static QFont OrigFont = qApp->font();
        static QPalette OrigPalette = qApp->palette();;
    
    
        MenuIDList::Iterator iter;
        for ( iter = IDList_StyleMenu.begin(); iter != IDList_StyleMenu.end(); ++iter)
          menuBar()->setItemChecked( (*iter), false );
    
    
        menuBar()->setItemChecked( id, true );
        int theme = menuBar()->itemParameter(id);
    
    
        switch ( theme )
        {
        case 1: // platinum
        {
          QPalette p( QColor( 239, 239, 239 ) );
          qApp->setStyle("platinum");
          qApp->setPalette( p, TRUE );
        }
        break;
        case 2: // windows
        {
          qApp->setStyle("windows");
          qApp->setFont( OrigFont, TRUE );
          qApp->setPalette( OrigPalette, TRUE );
        }
        break;
        case 3: // cde 
        case 4: // cde polished
        {
          QPalette p( QColor( 75, 123, 130 ) );
          qApp->setStyle("cde");
          p.setColor( QPalette::Active, QColorGroup::Base, QColor( 55, 77, 78 ) );
          p.setColor( QPalette::Inactive, QColorGroup::Base, QColor( 55, 77, 78 ) );
          p.setColor( QPalette::Disabled, QColorGroup::Base, QColor( 55, 77, 78 ) );
          p.setColor( QPalette::Active, QColorGroup::Highlight, Qt::white );
          p.setColor( QPalette::Active, QColorGroup::HighlightedText, QColor( 55, 77, 78 ) );
          p.setColor( QPalette::Inactive, QColorGroup::Highlight, Qt::white );
          p.setColor( QPalette::Inactive, QColorGroup::HighlightedText, QColor( 55, 77, 78 ) );
          p.setColor( QPalette::Disabled, QColorGroup::Highlight, Qt::white );
          p.setColor( QPalette::Disabled, QColorGroup::HighlightedText, QColor( 55, 77, 78 ) );
          p.setColor( QPalette::Active, QColorGroup::Foreground, Qt::white );
          p.setColor( QPalette::Active, QColorGroup::Text, Qt::white );
          p.setColor( QPalette::Active, QColorGroup::ButtonText, Qt::white );
          p.setColor( QPalette::Inactive, QColorGroup::Foreground, Qt::white );
          p.setColor( QPalette::Inactive, QColorGroup::Text, Qt::white );
          p.setColor( QPalette::Inactive, QColorGroup::ButtonText, Qt::white );
          p.setColor( QPalette::Disabled, QColorGroup::Foreground, Qt::lightGray );
          p.setColor( QPalette::Disabled, QColorGroup::Text, Qt::lightGray );
          p.setColor( QPalette::Disabled, QColorGroup::ButtonText, Qt::lightGray );
          qApp->setPalette( p, TRUE );
          qApp->setFont( QFont( "times", OrigFont.pointSize() ), TRUE );
        }
        break;
        case 5: // motif
        {
          QPalette p( QColor( 192, 192, 192 ) );
          qApp->setStyle("motif");
          qApp->setPalette( p, TRUE );
          qApp->setFont( OrigFont, TRUE );
        }
        break;
        case 6: // SGI
        {
          //QPalette p( QColor( 192, 192, 192 ) );
          qApp->setStyle("sgi");
          qApp->setPalette( OrigPalette, TRUE );
          qApp->setFont( OrigFont, TRUE );
        }
        break;
        default: // system default
        {
          QPalette p( QColor( 192, 192, 192 ) );
          qApp->setStyle("motif");
          qApp->setPalette( p, TRUE );
          qApp->setFont( OrigFont, TRUE );
          theme = 2;
        }
        break;
        }
    
    
        // make sure the windows that override the application font, do so
        emit restoreFonts();
    
    
        return theme;
    }
    
    
    void EQInterface::selectTheme( int id )
    {
      int theme = setTheme(id);
      pSEQPrefs->setPrefInt("Theme", "Interface", theme);
    }
    
    
    void EQInterface::showMap(int i)
    {
      if ((i > maxNumMaps) || (i < 0))
        return;
    
    
      // if it doesn't exist, create it
      if (m_map[i] == 0)
      {
        int mapNum = i + 1;
        QString mapPrefName = "Map";
        QString mapName = QString("map") + QString::number(mapNum);
        QString mapCaption = "Map ";
    
    
        if (i != 0)
        {
          mapPrefName += QString::number(mapNum);
          mapCaption += QString::number(mapNum);
        }
    
    
        m_map[i] = new MapFrame(m_filterMgr,
    			    m_mapMgr,
    			    m_player, 
    			    m_spawnShell, 
    			    m_zoneMgr,
    			    m_spawnMonitor,
    			    mapPrefName, 
    			    mapCaption,
    			    mapName, 
    			    0);
    
    
    
    
       setDockEnabled(m_map[i], 
    		  pSEQPrefs->getPrefBool(QString("Dockable") + mapPrefName,
    					 "Interface", true));
    
    
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", m_map[i]->preferenceName(),
    					    Left);
        addDockWindow(m_map[i], mapName, edge, true);
        if (!m_isMapDocked[i])
          m_map[i]->undock();
    
    
        connect(this, SIGNAL(saveAllPrefs(void)),
    	    m_map[i], SLOT(savePrefs()));
        connect(this, SIGNAL(restoreFonts(void)),
    	    m_map[i], SLOT(restoreFont(void)));
        
        // Get the map...
        Map* map = m_map[i]->map();
        
        // supply the Map slots with signals from EQInterface
        connect (this, SIGNAL(selectSpawn(const Item*)), 
    	     map, SLOT(selectSpawn(const Item*)));
        
        // supply EQInterface slots with signals from Map
        connect (map, SIGNAL(spawnSelected(const Item*)),
    	     this, SLOT(spawnSelected(const Item*)));
    
    
        m_map[i]->restoreSize();
    
    
        // restore it's position if necessary and practical
        if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
          m_map[i]->restorePosition();
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_map[i]);
      }
          
      // make sure it's visible
      m_map[i]->show();
    }
    
    
    void EQInterface::showMessageWindow(int i)
    {
      if ((i > maxNumMessageWindows) || (i < 0))
        return;
    
    
      // if it doesn't exist, create it
      if (m_messageWindow[i] == 0)
      {
        int winNum = i + 1;
        QString prefName = "MessageWindow" + QString::number(winNum);
        QString name = QString("messageWindow") + QString::number(winNum);
        QString caption = "Channel Messages ";
    
    
        if (i != 0)
          caption += QString::number(winNum);
    
    
        m_messageWindow[i] = new MessageWindow(m_messages, m_messageFilters,
    					   prefName, caption,
    					   0, name);
    
    
       setDockEnabled(m_messageWindow[i], 
    		  pSEQPrefs->getPrefBool(QString("Dockable") + prefName,
    					 "Interface", false));
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					    m_messageWindow[i]->preferenceName(),
    					    Left);
        addDockWindow(m_messageWindow[i], edge, false);
        if (!m_isMessageWindowDocked[i])
          m_messageWindow[i]->undock();
    
    
        connect(this, SIGNAL(saveAllPrefs(void)),
    	    m_messageWindow[i], SLOT(savePrefs(void)));
        connect(this, SIGNAL(restoreFonts(void)),
    	    m_messageWindow[i], SLOT(restoreFont(void)));
        
        m_messageWindow[i]->restoreSize();
    
    
        // restore it's position if necessary and practical
        if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
          m_messageWindow[i]->restorePosition();
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_messageWindow[i]);
      }
          
      // make sure it's visible
      m_messageWindow[i]->show();
    }
    
    
    void EQInterface::showSpawnList(void)
    {
      // if it doesn't exist, create it.
      if (m_spawnList == 0)
      {
        m_spawnList = new SpawnListWindow (m_player, m_spawnShell, m_categoryMgr,
    				       0, "spawnlist");
        setDockEnabled(m_spawnList, 
    		   pSEQPrefs->getPrefBool("DockableSpawnList",
    					  "Interface", true));
    
    
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					    m_spawnList->preferenceName(),
    					    Left);
        addDockWindow(m_spawnList, edge, false);
        if (m_isSpawnListDocked)
          m_spawnList->undock();
    
    
        // restore the size of the spawn list
        m_spawnList->restoreSize();
    
    
        // only do this move stuff iff the spawn list isn't docked
        // and the user set the option to do so.
        if (!m_isSpawnListDocked &&
    	pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0)) 
          m_spawnList->restorePosition();
    
    
         // connections from spawn list to interface
         connect (m_spawnList->spawnList(), SIGNAL(spawnSelected(const Item*)),
    	      this, SLOT(spawnSelected(const Item*)));
    
    
         // connections from interface to spawn list
         connect (this, SIGNAL(selectSpawn(const Item*)),
    	      m_spawnList->spawnList(), SLOT(selectSpawn(const Item*)));
         connect(this, SIGNAL(saveAllPrefs(void)),
    	     m_spawnList, SLOT(savePrefs(void)));
         connect(this, SIGNAL(restoreFonts(void)),
    	     m_spawnList, SLOT(restoreFont(void)));
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_spawnList);
      }
    
    
      // make sure it's visible
      m_spawnList->show();
    }
    
    
    void EQInterface::showSpawnList2(void)
    {
      // if it doesn't exist, create it.
      if (m_spawnList2 == 0)
      {
        m_spawnList2 = new SpawnListWindow2(m_player, m_spawnShell, 
    					m_categoryMgr,
    					0, "spawnlist");
       setDockEnabled(m_spawnList2, 
    		  pSEQPrefs->getPrefBool("DockableSpawnList2",
    					 "Interface", true));
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					    m_spawnList2->preferenceName(),
    					    Left);
        addDockWindow(m_spawnList2, edge, false);
        if (!m_isSpawnList2Docked)
          m_spawnList2->undock();
    
    
        // restore the size of the spawn list
        m_spawnList2->restoreSize();
    
    
        // only do this move stuff iff the spawn list isn't docked
        // and the user set the option to do so.
        if (!m_isSpawnList2Docked &&
    	pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0)) 
          m_spawnList2->restorePosition();
    
    
         // connections from spawn list to interface
         connect (m_spawnList2, SIGNAL(spawnSelected(const Item*)),
    	      this, SLOT(spawnSelected(const Item*)));
    
    
         // connections from interface to spawn list
         connect (this, SIGNAL(selectSpawn(const Item*)),
    	      m_spawnList2, SLOT(selectSpawn(const Item*)));
         connect(this, SIGNAL(saveAllPrefs(void)),
    	     m_spawnList2, SLOT(savePrefs(void)));
         connect(this, SIGNAL(restoreFonts(void)),
    	     m_spawnList2, SLOT(restoreFont(void)));
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_spawnList2);
      }
    
    
      // make sure it's visible
      m_spawnList2->show();
    }
    
    
    void EQInterface::showSpawnPointList(void)
    {
      // if it doesn't exist, create it.
      if (m_spawnPointList == 0)
      {
          m_spawnPointList = new SpawnPointWindow(m_spawnMonitor,
    					      0, "spawnlist");
          setDockEnabled(m_spawnPointList, 
    		     pSEQPrefs->getPrefBool("DockableSpawnPointList",
    					    "Interface", true));
          Dock edge = 
    	(Dock)pSEQPrefs->getPrefInt("Dock", 
    				    m_spawnPointList->preferenceName(),
    				    Left);
          addDockWindow(m_spawnPointList, edge, false);
          if (!m_isSpawnPointListDocked)
    	m_spawnPointList->undock();
    
    
        // restore the size of the spawn list
        m_spawnPointList->restoreSize();
    
    
        // only do this move stuff iff the spawn list isn't docked
        // and the user set the option to do so.
        if (!m_isSpawnPointListDocked &&
    	pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0)) 
          m_spawnPointList->restorePosition();
    
    
         // connections from interface to spawn list
         connect(this, SIGNAL(saveAllPrefs(void)),
    	     m_spawnPointList, SLOT(savePrefs(void)));
         connect(this, SIGNAL(restoreFonts(void)),
    	     m_spawnPointList, SLOT(restoreFont(void)));
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_spawnPointList);
      }
    
    
      // make sure it's visible
      m_spawnPointList->show();
    }
    
    
    void EQInterface::showStatList(void)
    {
      // if it doesn't exist, create it
      if (m_statList == 0)
      {
        m_statList = new StatListWindow(m_player, 0, "stats");
        setDockEnabled(m_statList, 
    		   pSEQPrefs->getPrefBool("DockablePlayerStats",
    					  "Interface", true));
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					    m_statList->preferenceName(),
    					    Left);
        addDockWindow(m_statList, edge, false);
        if (!m_isStatListDocked)
          m_statList->undock();
    
    
        // connect stat list slots to interface signals
        connect(this, SIGNAL(saveAllPrefs(void)),
    	    m_statList, SLOT(savePrefs(void)));
        connect(this, SIGNAL(restoreFonts(void)),
    	    m_statList, SLOT(restoreFont(void)));
    
    
        // restore the size of the spawn list
        m_statList->restoreSize();
    
    
        // only do this move stuff iff the spawn list isn't docked
        // and the user set the option to do so.
        if (!m_isStatListDocked &&
    	pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0)) 
          m_statList->restorePosition();
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_statList);
      }
    
    
      // make sure it's visible
      m_statList->show();
    }
    
    
    void EQInterface::showSkillList(void)
    {
      // if it doesn't exist, create it
      if (m_skillList == 0)
      {
        m_skillList = new SkillListWindow(m_player, 0, "skills");
        setDockEnabled(m_skillList, 
    		   pSEQPrefs->getPrefBool("DockablePlayerSkills",
    					  "Interface", true));
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					    m_skillList->preferenceName(),
    					    Left);
        addDockWindow(m_skillList, edge, false);
        if (!m_isSkillListDocked)
          m_skillList->undock();
    
    
        // connect skill list slots to interfaces signals
        connect(this, SIGNAL(saveAllPrefs(void)),
    	    m_skillList, SLOT(savePrefs(void)));
        connect(this, SIGNAL(restoreFonts(void)),
    	    m_skillList, SLOT(restoreFont(void)));
    
    
        // restore the size of the spawn list
        m_skillList->restoreSize();
    
    
        // only do this move stuff iff the spawn list isn't docked
        // and the user set the option to do so.
        if (!m_isSkillListDocked &&
    	pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0)) 
          m_skillList->restorePosition();
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_skillList);
      }
    
    
      // make sure it's visible
      m_skillList->show();
    }
    
    
    void EQInterface::showSpellList(void)
    {
      // if it doesn't exist, create it
      if (m_spellList == 0)
      {
        m_spellList = new SpellListWindow(m_spellShell, this, "spelllist");
        setDockEnabled(m_spellList, 
    		   pSEQPrefs->getPrefBool("DockableSpellList",
    					  "Interface", true));
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					    m_spellList->preferenceName(),
    					    Left);
        addDockWindow(m_spellList, edge, false);
        if (!m_isSpellListDocked)
          m_spellList->undock();
    
    
        SpellList* spellList = m_spellList->spellList();
    
    
        // connect SpellShell to SpellList
        connect(m_spellShell, SIGNAL(addSpell(const SpellItem *)),
    	    spellList, SLOT(addSpell(const SpellItem *)));
        connect(m_spellShell, SIGNAL(delSpell(const SpellItem *)),
    	    spellList, SLOT(delSpell(const SpellItem *)));
        connect(m_spellShell, SIGNAL(changeSpell(const SpellItem *)),
    	    spellList, SLOT(changeSpell(const SpellItem *)));
        connect(m_spellShell, SIGNAL(clearSpells()),
    	    spellList, SLOT(clear()));
        connect(this, SIGNAL(saveAllPrefs(void)),
    	    m_spellList, SLOT(savePrefs(void)));
        connect(this, SIGNAL(restoreFonts(void)),
    	    m_spellList, SLOT(restoreFont(void)));
    
    
        // restore the size of the spell list
        m_spellList->restoreSize();
    
    
        // only do this move stuff iff the spell list isn't docked
        // and the user set the option to do so.
        if (!m_isSpellListDocked &&
    	pSEQPrefs->getPrefBool("UseWindowPos", "Interface", 0)) 
          m_spellList->restorePosition();
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_spellList);
      }
    
    
      // make sure it's visible
      m_spellList->show();
    }
    
    
    void EQInterface::showCompass(void)
    {
      // if it doesn't exist, create it.
      if (m_compass == 0)
      {
        m_compass = new CompassFrame(m_player, 0, "compass");
        setDockEnabled(m_compass, 
    		   pSEQPrefs->getPrefBool("DockableCompass",
    					  "Interface", true));
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					    m_compass->preferenceName(),
    					    Left);
        addDockWindow(m_compass, edge, false);
        if (!m_isCompassDocked)
          m_compass->undock();
    
    
        // supply the compass slots with EQInterface signals
        connect (this, SIGNAL(selectSpawn(const Item*)),
    	     m_compass, SLOT(selectSpawn(const Item*)));
        connect(this, SIGNAL(restoreFonts(void)),
    	    m_compass, SLOT(restoreFont(void)));
        connect(this, SIGNAL(saveAllPrefs(void)),
    	    m_compass, SLOT(savePrefs(void)));
    
    
        m_compass->restoreSize();
    
    
        // move window to new position
        if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
          m_compass->restorePosition(); 
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_compass);
     }
    
    
      // make sure it's visible
      m_compass->show();
    }
    
    
    void EQInterface::showNetDiag()
    {
      if (m_netDiag == 0)
      {
        m_netDiag = new NetDiag(m_packet, 0, "NetDiag");
        setDockEnabled(m_netDiag, 
    		   pSEQPrefs->getPrefBool("DockableNetDiag",
    					  "Interface", true));
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					    m_netDiag->preferenceName(),
    					    Bottom);
        addDockWindow(m_netDiag, edge, true);
        m_netDiag->undock();
    
    
        connect(this, SIGNAL(restoreFonts(void)),
    	    m_netDiag, SLOT(restoreFont(void)));
        connect(this, SIGNAL(saveAllPrefs(void)),
    	    m_netDiag, SLOT(savePrefs(void)));
    
    
        m_netDiag->restoreSize();
        
        // move window to new position
        if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
          m_netDiag->restorePosition(); 
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_netDiag);
      }
    
    
      // make sure it's visible
      m_netDiag->show();
    }
    
    
    void EQInterface::showGuildList(void)
    {
      if (!m_guildListWindow)
      {
        m_guildListWindow = new GuildListWindow(m_player, m_guildShell, 
    					    0, "GuildList");
        setDockEnabled(m_guildListWindow, 
    		   pSEQPrefs->getPrefBool("DockableGuildListWindow",
    					  "Interface", true));
        Dock edge = (Dock)pSEQPrefs->getPrefInt("Dock", 
    					    m_guildListWindow->preferenceName(),
    					    Bottom);
        addDockWindow(m_guildListWindow, edge, true);
        m_guildListWindow->undock();
    
    
        connect(this, SIGNAL(restoreFonts(void)),
    	    m_guildListWindow, SLOT(restoreFont(void)));
        connect(this, SIGNAL(saveAllPrefs(void)),
    	    m_guildListWindow, SLOT(savePrefs(void)));
    
    
        m_guildListWindow->restoreSize();
        
        // move window to new position
        if (pSEQPrefs->getPrefBool("UseWindowPos", "Interface", true))
          m_guildListWindow->restorePosition(); 
    
    
        // insert its menu into the window menu
        insertWindowMenu(m_guildListWindow);
      }
    
    
      // make sure it's visible
      m_guildListWindow->show();
    }
    
    
    void EQInterface::createFilteredSpawnLog(void)
    {
      if (m_filteredSpawnLog)
        return;
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs",
    							   "filtered_spawns.log");
      
      m_filteredSpawnLog = new FilteredSpawnLog(m_dateTimeMgr, m_filterMgr,
    					    logFileInfo.absFilePath());
    
    
      connect(m_spawnShell, SIGNAL(addItem(const Item*)),
    	  m_filteredSpawnLog, SLOT(addItem(const Item*)));
      connect(m_spawnShell, SIGNAL(delItem(const Item*)),
    	  m_filteredSpawnLog, SLOT(delItem(const Item*)));
      connect(m_spawnShell, SIGNAL(killSpawn(const Item*, const Item*, uint16_t)),
    	  m_filteredSpawnLog, SLOT(killSpawn(const Item*)));
    }
    
    
    void EQInterface::createSpawnLog(void)
    {
      // if the spawnLogger already exists, then nothing to do... 
      if (m_spawnLogger)
        return;
    
    
      QString logFile = pSEQPrefs->getPrefString("SpawnLogFilename",
    					     "Misc", 
    					     "spawnlog.txt");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
      
      logFile = logFileInfo.absFilePath();
    
    
       // create the spawn logger
       m_spawnLogger = new SpawnLog(m_dateTimeMgr, logFile);
    
    
       // initialize it with the current state
       QString shortZoneName = m_zoneMgr->shortZoneName();
       if (!shortZoneName.isEmpty())
         m_spawnLogger->logNewZone(shortZoneName);
    
    
       // Connect SpawnLog slots to ZoneMgr signals
       connect(m_zoneMgr, SIGNAL(zoneBegin(const QString&)),
    	   m_spawnLogger, SLOT(logNewZone(const QString&)));
    
    
       // Connect SpawnLog slots to EQPacket signals
       m_packet->connect2("OP_ZoneSpawns", SP_Zone, DIR_Server,
    		      "spawnStruct", SZC_Modulus,
    		      m_spawnLogger, SLOT(logZoneSpawns(const uint8_t*, size_t)));
    // OP_NewSpawn is deprecated in the client
    //    m_packet->connect2("OP_NewSpawn", SP_Zone, DIR_Server,
    // 		      "spawnStruct", SZC_Match,
    // 		      m_spawnLogger, SLOT(logNewSpawn(const uint8_t*)));
       
       // Connect SpawnLog slots to SpawnShell signals
       connect(m_spawnShell, SIGNAL(delItem(const Item*)),
    	   m_spawnLogger, SLOT(logDeleteSpawn(const Item *)));
       connect(m_spawnShell, SIGNAL(killSpawn(const Item*, const Item*, uint16_t)),
    	   m_spawnLogger, SLOT(logKilledSpawn(const Item *, const Item*, uint16_t)));
    }
    
    
    void EQInterface::createGlobalLog(void)
    {
      if (m_globalLog)
        return;
    
    
      QString logFile = pSEQPrefs->getPrefString("GlobalLogFilename",
    					     "PacketLogging",
    					     "global.log");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
      
      m_globalLog = new PacketLog(*m_packet, 
    			      logFileInfo.absFilePath(),
    			      this, "GlobalLog");
    
    
      connect(m_packet, SIGNAL(newPacket(const EQUDPIPPacketFormat&)),
    	  m_globalLog, SLOT(logData(const EQUDPIPPacketFormat&)));
    }
    
    
    void EQInterface::createWorldLog(void)
    {
      if (m_worldLog)
        return;
    
    
      QString logFile = pSEQPrefs->getPrefString("WorldLogFilename",
    					     "PacketLogging",
    					     "world.log");
      
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
      
      m_worldLog = new PacketStreamLog(*m_packet, 
    				   logFileInfo.absFilePath(),
    				   this, "WorldLog");
    
    
      m_worldLog->setRaw(pSEQPrefs->getPrefBool("LogRawPackets", "PacketLogging",
    					   false));
    
    
      connect(m_packet, SIGNAL(rawWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t)),
    	  m_worldLog, SLOT(rawStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t)));
      connect(m_packet, SIGNAL(decodedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)),
    	  m_worldLog, SLOT(decodedStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)));
    }
    
    
    void EQInterface::createZoneLog(void)
    {
      if (m_zoneLog)
        return;
      
      QString logFile = pSEQPrefs->getPrefString("ZoneLogFilename",
    					     "PacketLogging",
    					     "zone.log");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
      
      m_zoneLog = new PacketStreamLog(*m_packet, 
    				  logFileInfo.absFilePath(),
    				  this, "ZoneLog");
    
    
      m_zoneLog->setRaw(pSEQPrefs->getPrefBool("LogRawPackets", "PacketLogging",
    					   false));
      
      m_zoneLog->setDir(0);
    
    
      connect(m_packet, SIGNAL(rawZonePacket(const uint8_t*, size_t, uint8_t, uint16_t)),
    	  m_zoneLog, SLOT(rawStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t)));
      connect(m_packet, SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)),
    	  m_zoneLog, SLOT(decodedStreamPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*)));
    }
    
    
    void EQInterface::createBazaarLog(void)
    {
      if (m_bazaarLog)
        return;
      
      QString logFile = pSEQPrefs->getPrefString("BazaarLogFilename",
    					     "PacketLogging",
    					     "bazaar.log");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
      
      m_bazaarLog = new BazaarLog(*m_packet,
    			      logFileInfo.absFilePath(),
    			      this,
    			      *m_spawnShell,
    			      "BazaarLog");
      m_packet->connect2("OP_BazaarSearch", SP_Zone, DIR_Server,
    		     "bazaarSearchResponseStruct", SZC_Modulus,
    		     m_bazaarLog, SLOT(bazaarSearch(const uint8_t*, size_t, uint8_t)));
    }
    
    
    void EQInterface::createUnknownZoneLog(void)
    {
      if (m_unknownZoneLog)
        return;
    
    
      QString section = "PacketLogging";
    
    
      QString logFile = pSEQPrefs->getPrefString("UnknownZoneLogFilename",
    					     section,
    					     "unknownzone.log");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
      
      logFile = logFileInfo.absFilePath();
    
    
      m_unknownZoneLog = new UnknownPacketLog(*m_packet, 
    					  logFile,
    					  this, "UnknownLog");
    
    
      m_unknownZoneLog->setView(pSEQPrefs->getPrefBool("ViewUnknown", section, 
    						   false));
    
    
      connect(m_packet, SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)),
    	  m_unknownZoneLog, SLOT(packet(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)));
      connect(m_packet, SIGNAL(decodedWorldPacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)),
    	  m_unknownZoneLog, SLOT(packet(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)));
    }
    
    
    void EQInterface::createOPCodeMonitorLog(const QString& opCodeList)
    {
      if (m_opcodeMonitorLog)
        return;
      
      QString section = "OpCodeMonitoring";
    
    
      QString logFile = pSEQPrefs->getPrefString("LogFilename", 
    					     section, 
    					     "opcodemonitor.log");
    
    
      QFileInfo logFileInfo = m_dataLocationMgr->findWriteFile("logs", logFile);
      
      logFile = logFileInfo.absFilePath();
    
    
      m_opcodeMonitorLog = new OPCodeMonitorPacketLog(*m_packet, 
    						  logFile,
    						  this, "OpCodeMonitorLog");
      
      m_opcodeMonitorLog->init(opCodeList);
      m_opcodeMonitorLog->setLog(pSEQPrefs->getPrefBool("Log", section, false));
      m_opcodeMonitorLog->setView(pSEQPrefs->getPrefBool("View", section, false));
      
      connect(m_packet, SIGNAL(decodedZonePacket(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)),
    	  m_opcodeMonitorLog, SLOT(packet(const uint8_t*, size_t, uint8_t, uint16_t, const EQPacketOPCode*, bool)));
    }
    
    
    
    
    void EQInterface::insertWindowMenu(SEQWindow* window)
    {
      QPopupMenu* menu = window->menu();
      if (menu)
      {
        // insert the windows menu into the window menu
        int id = m_windowMenu->insertItem(window->caption(), menu);
    
    
        // insert it into the window to window menu id dictionary
        m_windowsMenus.insert((void*)window, new int(id));
      }
    }
    
    
    void EQInterface::removeWindowMenu(SEQWindow* window)
    {
      // find the windows menu id
      int* id = m_windowsMenus.find((void*)window);
    
    
      // if the window had a menu, then remove it
      if (id)
      {
        m_windowMenu->removeItem(*id);
    
    
        // remove the item from the list
        m_windowsMenus.remove(window);
      }
    }
    
    
    void EQInterface::setDockEnabled(QDockWindow* dw, bool enable)
    {
      QMainWindow::setDockEnabled(dw, DockTop, enable);
      QMainWindow::setDockEnabled(dw, DockBottom, enable);
      QMainWindow::setDockEnabled(dw, DockLeft, enable);
      QMainWindow::setDockEnabled(dw, DockRight, enable);
    }
    
    
    #ifndef QMAKEBUILD
    #include "interface.moc"
    #endif

    everquest.h
    Code:
    /*
     *  everquest.h
     *
     *  ShowEQ Distributed under GPL
     *  http://seq.sourceforge.net/
     */
    
    
    
    
    /*
    ** Please be kind and remember to correctly re-order
    ** the values in here whenever you add a new item,
    ** thanks.  - Andon
    */
    
    
    /*
    ** Structures used in the network layer of Everquest
    */
    
    
    #ifndef EQSTRUCT_H
    #define EQSTRUCT_H
    
    
    #include "config.h"
    
    
    #ifdef __FreeBSD__
    #include <sys/types.h>
    #else
    #include <stdint.h>
    #endif
    
    
    /*
    ** ShowEQ specific definitions
    */
    // Statistical list defines
    #define LIST_HP                         0
    #define LIST_MANA                       1
    #define LIST_STAM                       2
    #define LIST_EXP                        3
    #define LIST_FOOD                       4
    #define LIST_WATR                       5
    #define LIST_STR                        6
    #define LIST_STA                        7
    #define LIST_CHA                        8
    #define LIST_DEX                        9
    #define LIST_INT                        10
    #define LIST_AGI                        11
    #define LIST_WIS                        12
    #define LIST_MR                         13
    #define LIST_FR                         14
    #define LIST_CR                         15
    #define LIST_DR                         16
    #define LIST_PR                         17
    #define LIST_AC                         18
    #define LIST_ALTEXP                     19
    #define LIST_MAXLIST                    20 
    
    
    /*
    ** MOB Spawn Type
    */
    #define SPAWN_PLAYER                    0
    #define SPAWN_NPC                       1
    #define SPAWN_PC_CORPSE                 2
    #define SPAWN_NPC_CORPSE                3
    #define SPAWN_NPC_UNKNOWN               4
    #define SPAWN_DROP                      6
    #define SPAWN_DOOR                      7
    #define SPAWN_SELF                      10
    
    
    /* 
    ** Diety List
    */
    #define DEITY_UNKNOWN                   0
    #define DEITY_AGNOSTIC			396
    #define DEITY_BRELL			202
    #define DEITY_CAZIC			203
    #define DEITY_EROL			204
    #define DEITY_BRISTLE			205
    #define DEITY_INNY			206
    #define DEITY_KARANA			207
    #define DEITY_MITH			208
    #define DEITY_PREXUS			209
    #define DEITY_QUELLIOUS			210
    #define DEITY_RALLOS			211
    #define DEITY_SOLUSEK			213
    #define DEITY_TRIBUNAL			214
    #define DEITY_TUNARE			215
    #define DEITY_BERT			201	
    #define DEITY_RODCET			212
    #define DEITY_VEESHAN			216
    
    
    //Team numbers for Deity teams
    #define DTEAM_GOOD			1
    #define DTEAM_NEUTRAL			2
    #define DTEAM_EVIL			3
    #define DTEAM_OTHER			5
    
    
    //Team numbers for Race teams
    #define RTEAM_HUMAN			1
    #define RTEAM_ELF			2
    #define RTEAM_DARK			3
    #define RTEAM_SHORT			4
    #define RTEAM_OTHER			5
    
    
    //Maximum limits of certain types of data
    #define MAX_KNOWN_SKILLS                100
    #define MAX_SPELL_SLOTS                 16
    #define MAX_KNOWN_LANGS                 32
    #define MAX_SPELLBOOK_SLOTS             720
    #define MAX_GROUP_MEMBERS               6
    #define MAX_BUFFS                       42
    #define MAX_GUILDS                      8192
    #define MAX_AA                          300
    #define MAX_BANDOLIERS                  20
    #define MAX_POTIONS_IN_BELT             5
    #define MAX_TRIBUTES                    5
    #define MAX_DISCIPLINES                 200
    
    
    //Item Flags
    #define ITEM_NORMAL                     0x0000
    #define ITEM_NORMAL1                    0x0031
    #define ITEM_NORMAL2                    0x0036
    #define ITEM_NORMAL3                    0x315f
    #define ITEM_NORMAL4                    0x3336
    #define ITEM_NORMAL5                    0x0032
    #define ITEM_NORMAL6                    0x0033
    #define ITEM_NORMAL7                    0x0034
    #define ITEM_NORMAL8                    0x0039
    #define ITEM_CONTAINER                  0x7900
    #define ITEM_CONTAINER_PLAIN            0x7953
    #define ITEM_BOOK                       0x7379
    #define ITEM_VERSION                    0xFFFF
    
    
    // Item spellId no spell value
    #define ITEM_SPELLID_NOSPELL            0xffff
    
    
    // Item Field Count
    #define ITEM_FIELD_SEPERATOR_COUNT      117
    #define ITEM_CMN_FIELD_SEPERATOR_COUNT  102
    
    
    //Combat Flags
    #define COMBAT_MISS						0
    #define COMBAT_BLOCK					-1
    #define COMBAT_PARRY					-2
    #define COMBAT_RIPOSTE					-3
    #define COMBAT_DODGE					-4
    
    
    #define PLAYER_CLASSES     16
    #define PLAYER_RACES       15
    
    
    /*
    ** Item Packet Type
    */
    enum ItemPacketType
    {
      ItemPacketViewLink		= 0x00,
      ItemPacketMerchant		= 0x64,
      ItemPacketLoot		= 0x66,
      ItemPacketTrade		= 0x67,
      ItemPacketSummonItem		= 0x6a,
      ItemPacketWorldContainer       = 0x6b
    };
    
    
    /*
    ** Item types
    */
    enum ItemType
    {
      ItemTypeCommon		= 0,
      ItemTypeContainer	= 1,
      ItemTypeBook		= 2
    };
    
    
    /*
    ** Chat Colors
    */
    enum ChatColor
    {
      CC_Default               = 0,
      CC_DarkGrey              = 1,
      CC_DarkGreen             = 2,
      CC_DarkBlue              = 3,
      CC_Purple                = 5,
      CC_LightGrey             = 6,
      CC_User_Say              = 256,
      CC_User_Tell             = 257,
      CC_User_Group            = 258,
      CC_User_Guild            = 259,
      CC_User_OOC              = 260,
      CC_User_Auction          = 261,
      CC_User_Shout            = 262,
      CC_User_Emote            = 263,
      CC_User_Spells           = 264,
      CC_User_YouHitOther      = 265,
      CC_User_OtherHitYou      = 266,
      CC_User_YouMissOther     = 267,
      CC_User_OtherMissYou     = 268,
      CC_User_Duels            = 269,
      CC_User_Skills           = 270,
      CC_User_Disciplines      = 271,
      CC_User_Default          = 273,
      CC_User_MerchantOffer    = 275,
      CC_User_MerchantExchange = 276,
      CC_User_YourDeath        = 277,
      CC_User_OtherDeath       = 278,
      CC_User_OtherHitOther    = 279,
      CC_User_OtherMissOther   = 280,
      CC_User_Who              = 281,
      CC_User_Yell             = 282,
      CC_User_NonMelee         = 283,
      CC_User_SpellWornOff     = 284,
      CC_User_MoneySplit       = 285,
      CC_User_Loot             = 286,
      CC_User_Random           = 287,
      CC_User_OtherSpells      = 288,
      CC_User_SpellFailure     = 289,
      CC_User_ChatChannel      = 290,
      CC_User_Chat1            = 291,
      CC_User_Chat2            = 292,
      CC_User_Chat3            = 293,
      CC_User_Chat4            = 294,
      CC_User_Chat5            = 295,
      CC_User_Chat6            = 296,
      CC_User_Chat7            = 297,
      CC_User_Chat8            = 298,
      CC_User_Chat9            = 299,
      CC_User_Chat10           = 300,
      CC_User_MeleeCrit        = 301,
      CC_User_SpellCrit        = 302,
      CC_User_TooFarAway       = 303,
      CC_User_NPCRampage       = 304,
      CC_User_NPCFurry         = 305,
      CC_User_NPCEnrage        = 306,
      CC_User_EchoSay          = 307,
      CC_User_EchoTell         = 308,
      CC_User_EchoGroup        = 309,
      CC_User_EchoGuild        = 310,
      CC_User_EchoOOC          = 311,
      CC_User_EchoAuction      = 312,
      CC_User_EchoShout        = 313,
      CC_User_EchoEmote        = 314,
      CC_User_EchoChat1        = 315,
      CC_User_EchoChat2        = 316,
      CC_User_EchoChat3        = 317,
      CC_User_EchoChat4        = 318,
      CC_User_EchoChat5        = 319,
      CC_User_EchoChat6        = 320,
      CC_User_EchoChat7        = 321,
      CC_User_EchoChat8        = 322,
      CC_User_EchoChat9        = 323,
      CC_User_EchoChat10       = 324,
      CC_User_UnusedAtThisTime = 325,
      CC_User_ItemTags         = 326,
      CC_User_RaidSay          = 327,
      CC_User_MyPet            = 328,
      CC_User_DamageShield     = 329,
    };
    
    
    /*
    ** Group Update actions
    */
    enum GroupUpdateAction
    {
      GUA_Joined = 0,
      GUA_Left = 1,
      GUA_LastLeft = 6,
      GUA_FullGroupInfo = 7,
      GUA_MakeLeader = 8,
      GUA_Started = 9,
    };
    
    
    /**
     * Leadership AAs enum, used to index into leadershipAAs in charProfileStruct
     */
    enum LeadershipAAIndex
    {
      groupMarkNPC = 0,
      groupNPCHealth,
      groupDelegateMainAssist,
      groupDelegateMarkNPC,
      groupUnknown4,
      groupUnknown5,
      groupInspectBuffs,
      groupUnknown7,
      groupSpellAwareness,
      groupOffenseEnhancement,
      groupManaEnhancement,
      groupHealthEnhancement,
      groupHealthRegeneration,
      groupFindPathToPC,
      groupHealthOfTargetsTarget,
      groupUnknown15,
      raidMarkNPC,                                   //0x10
      raidNPCHealth,
      raidDelegateMainAssist,
      raidDelegateMarkNPC,
      raidUnknown4,
      raidUnknown5,
      raidUnknown6,
      raidSpellAwareness,
      raidOffenseEnhancement,
      raidManaEnhancement,
      raidHealthEnhancement,
      raidHealthRegeneration,
      raidFindPathToPC,
      raidHealthOfTargetsTarget,
      raidUnknown14,
      raidUnknown15,
      MAX_LEAD_AA //=32
    };
    
    
    /**
     * Recast timer types. Used as an off set to charProfileStruct timers.
     */
    enum RecastTypes
    {
      RecastTimer0 = 0,
      RecastTimer1,
      WeaponHealClickTimer,                          // 2
      MuramiteBaneNukeClickTimer,                    // 3
      RecastTimer4,
      DispellClickTimer,                             // 5 (also click heal orbs?)
      EpicTimer,                                     // 6
      OoWBPClickTimer,                               // 7
      VishQuestClassItemTimer,                       // 8
      HealPotionTimer,                               // 9
      RecastTimer10,
      RecastTimer11,
      RecastTimer12,
      RecastTimer13,
      RecastTimer14,
      RecastTimer15,
      RecastTimer16,
      RecastTimer17,
      RecastTimer18,
      ModRodTimer,                                   // 19
      MAX_RECAST_TYPES                               // 20
    };
    
    
    
    
    /*
    ** Compiler override to ensure
    ** byte aligned structures
    */
    #pragma pack(1)
    
    
    /*
    **            Generic Structures used in specific
    **                      structures below
    */
    
    
    // OpCode stuff (all kinda silly, but until we stop including the OpCode everywhere)...
    struct opCodeStruct
    {
        int16_t opCode;
    
    
      // kinda silly -- this is required for us to be able to stuff them in a QValueList
      bool operator== ( const opCodeStruct t ) const
      {
        return ( opCode == t.opCode);
      }
      bool operator== ( uint16_t opCode2 ) const
      {
        return ( opCode == opCode2 );
      }
    };
    
    
    /**
     * Session request on a stream. This is sent by the client to initiate
     * a session with the zone or world server.
     * 
     * Size: 12 Octets
     */
    struct SessionRequestStruct
    {
    /*0000*/ uint32_t unknown0000;
    /*0004*/ uint32_t sessionId;
    /*0008*/ uint32_t maxLength;
    /*0012*/
    };
    
    
    /**
     * Session response on a stream. This is the server replying to a session
     * request with session information.
     *
     * Size: 19 Octets
     */
    struct SessionResponseStruct
    {
    /*0000*/ uint32_t sessionId;
    /*0004*/ uint32_t key;
    /*0008*/ uint16_t unknown0008;
    /*0010*/ uint8_t unknown0010;
    /*0011*/ uint32_t maxLength;
    /*0015*/ uint32_t unknown0015;
    /*0019*/
    };
    
    
    /**
     * Session disconnect on a stream. This is the server telling the client to
     * close a stream.
     *
     * Size: 8 Octets
     */
    struct SessionDisconnectStruct
    {
    /*0000*/ uint8_t unknown[8];
    /*0008*/
    };
    
    
    /* 
     * Used in charProfileStruct
     * Size: 4 Octets
     */
    struct Color_Struct
    {
      union
      {
        struct
        {
    /*0000*/uint8_t blue;
    /*0001*/uint8_t red;
    /*0002*/uint8_t green;
    /*0003*/uint8_t unknown0003;
        } rgb;
    /*0000*/uint32_t color;
      };
    };
    
    
    /*
    * Used in charProfileStruct. Buffs
    * Length: 88 Octets
    */
    struct spellBuff
    {
    /*0000*/  uint8_t     unknown0000;               //
    /*0001*/  int8_t      level;                     // Level of person who cast buff
    /*0002*/  uint8_t     unknown0002;               //
    /*0003*/  uint8_t     unknown0003;               //
    /*0004*/  float       unknown0004;
    /*0008*/  int32_t     spellid;                   // Spell
    /*0012*/  int32_t     duration;                  // Time remaining in ticks
    /*0016*/  int32_t     effect;                    // holds the dmg absorb amount on runes
    /*0020*/  uint8_t     unknown0020[4];            // *** this might need to be swapped with playerId
    /*0024*/  uint32_t    playerId;                  // Global id of caster (for wear off)
    /*0028*/  uint8_t     unknown0028[60];
    /*0088*/
    };
    
    
    
    
    /* 
     * Used in charProfileStruct
     * Size: 12 Octets
     */
    struct AA_Array
    {
    /*000*/ uint32_t AA;
    /*004*/ uint32_t value;
    /*008*/ uint32_t unknown008;
    /*012*/
    };
    
    
    /**
     * Used in charProfileStruct. An item inline in the stream, used in Bandolier and Potion Belt.
     * Size: 72 Octets 
     */
    struct InlineItem
    {
    /*000*/ uint32_t itemId;
    /*004*/ uint32_t icon;
    /*008*/ char itemName[64];
    /*072*/
    };
    
    
    /**
     * Used in charProfileStruct. Contents of a Bandolier.
     * Size: 320 Octets 
     */
    struct BandolierStruct
    {
    /*000*/ char bandolierName[32];
    /*032*/ InlineItem mainHand;
    /*104*/ InlineItem offHand;
    /*176*/ InlineItem range;
    /*248*/ InlineItem ammo;
    /*320*/
    };
    
    
    /**
     * Used in charProfileStruct. A tribute a player can have loaded.
     * Size: 8 Octets 
     */
    struct TributeStruct
    {
    /*000*/ uint32_t tribute;
    /*004*/ uint32_t rank;
    /*008*/
    };
    
    
    /**
     * Used in charProfileStruct. A bind point.
     * Size: 20 Octets
     */
    struct BindStruct
    {
    /*000*/ uint32_t zoneId;
    /*004*/ float x;
    /*008*/ float y;
    /*012*/ float z;
    /*016*/ float heading;
    /*020*/
    };
    
    
    /*
     * Used in charProfileStruct. Visible Equipment.
     * Size: 20 Octets
     */
    struct EquipStruct
    {
    /*00*/ uint32_t equip0;
    /*04*/ uint32_t equip1;
    /*08*/ uint32_t equip2;
    /*12*/ uint32_t itemId;
    /*16*/ uint32_t equip3;
    /*20*/
    };
    
    
    /*
    ** Type:   Zone Change Request (before hand)
    ** Length: 92 Octets
    ** OpCode: ZoneChangeCode
    */
    struct zoneChangeStruct
    {
    /*0000*/ char     name[64];	     	         // Character Name
    /*0064*/ uint16_t zoneId;                        // zone Id
    /*0066*/ uint16_t zoneInstance;                  // zone Instance
    /*0068*/ uint8_t  unknown0068[8];                // unknown
    /*0076*/ uint8_t  unknown0076[12];               // ***Placeholder (6/29/2005)
    /*0088*/ uint8_t  unknown0088[4];                // HoT Beta (9/7/2010)
    /*0092*/
    };
    
    
    /*
    ** Type:  Request Zone Change (server asking the client to change zones)
    ** Size:  24 Octets
    ** OpCode: OP_RequestZoneChange
    */
    struct requestZoneChangeStruct
    {
    /*0000*/ uint16_t zoneId;                        // Zone to change to
    /*0002*/ uint16_t zoneInstance;                  // Instance to change to
    /*0004*/ float x;                                // Zone in x coord in next zone
    /*0008*/ float y;                                // Zone in y coord in next zone
    /*0012*/ float z;                                // Zone in z coord in next zone
    /*0016*/ float heading;                          // Zone in heading in next zone
    /*0020*/ uint32_t unknown0020;                   // *** Placeholder
    /*0024*/
    };
    
    
    /*
    ** Client Zone Entry struct
    ** Length: 76 Octets
    ** OpCode: ZoneEntryCode (when direction == client)
    */
    struct ClientZoneEntryStruct
    {
    /*0000*/ uint32_t unknown0000;                   // ***Placeholder
    /*0004*/ char     name[32];                      // Player firstname
    /*0036*/ uint8_t  unknown0036[28];               // ***Placeholder
    /*0064*/ uint32_t unknown0064[3];                // unknown
    /*0076*/
    };
    
    
    
    
    /*
    ** New Zone Code
    ** Length: 948 Octets
    ** OpCode: NewZoneCode
    */
    struct newZoneStruct
    {
    /*0000*/ char    name[64];                       // Character name
    /*0064*/ char    shortName[32];                  // Zone Short Name (maybe longer?)
    /*0096*/ char    unknown0096[96];
    /*0192*/ char    longName[278];                  // Zone Long Name
    /*0470*/ uint8_t ztype;                          // Zone type
    /*0471*/ uint8_t fog_red[4];                     // Zone fog (red)
    /*0475*/ uint8_t fog_green[4];                   // Zone fog (green)
    /*0479*/ uint8_t fog_blue[4];                    // Zone fog (blue)
    /*0483*/ uint8_t unknown0483[87];                // *** Placeholder
    /*0570*/ uint8_t sky;                            // Zone sky
    /*0571*/ uint8_t unknown0571[13];                // *** Placeholder
    /*0584*/ float   zone_exp_multiplier;            // Experience Multiplier
    /*0588*/ float   safe_y;                         // Zone Safe Y
    /*0592*/ float   safe_x;                         // Zone Safe X
    /*0596*/ float   safe_z;                         // Zone Safe Z
    /*0600*/ float   unknown0600;                    // *** Placeholder
    /*0604*/ float   unknown0604;                    // *** Placeholder
    /*0608*/ float   underworld;                     // Underworld
    /*0612*/ float   minclip;                        // Minimum view distance
    /*0616*/ float   maxclip;                        // Maximum view distance
    /*0620*/ uint8_t unknown0616[84];                // *** Placeholder
    /*0704*/ char    zonefile[64];                   // Zone file name?
    /*0768*/ uint8_t unknown0764[36];                // *** Placeholder (12/05/2006)
    /*0804*/ uint8_t unknown0800[32];                // *** Placeholder (02/13/2007)
    /*0836*/ uint8_t unknown0832[12];                // *** Placeholder 
    /*0848*/ uint8_t unknown0844[4];                 // *** Placeholder (06/29/2005)
    /*0852*/ uint8_t unknown0848[4];                 // *** Placeholder (09/13/2005)
    /*0856*/ uint8_t unknown0852[4];                 // *** Placeholder (02/21/2006)
    /*0860*/ uint8_t unknown0856[36];                // *** Placeholder (06/13/2006)
    /*0896*/ uint8_t unknown0892[12];                // *** Placeholder (12/05/2006)
    /*0908*/ uint8_t unknown0904[8];                 // *** Placeholder (02/13/2007)
    /*0916*/ uint8_t unknown0916[4];                 // *** Placeholder (11/24/2007)
    /*0920*/ uint8_t unknown0920[4];                 // *** Placeholder (01/17/2008)
    /*0924*/ uint8_t unknown0924[4];                 // *** Placeholder (09/03/2008)
    /*0928*/ uint8_t unknown0928[4];                 // *** Placeholder (10/07/2008)
    /*0932*/ uint8_t unknown0932[8];                 // *** Placeholder (11/04/2009)
    /*0940*/ uint8_t unknown0940[4];                 // *** Placeholder (12/15/2009)
    /*0944*/ uint8_t unknown0944[4];                 // *** Placeholder (11/15/2011)
    /*0948*/
    };
    
    
    /*
    ** Dynamic Zone Switch Info Struct
    ** Length: 32 Octets
    ** OpCode: DzSwitchInfo
    */
    struct dzSwitchInfo
    {
    /*0000*/ uint32_t unknown0000;
    /*0004*/ uint32_t show;                          // Show compass line
    /*0008*/ uint16_t zoneID;
    /*0010*/ uint16_t instanceID;
    /*0012*/ uint32_t type;                          // if(type != 1 && type > 2 && type <= 5) { color = green; } else { color = pink; }
    /*0016*/ uint32_t unknown0016;
    /*0020*/ float    y;
    /*0024*/ float    x;
    /*0028*/ float    z;
    /*0032*/
    };
    
    
    /*
    ** Dynamic Zone Info Struct
    ** Length: 208 Octets
    ** OpCode: DzInfo
    */
    struct dzInfo
    {
    /*0000*/ uint32_t unknown0000;
    /*0004*/ uint32_t unknown0004;
    /*0008*/ uint8_t  newDZ;
    /*0009*/ uint8_t  padding0009[3];
    /*0012*/ uint32_t maxPlayers;
    /*0016*/ char     dzName[128];                   // Instance name
    /*0144*/ char     name[64];                      // Your player's name
    /*0208*/
    };
    
    
    /**
     * Player Profile. Common part of charProfileStruct shared between
     * shrouding and zoning profiles.
     *
     * NOTE: Offsets are kept in here relative to OP_PlayerProfile to ease in
     *       diagnosing changes in that struct.
     */
    struct playerProfileStruct
    {
    /*00004*/ uint16_t  gender;                           // Player Gender - 0 Male, 1 Female
    /*00008*/ uint32_t  race;                             // Player race
    /*00012*/ uint32_t  class_;                           // Player class
    /*00016*/ uint8_t   unknown00016[44];                 // ***Placeholder
    /*00056*/ uint8_t   level;                            // Level of player
    /*00057*/ uint8_t   level1;                           // Level of player (again?)
    /*00058*/ uint8_t   unknown00058[2];                  // ***Placeholder
    /*00060*/ BindStruct binds[5];                        // Bind points (primary is first)
    /*00160*/ uint32_t  deity;                            // deity
    /*00164*/ uint32_t  intoxication;                     // Alcohol level (in ticks till sober?)
    /*00168*/ uint32_t  spellSlotRefresh[13];             // Refresh time (millis)
    /*00220*/ uint8_t   haircolor;                        // Player hair color
    /*00221*/ uint8_t   beardcolor;                       // Player beard color
    /*00222*/ uint8_t   unknown00222[6];                  // *** Placeholder
    /*00228*/ uint8_t   eyecolor1;                        // Player left eye color
    /*00229*/ uint8_t   eyecolor2;                        // Player right eye color
    /*00230*/ uint8_t   hairstyle;                        // Player hair style
    /*00231*/ uint8_t   beard;                            // Player beard type
    /*00232*/ uint8_t   unknown00232[4];                  // *** Placeholder
    /*00236*/ union
             {
               struct
               {
                   /*00236*/ EquipStruct equip_helmet;         // Equipment: Helmet visual
                   /*00256*/ EquipStruct equip_chest;          // Equipment: Chest visual
                   /*00276*/ EquipStruct equip_arms;           // Equipment: Arms visual
                   /*00296*/ EquipStruct equip_bracers;        // Equipment: Wrist visual
                   /*00316*/ EquipStruct equip_hands;          // Equipment: Hands visual
                   /*00336*/ EquipStruct equip_legs;           // Equipment: Legs visual
                   /*00356*/ EquipStruct equip_feet;           // Equipment: Boots visual
                   /*00376*/ EquipStruct equip_primary;        // Equipment: Main visual
                   /*00396*/ EquipStruct equip_secondary;      // Equipment: Off visual
               } equip;
                /*00416*/ EquipStruct equipment[22];
             };
    /*00416*/ uint8_t   unknown00416[268];                // *** Placeholder
    /*00416*/ uint8_t   unknowntmp[30];                   // *** Placeholder
    /*00688*/ Color_Struct item_tint[9];                  // RR GG BB 00
    /*00724*/ AA_Array  aa_array[MAX_AA];                 // AAs
    /*04324*/ uint32_t  points;                           // Unspent Practice points
    /*04328*/ uint32_t  MANA;                             // Current MANA
    /*04332*/ uint32_t  curHp;                            // Current HP without +HP equipment
    /*04336*/ uint32_t  STR;                              // Strength
    /*04340*/ uint32_t  STA;                              // Stamina
    /*04344*/ uint32_t  CHA;                              // Charisma
    /*04348*/ uint32_t  DEX;                              // Dexterity
    /*04352*/ uint32_t  INT;                              // Intelligence
    /*04356*/ uint32_t  AGI;                              // Agility
    /*04360*/ uint32_t  WIS;                              // Wisdom
    /*04364*/ uint8_t   unknown04364[28];                 // *** Placeholder
    /*04392*/ uint32_t  face;                             // Player face
    /*04396*/ uint8_t   unknown04396[180];                // *** Placeholder
    /*04576*/ int32_t   sSpellBook[729];                  // List of the Spells in spellbook
    /*07492*/ int32_t   sMemSpells[MAX_SPELL_SLOTS];      // List of spells memorized
    /*07540*/ uint8_t   unknown07540[17];                 // *** Placeholder
    /*07585*/ uint32_t  platinum;                         // Platinum Pieces on player
    /*07564*/ uint32_t  gold;                             // Gold Pieces on player
    /*07568*/ uint32_t  silver;                           // Silver Pieces on player
    /*07572*/ uint32_t  copper;                           // Copper Pieces on player
    /*07576*/ uint32_t  platinum_cursor;                  // Platinum Pieces on cursor
    /*07580*/ uint32_t  gold_cursor;                      // Gold Pieces on cursor
    /*07584*/ uint32_t  silver_cursor;                    // Silver Pieces on cursor
    /*07588*/ uint32_t  copper_cursor;                    // Copper Pieces on cursor
    /*07592*/ uint32_t  skills[MAX_KNOWN_SKILLS];         // List of skills
    /*07992*/ uint32_t  innateSkills[26];                 // innateSkills
    /*08096*/ uint8_t   unknown08096[16];                 // *** Placeholder
    /*08112*/ uint32_t  toxicity;                         // Potion Toxicity (15=too toxic, each potion adds 3)
    /*08116*/ uint32_t  thirst;                           // Drink (ticks till next drink)
    /*08120*/ uint32_t  hunger;                           // Food (ticks till next eat)
    /*08124*/ uint8_t   unknown08124[20];                 // *** Placeholder
    /*08140*/ spellBuff buffs[MAX_BUFFS];                 // Buffs currently on the player
    /*11836*/ uint32_t  disciplines[MAX_DISCIPLINES];     // Known disciplines
    /*12236*/ uint8_t   unknown12236[400];                // *** Placeholder
    /*12636*/ uint32_t recastTimers[MAX_RECAST_TYPES];    // Timers (GMT of last use)
    /*12716*/ uint8_t   unknown12716[480];                // *** Placeholder
    /*13196*/ uint32_t  endurance;                        // Current endurance
    /*13200*/ uint32_t  aa_spent;                         // Number of spent AA points (including glyphs)
    /*13204*/ uint32_t  aa_assigned;                      // Number of points currently assigned to AAs
    /*13208*/ uint32_t   unknown13208[4];                 // *** Placeholder
    /*13224*/ uint32_t  aa_unspent;                       // Unspent AA points
    /*13228*/ uint8_t   unknown13228[4];                  // *** Placeholder
    /*13232*/ BandolierStruct bandoliers[MAX_BANDOLIERS]; // bandolier contents
    /*19632*/ InlineItem potionBelt[MAX_POTIONS_IN_BELT]; // potion belt
    /*19992*/ uint8_t   unknown19992[92];                 // *** Placeholder
    /*20084*/
     };
    
    
    /*
    ** Player Profile
    ** Length: Variable
    ** OpCode: OP_PlayerProfile
    */
    struct charProfileStruct
    {
    /*00000*/ uint32_t  checksum;                         //
    /*00004*/ playerProfileStruct profile;                // Profile
    /*20084*/ char      name[64];                         // Name of player
    /*20148*/ char      lastName[32];                     // Last name of player
    /*20180*/ uint8_t   unknown20180[8];                  // *** Placeholder
    /*20188*/ int32_t   guildID;                          // guildID
    /*20192*/ uint32_t  birthdayTime;                     // character birthday
    /*20196*/ uint32_t  lastSaveTime;                     // character last save time
    /*20200*/ uint32_t  timePlayedMin;                    // time character played
    /*20204*/ uint8_t   unknown20204[4];                  // *** Placeholder
    /*20208*/ uint8_t   pvp;                              // 1=pvp, 0=not pvp
    /*20209*/ uint8_t   anon;                             // 2=roleplay, 1=anon, 0=not anon
    /*20210*/ uint8_t   gm;                               // 0=no, 1=yes (guessing!)
    /*20211*/ int8_t    guildstatus;                      // 0=member, 1=officer, 2=guildleader
    /*20212*/ uint8_t   unknown20212[16];                 // *** Placeholder
    /*20228*/ uint32_t  exp;                              // Current Experience
    /*20232*/ uint8_t   unknown20232[12];                 // *** Placeholder
    /*20244*/ uint8_t   languages[MAX_KNOWN_LANGS];       // List of languages
    /*20270*/ uint8_t   unknown20272[6];                  // All 0x00 (language buffer?)
    /*20276*/ float     y;                                // Players y position
    /*20280*/ float     x;                                // Players x position
    /*20284*/ float     z;                                // Players z position
    /*20288*/ float     heading;                          // Players heading
    /*20292*/ uint32_t  standState;                       // 0x64 = stand
    /*20296*/ uint32_t  platinum_bank;                    // Platinum Pieces in Bank
    /*20300*/ uint32_t  gold_bank;                        // Gold Pieces in Bank
    /*20304*/ uint32_t  silver_bank;                      // Silver Pieces in Bank
    /*20308*/ uint32_t  copper_bank;                      // Copper Pieces in Bank
    /*20312*/ uint32_t  platinum_shared;                  // Shared platinum pieces
    /*20316*/ uint8_t   unknown20316[6220];               // *** Placeholder
    /*26536*/ uint32_t  expansions;                       // Bitmask for expansions
    /*26540*/ uint8_t   unknown22540[12];                 // *** Placeholder
    /*26552*/ uint32_t  autosplit;                        // 0 = off, 1 = on
    /*26556*/ uint8_t   unknown26556[16];                 // *** Placeholder
    /*26572*/ uint16_t  zoneId;                           // see zones.h
    /*26574*/ uint16_t  zoneInstance;                     // Instance id
    /*26576*/ uint8_t   unknown26576[992];                // *** Placeholder
    /*27568*/ uint32_t  leadAAActive;                     // 0 = leader AA off, 1 = leader AA on
    /*27572*/ uint8_t   unknown27572[4];                  // *** Placeholder
    /*27576*/ uint32_t  ldon_guk_points;                  // Earned GUK points
    /*27580*/ uint32_t  ldon_mir_points;                  // Earned MIR points
    /*27584*/ uint32_t  ldon_mmc_points;                  // Earned MMC points
    /*27588*/ uint32_t  ldon_ruj_points;                  // Earned RUJ points
    /*27592*/ uint32_t  ldon_tak_points;                  // Earned TAK points
    /*27596*/ uint32_t  ldon_avail_points;                // Available LDON points
    /*27600*/ uint8_t   unknown27600[144];                // *** Placeholder
    /*27744*/ uint32_t  tributeTime;                      // Time remaining on tribute (millisecs)
    /*27748*/ uint32_t  careerTribute;                    // Total favor points for this char
    /*27752*/ uint32_t  unknown23536;                     // *** Placeholder
    /*27756*/ uint32_t  currentTribute;                   // Current tribute points
    /*27760*/ uint32_t  unknown23544;                     // *** Placeholder
    /*27764*/ uint32_t  tributeActive;                    // 0 = off, 1=on
    /*27768*/ TributeStruct tributes[MAX_TRIBUTES];       // Current tribute loadout
    /*27808*/ uint8_t   unknown27808[100];                // *** Placeholder
    /*27908*/ float     expGroupLeadAA;                   // Current group lead exp points
    /*27912*/ float     expRaidLeadAA;                    // Current raid lead AA exp points
    /*27916*/ uint32_t  groupLeadAAUnspent;               // Unspent group lead AA points
    /*27920*/ uint32_t  unknown27920;                     // ***Placeholder
    /*27924*/ uint32_t  raidLeadAAUnspent;                // Unspent raid lead AA points
    /*27928*/ uint32_t  unknown27928;                     // ***Placeholder
    /*27932*/ uint32_t  leadershipAAs[MAX_LEAD_AA];       // Leader AA ranks
    /*28060*/ uint8_t   unknown28060[128];                // *** Placeholder
    /*28188*/ uint32_t  airRemaining;                     // Air supply (seconds)
    /*28192*/ uint8_t   unknown28192[4592];               // *** Placeholder
    /*32784*/ uint32_t  expAA;                            // Exp earned in current AA point
    /*32788*/ uint8_t   unknown32788[40];                 // *** Placeholder
    /*32828*/ uint32_t  currentRadCrystals;               // Current count of radiant crystals
    /*32832*/ uint32_t  careerRadCrystals;                // Total count of radiant crystals ever
    /*32836*/ uint32_t  currentEbonCrystals;              // Current count of ebon crystals
    /*32840*/ uint32_t  careerEbonCrystals;               // Total count of ebon crystals ever
    /*32844*/ uint8_t   groupAutoconsent;                 // 0=off, 1=on
    /*32845*/ uint8_t   raidAutoconsent;                  // 0=off, 1=on
    /*32846*/ uint8_t   guildAutoconsent;                 // 0=off, 1=on
    /*32847*/ uint8_t   unknown32487[5];                  // ***Placeholder (6/29/2005)
    /*32852*/ uint32_t  showhelm;                         // 0=no, 1=yes
    /*32856*/ uint8_t   unknown32856[1048];               // ***Placeholder (2/13/2007)
    /*33904*/
     };
    
    
    #if 0
    // The following seem to be totally gone from charProfileStruct (9/13/05)
    /*2384*/ char      title[32];                    // Current character title
    /*2352*/ char      servername[32];               // server the char was created on
    /*2416*/ char      suffix[32];                   // Current character suffix
    #endif
    
    
    #if 1
    struct playerAAStruct {
    /*    0 */  uint8_t unknown0;
      union {
        uint8_t unnamed[17];
        struct _named {  
    /*    1 */  uint8_t innate_strength;
    /*    2 */  uint8_t innate_stamina;
    /*    3 */  uint8_t innate_agility;
    /*    4 */  uint8_t innate_dexterity;
    /*    5 */  uint8_t innate_intelligence;
    /*    6 */  uint8_t innate_wisdom;
    /*    7 */  uint8_t innate_charisma;
    /*    8 */  uint8_t innate_fire_protection;
    /*    9 */  uint8_t innate_cold_protection;
    /*   10 */  uint8_t innate_magic_protection;
    /*   11 */  uint8_t innate_poison_protection;
    /*   12 */  uint8_t innate_disease_protection;
    /*   13 */  uint8_t innate_run_speed;
    /*   14 */  uint8_t innate_regeneration;
    /*   15 */  uint8_t innate_metabolism;
    /*   16 */  uint8_t innate_lung_capacity;
    /*   17 */  uint8_t first_aid;
        } named;
      } general_skills;
      union {
        uint8_t unnamed[17];
        struct _named {
    /*   18 */  uint8_t healing_adept;
    /*   19 */  uint8_t healing_gift;
    /*   20 */  uint8_t unknown20;
    /*   21 */  uint8_t spell_casting_reinforcement;
    /*   22 */  uint8_t mental_clarity;
    /*   23 */  uint8_t spell_casting_fury;
    /*   24 */  uint8_t chanelling_focus;
    /*   25 */  uint8_t unknown25;
    /*   26 */  uint8_t unknown26;
    /*   27 */  uint8_t unknown27;
    /*   28 */  uint8_t natural_durability;
    /*   29 */  uint8_t natural_healing;
    /*   30 */  uint8_t combat_fury;
    /*   31 */  uint8_t fear_resistance;
    /*   32 */  uint8_t finishing_blow;
    /*   33 */  uint8_t combat_stability;
    /*   34 */  uint8_t combat_agility;
        } named;
      } archetype_skills;
      union {
        uint8_t unnamed[93];
        struct _name {
    /*   35 */  uint8_t mass_group_buff;             // All group-buff-casting classes(?)
    // ===== Cleric =====
    /*   36 */  uint8_t divine_resurrection;
    /*   37 */  uint8_t innate_invis_to_undead;      // cleric, necromancer
    /*   38 */  uint8_t celestial_regeneration;
    /*   39 */  uint8_t bestow_divine_aura;
    /*   40 */  uint8_t turn_undead;
    /*   41 */  uint8_t purify_soul;
    // ===== Druid =====
    /*   42 */  uint8_t quick_evacuation;            // wizard, druid
    /*   43 */  uint8_t exodus;                      // wizard, druid
    /*   44 */  uint8_t quick_damage;                // wizard, druid
    /*   45 */  uint8_t enhanced_root;               // druid
    /*   46 */  uint8_t dire_charm;                  // enchanter, druid, necromancer
    // ===== Shaman =====
    /*   47 */  uint8_t cannibalization;
    /*   48 */  uint8_t quick_buff;                  // shaman, enchanter
    /*   49 */  uint8_t alchemy_mastery;
    /*   50 */  uint8_t rabid_bear;
    // ===== Wizard =====
    /*   51 */  uint8_t mana_burn;
    /*   52 */  uint8_t improved_familiar;
    /*   53 */  uint8_t nexus_gate;
    // ===== Enchanter  =====
    /*   54 */  uint8_t unknown54;
    /*   55 */  uint8_t permanent_illusion;
    /*   56 */  uint8_t jewel_craft_mastery;
    /*   57 */  uint8_t gather_mana;
    // ===== Mage =====
    /*   58 */  uint8_t mend_companion;              // mage, necromancer
    /*   59 */  uint8_t quick_summoning;
    /*   60 */  uint8_t frenzied_burnout;
    /*   61 */  uint8_t elemental_form_fire;
    /*   62 */  uint8_t elemental_form_water;
    /*   63 */  uint8_t elemental_form_earth;
    /*   64 */  uint8_t elemental_form_air;
    /*   65 */  uint8_t improved_reclaim_energy;
    /*   66 */  uint8_t turn_summoned;
    /*   67 */  uint8_t elemental_pact;
    // ===== Necromancer =====
    /*   68 */  uint8_t life_burn;
    /*   69 */  uint8_t dead_mesmerization;
    /*   70 */  uint8_t fearstorm;
    /*   71 */  uint8_t flesh_to_bone;
    /*   72 */  uint8_t call_to_corpse;
    // ===== Paladin =====
    /*   73 */  uint8_t divine_stun;
    /*   74 */  uint8_t improved_lay_of_hands;
    /*   75 */  uint8_t slay_undead;
    /*   76 */  uint8_t act_of_valor;
    /*   77 */  uint8_t holy_steed;
    /*   78 */  uint8_t fearless;                    // paladin, shadowknight
    
    
    /*   79 */  uint8_t two_hand_bash;               // paladin, shadowknight
    // ===== Ranger =====
    /*   80 */  uint8_t innate_camouflage;           // ranger, druid
    /*   81 */  uint8_t ambidexterity;               // all "dual-wield" users
    /*   82 */  uint8_t archery_mastery;             // ranger
    /*   83 */  uint8_t unknown83;
    /*   84 */  uint8_t endless_quiver;              // ranger
    // ===== Shadow Knight =====
    /*   85 */  uint8_t unholy_steed;
    /*   86 */  uint8_t improved_harm_touch;
    /*   87 */  uint8_t leech_touch;
    /*   88 */  uint8_t unknown88;
    /*   89 */  uint8_t soul_abrasion;
    // ===== Bard =====
    /*   90 */  uint8_t instrument_mastery;
    /*   91 */  uint8_t unknown91;
    /*   92 */  uint8_t unknown92;
    /*   93 */  uint8_t unknown93;
    /*   94 */  uint8_t jam_fest;
    /*   95 */  uint8_t unknown95;
    /*   96 */  uint8_t unknown96;
    // ===== Monk =====
    /*   97 */  uint8_t critical_mend;
    /*   98 */  uint8_t purify_body;
    /*   99 */  uint8_t unknown99;
    /*  100 */  uint8_t rapid_feign;
    /*  101 */  uint8_t return_kick;
    // ===== Rogue =====
    /*  102 */  uint8_t escape;
    /*  103 */  uint8_t poison_mastery;
    /*  104 */  uint8_t double_riposte;              // all "riposte" users
    /*  105 */  uint8_t unknown105;
    /*  106 */  uint8_t unknown106;
    /*  107 */  uint8_t purge_poison;                // rogue
    // ===== Warrior =====
    /*  108 */  uint8_t flurry;
    /*  109 */  uint8_t rampage;
    /*  110 */  uint8_t area_taunt;
    /*  111 */  uint8_t warcry;
    /*  112 */  uint8_t bandage_wound;
    // ===== (Other) =====
    /*  113 */  uint8_t spell_casting_reinforcement_mastery; // all "pure" casters
    /*  114 */  uint8_t unknown114;
    /*  115 */  uint8_t extended_notes;              // bard
    /*  116 */  uint8_t dragon_punch;                // monk
    /*  117 */  uint8_t strong_root;                 // wizard
    /*  118 */  uint8_t singing_mastery;             // bard
    /*  119 */  uint8_t body_and_mind_rejuvenation;  // paladin, ranger, bard
    /*  120 */  uint8_t physical_enhancement;        // paladin, ranger, bard
    /*  121 */  uint8_t adv_trap_negotiation;        // rogue, bard
    /*  122 */  uint8_t acrobatics;                  // all "safe-fall" users
    /*  123 */  uint8_t scribble_notes;              // bard
    /*  124 */  uint8_t chaotic_stab;                // rogue
    /*  125 */  uint8_t pet_discipline;              // all pet classes except enchanter
    /*  126 */  uint8_t unknown126;
    /*  127 */  uint8_t unknown127;
        } named;
      } class_skills;
    };
    #endif
    
    
    /*
    ** Generic Spawn Struct 
    ** Length: Variable.
    ** Used in: 
    **   dbSpawnStruct
    **   petStruct
    **   spawnShroudOther
    **   spawnShroudSelf
    */
    
    
    // Fixed-length struct that we'll fill with data from the variable-length packet,
    // unnecessary fields removed, arranged in order with the packet.
    struct spawnStruct
    {
    /*0000*/ char     name[64];
    /*0000*/ uint32_t spawnId;
    /*0000*/ uint8_t  level;
    /*0000*/ uint8_t  NPC;                           // 0=player,1=npc,2=pc corpse,3=npc corpse
    /*0000*/ union
             {
               struct
               {
                 unsigned   padding7:1;
                 unsigned   AFK:1;
                 unsigned   sneak:1;
                 unsigned   LFG:1;
                 unsigned   padding6:1;
                 unsigned   invis:1;
                 unsigned   padding5:11;
                 unsigned   gm:1;
                 unsigned   anon:1;                  // 0=normal, 1=anon, 2=roleplay
                 unsigned   padding4:1;
                 unsigned   gender:1;                // Gender (0=male, 1=female)
                 unsigned   padding3:1;
                 unsigned   linkdead:1;
                 unsigned   betabuffed:1;
                 unsigned   padding2:2;
                 unsigned   targetable:1;
                 unsigned   targetcyclable:1;
                 unsigned   padding1:2;
                 unsigned   trader:1;
                 unsigned   buyer:1;
               };
               int32_t miscData;
             };
    /*0000*/ uint8_t  otherData;                     // & 4 - has title, & 8 - has suffix, & 1 - it's a chest or untargetable
    /*0000*/ uint32_t race;
    /*0000*/ uint8_t  charProperties;
    /*0000*/ uint32_t bodytype;
    /*0000*/ uint32_t bodytype2;
    /*0000*/ uint8_t  curHp;
    /*0000*/ uint8_t  holding;
    /*0000*/ uint32_t deity;
    /*0000*/ uint32_t guildID;
    /*0000*/ uint32_t guildstatus;                   // 0=member, 1=officer, 2=leader, -1=not guilded
    /*0000*/ uint8_t  class_;
    /*0000*/ uint8_t  state;                         // stand state 
    /*0000*/ uint8_t  light;
    /*0000*/ char     lastName[32];
    /*0000*/ uint32_t petOwnerId;
             union
             {
               struct
               {
                 signed   padding0000:12;                // ***Placeholder
                 signed   deltaHeading:10;               // change in heading
                 signed   padding0005:10;                // ***Placeholder
                 signed   z:19;                          // z coord
                 signed   deltaZ:13;                     // change in z
                 signed   deltaY:13;                     // change in y
                 signed   y:19;                          // y coord
                 signed   x:19;                          // x coord
                 signed   deltaX:13;                     // change in x
                 unsigned heading:12;                    // heading
                 signed   animation:10;                  // animation
                 signed   padding0006:10;                // ***Placeholder
               };
               int32_t posData[5];
             };
    /*0000*/ union
             {
               struct
               {
                   /*0000*/ Color_Struct color_helmet;    // Color of helmet item
                   /*0000*/ Color_Struct color_chest;     // Color of chest item
                   /*0000*/ Color_Struct color_arms;      // Color of arms item
                   /*0000*/ Color_Struct color_bracers;   // Color of bracers item
                   /*0000*/ Color_Struct color_hands;     // Color of hands item
                   /*0000*/ Color_Struct color_legs;      // Color of legs item
                   /*0000*/ Color_Struct color_feet;      // Color of feet item
                   /*0000*/ Color_Struct color_primary;   // Color of primary item
                   /*0000*/ Color_Struct color_secondary; // Color of secondary item
               } equipment_colors;
                /*0000*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
             };
    /*0000*/ union
             {
               struct
               {
                   /*0000*/ EquipStruct equip_helmet;     // Equipment: Helmet visual
                   /*0000*/ EquipStruct equip_chest;      // Equipment: Chest visual
                   /*0000*/ EquipStruct equip_arms;       // Equipment: Arms visual
                   /*0000*/ EquipStruct equip_bracers;    // Equipment: Wrist visual
                   /*0000*/ EquipStruct equip_hands;      // Equipment: Hands visual
                   /*0000*/ EquipStruct equip_legs;       // Equipment: Legs visual
                   /*0000*/ EquipStruct equip_feet;       // Equipment: Boots visual
                   /*0000*/ EquipStruct equip_primary;    // Equipment: Main visual
                   /*0000*/ EquipStruct equip_secondary;  // Equipment: Off visual
               } equip;
                /*0000*/ EquipStruct equipment[9];
             };
    /*0000*/ char title[32];
    /*0000*/ char suffix[32];
    /*0000*/ uint8_t isMercenary;
    };
    
    
    #if 0
    // Basic structure of how the packet looks on the wire, for reference.
    // March 16, 2012 eqgame.exe
    struct spawnStruct
    {
    /*0000*/ char     name[0];
    /*0000*/ uint32_t spawnId;
    /*0000*/ uint8_t  level;
    /*0000*/ float    unknown1;
    /*0000*/ uint8_t  NPC;                           // 0=player,1=npc,2=pc corpse,3=npc corpse
    /*0000*/ unsigned   padding7:1;
             unsigned   AFK:1;
             unsigned   sneak:1;
             unsigned   LFG:1;
             unsigned   padding6:1;
             unsigned   invis:1;
             unsigned   padding5:11;
             unsigned   gm:1;
             unsigned   anon:1;                      // 0=normal, 1=anon, 2=roleplay
             unsigned   padding4:1;
             unsigned   gender:1;                    // Gender (0=male, 1=female)
             unsigned   padding3:1;
             unsigned   linkdead:1;
             unsigned   betabuffed:1;
             unsigned   padding2:2;
             unsigned   targetable:1;
             unsigned   targetcyclable:1;
             unsigned   padding1:2;
             unsigned   trader:1;
             unsigned   buyer:1;
    /*0000*/ uint8_t  otherData;                     // & 8 - has title, & 16 - has suffix, & 2 - auras, & 1 - it's a chest or untargetable
    /*0000*/ uint32_t unknown3;
    /*0000*/ uint32_t unknown4;
    /*0000*/ uint32_t unknown5;
    /*0000*/ uint8_t  facestyle;
    /*0000*/ float    walkspeed;
    /*0000*/ float    runspeed;
    /*0000*/ uint32_t race;
    /*0000*/ uint8_t  charProperties;                // for body types - value indicates how many properties are present
    /*0000*/ uint32_t bodytype;
    /*0000*/ uint32_t bodytype2;                     // this is only present if charProperties==2
                                                     // are there more than two possible properties?
    /*0000*/ uint8_t  curHp;
    /*0000*/ uint8_t  haircolor;
    /*0000*/ uint8_t  facialhaircolor;
    /*0000*/ uint8_t  eyecolor1;
    /*0000*/ uint8_t  eyecolor2;
    /*0000*/ uint8_t  hairstyle;
    /*0000*/ uint8_t  facialhair;
    /*0000*/ uint32_t heritage;
    /*0000*/ uint32_t tattoo;
    /*0000*/ uint32_t details;
    /*0000*/ uint8_t  holding;
    /*0000*/ uint32_t deity;
    /*0000*/ uint32_t guildID;
    /*0000*/ uint32_t guildstatus;                   // 0=member, 1=officer, 2=leader, -1=not guilded
    /*0000*/ uint8_t  class_;
    /*0000*/ uint8_t  PVP;
    /*0000*/ uint8_t  state;                         // stand state 
    /*0000*/ uint8_t  light;
    /*0000*/ uint8_t  unknown7;
    /*0000*/ uint8_t  unknown8;
    /*0000*/ uint8_t  unknown9;
    /*0000*/ uint8_t  unknown10;
    /*0000*/ uint8_t  unknown11;
    /*0000*/ char     lastName[0];
    /*0000*/ uint32_t AARank;
    /*0000*/ uint8_t  unknown12;
    /*0000*/ uint32_t petOwnerId;
    /*0000*/ uint8_t  unknown13;
    /*0000*/ uint32_t unknown14;
    /*0000*/ uint32_t unknown15;
    /*0000*/ uint32_t unknown16;
    /*0000*/ uint32_t unknown17;
    /*0000*/ uint32_t unknown18;
    /*0000*/ uint32_t unknown19;
    /*0000*/ signed   padding0000:12;                // ***Placeholder
             signed   deltaX:13;                     // change in x
             signed   padding0005:7;                 // ***Placeholder
    /*0000*/ signed   deltaHeading:10;               // change in heading
             signed   deltaY:13;                     // change in y
             signed   padding0006:9;                 // ***Placeholder
    /*0000*/ signed   y:19;                          // y coord
             signed   animation:13;                  // animation
    /*0000*/ unsigned heading:12;                    // heading
             signed   x:19;                          // x coord
             signed   padding0014:1;                 // ***Placeholder
    /*0000*/ signed   z:19;                          // z coord
             signed   deltaZ:13;                     // change in z
    // If not a valid player race (skip these if a valid player race)
    /*0000*/ union
             {
               struct
               {
                   /*0000*/ EquipStruct equip_helmet;     // Equipment: Helmet visual (maybe)
                   /*0000*/ EquipStruct equip_primary;    // Equipment: Main visual
                   /*0000*/ EquipStruct equip_secondary;  // Equipment: Off visual
               } equip;
               /*0000*/ EquipStruct equipment[3];
             };
    // skip these bytes if not a valid player race - colors[9] and equipment[9]
    /*0000*/ union
             {
               struct
               {
                   /*0000*/ Color_Struct color_helmet;    // Color of helmet item
                   /*0000*/ Color_Struct color_chest;     // Color of chest item
                   /*0000*/ Color_Struct color_arms;      // Color of arms item
                   /*0000*/ Color_Struct color_bracers;   // Color of bracers item
                   /*0000*/ Color_Struct color_hands;     // Color of hands item
                   /*0000*/ Color_Struct color_legs;      // Color of legs item
                   /*0000*/ Color_Struct color_feet;      // Color of feet item
                   /*0000*/ Color_Struct color_primary;   // Color of primary item
                   /*0000*/ Color_Struct color_secondary; // Color of secondary item
               } equipment_colors;
                /*0000*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above
            } 
    /*0000*/ union
             {
               struct
               {
                   /*0000*/ EquipStruct equip_helmet;     // Equipment: Helmet visual
                   /*0000*/ EquipStruct equip_chest;      // Equipment: Chest visual
                   /*0000*/ EquipStruct equip_arms;       // Equipment: Arms visual
                   /*0000*/ EquipStruct equip_bracers;    // Equipment: Wrist visual
                   /*0000*/ EquipStruct equip_hands;      // Equipment: Hands visual
                   /*0000*/ EquipStruct equip_legs;       // Equipment: Legs visual
                   /*0000*/ EquipStruct equip_feet;       // Equipment: Boots visual
                   /*0000*/ EquipStruct equip_primary;    // Equipment: Main visual
                   /*0000*/ EquipStruct equip_secondary;  // Equipment: Off visual
               } equip;
               /*0000*/ EquipStruct equipment[9];
             };
    /*0000*/ char title[0];                          // only read if(otherData & 8)
    /*0000*/ char suffix[0];                         // only read if(otherData & 16)
    /*0000*/ char unknown20[8];
    /*0000*/ uint8_t isMercenary;
    /*0000*/ char unknown21[54];
    };
    #endif
    
    
    
    
    #if 0
    // Old stuff from spawnStruct seq doesn't actually use at all..
    //
    /*0004*/ float    size;                          // Model size
    /*0078*/ int8_t   aa_title;                      // 0=none, 1=general, 2=archtype, 3=class
    /*0074*/ uint8_t  invis;                         // Invis (0=not, 1=invis)
    /*0117*/ uint8_t  lfg;                           // 0=off, 1=lfg on
    /*0196*/ uint8_t  afk;                           // 0=no, 1=afk
    /*0207*/ int8_t   guildrank;                     // 0=normal, 1=officer, 2=leader
    /*0213*/ uint8_t  face;	                         // Face id for players
    /*0247*/ uint8_t  is_pet;                        // 0=no, 1=yes
    /*0284*/ uint8_t  beardcolor;                    // Beard color
    /*0500*/ uint8_t  showhelm;                      // 0=no, 1=yes
    /*0501*/ uint8_t  helm;                          // Helm texture
    /*0660*/ uint8_t  hairstyle;                     // Hair style
    /*0090*/ uint8_t  eyecolor1;                     // Player's left eye color
    /*0542*/ uint8_t  eyecolor2;                     // Left eye color
    /*0547*/ uint8_t  haircolor;                     // Hair color
    /*0574*/ uint8_t  is_npc;                        // 0=no, 1=yes
    /*0575*/ uint8_t  findable;                      // 0=can't be found, 1=can be found
    /*0728*/ uint8_t  beard;                         // Beard style (not totally, sure but maybe!)
    /*0723*/ uint8_t  max_hp;                        // (name prolly wrong)takes on the value 100 for PCs, 100 or 110 for NPCs and 120 for PC corpses...
    /*122*/ uint8_t pvp;                             // 0=Not pvp,1=pvp
    union 
    {
    /*0091*/ int8_t equip_chest2;                    // Second place in packet for chest texture (usually 0xFF in live packets)
                                                     // Not sure why there are 2 of them, but it effects chest texture!
    /*0091*/ int8_t mount_color;                     // drogmor: 0=white, 1=black, 2=green, 3=red
    };
    #endif
    
    
    /*
    ** Server Zone Entry struct
    ** Length: 383 Octets
    ** OpCode: ZoneEntryCode (when direction == server)
    *
    *  This is just a spawnStruct for the player
    */
    struct ServerZoneEntryStruct : public spawnStruct
    {
    };
    
    
    /*
    ** Generic Door Struct
    ** Length: 96 Octets
    ** Used in: 
    **    OP_SpawnDoor
    **
    */
    
    
    struct doorStruct
    {
    /*0000*/ char    name[32];                       // Filename of Door?
    /*0016*/ // uint8_t unknown016[16];              // ***Placeholder
    /*0032*/ float   y;                              // y loc
    /*0036*/ float   x;                              // x loc
    /*0040*/ float   z;                              // z loc
    /*0044*/ float   heading;                        // heading
    /*0048*/ uint32_t incline;                       // incline
    /*0052*/ uint32_t size;                          // size
    /*0056*/ uint8_t unknown0056[4];                 // ***Placeholder
    /*0060*/ uint8_t doorId;                         // door's id #
    /*0061*/ uint8_t opentype;                       // open type
    /*0062*/ uint8_t spawnstate;                     // spawn state
    /*0063*/ uint8_t invertstate;                    // invert state
    /*0064*/ uint32_t zonePoint;
    /*0068*/ uint8_t unknown068[28];                 // ***Placeholder
    /*0096*/
    }; 
    
    
    /*
    ** Drop Item On Ground
    ** Length: Variable
    ** OpCode: MakeDropCode
    */
    // Note: Unknowns and other members removed that we don't use since we
    //       now only fill this with data we need from the serialized packet
    struct makeDropStruct
    {
       uint32_t dropId;                              // DropID
       float    heading;                             // Heading
       float    z;                                   // Z Position
       float    x;                                   // X Position
       float    y;                                   // Y Position
       char     idFile[30];                          // ACTOR ID - The client reads 30 bytes from the packet
                                                     //          - 20100210 eqgame.exe in EQItemList::UnpackNetData
    };
    
    
    /*
    ** ZonePoint
    ** Length: 24 Octets
    ** Sent as part of zonePointsStruct
    */
    
    
    struct zonePointStruct
    {
      /*0000*/ uint32_t zoneTrigger;
      /*0004*/ float    y;
      /*0008*/ float    x;
      /*0012*/ float    z;
      /*0016*/ float    heading;
      /*0020*/ uint16_t zoneId;
      /*0022*/ uint16_t zoneInstance;
      /*0024*/
    };
    
    
    /*
    ** ZonePointsStruct
    ** Length: Variable
    ** OPCode: OP_SendZonePoints
    */
    struct zonePointsStruct
    {
      /*0000*/ uint32_t        count;
      /*0004*/ zonePointStruct zonePoints[0]; 
      /*0xxx*/ uint8_t         unknown0xxx[24];
      /*0yyy*/
    };
    
    
    /*
    ** Time of Day
    ** Length: 8 Octets
    ** OpCode: TimeOfDayCode
    */
    struct timeOfDayStruct
    {
    /*0000*/ uint8_t  hour;                          // Hour (1-24)
    /*0001*/ uint8_t  minute;                        // Minute (0-59)
    /*0002*/ uint8_t  day;                           // Day (1-28)
    /*0003*/ uint8_t  month;                         // Month (1-12)
    /*0004*/ uint16_t year;                          // Year
    /*0006*/ uint16_t unknown0016;                   // Placeholder
    /*0008*/
    };
    
    
    /*
    ** Item Packet Struct - Works on a variety of item operations
    ** Packet Types: See ItemPacketType enum
    ** Length: Variable
    ** OpCode: ItemCode
    */
    struct itemPacketStruct
    {
    /*000*/	ItemPacketType	packetType;              // See ItemPacketType for more info.
    /*004*/	char		serializedItem[0];
    /*xx*/
    };
    
    
    /*
    ** Item Info Request Struct 
    ** Length: 72 Octets 
    ** OpCode: ItemInfoCode
    */
    struct itemInfoReqStruct
    {
    /*000*/ uint32_t itemNr;                         // ItemNr 
    /*005*/ uint32_t requestSeq;                     // Request sequence number
    /*008*/ char     name[64];                       // Item name
    /*072*/
    };
    
    
    /*
    ** Item Info Response Struct
    ** Length: Variable
    ** OpCode: ItemInfoCode
    */
    struct itemInfoStruct
    {
    /*000*/	uint32_t	requestSeq;              // Corresponds to sequence # in req
    /*004*/	char		serializedItem[0];
    /*xxx*/
    };
    
    
    /*
    ** Simple Spawn Update
    ** Length: 14 Octets
    ** OpCode: MobUpdateCode
    */
    
    
    
    
    struct spawnPositionUpdate 
    {
    /*0000*/ int16_t  spawnId;
    /*0002*/ uint8_t unk1[2];		         // BSH 13 Apr 2011
    /*0004*/ int64_t  y:19, z:19, x:19, u3:7;
             unsigned heading:12;
             signed unused2:4;
    /*0014*/
    };
    
    
    /*
    ** Rename a spawn
    ** Length: 232 Octets
    ** OpCode: SpawnRename
    */
    struct spawnRenameStruct
    {
    /*000*/	char        old_name[64];
    /*064*/	char        old_name_again[64];	         //not sure what the difference is
    /*128*/	char        new_name[64];
    /*192*/	uint32_t	unknown192;	         //set to 0
    /*196*/	uint32_t	unknown196;	         //set to 1
    /*200*/ uint8_t    unknown0084[32];              // ***Placeholder
    /*232*/
    };
    
    
    /*
    ** Illusion a spawn
    ** Length: 336 Octets
    ** OpCode: Illusion
    */
    struct spawnIllusionStruct
    {
    /*0000*/ uint32_t   spawnId;                     // Spawn id of the target
    /*0004*/ char       name[64];                    // Name of the target
    /*0068*/ uint32_t   race;                        // New race
    /*0072*/ uint8_t    gender;                      // New gender (0=male, 1=female)
    /*0073*/ uint8_t    texture;                     // ???
    /*0074*/ uint8_t    helm;                        // ???
    /*0075*/ uint8_t    unknown0075;                 // ***Placeholder
    /*0076*/ uint32_t   unknown0076;                 // ***Placeholder
    /*0080*/ uint32_t   face;                        // New face
    /*0084*/ uint8_t    unknown0084[252];            // ***Placeholder
    /*0336*/
    };
    
    
    /**
     * Shroud spawn. For others shrouding, this has their spawnId and
     * spawnStruct.
     * 
     * Length: variable
     * OpCode: OP_Shroud
     */
    struct spawnShroudOther
    {
    /*00000*/ uint32_t spawnId;                      // Spawn Id of the shrouded player
    /*00004*/ uint16_t spawnStructSize;              // Size of spawnStruct (or start of)
    /*00006*/ spawnStruct spawn;                     // Updated spawn struct for the player (variable length)
    /*xxxxx*/
    };
    
    
    /**
     * Shroud yourself. For yourself shrouding, this has your spawnId, spawnStruct,
     * bits of your charProfileStruct (no checksum, then charProfile up till
     * but not including name), and an itemPlayerPacket for only items on the player
     * and not the bank.
     *
     * Length: Variable
     * OpCode: OP_Shroud
     */
    struct spawnShroudSelf
    {
    /*00000*/ uint32_t spawnId;                      // Spawn Id of you
    /*00004*/ uint16_t ppStart;                      // Start of playerProfile data (spawnId+ppStart+spawnStruct)
    /*00004*/ spawnStruct spawn;                     // Updated spawnStruct for you (variable length)
    /*xxxxx*/ playerProfileStruct profile;           // Character profile for shrouded char
    /*xxxxx*/ uint8_t items;                         // Items on the player
    /*xxxxx*/
    };
    
    
    /*
    ** Campfire spawn
    ** Length: 997
    ** OpCode: OP_ZoneEntry
    */
    struct spawnCampfire
    {
    /*0000*/ spawnStruct spawn;
    /*0532*/ uint8_t     unknown0532[465];
    /*0997*/ 
    };
    
    
    
    
    /*
    **                 ShowEQ Specific Structures
    */
    
    
    /*
    ** DB spawn struct (adds zone spawn was in)
    */
    
    
    struct dbSpawnStruct
    {
    /*0000*/ struct spawnStruct spawn;               // Spawn Information
    /*0258*/ char   zoneName[40];                    // Zone Information
    };
    
    
    /*
    ** Pet spawn struct (pets pet and owner in one struct)
    */
    
    
    struct petStruct
    {
    /*0000*/ struct spawnStruct owner;               // Pet Owner Information
    /*0258*/ struct spawnStruct pet;                 // Pet Infromation
    };
    
    
    /*
    ** Server System Message
    ** Length: Variable Length
    ** OpCode: SysMsgCode
    */
    
    
    struct sysMsgStruct
    {
    /*0000*/ char     message[0];                    // Variable length message
    };
    
    
    /*
    ** Emote text
    ** Length: Variable Text
    ** OpCode: emoteTextCode
    */
    
    
    struct emoteTextStruct
    {
    /*0000*/ uint8_t  unknown0002[4];                // ***Placeholder
    /*0002*/ char     text[0];                       // Emote `Text
    };
    
    
    /*
    ** Channel Message received or sent
    ** Length: Variable
    ** OpCode: ChannelMessageCode
    
    
    This is how channelMessageStruct looks on the wire, for reference (8/12/09 eqgame.exe)
    
    
    char            sender[0];                       // Variable length senders name 
    char            target[0];                       // Variable length target characters name
    uint32_t        unknown;
    uint32_t        language;                        // Language
    uint32_t        chanNum;                         // Channel
    uint32_t        unknown;
    uint8_t         unknown;
    uint32_t        skillInLanguage;                 // senders skill in language
    char            message[0];                      // Variable length message
    uint8_t         unknown;
    uint32_t        unknown;
    uint32_t        unknown;
    char            unknown[0];                      // Variable legth unknown text
    uint8_t         unknown;
    uint32_t        unknown;
    
    
    */
    
    
    // This will get filled with data from the serialized packet
    struct channelMessageStruct
    {
    /*0000*/ char     sender[64];
    /*0064*/ char     target[64];
    /*0128*/ uint32_t language;
    /*0132*/ uint32_t chanNum;
    /*0144*/ uint32_t skillInLanguage;
    /*0148*/ char     message[2048];                 // Maximum message size according to eqgame.exe
    };
    
    
    /*
    ** Formatted text messages
    ** Length: Variable Text
    ** OpCode: emoteTextCode
    */
    
    
    struct formattedMessageStruct
    {
    /*0000*/ uint8_t  unknown0002[4];                // ***Placeholder
    /*0004*/ uint32_t messageFormat;                 // Indicates the message format
    /*0008*/ ChatColor messageColor;                 // Message color
    /*0012*/ char     messages[0];                   // messages(NULL delimited)
    /*0???*/ uint8_t  unknownXXXX[8];                // ***Placeholder
    };
    
    
    /*
    ** Simple text messages
    ** Length: 12 Octets
    ** OpCode: SimpleMessageCode
    */
    
    
    struct simpleMessageStruct
    {
    /*0000*/ uint32_t  messageFormat;                // Indicates the message format
    /*0004*/ ChatColor messageColor;                 // Message color
    /*0008*/ uint32_t  unknown;                      // ***Placeholder
    /*0012*/
    };
    
    
    /*
    ** Special Message Struct
    ** Length: Variable Text
    ** OPCode: OP_SpecialMesg
    */
    
    
    struct specialMessageStruct
    {
      /*0000*/ uint8_t   unknown0000[3];             // message style?
      /*0003*/ ChatColor messageColor;               // message color
      /*0007*/ uint16_t  target;                     // message target
      /*0009*/ uint16_t  padding;                    // padding
      /*0011*/ char      source[0];                  // message text
      /*0xxx*/ uint32_t  unknown0xxx[3];             //***Placeholder
      /*0yyy*/ char      message[0];                 // message text
    };
    
    
    /*
    ** Guild MOTD Struct
    ** Length: Variable Text
    ** OPCode: OP_GuildMOTD
    */
    struct guildMOTDStruct
    {
      /*0000*/ uint32_t unknown0000;                 //***Placeholder
      /*0004*/ char     target[64];                  // motd target
      /*0068*/ char     sender[64];                  // motd "sender" (who set it)
      /*0132*/ uint32_t unknown0132;                 //***Placeholder
      /*0136*/ char     message[0];
    };
    
    
    /*
    ** Corpse location
    ** Length: 18 Octets
    ** OpCode: corpseLocCode
    */
    
    
    struct corpseLocStruct
    {
    /*0000*/ uint32_t spawnId;
    /*0004*/ float    x;
    /*0008*/ float    y;
    /*0012*/ float    z;
    /*0018*/
    };
    
    
    /*
    ** Consent request
    ** Length: Variable by length of the name of the consentee
    */
    
    
    struct consentRequestStruct
    {
    /*0000*/ char consentee[0];                      // Name of player who was consented
    };
    
    
    /*
    ** Consent Response
    ** Length: 193 Octets
    */
    
    
    struct consentResponseStruct
    {
    /*0000*/ char consentee[64];                     // Name of player who was consented
    /*0064*/ char consenter[64];                     // Name of player who consented
    /*0128*/ uint8_t allow;                          // 00 = deny, 01 = allow
    /*0129*/ char corpseZoneName[64];                // Zone where the corpse is
    /*0193*/
    };
    
    
    /*
    ** Grouping Information
    ** Length: 456 Octets
    ** OpCode: OP_GroupUpdate
    */
    
    
    struct groupUpdateStruct
    {
    /*0000*/ int32_t  action;                        // Group update action
    /*0004*/ char     yourname[64];                  // Group Member Names
    /*0068*/ char     membername[64];                // Group leader name
    /*0132*/ uint8_t  unknown0132[324];              // ***Placeholder
    /*456*/
    };
    
    
    
    
    /*
    ** DEPRECATED
    ** Grouping Information
    ** Length: 768 Octets
    ** OpCode: OP_GroupUpdate
    */
    
    
    struct groupFullUpdateStruct
    {
    /*0000*/ int32_t  action;
    /*0004*/ char     membernames[MAX_GROUP_MEMBERS][64]; // Group Member Names
    /*0388*/ char     leader[64];                         // Group leader Name
    /*0452*/ char     unknown0452[316];                   // ***Placeholder
    /*0768*/
    };
    
    
    /*
    ** Grouping Invite
    ** Length 148 Octets (invite a player) or 152 (you get invited)
    ** Opcode OP_GroupInvite
    */
    
    
    struct groupInviteStruct
    {
    /*0000*/ char     invitee[64];                   // Invitee's Name
    /*0064*/ char     inviter[64];                   // Inviter's Name
    /*0128*/ uint8_t  unknown0128[24];               // ***Placeholder
    /*0152*/
    };
    
    
    /*
    ** Grouping Invite Answer - Decline
    ** Length 152 Octets
    ** Opcode GroupDeclineCode
    */
    
    
    struct groupDeclineStruct
    {
    /*0000*/ char     yourname[64];                  // Player Name
    /*0064*/ char     membername[64];                // Invited Member Name
    /*0128*/ uint8_t  unknown0128[20];               // ***Placeholder
    /*0148*/ uint8_t  reason;                        // Already in Group = 1, Declined Invite = 3
    /*0149*/ uint8_t  unknown0141[3];                // ***Placeholder
    /*0152*/
    };
    
    
    /*
    ** Grouping Invite Answer - Accept 
    ** Length 148 Octets
    ** Opcode OP_GroupFollow
    */
    
    
    struct groupFollowStruct
    {
    /*0000*/ char     unknown0000[64];               // ***Placeholder (zeros)
    /*0064*/ char     invitee[64];                   // Invitee's Member Name
    /*0128*/ uint8_t  unknown0132[4];                // ***Placeholder
    /*0132*/ uint32_t level;                         // Invitee's level
    /*0136*/ uint8_t  unknown0136[12];               // ***Placeholder (zeros)
    /*0148*/
    };
    
    
    /*
    ** Group Disbanding
    ** Length 148 Octets
    ** Opcode 
    */
    
    
    struct groupDisbandStruct
    {
    /*0000*/ char     yourname[64];                  // Player Name
    /*0064*/ char     membername[64];                // Invited Member Name
    /*0128*/ uint8_t  unknown0128[20];               // ***Placeholder
    /*0148*/
    };
    
    
    /*
    ** Group Leader Change
    ** Length 148 Octets
    ** Opcode OP_GroupLeader
    */
    
    
    struct groupLeaderChangeStruct
    {
    /*0000*/ char     unknown0000[64];               // ***Placeholder
    /*0064*/ char     membername[64];                // Invited Member Name
    /*0128*/ uint8_t  unknown0128[20];               // ***Placeholder
    /*0148*/
    };
    
    
    /*
    ** Delete Self
    ** Length: 4 Octets
    ** OpCode: OP_DeleteSpawn
    */
    
    
    struct deleteSpawnStruct
    {
    /*0000*/ uint32_t spawnId;                       // Spawn ID to delete
    /*0004*/
    };
    
    
    /*
    ** Remove Spawn
    ** Length: 5 Octets
    ** OpCode: OP_RemoveSpawn
    */
    
    
    struct removeSpawnStruct
    {
    /*0000*/ uint32_t spawnId;                       // Spawn ID to delete
    /*0004*/ uint8_t  removeSpawn;                   // 0 if spawn is not in your update radius
    /*0005*/
    };
    
    
    /*
    ** Remove Drop Item On Ground
    ** Length: 8 Octets
    ** OpCode: RemDropCode
    */
    
    
    struct remDropStruct
    {
    /*0000*/ uint16_t dropId;                        // ID assigned to drop
    /*0002*/ uint8_t  unknown0004[2];                // ***Placeholder
    /*0004*/ uint16_t spawnId;                       // ID of player picking item up
    /*0006*/ uint8_t  unknown0008[2];                // ***Placeholder
    /*0008*/
    };
    
    
    /*
    ** Consider Struct
    ** Length: 20 Octets
    ** OpCode: considerCode
    */
    
    
    struct considerStruct
    {
    /*0000*/ uint32_t playerid;                      // PlayerID
    /*0004*/ uint32_t targetid;                      // TargetID
    /*0008*/ int32_t  faction;                       // Faction
    /*0012*/ int32_t  level;                         // Level
    /*0016*/ int32_t  unknown0016;                   // unknown
    /*0020*/
    };
    
    
    /*
    ** Spell Casted On
    ** Length: 36 Octets
    ** OpCode: castOnCode
    */
    
    
    struct castOnStruct
    {
    /*0000*/ uint16_t targetId;                      // Target ID
    /*0002*/ uint8_t  unknown0002[2];                // ***Placeholder
    /*0004*/ int16_t  sourceId;                      // ***Source ID
    /*0006*/ uint8_t  unknown0006[2];                // ***Placeholder
    /*0008*/ uint8_t  unknown0008[24];               // might be some spell info?
    /*0032*/ uint16_t spellId;                       // Spell Id
    /*0034*/ uint8_t  unknown0034[2];                // ***Placeholder
    /*0036*/
    };
    
    
    /*
    ** Spawn Death Blow
    ** Length: 32 Octets
    ** OpCode: NewCorpseCode
    */
    
    
    struct newCorpseStruct
    {
    /*0000*/ uint32_t spawnId;                       // Id of spawn that died
    /*0004*/ uint32_t killerId;                      // Killer
    /*0008*/ uint32_t corpseid;                      // corpses id
    /*0012*/ int32_t  type;                          // corpse type?  
    /*0016*/ uint32_t spellId;                       // ID of Spell
    /*0020*/ uint16_t zoneId;                        // Bind zone id
    /*0022*/ uint16_t zoneInstance;                  // Bind zone instance
    /*0024*/ uint32_t damage;                        // Damage
    /*0028*/ uint8_t  unknown0028[4];                // ***Placeholder
    /*0032*/
    };
    
    
    /**
    ** Environmental damage (lava, falls)
    ** Length: 39 Octets
    */
    
    
    struct environmentDamageStruct
    {
    /*0000*/ uint32_t spawnId;                       // Who is taking the damage
    /*0004*/ uint8_t unknown0004[2];
    /*0006*/ uint32_t damage;                        // how much damage?
    /*0010*/ uint8_t unknown0010[12];
    /*0022*/ uint8_t type;                           // Damage type. FC = fall. FA = lava.
    /*0023*/ uint8_t unknown0023[16];
    /*0039*/
    };
    
    
    /*
    ** Money Loot
    ** Length: 20 Octets
    ** OpCode: MoneyOnCorpseCode
    */
    
    
    struct moneyOnCorpseStruct
    {
    /*0000*/ uint8_t  unknown0002[4];                // ***Placeholder
    /*0004*/ uint32_t platinum;                      // Platinum Pieces
    /*0008*/ uint32_t gold;                          // Gold Pieces
    /*0012*/ uint32_t silver;                        // Silver Pieces
    /*0016*/ uint32_t copper;                        // Copper Pieces
    /*0020*/
    };
    
    
    /*
    ** Stamina
    ** Length: 8 Octets
    ** OpCode: staminaCode
    */
    
    
    struct staminaStruct 
    {
    /*0000*/ uint32_t food;                          // Hunger, in ticks till next eat
    /*0004*/ uint32_t water;                         // Thirst, in ticks till next eat
    /*0008*/
    };
    
    
    /*
    ** Battle Code
    ** Length: 30 Octets
    ** OpCode: ActionCode
    */
    
    
    // This can be used to gather info on spells cast on us
    struct action2Struct
    {
    /*0000*/ uint16_t target;                        // Target ID
    /*0002*/ uint16_t source;                        // Source ID
    /*0004*/ uint8_t  type;                          // Bash, kick, cast, etc.
    /*0005*/ int16_t  spell;                         // SpellID
    /*0007*/ int32_t  damage;
    /*0011*/ uint8_t  unknown0011[13];               // ***Placeholder
    /*0024*/ uint8_t  unknown0024[6];	         // ***Placeholder (11/24/07)
    /*0030*/
    };
    
    
    // This can be used to gather info on spells cast on us
    struct actionStruct
    {
    /*0000*/ uint16_t target;                        // Target ID
    /*0002*/ uint16_t source;                        // SourceID
    /*0004*/ uint8_t  level;                         // Caster level
    /*0005*/ uint8_t  unknown0005[21];               // ***Placeholder
    /*0026*/ uint8_t  type;                          // Casts, Falls, Bashes, etc...
    /*0027*/ uint8_t  unknown0031[6];
    /*0033*/ int16_t  spell;                         // SpellID
    /*0035*/ uint8_t  unknown0035[2];                // ***Placeholder
    /*0037*/ uint8_t  unknown0037[2];                // ***Placeholder
    /*0039*/
    };
    
    
    // Starting with 2/21/2006, OP_Actions seem to come in pairs, duplicating
    // themselves, with the second one with slightly more information. Maybe this
    // has to do with buff blocking??
    struct actionAltStruct
    {
    /*0000*/ uint16_t target;                        // Target ID
    /*0002*/ uint16_t source;                        // SourceID
    /*0004*/ uint8_t  level;                         // Caster level
    /*0005*/ uint8_t  unknown0005[21];               // ***Placeholder
    /*0026*/ uint8_t  type;                          // Casts, Falls, Bashes, etc...
    /*0027*/ uint8_t  unknown0031[6];
    /*0033*/ int16_t  spell;                         // SpellID
    /*0035*/ uint8_t  unknown0035[2];                // ***Placeholder
    /*0037*/ uint32_t unknown0037;
    /*0041*/ uint8_t  unknown0041[15];
    /*0056*/
    };
    
    
    /*
    ** client changes target struct
    ** Length: 4 Octets
    ** OpCode: clientTargetCode
    */
    
    
    struct clientTargetStruct
    {
    /*0000*/ uint32_t newTarget;                     // Target ID
    /*0004*/ 
    };
    
    
    /*
    ** Info sent when you start to cast a spell
    ** Length: 44 Octets
    ** OpCode: StartCastCode
    */
    
    
    struct startCastStruct 
    {
    /*0000*/ int32_t  slot;                          // Spell slot
    /*0004*/ uint32_t spellId;                       // Spell ID
    /*0008*/ int32_t  inventorySlot;                 // ***Placeholder
    /*0012*/ uint8_t  unknown0012[8];                // ***Placeholder
    /*0020*/ uint32_t targetId;                      // The current selected target
    /*0024*/ uint8_t  unknown0024[4];                // ***Placeholder
    /*0028*/ uint8_t  unknown0028[16];	         // ***Placeholder (4/7/2009)
    /*0044*/
    };
    
    
    /*
    ** New Mana Amount
    ** Length: 20 Octets
    ** OpCode: manaDecrementCode
    */
    
    
    struct manaDecrementStruct
    {
    /*0000*/ int32_t newMana;                        // New Mana AMount
    /*0004*/ int32_t unknown;                        // Looks like endurance but not sure why that'd be reported here
    /*0008*/ int32_t spellId;                        // Last Spell Cast
    /*0012*/ uint8_t unknown0012[4];
    /*0016*/ uint8_t unknown0016[4];                 //*** Placeholder (02/13/07)
    /*0020*/
    };
    
    
    /*
    ** Special Message
    ** Length: 4 Octets + Variable Text Length
    ** OpCode: SPMesgCode
    */
    struct spMesgStruct
    {
    /*0000*/ int32_t msgType;                        // Type of message
    /*0004*/ char    message[0];                     // Message, followed by four Octets?
    };
    
    
    /*
    ** Spell Fade Struct
    ** Length: Variable length
    ** OpCode: SpellFadedCode
    */
    struct spellFadedStruct
    {
    /*0000*/ uint32_t color;                         // color of the spell fade message
    /*0004*/ char     message[0];                    // fade message
    /*0???*/ uint8_t  paddingXXX[3];                 // always 0's 
    };
    
    
    /*
    ** Spell Action Struct
    ** Length: 10 Octets
    ** OpCode: BeginCastCode
    */
    struct beginCastStruct
    {
    /*0000*/ uint16_t spawnId;                       // Id of who is casting
    /*0002*/ uint16_t spellId;                       // Id of spell
    /*0004*/ int16_t  param1;                        // Paramater 1
    /*0006*/ int16_t  param2;                        // Paramater 2
    /*0008*/ int16_t  param3;                        // Paramater 3
    /*0010*/
    };
    
    
    /*
    ** Spell Action Struct
    ** Length: 16 Octets
    ** OpCode: MemSpellCode
    */
    
    
    struct memSpellStruct
    {
    /*0000*/ uint32_t slotId;                        // Slot spell is being memorized in
    /*0004*/ uint32_t spellId;                       // Id of spell
    /*0008*/ int16_t  param1;                        // Paramater 1
    /*0010*/ int16_t  param2;                        // Paramater 2
    /*0012*/ uint8_t  unknown0012[4];                // *** Placeholder
    /*0016*/
    };
    
    
    /*
    ** Train Skill
    ** Length: 12 Octets
    ** OpCode: SkillTrainCode
    */
    
    
    struct skillTrainStruct
    {
    /*0000*/ int32_t  playerid;                      // player doing the training
    /*0004*/ int32_t  type;                          // type of training?
    /*0008*/ uint32_t skillId;                       // Id of skill
    /*0012*/
    };
    
    
    /*
    ** Skill Increment
    ** Length: 12 Octets
    ** OpCode: SkillIncCode
    */
    
    
    struct skillIncStruct
    {
    /*0000*/ uint32_t skillId;                       // Id of skill
    /*0004*/ int32_t  value;                         // New value of skill
    /*0008*/ uint8_t  unknown0008[4];                // *** Placeholder
    /*0012*/
    };
    
    
    /*
    ** When somebody changes what they're wearing
    **      or give a pet a weapon (model changes)
    ** Length: 14 Octets
    ** Opcode: WearChangeCode
    */
    
    
    // ZBTEMP: Find newItemID ***
    struct wearChangeStruct
    {
    /*0000*/ uint16_t spawnId;                       // SpawnID
    /*0002*/ Color_Struct color;                     // item color
    /*0006*/ uint8_t  wearSlotId;                    // Slot ID
    /*0007*/ uint8_t  unknown0007[7];                // unknown
    /*0014*/
    };
    
    
    /*
    ** Level Update
    ** Length: 12 Octets
    ** OpCode: LevelUpUpdateCode
    */
    
    
    struct levelUpUpdateStruct
    {
    /*0000*/ uint32_t level;                         // New level
    /*0004*/ uint32_t levelOld;                      // Old level
    /*0008*/ uint32_t exp;                           // Current Experience
    /*0012*/
    };
    
    
    /*
    ** Experience Update
    ** Length: 8 Octets
    ** OpCode: ExpUpdateCode
    */
    
    
    struct expUpdateStruct
    {
    /*0000*/ uint32_t exp;                           // experience value  x/330
    /*0004*/ uint32_t type;                          // 0=set, 2=update
    /*0008*/
    };
    
    
    /*
    ** Alternate Experience Update
    ** Length: 12 Octets
    ** OpCode: AltExpUpdateCode
    */
    struct altExpUpdateStruct
    {
    /*0000*/ uint32_t altexp;                        // alt exp x/330
    /*0004*/ uint32_t aapoints;                      // current number of AA points
    /*0008*/ uint8_t  percent;                       // percentage in integer form
    /*0009*/ uint8_t  unknown0009[3];                // ***Place Holder
    /*0012*/
    };
    
    
    /**
     * Leadership AA update
     * Length: 32 Octets
     * OpCode: LeadExpUpdate
     */
    struct leadExpUpdateStruct
    {
    /*0000*/ uint32_t unknown0000;                   // All zeroes?
    /*0004*/ uint32_t groupLeadExp;                  // Group leadership exp value
    /*0008*/ uint32_t unspentGroupPoints;            // Unspent group points
    /*0012*/ uint32_t unknown0012;                   // Type?
    /*0016*/ uint32_t unknown0016;                   // All zeroes?
    /*0020*/ uint32_t raidLeadExp;                   // Raid leadership exp value
    /*0024*/ uint32_t unspentRaidPoints;             // Unspent raid points
    /*0028*/ uint32_t unknown0028;
    /*0032*/
    };
    
    
    /*
    ** Player Spawn Update
    ** Length: 27 Octets
    ** OpCode: SpawnUpdateCode
    */
    
    
    struct SpawnUpdateStruct
    {
    /*0000*/ uint16_t spawnId;                       // Id of spawn to update
    /*0002*/ uint16_t subcommand;                    // some sort of subcommand type
    /*0004*/ int16_t  arg1;                          // first option
    /*0006*/ int16_t  arg2;                          // second option
    /*0008*/ uint8_t  arg3;                          // third option?
    /*0009*/ uint8_t unknown0009[18];
    /*0027*/
    };
    
    
    /*
    ** NPC Hp Update
    ** Length: 10 Octets
    ** Opcode NpcHpUpdateCode
    */
    
    
    struct hpNpcUpdateStruct
    {
    /*0000*/ int32_t curHP;
    /*0004*/ int32_t maxHP;
    /*0008*/ uint16_t spawnId;
    /*0010*/ 
    };
    
    
    /*
    ** Inspecting Information
    ** Length: 1860 Octets
    ** OpCode: InspectDataCode
    */
    
    
    struct inspectDataStruct
    {
    /*0000*/ uint8_t  unknown0000[8];                // ***Placeholder
    /*0008*/ char     itemNames[23][64];             // 23 items with names 
                                                     //    64 characters long.
    /*1480*/ int32_t  icons[23];                     // Icon Information
    /*1572*/ char     mytext[200];                   // Player Defined Text Info
    /*1772*/ uint8_t  unknown1772[88];               // ***Placeholder
    /*1860*/
    };
    
    
    /*
    ** Reading Book Information
    ** Length: Variable Length Octets
    ** OpCode: BookTextCode
    */
    
    
    struct bookTextStruct
    {
    /*0000*/ uint16_t unknown0000;
    /*0002*/ char     text[0];                       // Text of item reading
    };
    
    
    /*
    ** Interrupt Casting
    ** Length: 6 Octets + Variable Length Octets
    ** Opcode: BadCastCode
    */
    
    
    struct badCastStruct
    {
    /*0000*/ uint32_t spawnId;                       // Id of who is casting
    /*0004*/ char     message[0];                    // Text Message
    };
    
    
    /*
    ** Random Number Request
    ** Length: 8 Octets
    ** OpCode: RandomCode
    */
    struct randomReqStruct 
    {
    /*0000*/ uint32_t bottom;                        // Low number
    /*0004*/ uint32_t top;                           // High number
    /*0008*/
    };
    
    
    /*
    ** Random Number Result
    ** Length: 76 Octets
    ** OpCode: RandomCode
    */
    struct randomStruct 
    {
    /*0000*/ uint32_t bottom;                        // Low number
    /*0004*/ uint32_t top;                           // High number
    /*0008*/ uint32_t result;                        // result number
    /*0012*/ char     name[64];                      // name rolled by
    /*0076*/
    };
    
    
    /*
    ** Player Position Update
    ** Length: 24 Octets
    ** OpCode: PlayerPosCode
    */
    
    
    struct playerSpawnPosStruct
    {
    /*0000*/ uint16_t spawnId;
    /*0002*/ uint8_t  unk[2];	                       // BSH 13 Apr 2011
    /*0004*/ signed   padding0000:12;                // ***Placeholder
             signed   deltaHeading:10;               // change in heading
             signed   padding0005:10;                // ***Placeholder
    /*0008*/ signed   z:19;                          // z coord
             signed   deltaZ:13;                     // change in z
    /*0012*/ signed   deltaY:13;                     // change in y
             signed   y:19;                          // y coord
    /*0016*/ signed   x:19;                          // x coord
             signed   deltaX:13;                     // change in x
    /*0020*/ unsigned heading:12;                    // heading
             signed   animation:10;                  // animation
             signed   padding0006:10;                // ***Placeholder
    /*0024*/
    };
    
    
    /*
    ** Self Position Update
    ** Length: 42 Octets
    ** OpCode: PlayerPosCode
    */
    
    
    struct playerSelfPosStruct
    {
    /*0000*/ uint16_t spawnId;                       // Player's spawn id
    /*0002*/ uint8_t unknown0002[2];                 // ***Placeholder (update time counter?)
    /*0004*/ uint8_t unknown0004[6];                 // ***Placeholder -- BSH 13 Apr 2011
    /*0010*/ float y;                                // y coord (1st loc value)
    /*0014*/ float deltaY;
             signed deltaHeading:10;                 // change in heading
             unsigned heading:12;                    // Directional heading
             unsigned animation:10;                  // animation
    /*0022*/ float deltaX;
    /*0026*/ float deltaZ;
    /*0030*/ float x;                                // x coord (2nd loc value)
    /*0034*/ float z;                                // z coord (3rd loc value)
    };
    
    
    
    
    /*
    ** Spawn Appearance
    ** Length: 8 Octets
    ** OpCode: spawnAppearanceCode
    */
    
    
    struct spawnAppearanceStruct
    {
    /*0000*/ uint16_t spawnId;                       // ID of the spawn
    /*0002*/ uint16_t type;                          // Type of data sent
    /*0004*/ uint32_t parameter;                     // Values associated with the type
    /*0008*/
    };
    
    
    
    
    /*
    **               Structures that are not being currently used
     *               (except for logging)
    */
    
    
    struct bindWoundStruct
    {
    /*0000*/ uint16_t playerid;                      // TargetID
    /*0002*/ uint8_t  unknown0002[2];                // ***Placeholder
    /*0004*/ uint32_t hpmaybe;                       // Hitpoints -- Guess
    /*0008*/
    };
    
    
    struct inspectedStruct
    {
    /*0000*/ uint16_t inspectorid;                   // Source ID
    /*0002*/ uint8_t  unknown0002[2];                // ***Placeholder
    /*0004*/ uint16_t inspectedid;                   // Target ID - Should be you
    /*0006*/ uint8_t  unknown0006[2];                // ***Placeholder
    /*0008*/
    };
    
    
    struct attack1Struct
    {
    /*0000*/ uint16_t spawnId;                       // Spawn ID
    /*0002*/ int16_t  param1;                        // ***Placeholder
    /*0004*/ int16_t  param2;                        // ***Placeholder
    /*0006*/ int16_t  param3;                        // ***Placeholder
    /*0008*/ int16_t  param4;                        // ***Placeholder
    /*0010*/ int16_t  param5;                        // ***Placeholder
    /*0012*/
    };
    
    
    struct attack2Struct
    {
    /*0000*/ uint16_t spawnId;                       // Spawn ID
    /*0002*/ int16_t  param1;                        // ***Placeholder
    /*0004*/ int16_t  param2;                        // ***Placeholder
    /*0006*/ int16_t  param3;                        // ***Placeholder
    /*0008*/ int16_t  param4;                        // ***Placeholder
    /*0010*/ int16_t  param5;                        // ***Placeholder
    /*0012*/
    };
    
    
    struct newGuildInZoneStruct
    {
    /*0000*/ uint8_t  unknown0000[8];                // ***Placeholder
    /*0008*/ char     guildname[56];                 // Guildname
    /*0064*/
    };
    
    
    struct moneyUpdateStruct
    {
    /*0000*/ uint32_t spawnid;                       // ***Placeholder
    /*0004*/ uint32_t cointype;                      // Coin Type
    /*0008*/ uint32_t amount;                        // Amount
    /*0012*/
    };
    
    
    /* Memorize slot operations, mem, forget, etc */
    
    
    struct memorizeSlotStruct
    {
    /*0000*/ uint32_t slot;                          // Memorization slot (0-7)
    /*0004*/ uint32_t spellId;                       // Id of spell 
                                                     // (offset of spell in spdat.eff)
    /*0008*/ uint32_t action;                        // 1-memming,0-scribing,2-forget
    /*0012*/
    };
    
    
    /*
    ** Spawn Appearance
    ** Length: 4 Octets
    ** OpCode: SetRunModeCode
    */
    
    
    struct cRunToggleStruct
    {
    /*0000*/ uint32_t status;                        //01=run  00=walk
    /*0004*/
    };
    
    
    struct cChatFiltersStruct
    {
    /*0000*/ uint32_t DamageShields;                 //00=on  01=off
    /*0004*/ uint32_t NPCSpells;                     //00=on  01=off
    /*0008*/ uint32_t PCSpells;                      //00=all 01=off 02=grp
    /*0012*/ uint32_t BardSongs;                     //00=all 01=me  02=grp 03=off
    /*0016*/ uint32_t Unused;
    /*0020*/ uint32_t GuildChat;                     //00=off 01=on
    /*0024*/ uint32_t Socials;                       //00=off 01=on
    /*0028*/ uint32_t GroupChat;                     //00=off 01=on
    /*0032*/ uint32_t Shouts;                        //00=off 01=on
    /*0036*/ uint32_t Auctions;                      //00=off 01=on
    /*0040*/ uint32_t OOC;                           //00=off 01=on
    /*0044*/ uint32_t MyMisses;                      //00=off 01=on
    /*0048*/ uint32_t OthersMisses;                  //00=off 01=on
    /*0052*/ uint32_t OthersHits;                    //00=off 01=on
    /*0056*/ uint32_t AttackerMisses;                //00=off 01=on
    /*0060*/ uint32_t CriticalSpells;                //00=all 01=me  02=off
    /*0064*/ uint32_t CriticalMelee;                 //00=all 01=me  02=off
    /*0068*/
    };
    
    
    struct cOpenSpellBookStruct
    {
    /*0000*/ int32_t status;                         //01=open 00=close
    /*0004*/
    };
    
    
    struct tradeSpellBookSlotsStruct
    {
    /*0000*/ uint32_t slot1;
    /*0004*/ uint32_t slot2;
    /*0008*/
    };
    
    
    
    
    /*
    ** serverLFGStruct
    ** Length: 10 Octets
    ** signifies LFG, maybe afk, role, ld, etc
    */
    
    
    struct serverLFGStruct
    {
    /*0000*/ uint16_t spawnID;
    /*0002*/ uint16_t unknown0004;
    /*0004*/ uint16_t LFG;                           //1=LFG
    /*0006*/ uint16_t unknown0008;
    /*0008*/
    };
    
    
    /*
    ** clientLFGStruct
    ** Length: 70 Octets
    ** signifies LFG, maybe afk, role, ld, etc
    */
    
    
    struct clientLFGStruct
    {
    /*0000*/ uint8_t  name[64];
    /*0064*/ uint16_t LFG;                           //1=LFG
    /*0066*/ uint16_t unknown0008;
    };
    
    
    /*
    ** buffStruct
    ** Length: 44 Octets
    ** 
    */
    
    
    struct buffStruct
    {
    /*0000*/ uint32_t spawnid;                       //spawn id
    /*0004*/ uint8_t  unknown0004[4]; 
    /*0008*/ float    unknown0008;
    /*0012*/ uint32_t spellid;                       // spellidbegin
    /*0016*/ uint32_t duration;                      // duration
    /*0024*/ uint8_t  unknown0024[8];
    /*0028*/ uint32_t playerId;                      // Player id who cast the buff
    /*0032*/ uint8_t  unknown0032[4]; 
    /*0036*/ uint32_t spellslot;                     // spellslot
    /*0040*/ uint32_t changetype;                    // 1=buff fading,2=buff duration
    /*0044*/ 
    };
    
    
    /*
    ** Guild Member Update structure 
    ** Length: 76 Octets
    **
    */
    
    
    struct GuildMemberUpdate
    {
    /*000*/ uint32_t guildId;                        // guild id
    /*004*/ char     name[64];                       // member name
    /*068*/ uint16_t zoneId;                         // zone id 
    /*070*/ uint16_t zoneInstance;                   // zone instance
    /*072*/ uint32_t lastOn;                         // time the player was last on.
    /*076*/
    };
    
    
    /*
    ** Bazaar trader on/off struct
    ** Length: 76 Octets
    **
    */
    struct bazaarTraderRequest
    {
    /*000*/ uint32_t spawnId;                        // Spawn id of person turning trader on/off
    /*004*/ uint8_t mode;                            // 0=off, 1=on
    /*005*/ uint8_t uknown005[3];                    // 
    /*008*/ char     name[64];                       // trader name
    /*072*/ uint8_t uknown072[4];                    //
    /*076*/
    };
    
    
    struct bazaarSearchQueryStruct 
    {
      uint32_t mark;
      uint32_t type;
      char     unknownXXX0[20];                      // Value seems to always be the same
      char     searchstring[64];
      uint32_t unknownXXX1;
      uint32_t unknownXXX2;
    };
    
    
    /*
    ** Item Bazaar Search Result
    ** Length: 160 Octets
    ** OpCode: BazaarSearch
    */
    struct bazaarSearchResponseStruct 
    {
    /*0000*/ uint32_t mark;                          // ***unknown***
    /*0004*/ uint32_t player_id;                     // trader ID
    /*0008*/ char     merchant_name[64];             // trader name
    /*0072*/ uint32_t count;                         // Count of items for sale
    /*0076*/ uint32_t item_id;                       // ID of item for sale
    /*0080*/ uint8_t uknown0080[8];                  // ***unknown***
    /*0088*/ char     item_name[64];                 // nul-padded name with appended "(count)"
    /*0152*/ uint32_t price;                         // price in copper
    /*0156*/ uint8_t uknown0156[4];                  // ***unknown***
    /*0160*/
    };
    
    
    /*
    ** Item Bazaar Search Result
    ** Length: Variable
    ** OpCode: BazaarSearch
    */
    union bazaarSearchStruct
    {
      uint32_t mark;
      struct bazaarSearchQueryStruct query;
      struct bazaarSearchResponseStruct response[];
    };
    
    
    /*******************************/
    /* World Server Structs        */
    
    
    /*
    ** Guild List (from world server)
    ** Length: 68 Octets
    ** used in: worldGuildList
    */
    
    
    struct guildListStruct
    {
    /*0000*/ uint32_t guildId;
    /*0004*/ char     guildName[64];
    };
    
    
    /*
    ** Guild List (from world server)
    ** Length: Variable (serialized)
    */
    struct worldGuildListStruct
    {
    /*000*/ uint8_t   unknown000[64];
    /*064*/ uint32_t  numberOfGuilds; // ?
    /*068*/ guildListStruct guilds[MAX_GUILDS];      // MAX_GUILDS varies by server now
    };
    
    
    struct worldMOTDStruct
    {
      /*002*/ char    message[0];
      /*???*/ uint8_t unknownXXX[3];
    };
    
    
    // Restore structure packing to default
    #pragma pack()
    
    
    #endif // EQSTRUCT_H
    
    
    //. .7...6....,X....D4.M.\.....P.v..>..W....
    //123456789012345678901234567890123456789012
    //000000000111111111122222222223333333333444
    If you haven't already, be sure to also apply the spawnshell.cpp and zoneopcodes.xml changes posted earlier.

  3. #108
    Registered User
    Join Date
    Nov 2010
    Posts
    82

    Re: SEQ Borked with 8/15 patch.

    great work chaps!

    Just one quicky, the Named's corpses aren't reflecting that they've been updated to "dead" state.
    Any clues please?
    Thanks again!
    Your dad.

  4. #109
    Did you SEQ today? BlueAdept's Avatar
    Join Date
    Dec 2001
    Posts
    2,048

    Re: SEQ Borked with 8/15 patch.

    r6express check your mailbox.
    Filters for ShowEQ can now be found here. filters-5xx-06-20-05.tar.gz

    ShowEQ file section is here. https://sourceforge.net/project/show...roup_id=10131#

    Famous Quotes:

    Ratt: WTF you talkin' about BA? (Ok.. that sounds like a bad combo of Diffrent Strokes and A-Team)

    Razzle: I showeq my wife

  5. #110
    Registered User
    Join Date
    Mar 2012
    Posts
    21

    Re: SEQ Borked with 8/15 patch.

    Quote Originally Posted by Spanners View Post
    great work chaps!

    Just one quicky, the Named's corpses aren't reflecting that they've been updated to "dead" state.
    Any clues please?
    Thanks again!
    Hmm.. I just killed a named in the Grounds and he shows up as a named's corpse now in seq. Can you give any more info on this?
    Last edited by r6express; 10-21-2012 at 07:40 PM.

  6. #111
    Registered User
    Join Date
    Nov 2010
    Posts
    82

    Re: SEQ Borked with 8/15 patch.

    I've splatted lots of named over the weekend, they just stay in my spawn list a "#named" instead of "#named`s corpse" when they are deceased.

    I'm wondering if it's my filters that have gone screwy.

    Filter info
    Name "Named"
    Filter #
    Filter out [`|']|Raid|Mission

    This always used to remove corpses and Mission and Raid NPC's from the list.

    Thanks for reading!
    Your dad.

  7. #112
    Registered User
    Join Date
    Mar 2012
    Posts
    21

    Re: SEQ Borked with 8/15 patch.

    Quote Originally Posted by Spanners View Post
    I've splatted lots of named over the weekend, they just stay in my spawn list a "#named" instead of "#named`s corpse" when they are deceased.
    Do you have these opcodes set in zoneopcodes.xml?

    OP_Consider = 2ad3
    OP_TargetMouse = 5401
    OP_Corpse = 2f00

  8. #113
    Registered User
    Join Date
    Nov 2010
    Posts
    82

    Re: SEQ Borked with 8/15 patch.

    I put those in, but I'm getting old.. I'll check that I put them in the /right/ directory for the build.

    Thats the great thing about getting old, you can invent the banana and everyone knows what state you're in.
    Your dad.

  9. #114
    Administrator
    Join Date
    Sep 2005
    Posts
    357

    Re: SEQ Borked with 8/15 patch.

    Home for a day so I tried the changes suggested above from a clean tarball download and getting CTD when zoning. Anyone else seeing this? Tried several toons and all the same. Seems to crash on PlayerProfile packet.

    Code:
    Program received signal SIGSEGV, Segmentation fault.
    0x006a6d0a in __strcmp_ia32 () from /lib/libc.so.6
    Missing separate debuginfos, use: debuginfo-install expat-2.0.1-10.fc13.i686 fontconfig-2.8.0-2.fc14.i686 freetype-2.4.2-7.fc14.i686 glibc-2.13-2.i686 lcms-libs-1.19-2.fc14.i686 libICE-1.0.6-2.fc13.i686 libSM-1.1.0-7.fc12.i686 libX11-1.3.4-4.fc14.i686 libXau-1.0.6-1.fc14.i686 libXcursor-1.1.10-5.fc14.i686 libXext-1.1.2-2.fc14.i686 libXfixes-4.0.5-1.fc14.i686 libXft-2.1.14-1.fc13.i686 libXi-1.3.2-1.fc14.i686 libXinerama-1.1-2.fc13.i686 libXrandr-1.3.0-5.fc13.i686 libXrender-0.9.6-1.fc14.i686 libgcc-4.5.1-4.fc14.i686 libjpeg-turbo-1.1.1-1.fc14.i686 libmng-1.0.10-4.fc12.i686 libpcap-1.1.1-3.fc14.i686 libpng-1.2.46-1.fc14.i686 libstdc++-4.5.1-4.fc14.i686 libuuid-2.18-4.8.fc14.i686 libxcb-1.7-1.fc14.i686 qt3-3.3.8b-37.fc14.i686 zlib-1.2.5-2.fc14.i686
    (gdb) bt
    #0  0x006a6d0a in __strcmp_ia32 () from /lib/libc.so.6
    #1  0x08073320 in SpawnShell::zoneEntry (this=0x83b3da8, data=0x84d59f7 "soandso", len=429) at spawnshell.cpp:733
    #2  0x08075218 in SpawnShell::qt_invoke (this=0x83b3da8, _id=8, _o=0xbfffc2e0) at spawnshell.moc:395
    #3  0x04185642 in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #4  0x0809074f in EQPacketDispatch::signal (this=0x829f158, t0=0x84d59f7 "soandso", t1=429, t2=2 '\002') at packetinfo.moc:99
    #5  0x08089e99 in EQPacketStream::dispatchPacket (this=0x83275d8, data=0x84d59f7 "soandso", len=429, opCode=12887, opcodeEntry=0x83aea20)
        at packetstream.cpp:435
    #6  0x0808c27b in EQPacketStream::processPacket (this=0x83275d8, packet=..., isSubpacket=true) at packetstream.cpp:752
    #7  0x0808c58d in EQPacketStream::processPacket (this=0x83275d8, packet=..., isSubpacket=true) at packetstream.cpp:890
    #8  0x0808c2e8 in EQPacketStream::processPacket (this=0x83275d8, packet=..., isSubpacket=false) at packetstream.cpp:657
    #9  0x0808cd48 in EQPacketStream::handlePacket (this=0x83275d8, packet=...) at packetstream.cpp:570
    #10 0x080933a2 in EQPacket::dispatchPacket (this=0x847b030, packet=...) at packet.cpp:659
    #11 0x08095c75 in dispatchPacket (this=0x847b030) at packet.cpp:583
    #12 EQPacket::processPackets (this=0x847b030) at packet.cpp:400
    #13 0x08095f50 in EQPacket::qt_invoke (this=0x847b030, _id=2, _o=0xbfffe768) at packet.moc:577
    #14 0x04185642 in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #15 0x04185724 in QObject::activate_signal(int) () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #16 0x044ccc5a in QTimer::timeout() () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #17 0x041a5e3e in QTimer::event(QEvent*) () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #18 0x04123ffd in QApplication::internalNotify(QObject*, QEvent*) () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #19 0x0412418b in QApplication::notify(QObject*, QEvent*) () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #20 0x0411823c in QEventLoop::activateTimers() () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #21 0x040d3182 in QEventLoop::processEvents(unsigned int) () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #22 0x04139b50 in QEventLoop::enterLoop() () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #23 0x04139ad7 in QEventLoop::exec() () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #24 0x04124d20 in QApplication::exec() () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
    #25 0x08067a8b in main (argc=1, argv=0xbffff3f4) at main.cpp:737
    
    
    Must be missing something...
    Last edited by fransick; 10-22-2012 at 09:39 PM.

  10. #115
    Developer
    Join Date
    Sep 2005
    Posts
    155

    Re: SEQ Borked with 8/15 patch.

    It's working fine for me. Please keep in mind that the interface.cpp file does not have the change mentioned a couple pages back, so you need to make a change to that after you paste in the above code.

  11. #116
    Administrator
    Join Date
    Sep 2005
    Posts
    357

    Re: SEQ Borked with 8/15 patch.

    Quote Originally Posted by rogues View Post
    It's working fine for me. Please keep in mind that the interface.cpp file does not have the change mentioned a couple pages back, so you need to make a change to that after you paste in the above code.
    Are you referencing this change Rogues?

    Code:
    interface.cpp:1647 change to: 
    "charProfileStruct", SZC_None,
    When I look at the interface.cpp posted above I do not see the place where you would change it from what I assume was "Match" to "None". Perhaps it's jet lag but not seeing what I need to do!

  12. #117
    Registered User
    Join Date
    Mar 2012
    Posts
    21

    Re: SEQ Borked with 8/15 patch.

    fransick, try grabbing the latest svn changes I just pushed. That should help rule out if this is a manual merge problem or not.

  13. #118
    Administrator
    Join Date
    Sep 2005
    Posts
    357

    Re: SEQ Borked with 8/15 patch.

    Quote Originally Posted by r6express View Post
    fransick, try grabbing the latest svn changes I just pushed. That should help rule out if this is a manual merge problem or not.
    Yep, it musta been me... grabbed revision 771 and it is working. Will work on some opcodes this weekend when back in town. Well done r6!

  14. #119
    Developer
    Join Date
    Sep 2005
    Posts
    155

    Re: SEQ Borked with 8/15 patch.

    Quote Originally Posted by fransick View Post
    Are you referencing this change Rogues?

    Code:
    interface.cpp:1647 change to: 
    "charProfileStruct", SZC_None,
    When I look at the interface.cpp posted above I do not see the place where you would change it from what I assume was "Match" to "None". Perhaps it's jet lag but not seeing what I need to do!
    I was referring to this but I should have said spawnshell.cpp
    spawnshell.cpp:640 change to:
    if(name.length() > 0 && name.length() < sizeof(spawn->lastName))
    but it looks like you are all set now.

  15. #120
    Registered User
    Join Date
    Nov 2010
    Posts
    82

    Re: SEQ Borked with 8/15 patch.

    Quote Originally Posted by r6express View Post
    Do you have these opcodes set in zoneopcodes.xml?

    OP_Consider = 2ad3
    OP_TargetMouse = 5401
    OP_Corpse = 2f00

    I don't have anything with OP_Corpse , only OP_CorpseLocResponse - same thing?
    Your dad.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

You may post new threads
You may post replies
You may post attachments
You may edit your posts
HTML code is Off
vB code is On
Smilies are On
[IMG] code is On