<?xml version="1.0" encoding="utf-8" ?>
<EternityPatchFile name="QuestPatches" comment="This file enables patches related with quest mods" >

	<!-- Addresses 1.09.1 unless stated otherwise -->	
	
	<!-- This is an irregular patch. Implementation in the exe must be changed on any signature change -->	
	<Patch name="ModHLQInGlobalOrb" enabled="mod_hlq_always_in_global_orb" type="notify" search_start="0x4F57BA" >
		<Instruction code="48 8B 03" comment="mov rax, [rbx]" />
		<Instruction code="48 8B CB" comment="mov rcx, rbx" />
		<Instruction code="FF 50 10" comment="call qword ptr [rax+10h]" />
		<Instruction code="83 F8 03" comment="cmp eax, 3" />
		<Instruction code="75 E2" comment="jz -0x18" />
		<Instruction code="39 AF AC 00 00 00" comment="cmp [rdi+0ACh], ebp" />
		<Instruction code="0F 84 E0 00 00 00" comment="jz -XXX" />		
				
		<Notify value="OnModHlqPatchLocated" />
	</Patch>
	
	<Patch name="ExtendQEDConditions" type="hook" search_start="0x6ACD10" >
		<Instruction code="40 53" comment="push rbx" />
		<Instruction code="48 83 EC 20" comment="sub rsp, 20h" />
		<Instruction code="48 63 02" comment="movsxd rax, dword ptr [rdx]" />
		<Instruction code="33 DB" comment="xor ebx, ebx" />
		<Instruction code="83 F8 3B" comment="cmp eax, 3B" />
		<Instruction code="0F 87 30 03 00 00" comment="ja xxx" />
		
		<Hook value="QedCondHooked" setup="SetupQedCond" />
	</Patch>
	
	<Patch name="LocateQmlIdToEventCast" type="notify" search_start="0x6D2540" >
		<Instruction code="48 89 5C 24 08" comment="mov [rsp+8], rbx" />
		<Instruction code="57" comment="push rdi" />
		<Instruction code="48 83 EC 20" comment="sub rsp, 20h" />
		<Instruction code="48 8B 3D XXXXXXXX" comment="mov rdi, QuestManager_singleton" />
		<Instruction code="8B D9" comment="mov ebx, ecx" />
		<Instruction code="48 8B 8F 68 05 00 00" comment="mov rcx, [rdi+568h]" />
		<Instruction code="48 85 C9" comment="test rcx, rcx" />
		<Instruction code="75 0D" comment="jne +D" />
		<Instruction code="33 C0" comment="xor eax, eax" />
		<Instruction code="48 8B 5C 24 30" comment="mov rbx, [rsp+30h]" />
		
		<Notify value="OnQmlIdToEventCastLocated" />	
	</Patch>
	
</EternityPatchFile>
	