Jump to content

Recommended Posts

Posted

Sorry I originally posted this in the wrong spot. You can delete my other post wrong spot Don't be too hard on the new guy :(

I put this patch out on the Trinity site but thought I should post it here too. (I posted a previous fishing patch to the Trinity site that some how found it's way into here :))

This patch fixes some more fishing achievements and also fixes proper detection of spells learned previous to update. Anyway here it is.

diff -r f33a9a62e8aa src/game/AchievementMgr.cpp
--- a/src/game/AchievementMgr.cpp    Sat Apr 18 12:23:16 2009 +0200
+++ b/src/game/AchievementMgr.cpp    Sat Apr 18 09:02:37 2009 -0400
@@ -807,7 +807,8 @@
                // spell always provide and at login spell learning.
                if(miscvalue1 && miscvalue1!=achievementCriteria->learn_spell.spellID)
                    continue;
-                if(GetPlayer()->HasSpell(miscvalue1))
+        //miscvalue is 0 at login
+                if(GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID))
                    SetCriteriaProgress(achievementCriteria, 1);
                break;
            case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
@@ -953,6 +954,20 @@

                SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
                break;
+            case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
+        if (!miscvalue1)
+                    continue;
+                if (miscvalue1 != achievementCriteria->loot_type.lootType)
+                    continue;
+        //Special case for achievement that is zone dependent
+        uint32 zone, subzone;
+                GetPlayer()->GetZoneAndAreaId(zone,subzone);
+        if (achievementCriteria->ID == 5274 && zone !=1637)
+            continue;
+        if (achievementCriteria->ID == 5275 && zone !=1519)
+            continue;
+                SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
+                break;
            case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS:
            {
                // spell always provide and at login spell learning.
@@ -1058,7 +1073,6 @@
            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED:
            case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED:
            case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN:
-            case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
            case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE:
            case ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL:
            case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS:
@@ -1177,6 +1191,8 @@
            return progress->counter >= achievementCriteria->quest_reward_money.goldInCopper;
        case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT:
            return progress->counter >= achievementCriteria->fish_in_gameobject.lootCount;
+    case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
+        return progress->counter >= achievementCriteria->loot_type.lootTypeCount;
        case ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY:
            return progress->counter >= achievementCriteria->loot_money.goldInCopper;
        case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT:
diff -r f33a9a62e8aa src/game/GameObject.cpp
--- a/src/game/GameObject.cpp    Sat Apr 18 12:23:16 2009 +0200
+++ b/src/game/GameObject.cpp    Sat Apr 18 09:02:37 2009 -0400
@@ -1106,6 +1106,7 @@
                        }
                        else
                            player->SendLoot(GetGUID(),LOOT_FISHING);
+            player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, 3);
                    }
                    else
                    {

  • 39 years later...
Posted

I was preparing a fix for this criteria.

The problem in your patch is that you give the credit when the loot is sent, but it shall be done when the player actually loot the item. You should also give credit for every items looted (not only fish). not 1 per loot type (see comments on wowhead).

Moreover, the patch can be more general and support all loot type and not only fishing.

Here is my patch, if you want to merge some part. (based on rev 7673)

src/game/AchievementMgr.cpp |   45 ++++++++++++++++++++++++++++++++++++++++++-
src/game/LootHandler.cpp    |    2 +
src/game/LootMgr.h          |    2 +
src/game/Player.cpp         |    3 ++
4 files changed, 51 insertions(+), 1 deletions(-)

diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 1b8338a..2ea8dc8 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -1001,6 +1001,48 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
                SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
                break;
            }
+            case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
+            {
+                // miscvalue1=loot_type
+                // miscvalue2=count of item loot
+
+                if (!miscvalue1)
+                    continue;
+
+                if (miscvalue1 != achievementCriteria->loot_type.lootType)
+                    continue;
+
+                // Zone not in dbc.
+                switch(achievementCriteria->ID)
+                {
+                    case 5274:
+                    {
+                        // must be in orgrimmar
+                        uint32 zone_id;
+                        uint32 area_id; 
+                        GetPlayer()->GetZoneAndAreaId(zone_id,area_id);
+                        if (zone_id != 1637)
+                            continue;
+                        break;
+                    }
+                    case 5275:
+                    {
+                        // must be in stormwind
+                        uint32 zone_id;
+                        uint32 area_id; 
+                        GetPlayer()->GetZoneAndAreaId(zone_id,area_id);
+                        if (zone_id != 1519)
+                            continue;
+                        break;
+                    }
+                    default:
+                        break;
+                }
+
+                SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE);
+                break;
+            }
+
            // std case: not exist in DBC, not triggered in code as result
            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH:
            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER:
