From e94a4c77faa45a6fd746292e80413cdc86d854c9 Mon Sep 17 00:00:00 2001 From: Jeffrey Lamb Date: Wed, 24 Oct 2018 11:35:54 -0400 Subject: [PATCH] Cleanup, getting started prompt, misc. --- Dungeon_World_Official/Dungeon World.css | 41 +++++++- Dungeon_World_Official/Dungeon World.html | 104 ++++++++++++++++++-- Dungeon_World_Official/translation.json | 12 ++- Dungeon_World_Official/translations/en.json | 12 ++- 4 files changed, 157 insertions(+), 12 deletions(-) diff --git a/Dungeon_World_Official/Dungeon World.css b/Dungeon_World_Official/Dungeon World.css index 14c3ec940a..ba148d487d 100755 --- a/Dungeon_World_Official/Dungeon World.css +++ b/Dungeon_World_Official/Dungeon World.css @@ -42,6 +42,40 @@ display: none; } +.sheet-tip-confirm-flag { + display: none; +} + +.sheet-tip-confirm-flag:checked ~ .sheet-class-tip { + display: none; +} + +.sheet-tip-confirm-flag:not(:checked) ~ .sheet-class-tip { + display: block; + position: absolute; + top: 12.8em; + left: 10.7em; + background: white; + z-index: 99; + border: 2px solid black; + border-radius: 6px; + padding: 5px; + width: 701px; + height: 85px; +} + +.sheet-class-tip .sheet-cancel-button { + float: right; +} + +.sheet-class-tip button[type=action] { + color: black; +} + +.sheet-class-tip button[type=action]:hover { + border-color: #6e9ec6; +} + .sheet-container.active-drop-target.dropping ~ .sheet-compendium_warning { display: block; position: fixed; @@ -776,7 +810,7 @@ button span { display: inline-block; line-height: 14px; text-align: center; - content: "+"; + content: "◂"; } .sheet-bond-expansion textarea { @@ -788,7 +822,7 @@ button span { .sheet-spells .sheet-expand-spell:checked + span::before, .sheet-gear .sheet-expand-gear:checked + span::before, .sheet-gmod .sheet-expand-gmod:checked + span::before { - content: "-"; + content: "▾"; } @@ -861,7 +895,8 @@ button span { } .sheet-toggler input[type=radio] + span, -.sheet-toggler input[type=checkbox] + span { +.sheet-toggler input[type=checkbox] + span, +button[type=action] { border: 1px solid rgb(35, 31, 32); border-radius: 6px; padding: 1px 6px; diff --git a/Dungeon_World_Official/Dungeon World.html b/Dungeon_World_Official/Dungeon World.html index 57bc589041..7f279a1b3b 100755 --- a/Dungeon_World_Official/Dungeon World.html +++ b/Dungeon_World_Official/Dungeon World.html @@ -112,7 +112,7 @@ - + @@ -725,6 +725,20 @@ + +
+ +

Getting Started

+

Welcome to the Dungeon World Character Sheet by Roll20! To get started, drag a class from the compendium or select one from the choices below:

+ + + + + + + + +
ACCEPTING DROP FROM COMPENDIUM @@ -2275,6 +2289,57 @@ var dwMoves = { // ---- Start worker scripts ----- // + +on("sheet:opened", function() { + getAttrs(["character_class", "isNPC"], function(v) { + if (v.isNPC != "1") { + update = {}; + if (v.character_class == null || v.character_class == "") { + update["tip_confirm_flag"] = "0"; + } else { + update["tip_confirm_flag"] = "1"; + } + setAttrs(update); + } + }); +}); + +on("clicked:bard", function(eventinfo) { + setupClass("Bard"); +}); + +on("clicked:cleric", function(eventinfo) { + setupClass("Cleric"); +}); + +on("clicked:druid", function(eventinfo) { + setupClass("Druid"); +}); + +on("clicked:fighter", function(eventinfo) { + setupClass("Fighter"); +}); + +on("clicked:paladin", function(eventinfo) { + setupClass("Paladin"); +}); + +on("clicked:ranger", function(eventinfo) { + setupClass("Ranger"); +}); + +on("clicked:thief", function(eventinfo) { + setupClass("Thief"); +}); + +on("clicked:wizard", function(eventinfo) { + setupClass("Wizard"); +}); + +on("clicked:cancelclass", function(eventinfo) { + setAttrs({tip_confirm_flag: 1}, "silent"); +}); + on("change:strength change:debil_weak", function() { getAttrs(["strength", "debil_weak"], function(values) { setAttrs({ @@ -2330,8 +2395,16 @@ on("change:page", function() { }); on("change:isNPC", function () { - getAttrs(["isNPC"], function(v) { - setAttrs({calc_isNPC: v.isNPC}); + getAttrs(["isNPC", "character_class"], function(v) { + if (v.isNPC == "1") { + setAttrs({calc_isNPC: v.isNPC, tip_confirm_flag: 1}); + } else { + if (v.character_class == null || v.character_class == "") { + setAttrs({calc_isNPC: v.isNPC, tip_confirm_flag: 0}); + } else { + setAttrs({calc_isNPC: v.isNPC, tip_confirm_flag: 1}); + } + } }); }) @@ -3055,7 +3128,7 @@ on("change:comp_NPC_moves", function() { // ------------------------------------------ // // -- Main Class Drop Compilation Function -- // // ------------------------------------------ // -/* + on("change:comp_name", function() { getAttrs(["populate_moves", "comp_name", "comp_damagedie", "comp_classmoves", "comp_load", "strength_mod"], function(v) { if (v.comp_name != "dropped") { @@ -3063,7 +3136,9 @@ on("change:comp_name", function() { // Populate all basic moves. if (v.populate_moves == "all") { addBasicMoves(); - setAttrs({populate_moves: "classonly"}); + setAttrs({ + populate_moves: "classonly" + }); } // Populate the Class's starting moves @@ -3079,11 +3154,26 @@ on("change:comp_name", function() { damagedie: v.comp_damagedie }); } + setAttrs({character_class: v.comp_name}); } }); - setAttrs({comp_name: "dropped"}, "silent"); + setAttrs({comp_name: "dropped", tip_confirm_flag: 1}, "silent"); }); -*/ +// Classname is the name of the Compendium Page. +var setupClass = function(classname) { + getCompendiumPage(classname, function(page) { + if (page["data"]) { + var update = {}; + var data = page["data"]; + update["character_class"] = classname; + update["comp_name"] = classname; + update["comp_damagedie"] = data["Base Damage"]; + update["comp_classmoves"] = data["data-Basic Moves"]; + update["comp_load"] = data["Load"]; + setAttrs(update); + } + }); +}; \ No newline at end of file diff --git a/Dungeon_World_Official/translation.json b/Dungeon_World_Official/translation.json index 43d697caaf..7eb89dc0d9 100755 --- a/Dungeon_World_Official/translation.json +++ b/Dungeon_World_Official/translation.json @@ -113,5 +113,15 @@ "level:": "Level: ", "move-effect": "Effect:", "bond-u": "BOND", - "accepting-drop-u": "ACCEPTING DROP FROM COMPENDIUM" + "accepting-drop-u": "ACCEPTING DROP FROM COMPENDIUM", + "getting-started": "Getting Started", + "getting-started-class-tip": "Welcome to the Dungeon World Character Sheet by Roll20! To get started, drag a class from the compendium or select one from the choices below:", + "Bard": "Bard", + "Cleric": "Cleric", + "Druid": "Druid", + "Fighter": "Fighter", + "Paladin": "Paladin", + "Ranger": "Ranger", + "Thief": "Thief", + "Wizard": "Wizard" } \ No newline at end of file diff --git a/Dungeon_World_Official/translations/en.json b/Dungeon_World_Official/translations/en.json index 43d697caaf..7eb89dc0d9 100644 --- a/Dungeon_World_Official/translations/en.json +++ b/Dungeon_World_Official/translations/en.json @@ -113,5 +113,15 @@ "level:": "Level: ", "move-effect": "Effect:", "bond-u": "BOND", - "accepting-drop-u": "ACCEPTING DROP FROM COMPENDIUM" + "accepting-drop-u": "ACCEPTING DROP FROM COMPENDIUM", + "getting-started": "Getting Started", + "getting-started-class-tip": "Welcome to the Dungeon World Character Sheet by Roll20! To get started, drag a class from the compendium or select one from the choices below:", + "Bard": "Bard", + "Cleric": "Cleric", + "Druid": "Druid", + "Fighter": "Fighter", + "Paladin": "Paladin", + "Ranger": "Ranger", + "Thief": "Thief", + "Wizard": "Wizard" } \ No newline at end of file