aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Database/Implementation
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-02-25 00:13:14 +0100
committerShauren <shauren.trinity@gmail.com>2015-04-28 21:19:46 +0200
commitca83e14f8b141fab0a13e08f48fca6c1ace0c4c7 (patch)
tree68487de0cd291b6aba9131a4eade228433f05d99 /src/server/shared/Database/Implementation
parent455ef1a64af14ee249e270b451f67f552ba3605a (diff)
Core/Entities: Reworked guid scopes
* Added ObjectGuid traits to easily access whether guid type can be generated globally (ObjectMgr) or not * This adds separate (per map) guid sequences depending on object type * Ported map object container from cmangos/mangos-wotlk@a2d396eb0bb195efc460944dd4e0fab2a858b300 * Added type container visitor for TypeUnorderedMapContainer * Implemented helper function to erase unique pairs from multimap containers * Moved object storage of all objects except players and transports to map level * Added containers linking database spawn id with creature/gameobject in world * Renamed DBTableGuid to spawnId * Added a separate spawn id sequence generator for creatures and gameobjects - this will be used in db tables * Moved building SMSG_UPDATE_OBJECT - updatefields changes broadcast to map update
Diffstat (limited to 'src/server/shared/Database/Implementation')
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp17
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.h7
2 files changed, 9 insertions, 15 deletions
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index c7a63911a4c..6c18a0e76ee 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -338,16 +338,13 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_DEL_PLAYER_HOMEBIND, "DELETE FROM character_homebind WHERE guid = ?", CONNECTION_ASYNC);
// Corpse
- PrepareStatement(CHAR_SEL_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, corpseGuid, guid FROM corpse WHERE corpseType <> 0", CONNECTION_SYNCH);
- PrepareStatement(CHAR_INS_CORPSE, "INSERT INTO corpse (corpseGuid, guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE corpseGuid = ?", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_PLAYER_CORPSES, "DELETE FROM corpse WHERE guid = ? AND corpseType <> 0", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_OLD_CORPSES, "DELETE FROM corpse WHERE corpseType = 0 OR time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC);
- PrepareStatement(CHAR_SEL_CORPSE_PHASES, "SELECT Guid, PhaseId FROM corpse_phases", CONNECTION_SYNCH);
- PrepareStatement(CHAR_DEL_CORPSE_PHASES, "DELETE FROM corpse_phases WHERE Guid = ?", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_PLAYER_CORPSES_PHASES, "DELETE FROM corpse_phases WHERE OwnerGuid = ? AND CorpseType <> 0", CONNECTION_ASYNC);
- PrepareStatement(CHAR_DEL_OLD_CORPSE_PHASES, "DELETE FROM corpse_phases WHERE CorpseType = 0 OR Time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC);
- PrepareStatement(CHAR_INS_CORPSE_PHASES, "INSERT INTO corpse_phases (Guid, PhaseId, OwnerGuid, Time, CorpseType) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_SEL_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, guid FROM corpse WHERE mapId = ?", CONNECTION_SYNCH);
+ PrepareStatement(CHAR_INS_CORPSE, "INSERT INTO corpse (guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE guid = ?", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_DEL_CORPSES_FROM_MAP, "DELETE cp, c FROM corpse_phases cp INNER JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ?", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_SEL_CORPSE_PHASES, "SELECT cp.OwnerGuid, cp.PhaseId FROM corpse_phases cp LEFT JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ?", CONNECTION_SYNCH);
+ PrepareStatement(CHAR_INS_CORPSE_PHASES, "INSERT INTO corpse_phases (OwnerGuid, PhaseId) VALUES (?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(CHAR_DEL_CORPSE_PHASES, "DELETE FROM corpse_phases WHERE OwnerGuid = ?", CONNECTION_ASYNC);
// Creature respawn
PrepareStatement(CHAR_SEL_CREATURE_RESPAWNS, "SELECT guid, respawnTime FROM creature_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH);
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index b6897204b6a..ed3b6dd8098 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -294,13 +294,10 @@ enum CharacterDatabaseStatements
CHAR_SEL_CORPSES,
CHAR_INS_CORPSE,
CHAR_DEL_CORPSE,
- CHAR_DEL_PLAYER_CORPSES,
- CHAR_DEL_OLD_CORPSES,
+ CHAR_DEL_CORPSES_FROM_MAP,
CHAR_SEL_CORPSE_PHASES,
- CHAR_DEL_CORPSE_PHASES,
- CHAR_DEL_PLAYER_CORPSES_PHASES,
- CHAR_DEL_OLD_CORPSE_PHASES,
CHAR_INS_CORPSE_PHASES,
+ CHAR_DEL_CORPSE_PHASES,
CHAR_SEL_CREATURE_RESPAWNS,
CHAR_REP_CREATURE_RESPAWN,