Skip to content

Commit

Permalink
Merge branch 'crndev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
crnormand committed Nov 19, 2020
2 parents 0f6c2c6 + 8a4c958 commit 09d819e
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 69 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
### [Guide on how to use GURPS 4e for Foundry VTT](https://docs.google.com/document/d/1NMBPt9KhA9aGG1_kZxyk8ncuOKhz9Z6o7vPS8JcjdWc/edit?usp=sharing)


## Current Release Version 0.6.5
## Current Release Version 0.7.0

This is what we are currently working on:
- 0.8.0
- Enhanced Drag and Drop Damage Dialog.

### History
- 0.7.0
- Fixed manifest file to allow for automatic updating
- Added configurable system settings (range system (Basic Set / Monster Hunters 2), etc.)
Expand All @@ -14,12 +18,12 @@ This is what we are currently working on:
- fixed import for GCS characters that contain "&" in fields, assuming they turn @ENCODING back on
- Page Ref links to non-existent PDFs will now go to the SJG Warehouse 23 website
- Created Foundry VTT specific GCS export/import and massive performance boost.
- 3d6 on desktop
- 3d6/1d6 on desktop
- Can edit character sheet
- Started work on drag and drop damage!

**NOTE: YOU MUST delete all of your actors, and Restart Foundry for the changes to take effect**

