Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/vmangos/core into de…
Browse files Browse the repository at this point in the history
…velopment

# Conflicts:
#	src/game/Movement/RandomMovementGenerator.h
#	src/game/World.h
#	src/game/WorldSession.cpp
  • Loading branch information
jokerlfm committed Jun 27, 2023
2 parents 1672c27 + e3bfb32 commit 43eed45
Show file tree
Hide file tree
Showing 214 changed files with 32,960 additions and 3,623 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/db_dump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ jobs:
# cp ${{github.workspace}}/sql/migrations/logs_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/logs_db_updates.sql
# cp ${{github.workspace}}/sql/migrations/characters_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/characters_db_updates.sql
- name: Install SQLite dependencies
run: |
sudo apt install sqlite3 mawk -y
git clone https://github.com/dumblob/mysql2sqlite
chmod +x ${{github.workspace}}/mysql2sqlite/mysql2sqlite
- name: Create SQLite databases
run: |
mkdir ${{github.workspace}}/dbexport/sqlite_dump || true
${{github.workspace}}/mysql2sqlite/mysql2sqlite ${{github.workspace}}/dbexport/db_dump/mangos.sql | sqlite3 ${{github.workspace}}/dbexport/sqlite_dump/mangos.sqlite
${{github.workspace}}/mysql2sqlite/mysql2sqlite ${{github.workspace}}/dbexport/db_dump/logon.sql | sqlite3 ${{github.workspace}}/dbexport/sqlite_dump/logon.sqlite
${{github.workspace}}/mysql2sqlite/mysql2sqlite ${{github.workspace}}/dbexport/db_dump/logs.sql | sqlite3 ${{github.workspace}}/dbexport/sqlite_dump/logs.sqlite
${{github.workspace}}/mysql2sqlite/mysql2sqlite ${{github.workspace}}/dbexport/db_dump/characters.sql | sqlite3 ${{github.workspace}}/dbexport/sqlite_dump/characters.sqlite
- name: Create New tables
run: |
docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS realmd2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"'
Expand All @@ -98,19 +113,32 @@ jobs:
run: |
cd ${{github.workspace}}/dbexport
7z a -tzip db-${{steps.vars.outputs.sha_short}}.zip db_dump
7z a -tzip db-sqlite-${{steps.vars.outputs.sha_short}}.zip sqlite_dump
- name: Archive this artefact
- name: Archive SQL artifact
uses: actions/upload-artifact@v2
with:
name: snapshot-db-dump
path: "${{github.workspace}}/dbexport/db-${{steps.vars.outputs.sha_short}}.zip"

- name: Archive SQLite artifact
uses: actions/upload-artifact@v2
with:
name: snapshot-db-sqlite-dump
path: "${{github.workspace}}/dbexport/db-sqlite-${{steps.vars.outputs.sha_short}}.zip"

- name: Download artifact snapshot-db-dump
uses: actions/download-artifact@v1
with:
name: snapshot-db-dump
path: all_snapshots