@@ -1051,7 +1093,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
            case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED:
            case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED:
            case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN:
-            case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
            case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE:
            case ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL:
            case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS:
@@ -1174,6 +1215,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
            return progress->counter >= achievementCriteria->use_gameobject.useCount;
        case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS:
            return progress->counter >= achievementCriteria->learn_skilline_spell.spellCount;
+        case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
+            return progress->counter >= achievementCriteria->loot_type.lootTypeCount;

        // handle all statistic-only criteria here
        case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp
index 254f197..9a9bf55 100644
--- a/src/game/LootHandler.cpp
+++ b/src/game/LootHandler.cpp
@@ -143,6 +143,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )

        player->SendNewItem(newitem, uint32(item->count), false, false, true);
        player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count);
+        player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, (loot->loot_type == LOOT_FISHINGHOLE ? LOOT_FISHING : loot->loot_type), item->count);
    }
    else
        player->SendEquipError( msg, NULL, NULL );
@@ -497,6 +498,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
    Item * newitem = target->StoreNewItem( dest, item.itemid, true, item.randomPropertyId );
    target->SendNewItem(newitem, uint32(item.count), false, false, true );
    target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
+    target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, (pLoot->loot_type == LOOT_FISHINGHOLE ? LOOT_FISHING : pLoot->loot_type), item.count);

    // mark as looted
    item.count=0;
diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h
index b16757d..0f4dc30 100644
--- a/src/game/LootMgr.h
+++ b/src/game/LootMgr.h
@@ -57,6 +57,7 @@ enum PermissionTypes

class Player;
class LootStore;
+enum LootType;

struct LootStoreItem
{
@@ -224,6 +225,7 @@ struct Loot
    std::vector<LootItem> items;
    uint32 gold;
    uint8 unlootedCount;
+    LootType loot_type;

    Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0) {}
    ~Loot() { clear(); }
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 684cdac..dd26a4d 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -7252,6 +7252,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)

    SetLootGUID(guid);

+    // save original loot_type
+    loot->loot_type = loot_type;
+
    // LOOT_PICKPOCKETING, LOOT_PROSPECTING, LOOT_DISENCHANTING, LOOT_INSIGNIA and LOOT_MILLING unsupported by client, sending LOOT_SKINNING instead
    if(loot_type == LOOT_PICKPOCKETING || loot_type == LOOT_DISENCHANTING || loot_type == LOOT_PROSPECTING || loot_type == LOOT_INSIGNIA || loot_type == LOOT_MILLING)
        loot_type = LOOT_SKINNING;

Posted

Your right, the code you have written for LOOT_TYPE looks better. Honestly, I'd just like to see the code implemented more then anything as I'd like to be able to do the fishing achievements. Are you going to incorporate this into both cores or should I update my post on the trinity site to reflect you changes? Thanks for putting my other patch in btw.

Also, did you see my fix to SPELL_LEARN achievement in that patch?

Posted

Before ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE adding need resolve current loot types conflicting numbering with achievement, not as hack fix but proper way. I attempt currently find data for recently used loot types for different looting.

Posted

I made some test, and indeed the enum LootType in Player.h does not correspond to the loot type condition of the achievement criteria.

In the achievement criteria, the lootType condition is 2, 3 and 4.

Puting dummy value in the SetProgressCriteria for all the criteria I've found:

- The LootType condition 3 is definitely for the fishing.

- The LootType condition 2 is used in one criteria. It's a counter of object stolen (=> Pickpocketing)

- The LootType condition 4 is used in one criteria. It's a counter of disenchanted loot (in french "Materiaux obtenus par désenchantement).

So I started a new Enum for "AchievementConditionLootType" with the 3 values in DBCEnum.h. like this

(not compiled yet)

enum AchievementConditionLootType
{
   ACHIEVEMENT_CONDITION_LOOT_PICKPOCKETING = 2,
   ACHIEVEMENT_CONDITION_LOOT_FISHING = 3,
   ACHIEVEMENT_CONDITION_LOOT_DISENCHANTING = 4,
};

