-
Notifications
You must be signed in to change notification settings - Fork 80
Add complete information for each card and level #23
Comments
+1 |
It is a great suggestion, but unluckily there is a LOT of different options like hitpoints, damage, dps, etc. and as Supercell updates the balance of the game really often it is quite difficult for me to keep that information updated. I will leave this issue open, feel free to submit a pull request if you want help with this, I will try to work on this feature in the future. Thanks! |
@martincarrera Yes, it's almost impossible to do so unless people can contribute info or something like that which is not needed. Need to change the issue title to something proper. |
At least, could be possible to have cards level at tournament rules? It should be easier |
does anyone have an idea where the game store card stats? I can decode csv files and gather that info. |
I'm already on it, I decoded characters.csv and found so many ordered useful information. I will not leave this issue until I have them all ordered in a table and ready to be implemented, It'll take some time tho. I will keep you guys updated here. |
Option 1: Getting info from WikiaI managed to write a simple code that extracts stats and info from wikia page tables without the images in th, it also includes if we agree to use this method I will write special rules store numerical values as integers instead of strings how to test: var myRows = [];
var $headers = $("#unit-statistics-table th");
var $rows = $("#unit-statistics-table tr:not(:first-child)").each(function(index) {
$cells = $(this).find("td");
myRows[index] = {};
$cells.each(function(cellIndex) {
myRows[index][$($headers[cellIndex]).clone().children().remove().end().text().trim().toLowerCase().split(" ").join("-")] = $(this).text().trim();
});
});
var myObj = {}
myObj.name = $(".header-title h1").text().trim();
myObj.idName = $(".header-title h1").text().trim().toLowerCase().split(" ").join("-")
$("#unit-attributes-table tr th").each(function(index) {
var thisTH = $(this).clone().children().remove().end().text().trim().toLowerCase().split(" ").join("-")
var thisTD = $("#unit-attributes-table tr td").eq(index).text().trim()
myObj[thisTH] = thisTD
});
myObj.stats = myRows;
myObj.statsDate = new Date().toISOString()
console.log(myObj); you will get and object called {
"name": "Knight",
"idName": "knight",
"cost": "3",
"hit-speed": "1.1 sec",
"speed": "Medium (60)",
"deploy-time": "1 sec",
"range": "Melee",
"target": "Ground",
"count": "x1",
"transport": "Ground",
"type": "Troop",
"rarity": "Common",
"stats": [
{
"level": "1",
"hitpoints": "660",
"damage": "75",
"damage-per-second": "68"
},
{
"level": "2",
"hitpoints": "726",
"damage": "82",
"damage-per-second": "74"
},
{
"level": "3",
"hitpoints": "798",
"damage": "90",
"damage-per-second": "81"
},
{
"level": "4",
"hitpoints": "877",
"damage": "99",
"damage-per-second": "90"
},
{
"level": "5",
"hitpoints": "963",
"damage": "109",
"damage-per-second": "99"
},
{
"level": "6",
"hitpoints": "1,056",
"damage": "120",
"damage-per-second": "109"
},
{
"level": "7",
"hitpoints": "1,161",
"damage": "132",
"damage-per-second": "120"
},
{
"level": "8",
"hitpoints": "1,273",
"damage": "144",
"damage-per-second": "130"
},
{
"level": "9",
"hitpoints": "1,399",
"damage": "159",
"damage-per-second": "144"
},
{
"level": "10",
"hitpoints": "1,537",
"damage": "174",
"damage-per-second": "158"
},
{
"level": "11",
"hitpoints": "1,689",
"damage": "192",
"damage-per-second": "174"
},
{
"level": "12",
"hitpoints": "1,854",
"damage": "210",
"damage-per-second": "190"
},
{
"level": "13",
"hitpoints": "2,039",
"damage": "231",
"damage-per-second": "210"
}
],
"statsDate": "2017-03-22T08:20:55.031Z"
} |
Option 2: Getting info from game filesI managed to extract and decode official csv files, I narrowed down related files to these: https://github.com/MaherFa/temp-csv-files characters.decoded.csvincludes data like • DPS is calculated using • Ranged units doesn't have projectiles.decoded.csvincludes data about ranged units and some direct damage spells character_buffs.decoded.csvincludes information about elements that affect characters like Rage, Heal, Poison and Freeze buildings.decoded.csvbuildings area_effect_objects.decoded.csvarea effect spells and cards • some cards are listed with different names from game names, for example I believe this method is much better than the first option but it'll require more initial work. but once we have the script that extracts data from files we can automate the whole proccess for future updates. |
@martincarrera I have no experience with MongoDB, but I can loop through wikia pages and generate a JSON with all the info they have, and I think it should be easy to merge the result with the existing database. what do you think? |
Hi, I think the best way should be the first one. If you could provide me a JSON with the complete data of all the cards, I can update the API model to support that information and update the API. I could try to create a tiny script to run your code, but as I don't have a lot of time this days, it may take a couple of weeks. Thanks! |
already on it, I'm writing a node.js script that takes card names from an array and generate wikia links and http rquest them. I'm also using jsdom and jquery to run the code inside of node. it should be ready within 48 hours max, depending on my free time. Some mico issues: |
|
@martincarrera Full JSON file is ready, where should I upload it? |
Could you create a public gist and share the url? I can work on that. Thanks! |
it's a duplicate of your cards.json with same order and length with new keys. one thing to note, there was two cards with "needs confirmation" tags that we might need to confirm later. I hope you guys take a look at the file and point any possible issues and I'll work on them. but YEAH we finally have it!!!!! |
Is there a way to get tournament standards stats? |
@amirm3hdi
for others looking for a way to handle this, you can use conditions with hard coded indexes to get what you want for now: console.log(getTournyStats(cardObject))
function getTournyStats(myCard) {
switch (myCard.rarity) {
case "Common":
return myCard.stats[8];
break;
case "Rare":
return myCard.stats[6];
break;
case "Epic":
return myCard.stats[3];
break;
case "Legendary":
return myCard.stats[0];
break;
}
} |
@MaherFa I agree, a tiny code can achieve that. |
Can you add soon the levels to your API? All members of my clan are waiting for the levels of each card to add to my bot ;) https://gist.github.com/MaherFa/2d143da0a707caa7532dfff708643a6d |
@martincarrera if that JSON is hard to work with I can help if you point me to the recommended format you like the data in. I'm also perfecting the StatGrab bot for future updates, requests are welcomed. |
added all available icons to be used with stats (1d27efa) |
range [ number ] Except "Goblin Gang" and Mortar It says, 311 and should be "3/11" or something like that.
|
Is this still happening? Is anyone actively working on this api? |
Hi @BenC14! I am working on this API on my free time - and to be honest I don't have much since a couple of months ago. I will try to make this feature as soon as possible, but I can't promise any date or anything. I will post any news in this thread. Thanks! |
]
The text was updated successfully, but these errors were encountered: