Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 17.10.2005, 16:36   #1
Livid
Архивный участник
 
Join Date: Apr 2005
Posts: 314
Default [Tutorial?][HEX] Adding new crystal_type to itemdata

First, I don't know how you can find that. It is just luck or skill or both. I will just explain what do you need to change and why do you need to change that.

Task: add new crystal_type property value. Just add. Nothing more. Hex is a bit incomplete, ex. if you crush item with new cryst. type you will either get crash or bunch of no-crystal thing.

A bit of theory: Server parses all script files and stores them in memory. It stores those in rather... complex format, but most of properties are being saved as word or dword (since c works with numbers faster). There is a function, actually, that converts string assigned to property into numeric value. And it is resided in here : 00567840. So, all we need is to read this function carefully and understand what actually does it do. Consider that as your hometask. I will stop only on moments needed for our task.

Practice?
First, if you read that one carefuly, you can understand how it works. It checks on appropriate string in table and substitutes it with appropriate numeric value.
Also, it makes 80h cycles, meaning that it's for-loop.
This:
Code:
00567849  |.  BE 4C566C00   MOV ESI,L2server.006C564C
gives us a clue where the array (or table if you wish) resides. For those who did not understand, it's in .6C564C.
Second, what's length of our table item and its structure?
Code:
00567850  |> /396E FC       /CMP DWORD PTR DS:[ESI-4],EBP  ;check if table item is referenced to proerty field we have. Notice [esi-4]!
00567853  |. /75 14         |JNE SHORT L2server.00567869  ;if it's not, jump
00567855  |. |8B06          |MOV EAX,DWORD PTR DS:[ESI]  ;Get first element of table item to eax
00567857  |. |85C0          |TEST EAX,EAX ; Check if it's NULL
00567859  |. |74 1A         |JE SHORT L2server.00567875 ; if it is, break; exit; return error.
0056785B  |. |53            |PUSH EBX ;in [EBX] you have string from .txt
0056785C  |. |50            |PUSH EAX ;in EAX you have first element of table item
0056785D  |. |E8 4E350300   |CALL <L2server.cmpstr> ; it is standart VC++ compare string routine. Every hexer should recognize it from first sight. Consider it as your hometask.
00567862  |. |83C4 08       |ADD ESP,8 ; Shift Stack by 8 (2 values we pushed earlier)
00567865  |. |85C0          |TEST EAX,EAX ; Check if function returned NULL*
00567867  |. |74 16         |JE SHORT L2server.0056787F ; If it did, then strings are equal. Exit cycle.
00567869  |> \47            |INC EDI ; increment for-loop variable by one
0056786A  |.  83C6 10       |ADD ESI,10 ; add 10h to table pointer**
0056786D      81FF 80000000 CMP EDI,80 ; check if we've got for-loop variable = 80h
00567873  |.^ 72 DB         \JB SHORT L2server.00567850 ; if not, continue on cycle.
*According to stdcall and Ccall, function stores return value in EAX.
**Which means we increment table item pointer by one. Which means that one table item is 10h = 16 bytes long.

Now, let's see to code which is being executed when we got strings matched.
Code:
0056787F  |> \C1E7 04       SHL EDI,4 ;this actually means "divide EDI by 2^4 and take whole part" = [EDI/16]
00567882  |.  8B87 50566C00 MOV EAX,DWORD PTR DS:[EDI+6C5650] ;EDI+006C564C+4. Obviously, second element of item we exited on.
00567888  |.  8B97 54566C00 MOV EDX,DWORD PTR DS:[EDI+6C5654] ;Obviously, third element of item we exited on.
Then exit function in normal way.
This means that function returns two values in EAX and EDX. First one is dword value of string. Second... I don't know, but in this context it doesn't matter (if you're curious, look what is that in near of .568CB5. That's where this function is being called and EDI is being used).

So, we need
1) add new element to table in format:
(int field, PWideChar StringValue, int DwordValue, int Unknown=0)
2) Increase loop count by one.

Second is easy. Change
Code:
0056786D      81FF 80000000 CMP EDI,80
to
Code:
0056786D      81FF 80000000 CMP EDI,81
First is a bit harder. Just a bit.
I just added it at the end of table, like that:
Code:
006C5E48:  26000000 585E6C00 06000000 00000000
Which means:
int field = 26h (which is crystal_type)
PWideChar StringValue = 6C5E58 = UNICODE 'e'
int DwordValue = 6
int Unknown = 0

It is also possible to move table somewhere else, where is more space if you need it. In this case, we did not.
Well... I think that's all. Any feedback is welcomed.

Software
I usually get asked what soft do I use. I always answer, but it gets annoying, so I want to make it clear.
I use ollydbg 1.10 for debugging, often hexing, usually to post my hexes here.
I use Hex workshop to search for strings and cross-section references.
I use hiew to hex fast fixes in different versions of exes.

Stop. Nothing more.
Livid is offline  
Old 17.10.2005, 17:03   #2
wton
Архивный участник
 
Join Date: May 2005
Posts: 463
Default

thaks for help to comunity.. nice tutorial..

thanks again
wton is offline  
Old 17.10.2005, 19:26   #3
demon
Архивный участник
 
Join Date: May 2005
Posts: 367
Default

Novice
change item 5789,5790,2369,10,6,2370
to crystal_type=e from crystal_type=none
now novice SS can be used only in starting weapons
also edit consume
demon is offline  
Old 18.10.2005, 10:32   #4
Livid
Архивный участник
 
Join Date: Apr 2005
Posts: 314
Default

... Thought I'll bump this thread. Just in case.
166 views and 2 posts...
I fear people look and think: "I don't understand a word" and go out.
Livid is offline  
Old 18.10.2005, 10:55   #5
midnight
Архивный участник
 
Join Date: Jun 2005
Posts: 199
Default

woo coollll, thanks livid
midnight is offline  
Old 18.10.2005, 11:50   #6
Aikeleer
Архивный участник
 
Join Date: Jun 2005
Posts: 374
Default

Quote:
Originally Posted by demon
Novice
change item 5789,5790,2369,10,6,2370
to crystal_type=e from crystal_type=none
now novice SS can be used only in starting weapons
also edit consume
Why do you want to do that? It works for all no-grade weapons on retail...
Aikeleer is offline  
Old 18.10.2005, 12:14   #7
bwgreen
Архивный участник
 
Join Date: Sep 2005
Posts: 408
Default

Starter weapons use soulshot_none_for_rookie etc. I believe he's trying to allow them to use these or something.
bwgreen is offline  
Old 18.10.2005, 12:26   #8
Aikeleer
Архивный участник
 
Join Date: Jun 2005
Posts: 374
Default

Starter weapons use no grade soulshots, the soulshot_none_for_rookie are the same as no grade soulshots, but they just don't weigh as much and you get them with quests. There is no difference in crystal_type on retail; you can use the rookie soulshots with i.e. a comp bow if you'd like.
Aikeleer is offline  
Old 18.10.2005, 12:35   #9
Livid
Архивный участник
 
Join Date: Apr 2005
Posts: 314
Default

I belive you can use rookie soulshots/spiritshots only with limited ammount of weapons. Specifically with some of weapons that do not use normal soulshots/spss.
And you get rookie SS only for tutorial quest (as a part of tutorial actually) that was the point.
Livid is offline  
Old 18.10.2005, 14:13   #10
bwgreen
Архивный участник
 
Join Date: Sep 2005
Posts: 408
Default

ty for clarifying
bwgreen is offline  
Old 18.10.2005, 16:36   #11
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

wow, nice hex livid
torune is offline  
Old 25.12.2005, 01:58   #12
torune
Архивный участник
 
Join Date: Jul 2005
Posts: 371
Default

For some people this might be useful, just finished a dll to do it automaticly
i dont gurantee the code works
Code:
//ITEMDATA
typedef struct{	
	DWORD field;
	LPWSTR string;
	DWORD value;
	DWORD empty;
} ITEMDATA, *LPITEMDATA;

void copyBlock(LPDWORD destination, const DWORD* source, int _size)
{
	for(int i=_size>>2;--i>=0;) {
		*destination = *source;
		destination += 4;
		source += 4;
	}
}

void replaceByte(LPDWORD destination, BYTE data)
{
	*destination = data;
}

