It is currently 18 Apr 2024, 21:11
   
Text Size

[REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Moderator: CCGHQ Admins

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby RiiakShiNal » 17 Dec 2016, 00:51

No, it's exclusion was not intentional, it is probably more of an oversight than anything. It looks like I forgot to add it to the enum which means I missed it when I was going through all the entries trying to make sure they were all connected.

Adding the entry to the enum (in enums.cs) and recompiling is enough to get the type into the Advanced Filters, but the regular filters will take a little bit more code to get it tied in (nothing difficult just a few lines in a few different places).

What the enum should look like... | Open
Code: Select all
   public enum CardType
   {
      None = 0,
      Artifact = 0x0001,
      Creature = 0x0002,
      Enchantment = 0x0004,
      Instant = 0x0008,
      Land = 0x0010,
      Phenomenon = 0x0020,
      Plane = 0x0040,
      Planeswalker = 0x0080,
      Scheme = 0x0100,
      Sorcery = 0x0200,
      Tribal = 0x0400,
      Vanguard = 0x0800,
   }
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby RiiakShiNal » 17 Dec 2016, 01:04

Here are the changes to hook up Vanguard type in regular filters.
Filters.cs | Open
Code: Select all
      private bool CheckAgainstTypes(CardInfo ciCard)
      {
         bool bAllowed = true;

         switch (TypeFilter)
         {
            case FilterType.AllowAny:
               // Allow any combination of ...
               //   Anything outside the possible combinations should be denied.
               bAllowed = ((ciCard.Type & (~Type)) == 0);
               break;
            case FilterType.ExactMatch:
               bAllowed = (ciCard.Type == Type);
               break;
            case FilterType.Allow:
               bAllowed = CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Artifact, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Creature, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Enchantment, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Instant, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Land, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Phenomenon, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Plane, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Planeswalker, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Scheme, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Sorcery, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Tribal, TypeFilter);
               bAllowed |= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Vanguard, TypeFilter);
               break;
            case FilterType.Exclude:
               bAllowed = CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Artifact, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Creature, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Enchantment, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Instant, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Land, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Phenomenon, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Plane, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Planeswalker, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Scheme, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Sorcery, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Tribal, TypeFilter);
               bAllowed &= CheckFlag((int)ciCard.Type, (int)Type, (int)CardType.Vanguard, TypeFilter);
               break;
         }

         return bAllowed;
      }
FilterSettings.cs | Open
Code: Select all
      private void LoadSettingsFromFilters(Filters filters)
      {
         ...
         // Card Types
         chkArtifact.Checked = ((filters.Type & CardType.Artifact) == CardType.Artifact);
         chkCreature.Checked = ((filters.Type & CardType.Creature) == CardType.Creature);
         chkEnchantment.Checked = ((filters.Type & CardType.Enchantment) == CardType.Enchantment);
         chkInstant.Checked = ((filters.Type & CardType.Instant) == CardType.Instant);
         chkLand.Checked = ((filters.Type & CardType.Land) == CardType.Land);
         chkPhenomenon.Checked = ((filters.Type & CardType.Phenomenon) == CardType.Phenomenon);
         chkPlane.Checked = ((filters.Type & CardType.Plane) == CardType.Plane);
         chkPlaneswalker.Checked = ((filters.Type & CardType.Planeswalker) == CardType.Planeswalker);
         chkScheme.Checked = ((filters.Type & CardType.Scheme) == CardType.Scheme);
         chkSorcery.Checked = ((filters.Type & CardType.Sorcery) == CardType.Sorcery);
         chkTribal.Checked = ((filters.Type & CardType.Tribal) == CardType.Tribal);
         chkVanguard.Checked = ((filters.Type & CardType.Vanguard) == CardType.Vanguard);
         cboTypeFilter.SelectedItem = new KeyValuePair<FilterType, string>(filters.TypeFilter, Settings.UIStrings[filters.TypeFilter.ToString().ToUpper()]);
         ...
      }

      private void cmdApply_Click(object sender, EventArgs e)
      {
         ...
         // Types
         m_fltSettings.Type = (chkArtifact.Checked ? CardType.Artifact : 0);
         m_fltSettings.Type |= (chkCreature.Checked ? CardType.Creature : 0);
         m_fltSettings.Type |= (chkEnchantment.Checked ? CardType.Enchantment : 0);
         m_fltSettings.Type |= (chkInstant.Checked ? CardType.Instant : 0);
         m_fltSettings.Type |= (chkLand.Checked ? CardType.Land : 0);
         m_fltSettings.Type |= (chkPhenomenon.Checked ? CardType.Phenomenon : 0);
         m_fltSettings.Type |= (chkPlane.Checked ? CardType.Plane : 0);
         m_fltSettings.Type |= (chkPlaneswalker.Checked ? CardType.Planeswalker : 0);
         m_fltSettings.Type |= (chkScheme.Checked ? CardType.Scheme : 0);
         m_fltSettings.Type |= (chkSorcery.Checked ? CardType.Sorcery : 0);
         m_fltSettings.Type |= (chkTribal.Checked ? CardType.Tribal : 0);
         m_fltSettings.Type |= (chkVanguard.Checked ? CardType.Vanguard : 0);
         if (cboTypeFilter.SelectedIndex > -1)
            m_fltSettings.TypeFilter = ((KeyValuePair<FilterType, string>)cboTypeFilter.SelectedItem).Key;
         ...
      }
When I'm ready to release the next version this fix will be in there.

Edit:
Tools.cs | Open
Code: Select all
      public static string TypeText(CardType eType)
      {
         string strReturn = string.Empty;

         if ((eType & CardType.Tribal) == CardType.Tribal)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Tribal;
         }
         if ((eType & CardType.Artifact) == CardType.Artifact)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Artifact;
         }
         if ((eType & CardType.Creature) == CardType.Creature)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Creature;
         }
         if ((eType & CardType.Enchantment) == CardType.Enchantment)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Enchantment;
         }
         if ((eType & CardType.Instant) == CardType.Instant)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Instant;
         }
         if ((eType & CardType.Land) == CardType.Land)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Land;
         }
         if ((eType & CardType.Phenomenon) == CardType.Phenomenon)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Phenomenon;
         }
         if ((eType & CardType.Plane) == CardType.Plane)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Plane;
         }
         if ((eType & CardType.Planeswalker) == CardType.Planeswalker)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Planeswalker;
         }
         if ((eType & CardType.Scheme) == CardType.Scheme)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Scheme;
         }
         if ((eType & CardType.Sorcery) == CardType.Sorcery)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Sorcery;
         }
         if ((eType & CardType.Vanguard) == CardType.Vanguard)
         {
            if (strReturn.Length > 0)
               strReturn += " ";
            strReturn += CardType.Vanguard;
         }

         return strReturn;
      }
CardInfo.cs | Open
Code: Select all
      private string GenerateTypeLine(string strLangCode = null)
      {
         ...
         // Now we construct an appropriate regular type from the CardType.
         // Tribal takes precedence if present.
         if ((m_eType & CardType.Tribal) == CardType.Tribal)
            strTypeLine += lsStrings["CARD_TYPE_" + CardType.Tribal.ToString().ToUpper()] + " ";
         CardType ctTest = CardType.Artifact;
         while (ctTest != CardType.Tribal)
         {
            if ((m_eType & ctTest) == ctTest)
               strTypeLine += lsStrings["CARD_TYPE_" + ctTest.ToString().ToUpper()] + " ";
            ctTest = (CardType)((int)ctTest << 1);
         }
         if ((m_eType & CardType.Vanguard) == CardType.Vanguard)
            strTypeLine += lsStrings["CARD_TYPE_" + CardType.Vanguard.ToString().ToUpper()] + " ";
         ...
      }
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby Xander9009 » 17 Dec 2016, 15:03

