Skip to content

Commit 36e4a6b

Browse files
author
Wil Thieme
committed
display linked ammo name in place of counter
1 parent 859b387 commit 36e4a6b

File tree

6 files changed

+43
-12
lines changed

6 files changed

+43
-12
lines changed

campaign/5e_record_char_weapon.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
<basicnumber name="maxammo">
2525
<script file="common/scripts/number_crosslink_unlink.lua" />
2626
</basicnumber>
27+
<combobox_ammo name="ammopicker" source="ammunitionmanager.ammopicker">
28+
<anchored>
29+
<top parent="maxammo" anchor="top" offset="0" />
30+
<bottom parent="maxammo" anchor="bottom" offset="2" />
31+
<left parent="maxammo" anchor="right" offset="15" />
32+
<right parent="attackframe" anchor="right" offset="0" />
33+
</anchored>
34+
<itemsheetname><string /><field>subtype</field></itemsheetname>
35+
<itemsheetname><string /><field>type</field></itemsheetname>
36+
</combobox_ammo>
2737
</sheetdata>
2838
</windowclass>
2939

campaign/pfrpg2_record_char_actions.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@
4646
<basicnumber name="maxammo">
4747
<script file="common/scripts/number_crosslink_unlink.lua" />
4848
</basicnumber>
49+
<combobox_ammo name="ammopicker" source="ammunitionmanager.ammopicker">
50+
<anchored>
51+
<top parent="maxammo" anchor="top" offset="0" />
52+
<bottom parent="maxammo" anchor="bottom" offset="2" />
53+
<left parent="maxammo" anchor="right" offset="15" />
54+
<right parent="attackframe" anchor="right" offset="0" />
55+
</anchored>
56+
<itemsheetname><string /><field>subtype</field></itemsheetname>
57+
<itemsheetname><string /><field>type</field></itemsheetname>
58+
</combobox_ammo>
4959
</sheetdata>
5060
</windowclass>
5161

campaign/pfrpg_record_char_actions.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@
6363
<basicnumber name="maxammo">
6464
<script file="common/scripts/number_crosslink_unlink.lua" />
6565
</basicnumber>
66+
<combobox_ammo name="ammopicker" source="ammunitionmanager.ammopicker">
67+
<anchored>
68+
<top parent="maxammo" anchor="top" offset="0" />
69+
<bottom parent="maxammo" anchor="bottom" offset="2" />
70+
<left parent="maxammo" anchor="right" offset="15" />
71+
<right parent="attackframe" anchor="right" offset="15" />
72+
</anchored>
73+
<itemsheetname><string /><field>subtype</field></itemsheetname>
74+
<itemsheetname><string /><field>type</field></itemsheetname>
75+
</combobox_ammo>
6676
</sheetdata>
6777
</windowclass>
6878

campaign/scripts/5e_char_weapon.lua

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ function setAmmoVis(nodeWeapon, ...)
4646
isloaded.setVisible(bLoading)
4747

4848
local nodeAmmoLink = AmmunitionManager.getAmmoNode(nodeWeapon)
49-
ammocounter.setVisible(not nodeAmmoLink)
49+
local bRanged = AmmunitionManager.isWeaponRanged(nodeWeapon)
50+
ammocounter.setVisible(bRanged and not nodeAmmoLink)
51+
ammopicker.setComboBoxVisible(bRanged and nodeAmmoLink)
52+
ammopicker.setComboBoxReadOnly(true)
5053

5154
local nodeCount
5255
if nodeAmmoLink then nodeCount = DB.getChild(nodeAmmoLink, 'count') end
@@ -90,11 +93,9 @@ end
9093
function onInit()
9194
if super and super.onInit then super.onInit() end
9295

93-
if super then
94-
if super.onAttackAction then
95-
onAttackAction_old = super.onAttackAction
96-
super.onAttackAction = onAttackAction_new
97-
end
96+
if super and super.onAttackAction then
97+
onAttackAction_old = super.onAttackAction
98+
super.onAttackAction = onAttackAction_new
9899
end
99100

100101
local nodeWeapon = getDatabaseNode()
@@ -106,10 +107,8 @@ end
106107
function onClose()
107108
if super and super.onClose then super.onClose() end
108109

109-
if super then
110-
if super.onAttackAction then
111-
super.onAttackAction = onAttackAction_old
112-
end
110+
if super and super.onAttackAction then
111+
super.onAttackAction = onAttackAction_old
113112
end
114113

115114
local nodeWeapon = getDatabaseNode()

campaign/scripts/ammo_weapon.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ function onDataChanged()
3838
label_ammo.setVisible(bRanged)
3939
maxammo.setVisible(bRanged)
4040
ammocounter.setVisible(bRanged and not bInfiniteAmmo and not nodeAmmoLink)
41+
ammopicker.setComboBoxVisible(bRanged and not bInfiniteAmmo and nodeAmmoLink)
42+
ammopicker.setComboBoxReadOnly(true)
4143

4244
if not maxammo.setLink then return end
4345

extension.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<root version='3.3' release='3'>
66
<properties>
77
<name>Feature: Ammunition Manager</name>
8-
<version>4.0</version>
8+
<version>4.1</version>
99
<author>bmos (Wil Thieme)</author>
1010
<description>This extension aids in tracking ammunition and whether ranged weapons are loaded.</description>
1111
<ruleset>
@@ -26,7 +26,7 @@
2626
<loadorder>34</loadorder>
2727
</properties>
2828

29-
<announcement text="https://github.com/bmos/FG-PFRPG-Ammunition-Manager\nAmmunition Manager v4.0-hotfix.4:\nThis extension aids in tracking ammunition and whether ranged weapons are loaded." font="emotefont" icon="archery_ammomanager" />
29+
<announcement text="https://github.com/bmos/FG-PFRPG-Ammunition-Manager\nAmmunition Manager v4.1:\nThis extension aids in tracking ammunition and whether ranged weapons are loaded." font="emotefont" icon="archery_ammomanager" />
3030

3131
<base>
3232
<!-- Campaign Records -->

0 commit comments

Comments
 (0)