Jump to content

caeruleaus

Members
  • Posts

    185
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by caeruleaus

  1. they work right off except that it's missing GridMapManager.h/cpp so you can't compile it. I happened to find them though lol.

    GridMapManager.cpp

    #include "GridMapManager.h"
    
    
    namespace VMAP
    {
    
       GridMap::GridMap()
       {
           m_flags = 0;
           // Area data
           m_gridArea = 0;
           m_area_map = NULL;
           // Height level data
           m_gridHeight = -100000.0f;
           m_gridGetHeight = &GridMap::getHeightFromFlat;
           m_V9 = NULL;
           m_V8 = NULL;
           // Liquid data
           m_liquidType    = 0;
           m_liquid_offX   = 0;
           m_liquid_offY   = 0;
           m_liquid_width  = 0;
           m_liquid_height = 0;
           m_liquidLevel = -100000.0f;
           m_liquid_type = NULL;
           m_liquid_map  = NULL;
       }
    
       GridMap::~GridMap()
       {
           unloadData();
       }
    
       bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/)
       {
           map_areaHeader header;
           fseek(in, offset, SEEK_SET);
           fread(&header, sizeof(header), 1, in);
           if (header.fourcc != *((uint32 const*)(MAP_AREA_MAGIC)))
               return false;
    
           m_gridArea = header.gridArea;
           if (!(header.flags & MAP_AREA_NO_AREA))
           {
               m_area_map = new uint16 [16*16];
               fread(m_area_map, sizeof(uint16), 16*16, in);
           }
           return true;
       }
    
       bool  GridMap::loadHeightData(FILE *in, uint32 offset, uint32 /*size*/)
       {
           map_heightHeader header;
           fseek(in, offset, SEEK_SET);
           fread(&header, sizeof(header), 1, in);
           if (header.fourcc != *((uint32 const*)(MAP_HEIGHT_MAGIC)))
               return false;
    
           m_gridHeight = header.gridHeight;
           if (!(header.flags & MAP_HEIGHT_NO_HEIGHT))
           {
               if ((header.flags & MAP_HEIGHT_AS_INT16))
               {
                   m_uint16_V9 = new uint16 [129*129];
                   m_uint16_V8 = new uint16 [128*128];
                   fread(m_uint16_V9, sizeof(uint16), 129*129, in);
                   fread(m_uint16_V8, sizeof(uint16), 128*128, in);
                   m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535;
                   m_gridGetHeight = &GridMap::getHeightFromUint16;
               }
               else if ((header.flags & MAP_HEIGHT_AS_INT8))
               {
                   m_uint8_V9 = new uint8 [129*129];
                   m_uint8_V8 = new uint8 [128*128];
                   fread(m_uint8_V9, sizeof(uint8), 129*129, in);
                   fread(m_uint8_V8, sizeof(uint8), 128*128, in);
                   m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255;
                   m_gridGetHeight = &GridMap::getHeightFromUint8;
               }
               else
               {
                   m_V9 = new float [129*129];
                   m_V8 = new float [128*128];
                   fread(m_V9, sizeof(float), 129*129, in);
                   fread(m_V8, sizeof(float), 128*128, in);
                   m_gridGetHeight = &GridMap::getHeightFromFloat;
               }
           }
           else
               m_gridGetHeight = &GridMap::getHeightFromFlat;
           return true;
       }
    
       bool  GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/)
       {
           map_liquidHeader header;
           fseek(in, offset, SEEK_SET);
           fread(&header, sizeof(header), 1, in);
           if (header.fourcc != *((uint32 const*)(MAP_LIQUID_MAGIC)))
               return false;
    
           m_liquidType   = header.liquidType;
           m_liquid_offX  = header.offsetX;
           m_liquid_offY  = header.offsetY;
           m_liquid_width = header.width;
           m_liquid_height= header.height;
           m_liquidLevel  = header.liquidLevel;
    
           if (!(header.flags & MAP_LIQUID_NO_TYPE))
           {
               m_liquid_type = new uint8 [16*16];
               fread(m_liquid_type, sizeof(uint8), 16*16, in);
           }
           if (!(header.flags & MAP_LIQUID_NO_HEIGHT))
           {
               m_liquid_map = new float [m_liquid_width*m_liquid_height];
               fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in);
           }
           return true;
       }
    
       float  GridMap::getHeightFromFlat(float /*x*/, float /*y*/) const
       {
           return m_gridHeight;
       }
    
       float  GridMap::getHeightFromFloat(float x, float y) const
       {
           if (!m_V8 || !m_V9)
               return m_gridHeight;
    
           x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
           y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
    
           int x_int = (int)x;
           int y_int = (int)y;
           x -= x_int;
           y -= y_int;
           x_int&=(MAP_RESOLUTION - 1);
           y_int&=(MAP_RESOLUTION - 1);
    
           // Height stored as: h5 - its v8 grid, h1-h4 - its v9 grid
           // +--------------> X
           // | h1-------h2     Coordinates is:
           // | | \\  1  / |     h1 0,0
           // | |  \\   /  |     h2 0,1
           // | | 2  h5 3 |     h3 1,0
           // | |  /   \\  |     h4 1,1
           // | | /  4  \\ |     h5 1/2,1/2
           // | h3-------h4
           // V Y
           // For find height need
           // 1 - detect triangle
           // 2 - solve linear equation from triangle points
           // Calculate coefficients for solve h = a*x + b*y + c
    
           float a,b,c;
           // Select triangle:
           if (x+y < 1)
           {
               if (x > y)
               {
                   // 1 triangle (h1, h2, h5 points)
                   float h1 = m_V9[(x_int  )*129 + y_int];
                   float h2 = m_V9[(x_int+1)*129 + y_int];
                   float h5 = 2 * m_V8[x_int*128 + y_int];
                   a = h2-h1;
                   b = h5-h1-h2;
                   c = h1;
               }
               else
               {
                   // 2 triangle (h1, h3, h5 points)
                   float h1 = m_V9[x_int*129 + y_int  ];
                   float h3 = m_V9[x_int*129 + y_int+1];
                   float h5 = 2 * m_V8[x_int*128 + y_int];
                   a = h5 - h1 - h3;
                   b = h3 - h1;
                   c = h1;
               }
           }
           else
           {
               if (x > y)
               {
                   // 3 triangle (h2, h4, h5 points)
                   float h2 = m_V9[(x_int+1)*129 + y_int  ];
                   float h4 = m_V9[(x_int+1)*129 + y_int+1];
                   float h5 = 2 * m_V8[x_int*128 + y_int];
                   a = h2 + h4 - h5;
                   b = h4 - h2;
                   c = h5 - h4;
               }
               else
               {
                   // 4 triangle (h3, h4, h5 points)
                   float h3 = m_V9[(x_int  )*129 + y_int+1];
                   float h4 = m_V9[(x_int+1)*129 + y_int+1];
                   float h5 = 2 * m_V8[x_int*128 + y_int];
                   a = h4 - h3;
                   b = h3 + h4 - h5;
                   c = h5 - h4;
               }
           }
           // Calculate height
           return a * x + b * y + c;
       }
    
       float  GridMap::getHeightFromUint8(float x, float y) const
       {
           if (!m_uint8_V8 || !m_uint8_V9)
               return m_gridHeight;
    
           x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
           y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
    
           int x_int = (int)x;
           int y_int = (int)y;
           x -= x_int;
           y -= y_int;
           x_int&=(MAP_RESOLUTION - 1);
           y_int&=(MAP_RESOLUTION - 1);
    
           int32 a, b, c;
           uint8 *V9_h1_ptr = &m_uint8_V9[x_int*128 + x_int + y_int];
           if (x+y < 1)
           {
               if (x > y)
               {
                   // 1 triangle (h1, h2, h5 points)
                   int32 h1 = V9_h1_ptr[  0];
                   int32 h2 = V9_h1_ptr[129];
                   int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int];
                   a = h2-h1;
                   b = h5-h1-h2;
                   c = h1;
               }
               else
               {
                   // 2 triangle (h1, h3, h5 points)
                   int32 h1 = V9_h1_ptr[0];
                   int32 h3 = V9_h1_ptr[1];
                   int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int];
                   a = h5 - h1 - h3;
                   b = h3 - h1;
                   c = h1;
               }
           }
           else
           {
               if (x > y)
               {
                   // 3 triangle (h2, h4, h5 points)
                   int32 h2 = V9_h1_ptr[129];
                   int32 h4 = V9_h1_ptr[130];
                   int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int];
                   a = h2 + h4 - h5;
                   b = h4 - h2;
                   c = h5 - h4;
               }
               else
               {
                   // 4 triangle (h3, h4, h5 points)
                   int32 h3 = V9_h1_ptr[  1];
                   int32 h4 = V9_h1_ptr[130];
                   int32 h5 = 2 * m_uint8_V8[x_int*128 + y_int];
                   a = h4 - h3;
                   b = h3 + h4 - h5;
                   c = h5 - h4;
               }
           }
           // Calculate height
           return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight;
       }
    
       float  GridMap::getHeightFromUint16(float x, float y) const
       {
           if (!m_uint16_V8 || !m_uint16_V9)
               return m_gridHeight;
    
           x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
           y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
    
           int x_int = (int)x;
           int y_int = (int)y;
           x -= x_int;
           y -= y_int;
           x_int&=(MAP_RESOLUTION - 1);
           y_int&=(MAP_RESOLUTION - 1);
    
           int32 a, b, c;
           uint16 *V9_h1_ptr = &m_uint16_V9[x_int*128 + x_int + y_int];
           if (x+y < 1)
           {
               if (x > y)
               {
                   // 1 triangle (h1, h2, h5 points)
                   int32 h1 = V9_h1_ptr[  0];
                   int32 h2 = V9_h1_ptr[129];
                   int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int];
                   a = h2-h1;
                   b = h5-h1-h2;
                   c = h1;
               }
               else
               {
                   // 2 triangle (h1, h3, h5 points)
                   int32 h1 = V9_h1_ptr[0];
                   int32 h3 = V9_h1_ptr[1];
                   int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int];
                   a = h5 - h1 - h3;
                   b = h3 - h1;
                   c = h1;
               }
           }
           else
           {
               if (x > y)
               {
                   // 3 triangle (h2, h4, h5 points)
                   int32 h2 = V9_h1_ptr[129];
                   int32 h4 = V9_h1_ptr[130];
                   int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int];
                   a = h2 + h4 - h5;
                   b = h4 - h2;
                   c = h5 - h4;
               }
               else
               {
                   // 4 triangle (h3, h4, h5 points)
                   int32 h3 = V9_h1_ptr[  1];
                   int32 h4 = V9_h1_ptr[130];
                   int32 h5 = 2 * m_uint16_V8[x_int*128 + y_int];
                   a = h4 - h3;
                   b = h3 + h4 - h5;
                   c = h5 - h4;
               }
           }
           // Calculate height
           return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight;
       }

    GridMapManager.h

    #ifndef _GRIDMAPMANAGER_H
    #define _GRIDMAPMANAGER_H
    
    #include <string>
    
    namespace VMAP
    {
    
       #define MAX_NUMBER_OF_GRIDS      64
    
       #define SIZE_OF_GRIDS            533.33333f
       #define CENTER_GRID_ID           (MAX_NUMBER_OF_GRIDS/2)
    
       #define CENTER_GRID_OFFSET      (SIZE_OF_GRIDS/2)
    
       #define MAX_NUMBER_OF_CELLS     8
       #define SIZE_OF_GRID_CELL       (SIZE_OF_GRIDS/MAX_NUMBER_OF_CELLS)
    
       #define CENTER_GRID_CELL_ID     (MAX_NUMBER_OF_CELLS*MAX_NUMBER_OF_GRIDS/2)
       #define CENTER_GRID_CELL_OFFSET (SIZE_OF_GRID_CELL/2)
    
       #define TOTAL_NUMBER_OF_CELLS_PER_MAP    (MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_CELLS)
    
       #define MAP_RESOLUTION 128
    
       #define MAP_SIZE                (SIZE_OF_GRIDS*MAX_NUMBER_OF_GRIDS)
       #define MAP_HALFSIZE            (MAP_SIZE/2)
    
    
         //================================================
    
       static char const* MAP_MAGIC         = "MAPS";
       static char const* MAP_VERSION_MAGIC = "v1.1";
       static char const* MAP_AREA_MAGIC    = "AREA";
       static char const* MAP_HEIGHT_MAGIC  = "MHGT";
       static char const* MAP_LIQUID_MAGIC  = "MLIQ";
    
       typedef unsigned int uint32;
       typedef unsigned short uint16;
       typedef unsigned char uint8;
       typedef signed int int32;
    
       struct map_fileheader
       {
           uint32 mapMagic;
           uint32 versionMagic;
           uint32 buildMagic;
           uint32 areaMapOffset;
           uint32 areaMapSize;
           uint32 heightMapOffset;
           uint32 heightMapSize;
           uint32 liquidMapOffset;
           uint32 liquidMapSize;
       };
    
       #define MAP_AREA_NO_AREA      0x0001
    
       struct map_areaHeader
       {
           uint32 fourcc;
           uint16 flags;
           uint16 gridArea;
       };
    
       #define MAP_HEIGHT_NO_HEIGHT  0x0001
       #define MAP_HEIGHT_AS_INT16   0x0002
       #define MAP_HEIGHT_AS_INT8    0x0004
    
       struct map_heightHeader
       {
           uint32 fourcc;
           uint32 flags;
           float  gridHeight;
           float  gridMaxHeight;
       };
    
       #define MAP_LIQUID_NO_TYPE    0x0001
       #define MAP_LIQUID_NO_HEIGHT  0x0002
    
       struct map_liquidHeader
       {
           uint32 fourcc;
           uint16 flags;
           uint16 liquidType;
           uint8  offsetX;
           uint8  offsetY;
           uint8  width;
           uint8  height;
           float  liquidLevel;
       };
    
       enum ZLiquidStatus
       {
           LIQUID_MAP_NO_WATER     = 0x00000000,
           LIQUID_MAP_ABOVE_WATER  = 0x00000001,
           LIQUID_MAP_WATER_WALK   = 0x00000002,
           LIQUID_MAP_IN_WATER     = 0x00000004,
           LIQUID_MAP_UNDER_WATER  = 0x00000008
       };
    
       #define MAP_LIQUID_TYPE_NO_WATER    0x00
       #define MAP_LIQUID_TYPE_WATER       0x01
       #define MAP_LIQUID_TYPE_OCEAN       0x02
       #define MAP_LIQUID_TYPE_MAGMA       0x04
       #define MAP_LIQUID_TYPE_SLIME       0x08
    
       #define MAP_ALL_LIQUIDS   (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN | MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME)
    
       #define MAP_LIQUID_TYPE_DARK_WATER  0x10
       #define MAP_LIQUID_TYPE_WMO_WATER   0x20
    
       struct LiquidData
       {
           uint32 type;
           float  level;
           float  depth_level;
       };
    
       class GridMap
       {
           uint32  m_flags;
           // Area data
           uint16  m_gridArea;
           uint16 *m_area_map;
           // Height level data
           float   m_gridHeight;
           float   m_gridIntHeightMultiplier;
           union{
               float  *m_V9;
               uint16 *m_uint16_V9;
               uint8  *m_uint8_V9;
           };
           union{
               float  *m_V8;
               uint16 *m_uint16_V8;
               uint8  *m_uint8_V8;
           };
           // Liquid data
           uint16  m_liquidType;
           uint8   m_liquid_offX;
           uint8   m_liquid_offY;
           uint8   m_liquid_width;
           uint8   m_liquid_height;
           float   m_liquidLevel;
           uint8  *m_liquid_type;
           float  *m_liquid_map;
    
           bool  loadAreaData(FILE *in, uint32 offset, uint32 size);
           bool  loadHeightData(FILE *in, uint32 offset, uint32 size);
           bool  loadLiquidData(FILE *in, uint32 offset, uint32 size);
    
           // Get height functions and pointers
           typedef float (GridMap::*pGetHeightPtr) (float x, float y) const;
           pGetHeightPtr m_gridGetHeight;
           float  getHeightFromFloat(float x, float y) const;
           float  getHeightFromUint16(float x, float y) const;
           float  getHeightFromUint8(float x, float y) const;
           float  getHeightFromFlat(float x, float y) const;
    
       public:
           GridMap();
           ~GridMap();
           bool  loadData(char *filaname);
           void  unloadData();
    
           //uint16 getArea(float x, float y);
           inline float getHeight(float x, float y) {return (this->*m_gridGetHeight)(x, y);}
           //float  getLiquidLevel(float x, float y);
           //uint8  getTerrainType(float x, float y);
           //ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data = 0);
       };
    
       //================================================
    
       class GridMapManager
       {
       private:
           GridMap *iGridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
           bool iMapExist[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
           std::string iBasePath;
           unsigned int iMapId;
       public:
           GridMapManager (const char* pBasePath, unsigned int pMapId);
           ~GridMapManager ();
    
           bool loadMap (int pX, int pY);
           void unloadMap (int pX, int pY);
           float getHeight (float pX, float pY);
       };
    
     //================================================
    }
    
    #endif

  2. UPDATE: Made it so you can choose which build type you'd like to make it.

    For example, I have Windows 7 64 bit so I have the buildarch set as

    "Release|x64"

    If you want it for win32

    "Release|win32"

    To build for x64 your microsoft visual studio MUST be set up for it. There's a few tutorials online that explain how to setup the express editions to build for x64. I am NOT going to help you set it up for x64. Google it.

    I did it and so can you.

  3. Not sure if i should do this here or not but it makes sense to be in installation.

    This is an automatic batch file to update, compile, and zip mangos. I don't really care about the zip function that much though i did make it work with 7-zip. The original idea came from http://www.scriptdev2.com/windows-ultimate-mangos-t16.html. So i have to thank elegos for the original idea. However i modified it to use vcbuild instead of msbuild and made it work with git for mangos. You can automate this by adding it to the taskscheduler. I'm not going to go into how to do that but you can google it pretty easy.

    Anyway have fun, tell me if it works and whatnot. Make sure to update the fields to reflect your setup.

    vcbuild will always be in the Microsoft Visual Studio folder, just make sure it's the right version. I have visual studio 9.0 so just make sure it reflects which one you have.

    MAKE SURE TO RUN THE BATCH FILE AS ADMINISTRATOR IF YOU WANT ZIPPING TO WORK!

    @ECHO OFF
    SET VCBUILDDRIVE=C:
    SET VCBUILDPATH= Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\vcpackages
    ::
    SET MANGOSPATH=C:\\mangos
    :: VC80|VC90|VC100
    SET SOLUTIONV=VC90
    :: Release|Debug:win32|x64
    SET BUILDARCH="Release|x64"
    :: Y|N
    SET PAUSEMODE=N
    
    :: OPTIONAL
    
    :: Y|N, you need Subversion installed
    SET SVNMODE=N
    SET SVNDRIVE=C:
    SET SVNPATH=Program Files\\TortoiseSVN\\bin
    
    :: Y|N, you need GIT installed
    SET GITMODE=N
    SET GITDRIVE=C:
    SET GITPATH=git\\bin
    
    :: Y|N
    SET ARCHIVEMODE=N
    :: WINRAR|WINZIP|7ZIP
    SET ARCHIVER=7ZIP
    SET ARCHIVERDRIVE=C:
    SET ARCHIVERPATH=Program Files\\7-Zip
    SET ARCHIVENAME=MaNGOS_SD2_svn
    SET ARCHIVEPATH=C:\\MaNGOS_bins
    
    IF %GITMODE%==Y GOTO GIT
    GOTO BUILD
    :GIT
    %GITDRIVE%
    CD\\
    CD %GITPATH%
    IF NOT EXIST %MANGOSPATH% git clone git://github.com/mangos/mangos.git %MANGOSPATH%
    git --git-dir=%MANGOSPATH%\\.git pull origin master
    IF %SVNMODE%==Y GOTO SVN
    GOTO BUILD
    :SVN
    %SVNDRIVE%
    CD\\
    CD %SVNPATH%
    IF NOT EXIST %MANGOSPATH%\\src\\bindings\\ScriptDev2 TortoiseProc /command:checkout /path:%MANGOSPATH%\\src\\bindings\\ScriptDev2 /closeonend:1 /url:[url]https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2[/url]
    TortoiseProc /command:update /path:%MANGOSPATH%\\src\\bindings\\ScriptDev2 /closeonend:1 /url:[url]https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2[/url]
    IF %PAUSEMODE%==Y PAUSE
    :BUILD
    %VCBUILDDRIVE%
    CD\\
    CD %VCBUILDPATH%
    vcbuild %MANGOSPATH%\\win\\mangosd%SOLUTIONV%.sln %BUILDARCH% /rebuild
    IF %PAUSEMODE%== Y PAUSE
    vcbuild %MANGOSPATH%\\src\\bindings\\ScriptDev2\\script%SOLUTIONV%.sln %BUILDARCH% /rebuild
    
    copy %MANGOSPATH%\\src\\mangosd\\mangosd.conf.dist.in %MANGOSPATH%\\bin\\win32_release\\mangosd.conf
    copy %MANGOSPATH%\\src\\realmd\\realmd.conf.dist.in %MANGOSPATH%\\bin\\win32_release\\realmd.conf
    copy %MANGOSPATH%\\src\\bindings\\ScriptDev2\\ScriptDev2.conf.dist.in %MANGOSPATH%\\bin\\win32_release\\ScriptDev2.conf
    
    IF %PAUSEMODE%== Y PAUSE
    IF %ARCHIVEMODE%==Y GOTO ARCHIVER
    GOTO END
    :ARCHIVER
    CD\\
    %ARCHIVERDRIVE%
    CD\\
    CD %ARCHIVERPATH%
    IF %ARCHIVER%==WINRAR GOTO WINRAR
    IF %ARCHIVER%==WINZIP GOTO WINZIP
    IF %ARCHIVER%==7ZIP GOTO 7ZIP
    GOTO END
    :WINRAR
    rar a %ARCHIVEPATH%\\%ARCHIVENAME% %MANGOSPATH%\\bin\\win32_release\\ -ao -ad -r -ep1
    rar a %ARCHIVEPATH%\\%ARCHIVENAME% %MANGOSPATH%\\sql\\ -apmangos_sql -ao -ad -r -ep1 -x*.svn-base -x*ll-wcprops -x*ntries -x*ormat -xMakefile*
    rar a %ARCHIVEPATH%\\%ARCHIVENAME% %MANGOSPATH%\\src\\bindings\\ScriptDev2\\sql\\ -apscriptdev2_sql -ao -ad -r -ep1 -x*.svn-base -x*ll-wcprops -x*ntries -x*ormat
    GOTO END
    :WINZIP
    GOTO END
    :7ZIP
    7z d %ARCHIVEPATH%\\%ARCHIVENAME%
    7z a %ARCHIVEPATH%\\%ARCHIVENAME% %MANGOSPATH%\\bin\\win32_release\\ -r -x!*.map -x!*.exp -x!*.lib
    7z a %ARCHIVEPATH%\\%ARCHIVENAME% %MANGOSPATH%\\sql\\ -r -x!*.am -x!*.in -x!*.svn
    7z a %ARCHIVEPATH%\\%ARCHIVENAME% %MANGOSPATH%\\src\\bindings\\ScriptDev2\\sql\\ -r -x!*.am -x!*.in -x!*.svn
    GOTO END
    :END
    EXIT

    EDIT: Made it work a lot better without the taskkill stuff! WOO

  4. sorry for the double post but i found a way that works though it might be a little hackish. For whatever reason the spell goes to implicit target 63 (TARGET_DUELVSPLAYER_COORDINATES) as well as implicit target 31 (TARGET_ALL_FRIENDLY_IN_AREA or something like that) and implicit target 23 (TARGET_GAMEOBJECT). I didn't deal with the gameobject one but this should fix it healing everyone (just chooses a random target near the original caster and heals it)

    diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
    index b0acd37..789d381 100644
    --- a/src/game/Spell.cpp
    +++ b/src/game/Spell.cpp
    @@ -1661,7 +1661,11 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
            }
            case TARGET_DUELVSPLAYER_COORDINATES:
            {
    -            if(Unit* currentTarget = m_targets.getUnitTarget())
    +            if(m_spellInfo->Id == 71610)
    +            {
    +                break;
    +            }
    +            else if(Unit* currentTarget = m_targets.getUnitTarget())
                {
                    m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ());
                    targetUnitMap.push_back(currentTarget);
    @@ -1724,8 +1728,46 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
                }
                break;
            case TARGET_ALL_FRIENDLY_UNITS_IN_AREA:
    +            // Echoes of Light
    +            if (m_spellInfo->Id == 71610)
    +            {
    +                CellPair p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
    +                Cell cell(p);
    +                cell.data.Part.reserved = ALL_DISTRICT;
    +                cell.SetNoCreate();
    +                std::list<Unit*> tempTargetUnitMap;
    +                {
    +                    MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(m_caster, radius);
    +                    MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(m_caster, tempTargetUnitMap, u_check);
    +
    +                    TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
    +                    TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, GridTypeMapContainer >  grid_unit_searcher(searcher);
    +
    +                    cell.Visit(p, world_unit_searcher, *m_caster->GetMap(), *m_caster, radius);
    +                    cell.Visit(p, grid_unit_searcher, *m_caster->GetMap(), *m_caster, radius);
    +                }
    +
    +                if(tempTargetUnitMap.empty())
    +                    break;
    +
    +                tempTargetUnitMap.sort(TargetDistanceOrder(m_caster));
    +
    +                //Now to get us a random target that's in the initial range of the spell
    +                uint32 t = 0;
    +                std::list<Unit*>::iterator itr = tempTargetUnitMap.begin();
    +                while(itr != tempTargetUnitMap.end() && (*itr)->IsWithinDist(m_caster, radius))
    +                    ++t, ++itr;
    +
    +                if(!t)
    +                    break;
    +
    +                itr = tempTargetUnitMap.begin();
    +                std::advance(itr, rand() % t);
    +                Unit *pUnitTarget = *itr;
    +                targetUnitMap.push_back(pUnitTarget);
    +            }
                // Death Pact (in fact selection by player selection)
    -            if (m_spellInfo->Id == 48743)
    +            else if (m_spellInfo->Id == 48743)
                {
                    // checked in Spell::CheckCast
                    if (m_caster->GetTypeId()==TYPEID_PLAYER)
    
    

    EDIT: Just to clarify, i checked the DBC files and it doesn't have implicitTarget 63. But for some reason it still goes to that case statement. It does have EffectMechanic 63 though i don't even know where the effect mechanics are listed.

  5. okay, I'm working on fixing the trinket Althor's Abacus

    It trigger's spell Item - Icecrown 25 Normal Healer Trinket 2

    which then triggers spell:

    Echoes of Light

    It has ImplictTargetA1 as 31 which is TARGET_ALL_FRIENDLY_UNITS_IN_AREA

    and ImplicitTargetB1 as 23 which is TARGET_GAMEOBJECT (I'm assuming it's for healing destructible gameobjects that are friendly to you in wintergrasp).

    Right now i just want to fix it so it will choose ONE friendly random target near the caster within the defined radius of (in the DBCs it's 31 yards, on WoWhead it says 40) 31 yards. I tried seeing it i could do it by just using FillAreaTargets and then choosing the first unit from the targetmap but that doesnt seem to work. So now i just want to get a random target and then push it to the targetmap.

  6. it's a client limitation now. The client expects all the weapons to be in the DBC files so if it's not, it won't load the proper values to let you cast spells. I was attempting to find a way to trick the client into thinking it was a different weapon than it was (for spell casting anyway) but gave up for now. You can use unused ID's that are in the DBC files and it will work correctly but it takes a lot of time to go through them all.

  7. make sure the makefile in src/shared looks like

    # Copyright (C) 2005-2010 MaNGOS <http://getmangos.eu/>
    #
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; either version 2 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program; if not, write to the Free Software
    # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    
    ## Process this file with automake to produce Makefile.in
    
    ## Sub-directories to parse
    SUBDIRS = Auth Config Database vmap
    
    ## CPP flags for includes, defines, etc.
    AM_CPPFLAGS = $(MANGOS_INCLUDES) -I$(top_builddir)/src/shared -I$(srcdir) -I$(srcdir)/../../dep/include -I$(srcdir)/../framework -I$(srcdir)/../shared -I$(srcdir)/../../dep/include/g3dlite  -DSYSCONFDIR=\\"$(sysconfdir)/\\"
    ## AM_CPPFLAGS += -I$(srcdir)/../game -I$(srcdir)/../realmd
    
    ## Build MaNGOS shared library and its parts as convenience library.
    #  All libraries will be convenience libraries. Might be changed to shared
    #  later.
    noinst_LIBRARIES = libmangosshared.a
    
    #  libmangosshared library will later be reused by ...
    libmangosshared_a_SOURCES = \\
       ByteBuffer.h \\
       Common.cpp \\
       Common.h \\
       DelayExecutor.cpp \\
       DelayExecutor.h \\
       Errors.h \\
       LockedQueue.h \\
       Log.cpp \\
       Log.h \\
       MemoryLeaks.cpp \\
       MemoryLeaks.h \\
       ProgressBar.cpp \\
       ProgressBar.h \\
       Timer.h \\
       Threading.cpp \\
       Threading.h \\
       Util.cpp \\
       Util.h \\
       WorldPacket.h \\
       revision_nr.h \\
       revision_sql.h \\
       revision.h
    
    # Get revision (git or svn)
    REVISION_FILE = revision.h
    
    BUILT_SOURCES = $(REVISION_FILE)
    CLEANFILES = $(REVISION_FILE)
    
    FORCE:
    
    $(REVISION_FILE) : $(top_builddir)/src/tools/genrevision/genrevision FORCE
       $(top_builddir)/src/tools/genrevision/genrevision $(top_srcdir)
    
    ## Additional files to include when running 'make dist'
    #  Disabled packet logger
    EXTRA_DIST = \\
       PacketLog.cpp \\
       PacketLog.h
    
    # System configuration
    EXTRA_DIST += \\
       SystemConfig.h
    
    # System Win32 files
    EXTRA_DIST += \\
       ServiceWin32.cpp \\
       ServiceWin32.h \\
       WheatyExceptionReport.cpp \\
       WheatyExceptionReport.h

  8. try this

    diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
    index 555a44b..271a55c 100644
    --- a/src/game/Spell.cpp
    +++ b/src/game/Spell.cpp
    @@ -1304,6 +1304,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
                    case 31347:                                 // Doom TODO: exclude top threat target from target selection
                    case 33711:                                 // Murmur's Touch
                    case 38794:                                 // Murmur's Touch (h)
    +                case 71610:
                        unMaxTargets = 1;
                        break;
                    case 28542:                                 // Life Drain
    
    

  9. updated my repo. I removed playbot since it was commited in 9661. Added AHBot with the repair bot. Everything SHOULD be in working order (compile wont work for anything but linux and VC90, if you use the other sln files let me know and ill pm you how to fix it).

    Please report errors/crashes/etc.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use