View Single Post
Old 21.04.2005, 06:59   #54
Livid
Архивный участник
 
Join Date: Apr 2005
Posts: 314
Default

Kinda translation... and some of explanation
So, we want to use command //create_pet with 5: Wind strider,6: Star strider,7: Dusk(twilight) strider

So, first of all, function for creating items & stuff for strider.
Just put hex in the l2server.exe ^_^, overwriting old segment
Address Hex ASM translation
Code:
::004245F0:: 83E8 04		SUB	EAX,4 
::004245F3:: 8BC8	 	MOV	ECX,EAX 
::004245F5:: 81C1 2E730F00 	ADD	ECX,F732E 
::004245FB:: 51 		PUSH 	ECX 
::004245FC:: 05 46110000 	ADD 	EAX,1146 
::00424601:: 50 		PUSH 	EAX 
::00424602:: 8B55 0C 		MOV 	EDX,[EBP+C] 
::00424605:: 52 		PUSH 	EDX 
::00424606:: E8 E5841200 	CALL 	0054CAF0 \:JMPDOWN 
::0042460B:: 8B4D F4 	MOV 	ECX,[EBP-C] 
::0042460E:: 5F 		POP 	EDI 
::0042460F:: 5E 		POP 	ESI 
::00424610:: 32C0 		XOR 	AL,AL 
::00424612:: 64:890D 00000000 	MOV 	FS:[0],ECX 
::00424619:: 5B 		POP 	EBX 
::0042461A:: 8BE5	 	MOV 	ESP,EBP 
::0042461C:: 5D 		POP 	EBP 
::0042461D:: C3 		RETN
so that, we need to rewrite hex segment from 004245F0 (in HexWorkshop, etc 000245F0) to 0042461D (0002461D) with following HEX sequence:
83E8 048B C881 C12E 730F 0051 0546 1100 0050 8B55 0C52 E8E5 8412 008B 4DF4 5F5E 32C0 6489 0D00 0000 005B 8BE5 5DC3

Now, function responding to //create_pet command
Code:
::004143DC:: 83F8 06 		CMP 	EAX,6 
::004143DF:: 0F87 D8000000 	JA 	004144BD 	\:JMPDOWN
::004143E5:: FF2485 50CF5B00 	JMP 	[EAX*4+5BCF50] 	<- pointer to func addr table here!
::004143EC:: 8B4D 08 	MOV 	ECX,[EBP+8] 	\:BYJMP JmpBy:004143B4, 
::004143EF:: 68 DCCF5B00 	PUSH 	5BCFDC 		\- : //create_pet 1~3 
::004143F4:: 68 FCCA5B00 	PUSH 	5BCAFC 		\- : SYS 
::004143F9:: E8 B2200F00 	CALL 	005064B0 		\:JMPDOWN\:BYJMP JmpBy:004144D
So that, overwrite segment from 004143DC (000143DC) to 004143F9 (000143F9) with:
83F8 060F 87D8 0000 00FF 2485 50CF 5B00 8B4D 0868 DCCF 5B00 68FC CA5B 00E8 B220 0F00
Actually, you need to chenge much lesser. Compare segments & you'll see what (of course if you don't want to think, just copypaste).

The prev (414500) func addr table was too small (couldn't add any strider pointers), so constructed the addr table again in this 5BCF50 (1BCF50).

old Funcs (starting at 414500 (14500))
00414411 == wolf
0041443C == hatchling of wind
00414467 == hatcling of stars
00414492 == of twilight

new funcs (ok, put it here: 5BCF50 (1BCF50))
00414411 == wolf
0041443C == hatchling of wind
00414467 == hatcling of stars
00414492 == of twilight
004245F0 \
004245F0 | == strider of anyhing (freaking good function!)
004245F0 /

That was an explanaition why are we going to do it. And now, WHAT are we supposed to do:
Put following HEX into segment from 5BCF50 (1BCF50) to 5BCF6B (1BCF6B):
1144 4100 3C44 4100 6744 4100 9244 4100 F045 4200 F045 4200 F045 4200

Actually, ure done.

And now, short explanation again:
::004245F0:: section of code can act according to the parameter.
The bugle function prototype, the address is:
0054CAF0 void CNPC::CreatePet (CSharedCreatureData* to, int nPetCollarClassID, int nPetNpcClassID)

If you want to use also //create_pet 8: wyvern, you'll need to white your own function... I suppose so. Good luck anyways.

So, the final list of changes (in HW, UE etc addreses):
000245F0: 83E8 048B C881 C12E 730F 0051 0546 1100 0050 8B55 0C52 E8E5 8412 008B 4DF4 5F5E 32C0 6489 0D00 0000 005B 8BE5 5DC3
000143DC: 83F8 060F 87D8 0000 00FF 2485 50CF 5B00 8B4D 0868 DCCF 5B00 68FC CA5B 00E8 B220 0F00
001BCF50: 1144 4100 3C44 4100 6744 4100 9244 4100 F045 4200 F045 4200 F045 4200
Don't forget, that you need to OVERWRITE, not INSERT!
Livid is offline