GithubHelp home page GithubHelp logo

ronelm2000 / wsmtools Goto Github PK

View Code? Open in Web Editor NEW
23.0 4.0 4.0 768 KB

Weiss Schwarz Montage Tools (including parsing and exporting)

License: GNU General Public License v3.0

C# 99.45% HTML 0.55%
encore-decks parsing card game weiss-schwarz decklog

wsmtools's People

Contributors

ianzzz94 avatar longagofaraway avatar ronelm2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wsmtools's Issues

Card Queries

You can search for cards using your local card database.

  • By Serial
  • By Name
  • By Trait
  • By Level
  • By Cost
  • By Card Effect

Can't Export Decks

I currently cannot export decks from encore due to the error in the image attached. It was working for several days prior to the incident.
2020-08-06 15_01_47-Select Windows PowerShell

MSE2 Parser

Since .mse-set files use YAML, it should be possible to parse the set from it, but the user will likely need to specify a local repository of images.

To avoid conflicts with real cards, a new serial standard shall be introduced specifically for custom sets. Serials do not actually exist on the Weiss MSE sets, so serials shall be automatically generated as per the algorithm in the original plugins (which should already be the same).

[ABCDabcd]/[W]C[ZZZ]-001
[ABCDabcd] is the Neo-Standard Code. Unless specified, typical Weiss Schwarz rules for Neo-Standard apply.

[W] is the Side. This may be divided into Weiss [W], Schwarz [S], or Both [WS]. Custom "Sides" are not allowed.

[ZZZ] is the Custom Set's Full ID. This may consist of a value from 0-9, a-z, and A-Z. This adds up to 238,328‬ potential unique sets per side.

If the Full ID starts with [E], it must mean that it is an Extra Booster.

Planned Supported MSE2 Plugins

Deck Log Image and Card Information Post-Processor

I've analyzed the API powering Bushiroad's DeckLog application and it should be possible to get image URL data from it.

This can be done using: POST https://decklog.bushiroad.com/system/app/api/search/2 (2 very likely refers to the Game ID Weiss Schwarz)

This request accepts application/json of the following format:

{"param":{"title_number":"","keyword":"GF/W33-001","keyword_type":["no"],"side":"","card_kind":"0","level_s":"","level_e":"","power_s":"","power_e":"","color":"0","soul_s":"","soul_e":"","cost_s":"","cost_e":"","trigger":"","option_counter":false,"option_clock":false,"deck_param1":"S","deck_param2":""},"page":1}

This will output the following JSON.

[{"id":4970,"card_number":"GF\/W33-001","num":0,"card_kind":2,"name":"\u7d20\u9854\u306e\u79c1\u3092 \u6afb\u4e95\u660e\u97f3","rare":"RR+","img":"g\/gf_w33\/gf_w33_001.png","width":400,"height":559,"direction":0,"sub":"","p_param":{"p1":"","p2":"","p3":"","p4":"","p5":"","p6":"","p7":"","p8":"","p9":"","p10":""},"max":4,"g_param":{"g0":0,"g1":1,"g2":0,"g3":0,"g4":1,"g5":0,"g6":0,"g7":0,"g8":0,"g9":0}}]

The "img" string shall refer to a subdirectory within the following URL (which may be subject to change): https://s3-ap-northeast-1.amazonaws.com/static.ws-tcg.com/wordpress/wp-content/cardimages/

Thus the URL of the serial GF/W33-001 refers to the following image: https://s3-ap-northeast-1.amazonaws.com/static.ws-tcg.com/wordpress/wp-content/cardimages/g/gf_w33/gf_w33_001.png

GF/W33-001

This Post-Processor should not be able to accept English cards.
This Post-Processor must first get image data via Release ID. Only use a single-card search when necessary. In such a case, the request body should be this.

{"param":{"title_number":"##GF##","keyword":"","keyword_type":["name","text","no","feature"],"side":"","card_kind":"0","level_s":"","level_e":"","power_s":"","power_e":"","color":"0","soul_s":"","soul_e":"","cost_s":"","cost_e":"","trigger":"","option_counter":false,"option_clock":false,"deck_param1":"S","deck_param2":""},"page":1}

When using Title Code/Neo-Standard Code search, the page variable in the JSON must increment by 1 until the resulting JSON becomes []. This is how all card data for that Title Code/Neo-Standard Code shall be obtained.

