forked from espositos/fvtt-tokenactionhud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a1ff5e
commit 69bad8b
Showing
2 changed files
with
94 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,64 @@ | ||
import { RollHandler } from "../rollHandler.js"; | ||
|
||
export class RollHandlerBaseLancer extends RollHandler { | ||
constructor() { | ||
super(); | ||
constructor() { | ||
super(); | ||
} | ||
|
||
/** @override */ | ||
doHandleActionEvent(event, encodedValue) { | ||
let payload = encodedValue.split("|"); | ||
|
||
if (payload.length != 3 && payload.length != 4) { | ||
super.throwInvalidValueErr(); | ||
} | ||
|
||
/** @override */ | ||
doHandleActionEvent(event, encodedValue) { | ||
let payload = encodedValue.split('|'); | ||
|
||
if (payload.length != 3 && payload.length != 4) { | ||
super.throwInvalidValueErr(); | ||
} | ||
|
||
let macroType = payload[0]; | ||
let tokenId = payload[1]; | ||
let actionId = payload[2]; | ||
let option = JSON.parse(payload[3]); | ||
let macroType = payload[0]; | ||
let tokenId = payload[1]; | ||
let actionId = payload[2]; | ||
let option = JSON.parse(payload[3]); | ||
|
||
let actor = super.getActor(tokenId); | ||
let actor = super.getActor(tokenId); | ||
|
||
let hasSheet = ['item'] | ||
if (this.isRenderItem() && hasSheet.includes(macroType)) | ||
return this.doRenderItem(tokenId, actionId); | ||
let hasSheet = ["item"]; | ||
if (this.isRenderItem() && hasSheet.includes(macroType)) return this.doRenderItem(tokenId, actionId); | ||
|
||
switch (macroType) { | ||
case "hase": | ||
this._rollHaseMacro(actor, actionId); | ||
break; | ||
case "stat": | ||
this._rollStatMacro(actor, actionId); | ||
break; | ||
case "item": | ||
this._rollWeaponOrFeatureMacro(actor, actionId, option); | ||
break; | ||
case "coreActive": | ||
this._rollCoreActiveMacro(actor); | ||
break; | ||
case "corePassive": | ||
this._rollCorePassiveMacro(actor); | ||
break; | ||
} | ||
switch (macroType) { | ||
case "hase": | ||
this._rollHaseMacro(actor, actionId); | ||
break; | ||
case "stat": | ||
this._rollStatMacro(actor, actionId); | ||
break; | ||
case "item": | ||
this._rollWeaponOrFeatureMacro(actor, actionId, option); | ||
break; | ||
case "coreActive": | ||
this._rollCoreActiveMacro(actor); | ||
break; | ||
case "corePassive": | ||
this._rollCorePassiveMacro(actor); | ||
break; | ||
} | ||
} | ||
|
||
_rollHaseMacro(actor, action) { | ||
game.lancer.prepareStatMacro(actor._id, `data.mech.${action}`); | ||
} | ||
_rollHaseMacro(actor, action) { | ||
game.lancer.prepareStatMacro(actor._id, `${action}`); | ||
} | ||
|
||
_rollStatMacro(actor, action) { | ||
game.lancer.prepareStatMacro(actor._id, `data.${action}`); | ||
} | ||
_rollStatMacro(actor, action) { | ||
game.lancer.prepareStatMacro(actor._id, `${action}`); | ||
} | ||
|
||
_rollWeaponOrFeatureMacro(actor, itemId, option) { | ||
game.lancer.prepareItemMacro(actor._id, itemId, option); | ||
} | ||
_rollWeaponOrFeatureMacro(actor, itemId, option) { | ||
game.lancer.prepareItemMacro(actor._id, itemId, option); | ||
} | ||
|
||
_rollCoreActiveMacro(actor) { | ||
game.lancer.prepareCoreActiveMacro(actor._id); | ||
} | ||
_rollCoreActiveMacro(actor) { | ||
game.lancer.prepareCoreActiveMacro(actor._id); | ||
} | ||
|
||
_rollCorePassiveMacro(actor) { | ||
game.lancer.prepareCorePassiveMacro(actor._id); | ||
} | ||
} | ||
_rollCorePassiveMacro(actor) { | ||
game.lancer.prepareCorePassiveMacro(actor._id); | ||
} | ||
} |