Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Server Modifications ONLY!
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 22.12.2005, 08:53   #1
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default command /loc fix



basicly, the idea is from l2j, big thx to them

(following info are from L2j and L2jDatapack team)
Quote:
SQL:
INSERT INTO `mapregion` VALUES (0,3,3,3,3,3,4,4,4,4,4);
INSERT INTO `mapregion` VALUES (1,3,3,3,3,3,4,4,4,4,4);
INSERT INTO `mapregion` VALUES (2,3,3,3,3,3,4,4,4,4,4);
INSERT INTO `mapregion` VALUES (3,3,3,3,3,3,4,4,4,4,4);
INSERT INTO `mapregion` VALUES (4,3,3,3,3,3,4,4,4,4,4);
INSERT INTO `mapregion` VALUES (5,3,3,3,3,3,4,4,4,4,4);
INSERT INTO `mapregion` VALUES (6,3,3,3,3,3,4,4,4,4,4);
INSERT INTO `mapregion` VALUES (7,3,3,3,3,3,4,4,4,4,4);
INSERT INTO `mapregion` VALUES (8,3,3,3,3,3,4,4,4,4,4);
INSERT INTO `mapregion` VALUES (9,2,2,2,2,2,2,9,9,10,10);
INSERT INTO `mapregion` VALUES (10,2,2,2,2,2,9,9,10,10,10);
INSERT INTO `mapregion` VALUES (11,2,2,2,2,1,1,9,11,10,10);
INSERT INTO `mapregion` VALUES (12,6,6,2,5,1,1,9,11,11,11);
INSERT INTO `mapregion` VALUES (13,6,6,5,5,7,7,8,8,8,8);
INSERT INTO `mapregion` VALUES (14,6,6,6,5,7,7,8,8,8,8);
INSERT INTO `mapregion` VALUES (15,0,6,6,5,7,12,8,8,13,13);
INSERT INTO `mapregion` VALUES (16,0,0,6,6,12,12,13,13,13,13);
INSERT INTO `mapregion` VALUES (17,0,0,0,0,0,0,13,13,13,13);

private final int[][] _regions = new int[19][21];

private MapRegionTable()
{
region = rset.getInt(1);

for (int j=0; j<10; j++)
{
_regions[j][region] = rset.getInt(j+2);
}
}
private int getMapRegion(int posX, int posY)
{
int tileX = ( posX >> 15 ) + 4;// + centerTileX;
int tileY = ( posY >> 15 ) + 10;// + centerTileY;
//_log.fine(tileX+" : "+tileY);
return _regions[tileX][tileY];
}

int _nearestTown=MapRegionTable.getInstance().getClose stTownNumber(activeChar);
int msg = 0;
switch (_nearestTown)
{
case 0: msg = SystemMessage.LOC_TI_S1_S2_S3; break;
case 1: msg = SystemMessage.LOC_ELVEN_S1_S2_S3; break;
case 2: msg = SystemMessage.LOC_DARK_ELVEN_S1_S2_S3; break;
case 3: msg = SystemMessage.LOC_ORC_S1_S2_S3; break;
case 4: msg = SystemMessage.LOC_DWARVEN_S1_S2_S3; break;
case 5: msg = SystemMessage.LOC_GLUDIO_S1_S2_S3; break;
case 6: msg = SystemMessage.LOC_GLUDIN_S1_S2_S3; break;
case 7: msg = SystemMessage.LOC_DION_S1_S2_S3; break;
case 8: msg = SystemMessage.LOC_GIRAN_S1_S2_S3; break;
case 9: msg = SystemMessage.LOC_OREN_S1_S2_S3; break;
case 10: msg = SystemMessage.LOC_ADEN_S1_S2_S3; break;
case 11: msg = SystemMessage.LOC_HUNTER_S1_S2_S3; break;
case 12: msg = SystemMessage.LOC_GIRAN_HARBOR_S1_S2_S3; break;
case 13: msg = SystemMessage.LOC_HEINE_S1_S2_S3; break;
default: msg = SystemMessage.LOC_ADEN_S1_S2_S3;
}
okey, lets get starting

you need to have 2 free spaces for 2 arraies
1. for storage _regions
2. for the message that gotta send back to client

19*21 = 399
you need 399*4 bytes for _regions
and appoximate 14*4 bytes for message id

lets say you store the data at 0x002de620 for _regions
and 0x002df620 for messageid

expand old loc code, store posX, and posY;
Code:
		FLD QWORD PTR DS:[EBX+0x10];
		call _fnCalculatePosition;
		push eax;
		mov posY, eax;
		push 1;		
		FLD QWORD PTR DS:[EBX+0x08];
		call _fnCalculatePosition;
		push eax;
		mov posX, eax;
		push 1;
before the message id get push into stack
you
Code:
		shr posX, 15;
		add posX, 4;
		and posX, 31; 
		shr posY, 15;
		add posY, 10;
		and posY, 31; (to avoid the problem that comes with  negative value after been shift to right)
then you calculate the real offset of value in the _regions table

Code:
	int RToffset = (posY*_RTable_Y+posX);
	RToffset = RToffset*4;
after it get calculated

Code:
		mov eax, offset _regions;(0x002de620 will be assigned to eax)
		mov eax, dword ptr DS:[eax+RToffset]; (get the value)
		mov _region, eax;
		push _LOC_MSG[_region]; 
		push 7a;
............
good luck, guys
torune is offline  
Old 22.12.2005, 09:03   #2
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

oh btw, remember do some range check
torune is offline  
Old 22.12.2005, 09:40   #3
TheOrder
Архивный участник
 
Join Date: Sep 2005
Posts: 731
Default Happily surprised !!!

Torune like always you amaze me , i thought you left the community there for 1 sec but i am so happy you are still helping !!! GJ and tnx for all !!! You're fixes and geodata are the best !!!
TheOrder is offline  
Old 22.12.2005, 10:27   #4
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

though i envy you and your knowledge (:P) i must say this is really good...
as always

thx again
toolpunk is offline  
Old 22.12.2005, 14:27   #5
top-gear
Архивный участник
 
Join Date: Aug 2005
Posts: 605
Default

A big thanks to you
top-gear is offline  
Old 24.12.2005, 10:48   #6
rodier
Архивный участник
 
Join Date: May 2005
Posts: 979
Default

it is possible to fix //stoplogin?
rodier is offline  
Old 24.12.2005, 11:03   #7
l2online
Архивный участник
 
Join Date: Nov 2005
Posts: 16
Default

well i became far but i didn't follow any assembler tutorial....

i know that /loc function is defined at offset: '006b84c0'
But hell not know where i have to let it call offset: '002df620'
said in your tutorial...
torune perhaps you have a good website with a tutorial about asm?
l2online is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:55.