Add Card Versioning

Add a migration version to each card. This should allow me as developer to delete/modify broken cards each time there's an update, and especially prevalent during major changes that require card data revisions.

Basically, each time a user parses a set, it adds a timestamp of the wsmtools version.
After this change, all cards will be timestamped for v0.6.1.

Implement IProgress and Cancellation in APIs

IProgress and CancellationToken should be implemented in all Task APIs where it's possible.

This will allow future Service API to insert its own implementation and also provide an implementation for cancellation if needed, like say, for a browser extension, or a GUI.

For the old use cases (that is, for implementations that do not need IProgress and CancellationToken), an interface extension (or default implementation) method shall be provided.

Add `pipe` or `stdin` as a valid Source URL for `./wstools export`

Allows wsmtools to accept input from pipe/stdin. Currently, the only parser the should require this input should be Deck JSON Deck Parser.

Sample Usage:

# This command will get Deck Data from EncoreDecks, replace base rarity cards with my foil cards, then export to TTS.
./wstools merge https://www.encoredecks.com/deck/UFo2ADuKC ./path/to/my_foil_cards.json | ./wstools export pipe --with upscaling,sendtcp --exporter tts --out sharex

Manual Input

Users should be able to enter translations and new card details manually. This can be done via a new parser which will take in an input file.

The input file shall be in JSON. This allows inputs to be easier to define and do not scale vertically as they can introduce problems when editing manually.

This needs to be well defined before work on it can be started.

Add `./wstools merge`

Adds a merge command to wsmtools.

This command merges two decks into 1 deck; overwriting copies of the source_url to copies of the source2_url cards, if any. The only output is Deck JSON stdout (as there is no destination output).

Format:

./wstools merge source_url source2_url [--with optional,flag,strings]

Sample Command:

# This command will get Deck Data from EncoreDecks and replace base rarity cards with my foil cards.
./wstools merge https://www.encoredecks.com/deck/UFo2ADuKC ./my_foil_cards.json

How to fix this error

Error:
An assembly specified in the application dependencies manifest (wstools.deps.json) was not found:
package: 'Microsoft.DotNet.PlatformAbstractions', version: '3.1.6'
path: 'lib/netstandard2.0/Microsoft.DotNet.PlatformAbstractions.dll'

Cockatrice export

Good day,

I am attempting to export a deck from Cockatrice to use in TTS. The XML file that is being used is the community one for all cards. I have parsed the 2 sets that are required for this deck and I am now getting the below error for the export.

Thanks,
Chris

image

New serie with Decklog

Hello, I got this error with an empty cards.db.

PS E:\wsmtools> ./wstools export https://decklog.bushiroad.com/view/FHL4 --with sendtcp,upscaling --out sharex
[17:45:27 INF] [] Starting...
[17:45:28 INF] [] The latest version is: "0.6.0"
[17:45:28 INF] [] The latest version on repository: "v0.6.0"
[17:45:28 INF] [Montage.Weiss.Tools.CLI.ExportVerb] Running...
[17:45:32 INF] [Montage.Weiss.Tools.Impls.Parsers.Deck.DeckLogParser] Parsing ID: "FHL4"
Unhandled exception. Montage.Weiss.Tools.Entities.Exceptions.DeckParsingException: The following serials are missing from the DB:
SBY/W64-026
SBY/W64-032
SBY/W64-052
SBY/W64-057
SBY/W64-078S
SBY/W77-044
SBY/W64-070
SBY/W64-096
SBY/W64-030
SBY/W77-055
SBY/W64-056
SBY/W64-094
SBY/W64-P02
SBY/W64-014
SBY/W64-029
SBY/W64-028
SBY/W64-035
SBY/W64-058
SBY/W77-050
SBY/W64-092
SBY/W64-084
SBY/W64-076
SBY/W77-076
SBY/W77-046
SBY/W64-097
SBY/W64-074
SBY/W64-075
   at Montage.Weiss.Tools.Impls.Parsers.Deck.DeckLogParser.Parse(String sourceUrlOrFile)
   at Montage.Weiss.Tools.CLI.ExportVerb.Run(IContainer ioc)
   at Montage.Weiss.Tools.Program.<>c__DisplayClass0_0.<<Main>b__2>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Montage.Weiss.Tools.Program.Main(String[] args)
   at Montage.Weiss.Tools.Program.<Main>(String[] args)

