Jump to content

[fix][8987] pet action bar


Recommended Posts

Posted

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

fix pet action bar saving and loading.

For which repository revision was the patch created?

8967

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

Arthorius

http://filebeam.com/e3189d1f61705b159e2f9f9ab3b66b40

diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 1a9af67..063a00d 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -414,8 +414,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
            << curmana << ", "
            << GetPower(POWER_HAPPINESS) << ", '";

-        // save only spell slots from action bar
-        for(uint32 i = ACTION_BAR_INDEX_PET_SPELL_START; i < ACTION_BAR_INDEX_PET_SPELL_END; ++i)
+        for(uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i)
        {
            ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << " "
               << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << " ";
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index 57b0489..4d6c2b3 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -341,6 +341,12 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
        if(position >= MAX_UNIT_ACTION_BAR_INDEX)
            return;

+        // in the normal case, comand and reaction buttons can only be moved, not removed
+        // at moving count ==2, at removing count == 1
+        // ignore attempt to remove command|reaction buttons (not possible at normal case)
+        if((act_state == ACT_COMMAND || act_state == ACT_REACTION) && count == 1)
+            return;
+
        //if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
        if(!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
        {
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b5112b6..ed15152 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -11631,12 +11631,12 @@ void CharmInfo::LoadPetActionBar(const std::string& data )

    Tokens tokens = StrSplit(data, " ");

-    if (tokens.size() != (ACTION_BAR_INDEX_PET_SPELL_END-ACTION_BAR_INDEX_PET_SPELL_START)*2)
+    if (tokens.size() != (ACTION_BAR_INDEX_END-ACTION_BAR_INDEX_START)*2)
        return;                                             // non critical, will reset to default

    int index;
    Tokens::iterator iter;
-    for(iter = tokens.begin(), index = ACTION_BAR_INDEX_PET_SPELL_START; index < ACTION_BAR_INDEX_PET_SPELL_END; ++iter, ++index )
+    for(iter = tokens.begin(), index = ACTION_BAR_INDEX_START; index < ACTION_BAR_INDEX_END; ++iter, ++index )
    {
        // use unsigned cast to avoid sign negative format use at long-> ActiveStates (int) conversion
        uint8 type  = atol((*iter).c_str());

Posted
Why you see that it broken? I not see any problems with current way work. rejected.

Player can move spell to action slot(1-3,8-10) and action to spell slot (4-7). Therefore it is necessary to save all slots on the action bar.

Posted

This patch maybe fix this bug? :

Sometimes your pet Die and when you go logout pet action bar(skill's pet change position)

Maybe it's not big bug beacouse you can fast set skill's pet.

Posted
This patch maybe fix this bug? :

Sometimes your pet Die and when you go logout pet action bar(skill's pet change position)

Maybe it's not big bug beacouse you can fast set skill's pet.

yes, this patch fixes this bug.

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