Skip to content

Commit

Permalink
Merge pull request #1345 from Aelto/transmo-id-param
Browse files Browse the repository at this point in the history
feat: transmo subcommand to load supplied npc model id
  • Loading branch information
3vcloud authored Feb 19, 2025
2 parents fd2ceef + 17bc1b2 commit 48629af
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
38 changes: 37 additions & 1 deletion GWToolboxdll/Modules/ChatCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2719,6 +2719,42 @@ void CHAT_CMD_FUNC(ChatCommands::CmdTransmo)
if (wcsncmp(argv[1], L"reset", 5) == 0) {
transmo.npc_id = std::numeric_limits<int>::max();
}
else if (wcsncmp(argv[1], L"model", 5) == 0) {
bool invalid_data = argc < 6;
int npc_id = transmo.npc_id;
if (!invalid_data && argc > 2 && !TextUtils::ParseInt(argv[3], &npc_id)) {
Log::Error("Transmo model: invalid NPC ID '%ls', expected an integer. Example: 4581", argv[3]);
invalid_data = true;
}
int model_file_id = transmo.npc_model_file_id;
if (!invalid_data && argc > 3 && !TextUtils::ParseInt(argv[3], &model_file_id)) {
Log::Error("Transmo model: invalid NPC ModelFileID '%ls', expected an integer. Example: 204020", argv[3]);
invalid_data = true;
}
int model_file_data = transmo.npc_model_file_data;
if (!invalid_data && argc > 4 && !TextUtils::ParseInt(argv[4], &model_file_data)) {
Log::Error("Transmo model: invalid NPC ModelFile'%ls', expected an integer. Example: 245127", argv[4]);
invalid_data = true;
}
int flags = transmo.flags;
if (!invalid_data && argc > 5 && !TextUtils::ParseInt(argv[5], &flags)) {
Log::Error("Transmo model: invalid NPC Flags '%ls', expected an integer. Example: 540", argv[5]);
invalid_data = true;
}

if (invalid_data) {
Log::Info("HELP for /transmo model");
Log::Info("Usage: /transmo model NPC_ID MODEL_FILE_ID MODEL_FILE FLAGS");
Log::Info("Example, transfo as Gehraz: /transmo model 4581 204020 245127 540");
Log::Info("The numbers required by the command can be obtained from the GWToolbox 'Info' window, in the 'Advanced' section under the 'Target' menu. Note: the numbers must be converted from hexadecimal to decimal.");
return;
}

transmo.npc_id = npc_id;
transmo.npc_model_file_id = model_file_id;
transmo.npc_model_file_data = model_file_data;
transmo.flags = flags;
}
else if (TextUtils::ParseInt(argv[1], &iscale)) {
if (!ParseScale(iscale, transmo)) {
return;
Expand All @@ -2728,7 +2764,7 @@ void CHAT_CMD_FUNC(ChatCommands::CmdTransmo)
Log::Error("unknown transmo '%ls'", argv[1]);
return;
}
if (argc > 2 && TextUtils::ParseInt(argv[2], &iscale)) {
else if (argc > 2 && TextUtils::ParseInt(argv[2], &iscale)) {
if (!ParseScale(iscale, transmo)) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ GWToolbox++ supports a variety of chat commands that enhance your gameplay exper
- `/transmo`: Change your character model to that of the target NPC (only visible to you).
- `/transmo [size (6-255)]`: Set the size of your model.
- `/transmo <npc_name> [size (6-255)]`: Change your appearance into a specific NPC.
- `/transmo model <npc_id> <npc_model_file_id> <npc_model_file> <flags>`: Change your appearance into a specific NPC model.
- `/transmo reset`: Reset your appearance.
- `/transmotarget <npc_name> [size (6-255)]`: Change your target's appearance into an NPC (only visible to you).
- `/transmotarget reset`: Reset your target's appearance.
Expand Down

0 comments on commit 48629af

Please sign in to comment.