ENH: Reworked roll interactions

master
U~man 2020-07-09 11:56:11 +02:00
parent ded5e00aa5
commit 9bcc0fd975
12 changed files with 82 additions and 29 deletions

View File

@ -6,4 +6,6 @@ This Foundry VTT system requires Old-School Essentials Core Rules and does not c
## Contributions
This system is currently under heavy development.
Feel free to grab a TO DO issue from the gitlab board. You can then do a merge request on the `development` branch.
Feel free to grab a TO DO issue from the gitlab board. You can then do a merge request on the `development` branch.
[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/H2H21WMKA)

View File

@ -111,12 +111,21 @@ export class OseActorSheet extends ActorSheet {
});
});
html.find(".item-image").click(async (ev) => {
html.find(".item .item-controls .item-show").click(async (ev) => {
const li = $(ev.currentTarget).parents(".item");
const item = this.actor.getOwnedItem(li.data("itemId"));
item.roll({skipDialog: event.ctrlKey});
});
html.find(".item .item-rollable .item-image").click(async ev => {
const li = $(ev.currentTarget).parents(".item");
const item = this.actor.getOwnedItem(li.data("itemId"));
if (item.type == 'weapon') {
item.rollWeapon();
} else {
item.rollFormula();
}
});
html.find(".attack a").click(ev => {
let actorObject = this.actor;

0
src/module/init.js Normal file
View File

View File

@ -6,8 +6,8 @@ import { preloadHandlebarsTemplates } from "./module/preloadTemplates.js";
import { OseActor } from "./module/actor/entity.js";
import { OseItem } from "./module/item/entity.js";
import { OSE } from "./module/config.js";
import { registerSettings } from './module/settings.js';
import { registerHelpers } from './module/helpers.js';
import { registerSettings } from "./module/settings.js";
import { registerHelpers } from "./module/helpers.js";
import * as chat from "./module/chat.js";
import * as macros from "./module/macros.js";
@ -26,17 +26,17 @@ Hooks.once("init", async function () {
};
CONFIG.OSE = OSE;
game.ose = {
rollItemMacro: macros.rollItemMacro
}
rollItemMacro: macros.rollItemMacro,
};
// Custom Handlebars helpers
registerHelpers();
// Register custom system settings
registerSettings();
CONFIG.Actor.entityClass = OseActor;
CONFIG.Item.entityClass = OseItem;
@ -71,8 +71,23 @@ Hooks.once("setup", function () {
});
Hooks.once("ready", () => {
Hooks.on("hotbarDrop", (bar, data, slot) => macros.createOseMacro(data, slot));
Hooks.on("hotbarDrop", (bar, data, slot) =>
macros.createOseMacro(data, slot)
);
});
Hooks.on(
"preUpdateCombat",
async (combat, updateData, options, userId) => {
if (!updateData.round) {
return;
}
console.log("SETTING UP INITIATIVE");
if (game.settings.get('ose', 'individualInit')) {
console.log("PLOP");
}
}
);
Hooks.on("renderChatLog", (app, html, data) => OseItem.chatListeners(html));
Hooks.on("getChatLogEntryContext", chat.addChatMessageContextOptions);
Hooks.on("getChatLogEntryContext", chat.addChatMessageContextOptions);

View File

@ -242,6 +242,15 @@
grid-area: item-equipped;
justify-self: center;
}
.item-rollable {
&:hover .item-image {
background-image: url("/icons/svg/d20-grey.svg") !important;
cursor: pointer;
}
.item-image:hover {
background-image: url("/icons/svg/d20-black.svg") !important;
}
}
.item-name {
text-indent: 8px;
text-align: left;
@ -249,18 +258,11 @@
height: 30px;
margin: 0;
line-height: 30px;
&:hover .item-image {
background-image: url("/icons/svg/d20-grey.svg") !important;
cursor: pointer;
}
.item-image {
flex-basis: 30px;
flex-grow: 0;
background-size: contain;
background-repeat: no-repeat;
&:hover {
background-image: url("/icons/svg/d20-black.svg") !important;
}
}
h4 {
margin: 0;
@ -307,13 +309,17 @@
.item-unequipped {
color: rgba(0, 0, 0, 0.2);
}
a:hover {
color: $colorCrimson;
text-shadow: 0 0 5px $colorFaint, 1px 0 5px $colorFaint, 0 1px 5px $colorFaint, 1px 1px 5px $colorFaint;
}
}
&.spells {
.item-titles {
line-height: 24px;
}
.item-controls {
flex-basis: 30px;
flex-basis: 45px;
}
}
}

View File

@ -14,9 +14,20 @@
color: white;
padding: 2px;
box-shadow: 0 0 2px #FFF inset;
text-align: center;
margin: 4px 0;
font-size: 16px;
display: flex;
h2 {
border: none;
line-height: 30px;
margin: 0;
text-indent: 10px;
font-size: 16px;
}
img {
border: none;
width: 30px;
height: 30px;
}
}
.chat-details {
padding: 4px;

View File

@ -41,7 +41,7 @@
{{#each abilities as |item|}}
<li class="item-entry">
<div class="item flexrow" data-item-id="{{item._id}}">
<div class="item-name flexrow">
<div class="item-name {{#if item.data.roll}}item-rollable{{/if}} flexrow">
<div class="item-image" style="background-image: url({{item.img}})"></div>
<a>
<h4 title="{{item.name}}">
@ -50,10 +50,11 @@
</a>
</div>
<div class="field-long">
{{item.roll}}
{{item.data.roll}}
</div>
<div class="item-controls">
{{#if ../owner}}
<a class="item-control item-show" title='{{localize "OSE.Show"}}'><i class="fas fa-eye"></i></a>
<a class="item-control item-edit" title='{{localize "OSE.Edit"}}'><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title='{{localize "OSE.Delete"}}'><i class="fas fa-trash"></i></a>
{{/if}}

View File

@ -14,7 +14,7 @@
{{#each owned.weapons as |item|}}
<li class="item-entry">
<div class="item flexrow" data-item-id="{{item._id}}">
<div class="item-name flexrow">
<div class="item-name item-rollable flexrow">
<div class="item-image" style="background-image: url({{item.img}})"></div>
<a>
<h4 title="{{item.name}}">

View File

@ -22,7 +22,7 @@
<a class="item-control item-memorize {{#unless item.data.memorized}}item-unequipped{{/unless}}" title="{{localize 'OSE.spells.Memorized'}}"><i
class="fas fa-book-open"></i></a>
</div>
<div class="item-name flexrow">
<div class="item-name {{#if item.data.roll}}item-rollable{{/if}} flexrow">
<div class="item-image" style="background-image: url({{item.img}})"></div>
<a>
<h4 title="{{item.name}}">
@ -32,6 +32,7 @@
</div>
<div class="item-controls">
{{#if ../../owner}}
<a class="item-control item-show" title='{{localize "OSE.Show"}}'><i class="fas fa-eye"></i></a>
<a class="item-control item-edit" title='{{localize "OSE.Edit"}}'><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title='{{localize "OSE.Delete"}}'><i class="fas fa-trash"></i></a>
{{/if}}

View File

@ -84,7 +84,7 @@
{{#each abilities as |item|}}
<li class="item-entry">
<div class="item flexrow" data-item-id="{{item._id}}">
<div class="item-name flexrow">
<div class="item-name {{#if item.data.roll}}item-rollable{{/if}} flexrow">
<div class="item-image" style="background-image: url({{item.img}})"></div>
<h4 title="{{item.name}}">
{{item.name~}}
@ -92,6 +92,8 @@
</div>
<div class="item-controls">
{{#if ../owner}}
<a class="item-control item-show" title='{{localize "OSE.Show"}}'><i
class="fas fa-eye"></i></a>
<a class="item-control item-edit" title='{{localize "OSE.Edit"}}'><i
class="fas fa-edit"></i></a>
<a class="item-control item-delete" title='{{localize "OSE.Delete"}}'><i
@ -105,7 +107,7 @@
{{#each section as |item|}}
<li class="item-entry">
<div class="item flexrow" data-item-id="{{item._id}}">
<div class="item-name flexrow">
<div class="item-name {{#if (eq item.type 'weapon')}}item-rollable{{/if}} flexrow">
<div class="item-image" style="background-image: url({{item.img}})"></div>
<h4 title="{{item.name}}">
{{item.name~}}

View File

@ -1,6 +1,9 @@
<section class="ose chat-message">
<div class="ose chat-block">
<h2 class="chat-title">{{title}}</h2>
<div class="chat-title">
<img src="{{data.img}}">
<h2>{{title}}</h2>
</div>
<div class="chat-details">
<div class="roll-result">{{{result.details}}}</div>
</div>

View File

@ -1,6 +1,9 @@
<section class="ose chat-message">
<div class="ose chat-block">
<h2 class="chat-title">{{title}}</h2>
<div class="chat-title">
<img src="{{data.img}}">
<h2>{{title}}</h2>
</div>
{{#if result.details}}<div class="chat-details">{{{result.details}}}</div>{{/if}}
{{#if result.isFailure}}<div class='roll-result roll-fail'><b>{{localize 'OSE.Failure'}}</b> ({{result.target}})
</div>{{/if}}