Analyse Diacritique et les D2I

The Falcon

Contributeur
Inscrit
7 Juin 2017
Messages
24
Reactions
0
#1
Bonjour,

Je me suis mis à essayer de comprendre le format des d2i et faire mon propre reader.

Pour l'instant j'arrive à lire toutes les datas.

Pour comprendre le fichier j'ai utilisé ce guide:
https://github.com/OpenDofus/wiki/blob/master/pages/Format-Fichiers-d2i.md

et j'ai analysé en HEX un des d2i: i18n_fr.d2i

Je comprend les index etc mais je bute sur un problème

D'après OpenDofus les indexs sont sous forme:

format.PNG

legend.PNG

Avec si Diacritique = True alors pointeur diacritique en plus à la fin.

Ma question est qu'elle valeur aurait un Byte/Hex si Diacritique = True?
Car quand il est false il n'existe pas exemple:
dia.PNG
KEY = 00 00 00 01 = 1
Pointer = 00 00 00 04 = 4

Mais il y a pas de valeur pour le boolean Diacritique
donc comment savoir si il est False ou True?
 
Inscrit
16 Mars 2014
Messages
214
Reactions
30
#2
Ma question est qu'elle valeur aurait un Byte/Hex si Diacritique = True?
False = 0
True = 1
 
Inscrit
16 Mars 2014
Messages
214
Reactions
30
#4
C'est un d2i quel version déjà ? car il me semble que le bool n'est pas sur les d2i 2.10 et en dessous
 

The Falcon

Contributeur
Inscrit
7 Juin 2017
Messages
24
Reactions
0
#5
C'est un d2i quel version déjà ? car il me semble que le bool n'est pas sur les d2i 2.10 et en dessous
2.10 oui du coup pas de boolean? par contre du coup c'est quoi le code après les indexs:

Exemple:
Code:
* ui.popup.protocolError M
,  ui.asia.header.subscribeLeftTime M
Ž $ui.asia.server.cantChoose.serverFull M
 %ui.asia.charcrea.breedNotAvailable.13 M
’ %ui.asia.charcrea.breedNotAvailable.12 M
” ui.asia.item.characteristics M
– %ui.asia.charcrea.breedNotAvailable.14 M
˜ "ui.asia.connection.loggedInMembers M
š ui.mount.filterNoFecondable M
œ ui.asia.payzone.btn M
² ui.chat.console.help.clear M
´ ui.mount.paddockAbandonned M
Ï ,ui.asia.server.cantChoose.locationRestricted M
â ui.spellInfo.castNeedTakenCell M
 
Inscrit
16 Mars 2014
Messages
214
Reactions
30
#6
Ouvre ton DofusInvoker.swf avec JPEXS et rend toi ici pour avoir la structure de ton d2i pour ta version, avec le code pour le lire "com/ankamagames/jerakine/data/I18nFileAccessor.as"
 

The Falcon

Contributeur
Inscrit
7 Juin 2017
Messages
24
Reactions
0
#7
Ouvre ton DofusInvoker.swf avec JPEXS et rend toi ici pour avoir la structure de ton d2i pour ta version, avec le code pour le lire "com/ankamagames/jerakine/data/I18nFileAccessor.as"
Merci de l'information mais j'essayerais de trouver autrement vu que j'ai pas accès au invoker actuellement.
 
