All pastes #924661 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-03-01 16:15 UTC
rendered paste body
Index: src/game/Object.cpp
===================================================================
--- src/game/Object.cpp	(revision 5341)
+++ src/game/Object.cpp	(working copy)
@@ -1189,7 +1189,7 @@
     return MapManager::Instance().GetBaseMap(GetMapId());
 }
 
-Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime)
+Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang, float spawndist, TempSummonType spwtype,uint32 despwtime)
 {
     TemporarySummon* pCreature = new TemporarySummon(this, GetGUID());
 
@@ -1198,7 +1198,7 @@
     if (GetTypeId()==TYPEID_PLAYER)
         team = ((Player*)this)->GetTeam();
 
-    if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), GetMapId(), x, y, z, ang, id, team))
+    if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), GetMapId(), x, y, z, ang, spawndist, id, team))
     {
         delete pCreature;
         return NULL;
Index: src/game/SpellEffects.cpp
===================================================================
--- src/game/SpellEffects.cpp	(revision 5341)
+++ src/game/SpellEffects.cpp	(working copy)
@@ -2576,7 +2576,7 @@
 
         TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN;
 
-        m_caster->SummonCreature(creature_entry,px,py,pz,m_caster->GetOrientation(),summonType,duration);
+        m_caster->SummonCreature(creature_entry, px, py, pz, 0.0f, m_caster->GetOrientation(), summonType, duration);
     }
 }
 
@@ -3912,7 +3912,7 @@
     Totem* pTotem = new Totem(m_caster);
 
     if(!pTotem->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT),
-        m_caster->GetMapId(), x, y, z, m_caster->GetOrientation(),
+        m_caster->GetMapId(), x, y, z, m_caster->GetOrientation(), 0.0f,
         m_spellInfo->EffectMiscValue[i], team ))
     {
         delete pTotem;
@@ -4667,7 +4667,7 @@
     if (px == 0 || py == 0 || pz == 0)
         m_caster->GetClosePoint(px, py, pz);
 
-    Creature* Charmed = m_caster->SummonCreature(m_spellInfo->EffectMiscValue[i], px, py, pz, m_caster->GetOrientation(),TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,3600000);
+    Creature* Charmed = m_caster->SummonCreature(m_spellInfo->EffectMiscValue[i], px, py, pz, 0.0f, m_caster->GetOrientation(),TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,3600000);
     if (!Charmed)
         return;
 
Index: src/game/Creature.h
===================================================================
--- src/game/Creature.h	(revision 5341)
+++ src/game/Creature.h	(working copy)
@@ -306,7 +306,7 @@
         void AddToWorld();
         void RemoveFromWorld();
 
-        bool Create (uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 Entry, uint32 team, const CreatureData *data = NULL);
+        bool Create (uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, float spawndist, uint32 Entry, uint32 team, const CreatureData *data = NULL);
         bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL);
         bool LoadCreaturesAddon(bool reload = false);
         void SelectLevel(const CreatureInfo *cinfo);
Index: src/game/Object.h
===================================================================
--- src/game/Object.h	(revision 5341)
+++ src/game/Object.h	(working copy)
@@ -355,7 +355,7 @@
 
         Map      * GetMap() const;
         Map const* GetBaseMap() const;
-        Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime);
+        Creature* SummonCreature(uint32 id, float x, float y, float z, float ang, float spawndist, TempSummonType spwtype,uint32 despwtime);
     protected:
         explicit WorldObject( WorldObject *instantiator );
         std::string m_name;
Index: src/game/BattleGroundAB.cpp
===================================================================
--- src/game/BattleGroundAB.cpp	(revision 5341)
+++ src/game/BattleGroundAB.cpp	(working copy)
@@ -463,7 +463,7 @@
     if (m_spiritGuides[node])
         return;
     m_spiritGuides[node] = new Creature(NULL);
-    if (!m_spiritGuides[node]->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), 529, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], (node>4)?BG_AB_SpiritGuideId[node-5]:BG_AB_SpiritGuideId[m_Nodes[node]-3], (node>4)?BG_AB_SpiritGuideTeamId[node-5]:BG_AB_SpiritGuideTeamId[m_Nodes[node]-3]))
+    if (!m_spiritGuides[node]->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), 529, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], 0.0f, (node>4)?BG_AB_SpiritGuideId[node-5]:BG_AB_SpiritGuideId[m_Nodes[node]-3], (node>4)?BG_AB_SpiritGuideTeamId[node-5]:BG_AB_SpiritGuideTeamId[m_Nodes[node]-3]))
         ASSERT(0);
     m_spiritGuides[node]->setDeathState(DEAD);
     m_spiritGuides[node]->AIM_Initialize();
Index: src/game/BattleGround.cpp
===================================================================
--- src/game/BattleGround.cpp	(revision 5341)
+++ src/game/BattleGround.cpp	(working copy)
@@ -820,10 +820,10 @@
     }
 }
 
-Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o)
+Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, float spawndist,)
 {
     Creature* pCreature = new Creature(NULL);
-    if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), GetMapId(), x, y, z, o, entry, teamval))
+    if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), GetMapId(), x, y, z, o, spawndist, entry, teamval))
     {
         sLog.outError("Can't create creature entry: %u",entry);
         delete pCreature;
@@ -875,7 +875,7 @@
     else
         entry = 13117;
 
-    Creature* pCreature = AddCreature(entry,type,team,x,y,z,o);
+    Creature* pCreature = AddCreature(entry, type, team, x, y, z, o, 0.0f);
     if(!pCreature)
     {
         sLog.outError("Can't create Spirit guide. BattleGround not created!");
Index: src/game/World.cpp
===================================================================
--- src/game/World.cpp	(revision 5341)
+++ src/game/World.cpp	(working copy)
@@ -1288,8 +1288,9 @@
                 float y = step.script->y;
                 float z = step.script->z;
                 float o = step.script->o;
-
-                Creature* pCreature = summoner->SummonCreature(step.script->datalong, x, y, z, o,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,step.script->datalong2);
+		float spawndist = 0.0f;	  //currently set to 0 untill spawndist implemented in event/script DB tables
+		
+                Creature* pCreature = summoner->SummonCreature(step.script->datalong, x, y, z, o, spawndist, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->datalong2);
                 if (!pCreature)
                 {
                     sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON failed for creature (entry: %u).",step.script->datalong);
Index: src/game/Level2.cpp
===================================================================
--- src/game/Level2.cpp	(revision 5341)
+++ src/game/Level2.cpp	(working copy)
@@ -602,9 +602,10 @@
     float y = chr->GetPositionY();
     float z = chr->GetPositionZ();
     float o = chr->GetOrientation();
+    float spawndist = 0.0f;	//currently set to 0 untill spawndist implemented in .addspw command
 
     Creature* pCreature = new Creature(chr);
-    if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(), x, y, z, o, id, (uint32)teamval))
+    if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(), x, y, z, o, spawndist, id, (uint32)teamval))
     {
         delete pCreature;
         return false;
@@ -2251,7 +2252,7 @@
 
         Creature* wpCreature = new Creature(chr);
         if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(),
-            chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation(), VISUAL_WAYPOINT,0))
+            chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation(), 0.0f, VISUAL_WAYPOINT,0))
         {
             PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
             delete wpCreature;
@@ -2346,7 +2347,7 @@
                 // re-create
                 Creature* wpCreature2 = new Creature(chr);
                 if (!wpCreature2->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(),
-                    chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation(), VISUAL_WAYPOINT, 0))
+                    chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation(), 0.0f, VISUAL_WAYPOINT, 0))
                 {
                     PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
                     delete wpCreature2;
@@ -2829,9 +2830,9 @@
 
             Player *chr = m_session->GetPlayer();
             float o = chr->GetOrientation();
-
+	    
             Creature* wpCreature = new Creature(chr);
-            if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(), x, y, z, o, id, 0))
+            if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(), x, y, z, o, 0.0f, id, 0))
             {
                 PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
                 delete wpCreature;
@@ -2876,7 +2877,7 @@
         float o = chr->GetOrientation();
 
         Creature* pCreature = new Creature(chr);
-        if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(), x, y, z, o, id, 0))
+        if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(), x, y, z, o, 0.0f, id, 0))
         {
             PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
             delete pCreature;
@@ -2924,7 +2925,7 @@
         float o = chr->GetOrientation();
 
         Creature* pCreature = new Creature(chr);
-        if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(), x, y, z, o, id, 0))
+        if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), chr->GetMapId(), x, y, z, o, 0.0f, id, 0))
         {
             PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
             delete pCreature;
Index: src/game/BattleGround.h
===================================================================
--- src/game/BattleGround.h	(revision 5341)
+++ src/game/BattleGround.h	(working copy)
@@ -355,7 +355,7 @@
         BGCreatures m_BgCreatures;
         void SpawnBGObject(uint32 type, uint32 respawntime);
         bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawntime = 0);
-        Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o);
+        Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, float spawndist);
         bool DelCreature(uint32 type);
         bool DelObject(uint32 type);
         bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team);
Index: src/game/Creature.cpp
===================================================================
--- src/game/Creature.cpp	(revision 5341)
+++ src/game/Creature.cpp	(working copy)
@@ -346,14 +346,15 @@
     return true;
 }
 
-bool Creature::Create (uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 Entry, uint32 team, const CreatureData *data)
+bool Creature::Create (uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, float spawndist, uint32 Entry, uint32 team, const CreatureData *data)
 {
     respawn_cord[0] = x;
     respawn_cord[1] = y;
     respawn_cord[2] = z;
     SetMapId(mapid);
     Relocate(x,y,z);
-
+    m_respawnradius = spawndist;
+    
     if(!IsPositionValid())
     {
         sLog.outError("ERROR: Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",guidlow,Entry,x,y);
@@ -1224,7 +1225,7 @@
     SetInstanceId(InstanceId);
 
     uint16 team = 0;
-    if(!Create(guid,data->mapid,data->posX,data->posY,data->posZ,data->orientation,data->id,team,data))
+    if(!Create(guid,data->mapid,data->posX,data->posY,data->posZ,data->orientation,data->spawndist,data->id,team,data))
         return false;
 
     m_DBTableGuid = stored_guid;