-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added item count to food/potions * added position and font size setting to mcm * the inventory event sink is not the best, but should do for now ...
- Loading branch information
Showing
20 changed files
with
196 additions
and
19 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -34,7 +34,7 @@ set(BUILD_TESTS OFF) | |
|
||
project( | ||
LamasTinyHUD | ||
VERSION 1.0.0.3 | ||
VERSION 1.0.0.4 | ||
LANGUAGES CXX | ||
) | ||
|
||
|
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
Binary file not shown.
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,50 @@ | ||
#include "inventory_event.h" | ||
|
||
#include "handle/page_handle.h" | ||
|
||
namespace event { | ||
inventory_event* inventory_event::get_singleton() { | ||
static inventory_event singleton; | ||
return std::addressof(singleton); | ||
} | ||
|
||
void inventory_event::sink() { | ||
if (const auto event = RE::Inventory::GetEventSource(); event) { | ||
event->AddEventSink<RE::Inventory::Event>(get_singleton()); | ||
logger::info("Registered {} handler"sv, typeid(RE::Inventory::Event).name()); | ||
} | ||
} | ||
|
||
inventory_event::event_result inventory_event::ProcessEvent(const RE::Inventory::Event* a_event, | ||
RE::BSTEventSource<RE::Inventory::Event>*) { | ||
if (!a_event) { | ||
return event_result::kContinue; | ||
} | ||
|
||
if (!a_event->objRefr->IsPlayer() && !a_event->objRefr->IsPlayerRef()) { | ||
return event_result::kContinue; | ||
} | ||
|
||
//TODO i might use something different, as far as testing goes, removing it does not notify | ||
//TODO use something else | ||
//those should include food and potions | ||
if (a_event->entryData && a_event->entryData->object->IsMagicItem()) { | ||
const auto page_handle = handle::page_handle::get_singleton(); | ||
for (auto pages = page_handle->get_page(); auto [position, page] : pages) { | ||
for (const auto setting : page->slot_settings) { | ||
if (setting->type == util::selection_type::item && setting->form->formID == a_event->entryData-> | ||
object->GetFormID()) { | ||
const auto diff = a_event->newCount - a_event->prevCount; | ||
setting->item_count = setting->item_count + diff; | ||
logger::trace("Name {}, old {}, new {}"sv, | ||
a_event->entryData->GetDisplayName(), | ||
a_event->prevCount, | ||
a_event->newCount); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return event_result::kContinue; | ||
} | ||
} |
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,25 @@ | ||
#pragma once | ||
|
||
namespace event { | ||
class inventory_event final : public RE::BSTEventSink<RE::Inventory::Event> { | ||
public: | ||
using event_result = RE::BSEventNotifyControl; | ||
|
||
[[nodiscard]] static inventory_event* get_singleton(); | ||
|
||
static void sink(); | ||
|
||
inventory_event(const inventory_event&) = delete; | ||
inventory_event(inventory_event&&) = delete; | ||
|
||
inventory_event& operator=(const inventory_event&) = delete; | ||
inventory_event& operator=(inventory_event&&) = delete; | ||
|
||
protected: | ||
event_result ProcessEvent(const RE::Inventory::Event* a_event, RE::BSTEventSource<RE::Inventory::Event>*) override; | ||
|
||
private: | ||
inventory_event() = default; | ||
~inventory_event() override = default; | ||
}; | ||
} |
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
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
#pragma once | ||
#include "handle/page/slot_setting.h" | ||
|
||
namespace item { | ||
class potion { | ||
public: | ||
static void consume_potion(const RE::TESForm* a_form, RE::PlayerCharacter*& a_player); | ||
static void consume_potion(handle::slot_setting*& a_slot, RE::PlayerCharacter*& a_player); | ||
}; | ||
} |
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
Oops, something went wrong.