All pastes #956629 Raw Edit

Anonymous

public text v1 · immutable
#956629 ·published 2008-03-25 13:25 UTC
rendered paste body
Index: src/game/GameObject.cpp
===================================================================
--- src/game/GameObject.cpp	(revision 5490)
+++ src/game/GameObject.cpp	(working copy)
@@ -528,9 +528,9 @@
 
 void GameObject::DeleteFromDB()
 {
-    objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
-    objmgr.DeleteGOData(m_DBTableGuid);
-    WorldDatabase.PExecute("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid);
+	objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
+	objmgr.DeleteGOData(m_DBTableGuid);
+	WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid);
 }
 
 GameObject* GameObject::GetGameObject(WorldObject& object, uint64 guid)
Index: src/game/Level2.cpp
===================================================================
--- src/game/Level2.cpp	(revision 5490)
+++ src/game/Level2.cpp	(working copy)
@@ -749,13 +749,21 @@
 
         uint32 lowguid = atoi(cId);
 
-        if(lowguid)
-            pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_GUID(lowguid,HIGHGUID_UNIT));
+		if(!lowguid) 
+			return false;
+ 
+		if(!objmgr.GetCreatureData(lowguid))
+		{
+			PSendSysMessage("nety moba pl9a");
+			return true;
+		}
 
+		pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_GUID(lowguid,HIGHGUID_UNIT));
+
         // Attempting creature load from DB
         if(!pCreature)
-        {
-            QueryResult *result = WorldDatabase.PQuery( "SELECT guid,map FROM creature WHERE guid = '%u'",lowguid);
+		{
+            QueryResult *result = WorldDatabase.PQuery( "SELECT map FROM creature WHERE guid = '%u'",lowguid);
             if(!result)
             {
                 PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid);
@@ -763,9 +771,7 @@
             }
 
             Field* fields = result->Fetch();
-            lowguid = fields[0].GetUInt32();
-
-            uint32 map_id = fields[1].GetUInt32();
+            uint32 map_id = fields[0].GetUInt32();
             delete result;
 
             if(m_session->GetPlayer()->GetMapId()!=map_id)
@@ -774,11 +780,7 @@
                 return true;
             }
         }
-        else
-        {
-            lowguid = pCreature->GetDBTableGUIDLow();
-        }
-    }
+	}
     else
     {
         lowguid = pCreature->GetDBTableGUIDLow();