- name: Download artifact snapshot-db-sqlite-dump
uses: actions/download-artifact@v1
with:
name: snapshot-db-sqlite-dump
path: all_snapshots

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
Expand Down
18 changes: 0 additions & 18 deletions contrib/mmap/config.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
{
"0": {
"3652": {
"quick": 1,
"_Info": "fixes terrain beneath a bridge at deadwind pass"
},
"3328": {
"quick": 1,
"_Info": "fixes terrain beneath a barricade at the bulwark"
},
"3147": {
"maxSimplificationError": 1.0,
"detailSampleDist": 0.5,
Expand All @@ -16,15 +8,5 @@
"3050": {
"_Info": "TODO:westbrook garrison"
}
},
"1": {
"3541": {
"quick": 1,
"_Info": "fixes terrain beneath a bridge allowing galak messenger to path correctly"
},
"4045": {
"quick": 1,
"_Info": "fixes terrain beneath a tent so wastewander bandit is no longer stuck"
}
}
}
66 changes: 26 additions & 40 deletions contrib/mmap/src/MapBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,6 @@ namespace MMAP
/**************************************************************************/
MapBuilder::~MapBuilder()
{
for (TileList::iterator it = m_tiles.begin(); it != m_tiles.end(); ++it)
{
(*it).second->clear();
delete (*it).second;
}

delete m_terrainBuilder;
delete m_rcContext;
}
Expand All @@ -294,7 +288,7 @@ namespace MMAP
mapID = uint32(atoi(files[i].substr(0, 3).c_str()));
if (m_tiles.find(mapID) == m_tiles.end())
{
m_tiles.insert(std::pair<uint32, std::set<uint32>*>(mapID, new std::set<uint32>));
m_tiles.emplace(mapID, std::set<uint32>{});
count++;
}
}
Expand All @@ -304,16 +298,19 @@ namespace MMAP
for (uint32 i = 0; i < files.size(); ++i)
{
mapID = uint32(atoi(files[i].substr(0, 3).c_str()));
m_tiles.insert(std::pair<uint32, std::set<uint32>*>(mapID, new std::set<uint32>));
count++;
if (m_tiles.find(mapID) == m_tiles.end())
{
m_tiles.emplace(mapID, std::set<uint32>{});
count++;
}
}
printf("found %u.\n", count);

count = 0;
printf("Discovering tiles... ");
for (TileList::iterator itr = m_tiles.begin(); itr != m_tiles.end(); ++itr)
{
std::set<uint32>* tiles = (*itr).second;
std::set<uint32>& tiles = (*itr).second;
mapID = (*itr).first;

sprintf(filter, "%03u*.vmtile", mapID);
Expand All @@ -325,7 +322,7 @@ namespace MMAP
tileY = uint32(atoi(files[i].substr(4, 2).c_str()));
tileID = StaticMapTree::packTileID(tileY, tileX);

tiles->insert(tileID);
tiles.insert(tileID);
count++;
}

Expand All @@ -338,23 +335,21 @@ namespace MMAP
tileX = uint32(atoi(files[i].substr(5, 2).c_str()));
tileID = StaticMapTree::packTileID(tileX, tileY);

if (tiles->insert(tileID).second)
if (tiles.insert(tileID).second)
count++;
}
}
printf("found %u.\n\n", count);
}

/**************************************************************************/
std::set<uint32>* MapBuilder::getTileList(uint32 mapID)
std::set<uint32>& MapBuilder::getTileList(uint32 mapID)
{
TileList::iterator itr = m_tiles.find(mapID);
if (itr != m_tiles.end())
return (*itr).second;

std::set<uint32>* tiles = new std::set<uint32>();
m_tiles.insert(std::pair<uint32, std::set<uint32>*>(mapID, tiles));
return tiles;
return m_tiles.emplace(mapID, std::set<uint32>{}).first->second;
}

