Get/Set merch and refs by shop id
Also, rename placeholder to activator. Some MCM UI improvements.
This commit is contained in:
parent
40350de32e
commit
69b87517ec
BIN
Bazaar Realm.esp
BIN
Bazaar Realm.esp
Binary file not shown.
@ -83,6 +83,7 @@ endState
|
|||||||
state START_MOD
|
state START_MOD
|
||||||
event OnSelectST()
|
event OnSelectST()
|
||||||
if BR.StartMod()
|
if BR.StartMod()
|
||||||
|
SetOptionFlagsST(OPTION_FLAG_DISABLED)
|
||||||
int attempts = 0
|
int attempts = 0
|
||||||
while BR.ShopId == 0 && !BR.StartModFailed && attempts < 100
|
while BR.ShopId == 0 && !BR.StartModFailed && attempts < 100
|
||||||
attempts += 1
|
attempts += 1
|
||||||
@ -123,7 +124,9 @@ endState
|
|||||||
|
|
||||||
state LOAD_REFS
|
state LOAD_REFS
|
||||||
event OnSelectST()
|
event OnSelectST()
|
||||||
|
SetTextOptionValueST("Loading...")
|
||||||
BR.LoadInteriorRefs()
|
BR.LoadInteriorRefs()
|
||||||
|
SetTextOptionValueST("")
|
||||||
endEvent
|
endEvent
|
||||||
|
|
||||||
event OnHighlightST()
|
event OnHighlightST()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
scriptname BRMerchPlaceholderScript extends ObjectReference
|
scriptname BRMerchActivatorScript extends ObjectReference
|
||||||
|
|
||||||
Actor Property PlayerRef Auto
|
Actor Property PlayerRef Auto
|
||||||
|
|
@ -3,10 +3,11 @@ scriptname BRMerchNextPageScript extends ObjectReference
|
|||||||
Keyword property BRLinkMerchShelf auto
|
Keyword property BRLinkMerchShelf auto
|
||||||
Keyword property BRLinkMerchChest auto
|
Keyword property BRLinkMerchChest auto
|
||||||
Keyword property BRLinkItemRef auto
|
Keyword property BRLinkItemRef auto
|
||||||
|
Keyword property BRLinkActivatorRef auto
|
||||||
Keyword property BRLinkMerchToggle auto
|
Keyword property BRLinkMerchToggle auto
|
||||||
Keyword property BRLinkMerchNext auto
|
Keyword property BRLinkMerchNext auto
|
||||||
Keyword property BRLinkMerchPrev auto
|
Keyword property BRLinkMerchPrev auto
|
||||||
Activator property PlaceholderStatic auto
|
Activator property ActivatorStatic auto
|
||||||
Actor property PlayerRef auto
|
Actor property PlayerRef auto
|
||||||
Quest Property BRQuest Auto
|
Quest Property BRQuest Auto
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ event OnActivate(ObjectReference akActionRef)
|
|||||||
if akActionRef == PlayerRef
|
if akActionRef == PlayerRef
|
||||||
ObjectReference MerchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
|
ObjectReference MerchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
|
||||||
BRQuestScript BRScript = BRQuest as BRQuestScript
|
BRQuestScript BRScript = BRQuest as BRQuestScript
|
||||||
bool result = BRMerchandiseList.NextPage(BRScript.ApiUrl, BRScript.ApiKey, BRScript.MerchandiseListId, MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
|
bool result = BRMerchandiseList.NextPage(BRScript.ApiUrl, BRScript.ApiKey, BRScript.ActiveShopId, MerchantShelf, ActivatorStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkActivatorRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
|
||||||
Debug.Trace("BRMerchandiseList.NextPage result: " + result)
|
Debug.Trace("BRMerchandiseList.NextPage result: " + result)
|
||||||
if !result
|
if !result
|
||||||
Debug.MessageBox("Failed to load or clear shop merchandise.\n\n" + BRScript.BugReportCopy)
|
Debug.MessageBox("Failed to load or clear shop merchandise.\n\n" + BRScript.BugReportCopy)
|
||||||
|
@ -3,10 +3,11 @@ scriptname BRMerchPrevPageScript extends ObjectReference
|
|||||||
Keyword property BRLinkMerchShelf auto
|
Keyword property BRLinkMerchShelf auto
|
||||||
Keyword property BRLinkMerchChest auto
|
Keyword property BRLinkMerchChest auto
|
||||||
Keyword property BRLinkItemRef auto
|
Keyword property BRLinkItemRef auto
|
||||||
|
Keyword property BRLinkActivatorRef auto
|
||||||
Keyword property BRLinkMerchToggle auto
|
Keyword property BRLinkMerchToggle auto
|
||||||
Keyword property BRLinkMerchNext auto
|
Keyword property BRLinkMerchNext auto
|
||||||
Keyword property BRLinkMerchPrev auto
|
Keyword property BRLinkMerchPrev auto
|
||||||
Activator property PlaceholderStatic auto
|
Activator property ActivatorStatic auto
|
||||||
Actor property PlayerRef auto
|
Actor property PlayerRef auto
|
||||||
Quest Property BRQuest Auto
|
Quest Property BRQuest Auto
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ event OnActivate(ObjectReference akActionRef)
|
|||||||
if akActionRef == PlayerRef
|
if akActionRef == PlayerRef
|
||||||
ObjectReference MerchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
|
ObjectReference MerchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
|
||||||
BRQuestScript BRScript = BRQuest as BRQuestScript
|
BRQuestScript BRScript = BRQuest as BRQuestScript
|
||||||
bool result = BRMerchandiseList.PrevPage(BRScript.ApiUrl, BRScript.ApiKey, BRScript.MerchandiseListId, MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
|
bool result = BRMerchandiseList.PrevPage(BRScript.ApiUrl, BRScript.ApiKey, BRScript.ActiveShopId, MerchantShelf, ActivatorStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkActivatorRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
|
||||||
Debug.Trace("BRMerchandiseList.PrevPage result: " + result)
|
Debug.Trace("BRMerchandiseList.PrevPage result: " + result)
|
||||||
if !result
|
if !result
|
||||||
Debug.MessageBox("Failed to load or clear shop merchandise.\n\n" + BRScript.BugReportCopy)
|
Debug.MessageBox("Failed to load or clear shop merchandise.\n\n" + BRScript.BugReportCopy)
|
||||||
|
@ -3,10 +3,11 @@ scriptname BRMerchToggleScript extends ObjectReference
|
|||||||
Keyword property BRLinkMerchShelf auto
|
Keyword property BRLinkMerchShelf auto
|
||||||
Keyword property BRLinkMerchChest auto
|
Keyword property BRLinkMerchChest auto
|
||||||
Keyword property BRLinkItemRef auto
|
Keyword property BRLinkItemRef auto
|
||||||
|
Keyword property BRLinkActivatorRef auto
|
||||||
Keyword property BRLinkMerchToggle auto
|
Keyword property BRLinkMerchToggle auto
|
||||||
Keyword property BRLinkMerchNext auto
|
Keyword property BRLinkMerchNext auto
|
||||||
Keyword property BRLinkMerchPrev auto
|
Keyword property BRLinkMerchPrev auto
|
||||||
Activator property PlaceholderStatic auto
|
Activator property ActivatorStatic auto
|
||||||
Actor property PlayerRef auto
|
Actor property PlayerRef auto
|
||||||
Quest Property BRQuest Auto
|
Quest Property BRQuest Auto
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ event OnActivate(ObjectReference akActionRef)
|
|||||||
if akActionRef == PlayerRef
|
if akActionRef == PlayerRef
|
||||||
ObjectReference MerchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
|
ObjectReference MerchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
|
||||||
BRQuestScript BRScript = BRQuest as BRQuestScript
|
BRQuestScript BRScript = BRQuest as BRQuestScript
|
||||||
bool result = BRMerchandiseList.Toggle(BRScript.ApiUrl, BRScript.ApiKey, BRScript.MerchandiseListId, MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
|
bool result = BRMerchandiseList.Toggle(BRScript.ApiUrl, BRScript.ApiKey, BRScript.ActiveShopId, MerchantShelf, ActivatorStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkActivatorRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
|
||||||
Debug.Trace("BRMerchandiseList.Toggle result: " + result)
|
Debug.Trace("BRMerchandiseList.Toggle result: " + result)
|
||||||
if !result
|
if !result
|
||||||
Debug.MessageBox("Failed to load or clear shop merchandise.\n\n" + BRScript.BugReportCopy)
|
Debug.MessageBox("Failed to load or clear shop merchandise.\n\n" + BRScript.BugReportCopy)
|
||||||
@ -25,7 +26,7 @@ endEvent
|
|||||||
event OnLoadMerchandiseSuccess(bool result)
|
event OnLoadMerchandiseSuccess(bool result)
|
||||||
Debug.Trace("BRMerchToggleScript OnLoadMerchandiseSuccess result: " + result)
|
Debug.Trace("BRMerchToggleScript OnLoadMerchandiseSuccess result: " + result)
|
||||||
ObjectReference MerchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
|
ObjectReference MerchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
|
||||||
while !BRMerchandiseList.Replace3D(MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkItemRef)
|
while !BRMerchandiseList.Replace3D(MerchantShelf, ActivatorStatic, BRLinkMerchShelf, BRLinkItemRef)
|
||||||
Debug.Trace("BRMerchandiseList.Replace3D returned false, waiting and trying again")
|
Debug.Trace("BRMerchandiseList.Replace3D returned false, waiting and trying again")
|
||||||
Utility.Wait(0.05)
|
Utility.Wait(0.05)
|
||||||
endWhile
|
endWhile
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
scriptname BRMerchandiseList
|
scriptname BRMerchandiseList
|
||||||
|
|
||||||
; TODO: a save function that saves the merch to the server, load should load from server
|
; TODO: a save function that saves the merch to the server, load should load from server
|
||||||
bool function Toggle(string apiUrl, string apiKey, int merchandise_list_id, ObjectReference merchantShelf, Form placeholderStatic, Keyword shelfKeyword, Keyword chestKeyword, Keyword itemKeyword, Keyword toggleKeyword, Keyword nextKeyword, Keyword prevKeyword) global native
|
bool function Toggle(string apiUrl, string apiKey, int shop_id, ObjectReference merchantShelf, Form activatorStatic, Keyword shelfKeyword, Keyword chestKeyword, Keyword itemKeyword, Keyword activatorKeyword, Keyword toggleKeyword, Keyword nextKeyword, Keyword prevKeyword) global native
|
||||||
bool function NextPage(string apiUrl, string apiKey, int merchandise_list_id, ObjectReference merchantShelf, Form placeholderStatic, Keyword shelfKeyword, Keyword chestKeyword, Keyword itemKeyword, Keyword toggleKeyword, Keyword nextKeyword, Keyword prevKeyword) global native
|
bool function NextPage(string apiUrl, string apiKey, int shop_id, ObjectReference merchantShelf, Form activatorStatic, Keyword shelfKeyword, Keyword chestKeyword, Keyword itemKeyword, Keyword activatorKeyword, Keyword toggleKeyword, Keyword nextKeyword, Keyword prevKeyword) global native
|
||||||
bool function PrevPage(string apiUrl, string apiKey, int merchandise_list_id, ObjectReference merchantShelf, Form placeholderStatic, Keyword shelfKeyword, Keyword chestKeyword, Keyword itemKeyword, Keyword toggleKeyword, Keyword nextKeyword, Keyword prevKeyword) global native
|
bool function PrevPage(string apiUrl, string apiKey, int shop_id, ObjectReference merchantShelf, Form activatorStatic, Keyword shelfKeyword, Keyword chestKeyword, Keyword itemKeyword, Keyword activatorKeyword, Keyword toggleKeyword, Keyword nextKeyword, Keyword prevKeyword) global native
|
||||||
|
|
||||||
bool function Replace3D(ObjectReference merchantShelf, Form placeholderStatic, Keyword shelfKeyword, Keyword itemKeyword) global native
|
bool function Replace3D(ObjectReference merchantShelf, Form activatorStatic, Keyword shelfKeyword, Keyword itemKeyword) global native
|
||||||
|
|
||||||
Form function Buy(ObjectReference merchandisePlaceholder) global native
|
Form function Buy(ObjectReference merchandiseActivator) global native
|
||||||
|
|
||||||
bool function Create(string apiUrl, string apiKey, int shopId, ObjectReference merchantChest) global native
|
bool function Create(string apiUrl, string apiKey, int shopId, ObjectReference merchantChest) global native
|
Loading…
Reference in New Issue
Block a user