From f7307fa1efca756af221491f31d5544d6cde0991 Mon Sep 17 00:00:00 2001
From: Tim Repke <timmothey@gmx.de>
Date: Mon, 21 Sep 2015 22:33:53 +0200
Subject: [PATCH] =?UTF-8?q?typ=20am=20dorfeingang,=20tor=20w=C3=A4hlt=20al?=
 =?UTF-8?q?ter?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 registration-system/view/js/api.js            |   1 +
 .../view/signups/game1/MAP_HOWTO.md           |   1 +
 .../view/signups/game1/js/environment.js      |   2 +
 .../view/signups/game1/js/events.js           |  12 ++-
 .../view/signups/game1/js/story.js            |  69 +++++++++++++++---
 .../view/signups/game1/maps/map_landing.svg   | Bin 6738310 -> 6745913 bytes
 6 files changed, 74 insertions(+), 11 deletions(-)

diff --git a/registration-system/view/js/api.js b/registration-system/view/js/api.js
index c4a0e26..e8d38df 100644
--- a/registration-system/view/js/api.js
+++ b/registration-system/view/js/api.js
@@ -42,6 +42,7 @@ function Bachelor() {
         'mehl':    null,
         'essen':   null,
         'public':  null,
+        'virgin':  null,
         'studityp':null,
         'comment': null
     };
diff --git a/registration-system/view/signups/game1/MAP_HOWTO.md b/registration-system/view/signups/game1/MAP_HOWTO.md
index 0d8cc28..e2a73e5 100644
--- a/registration-system/view/signups/game1/MAP_HOWTO.md
+++ b/registration-system/view/signups/game1/MAP_HOWTO.md
@@ -38,6 +38,7 @@ Folgende Attribute sollten gesetzt werden:
 - destination (optional, target map für mapchange)
 - id
 - action (optional, action to call as defined in Events.actions)
+- directAction (optional, set true to fire action before walkTo point is reached)
 - walkTo (optional, before calling action, walk to point with this ID)
 - condition (optional, expression with vars as defined in Environment.progress, parenthesis allowed, i.e.: `(!someVar||otherVar)&&moreVar`)
 
diff --git a/registration-system/view/signups/game1/js/environment.js b/registration-system/view/signups/game1/js/environment.js
index 0d3309e..b6e5e64 100644
--- a/registration-system/view/signups/game1/js/environment.js
+++ b/registration-system/view/signups/game1/js/environment.js
@@ -15,6 +15,8 @@ Environment.progress = {
     // landing map related
     landing_askedNickname: false,
     landing_killedGoat: false,
+    landing_dorfEntranceApproach: false,
+    landing_ageChosen: false,
 
 
     // -----------------------------
diff --git a/registration-system/view/signups/game1/js/events.js b/registration-system/view/signups/game1/js/events.js
index d62e074..af503f0 100644
--- a/registration-system/view/signups/game1/js/events.js
+++ b/registration-system/view/signups/game1/js/events.js
@@ -24,6 +24,7 @@ function EventHandler(svg) {
                 destination: this.getAttribute('destination'),
                 stopsWalk: this.getAttribute('stopsWalk') === 'true',
                 action: this.getAttribute('action'),
+                directAction: this.getAttribute('directAction'),
                 walkTo: this.getAttribute('walkTo'),
                 condition: this.getAttribute('condition')
             });
@@ -113,13 +114,20 @@ EventHandler.handleAction = function (event) {
                 var bbox = spawn[0][0].getBBox();
                 var xy = Vec.add(getTranslation(spawn[0][0], Game.char.svg[0][0]), [bbox.x, bbox.y]);
 
+                // trigger action, then walk to target
+                if (event.directAction && event.directAction === 'true') {
+                    Story.actions[event.action].action(event);
+                    Game.char.setMoveTarget(xy[0], xy[1]);
+                }
                 // walk to the action point, start action on callback
-                Game.char.setMoveTarget(xy[0], xy[1], Story.actions[event.action].action);
+                else {
+                    Game.char.setMoveTarget(xy[0], xy[1], Story.actions[event.action].action);
+                }
             }
         }
         // otherwise start action directly
         else {
-            Story.actions[event.action].action();
+            Story.actions[event.action].action(event);
         }
     }
     return isPossible;
diff --git a/registration-system/view/signups/game1/js/story.js b/registration-system/view/signups/game1/js/story.js
index f8fcaf5..fca4ed2 100644
--- a/registration-system/view/signups/game1/js/story.js
+++ b/registration-system/view/signups/game1/js/story.js
@@ -348,15 +348,66 @@ Story.actions = {
                 function rotate(deg) {
                     return 'rotate(' + deg + ',' + goatPos.xCenter + ',' + goatPos.yCenter + ')';
                 }
+
+                function helper_endAll(transition, callback) {
+                    var n = 0;
+                    transition.each(function () {
+                        ++n;
+                    }).each('end', function () {
+                        if (!--n && callback) callback.apply(this, arguments);
+                    });
+                }
             }
+        }
+    },
 
