Get & save keywords with transactions
Also, start setting vendor faction vendor items form list during shop load (hardcoded to just sell/buy armor for now until I implement shop configs).
This commit is contained in:
parent
c576a2b885
commit
289ec598d4
@ -286,6 +286,9 @@ void LoadRefsTask(FFIResult<RawInteriorRefData> result, RE::TESObjectREFR* targe
|
||||
RE::BGSKeyword* toggle_keyword = data_handler->LookupForm<RE::BGSKeyword>(KEYWORD_TOGGLE, MOD_NAME);
|
||||
RE::BGSKeyword* next_keyword = data_handler->LookupForm<RE::BGSKeyword>(KEYWORD_NEXT, MOD_NAME);
|
||||
RE::BGSKeyword* prev_keyword = data_handler->LookupForm<RE::BGSKeyword>(KEYWORD_PREV, MOD_NAME);
|
||||
RE::BGSKeyword* vendor_item_armor_keyword = RE::TESForm::LookupByID<RE::BGSKeyword>(KEYWORD_VENDOR_ITEM_ARMOR);
|
||||
RE::BGSListForm* vendor_items = data_handler->LookupForm<RE::BGSListForm>(FORM_LIST_VENDOR_ITEMS, MOD_NAME);
|
||||
RE::TESFaction* vendor_services_faction = data_handler->LookupForm<RE::TESFaction>(FACTION_SERVICES_VENDOR, MOD_NAME);
|
||||
|
||||
SKSE::RegistrationMap<bool, std::vector<RE::TESObjectREFR*>> successReg = SKSE::RegistrationMap<bool, std::vector<RE::TESObjectREFR*>>();
|
||||
successReg.Register(quest, RE::BSFixedString("OnLoadInteriorRefListSuccess"));
|
||||
@ -457,6 +460,13 @@ void LoadRefsTask(FFIResult<RawInteriorRefData> result, RE::TESObjectREFR* targe
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: load shop vendor(s)
|
||||
|
||||
// TODO: load these values from shop config data
|
||||
vendor_items->ClearData();
|
||||
vendor_items->AddForm(vendor_item_armor_keyword);
|
||||
vendor_services_faction->vendorData.vendorValues.notBuySell = false;
|
||||
} else {
|
||||
const char * error = result.AsErr();
|
||||
logger::error(FMT_STRING("LoadInteriorRefList get_interior_ref_list error: {}"), error);
|
||||
|
@ -941,6 +941,7 @@ RE::BGSKeywordForm* LookupKeywordForm(RE::FormID form_id, RE::FormType form_type
|
||||
break;
|
||||
} default:
|
||||
logger::warn(FMT_STRING("LookupKeywordForm form cannot have keywords with form_id: {:x} and form_type: {:x}"), (uint32_t)form_id, (uint32_t)form_type);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -949,7 +950,7 @@ std::vector<const char*> GetKeywords(RE::FormID form_id, RE::FormType form_type)
|
||||
|
||||
RE::BGSKeywordForm* keyword_form = LookupKeywordForm(form_id, form_type);
|
||||
|
||||
if (!keyword_form) {
|
||||
if (keyword_form == nullptr) {
|
||||
logger::warn(FMT_STRING("GetKeywords form {:x} type: {:x} is not a keyword form"), (uint32_t)form_id, (uint32_t)form_type);
|
||||
return keywords;
|
||||
}
|
||||
|
@ -45,3 +45,4 @@ bool CreateMerchandiseList(
|
||||
int GetMerchandiseQuantity(RE::StaticFunctionTag*, RE::TESObjectREFR* activator);
|
||||
int GetMerchandisePrice(RE::StaticFunctionTag*, RE::TESObjectREFR* activator);
|
||||
int GetMerchandiseSellPrice(RE::StaticFunctionTag*, RE::TESForm* form);
|
||||
std::vector<const char*> GetKeywords(RE::FormID form_id, RE::FormType form_type);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "bindings.h"
|
||||
#include "utils.h"
|
||||
#include "BRMerchandiseList.h"
|
||||
|
||||
void CreateTransactionImpl(
|
||||
RE::BSFixedString api_url,
|
||||
@ -46,8 +47,9 @@ void CreateTransactionImpl(
|
||||
// if (extra_quantity_price) {
|
||||
// price = extra_quantity_price->pad14;
|
||||
// }
|
||||
std::vector<const char*> keywords = GetKeywords(form_id, merch_base->GetFormType());
|
||||
|
||||
RawTransaction input_transaction = { 0, shop_id, mod_name, local_form_id, name, form_type, is_food, price, is_sell, quantity, amount };
|
||||
RawTransaction input_transaction = { 0, shop_id, mod_name, local_form_id, name, form_type, is_food, price, is_sell, quantity, amount, &keywords[0], keywords.size() };
|
||||
FFIResult<RawTransaction> result = create_transaction(api_url.c_str(), api_key.c_str(), input_transaction);
|
||||
if (result.IsOk()) {
|
||||
RawTransaction saved_transaction = result.AsOk();
|
||||
|
@ -8,5 +8,10 @@ constexpr uint32_t KEYWORD_NEXT = 0x00351c;
|
||||
constexpr uint32_t KEYWORD_PREV = 0x00351d;
|
||||
constexpr uint32_t KEYWORD_ITEM = 0x003517;
|
||||
constexpr uint32_t KEYWORD_ACTIVATOR = 0x004AA8;
|
||||
constexpr uint32_t KEYWORD_VENDOR_ITEM_ARMOR = 0x008F959;
|
||||
|
||||
constexpr uint32_t ACTIVATOR_STATIC = 0x002a3b;
|
||||
|
||||
constexpr uint32_t FORM_LIST_VENDOR_ITEMS = 0x0075CA;
|
||||
|
||||
constexpr uint32_t FACTION_SERVICES_VENDOR = 0x005AD4;
|
||||
|
Loading…
Reference in New Issue
Block a user