ENH: Monster treasure link

master
U~man 2020-07-14 11:37:24 +02:00
parent c022f07bcb
commit 82a6a2508a
3 changed files with 29 additions and 8 deletions

View File

@ -41,10 +41,32 @@ export class OseActorSheetMonster extends OseActorSheet {
// Settings
data.config.morale = game.settings.get("ose", "morale");
console.log(data);
data.data.details.treasure.link = TextEditor.enrichHTML(data.data.details.treasure.table);
return data;
}
async _onDrop(event) {
super._onDrop(event);
let data;
try {
data = JSON.parse(event.dataTransfer.getData('text/plain'));
if (data.type !== "RollTable") return;
} catch (err) {
return false;
}
let link = "";
if (data.pack) {
let tableData = game.packs.get(data.pack).index.filter(el => el._id = "laDZWR1TIe0MVNZe");
link = `@Compendium[${data.pack}.${data.id}]{${tableData[0].name}}`;
} else {
link = `@RollTable[${data.id}]`;
}
this.actor.update({"data.details.treasure.table": link});
}
/* -------------------------------------------- */
async _chooseItemType(choices = ["weapon", "armor", "shield", "gear"]) {

View File

@ -3,6 +3,9 @@
min-width: 460px;
.header-details {
.summary {
.treasure-table {
text-align: center;
}
.check-field {
&:hover {
.check {

View File

@ -33,17 +33,13 @@
{{/if}}
</ul>
<ul class="summary flexrow">
<li class="flex3">
<li>
<input type="text" name="data.details.xp" value="{{data.details.xp}}" />
<label>{{localize 'OSE.details.experience.award'}}</label>
</li>
<li class="flex3">
<input type="text" name="data.details.treasure.type" value="{{data.details.treasure.type}}" />
<li class="treasure-table" title="{{localize 'OSE.details.treasureTableHint'}}">
<div>{{{data.details.treasure.link}}}</div>
<label>{{localize 'OSE.details.treasure'}}</label>
</li>
<!-- <li title="{{localize 'OSE.details.treasureTableHint'}}">
<div>{{data.details.treasure.table}}</div>
<label>{{localize 'OSE.details.treasureTable'}}</label>
</li> -->
</ul>
</section>