Skip to content

Commit

Permalink
Update default URL to something that will actually work.
Browse files Browse the repository at this point in the history
Fix Y position of token stacks.
Fix infinite loop in clearChips (empty array is false in a Boolean context in Python, but true in JS).
  • Loading branch information
manveti committed Apr 8, 2015
1 parent aa8e7f6 commit 0c5bbc8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions DiceInTheVineyard/ditv.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var DitV = DitV || {
DEFAULT_URLS: {
//1: "https://s3.amazonaws.com/files.d20.io/images/USER_ID/SOME_RANDOM_CHARACTERS/thumb.png"
},
GENERIC_URL: "http://pokerproppers.com/assets/poker-2.png",
GENERIC_URL: "https://s3.amazonaws.com/files.d20.io/images/8713360/xSx7ppXB9KD2hIvGf64TaQ/thumb.png?1428459149",


init: function(){
Expand Down Expand Up @@ -67,7 +67,7 @@ var DitV = DitV || {
clearChips: function(name){
if (!state.DitV.characters[name]){ return "Character '" + name + "' not registered."; }
for (var value in state.DitV.characters[name]['chips']){
while (state.DitV.characters[name]['chips'][value]){
while ((state.DitV.characters[name]['chips'][value]) && (state.DitV.characters[name]['chips'][value].length > 0)){
var token = getObj("graphic", state.DitV.characters[name]['chips'][value].pop());
if (token){ token.remove(); }
}
Expand All @@ -82,7 +82,7 @@ var DitV = DitV || {
var character = state.DitV.characters[name];
var pos = value - 1 + DitV.CHIP_START; // position in wrapped list of 1x2 stacks (CHIP_START is the offset past the reserved top-left area)
var x = (pos % DitV.BOX_WIDTH) + character['x'];
var y = Math.floor(pos / DitV.BOX_WIDTH) + character['y'];
var y = Math.floor(pos / DitV.BOX_WIDTH) * 2 + character['y'] + 1;
// translate from squares to pixels, and adjust for the fact that Roll20 uses center instead of top-left for position
x = (x * DitV.GRID_SIZE) + (DitV.GRID_SIZE / 2);
y = (y * DitV.GRID_SIZE) + (DitV.GRID_SIZE / 2);
Expand Down

0 comments on commit 0c5bbc8

Please sign in to comment.