Jump to content

[FIX] Console error if adding NPC with command .npc add


Guest MasterTomas

Recommended Posts

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

Fix console error Table `creature` have creature (GUID: XXX Entry: XXX) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.

For which repository revision was the patch created?

9649

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

No see any

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

Me

commit f8f6befafbbcc28b74dcf5c179f1e91cba4489ba
Author: Xadiaris <[email protected]>
Date:   Wed Mar 31 14:51:17 2010 +0300

   [FIX] Console error if adding NPC with command .npc add

diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index c299d2b..3a55282 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -115,7 +115,7 @@ Creature::Creature(CreatureSubtype subtype) :
Unit(), i_AI(NULL),
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), m_groupLootId(0),
m_lootMoney(0), m_lootRecipient(0),
-m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(5.0f),
+m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0),
m_subtype(subtype), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0),
m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false),
m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_needNotify(false),

ALTER TABLE creature 
   CHANGE COLUMN spawndist spawndist FLOAT DEFAULT '0' NOT NULL;

Link to comment
Share on other sites

...and then a summoned mob, having random movement as default get 0 spawndist. Fixing one thing, breaking another.

The real problem must be in Creature::SaveToDB

You meat this session:

    std::ostringstream ss;
   ss << "INSERT INTO creature VALUES
("
       << m_DBTableGuid << ","
       << GetEntry() << ","
       << mapid <<","
       << uint32(spawnMask) << ","                         // cast to prevent save as symbol
       << uint16(GetPhaseMask()) << ","                    // prevent out of range error
       << displayId <<","
       << GetEquipmentId() <<","
       << GetPositionX() << ","
       << GetPositionY() << ","
       << GetPositionZ() << ","
       << GetOrientation() << ","
       << m_respawnDelay << ","                            //respawn time
       << (float) m_respawnradius << ","                   //spawn distance (float)
       << (uint32) (0) << ","                              //currentwaypoint
       << GetHealth() << ","                               //curhealth
       << GetPower(POWER_MANA) << ","                      //curmana
       << (m_isDeadByDefault ? 1 : 0) << ","               //is_dead
       << GetDefaultMovementType() << ")";                 //default movement generator type

if you want pls fix it my c is no good to make this change

Link to comment
Share on other sites

---------------------------- src/game/Creature.cpp ----------------------------
index c299d2b..71c7e7d 100644
@@ -927,7 +927,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
        << GetPositionZ() << ","
        << GetOrientation() << ","
        << m_respawnDelay << ","                            //respawn time
-        << (float) m_respawnradius << ","                   //spawn distance (float)
+        << (m_respawnradius ? 0 : m_respawnradius) << ","   //spawn distance (float)
        << (uint32) (0) << ","                              //currentwaypoint
        << GetHealth() << ","                               //curhealth
        << GetPower(POWER_MANA) << ","                      //curmana

this work ??

Link to comment
Share on other sites

  • 1 year 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