best stock prices guaranteed.
parent
8258f53a3a
commit
4be53924d8
|
|
@ -21,6 +21,7 @@ export class MerchantSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
},
|
||||
actions: {
|
||||
buy: MerchantSheet.#buyWare,
|
||||
editItem: MerchantSheet.#openEmbeddedDocument,
|
||||
editImage: DocumentSheetV2.DEFAULT_OPTIONS.actions.editImage,
|
||||
editServiceImage: MerchantSheet.#editServiceImage,
|
||||
editNewServiceImage: MerchantSheet.#editNewServiceImage,
|
||||
|
|
@ -88,7 +89,7 @@ export class MerchantSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
const item = this.document.items.get(itemId)
|
||||
|
||||
let selections = ''
|
||||
game.actors.filter(p => p.isOwner).forEach(actor => {
|
||||
game.actors.filter(p => p.isOwner && p.type === "character").forEach(actor => {
|
||||
selections += `<option value=${actor.id}>${actor.name}</option>`
|
||||
})
|
||||
|
||||
|
|
@ -101,6 +102,7 @@ export class MerchantSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
}
|
||||
});
|
||||
|
||||
if (actorId) { // ignore the following when dialog was cancelled
|
||||
const actor = game.actors.get(actorId)
|
||||
const canBuy = await actor.reduceWealth(item.system.price)
|
||||
if (canBuy) { // returns false when the wealth cant be reduced sufficiently
|
||||
|
|
@ -123,9 +125,24 @@ export class MerchantSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
} else {
|
||||
ui.notifications.error(item.name + " ist zu teuer für " + actor.name)
|
||||
}
|
||||
}
|
||||
|
||||
console.log(actorId)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {MouseEvent} event
|
||||
*/
|
||||
static #openEmbeddedDocument(event) {
|
||||
let dataset = event.target.dataset
|
||||
if (!dataset.itemId && !dataset.id) {
|
||||
dataset = event.target.parentElement.dataset
|
||||
}
|
||||
const id = dataset.itemId ?? dataset.id
|
||||
|
||||
if (this.document.isOwner) { // only shop owner can change stock and price
|
||||
this.document.items.get(id).sheet.render(true)
|
||||
}
|
||||
}
|
||||
|
||||
static async #removeService(event, target) {
|
||||
|
|
@ -251,6 +268,7 @@ export class MerchantSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
context.description = this.document.system.description
|
||||
context.goods = this.document.itemTypes["Equipment"] ?? []
|
||||
context.services = this.document.system.services
|
||||
context.isOwner = this.document.isOwner
|
||||
|
||||
return context
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id": "DSA_4-1",
|
||||
"title": "Das Schwarze Auge 4.1",
|
||||
"description": "Noch ein Spielsystem für Das Schwarze Auge 4.1",
|
||||
"version": "0.4.0-rc4",
|
||||
"version": "0.0.1",
|
||||
"compatibility": {
|
||||
"minimum": 12,
|
||||
"verified": 13
|
||||
|
|
@ -348,5 +348,5 @@
|
|||
"primaryTokenAttribute": "lep.aktuell",
|
||||
"url": "https://git.macniel.online/macniel/foundry-dsa41-game",
|
||||
"manifest": "https://git.macniel.online/macniel/foundry-dsa41-game/raw/branch/main/src/system.json",
|
||||
"download": "https://git.macniel.online/macniel/foundry-dsa41-game/releases/download/0.4.0-rc4/release.zip"
|
||||
"download": "https://git.macniel.online/macniel/foundry-dsa41-game/releases/download/0.0.1/release.zip"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<div class="merchant-goods">
|
||||
{{#each goods}}
|
||||
<div class="merchant-good">
|
||||
<div class="merchant-good" {{#if isOwner}}data-action="editItem"{{/if}} data-item-id="{{this._id}}">
|
||||
<img src="{{this.img}}" style="width: 32px; height: 32px;"/>
|
||||
<span class="name">{{this.name}}</span>
|
||||
<span class="price">{{currency this.system.price}}</span>
|
||||
|
|
|
|||
Loading…
Reference in New Issue