Skip to content

Commit

Permalink
update gwca, update example plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
DubbleClick committed Dec 17, 2024
1 parent 5523bc4 commit 11b6107
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
Binary file modified Dependencies/GWCA/bin/gwca.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Dependencies/GWCA/include/GWCA/Managers/ChatMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace GW {
// callbacks that handle chat commands; always blocks gw command, unless you set hook_status->blocked = false;
typedef void (__cdecl* ChatCommandCallback)(GW::HookStatus*, const wchar_t* cmd, int argc, const LPWSTR* argv);
GWCA_API void CreateCommand(const wchar_t* cmd, ChatCommandCallback callback);
GWCA_API void DeleteCommand(const wchar_t* cmd);
GWCA_API void DeleteCommand(const wchar_t* cmd, ChatCommandCallback callback = nullptr);

GWCA_API void ToggleTimestamps(bool enable);
GWCA_API void SetTimestampsFormat(bool use_24h, bool show_timestamp_seconds = false);
Expand Down
6 changes: 6 additions & 0 deletions Dependencies/GWCA/include/GWCA/Managers/UIMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,18 @@ namespace GW {
kRecvWhisper = 0x30000000 | 0x1E, // wparam = UIPacket::kRecvWhisper*
kPrintChatMessage = 0x30000000 | 0x1F, // wparam = UIPacket::kPrintChatMessage*. Triggered when a message wants to be added to the in-game chat window.
kSendWorldAction = 0x30000000 | 0x20, // wparam = UIPacket::kSendWorldAction*
kSetRendererValue = 0x30000000 | 0x21 // wparam = UIPacket::kSetRendererValue
};
enum class FlagPreference : uint32_t;
enum class NumberPreference : uint32_t;
enum class EnumPreference : uint32_t;

namespace UIPacket {
struct kSetRendererValue {
uint32_t renderer_mode; // 0 for window, 2 for full screen
uint32_t metric_id; // TODO: Enum this!
uint32_t value;
};
struct kEffectAdd {
uint32_t agent_id;
Effect* effect;
Expand Down
Binary file modified Dependencies/GWCA/lib/gwca.lib
Binary file not shown.
16 changes: 10 additions & 6 deletions plugins/ExamplePlugin/ExamplePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,23 @@ void ExamplePlugin::DrawSettings()
ImGui::Checkbox("Redirect ee to eee", &redirect_slash_ee_to_eee);
}

void EeCmd(GW::HookStatus*, const wchar_t*, const int, const LPWSTR*)
{
if (redirect_slash_ee_to_eee) {
GW::Chat::SendChat('/', "eee");
}
}

void ExamplePlugin::Initialize(ImGuiContext* ctx, const ImGuiAllocFns allocator_fns, const HMODULE toolbox_dll)
{
ToolboxUIPlugin::Initialize(ctx, allocator_fns, toolbox_dll);
GW::Chat::CreateCommand(L"ee", [](GW::HookStatus*, const wchar_t*, const int, const LPWSTR*) {
if (redirect_slash_ee_to_eee) {
GW::Chat::SendChat('/', "eee");
}
});
GW::Chat::CreateCommand(L"ee", EeCmd);
}

void ExamplePlugin::SignalTerminate()
{
ToolboxUIPlugin::SignalTerminate();
GW::Chat::DeleteCommand(L"ee");
GW::Chat::DeleteCommand(L"ee", EeCmd);
}

bool ExamplePlugin::CanTerminate() {
Expand Down

0 comments on commit 11b6107

Please sign in to comment.