Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <API/ARK/Ark.h>
  3.  
  4. #pragma comment(lib, "ArkApi.lib")
  5.  
  6. DECLARE_HOOK(APrimalStructure_TakeDamage, float, APrimalStructure*, float, FDamageEvent*, AController*, AActor*, AShooterPlayerController*);
  7.  
  8. float Hook_APrimalStructure_TakeDamage(APrimalStructure* _this, float Damage, FDamageEvent* DamageEvent,
  9. AController* EventInstigator, AActor* DamageCauser, AShooterPlayerController* KillerShooterController)
  10. {
  11. if (EventInstigator)
  12. {
  13. ACharacter* character = EventInstigator->CharacterField();
  14.  
  15. if (character != nullptr && character->IsA(APrimalDinoCharacter::GetPrivateStaticClass()))
  16. {
  17. APrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(character);
  18.  
  19. FString descr;
  20. dino->GetDinoDescriptiveName(&descr);
  21.  
  22.  
  23.  
  24.  
  25. if (descr.Contains("Dragon"))
  26. {
  27. return 0;
  28. }
  29. if (descr.Contains("Wyvern"))
  30. {
  31. return 0;
  32. }
  33. if (descr.Contains("Broodmother"))
  34. {
  35. return 0;
  36. }
  37. if (descr.Contains("Megapithecus"))
  38. {
  39. return 0;
  40. }
  41. if (descr.Contains("DodoRex"))
  42. {
  43. return 0;
  44. }
  45. if (descr.Contains("Odracir"))
  46. {
  47. return 0;
  48. }
  49. if (descr.Contains("Rawaiim"))
  50. {
  51. return 0;
  52. }
  53. if (descr.Contains("Nilloc"))
  54. {
  55. return 0;
  56. }
  57. if (descr.Contains("Smough"))
  58. {
  59. return 0;
  60. }
  61. if (descr.Contains("Karkinos"))
  62. {
  63. return 0;
  64. }
  65. if (descr.Contains("Gnashor"))
  66. {
  67. return 0;
  68. }
  69. if (descr.Contains("Bokito"))
  70. {
  71. return 0;
  72. }
  73. if (descr.Contains("Mormaw"))
  74. {
  75. return 0;
  76. }
  77. if (descr.Contains("Perdition"))
  78. {
  79. return 0;
  80. }
  81. if (descr.Contains("Raphus"))
  82. {
  83. return 0;
  84. }
  85. if (descr.Contains("Primordius"))
  86. {
  87. return 0;
  88. }
  89. if (descr.Contains("Demonic"))
  90. {
  91. return 0;
  92. }
  93. if (descr.Contains("Celestial"))
  94. {
  95. return 0;
  96. }
  97. if (descr.Contains("Chaos"))
  98. {
  99. return 0;
  100. }
  101. if (descr.Contains("Spirit"))
  102. {
  103. return 0;
  104. }
  105. if (descr.Contains("Badass"))
  106. {
  107. return 0;
  108. }
  109. if (descr.Contains("Champion"))
  110. {
  111. return 0;
  112. }
  113. if (descr.Contains("Alpha"))
  114. {
  115. return 0;
  116. }
  117. if (descr.Contains("Elite"))
  118. {
  119. return 0;
  120. }
  121. if (descr.Contains("Ancient"))
  122. {
  123. return 0;
  124. }
  125. if (descr.Contains("Zomdodo"))
  126. {
  127. return 0;
  128. }
  129. if (descr.Contains("Monkey"))
  130. {
  131. return 0;
  132. }
  133. if (descr.Contains("Apex"))
  134. {
  135. return 0;
  136. }
  137. if (descr.Contains("Toxic"))
  138. {
  139. return 0;
  140. }
  141. if (descr.Contains("Fabled"))
  142. {
  143. return 0;
  144. }
  145. if (descr.Contains("Primal"))
  146. {
  147. return 0;
  148. }
  149. if (descr.Contains("Elder"))
  150. {
  151. return 0;
  152. }
  153. if (descr.Contains("Buffon"))
  154. {
  155. return 0;
  156. }
  157. if (descr.Contains("Origins"))
  158. {
  159. return 0;
  160. }
  161. if (descr.Contains("Light"))
  162. {
  163. return 0;
  164. }
  165. if (descr.Contains("Ice"))
  166. {
  167. return 0;
  168. }
  169. if (descr.Contains("Fire"))
  170. {
  171. return 0;
  172. }
  173. if (descr.Contains("Electric"))
  174. {
  175. return 0;
  176. }
  177. if (descr.Contains("Captain"))
  178. {
  179. return 0;
  180. }
  181. }
  182. }
  183. float Hook_APrimalStructure_TakeDamage(APrimalStructure* _this, float Damage, FDamageEvent* DamageEvent, AController* EventInstigator, AActor* DamageCauser);
  184. {
  185. if (_this && EventInstigator && !EventInstigator->IsLocalController() && EventInstigator->IsA(AShooterPlayerController::StaticClass()))
  186. {
  187. AShooterPlayerController* AttackerShooterController = static_cast<AShooterPlayerController*>(EventInstigator);
  188. if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
  189. {
  190. FString WeaponName;
  191. AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
  192. if (WeaponName.Contains(L"Flamethrower")) return 0;
  193. }
  194. }
  195. APrimalStructure_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser,KillerShooterController);
  196. }
  197.  
  198.  
  199. void Load()
  200. {
  201. Log::Get().Init("NoNunnaki");
  202.  
  203. ArkApi::GetHooks().SetHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage,
  204. &APrimalStructure_TakeDamage_original);
  205. }
  206.  
  207. void Unload()
  208. {
  209. ArkApi::GetHooks().DisableHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage);
  210. }
  211.  
  212. BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
  213. {
  214. switch (ul_reason_for_call)
  215. {
  216. case DLL_PROCESS_ATTACH:
  217. Load();
  218. break;
  219. case DLL_PROCESS_DETACH:
  220. Unload();
  221. break;
  222. }
  223. return TRUE;
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement