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
This commit is contained in:
+1
-1
@@ -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`)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `groups` CHANGE `isRaid` `groupType` MEDIUMINT(8) UNSIGNED NOT NULL;
|
||||
UPDATE `groups` SET `groupType`=2 where `groupType`=1;
|
||||
+4
-4
@@ -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)
|
||||
|
||||
+1
-1
@@ -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; }
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user