[Mod] King's Courtier (Chrome Plugin)

Previous topic - Next topic

Icehawk78

This is still very much a work in progress, but it was suggested that I post this here, since the other two mods are also here.

King's Courtier is a Chrome Plugin that adds some extra functionality to the Shuffle iT site. Currently there are only two features, but more are in progress:


  • Kingdom Text View - This replaces all cards' images in the kingdom with their associated card text.
  • Repeat Kingdom Button - This adds a "Repeat Kingdom" button to the end of game scoring screen, which when clicked will set every card in the kingdom just played as a required card.

Download from here:  https://github.com/Icehawk78/kings_courtier/releases

Configuration:

I'm working on a screen that will let you change which options are active, but in the meantime, you can change the options by opening your Javascript Console (on Windows, ctrl-shift-j) and running this:

Turn off the text-view kingdom:
KC.update_preference('kingdom_text', false);

Turn off the repeat kingdom button:
KC.update_preference('show_repeat', false);

Icehawk78

Finally getting around to updating this post.

I now have the full Kingdom viewer working, which also now allows for naming of cards that are not in visible piles, including split pile cards, individual knights, shelters, and ruins.

Installation instructions:

This can be installed via the Chrome Web Store at King's Courtier or by downloading it directly from Github.

To open the Kingdom viewer, simply click the "Kingdom" button on the left.



You will then be presented with this screen:



