Jump to content

[7754-7755][FIX] 3 interesting fixes for Children's Week quest


Recommended Posts

Posted

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

On Children's Week, can't get quest from the summoned Human Orphan who is a MINI_PET.

* For which repository revision was the patch created?

[7743]

UDB 371

* Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

No

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

Me.

1. set UNIT_NPC_FLAGS for summoned MINI_PET, so he can be a quest giver

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 30d2c62..74b7a59 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -5970,9 +5970,8 @@ void Spell::EffectSummonCritter(uint32 i)

    critter->AIM_Initialize();
    critter->InitPetCreateSpells();                         // e.g. disgusting oo
-    critter->SetMaxHealth(1);
-    critter->SetHealth(1);
-    critter->SetLevel(1);
+    critter->SelectLevel(critter->GetCreatureInfo());
+    critter->SetUInt32Value(UNIT_NPC_FLAGS, critter->GetCreatureInfo()->npcflag);

    // set timer for unsummon
    int32 duration = GetSpellDuration(m_spellInfo);

2. allow player interact with MINI_PET

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index fa8d925..5a1e49a 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1978,8 +1978,8 @@ Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
    if(!unit->isAlive() && (!unit->isSpiritService() || isAlive() ))
        return NULL;

-    // not allow interaction under control
-    if(unit->GetCharmerOrOwnerGUID())
+    // allow interaction if under player's control, else not
+    if (unit->GetCharmerOrOwnerGUID() && unit->GetCharmerOrOwnerGUID() != GetGUID())
        return NULL;

    // not enemy

3. I don't know why Map::GetCreature can't find summoned MINI_PET(on Linux), so 2nd try

diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 27b9a21..83b50c9 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -2536,6 +2536,10 @@ Creature*
Map::GetCreature(uint64 guid)
{
    Creature * ret = ObjectAccessor::GetObjectInWorld(guid, (Creature*)NULL);
+
+    if (!ret)
+        ret = (Creature *)ObjectAccessor::GetObjectInWorld(guid, (Unit*)NULL);
+
    if(!ret)
        return NULL;

Posted

You need to use GetPet or GetCreatureOrPetOrVehicle

if (unit->GetCharmerOrOwnerGUID() && unit->GetCharmerOrOwnerGUID() != GetGUID())

This is not so good. Because some players charm NPC of the other faction and buy mounts from them.

I use this:

if(unit->GetCharmerGUID())

return NULL;

I do not know why we do not allow interact with npc with owner. If that repair bot does not work

Posted

NPC flags part added in [7754]. Thank you.

But GetCreature other 2 parts of patch is wrong as described by megamage.

I plan add its in version suhhested by megamage. Ofc, instead GetCreature modify need adding GetCreatureOrPetOrVehicle

in all affected gossip function/handlers

[added]Second patch added in [7755]. Thanks to daveh and megamage.

Posted

Hi, I just found pet doesn't update status when player accepted or finished the quest.

I've post a new fix, please review, thanks.

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