Commit e075249c authored by Manish Kumar's avatar Manish Kumar
Browse files

stuff ignore

parent 144c5d31
......@@ -23,8 +23,8 @@ exports.filterJSON = function (data, type){
}
exports.filterJSONCombat = function (data){
var separatorsNames = ["types", "stats", "moves"];
var separators = ["id_type", "id", "id_move"];
var separatorsNames = ["types", "stats", "base_stats", "moves"];
var separators = ["id_type", "id", "baseStat_id", "id_move"];
var dataSet = new Set();
var filteredData = [];
var i = -1;
......@@ -33,6 +33,7 @@ exports.filterJSONCombat = function (data){
var tempArray = {};
var typesContainer = {};
var statsContainer = {};
var baseStatsContainer = {};
var movesContainer = {};
Object.keys(data[key]).forEach(function(key2) {
if(separators.includes(key2)) switcher++;
......@@ -44,6 +45,9 @@ exports.filterJSONCombat = function (data){
statsContainer[key2] = data[key][key2];
break;
case 3:
baseStatsContainer[key2] = data[key][key2];
break;
case 4:
movesContainer[key2] = data[key][key2];
break;
default:
......@@ -57,17 +61,19 @@ exports.filterJSONCombat = function (data){
//filteredData[i][moveNom].push(subContainer)
filteredData[i][separatorsNames[0]].push(typesContainer);
filteredData[i][separatorsNames[1]].push(statsContainer);
filteredData[i][separatorsNames[2]].push(movesContainer);
filteredData[i][separatorsNames[2]].push(baseStatsContainer);
filteredData[i][separatorsNames[3]].push(movesContainer);
} else {
i++;
filteredData.push(tempArray);
dataSet.add(data[key]["id_pokemon"]);
filteredData[i][separatorsNames[0]].push(typesContainer);
filteredData[i][separatorsNames[1]].push(statsContainer);
filteredData[i][separatorsNames[2]].push(movesContainer);
filteredData[i][separatorsNames[2]].push(baseStatsContainer);
filteredData[i][separatorsNames[3]].push(movesContainer);
}
});
filteredData.forEach(pokemon => {pokemon.types = arrUnique(pokemon.types); pokemon.moves = arrUnique(pokemon.moves); pokemon.stats = arrUnique(pokemon.stats);});
filteredData.forEach(pokemon => {pokemon.types = arrUnique(pokemon.types); pokemon.moves = arrUnique(pokemon.moves); pokemon.stats = arrUnique(pokemon.stats); pokemon.base_stats = arrUnique(pokemon.base_stats);});
return filteredData;
}
......
......@@ -112,7 +112,7 @@ Partie.accept = (id_partie, result) => {
};
Partie.getCombatTeam = (id_partie, id_joueur, result) =>{
sql.query("SELECT DISTINCT p.id_pokemon, p.pokeName, ep.active, typePoke.id_type, typePoke.nomType as typeNom, gs.id, gs.identifier as statName, es.stat_value, es.effort, m.id_move, m.identifier, m.power, m.accuracy, typeMove.id_type as m_id_type, typeMove.nomType, em.pp FROM etatPoke as ep, etatStats as es, etatMove as em, team as t, joueur as j, pokemon as p, move as m, genState as gs, type as typePoke, type as typeMove, pokemon_type as pty WHERE ep.id_partie=? AND ep.id_team=t.id_team AND t.id_joueur=? AND ep.id_etat=es.id_etat AND ep.id_etat=em.id_etat AND t.id_pokemon=p.id_pokemon AND m.id_move=em.id_move AND gs.id=es.stat_id AND p.id_pokemon=pty.pokemon_id AND pty.type_id=typePoke.id_type AND m.type_id=typeMove.id_type", [id_partie, id_joueur], (err, res) => {
sql.query("SELECT DISTINCT p.id_pokemon, p.pokeName, ep.active, typePoke.id_type, typePoke.nomType as typeNom, gs.id, gs.identifier as statName, es.stat_value, es.effort, s.stat_id as baseStat_id, gsBase.identifier as baseStatName, s.base_stat, m.id_move, m.identifier, m.power, m.accuracy, typeMove.id_type as m_id_type, typeMove.nomType, em.pp FROM etatPoke as ep, etatStats as es, etatMove as em, team as t, joueur as j, pokemon as p, move as m, genState as gs, type as typePoke, type as typeMove, pokemon_type as pty, stats as s, genState as gsBase WHERE ep.id_partie=? AND ep.id_team=t.id_team AND t.id_joueur=? AND ep.id_etat=es.id_etat AND ep.id_etat=em.id_etat AND t.id_pokemon=p.id_pokemon AND m.id_move=em.id_move AND gs.id=es.stat_id AND p.id_pokemon=pty.pokemon_id AND pty.type_id=typePoke.id_type AND m.type_id=typeMove.id_type AND p.id_pokemon=s.pokemon_id AND gsBase.id=s.stat_id ORDER BY p.id_pokemon", [id_partie, id_joueur], (err, res) => {
if (err) {
console.log("error: ", err);
result(err, null);
......
......@@ -19,11 +19,7 @@
</div>
<div class="top">
<div class="pokeballs">
<div class="pokeball"></div>
<div class="pokeball"></div>
<div class="pokeball"></div>
<div class="pokeball"></div>
<div class="pokeball"></div>
<div class="pokeball" *ngFor="let poke of selfTeam"></div>
</div>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment