It is currently 19 Apr 2024, 02:11
   
Text Size

Manalink PlayDeck Sorter v0.1a

Continuing Development of MicroProse's Magic: The Gathering!

Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins

Manalink PlayDeck Sorter v0.1a

Postby CirothUngol » 21 Mar 2013, 07:16

Well, this took a couple of months longer than I expected. ^_^
Code: Select all
Manalink PlayDeck Sorter v0.1a
written in Liberty BASIC 4.04
for the CCGHQ Manalink Forums
by CirothUngol March 21, 2013
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------

The Manalink PlayDeck Sorter is a small utility that sorts PlayDeck.dck
files into the Manalink \PlayDeck\ folder. It allows you to find PlayDecks
either by searching for content (DeckName, Description, Comments, CardName,
CardQty, etc.) or by availability in a given Expansion or Expansions.

It also allows you to view newly-sorted PlayDecks, load the viewed PlayDeck
file into NotePad, or you can double-click it to automatically load it
into Manalink's DeckBuilder. The PDSorter can even run "Magic.exe" when you
exit... so you can go play with all those decks you just sorted!

How to start:
-------------
Copy the "PlayDeckSorter.exe" executable file in or near your Manalink
Installation Folder. It first searches the current folder and tree for
"Rarity.dat" (the only resource file it currently uses) to identify the
Program Folder. If not found, it will jump up one directory and search again.

When it identifies a new "Rarity.dat", it will create a "Rarity.pdv" file
containing Expansion Names and Card Expansion/Rarity info. It then creates
the small "PDLoader" executable if it doesn't already exist in the Manalink
Program Folder (see below). All of this can take a minute or two the first
time you run the app, but it should load rather quickly after that.

The folder structure:
---------------------
The PDSorter then looks in the \PlayDeck\ folder for its own \_PDSorter\
folder, creating it if needed. If the \_PDSorter\ folder is empty, all of
the decks in the \PlayDeck\ folder will be moved there, making the \PlayDeck\
folder ready for sorting. Likewise, if the \PlayDeck\ folder is empty when
you exit PDSorter, you will have the choice of returning all of the decks
in the \PDSorter\ folder back where they came from... just in case you change
your mind and want to play Random Duel with way too many PlayDecks again. ^_^

If there are PlayDecks in both the \PlayDeck\ and \_PDSorter\ folder when
running or exiting the app, then no PlayDecks are moved.

The PDSorter will also recursively search the \PlayDeck\ folder tree for
all "*.dck" files, and allow you to choose either the \_PDSorter\ folder
or all other folders as the PlayDeck source... but not both. A notice is
given if any duplicate FileNames are found, with an option to view a list
of duplicate DeckNames and their folders in a seperate window.

Where it looks for matches:
---------------------------
The PDSorter only searches for matching files from within SubFolders
contained inside of the \PlayDeck\ folder. It then copies any matching
files into the \PlayDeck\ folder for playing or viewing with DeckBuilder.
This is a one-way trip. The only time the app moves files from the main
\PlayDeck\ folder into a SubFolder is when it's first executed and the
\_PDSorter\ SubFolder is empty. Otherwise, it never copies FROM the
\PlayDeck\ folder, it always copies TO the \PlayDeck\ folder. This keeps
your DataBase of PlayDecks safe while allowing you to clear the \PlayDeck\
folder with impunity any time you'd like to change the mix of the decks
you're playing with.

"Use Expnsn" Button:
--------------------
The app opens on the "Expansion" page. You can select Expansions by double-
clicking them on the left-pane to move them to the right-pane. Click the
"Sort Decks" button to search for PlayDecks containg only cards from the
selected Expansions and copy them into the \PlayDecks\ folder.

"Use Search" Button:
--------------------
You can click the "Use Search" button to switch to the "Search" page. Here
you may search PlayDecks by any of the Header contents, as well as CardName
and/or CardQty. Use the "Any/All" button as a logical OR/AND. If "Match Any"
is selected, then PlayDecks are matched on any content from any of the
search fields. If "Match All" is selected, then PlayDecks are only matched
if they contain all of the content from all of the search fields. You can
search for multi-word strings by enclosing them in double-quotes. Click the
"Sort Decks" button to start the search. Any matching decks will be copied
into the \PlayDeck\ folder.

