BazaarRealmMod/Source/Scripts/BRMerchChestScript.psc

53 lines
2.2 KiB
Plaintext
Raw Normal View History

2020-10-13 01:26:16 +00:00
Scriptname BRMerchChestScript extends ObjectReference
Keyword property BRLinkMerchShelf auto
Keyword property BRLinkMerchChest auto
Keyword property BRLinkItemRef auto
Keyword property BRLinkActivatorRef auto
Keyword property BRLinkMerchToggle auto
Keyword property BRLinkMerchNext auto
Keyword property BRLinkMerchPrev auto
Activator property ActivatorStatic auto
2020-10-13 01:26:16 +00:00
Actor Property PlayerRef Auto
Quest Property BRQuest Auto
event OnMenuClose(string menuName)
if menuName == "ContainerMenu"
Debug.Trace("BRMerchChestScript container menu closed")
2020-10-13 01:26:16 +00:00
BRQuestScript BRScript = BRQuest as BRQuestScript
bool result = BRMerchandiseList.Create(BRScript.ApiUrl, BRScript.ApiKey, BRScript.ShopId, self)
if !result
Debug.MessageBox("Failed to save shop merchandise.\n\n" + BRScript.BugReportCopy)
2020-10-13 01:26:16 +00:00
endif
UnregisterForMenu("ContainerMenu")
endif
endEvent
event OnActivate(ObjectReference akActionRef)
if akActionRef == PlayerRef
Debug.Trace("BRMerchChestScript container was opened")
2020-10-13 01:26:16 +00:00
RegisterForMenu("ContainerMenu")
endif
endEvent
event OnCreateMerchandiseSuccess(bool created, int id)
Debug.Trace("BRMerchChestScript OnCreateMerchandiseSuccess created: " + created + " id: " + id)
if created
BRQuestScript BRScript = BRQuest as BRQuestScript
BRScript.MerchandiseListId = id;
Debug.Notification("Saved merchandise successfully")
ObjectReference merchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
if !BRMerchandiseList.Refresh(BRScript.ApiUrl, BRScript.ApiKey, BRScript.ActiveShopId, merchantShelf, ActivatorStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkActivatorRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
Debug.MessageBox("Failed refresh merchandise.\n\n" + BRScript.BugReportCopy)
endif
else
Debug.Trace("BRMerchChestScript no container changes to save to the server")
endif
endEvent
event OnCreateMerchandiseFail(string error)
Debug.Trace("BRMerchChestScript OnCreateMerchandiseFail error: " + error)
BRQuestScript BRScript = BRQuest as BRQuestScript
Debug.MessageBox("Failed to save shop merchandise.\n\n" + error + "\n\n" + BRScript.BugReportCopy)
2020-10-13 01:26:16 +00:00
endEvent