
//alloc(newmem,2048,"DiabloImmortal.exe"+B50ED2)
//alloc(newmem,2048,"DiabloImmortal.exe"+B5AF02)
//alloc(newmem,2048,"DiabloImmortal.exe"+B56FB2)
//alloc(newmem,2048,"DiabloImmortal.exe"+B57C12)
//alloc(newmem,2048,"DiabloImmortal.exe"+CAA092)
alloc(newmem,2048,"DiabloImmortal.exe"+15BD2EE)


label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:

// 000000 4D 6F 6E 73 74 65 72 000000  Monster

// new rcx+C8 = 00726574 // Monster  PlayerAvatar
// new rcx+E8 = float x
// new rcx+F0 = float y
// new rcx + 38 = r14 = id enemy

// new rdx+70 = 696C635F _realFightState
// new rdx+470 = _teamId text
// new rdx+30 = _teamId text


// rcx + 38 = r14 = id enemy
// [rcx + 38] > 0 = 66 68 npc summon
// rcx+A8 = 736E6F4D // Monster
// rcx+AC = 00726574 // Monster
// rcx+C8 = float x
// rcx+D0 = float y

// rdx = text target or client combat
// rdx+28 = 696C635F _clientCombatSwitch
// rdx+2F = 626D6F43 _clientCombatSwitch
// rdx+28 = 67726174 targetid
// rdx+28 = 69417369 isAiInMaster

// rdx = text target or client combat
// rdx+28 = 696C635F _clientCombatSwitch
// rdx+2F = 626D6F43 _clientCombatSwitch
// rdx+28 = 67726174 targetid
// rdx+28 = 69417369 isAiInMaster

// rdx+28 = 656E776F // ownerid > bi tan cong bat id
// rdx+28 = trang thai text
// rdx+370 = _teamId text

// xor r8d,r8d
mov rcx,[rax+20] // lui lai len crash o cheat engine > ce dung mov rsi,[rax+000001D8]
mov rax,[rcx]
//mov rsi,[rax+000001D8] // cu mov rsi,[rax+000001B8]
      // them mov rcx,[rcx]  // > tach ra de lay rcx = rbx > text monster
// vi thieu bytes jmp > mov rcx,[rax+20]
// mov rcx,rsi



push rax // address
push rcx // address
push rbx // address

mov rax,newmem+500 // Địa chỉ gốc chứa mảng

mov rcx,[rcx]      // Lấy địa chỉ thực của quái
mov rbx,[rax+0]    // Đọc số đếm offset hiện tại (rbx đóng vai trò là biến $i*8)

// 1. LỌC ĐÚNG QUÁI VẬT ("Mons")
cmp dword ptr [rcx+C8],736E6F4D
jne exit01

// 2. ĐIỀU KIỆN DỪNG (Vòng lặp chạy 10 lần)
// Chữ số 48 trong CE được hiểu là 48 Hex (tức 72 hệ thập phân).
// Nếu rbx vượt qua 48 (nghĩa là đã ghi xong slot thứ 10), thì nhảy bỏ qua, KHÔNG GHI NỮA.
cmp rbx,48
ja exit01

// 3. CHỐNG GHI TRÙNG MỘT CON (Chỉ ghi nếu con quái này khác con vừa ghi trước đó)
cmp [rax+rbx+0],rcx
je exit01

// 4. GHI VÀO MẢNG VÀ TĂNG BIẾN ĐẾM
mov [rax+rbx+8],rcx // Ghi rcx vào [rax + 8*$i]
add rbx,8           // Tăng biến đếm lên một nấc 8-byte ($i++)
mov [rax+0],rbx     // Lưu lại biến đếm vào [rax+0] để lần sau gọi còn biết đường chạy tiếp

exit01:
pop rbx
pop rcx
pop rax



exit:
jmp returnhere




//"DiabloImmortal.exe"+B50ED2:
//"DiabloImmortal.exe"+B5AF02:
//"DiabloImmortal.exe"+B56FB2:
//"DiabloImmortal.exe"+B57C12:
//"DiabloImmortal.exe"+CAA092:
"DiabloImmortal.exe"+15BD2EE:

jmp newmem
nop
nop
returnhere:

