Skip to content

Commit 2bf9625

Browse files
authored
Merge pull request #1 from spako/cyberpunkred_init_mod_aimed_shot_v2
Cyberpunkred init mod aimed shot v2
2 parents 3cfd7a8 + c29f3ea commit 2bf9625

File tree

2 files changed

+151
-38
lines changed

2 files changed

+151
-38
lines changed

CyberpunkRED_raycw/cyberpunkred-raycw.css

Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ input[type=number] {
5555
box-shadow: none;
5656
}
5757

58-
5958
.sheet-netruntoggle[value="nbi"] ~ div.sheet-nbiprogram,
6059
.sheet-netruntoggle[value="blackice"] ~ div.sheet-blackice,
6160
.sheet-netruntoggle[value="hardware"] ~ div.sheet-hardware {
@@ -868,7 +867,7 @@ select {
868867
}
869868

870869
/* Configure the button styling. This example makes it look like a checkbox. */
871-
button.sheet-toggle, button.sheet-mooktoggle {
870+
button.sheet-toggle, button.sheet-mooktoggle, button.sheet-settings-toggle {
872871
padding: 0;
873872
border: none;
874873
background: none;
@@ -885,7 +884,8 @@ button.sheet-toggle, button.sheet-mooktoggle {
885884
font-weight: bold;
886885
}
887886

888-
.sheet-settings .sheet-settings-checkbox button.sheet-mooktoggle {
887+
.sheet-settings .sheet-settings-checkbox button.sheet-mooktoggle,
888+
.sheet-settings .sheet-settings-checkbox button.sheet-settings-toggle {
889889
border: 1px solid #0f0f0f;
890890
}
891891

@@ -898,12 +898,22 @@ input.sheet-mooktoggle:not([value="1"]) ~ div.sheet-mook-mode {
898898
display: none;
899899
}
900900

901-
/* Hide the "checked" section of the toggle if the attribute value is not "1". */
902-
input.sheet-toggle:not([value="1"]) ~ button.sheet-toggle > span.sheet-checked {
901+
input.sheet-settings-toggle-show-initiative-modifier:not([value="1"]) ~ div.sheet-initiative-modifier {
902+
display: none;
903+
}
904+
905+
input.sheet-settings-toggle-show-aimed-shot-button:not([value="1"]) ~ button[name="roll_aimed_shot"] {
903906
display: none;
904907
}
905908

909+
input.sheet-settings-toggle:not([value="1"]) ~ button.sheet-settings-toggle > span.sheet-checked {
910+
display: none;
911+
}
906912

913+
/* Hide the "checked" section of the toggle if the attribute value is not "1". */
914+
input.sheet-toggle:not([value="1"]) ~ button.sheet-toggle > span.sheet-checked {
915+
display: none;
916+
}
907917

908918

909919
.sheet-cyberware .sheet-cwtable div {
@@ -1482,13 +1492,19 @@ button[type="roll"].sheet-txt-btn{
14821492
box-shadow: none;
14831493
}
14841494

1495+
button[type="roll"].sheet-aimed-shot-icon{
1496+
font-weight: bold;
1497+
color: #CD272C;
1498+
font-size: 1.5rem;
1499+
margin-top: -3px;
1500+
}
1501+
14851502
.sheet-small button[type="roll"].sheet-txt-btn{
14861503
font-size: 1.3rem;
14871504
color: #fff;
14881505
font-weight:bold;
14891506
}
14901507

1491-
14921508
button[type="roll"].sheet-txt-btn:hover{
14931509
background: none;
14941510
text-decoration: underline;
@@ -1872,7 +1888,8 @@ td.sheet-subskill-header {
18721888
}
18731889

18741890

1875-
.sheet-main .sheet-flex-table div input{
1891+
.sheet-main .sheet-flex-table div input,
1892+
.sheet-settings .sheet-settings-value input {
18761893
margin: 0;
18771894
padding: 0;
18781895
width: 100%;
@@ -1881,7 +1898,8 @@ td.sheet-subskill-header {
18811898
min-width:0
18821899
}
18831900

1884-
.sheet-main .sheet-flex-table div input[type=number]{
1901+
.sheet-main .sheet-flex-table div input[type=number],
1902+
.sheet-settings .sheet-settings-value input[type=number] {
18851903
text-align: center;
18861904
}
18871905

@@ -1894,22 +1912,60 @@ td.sheet-subskill-header {
18941912
}
18951913

18961914
.sheet-my-settings {
1897-
display: flex;
1915+
max-width: 800px;
18981916
}
18991917

1900-
.sheet-settings-title {
1918+
.sheet-settings-row {
19011919
display: flex;
19021920
flex-direction: column;
1903-
align-items: center;
1904-
justify-content: center;
1921+
margin-bottom: 15px;
19051922
}
19061923

1907-
.sheet-my-settings div {
1924+
.sheet-settings-option {
1925+
display: flex;
1926+
width: 300px;
1927+
border: 1px solid #0f0f0f;
19081928
margin: 4px;
19091929
padding: 4px;
1930+
align-items: center;
1931+
justify-content: center;
1932+
}
1933+
1934+
.sheet-settings-help {
1935+
max-width: 310px;
1936+
text-align: justify;
1937+
}
1938+
1939+
.sheet-settings-title {
1940+
flex: 1 1 auto;
19101941
}
19111942

1912-
.sheet-option {
1943+
.sheet-settings-value {
1944+
flex: 0 0 auto;
19131945
display: flex;
1946+
align-items: center;
1947+
justify-content: center;
1948+
}
1949+
1950+
.sheet-aimed-shot-icon {
1951+
font-weight: bold;
1952+
color: #CD272C;
1953+
font-size: 1.5rem;
1954+
}
1955+
1956+
.sheet-settings-number {
1957+
width: 24px;
1958+
height: 24px;
19141959
border: 1px solid #0f0f0f;
1915-
}
1960+
background-color: var(--color-surface2);
1961+
}
1962+
1963+
.sheet-settings-checkbox {
1964+
background-color: var(--color-surface2);
1965+
}
1966+
1967+
.sheet-weapon {
1968+
background-color: #CD272C;
1969+
margin: -4px;
1970+
padding: 4px;
1971+
}

CyberpunkRED_raycw/cyberpunkred-raycw.html

Lines changed: 80 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
<div class="nav">
6-
<input type="hidden" class="mooktoggle" name="attr_mooksheet_flag" value='0' />
6+
<input type="hidden" class="mooktoggle" name="attr_mooksheet_flag" value="0" />
77

88
<div class="character-mode"><button type="action" name="act_character" >CHARACTER</button></div>
99
<div class="mook-mode"><button type="action" name="act_mook" >MOOK</button></div>
@@ -86,7 +86,8 @@ <h3>ROLE ABILITIES</h3><input type=text spellcheck=false name="attr_RoleAbility"
8686
<div class="bg-white skill-rank"><input type="number" name="attr_rankMoto" placeholder="0"/></div>
8787
</div>
8888

89-
<div class="flex-table">
89+
<input type="hidden" class="settings-toggle-show-initiative-modifier" name="attr_initiative_modifier_flag" value="0" />
90+
<div class="flex-table initiative-modifier">
9091
<div class="bg-black-2 skill-name">Initiative Modifier</div>
9192
<div class="bg-white skill-rank"><input type="number" name="attr_initiative_modifier" value="0"/></div>
9293
</div>
@@ -912,7 +913,8 @@ <h3>ROLE ABILITIES</h3><input type=text spellcheck=false name="attr_RoleAbility"
912913
<button type="roll" name="roll_weapon_dmg" style="display: none;" value="@{DMG}"></button>
913914
<input type="hidden" name="attr_WeaponMod" value="@{Total_Melee}">
914915
<div class="bg-white weapon-name">
915-
<button name="roll_aimed_shot" type="roll" class="txt-btn" value="&{template:attack} {{critroll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+10+1d10]]}} {{@{Weapontype}=true}} {{rollname=[@{Weaponname}](~repeating_weapons_weapon_dmg)}} {{failroll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+1-1d10]]}} {{weapontype=@{Weapontype}}} {{aimed_shot=1}} {{roll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+1d10]]}}" title="Aimed Shot"></button>
916+
<input type="hidden" class="settings-toggle-show-aimed-shot-button" name="attr_aimed_shot_flag" value="0" />
917+
<button name="roll_aimed_shot" type="roll" class="txt-btn aimed-shot-icon" value="&{template:attack} {{critroll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+10+1d10]]}} {{@{Weapontype}=true}} {{rollname=[@{Weaponname}](~repeating_weapons_weapon_dmg)}} {{failroll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+1-1d10]]}} {{weapontype=@{Weapontype}}} {{aimed_shot=1}} {{roll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+1d10]]}}" title="Aimed Shot"></button>
916918
<button name="roll_attack" type="roll" class="txt-btn" value="&{template:attack} {{critroll=[[@{WeaponMod}+@{WeaponBonus}+10+1d10]]}} {{@{Weapontype}=true}} {{rollname=[@{Weaponname}](~repeating_weapons_weapon_dmg)}} {{failroll=[[@{WeaponMod}+@{WeaponBonus}+1-1d10]]}} {{weapontype=@{Weapontype}}} {{roll=[[@{WeaponMod}+@{WeaponBonus}+1d10]]}}">Attack:</button>
917919
<input type=text spellcheck=false name="attr_Weaponname" placeholder="Type here...">
918920
</div>
@@ -1603,31 +1605,66 @@ <h2>NOTES</h2>
16031605
</div>
16041606

16051607
<div class="settings">
1606-
1607-
<div class="nav">
1608-
<div><button class="options" type="action" name="act_resetbase" >RESET BASE SKILLS</button></div>
1609-
<div><button class="options" type="action" name="act_newcharacter" >TOGGLE STAT/SKILLPOINT TRACKER</button></div>
1610-
</div>
1611-
16121608
<div class="my-settings">
1613-
<div class="option">
1614-
<div class="settings-title">ENABLE MOOK SHEET</div>
1615-
<div class='settings-checkbox'>
1616-
<input type="hidden" class="mooktoggle" name="attr_mooksheet_flag" value=0/>
1617-
<button type="action" name="act_mooksheet" class="mooktoggle">
1618-
<span class="checked"></span>
1619-
</button>
1609+
1610+
<div class="settings-row">
1611+
<h3>CHARACTER SHEET OPTIONS</h3>
1612+
<div class="nav">
1613+
<div><button class="options" type="action" name="act_resetbase" >RESET BASE SKILLS</button></div>
1614+
<div><button class="options" type="action" name="act_newcharacter" >TOGGLE STAT/SKILLPOINT TRACKER</button></div>
1615+
</div>
1616+
<div class="settings-option">
1617+
<div class="settings-title">ENABLE MOOK SHEET</div>
1618+
<div class="settings-value">
1619+
<div class="settings-checkbox">
1620+
<input type="hidden" class="mooktoggle" name="attr_mooksheet_flag" value="0" />
1621+
<button type="action" name="act_mooksheet" class="mooktoggle">
1622+
<span class="checked"></span>
1623+
</button>
1624+
</div>
1625+
</div>
1626+
</div>
1627+
<div class="settings-option">
1628+
<div class="settings-title">SHOW INITIATIVE MODIFIER</div>
1629+
<div class="settings-value">
1630+
<div class="settings-checkbox">
1631+
<input type="hidden" class="settings-toggle settings-toggle-show-initiative-modifier" name="attr_initiative_modifier_flag" value="0" />
1632+
<button type="action" name="act_initiative_modifier" class="settings-toggle">
1633+
<span class="checked"></span>
1634+
</button>
1635+
</div>
1636+
</div>
16201637
</div>
16211638
</div>
16221639

1623-
<div class="option">
1624-
<div class="settings-title">AIMED SHOT PENALTY</div>
1625-
<div class='settings-text'>
1626-
<input type="number" name="attr_aimed_shot_penalty" value="-8" />
1640+
<div class="settings-row">
1641+
<h3>AIMED SHOT OPTIONS</h3>
1642+
<div class="settings-help">
1643+
When enabled, an aimed shot button is displayed next to the "Attack" button for each weapon.
1644+
The button will be displayed as a crosshair icon that looks like this: "<span class="aimed-shot-icon"></span>".
1645+
</div>
1646+
<div class="settings-option">
1647+
<div class="settings-title settings-title-show-aimed" name="title_show_aimed_button">SHOW AIMED SHOT BUTTON</div>
1648+
<div class="settings-value">
1649+
<div class="settings-checkbox">
1650+
<input type="hidden" class="settings-toggle settings-toggle-show-aimed-shot-button" name="attr_aimed_shot_flag" value="0" />
1651+
<button type="action" name="act_aimed_shot" class="settings-toggle">
1652+
<span class="checked"></span>
1653+
</button>
1654+
</div>
1655+
</div>
1656+
</div>
1657+
<div class="settings-option">
1658+
<div class="settings-title">AIMED SHOT PENALTY</div>
1659+
<div class="settings-value">
1660+
<div class="settings-number">
1661+
<input type="number" name="attr_aimed_shot_penalty" value="-8" />
1662+
</div>
1663+
</div>
16271664
</div>
16281665
</div>
1629-
</div>
16301666

1667+
</div>
16311668
</div>
16321669

16331670
<div class="mook">
@@ -1717,7 +1754,8 @@ <h2>NOTES</h2>
17171754
<button type="roll" name="roll_weapon_dmg" style="display: none;" value="@{DMG}"></button>
17181755
<input type="hidden" name="attr_WeaponMod" value="@{Total_Melee}">
17191756
<div class="bg-white weapon-name">
1720-
<button name="roll_aimed_shot" type="roll" class="txt-btn" value="&{template:attack} {{critroll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+10+1d10]]}} {{@{Weapontype}=true}} {{rollname=[@{Weaponname}](~repeating_weapons_weapon_dmg)}} {{failroll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+1-1d10]]}} {{weapontype=@{Weapontype}}} {{aimed_shot=1}} {{roll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+1d10]]}}" title="Aimed Shot"></button>
1757+
<input type="hidden" class="settings-toggle-show-aimed-shot-button" name="attr_aimed_shot_flag" value="0" />
1758+
<button name="roll_aimed_shot" type="roll" class="txt-btn aimed-shot-icon" value="&{template:attack} {{critroll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+10+1d10]]}} {{@{Weapontype}=true}} {{rollname=[@{Weaponname}](~repeating_weapons_weapon_dmg)}} {{failroll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+1-1d10]]}} {{weapontype=@{Weapontype}}} {{aimed_shot=1}} {{roll=[[@{WeaponMod}+@{WeaponBonus}+@{aimed_shot_penalty}+1d10]]}}" title="Aimed Shot"></button>
17211759
<button name="roll_attack" type="roll" class="txt-btn" value="&{template:attack} {{critroll=[[@{WeaponMod}+@{WeaponBonus}+10+1d10]]}} {{@{Weapontype}=true}} {{rollname=[@{Weaponname}](~repeating_weapons_weapon_dmg)}} {{failroll=[[@{WeaponMod}+@{WeaponBonus}+1-1d10]]}} {{weapontype=@{Weapontype}}} {{roll=[[@{WeaponMod}+@{WeaponBonus}+1d10]]}}">Attack:</button>
17221760
<input type=text spellcheck=false name="attr_Weaponname" placeholder="Type here..."></div>
17231761
<div class="bg-white weapon-type">
@@ -3231,7 +3269,10 @@ <h2>Inventory and Notes</h2>
32313269
});
32323270
});
32333271

3234-
const toggleList = ["cbaudio","lefteye","righteye","rightarm","leftarm","neurallink","rightleg","leftleg","mooksheet"];
3272+
const toggleList = [
3273+
"cbaudio","lefteye","righteye","rightarm","leftarm","neurallink","rightleg","leftleg","mooksheet",
3274+
"initiative_modifier"
3275+
];
32353276
toggleList.forEach(function(button) {
32363277
on(`clicked:${button}`, function() {
32373278
const flag = `${button}_flag`;
@@ -3242,6 +3283,22 @@ <h2>Inventory and Notes</h2>
32423283
});
32433284
});
32443285
});
3286+
on('clicked:aimed_shot', function() {
3287+
getAttrs(['aimed_shot_flag'], function(v) {
3288+
const flag_value = v['aimed_shot_flag'] !== "1" ? "1" : "0";
3289+
setAttrs({
3290+
['aimed_shot_flag']: flag_value
3291+
});
3292+
3293+
getSectionIDs("repeating_weapons", function(idarray) {
3294+
const output = {};
3295+
idarray.forEach(id => {
3296+
output[`repeating_weapons_${id}_aimed_shot_flag`] = flag_value;
3297+
});
3298+
setAttrs(output);
3299+
});
3300+
});
3301+
});
32453302

32463303
</script>
32473304

0 commit comments

Comments
 (0)