[9974] Restore raid functionality broken after one from 3.3.x switches.

* Fixed typo in raid converting code that triggering raid disband at server restart.
* Fixed current subgroup show for character and update group memebers data at move its
  in diff subgroups.
This commit is contained in:
VladimirMangos 2010-05-26 00:01:58 +04:00
parent dc82105963
commit 94888e52cd
8 changed files with 44 additions and 16 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`; DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` ( CREATE TABLE `character_db_version` (
`required_9849_01_characters_saved_variables` bit(1) default NULL `required_9974_01_characters_group` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
-- --
@ -1033,7 +1033,7 @@ CREATE TABLE `groups` (
`icon6` int(11) unsigned NOT NULL, `icon6` int(11) unsigned NOT NULL,
`icon7` int(11) unsigned NOT NULL, `icon7` int(11) unsigned NOT NULL,
`icon8` int(11) unsigned NOT NULL, `icon8` int(11) unsigned NOT NULL,
`isRaid` tinyint(1) unsigned NOT NULL, `groupType` tinyint(1) unsigned NOT NULL,
`difficulty` tinyint(3) unsigned NOT NULL default '0', `difficulty` tinyint(3) unsigned NOT NULL default '0',
`raiddifficulty` int(11) UNSIGNED NOT NULL default '0', `raiddifficulty` int(11) UNSIGNED NOT NULL default '0',
PRIMARY KEY (`groupId`), PRIMARY KEY (`groupId`),

View file

@ -0,0 +1,8 @@
ALTER TABLE character_db_version CHANGE COLUMN required_9849_01_characters_saved_variables required_9974_01_characters_group bit;
ALTER TABLE groups
CHANGE COLUMN isRaid groupType tinyint(1) unsigned NOT NULL;
/* now fixed bug in past can save raids as 1 (BG group) */
UPDATE groups
SET groupType = 2 WHERE groupType = 1;

View file

@ -70,6 +70,7 @@ pkgdata_DATA = \
9957_01_mangos_mangos_string.sql \ 9957_01_mangos_mangos_string.sql \
9957_02_mangos_npc_vendor.sql \ 9957_02_mangos_npc_vendor.sql \
9967_01_mangos_spell_proc_event.sql \ 9967_01_mangos_spell_proc_event.sql \
9974_01_characters_group.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -120,4 +121,5 @@ EXTRA_DIST = \
9957_01_mangos_mangos_string.sql \ 9957_01_mangos_mangos_string.sql \
9957_02_mangos_npc_vendor.sql \ 9957_02_mangos_npc_vendor.sql \
9967_01_mangos_spell_proc_event.sql \ 9967_01_mangos_spell_proc_event.sql \
9974_01_characters_group.sql \
README README

View file

@ -111,10 +111,10 @@ bool Group::Create(const uint64 &guid, const char * name)
CharacterDatabase.BeginTransaction(); CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId ='%u'", m_Id); CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId ='%u'", m_Id);
CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id); CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id);
CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) " CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty) "
"VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')", "VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')",
m_Id, GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod), m_Id, GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), 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); 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), uint32(m_raidDifficulty));
} }
if(!AddMember(guid, name)) if(!AddMember(guid, name))
@ -129,7 +129,7 @@ bool Group::Create(const uint64 &guid, const char * name)
bool Group::LoadGroupFromDB(Field* fields) bool Group::LoadGroupFromDB(Field* fields)
{ {
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid, groupId FROM groups"); // result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
m_Id = fields[17].GetUInt32(); m_Id = fields[17].GetUInt32();
m_leaderGuid = MAKE_NEW_GUID(fields[16].GetUInt32(),0,HIGHGUID_PLAYER); m_leaderGuid = MAKE_NEW_GUID(fields[16].GetUInt32(),0,HIGHGUID_PLAYER);
@ -190,7 +190,7 @@ void Group::ConvertToRaid()
_initRaidSubGroupsCounter(); _initRaidSubGroupsCounter();
if(!isBGGroup()) if(!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET isRaid = 1 WHERE groupId='%u'", m_Id); CharacterDatabase.PExecute("UPDATE groups SET groupType = %u WHERE groupId='%u'", uint8(m_groupType), m_Id);
SendUpdate(); SendUpdate();
// update quest related GO states (quest activity dependent from raid membership) // update quest related GO states (quest activity dependent from raid membership)
@ -970,9 +970,9 @@ void Group::SendUpdate()
// guess size // guess size
WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+8+4+GetMembersCount()*20)); WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+8+4+GetMembersCount()*20));
data << uint8(m_groupType); // group type (flags in 3.3) data << uint8(m_groupType); // group type (flags in 3.3)
data << uint8(isBGGroup() ? 1 : 0); // 2.0.x, isBattleGroundGroup?
data << uint8(citr->group); // groupid data << uint8(citr->group); // groupid
data << uint8(citr->assistant ? 0x01 : 0x00); // 0x2 main assist, 0x4 main tank data << uint8(isBGGroup() ? 1 : 0); // 2.0.x, isBattleGroundGroup?
data << uint8(GetFlags(*citr)); // group flags
if(m_groupType & GROUPTYPE_LFD) if(m_groupType & GROUPTYPE_LFD)
{ {
data << uint8(0); data << uint8(0);
@ -991,10 +991,9 @@ void Group::SendUpdate()
data << citr2->name; data << citr2->name;
data << uint64(citr2->guid); data << uint64(citr2->guid);
// online-state data << uint8(onlineState); // online-state
data << uint8(onlineState);
data << uint8(citr2->group); // groupid data << uint8(citr2->group); // groupid
data << uint8(citr2->assistant?0x01:0); // 0x2 main assist, 0x4 main tank data << uint8(GetFlags(*citr2)); // group flags
data << uint8(0); // 3.3, role? data << uint8(0); // 3.3, role?
} }

