Add ListShops action to MCM menu
Very bare-bones and expiremental right now as I figure out the best UI for choosing shops.
This commit is contained in:
parent
e6a4b19f5a
commit
388fd7b7e0
@ -46,6 +46,7 @@ event OnPageReset(string page)
|
|||||||
SetCursorPosition(20)
|
SetCursorPosition(20)
|
||||||
AddTextOptionST("SAVE_REFS", "Save current shop state", "")
|
AddTextOptionST("SAVE_REFS", "Save current shop state", "")
|
||||||
AddTextOptionST("LOAD_REFS", "Load saved shop state", "")
|
AddTextOptionST("LOAD_REFS", "Load saved shop state", "")
|
||||||
|
AddTextOptionST("LIST_SHOPS", "List shops", "")
|
||||||
endif
|
endif
|
||||||
endEvent
|
endEvent
|
||||||
|
|
||||||
@ -240,4 +241,27 @@ state LOAD_SHOP_CONFIG
|
|||||||
event OnHighlightST()
|
event OnHighlightST()
|
||||||
SetInfoText("Overwrites the shop name and description with values saved on the server. Run this after updating any of your shop config values on the website.")
|
SetInfoText("Overwrites the shop name and description with values saved on the server. Run this after updating any of your shop config values on the website.")
|
||||||
endEvent
|
endEvent
|
||||||
|
endState
|
||||||
|
|
||||||
|
state LIST_SHOPS
|
||||||
|
event OnSelectST()
|
||||||
|
SetTextOptionValueST("Fetching...")
|
||||||
|
BR.ListShops()
|
||||||
|
|
||||||
|
int attempts = 0
|
||||||
|
while !BR.ListShopsComplete && attempts < 100
|
||||||
|
attempts += 1
|
||||||
|
Utility.WaitMenuMode(0.1)
|
||||||
|
endWhile
|
||||||
|
|
||||||
|
if attempts >= 100
|
||||||
|
Debug.Trace("BRMCMConfigMenu BR.ListShops failed. BR.ListShopsComplete still unset after 100 polls (10 seconds)")
|
||||||
|
endif
|
||||||
|
|
||||||
|
ForcePageReset()
|
||||||
|
endEvent
|
||||||
|
|
||||||
|
event OnHighlightST()
|
||||||
|
SetInfoText("Displays a list of shops on the server.")
|
||||||
|
endEvent
|
||||||
endState
|
endState
|
@ -16,6 +16,7 @@ ObjectReference property ShopXMarker auto
|
|||||||
bool property StartModFailed = false auto
|
bool property StartModFailed = false auto
|
||||||
bool property UpdateShopComplete = false auto
|
bool property UpdateShopComplete = false auto
|
||||||
bool property GetShopComplete = false auto
|
bool property GetShopComplete = false auto
|
||||||
|
bool property ListShopsComplete = false auto
|
||||||
UILIB_1 property UILib auto
|
UILIB_1 property UILib auto
|
||||||
string property BugReportCopy = "Please submit a bug on Nexus Mods with the contents of BazaarRealmPlugin.log and BazaarRealmClient.log usually located in C:\\Users\\<your user>\\Documents\\My Games\\Skyrim Special Edition\\SKSE." auto
|
string property BugReportCopy = "Please submit a bug on Nexus Mods with the contents of BazaarRealmPlugin.log and BazaarRealmClient.log usually located in C:\\Users\\<your user>\\Documents\\My Games\\Skyrim Special Edition\\SKSE." auto
|
||||||
|
|
||||||
@ -213,4 +214,29 @@ event OnGetShopFail(string error)
|
|||||||
Debug.Trace("BRQuestScript OnGetShopFail error: " + error)
|
Debug.Trace("BRQuestScript OnGetShopFail error: " + error)
|
||||||
Debug.MessageBox("Failed to get shop.\n\n" + error + "\n\n" + BugReportCopy)
|
Debug.MessageBox("Failed to get shop.\n\n" + error + "\n\n" + BugReportCopy)
|
||||||
GetShopComplete = true
|
GetShopComplete = true
|
||||||
|
endEvent
|
||||||
|
|
||||||
|
function ListShops()
|
||||||
|
Debug.Trace("BRQuestScript ListShops")
|
||||||
|
ListShopsComplete = false
|
||||||
|
bool result = BRShop.List(ApiUrl, ApiKey, self)
|
||||||
|
if !result
|
||||||
|
Debug.MessageBox("Failed to list shops.\n\n" + BugReportCopy)
|
||||||
|
ListShopsComplete = true
|
||||||
|
endif
|
||||||
|
endFunction
|
||||||
|
|
||||||
|
event OnListShopsSuccess(int[] ids, string[] names, string[] descriptions)
|
||||||
|
Debug.Trace("BRQuestScript OnListShopsSuccess ids.length: " + ids.Length + " names.length: " + names.Length + " descriptions.length: " + descriptions.Length)
|
||||||
|
int index = 0
|
||||||
|
int selectedIndex = UILib.ShowList("Shop Merchandise", names, 0, 0)
|
||||||
|
Debug.MessageBox(names[selectedIndex] + " (ID: " + ids[selectedIndex] + ")\n\n" + descriptions[selectedIndex])
|
||||||
|
UILib.ShowNotification("Chose " + names[selectedIndex] + ". Id: " + ids[selectedIndex], "#74C56D")
|
||||||
|
ListShopsComplete = true
|
||||||
|
endEvent
|
||||||
|
|
||||||
|
event OnListShopsFail(string error)
|
||||||
|
Debug.Trace("BRQuestScript OnListShopsFail error: " + error)
|
||||||
|
Debug.MessageBox("Failed to list shops.\n\n" + error + "\n\n" + BugReportCopy)
|
||||||
|
ListShopsComplete = true
|
||||||
endEvent
|
endEvent
|
@ -2,4 +2,5 @@ scriptname BRShop
|
|||||||
|
|
||||||
bool function Create(string apiUrl, string apiKey, string name, string description = "", quest quest) global native
|
bool function Create(string apiUrl, string apiKey, string name, string description = "", quest quest) global native
|
||||||
bool function Update(string apiUrl, string apiKey, int id, string name, string description = "", quest quest) global native
|
bool function Update(string apiUrl, string apiKey, int id, string name, string description = "", quest quest) global native
|
||||||
bool function Get(string apiUrl, string apiKey, int id, quest quest) global native
|
bool function Get(string apiUrl, string apiKey, int id, quest quest) global native
|
||||||
|
bool function List(string apiUrl, string apiKey, quest quest) global native
|
Loading…
Reference in New Issue
Block a user