Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #32 from zombodotcom/zombpoe-post-0.0.6
Browse files Browse the repository at this point in the history
Zombpoe post 0.0.6 3.9 Update
  • Loading branch information
zombodotcom authored Dec 14, 2019
2 parents 35e924d + f907533 commit 6c1e6e7
Show file tree
Hide file tree
Showing 6 changed files with 711 additions and 67 deletions.
194 changes: 174 additions & 20 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ interface Colour {
// ]);
// Menu.setApplicationMenu(menu);

// const { app, autoUpdater } = require("electron");
// const server = "hazel-i9aodbuhq.now.sh";
// const feed = `${server}/update/${process.platform}/${app.getVersion()}`;

const ipcMain = require("electron").ipcMain;
const { session } = require("electron");
let responsedata;
Expand Down Expand Up @@ -346,12 +350,14 @@ ipcMain.on("ping-async", async (event, message) => {
console.log("hello");
let sessionid = message[0];
let accountName = message[1];
let league = message[2].split(" ").join("+");
// let league = message[2].split(" ").join("+");
let league = message[2];
// let currencyCutoff = message[3];
event.sender.send("ping-async-stash", [
"Starting",
accountName,
league
league,
message[2]
// currencyCutoff
]);
// const { net } = require("electron");
Expand Down Expand Up @@ -381,25 +387,36 @@ ipcMain.on("ping-async", async (event, message) => {
// console.log(message);
//TODO
// get the number of tabs, concat the response data
let urls: string[] = [
"https://www.pathofexile.com/character-window/get-stash-items?league=" +
message[2] +
"&accountName=qqazraelz&tabs=1&tabIndex=1",
"https://www.pathofexile.com/character-window/get-stash-items?league=" +
message[2] +
"&accountName=qqazraelz&tabs=1&tabIndex=2"
];

// let urls: string[] = [
// "https://www.pathofexile.com/character-window/get-stash-items?league=" +
// message[2] +
// "&accountName=qqazraelz&tabs=1&tabIndex=1",
// "https://www.pathofexile.com/character-window/get-stash-items?league=" +
// message[2] +
// "&accountName=qqazraelz&tabs=1&tabIndex=2"
// ];
let poeninjaleaguename = message[2];
if (poeninjaleaguename.includes("SSF Metamorph HC")){
poeninjaleaguename="Metamorph";
}
if (poeninjaleaguename.includes("SSF ")) {
poeninjaleaguename = poeninjaleaguename.replace("SSF ", "");
}
if (poeninjaleaguename == "Hardcore Metamorph") {
poeninjaleaguename = "Metamorph";
}

console.log(message[2],poeninjaleaguename)
// 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=" +
encodeURI(message[2]) +
encodeURI(poeninjaleaguename) +
"&type=";
let urlendings: string[] = [
"Currency", // currency has currencyoveriew and Itemoveriew updated
"https://poe.ninja/api/data/currencyoverview?league=" +
encodeURI(message[2]) +
encodeURI(poeninjaleaguename) +
"&type=Fragment", //currency is different url
"Oil",
"Fossil",
Expand All @@ -413,7 +430,8 @@ ipcMain.on("ping-async", async (event, message) => {
"UniqueArmour",
"UniqueAccessory",
"UniqueFlask",
"Incubator"
"Incubator",
"SkillGem"
];

let poeNinjaResponseArray;
Expand All @@ -432,11 +450,13 @@ ipcMain.on("ping-async", async (event, message) => {
let uniqueflaskDataResponse;
let incubatorDataResponse;
let essenceDataResponse;
let skillgemDataResponse;
let stashdata;

event.sender.send("ping-async-stash", [
"getting poeninja data,",
accountName,
encodeURI(message[2])
encodeURI(poeninjaleaguename)
// currencyCutoff
]);
await axios
Expand All @@ -455,7 +475,8 @@ ipcMain.on("ping-async", async (event, message) => {
axios.get(baseURL + urlendings[11]), //uniquearmours
axios.get(baseURL + urlendings[12]), //uniqueaccessory
axios.get(baseURL + urlendings[13]), //UniqueFlask
axios.get(baseURL + urlendings[14]) //incubator
axios.get(baseURL + urlendings[14]), //incubator
axios.get(baseURL + urlendings[15]) //Skill Gems
])
// .catch(e => {
// console.log("Error: ", e.response.data);
Expand All @@ -479,6 +500,7 @@ ipcMain.on("ping-async", async (event, message) => {
this.uniqueaccessoriesDataResponse = responseArr[12].data; //access
this.uniqueflaskDataResponse = responseArr[13].data; //flask
this.incubatorDataResponse = responseArr[14].data; //incubator
this.skillgemDataResponse = responseArr[15].data; //skillgem
// console.log("Fragments: ", responseArr[1].data);
// console.log("Oils: ", responseArr[2].data);
// console.log("Fossils: ", responseArr[3].data);
Expand Down Expand Up @@ -508,7 +530,8 @@ ipcMain.on("ping-async", async (event, message) => {
responseArr[11].data,
responseArr[12].data,
responseArr[13].data,
responseArr[14].data
responseArr[14].data,
responseArr[15].data
]; //Changedd to .data
})
.catch(e => {
Expand All @@ -518,11 +541,10 @@ ipcMain.on("ping-async", async (event, message) => {
"error in poeninja data"
]);
});
event.sender.send(
"ping-async-stash",
event.sender.send("ping-async-stash", [
"backend poedata going to sleep for 2 seconds now",
this.poeNinjaResponseArray
);
]);
await sleep(2000);
// .then(
// axios.spread(function(resp2, reposResponse) {
Expand Down Expand Up @@ -793,6 +815,138 @@ ipcMain.on("ping-sync", (event, message) => {
event.returnValue = message;
});

ipcMain.on("get-stash-names", async (event, message) => {
console.log("hello");
let sessionid = message[0];
let accountName = message[1];
let league = message[2].split(" ").join("+");
// let currencyCutoff = message[3];
event.sender.send("ping-async-stash", [
"Starting",
accountName,
league,
message[2]
// currencyCutoff
]);

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=1&tabIndex=1",
{
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);
// // message = response.data as RootObject;
// let stashdatatemp = [];
// this.stashdata = response.data;
event.sender.send("get-stash-names", [response.data, "got stash data"]);
// event.sender.send("ping-async-stashprogressbar", [
// 0,
// stashurlsFull.length
// ]);
// 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 < Number(responseNumTabsTotal); 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 (Number(responseNumTabsTotal) > 40) {
// stashtotaltoget = 40;
// responseNumTabsTotal = 40;
// }
// console.log(responseNumTabsTotal, stashtotaltoget);
// console.log(stashurlsFull);
// // get all stash data
// let promisesurls = [];
// 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);
// event.sender.send("ping-async-stashprogressbar", [
// x,
// stashurlsFull.length
// ]);
// })
// .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,
// this.poeNinjaResponseArray,
// stashdatatemp
// );
})
.catch(e => {
console.log("Error: ", e.response.data);
// console.log("pathofexile.com Probably Down....");
event.sender.send("get-stash-names", [
e.response.data,
"get stash names error?"
]);
event.sender.send("get-stash-names", null);
});
});

// import { PythonShell } from "python-shell";
let win, serve;
const args = process.argv.slice(1);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zombpoe",
"version": "0.0.6",
"version": "0.0.7",
"description": "Path of exile poe.ninja and stash program Angular 8 with Electron (Typescript + SASS + Hot Reload)",
"homepage": "https://github.com/zombodotcom/Zombpoe",
"author": {
Expand Down
8 changes: 8 additions & 0 deletions src/app/displaylist/dev.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "X:\\angularapps\\gits\\Zombpoe"
}
],
"settings": {}
}
Loading

0 comments on commit 6c1e6e7

Please sign in to comment.