How to check if a mob is alive/dead

04/13/2022 00:52 theashmaster#1
Hey guys!

I'd like to know if there's any function in the source that I can use to check if a mob is alive or dead or at least it's current HP.

I'm making a simple waithack, but when I send too many packets to the server I get disconnected. I think that if I stop send packets after the mobs are dead, I can increase the speed of the cheat, cause in the current state my hack keeps sending packets for a few seconds after the mobs died until their VID is 'unregistered'.

My first approach was hooking the RecvDeadPacket and get the VID of the mob. But I think this is too slow, cause I need to iterate through the whole mob list to remove the VID.

I also tried to call isAlive, isDead and isRegistered functions, which are called in GetVIDInfo function. But it simply returns 1 until VID is unregistered (isDead always returns 0).

Even if it doesn't work for my main goal, I'd like to know a function/approach to get this info for learning purposes.

Thanks in advance.
04/13/2022 07:59 br4ve-trave1er.asf#2
Quote:
Originally Posted by theashmaster View Post
My first approach was hooking the RecvDeadPacket and get the VID of the mob. But I think this is too slow, cause I need to iterate through the whole mob list to remove the VID.
maybe post the code?

current hp is not a good approach as entities can be healed while in death state, so dead mobs could be hit again if they have tp regeneration or tp absorborbtion (eg. grotto2 mobs)
04/13/2022 08:41 Affenmaster02#3
There is a really short time period (1s) where is dead actually returns 1 before unregistering the VID.

But that's nowhere usable.

I dunno.
Exlib does it via C++, I don't think it's possible with pure python,

Unless you capture the "current target" hotbar on the top, and "check" the percentage for the selected mob.
That might be possible, but only for one mob at a time.

Oh and the "tab" hotkey can only select alive mobs. It will not select dead ones. Maybe this can help You as well somehow.

But I haven't done anything in a while now, so I don't know.
04/14/2022 01:54 theashmaster#4
Quote:
Originally Posted by br4ve-trave1er.asf View Post
maybe post the code?

current hp is not a good approach as entities can be healed while in death state, so dead mobs could be hit again if they have tp regeneration or tp absorborbtion (eg. grotto2 mobs)
Maybe if I can compare its health (hp < 0), I can stop sending packets and, meanwhile, remove the vid from the list, so it wont send any packets even if it heals over 0.

I don't have acess to my pc right now, but it's a simple loop that looks like this:

for(int i = 0; i < MAX_ENTITY; i++)
{
* if(entity_list[i] != nullptr)
*** {
****** if(*entity_list[i] == dead_packet_vid)
****** {
*********** *entity_list[i] = 0;
*********** break;
******* }
*** }
}

entity_list is a c array. Pointers to mob vids are obtained by hooking the function that register new mobs. I couldn't get the vids from the m_kAliveInstanceMap object because the game crashes and idk why (the hooking method works perfect tho)
dead_packet_vid is the value obtained by hooking RecvDeadPacket

Quote:
Originally Posted by Affenmaster02 View Post
There is a really short time period (1s) where is dead actually returns 1 before unregistering the VID.

But that's nowhere usable.

I dunno.
Exlib does it via C++, I don't think it's possible with pure python,

Unless you capture the "current target" hotbar on the top, and "check" the percentage for the selected mob.
That might be possible, but only for one mob at a time.

Oh and the "tab" hotkey can only select alive mobs. It will not select dead ones. Maybe this can help You as well somehow.

But I haven't done anything in a while now, so I don't know.
I'll at least try this isDead also for learning purposes.

I also thought I could get the info from the ui target bar, but as you said, it would only work for one mob at a time.

Also, I'm programming in c++. Just couldn't find in the source an useful function for this purpose.
04/14/2022 07:24 br4ve-trave1er.asf#5
Quote:
Originally Posted by theashmaster View Post
for(int i = 0; i < MAX_ENTITY; i++)
{
* if(entity_list[i] != nullptr)
*** {
****** if(*entity_list[i] == dead_packet_vid)
****** {
*********** *entity_list[i] = 0;
*********** break;
******* }
*** }
}
entity_list is a c array.
Code:
std::unordered_map<uint32_t, void*> entity_list;
//Pointers to mob vids are obtained by hooking the function that register new mobs
entity_list[instance_ptr->vid] = instance_ptr;

//Recv Dead
if (entity_list.find(dead_packet_vid) != entity_list.end()) {
    entity_list.erase(dead_packet_vid);
}

//your attack function
for (const auto& entity: entity_list) {
    if (entity.second)
        SendAttackToTarget(entity.first);
}
or something like that
04/14/2022 07:40 xTryx#6
if you want to use this the Legal way you just need the pointer of the Character for example if you hit a Monster a Packet will sended to the server with the VID from the Monster with this VID you can get the Pointer

for example :
CHARACTER* Monster = CHARACTER_MANAGER::instance().Find(p->VID);

now you have the Pointer from the Monster the only thing you have to do is to check if the HP is 0 or lower than 0

but since you want to create a cheat i can't help you with that sorry.