Topic: Editing arms dealers and their inventory  
Azrael

Posted: Jan. 11 2002,12:24   

first of all: emrep deserves credit for the information about the inventory!


their are two parts in the exe, that contain the information about the dealers:
in the first part you find some general information about them, in the second part their inventory.

the offsets of those two parts in different versions of ja2:
(for version 1.06 us you need to remove safedisc protection)

                              general info          inventory
ja2 1.02 ger               0x225c90             0x22f970
ja2 1.02 beta ger        0x226cc0             0x230738
ja2 1.05 ger               0x215e10             0x21f840
ja2 1.06 us                0x230240             0x239cc0
ja2 1.07 us                0x230258             0x239cd8
ja2 beta 0.95 debug    0x3443d0             0x353088



a list of all arms dealers and repairman in ja2

number of character       name
       (hex) (dec)
         5b     91                  tony
         7c   124                  franz
         93   147                  keith
         71   113                  jake cameron
         68   104                  gabby
         3d    61                  devin
         7d   125                  howard
         7e   126                  sam
         5c    92                   frank
         97   151                  herve santos
         98   152                  peter santos
         99   153                  alberto santos
         9a   154                  carlo santos
         60     96                  micky o'brien
         80   128                  arnie
         82   130                  alexander fredo
         4a    74                   perko
         70   112                  charlie
         9b   155                  manny santos




general information about the arms dealers
the record for each character has a length of 20 bytes. for their order in ja2.exe see the list above.

bytes 01-04: factor, that is used to calculate the prices of items, that the character will buy

bytes 05-08: factor, that is used to calculate the prices of items, that the character sells

the gun dealers' prices differ from the normal item prices, that you can edit with w4st wedit for example.
i'm not sure about the exact way, that is used to calculate the prices, but this formula should approximate the price, that is used in the game:
dealer price= price*2^((factor-16256)/2)

i don't know, what these bytes do for repairmen, but it has probably something to do with the time they need to repair an item.


byte 09: number of character

byte 10: possible interactions (00 - buy/sell, 01 - buy only, 02 - sell only, 03 - repair)
please note: if you want to change a character to 'sell only', you must change his inventory as well. it is not possible yet to change a character to 'repair'. their must be some unknown additional information in the exe, that has to be changed for that)

byte 11-12: always 00

byte 13-16: max amount of money the trader will buy stuff for

bytes 17-20: unknown





inventory

the inventories of the dealers don't have a fixed length, but are separated by ff ff 00 00.
their are 4 bytes for each item in stock:

bytes 01-02: item number

bytes 03-04: number of items
(00 00 means, that this item can only be sold; the number of guns is always 01 00)



if you want to support us finding more stuff in ja2.exe, please see this topic

--------------
Azrael