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
Prev Previous Post   Next Post Next
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  
 


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 22:08.