Inscrit
13 Avril 2016
Messages
72
Reactions
0
#8
Merci de l'information mais j'essayerais de trouver autrement vu que j'ai pas accès au invoker actuellement.
Voilà le I18nFileAccessor ;)
Code:
package com.ankamagames.jerakine.data
{
   import com.ankamagames.jerakine.logger.Log;
   import com.ankamagames.jerakine.logger.Logger;
   import com.ankamagames.jerakine.managers.LangManager;
   import com.ankamagames.jerakine.types.Uri;
   import com.ankamagames.jerakine.utils.errors.SingletonError;
   import flash.filesystem.File;
   import flash.filesystem.FileMode;
   import flash.filesystem.FileStream;
   import flash.utils.ByteArray;
   import flash.utils.Dictionary;
   import flash.utils.Endian;
   import flash.utils.getQualifiedClassName;
   
   public class I18nFileAccessor
   {
     
      private static const _log:Logger = Log.getLogger(getQualifiedClassName(I18nFileAccessor));
     
      private static var _self:I18nFileAccessor;
       
     
      private var _stream:FileStream;
     
      private var _indexes:Dictionary;
     
      private var _unDiacriticalIndex:Dictionary;
     
      private var _textIndexes:Dictionary;
     
      private var _textIndexesOverride:Dictionary;
     
      private var _textSortIndex:Dictionary;
     
      private var _startTextIndex:uint = 4;
     
      private var _textCount:uint;
     
      private var _directBuffer:ByteArray;
     
      public function I18nFileAccessor()
      {
         super();
         if(_self)
         {
            throw new SingletonError();
         }
      }
     
      public static function getInstance() : I18nFileAccessor
      {
         if(!_self)
         {
            _self = new I18nFileAccessor();
         }
         return _self;
      }
     
      public function init(param1:Uri) : void
      {
         var _loc6_:int = 0;
         var _loc7_:int = 0;
         var _loc8_:Boolean = false;
         var _loc10_:uint = 0;
         var _loc11_:* = null;
         var _loc2_:File = param1.toFile();
         if(!_loc2_ || !_loc2_.exists)
         {
            throw new Error("I18n file not readable.");
         }
         this._stream = new FileStream();
         this._stream.endian = Endian.BIG_ENDIAN;
         this._stream.open(_loc2_,FileMode.READ);
         this._indexes = new Dictionary();
         this._unDiacriticalIndex = new Dictionary();
         this._textIndexes = new Dictionary();
         this._textIndexesOverride = new Dictionary();
         this._textSortIndex = new Dictionary();
         this._textCount = 0;
         var _loc3_:int = this._stream.readInt();
         var _loc4_:uint = 0;
         this._stream.position = _loc3_;
         var _loc5_:int = this._stream.readInt();
         var _loc9_:uint = 0;
         while(_loc9_ < _loc5_)
         {
            _loc6_ = this._stream.readInt();
            _loc8_ = this._stream.readBoolean();
            _loc7_ = this._stream.readInt();
            this._indexes[_loc6_] = _loc7_;
            _loc4_++;
            if(_loc8_)
            {
               _loc4_++;
               _loc9_ = _loc9_ + 4;
               this._unDiacriticalIndex[_loc6_] = this._stream.readInt();
            }
            else
            {
               this._unDiacriticalIndex[_loc6_] = _loc7_;
            }
            _loc9_ = _loc9_ + 9;
         }
         _loc5_ = this._stream.readInt();
         while(_loc5_ > 0)
         {
            _loc10_ = this._stream.position;
            _loc11_ = this._stream.readUTF();
            _loc7_ = this._stream.readInt();
            this._textCount++;
            this._textIndexes[_loc11_] = _loc7_;
            _loc5_ = _loc5_ - (this._stream.position - _loc10_);
         }
         _loc5_ = this._stream.readInt();
         _loc9_ = 0;
         while(_loc5_ > 0)
         {
            _loc10_ = this._stream.position;
            this._textSortIndex[this._stream.readInt()] = ++_loc9_;
            _loc5_ = _loc5_ - (this._stream.position - _loc10_);
         }
         for(_loc11_ in this._textIndexes)
         {
            LangManager.getInstance().setEntry(_loc11_,this.getNamedText(_loc11_));
         }
         _log.debug("Initialized !");
      }
     
      public function overrideId(param1:uint, param2:uint) : void
      {
         this._indexes[param1] = this._indexes[param2];
         this._unDiacriticalIndex[param1] = this._unDiacriticalIndex[param2];
      }
     
      public function addOverrideFile(param1:Uri) : void
      {
         var rawContent:String = null;
         var f:File = null;
         var fs:FileStream = null;
         var content:XML = null;
         var override:XML = null;
         var file:Uri = param1;
         if(file.fileType == "xml")
         {
            try
            {
               f = file.toFile();
               if(!f.exists)
               {
                  _log.fatal("Le fichier [" + file + "] utiliser lors de la surcharge du fichier i18n n\'existe pas");
                  return;
               }
               fs = new FileStream();
               fs.open(f,FileMode.READ);
               rawContent = fs.readUTFBytes(fs.bytesAvailable);
            }
            catch(e:Error)
            {
               _log.fatal("Impossible de lire le fichier " + file + " lors de la surcharge du fichier i18n : \n" + e.getStackTrace());
               return;
            }
            try
            {
               content = new XML(rawContent);
               for each(override in content..override)
               {
                  if([email protected]() == "" || [email protected]() == "ui")
                  {
                     this._textIndexesOverride[[email protected]()] = override.toString();
                  }
                  else
                  {
                     GameData.addOverride([email protected](),[email protected](),override.toString());
                  }
               }
            }
            catch(e:Error)
            {
               _log.fatal("Erreur lors de la lecture du fichier " + file + " pour la surcharge du fichier i18n : \n" + e.getStackTrace());
            }
            _log.debug("Override done !");
         }
         else
         {
            _log.error("Le fichier d\'override [" + file.fileName + "] n\'est pas un fichier xml.");
         }
      }
     
      public function getOrderIndex(param1:int) : int
      {
         return this._textSortIndex[param1];
      }
     
      public function getText(param1:int) : String
      {
         if(!this._indexes)
         {
            return null;
         }
         var _loc2_:int = this._indexes[param1];
         if(!_loc2_)
         {
            return null;
         }
         if(this._directBuffer == null)
         {
            this._stream.position = _loc2_;
            return this._stream.readUTF();
         }
         this._directBuffer.position = _loc2_;
         return this._directBuffer.readUTF();
      }
     
      public function getUnDiacriticalText(param1:int) : String
      {
         if(!this._unDiacriticalIndex)
         {
            return null;
         }
         var _loc2_:int = this._unDiacriticalIndex[param1];
         if(!_loc2_)
         {
            return null;
         }
         if(this._directBuffer == null)
         {
            this._stream.position = _loc2_;
            return this._stream.readUTF();
         }
         this._directBuffer.position = _loc2_;
         return this._directBuffer.readUTF();
      }
     
      public function hasText(param1:int) : Boolean
      {
         return this._indexes && this._indexes[param1];
      }
     
      public function getNamedText(param1:String) : String
      {
         if(!this._textIndexes)
         {
            return null;
         }
         if(this._textIndexesOverride[param1])
         {
            param1 = this._textIndexesOverride[param1];
         }
         var _loc2_:int = this._textIndexes[param1];
         if(!_loc2_)
         {
            return null;
         }
         this._stream.position = _loc2_;
         return this._stream.readUTF();
      }
     
      public function hasNamedText(param1:String) : Boolean
      {
         return this._textIndexes && this._textIndexes[param1];
      }
     
      public function useDirectBuffer(param1:Boolean) : void
      {
         if(this._directBuffer == null == param1)
         {
            return;
         }
         if(!param1)
         {
            this._directBuffer = null;
         }
         else
         {
            this._directBuffer = new ByteArray();
            this._stream.position = 0;
            this._stream.readBytes(this._directBuffer);
         }
      }
     
      public function close() : void
      {
         if(this._stream)
         {
            try
            {
               this._stream.close();
            }
            catch(e:Error)
            {
            }
            this._stream = null;
         }
         this._indexes = null;
         this._textIndexes = null;
         this._directBuffer = null;
      }
   }
}
 
Haut Bas