Merge commit 'origin/master' into 330

This commit is contained in:
tomrus88 2009-10-24 19:33:43 +04:00
commit 2164bbad86
15 changed files with 127 additions and 94 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_8702_01_characters_character_reputation` bit(1) default NULL `required_8721_01_characters_guild` 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';
-- --

View file

@ -0,0 +1,3 @@
ALTER TABLE character_db_version CHANGE COLUMN required_8702_01_characters_character_reputation required_8721_01_characters_guild bit;
UPDATE guild_rank SET BankMoneyPerDay = 4294967295 WHERE rid = 0;

View file

@ -140,6 +140,7 @@ pkgdata_DATA = \
8693_01_mangos_spell_proc_event.sql \ 8693_01_mangos_spell_proc_event.sql \
8702_01_characters_character_reputation.sql \ 8702_01_characters_character_reputation.sql \
8720_01_mangos_quest_template.sql \ 8720_01_mangos_quest_template.sql \
8721_01_characters_guild.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -260,4 +261,5 @@ EXTRA_DIST = \
8693_01_mangos_spell_proc_event.sql \ 8693_01_mangos_spell_proc_event.sql \
8702_01_characters_character_reputation.sql \ 8702_01_characters_character_reputation.sql \
8720_01_mangos_quest_template.sql \ 8720_01_mangos_quest_template.sql \
8721_01_characters_guild.sql \
README README

View file

@ -818,7 +818,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT: case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT:
{ {
uint32 counter =0; uint32 counter =0;
for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++) for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); ++itr)
if(itr->second.m_rewarded) if(itr->second.m_rewarded)
counter++; counter++;
SetCriteriaProgress(achievementCriteria, counter); SetCriteriaProgress(achievementCriteria, counter);
@ -831,7 +831,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
continue; continue;
uint32 counter =0; uint32 counter =0;
for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++) for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); ++itr)
{ {
Quest const* quest = objmgr.GetQuestTemplate(itr->first); Quest const* quest = objmgr.GetQuestTemplate(itr->first);
if(itr->second.m_rewarded && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID) if(itr->second.m_rewarded && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID)

View file

@ -44,7 +44,7 @@ Group::Group()
m_lootThreshold = ITEM_QUALITY_UNCOMMON; m_lootThreshold = ITEM_QUALITY_UNCOMMON;
m_subGroupsCounts = NULL; m_subGroupsCounts = NULL;
for (int i=0; i<TARGETICONCOUNT; ++i) for (int i = 0; i < TARGETICONCOUNT; ++i)
m_targetIcons[i] = 0; m_targetIcons[i] = 0;
} }
@ -53,9 +53,12 @@ Group::~Group()
if(m_bgGroup) if(m_bgGroup)
{ {
sLog.outDebug("Group::~Group: battleground group being deleted."); sLog.outDebug("Group::~Group: battleground group being deleted.");
if(m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL); if(m_bgGroup->GetBgRaid(ALLIANCE) == this)
else if(m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL); m_bgGroup->SetBgRaid(ALLIANCE, NULL);
else sLog.outError("Group::~Group: battleground group is not linked to the correct battleground."); else if(m_bgGroup->GetBgRaid(HORDE) == this)
m_bgGroup->SetBgRaid(HORDE, NULL);
else
sLog.outError("Group::~Group: battleground group is not linked to the correct battleground.");
} }
Rolls::iterator itr; Rolls::iterator itr;
while(!RollId.empty()) while(!RollId.empty())
@ -118,7 +121,8 @@ bool Group::Create(const uint64 &guid, const char * name)
if(!AddMember(guid, name)) if(!AddMember(guid, name))
return false; return false;
if(!isBGGroup()) CharacterDatabase.CommitTransaction(); if(!isBGGroup())
CharacterDatabase.CommitTransaction();
return true; return true;
} }
@ -168,9 +172,10 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool
m_looterGuid = MAKE_NEW_GUID((*result)[3].GetUInt32(), 0, HIGHGUID_PLAYER); m_looterGuid = MAKE_NEW_GUID((*result)[3].GetUInt32(), 0, HIGHGUID_PLAYER);
m_lootThreshold = (ItemQualities)(*result)[4].GetUInt16(); m_lootThreshold = (ItemQualities)(*result)[4].GetUInt16();
for(int i=0; i<TARGETICONCOUNT; ++i) for(int i = 0; i < TARGETICONCOUNT; ++i)
m_targetIcons[i] = (*result)[5+i].GetUInt64(); m_targetIcons[i] = (*result)[5+i].GetUInt64();
if(!external) delete result; if(!external)
delete result;
if(loadMembers) if(loadMembers)
{ {
@ -474,15 +479,16 @@ void Group::Disband(bool hideDestroy)
void Group::SendLootStartRoll(uint32 CountDown, const Roll &r) void Group::SendLootStartRoll(uint32 CountDown, const Roll &r)
{ {
WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4)); WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4+4));
data << uint64(r.itemGUID); // guid of rolled item data << uint64(r.itemGUID); // guid of rolled item
data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it??? data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it???
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
data << uint32(r.itemRandomSuffix); // randomSuffix data << uint32(r.itemRandomSuffix); // randomSuffix
data << uint32(r.itemRandomPropId); // item random property ID data << uint32(r.itemRandomPropId); // item random property ID
data << uint32(r.itemCount); // items in stack
data << uint32(CountDown); // the countdown time to choose "need" or "greed" data << uint32(CountDown); // the countdown time to choose "need" or "greed"
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr) for (Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
{ {
Player *p = objmgr.GetPlayer(itr->first); Player *p = objmgr.GetPlayer(itr->first);
if(!p || !p->GetSession()) if(!p || !p->GetSession())
@ -495,7 +501,7 @@ void Group::SendLootStartRoll(uint32 CountDown, const Roll &r)
void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r) void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
{ {
WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1)); WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1));
data << uint64(SourceGuid); // guid of the item rolled data << uint64(SourceGuid); // guid of the item rolled
data << uint32(0); // unknown, maybe amount of players data << uint32(0); // unknown, maybe amount of players
data << uint64(TargetGuid); data << uint64(TargetGuid);
@ -506,7 +512,7 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin
data << uint8(RollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll data << uint8(RollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll
data << uint8(0); // 2.4.0 data << uint8(0); // 2.4.0
for( Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr) for( Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
{ {
Player *p = objmgr.GetPlayer(itr->first); Player *p = objmgr.GetPlayer(itr->first);
if(!p || !p->GetSession()) if(!p || !p->GetSession())
@ -529,7 +535,7 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid,
data << uint8(RollNumber); // rollnumber realted to SMSG_LOOT_ROLL data << uint8(RollNumber); // rollnumber realted to SMSG_LOOT_ROLL
data << uint8(RollType); // Rolltype related to SMSG_LOOT_ROLL data << uint8(RollType); // Rolltype related to SMSG_LOOT_ROLL
for( Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr) for( Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
{ {
Player *p = objmgr.GetPlayer(itr->first); Player *p = objmgr.GetPlayer(itr->first);
if(!p || !p->GetSession()) if(!p || !p->GetSession())
@ -568,7 +574,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
Player *player = objmgr.GetPlayer(playerGUID); Player *player = objmgr.GetPlayer(playerGUID);
Group *group = player->GetGroup(); Group *group = player->GetGroup();
for (i=loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
{ {
item = objmgr.GetItemPrototype(i->itemid); item = objmgr.GetItemPrototype(i->itemid);
if (!item) if (!item)
@ -580,8 +586,8 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
//roll for over-threshold item if it's one-player loot //roll for over-threshold item if it's one-player loot
if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall) if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
{ {
uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM),0,HIGHGUID_ITEM); uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
Roll* r=new Roll(newitemGUID,*i); Roll* r = new Roll(newitemGUID, *i);
//a vector is filled with only near party members //a vector is filled with only near party members
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
@ -591,7 +597,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
continue; continue;
if ( i->AllowedForPlayer(member) ) if ( i->AllowedForPlayer(member) )
{ {
if (member->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) if (member->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
{ {
r->playerVote[member->GetGUID()] = NOT_EMITED_YET; r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
++r->totalPlayersRolling; ++r->totalPlayersRolling;
@ -611,8 +617,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
RollId.push_back(r); RollId.push_back(r);
} }
else else
i->is_underthreshold=1; i->is_underthreshold = 1;
} }
} }
@ -630,8 +635,8 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
//only roll for one-player items, not for ones everyone can get //only roll for one-player items, not for ones everyone can get
if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall) if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
{ {
uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM),0,HIGHGUID_ITEM); uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
Roll* r=new Roll(newitemGUID,*i); Roll* r = new Roll(newitemGUID, *i);
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{ {
@ -641,7 +646,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
if (playerToRoll->CanUseItem(item) && i->AllowedForPlayer(playerToRoll) ) if (playerToRoll->CanUseItem(item) && i->AllowedForPlayer(playerToRoll) )
{ {
if (playerToRoll->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) if (playerToRoll->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
{ {
r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET; r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
++r->totalPlayersRolling; ++r->totalPlayersRolling;
@ -666,7 +671,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
} }
} }
else else
i->is_underthreshold=1; i->is_underthreshold = 1;
} }
} }
@ -689,19 +694,19 @@ void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creat
if (!looter->IsInWorld()) if (!looter->IsInWorld())
continue; continue;
if (looter->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) if (looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
{ {
data << looter->GetGUID(); data << looter->GetGUID();
++real_count; ++real_count;
} }
} }
data.put<uint8>(0,real_count); data.put<uint8>(0, real_count);
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{ {
Player *looter = itr->getSource(); Player *looter = itr->getSource();
if (looter->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) if (looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
looter->GetSession()->SendPacket(&data); looter->GetSession()->SendPacket(&data);
} }
} }
@ -724,23 +729,23 @@ void Group::CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 N
switch (Choise) switch (Choise)
{ {
case 0: //Player choose pass case ROLL_PASS: // Player choose pass
{ {
SendLootRoll(0, playerGUID, 128, 128, *roll); SendLootRoll(0, playerGUID, 0, ROLL_PASS, *roll);
++roll->totalPass; ++roll->totalPass;
itr->second = PASS; itr->second = PASS;
} }
break; break;
case 1: //player choose Need case ROLL_NEED: // player choose Need
{ {
SendLootRoll(0, playerGUID, 0, 0, *roll); SendLootRoll(0, playerGUID, 0, ROLL_NEED, *roll);
++roll->totalNeed; ++roll->totalNeed;
itr->second = NEED; itr->second = NEED;
} }
break; break;
case 2: //player choose Greed case ROLL_GREED: // player choose Greed
{ {
SendLootRoll(0, playerGUID, 128, 2, *roll); SendLootRoll(0, playerGUID, 128, ROLL_GREED, *roll);
++roll->totalGreed; ++roll->totalGreed;
itr->second = GREED; itr->second = GREED;
} }
@ -782,20 +787,20 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
uint64 maxguid = (*roll->playerVote.begin()).first; uint64 maxguid = (*roll->playerVote.begin()).first;
Player *player; Player *player;
for( Roll::PlayerVote::const_iterator itr=roll->playerVote.begin(); itr!=roll->playerVote.end(); ++itr) for( Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
{ {
if (itr->second != NEED) if (itr->second != NEED)
continue; continue;
uint8 randomN = urand(1, 99); uint8 randomN = urand(1, 99);
SendLootRoll(0, itr->first, randomN, 1, *roll); SendLootRoll(0, itr->first, randomN, ROLL_NEED, *roll);
if (maxresul < randomN) if (maxresul < randomN)
{ {
maxguid = itr->first; maxguid = itr->first;
maxresul = randomN; maxresul = randomN;
} }
} }
SendLootRollWon(0, maxguid, maxresul, 1, *roll); SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll);
player = objmgr.GetPlayer(maxguid); player = objmgr.GetPlayer(maxguid);
if(player && player->GetSession()) if(player && player->GetSession())
@ -829,20 +834,20 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
Player *player; Player *player;
Roll::PlayerVote::iterator itr; Roll::PlayerVote::iterator itr;
for (itr=roll->playerVote.begin(); itr!=roll->playerVote.end(); ++itr) for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
{ {
if (itr->second != GREED) if (itr->second != GREED)
continue; continue;
uint8 randomN = urand(1, 99); uint8 randomN = urand(1, 99);
SendLootRoll(0, itr->first, randomN, 2, *roll); SendLootRoll(0, itr->first, randomN, ROLL_GREED, *roll);
if (maxresul < randomN) if (maxresul < randomN)
{ {
maxguid = itr->first; maxguid = itr->first;
maxresul = randomN; maxresul = randomN;
} }
} }
SendLootRollWon(0, maxguid, maxresul, 2, *roll); SendLootRollWon(0, maxguid, maxresul, ROLL_GREED, *roll);
player = objmgr.GetPlayer(maxguid); player = objmgr.GetPlayer(maxguid);
if(player && player->GetSession()) if(player && player->GetSession())
@ -884,7 +889,7 @@ void Group::SetTargetIcon(uint8 id, uint64 guid)
// clean other icons // clean other icons
if( guid != 0 ) if( guid != 0 )
for(int i=0; i<TARGETICONCOUNT; ++i) for(int i = 0; i < TARGETICONCOUNT; ++i)
if( m_targetIcons[i] == guid ) if( m_targetIcons[i] == guid )
SetTargetIcon(i, 0); SetTargetIcon(i, 0);
@ -928,7 +933,7 @@ void Group::SendTargetIconList(WorldSession *session)
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGETICONCOUNT*9)); WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGETICONCOUNT*9));
data << (uint8)1; data << (uint8)1;
for(int i=0; i<TARGETICONCOUNT; ++i) for(int i = 0; i < TARGETICONCOUNT; ++i)
{ {
if(m_targetIcons[i] == 0) if(m_targetIcons[i] == 0)
continue; continue;
@ -1011,7 +1016,7 @@ void Group::BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int
if(!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) ) if(!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
continue; continue;
if (pl->GetSession() && (group==-1 || itr->getSubGroup()==group)) if (pl->GetSession() && (group == -1 || itr->getSubGroup() == group))
pl->GetSession()->SendPacket(packet); pl->GetSession()->SendPacket(packet);
} }
} }
@ -1049,7 +1054,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant)
if (m_subGroupsCounts) if (m_subGroupsCounts)
{ {
bool groupFound = false; bool groupFound = false;
for (; groupid < MAXRAIDSIZE/MAXGROUPSIZE; ++groupid) for (; groupid < MAXRAIDSIZE / MAXGROUPSIZE; ++groupid)
{ {
if (m_subGroupsCounts[groupid] < MAXGROUPSIZE) if (m_subGroupsCounts[groupid] < MAXGROUPSIZE)
{ {
@ -1104,7 +1109,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u
if(!isRaidGroup()) // reset targetIcons for non-raid-groups if(!isRaidGroup()) // reset targetIcons for non-raid-groups
{ {
for(int i=0; i<TARGETICONCOUNT; ++i) for(int i = 0; i < TARGETICONCOUNT; ++i)
m_targetIcons[i] = 0; m_targetIcons[i] = 0;
} }
@ -1225,28 +1230,33 @@ void Group::_removeRolls(const uint64 &guid)
if(itr2 == roll->playerVote.end()) if(itr2 == roll->playerVote.end())
continue; continue;
if (itr2->second == GREED) --roll->totalGreed; if (itr2->second == GREED)
if (itr2->second == NEED) --roll->totalNeed; --roll->totalGreed;
if (itr2->second == PASS) --roll->totalPass; if (itr2->second == NEED)
if (itr2->second != NOT_VALID) --roll->totalPlayersRolling; --roll->totalNeed;
if (itr2->second == PASS)
--roll->totalPass;
if (itr2->second != NOT_VALID)
--roll->totalPlayersRolling;
roll->playerVote.erase(itr2); roll->playerVote.erase(itr2);
CountRollVote(guid, roll->itemGUID, GetMembersCount()-1, 3); CountRollVote(guid, roll->itemGUID, GetMembersCount()-1, MAX_ROLL_TYPE);
} }
} }
bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group) bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group)
{ {
member_witerator slot = _getMemberWSlot(guid); member_witerator slot = _getMemberWSlot(guid);
if(slot==m_memberSlots.end()) if(slot == m_memberSlots.end())
return false; return false;
slot->group = group; slot->group = group;
SubGroupCounterIncrease(group); SubGroupCounterIncrease(group);
if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid)); if(!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
return true; return true;
} }
@ -1254,45 +1264,51 @@ bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group)
bool Group::_setAssistantFlag(const uint64 &guid, const bool &state) bool Group::_setAssistantFlag(const uint64 &guid, const bool &state)
{ {
member_witerator slot = _getMemberWSlot(guid); member_witerator slot = _getMemberWSlot(guid);
if(slot==m_memberSlots.end()) if(slot == m_memberSlots.end())
return false; return false;
slot->assistant = state; slot->assistant = state;
if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE group_member SET assistant='%u' WHERE memberGuid='%u'", (state==true)?1:0, GUID_LOPART(guid)); if(!isBGGroup())
CharacterDatabase.PExecute("UPDATE group_member SET assistant='%u' WHERE memberGuid='%u'", (state==true)?1:0, GUID_LOPART(guid));
return true; return true;
} }
bool Group::_setMainTank(const uint64 &guid) bool Group::_setMainTank(const uint64 &guid)
{ {
member_citerator slot = _getMemberCSlot(guid); member_citerator slot = _getMemberCSlot(guid);
if(slot==m_memberSlots.end()) if(slot == m_memberSlots.end())
return false; return false;
if(m_mainAssistant == guid) if(m_mainAssistant == guid)
_setMainAssistant(0); _setMainAssistant(0);
m_mainTank = guid; m_mainTank = guid;
if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET mainTank='%u' WHERE leaderGuid='%u'", GUID_LOPART(m_mainTank), GUID_LOPART(m_leaderGuid)); if(!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET mainTank='%u' WHERE leaderGuid='%u'", GUID_LOPART(m_mainTank), GUID_LOPART(m_leaderGuid));
return true; return true;
} }
bool Group::_setMainAssistant(const uint64 &guid) bool Group::_setMainAssistant(const uint64 &guid)
{ {
member_witerator slot = _getMemberWSlot(guid); member_witerator slot = _getMemberWSlot(guid);
if(slot==m_memberSlots.end()) if(slot == m_memberSlots.end())
return false; return false;
if(m_mainTank == guid) if(m_mainTank == guid)
_setMainTank(0); _setMainTank(0);
m_mainAssistant = guid; m_mainAssistant = guid;
if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET mainAssistant='%u' WHERE leaderGuid='%u'", GUID_LOPART(m_mainAssistant), GUID_LOPART(m_leaderGuid)); if(!isBGGroup())
CharacterDatabase.PExecute("UPDATE groups SET mainAssistant='%u' WHERE leaderGuid='%u'", GUID_LOPART(m_mainAssistant), GUID_LOPART(m_leaderGuid));
return true; return true;
} }
bool Group::SameSubGroup(Player const* member1, Player const* member2) const bool Group::SameSubGroup(Player const* member1, Player const* member2) const
{ {
if(!member1 || !member2) return false; if(!member1 || !member2)
if (member1->GetGroup() != this || member2->GetGroup() != this) return false; return false;
else return member1->GetSubGroup() == member2->GetSubGroup(); if (member1->GetGroup() != this || member2->GetGroup() != this)
return false;
else
return member1->GetSubGroup() == member2->GetSubGroup();
} }
// allows setting subgroup for offline members // allows setting subgroup for offline members
@ -1359,7 +1375,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
{ {
// not update if only update if need and ok // not update if only update if need and ok
Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid); Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid);
if(looter && looter->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) if(looter && looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
return; return;
} }
++guid_itr; ++guid_itr;
@ -1372,16 +1388,16 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
{ {
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid)) if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
{ {
if (pl->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
{ {
bool refresh = pl->GetLootGUID()==creature->GetGUID(); bool refresh = pl->GetLootGUID() == creature->GetGUID();
//if(refresh) // update loot for new looter //if(refresh) // update loot for new looter
// pl->GetSession()->DoLootRelease(pl->GetLootGUID()); // pl->GetSession()->DoLootRelease(pl->GetLootGUID());
SetLooterGuid(pl->GetGUID()); SetLooterGuid(pl->GetGUID());
SendUpdate(); SendUpdate();
if(refresh) // update loot for new looter if(refresh) // update loot for new looter
pl->SendLoot(creature->GetGUID(),LOOT_CORPSE); pl->SendLoot(creature->GetGUID(), LOOT_CORPSE);
return; return;
} }
} }
@ -1393,7 +1409,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
{ {
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid)) if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
{ {
if (pl->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false)) if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
{ {
bool refresh = pl->GetLootGUID()==creature->GetGUID(); bool refresh = pl->GetLootGUID()==creature->GetGUID();
@ -1402,7 +1418,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
SetLooterGuid(pl->GetGUID()); SetLooterGuid(pl->GetGUID());
SendUpdate(); SendUpdate();
if(refresh) // update loot for new looter if(refresh) // update loot for new looter
pl->SendLoot(creature->GetGUID(),LOOT_CORPSE); pl->SendLoot(creature->GetGUID(), LOOT_CORPSE);
return; return;
} }
} }
@ -1551,15 +1567,19 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
if(SendMsgTo) if(SendMsgTo)
{ {
if(isEmpty) SendMsgTo->SendResetInstanceSuccess(p->GetMapId()); if(isEmpty)
else SendMsgTo->SendResetInstanceFailed(0, p->GetMapId()); SendMsgTo->SendResetInstanceSuccess(p->GetMapId());
else
SendMsgTo->SendResetInstanceFailed(0, p->GetMapId());
} }
if(isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY) if(isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
{ {
// do not reset the instance, just unbind if others are permanently bound to it // do not reset the instance, just unbind if others are permanently bound to it
if(p->CanReset()) p->DeleteFromDB(); if(p->CanReset())
else CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", p->GetInstanceId()); p->DeleteFromDB();
else
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", p->GetInstanceId());
// i don't know for sure if hash_map iterators // i don't know for sure if hash_map iterators
m_boundInstances[diff].erase(itr); m_boundInstances[diff].erase(itr);
itr = m_boundInstances[diff].begin(); itr = m_boundInstances[diff].begin();
@ -1619,20 +1639,23 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, boo
{ {
// when a boss is killed or when copying the players's binds to the group // when a boss is killed or when copying the players's binds to the group
if(permanent != bind.perm || save != bind.save) if(permanent != bind.perm || save != bind.save)
if(!load) CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GUID_LOPART(GetLeaderGUID()), bind.save->GetInstanceId()); if(!load)
CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GUID_LOPART(GetLeaderGUID()), bind.save->GetInstanceId());
} }
else else if(!load)
if(!load) CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')", GUID_LOPART(GetLeaderGUID()), save->GetInstanceId(), permanent); CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')", GUID_LOPART(GetLeaderGUID()), save->GetInstanceId(), permanent);
if(bind.save != save) if(bind.save != save)
{ {
if(bind.save) bind.save->RemoveGroup(this); if(bind.save)
bind.save->RemoveGroup(this);
save->AddGroup(this); save->AddGroup(this);
} }
bind.save = save; bind.save = save;
bind.perm = permanent; bind.perm = permanent;
if(!load) sLog.outDebug("Group::BindToInstance: %d is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetLeaderGUID()), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty()); if(!load)
sLog.outDebug("Group::BindToInstance: %d is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetLeaderGUID()), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
return &bind; return &bind;
} }
else else
@ -1644,7 +1667,8 @@ void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid); BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
if(itr != m_boundInstances[difficulty].end()) if(itr != m_boundInstances[difficulty].end())
{ {
if(!unload) CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'", GUID_LOPART(GetLeaderGUID()), itr->second.save->GetInstanceId()); if(!unload)
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'", GUID_LOPART(GetLeaderGUID()), itr->second.save->GetInstanceId());
itr->second.save->RemoveGroup(this); // save can become invalid itr->second.save->RemoveGroup(this); // save can become invalid
m_boundInstances[difficulty].erase(itr); m_boundInstances[difficulty].erase(itr);
} }

View file

@ -99,7 +99,7 @@ class Roll : public LootValidatorRef
{ {
public: public:
Roll(uint64 _guid, LootItem const& li) Roll(uint64 _guid, LootItem const& li)
: itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), : itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0) {} totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0) {}
~Roll() { } ~Roll() { }
void setLoot(Loot *pLoot) { link(pLoot, this); } void setLoot(Loot *pLoot) { link(pLoot, this); }
@ -110,6 +110,7 @@ class Roll : public LootValidatorRef
uint32 itemid; uint32 itemid;
int32 itemRandomPropId; int32 itemRandomPropId;
uint32 itemRandomSuffix; uint32 itemRandomSuffix;
uint8 itemCount;
typedef std::map<uint64, RollVote> PlayerVote; typedef std::map<uint64, RollVote> PlayerVote;
PlayerVote playerVote; //vote position correspond with player position (in group) PlayerVote playerVote; //vote position correspond with player position (in group)
uint8 totalPlayersRolling; uint8 totalPlayersRolling;

View file

@ -368,26 +368,26 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
uint64 Guid; uint64 Guid;
uint32 NumberOfPlayers; uint32 NumberOfPlayers;
uint8 Choise; uint8 rollType;
recv_data >> Guid; //guid of the item rolled recv_data >> Guid; //guid of the item rolled
recv_data >> NumberOfPlayers; recv_data >> NumberOfPlayers;
recv_data >> Choise; //0: pass, 1: need, 2: greed recv_data >> rollType;
//sLog.outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, Choise:%u", (uint32)Guid, NumberOfPlayers, Choise); //sLog.outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, rollType:%u", (uint32)Guid, NumberOfPlayers, rollType);
Group* group = GetPlayer()->GetGroup(); Group* group = GetPlayer()->GetGroup();
if(!group) if(!group)
return; return;
// everything's fine, do it // everything's fine, do it
group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, Choise); group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, rollType);
switch (Choise) switch (rollType)
{ {
case 1: case ROLL_NEED:
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1); GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1);
break; break;
case 2: case ROLL_GREED:
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1); GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1);
break; break;
} }

View file

@ -112,6 +112,8 @@ void Guild::CreateDefaultGuildRanks(int locale_idx)
CreateRank(objmgr.GetMangosString(LANG_GUILD_VETERAN, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); CreateRank(objmgr.GetMangosString(LANG_GUILD_VETERAN, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
CreateRank(objmgr.GetMangosString(LANG_GUILD_MEMBER, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); CreateRank(objmgr.GetMangosString(LANG_GUILD_MEMBER, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
CreateRank(objmgr.GetMangosString(LANG_GUILD_INITIATE, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK); CreateRank(objmgr.GetMangosString(LANG_GUILD_INITIATE, locale_idx), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
SetBankMoneyPerDay((uint32)GR_GUILDMASTER, WITHDRAW_MONEY_UNLIMITED);
} }
bool Guild::AddMember(uint64 plGuid, uint32 plRank) bool Guild::AddMember(uint64 plGuid, uint32 plRank)

View file

@ -1121,7 +1121,6 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
// Go on with creating tab // Go on with creating tab
pGuild->CreateNewBankTab(); pGuild->CreateNewBankTab();
GetPlayer()->ModifyMoney(-int(TabCost)); GetPlayer()->ModifyMoney(-int(TabCost));
pGuild->SetBankMoneyPerDay(GetPlayer()->GetRank(), WITHDRAW_MONEY_UNLIMITED);
pGuild->SetBankRightsAndSlots(GetPlayer()->GetRank(), TabId, GUILD_BANK_RIGHT_FULL, WITHDRAW_SLOT_UNLIMITED, true); pGuild->SetBankRightsAndSlots(GetPlayer()->GetRank(), TabId, GUILD_BANK_RIGHT_FULL, WITHDRAW_SLOT_UNLIMITED, true);
pGuild->Roster(); // broadcast for tab rights update pGuild->Roster(); // broadcast for tab rights update
pGuild->DisplayGuildBankTabsInfo(this); pGuild->DisplayGuildBankTabsInfo(this);

View file

@ -30,7 +30,8 @@ enum RollType
{ {
ROLL_PASS = 0, ROLL_PASS = 0,
ROLL_NEED = 1, ROLL_NEED = 1,
ROLL_GREED = 2 ROLL_GREED = 2,
MAX_ROLL_TYPE = 3
}; };
#define MAX_NR_LOOT_ITEMS 16 #define MAX_NR_LOOT_ITEMS 16

View file

@ -6205,7 +6205,7 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real)
((m_removeMode == AURA_REMOVE_BY_DEFAULT && !m_modifier.m_amount) || m_removeMode == AURA_REMOVE_BY_DISPEL)) ((m_removeMode == AURA_REMOVE_BY_DEFAULT && !m_modifier.m_amount) || m_removeMode == AURA_REMOVE_BY_DISPEL))
{ {
Unit::AuraList const& vDummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); Unit::AuraList const& vDummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); itr++) for(Unit::AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr)
{ {
SpellEntry const* vSpell = (*itr)->GetSpellProto(); SpellEntry const* vSpell = (*itr)->GetSpellProto();

View file

@ -9603,7 +9603,8 @@ void Unit::ClearInCombat()
// Player's state will be cleared in Player::UpdateContestedPvP // Player's state will be cleared in Player::UpdateContestedPvP
if (GetTypeId() != TYPEID_PLAYER) if (GetTypeId() != TYPEID_PLAYER)
{ {
if (((Creature*)this)->GetCreatureInfo()->unit_flags & UNIT_FLAG_OOC_NOT_ATTACKABLE) Creature* creature = (Creature*)this;
if (creature->GetCreatureInfo() && creature->GetCreatureInfo()->unit_flags & UNIT_FLAG_OOC_NOT_ATTACKABLE)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
clearUnitState(UNIT_STAT_ATTACK_PLAYER); clearUnitState(UNIT_STAT_ATTACK_PLAYER);

View file

@ -895,7 +895,7 @@ void WorldSession::SendAddonsInfo()
if (unk1) if (unk1)
{ {
uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC
data << uint8(unk2); data << uint8(unk2); // if 1, than add addon public signature
if (unk2) // if CRC is wrong, add public key (client need it) if (unk2) // if CRC is wrong, add public key (client need it)
data.append(tdata, sizeof(tdata)); data.append(tdata, sizeof(tdata));
@ -903,7 +903,7 @@ void WorldSession::SendAddonsInfo()
} }
uint8 unk3 = 0; // 0 is sent here uint8 unk3 = 0; // 0 is sent here
data << uint8(unk3); data << uint8(unk3); // use <Addon>\<Addon>.url file or not
if (unk3) if (unk3)
{ {
// String, 256 (null terminated?) // String, 256 (null terminated?)
@ -914,7 +914,7 @@ void WorldSession::SendAddonsInfo()
m_addonsList.clear(); m_addonsList.clear();
uint32 count = 0; uint32 count = 0;
data << uint32(count); data << uint32(count); // BannedAddons count
/*for(uint32 i = 0; i < count; ++i) /*for(uint32 i = 0; i < count; ++i)
{ {
uint32 uint32

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 "8720" #define REVISION_NR "8722"
#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_8702_01_characters_character_reputation" #define REVISION_DB_CHARACTERS "required_8721_01_characters_guild"
#define REVISION_DB_MANGOS "required_8720_01_mangos_quest_template" #define REVISION_DB_MANGOS "required_8720_01_mangos_quest_template"
#define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters" #define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__