is it ok to continue that way?

Posted

no-no. This is fixed more easy by re-numbering loot types (enum LootType) and this part already ready in my local repo.

So switch LOOT_SKINNING with LOOT_PICKPOCKETING and after LOOT_DISENCHANTING and LOOT_SKINNING, and update code to 5-8 custom values.

Currently we send to client only 1-3 values and replace any server side values 4-8 by 2 for client.

But base at achievement data possible 4 also now acceptable for client.

So after this changes we apply fishing part replace we will have values compatibale with achievment values.

_But_ possible our replace 5-8 by 2 not fully correct and client expect another values for specific loot types.

This will not affect achivement side but i don;t want move enum value by associared numbers without confirmations.

So achivment part can wait until in game loot type enums will updated to more correct state.

Posted

So achivment part can wait until in game loot type enums will updated to more correct state.

ok. I wait and will propose an updated fix for the achievement when you have completed the enum update.

Posted

Can I be of any help to speed up the process? I'd be willing to be a testbed for part if you'd like. To be honest I'm just interested in getting the achievement for catching 100 fish working, but I help to fix all the others along with it so the job gets done right.

Posted

Alright, here's a diff that uses the fixed loot_type.

diff -r 7815832576de src/game/AchievementMgr.cpp
--- a/src/game/AchievementMgr.cpp    Tue Apr 28 00:09:37 2009 -0500
+++ b/src/game/AchievementMgr.cpp    Tue Apr 28 14:58:35 2009 -0400
@@ -861,6 +861,45 @@
                if(GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID))
                    SetCriteriaProgress(achievementCriteria, 1);
                break;
+            case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
+            {
+                // miscvalue1=loot_type
+                // miscvalue2=count of item loot
+                if (!miscvalue1)
+                    continue;
+                if (miscvalue1 != achievementCriteria->loot_type.lootType)
+                    continue;
+
+                // Zone not in dbc.
+                switch(achievementCriteria->ID)
+                {
+                    case 5274:
+                    {
+                        // must be in orgrimmar
+                        uint32 zone_id;
+                        uint32 area_id; 
+                        GetPlayer()->GetZoneAndAreaId(zone_id,area_id);
+                        if (zone_id != 1637)
+                            continue;
+                        break;
+                    }
+                    case 5275:
+                    {
+                        // must be in stormwind
+                        uint32 zone_id;
+                        uint32 area_id; 
+                        GetPlayer()->GetZoneAndAreaId(zone_id,area_id);
+                        if (zone_id != 1519)
+                            continue;
+                        break;
+                    }
+                    default:
+                        break;
+                }
+
+                SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE);
+                break;
+            }
            case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
                // speedup for non-login case
                if(miscvalue1 && achievementCriteria->own_item.itemID != miscvalue1)
@@ -1141,7 +1180,6 @@
            case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED:
            case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED:
            case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN:
-            case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
            case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS:
            case ACHIEVEMENT_CRITERIA_TYPE_TOTAL:
                break;                                   // Not implemented yet 
@@ -1231,6 +1269,8 @@
            return progress->counter >= achievementCriteria->cast_spell.castCount;
        case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
            return progress->counter >= 1;
+        case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
+            return progress->counter >= achievementCriteria->loot_type.lootTypeCount;
        case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
            return progress->counter >= achievementCriteria->own_item.itemCount;
        case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM:
diff -r 7815832576de src/game/LootHandler.cpp
--- a/src/game/LootHandler.cpp    Tue Apr 28 00:09:37 2009 -0500
+++ b/src/game/LootHandler.cpp    Tue Apr 28 14:58:35 2009 -0400
@@ -153,6 +153,7 @@

        player->SendNewItem(newitem, uint32(item->count), false, false, true);
        player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count);
+        player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, (loot->loot_type == LOOT_FISHINGHOLE ? LOOT_FISHING : loot->loot_type), item->count);
    }
    else
        player->SendEquipError( msg, NULL, NULL );
@@ -509,6 +510,7 @@
    Item * newitem = target->StoreNewItem( dest, item.itemid, true, item.randomPropertyId );
    target->SendNewItem(newitem, uint32(item.count), false, false, true );
    target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