-            function helper_endAll(transition, callback) {
-                var n = 0;
-                transition.each(function () {
-                    ++n;
-                }).each('end', function () {
-                    if (!--n && callback) callback.apply(this, arguments);
-                });
+    'landing_dorfEntranceApproach': {
+        possible: function () {
+            return !Environment.progress.landing_dorfEntranceApproach;
+        },
+        action: function () {
+            Environment.progress.landing_dorfEntranceApproach = true;
+            Game.char.svg.select('#dorfritter')
+                .transition().attr('transform', 'translate(0,15)');
+
+            Story.dialogueHelper([{
+                bubble: '#dorfritter_speech',
+                message: 'Wie ich sehe, willst du in das Dorf.',
+                action: function () {
+                    Game.char.svg.select('#dorfritter')
+                        .transition().duration(400).attr('transform', 'translate(30,5)');
+                }
+            }, {
+                bubble: '#dorfritter_speech',
+                message: 'Wenn du über 18 bist, nutze das rechte Tor.',
+                action: function () {
+                    Game.char.svg.select('#dorfritter')
+                        .transition().duration(800).attr('transform', 'translate(-30,5)');
+                }
+            }, {
+                bubble: '#dorfritter_speech',
+                message: 'Wenn nicht, dann das Linke!',
+                action: function () {
+                    Game.char.svg.select('#dorfritter')
+                        .transition().duration(200).attr('transform', 'translate(0,0)');
+                }
+            }], null, function() {
+                Game.log('Gehe ins Dorf.');
+                Game.log('18+ rechtes Tor, sonst das linke');
+            });
+        }
+    },
+
+    'landing_ageChoice': {
+        possible: function () {
+            return Environment.progress.landing_dorfEntranceApproach && !Environment.progress.landing_ageChosen;
+        },
+        action: function (event) {
+            Environment.progress.landing_ageChosen = true;
+            if (event.id === '18plusEntrance') {
+                Environment.fapi.data.setValue('virgin', 'Ja');
+            } else {
+                Environment.fapi.data.setValue('virgin', 'Nein');
             }
         }
     }
@@ -365,8 +416,8 @@ Story.actions = {
 Story.dialogueHelper = function (dialogue, context, done) {
 
     var speed = {
-        talk: UrlComponents.isSet('fastTalk') ? 1 : 45,
-        pause: UrlComponents.isSet('fastTalk') ? 50 : 1500
+        talk: UrlComponents.isSet('fastTalk') ? 1 : 50,
+        pause: UrlComponents.isSet('fastTalk') ? 50 : 2000
     };
 
     Game.actionsBlocked = true;
diff --git a/registration-system/view/signups/game1/maps/map_landing.svg b/registration-system/view/signups/game1/maps/map_landing.svg
index d81e9c54971307d3e00406d6db0c6afc346fcfd8..8af9084ebbda29901e0533257062e757e6be4ae2 100644
GIT binary patch
delta 5056
zcmc(j+0WzFb--bdm$5wd#2s&$*kjGKZqxGnB<_nd<Cxk-ZImcVl<LG5mrGI-Nr|K=
zN_|is(&V89ViYY{AOQk235o)BZ3hJgE?}TG+8}8iJ9%<}q6zX3bO8z%?Ng8D>x^xr
zK$E8m_~B5Oyvtec;XVAyx4wSv&7XYz+?T$5*O%}9%X9z!?GjnwNuDM-;#w|${JH)j
zGG;65IU~JsjS`3g4?p(jZtiYeBXEi-kR1J0_B-c*dw_d^`+)m_^S}c@4tNl_06YXd
z3|s_01v~=$3UCQ{6nG4H9C!kF68JQ58TbtF6!0`~1$YL?16P4-z^?+o20RP=I`A97
zXMx`Yeha{W6W|mm07U=?2!I4A;HU=!umA_}fB-xPd=9t{+yI^jJ`cPAh(HM_0~MeO
z)POqB0GfaVw176y0lGjBkbyoh02E*dsK5vq0~#;^roe9lF9Kfxz6iVoybR0${U-Yz
z<N3e1FP!<d6=veA=Y*TzRm{_i*{2o{+?W0El_`1iL*0Dmsk=!$du@90i3iOfM4=nU
zR(LIY#J=ZAnqUe%PLa(2csZXxx}K&BI1awQ)99Kvu6@)s``PcGuVz0w?caN0Qx+$p
zC|3Gzr<wiugS##tNJ$!0Yie%X)MBqeM5<tnwhgSV&L=B<RI=R(<)&>}?Du+Vv!z$v
zS<<X-o8xG$xK69q^v!i=ri@o<H&`l_GTvWKN;$Z~6}&WFOlyHsYmA(l(h)ZlTeG88
zDsH55Kvf*PzS$NJT~ES$&FQqxI;$Ba6WnI6CD^Xp79vU@rC!41C_mX?Q)17B38j@1
ztX<?Qk&%vYE8NZ+@@TFaWrJ&TWNla4j9C<zm@dYSuh)Zp(OQ_wFt$z2#zl2o%V9Y0
z`preXI9`~ZgbtHPk2YG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