Advertisement
Guest User

Untitled

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