fix displaying of stats in non-full tables
This commit is contained in:
parent
23c26422e6
commit
19fa4454a1
1 changed files with 9 additions and 20 deletions
|
@ -1,6 +1,6 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name onlinetichu.com card counter
|
// @name onlinetichu.com card counter
|
||||||
// @version 1.3.0
|
// @version 1.3.1
|
||||||
// @description automatically count cards at onlinetichu.com
|
// @description automatically count cards at onlinetichu.com
|
||||||
// @match *://*.onlinetichu.com/Site/Game/Table/*
|
// @match *://*.onlinetichu.com/Site/Game/Table/*
|
||||||
// @author Maximilian Keßler
|
// @author Maximilian Keßler
|
||||||
|
@ -632,9 +632,11 @@ function injectCounter() {
|
||||||
// reset player names as they might have changed
|
// reset player names as they might have changed
|
||||||
otc.playerNames = {};
|
otc.playerNames = {};
|
||||||
|
|
||||||
|
southPosition = 1;
|
||||||
$(message.Table.Players).each(function () {
|
$(message.Table.Players).each(function () {
|
||||||
if (this.Username == ot.$Username.val()) {
|
if (this.Username == ot.$Username.val()) {
|
||||||
spectator = false;
|
spectator = false;
|
||||||
|
southPosition = this.Position;
|
||||||
// console.log('found player');
|
// console.log('found player');
|
||||||
if (message.Table.Turn == this.Position) {
|
if (message.Table.Turn == this.Position) {
|
||||||
// console.log('my turn!');
|
// console.log('my turn!');
|
||||||
|
@ -651,30 +653,17 @@ function injectCounter() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('position of iterated player is: ' + this.Position)
|
|
||||||
if (ot.eastPlayer != null && ot.eastPlayer == this.Position) {
|
|
||||||
otc.playerNames['east'] = this.Username;
|
|
||||||
console.log('found east player');
|
|
||||||
}
|
|
||||||
if (ot.southPlayer != null && ot.southPlayer == this.Position) {
|
|
||||||
otc.playerNames['south'] = this.Username;
|
|
||||||
}
|
|
||||||
if (ot.westPlayer != null && ot.westPlayer == this.Position) {
|
|
||||||
otc.playerNames['west'] = this.Username;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get stats of player if we don't have them yet)
|
// get stats of player if we don't have them yet)
|
||||||
if (otc.stats[this.Username] === undefined) {
|
if (otc.stats[this.Username] === undefined) {
|
||||||
otc.util.getStats(this.Username);
|
otc.util.getStats(this.Username);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// store usernames of players for display of stats
|
$(message.Table.Players).each(function () {
|
||||||
if (spectator) {
|
dirs = ['south', 'east', 'north', 'west'];
|
||||||
otc.playerNames['south'] = message.Table.Players[0].Username;
|
index = (this.Position - southPosition + 4) % 4;
|
||||||
} else {
|
otc.playerNames[dirs[index]] = this.Username;
|
||||||
otc.playerNames['south'] = ot.$Username.val();
|
});
|
||||||
}
|
|
||||||
|
|
||||||
otc.action.updateDisplayStats();
|
otc.action.updateDisplayStats();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue