Skip to content

Commit

Permalink
v4.21
Browse files Browse the repository at this point in the history
  • Loading branch information
bmos committed Jun 27, 2021
1 parent 3d6cd71 commit 375b6e1
Show file tree
Hide file tree
Showing 4 changed files with 295 additions and 0 deletions.
107 changes: 107 additions & 0 deletions campaign/record_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="iso-8859-1"?>

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

<root>
<windowclass name="item" merge="join">
<sheetdata>
<subwindow_record name="main">
<script file="campaign/scripts/item_drop.lua" />
</subwindow_record>
</sheetdata>
</windowclass>

<windowclass name="item_main" merge="join">
<margins control="0,0,0,2" />
<script file="campaign/scripts/item_main.lua" />
<sheetdata>
<label_column name="charge_label" insertbefore="divider4">
<anchored>
<top offset="16" />
</anchored>
<static textres="item_label_charges" />
</label_column>
<number_columnh name="charge" insertbefore="divider4">
<anchored width="60" >
<top offset="16" />
</anchored>
<stateframe>
<drophilight name="fieldfocusplus" />
</stateframe>
<script>
function onDrop(x, y, draginfo)
if draginfo.isType("number") then
setValue(getValue() + draginfo.getNumberData());
return true;
end
end
</script>
</number_columnh>

<label_fieldtop name="current_label" insertbefore="divider4">
<anchored to="charge" />
<static textres="item_label_curent" size="50%" />
</label_fieldtop>

<number_columnh name="maxcharges" insertbefore="divider4">
<anchored to="charge" width="60" >
<top offset="-20" relation="current" />
</anchored>
<default>50</default>
<gmeditonly />
<stateframe>
<drophilight name="fieldfocusplus" />
</stateframe>
<script>
function onDrop(x, y, draginfo)
if draginfo.isType("number") then
setValue(getValue() + draginfo.getNumberData());
return true;
end
end
</script>
</number_columnh>

<label_fieldtop name="maxcharges_label" insertbefore="divider4">
<anchored to="maxcharges" />
<static textres="item_label_max_charges" size="50%" />
</label_fieldtop>

<label_column name="equipslot_label" insertbefore="divider4">
<static textres="item_label_equipslot" />
</label_column>
<string_columnh name="equipslot" insertbefore="divider4">
<gmeditonly />
</string_columnh>

<line_column name="divider6" />

<label_column name="gmonly_label">
<static textres="item_label_gmonly" />
</label_column>
<ft_columnh name="gmonly">
<anchored>
<left offset="97" />
<right offset="-5" />
</anchored>
<gmeditonly />
</ft_columnh>

<line_column name="divider5" />

<ft_columnh name="description">
<gmeditonly />
</ft_columnh>

<label_column name="sourcebook_label">
<static textres="item_label_sourcebook" />
</label_column>
<string_columnh name="sourcebook">
<gmeditonly />
</string_columnh>
</sheetdata>
</windowclass>
</root>
149 changes: 149 additions & 0 deletions campaign/scripts/item_main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
--
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--

function onInit()
update();
end

function VisDataCleared()
update();
end

function InvisDataAdded()
update();
end

function updateControl(sControl, bReadOnly, bID)
if not self[sControl] then
return false;
end

if not bID then
return self[sControl].update(bReadOnly, true);
end

return self[sControl].update(bReadOnly);
end

function update()
local nodeRecord = getDatabaseNode();
local bReadOnly = WindowManager.getReadOnlyState(nodeRecord);
local bID, bOptionID = ItemManager.getIDState(nodeRecord);

local sType = type.getValue();
local bWeapon
local bArmor
local bWand
local bStaff
local bWondrous

if sType:match("Weapon") then
bWeapon = true;
else
bWeapon = false;
end
if sType:match("Armor") then
bArmor = true;
else
bArmor = false;
end
if sType:match("Wand") then
bWand = true;
else
bWand = false;
end
if sType:match("Staff") then
bStaff = true;
else
bStaff = false;
end
if sType:match("Wondrous Item") then
bWondrous = true;
else
bWondrous = false;
end


local bSection1 = false;
if bOptionID and User.isHost() then
if updateControl("nonid_name", bReadOnly, true) then bSection1 = true; end;
else
updateControl("nonid_name", false);
end
if bOptionID and (User.isHost() or not bID) then
if updateControl("nonidentified", bReadOnly, true) then bSection1 = true; end;
else
updateControl("nonidentified", false);
end

local bSection2 = false;
if updateControl("type", bReadOnly, bID) then bSection2 = true; end
if updateControl("subtype", bReadOnly, bID) then bSection2 = true; end

local bSection3 = false;
if updateControl("cost", bReadOnly, bID) then bSection3 = true; end
if updateControl("weight", bReadOnly, bID) then bSection3 = true; end
if updateControl("size", bReadOnly, bID) then bSection3 = true; end

local bSection4 = false;
if updateControl("damage", bReadOnly, bID and bWeapon) then bSection4 = true; end
if updateControl("damagetype", bReadOnly, bID and bWeapon) then bSection4 = true; end
if updateControl("critical", bReadOnly, bID and bWeapon) then bSection4 = true; end
if updateControl("range", bReadOnly, bID and bWeapon) then bSection4 = true; end

if updateControl("ac", bReadOnly, bID and bArmor) then bSection4 = true; end
if updateControl("maxstatbonus", bReadOnly, bID and bArmor) then bSection4 = true; end
if updateControl("checkpenalty", bReadOnly, bID and bArmor) then bSection4 = true; end
if updateControl("spellfailure", bReadOnly, bID and bArmor) then bSection4 = true; end
if updateControl("speed30", bReadOnly, bID and bArmor) then bSection4 = true; end
if updateControl("speed20", bReadOnly, bID and bArmor) then bSection4 = true; end

current_label.setVisible(false);
maxcharges.setVisible(false);
maxcharges_label.setVisible(false);
if updateControl("charge", bReadOnly, bID and (bWand or bStaff)) then
current_label.setVisible(true);
maxcharges.setVisible(true);
maxcharges.setReadOnly(bReadOnly);
maxcharges_label.setVisible(true);
bSection4 = true;
end
charge.setReadOnly(false);

if updateControl("equipslot", bReadOnly, bID and bWondrous) then bSection4 = true; end

if updateControl("properties", bReadOnly, bID and (bWeapon or bArmor)) then bSection4 = true; end

local bSection5 = false;
if updateControl("bonus", bReadOnly, bID and (bWeapon or bArmor)) then bSection5 = true; end
if updateControl("aura", bReadOnly, bID) then bSection5 = true; end
if updateControl("cl", bReadOnly, bID) then bSection5 = true; end
if updateControl("prerequisites", bReadOnly, bID) then bSection5 = true; end

local bSection6 = bID;
description.setVisible(bID);
description.setReadOnly(bReadOnly);
updateControl("sourcebook", bReadOnly, bID);

local bSection7 = false;
divider6.setVisible(false);
gmonly_label.setVisible(false);
gmonly.setVisible(false);

if bOptionID and User.isHost() then
if updateControl("gmonly", bReadOnly, true) then bSection7 = true; end
else
updateControl("gmonly", bReadOnly, false);
end
if User.isHost() then
divider6.setVisible((bSection1 or bSection2 or bSection3 or bSection4 or bSection5) and bSection7);
end

divider.setVisible(bSection1 and bSection2);
divider2.setVisible((bSection1 or bSection2) and bSection3);
divider3.setVisible((bSection1 or bSection2 or bSection3) and bSection4);
divider4.setVisible((bSection1 or bSection2 or bSection3 or bSection4) and bSection5);
divider5.setVisible((bSection1 or bSection2 or bSection3 or bSection4 or bSection5) and bSection6);
end
29 changes: 29 additions & 0 deletions extension.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="iso-8859-1"?>

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

<root version="3.1">
<properties>
<name>PFRPG - Enhanced Items v4.21</name>
<version>4.21</version>
<author>Llisandur</author>
<description>Enhanced Item fields for 3.5E and Pathfinder</description>
<ruleset>
<name>3.5E</name>
</ruleset>
<ruleset>
<name>PFRPG</name>
</ruleset>
<loadorder>50</loadorder>
</properties>
<announcement text="PFRPG - Enhanced Items v4.21\nFor Fantasy Grounds v3.3+ and the Pathfinder Rulesets\nBy Llisandur, based on the work by Sciencephile and Jwguy with contributions from rmilmine" font="emotefont"/>
<base>
<!-- Strings -->
<includefile source="strings/strings.xml" />
<!-- Campaign Records -->
<includefile source="campaign/record_item.xml" />
</base>
</root>
10 changes: 10 additions & 0 deletions strings/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

<root>
<string name="item_label_charges">Charges</string>
<string name="item_label_curent">Current</string>
<string name="item_label_equipslot">Slot</string>
<string name="item_label_gmonly">GM Notes</string>
<string name="item_label_max_charges">Maximum</string>
<string name="item_label_size">Size</string>
<string name="item_label_sourcebook">Source</string>
</root>

0 comments on commit 375b6e1

Please sign in to comment.