Guest User

Spore ModAPI Planet Buster Cheat

a guest
Feb 5th, 2019
269
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // dllmain.cpp : Defines the entry point for the DLL application.
  2. #include "stdafx.h"
  3.  
  4. #include <ModAPI\MainUtilities.h>
  5. #include <Spore\Simulator\cSimulatorSpaceGame.h>
  6.  
  7. /*
  8. Create detourings here.
  9. */
  10.  
  11. void Initialization()
  12. {
  13.     App::CheatManager()->AddCheat("planetBuster",
  14.         [](const ArgScript::Line& line, ArgScript::FormatParser* formatParser) {
  15.  
  16.         using namespace Simulator;
  17.  
  18.         if (IsSpaceGame())
  19.         {
  20.             auto inventory = SimulatorSpaceGame()->GetPlayerInventory();
  21.  
  22.             intrusive_ptr<cSpaceToolData> tool;
  23.             ToolManager()->LoadTool(instance_id(id("PlanetBusterBomb")), tool);
  24.  
  25.             size_t numArguments;
  26.             auto args = line.GetArgumentsRange(&numArguments, 0, 1);
  27.             if (numArguments == 1) {
  28.                 tool->mCurrentAmmoCount = formatParser->ParseInt(args[0]);
  29.             }
  30.  
  31.             inventory->AddItem(tool.get());
  32.         }
  33.     },
  34.         [](ArgScript::DescriptionMode mode) {
  35.         return "Call the cheat. Drop the bomb. BOOM!";
  36.     });
  37. }
  38.  
  39. void AttachDetouring()
  40. {
  41.     /*
  42.     Only attach detourings (method redirections) in this method.
  43.     For example, if you used 'detour(...) GetValue_detoured;', call 'GetValue_detoured::attach()' here.
  44.     */
  45. }
  46.  
  47. BOOL APIENTRY DllMain( HMODULE hModule,
  48.                        DWORD  ul_reason_for_call,
  49.                        LPVOID lpReserved
  50.                      )
  51. {
  52.     switch (ul_reason_for_call)
  53.     {
  54.     case DLL_PROCESS_ATTACH:
  55.  
  56.         // This line is always necessary
  57.         ModAPI::ModAPIUtils::InitModAPI();
  58.  
  59.         /* Usually you don't need to insert code here. Use the AttachDetour and Initialization functions instead */
  60.        
  61.         PrepareDetours(hModule);
  62.         AttachDetouring();
  63.         SendDetours();
  64.        
  65.         ModAPI::AddInitFunction(&Initialization);
  66.  
  67.  
  68.     case DLL_THREAD_ATTACH:
  69.     case DLL_THREAD_DETACH:
  70.     case DLL_PROCESS_DETACH:
  71.         break;
  72.     }
  73.     return TRUE;
  74. }
RAW Paste Data