L2EXT_API void parseItemData()
{
	int ItemDataType
	LPITEMDATA _lpDwords;
	LPITEMDATA _lpCopy = new ITEMDATA();
	LPDWORD _lpCounter;
	__asm 
	{
		mov _lpDwords, 0x6C5E48;
		mov _lpCounter, 0x56786F;
		mov ItemDataType, eax;
	}
	copyBlock((LPDWORD)_lpCopy, (LPDWORD)_lpDwords, 16);

	_lpDwords->field = 0x26;
	_lpDwords->string = 0x6C5E58;
	_lpDwords->value = 0x06;
	_lpDwords->empty = 0;

	replaceByte(_lpCounter, 0x81);
	__asm {
		push ItemDataType;
		CALL _fnItemDataParser;
		ADD ESP,4;
		push eax
	}

	replaceByte(_lpCounter, 0x80);
	copyBlock((LPDWORD)_lpDwords,(LPDWORD)_lpCopy,  16);
	delete _lpCopy;
	_asm pop eax;
}
torune is offline  
Old 25.12.2005, 23:25   #13
top-gear
Архивный участник
 
Join Date: Aug 2005
Posts: 605
Default

A big thanks to you for your help ^^ Do you guys imagine what would happen if ppl like livid and torune had the c3 source in theri hands.wohooo! Keep up the good work guys
top-gear is offline  
Old 26.12.2005, 15:45   #14
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

Livid and torune, you are the most shared in hexing. Help me if you can in full party - should be a bonus 90% of exp for full paty - in my server have bonus too - 7% (i think so ) question: Where i shold increse parametr for this?

sory for my bad english.

rus Пати бонус - должно быть 90% если полная пати говарят что есть 7% как сделать 90%?
Domzelan is offline  
Old 27.12.2005, 01:00   #15
bwgreen
Архивный участник
 
Join Date: Sep 2005
Posts: 408
Default

try making a new post instead of going offtopic
bwgreen is offline  
Old 27.12.2005, 08:37   #16
TheOrder
Архивный участник
 
Join Date: Sep 2005
Posts: 731
Default

Tnx for the share Livid !!!
TheOrder is offline  
Old 16.01.2006, 10:41   #17
yobzhik
Guest
 
Posts: n/a
Default

Sorry, but i dont find post about novice SS|BSPS...
It deleted ?

P.S. Ill try search - dont found =(
 
Old 16.01.2006, 10:46   #18
bwgreen
Архивный участник
 
Join Date: Sep 2005
Posts: 408
Default

Novice ss/bsps are identical to no graed except for the name.


Could this be used for fishing rods? They all have their own grades and use fishing shots. I know this is for adding a new grade, but what about adding a new wepaon type of ROD?
bwgreen is offline  
Old 16.01.2006, 12:27   #19
Stormi
Архивный участник
 
Join Date: Nov 2005
Posts: 15
Default

Novice ss/bsps are identical to no graed except for the name.

does it mean that any wearpon (not just starter, but any) can be charged with Novice ss/bsps?
Stormi is offline  
Old 16.01.2006, 14:48   #20
Aikeleer
Архивный участник
 
Join Date: Jun 2005
Posts: 374
Default

Yes. That's what I've been saying from the start...
Aikeleer is offline  
Old 16.01.2006, 16:59   #21
yobzhik
Guest
 
Posts: n/a
Default

=(
if you have it, plz mail it to me.
[email protected]
thanks
 
Old 16.01.2006, 21:22   #22
rodier
Архивный участник
 
Join Date: May 2005
Posts: 979
Default

SS for rookie are weaker than normal SS none..
rodier is offline  
Old 17.01.2006, 03:15   #23
elcapo
Архивный участник
 
Join Date: Mar 2005
Posts: 107
Default

Livid, nice Tutorial.
It makes us take courage and start to learn ASM and try to hex L2.
elcapo is offline  
Old 17.01.2006, 23:07   #24
archonus
Архивный участник
 
Join Date: Apr 2005
Posts: 75
Default

livid can u add a new crystal higher than S grade (becouse crystal E is lower than D) , i was thinking on use a new crystal H (for example) for hero weapons , and make a new expertise H for hero , so then can use hero weapons and hero sets
archonus is offline  
Old 18.01.2006, 12:28   #25
bwgreen
Архивный участник
 
Join Date: Sep 2005
Posts: 408
Default

Quote:
Originally Posted by rodier
SS for rookie are weaker than normal SS none..
Wrong. They're exactly the same.



Quote:
Originally Posted by yobzhik
=(

if you have it, plz mail it to me.
[email protected]
thanks
Have what..?
bwgreen 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 18:37.