Code:
func void _Engine_oCNpc_RemoveFromSlot(var int npcPtr, var string SlotName, var int retVal, var int SlotID) {
CALL_IntParam(SlotID);
CALL_IntParam(retVal);
CALL_zStringPtrParam(SlotName);
CALL__thiscall(npcPtr, oCNpc__RemoveFromSlot);
};
func void _Npc_ClearHands(var int npcPtr) {
_Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_RIGHTHAND", 0, 0);
_Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_LEFTHAND", 0, 0);
_Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_SWORD", 0, 0);
_Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_LONGSWORD", 0, 0);
_Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_BOW", 0, 0);
_Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_CROSSBOW", 0, 0);
_Engine_oCNpc_RemoveFromSlot(npcPtr, "ZS_SHIELD", 0, 0);
};
func void _oCNpc_DropAllInHand() {
var int npcPtr; npcPtr = ESI;
const int oCNpc_DropAllInHand_G2 = 7566816; // 0x007375e0
CALL__thiscall(npcPtr, oCNpc_DropAllInHand_G2);
};
func void oCNpc_DropUnconscious_DropAllInHand() {
MEM_Info("oCNpc_DropUnconscious_DropAllInHand");
_Npc_ClearHands(ESI);
// _oCNpc_DropAllInHand();
};
func void oCNpc_DoDie_DropAllInHand() {
MEM_Info("oCNpc_DoDie_DropAllInHand");
_Npc_ClearHands(ESI);
// _oCNpc_DropAllInHand();
};
func void InitCustomDropAllInHand() {
const int oCNpc_DropUnconscious_DropAllInHand_G2 = 7561131; // 0x00735fab
const int oCNpc_DoDie_DropAllInHand_G2 = 7563416; // 0x00736898
const int once = 1;
if (once) {
MemoryProtectionOverride(oCNpc_DropUnconscious_DropAllInHand_G2, 7);
MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+1, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+2, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+3, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+4, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+5, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DropUnconscious_DropAllInHand_G2+6, ASMINT_OP_nop);
MemoryProtectionOverride(oCNpc_DoDie_DropAllInHand_G2, 7);
MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+1, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+2, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+3, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+4, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+5, ASMINT_OP_nop);
MEM_WriteByte(oCNpc_DoDie_DropAllInHand_G2+6, ASMINT_OP_nop);
HookEngineF(oCNpc_DropUnconscious_DropAllInHand_G2, 7, oCNpc_DropUnconscious_DropAllInHand);
HookEngineF(oCNpc_DoDie_DropAllInHand_G2, 7, oCNpc_DoDie_DropAllInHand);
once = 0;
};
};