mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[11807] Add gameobject_addon table
table holds additional per-guid gameobject data. currently it contains path rotation info that required for some elevators and transports
This commit is contained in:
parent
7a67f27ab3
commit
3567e69a3d
11 changed files with 93 additions and 16 deletions
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
|||
`version` varchar(120) default NULL,
|
||||
`creature_ai_version` varchar(120) default NULL,
|
||||
`cache_id` int(10) default '0',
|
||||
`required_11785_01_mangos_instance_encounters` bit(1) default NULL
|
||||
`required_11807_01_mangos_gameobject_addon` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
@ -1878,6 +1878,29 @@ LOCK TABLES `gameobject` WRITE;
|
|||
/*!40000 ALTER TABLE `gameobject` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `gameobject_addon`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `gameobject_addon`;
|
||||
CREATE TABLE `gameobject_addon` (
|
||||
`guid` int(10) unsigned NOT NULL default '0',
|
||||
`path_rotation0` float NOT NULL default '0',
|
||||
`path_rotation1` float NOT NULL default '0',
|
||||
`path_rotation2` float NOT NULL default '0',
|
||||
`path_rotation3` float NOT NULL default '1',
|
||||
PRIMARY KEY (`guid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Gameobject System';
|
||||
|
||||
--
|
||||
-- Dumping data for table `gameobject_addon`
|
||||
--
|
||||
|
||||
LOCK TABLES `gameobject_addon` WRITE;
|
||||
/*!40000 ALTER TABLE `gameobject_addon` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `gameobject_addon` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `gameobject_battleground`
|
||||
--
|
||||
|
|
|
|||
11
sql/updates/11807_01_mangos_gameobject_addon.sql
Normal file
11
sql/updates/11807_01_mangos_gameobject_addon.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_11785_01_mangos_instance_encounters required_11807_01_mangos_gameobject_addon bit;
|
||||
|
||||
DROP TABLE IF EXISTS `gameobject_addon`;
|
||||
CREATE TABLE `gameobject_addon` (
|
||||
`guid` int(10) unsigned NOT NULL default '0',
|
||||
`path_rotation0` float NOT NULL default '0',
|
||||
`path_rotation1` float NOT NULL default '0',
|
||||
`path_rotation2` float NOT NULL default '0',
|
||||
`path_rotation3` float NOT NULL default '1',
|
||||
PRIMARY KEY (`guid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Gameobject System';
|
||||
|
|
@ -130,9 +130,11 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
|
|||
SetObjectScale(goinfo->size);
|
||||
|
||||
SetWorldRotation(rotation.x,rotation.y,rotation.z,rotation.w);
|
||||
// For most of gameobjects is (0, 0, 0, 1) quaternion, only transports has not standart rotation
|
||||
// TODO: store these values in DB
|
||||
SetTransportPathRotation(0, 0, 0, 1.f);
|
||||
// For most of gameobjects is (0, 0, 0, 1) quaternion, only some transports has not standart rotation
|
||||
if (const GameObjectDataAddon * addon = sGameObjectDataAddonStorage.LookupEntry<GameObjectDataAddon>(guidlow))
|
||||
SetTransportPathRotation(addon->path_rotation);
|
||||
else
|
||||
SetTransportPathRotation(QuaternionData(0,0,0,1));
|
||||
|
||||
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
|
||||
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
|
||||
|
|
@ -1682,12 +1684,12 @@ void GameObject::SetWorldRotation(float qx, float qy, float qz, float qw)
|
|||
m_worldRotation.w = rotation.w;
|
||||
}
|
||||
|
||||
void GameObject::SetTransportPathRotation(float qx, float qy, float qz, float qw)
|
||||
void GameObject::SetTransportPathRotation(QuaternionData rotation)
|
||||
{
|
||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+0, qx);
|
||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+1, qy);
|
||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+2, qz);
|
||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+3, qw);
|
||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+0, rotation.x);
|
||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+1, rotation.y);
|
||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation.z);
|
||||
SetFloatValue(GAMEOBJECT_PARENTROTATION+3, rotation.w);
|
||||
}
|
||||
|
||||
void GameObject::SetWorldRotationAngles(float z_rot, float y_rot, float x_rot)
|
||||
|
|
|
|||
|
|
@ -576,6 +576,13 @@ struct GameObjectData
|
|||
uint8 spawnMask;
|
||||
};
|
||||
|
||||
// from `gameobject_addon`
|
||||
struct GameObjectDataAddon
|
||||
{
|
||||
uint32 guid;
|
||||
QuaternionData path_rotation;
|
||||
};
|
||||
|
||||
// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
|
||||
// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
|
||||
// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
|
||||
|
|
@ -617,7 +624,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
// z_rot, y_rot, x_rot - rotation angles around z, y and x axes
|
||||
void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot);
|
||||
void SetWorldRotation(float qx, float qy, float qz, float qw);
|
||||
void SetTransportPathRotation(float qx, float qy, float qz, float qw); // transforms(rotates) transport's path
|
||||
void SetTransportPathRotation(QuaternionData rotation); // transforms(rotates) transport's path
|
||||
int64 GetPackedWorldRotation() const { return m_packedRotation; }
|
||||
|
||||
// overwrite WorldObject function for proper name localization
|
||||
|
|
|
|||
|
|
@ -1398,7 +1398,7 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
|
|||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameobjects()
|
||||
void ObjectMgr::LoadGameObjects()
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
|
|
@ -1561,6 +1561,33 @@ void ObjectMgr::LoadGameobjects()
|
|||
sLog.outString( ">> Loaded %lu gameobjects", (unsigned long)mGameObjectDataMap.size());
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameObjectAddon()
|
||||
{
|
||||
sGameObjectDataAddonStorage.Load();
|
||||
|
||||
sLog.outString(">> Loaded %u gameobject addons", sGameObjectDataAddonStorage.RecordCount);
|
||||
sLog.outString();
|
||||
|
||||
for(uint32 i = 1; i < sGameObjectDataAddonStorage.MaxEntry; ++i)
|
||||
{
|
||||
GameObjectDataAddon const* addon = sGameObjectDataAddonStorage.LookupEntry<GameObjectDataAddon>(i);
|
||||
if (!addon)
|
||||
continue;
|
||||
|
||||
if (!GetGODataPair(addon->guid))
|
||||
{
|
||||
sLog.outErrorDb("Gameobject (GUID: %u) does not exist but has a record in `gameobject_addon`",addon->guid);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!addon->path_rotation.isUnit())
|
||||
{
|
||||
sLog.outErrorDb("Gameobject (GUID: %u) has invalid path rotation", addon->guid);
|
||||
const_cast<GameObjectDataAddon*>(addon)->path_rotation = QuaternionData(0.f, 0.f, 0.f, 1.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
|
||||
{
|
||||
uint8 mask = data->spawnMask;
|
||||
|
|
|
|||
|
|
@ -654,7 +654,8 @@ class ObjectMgr
|
|||
void LoadCreatureModelRace();
|
||||
void LoadEquipmentTemplates();
|
||||
void LoadGameObjectLocales();
|
||||
void LoadGameobjects();
|
||||
void LoadGameObjects();
|
||||
void LoadGameObjectAddon();
|
||||
void LoadItemPrototypes();
|
||||
void LoadItemConverts();
|
||||
void LoadItemExpireConverts();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ const char CreatureInfodstfmt[]="iiiiiiiiiisssiiiiiiiiiiifffiffiifiiiiiiiiiiffii
|
|||
const char CreatureDataAddonInfofmt[]="iiibbiis";
|
||||
const char CreatureModelfmt[]="iffbii";
|
||||
const char CreatureInfoAddonInfofmt[]="iiibbiis";
|
||||
const char GameObjectInfoAddonInfofmt[]="iffff";
|
||||
const char EquipmentInfofmt[]="iiii";
|
||||
const char GameObjectInfosrcfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis";
|
||||
const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii";
|
||||
|
|
@ -41,6 +42,7 @@ SQLStorage sCreatureStorage(CreatureInfosrcfmt, CreatureInfodstfmt, "entry","cre
|
|||
SQLStorage sCreatureDataAddonStorage(CreatureDataAddonInfofmt,"guid","creature_addon");
|
||||
SQLStorage sCreatureModelStorage(CreatureModelfmt,"modelid","creature_model_info");
|
||||
SQLStorage sCreatureInfoAddonStorage(CreatureInfoAddonInfofmt,"entry","creature_template_addon");
|
||||
SQLStorage sGameObjectDataAddonStorage(GameObjectInfoAddonInfofmt,"guid","gameobject_addon");
|
||||
SQLStorage sEquipmentStorage(EquipmentInfofmt,"entry","creature_equip_template");
|
||||
SQLStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry","gameobject_template");
|
||||
SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "entry","item_template");
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ extern SQLStorage sCreatureStorage;
|
|||
extern SQLStorage sCreatureDataAddonStorage;
|
||||
extern SQLStorage sCreatureInfoAddonStorage;
|
||||
extern SQLStorage sCreatureModelStorage;
|
||||
extern SQLStorage sGameObjectDataAddonStorage;
|
||||
extern SQLStorage sEquipmentStorage;
|
||||
extern SQLStorage sGOStorage;
|
||||
extern SQLStorage sPageTextStore;
|
||||
|
|
|
|||
|
|
@ -1062,7 +1062,10 @@ void World::SetInitialWorldSettings()
|
|||
sLog.outString();
|
||||
|
||||
sLog.outString( "Loading Gameobject Data..." );
|
||||
sObjectMgr.LoadGameobjects();
|
||||
sObjectMgr.LoadGameObjects();
|
||||
|
||||
sLog.outString( "Loading Gameobject Addon Data..." );
|
||||
sObjectMgr.LoadGameObjectAddon();
|
||||
|
||||
sLog.outString( "Loading Objects Pooling Data...");
|
||||
sPoolMgr.LoadFromDB();
|
||||
|
|
@ -1094,7 +1097,7 @@ void World::SetInitialWorldSettings()
|
|||
sLog.outString( "Loading Creature Respawn Data..." ); // must be after LoadCreatures(), and sMapPersistentStateMgr.InitWorldMaps()
|
||||
sMapPersistentStateMgr.LoadCreatureRespawnTimes();
|
||||
|
||||
sLog.outString( "Loading Gameobject Respawn Data..." ); // must be after LoadGameobjects(), and sMapPersistentStateMgr.InitWorldMaps()
|
||||
sLog.outString( "Loading Gameobject Respawn Data..." ); // must be after LoadGameObjects(), and sMapPersistentStateMgr.InitWorldMaps()
|
||||
sMapPersistentStateMgr.LoadGameobjectRespawnTimes();
|
||||
|
||||
sLog.outString( "Loading UNIT_NPC_FLAG_SPELLCLICK Data..." );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11806"
|
||||
#define REVISION_NR "11807"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_11785_02_characters_instance"
|
||||
#define REVISION_DB_MANGOS "required_11785_01_mangos_instance_encounters"
|
||||
#define REVISION_DB_MANGOS "required_11807_01_mangos_gameobject_addon"
|
||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue