Jump to content

[fixed] Just 1 Loot after Implementation of partly item looting


Guest Marik

Recommended Posts

Mangos Version: [10675]

Custom Patches: None

SD2 Version: None

Database Name and Version: Current PSMDB

The Problem: Since the implementation of partly item looting (http://github.com/mangos/mangos/commit/be120e8800e7b090fbe450bb9c7dabb8c5ba640d), it is not possible to get some loot from Miling and Prospecting.

I.E.: First time i mile or prospect i get a loot. The next x-times the loot is empty

Greetz Marik

Link to comment
Share on other sites

Confirmed, but to clarify this: It ONLY happens if you had more than a 5 stack to start and then you try to mill/prospect the from the SAME stack.

To dupicate:

- Add 10 Peaceblooms and/or 10 Titanium Ores to yourself.

- Mill/Prospect the stack of 10, leaving 5. You will get loot.

- Mill/Prospect the 5 remaining and you will get a blank loot window.

If you separate the stacks of 5 first this does NOT happen.

Link to comment
Share on other sites

Addition: It depends on the Stack. So if i have a 20 Stack of an ore just the first has a loot.

But, if there is another Stack, again the first has loot.

Addition2: After Prospecting two different Stacks it is not possible to stack items together, anymore. (So i Can not stack two different Stacks with each 10 Ores)

Link to comment
Share on other sites

I think the problem lies in hier:

if (!item->HasGeneratedLoot())
           {
               item->loot.clear();

               switch(loot_type)
               {
                   case LOOT_DISENCHANTING:
                       loot->FillLoot(item->GetProto()->DisenchantID, LootTemplates_Disenchant, this,true);
                       item->SetLootState(ITEM_LOOT_TEMPORARY);
                       break;
                   case LOOT_PROSPECTING:
                       loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this,true);
                       item->SetLootState(ITEM_LOOT_TEMPORARY);
                       break;
                   case LOOT_MILLING:
                       loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this,true);
                       item->SetLootState(ITEM_LOOT_TEMPORARY);
                       break;
                   default:
                       loot->FillLoot(item->GetEntry(), LootTemplates_Item, this,true);
                       loot->generateMoneyLoot(item->GetProto()->MinMoneyLoot,item->GetProto()->MaxMoneyLoot);
                       item->SetLootState(ITEM_LOOT_CHANGED);
                       break;
               }
           }
           break;
       }

In the first round u can fullfill if (!item->HasGeneratedLoot()).

But then you set item->SetLootState(ITEM_LOOT_TEMPORARY);

Now item->HasGeneratedLoot() returns true and if (!item->HasGeneratedLoot()) is false.

Therefore the programm does not acces the above code and does not create the new loot.

Greetz Marik

Link to comment
Share on other sites

diff --git a/src/game/Item.h b/src/game/Item.h
index 6b87604..b470564 100644
--- a/src/game/Item.h
+++ b/src/game/Item.h
@@ -359,6 +359,7 @@ class MANGOS_DLL_SPEC Item : public Object
        void SetLootState(ItemLootUpdateState state);
        bool HasGeneratedLoot() const { return m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_REMOVED; }
        bool HasSavedLoot() const { return m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_NEW && m_lootState != ITEM_LOOT_TEMPORARY; }
+        bool IsTemporaryLoot() const { return m_lootState == ITEM_LOOT_TEMPORARY; }

        // Update States
        ItemUpdateState GetState() const { return uState; }
diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 1daeabd..c92bf9f 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -7900,7 +7900,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)

            loot = &item->loot;

-            if (!item->HasGeneratedLoot())
+            if (!item->HasGeneratedLoot() || item->IsTemporaryLoot())
            {
                item->loot.clear();

That would fix the problem. I've tested it.

Whether it is good code style, you have to decide.

Maybe you prefer to combinte this two method calls to one new: !item->HasGeneratedLoot() || item->IsTemporaryLoot()

Thats implementation details.

I hope, I could help.

Marik

Link to comment
Share on other sites

×
×
  • 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