-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove InstanceTimer plugin, instead create ExamplePlugin that can al…
…ways run to check for stability
- Loading branch information
1 parent
919a46e
commit 301d366
Showing
9 changed files
with
112 additions
and
360 deletions.
There are no files selected for viewing
Submodule GWCA
updated
from c53ea3 to 3fdd93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include "ExamplePlugin.h" | ||
|
||
#include <GWCA/Constants/Constants.h> | ||
#include <GWCA/Managers/MapMgr.h> | ||
|
||
#include <Utils/GuiUtils.h> | ||
#include <GWCA/GWCA.h> | ||
#include <GWCA/Utilities/Hooker.h> | ||
|
||
#include "GWCA/Managers/ChatMgr.h" | ||
#include "Modules/ChatLog.h" | ||
|
||
namespace { | ||
bool redirect_slash_ee_to_eee = false; | ||
} | ||
|
||
DLLAPI ToolboxPlugin* ToolboxPluginInstance() | ||
{ | ||
static ExamplePlugin instance; | ||
return &instance; | ||
} | ||
|
||
void ExamplePlugin::LoadSettings(const wchar_t* folder) | ||
{ | ||
ToolboxUIPlugin::LoadSettings(folder); | ||
PLUGIN_LOAD_BOOL(redirect_slash_ee_to_eee); | ||
} | ||
|
||
void ExamplePlugin::SaveSettings(const wchar_t* folder) | ||
{ | ||
ToolboxUIPlugin::SaveSettings(folder); | ||
PLUGIN_SAVE_BOOL(redirect_slash_ee_to_eee); | ||
PLUGIN_ASSERT(ini.SaveFile(GetSettingFile(folder).c_str()) == SI_OK); | ||
} | ||
|
||
void ExamplePlugin::DrawSettings() | ||
{ | ||
if (!toolbox_handle) { | ||
return; | ||
} | ||
ImGui::Checkbox("Redirect ee to eee", &redirect_slash_ee_to_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", [](const wchar_t*, const int, const LPWSTR*) { | ||
if (redirect_slash_ee_to_eee) { | ||
GW::Chat::SendChat('/', "eee"); | ||
} | ||
}); | ||
} | ||
void ExamplePlugin::SignalTerminate() | ||
{ | ||
ToolboxUIPlugin::SignalTerminate(); | ||
GW::Chat::DeleteCommand(L"ee"); | ||
GW::DisableHooks(); | ||
} | ||
|
||
bool ExamplePlugin::CanTerminate() { | ||
return GW::Hook::GetInHookCount() == 0; | ||
} | ||
|
||
void ExamplePlugin::Draw(IDirect3DDevice9*) | ||
{ | ||
if (GW::Map::GetInstanceType() != GW::Constants::InstanceType::Loading) { | ||
return; | ||
} | ||
|
||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0)); | ||
if (ImGui::Begin(Name(), GetVisiblePtr(), ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar)) { | ||
ImGui::Text("Example plugin: area loading..."); | ||
} | ||
ImGui::End(); | ||
ImGui::PopStyleColor(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include <ToolboxUIPlugin.h> | ||
|
||
class ExamplePlugin : public ToolboxUIPlugin { | ||
public: | ||
ExamplePlugin() | ||
{ | ||
can_show_in_main_window = false; | ||
show_title = false; | ||
can_collapse = false; | ||
can_close = false; | ||
} | ||
~ExamplePlugin() override = default; | ||
|
||
const char* Name() const override { return "Example Plugin"; } | ||
|
||
void LoadSettings(const wchar_t*) override; | ||
void SaveSettings(const wchar_t*) override; | ||
void DrawSettings() override; | ||
void Initialize(ImGuiContext* ctx, ImGuiAllocFns allocator_fns, HMODULE toolbox_dll) override; | ||
void SignalTerminate() override; | ||
bool CanTerminate() override; | ||
// Draw user interface. Will be called every frame if the element is visible | ||
void Draw(IDirect3DDevice9* pDevice) override; | ||
}; |
Oops, something went wrong.