Skip to content

Commit

Permalink
[s2472] Creature/Gameobject: Upgrade precision of GO and creature pos…
Browse files Browse the repository at this point in the history
…itions

Loss during dumping
  • Loading branch information
killerwife committed Dec 31, 2023
1 parent a07ba36 commit 4232dfc
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
26 changes: 13 additions & 13 deletions sql/base/mangos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` (
`version` varchar(120) DEFAULT NULL,
`creature_ai_version` varchar(120) DEFAULT NULL,
`required_s2471_01_mangos_pursuit` bit(1) DEFAULT NULL
`required_s2472_01_mangos_precision_decimal` bit(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Used DB version notes';

--
Expand Down Expand Up @@ -761,10 +761,10 @@ CREATE TABLE `creature` (
`id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Creature Identifier',
`map` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Map Identifier',
`spawnMask` tinyint(3) unsigned NOT NULL DEFAULT '1',
`position_x` float NOT NULL DEFAULT '0',
`position_y` float NOT NULL DEFAULT '0',
`position_z` float NOT NULL DEFAULT '0',
`orientation` float NOT NULL DEFAULT '0',
`position_x` DECIMAL(40,20) NOT NULL DEFAULT '0',
`position_y` DECIMAL(40,20) NOT NULL DEFAULT '0',
`position_z` DECIMAL(40,20) NOT NULL DEFAULT '0',
`orientation` DECIMAL(40,20) NOT NULL DEFAULT '0',
`spawntimesecsmin` int(10) unsigned NOT NULL DEFAULT '120' COMMENT 'Creature respawn time minimum',
`spawntimesecsmax` int(10) unsigned NOT NULL DEFAULT '120' COMMENT 'Creature respawn time maximum',
`spawndist` float NOT NULL DEFAULT '5',
Expand Down Expand Up @@ -2020,14 +2020,14 @@ CREATE TABLE `gameobject` (
`id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Gameobject Identifier',
`map` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Map Identifier',
`spawnMask` tinyint(3) unsigned NOT NULL DEFAULT '1',
`position_x` float NOT NULL DEFAULT '0',
`position_y` float NOT NULL DEFAULT '0',
`position_z` float NOT NULL DEFAULT '0',
`orientation` float NOT NULL DEFAULT '0',
`rotation0` float NOT NULL DEFAULT '0',
`rotation1` float NOT NULL DEFAULT '0',
`rotation2` float NOT NULL DEFAULT '0',
`rotation3` float NOT NULL DEFAULT '0',
`position_x` DECIMAL(40,20) NOT NULL DEFAULT '0',
`position_y` DECIMAL(40,20) NOT NULL DEFAULT '0',
`position_z` DECIMAL(40,20) NOT NULL DEFAULT '0',
`orientation` DECIMAL(40,20) NOT NULL DEFAULT '0',
`rotation0` DECIMAL(40,20) NOT NULL DEFAULT '0',
`rotation1` DECIMAL(40,20) NOT NULL DEFAULT '0',
`rotation2` DECIMAL(40,20) NOT NULL DEFAULT '0',
`rotation3` DECIMAL(40,20) NOT NULL DEFAULT '0',
`spawntimesecsmin` int(11) NOT NULL DEFAULT '0' COMMENT 'GameObject respawn time minimum',
`spawntimesecsmax` int(11) NOT NULL DEFAULT '0' COMMENT 'Gameobject respawn time maximum',
PRIMARY KEY (`guid`),
Expand Down
15 changes: 15 additions & 0 deletions sql/updates/mangos/s2472_01_mangos_precision_decimal.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ALTER TABLE db_version CHANGE COLUMN required_s2471_01_mangos_pursuit required_s2472_01_mangos_precision_decimal bit;

ALTER TABLE gameobject CHANGE position_x position_x DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE gameobject CHANGE position_y position_y DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE gameobject CHANGE position_z position_z DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE gameobject CHANGE orientation orientation DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE gameobject CHANGE rotation0 rotation0 DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE gameobject CHANGE rotation1 rotation1 DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE gameobject CHANGE rotation2 rotation2 DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE gameobject CHANGE rotation3 rotation3 DECIMAL(40,20) NOT NULL DEFAULT 0;

ALTER TABLE creature CHANGE position_x position_x DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE creature CHANGE position_y position_y DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE creature CHANGE position_z position_z DECIMAL(40,20) NOT NULL DEFAULT 0;
ALTER TABLE creature CHANGE orientation orientation DECIMAL(40,20) NOT NULL DEFAULT 0;
8 changes: 4 additions & 4 deletions src/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2222,10 +2222,10 @@ void ObjectMgr::LoadGameObjects()
{
uint32 count = 0;

// 0 1 2 3 4 5 6
auto queryResult = WorldDatabase.Query("SELECT gameobject.guid, gameobject.id, map, round(position_x, 20), round(position_y, 20), round(position_z, 20), round(orientation, 20),"
// 7 8 9 10 11 12 13 14
"round(rotation0, 20), round(rotation1, 20), round(rotation2, 20), round(rotation3, 20), spawntimesecsmin, spawntimesecsmax, spawnMask, event,"
// 0 1 2 3 4 5 6
auto queryResult = WorldDatabase.Query("SELECT gameobject.guid, gameobject.id, map, position_x, position_y, position_z, orientation,"
// 7 8 9 10 11 12 13 14
"rotation0, rotation1, rotation2, rotation3, spawntimesecsmin, spawntimesecsmax, spawnMask, event,"
// 15 16
"pool_gameobject.pool_entry, pool_gameobject_template.pool_entry "
"FROM gameobject "
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#define REVISION_DB_REALMD "required_s2455_01_realmd_platform"
#define REVISION_DB_LOGS "required_s2433_01_logs_anticheat"
#define REVISION_DB_CHARACTERS "required_s2452_01_characters_fishingSteps"
#define REVISION_DB_MANGOS "required_s2471_01_mangos_pursuit"
#define REVISION_DB_MANGOS "required_s2472_01_mangos_precision_decimal"
#endif // __REVISION_SQL_H__

0 comments on commit 4232dfc

Please sign in to comment.