mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
Merge remote branch 'origin/master' into 330
This commit is contained in:
commit
654a93d7cd
8 changed files with 147 additions and 135 deletions
|
|
@ -448,8 +448,8 @@ void Group::Disband(bool hideDestroy)
|
|||
void Group::SendLootStartRoll(uint32 CountDown, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4+4+1));
|
||||
data << uint64(r.itemGUID); // guid of rolled item
|
||||
data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it???
|
||||
data << r.lootedTargetGUID; // creature guid what we're looting
|
||||
data << uint32(r.itemSlot); // item slot in loot
|
||||
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
|
||||
data << uint32(r.itemRandomSuffix); // randomSuffix
|
||||
data << uint32(r.itemRandomPropId); // item random property ID
|
||||
|
|
@ -468,17 +468,17 @@ 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(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1));
|
||||
data << uint64(SourceGuid); // guid of the item rolled
|
||||
data << uint32(0); // unknown, maybe amount of players
|
||||
data << uint64(TargetGuid);
|
||||
data << r.lootedTargetGUID; // creature guid what we're looting
|
||||
data << uint32(r.itemSlot); // unknown, maybe amount of players, or item slot in loot
|
||||
data << targetGuid;
|
||||
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
|
||||
data << uint32(r.itemRandomSuffix); // randomSuffix
|
||||
data << uint32(r.itemRandomPropId); // Item random property ID
|
||||
data << uint8(RollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number
|
||||
data << uint8(RollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll
|
||||
data << uint8(rollNumber); // 0: "Need for: [item name]" > 127: "you passed on: [item name]" Roll number
|
||||
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
|
||||
|
||||
for( Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
|
|
@ -492,17 +492,17 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin
|
|||
}
|
||||
}
|
||||
|
||||
void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
|
||||
void Group::SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_ROLL_WON, (8+4+4+4+4+8+1+1));
|
||||
data << uint64(SourceGuid); // guid of the item rolled
|
||||
data << uint32(0); // unknown, maybe amount of players
|
||||
data << r.lootedTargetGUID; // creature guid what we're looting
|
||||
data << uint32(r.itemSlot); // item slot in loot
|
||||
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
|
||||
data << uint32(r.itemRandomSuffix); // randomSuffix
|
||||
data << uint32(r.itemRandomPropId); // Item random property
|
||||
data << uint64(TargetGuid); // guid of the player who won.
|
||||
data << uint8(RollNumber); // rollnumber realted to SMSG_LOOT_ROLL
|
||||
data << uint8(RollType); // Rolltype related to SMSG_LOOT_ROLL
|
||||
data << targetGuid; // guid of the player who won.
|
||||
data << uint8(rollNumber); // rollnumber realted 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)
|
||||
{
|
||||
|
|
@ -515,11 +515,11 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid,
|
|||
}
|
||||
}
|
||||
|
||||
void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
|
||||
void Group::SendLootAllPassed(Roll const& r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4));
|
||||
data << uint64(r.itemGUID); // Guid of the item rolled
|
||||
data << uint32(NumberOfPlayers); // The number of players rolling for it???
|
||||
data << r.lootedTargetGUID; // creature guid what we're looting
|
||||
data << uint32(r.itemSlot); // item slot in loot
|
||||
data << uint32(r.itemid); // The itemEntryId for the item that shall be rolled for
|
||||
data << uint32(r.itemRandomPropId); // Item random property ID
|
||||
data << uint32(r.itemRandomSuffix); // Item random suffix ID
|
||||
|
|
@ -535,7 +535,7 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
|
|||
}
|
||||
}
|
||||
|
||||
void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
||||
void Group::GroupLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creature)
|
||||
{
|
||||
std::vector<LootItem>::iterator i;
|
||||
ItemPrototype const *item;
|
||||
|
|
@ -555,8 +555,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
//roll for over-threshold item if it's one-player loot
|
||||
if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
|
||||
{
|
||||
uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
|
||||
Roll* r = new Roll(newitemGUID, *i);
|
||||
Roll* r=new Roll(creature->GetGUID(),*i);
|
||||
|
||||
//a vector is filled with only near party members
|
||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
|
|
@ -574,23 +573,34 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
}
|
||||
}
|
||||
|
||||
r->setLoot(loot);
|
||||
r->itemSlot = itemSlot;
|
||||
if (r->totalPlayersRolling > 0) // has looters
|
||||
{
|
||||
r->setLoot(loot);
|
||||
r->itemSlot = itemSlot;
|
||||
|
||||
group->SendLootStartRoll(60000, *r);
|
||||
if (r->totalPlayersRolling == 1) // single looter
|
||||
r->playerVote.begin()->second = NEED;
|
||||
else
|
||||
{
|
||||
group->SendLootStartRoll(60000, *r);
|
||||
|
||||
loot->items[itemSlot].is_blocked = true;
|
||||
creature->m_groupLootTimer = 60000;
|
||||
creature->m_groupLootId = GetId();
|
||||
loot->items[itemSlot].is_blocked = true;
|
||||
|
||||
RollId.push_back(r);
|
||||
creature->m_groupLootTimer = 60000;
|
||||
creature->m_groupLootId = GetId();
|
||||
}
|
||||
|
||||
RollId.push_back(r);
|
||||
}
|
||||
else // no looters??
|
||||
delete r;
|
||||
}
|
||||
else
|
||||
i->is_underthreshold = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *creature)
|
||||
void Group::NeedBeforeGreed(ObjectGuid const& playerGUID, Loot *loot, Creature *creature)
|
||||
{
|
||||
ItemPrototype const *item;
|
||||
Player *player = sObjectMgr.GetPlayer(playerGUID);
|
||||
|
|
@ -604,8 +614,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
|
|||
//only roll for one-player items, not for ones everyone can get
|
||||
if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
|
||||
{
|
||||
uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
|
||||
Roll* r = new Roll(newitemGUID, *i);
|
||||
Roll* r=new Roll(creature->GetGUID(),*i);
|
||||
|
||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
|
|
@ -623,28 +632,30 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
|
|||
}
|
||||
}
|
||||
|
||||
if (r->totalPlayersRolling > 0)
|
||||
if (r->totalPlayersRolling > 0) // has looters
|
||||
{
|
||||
r->setLoot(loot);
|
||||
r->itemSlot = itemSlot;
|
||||
|
||||
group->SendLootStartRoll(60000, *r);
|
||||
|
||||
loot->items[itemSlot].is_blocked = true;
|
||||
if (r->totalPlayersRolling == 1) // single looter
|
||||
r->playerVote.begin()->second = NEED;
|
||||
else
|
||||
{
|
||||
group->SendLootStartRoll(60000, *r);
|
||||
loot->items[itemSlot].is_blocked = true;
|
||||
}
|
||||
|
||||
RollId.push_back(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
else // no looters??
|
||||
delete r;
|
||||
}
|
||||
}
|
||||
else
|
||||
i->is_underthreshold = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creature)
|
||||
void Group::MasterLoot(ObjectGuid const& playerGUID, Loot* /*loot*/, Creature *creature)
|
||||
{
|
||||
Player *player = sObjectMgr.GetPlayer(playerGUID);
|
||||
if(!player)
|
||||
|
|
@ -680,48 +691,58 @@ void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creat
|
|||
}
|
||||
}
|
||||
|
||||
void Group::CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 NumberOfPlayers, uint8 Choise)
|
||||
void Group::CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& lootedTarget, uint32 itemSlot, uint8 choise)
|
||||
{
|
||||
Rolls::iterator rollI = GetRoll(Guid);
|
||||
Rolls::iterator rollI = RollId.begin();
|
||||
for (; rollI != RollId.end(); ++rollI)
|
||||
if ((*rollI)->isValid() && (*rollI)->lootedTargetGUID == lootedTarget && (*rollI)->itemSlot == itemSlot)
|
||||
break;
|
||||
|
||||
if (rollI == RollId.end())
|
||||
return;
|
||||
|
||||
CountRollVote(playerGUID, rollI, choise);
|
||||
}
|
||||
|
||||
bool Group::CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& rollI, uint8 choise)
|
||||
{
|
||||
Roll* roll = *rollI;
|
||||
|
||||
Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID);
|
||||
Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID.GetRawValue());
|
||||
// this condition means that player joins to the party after roll begins
|
||||
if (itr == roll->playerVote.end())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (roll->getLoot())
|
||||
if (roll->getLoot()->items.empty())
|
||||
return;
|
||||
return false;
|
||||
|
||||
switch (Choise)
|
||||
switch (choise)
|
||||
{
|
||||
case ROLL_PASS: // Player choose pass
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 0, ROLL_PASS, *roll);
|
||||
SendLootRoll(playerGUID, 0, ROLL_PASS, *roll);
|
||||
++roll->totalPass;
|
||||
itr->second = PASS;
|
||||
}
|
||||
break;
|
||||
case ROLL_NEED: // player choose Need
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 0, ROLL_NEED, *roll);
|
||||
SendLootRoll(playerGUID, 0, ROLL_NEED, *roll);
|
||||
++roll->totalNeed;
|
||||
itr->second = NEED;
|
||||
}
|
||||
break;
|
||||
case ROLL_GREED: // player choose Greed
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 128, ROLL_GREED, *roll);
|
||||
SendLootRoll(playerGUID, 128, ROLL_GREED, *roll);
|
||||
++roll->totalGreed;
|
||||
itr->second = GREED;
|
||||
}
|
||||
break;
|
||||
case ROLL_DISENCHANT: // player choose Disenchant
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 128, ROLL_DISENCHANT, *roll);
|
||||
SendLootRoll(playerGUID, 128, ROLL_DISENCHANT, *roll);
|
||||
++roll->totalGreed;
|
||||
itr->second = DISENCHANT;
|
||||
}
|
||||
|
|
@ -729,8 +750,11 @@ void Group::CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 N
|
|||
}
|
||||
if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling)
|
||||
{
|
||||
CountTheRoll(rollI, NumberOfPlayers);
|
||||
CountTheRoll(rollI);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//called when roll timer expires
|
||||
|
|
@ -741,18 +765,17 @@ void Group::EndRoll()
|
|||
{
|
||||
//need more testing here, if rolls disappear
|
||||
itr = RollId.begin();
|
||||
CountTheRoll(itr, GetMembersCount()); //i don't have to edit player votes, who didn't vote ... he will pass
|
||||
CountTheRoll(itr); //i don't have to edit player votes, who didn't vote ... he will pass
|
||||
}
|
||||
}
|
||||
|
||||
void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
||||
void Group::CountTheRoll(Rolls::iterator& rollI)
|
||||
{
|
||||
Roll* roll = *rollI;
|
||||
if(!roll->isValid()) // is loot already deleted ?
|
||||
{
|
||||
RollId.erase(rollI);
|
||||
rollI = RollId.erase(rollI);
|
||||
delete roll;
|
||||
return;
|
||||
}
|
||||
//end of the roll
|
||||
if (roll->totalNeed > 0)
|
||||
|
|
@ -760,7 +783,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
if(!roll->playerVote.empty())
|
||||
{
|
||||
uint8 maxresul = 0;
|
||||
uint64 maxguid = (*roll->playerVote.begin()).first;
|
||||
ObjectGuid maxguid = (*roll->playerVote.begin()).first;
|
||||
Player *player;
|
||||
|
||||
for( Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
|
||||
|
|
@ -769,14 +792,14 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
continue;
|
||||
|
||||
uint8 randomN = urand(1, 99);
|
||||
SendLootRoll(0, itr->first, randomN, ROLL_NEED, *roll);
|
||||
SendLootRoll(itr->first, randomN, ROLL_NEED, *roll);
|
||||
if (maxresul < randomN)
|
||||
{
|
||||
maxguid = itr->first;
|
||||
maxresul = randomN;
|
||||
}
|
||||
}
|
||||
SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll);
|
||||
SendLootRollWon(maxguid, maxresul, ROLL_NEED, *roll);
|
||||
player = sObjectMgr.GetPlayer(maxguid);
|
||||
|
||||
if(player && player->GetSession())
|
||||
|
|
@ -817,7 +840,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
continue;
|
||||
|
||||
uint8 randomN = urand(1, 99);
|
||||
SendLootRoll(0, itr->first, randomN, itr->second, *roll);
|
||||
SendLootRoll(itr->first, randomN, itr->second, *roll);
|
||||
if (maxresul < randomN)
|
||||
{
|
||||
maxguid = itr->first;
|
||||
|
|
@ -825,7 +848,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
rollvote = itr->second;
|
||||
}
|
||||
}
|
||||
SendLootRollWon(0, maxguid, maxresul, rollvote, *roll);
|
||||
SendLootRollWon(maxguid, maxresul, rollvote, *roll);
|
||||
player = sObjectMgr.GetPlayer(maxguid);
|
||||
|
||||
if(player && player->GetSession())
|
||||
|
|
@ -865,11 +888,11 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
}
|
||||
else
|
||||
{
|
||||
SendLootAllPassed(NumberOfPlayers, *roll);
|
||||
SendLootAllPassed(*roll);
|
||||
LootItem *item = &(roll->getLoot()->items[roll->itemSlot]);
|
||||
if(item) item->is_blocked = false;
|
||||
}
|
||||
RollId.erase(rollI);
|
||||
rollI = RollId.erase(rollI);
|
||||
delete roll;
|
||||
}
|
||||
|
||||
|
|
@ -1222,7 +1245,7 @@ void Group::_setLeader(const uint64 &guid)
|
|||
|
||||
void Group::_removeRolls(const uint64 &guid)
|
||||
{
|
||||
for (Rolls::iterator it = RollId.begin(); it < RollId.end(); ++it)
|
||||
for (Rolls::iterator it = RollId.begin(); it < RollId.end(); )
|
||||
{
|
||||
Roll* roll = *it;
|
||||
Roll::PlayerVote::iterator itr2 = roll->playerVote.find(guid);
|
||||
|
|
@ -1240,7 +1263,8 @@ void Group::_removeRolls(const uint64 &guid)
|
|||
|
||||
roll->playerVote.erase(itr2);
|
||||
|
||||
CountRollVote(guid, roll->itemGUID, GetMembersCount()-1, MAX_ROLL_TYPE);
|
||||
if (!CountRollVote(guid, it, MAX_ROLL_TYPE))
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,15 +104,15 @@ class InstanceSave;
|
|||
class Roll : public LootValidatorRef
|
||||
{
|
||||
public:
|
||||
Roll(uint64 _guid, LootItem const& li)
|
||||
: itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
|
||||
totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0) {}
|
||||
Roll(ObjectGuid _lootedTragetGuid, LootItem const& li)
|
||||
: lootedTargetGUID(_lootedTragetGuid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix),
|
||||
itemCount(li.count), totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0) {}
|
||||
~Roll() { }
|
||||
void setLoot(Loot *pLoot) { link(pLoot, this); }
|
||||
Loot *getLoot() { return getTarget(); }
|
||||
void targetObjectBuildLink();
|
||||
|
||||
uint64 itemGUID;
|
||||
ObjectGuid lootedTargetGUID;
|
||||
uint32 itemid;
|
||||
int32 itemRandomPropId;
|
||||
uint32 itemRandomSuffix;
|
||||
|
|
@ -313,26 +313,13 @@ class MANGOS_DLL_SPEC Group
|
|||
/*********************************************************/
|
||||
|
||||
void SendLootStartRoll(uint32 CountDown, const Roll &r);
|
||||
void SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
|
||||
void SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
|
||||
void SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r);
|
||||
void GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature);
|
||||
void NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *creature);
|
||||
void MasterLoot(const uint64& playerGUID, Loot *loot, Creature *creature);
|
||||
Rolls::iterator GetRoll(uint64 Guid)
|
||||
{
|
||||
Rolls::iterator iter;
|
||||
for (iter=RollId.begin(); iter != RollId.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->itemGUID == Guid && (*iter)->isValid())
|
||||
{
|
||||
return iter;
|
||||
}
|
||||
}
|
||||
return RollId.end();
|
||||
}
|
||||
void CountTheRoll(Rolls::iterator roll, uint32 NumberOfPlayers);
|
||||
void CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 NumberOfPlayers, uint8 Choise);
|
||||
void SendLootRoll(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r);
|
||||
void SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r);
|
||||
void SendLootAllPassed(const Roll &r);
|
||||
void GroupLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creature);
|
||||
void NeedBeforeGreed(ObjectGuid const& playerGUID, Loot *loot, Creature *creature);
|
||||
void MasterLoot(ObjectGuid const& playerGUID, Loot *loot, Creature *creature);
|
||||
void CountRollVote(ObjectGuid const& playerGUID, ObjectGuid const& lootedTarget, uint32 itemSlot, uint8 choise);
|
||||
void EndRoll();
|
||||
|
||||
void LinkMember(GroupReference *pRef) { m_memberMgr.insertFirst(pRef); }
|
||||
|
|
@ -403,6 +390,9 @@ class MANGOS_DLL_SPEC Group
|
|||
--m_subGroupsCounts[subgroup];
|
||||
}
|
||||
|
||||
void CountTheRoll(Rolls::iterator& roll); // iterator update to next, in CountRollVote if true
|
||||
bool CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& roll, uint8 choise);
|
||||
|
||||
uint32 m_Id; // 0 for not created or BG groups
|
||||
MemberSlotList m_memberSlots;
|
||||
GroupRefManager m_memberMgr;
|
||||
|
|
|
|||
|
|
@ -369,11 +369,11 @@ void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::HandleLootRoll( WorldPacket &recv_data )
|
||||
{
|
||||
uint64 Guid;
|
||||
uint32 NumberOfPlayers;
|
||||
ObjectGuid lootedTarget;
|
||||
uint32 itemSlot;
|
||||
uint8 rollType;
|
||||
recv_data >> Guid; //guid of the item rolled
|
||||
recv_data >> NumberOfPlayers;
|
||||
recv_data >> lootedTarget; //guid of the item rolled
|
||||
recv_data >> itemSlot;
|
||||
recv_data >> rollType;
|
||||
|
||||
//sLog.outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, rollType:%u", (uint32)Guid, NumberOfPlayers, rollType);
|
||||
|
|
@ -383,7 +383,7 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
|
|||
return;
|
||||
|
||||
// everything's fine, do it
|
||||
group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, rollType);
|
||||
group->CountRollVote(GetPlayer()->GetObjectGuid(), lootedTarget, itemSlot, rollType);
|
||||
|
||||
switch (rollType)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1106,9 +1106,9 @@ bool ChatHandler::HandleModifyASpeedCommand(const char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
float ASpeed = (float)atof((char*)args);
|
||||
float modSpeed = (float)atof((char*)args);
|
||||
|
||||
if (ASpeed > 10 || ASpeed < 0.1)
|
||||
if (modSpeed > 10 || modSpeed < 0.1)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1136,15 +1136,15 @@ bool ChatHandler::HandleModifyASpeedCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_ASPEED, ASpeed, chrNameLink.c_str());
|
||||
PSendSysMessage(LANG_YOU_CHANGE_ASPEED, modSpeed, chrNameLink.c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, GetNameLink().c_str(), ASpeed);
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||
|
||||
chr->SetSpeedRate(MOVE_WALK, ASpeed,true);
|
||||
chr->SetSpeedRate(MOVE_RUN, ASpeed,true);
|
||||
chr->SetSpeedRate(MOVE_SWIM, ASpeed,true);
|
||||
//chr->SetSpeed(MOVE_TURN, ASpeed,true);
|
||||
chr->SetSpeedRate(MOVE_FLIGHT, ASpeed,true);
|
||||
chr->UpdateSpeed(MOVE_WALK, true, modSpeed);
|
||||
chr->UpdateSpeed(MOVE_RUN, true, modSpeed);
|
||||
chr->UpdateSpeed(MOVE_SWIM, true, modSpeed);
|
||||
//chr->UpdateSpeed(MOVE_TURN, true, modSpeed);
|
||||
chr->UpdateSpeed(MOVE_FLIGHT, true, modSpeed);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1154,9 +1154,9 @@ bool ChatHandler::HandleModifySpeedCommand(const char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
float Speed = (float)atof((char*)args);
|
||||
float modSpeed = (float)atof((char*)args);
|
||||
|
||||
if (Speed > 10 || Speed < 0.1)
|
||||
if (modSpeed > 10 || modSpeed < 0.1)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1184,11 +1184,11 @@ bool ChatHandler::HandleModifySpeedCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SPEED, Speed, chrNameLink.c_str());
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SPEED, modSpeed, chrNameLink.c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, GetNameLink().c_str(), Speed);
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||
|
||||
chr->SetSpeedRate(MOVE_RUN,Speed,true);
|
||||
chr->UpdateSpeed(MOVE_RUN, true, modSpeed);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1199,9 +1199,9 @@ bool ChatHandler::HandleModifySwimCommand(const char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
float Swim = (float)atof((char*)args);
|
||||
float modSpeed = (float)atof((char*)args);
|
||||
|
||||
if (Swim > 10.0f || Swim < 0.01f)
|
||||
if (modSpeed > 10.0f || modSpeed < 0.01f)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1229,11 +1229,11 @@ bool ChatHandler::HandleModifySwimCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SWIM_SPEED, Swim, chrNameLink.c_str());
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SWIM_SPEED, modSpeed, chrNameLink.c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, GetNameLink().c_str(), Swim);
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||
|
||||
chr->SetSpeedRate(MOVE_SWIM,Swim,true);
|
||||
chr->UpdateSpeed(MOVE_SWIM, true, modSpeed);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1244,9 +1244,9 @@ bool ChatHandler::HandleModifyBWalkCommand(const char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
float BSpeed = (float)atof((char*)args);
|
||||
float modSpeed = (float)atof((char*)args);
|
||||
|
||||
if (BSpeed > 10.0f || BSpeed < 0.1f)
|
||||
if (modSpeed > 10.0f || modSpeed < 0.1f)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1274,11 +1274,11 @@ bool ChatHandler::HandleModifyBWalkCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_BACK_SPEED, BSpeed, chrNameLink.c_str());
|
||||
PSendSysMessage(LANG_YOU_CHANGE_BACK_SPEED, modSpeed, chrNameLink.c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, GetNameLink().c_str(), BSpeed);
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||
|
||||
chr->SetSpeedRate(MOVE_RUN_BACK,BSpeed,true);
|
||||
chr->UpdateSpeed(MOVE_RUN_BACK, true, modSpeed);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1289,9 +1289,9 @@ bool ChatHandler::HandleModifyFlyCommand(const char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
float FSpeed = (float)atof((char*)args);
|
||||
float modSpeed = (float)atof((char*)args);
|
||||
|
||||
if (FSpeed > 10.0f || FSpeed < 0.1f)
|
||||
if (modSpeed > 10.0f || modSpeed < 0.1f)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1310,11 +1310,11 @@ bool ChatHandler::HandleModifyFlyCommand(const char* args)
|
|||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, FSpeed, GetNameLink(chr).c_str());
|
||||
PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, modSpeed, GetNameLink(chr).c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetNameLink().c_str(), FSpeed);
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||
|
||||
chr->SetSpeedRate(MOVE_FLIGHT,FSpeed,true);
|
||||
chr->UpdateSpeed(MOVE_FLIGHT, true, modSpeed);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7744,13 +7744,13 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
|||
{
|
||||
case GROUP_LOOT:
|
||||
// GroupLoot delete items over threshold (threshold even not implemented), and roll them. Items with quality<threshold, round robin
|
||||
group->GroupLoot(recipient->GetGUID(), loot, creature);
|
||||
group->GroupLoot(recipient->GetObjectGuid(), loot, creature);
|
||||
break;
|
||||
case NEED_BEFORE_GREED:
|
||||
group->NeedBeforeGreed(recipient->GetGUID(), loot, creature);
|
||||
group->NeedBeforeGreed(recipient->GetObjectGuid(), loot, creature);
|
||||
break;
|
||||
case MASTER_LOOT:
|
||||
group->MasterLoot(recipient->GetGUID(), loot, creature);
|
||||
group->MasterLoot(recipient->GetObjectGuid(), loot, creature);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1558,11 +1558,14 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||
// only from players
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
uint32 redunction_affected_damage = CalcNotIgnoreDamageRedunction(damage,damageInfo->damageSchoolMask);
|
||||
uint32 redunction_affected_damage = CalcNotIgnoreDamageRedunction(damageInfo->damage,damageInfo->damageSchoolMask);
|
||||
uint32 resilienceReduction;
|
||||
if (attackType != RANGED_ATTACK)
|
||||
damage -= pVictim->GetMeleeDamageReduction(redunction_affected_damage);
|
||||
resilienceReduction = pVictim->GetMeleeDamageReduction(redunction_affected_damage);
|
||||
else
|
||||
damage -= pVictim->GetRangedDamageReduction(redunction_affected_damage);
|
||||
resilienceReduction = pVictim->GetRangedDamageReduction(redunction_affected_damage);
|
||||
damageInfo->damage -= resilienceReduction;
|
||||
damageInfo->cleanDamage += resilienceReduction;
|
||||
}
|
||||
|
||||
// Calculate absorb resist
|
||||
|
|
@ -8638,11 +8641,6 @@ void Unit::SetPet(Pet* pet)
|
|||
|
||||
if(pet && GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)this)->SendPetGUIDs();
|
||||
|
||||
// FIXME: hack, speed must be set only at follow
|
||||
if(pet && GetTypeId()==TYPEID_PLAYER)
|
||||
for(int i = 0; i < MAX_MOVE_TYPE; ++i)
|
||||
pet->SetSpeedRate(UnitMoveType(i), m_speed_rate[i], true);
|
||||
}
|
||||
|
||||
void Unit::SetCharm(Unit* pet)
|
||||
|
|
@ -10724,7 +10722,7 @@ void Unit::UpdateWalkMode(Unit* source, bool self)
|
|||
CallForAllControlledUnits(UpdateWalkModeHelper(source), false, true, true);
|
||||
}
|
||||
|
||||
void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
||||
void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
|
||||
{
|
||||
// not in combat pet have same speed as owner
|
||||
switch(mtype)
|
||||
|
|
@ -10834,7 +10832,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
|||
if (speed < min_speed)
|
||||
speed = min_speed;
|
||||
}
|
||||
SetSpeedRate(mtype, speed, forced);
|
||||
SetSpeedRate(mtype, speed * ratio, forced);
|
||||
}
|
||||
|
||||
float Unit::GetSpeed( UnitMoveType mtype ) const
|
||||
|
|
|
|||
|
|
@ -1739,7 +1739,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, bool canReflect = false);
|
||||
|
||||
void UpdateWalkMode(Unit* source, bool self = true);
|
||||
void UpdateSpeed(UnitMoveType mtype, bool forced);
|
||||
void UpdateSpeed(UnitMoveType mtype, bool forced, float ratio = 1.0f);
|
||||
float GetSpeed( UnitMoveType mtype ) const;
|
||||
float GetSpeedRate( UnitMoveType mtype ) const { return m_speed_rate[mtype]; }
|
||||
void SetSpeedRate(UnitMoveType mtype, float rate, bool forced = false);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9580"
|
||||
#define REVISION_NR "9584"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue