Skip to content

Commit bee602a

Browse files
committed
Added DinoId-command
1 parent 2c399ba commit bee602a

8 files changed

Lines changed: 54 additions & 2 deletions

File tree

Configs/Config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"Permissions": false,
77
"Method": "destroy"
88
},
9+
"DinoId_Console": {
10+
"Command": "DinoId",
11+
"Enabled": true
12+
},
913
"DoRespec_Console": {
1014
"Command": "DoRespec",
1115
"Enabled": true

Configs/PluginInfo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FullName":"Improved Commands",
33
"Description": "",
4-
"Version":2.02,
4+
"Version":2.03,
55
"MinApiVersion":2.0,
66
"Dependencies":[
77
"Permissions"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include "DinoIdCommand.h"
2+
3+
void DinoIdConsoleCommand(APlayerController* aPlayerController, FString* cmd, bool bWriteToLog)
4+
{
5+
UWorld* world = ArkApi::GetApiUtils().GetWorld();
6+
if (!world) return;
7+
8+
auto aShooterPlayerController = static_cast<AShooterPlayerController*>(aPlayerController);
9+
if (!aShooterPlayerController) return;
10+
11+
ACharacter* character = aShooterPlayerController->CharacterField()();
12+
if (!character || !character->IsA(APrimalCharacter::GetPrivateStaticClass())) return;
13+
14+
std::wstringstream ss;
15+
16+
APrimalCharacter* primalCharacter = static_cast<APrimalCharacter*>(character);
17+
AActor* actor = primalCharacter->GetAimedActor(ECollisionChannel::ECC_GameTraceChannel2, 0i64, 0.0, 0.0, 0i64, 0i64, 0, 0);
18+
if (actor && actor->IsA(APrimalDinoCharacter::GetPrivateStaticClass()))
19+
{
20+
APrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(actor);
21+
22+
ss << "ID1=" << dino->DinoID1Field()() << ", ID2=" << dino->DinoID2Field()();
23+
}
24+
else ss << "Target is not a creature.";
25+
26+
ArkApi::GetApiUtils().SendChatMessage(aShooterPlayerController, L"[system]", ss.str().c_str());
27+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
#include "../Utils.h"
3+
4+
DECLARE_COMMAND(DinoId_Console);
5+
6+
void DinoIdConsoleCommand(APlayerController* aPlayerController, FString* cmd, bool bWriteToLog);

ImprovedCommands/ImprovedCommands.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "Commands/DestroyDinosForTeamIdCommand.h"
77
#include "Commands/DestroyMyDinoCommand.h"
88
#include "Commands/DestroyStructuresForTeamIdAtPositionCommand.h"
9+
#include "Commands/DinoIdCommand.h"
910
#include "Commands/DoRespecCommand.h"
1011
#include "Commands/DoRespecDinoCommand.h"
1112
#include "Commands/FeedDinosForTeamIdCommand.h"
@@ -54,6 +55,8 @@ void Load()
5455
[&commands](wchar_t* name) { commands.AddChatCommand(name, &SuicideChatCommand); });
5556

5657
// console
58+
ArkLibrary::AddCommand(CommandName_DinoId_Console,
59+
[&commands](wchar_t* name) { commands.AddConsoleCommand(name, &DinoIdConsoleCommand); });
5760
ArkLibrary::AddCommand(CommandName_DoRespec_Console,
5861
[&commands](wchar_t* name) { commands.AddConsoleCommand(name, &DoRespecConsoleCommand); });
5962
ArkLibrary::AddCommand(CommandName_DoRespecDino_Console,
@@ -109,6 +112,8 @@ void Unload()
109112
[&commands](wchar_t* name) { commands.RemoveChatCommand(name); });
110113

111114
// console
115+
ArkLibrary::RemoveCommand(CommandName_DinoId_Console,
116+
[&commands](wchar_t* name) { commands.RemoveConsoleCommand(name); });
112117
ArkLibrary::RemoveCommand(CommandName_DoRespec_Console,
113118
[&commands](wchar_t* name) { commands.RemoveConsoleCommand(name); });
114119
ArkLibrary::RemoveCommand(CommandName_DoRespecDino_Console,

ImprovedCommands/ImprovedCommands.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
<ClCompile Include="Commands\DestroyDinosForTeamIdCommand.cpp" />
123123
<ClCompile Include="Commands\DestroyMyDinoCommand.cpp" />
124124
<ClCompile Include="Commands\DestroyStructuresForTeamIdAtPositionCommand.cpp" />
125+
<ClCompile Include="Commands\DinoIdCommand.cpp" />
125126
<ClCompile Include="Commands\DoRespecCommand.cpp" />
126127
<ClCompile Include="Commands\DoRespecDinoCommand.cpp" />
127128
<ClCompile Include="Commands\FeedDinosForTeamIdCommand.cpp" />
@@ -138,6 +139,7 @@
138139
<ClInclude Include="Commands\DestroyDinosForTeamIdCommand.h" />
139140
<ClInclude Include="Commands\DestroyMyDinoCommand.h" />
140141
<ClInclude Include="Commands\DestroyStructuresForTeamIdAtPositionCommand.h" />
142+
<ClInclude Include="Commands\DinoIdCommand.h" />
141143
<ClInclude Include="Commands\DoRespecCommand.h" />
142144
<ClInclude Include="Commands\DoRespecDinoCommand.h" />
143145
<ClInclude Include="Commands\FeedDinosForTeamIdCommand.h" />

ImprovedCommands/ImprovedCommands.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
<ClCompile Include="Commands\DoRespecDinoCommand.cpp">
6464
<Filter>Source Files\Commands</Filter>
6565
</ClCompile>
66+
<ClCompile Include="Commands\DinoIdCommand.cpp">
67+
<Filter>Source Files\Commands</Filter>
68+
</ClCompile>
6669
</ItemGroup>
6770
<ItemGroup>
6871
<ClInclude Include="Commands\DoRespecCommand.h">
@@ -104,5 +107,8 @@
104107
<ClInclude Include="Commands\DoRespecDinoCommand.h">
105108
<Filter>Header Files\Commands</Filter>
106109
</ClInclude>
110+
<ClInclude Include="Commands\DinoIdCommand.h">
111+
<Filter>Header Files\Commands</Filter>
112+
</ClInclude>
107113
</ItemGroup>
108114
</Project>

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
Adds additional commands to ARK Survival Evolved servers using ARK Server API.
66

77
### Chat
8-
* **/MyDinoStats**: Prints the base levels, and optionally base stats, of a owned and tamed dino in-front of the player.
8+
* **/MyDinoStats**: Prints the base levels, and optionally base stats, of an owned and tamed dino in-front of the player.
99
* **/DestroyMyDino**: Deletes the owned and tamed dino in-front of the player from the ARK.
1010
* **/Suicide**: Kill your own character (to get unstuck etc.)
1111

1212
### Rcon and Console
13+
* **DinoId**: Get the dino IDs for the targeted dino (console only).
14+
1315
* **DoRespec `<steam id>`**: Force respec (mindwipe) of a character.
1416
Example: `DoRespec 12345678912345678`
1517

0 commit comments

Comments
 (0)