Jump to content

[9582][Patch] Correct GUID in roll packets


Guest Opterman

Recommended Posts

What bug does the patch fix? What features does the patch add?

It change itemGUID in packets by real guid ( loot creature guid )

For which repository revision was the patch created?

8442

Who has been writing this patch? Please include either forum user names or email addresses.

Me

This is the fix:

From 2697d66417bc9bf514ec3331fa5537caa4289607 Mon Sep 17 00:00:00 2001
From: unknown <Administrator@.(none)>
Date: Mon, 31 Aug 2009 10:25:20 -0700
Subject: [PATCH] Send Owner as its in roll packets

---
src/game/Group.cpp |   30 +++++++++++++++---------------
src/game/Group.h   |   11 ++++++-----
2 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 5c83df6..e0fc912 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -451,7 +451,7 @@ 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));
-    data << uint64(r.itemGUID);                             // object guid what we're looting
+    data << uint64(r.LootedTargetGUID);                     // creature guid what we're looting
    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.itemRandomSuffix);                     // randomSuffix
@@ -469,10 +469,10 @@ 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& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
{
    WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1));
-    data << uint64(SourceGuid);                             // guid of the item rolled
+    data << uint64(r.LootedTargetGUID);                     // creature guid what we're looting
    data << uint32(0);                                      // unknown, maybe amount of players
    data << uint64(TargetGuid);
    data << uint32(r.itemid);                               // the itemEntryId for the item that shall be rolled for
@@ -493,10 +493,10 @@ 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(const uint64& 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 << uint64(r.LootedTargetGUID);                     // creature guid what we're looting
    data << uint32(0);                                      // unknown, maybe amount of players
    data << uint32(r.itemid);                               // the itemEntryId for the item that shall be rolled for
    data << uint32(r.itemRandomSuffix);                     // randomSuffix
@@ -519,7 +519,7 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid,
void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r)
{
    WorldPacket data(SMSG_LOOT_ALL_PASSED, (8+4+4+4+4));
-    data << uint64(r.itemGUID);                             // Guid of the item rolled
+    data << uint64(r.LootedTargetGUID);                     // creature guid what we're looting
    data << uint32(NumberOfPlayers);                        // The number of players rolling for it???
    data << uint32(r.itemid);                               // The itemEntryId for the item that shall be rolled for
    data << uint32(r.itemRandomPropId);                     // Item random property ID
@@ -557,7 +557,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
        if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
        {
            uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM),0,HIGHGUID_ITEM);
-            Roll* r=new Roll(newitemGUID,*i);
+            Roll* r=new Roll(newitemGUID,creature->GetGUID(),*i);

            //a vector is filled with only near party members
            for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -607,7 +607,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
        if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
        {
            uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM),0,HIGHGUID_ITEM);
-            Roll* r=new Roll(newitemGUID,*i);
+            Roll* r=new Roll(newitemGUID,creature->GetGUID(),*i);

            for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
            {
@@ -702,21 +702,21 @@ void Group::CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 N
    {
        case 0:                                             //Player choose pass
        {
-            SendLootRoll(0, playerGUID, 128, 128, *roll);
+            SendLootRoll(playerGUID, 128, 128, *roll);
            ++roll->totalPass;
            itr->second = PASS;
        }
        break;
        case 1:                                             //player choose Need
        {
-            SendLootRoll(0, playerGUID, 0, 0, *roll);
+            SendLootRoll(playerGUID, 0, 0, *roll);
            ++roll->totalNeed;
            itr->second = NEED;
        }
        break;
        case 2:                                             //player choose Greed
        {
-            SendLootRoll(0, playerGUID, 128, 2, *roll);
+            SendLootRoll(playerGUID, 128, 2, *roll);
            ++roll->totalGreed;
            itr->second = GREED;
        }
@@ -764,14 +764,14 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
                    continue;

                uint8 randomN = urand(1, 99);
-                SendLootRoll(0, itr->first, randomN, 1, *roll);
+                SendLootRoll(itr->first, randomN, 1, *roll);
                if (maxresul < randomN)
                {
                    maxguid  = itr->first;
                    maxresul = randomN;
                }
            }
-            SendLootRollWon(0, maxguid, maxresul, 1, *roll);
+            SendLootRollWon(maxguid, maxresul, 1, *roll);
            player = objmgr.GetPlayer(maxguid);

            if(player && player->GetSession())
@@ -811,14 +811,14 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
                    continue;

                uint8 randomN = urand(1, 99);
-                SendLootRoll(0, itr->first, randomN, 2, *roll);
+                SendLootRoll(itr->first, randomN, 2, *roll);
                if (maxresul < randomN)
                {
                    maxguid  = itr->first;
                    maxresul = randomN;
                }
            }
-            SendLootRollWon(0, maxguid, maxresul, 2, *roll);
+            SendLootRollWon(maxguid, maxresul, 2, *roll);
            player = objmgr.GetPlayer(maxguid);

            if(player && player->GetSession())
diff --git a/src/game/Group.h b/src/game/Group.h
index 478b7c5..f697789 100644
--- a/src/game/Group.h
+++ b/src/game/Group.h
@@ -97,16 +97,17 @@ class InstanceSave;
class Roll : public LootValidatorRef
{
    public:
-        Roll(uint64 _guid, LootItem const& li)
-            : itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix),
+        Roll(uint64 _guid, uint64 _owner, LootItem const& li)
+            : itemGUID(_guid), LootedTargetGUID(_owner), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix),
            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;
        uint32 itemid;
+        uint64 itemGUID;
+       uint64 LootedTargetGUID;
        int32  itemRandomPropId;
        uint32 itemRandomSuffix;
        typedef std::map<uint64, RollVote> PlayerVote;
@@ -300,8 +301,8 @@ 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 SendLootRoll(const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r);
+        void SendLootRollWon(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);
-- 
1.6.2.msysgit.0.186.gf7512

Greetings, Opterman

Link to comment
Share on other sites

hi,

from my point of view i would not use variable named OwnerGUID as the GUID of creature that is being looted. I think better would be something like LootedTargetGUID and i would update also comments, because out of date comments can confuse others. Anyway patch seems OK.

Link to comment
Share on other sites

hi,

from my point of view i would not use variable named OwnerGUID as the GUID of creature that is being looted. I think better would be something like LootedTargetGUID and i would update also comments, because out of date comments can confuse others. Anyway patch seems OK.

Ok , you're right , i 've updated already.

Greetings, Opterman

Link to comment
Share on other sites

  • 6 months later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use