View file

@ -82,6 +82,13 @@ enum GroupType // group type flags?
// 0x10, leave/change group?, I saw this flag when leaving group and after leaving BG while in group // 0x10, leave/change group?, I saw this flag when leaving group and after leaving BG while in group
}; };
enum GroupFlagMask
{
GROUP_ASSISTENT = 0x01,
GROUP_MAIN_ASSISTENT = 0x02,
GROUP_MAIN_TANK = 0x04,
};
class BattleGround; class BattleGround;
enum GroupUpdateFlags enum GroupUpdateFlags
@ -410,6 +417,18 @@ class MANGOS_DLL_SPEC Group
void CountTheRoll(Rolls::iterator& roll); // iterator update to next, in CountRollVote if true void CountTheRoll(Rolls::iterator& roll); // iterator update to next, in CountRollVote if true
bool CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& roll, RollVote choise); bool CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& roll, RollVote choise);
GroupFlagMask GetFlags(MemberSlot const& slot) const
{
uint8 flags = 0;
if (slot.assistant)
flags |= GROUP_ASSISTENT;
if (slot.guid == m_mainAssistant)
flags |= GROUP_MAIN_ASSISTENT;
if (slot.guid == m_mainTank)
flags |= GROUP_MAIN_TANK;
return GroupFlagMask(flags);
}
uint32 m_Id; // 0 for not created or BG groups uint32 m_Id; // 0 for not created or BG groups
MemberSlotList m_memberSlots; MemberSlotList m_memberSlots;
GroupRefManager m_memberMgr; GroupRefManager m_memberMgr;

View file

@ -3160,7 +3160,7 @@ void ObjectMgr::LoadGroups()
// -- loading groups -- // -- loading groups --
uint32 count = 0; uint32 count = 0;
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid, groupId FROM groups"); QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
if (!result) if (!result)
{ {

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9973" #define REVISION_NR "9974"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables" #define REVISION_DB_CHARACTERS "required_9974_01_characters_group"
#define REVISION_DB_MANGOS "required_9967_01_mangos_spell_proc_event" #define REVISION_DB_MANGOS "required_9967_01_mangos_spell_proc_event"
#define REVISION_DB_REALMD "required_9748_01_realmd_realmlist" #define REVISION_DB_REALMD "required_9748_01_realmd_realmlist"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__