Some notes:


  • The black market deck will not be a secret if you use this. I've looked into it, and unfortunately the only way for me at this time to hide the black market contents would unfortunately also risk leaking which cards are in your opponent's hand, due to the way the client model is structured.
  • Any input that is waiting on you will be obscured by the card list. I can look into changing this later, but for now, make sure you close it when not actively watching so you know when it's your turn.
  • When you play a "name any card" effect card, opening the Kingdom view will allow you to select all cards. (If this doesn't work, please let me know so I can update it.)

yed

I thought you don't have access to oponent hand client side. Same with Black Market, client don't need it so why is it possible to find by the extension?

Icehawk78

Quote from: yed on 31 January 2017, 01:06:48 PM
I thought you don't have access to oponent hand client side. Same with Black Market, client don't need it so why is it possible to find by the extension?

Ironically, the issue is that in the client, the opponent's hand and the BM deck are the only two card piles which you *don't* have access to. This includes both players' deck and discard piles, provided a single shuffle has occurred.

As a result, for certain cards such as castles, knights, or anything bought from the Black Market, if I hid cards which I couldn't find in any public pile, which is currently the only way for me to positively identify whether a card is in the Black Market pile or not, then they would disappear from the Kingdom view when your opponent drew them into their hand.

allanfieldhouse

Quote from: Icehawk78 on 31 January 2017, 03:29:21 PM
Quote from: yed on 31 January 2017, 01:06:48 PM
I thought you don't have access to oponent hand client side. Same with Black Market, client don't need it so why is it possible to find by the extension?

Ironically, the issue is that in the client, the opponent's hand and the BM deck are the only two card piles which you *don't* have access to. This includes both players' deck and discard piles, provided a single shuffle has occurred.

So the issue is that you don't have access to the PILE, but you still know the list of cards in the GAME, right? I think his question was more, "how do you even know what's in the BM deck?"

Icehawk78

Quote from: allanfieldhouse on 31 January 2017, 11:23:13 PMSo the issue is that you don't have access to the PILE, but you still know the list of cards in the GAME, right? I think his question was more, "how do you even know what's in the BM deck?"

Ah. Yes, that is exactly correct.

The client has a list of all of the different cards in the game, that I have access to and am using for building the screen, which includes the Black Market cards. The client also has a "black market pile" which does not contain a list of cards, just a count.

fett0001

Since we know what's been gained from BM/castles/etc. why not remove those cards from your display?

Icehawk78

Quote from: fett0001 on 01 February 2017, 03:16:32 AM
Since we know what's been gained from BM/castles/etc. why not remove those cards from your display?

The issue is that while you may know that from reading the log, there isn't a clear place I've been able to find that stores that information in the client model.

What I currently have to work with is the following:

Full card list of the game (this contains every card name that exists in this game)
List of "zones"


  • Each individual Supply Pile
  • Each individual Non-Supply Pile
  • The black market deck
  • Your Deck
  • Your Hand
  • Your Discard
  • Your In Play Area
  • Your Tavern Mat
  • Opponent's Deck
  • Opponent's Hand
  • Opponent's Discard
  • Opponent's In Play
  • Opponent's Tavern Mat
  • Probably others

Each of these zones contains a list of cards that they contain. However, some of those cards are literally just marked as "Card Back" (ie hidden from you/the client).

The issue is that if you look at the list above, the bold zones contain the actual names of the card contents. However, the italicized zones contain only a card count, with each card being listed as the generic "back".

As such, because I have only a full card list to start with, without being told what the contents of the black market deck are, I don't have a way of knowing whether a given card that is in the full card list but not visible in any of the other zones is "in the black market" or "in my opponent's hand". As such, if I simply didn't display any cards that I can't see in any given zone, then I might inadvertently reveal which cards are in your opponent's hand. Imagine a game being played with Knights, and I notice that "Dame Anna" is no longer visible in the kingdom view. It could be that that card is in the black market. However, it could also be in your hand.

As such, I judged that it was safer to not ever potentially reveal information about your opponent's hands, and instead to show the contents of the Black Market. If the client is updated to have the contents of the BM deck known, then I will remove it from my extension.

Martin plays Piano

Hi Icehawk,

has anybody told you, how great and helpful your features are? – many thx for your extensions, I really appreciate your service here.

Some thoughts for you to consider:
- the sort of the shown kingdom cards is the other way around than in the game
(yours starts top left with the cheapest card and ends bottom right with the most expensive one)
(in the game you know the cheapest is bottom left and ends up with the most expensive top right)
- Events and landmarks are currently not shown
- split cards are shown, but not as a corresponding couple – mostly the covered card is top left (like Avanto) and the Sauna card is somewhere
- perhaps you can reduce the size of your kingdom display to avoid the scrolling – so you can have 6 or 7 cards in one row and this will give the possibility to show even bigger kingdoms on one page then

And by the way, on a second computer I get the problem, that Chrome administrator blocks the installation of your plug-in, but I will figure it out somehow.

Icehawk78

Kingdom sort: This was an intentional decision because it's quite difficult to draw from the bottom left and go up, so it's unlikely to change.

Landscape cards will require me to update the rendering code, so while I might get to it eventually, it's not currently a high priority.

I agree with your assessment of split cards and am still currently trying to find a good way to display them. Unfortunately, I don't currently know of a way to tie them together, but I'm looking into it.

Changing the size of the kingdom is definitely doable and will likely be a configuration option in the next version.

Thanks for your feedback!

fett0001

Knights can't be both in the kingdom and in the BM deck. Unless there's something strange about the implementation.

Icehawk78

Quote from: fett0001 on 02 February 2017, 02:54:47 AM
Knights can't be both in the kingdom and in the BM deck. Unless there's something strange about the implementation.

True, but the issue is still that for any other card in the BM deck, I don't have a way of knowing whether it's not been bought or is just in an opponent's hand.

I would also not be terribly surprised if the same code that would hide the BM deck might also hide the knights pile contents, as well.

SaintO

Is this plugin still operating with all of the version updates? Is Shuffle IT simply incorporating the functionality into the native web app? Is the mod still being updated?

Gasku

Sadly it is. Hope it gets updated, or SuffleiT puts the option in the game. Seriously, how hard would it be?

jgriffith91786

How did you get access to the client? I wanted to try creating a extension that would capture the game log when the game ends each time. I think I need a access to the game code to work out the execution. Any advice would be helpful!