Skip to content

Commit

Permalink
Merge pull request #124 from HavlockV/features/inventory
Browse files Browse the repository at this point in the history
Inventory rework
  • Loading branch information
HavlockV authored Sep 5, 2020
2 parents 7fab0c2 + e3bd376 commit 77b230e
Show file tree
Hide file tree
Showing 14 changed files with 431 additions and 40 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@ Compendium 'Weapons' contains a single test weapon.

## What is working

version 0.3.2 :

* Token will now correctly display bars.
* Skills will now popup in a separate modal.
* Option added for initiative. You can select the regular or the optional way of rolling initiative.
version 0.3.3 :

* Inventory (Gear&Cash tab) displays items, books and spells.
* clicking on a section will toggle the display of it's content.
* clicking on an item name will display it's description.
* Combat tracker now correctly displays actor's turn.
* Option added for initiative. You can select the regular (DEX value) or the optional (DEX roll) initiative rule.
* A small target icon has been added to each combat participant. Clicking it will ready the actor's gun and modify it's initiative.
* Spells can now be properly dragged and dropped to and from books.
* Token will now correctly displays bars.
* Skills will now popup in a separate window.
* Option added for Pulp HP.
* Bug correction on skill specialization localization.

version 0.3.2 :

Expand Down
148 changes: 148 additions & 0 deletions coc7g.css
Original file line number Diff line number Diff line change
Expand Up @@ -694,3 +694,151 @@
padding: 0.25em 0.5em;
border-top: 1px solid #c9c7b8;
}
.coc7.sheet .inventory {
height: 100%;
}
.coc7.sheet .inventory-list {
list-style: none;
margin: 0;
padding: 0 5px;
overflow-y: auto;
scrollbar-width: thin;
}
.coc7.sheet .inventory-list .item {
line-height: 16px;
padding: 0 2px;
border-bottom: 1px solid #c9c7b8;
}
.coc7.sheet .inventory-list .item:last-child {
border-bottom: none;
}
.coc7.sheet .inventory-list .item .item-name {
cursor: pointer;
max-height: 16px;
overflow: hidden;
}
.coc7.sheet .inventory-list .item .item-image {
flex: 0 0 16px;
background-size: 16px;
margin-right: 5px;
height: 16px;
}
.coc7.sheet .inventory-list .item h4 {
margin: 0;
white-space: nowrap;
overflow-x: hidden;
}
.coc7.sheet .inventory-list .item.rollable:hover .item-image {
background-image: url("/icons/svg/d20-grey.svg") !important;
}
.coc7.sheet .inventory-list .item.rollable .item-image:hover {
background-image: url("/icons/svg/d20-black.svg") !important;
}
.coc7.sheet .inventory-list .item i.attuned {
color: #7a7971;
}
.coc7.sheet .inventory-list .item .item-uses input {
width: 24px;
text-align: center;
}
.coc7.sheet .inventory-list .item .item-properties {
margin-top: 3px;
}
.coc7.sheet .inventory-list .item .item-recharge {
flex: 0 0 80px;
text-align: right;
font-size: 11px;
color: #7a7971;
white-space: nowrap;
}
.coc7.sheet .inventory-list .inventory-header {
margin: 2px 0;
padding: 0;
background: rgba(0, 0, 0, 0.05);
border: 2px groove #eeede0;
font-weight: bold;
line-height: 15px;
}
.coc7.sheet .inventory-list .inventory-header h3 {
margin: 0 -5px 0 0;
padding-left: 5px;
font-family: "Modesto Condensed", "Palatino Linotype", serif;
font-size: 20px;
font-weight: 700;
font-size: 1.125em;
}
.coc7.sheet .inventory-list .inventory-header .item-controls a.item-create {
flex: 0 0 100%;
}
.coc7.sheet .inventory-list .item-detail {
flex: 0 0 70px;
font-size: 12px;
color: #7a7971;
text-align: center;
border-right: 1px solid #c9c7b8;
word-break: break-word;
white-space: nowrap;
overflow: hidden;
}
.coc7.sheet .inventory-list .item-detail:last-child {
border-right: none;
}
.coc7.sheet .inventory-list .item-detail.item-action {
flex: 0 0 100px;
}
.coc7.sheet .inventory-list .item-weight {
flex: 0 0 60px;
border-left: 1px solid #c9c7b8;
border-right: 1px solid #c9c7b8;
}
.coc7.sheet .inventory-list .item-list {
list-style: none;
margin: 0;
padding: 0;
}
.coc7.sheet .inventory-list .item-controls {
flex: 0 0 32px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
justify-content: flex-end;
height: 16px;
}
.coc7.sheet .inventory-list .item-controls > * {
flex: 1;
}
.coc7.sheet .inventory-list .item-controls .flex1 {
flex: 1;
}
.coc7.sheet .inventory-list .item-controls .flex2 {
flex: 2;
}
.coc7.sheet .inventory-list .item-controls .flex3 {
flex: 3;
}
.coc7.sheet .inventory-list .item-controls .flex4 {
flex: 4;
}
.coc7.sheet .inventory-list .item-controls a {
flex: 0 0 16px;
font-size: 12px;
text-align: center;
color: #7a7971;
}
.coc7.sheet .inventory-list .item-summary {
flex: 0 0 100%;
font-size: 12px;
line-height: 16px;
padding: 0.25em 0.5em;
border-top: 1px solid #c9c7b8;
}
.coc7.sheet.actor .info-fields .form-group label {
width: auto;
flex: unset;
line-height: 18px;
height: 18px;
border: 0;
margin: 0;
font-weight: bold;
}
9 changes: 8 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@
"CoC7.OccultBook": "Occult Tome",
"CoC7.Unidentified": "Unidentified description",

"CoC7.Items": "Items",
"CoC7.Books": "Books",

"CoC7.PutGunAway": "Put your gun away",
"CoC7.DrawGun": "Draw your gun",

"SETTINGS.DefaultDifficulty": "Default check difficulty",
"SETTINGS.DefaultDifficultyHint": "You can choose the default difficulty for checks. Unknown will roll checks without the player knowing the check difficulty.",
Expand All @@ -311,5 +316,7 @@
"SETTINGS.InitiativeRuleBasic": "Basic",
"SETTINGS.InitiativeRuleOptional": "Optional",
"SETTINGS.displayInitDices": "Display init dice",
"SETTINGS.displayInitDicesHint": "Display the dices when rolling for initiative (Optional rules only)"
"SETTINGS.displayInitDicesHint": "Display the dices when rolling for initiative (Optional rules only)",
"SETTINGS.PulpRules" : "Use Pulp HP",
"SETTINGS.PulpRulesHint" : "Use Pulp Rules for HP calculation"
}
15 changes: 15 additions & 0 deletions less/actor.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.coc7.sheet.actor{
.info-fields{
.form-group{
label{
width: auto;
flex: unset;
line-height: 18px;
height: 18px;
border: 0;
margin: 0;
font-weight: bold;
}
}
}
}
4 changes: 3 additions & 1 deletion less/coc7g.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
@import "coc7.less";
@import "chat-card.less";
@import "inventory.less";
@import "items.less";
@import "items.less";
@import "sheet.less";
@import "actor.less";
144 changes: 144 additions & 0 deletions less/sheet.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
.coc7.sheet{
.inventory{
height: 100%;
}

.inventory-list {
list-style: none;
margin: 0;
padding: 0 5px;
overflow-y: auto;
scrollbar-width: thin;

// Inventory Item
.item {
line-height: 16px;
padding: 0 2px; // to align with the header border
border-bottom: 1px solid @colorFaint;
&:last-child { border-bottom: none; }

// Item Header Name
.item-name {
cursor: pointer;
max-height: 16px;
overflow: hidden;
}

.item-image {
flex: 0 0 16px;
background-size: 16px;
margin-right: 5px;
height: 16px;
}

h4 {
margin: 0;
white-space: nowrap;
overflow-x: hidden;
}

&.rollable:hover .item-image {
background-image: url("/icons/svg/d20-grey.svg") !important;
}
&.rollable .item-image:hover {
background-image: url("/icons/svg/d20-black.svg") !important;
}

i.attuned {
color: @colorTan;
}

// Item uses
.item-uses input {
width: 24px;
text-align: center;
}

// Item Dropdown Properties
.item-properties {
margin-top: 3px;
}

// Charged
.item-recharge {
flex: 0 0 80px;
text-align: right;
font-size: 11px;
color: @colorTan;
white-space: nowrap;
}
}

// Inventory Header
.inventory-header {
margin: 2px 0;
padding: 0;
background: rgba(0, 0, 0, 0.05);
border: @borderGroove;
font-weight: bold;
line-height: 15px;

h3 {
margin: 0 -5px 0 0;
padding-left: 5px;
.modesto();
font-size: 1.125em;
}

.item-controls a.item-create {
flex: 0 0 100%;
}
}

// Item Detail Sections
.item-detail {
flex: 0 0 70px;
font-size: 12px;
color: @colorTan;
text-align: center;
border-right: 1px solid @colorFaint;
word-break: break-word;
white-space: nowrap;
overflow: hidden;

&:last-child { border-right: none; }
&.item-action {flex: 0 0 100px}
}

.item-weight {
flex: 0 0 60px;
border-left: 1px solid @colorFaint;
border-right: 1px solid @colorFaint;
}

.item-list {
list-style: none;
margin: 0;
padding: 0;
}

// Item Control Buttons
.item-controls {
flex: 0 0 32px;
.flexrow();
justify-content: flex-end;
height: 16px;

a {
flex: 0 0 16px;
font-size: 12px;
text-align: center;
color: @colorTan;
}
}

// Item Dropdown Summary
.item-summary {
flex: 0 0 100%;
font-size: 12px;
line-height: 16px;
padding: 0.25em 0.5em;
border-top: 1px solid @colorFaint;
}
}
}
6 changes: 4 additions & 2 deletions module/actors/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,10 @@ export class CoCActor extends Actor {

get hpMax(){
if( this.data.data.attribs.hp.auto){
if(this.data.data.characteristics.siz.value != null && this.data.data.characteristics.con.value !=null)
return Math.floor( (this.data.data.characteristics.siz.value + this.data.data.characteristics.con.value)/10);
if(this.data.data.characteristics.siz.value != null && this.data.data.characteristics.con.value !=null){
const maxHP = Math.floor( (this.data.data.characteristics.siz.value + this.data.data.characteristics.con.value)/10);
return game.settings.get('CoC7', 'pulpRules')? maxHP*2:maxHP;
}
else return null;
}
return parseInt( this.data.data.attribs.hp.max);
Expand Down
Loading

0 comments on commit 77b230e

Please sign in to comment.