From 233cfc7715ff3c1ccda35161665940cfd6d59eba Mon Sep 17 00:00:00 2001 From: Techwizz-somboo Date: Sat, 5 Feb 2022 01:25:08 -0700 Subject: [PATCH] Removed SkyUI 2.2 SKSE checks --- scripts/ski_main.pex | Bin 0 -> 6895 bytes source/scripts/ski_main.psc | 277 ++++++++++++++++++++++++++++++++++++ 2 files changed, 277 insertions(+) create mode 100644 scripts/ski_main.pex create mode 100644 source/scripts/ski_main.psc diff --git a/scripts/ski_main.pex b/scripts/ski_main.pex new file mode 100644 index 0000000000000000000000000000000000000000..52cbf66fe321fac578d3bf1ee2dcea14ce9b7026 GIT binary patch literal 6895 zcmbVQS!^5U5uPP=P_$(0uzVYx*g%slQ(ZeA#avV!!yI%E2isNj!k+ST!8vv@0Q8w+K#M1#}D zl2vRF?;0~)-*g+~d&eEyM<}*f+Bsz{`VAWfrj3;b;oeDO)p0G~^ct2DQ>H)T8@@?h zQ;zQ_wj*a}Y|E$aoIPb!OnB)SB}(RO-kw`AZE8=uuH#a#_{P%E_1z-L_+~{+Ih7U1 zMkqY$Shh+f?A%s#?2_dpOh%b{xEP+Unw~$#VH_%8v5C8FV~$g%T_}vL;x{ldB8VnT z-z@rOsjzCeIL>OGhr-fU;oFJx8{;=rSZo@=-Gzm%Q`eS-=hSWhN|`!GMi7#f$Eah* zcP)E~x<*E9tTW6u&nz#}j=Z^Kd8mO&N6LWuF5B)VQBPf6QD=~A>Z$WRGPEc1= zbre658m4&0_QTavA#;)vVM&FeVQD~}Q%OB_rAXc9ovMo*28(qS7H&UA$y!}ghf%2T zK?xO$s9MflxU@BxTTc0wn)8&rLwbNlv7+yD$%qShCx zjfofrX-{xknEf&W>xuHNP&ta^MP8#$qhPvjro{QGcuOI&;SW6)y7>wU^9=>JlZVP0ury z%rWN83>0;UNyvQcYZA8-Y#7HVh*E5T9=9-Das~(?Z*t%0LVXumI5P&0k)jk?n z)-7MGxMn2b?36L(JYNqsr04-IYvoNK(<_!&G5q4PzKGmX3;_Bu=&P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sJ^PW=pCoTW#uV+@!jw)h7I~-)u=$eXC9Qt-pDbDvef~ e@biE3CYAG6n^f^{p+UQlo|ln@;KM%!o&N)bS$Q%5 literal 0 HcmV?d00001 diff --git a/source/scripts/ski_main.psc b/source/scripts/ski_main.psc new file mode 100644 index 00000000..631f01e2 --- /dev/null +++ b/source/scripts/ski_main.psc @@ -0,0 +1,277 @@ +scriptname SKI_Main extends SKI_QuestBase + +; CONSTANTS --------------------------------------------------------------------------------------- + +string property HUD_MENU = "HUD Menu" autoReadOnly +string property INVENTORY_MENU = "InventoryMenu" autoReadonly +string property MAGIC_MENU = "MagicMenu" autoReadonly +string property CONTAINER_MENU = "ContainerMenu" autoReadonly +string property BARTER_MENU = "BarterMenu" autoReadonly +string property GIFT_MENU = "GiftMenu" autoReadonly +string property JOURNAL_MENU = "Journal Menu" autoReadonly +string property MAP_MENU = "MapMenu" autoReadonly +string property FAVORITES_MENU = "FavoritesMenu" autoReadonly + +int property ERR_SWF_INVALID = 5 autoReadonly +int property ERR_SWF_VERSION = 6 autoReadonly + + +; PRIVATE VARIABLES ------------------------------------------------------------------------------- + +bool _inventoryMenuCheckEnabled = true +bool _magicMenuCheckEnabled = true +bool _barterMenuCheckEnabled = true +bool _containerMenuCheckEnabled = true +bool _giftMenuCheckEnabled = true +bool _mapMenuCheckEnabled = true +bool _favoritesMenuCheckEnabled = true + + +; PROPERTIES -------------------------------------------------------------------------------------- + +int property ReqSWFRelease = 16 autoReadonly +string property ReqSWFVersion = "4.1" autoReadonly + +bool property ErrorDetected = false auto + + +bool property InventoryMenuCheckEnabled + bool function get() + return _inventoryMenuCheckEnabled + endFunction + + function set(bool a_val) + _inventoryMenuCheckEnabled = a_val + if (a_val) + RegisterForMenu(INVENTORY_MENU) + else + UnregisterForMenu(INVENTORY_MENU) + endIf + endFunction +endProperty + +bool property MagicMenuCheckEnabled + bool function get() + return _magicMenuCheckEnabled + endFunction + + function set(bool a_val) + _magicMenuCheckEnabled = a_val + if (a_val) + RegisterForMenu(MAGIC_MENU) + else + UnregisterForMenu(MAGIC_MENU) + endIf + endFunction +endProperty + +bool property BarterMenuCheckEnabled + bool function get() + return _barterMenuCheckEnabled + endFunction + + function set(bool a_val) + _barterMenuCheckEnabled = a_val + if (a_val) + RegisterForMenu(BARTER_MENU) + else + UnregisterForMenu(BARTER_MENU) + endIf + endFunction +endProperty + +bool property ContainerMenuCheckEnabled + bool function get() + return _containerMenuCheckEnabled + endFunction + + function set(bool a_val) + _containerMenuCheckEnabled = a_val + if (a_val) + RegisterForMenu(CONTAINER_MENU) + else + UnregisterForMenu(CONTAINER_MENU) + endIf + endFunction +endProperty + +bool property GiftMenuCheckEnabled + bool function get() + return _giftMenuCheckEnabled + endFunction + + function set(bool a_val) + _giftMenuCheckEnabled = a_val + if (a_val) + RegisterForMenu(GIFT_MENU) + else + UnregisterForMenu(GIFT_MENU) + endIf + endFunction +endProperty + +bool property MapMenuCheckEnabled + bool function get() + return _mapMenuCheckEnabled + endFunction + + function set(bool a_val) + _mapMenuCheckEnabled = a_val + if (a_val) + RegisterForMenu(MAP_MENU) + else + UnregisterForMenu(MAP_MENU) + endIf + endFunction +endProperty + +bool property FavoritesMenuCheckEnabled + bool function get() + return _favoritesMenuCheckEnabled + endFunction + + function set(bool a_val) + _favoritesMenuCheckEnabled = a_val + if (a_val) + RegisterForMenu(FAVORITES_MENU) + else + UnregisterForMenu(FAVORITES_MENU) + endIf + endFunction +endProperty + + +; INITIALIZATION ---------------------------------------------------------------------------------- + +event OnInit() + OnGameReload() +endEvent + +; @implements SKI_QuestBase +event OnGameReload() + ErrorDetected = false + + ; Check menus, when they're opened + if (InventoryMenuCheckEnabled) + RegisterForMenu(INVENTORY_MENU) + endIf + + if (MagicMenuCheckEnabled) + RegisterForMenu(MAGIC_MENU) + endIf + + if (ContainerMenuCheckEnabled) + RegisterForMenu(CONTAINER_MENU) + endIf + + if (BarterMenuCheckEnabled) + RegisterForMenu(BARTER_MENU) + endIf + + if (GiftMenuCheckEnabled) + RegisterForMenu(GIFT_MENU) + endIf + + if (MapMenuCheckEnabled) + RegisterForMenu(MAP_MENU) + endIf + + if (FavoritesMenuCheckEnabled) + RegisterForMenu(FAVORITES_MENU) + endIf + + RegisterForMenu(JOURNAL_MENU) +endEvent + + +; EVENTS ------------------------------------------------------------------------------------------ + +event OnMenuOpen(string a_menuName) + if (a_menuName == INVENTORY_MENU) + if (CheckMenuVersion("inventorymenu.swf", a_menuName, "_global.InventoryMenu") && \ + CheckItemMenuComponents(a_menuName)) + ; Only unregister if all checks have been performed (regardless of check result) + UnregisterForMenu(a_menuName) + endIf + + elseIf (a_menuName == MAGIC_MENU) + if (CheckMenuVersion("magicmenu.swf", a_menuName, "_global.MagicMenu") && \ + CheckItemMenuComponents(a_menuName)) + UnregisterForMenu(a_menuName) + endIf + + elseIf (a_menuName == CONTAINER_MENU) + if (CheckMenuVersion("containermenu.swf", a_menuName, "_global.ContainerMenu") && \ + CheckItemMenuComponents(a_menuName)) + UnregisterForMenu(a_menuName) + endIf + + elseIf (a_menuName == BARTER_MENU) + if (CheckMenuVersion("bartermenu.swf", a_menuName, "_global.BarterMenu") && \ + CheckItemMenuComponents(a_menuName)) + UnregisterForMenu(a_menuName) + endIf + + elseIf (a_menuName == GIFT_MENU) + if (CheckMenuVersion("giftmenu.swf", a_menuName, "_global.GiftMenu") && \ + CheckItemMenuComponents(a_menuName)) + UnregisterForMenu(a_menuName) + endIf + + elseIf (a_menuName == JOURNAL_MENU) + if (CheckMenuVersion("quest_journal.swf", a_menuName, "_global.Quest_Journal") && \ + CheckMenuVersion("skyui/configpanel.swf", a_menuName, "_global.ConfigPanel")) + UnregisterForMenu(a_menuName) + endIf + + elseIf (a_menuName == MAP_MENU) + if (CheckMenuVersion("map.swf", a_menuName, "_global.Map.MapMenu")) + UnregisterForMenu(a_menuName) + endIf + + elseIf (a_menuName == FAVORITES_MENU) + if (CheckMenuVersion("favoritesmenu.swf", a_menuName, "_global.FavoritesMenu")) + UnregisterForMenu(a_menuName) + endIf + endIf +endEvent + + +; FUNCTIONS --------------------------------------------------------------------------------------- + +function Error(int a_errId, string a_msg) + Debug.MessageBox("SKYUI ERROR CODE " + a_errId + "\n\n" + a_msg + "\n\nFor help, see the SkyUI mod description.") + ErrorDetected = true +endFunction + +bool function CheckMenuVersion(string a_swfName, string a_menu, string a_class) + ; Returns false if the menu is closed before UI.Get* receive their value + + int releaseIdx = UI.GetInt(a_menu, a_class + ".SKYUI_RELEASE_IDX") + string version = UI.GetString(a_menu, a_class + ".SKYUI_VERSION_STRING") + + if (!UI.IsMenuOpen(a_menu)) + return false + endIf + + if (releaseIdx == 0) + Error(ERR_SWF_INVALID, "Incompatible menu file (" + a_swfName + ").\nPlease make sure you installed everything correctly and no other mod has overwritten this file.\n" \ + + "If you were using an older SkyUI version, un-install it and re-install the latest version.") + + elseIf (releaseIdx != ReqSWFRelease) + Error(ERR_SWF_VERSION, "Menu file version mismatch for " + a_swfName + ".\n" \ + + "Required version: " + ReqSWFVersion + "\n" \ + + "Detected version: " + version) + + endIf + + return true +endFunction + +bool function CheckItemMenuComponents(string a_menu) + ; Returns false if the menu is closed before all checks have finished + + return CheckMenuVersion("skyui/itemcard.swf", a_menu, "_global.ItemCard") && \ + CheckMenuVersion("skyui/bottombar.swf", a_menu, "_global.BottomBar") && \ + CheckMenuVersion("skyui/inventorylists.swf", a_menu, "_global.InventoryLists") +endFunction