/**************************************************************************/
Expand Down Expand Up @@ -415,8 +410,8 @@ namespace MMAP
void MapBuilder::buildSingleTile(uint32 mapID, uint32 tileX, uint32 tileY)
{
// make sure we process maps which don't have tiles
set<uint32>* tiles = getTileList(mapID);
if (!tiles->size())
std::set<uint32>& tiles = getTileList(mapID);
if (!tiles.size())
{
// convert coord bounds to grid bounds
uint32 minX, minY, maxX, maxY;
Expand All @@ -426,9 +421,9 @@ namespace MMAP
for (uint32 i = minX; i <= maxX; ++i)
for (uint32 j = minY; j <= maxY; ++j)
if (i == tileX && j == tileY)
tiles->insert(StaticMapTree::packTileID(i, j));
tiles.insert(StaticMapTree::packTileID(i, j));
}
if (!tiles->size())
if (!tiles.size())
return;
dtNavMesh* navMesh = nullptr;
buildNavMesh(mapID, navMesh);
Expand All @@ -447,10 +442,10 @@ namespace MMAP
{
printf("Building map %03u: \n", mapID);

std::set<uint32>* tiles = getTileList(mapID);
std::set<uint32>& tiles = getTileList(mapID);

// make sure we process maps which don't have tiles
if (!tiles->size())
if (!tiles.size())
{
// convert coord bounds to grid bounds
uint32 minX, minY, maxX, maxY;
Expand All @@ -459,10 +454,10 @@ namespace MMAP
// add all tiles within bounds to tile list.
for (uint32 i = minX; i <= maxX; ++i)
for (uint32 j = minY; j <= maxY; ++j)
tiles->insert(StaticMapTree::packTileID(i, j));
tiles.insert(StaticMapTree::packTileID(i, j));
}

if (!tiles->size())
if (!tiles.size())
return;

// build navMesh
Expand All @@ -475,10 +470,10 @@ namespace MMAP
}

// now start building mmtiles for each tile
printf("[Map %03i] We have %u tiles. \n", mapID, uint32(tiles->size()));
printf("[Map %03i] We have %u tiles. \n", mapID, uint32(tiles.size()));

uint32 currentTile = 0;
for (std::set<uint32>::iterator it = tiles->begin(); it != tiles->end(); ++it)
for (std::set<uint32>::iterator it = tiles.begin(); it != tiles.end(); ++it)
{
currentTile++;
uint32 tileX, tileY;
Expand All @@ -489,7 +484,7 @@ namespace MMAP
if (shouldSkipTile(mapID, tileX, tileY))
continue;

buildTile(mapID, tileX, tileY, navMesh, currentTile, uint32(tiles->size()));
buildTile(mapID, tileX, tileY, navMesh, currentTile, uint32(tiles.size()));
}

dtFreeNavMesh(navMesh);
Expand Down Expand Up @@ -539,12 +534,12 @@ namespace MMAP
/**************************************************************************/
void MapBuilder::buildNavMesh(uint32 mapID, dtNavMesh*& navMesh)
{
std::set<uint32>* tiles = getTileList(mapID);
std::set<uint32>& tiles = getTileList(mapID);

/*** calculate bounds of map ***/

uint32 tileXMax = 0, tileYMax = 0, tileX, tileY;
for (std::set<uint32>::iterator it = tiles->begin(); it != tiles->end(); ++it)
for (std::set<uint32>::iterator it = tiles.begin(); it != tiles.end(); ++it)
{
StaticMapTree::unpackTileID((*it), tileX, tileY);

Expand All @@ -558,7 +553,7 @@ namespace MMAP
// use Max because '32 - tileX' is negative for values over 32
float bmin[3], bmax[3];
getTileBounds(tileXMax, tileYMax, nullptr, 0, bmin, bmax);
int maxTiles = tiles->size();
int maxTiles = tiles.size();

/*** now create the navmesh ***/

Expand Down Expand Up @@ -690,12 +685,6 @@ namespace MMAP
tileCfg.bmax[0] = config.bmin[0] + float((x + 1) * config.tileSize + config.borderSize) * config.cs;
tileCfg.bmax[2] = config.bmin[2] + float((y + 1) * config.tileSize + config.borderSize) * config.cs;

float tbmin[2], tbmax[2];
tbmin[0] = tileCfg.bmin[0];
tbmin[1] = tileCfg.bmin[2];
tbmax[0] = tileCfg.bmax[0];
tbmax[1] = tileCfg.bmax[2];

// NOSTALRIUS - MMAPS TILE GENERATION
/// 1. Alloc heightfield for walkable areas
tile.solid = rcAllocHeightfield();
Expand Down Expand Up @@ -764,11 +753,8 @@ namespace MMAP
for (int v = 0; v < 3; ++v) // Coordinate
verts[3*c + v] = (5*tVerts[tri[c]*3 + v] + tVerts[tri[(c+1)%3]*3 + v] + tVerts[tri[(c+2)%3]*3 + v]) / 7;
// A triangle is undermap if all corners are undermap
bool undermap1 = m_terrainBuilder->IsUnderMap(&verts[0]);
bool undermap2 = m_terrainBuilder->IsUnderMap(&verts[3]);
bool undermap3 = m_terrainBuilder->IsUnderMap(&verts[6]);

if ((undermap1 + undermap2 + undermap3) == 3)
if (m_terrainBuilder->IsUnderMap(&verts[0]) && m_terrainBuilder->IsUnderMap(&verts[3]) && m_terrainBuilder->IsUnderMap(&verts[6]))
{
areas[i] = 0;
continue;
Expand Down
4 changes: 2 additions & 2 deletions contrib/mmap/src/MapBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace MMAP
const static int VERTEX_PER_TILE = 80; // must divide VERTEX_PER_MAP
const static int TILES_PER_MAP = VERTEX_PER_MAP / VERTEX_PER_TILE;

typedef std::map<uint32, std::set<uint32>*> TileList;
typedef std::map<uint32, std::set<uint32>> TileList;
struct Tile
{
Tile() : chf(NULL), solid(NULL), cset(NULL), pmesh(NULL), dmesh(NULL) {}
Expand Down Expand Up @@ -103,7 +103,7 @@ namespace MMAP
private:
// detect maps and tiles
void discoverTiles();
std::set<uint32>* getTileList(uint32 mapID);
std::set<uint32>& getTileList(uint32 mapID);

void buildNavMesh(uint32 mapID, dtNavMesh*& navMesh);

Expand Down
10 changes: 6 additions & 4 deletions contrib/mmap/src/TerrainBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,7 @@ namespace MMAP
/// Check every map vertice
// x, y * -1
Vector3 up(0, 0, 1);
up.x *= -1.0f;
up.y *= -1.0f;
up = up * rotation.inverse() / scale;

for (vector<GroupModel>::iterator it = groupModels.begin(); it != groupModels.end(); ++it)
for (int t = 0; t < mapVertsCount / 3; ++t)
{
Expand All @@ -767,7 +765,11 @@ namespace MMAP
float outDist = -1.0f;
float inDist = -1.0f;
if (it->IsUnderObject(v, up, isM2, &outDist, &inDist)) // inDist < outDist
terrainInsideModelsVerts[t] = inDist;
{
//if there are less than 1.5y between terrain and model then mark the terrain as unwalkable
if (inDist < 1.5f)
terrainInsideModelsVerts[t] = inDist;
}
}
}
/// Correct triangles partially under models
Expand Down
3 changes: 3 additions & 0 deletions dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,9 @@ dtStatus dtNavMeshQuery::getPortalPoints(dtPolyRef from, const dtPoly* fromPoly,
}
return DT_FAILURE | DT_INVALID_PARAM;
}

if (fromPoly->vertCount == 0)
return DT_FAILURE | DT_INVALID_PARAM;

// Find portal vertices.
const int v0 = fromPoly->verts[link->edge];
Expand Down
30 changes: 30 additions & 0 deletions sql/migrations/20220820140339_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
DROP PROCEDURE IF EXISTS add_migration;
delimiter ??
CREATE PROCEDURE `add_migration`()
BEGIN
DECLARE v INT DEFAULT 1;
SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20220820140339');
IF v=0 THEN
INSERT INTO `migrations` VALUES ('20220820140339');
-- Add your query below.

DELETE FROM `script_texts` WHERE `entry`= -1129005;
DELETE FROM `script_texts` WHERE `entry`= -1129006;
DELETE FROM `script_texts` WHERE `entry`= -1129007;
DELETE FROM `script_texts` WHERE `entry`= -1129008;
DELETE FROM `script_texts` WHERE `entry`= -1129009;
DELETE FROM `script_texts` WHERE `entry`= -1129010;
DELETE FROM `script_texts` WHERE `entry`= -1129011;
DELETE FROM `script_texts` WHERE `entry`= -1129012;

UPDATE `broadcast_text` SET `chat_type`=1 WHERE `entry`=4504;
UPDATE `broadcast_text` SET `chat_type`=1 WHERE `entry`=4505;
UPDATE `broadcast_text` SET `chat_type`=1 WHERE `entry`=4506;
UPDATE `broadcast_text` SET `chat_type`=1 WHERE `entry`=4507;

-- End of migration.
END IF;
END??
delimiter ;
CALL add_migration();
DROP PROCEDURE IF EXISTS add_migration;
Loading

0 comments on commit 43eed45

Please sign in to comment.