Working on Compatibility for FVTT v10
modified some actor-id to uuid : dragndrop-actor-id -> dragndrop-actor-uuid open-sheet-actor-id -> open-sheet-from-uuid
This commit is contained in:
@@ -470,16 +470,18 @@ export class HelpersL5r5e {
|
||||
});
|
||||
|
||||
// Ability to drag n drop an actor
|
||||
html.find(".dragndrop-actor-id").on("dragstart", (event) => {
|
||||
html.find(".dragndrop-actor-uuid").on("dragstart", (event) => {
|
||||
// Compatibility actor-id (armies sheets)
|
||||
const actorId = $(event.currentTarget).data("actor-id");
|
||||
if (!actorId) {
|
||||
const actorUuid = $(event.currentTarget).data("actor-uuid");
|
||||
if (!actorId && !actorUuid) {
|
||||
return;
|
||||
}
|
||||
event.originalEvent.dataTransfer.setData(
|
||||
"text/plain",
|
||||
JSON.stringify({
|
||||
type: "Actor",
|
||||
id: actorId,
|
||||
uuid: actorUuid ? actorUuid : `Actor.${actorId}`, // TODO fix for v10 uuid required, remove use of id in futur
|
||||
})
|
||||
);
|
||||
});
|
||||
@@ -494,15 +496,19 @@ export class HelpersL5r5e {
|
||||
});
|
||||
|
||||
// Open actor sheet
|
||||
html.find(".open-sheet-actor-id").on("click", (event) => {
|
||||
html.find(".open-sheet-from-uuid").on("click", async (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
const id = $(event.currentTarget).data("actor-id");
|
||||
if (!id) {
|
||||
const uuid = $(event.currentTarget).data("uuid");
|
||||
const actorId = $(event.currentTarget).data("actor-id");
|
||||
if (!uuid && !actorId) {
|
||||
return;
|
||||
}
|
||||
game.actors.get(id)?.sheet?.render(true);
|
||||
if (actorId) {
|
||||
// Compatibility actor-id (armies sheets)
|
||||
game.actors.get(actorId)?.sheet?.render(true);
|
||||
}
|
||||
(await fromUuid(uuid))?.sheet?.render(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ export class ItemL5r5e extends Item {
|
||||
|
||||
// Merge (DocumentData cannot be set)
|
||||
const result = foundry.utils.mergeObject(this, foundry.utils.expandObject(data));
|
||||
console.log(result); // TODO TMP
|
||||
|
||||
if (result.name) {
|
||||
this.name = result.name;
|
||||
@@ -56,8 +55,8 @@ export class ItemL5r5e extends Item {
|
||||
if (result.img) {
|
||||
this.img = result.img;
|
||||
}
|
||||
if (result.data) {
|
||||
this.data = result.data; // todo tmp check this!
|
||||
if (result.system) {
|
||||
this.system = result.system;
|
||||
}
|
||||
|
||||
// Update
|
||||
|
||||
@@ -85,10 +85,7 @@ export class ArmyCohortSheetL5r5e extends ItemSheetL5r5e {
|
||||
html.find(".actor-remove-control").on("click", (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const id = $(event.currentTarget).data("actor-id");
|
||||
if (id) {
|
||||
this._removeLinkedActor();
|
||||
}
|
||||
this._removeLinkedActor();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user