From 46d65aebe5b3164ee61d527d2ccd35f24b91e910 Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Sat, 9 Nov 2019 01:29:24 -0700 Subject: [PATCH 1/5] adding a currency cuttof filter mayby --- main.ts | 207 +++++++++++++++++- .../displaylist/displaylist.component.html | 10 +- src/app/displaylist/displaylist.component.ts | 105 ++++++++- 3 files changed, 309 insertions(+), 13 deletions(-) diff --git a/main.ts b/main.ts index 3a72e59..5da52a2 100644 --- a/main.ts +++ b/main.ts @@ -107,15 +107,220 @@ interface Colour { const ipcMain = require("electron").ipcMain; const { session } = require("electron"); let responsedata; +ipcMain.on("only-character-data", async (event, message) => { + console.log("hello inside character data"); + let sessionid = message[0]; + let accountName = message[1]; + let league = message[2].split(" ").join("+"); + // event.sender.send("ping-async-stash", [ + // "got poeninja data, starting stash", + // accountName, + // league + // ]); + + let stashdatatemp2 = []; + + event.sender.send("ping-async-stash", [ + "backend poedata", + [sessionid, accountName, league] + ]); + + let stashurlsFull = []; + + event.sender.send("ping-async-stash", "starting stash"); + + await axios + .get( + "https://www.pathofexile.com/character-window/get-stash-items?league=" + + league + + "&accountName=" + + accountName + + "&tabs=0&tabIndex=0", + { + headers: { + cookie: "POESESSID=" + sessionid //the token is a variable which holds the token + } + } + ) + .then(async response => { + // var finalObj = finalObj.concat(response); // should concat the data + console.log(response.headers); + // message = response.data as RootObject; + let stashdatatemp = []; + this.stashdata = response.data; + event.sender.send("ping-async-stash", [ + response, + "got stash data" + "tab count " + Number(response.data.numTabs) + ]); + await sleep(10000); + // get stash data + let responseNumTabsTotal = response.data.numTabs; + // event.returnValue = [ + // ["Stash " + x], + // ["Left! total-index= " + (stashurlsFull.length - x)] + // ]; + event.returnValue = ["hi"]; + // let numTabsResponse = + for (let x = 0; x < 5; x++) { + stashurlsFull.push( + "https://www.pathofexile.com/character-window/get-stash-items?league=" + + league + + "&accountName=" + + accountName + + "&tabs=0&tabIndex=" + + x + ); + } + let stashtotaltoget = stashurlsFull.length; + // if (message[2] == "Standard") { + // stashtotaltoget = 10; + // responseNumTabsTotal = 10; + // } + if (Number(responseNumTabsTotal) > 40) { + stashtotaltoget = 40; + responseNumTabsTotal = 40; + } + console.log(responseNumTabsTotal, stashtotaltoget); + console.log(stashurlsFull); + // get all stash data + let promisesurls = []; + // ## CHANGE HERE FOR RATE LIMIT + + // Currently just setting to 48 for testing. + // for (let x = 0; x < stashtotaltoget; x++) { + // // CHANGE HERE FOR RATE LIMIT + // // ## CHANGE HERE FOR RATE LIMIT + // // for (let x = 0; x < 5; x++) { + // promisesurls.push( + // axios.get(stashurlsFull[x], { + // headers: { + // cookie: "POESESSID=" + sessionid //the token is a variable which holds the token + // } + // }) + // ); + // } + + // event.sender.send( + // "ping-async", + // this.stashdata, + // this.poeNinjaResponseArray, + // this.fullstashdata + // ); + // let stashdatawhy=[] + for (let x = 0; x < stashurlsFull.length; x++) { + await axios + .get(stashurlsFull[x], { + headers: { + cookie: "POESESSID=" + sessionid //the token is a variable which holds the token + } + }) + .then(response => { + //this will be executed only when all requests are complete + // console.log("Currency: ", responseArr[0].data); + this.fullstashdata = response; // currency + // console.log(response.data); + stashdatatemp.push(response); + console.log( + response.headers["x-rate-limit-account"], + "x-rate-limit-account" + ); + console.log( + response.headers["x-rate-limit-account-state"], + "x-rate-limit-account-state" + ); + console.log("Stash " + x); + console.log("Left! total-index= " + (stashurlsFull.length - x)); + event.sender.send("ping-async-stash", [ + "Stash " + x, + "Left! total-index= " + (stashurlsFull.length - x) + ]); + event.sender.send("ping-async-stash", response); + // console.log(response); + // console.log(responseArr[0].data) + // for (let x = 0; x < stashurlsFull.length; x++) { + // console.log(this.fullstashdata[x].data); + // } + // this.poeNinjaResponseArray = [ + // responseArr[0].data, + // ]; //Changedd to .data + }) + .catch(e => { + console.log("Error: in stash responses", e.response.data); + }); + // console.log(stashdatatemp); + await sleep(1350); + } + this.stashdatatemp2 = stashdatatemp; + event.sender.send("ping-async", this.stashdata, stashdatatemp); + // axios + // .all(promisesurls) + // .then(responseArr => { + // //this will be executed only when all requests are complete + // // console.log("Currency: ", responseArr[0].data); + // this.fullstashdata = responseArr; // currency + // // console.log(responseArr); + // // console.log(responseArr[0].data) + // // for (let x = 0; x < stashurlsFull.length; x++) { + // // console.log(this.fullstashdata[x].data); + // // } + // // this.poeNinjaResponseArray = [ + // // responseArr[0].data, + // // ]; //Changedd to .data + // event.sender.send( + // "ping-async", + // this.stashdata, + // this.poeNinjaResponseArray, + // this.fullstashdata + // ); + // }) + // .catch(e => { + // console.log("Error: in stash responses", e.response.data); + // }); + + // event.sender.send( + // "ping-async", + // this.stashdata, + // this.poeNinjaResponseArray, + // this.fullstashdata + // ); + }) + .catch(e => { + console.log("Error: ", e.response.data); + console.log("pathofexile.com Probably Down...."); + event.sender.send("ping-async", this.stashdata, null, stashdatatemp2); + }); + // getter(); + // let giantstasharray = []; + // if (this.fullstashdata) { + // for (let x = 0; x < this.fullstashdata; x++) { + // // console.log(resp3[x].data.items); + // if (this.fullstashdata[x].data.items) { + // giantstasharray.push(this.fullstashdata[x].data.items); + // } + // } + // } + + // let bigarrayconcat = [].concat(giantstasharray); + // let biggestitemarrayever = []; + // for (var i = 0; i < bigarrayconcat.length; ++i) { + // for (var j = 0; j < bigarrayconcat[i].length; ++j) + // biggestitemarrayever.push(bigarrayconcat[i][j]); + // } + // this.fullstashdata = biggestitemarrayever; +}); + +// force refresh are and others ipcMain.on("ping-async", async (event, message) => { console.log("hello"); let sessionid = message[0]; let accountName = message[1]; - let league = message[2]; + let league = message[2].split(" ").join("+"); + // let currencyCutoff = message[3]; event.sender.send("ping-async-stash", [ "got poeninja data, starting stash", accountName, league + // currencyCutoff ]); // const { net } = require("electron"); // let request = net.request( diff --git a/src/app/displaylist/displaylist.component.html b/src/app/displaylist/displaylist.component.html index 32bc416..c22b34f 100644 --- a/src/app/displaylist/displaylist.component.html +++ b/src/app/displaylist/displaylist.component.html @@ -17,7 +17,7 @@ --> -
+ - @@ -129,6 +132,9 @@
+ + + diff --git a/src/app/displaylist/displaylist.component.ts b/src/app/displaylist/displaylist.component.ts index 2e5015c..c51205c 100644 --- a/src/app/displaylist/displaylist.component.ts +++ b/src/app/displaylist/displaylist.component.ts @@ -260,7 +260,8 @@ export class DisplaylistComponent implements OnInit { POESESSID: new FormControl("***Replace***", Validators.maxLength(32)), accountName: new FormControl("qqazraelz", Validators.required), characterName: new FormControl("ZomboTD", Validators.maxLength(20)), - league: new FormControl("Blight", Validators.maxLength(20)) + league: new FormControl("Blight", Validators.maxLength(20)), + worthCutoff: new FormControl("none", Validators.maxLength(20)) }); accform = new FormControl(20, Validators.required); characterform = new FormControl(); @@ -909,7 +910,22 @@ export class DisplaylistComponent implements OnInit { this.fullstashDataResponseSource.filter = filterValue.trim().toLowerCase(); // console.log(this.currenttablesource); } - openModal() { + applyFilterCurrencyCuttoff(filterValue: string) { + this.fullstashDataResponseSource.filterPredicate = function( + data, + filter: string + ): boolean { + // return data.name.toLowerCase().includes(filter) || data.symbol.toLowerCase().includes(filter) || data.position.toString().includes(filter); + console.log(data[0], "wut"); + return data[0].toLowerCase().includes(filter); + // data.worth.toLowerCase().includes(filter) || + // data.explicitMods.toString().includes(filter) + }; + // this.fullstashDataResponseSource.filter = filterValue.trim().toLowerCase(); + // console.log(this.currenttablesource); + } + + forceRefresh() { console.log("Play"); if (this._electronService.isElectronApp) { @@ -969,9 +985,15 @@ export class DisplaylistComponent implements OnInit { console.log(this.fullstashdataBigBoiArray, "Big Boi"); for (let x = 0; x < this.fullstashdataBigBoiArray.length; x++) { // console.log(this.fullstashdataBigBoiArray[x], "before push"); - this.fullstashdataBigBoiArray[x].worth = this.worthfinder2( - this.fullstashdataBigBoiArray[x] - ); + let worthpush = this.worthfinder2(this.fullstashdataBigBoiArray[x]); + // if (this.userForm.get("worthCutoff").value == "none") { + // this.fullstashdataBigBoiArray[x].worth = worthpush + // } + this.fullstashdataBigBoiArray[x].worth = worthpush; + // if (this.userForm.get("worthCutoff").value > worthpush) { + // delete this.fullstashdataBigBoiArray[x] + // } + this.networth += Number( parseFloat( this.fullstashdataBigBoiArray[x].worth.toString() @@ -1055,9 +1077,9 @@ export class DisplaylistComponent implements OnInit { // this.itemheadersTest2 = Object.keys(resp2[3].lines[0]); // get all headers // console.log(this.itemheadersTest2); - for (let entry of this.stashdatarequest) { - console.log(entry, "items"); - } + // for (let entry of this.stashdatarequest) { + // console.log(entry, "items"); + // } // console.log(resp2[0].lines, "Currency?"); console.log(this.stashdatarequest, "stashData Request"); // this.derpcolums = Object.keys(resp[3].data); @@ -1089,11 +1111,74 @@ export class DisplaylistComponent implements OnInit { // localStorage.length > 0 // ? localstorageAccountData.accountName this.userForm.get("league").value + // this.userForm.get("worthCutoff").value + // this.userForm.get("league").value ]); // get us data } - onFormSubmit(): void {} + onStashesOnlySubmit(): void { + if (this._electronService.isElectronApp) { + // We have access to node process. + this.versions.node = this._electronService.process.versions.node; + this.versions.chrome = this._electronService.process.versions.chrome; + this.versions.electron = this._electronService.process.versions.electron; + console.log(this.versions, "versions"); + } + this._electronService.ipcRenderer.on("ping-async-stash", (event, resp) => { + console.log(resp); + }); + + this._electronService.ipcRenderer.send("only-character-data", [ + // localStorage.length > 0 + // ? localstorageAccountData.POESESSID + this.userForm.get("POESESSID").value, + // localStorage.length > 0 + // ? localstorageAccountData.accountName + this.userForm.get("accountName").value, + // localStorage.length > 0 + // ? localstorageAccountData.accountName + this.userForm.get("league").value + // this.userForm.get("league").value + //add new values here like tab # or a list of user specified tabs + ]); // get us data + + this._electronService.ipcRenderer.on("ping-async", (event, resp, resp2) => { + // prints "pong" + console.log(resp, resp2); + + let bigboyarray2 = []; + if (resp2) { + for (let x = 0; x < resp2.length; x++) { + // console.log(resp3[x].data.items); + if (resp2[x].data.items) { + bigboyarray2.push(resp2[x].data.items); + } + } + } + let bigarrayconcat = [].concat(bigboyarray2); + let biggestitemarrayever = []; + for (var i = 0; i < bigarrayconcat.length; ++i) { + for (var j = 0; j < bigarrayconcat[i].length; ++j) + biggestitemarrayever.push(bigarrayconcat[i][j]); + } + this.fullstashdataBigBoiArray = biggestitemarrayever; + + // this.itemheadersTest2 = Object.keys(resp2[3].lines[0]); // get all headers + // console.log(this.itemheadersTest2); + // for (let entry of this.stashdatarequest) { + // console.log(entry, "items"); + // } + // console.log(resp2[0].lines, "Currency?"); + console.log(this.stashdatarequest, "stashData Request"); + + let stashdatasourceitems = resp.items; + this.stashdatasource = new MatTableDataSource(resp); + this.stashItems2 = new MatTableDataSource(stashdatasourceitems); + + this.refresh(); // makes the display look for changes aka our new data + }); + } getuserName(): any { return this.userForm.get("name"); @@ -1119,7 +1204,7 @@ export class DisplaylistComponent implements OnInit { } ngOnInit() { - // this.openModal(); // run the button + // this.forceRefresh(); // run the button console.log("Before"); From e944598f23bc5a07411e273022e092f7387d47d7 Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Sun, 10 Nov 2019 13:41:17 -0700 Subject: [PATCH 2/5] progess bar and league selector --- main.ts | 39 +++++++++-- package.json | 3 +- src/app/app.component.html | 4 +- src/app/app.module.ts | 2 + .../displaylist/displaylist.component.html | 48 ++++++++++--- src/app/displaylist/displaylist.component.ts | 68 ++++++++++++++++--- src/app/home/home.component.html | 12 +++- 7 files changed, 149 insertions(+), 27 deletions(-) diff --git a/main.ts b/main.ts index 5da52a2..3278c50 100644 --- a/main.ts +++ b/main.ts @@ -235,6 +235,7 @@ ipcMain.on("only-character-data", async (event, message) => { "Left! total-index= " + (stashurlsFull.length - x) ]); event.sender.send("ping-async-stash", response); + event.sender.send("ping-async-stashprogressbar",[ x, stashurlsFull.length]); // console.log(response); // console.log(responseArr[0].data) // for (let x = 0; x < stashurlsFull.length; x++) { @@ -246,6 +247,10 @@ ipcMain.on("only-character-data", async (event, message) => { }) .catch(e => { console.log("Error: in stash responses", e.response.data); + event.sender.send("ping-async-stash", [ + e.response.data, + "error in stash responses" + ]); }); // console.log(stashdatatemp); await sleep(1350); @@ -287,6 +292,7 @@ ipcMain.on("only-character-data", async (event, message) => { .catch(e => { console.log("Error: ", e.response.data); console.log("pathofexile.com Probably Down...."); + event.sender.send("ping-async-stash", e.response.data); event.sender.send("ping-async", this.stashdata, null, stashdatatemp2); }); // getter(); @@ -309,6 +315,9 @@ ipcMain.on("only-character-data", async (event, message) => { // this.fullstashdata = biggestitemarrayever; }); + + + // force refresh are and others ipcMain.on("ping-async", async (event, message) => { console.log("hello"); @@ -317,7 +326,7 @@ ipcMain.on("ping-async", async (event, message) => { let league = message[2].split(" ").join("+"); // let currencyCutoff = message[3]; event.sender.send("ping-async-stash", [ - "got poeninja data, starting stash", + "Starting", accountName, league // currencyCutoff @@ -361,11 +370,13 @@ ipcMain.on("ping-async", async (event, message) => { // https://www.pathofexile.com/character-window/get-stash-items?league=Blight&accountName=qqazraelz&tabs=0 // {"numTabs":39} let baseURL = - "https://poe.ninja/api/data/ItemOverview?league=" + message[2] + "&type="; + "https://poe.ninja/api/data/ItemOverview?league=" + + encodeURI(message[2]) + + "&type="; let urlendings: string[] = [ "Currency", // currency has currencyoveriew and Itemoveriew updated "https://poe.ninja/api/data/currencyoverview?league=" + - message[2] + + encodeURI(message[2]) + "&type=Fragment", //currency is different url "Oil", "Fossil", @@ -399,7 +410,12 @@ ipcMain.on("ping-async", async (event, message) => { let incubatorDataResponse; let essenceDataResponse; let stashdata; - + event.sender.send("ping-async-stash", [ + "getting poeninja data,", + accountName, + encodeURI(message[2]) + // currencyCutoff + ]); await axios .all([ axios.get(baseURL + urlendings[0]), //Currency @@ -474,6 +490,10 @@ ipcMain.on("ping-async", async (event, message) => { }) .catch(e => { console.log("Error: POE NINJA GET ERROR", e.response.data); + event.sender.send("ping-async-stash", [ + e.response.data, + "error in poeninja data" + ]); }); event.sender.send( "ping-async-stash", @@ -561,6 +581,7 @@ ipcMain.on("ping-async", async (event, message) => { response, "got stash data" + "tab count " + Number(response.data.numTabs) ]); + event.sender.send("ping-async-stashprogressbar",[ 0, stashurlsFull.length]); await sleep(10000); // get stash data let responseNumTabsTotal = response.data.numTabs; @@ -644,6 +665,7 @@ ipcMain.on("ping-async", async (event, message) => { "Left! total-index= " + (stashurlsFull.length - x) ]); event.sender.send("ping-async-stash", response); + event.sender.send("ping-async-stashprogressbar",[ x, stashurlsFull.length]); // console.log(response); // console.log(responseArr[0].data) // for (let x = 0; x < stashurlsFull.length; x++) { @@ -655,10 +677,15 @@ ipcMain.on("ping-async", async (event, message) => { }) .catch(e => { console.log("Error: in stash responses", e.response.data); + event.sender.send("ping-async-stash", [ + e.response.data, + "error in stash response" + ]); }); // console.log(stashdatatemp); await sleep(1350); } + event.sender.send("ping-async-stashprogressbar",[ stashurlsFull.length, stashurlsFull.length]); event.sender.send( "ping-async", this.stashdata, @@ -700,6 +727,10 @@ ipcMain.on("ping-async", async (event, message) => { .catch(e => { console.log("Error: ", e.response.data); console.log("pathofexile.com Probably Down...."); + event.sender.send("ping-async-stash", [ + e.response.data, + "error PoE might be down?" + ]); event.sender.send("ping-async", null, this.poeNinjaResponseArray, null); }); // getter(); diff --git a/package.json b/package.json index c7c74cf..ad5545f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zombpoe", - "version": "0.0.5", + "version": "0.0.5a", "description": "Path of exile poe.ninja and stash program Angular 8 with Electron (Typescript + SASS + Hot Reload)", "homepage": "https://github.com/zombodotcom/Zombpoe", "author": { @@ -98,6 +98,7 @@ "electron-log": "^3.0.8", "express": "^4.17.1", "hammerjs": "^2.0.8", + "mat-table-exporter": "^1.2.2", "ngx-cookie-service": "^2.2.0", "ngx-electron": "^2.1.1", "ngx-embed-video": "^1.0.4", diff --git a/src/app/app.component.html b/src/app/app.component.html index b7005a6..d9832e6 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -6,11 +6,11 @@ -->

- Zombo + Zombopoe

- + + + League + + Blight + Standard + Hardcore + SSF Standard + SSF Hardcore + Hardcore Blight + SSF Blight + SSF Blight HC + + + + +

+Stash Download Progress: {{progressdownload}} % +

+ + +
+ + +
+ + +
Name @@ -276,16 +302,18 @@ + - + + class="w-100" >
- Name diff --git a/src/app/displaylist/displaylist.component.ts b/src/app/displaylist/displaylist.component.ts index c51205c..1ddb14f 100644 --- a/src/app/displaylist/displaylist.component.ts +++ b/src/app/displaylist/displaylist.component.ts @@ -7,6 +7,7 @@ import { ChangeDetectorRef } from "@angular/core"; import { PoeninjaapiService, CharacterData } from "../poeninjaapi.service"; +import {MatProgressBarModule} from '@angular/material' import { DataSource } from "@angular/cdk/table"; import { Sort, MatSort } from "@angular/material/sort"; import { NgForm, FormBuilder } from "@angular/forms"; @@ -174,6 +175,8 @@ interface Colour { }) export class DisplaylistComponent implements OnInit { displayedColumnstester: string[]; + public progressdownload=0; + public progressleft; currencyDataResponse; fragmentsDataResponse; oilsDataResponse; @@ -256,12 +259,23 @@ export class DisplaylistComponent implements OnInit { itemsearchtest = new FormGroup({ itemsearchstring: new FormControl("Enter Item", Validators.maxLength(100)) }); + // leagues: string[] = [ + // "Standard", + // "Hardcore", + // "SSF Standard", + // "SSF Hardcore", + // "Hardcore Blight", + // "SSF Blight", + // "SSF Blight HC" + // ]; + default: string = "Blight"; userForm = new FormGroup({ POESESSID: new FormControl("***Replace***", Validators.maxLength(32)), accountName: new FormControl("qqazraelz", Validators.required), - characterName: new FormControl("ZomboTD", Validators.maxLength(20)), - league: new FormControl("Blight", Validators.maxLength(20)), - worthCutoff: new FormControl("none", Validators.maxLength(20)) + characterName: new FormControl("Not Used Yet", Validators.maxLength(25)), + league: new FormControl("Blight") + // league2: new FormControl("Blight") + // worthCutoff: new FormControl("none", Validators.maxLength(20)) }); accform = new FormControl(20, Validators.required); characterform = new FormControl(); @@ -738,13 +752,25 @@ export class DisplaylistComponent implements OnInit { this.giantpoeninjaarray[i].explicitModifiers ) { if (item.explicitMods.indexOf("Has 1 Abyssal Socket") !== -1) { - console.log("has1"); + console.log("Has 1 Abyssal Socket"); continue; } if (item.explicitMods.indexOf("Has 2 Abyssal Socket") !== -1) { // continue; - console.log("has 2"); + if ( + this.giantpoeninjaarray[i].explicitModifiers.indexOf( + "Has 2 Abyssal Socket" + ) !== -1 + ) { + console.log("Has 2 Abyssal Socket inside both! Pricing?"); + return this.giantpoeninjaarray[i].chaosValue + ? this.giantpoeninjaarray[i].chaosValue + : this.giantpoeninjaarray[i].chaosEquivalent; + } + console.log( + "Has 2 Abyssal Socket this item might be worth something" + ); } } return this.giantpoeninjaarray[i].chaosValue @@ -937,7 +963,11 @@ export class DisplaylistComponent implements OnInit { } this._electronService.ipcRenderer.on("ping-async-stash", (event, resp) => { console.log(resp); + }); + //Update the progress bar + + this._electronService.ipcRenderer.on( "ping-async", @@ -1089,7 +1119,7 @@ export class DisplaylistComponent implements OnInit { let stashdatasourceitems = resp.items; this.stashdatasource = new MatTableDataSource(resp); - this.stashItems2 = new MatTableDataSource(stashdatasourceitems); + // this.stashItems2 = new MatTableDataSource(stashdatasourceitems); this.arrayOfKeys = Object.keys(this.stashdatarequest); this.stashitemOBJ = Object; this.stashitemOBJ = this.stashdatarequest; @@ -1172,9 +1202,9 @@ export class DisplaylistComponent implements OnInit { // console.log(resp2[0].lines, "Currency?"); console.log(this.stashdatarequest, "stashData Request"); - let stashdatasourceitems = resp.items; + // let stashdatasourceitems = resp.items; this.stashdatasource = new MatTableDataSource(resp); - this.stashItems2 = new MatTableDataSource(stashdatasourceitems); + // this.stashItems2 = new MatTableDataSource(stashdatasourceitems); this.refresh(); // makes the display look for changes aka our new data }); @@ -1202,6 +1232,13 @@ export class DisplaylistComponent implements OnInit { console.log(this.POESESSID.value); console.log(this.accountName.value); } +// stashprogressget(){ +// return this.progressdownload; +// } + +// stashprogressset(resp){ +// this.progressdownload = !isNaN(Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0; +// } ngOnInit() { // this.forceRefresh(); // run the button @@ -1209,9 +1246,22 @@ export class DisplaylistComponent implements OnInit { console.log("Before"); let derplist; - +this._electronService.ipcRenderer.on("ping-async-stashprogressbar", (event, resp) => { + // console.log(resp,"ping-async-stashprogressbar"); + // stashprogressset(resp); + // stashprogressget(); + // let buffer=!isNaN(Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0 + // buffer=100-buffer + setTimeout(() => { this.progressdownload =!isNaN(Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0;} , 100); + // setTimeout(() => { this.progressdownload =!isNaN((Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0); }, 100); + + this.changeDetectorRefs.detectChanges(); + }); ///end of on init this.refresh(); + + console.log(this.userForm.get("league").value); + } refresh() { diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 3ab53f1..6ad485d 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,6 +1,16 @@

- {{ "PAGES.HOME.TITLE" | translate }} + +

+ + Welcome to Zombpoe
+ This is Zombpoe
+ You can do anything with Zombpoe,
+ Anything at all,
+ The only Limit...
+ is yourself!
+ +
From 4219eba3d0bde04108490896ca77778be8bafa8a Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Mon, 11 Nov 2019 00:32:50 -0700 Subject: [PATCH 3/5] Lots of UI fixes and local Storage! --- main.ts | 23 +- package.json | 2 + src/app/app.module.ts | 2 + .../displaylist/displaylist.component.html | 40 +- .../displaylist/displaylist.component.scss | 11 + src/app/displaylist/displaylist.component.ts | 462 ++++++++++++------ 6 files changed, 372 insertions(+), 168 deletions(-) diff --git a/main.ts b/main.ts index 3278c50..8a81e58 100644 --- a/main.ts +++ b/main.ts @@ -235,7 +235,10 @@ ipcMain.on("only-character-data", async (event, message) => { "Left! total-index= " + (stashurlsFull.length - x) ]); event.sender.send("ping-async-stash", response); - event.sender.send("ping-async-stashprogressbar",[ x, stashurlsFull.length]); + event.sender.send("ping-async-stashprogressbar", [ + x, + stashurlsFull.length + ]); // console.log(response); // console.log(responseArr[0].data) // for (let x = 0; x < stashurlsFull.length; x++) { @@ -315,9 +318,6 @@ ipcMain.on("only-character-data", async (event, message) => { // this.fullstashdata = biggestitemarrayever; }); - - - // force refresh are and others ipcMain.on("ping-async", async (event, message) => { console.log("hello"); @@ -581,7 +581,10 @@ ipcMain.on("ping-async", async (event, message) => { response, "got stash data" + "tab count " + Number(response.data.numTabs) ]); - event.sender.send("ping-async-stashprogressbar",[ 0, stashurlsFull.length]); + event.sender.send("ping-async-stashprogressbar", [ + 0, + stashurlsFull.length + ]); await sleep(10000); // get stash data let responseNumTabsTotal = response.data.numTabs; @@ -665,7 +668,10 @@ ipcMain.on("ping-async", async (event, message) => { "Left! total-index= " + (stashurlsFull.length - x) ]); event.sender.send("ping-async-stash", response); - event.sender.send("ping-async-stashprogressbar",[ x, stashurlsFull.length]); + event.sender.send("ping-async-stashprogressbar", [ + x, + stashurlsFull.length + ]); // console.log(response); // console.log(responseArr[0].data) // for (let x = 0; x < stashurlsFull.length; x++) { @@ -685,7 +691,10 @@ ipcMain.on("ping-async", async (event, message) => { // console.log(stashdatatemp); await sleep(1350); } - event.sender.send("ping-async-stashprogressbar",[ stashurlsFull.length, stashurlsFull.length]); + event.sender.send("ping-async-stashprogressbar", [ + stashurlsFull.length, + stashurlsFull.length + ]); event.sender.send( "ping-async", this.stashdata, diff --git a/package.json b/package.json index ad5545f..400c4cc 100644 --- a/package.json +++ b/package.json @@ -93,12 +93,14 @@ "@angular/material": "~8.2.3", "@ng-bootstrap/ng-bootstrap": "^5.1.2", "axios": "^0.19.0", + "chart.js": "^2.9.2", "cors": "^2.8.5", "electron-is-dev": "^1.1.0", "electron-log": "^3.0.8", "express": "^4.17.1", "hammerjs": "^2.0.8", "mat-table-exporter": "^1.2.2", + "ng2-charts": "^2.3.0", "ngx-cookie-service": "^2.2.0", "ngx-electron": "^2.1.1", "ngx-embed-video": "^1.0.4", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6b358d2..c34aaeb 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -45,6 +45,7 @@ import { MatTooltipModule, MatFormFieldModule } from "@angular/material"; +import { ChartsModule } from "ng2-charts"; import { ReactiveFormsModule } from "@angular/forms"; import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; // NG Translate @@ -94,6 +95,7 @@ export function HttpLoaderFactory(http: HttpClient) { ReactiveFormsModule, SharedModule, HomeModule, + ChartsModule, BrowserAnimationsModule, MatPaginatorModule, MatToolbarModule, diff --git a/src/app/displaylist/displaylist.component.html b/src/app/displaylist/displaylist.component.html index 426f1a3..549a71b 100644 --- a/src/app/displaylist/displaylist.component.html +++ b/src/app/displaylist/displaylist.component.html @@ -15,9 +15,12 @@ + -
+ + + + + +
+ + + +
+

@@ -149,10 +170,15 @@
-
{{networth}} +
{{networtharray[0].data[networtharray[0].data.length-1]}} Net Worth
- + +
+ diff --git a/src/app/displaylist/displaylist.component.scss b/src/app/displaylist/displaylist.component.scss index 7487394..db69f1d 100644 --- a/src/app/displaylist/displaylist.component.scss +++ b/src/app/displaylist/displaylist.component.scss @@ -93,3 +93,14 @@ th.mat-header-cell { .smaller { width: 1%; } + +.chart-container { + // position: relative; + // margin: auto; + height: 20vh; + width: 20vw; +} + +canvas { + // border: 1px solid purple; +} diff --git a/src/app/displaylist/displaylist.component.ts b/src/app/displaylist/displaylist.component.ts index 1ddb14f..bf6a184 100644 --- a/src/app/displaylist/displaylist.component.ts +++ b/src/app/displaylist/displaylist.component.ts @@ -6,8 +6,11 @@ import { ViewChild, ChangeDetectorRef } from "@angular/core"; +import { ChartDataSets, ChartOptions } from "chart.js"; +import { Color, Label } from "ng2-charts"; +import { BaseChartDirective } from "ng2-charts/ng2-charts"; import { PoeninjaapiService, CharacterData } from "../poeninjaapi.service"; -import {MatProgressBarModule} from '@angular/material' +import { MatProgressBarModule } from "@angular/material"; import { DataSource } from "@angular/cdk/table"; import { Sort, MatSort } from "@angular/material/sort"; import { NgForm, FormBuilder } from "@angular/forms"; @@ -174,15 +177,43 @@ interface Colour { styleUrls: ["./displaylist.component.scss"] }) export class DisplaylistComponent implements OnInit { + lineChartData: ChartDataSets[] = JSON.parse( + localStorage.getItem("networtharray") + ); + + lineChartLabels: Label[] = [ + JSON.parse(localStorage.getItem("networthlabels")) + ]; + + lineChartOptions = { + responsive: true + }; + + lineChartColors: Color[] = [ + { + borderColor: "rgba(255,99,132,1)", + backgroundColor: "rgba(255,99,132,0.2)", + hoverBackgroundColor: "rgba(255,99,132,0.4)", + hoverBorderColor: "rgba(255,99,132,1)" + } + ]; + + lineChartLegend = true; + lineChartPlugins = []; + lineChartType = "line"; + displayedColumnstester: string[]; - public progressdownload=0; - public progressleft; + public progressdownload = 0; + public progressleft = 99; currencyDataResponse; fragmentsDataResponse; oilsDataResponse; fossilsDataResponse; scarabsDataResponse; divsDataResponse; + chartArray; + networtharray = []; + networthlabels = []; resonatorsDataResponse; propheciesDataResponse; uniqueweaponsDataResponse; @@ -228,7 +259,7 @@ export class DisplaylistComponent implements OnInit { uniqueflaskDataResponseTableSource = new MatTableDataSource(); //flask essenceDataResponseTableSource = new MatTableDataSource(); //essence incubatorDataResponseTableSource = new MatTableDataSource(); //essence - fullstashDataResponseSource = new MatTableDataSource(); + fullstashDataResponseSource = new MatTableDataSource(); //stash currenttablesource = new MatTableDataSource(); // storage for filter test // public itemlist:any; sortedData: PoeNinjaItemData[]; @@ -270,7 +301,12 @@ export class DisplaylistComponent implements OnInit { // ]; default: string = "Blight"; userForm = new FormGroup({ - POESESSID: new FormControl("***Replace***", Validators.maxLength(32)), + POESESSID: new FormControl( + localStorage.getItem("POESESSID") != null + ? localStorage.getItem("POESESSID") + : "***REPLACE***", + Validators.maxLength(32) + ), accountName: new FormControl("qqazraelz", Validators.required), characterName: new FormControl("Not Used Yet", Validators.maxLength(25)), league: new FormControl("Blight") @@ -951,6 +987,27 @@ export class DisplaylistComponent implements OnInit { // console.log(this.currenttablesource); } + clearLocalStorage() { + console.log("clearing LocalStorage"); + try { + localStorage.clear(); + console.log("LocalStorage cleared"); + } catch (err) { + console.log("couldnt clear? error:", err); + } + } + onloaddatabutton() { + if (JSON.parse(localStorage.getItem("bigstasharray"))) { + this.fullstashDataResponseSource = new MatTableDataSource( + JSON.parse(localStorage.getItem("bigstasharray")) + ? JSON.parse(localStorage.getItem("bigstasharray")) + : null + ); + this.fullstashDataResponseSource.paginator = this.paginatorstash; + this.fullstashDataResponseSource.sort = this.sortstash; + } + this.changeDetectorRefs.detectChanges(); + } forceRefresh() { console.log("Play"); @@ -963,12 +1020,189 @@ export class DisplaylistComponent implements OnInit { } this._electronService.ipcRenderer.on("ping-async-stash", (event, resp) => { console.log(resp); - }); //Update the progress bar - - + let localstorageAccountData = JSON.parse( + localStorage.getItem("AccountData") + ); + localStorage.setItem("POESESSID", this.userForm.get("POESESSID").value); + this._electronService.ipcRenderer.send("ping-async", [ + // localStorage.length > 0 + // ? localstorageAccountData.POESESSID + this.userForm.get("POESESSID").value, + // localStorage.length > 0 + // ? localstorageAccountData.accountName + this.userForm.get("accountName").value, + // localStorage.length > 0 + // ? localstorageAccountData.accountName + this.userForm.get("league").value + // this.userForm.get("worthCutoff").value + + // this.userForm.get("league").value + ]); // get us data + } + + onStashesOnlySubmit(): void { + if (this._electronService.isElectronApp) { + // We have access to node process. + this.versions.node = this._electronService.process.versions.node; + this.versions.chrome = this._electronService.process.versions.chrome; + this.versions.electron = this._electronService.process.versions.electron; + console.log(this.versions, "versions"); + } + this._electronService.ipcRenderer.on("ping-async-stash", (event, resp) => { + console.log(resp); + }); + + this._electronService.ipcRenderer.send("only-character-data", [ + // localStorage.length > 0 + // ? localstorageAccountData.POESESSID + this.userForm.get("POESESSID").value, + // localStorage.length > 0 + // ? localstorageAccountData.accountName + this.userForm.get("accountName").value, + // localStorage.length > 0 + // ? localstorageAccountData.accountName + this.userForm.get("league").value + // this.userForm.get("league").value + //add new values here like tab # or a list of user specified tabs + ]); // get us data + + this._electronService.ipcRenderer.on("ping-async", (event, resp, resp2) => { + // prints "pong" + console.log(resp, resp2); + + let bigboyarray2 = []; + if (resp2) { + for (let x = 0; x < resp2.length; x++) { + // console.log(resp3[x].data.items); + if (resp2[x].data.items) { + bigboyarray2.push(resp2[x].data.items); + } + } + } + let bigarrayconcat = [].concat(bigboyarray2); + let biggestitemarrayever = []; + for (var i = 0; i < bigarrayconcat.length; ++i) { + for (var j = 0; j < bigarrayconcat[i].length; ++j) + biggestitemarrayever.push(bigarrayconcat[i][j]); + } + this.fullstashdataBigBoiArray = biggestitemarrayever; + + // this.itemheadersTest2 = Object.keys(resp2[3].lines[0]); // get all headers + // console.log(this.itemheadersTest2); + // for (let entry of this.stashdatarequest) { + // console.log(entry, "items"); + // } + // console.log(resp2[0].lines, "Currency?"); + console.log(this.stashdatarequest, "stashData Request"); + + // let stashdatasourceitems = resp.items; + this.stashdatasource = new MatTableDataSource(resp); + // this.stashItems2 = new MatTableDataSource(stashdatasourceitems); + + this.refresh(); // makes the display look for changes aka our new data + }); + } + + getuserName(): any { + return this.userForm.get("name"); + } + setResetName() { + this.POESESSID.reset(); + this.accountName.reset(); + this.characterform.reset(); + } + changeValue() { + console.log(this.POESESSID.value); + console.log(this.accountName.value); + console.log(this.characterform.value); + + this.POESESSID = new FormControl(!this.POESESSID.value); + this.accountName = new FormControl(!this.accountName.value); + this.characterform = new FormControl(!this.characterform.value); + } + + updateName() { + console.log(this.POESESSID.value); + console.log(this.accountName.value); + } + // stashprogressget(){ + // return this.progressdownload; + // } + + // stashprogressset(resp){ + // this.progressdownload = !isNaN(Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0; + // } + + ngOnInit() { + // var storedLabels = JSON.parse(localStorage.getItem("networthlabels")); + // for (let i = storedLabels; i >= 0; i--) { + // this.lineChartLabels.push(storedLabels[i]); + // } + // console.log(storedLabels); + // this.fullJSON.parse(localStorage.getItem("bigstasharray")); + + let storedNetworth = JSON.parse(localStorage.getItem("networtharray")); + let storedLabels = JSON.parse(localStorage.getItem("networthlabels")); + console.log(storedNetworth, "networtharray"); + console.log(storedLabels, "networthlabels"); + this.networtharray = storedNetworth; + this.networthlabels = storedLabels; + // console.log(this.chartArray); + this.pingresponsesetter(); + // this.forceRefresh(); // run the button + // let testersss = [0, 10, 20, 30, 40, 50, 60, 70, 80]; + // localStorage.setItem("tester", JSON.stringify(testersss)); + + // console.log("Before"); + // console.log( + // JSON.parse(localStorage.getItem("networtharray")), + // "stored net worth" + // ); + // console.log( + // JSON.parse(localStorage.getItem("networthlabels")), + // "stored net worth labels" + // ); + + // console.log(storedNetworth); + let derplist; + this._electronService.ipcRenderer.on( + "ping-async-stashprogressbar", + (event, resp) => { + // console.log(resp,"ping-async-stashprogressbar"); + // stashprogressset(resp); + // stashprogressget(); + // let buffer = !isNaN(Math.round((resp[0] / resp[1]) * 100)) + // ? Math.round((resp[0] / resp[1]) * 100) + // : 100; + // buffer = 100 - buffer; + // console.log(buffer); + setTimeout(() => { + this.progressdownload = !isNaN(Math.round((resp[0] / resp[1]) * 100)) + ? Math.round((resp[0] / resp[1]) * 100) + : 0; + // this.progressleft = 99; + }, 100); + // setTimeout(() => { this.progressdownload =!isNaN((Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0); }, 100); + + this.changeDetectorRefs.detectChanges(); + } + ); + ///end of on init + this.refresh(); + + console.log(this.userForm.get("league").value); + // this.changeDetectorRefs.detectChanges(); + this.onloaddatabutton(); // loads the old stash data + } + + refresh() { + this.changeDetectorRefs.detectChanges(); + } + + pingresponsesetter() { this._electronService.ipcRenderer.on( "ping-async", (event, resp, resp2, resp3) => { @@ -1013,6 +1247,7 @@ export class DisplaylistComponent implements OnInit { console.log(biggestpoeninjarrayever, "biggestpoeninjarrayever"); console.log(this.fullstashdataBigBoiArray, "Big Boi"); + this.networth = 0; for (let x = 0; x < this.fullstashdataBigBoiArray.length; x++) { // console.log(this.fullstashdataBigBoiArray[x], "before push"); let worthpush = this.worthfinder2(this.fullstashdataBigBoiArray[x]); @@ -1029,15 +1264,68 @@ export class DisplaylistComponent implements OnInit { this.fullstashdataBigBoiArray[x].worth.toString() ).toFixed(3) ); + // console.log(this.fullstashdataBigBoiArray[x], "afterpush"); } + // let testersss = [0, 10, 20, 30, 40, 50, 60, 70, 80]; + this.networtharray = JSON.parse(localStorage.getItem("networtharray")); + + if (this.networtharray == null) { + this.networtharray = [{ data: [this.networth], label: Date() }]; + } else { + this.networtharray[0].data.push(this.networth); + // this.networtharray[0].label.push(Date()); + } + this.networthlabels = JSON.parse( + localStorage.getItem("networthlabels") + ); + if (this.networthlabels == null) { + this.networthlabels = [this.networth]; + } else { + this.networthlabels.push(this.networth); + } + + // this.lineChartLabels = [""]; + + // for (let i = 0; i < this.networtharray[0].label.length; i++) { + // this.lineChartLabels.push(this.networtharray[i].label); + // } + localStorage.setItem( + "networtharray", + JSON.stringify(this.networtharray) + ); + localStorage.setItem( + "networthlabels", + JSON.stringify(this.networthlabels) + ); + let storedNetworth = JSON.parse(localStorage.getItem("networtharray")); + let storedLabels = JSON.parse(localStorage.getItem("networthlabels")); + console.log(storedNetworth, "networtharray"); + console.log(storedLabels, "networthlabels"); + // this.networtharray = storedNetworth; + // this.networthlabels = storedLabels; this.fullstashDataResponseSource = new MatTableDataSource( this.fullstashdataBigBoiArray ); - this.fullstashDataResponseSource.paginator = this.paginatorstash; this.fullstashDataResponseSource.sort = this.sortstash; + localStorage.setItem( + "bigstasharray", + JSON.stringify(this.fullstashdataBigBoiArray) + ); + // localStorage.setItem( + // "stashpaginator", + // JSON.stringify(this.paginatorstash) + // ); + // localStorage.setItem( + // "stashsort", + // JSON.stringify(this.sortstash) + // ); + // localStorage.setItem( + // "stashtablesource", + // JSON.stringify(this.fullstashDataResponseSource) + // ); this.stashdatarequest = resp; this.currencyDataResponse = resp2[0].data; // currency this.fragmentsDataResponse = resp2[1].data; //frag @@ -1116,156 +1404,22 @@ export class DisplaylistComponent implements OnInit { // console.log(this.derpcolums); // console.log(resp2); console.log(this.fullPoeNinjaResponse, "Full Response"); + // if (resp.items) { + // let stashdatasourceitems = resp.items; + // } + if (resp) { + this.stashdatasource = new MatTableDataSource(resp); + } else { + console.warn("no Stash data"); + } - let stashdatasourceitems = resp.items; - this.stashdatasource = new MatTableDataSource(resp); // this.stashItems2 = new MatTableDataSource(stashdatasourceitems); - this.arrayOfKeys = Object.keys(this.stashdatarequest); - this.stashitemOBJ = Object; - this.stashitemOBJ = this.stashdatarequest; + // this.arrayOfKeys = Object.keys(this.stashdatarequest); + // this.stashitemOBJ = Object; + // this.stashitemOBJ = this.stashdatarequest; this.refresh(); // makes the display look for changes aka our new data } ); - - let localstorageAccountData = JSON.parse( - localStorage.getItem("AccountData") - ); - - this._electronService.ipcRenderer.send("ping-async", [ - // localStorage.length > 0 - // ? localstorageAccountData.POESESSID - this.userForm.get("POESESSID").value, - // localStorage.length > 0 - // ? localstorageAccountData.accountName - this.userForm.get("accountName").value, - // localStorage.length > 0 - // ? localstorageAccountData.accountName - this.userForm.get("league").value - // this.userForm.get("worthCutoff").value - - // this.userForm.get("league").value - ]); // get us data - } - - onStashesOnlySubmit(): void { - if (this._electronService.isElectronApp) { - // We have access to node process. - this.versions.node = this._electronService.process.versions.node; - this.versions.chrome = this._electronService.process.versions.chrome; - this.versions.electron = this._electronService.process.versions.electron; - console.log(this.versions, "versions"); - } - this._electronService.ipcRenderer.on("ping-async-stash", (event, resp) => { - console.log(resp); - }); - - this._electronService.ipcRenderer.send("only-character-data", [ - // localStorage.length > 0 - // ? localstorageAccountData.POESESSID - this.userForm.get("POESESSID").value, - // localStorage.length > 0 - // ? localstorageAccountData.accountName - this.userForm.get("accountName").value, - // localStorage.length > 0 - // ? localstorageAccountData.accountName - this.userForm.get("league").value - // this.userForm.get("league").value - //add new values here like tab # or a list of user specified tabs - ]); // get us data - - this._electronService.ipcRenderer.on("ping-async", (event, resp, resp2) => { - // prints "pong" - console.log(resp, resp2); - - let bigboyarray2 = []; - if (resp2) { - for (let x = 0; x < resp2.length; x++) { - // console.log(resp3[x].data.items); - if (resp2[x].data.items) { - bigboyarray2.push(resp2[x].data.items); - } - } - } - let bigarrayconcat = [].concat(bigboyarray2); - let biggestitemarrayever = []; - for (var i = 0; i < bigarrayconcat.length; ++i) { - for (var j = 0; j < bigarrayconcat[i].length; ++j) - biggestitemarrayever.push(bigarrayconcat[i][j]); - } - this.fullstashdataBigBoiArray = biggestitemarrayever; - - // this.itemheadersTest2 = Object.keys(resp2[3].lines[0]); // get all headers - // console.log(this.itemheadersTest2); - // for (let entry of this.stashdatarequest) { - // console.log(entry, "items"); - // } - // console.log(resp2[0].lines, "Currency?"); - console.log(this.stashdatarequest, "stashData Request"); - - // let stashdatasourceitems = resp.items; - this.stashdatasource = new MatTableDataSource(resp); - // this.stashItems2 = new MatTableDataSource(stashdatasourceitems); - - this.refresh(); // makes the display look for changes aka our new data - }); - } - - getuserName(): any { - return this.userForm.get("name"); - } - setResetName() { - this.POESESSID.reset(); - this.accountName.reset(); - this.characterform.reset(); - } - changeValue() { - console.log(this.POESESSID.value); - console.log(this.accountName.value); - console.log(this.characterform.value); - - this.POESESSID = new FormControl(!this.POESESSID.value); - this.accountName = new FormControl(!this.accountName.value); - this.characterform = new FormControl(!this.characterform.value); - } - - updateName() { - console.log(this.POESESSID.value); - console.log(this.accountName.value); - } -// stashprogressget(){ -// return this.progressdownload; -// } - -// stashprogressset(resp){ -// this.progressdownload = !isNaN(Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0; -// } - - ngOnInit() { - // this.forceRefresh(); // run the button - - console.log("Before"); - - let derplist; -this._electronService.ipcRenderer.on("ping-async-stashprogressbar", (event, resp) => { - // console.log(resp,"ping-async-stashprogressbar"); - // stashprogressset(resp); - // stashprogressget(); - // let buffer=!isNaN(Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0 - // buffer=100-buffer - setTimeout(() => { this.progressdownload =!isNaN(Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0;} , 100); - // setTimeout(() => { this.progressdownload =!isNaN((Math.round((resp[0] / resp[1]) * 100))?Math.round((resp[0] / resp[1]) * 100):0); }, 100); - - this.changeDetectorRefs.detectChanges(); - }); - ///end of on init - this.refresh(); - - console.log(this.userForm.get("league").value); - - } - - refresh() { - this.changeDetectorRefs.detectChanges(); } } interface poeNinjaFullResponseInterface { From ee6ed2afcfe43f23f3352bdf4e0ef2992b30398f Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Mon, 11 Nov 2019 13:53:35 -0700 Subject: [PATCH 4/5] still need to fix graph. updated version 0.0.5b --- package.json | 3 ++- src/app/displaylist/displaylist.component.ts | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 400c4cc..837834c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zombpoe", - "version": "0.0.5a", + "version": "0.0.5b", "description": "Path of exile poe.ninja and stash program Angular 8 with Electron (Typescript + SASS + Hot Reload)", "homepage": "https://github.com/zombodotcom/Zombpoe", "author": { @@ -62,6 +62,7 @@ "codelyzer": "5.1.0", "conventional-changelog-cli": "2.0.21", "core-js": "3.1.4", + "devtron": "^1.4.0", "electron": "6.0.10", "electron-builder": "21.2.0", "electron-reload": "1.5.0", diff --git a/src/app/displaylist/displaylist.component.ts b/src/app/displaylist/displaylist.component.ts index bf6a184..aa75f3f 100644 --- a/src/app/displaylist/displaylist.component.ts +++ b/src/app/displaylist/displaylist.component.ts @@ -1271,7 +1271,7 @@ export class DisplaylistComponent implements OnInit { this.networtharray = JSON.parse(localStorage.getItem("networtharray")); if (this.networtharray == null) { - this.networtharray = [{ data: [this.networth], label: Date() }]; + this.networtharray = [{ data: [this.networth], label: "net Worth" }]; } else { this.networtharray[0].data.push(this.networth); // this.networtharray[0].label.push(Date()); @@ -1280,9 +1280,9 @@ export class DisplaylistComponent implements OnInit { localStorage.getItem("networthlabels") ); if (this.networthlabels == null) { - this.networthlabels = [this.networth]; + this.networthlabels = [[this.networth]]; } else { - this.networthlabels.push(this.networth); + this.networthlabels.push([this.networth]); } // this.lineChartLabels = [""]; @@ -1314,6 +1314,10 @@ export class DisplaylistComponent implements OnInit { "bigstasharray", JSON.stringify(this.fullstashdataBigBoiArray) ); + // localStorage.setItem( + // "biggestpoeninjarrayever", + // JSON.stringify(biggestpoeninjarrayever) + // ); // localStorage.setItem( // "stashpaginator", // JSON.stringify(this.paginatorstash) From e969a9f1a9c5689c57c54112f31db9948d9027ea Mon Sep 17 00:00:00 2001 From: zombodotcom Date: Tue, 12 Nov 2019 12:40:11 -0700 Subject: [PATCH 5/5] updated some stuff --- .../displaylist/displaylist.component.html | 5 +++ src/app/displaylist/displaylist.component.ts | 41 ++++++++++++++++--- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/app/displaylist/displaylist.component.html b/src/app/displaylist/displaylist.component.html index 549a71b..8db4730 100644 --- a/src/app/displaylist/displaylist.component.html +++ b/src/app/displaylist/displaylist.component.html @@ -67,6 +67,11 @@ --> + + + diff --git a/src/app/displaylist/displaylist.component.ts b/src/app/displaylist/displaylist.component.ts index aa75f3f..41080a2 100644 --- a/src/app/displaylist/displaylist.component.ts +++ b/src/app/displaylist/displaylist.component.ts @@ -8,7 +8,7 @@ import { } from "@angular/core"; import { ChartDataSets, ChartOptions } from "chart.js"; import { Color, Label } from "ng2-charts"; -import { BaseChartDirective } from "ng2-charts/ng2-charts"; +import { BaseChartDirective } from "ng2-charts"; import { PoeninjaapiService, CharacterData } from "../poeninjaapi.service"; import { MatProgressBarModule } from "@angular/material"; import { DataSource } from "@angular/cdk/table"; @@ -290,6 +290,7 @@ export class DisplaylistComponent implements OnInit { itemsearchtest = new FormGroup({ itemsearchstring: new FormControl("Enter Item", Validators.maxLength(100)) }); + // leagues: string[] = [ // "Standard", // "Hardcore", @@ -396,6 +397,7 @@ export class DisplaylistComponent implements OnInit { ]; // Sorters + @ViewChild("MatSortcurrency", { static: false }) sortcurrency: MatSort; @ViewChild("MatSortfrag", { static: false }) sortfrag: MatSort; @ViewChild("MatSortoil", { static: false }) sortoil: MatSort; @@ -434,6 +436,7 @@ export class DisplaylistComponent implements OnInit { @ViewChild("paginatorproph", { static: false }) paginatorproph: MatPaginator; @ViewChild("paginatorjewel", { static: false }) paginatorjewel: MatPaginator; @ViewChild("paginatorflask", { static: false }) paginatorflask: MatPaginator; + @ViewChild("paginatoressence", { static: false }) paginatoressence: MatPaginator; @ViewChild("paginatorincubator", { static: false }) @@ -538,6 +541,29 @@ export class DisplaylistComponent implements OnInit { // console.log('tab => ', event); } + @ViewChild(BaseChartDirective, { static: false }) chart: BaseChartDirective; + + refresh_chart() { + // this.chart.ngOnChanges({}); + + // let storedNetworth = JSON.parse(localStorage.getItem("networtharray")); + // let storedLabels = JSON.parse(localStorage.getItem("networthlabels")); + // console.log(storedNetworth, "networtharray"); + // console.log(storedLabels, "networthlabels"); + // this.networtharray = storedNetworth; + // this.networthlabels = storedLabels; + if (this.chart) { + this.chart.chart.config.data.labels = this.networthlabels; + this.chart.chart.update(); + + setTimeout(() => { + if (this.chart && this.chart.chart && this.chart.chart.config) { + this.chart.chart.config.data.labels = this.networthlabels; + this.chart.chart.update(); + } + }, 100); + } + } _setDataSource(indexNumber) { setTimeout(() => { switch (indexNumber) { @@ -1155,7 +1181,7 @@ export class DisplaylistComponent implements OnInit { // this.forceRefresh(); // run the button // let testersss = [0, 10, 20, 30, 40, 50, 60, 70, 80]; // localStorage.setItem("tester", JSON.stringify(testersss)); - + // this.refresh_chart(); // console.log("Before"); // console.log( // JSON.parse(localStorage.getItem("networtharray")), @@ -1200,6 +1226,7 @@ export class DisplaylistComponent implements OnInit { refresh() { this.changeDetectorRefs.detectChanges(); + // this.refresh_chart(); } pingresponsesetter() { @@ -1273,16 +1300,19 @@ export class DisplaylistComponent implements OnInit { if (this.networtharray == null) { this.networtharray = [{ data: [this.networth], label: "net Worth" }]; } else { - this.networtharray[0].data.push(this.networth); + this.networtharray[0].data.push({ + data: [this.networth], + label: Date() + }); // this.networtharray[0].label.push(Date()); } this.networthlabels = JSON.parse( localStorage.getItem("networthlabels") ); if (this.networthlabels == null) { - this.networthlabels = [[this.networth]]; + this.networthlabels = [Date()]; } else { - this.networthlabels.push([this.networth]); + this.networthlabels.push(Date()); } // this.lineChartLabels = [""]; @@ -1411,6 +1441,7 @@ export class DisplaylistComponent implements OnInit { // if (resp.items) { // let stashdatasourceitems = resp.items; // } + // this.refresh_chart(); if (resp) { this.stashdatasource = new MatTableDataSource(resp); } else {