Jump to content

[BUG] Unknow Pets (Ids Overflow?¿?)


Guest kero99

Recommended Posts

Core Version : 11064 but is old bug since 9500+

Patch: RSA fork now but clean when appear in 9500+

Problem:

For some reason when pet id in characters_pet become over some number of 170XXXXX (actually our last pet have id 17043690), all new pet tamed or learned by warlock become "Unknow Entity" (in my case "Entidad Desconocida"):

[sCREENSHOT REMOVED - DO NOT POST SCREENSHOTS OF COPYRIGHTED CONTENT]

In the other realms with max pet id 15622086 or less, the problem dont appear.

A year ago this problem appeared at same number of id and we solved it with a wipe of pets, because i thought in a corrupted data in my db...

Is strange because pet_id value in DB is int 11 and Objectguid maybe is enougth for these values...

Any ideas?

Link to comment
Share on other sites

pet id is petnumber, not guid low.

For pets guids is dynamic values and start from 0 at server start.

In DB stored petnumbers. In different from creature guids, pet guids have as middle guid part referenced petnumber so petnumber limited by size of middle guid part: max value is 0xFFFFFF = 16777215.

Maybe some compression possible at loading server, no other way prevent petnumbers overflow.

Link to comment
Share on other sites

I made a php script for id reorder:

<?php
#####################################################################################
#
#    MaNGOS PET DEBUGGER WRITTEN BY UNDERGARUN
#
#####################################################################################

$petdebuggerhandler = new MaNGOS_PET_DEBUGGER('host', 'root', 'pass', 'characters', '/var/log/petdebug.log');


######### PLEASE, DO NOT MODIFIED ANYTHING BEYOND THIS POINT #########################

$petdebuggerhandler->rebuildPetGeneralUniqueIdentificators();

class MaNGOS_PET_DEBUGGER
{
   var $connection;
   var $db;
   var $logname;
   var $petlist;
   function __construct($host, $user, $pass, $db, $logpath)
   {
       set_time_limit(0);    // Evitar timeout de ejecución del script.
       error_reporting(E_ALL);
       ini_set('display_errors', '1');
       $this->connection = mysql_connect($host.':3306', $user, $pass) or $this->errorLogMessage('Imposible establecer conexión con mySQL. Info provide => Host: '.$host.' User: '.$user.' Pass: '.$pass.' Mysql err: '.mysql_error($this->connection));
       $this->db = mysql_select_db($db, $this->connection) or $this->errorLogMessage('Imposible establecer conexión con la base de datos: '.$db.' MySQL err: '.mysql_error($this->connection));
       $this->logname = $logpath;
   }
   function __destruct()
   {
       mysql_close($this->connection);    
   }
   /**
   *
   *    Logger functions
   *
   **/
   private function debugLogMessage($msg)
   {
       $logPetition = fopen($this->logname, 'a');
       fwrite($logPetition, '['.date('d/m/Y').']['.date('H:i:s').'][DEBUG]: '.$msg);
       fwrite($logPetition, "\\r\\n");
       fclose($logPetition);
   }
   private function errorLogMessage($msg)
   {
       $logPetition = fopen($this->logname, 'a');
       fwrite($logPetition, '['.date('d/m/Y').']['.date('H:i:s').'][ERROR]: '.$msg);
       fwrite($logPetition, "\\r\\n");
       fclose($logPetition);
   }
   /**
   *
   *    MySQL functions
   *
   **/
   private function BeginTransaction()
   {
       mysql_query('BEGIN', $this->connection);
   }
   private function CommitTransaction()
   {
       mysql_query('COMMIT', $this->connection);
   }
   private function RollbackTransaction()
   {
       mysql_query('ROLLBACK', $this->connection);
       $this->errorLogMessage('There was an error. MySQL errno: '.mysql_errno($this->connection).' MySQL error: '.mysql_error($this->connection).' Rollbacking everything!');
       die('An error happens, please check '.$this->logname);
       exit();
   }
   private function ExecuteQuery($query)
   {
       $executedquery = mysql_query($query, $this->connection) or $this->RollbackTransaction();
       return $executedquery;
   }
   private function FetchArray($resultSet)
   {
       return mysql_fetch_array($resultSet);
   }
   /**
   *
   *    Reorder method
   *
   **/
   public function rebuildPetGeneralUniqueIdentificators()
   {
       $this->debugLogMessage('Starting process...');
       $this->BeginTransaction();
       $this->petlist = $this->ExecuteQuery('SELECT id FROM character_pet ORDER BY id');
       for($itr = 0; $data = $this->FetchArray($this->petlist); $itr++)
       {
           $this->ExecuteQuery("UPDATE character_pet SET id = ".$itr." WHERE id = ".$data['id']."");
           $this->ExecuteQuery("UPDATE pet_spell SET guid = ".$itr." WHERE guid = ".$data['id']."");
           $this->ExecuteQuery("UPDATE pet_spell_cooldown SET guid = ".$itr." WHERE guid = ".$data['id']."");
           $this->debugLogMessage('PET (Guid: '.$data['id'].') relocated to Guid: '.$itr.' successfully!');
       }
       $this->ExecuteQuery("TRUNCATE TABLE pet_aura");
       $this->CommitTransaction();
       $this->debugLogMessage('Process Finished!');
       echo ('Operation completed successfully! You can check the process in '.$this->logname.'.');
   }
}

?>

Link to comment
Share on other sites

petnumbers used for pet auras, pet talents and etc

$this->ExecuteQuery("TRUNCATE TABLE pet_aura");

I truncate pet_aura table but should work with:

$this->ExecuteQuery("UPDATE pet_aura SET guid = ".$itr." WHERE guid = ".$data['id']."");

And as i know pet talents are stored in abdata field in character_pet.

Link to comment
Share on other sites

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