And if I get informations from encoredeck, images do not load it retry "infinitely".

Application to Execute does not Exist

I am unable to export on v.0.4.0. I receive an error which states that the application at 'C:\Users\Name\AppData\Local\Temp.net\wstools\vof4n0tx.fio\wstools.dll' does not exist.

Unifying wsmtools and r4utools APIs

Because the common APIs and services used for wsmtools are slowly becoming out of sync with r4utools, a new common API library is required to sync both projects' API together.

This needs to be done so that any changes for wsmtools in regards to common APIs are also properly reflected on r4utools and thus it would be easier to synchronize any functionality common between the two.

  • Decouple services and interfaces
  • Add a new project for wsmtools
  • Synchronize the new project for r4utools
  • Add API changes from r4utools to wsmtools and update wsmtools appropriately.

GochiUsa DMS (W57) Using SEC Images

Due to how YYT Image Post-Processor currently works, the captured image links for several cards use SEC foil images instead of its RR (or R) rarities.

The current workaround is to cache the entire DMS set (using ./wstools cache W57 jp) and replace all SEC images.

Image Ratio is Incorrect

As reported by Warliet via Discord, export is not working as expected.

Command used: wstools.exe export https://www.encoredecks.com/deck/gO_JKfCsm
Replacement Image URL used: https://images.littleakiba.com/tcg/card4487-large.jpg
image

recurring error

Hello,
I have a problem with the program
image

I manage to remove it by deleting the temporary file

just i tried to look at the code when i open the .sln i have an error
image

To explain I downloaded the file as is and unable to open it there is a link statement which must be problematic

Send Directly to TTS

An enhancement to use a flag --with sendtcp with TabletopSimulatorExporter. If this flag is enabled, wsmtools will send the Deck Generator JSON over directly into Tabletop Simulator. This would stop the need to put the Deck Generator JSON into the specified Saved Objects folder.

Don't Have Parenthesis in Deck Image Formats

As an aside, decks with parentheses in the title seem to trip up the program because in tts it throws unsupported image format (*.jpg...). It doesn't seem like a big deal though because I renamed the deck to remove parentheses and it works.
Originally posted by @namtsui in #58 (comment)

Add Support for Expression Trees

Part of a long term goal for completely replacing HOTC as a codestyle. The idea is to be able to parse any card text (from any card style or any language for that matter), convert it into an Expression Tree.

Using this expression tree allows various functions, from being able to serialize it into another language entirely (using any type of card effect style), or use the data to create card scripts (like that for BlakeWS)

[Sample Format]

    // [CONT] Assist All of your characters in front of this card gets +500 power.
    // [C] ASSIST All your Characters in front of this gain +500 Power. 
    private static WSExpressionTree GetSample()
    {
        return new WSExpressionTree()
        {
            ExpressionType = WSExpressionType.Continous,
            Labels = new[] { WSLabel.Assist },
            Condition = null,
            Effect = new WSGainATKEffect()
            {
                ATK = +500,
                Target = WSZone.YourStage with {
                    Condition = WSCondition.InFrontOf(WSTarget.ThisCard)
                }
            }
        };
    }

Unhandled exception. System.InvalidOperationException

Hi,

im trying to export a few Decks and run into an Issue with Decks, that use multiple Sets like Hololive or Sword Art Online.
I use a standard wsttols export [URL] for the export

When I try to export the following Deck https://decklog-en.bushiroad.com/view/J8HV for example i get the following Error Message:

Unhandled exception. System.InvalidOperationException: The instance of entity type 'WeissSchwarzTrait' cannot be tracked because another instance with the same key value for {'TraitID', 'Serial'} is already being tracked. When replacing owned entities, modify the properties without changing the instance or detach the previous owned entity entry first. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values.

The second Deck https://www.encoredecks.com/deck/9HkcdZrjq is getting an
Unhandled exception. System.ArgumentException: An item with the same key has already been added. Key: sao/s80-e004sp
Error.

Can you point me on how to export these two successfully please or what seems to be the Issue ?
Thanks

Add `./wstools update`

[Format]
./wstools update rid1;rid2;rid3 postprocessoralias1;postprocessoralias2

This command allows you to update cards that already exist in your ./cards.db using already existing card post-processors.
This will not skip the compatibility phase for post-processing, but will skip flag checks for skipping (or not skipping) typically employed in ./wstools parse url, like that used in yuyutei.

