Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: [1]

Author Topic: Found some code for Google Hangouts  (Read 929 times)

0 Members and 1 Guest are viewing this topic.

michaeljb

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1422
  • Shuffle iT Username: michaeljb
  • Respect: +2113
    • View Profile
Found some code for Google Hangouts
« on: April 05, 2014, 03:48:22 pm »
+9

I was doing some digging around Goko's code today, trying to do some work for Salvager, and came across some code that seems related to playing in Google Hangouts, and I felt it was worth sharing some snippets.

https://www.playdominion.com/Dominion/lib/DominionUI.js - starting at line 9546, just ctrl+F/cmd+F for "HangoutEventManager.prototype.onEvent = function(options)"

Code: [Select]
case "system.youWin":
console.log("ZZZZZZZZZZ - YOUWIN!!!");
break;
case "system.yourTurn":
console.log("ZZZZZZZZZZ - YOUR TURN!!!");
break;
case "village.onPlay":
console.log("You played a village - cool animations here");
break;
case "curse.onBuy":
console.log("You bought a curse - cool animations here");

When writing production code, make sure your log messages go the bottom of an alphabetized list. Or at least some of them. Also, saying "cool animations" is almost as good as actually having cool animations.

Code: [Select]
// More custom-ish stuff up top
case "system.youWin":
createOverlay('crown');
break;
case "system.yourTurn":
// Add video overlay hilite to my window
// SOON
//createOverlay('turn');
break;
case "curse.onBuy":
createOverlay('jackass', 10000);
playHangoutSound('jackass.wav');
ignoreNextGain = true;
break;
case "curse.onGain":
if (ignoreNextGain) {
//console.log("You gained a curse - IGNORED");
} else {
createOverlay('frog', 10000);
//playHangoutSound('jackass.mp3');
}


SOON.

I can't wait to play on Google Hangouts and win, I get a crown! Better not buy a Curse though, don't want all my friends to start calling me a jackass.

I guess in Google Hangouts, Dominion is now a fairy tale where everyone is a Prince and gaining a Curse is like being turned into a frog. At least they changed their mind about adding insult to injury with the jackass noise when you turn into a frog.

Code: [Select]
switch (options.code) {

....

case "baron.onPlay":
createOverlay(overlayName);
break;
case "bureaucrat.onPlay":
createOverlay(overlayName);
break;
case "chancellor.onPlay":
createOverlay(overlayName);
break;
case "duke.onPlay":
createOverlay(overlayName);
break;
case "harem.onPlay":
createOverlay(overlayName);
break;
case "envoy.onPlay":
createOverlay(overlayName);
break;
case "explorer.onPlay":
createOverlay(overlayName);
break;
case "feast.onPlay":
createOverlay(overlayName);
break;
case "festival.onPlay":
createOverlay(overlayName);
break;
case "forge.onPlay":
createOverlay(overlayName);
break;
case "goons.onPlay":
createOverlay(overlayName);
break;
case "harem.onGain":
createOverlay(overlayName);
break;
case "kingsCourt.onPlay":
createOverlay(overlayName);
break;
case "militia.onPlay":
createOverlay(overlayName);
break;
case "minion.onPlay":
createOverlay(overlayName);
break;
case "mint.onPlay":
createOverlay(overlayName);
break;
case "moneylender.onPlay":
createOverlay(overlayName);
break;
case "mountebank.onPlay":
createOverlay(overlayName);
break;
case "nobles.onPlay":
createOverlay(overlayName);
break;
case "pearlDiver.onPlay":
createOverlay(overlayName);
break;
case "peddler.onPlay":
createOverlay(overlayName);
break;
case "rabble.onPlay":
createOverlay(overlayName);
break;
case "salvager.onPlay":
createOverlay(overlayName);
break;
case "seaHag.onPlay":
createOverlay(overlayName);
break;
case "spy.onPlay":
createOverlay(overlayName);
break;
case "swindler.onPlay":
createOverlay(overlayName);
break;
case "thief.onPlay":
createOverlay(overlayName);
break;
case "torturer.onPlay":
createOverlay(overlayName);
break;
case "witch.onPlay":
createOverlay(overlayName);
break;

So, not all of the cards are listed here. I wonder how they chose which cards matter for Google Hangouts? Also note that before this switch statement, overlayName was defined by:

Code: [Select]
var overlayName = options.code.split(".")[0];
So that all could probably be replaced with

Code: [Select]
createOverlay(overlayName);
or something similar.
« Last Edit: April 05, 2014, 03:54:33 pm by michaeljb »
Logged
🚂 Give 18xx games a chance 🚂
Pages: [1]
 

Page created in 0.038 seconds with 20 queries.