+    target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, (pLoot->loot_type == LOOT_FISHINGHOLE ? LOOT_FISHING : pLoot->loot_type), item.count);

    // mark as looted
    item.count=0;
diff -r 7815832576de src/game/LootMgr.h
--- a/src/game/LootMgr.h    Tue Apr 28 00:09:37 2009 -0500
+++ b/src/game/LootMgr.h    Tue Apr 28 14:58:35 2009 -0400
@@ -57,6 +57,20 @@
    NONE_PERMISSION   = 3
};

+enum LootType
+{
+    LOOT_CORPSE                 = 1,
+    LOOT_PICKPOCKETING          = 2,
+    LOOT_FISHING                = 3,
+    LOOT_DISENCHANTING          = 4,
+                                                            // ignored always by client
+    LOOT_SKINNING               = 6,
+    LOOT_PROSPECTING            = 7,
+    LOOT_MILLING                = 8,
+
+    LOOT_FISHINGHOLE            = 20,                       // unsupported by client, sending LOOT_FISHING instead
+    LOOT_INSIGNIA               = 21                        // unsupported by client, sending LOOT_CORPSE instead
+};
class Player;
class LootStore;

@@ -226,6 +240,7 @@
    std::vector<LootItem> items;
    uint32 gold;
    uint8 unlootedCount;
+    LootType loot_type;

    Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0) {}
    ~Loot() { clear(); }
diff -r 7815832576de src/game/Player.cpp
--- a/src/game/Player.cpp    Tue Apr 28 00:09:37 2009 -0500
+++ b/src/game/Player.cpp    Tue Apr 28 14:58:35 2009 -0400
@@ -7455,6 +7455,8 @@
    }

    SetLootGUID(guid);
+
+    loot->loot_type = loot_type;

    // LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client
    switch(loot_type)
diff -r 7815832576de src/game/Player.h
--- a/src/game/Player.h    Tue Apr 28 00:09:37 2009 -0500
+++ b/src/game/Player.h    Tue Apr 28 14:58:36 2009 -0400
@@ -455,20 +455,7 @@
    ERR_TAXINOTSTANDING             = 12
};

-enum LootType
-{
-    LOOT_CORPSE                 = 1,
-    LOOT_PICKPOCKETING          = 2,
-    LOOT_FISHING                = 3,
-    LOOT_DISENCHANTING          = 4,
-                                                            // ignored always by client
-    LOOT_SKINNING               = 6,
-    LOOT_PROSPECTING            = 7,
-    LOOT_MILLING                = 8,

-    LOOT_FISHINGHOLE            = 20,                       // unsupported by client, sending LOOT_FISHING instead
-    LOOT_INSIGNIA               = 21                        // unsupported by client, sending LOOT_CORPSE instead
-};

enum MirrorTimerType
{

Thanks for fixing the loot_type so that we can get this integrated :)

Posted

Raven, put this

@@ -7455,6 +7455,8 @@
    }

    SetLootGUID(guid);
+
+    [b]loot->loot_type = loot_type[/b];

    // LOOT_INSIGNIA and LOOT_FISHINGHOLE unsupported by client
    switch(loot_type)

after the switch (so saving the updated loot_type), and you can now also simplify this block as follow :

diff -r 7815832576de src/game/LootHandler.cpp
--- a/src/game/LootHandler.cpp    Tue Apr 28 00:09:37 2009 -0500
+++ b/src/game/LootHandler.cpp    Tue Apr 28 14:58:35 2009 -0400
@@ -153,6 +153,7 @@

        player->SendNewItem(newitem, uint32(item->count), false, false, true);
        player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count);
+        player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count);
    }
    else
        player->SendEquipError( msg, NULL, NULL );
@@ -509,6 +510,7 @@
    Item * newitem = target->StoreNewItem( dest, item.itemid, true, item.randomPropertyId );
    target->SendNewItem(newitem, uint32(item.count), false, false, true );
    target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
+    target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count);

    // mark as looted
    item.count=0;

Posted

I currently review, just notes:

loot->loot_type = loot_type;

better set _after_ merge fishingnode to fishing. This make loot of fishing node expected fishing loot also.

And will not req. specail check in achievement call.

2. Instead hardcoded values i will add using `achievement_criteria_data`

Guest
This topic is now closed to further replies.
×
×
  • 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