Editing LDC File Format Specification

From LOTR-TCG Wiki
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
=LDC File Format Specification=
=LDC File Format Specification=
The *.ldc file format is a decklist format used exclusively by the [[Lord of the Rings Online]] software produced by Decipher and Worlds Apart. It is a proprietary format, recently analyzed and picked apart to facilitate conversion of *.ldc decks into more modern and useable formats.
The *.ldc file format is a decklist format used exclusively by the[[Lord of the Rings Online]] software produced by Decipher and Worlds Apart. It is a proprietary format, recently analyzed and picked apart to facilitate conversion of *.ldc decks into more modern and useable formats.


A collection of decks that entered various tournaments can be found [[http://lotrtcgwiki.com/forums/index.php?topic=====8730.new|in this TLHH post here]] if you'd like to follow along. If you intend to write a parser, be sure to get the copy of LotR-O in that same post; the various installers floating around do not include any updates and so only contain sets 1-13.   
A collection of decks that entered various tournaments can be found[[http://lotrtcgwiki.com/forums/index.php?topic=====8730.new|in this TLHH post here]] if you'd like to follow along. If you intend to write a parser, be sure to get the copy of LotR-O in that same post; the various installers floating around do not include any updates and so only contain sets 1-13.   


==Format Quirks==
==Format Quirks==
Line 16: Line 16:


   0a  42 72 69 61 6E 5F 46 72 65 64 00
   0a  42 72 69 61 6E 5F 46 72 65 64 00
  [10] B  R  I  A  N  _  F  R  E  D  \0
[10] B  R  I  A  N  _  F  R  E  D  \0
    
    
===Length Format===
===Length Format===
Line 49: Line 49:
* Free Peoples deck - 1+ bytes
* Free Peoples deck - 1+ bytes
* Shadow deck - 1+ bytes
* Shadow deck - 1+ bytes
* [[Adventure deck]] - 1+ bytes
*[[Adventure deck]] - 1+ bytes
* Starting Fellowship - 1+ bytes
* Starting Fellowship - 1+ bytes
* Footer - 2 bytes
* Footer - 2 bytes
Line 85: Line 85:
The Free Peoples deck marks the first of four card arrays, which are all recorded in the same straightforward style.   
The Free Peoples deck marks the first of four card arrays, which are all recorded in the same straightforward style.   


Each array is prefaced by the length, which is the dynamic 1- or 2-byte length described [[ldc_file_format_specification#length_format|above]].  The length describes the number of cards it contains, and not the number of bytes (as this varies from card to card).  There is no null terminator at the end.  If there are no cards in the array, a single null byte (doubling as the length of the array) takes its place.
Each array is prefaced by the length, which is the dynamic 1- or 2-byte length described[[ldc_file_format_specification#length_format|above]].  The length describes the number of cards it contains, and not the number of bytes (as this varies from card to card).  There is no null terminator at the end.  If there are no cards in the array, a single null byte (doubling as the length of the array) takes its place.
    
    
===Shadow deck===
===Shadow deck===
Line 178: Line 178:
So now we've seen how decks are recorded, and how cards are recorded within decks, but how best to use this information?  First we need to gather some bird's-eye data.  I've taken the liberty of grabbing the major information that defines each set; this information was obtained by making a deck with one card from each set, with that card being one of the first 15.  This gives us the set's Identifier Byte as well as the Sequence Byte for the first group of 16.  All of this data is below:
So now we've seen how decks are recorded, and how cards are recorded within decks, but how best to use this information?  First we need to gather some bird's-eye data.  I've taken the liberty of grabbing the major information that defines each set; this information was obtained by making a deck with one card from each set, with that card being one of the first 15.  This gives us the set's Identifier Byte as well as the Sequence Byte for the first group of 16.  All of this data is below:


 
Set Name  ^ Set #  ^ First Sequence Byte  ^ Identifier Byte  ^ First Foil Sequence Byte  ^ Foil Identifier Byte ^
{| class="wikitable"
|  Promotional  |  0  |  -  |  -  |  0x42  |  0x49   
|-
|  Tengwar  |  ~  |  0x71  |  0x02  |  -  |  -   
! Set Name  !! Set #  !! First Sequence Byte  !! Identifier Byte  !! First Foil Sequence Byte  !! Foil Identifier Byte  
|  W-Series 1  |  W  |  0x71  |  0x18  |  -  |  -   
|-
|  W-Series 2  |  W  |  0xa8  |  0x61  |  -  |  -   
|  Promotional  ||  0  ||  -  ||  -  ||  0x42  ||  0x49   
|  Fellowship of the Ring  |  1  |  0x24  |  0xF4  |  0x62  |  0x3D   
|-
|  Mines of Moria  |  2  |  0x48  |  0xE8  |  0x86  |  0x31   
|  Tengwar  ||  ~  ||  0x71  ||  0x02  ||  -  ||  -   
|  Realms of the Elf-lords  |  3  |  0x6C  |  0xDC  |  0xAA  |  0x25   
|-
|  The Two Towers  |  4  |  0x90  |  0xD0  |  0xCE  |  0x19   
|  W-Series 1  ||  W  ||  0x71  ||  0x18  ||  -  ||  -   
|  Battle of Helm's Deep  |  5  |  0xB4  |  0xC4  |  0xF2  |  0x0D   
|-
|  Ents of Fangorn  |  6  |  0xD8  |  0xB8  |  0x16  |  0x02   
|  W-Series 2  ||  W  ||  0xa8  ||  0x61  ||  -  ||  -   
|  Return of the King  |  7  |  0xFC  |  0xAC, 0xAD  |  0x3A  |  0xF6   
|-
|  Siege of Gondor  |  8  |  0x20  |  0xA1  |  0x5E  |  0xEA   
|  Fellowship of the Ring  ||  1  ||  0x24  ||  0xF4  ||  0x62  ||  0x3D   
|  Reflections  |  9  |  -  |  -  |  0x82  |  0xDE   
|-
| [[Mount Doom]]  |  10  |  0x68  |  0x89  |  0xA6  |  0xD2   
|  Mines of Moria  ||  2  ||  0x48  ||  0xE8  ||  0x86  ||  0x31   
|  Shadows  |  11  |  0x8C  |  0x7D  |  0xCA  |  0xC6   
|-
| [[Black Rider]]  |  12  |  0xB0  |  0x71  |  0xEE  |  0xBA   
|  Realms of the Elf-lords  ||  3  ||  0x6C  ||  0xDC  ||  0xAA  ||  0x25   
|  Bloodlines  |  13  |  0xD4  |  0x65  |  0x12  |  0xAF   
|-
|  Expanded Middle-earth  |  14  |  -  |  -  |  0x36  |  0xA3   
|  The Two Towers  ||  4  ||  0x90  ||  0xD0  ||  0xCE  ||  0x19   
|  The Hunters  |  15  |  0x1E  |  0x4E  |  0x5A  |  0x97   
|-
|  The Wraith Collection  |  16  |  -  |  -  |  0x7E  |  0x8B   
|  Battle of Helm's Deep  ||  5  ||  0xB4  ||  0xC4  ||  0xF2  ||  0x0D   
|  Rise of Saruman  |  17  |  0x64  |  0x36  |  0xA2  |  0x7F   
|-
| [[Treachery & Deceit]]  |  18  |  0x88  |  0x2A  |  0xC6  |  0x73   
|  Ents of Fangorn  ||  6  ||  0xD8  ||  0xB8  ||  0x16  ||  0x02   
| [[Age's End]]  |  19  |  0xAC  |  0x1E  |  0xEA  |  0x67   
|-
|  Return of the King  ||  7  ||  0xFC  ||  0xAC, 0xAD  ||  0x3A  ||  0xF6   
|-
|  Siege of Gondor  ||  8  ||  0x20  ||  0xA1  ||  0x5E  ||  0xEA   
|-
|  Reflections  ||  9  ||  -  ||  -  ||  0x82  ||  0xDE   
|-
[[Mount Doom]]  ||  10  ||  0x68  ||  0x89  ||  0xA6  ||  0xD2   
|-
|  Shadows  ||  11  ||  0x8C  ||  0x7D  ||  0xCA  ||  0xC6   
|-
[[Black Rider]]  ||  12  ||  0xB0  ||  0x71  ||  0xEE  ||  0xBA   
|-
|  Bloodlines  ||  13  ||  0xD4  ||  0x65  ||  0x12  ||  0xAF   
|-
|  Expanded Middle-earth  ||  14  ||  -  ||  -  ||  0x36  ||  0xA3   
|-
|  The Hunters  ||  15  ||  0x1E  ||  0x4E  ||  0x5A  ||  0x97   
|-
|  The Wraith Collection  ||  16  ||  -  ||  -  ||  0x7E  ||  0x8B   
|-
|  Rise of Saruman  ||  17  ||  0x64  ||  0x36  ||  0xA2  ||  0x7F   
|-
[[Treachery & Deceit]]  ||  18  ||  0x88  ||  0x2A  ||  0xC6  ||  0x73   
|-
[[Age's End]]  ||  19  ||  0xAC  ||  0x1E  ||  0xEA  ||  0x67   
|}


There's a couple of things that jump out from the data so arranged.  First, the Sequence Bytes get steadily larger from each set to the next.  This suggests that the game client kept all the cards in a giant list, and so the Sequence Byte represented an offset to this giant table, with the Repeating Byte further narrowing it down.  In that case it also seems that the foil sets would fit interlockingly between the normal sets, which would be a mess if the list ever needed manual modification, but isn't really a problem when you're using a table lookup anyway.
There's a couple of things that jump out from the data so arranged.  First, the Sequence Bytes get steadily larger from each set to the next.  This suggests that the game client kept all the cards in a giant list, and so the Sequence Byte represented an offset to this giant table, with the Repeating Byte further narrowing it down.  In that case it also seems that the foil sets would fit interlockingly between the normal sets, which would be a mess if the list ever needed manual modification, but isn't really a problem when you're using a table lookup anyway.
Line 246: Line 219:
The multipliers for each set are below, in decimal:
The multipliers for each set are below, in decimal:


{| class="wikitable"
Regular Sets  ^ Multiplier ^
|-
|  Promotional (2-byte)  |  117   
! Regular Sets  !! Multiplier
|  Fellowship of the Ring  |  40   
|-
|  Mines of Moria  |  78   
|  Promotional (2-byte)  ||  117   
|  Realms of the Elf-Lords  |  114   
|-
|  The Two Towers  |  150   
|  Fellowship of the Ring  ||  40   
|  Battle of Helm's Deep  |  186   
|-
|  Ents of Fangorn  |  222   
|  Mines of Moria  ||  78   
|  Return of the King 1  |  258   
|-
|  Return of the King 2  |  2   
|  Realms of the Elf-Lords  ||  114   
|  Siege of Gondor  |  38   
|-
|  Reflections  |  136   
|  The Two Towers  ||  150   
| [[Mount Doom]]  |  110   
|-
|  Shadows  |  146   
|  Battle of Helm's Deep  ||  186   
| [[Black Rider]]  |  182   
|-
|  Bloodlines  |  218   
|  Ents of Fangorn  ||  222   
|  Expanded Middle-Earth  |  60   
|-
|  The Hunters  |  34   
|  Return of the King 1  ||  258   
|  The Wraith Collection  |  132   
|-
|  Rise of Saruman  |  106   
|  Return of the King 2  ||  2   
|  Treachery & Deceit  |  142   
|-
|  Age's End  |  178   
|  Siege of Gondor  ||  38   
|-
|  Reflections  ||  136   
|-
[[Mount Doom]]  ||  110   
|-
|  Shadows  ||  146   
|-
[[Black Rider]]  ||  182   
|-
|  Bloodlines  ||  218   
|-
|  Expanded Middle-Earth  ||  60   
|-
|  The Hunters  ||  34   
|-
|  The Wraith Collection  ||  132   
|-
|  Rise of Saruman  ||  106   
|-
|  Treachery & Deceit  ||  142   
|-
|  Age's End  ||  178   
|-
|}
 
{| class="wikitable"
|-
! Foil Sets  !!  Multiplier
|-
|  Promotional (3-byte)  ||  66 
|-
|  Fellowship of the Ring  ||  104 
|-
|  Mines of Moria  ||  140 
|-
|  Realms of the Elf-Lords  ||  176 
|-
|  The Two Towers  ||  212 
|-
|  Battle of Helm's Deep  ||  248 
|-
|  Ents of Fangorn  ||  28 
|-
|  Return of the King  ||  64 
|-
|  Siege of Gondor  ||  100 
|-
|  [[Mount Doom]]  ||  172 
|-
|  Shadows  ||  208 
|-
|  [[Black Rider]]  ||  244 
|-
|  Bloodlines  ||  24 
|-
|  The Hunters  ||  96
|-
|  Rise of Saruman  ||  168 
|-
|  Treachery & Deceit  ||  204 
|-
|  Age's End  ||  240 
|-
|  D-series  ||  22 
|-
|  W-series 1  ||  110 
|-
|  W-series 2  ||  172 
|-
|  Tengwar  ||  117
|-
|}


^  Foil Sets  ^  Multiplier  ^
|  Promotional (3-byte)  |  66 
|  Fellowship of the Ring  |  104 
|  Mines of Moria  |  140 
|  Realms of the Elf-Lords  |  176 
|  The Two Towers  |  212 
|  Battle of Helm's Deep  |  248 
|  Ents of Fangorn  |  28 
|  Return of the King  |  64 
|  Siege of Gondor  |  100 
| [[Mount Doom]]  |  172 
|  Shadows  |  208 
| [[Black Rider]]  |  244 
|  Bloodlines  |  24 
|  The Hunters  |  96  | 
|  Rise of Saruman  |  168 
|  Treachery & Deceit  |  204 
|  Age's End  |  240 
|  D-series  |  22 
|  W-series 1  |  110 
|  W-series 2  |  172 
|  Tengwar  |  117 


All of them are even except for the Promotional sets, which can be explained by the fact that the Promotional set has one byte's worth of cards that use the 1-byte system and that byte needs to be subtracted from the multiplier.   
All of them are even except for the Promotional sets, which can be explained by the fact that the Promotional set has one byte's worth of cards that use the 1-byte system and that byte needs to be subtracted from the multiplier.   
Line 360: Line 282:
In both cases, there's simply nothing to be done but to have a lookup table that the fake set and card numbers line up to.  I have taken the liberty of compiling the values for the Tengwar cards below:
In both cases, there's simply nothing to be done but to have a lookup table that the fake set and card numbers line up to.  I have taken the liberty of compiling the values for the Tengwar cards below:


{| class="wikitable"
Fake #  ^ Actual Card  ^ Fake #  ^ Actual Card ^
|-
|  1  |  01001T  |  29  |  04090T   
! Fake #  !! Actual Card  !! Fake #  !! Actual Card
|  2  |  01013T  |  30  |  04100T   
|-
|  3  |  01014T  |  31  |  06088T   
|  1  ||  01001T  ||  29  ||  04090T   
|  4  |  01030T  |  32  |  04219T   
|-
|  5  |  01050T  |  33  |  04176T   
|  2  ||  01013T  ||  30  ||  04100T   
|  6  |  01072T  |  34  |  04225T   
|-
|  7  |  01083T  |  35  |  04019T   
|  3  ||  01014T  ||  31  ||  06088T   
|  8  |  01089T  |  36  |  04289T   
|-
|  9  |  01096T  |  37  |  05116T   
|  4  ||  01030T  ||  32  ||  04219T   
|  10  |  01114T  |  38  |  07002T   
|-
|  11  |  01127T  |  39  |  07211T   
|  5  ||  01050T  ||  33  ||  04176T   
|  12  |  01165T  |  40  |  07221T   
|-
|  13  |  01231T  |  41  |  07227T   
|  6  ||  01072T  ||  34  ||  04225T   
|  14  |  01237T  |  42  |  07321T   
|-
|  15  |  01256T  |  43  |  07324T   
|  7  ||  01083T  ||  35  ||  04019T   
|  16  |  02052T  |  44  |  08015T   
|-
|  17  |  02102T  |  45  |  08025T   
|  8  ||  01089T  ||  36  ||  04289T   
|  18  |  02105T  |  46  |  08038T   
|-
|  19  |  04001T  |  47  |  08051T   
|  9  ||  01096T  ||  37  ||  05116T   
|  20  |  04073T  |  48  |  08057T   
|-
|  21  |  04364T  |  49  |  08103T   
|  10  ||  01114T  ||  38  ||  07002T   
|  22  |  05029T  |  50  |  10006T   
|-
|  23  |  05025T  |  51  |  10009T   
|  11  ||  01127T  ||  39  ||  07211T   
|  24  |  04154T  |  52  |  10025T   
|-
|  25  |  04173T  |  53  |  10088T   
|  12  ||  01165T  ||  40  ||  07221T   
|  26  |  04301T  |  54  |  10122T   
|-
|  27  |  05100T  |  55  |  07079T   
|  13  ||  01231T  ||  41  ||  07227T   
|  28  |  04103T  | |  
|-
|  14  ||  01237T  ||  42  ||  07321T   
|-
|  15  ||  01256T  ||  43  ||  07324T   
|-
|  16  ||  02052T  ||  44  ||  08015T   
|-
|  17  ||  02102T  ||  45  ||  08025T   
|-
|  18  ||  02105T  ||  46  ||  08038T   
|-
|  19  ||  04001T  ||  47  ||  08051T   
|-
|  20  ||  04073T  ||  48  ||  08057T   
|-
|  21  ||  04364T  ||  49  ||  08103T   
|-
|  22  ||  05029T  ||  50  ||  10006T   
|-
|  23  ||  05025T  ||  51  ||  10009T   
|-
|  24  ||  04154T  ||  52  ||  10025T   
|-
|  25  ||  04173T  ||  53  ||  10088T   
|-
|  26  ||  04301T  ||  54  ||  10122T   
|-
|  27  ||  05100T  ||  55  ||  07079T   
|-
|  28  ||  04103T  || ||
|-
|}


In the case of the D-Series card(s), only 1 of them is exposed within the client, and being as they are not used ''anywhere'' outside of LotR-O, I have left determination of any values for those card(s) as an exercise to the reader.
In the case of the D-Series card(s), only 1 of them is exposed within the client, and being as they are not used ''anywhere'' outside of LotR-O, I have left determination of any values for those card(s) as an exercise to the reader.
Line 426: Line 316:
<sub>Article and research originally by teltura</sub>
<sub>Article and research originally by teltura</sub>


{{:Electronic_Platform_Table}}
{{:electronic_platform_table}}
&nbsp;
Please note that all contributions to the LOTR-TCG Wiki may be edited, altered, or removed by other contributors. Your writing is liable to be edited mercilessly, so be sure to back up any major claims with links if possible.

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)