Thanks, I got those put in and they worked fine.

Out of curiosity, do you know of a simple method of making the Advanced Filter use Add Filter as the default button? Normally, it would just be setting the AcceptButton to that, but this actually uses multiple buttons, and it's reliant on the current tab, so I can only think of methods that aren't extremely simple (such as when the tab control's selected index changes, set the AcceptButton for the window to the currently relevant one). But I don't want to mess with anything complicated. I don't think there is a super simple way to manage it, but figured I'd ask on the off-chance you know of one.

EDIT: Nevermind. Looked it up and discovered this is actually the suggested way to handle it apparently.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby RiiakShiNal » 17 Dec 2016, 19:09

With the ways I have things currently set up that is the easiest way. It's not particularly difficult. It is just setting up the SelectedIndexChanged event and using a switch on the index to set the appropriate button as the default. The other good way would be to move replace and add outside the tab control making them generic, though then you to combine all of the add and replace button code into a single function that switches based on the index (which is more complex than just switching between default buttons).

I try to keep functions simple where possible to make things easier to maintain. Though there are places where it really isn't possible to keep it simple.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby Xander9009 » 30 Dec 2016, 05:40

How likely would it be to get a menu option to export a list of the currently filtered cards? FILENAME alone would be enough, although of course a tab delimited listing including all of the currently visible columns would be amazing. I considered doing it myself, and I might, but I'm trying to keep the changes I make to a minimum so they're easy to re-implement on my end if they're not included with the next release. (Which, by the way, let me know if you want to look at the changes I made. They include * being a wildcard for the simple filter's ability section, the ability to exclude cards whose filenames start with an underscore, and the ability to edit a deck directly, automatically using its current ID and chosen from only the decks matching the current ID format, e.g. I only choose from decks with IDs 9009*.)
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby RiiakShiNal » 01 Jan 2017, 05:14

Exporting a tab delimited listing of all cards currently in the list (including all currently visible columns) is pretty easy if you allow for excluding/substituting the Casting Cost column (if substituting use Casting Cost Text instead). It's not a good idea to try and output images to a text file. Granted it's pretty easy to even implement the output as a choice between simple filename list, tab delimited list, and even as an Excel Workbook.

So if looking at the choice route which is the more preferable option putting the choice in the right-click menu or in the drop-down in the save dialog?
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby Xander9009 » 01 Jan 2017, 11:25

RiiakShiNal wrote:Exporting a tab delimited listing of all cards currently in the list (including all currently visible columns) is pretty easy if you allow for excluding/substituting the Casting Cost column (if substituting use Casting Cost Text instead). It's not a good idea to try and output images to a text file. Granted it's pretty easy to even implement the output as a choice between simple filename list, tab delimited list, and even as an Excel Workbook.

So if looking at the choice route which is the more preferable option putting the choice in the right-click menu or in the drop-down in the save dialog?
Awesome. I'd imagine either would work well, but I'd personally prefer the menu option since the right click menu seems to be mostly specific to the card the mouse is on.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby addict insane » 16 Jan 2017, 13:06

Sorry for the newb question, but is anyone else having trouble running the deck builder in windows 10? It won't run the .exe
addict insane
 
Posts: 184
Joined: 02 Mar 2015, 22:20
Has thanked: 23 times
Been thanked: 11 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby Xander9009 » 16 Jan 2017, 13:08

addict insane wrote:Sorry for the newb question, but is anyone else having trouble running the deck builder in windows 10? It won't run the .exe
It definitely works in Windows 10 normally. What's it do? Just nothing at all? Is the deck builder freshly installed, or is it a copy from your previous windows installation? If it's a copy, I'd redownload the latest version and try it again. I'm also not sure what would happen if you tried running the 64 bit version on a 32 bit system, but that might be it.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby addict insane » 16 Jan 2017, 13:53

Xander9009 wrote:
addict insane wrote:Sorry for the newb question, but is anyone else having trouble running the deck builder in windows 10? It won't run the .exe
It definitely works in Windows 10 normally. What's it do? Just nothing at all? Is the deck builder freshly installed, or is it a copy from your previous windows installation? If it's a copy, I'd redownload the latest version and try it again. I'm also not sure what would happen if you tried running the 64 bit version on a 32 bit system, but that might be it.
Yep, that was the problem. Thanks. Running on a different computer this time so had no idea what was going on
addict insane
 
Posts: 184
Joined: 02 Mar 2015, 22:20
Has thanked: 23 times
Been thanked: 11 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby RiiakShiNal » 17 Jan 2017, 11:13

Xander9009 wrote:It definitely works in Windows 10 normally. What's it do? Just nothing at all? Is the deck builder freshly installed, or is it a copy from your previous windows installation? If it's a copy, I'd redownload the latest version and try it again. I'm also not sure what would happen if you tried running the 64 bit version on a 32 bit system, but that might be it.
My development system is currently Windows 10 so the Deck Builder has no issues with Windows 10 (if it had issues then I would have already fixed them because I would have been seeing them).

The 64-bit version can't run at all on a 32-bit version of Windows.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby nachonal986 » 25 Feb 2017, 01:40

hey, I have an issue: When I try to legendary super types on normal filter, to see cards only with those condition, Doesn't apply these filter.

Im using last version, with windows 10 on 64 bit.
Last edited by nachonal986 on 25 Feb 2017, 01:48, edited 1 time in total.
User avatar
nachonal986
 
Posts: 83
Joined: 27 Jul 2015, 21:13
Has thanked: 17 times
Been thanked: 1 time

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby Xander9009 » 25 Feb 2017, 01:44

nachonal986 wrote:hey, I have an issue: When I try to legendary super types, to see card only with those condition, Doesn't apply these filter.

Im using last version, with windows 10 on 64 bit.
The supertypes listed in the filters window are for allowing or excluding those supertypes. If you uncheck legendary, then no legendaries will be shown. Having it checked doesn't make it only show legendaries. In order to only show cards with the legendary supertype, you need to open the advanced filters and add "Enum Filters>Supertype is Legendary".
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby nachonal986 » 25 Feb 2017, 01:52

Xander9009 wrote:
nachonal986 wrote:hey, I have an issue: When I try to legendary super types, to see card only with those condition, Doesn't apply these filter.

Im using last version, with windows 10 on 64 bit.
The supertypes listed in the filters window are for allowing or excluding those supertypes. If you uncheck legendary, then no legendaries will be shown. Having it checked doesn't make it only show legendaries. In order to only show cards with the legendary supertype, you need to open the advanced filters and add "Enum Filters>Supertype is Legendary".
Thanks dude, was a wrong way to use the normal filter.

as always saving my neck
User avatar
nachonal986
 
Posts: 83
Joined: 27 Jul 2015, 21:13
Has thanked: 17 times
Been thanked: 1 time

Re: [REL] Riiak's DotP 2014 Deck Builder v1.5.0.3

Postby ChrisDovahkiin » 26 Apr 2017, 22:15

Hey Riiak, I've been using the latest version of the Builder without issue until today.

Now, anytime I try to save any deck (even one's I've already made/saved) I get an Unhandled Exception:

| Open
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at RSN.DotP.Deck.Export(IdScheme isScheme, Boolean bForceExport)
at RSN.DotP.DeckBuilder.SaveDeck()
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


Any idea what's going on or what I need to fix?

Many thanks!
ChrisDovahkiin
 
Posts: 6
Joined: 25 Apr 2017, 20:48
Has thanked: 1 time
Been thanked: 1 time

PreviousNext

Return to Utilities

Who is online

Users browsing this forum: No registered users and 9 guests


Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 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 9 guests

Login Form