Показать сообщение отдельно
Непрочитано 18.07.2013, 10:50   #916
Аватар для Hint
Герой

По умолчанию Re: Работа над Goddess of Destruction (part 5)

Пакет ExUserInfo. Разбирал "на глаз", анализируя трафик, поэтому мог где-нибудь ошибиться. Если заполните пробелы, буду благодарен.

procedure TGameStream.ExUserInfoPacket(Packet: TGamePacket);
var
  I, Flags, Size: Integer;
  Clan: TClan;
 
  function ReadBlockSize(Fixed: Integer = 0): Integer;
  begin
    Result := Packet.ReadH;
    if (Fixed > 0) and (Result <> Fixed) then raise EBadPacket.Create('Invalid block size!');
  end;
 
begin
  with Packet do
    begin
      Player.ObjectId := ReadD;
      ReadH; // Size
      ReadH;
      ReadC;
      Flags := ReadD;
 
      if ((Flags shr 15) and 1) = 1 then
        begin
          ReadD;
        end;
 
      if ((Flags shr 14) and 1) = 1 then // 12, 14?
        begin
          ReadBlockSize;
 
          Player.Name := ReadS2;
          ReadC;
          Player.Race := ReadC;
          Player.Sex := ReadC;
          Player.BaseClassId := ReadD;
          Player.ClassId := ReadD;          
          Player.Level := ReadC;
        end;
 
      if ((Flags shr 13) and 1) = 1 then
        begin
          ReadBlockSize(14);
 
          Player.Str := ReadH;
          Player.Dex := ReadH;
          Player.Con := ReadH;
          Player.Int := ReadH;
          Player.Wit := ReadH;
          Player.Men := ReadH;
        end;
 
      if ((Flags shr 12) and 1) = 1 then // 12, 14?
        begin
          ReadBlockSize(14);
 
          Player.MaxHP := ReadD;
          Player.MaxMP := ReadD;
          Player.MaxCP := ReadD;
        end;
 
      if ((Flags shr 11) and 1) = 1 then
        begin
          ReadBlockSize(38);
 
          Player.HP := ReadD;
          Player.MP := ReadD;
          Player.CP := ReadD;
          Player.SP := ReadQ;
          Player.Exp := ReadQ;
          Player.ExpProgress := ReadF;
        end;
 
      if ((Flags shr 10) and 1) = 1 then
        begin
          ReadBlockSize(3);
 
          ReadC;
        end;
 
      if ((Flags shr 9) and 1) = 1 then // ?
        begin
          ReadBlockSize(15);
 
          Skip(13);
        end;
 
      if ((Flags shr 8) and 1) = 1 then
        begin
          ReadBlockSize(5);
 
          ReadC;
          Player.PrivateStoreType := ReadC;
          ReadC;
        end;
 
      if ((Flags shr 23) and 1) = 1 then
        begin
          ReadBlockSize(56);
 
          ReadH;
          Player.PAtk := ReadD;
          Player.PAtkSpd := ReadD;
          Player.PDef := ReadD;
          Player.EvasionRate := ReadD;
          Player.Accuracy := ReadD;
          Player.CriticalHit := ReadD;
          Player.MAtk := ReadD;
          Player.MAtkSpd := ReadD;
          Player.PAtkSpd := ReadD;
          Player.MAccuracy := ReadD;
          Player.MDef := ReadD;
          Player.MEvasionRate := ReadD;
          Player.MCriticalHit := ReadD;
        end;
 
      if ((Flags shr 22) and 1) = 1 then // 17 or 22
        begin
          ReadBlockSize(14);
 
          Player.Elements.Fire := ReadH;
          Player.Elements.Water := ReadH;
          Player.Elements.Wind := ReadH;
          Player.Elements.Earth := ReadH;
          Player.Elements.Holy := ReadH;
          Player.Elements.Dark := ReadH;
        end;
 
      if ((Flags shr 21) and 1) = 1 then
        begin
          ReadBlockSize(18);
 
          Player.Pos.X := ReadD;
          Player.Pos.Y := ReadD;
          Player.Pos.Z := ReadD;
          ReadD;
        end;
 
      if ((Flags shr 20) and 1) = 1 then // ?
        begin
          ReadBlockSize(18);
 
          for I := 1 to 4 do
            begin
              ReadH; // Run Speed
              ReadH; // Walk Speed
            end;
        end;
 
      if ((Flags shr 19) and 1) = 1 then
        begin
          ReadBlockSize(18);
 
          ReadF;
          ReadF;
        end;
 
      if ((Flags shr 18) and 1) = 1 then // ?
        begin
          ReadBlockSize(18);
 
          ReadF;
          ReadF;
        end;
 
      if ((Flags shr 17) and 1) = 1 then // 17 or 22
        begin
          ReadBlockSize(5);
 
          Player.Elements.AttackType := ReadC;
          Player.Elements.AttackPower := ReadH;
        end;
 
      if ((Flags shr 16) and 1) = 1 then
        begin
          ReadBlockSize;
 
          Player.Title := ReadS2;
          ReadH; // Subdivision
          Player.Clan.Id := ReadD;
          ReadD;
          Player.Clan.CrestId := ReadD;
          ReadD;
          ReadC;
          Player.Clan.AllyId :=ReadD;
          Player.Clan.AllyCrestId := ReadD;
          ReadC; // PartyRoom
        end;
 
      if ((Flags shr 31) and 1) = 1 then
        begin
          ReadBlockSize(22);
 
          Skip(12);
          Player.PvP := ReadD;
          Player.Recomendations := ReadH;
          ReadH;
        end;
 
      if ((Flags shr 30) and 1) = 1 then // ?
        begin
          Size := ReadBlockSize;
 
          Skip(Size - 2);
        end;
 
      if ((Flags shr 29) and 1) = 1 then // ?
        begin
          Size := ReadBlockSize;
 
          Skip(Size - 2);
        end;
 
      if ((Flags shr 28) and 1) = 1 then
        begin
          ReadBlockSize(4);
 
          ReadC;
          Player.IsStanding := ReadBoolC;
        end;
 
      if ((Flags shr 27) and 1) = 1 then // ?
        begin
          ReadBlockSize(10);
 
          Player.NameColor := ReadD;
          Player.TitleColor := ReadD;
        end;
 
      if ((Flags shr 26) and 1) = 1 then // ?
        begin
          Size := ReadBlockSize;
 
          Skip(Size - 2);
        end;
 
      if ((Flags shr 25) and 1) = 1 then // ?
        begin
          Size := ReadBlockSize;
 
          Skip(Size - 2);
        end;
 
      EndOfPacket;
    end;       
 
  ...
end;
Code: Pascal
__________________
hLaPEx, Evermore, hAuthD, L2on, ...

Последний раз редактировалось Hint; 18.07.2013 в 12:09.
Hint вне форума
Сказали спасибо: