Skip to content

Commit

Permalink
clean up CmdUseSkill code
Browse files Browse the repository at this point in the history
  • Loading branch information
DubbleClick committed Sep 19, 2024
1 parent 2b660ab commit be99548
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions GWToolboxdll/Modules/ChatCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2344,23 +2344,20 @@ void CHAT_CMD_FUNC(ChatCommands::CmdTarget)

void CHAT_CMD_FUNC(ChatCommands::CmdUseSkill)
{
if (!IsMapReady())
return;
if (argc < 2) {
Instance().skill_to_use.slot = 0;
auto& skill_to_use = Instance().skill_to_use;
skill_to_use.slot = 0;
if (!IsMapReady() || argc < 2) {
return;
}
const std::wstring arg1 = TextUtils::ToLower(argv[1]);
if (arg1 == L"stop" || arg1 == L"off") {
Instance().skill_to_use.slot = 0;
return;
}
uint32_t num = 0;
if (!TextUtils::ParseUInt(argv[1], &num) || num > 8) {
Log::ErrorW(L"Invalid argument '%s', please use an integer value of 1 to 8", argv[1]);
return;
}
auto& skill_to_use = Instance().skill_to_use;
if (skill_to_use.slot == num)
num = 0;
skill_to_use.slot = num;
Expand Down

0 comments on commit be99548

Please sign in to comment.