It is currently 08 Sep 2025, 16:35
   
Text Size

M15

Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins

M15

Postby quercitron » 30 Jun 2014, 21:00

Most of M15 cards are already known, prerelease will start in two weeks. Is it possible to start working on the set? I want to implement some new cards, but I don't know how to initiate the process: add the new set and known cards in it.
quercitron
 
Posts: 17
Joined: 09 Nov 2011, 08:32
Has thanked: 0 time
Been thanked: 1 time

Re: M15

Postby LevelX » 01 Jul 2014, 07:24

I added the M15 set to to project.

The problem with adding the new cards to the mtg-cards-data.txt file is, that the java script I used in the past to parse the spoiler page of new sets on http://www.mtgsalvation.com doesn't work, after they changed the format of the spoiler pages.

So I tend to wait until the set is added to Gatherer, where I can get the list of new cards for mtg-cards-data.txt with Gatherer Crawler.

Maybe someone can change the java script to work with the new format of the page. That would be very useful. Here the script that worked with the old format.

Code: Select all
(function(){
   var x = '';
   function printCard(card){
       var text = '';
       text += card.name + '|Magic 2014|';
       text += (card.number ? card.number : '') + '|';
       text += card.rarity[0].replace('B', 'L') + '|';
       text += ((card.cost.length > 0) ? '{' : '') + card.cost.join('}{') + ((card.cost.length > 0) ? '}|' : '|');
       text += card.type + '|';
       text += (card.pt ? card.pt.split('/').join("|") : '|') + '|';
       text += (card.abilities ? card.abilities.join('$') : '') + '|';
       return text;
   }
   $.each($('table[cellpadding=5]'), function(index, value) {
       var $value = $(value);
       var card = {};
       card.name = $value.find('td[width=220px]:eq(0) a:eq(1)').attr('name');
       card.cost = [];
       $.each($value.find('td[width=80px]:eq(0) img'), function(idx, val) {
           card.cost.push(val.alt.toUpperCase());
       });
       card.type = $value.find('td[width=220px]:eq(1)').text();
       card.rarity = $value.find('td[width=80px]:eq(1) img').attr('alt');
       var findResult = $value.find('td[colspan=2]:eq(0)');
       if(findResult.length > 0){
           var text = findResult.html().replace(/<img src="http:\/\/forums.mtgsalvation.com\/images\/smilies\/[\w\d]+?.gif" alt="/g, '{');
           text = text.replace(/">/g, '}');
           text = text.replace(/{{/g, '{');
           text = text.replace(/}}/g, '}');
           text = text.replace(/(\r\n|\n|\r)/gm,"");
           card.abilities = text.split('<br>');
       }
       findResult = $value.find('tr:last i')
       if(findResult.length > 0){
           card.number = findResult.html().replace('#', '').split('/')[0];
       }
       findResult = $value.find('tr:last td:last')
       if(findResult.length > 0){   
           card.pt = findResult.html();
       }

       if(card.name.indexOf('//') != -1){
           var card1 = {};
           var card2 = {};
           card1.name = card.name.split(' // ')[0];
           card2.name = card.name.split(' // ')[1];
           card1.cost = card.cost;
           card2.cost = [];
           card1.rarity = card.rarity;
           card2.rarity = card.rarity;
           card1.type = card.type.split(' // ')[0];
           card2.type = card.type.split(' // ')[1];
           card1.pt = card.pt.split(' // ')[0];
           card2.pt = card.pt.split(' // ')[1];
           if(card.number){
               card1.number = card.number;
               card2.number = card.number;
           }
           var first = true;
           card1.abilities = [];
           card2.abilities = [];
           for(var i = 0; i < card.abilities.length; i++){
               if(card.abilities[i].indexOf('//') != -1 || card.abilities[i].indexOf('--') != -1){
                   first = false;
               }else if (card.abilities[i].length > 0) {
                   if(first){
                       card1.abilities.push(card.abilities[i]);
                   }else{
                       card2.abilities.push(card.abilities[i]);
                   }
               }
           }
           x += printCard(card1) + '\n';
           x += printCard(card2) + '\n';
       }else{
           x += printCard(card) + '\n';
       }
   });
   console.log(x);
})();
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: M15

Postby LevelX » 01 Jul 2014, 12:00

OK, I updated the script to work with the new format.
I'll add the current spoiler mtg-cards-data.txt.

Code: Select all
(function(){
   var x = '';
   function printCard(card){
       var text = '';
       text += card.name + '|Magic 2015|';
       text += (card.number ? card.number : '') + '|';
       text += card.rarity + '|';
       text += card.cost + '|';
       text += card.type + '|';
       text += (card.pt ? card.pt.split('/').join("|") : '|') + '|';
       text += card.abilities + '|';
       return text;
   }
   $.each($('div.t-spoiler-wrapper'), function(index, value) {
     var $value = $(value);
     var card = {};
     card.name = $value.find('div.t-spoiler').attr('id');       
     
     var findResult = $value.find('span.t-spoiler-artist').text();
     if(findResult.length > 0){
        var parts = findResult.split('#');
        card.number = parts[1].split('/')[0].trim();
     }
       
     var findResult = $value.find('span.t-spoiler-rarity').find('span:first').attr('class');
     if (findResult.substr(findResult.length - 6) == 'common') {
       card.rarity = 'C';
     } else if (findResult.substr(findResult.length - 8) == 'uncommon') {
       card.rarity = 'U';
     } else if (findResult.substr(findResult.length - 4) == 'rare') {
       card.rarity = 'R';
     } else if (findResult.substr(findResult.length - 6) == 'mythic') {
       card.rarity = 'M';
     } else if (findResult.substr(findResult.length - 4) == 'land') {
       card.rarity = 'L';
     } else {
       card.rarity = '?' + findResult;
     }
     
     var findCosts = $value.find('ul.t-spoiler-mana').find('span').text();     
     card.cost = '';
     $.each(findCosts , function (i, rowValue) {
             card.cost += '{' + rowValue + '}';
     });     

     card.type = $value.find('span.t-spoiler-type').text();
     
     card.pt = $value.find('span.t-spoiler-stat').text().replace(/\*/g,"0");
     
     var abilities = $value.find('div.t-spoiler-ability');
     abilities.find('span').replaceWith(function() { return '{' + this.innerHTML + '}' ; });
     
     card.abilities = '';
     $.each(abilities.find('p'), function (i, rowValue) {
       if (i > 0) {         
         card.abilities += '$';
       }
       card.abilities += rowValue.innerHTML.replace(/(\r\n|\n|\r)/gm,"");
     });         
     card.abilities = card.abilities.replace(/[\$]+/g,"$");
     
     x += printCard(card) + '\n';
   });   
   console.log(x);
   
})();
EDIT: Fixed the P/T bug in source code.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: M15

Postby LevelX » 01 Jul 2014, 12:56

Maybe you write here which cards you are going to implement, so we won't do the work twice.
I will start with the missing M15 green cards, as soon I got time and passion.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: M15

Postby quercitron » 01 Jul 2014, 15:35

Great, thank you!
I'll start with red cards.
quercitron
 
Posts: 17
Joined: 09 Nov 2011, 08:32
Has thanked: 0 time
Been thanked: 1 time

Re: M15

Postby LevelX » 03 Jul 2014, 20:18

I switch to white.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: M15

Postby quercitron » 04 Jul 2014, 22:28

Unfortunately I'll be away for about a week and won't be able to implement new cards :(
quercitron
 
Posts: 17
Joined: 09 Nov 2011, 08:32
Has thanked: 0 time
Been thanked: 1 time

Re: M15

Postby LevelX » 05 Jul 2014, 06:49

You're giving me a hard M15 week. #-o
Let's see what's possible.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: M15

Postby noxx » 07 Jul 2014, 15:20

Are we still using card tracker for dev purposes?
noxx
DEVELOPER
 
Posts: 110
Joined: 25 Mar 2012, 08:13
Has thanked: 3 times
Been thanked: 37 times

Re: M15

Postby LevelX » 07 Jul 2014, 15:27

noxx wrote:Are we still using card tracker for dev purposes?
Yes, as soon as the new sets are available on the Wizard gatherer I add them to the card tracker. That's because our card tracker needs the universal card id from gatherer.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: M15

Postby emerald3x0 » 08 Jul 2014, 01:25

Sent a patch via PM to LevelX containing the M15 artifacts other than Chain Veil.

EDIT: Realized a forgot a couple. Will do them tomorrow.
emerald3x0
 
Posts: 5
Joined: 08 Jul 2014, 00:41
Has thanked: 0 time
Been thanked: 0 time

Re: M15

Postby LevelX » 08 Jul 2014, 14:02

emerald3x0 wrote:Sent a patch via PM to LevelX containing the M15 artifacts other than Chain Veil.

EDIT: Realized a forgot a couple. Will do them tomorrow.
Hi emerald,

I've committed the 8 artifacts.
I also added you to the group of committers of the XMage project, so you can commit the next classes by yourself.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: M15

Postby emerald3x0 » 08 Jul 2014, 14:14

LevelX wrote:
emerald3x0 wrote:Sent a patch via PM to LevelX containing the M15 artifacts other than Chain Veil.

EDIT: Realized a forgot a couple. Will do them tomorrow.
Hi emerald,

I've committed the 8 artifacts.
I also added you to the group of committers of the XMage project, so you can commit the next classes by yourself.
I noticed you added a couple of effect.setText() to some abilities. For which abilities do you have to add it?

Also, do you have to restart the Mage Server every time you make a change to a card? Because mine takes about 5 minutes to start and it takes forever to make small changes.
emerald3x0
 
Posts: 5
Joined: 08 Jul 2014, 00:41
Has thanked: 0 time
Been thanked: 0 time

Re: M15

Postby LevelX » 08 Jul 2014, 15:55

emerald3x0 wrote:I noticed you added a couple of effect.setText() to some abilities. For which abilities do you have to add it?
Only if the text of a card combines more than one effect and modifies therefore the effect text. To get the correct text to the tooltip the best way is to use the effect.setText() method to change the standard effect text.

emerald3x0 wrote: Also, do you have to restart the Mage Server every time you make a change to a card? Because mine takes about 5 minutes to start and it takes forever to make small changes.
If you want to have the change active yes. But normally it doesn't need so much time. On Windows 7 64 bit the server restart needs about 15 seconds.
Which os and version do you use?
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: M15

Postby emerald3x0 » 08 Jul 2014, 16:08

LevelX wrote:If you want to have the change active yes. But normally it doesn't need so much time. On Windows 7 64 bit the server restart needs about 15 seconds.
Which os and version do you use?
I'm running Windows 7 32-bit on a couple of years old laptop.
emerald3x0
 
Posts: 5
Joined: 08 Jul 2014, 00:41
Has thanked: 0 time
Been thanked: 0 time

Next

Return to Developers Talk

Who is online

Users browsing this forum: No registered users and 3 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 3 guests

Login Form