diff options
author | Trazom62 <none@none> | 2010-05-05 12:40:52 +0200 |
---|---|---|
committer | Trazom62 <none@none> | 2010-05-05 12:40:52 +0200 |
commit | eee3ebe6d6e55a18f690704bc28db3a58f0efb12 (patch) | |
tree | 655a60eee075bce42c85ecc876472dc9e446a77c | |
parent | 3199e7b8dbae8eb6025a612073fed230566ba9c6 (diff) |
Fix raid groups load from DB and save to DB.
Fixes issue #299.
- In table GROUPS, since rev 7841, isRaid is used to store the groupType. The DB was not updated. this is now fixed.
- Fix isRaid set to 1 when group converted to raid (shall be the groupType).
- Fix isRaidGroup check as groupType is now a set of flags.
- Fix dungeon/raid check when difficulty change.
--HG--
branch : trunk
-rw-r--r-- | sql/characters.sql | 2 | ||||
-rw-r--r-- | sql/updates/8116_characters_groups.sql | 2 | ||||
-rw-r--r-- | src/game/Group.cpp | 8 | ||||
-rw-r--r-- | src/game/Group.h | 2 | ||||
-rw-r--r-- | src/game/MiscHandler.cpp | 6 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 4 |
6 files changed, 13 insertions, 11 deletions
diff --git a/sql/characters.sql b/sql/characters.sql index 4c798262bb2..b0e3e170062 100644 --- a/sql/characters.sql +++ b/sql/characters.sql @@ -1360,7 +1360,7 @@ CREATE TABLE `groups` ( `icon6` int(11) unsigned NOT NULL, `icon7` int(11) unsigned NOT NULL, `icon8` int(11) unsigned NOT NULL, - `isRaid` tinyint(1) unsigned NOT NULL, + `groupType` mediumint(8) unsigned NOT NULL, `difficulty` tinyint(3) unsigned NOT NULL default '0', `raiddifficulty` int(11) UNSIGNED NOT NULL default '0', PRIMARY KEY (`leaderGuid`) diff --git a/sql/updates/8116_characters_groups.sql b/sql/updates/8116_characters_groups.sql new file mode 100644 index 00000000000..a75bb274ffb --- /dev/null +++ b/sql/updates/8116_characters_groups.sql @@ -0,0 +1,2 @@ +ALTER TABLE `groups` CHANGE `isRaid` `groupType` MEDIUMINT(8) UNSIGNED NOT NULL; +UPDATE `groups` SET `groupType`=2 where `groupType`=1; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 3b45c48cb26..9b7ec6ec20d 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -109,7 +109,7 @@ bool Group::Create(const uint64 &guid, const char * name) CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); CharacterDatabase.PExecute("DELETE FROM group_member WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); - CharacterDatabase.PExecute("INSERT INTO groups (leaderGuid,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) " + CharacterDatabase.PExecute("INSERT INTO groups (leaderGuid,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty) " "VALUES ('%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')", GUID_LOPART(m_leaderGuid), uint32(m_lootMethod), GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], uint8(m_groupType), uint32(m_dungeonDifficulty), m_raidDifficulty); @@ -135,8 +135,8 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result if (!result) { external = false; - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 - result = CharacterDatabase.PQuery("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid)); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 + result = CharacterDatabase.PQuery("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid)); if (!result) return false; } @@ -213,7 +213,7 @@ void Group::ConvertToRaid() _initRaidSubGroupsCounter(); if (!isBGGroup()) - CharacterDatabase.PExecute("UPDATE groups SET isRaid = 1 WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid)); + CharacterDatabase.PExecute("UPDATE groups SET groupType='%u' WHERE leaderGuid='%u'", uint8(m_groupType), GUID_LOPART(m_leaderGuid)); SendUpdate(); // update quest related GO states (quest activity dependent from raid membership) diff --git a/src/game/Group.h b/src/game/Group.h index 41e45a4cac6..132b5a20b5c 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -190,7 +190,7 @@ class Group // properties accessories bool IsFull() const { return (m_groupType == GROUPTYPE_NORMAL) ? (m_memberSlots.size() >= MAXGROUPSIZE) : (m_memberSlots.size() >= MAXRAIDSIZE); } - bool isRaidGroup() const { return m_groupType == GROUPTYPE_RAID; } + bool isRaidGroup() const { return m_groupType & GROUPTYPE_RAID; } bool isBGGroup() const { return m_bgGroup != NULL; } bool IsCreated() const { return GetMembersCount() > 0; } const uint64& GetLeaderGUID() const { return m_leaderGuid; } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index cb1d6dca583..6f2820d5d87 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1527,7 +1527,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) return; map = pGroupGuy->GetMap(); - if (map && map->IsRaidOrHeroicDungeon()) + if (map && map->IsNonRaidDungeon()) { sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; @@ -1588,9 +1588,9 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) return; map = pGroupGuy->GetMap(); - if (map && map->IsRaidOrHeroicDungeon()) + if (map && map->IsRaid()) { - sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); + sLog.outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; } } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 6db783eb610..c10674f8bd7 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -3418,8 +3418,8 @@ void ObjectMgr::LoadGroups() Group *group = NULL; uint64 leaderGuid = 0; uint32 count = 0; - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid FROM groups"); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid FROM groups"); if (!result) { |