"View Decks" Button:
--------------------
This button is only active if there are currently PlayDecks sorted into
the \PlayDeck\ folder. Click it to switch to the "View" page. All sorted
PlayDecks are listed on the left-pane. Highlight a DeckName using either
the arrow keys or a single mouse click to view it on the right-pane.
Double-clicking the right pane will open the displayed PlayDeck with
NotePad. Double-clicking the DeckName on the left-pane will automatically
open the PlayDeck with Manalink's DeckBuilder.

"Clear Decks" Button:
---------------------
This button appears only when the "View" page is active. Click it to
remove all of the files from the \PlayDeck\ folder and start over. If
you clear the PlayDecks before exiting the app, then all of the decks
in the \_PDSorter\ folder will be returned to the \PlayDeck\ Folder.

"Truncate PlayDeck Names" CheckBox:
-----------------------------------
Manalink will load and use PlayDecks with names longer than 28 characters,
but DeckBuilder will not. If you'd like to view the sorted PlayDecks with
DeckBuilder, then you may select this CheckBox to automatically limit
the name of copied PlayDecks to 28 characters. If necessary, PDSorter will
automatically number and rename PlayDecks to prevent them from overwriting
each other due to the truncation.

"Run MAGIC.EXE on Exit" CheckBox:
---------------------------------
Just what it says. If selected, Manalink will run when you exit the app.

"Exact Match Only" CheckBox:
----------------------------
Only useful when using the "Search" page. If selected, PlayDecks must match
the search string exactly to be copied into the \PlayDeck\ folder.

"Use PDSorter Folder" CheckBox:
-------------------------------
If selected, then only the \_PDSorter\ SubFolder is searched for matches.
If not selected, then only SubFolders that aren't the \_PDSorter\ SubFolder
are searched for matches.

PDLoader.exe
------------
This is a tiny CommandLine app written in AutoIt 3. It's automatically
generated by PDSorter and must be located in the Manalink Program Folder
to operate correctly. It will automatically run DeckBuilder and load the
PlayDeck Name given as the first parameter. The DeckName must match exactly.
Double-quotes must be used if the DeckName contains any spaces.
It will also run "Magic.exe" if the first parameter is "Start_Magic".

So...
-----
Wanna play only Tempest Block?
How about anything up to Ice Age?
Modern... or Extended?
All of this info is available in "Rarity.dat". You can search your decks
for compatibility and they'll be copied directly to the \PlayDeck\ folder.

Wanna play nothing but Red?
How about only Black\Green decks?
All Artifact... or 5 Color?
If you've previously used the Manalink PlayDeck Analyser with "Rebuild Color
Decriptions" selected to scan your PlayDecks, then these searches are easy.

Acknowledgements:
-----------------
The Manalink PlayDeck Sorter was written using LibertyBASIC v4.04 and compiled
to executable using Liberty BASIC Booster v1.87.
The PlayDeck Loader was written in and compiled by AutoIt v3.3.8.1.

All thanx to Mok, without whom none of this would be possible.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Please download and try it out. Lemme know if it doesn't seem to work, doesn't search/match correctly, or just generally acts wonky. As always, you can extract the embedded files by calling it from the CommandLine with "ef" or "extractfiles" as the 1st parameter, and any suggestions for improvements, better search criteria and options, better GUI layout, extra gizmos, widgets, etc, are welcomed.

Edit: v0.1a added choice of returning PlayDecks when exiting, added line numbers to "Rarity.pdv", and centered the NoticeBox in the WindowFrame.
Attachments
PlayDeckSorter _v0.1a.zip
Manalink PlayDeck Sorter v0.1a
(539.42 KiB) Downloaded 309 times
Last edited by CirothUngol on 22 Mar 2013, 05:54, edited 2 times in total.
"I thought the day had brought enough horrors for our ragged band, but the night was far worse."
-Lucilde Fiksdotter


Shandalar 2012 Revisited
Magic: The Gathering Abandonware
User avatar
CirothUngol
Programmer
 
Posts: 431
Joined: 13 May 2009, 21:34
Location: Gulf Coast, Texas, USA
Has thanked: 106 times
Been thanked: 106 times

Re: Manalink PlayDeck Sorter v0.1

Postby stassy » 21 Mar 2013, 11:40

- The big main issue about strict expansion filtering is...substitute and reprint cards not added to the current coded list.
A typical example is Borderland Ranger replaced by Civic Wayfinder in Avacyn deck (it's not a strict replacement but a workaround since there are type difference).
By being too strict the Playdeck Sorter doesn't give lot of results because many decks (at least mine) have substitutes.

- The possibility to select several expansion with shift or ctrl in the lists would be nice (for example if I want a Inny selection I would need Dark Ascension and Avacyn, however some others are in the way and all three can't be selected at once)

- Another quit button without rolling back would be nice, maybe with a warning because with 2k+ decks it take a looooooooooooong time to exit the programs if no modifications were done

Still, it's another nice app to have in hand...when the big sorting will be done (I am currently at year 2009...4 years to go until it's done :oops: )

Edit: Another possibility that would be nice is to have custom expansion and to manually keep/remove some decks from a filter (for example the deck LAND.dck that fit any filter...because it's a test deck filled by basic land :D)
stassy
Moderator
 
Posts: 5274
Joined: 25 Feb 2009, 07:06
Has thanked: 471 times
Been thanked: 337 times

Re: Manalink PlayDeck Sorter v0.1

Postby CirothUngol » 22 Mar 2013, 05:05

stassy wrote:The big main issue about strict expansion filtering is...
Yea, I noticed that. However, I believe this is a problem that may eventually "fix itself". Most of the non-coded cards seem to be fairly simple cards that haven't been coded only because they are repeats, and therefore unnecessary. I'd like to think that someone will come along and code all of the skipped-over non-coded cards in the CSV. In the example you give, coding the card should be a simple matter of copy and paste, with a little editing... but that doesn't really help us today, now does it?

Let's see... take a look at the "Rarity.pdv" file that PDSorter produces. It contains expansion/rarity info for each card in the format: ExpColumn_Rarity. Column numbering starts with column "(B) Block" in the Manalink.csv. That would make Avacyn Restored #113. Just adding the string "113_C" to the Civic Wayfinder entry in "Rarity.pdv" will label the card as legal for that Expansion. PDSorter only reads "Rarity.dat", so it doesn't yet know CardNames and such.
How about if I number the lines in "Rarity.pdv" so Cards and Expansions can be easily identified and edited?

The possibility to select several expansion with shift or ctrl...
Yes, and I couldn't find an easy way to do that. It would have required using TextEditor controls instead on ListBox controls (at least in Liberty BASIC). This complicates the program, and comes with additional baggage I didn't want.
How about trying to add an option to see only tournament expansions (no special sets), or to group expansions by Block. That might be doable.

Another quit button without rolling back would be nice...
Yea, I didn't really think about that. I tested with a folder of over 5,000 PlayDecks (repeats), and it never took more than a few seconds... but my main computer is a real beast. Sorry 'bout that. I'll add a popup to allow the choice of returning PlayDecks.

Another possibility that would be nice is to have custom expansion...
This is easily doable, in principal. The last "Future Expansion" is #137. Adding "137_C" to any card's line will associate it with that expansion. What we'd need is an easy editor.

Great work you and nove have been doing with the PlayDecks!
I think the easiest way to eventually sort them is to add some sort of flag to the Comments. There's 398 characters of space, so any PlayDeck should have a few to spare. Then they can be sorted using PDSorter's "Search" page. If we come up with a standard, unified system of marking PlayDecks, then I could even add another page to PDSorter with options to select Theme, Tribal, Tournament, etc, and it already has enough info to do Pauper and Singleton. The next step beyond that is probably to read in "Cards.dat", then we could have access to any of the card attributes.

I've added the option of returning PlayDecks when exiting, added numbers to the "Rarity.pdv" file (so things are easier to identify), and updated the 1st post to v0.1a.
"I thought the day had brought enough horrors for our ragged band, but the night was far worse."
-Lucilde Fiksdotter


Shandalar 2012 Revisited
Magic: The Gathering Abandonware
User avatar
CirothUngol
Programmer
 
Posts: 431
Joined: 13 May 2009, 21:34
Location: Gulf Coast, Texas, USA
Has thanked: 106 times
Been thanked: 106 times

Re: Manalink PlayDeck Sorter v0.1a

Postby stassy » 22 Mar 2013, 06:09

group expansions by Block.
It would be nice, or even better the possibility to custom your own expansion list group (like grouping/degrouping 2010/2011/2012/2013 expansions together with the ability to edit those expansions)
stassy
Moderator
 
Posts: 5274
Joined: 25 Feb 2009, 07:06
Has thanked: 471 times
Been thanked: 337 times


Return to ManaLink 3.0

Who is online

Users browsing this forum: No registered users and 31 guests


Who is online

In total there are 31 users online :: 0 registered, 0 hidden and 31 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 31 guests

Login Form