Skip to content

Commit

Permalink
0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Никита Белов committed Feb 6, 2023
1 parent 7947807 commit 9fe3cf1
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 14 deletions.
9 changes: 8 additions & 1 deletion lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
"Mod": "Выбор модификаторов",
"YouModifyRoll": "Модификатор для броска",
"MyItemInUse": "Использовать памятный предемет?",
"UseElement": "Использовать элемент?"
"UseElement": "Использовать элемент?",
"Table": {
"Appr": "За подход",
"MyItem": "За памятный предмет",
"Element": "За элемент",
"Mod": "Модификатор",
"ReRoll": "Перебросить"
}
},

"Actor": {
Expand Down
33 changes: 33 additions & 0 deletions module/actors/sheets/HeroActorSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,40 @@ export class HeroActorSheet extends BaseActorSheet {
}

async rollApproach(appr_id, appr_val, appr_mod, html) {
const mod = html.find('select[name=set-mofidy] option:checked').val();
const element = html.find('select[name=elements] option:checked').val();
const myitem = html.find('input[name=myiteminuse]:checked').val();

let dices = appr_mod; // подход
dices += parseInt(mod); // select модификатор
if (typeof myitem !== 'undefined') {
dices += 1; // использую памятный предмет
}

if (parseInt(element) !== 0 ) {
dices += 1; // использую элемент
}

const formula = `${dices}d6`;
let roll = await new Roll(formula).evaluate({async: true});
const template = await renderTemplate(`${game.system_path}/templates/chats/dices-roll.hbs`, {
formula: formula,
result: roll.result,
total: roll.total,
appr_id: appr_id,
terms: roll.terms[0].results,
appr_mod: appr_mod,
myitem: (typeof myitem !== 'undefined')?true:false,
element: (parseInt(element) !== 0 )?true:false,
mod: mod
});

ChatMessage.create({
user: game.user._id,
speaker: ChatMessage.getSpeaker(),
content: template
});

}

async _onActorRollApproach(evt) {
Expand Down
3 changes: 2 additions & 1 deletion module/handlebars/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const preloadHandlebarsTemplates = async function () {

`${game.system_path}/templates/chats/get-cards.hbs`,
`${game.system_path}/templates/chats/weapon-roll.hbs`,
`${game.system_path}/templates/chats/attrs-roll.hbs`
`${game.system_path}/templates/chats/attrs-roll.hbs`,
`${game.system_path}/templates/chats/dices-roll.hbs`
];

// Load the template parts
Expand Down
11 changes: 11 additions & 0 deletions src/less/sheet.less
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,15 @@
font-size: 16px;
}
}
}

.dice-total table.dices-total {
font-size: 16px;
font-weight: normal;
}

.chat-reroll {
cursor: pointer;
text-align: center;
font-weight: bold;
}
9 changes: 9 additions & 0 deletions styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@
text-align: left;
font-size: 16px;
}
.dice-total table.dices-total {
font-size: 16px;
font-weight: normal;
}
.chat-reroll {
cursor: pointer;
text-align: center;
font-weight: bold;
}
/* Items Sheet */
.item-cards .window-content {
font-family: CardText;
Expand Down
2 changes: 1 addition & 1 deletion system.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "see-you-in-hell",
"title": "Встретимся в АДУ",
"description": "Брутальный нарративный боевик о крутых парнях, которые останавливают инфернальное вторжение. Игра от команды Silver Hoof Games",
"version": "0.1",
"version": "0.9",
"compatibility": {
"minimum": "10",
"verified": "10.291"
Expand Down
67 changes: 67 additions & 0 deletions templates/chats/dices-roll.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<div class="dice-roll">
<div class="dice-result">
<div class="dice-formula">
{{#ife appr_id "BloodthirstyColdBlooded"}}
{{#ife appr_id 1}}
{{localize "CZT.Actor.Approaches.Bloodthirsty"}}
{{else}}
{{localize "CZT.Actor.Approaches.ColdBlooded"}}
{{/ife}}
{{/ife}}
{{#ife appr_id "ElusiveImpenetrable"}}
{{#ife appr_id 1}}
{{localize "CZT.Actor.Approaches.Elusive"}}
{{else}}
{{localize "CZT.Actor.Approaches.Impenetrable"}}
{{/ife}}
{{/ife}}
{{#ife appr_id "ConfidentCalculating"}}
{{#ife appr_id 1}}
{{localize "CZT.Actor.Approaches.Confident"}}
{{else}}
{{localize "CZT.Actor.Approaches.Calculating"}}
{{/ife}}
{{/ife}}
&nbsp;{{localize "CZT.Actor.Approach"}}:
{{formula}}</div>
<div class="dice-tooltip expanded">
<section class="tooltip-part">
<div class="dice">
<header class="part-header flexrow">
<span class="part-formula">{{formula}}</span>
<span class="part-total">{{total}}</span>
</header>
<ol class="dice-rolls">
{{#each terms as |dice key|}}
<li class="roll die d6{{#ife dice.result 1}} min{{/ife}}{{#ife dice.result 6}} max{{/ife}}{{#ife dice.result 5}} max{{/ife}}">{{dice.result}}</li>
{{/each}}
</ol>
</div>
</section>
</div>

<table class="dices-total">
<tr>
<td>{{localize "CZT.Rolls.Table.Appr"}}</td>
<td>{{appr_mod}}d6</td>
</tr>
{{#if myitem}}
<tr>
<td>{{localize "CZT.Rolls.Table.MyItem"}}</td>
<td>+1d6</td>
</tr>
{{/if}}
{{#if element}}
<tr>
<td>{{localize "CZT.Rolls.Table.Element"}}</td>
<td>+1d6</td>
</tr>
{{/if}}
<tr>
<td>{{localize "CZT.Rolls.Table.Mod"}}</td>
<td>{{mod}}d6</td>
</tr>
<tr><td class="chat-reroll" colspan="2">{{localize "CZT.Rolls.Table.ReRoll"}}</td></tr>
</table>
</div>
</div>
19 changes: 8 additions & 11 deletions templates/dialogs/modify-attrs-roll.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,22 @@
<div class="actor-column">{{localize "CZT.Rolls.YouModifyRoll"}}:</div>
<div class="actor-column">
<select name="set-mofidy">
<option value="-5">-5</option>
<option value="-4">-4</option>
<option value="-3">-3</option>
<option value="-2">-2</option>
<option value="-1">-1</option>
<option value="0" selected>0</option>
<option value="1">+1</option>
<option value="2">+2</option>
<option value="3">+3</option>
<option value="4">+4</option>
<option value="5">+5</option>
<option value="+0" selected>0</option>
<option value="+1">+1</option>
<option value="+2">+2</option>
<option value="+3">+3</option>
<option value="+4">+4</option>
<option value="+5">+5</option>
</select>
</div>
</div>
{{#if elements}}
<div class="actor-row dialog-select-mofidy">
<div class="actor-column">{{localize "CZT.Rolls.UseElement"}}</div>
<div class="actor-column">
<select name="myitem">
<select name="elements">
<option value="0" selected>{{localize "CZT.Common.Select.No"}}</option>
{{#each elements as |item key|}}
<option value="{{item.id}}">{{item.name}}</option>
Expand All @@ -62,7 +59,7 @@
<div class="actor-row dialog-select-mofidy">
<div class="actor-column">{{localize "CZT.Rolls.MyItemInUse"}}</div>
<div class="actor-column">
<input type="checkbox" name="myiteminuse" />
<input type="checkbox" name="myiteminuse" value="1" />
</div>
</div>
{{/if}}
Expand Down

0 comments on commit 9fe3cf1

Please sign in to comment.