D5XJXJK472U7GYOBKYYGEMO5B3QM2OBDM5NWMYRNCZ2A7Z2HNFVAC HTIL7GWVKJ6WRRRQEEFGMQL6GWTFW2TP7FI34DLXI4DK4QS4HXSAC OPI6W7BO4V3R5WGEVN4USOHVPUV5PVWGKYBMCRU4VQOI7F7RCF5QC 4LMTBPV7JT446YP5RLF6HT7246BY75U5V35JTEIK4PT5NEPKNNKAC MYLF7NEGFT6YYO6OEK22FLAS6Y2V3YGU4CQIMBE6APOLGLTOFNRQC NDDFOS5624OS3JXFPE46C2VBGU6XYA2XOOP7X5GF26HMDPYLOQXQC EZYBNJFUNOS3LIU6ILXN7MFKLVW4SDXW6K5T4YFKFZ2R4UWSFUXAC OLS2OW4YBKIEBURLW2LZDHHFGBGILOXQHHZBW7ED37MKISEGJKOAC JPHC6PBQJCGZ3B4LKX7C3XZOYP6UTHWV5PU5EXZ27TTXYZY3AG4AC J6J74CCDLZIY2SBU6O7DCX7QUO7LVNBFOZJ7F3VW4OPRPHKQ62OAC ZXBDOUETFSXTFY6J5LIMXBCNMDW6NTUTZ7HZZ6ND7BNUKISR74FAC KLQKDNMZA776M73IWLBYAHXLESBVKE44YJS2IAAMYJJLOC3IJMOAC NRK37A4NNGLF53STW5RJDHUEP6OKKJORJZL3HYVOKD7OW4QBO5XAC M74RMZSTQLQHMG5PGM6DMM7JJFUHHNBS7QPNGJNXCSB4WHQVBTFAC .investigator {z-index:100;position: absolute;height:50px;width:50px;background-color: darkred;border: solid 0 rgba(0, 0, 0, 0.33);border-width: 0 1px 1px 0;border-radius: 4px;box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.5);}
.loc_tokens {position: absolute;height:50px;width:272px;text-align: center;background-color: #ffffff33;}.loc_tokens.loc_chinatown {top: 394px;left: 30px;}.loc_tokens.loc_forestpark {top: 52px;left: 596px;transform: rotate(2.5deg);}.loc_tokens.loc_trocadero {top:220px;left:452px;transform: rotate(1deg);}.loc_tokens .investigator {position:relative;display:inline-block;}.loc_tokens .investigator:last-of-type {margin-right:0;}
/* Top right, so we can still see the image and the cubes */.locslot .disc30 {top:18px;left:33px;}/* Regarding multiple discs on one locslot: Yes, there can only ever be one discon a tile. If a user manually moves one there it stays there, unless we finda full match later. Then we move it back to the agentarea. A full match is afull match, there is no sense in keeping a wrongly manually placed disc therethen. This might count as a very very minor 'helping the player'; but it'sreally too obvious not to tell them. TODO: implement this in the backend. */.investigator {z-index:100;position: relative;height:36px;width:36px;margin:3px;background-image: url("img/investigators.png");background-size:182px;border-radius: 4px;box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.75);}.investigator_red { background-position: 0px 0px }.investigator_blue { background-position: -36px 0px }.investigator_yellow { background-position: -72px 0px }.investigator_green { background-position: -108px 0px }.investigator_purple { background-position: -144px 0px }.investigator .cube20,.investigator .disc30 {position: absolute;}.investigator .disc30 {bottom:-1px;right:-2px;}.investigator > div:nth-of-type(1) { left: -5px; bottom:-2px; z-index:200; }.investigator > div:nth-of-type(2) { right: -5px; bottom:-2px; left:17px; z-index:200; }.investigator > div:nth-of-type(3) { left: -5px; bottom:13px; z-index:201; }
.disc30_green { background-position: -30px 0px }.disc30_beige { background-position: -60px 0px }.disc30_orange { background-position: -90px 0px }.disc30_white { background-position: -120px 0px }.disc30_black { background-position: -150px 0px }.disc30_red { background-position: -180px 0px }.disc30_yellow { background-position: -210px 0px }.disc30_gray { background-position: -240px 0px }.disc30_purple { background-position: -270px 0px }
.disc30_green { background-position: -25px 0px }.disc30_beige { background-position: -50px 0px }.disc30_orange { background-position: -75px 0px }.disc30_white { background-position: -100px 0px }.disc30_black { background-position: -125px 0px }.disc30_red { background-position: -150px 0px }.disc30_yellow { background-position: -175px 0px }.disc30_gray { background-position: -200px 0px }.disc30_purple { background-position: -225px 0px }
function getLocationIdOfTile($tile){// Assert that the tile is actually on the board.if ($tile['location'] != 'locslot') {throw new BgaVisibleSystemException("Tile is not on the board. Please report this.");}$tile_slot_id = $tile['location_arg'];return floor((int)$tile_slot_id / 100); // the invers of ($loc_id * 100 + 1|2|3)}
// Assert that the tile is actually on the board.if ($tile['location'] != 'locslot') {throw new BgaVisibleSystemException("Tile is not on the board. Please report this.");}$tile_slot_id = $tile['location_arg'];$location_mid = floor((int)$tile_slot_id / 100); // the invers of ($loc_id * 100 + 1|2|3)
$location_mid = $this->getLocationIdOfTile($tile);
$this->tokens->pickTokensForLocation(1, "pi_supply_{$player_id}", "location_{$location_id}");
$_temp = $this->tokens->pickTokensForLocation(1, "pi_supply_{$player_id}", $token_location);$pi_token = array_shift($_temp);self::notifyAllPlayers('placeToken',clienttranslate('${player_name} sends an investigator to ${location_name}.'),array('i18n' => array('location_name'),'token' => $pi_token,'target_id' => $token_location,'player_name' => $player['player_name'],'location_name' => $this->locations[$location_id]['name']));
// Various infos we need$card_name = $this->cardBasis[$currentCard['type_arg']]['name'];$player_id = self::getActivePlayerId();$player = self::loadPlayersBasicInfos()[$player_id];$color = $this->constants['HEX2COLORNAME'][$player['player_color']];$tile = $this->getCorrespondingTile($currentCard['id']);$location_id = $this->getLocationIdOfTile($tile);$agent_area = "agentarea_{$location_id}";// The locslot to place a token on, in case of success$target_id = "locslot_{$tile['location_arg']}";
// Full match// // TODO: Put player-colored disc onto the locslot (if not there already)// $discs = $this->tokens->getTokensOfTypeInLocation('disc_%', "supply_{$player_id}");// if (!$discs) {// // The disc for this match is out there already; should be on the slot's parent location/agent slot.// // TODO: find it and put it on the locslot// } else {// $disc = array_shift($discs);// }// $disc = $this->tokens->getTokenOnTop('');// if (!$disc) {// throw new BgaUserException(self::_("No more discs in your supply. You should be able to solve the case!"));// }
// Get a disc to put on the tile.
// $newtokens = ...
// First we check if there is already a dics at that *location*,// i.e. on an investigator tile. If so, we take it from there. Else// from our supply.$discs = $this->tokens->getTokensOfTypeInLocation("disc_{$color}_%", $agent_area);if (count($discs)) {$disc = array_shift($discs);} else {$disc = $this->tokens->getTokenOnTop("discs_{$player_id}");}if (!$disc) {throw new BgaUserException(self::_("No more discs in your supply. You should be able to solve the case!"));}
// TODO: place token in DB and via Notif
// First check if there is already a cube at that *location*, i.e.// on an investigator tile. If so, we take it from there. Else from// our supply.$cubes = $this->tokens->getTokensOfTypeInLocation("cube_{$color}_%", $agent_area);if (count($cubes)) {$cube = array_shift($cubes);} else {$cube = $this->tokens->getTokenOnTop("cubes_{$player_id}");}if (!$cube) {throw new BgaUserException(self::_("No more cubes in your supply!"));}// Put card on discard$this->cards->insertCardOnExtremePosition($card_id, "discard", true);
));// Put card on discard$this->cards->insertCardOnExtremePosition($card_id, "discard", true);
));// Move token$this->tokens->moveToken($cube['key'], $target_id);self::notifyAllPlayers('placeToken', '',array('token' => $cube,'target_id' => $target_id,));
this.placeTokens(this.gamedatas.tokens);
// Sort tokens: investigators need to be placed before cubes/discs.var tokens = this.gamedatas.tokens;tokens.sort(function (a, b) { return b.key.startsWith('pi_') - a.key.startsWith('pi_') });this.placeTokens(tokens);
dojo.place(html, target_id);
// Cubes/discs for 'agentarea_X' actually go onto the corresponding investigator there.if ((ttype == 'cube' || ttype == 'disc') && target_id.startsWith('agentarea')) {console.log(token, target_id);target_id = dojo.query('#' + target_id + ' .investigator_' + color)[0].id;}if (!$(key)) {var html;if (ttype == 'cube') {var html = '<div id="' + key + '" class="cube20 cube20_' + color + '"></div>';} else if (ttype == 'disc') {var html = '<div id="' + key + '" class="disc30 disc30_' + color + '"></div>';} else {var html = '<div id="' + key + '" class="investigator investigator_' + color + '"></div>';}dojo.place(html, target_id);} else {this.slideToObject(key, target_id).play();}
<!-- <div class="disc" style="top:230px; left:150px"></div><div class="disc red" style="top:100px; left:500px"></div><div class="disc blue" style="top:150px; left:500px"></div><div class="disc green" style="top:200px; left:500px"></div><div class="disc purple" style="top:340px; left:440px"></div><div class="disc yellow" style="top:240px; left:223px"></div><div class="disc yellow" style="top:230px; left:223px"></div><div class="disc yellow" style="top:220px; left:223px"></div><div class="cube" style="top:330px; left:150px"></div><div class="cube red" style="top:200px; left:500px"></div><div class="cube blue" style="top:250px; left:500px"></div><div class="cube green" style="top:300px; left:500px"></div><div class="cube purple" style="top:400px; left:166px"></div><div class="cube yellow" style="top:300px; left:200px"></div><div class="cube yellow" style="top:250px; left:251px"></div><div class="cube yellow" style="top:240px; left:251px"></div><div class="investigator" style="background: red; top:218px; left:160px"></div><div class="investigator" style="background: #fe0; top:218px; left:220px"></div><div class="investigator" style="background: lime; top:218px; left:280px"></div><div class="investigator" style="background: magenta; top:218px; left:340px"></div><div class="investigator" style="background: blue; top:218px; left:400px"></div><div class="loc_tokens loc_forestpark" style=""><div class="investigator" style="background: #fe0;"></div><div class="investigator" style="background: magenta;"></div><div class="investigator" style="background: red;"></div><div class="investigator" style="background: lime;"></div><div class="investigator" style="background: blue;"></div></div><div class="loc_tokens loc_chinatown" style=""><div class="investigator" style="background: red;"></div><div class="investigator" style="background: blue;"></div></div><div class="loc_tokens loc_trocadero" style=""><div class="investigator" style="background: red;"></div><div class="investigator" style="background: blue;"></div></div> -->