From 5e1fea7441ed0b6d5d0a51813173a1b4eb730a61 Mon Sep 17 00:00:00 2001 From: Jeffrey Lamb Date: Tue, 23 Oct 2018 18:57:35 -0400 Subject: [PATCH] A lot of changes. --- Dungeon_World_Official/Dungeon World.css | 99 +++++++++-- Dungeon_World_Official/Dungeon World.html | 206 ++++++++++++++++++---- Dungeon_World_Official/translation.json | 3 +- 3 files changed, 256 insertions(+), 52 deletions(-) diff --git a/Dungeon_World_Official/Dungeon World.css b/Dungeon_World_Official/Dungeon World.css index 4416c80bc14..14c3ec940af 100755 --- a/Dungeon_World_Official/Dungeon World.css +++ b/Dungeon_World_Official/Dungeon World.css @@ -4,6 +4,7 @@ background-color: rgb(230, 231, 233); height: auto; border: 1px solid rgb(35, 31, 32); + min-width: 820px; } .charsheet .sheet-container label { @@ -30,7 +31,30 @@ } .sheet-compendium-drop-target.dropping { - background-color: yellow; + opacity: 0.5; + transition: opacity .15s ease-in-out; + -moz-transition: opacity .15s ease-in-out; + -webkit-transition: opacity .15s ease-in-out; + background-color: transparent; +} + +.sheet-compendium_warning { + display: none; +} + +.sheet-container.active-drop-target.dropping ~ .sheet-compendium_warning { + display: block; + position: fixed; + top: 50%; + background: white; + left: 50%; + z-index: 100; + border: 2px solid black; + width: 300px; + height: 85px; + text-align: center; + margin: -70px 0 0 -170px; + padding-top: 20px; } /* start npcstuff */ @@ -656,12 +680,15 @@ input[type=number]::-webkit-outer-spin-button { .sheet-dw-stat-header input { border-style: none; - border-bottom: 1px solid white; + border-bottom: 1px solid black; box-shadow: none; + margin-bottom: 5px; + width: 25px !important; background: none; color: inherit; text-align: right; align-self: flex-end; + padding-bottom: 0px; } button input[disabled=true] { @@ -724,8 +751,8 @@ button span { width: 16px; height: 16px; position: relative; - top: -5px; - left: 5px; + top: -2px; + left: 4px; margin: -10px; cursor: pointer; z-index: 1; @@ -845,6 +872,26 @@ button span { font-weight: bold; } +.sheet-nav-tabs { + margin-left: +6px; +} + +.sheet-nav-tabs .sheet-toggler input[type=radio] + span { + border-radius: 2px; + font-size: 0.9em; + padding-top: 0.2em; +} + +.sheet-nav-tabs .sheet-toggler input[type=radio]:checked + span { + background-color: unset; + background-image: linear-gradient(#ffffffb8, transparent); + border-bottom-color: transparent; +} + +.sheet-nav-tabs .sheet-toggler input[type=radio]:focus + span { + border-bottom-color: transparent; +} + .sheet-toggler input[type=radio]:checked + span, .sheet-toggler input[type=checkbox]:checked + span { color: rgb(35, 31, 32); @@ -979,7 +1026,11 @@ button span { flex-wrap: wrap; text-align: right; margin-top: 5px; - padding-right: 20px; + padding-right: 20px; +} + +.sheet-move-expansion { + text-align: left; } .sheet-move-expansion input[type="text"], @@ -1003,6 +1054,11 @@ button span { height: 3em; } +.sheet-move-expansion textarea { + width: calc(100% - 20px); + margin-top: 0px; +} + .sheet-move-expansion input[type="number"], .sheet-spell-expansion input[type="number"], .sheet-gear-expansion input[type="number"], @@ -1136,11 +1192,18 @@ textarea.sheet-gear-details { } .sheet-gmod { + /* background-color: white; border: 1px solid black; + */ padding: 2px; - margin-left: 0.2em; - width: 20em; + margin-left: 0.3em; + width: calc(100% - 1.2em); +} + +.sheet-gmod .repitem { + width: calc(100% - 5%); + margin-left: 0.5em; } /* Roll Templates */ @@ -1220,16 +1283,16 @@ textarea.sheet-gear-details { /* Notes Fields */ .sheet-notes{ - border-radius: 0; - box-shadow: none; - border: 1px solid; - min-height: 28px; - padding: 5px; - width:49%; - box-sizing: border-box; - resize:vertical; - display:inline-block; + border-radius: 0; + box-shadow: none; + border: 1px solid; + min-height: 28px; + padding: 5px; + width:49%; + box-sizing: border-box; + resize:vertical; + display:inline-block; } .sheet-notes2{ - margin-left:10px; -} + margin-left:10px; +} \ No newline at end of file diff --git a/Dungeon_World_Official/Dungeon World.html b/Dungeon_World_Official/Dungeon World.html index 0608693c3d6..57bc5890414 100755 --- a/Dungeon_World_Official/Dungeon World.html +++ b/Dungeon_World_Official/Dungeon World.html @@ -1,4 +1,4 @@ -
+
@@ -29,6 +29,7 @@ +
@@ -38,10 +39,10 @@
-
+
- + Tags: @@ -432,8 +433,7 @@
-
- +
@@ -441,8 +441,9 @@
Move Name: - + Trigger: +

@@ -462,15 +463,18 @@
Success (10+): +
At a Cost (7-9): +
Miss (6-): +
Details:
- +
@@ -496,17 +500,17 @@ GEAR LOAD - / - + / +
-
+
- + @@ -516,18 +520,18 @@
Gear Name: - + Gear Tags: - +
- Value: + Value: Qty: - Weight: + Weight:
@@ -556,21 +560,21 @@
- Damage: + Damage:
- Base Armor: + Base Armor: - + Armor: + + Armor:

Details:
- +
@@ -588,16 +592,16 @@ - + - +
Spell Name: - + Spell Tags: - + Level:
+
+ + + + + + + +
+ + + +
+ ACCEPTING DROP FROM COMPENDIUM +
@@ -2320,7 +2339,7 @@ var calculateMod = function(attribute) { if (attribute < 4) return -3; - if (attribute < 6) + if (attribute < 6) return -2; if (attribute < 9) return -1; @@ -2363,6 +2382,64 @@ return "0[no stat]"; } +// Spell is the name of the compendium page to get. +var addSpell = function(spell, rowid = 0) { + var newspellid = rowid; + if (!rowid) { + newspellid = generateRowID(); + } + console.log("Adding Spell: " + spell); + getCompendiumPage(spell, function(page) { + console.log("Got compendium page for " + spell); + if (page["data"]) { + var data = page["data"]; + console.log("dropping " + spell); + console.log(data); + var prefix = "repeating_spells_" + newspellid + "_"; + var attrs = {}; + attrs[prefix + "spellname_base"] = page["name"]; + attrs[prefix + "spell_tags"] = data["Tags"] || ""; + attrs[prefix + "comp_spell_level"] = data["Level"] || "0"; + attrs[prefix + "comp_fullroll"] = data["Roll"] || ""; + attrs[prefix + "spelldetails"] = data["Details"] || ""; + + // Don't auto-expand gear from compendium. + attrs[prefix + "expand_spell"] = 0; + setAttrs(attrs); + } + }); +} + +// Gear is the Name of the Compendium Page to get. +var addGear = function(gear, rowid = 0) { + var newgearid = rowid; + if (!rowid) { + newgearid = generateRowID(); + } + console.log("Adding Gear: " + gear); + getCompendiumPage(gear, function(page) { + console.log("Got compendium page for " + gear); + if (page["data"]) { + var data = page["data"]; + var prefix = "repeating_gear_" + newgearid + "_"; + var attrs = {}; + attrs[prefix + "gearname_base"] = page["name"]; + attrs[prefix + "gear_tags"] = data["Tags"] || ""; + attrs[prefix + "gear_value"] = data["Value"] || "0"; + attrs[prefix + "gear_type"] = data["Type"] || "Item"; + attrs[prefix + "gear_weight"] = data["Weight"] || "0"; + attrs[prefix + "gear_damage"] = data["Damage"] || "0"; + attrs[prefix + "gear_base_armor"] = data["Armor"] || "0"; + attrs[prefix + "gear_add_armor"] = data["Armor Mod"] || "0"; + attrs[prefix + "geardetails"] = data["Details"] || ""; + + // Don't auto-expand gear from compendium. + attrs[prefix + "expand_gear"] = 0; + setAttrs(attrs); + } + }); +} + // move is the shortname, no special chars, spaces, all lowercase. var addMove = function(move, rowid = 0) { if (dwMoves[move]) { @@ -2451,7 +2528,6 @@ var preparedLevels = []; for(var i=0; i < ids.length; i++) { var attr = "repeating_spells_" + ids[i] + "_calc_prepval"; - console.log("wtf"); preparedLevels.push(attr); } @@ -2500,7 +2576,7 @@ repeating_spells_spell_level:v.repeating_spells_comp_spell_level, repeating_spells_comp_spell_level: -1 }); - if (v.repeating_spells_comp_fullroll != "" && v.repeating_spells_comp_fullroll != null) { + if (v.repeating_spells_comp_fullroll != "" && v.repeating_spells_comp_fullroll != null && v.repeating_spells_comp_fullroll != "") { var rollPieces = []; rollPieces = parseRoll(v.repeating_spells_comp_fullroll); setAttrs({ @@ -2891,12 +2967,75 @@ }); }); +// ---------------------- // +// -- Compendium Drops -- // +// ---------------------- // + +on("change:drop_category", function(eventinfo) { + if(eventinfo.newValue === "Monsters") { + // Handle query for changing to an NPC if not already one. + getAttrs(["isNPC", "drop_name"], function(v) { + if (v.isNPC) { + setAttrs({character_name: v.drop_name}); + } + }); + } + else { + handle_drop(eventinfo.newValue); + } +}); + +var handle_drop = function(category, eventinfo) { + console.log("Handling drop"); + console.log(category); + setAttrs({drop_category: ""}, "silent", function() { + getAttrs(["drop_name", "drop_data", "drop_content"], function(v) { + pagedata = {}; + try { + pagedata = JSON.parse(v.drop_data); + } catch(e) { + pagedata = v.drop_data; + } + console.log(pagedata); + if (category === "Moves") { + addMove(pagedata["data-Shortname"]); + } else if (category === "Equipment") { + addGear(v.drop_name); + } else if (category === "Spells") { + addSpell(v.drop_name); + } else if (category === "Classes") { + getAttrs(["populate_moves", "comp_name", "comp_damagedie", "comp_classmoves", "comp_load", "strength_mod"], function(v) { + if (v.comp_name != "dropped") { + + // Populate all basic moves. + if (v.populate_moves == "all") { + addBasicMoves(); + setAttrs({populate_moves: "classonly"}); + } + + // Populate the Class's starting moves + if (v.populate_moves == "all" || v.populate_moves == "classonly") { + var startingMoves = [] + startingMoves = JSON.parse(v.comp_classmoves); + + for (var i = 0, len = startingMoves.length; i < len; i++) { + addMove(shortName(startingMoves[i])); + } + + setAttrs({ + damagedie: v.comp_damagedie + }); + } + } + }); + setAttrs({comp_name: "dropped"}, "silent"); + } + }); + }); +} // Move Drop on("change:repeating_moves:comp_shortname", function(eventInfo) { - getAttrs(["repeating_moves_comp_shortname"], function(v) { - addMove(v.repeating_moves_comp_shortname, eventInfo.sourceAttribute.split("_")[2]); - setAttrs({repeating_moves_comp_shortname: "-1"}, "silent"); // Don't repropagate. - }); + }); // NPC Drop @@ -2916,6 +3055,7 @@ // ------------------------------------------ // // -- 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") { @@ -2943,7 +3083,7 @@ }); setAttrs({comp_name: "dropped"}, "silent"); }); +*/ - - + \ No newline at end of file diff --git a/Dungeon_World_Official/translation.json b/Dungeon_World_Official/translation.json index 97b710d5115..43d697caafc 100755 --- a/Dungeon_World_Official/translation.json +++ b/Dungeon_World_Official/translation.json @@ -112,5 +112,6 @@ "name-makes-spell": "casts a spell", "level:": "Level: ", "move-effect": "Effect:", - "bond-u": "BOND" + "bond-u": "BOND", + "accepting-drop-u": "ACCEPTING DROP FROM COMPENDIUM" } \ No newline at end of file