Skip to content

Commit

Permalink
allow nonid names for host
Browse files Browse the repository at this point in the history
  • Loading branch information
bmos committed Feb 12, 2022
1 parent a9028c7 commit a98d8b5
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions extension.xml
Expand Up @@ -17,5 +17,11 @@

<!-- Campaign records -->
<includefile source="campaign/record_parcel.xml" />

<!-- Scripts -->
<script name="PartyInventoryIDOptions" file="scripts/pii-options.lua" />

<!-- Strings -->
<includefile source="strings/strings_partyinventoryidentified.xml" />
</base>
</root>
27 changes: 27 additions & 0 deletions ps/ps_inventory.xml
Expand Up @@ -16,6 +16,33 @@

<windowclass name="ps_parcelitem" merge="join">
<sheetdata>
<hidden_record_isidentified name="isidentified">
<class>item</class>
<script>
function onInit()
if super.onInit then
super.onInit();
end

OptionsManager.registerCallback("PS-NONID-NAME", hideOrShowID);

This comment has been minimized.

Copy link
@bmos

bmos Feb 12, 2022

Author Collaborator

calls hideOrShowID function when option is changed

hideOrShowID();
end

function hideOrShowID()
if super then
super.ignorehost = (OptionsManager.isOption("PS-NONID-NAME", "on") and Session.IsHost)

This comment has been minimized.

Copy link
@bmos

bmos Feb 12, 2022

Author Collaborator

ignorehost is a variable in the hidden_record_isidentified template's script.
It causes the onValueChanged function in that script to show the non_id name field.

if super.onValueChanged then
super.onValueChanged()
end
end
end

function onClose()
OptionsManager.unregisterCallback("PS-NONID-NAME", hideOrShowID);

This comment has been minimized.

Copy link
@bmos

bmos Feb 12, 2022

Author Collaborator

unregistering the callback handler is important when closing the window to reduce background calculations and prevent multiple callback handlers being set if you close the window and open it again (which could re-run oninit).

end
</script>
</hidden_record_isidentified>

<button_record_isidentified name="identifyitem" insertbefore="assign">
<anchored width="20" height="20">
<top offset="2" />
Expand Down
10 changes: 10 additions & 0 deletions scripts/pii-options.lua
@@ -0,0 +1,10 @@
--
-- Please see the LICENSE.md file included with this distribution for attribution and copyright information.
--

-- search

function onInit()
OptionsManager.registerOption2('PS-NONID-NAME', false, 'option_header_game', 'opt_lab_ps_nonidname', 'option_entry_cycler',

This comment has been minimized.

Copy link
@bmos

bmos Feb 12, 2022

Author Collaborator

adds new option to options menu

{ labels = 'option_val_on', values = 'on', baselabel = 'option_val_off', baseval = 'off', default = 'off'})
end
8 changes: 8 additions & 0 deletions strings/strings_partyinventoryidentified.xml
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1"?>

<!-- Please see the LICENSE.md file included with this distribution for attribution and copyright information -->

<root>
<!-- options titles -->
<string name="opt_lab_ps_nonidname">GM: Un-ID'd Names on PS</string>
</root>

0 comments on commit a98d8b5

Please sign in to comment.