[Use Case]
Update YYT pricing by making it possible to schedule a job every day where YYT pricing data will always be obtained to allow price trend tracking.

New Image Source for WS EN cards

Due to a recent announcement by JKTCG announcing its closure, this application will need to find a new image sources for Weiss Schawarz English cards. Any insight is welcome!

Image Low quality

The quality of the image exported is extremely low to the point even the power is almost unreadable.
deck_mirimu

the tool doesn't start

when ever I start the powershell in the folder it just sits there doing nothing. the tool doesn't start and doesn't export or create the files needed
wstools issue

HOTC-Style Card Set Parser

Allow certain .txt files to be parsed using a format typically reserved for HOTC text.
You must explictly tell the parser that the file to be parsed is HOTC format.

Example:
./wstools parse path/to/file.txt --with hotc

file.txt format:

Random Text Information May Be Inserted Here.
For example, you can put some author notes or links to your discord server
as ads or something.
================================================================================

Interesting Titles Participating!
気になるタイトル続々参戦!
Card No.: CGS/WS01-P01  Rarity: PR
Color: Blue   Side: Weiss  Climax
Level: 0   Cost: 0   Power: 0   Soul: 0
Traits: None
Triggers: 2 Soul 
Flavor: Hey, you should Weiss Schwarz too!
TEXT: [A] When this is placed from hand to the Climax Zone, remove all cards in
your Library and Waiting Room from the game, and use a new deck with a
different sleeve as that Library as Library, and continue the game. For the
rest of the game, whenever a card from the old deck would be placed in the
Waiting Room, instead remove it from the game.
*This card cannot be used in official and sanctioned tournaments.

================================================================================

Shiyoko, Shiro-Kuro Fes 2016
しろくろフェス2016 しよ子
Card No.: CGS/WS01-P02  Rarity: PR
Color: Blue   Side: Weiss  Character
Level: 0   Cost: 0   Power: 2000   Soul: 1
Traits: カードゲーム (Card Game), 和服 (Yukata)
Triggers: None
Flavor: Let's...... Let's...... Let's......
TEXT: [C] If there are no other Characters in your Front Row, this gains +1500
Power.
[A] At the start of your Opponent's Attack Phase, you may move this to an empty
Front Row Center Slot.

================================================================================

HOTC-style input should be fine I guess. It shouldn't be too difficult for that parser to accept a file. I still like the idea for HOTC file parser tho, so I will include that as a separate card.

Originally posted by @ronelm2000 in #1 (comment)

Microsoft.DotNet.PlatformAbstractions

Started getting this error the other day, unsure what could be done to solve it
Error:
An assembly specified in the application dependencies manifest (wstools.deps.json) was not found:
package: 'Microsoft.DotNet.PlatformAbstractions', version: '3.1.3'
path: 'lib/netstandard2.0/Microsoft.DotNet.PlatformAbstractions.dll'

wstools does not generate any files

Hello!
I tried to import an english deck from encoredecks with the help of IanTCGs instructions. Powershell seemed to download the image files and card text, but then seemed to fail to safe it to the export folder. I'm unsure if it is a mistake on my part or if the program is doing something funny, since I don't know anything about coding. You'll find the code in the text file.
Code_WS_Export.txt

Wrong suggested lines

May you fix the suggestions for adding the Promos, since you add translations via "parse" instead of "export".

Update to C# 10.0 and .NET 6 (and 11.0)

The purpose for doing this is to keep the source well-maintained, as well as perform any necessary refactoring due to this change. This includes:

  • Providing GlobalUsings.cs to the API libraries to reduce clutter.
  • Adding guard clauses to some common services.
  • Check for the usage of ReadOnlySpan in the Cursor reader in HOTC parser for possible improvements.
  • Usage of record types where possible.
  • Usage of pattern matching enhancements where possible: if (c is (>= 0 and < 10))

Cannot Export HOTC Page

I'm also experiencing the same error text, but specifically when attempting to export hotc translation pages (decks never cause this).

Originally posted by @MoeGuitarist in #35 (comment)

Can you post the command you used for this?

Option to forcefully maintain high resolution images

Currently, some multi-release sets (ie. Little Busters) will create a full grid of 2600x1850 due to a slightly smaller resolution for older sets. This creates difficult to read images of otherwise legible original images. Suggesting a flag to forcefully maintain full grid resolution and scale up images to match the grid, as opposed to scaling down images to match a smaller grid.

