All pastes #65088 Raw Edit

Untitled

public text v1 · immutable
#65088 ·published 2006-06-13 11:53 UTC
rendered paste body
region grid reference formula 
X-axis ( X-20) *32768,(X-20+1)*32768 
Y-axis ( Y-18 ) *32768,(Y-18+1)*32768 

e.g water city (23_24), 
(X-20 ) *32768,(X-20+1 ) *32768 = 98304, 131072 
(Y-18 ) *32768,(Y-18+1 ) *32768-1 = 196608, 229376 

23_24 region is within grid reference 


(98304,196608) (98304,229376) (131072,229376) (131072,196608) 


grid 20_18 is 0_0 ingame 


(real ingame X / 32768 ) + 20 for X 
(real ingame Y / 32768 ) + 18 for Y 

and round down to nearest int 

the bloacks are stored like so in the file. 

1  9 17 25 33 41 49 57 
2 10 18 26 34 42 50 58 
3 11 19 27 35 43 51 59 
4 12 20 28 36 44 52 60 
5 13 21 29 37 45 53 61 
6 14 22 30 38 46 54 62 
7 15 23 31 39 47 55 63 
8 16 24 32 40 48 56 64 

X = ->
y = ^

104304 = 3.183105469 + 20 = 23.183105469 (round to lowest int) 
200608 = 6.183105469 + 18 = 24.183105469 (round to lowest int) 

we can see we are at grid 23_24 

now work out the 0,0 values for 23,24 

3 * 32768 = 98304
6 * 32768 = 196608

x = 98304 
y = 196608 

we can now subtract the 0,0 from the real players x,y 

104304 - 98304 = 6000 (2nd column) 
200608 - 196608 = 4000 (1st row) 

next we divide these by 4096 ( the grid size we use in our files) 

so we KNOW that our block is at 4,6 = 30	= 3*8+6
so we KNOW that our block is at 1,1 = 1		= 0*8+1
so we KNOW that our block is at 7,7 = 55    	= 6*8+7
so we KNOW that our block is at 2,1 = 9    	= 1*8+1


( x )(6000/4096) = 1.46 (round up) = 2
( y )(4000/4096) = .89  (round up) = 1

( ( x * 8 ) -1) + ( y ) = grid number = 9

Now we need to convert this to our l2jgrid.world which is 88 * 128

we know we have the

23_24 for our initial start so we subract 16_10 this is the top right grid

this gives us

07 _ 14

we know each conv.dat is 32768 so we can work out our initial file

7 * 32768 / 4096 = 56
14 * 32768 / 4096 = 112

now we know the sub values how inside this

x and y were 2 and 1

so we know its 
2 * 4096 to add to the x
1 * 4096 to add to the y

 56 + 2 =  58
112 + 1 = 113

so from our real ingame x(104304),y(200608) 

we now know our l2jgrid.world x,y coord as well as the file name

file 23_24_l2jgrid.world and load offset 9

switch on l2jgrid(58,113)