lawless-legends/OutlawEditor/src/main/resources/mythos/mythos-editor/html/editor.html
2022-11-30 09:34:52 -06:00

794 lines
45 KiB
HTML

<!DOCTYPE html>
<!--
Copyright (C) 2015 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1
(the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-1.1>.
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
-->
<html>
<head>
<meta charset="utf-8"></meta>
<title>MythOS Script Editor</title>
<script type="text/javascript" src="../../blockly_compressed.js"></script>
<script type="text/javascript" src="../../blocks_compressed.js"></script>
<script type="text/javascript" src="../../msg/js/en.js"></script>
<script type="text/javascript" src="../js/mythos_uncompressed.js"></script>
<style>
body {
background-color: #fff;
font-family: sans-serif;
}
h1 {
font-weight: normal;
font-size: 140%;
}
html, body {
height: 100%;
margin: 0;
overflow: hidden;
}
#blocklyArea {
min-height: 100%;
width: 100%;
height: 100%;
overflow: hidden;
}
#blocklyDiv {
height: 700px;
width: 990px;
overflow: hidden;
}
</style>
</head>
<body>
<div id="blocklyArea">
<div id="blocklyDiv"></div>
</div>
<xml id="toolbox" style="display: none">
<category id="variables" name="Variables">
<block type="variables_set"></block>
<block type="variables_get"></block>
</category>
<category id="functions" name="Functions">
<category id="globalFunctions" name="Global"></category>
<category id="localFunctions" name="Local"></category>
</category>
<category name="Flow">
<block type="controls_if"></block>
<block type="flow_for"></block>
<block type="flow_repeat"></block>
<block type="flow_break"></block>
<block type="flow_continue"></block>
</category>
<category name="Math">
<block type="math_number"></block>
<block type="math_arithmetic"></block>
<block type="math_change"></block>
<block type="math_modulo"></block>
<block type="math_random_int"></block>
</category>
<category name="Logic">
<block type="logic_compare"></block>
<block type="logic_operation"></block>
<block type="logic_negate"></block>
<block type="logic_boolean"></block>
<block type="logic_ternary"></block>
<block type="logic_cointoss"></block>
</category>
<category name="Events">
<block type="events_set_map"></block>
<block type="events_teleport"></block>
<block type="events_move_backward"></block>
<block type="events_set_sky"></block>
<block type="events_set_ground"></block>
<block type="events_add_encounter_zone"></block>
<block type="events_clr_encounter_zones"></block>
<block type="events_start_encounter"></block>
</category>
<category name="Text">
<!--<block type="text_window"></block>-->
<block type="text_clear_window"></block>
<!--<block type="text_moveto"></block>-->
<block type="text_print"></block>
<block type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
</block>
<block type="text_println"></block>
<block type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
</block>
<block type="text_printnum"></block>
<block type="text_storybook">
<value name="INTRO">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="SHORT">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="LONG">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
</block>
<block type="text_getanykey"></block>
<block type="text_promptanykey"></block>
<!--<block type="text_mode"></block>-->
<!--<block type="text_scroll"></block>-->
<block type="text"></block>
<block type="text_getstring"></block>
<block type="text_getnumber"></block>
<block type="text_getboolean"></block>
<block type="text_getcharacter"></block>
</category>
<category name="Interaction">
<block type="interaction_get_stat"></block>
<block type="interaction_increase_stat"></block>
<block type="interaction_increase_stat_expr"></block>
<block type="interaction_decrease_stat"></block>
<block type="interaction_decrease_stat_expr"></block>
<block type="interaction_get_flag"></block>
<block type="interaction_set_flag"></block>
<block type="interaction_clr_flag"></block>
<block type="interaction_pause"></block>
<block type="interaction_buy_from_store"></block>
<block type="interaction_sell_to_store"></block>
</category>
<category name="Party">
<block type="interaction_add_player"></block>
<block type="interaction_remove_player"></block>
<block type="interaction_has_player"></block>
<block type="interaction_bench_player"></block>
<block type="interaction_unbench_player"></block>
<block type="interaction_give_item"></block>
<block type="interaction_take_item"></block>
<block type="interaction_has_item"></block>
<block type="interaction_increase_party_stats"></block>
<block type="interaction_decrease_party_stats"></block>
</category>
<category id="customTypes" name="Custom Types">
</category>
<category name="Graphics">
<block type="graphics_set_portrait"></block>
<block type="graphics_clr_portrait"></block>
<block type="graphics_set_fullscreen"></block>
<block type="graphics_clr_fullscreen"></block>
<block type="graphics_set_avatar"></block>
<block type="graphics_swap_tile"></block>
<block type="graphics_intimate_mode"></block>
</category>
<category name="Sound">
<block type="sound_play_emu_track"></block>
<block type="sound_play_emu_sfx"></block>
<block type="sound_stop_emu_playback"></block>
<block type="sound_generate_sfx"></block>
</category>
<category name="Preconnected">
<!-- Press any key -->
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="text_getanykey"></block>
</next>
</block>
<!-- Show portrait / Text -->
<block type="graphics_set_portrait">
<field name="NAME">Name</field>
<next>
<block type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text</field>
</block>
</value>
<next>
<block type="text_getanykey">
<next>
<block type="text_clear_window">
<next>
<block type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
<!-- Special (show portrait and step back -->
<block type="graphics_set_portrait">
<field name="NAME">Name</field>
<next>
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="text_getanykey">
<next>
<block type="events_move_backward"></block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
<!-- Exit -->
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">Leave?</field>
</block>
</value>
<next>
<block inline="false" type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block type="text_getboolean"></block>
</value>
<statement name="DO0">
<block type="events_set_map">
<field name="NAME">Overworld - 2D</field>
<field name="X">42</field>
<field name="Y">42</field>
<field name="FACING">0</field>
</block>
</statement>
<statement name="ELSE">
<block type="events_move_backward"></block>
</statement>
</block>
</next>
</block>
<!--Puzzle-->
<block type="graphics_set_portrait">
<field name="NAME">Name</field>
<next>
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text</field>
</block>
</value>
<next>
<block inline="true" type="variables_set">
<field name="VAR">response</field>
<value name="VALUE">
<block type="text_getstring"></block>
</value>
<next>
<block type="text_clear_window">
<next>
<block inline="false" type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block inline="true" type="logic_compare">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get">
<field name="VAR">response</field>
</block>
</value>
<value name="B">
<block type="text">
<field name="TEXT">correct response</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Affirmative Response</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="text_getanykey"></block>
</next>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Negative Response</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="text_getanykey">
<next>
<block type="events_move_backward"></block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
<!-- Boss Battle -->
<block inline="false" type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block type="interaction_has_item">
<field name="NAME">quest item</field>
</block>
</value>
<statement name="DO0">
<block type="text_clear_window">
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">Already beat boss</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="graphics_set_portrait">
<field name="NAME">Boss pic</field>
<next>
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Pre-boss fight message</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="text_getanykey">
<next>
<block type="events_start_encounter">
<field name="CODE">Boss code</field>
<next>
<block type="graphics_set_portrait">
<field name="NAME">Combat win</field>
<next>
<block type="text_clear_window">
<next>
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">winning message</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="interaction_give_item">
<field name="NAME">Quest item</field>
<next>
<block type="text_getanykey"></block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<!-- Shop -->
<block type="graphics_set_portrait">
<field name="NAME">picture</field>
<next>
<block type="text_clear_window">
<next>
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Question Y/N</field>
</block>
</value>
<next>
<block inline="false" type="controls_if">
<value name="IF0">
<block type="text_getboolean"></block>
</value>
<statement name="DO0">
<block inline="false" type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block inline="true" type="logic_compare">
<field name="OP">GTE</field>
<value name="A">
<block type="interaction_get_stat">
<field name="NAME">Gold</field>
</block>
</value>
<value name="B">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="interaction_decrease_stat">
<field name="NAME">Gold</field>
<field name="AMOUNT">0</field>
<next>
<block type="text_clear_window">
<next>
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">text for sold</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="interaction_give_item">
<field name="NAME">item</field>
<next>
<block type="text_getanykey"></block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="text_clear_window">
<next>
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text for no sale</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="text_getanykey"></block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
<next>
<block type="events_move_backward"></block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
<!-- Treasure -->
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text Y/N</field>
</block>
</value>
<next>
<block inline="false" type="controls_if">
<value name="IF0">
<block type="text_getboolean"></block>
</value>
<statement name="DO0">
<block inline="false" type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block type="interaction_has_item">
<field name="NAME">Item</field>
</block>
</value>
<statement name="DO0">
<block type="text_clear_window">
<next>
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="text_getanykey"></block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="text_clear_window">
<next>
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="interaction_give_item">
<field name="NAME">item</field>
<next>
<block type="text_getanykey"></block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</next>
</block>
<!-- Use item -->
<block type="graphics_set_portrait" id="2">
<field name="NAME">Picture</field>
<next>
<block inline="false" type="text_println" id="3">
<value name="VALUE">
<block type="text">
<field name="TEXT">TEXT</field>
</block>
</value>
<next>
<block inline="false" type="controls_if">
<value name="IF0">
<block inline="true" type="logic_operation">
<field name="OP">AND</field>
<value name="A">
<block inline="true" type="logic_compare">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get">
<field name="VAR">event</field>
</block>
</value>
<value name="B">
<block type="text">
<field name="TEXT">use</field>
</block>
</value>
</block>
</value>
<value name="B">
<block inline="true" type="logic_compare">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get">
<field name="VAR">data</field>
</block>
</value>
<value name="B">
<block type="text">
<field name="TEXT">Item?</field>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="text_clear_window">
<next>
<block inline="false" type="controls_if">
<mutation else="1"></mutation>
<value name="IF0">
<block type="interaction_get_flag">
<field name="NAME">?</field>
</block>
</value>
<statement name="DO0">
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="text_getanykey"/>
</next>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block inline="false" type="text_println">
<value name="VALUE">
<block type="text">
<field name="TEXT">Text</field>
</block>
</value>
<next>
<block inline="false" type="text_print">
<value name="VALUE">
<block type="text">
<field name="TEXT">(press any key)</field>
</block>
</value>
<next>
<block type="text_getanykey"/>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</category>
</xml>
<script>
var blocklyArea = document.getElementById('blocklyArea');
var blocklyDiv = document.getElementById('blocklyDiv');
Mythos.initBlocks();
Mythos.workspace = Blockly.inject(blocklyDiv,
{path: '../../', toolbox: document.getElementById('toolbox'), sounds: false});
var onresize = function (e) {
// Compute the absolute coordinates and dimensions of blocklyArea.
var element = blocklyArea;
var x = 0;
var y = 0;
do {
x += element.offsetLeft;
y += element.offsetTop;
element = element.offsetParent;
} while (element);
// Position blocklyDiv over blocklyArea.
blocklyDiv.style.left = x + 'px';
blocklyDiv.style.top = y + 'px';
blocklyDiv.style.width = blocklyArea.offsetWidth + 'px';
blocklyDiv.style.height = blocklyArea.offsetHeight + 'px';
};
window.addEventListener('resize', onresize, false);
onresize();
</script>
</body>
</html>