English Prillya not exporting

It seems that the English Prillya set is not being suffixed with EN in Encore decks and keeps being unable to find images. When I try to use images from either the Encore decks or WS-TCG site they keep complaining about ratio being wrong.

Image Ratio isn't correct

image

One of the image doesn't show up and when I try to add it via link (from Encoredecks and Littleakiba, I tried both) it says image ratio isn't correct. Did I do something wrong? Thank you!

404 Error when Parsing with DeckLog images

The prefix for the URL for DeckLog images was changed, hence why images are not currently working as intended for DeckLog images.

See #21 for the original format, and the new format is now:

https://ws-tcg.com/wordpress/wp-content/images/cardlist/b/bfr_s78/bfr_s78_t01.png

is it possible to get card data to a local json file?

hi,

I'm building a suite of tools and I'm looking to find a good way to automate getting EN card data. I've tried building my own scraper, but it looks like there's one here that works. I just can't seem to figure out the documentation on how I could use it for things that aren't deck exports.

my goal: call ./wstools --card-id=5HY/W83-E001 --json=cache/5HY_W83_E001.json and get a json file with all of the relevant card information

(I already plan to handle other aspects of the pipeline)

let me know if this is possible and I just missed it!

Add `./wstools fetch`

Add the following:

[Format]
./wstools fetch [rids_or_card_serial_in_commas] [--with flags]

[Example]
./wstools fetch W95 --with noskip:yyt

This is an easier way to automatically fetch data using default settings when you only have an RID or Card Serial..

The current implementation will be to fetch sets of cards via EncoreDecks API and running parse commands based on the data. Providing no RID or card serial will attempt to fetch all cards in the game, with visible warning requiring you to prompt yes, unless you use the following flag --with nowarn.

This will fetch both the JP and EN versions of the RID, when applicable.

It must be reiterated that fetching all cards in the game may cause certain sites (like yuyutei or DeckLog) to ban you as a bot, and is thus not recommended.

linux artifacts in image output

Hi,
I'm on guixsd linux and get these artifacts in the output (see the end of this post).

https://github.com/namtsui/imagedump/blob/main/deck_ddm_12events_gate_pants_.jpg

First, I tried running the linux release and got a similar result. Then, I tried using mono to build from source (as in .github/workflows/nightly.yml). Both yielded the same results.

$ ldd wstools
        linux-vdso.so.1 (0x00007ffea5733000)
        libpthread.so.0 => /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libpthread.so.0 (0x00007f6dfd827000)
        libdl.so.2 => /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libdl.so.2 (0x00007f6dfd822000)
        libstdc++.so.6 => /gnu/store/6d0pl5khj08j3c2619jnypc8bznspgx8-gcc-10.3.0-lib/lib/libstdc++.so.6 (0x00007f6dfd64d000)
        libm.so.6 => /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libm.so.6 (0x00007f6dfd50c000)
        libgcc_s.so.1 => /gnu/store/6d0pl5khj08j3c2619jnypc8bznspgx8-gcc-10.3.0-lib/lib/libgcc_s.so.1 (0x00007f6dfd4f2000)
        libc.so.6 => /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/libc.so.6 (0x00007f6dfd32e000)
        /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/ld-linux-x86-64.so.2 (0x00007f6dfd870000)
namtsui@antelope ~/workspace/wsmtools_code/wsmtools/MontageWeissTools/bin/Release/net6.0$ file wstools
wstools: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/ld-linux-x86-64.so.2, BuildID[sha1]=38f32dad6bd760faf250dafce41a819685ce9c84, for GNU/Linux 2.6.32, stripped

To build I used:

dotnet restore
dotnet build --configuration Release --no-restore

Then, I ran the binary from wsmtools/MontageWeissTools/bin/Release/net6.0
$ ./wstools export https://www.encoredecks.com/deck/G17icr9vk

Finally, logs follow. When building a DDM deck (https://www.encoredecks.com/deck/G17icr9yk) it gets the image with artifacts (https://github.com/namtsui/imagedump/blob/main/deck_ddm_12events_gate_pants_.jpg). When trying to build a DAL deck (https://www.encoredecks.com/deck/BhJy3HOn4) it exposes a crash with image 10 in zlib.

log_dal.txt
log_ddm.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.