### History
- 0.6.5
- Removed "+0" range modifiers
- Enabled Full/Combat view for Players
Expand Down
3 changes: 2 additions & 1 deletion lib/initiative.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export default class Initiative {
setup() {
Hooks.once("init", () => {
CONFIG.Combat.initiative = {
formula: "(1d6 / 1000) + @attributes.DX.value / 100 + @basicspeed.value * 100",
// formula: "(1d6 / 1000) + @attributes.DX.value / 100 + @basicspeed.value * 100",
formula: "(1d6 / 1000) + (@attributes.DX.value / 100) + @basicspeed.value",
decimals: 3
}

Expand Down
86 changes: 55 additions & 31 deletions module/actor-sheet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GURPS } from "./gurps.js";
import { isNiceDiceEnabled } from '../lib/utilities.js'
import { Melee, Reaction, Ranged, Advantage, Skill, Spell, Note } from './actor.js';
import { Melee, Reaction, Ranged, Advantage, Skill, Spell, Equipment, Note } from './actor.js';

/**
* Extend the basic ActorSheet with some very simple modifications
Expand Down Expand Up @@ -286,14 +286,15 @@ export class GurpsActorSheet extends ActorSheet {
get title() {
const t = this.actor.name;
const sheet = this.actor.getFlag("core", "sheetClass");
return (sheet === "gurps.GurpsActorEditorSheet") ? "Editing: " + t : t;
return (sheet === "gurps.GurpsActorEditorSheet") ? "**** Editing: " + t + " ****": t;
}

_getHeaderButtons() {
let buttons = super._getHeaderButtons();

const sheet = this.actor.getFlag("core", "sheetClass");
const isFull = sheet === undefined || sheet === "gurps.GurpsActorSheetGCS";
const isEditor = sheet === "gurps.GurpsActorEditorSheet";

// Token Configuration
const canConfigure = game.user.isGM || this.actor.owner;
Expand All @@ -312,10 +313,10 @@ export class GurpsActorSheet extends ActorSheet {
onclick: ev => this._onFileImport(ev)
}
];
if (isFull) {
if (!isEditor) {
b.push(
{
label: "Edit",
label: "Editor",
class: "edit",
icon: "fas fa-edit",
onclick: ev => this._onOpenEditor(ev)
Expand Down Expand Up @@ -445,7 +446,11 @@ export class GurpsActorEditorSheet extends GurpsActorSheet {
}

makeAddDeleteMenu(html, cssclass, obj) {
new ContextMenu(html, cssclass, [
new ContextMenu(html, cssclass, this.addDeleteMenu(obj));
}

addDeleteMenu(obj) {
return [
{
name: "Add Before",
icon: "<i class='fas fa-edit'></i>",
Expand All @@ -459,34 +464,38 @@ export class GurpsActorEditorSheet extends GurpsActorSheet {
callback: e => {
GURPS.removeKey(this.actor, e[0].dataset.key);
}
}
]);
},
{
name: "Add at the end",
icon: "<i class='fas fa-edit'></i>",
callback: e => {
let p = e[0].dataset.key;
let i = p.lastIndexOf(".");
let objpath = p.substring(0, i);
let o = GURPS.decode(this.actor.data, objpath);
GURPS.put(o, duplicate(obj));
this.actor.update({ [objpath] : o });
}
}
];
}

makeHeaderMenu(html, cssclass, name, obj, path, name2, obj2, path2) {
let opts = [];
opts.push( {
name: "Add " + name + " to the end",
headerMenu(name, obj, path) {
return [ {
name: "Add " + name + " at the end",
icon: "<i class='fas fa-edit'></i>",
callback: e => {
let o = GURPS.decode(this.actor.data, path);
GURPS.put(o, duplicate(obj));
this.actor.update({ [path] : o });
}
});
if (!!path2) {
opts.push( {
name: "Add " + name2 + " to the end",
icon: "<i class='fas fa-edit'></i>",
callback: e => {
let o = GURPS.decode(this.actor.data, path2);
GURPS.put(o, duplicate(obj2));
this.actor.update({ [path2] : o });
}
});
}
}
];
}


new ContextMenu(html, cssclass, opts);
makeHeaderMenu(html, cssclass, name, obj, path) {
new ContextMenu(html, cssclass, this.headerMenu(name, obj, path));
}

activateListeners(html) {
Expand All @@ -504,7 +513,9 @@ export class GurpsActorEditorSheet extends GurpsActorSheet {
this.makeHeaderMenu(html, ".rangedhead", "Ranged Attack", new Ranged("New Attack"), "data.ranged");
this.makeAddDeleteMenu(html, ".rangedmenu", new Ranged("New Attack"));

this.makeHeaderMenu(html, ".adshead", "Advantage", new Advantage("New Advantage"), "data.ads", "Disadvantage", new Advantage("New Disadvantage"), "data.disads");
let opts = this.headerMenu("Advantage", new Advantage("New Advantage"), "data.ads").concat(
this.headerMenu("Disadvantage", new Advantage("New Disadvantage"), "data.disads"));
new ContextMenu(html, ".adshead", opts);
this.makeAddDeleteMenu(html, ".adsmenu", new Advantage("New Advantage"));
this.makeAddDeleteMenu(html, ".disadsmenu", new Advantage("New Disadvantage"));

Expand All @@ -516,6 +527,23 @@ export class GurpsActorEditorSheet extends GurpsActorSheet {

this.makeHeaderMenu(html, ".notehead", "Note", new Note("New Note"), "data.notes");
this.makeAddDeleteMenu(html, ".notemenu", new Note("New Note"));

this.makeHeaderMenu(html, ".carhead", "Carried Equipment", new Equipment("New Equipment"), "data.equipment.carried");
this.makeHeaderMenu(html, ".othhead", "Other Equipment", new Equipment("New Equipment"), "data.equipment.other");

opts = this.addDeleteMenu(new Equipment("New Equipment"));
opts.push( {
name: "Add In (new Equipment will be contained by this)",
icon: "<i class='fas fa-edit'></i>",
callback: e => {
let k = e[0].dataset.key + ".contains";
let o = GURPS.decode(this.actor.data, k ) || {};
GURPS.put(o, duplicate(new Equipment("New Equipment")));
this.actor.update({ [k] : o });
}
});
new ContextMenu(html, ".carmenu", opts);
new ContextMenu(html, ".othmenu", opts);
}

async _onRightClickReactions(ev) {
Expand All @@ -527,12 +555,9 @@ export class GurpsActorEditorSheet extends GurpsActorSheet {
ev.preventDefault();
let element = ev.currentTarget;
let key = element.dataset.key;
let eqts = this.actor.data.data.equipment.carried;
let eqt = GURPS.decode(eqts, key);
let eqt = GURPS.decode(this.actor.data, key);
eqt.equipped = !eqt.equipped;
let t = "data.equipment.carried." + key;
await this.actor.update({ [t] : eqt });
//this.actor.sheet.render(true);
await this.actor.update({ [key] : eqt });
}

async _onClickEnc(ev) {
Expand All @@ -551,6 +576,5 @@ export class GurpsActorEditorSheet extends GurpsActorSheet {
await this.actor.update({ [t] : true });
}
}
// this.actor.sheet.render(true);
}
}
6 changes: 3 additions & 3 deletions system.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "gurps",
"title": "GURPS 4th Edition (Unofficial)",
"description": "An adaption of GURPS 4e for Foundry VTT (GCS/GCA edition)",
"version": "0.6.6",
"description": "A game aid to help play GURPS 4e for Foundry VTT (GCS/GCA edition)",
"version": "0.7.0",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.7",
"templateVersion": 2,
Expand Down Expand Up @@ -36,6 +36,6 @@
"secondaryTokenAttribute": "FP",
"url": "https://github.com/crnormand/gurps",
"manifest": "https://raw.githubusercontent.com/crnormand/gurps/release/system.json",
"download": "https://github.com/crnormand/gurps/archive/0.6.6.zip",
"download": "https://github.com/crnormand/gurps/archive/0.7.0.zip",
"license": "LICENSE.txt"
}
94 changes: 93 additions & 1 deletion template.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,99 @@
},
"melee": {},
"ranged": {},
"hitlocations" : {},
"hitlocations" : {
"00000": {
"dr": "0",
"equipment": "",
"penalty": "-9",
"roll": "",
"where": "Eye"
},
"00001": {
"dr": "2",
"equipment": "",
"penalty": "-7",
"roll": "",
"where": "Skull"
},
"00002": {
"dr": "0",
"equipment": "",
"penalty": "-5",
"roll": "",
"where": "Face"
},
"00003": {
"dr": "1",
"equipment": "",
"penalty": "-2",
"roll": "",
"where": "Right Leg"
},
"00004": {
"dr": "1",
"equipment": "",
"penalty": "-2",
"roll": "",
"where": "Right Arm"
},
"00005": {
"dr": "3",
"equipment": "",
"penalty": "0",
"roll": "",
"where": "Torso"
},
"00006": {
"dr": "2",
"equipment": "",
"penalty": "-3",
"roll": "",
"where": "Groin"
},
"00007": {
"dr": "1",
"equipment": "",
"penalty": "-2",
"roll": "",
"where": "Left Arm"
},
"00008": {
"dr": "1",
"equipment": "",
"penalty": "-2",
"roll": "",
"where": "Left Leg"
},
"00009": {
"dr": "0",
"equipment": "",
"penalty": "-4",
"roll": "",
"where": "Hand"
},
"00010": {
"dr": "0",
"equipment": "",
"penalty": "-4",
"roll": "",
"where": "Foot"
},
"00011": {
"dr": "0",
"equipment": "",
"penalty": "-5",
"roll": "",
"where": "Neck"
},
"00012": {
"dr": "3",
"equipment": "",
"penalty": "-3",
"roll": "",
"where": "Vitals"
}
},
"encumbrance": {},
"notes": {},
"equipment": {
Expand Down
Loading

0 comments on commit 09d819e

Please sign in to comment.