Advertisement
Guest User

Untitled

a guest
Nov 27th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.63 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*);
  7.  
  8. float Hook_APrimalStructure_TakeDamage(APrimalStructure* _this, float Damage, FDamageEvent* DamageEvent, AController* EventInstigator, AActor* DamageCauser)
  9. {
  10. if (_this && EventInstigator && !EventInstigator->IsLocalController() && EventInstigator->IsA(AShooterPlayerController::StaticClass()))
  11. {
  12. ACharacter* character = EventInstigator->CharacterField();
  13. if (character && character->IsA(APrimalDinoCharacter::GetPrivateStaticClass()))
  14. {
  15. APrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(character);
  16. FString descr;
  17. dino->GetDinoDescriptiveName(&descr);
  18. if (descr.Contains(L"Dragon")
  19. || descr.Contains(L"Wyvern")
  20. || descr.Contains(L"Broodmother")
  21. || descr.Contains(L"Megapithecus")
  22. || descr.Contains(L"DodoRex")
  23. || descr.Contains(L"Odracir")
  24. || descr.Contains(L"Rawaiim")
  25. || descr.Contains(L"Nilloc")
  26. || descr.Contains(L"Smough")
  27. || descr.Contains(L"Karkinos")
  28. || descr.Contains(L"Gnashor")
  29. || descr.Contains(L"Bokito")
  30. || descr.Contains(L"Mormaw")
  31. || descr.Contains(L"Perdition")
  32. || descr.Contains(L"Raphus")
  33. || descr.Contains(L"Primordius")
  34. || descr.Contains(L"Demonic")
  35. || descr.Contains(L"Celestial")
  36. || descr.Contains(L"Chaos")
  37. || descr.Contains(L"Spirit")
  38. || descr.Contains(L"Badass")
  39. || descr.Contains(L"Champion")
  40. || descr.Contains(L"Alpha")
  41. || descr.Contains(L"Elite")
  42. || descr.Contains(L"Ancient")
  43. || descr.Contains(L"Zomdodo")
  44. || descr.Contains(L"Monkey")
  45. || descr.Contains(L"Apex")
  46. || descr.Contains(L"Toxic")
  47. || descr.Contains(L"Fabled")
  48. || descr.Contains(L"Primal")
  49. || descr.Contains(L"Elder")
  50. || descr.Contains(L"Buffon")
  51. || descr.Contains(L"Light")
  52. || descr.Contains(L"Ice")
  53. || descr.Contains(L"Fire")
  54. || descr.Contains(L"Electric")
  55. || descr.Contains(L"Captain"))
  56. return 0;
  57. }
  58. AShooterPlayerController* AttackerShooterController = static_cast<AShooterPlayerController*>(EventInstigator);
  59. if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
  60. {
  61. FString WeaponName;
  62. AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
  63. if (WeaponName.Contains(L"Flamethrower")) return 0;
  64. }
  65. }
  66. else if (EventInstigator && EventInstigator->CharacterField())
  67. {
  68. ACharacter* character = EventInstigator->CharacterField();
  69. if (character && character->IsA(APrimalDinoCharacter::GetPrivateStaticClass()))
  70. {
  71. APrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(character);
  72. FString descr;
  73. dino->GetDinoDescriptiveName(&descr);
  74. if (descr.Contains(L"Dragon")
  75. || descr.Contains(L"Wyvern")
  76. || descr.Contains(L"Broodmother")
  77. || descr.Contains(L"Megapithecus")
  78. || descr.Contains(L"DodoRex")
  79. || descr.Contains(L"Odracir")
  80. || descr.Contains(L"Rawaiim")
  81. || descr.Contains(L"Nilloc")
  82. || descr.Contains(L"Smough")
  83. || descr.Contains(L"Karkinos")
  84. || descr.Contains(L"Gnashor")
  85. || descr.Contains(L"Bokito")
  86. || descr.Contains(L"Mormaw")
  87. || descr.Contains(L"Perdition")
  88. || descr.Contains(L"Raphus")
  89. || descr.Contains(L"Primordius")
  90. || descr.Contains(L"Demonic")
  91. || descr.Contains(L"Celestial")
  92. || descr.Contains(L"Chaos")
  93. || descr.Contains(L"Spirit")
  94. || descr.Contains(L"Badass")
  95. || descr.Contains(L"Champion")
  96. || descr.Contains(L"Alpha")
  97. || descr.Contains(L"Elite")
  98. || descr.Contains(L"Ancient")
  99. || descr.Contains(L"Zomdodo")
  100. || descr.Contains(L"Monkey")
  101. || descr.Contains(L"Apex")
  102. || descr.Contains(L"Toxic")
  103. || descr.Contains(L"Fabled")
  104. || descr.Contains(L"Primal")
  105. || descr.Contains(L"Elder")
  106. || descr.Contains(L"Buffon")
  107. || descr.Contains(L"Light")
  108. || descr.Contains(L"Ice")
  109. || descr.Contains(L"Fire")
  110. || descr.Contains(L"Electric")
  111. || descr.Contains(L"Captain"))
  112. return 0;
  113. }
  114. if (DamageCauser)
  115. {
  116. FString descr;
  117. DamageCauser->GetHumanReadableName(&descr);
  118.  
  119. if (descr.Contains("Tek Turret"))
  120. {
  121. return 0;
  122. }
  123. }
  124. }
  125. APrimalStructure_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser);
  126. }
  127.  
  128. void SuicideCMD(AShooterPlayerController* player, FString* message, int mode)
  129. {
  130. if (!player || !player->PlayerStateField() || !player->GetPlayerCharacter() || player->GetPlayerCharacter()->IsDead()) return;
  131. if (!ArkApi::GetApiUtils().IsRidingDino(player)) player->GetPlayerCharacter()->Suicide();
  132. }
  133.  
  134.  
  135. void Load()
  136. {
  137. Log::Get().Init("NoNunnaki");
  138.  
  139. ArkApi::GetHooks().SetHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage,
  140. &APrimalStructure_TakeDamage_original);
  141.  
  142. ArkApi::GetCommands().AddChatCommand("/suicide", &SuicideCMD);
  143.  
  144.  
  145. }
  146.  
  147. void Unload()
  148. {
  149. ArkApi::GetHooks().DisableHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage);
  150. ArkApi::GetCommands().RemoveChatCommand("/suicide");
  151. }
  152.  
  153. BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
  154. {
  155. switch (ul_reason_for_call)
  156. {
  157. case DLL_PROCESS_ATTACH:
  158. Load();
  159. break;
  160. case DLL_PROCESS_DETACH:
  161. Unload();
  162. break;
  163. }
  164. return TRUE;
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement