M15
Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins
17 posts
• Page 1 of 2 • 1, 2
M15
by 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
by 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.
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.
- 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);
})();
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
Re: M15
by 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.
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);
})();
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
Re: M15
by 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.
I will start with the missing M15 green cards, as soon I got time and passion.
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
- quercitron
- Posts: 17
- Joined: 09 Nov 2011, 08:32
- Has thanked: 0 time
- Been thanked: 1 time
Re: M15
by 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
by LevelX » 07 Jul 2014, 15:27
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.noxx wrote:Are we still using card tracker for dev purposes?
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
Re: M15
by 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.
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
by LevelX » 08 Jul 2014, 14:02
Hi emerald,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.
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.
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
Re: M15
by emerald3x0 » 08 Jul 2014, 14:14
I noticed you added a couple of effect.setText() to some abilities. For which abilities do you have to add it?LevelX wrote:Hi emerald,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.
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.
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
by LevelX » 08 Jul 2014, 15:55
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:I noticed you added a couple of effect.setText() to some abilities. For which abilities do you have to add it?
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.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.
Which os and version do you use?
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
Re: M15
by emerald3x0 » 08 Jul 2014, 16:08
I'm running Windows 7 32-bit on a couple of years old laptop.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?
- emerald3x0
- Posts: 5
- Joined: 08 Jul 2014, 00:41
- Has thanked: 0 time
- Been thanked: 0 time
17 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 3 guests