Skip to content
Permalink
Browse files

Merge pull request #299 from lusbenjamin/sparky-name

Recognize Opponent Named "Sparky"
  • Loading branch information...
Manuel-777 committed Apr 30, 2019
2 parents e428487 + aff41de commit ed88b1d8ecfa9fd799e8446563dbb0144362d8e2
Showing with 17 additions and 5 deletions.
  1. +5 −1 window_background/background.js
  2. +12 −4 window_overlay/overlay.js
@@ -1452,7 +1452,11 @@ function getNameBySeat(seat) {
if (seat == currentMatch.player.seat) {
return playerData.name.slice(0, -6);
} else {
return currentMatch.opponent.name.slice(0, -6);
let oppName = currentMatch.opponent.name;
if (oppName && oppName !== "Sparky") {
oppName = oppName.slice(0, -6);
}
return oppName || "Opponent";
}
} catch (e) {
return "???";
@@ -289,7 +289,11 @@ ipc.on("set_hover", function(event, arg) {

//
ipc.on("set_opponent", function(event, arg) {
oppName = arg.slice(0, -6);
let cleanName = arg;
if (cleanName && cleanName !== "Sparky") {
cleanName = cleanName.slice(0, -6);
}
oppName = cleanName || "Opponent";
recreateClock();
$(".top_username").html(oppName);
});
@@ -324,6 +328,12 @@ ipc.on("set_match", (event, arg) => {
});

function updateView() {
let cleanName = currentMatch && currentMatch.opponent && currentMatch.opponent.name;
if (cleanName && cleanName !== "Sparky") {
cleanName = cleanName.slice(0, -6);
}
oppName = cleanName || "Opponent";

if (overlayMode == 1) {
$(".overlay_draft_container").hide();
$(".overlay_deck_container").show();
@@ -399,9 +409,7 @@ function updateView() {
//
if (deckMode == 3) {
$('<div class="overlay_archetype"></div>').insertAfter(".overlay_deckname");
$(".overlay_deckname").html(
"Played by " + currentMatch.opponent.name.slice(0, -6)
);
$(".overlay_deckname").html("Played by " + oppName);
$(".overlay_archetype").html(currentMatch.oppCards.archetype);

currentMatch.oppCards.colors.get().forEach(color => {

0 comments on commit ed88b1d

Please sign in to comment.
You can’t perform that action at this time.