Original post and credits go to smby:
Hi I wrote super messy golang code that will read the "pickit_log.txt" file and it will parse all the information in it every 10 seconds and display the information on a webserver. It must be ran from the same directory as the pickit_log.txt file.
the text file currently looks like
and the webserver will display the items like this:
The webserver can be accessed by running the server and going to 127.0.0.1:8080 in a browser OR the local ip address:8080 from a computer on the same network.
Update: Here is an image of me viewing the drop log from my phone on the same network
The source code is in golang here:
The compiled exe can be downloaded here - the code not malicious but virustotal had 4/67 detection, this is what we refer to as false positive as you can compile this yourself and get the same result.
Once I get stats working when jieguan api is available, I am going to do something like this with the ability to search as well, eventually would like to get it to look like in game also view:
Hi I wrote super messy golang code that will read the "pickit_log.txt" file and it will parse all the information in it every 10 seconds and display the information on a webserver. It must be ran from the same directory as the pickit_log.txt file.
the text file currently looks like
Code:
[2022-05-15 02:46:28] Kept: Magefist Light Gauntlets - Area: Catacombs Level 4 | Rule: [name]==lightgauntlets&&[quality]==unique&&[flag]!=ethereal#[enhanceddefense]>=10
[2022-05-15 02:46:29] Kept: Dwarf Star Ring - Area: Catacombs Level 4 | Rule: [type]==ring&&[quality]==unique#[maxhp]==40
[2022-05-15 03:06:34] Kept: Charged Essence of Hatred - Area: Durance of Hate Level 3 | Rule: [name]==chargedessenceofhatred
The webserver can be accessed by running the server and going to 127.0.0.1:8080 in a browser OR the local ip address:8080 from a computer on the same network.
Update: Here is an image of me viewing the drop log from my phone on the same network
The source code is in golang here:
Code:
package main
import (
"net/http"
"text/template"
"os"
"io/ioutil"
"strings"
"time"
"fmt"
)
type Context struct {
Title string
Items []FullItem
}
type FullItem struct{
Time string
Name string
Area string
}
func main() {
const htmlpage = `
<!DOCTYPE html>
<html>
<script>
function autoRefresh() {
window.location = window.location.href;
}
setInterval('autoRefresh()', 10000);
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
table, th, td {
border: 1px solid black;
}
table {
padding-right: 10px;
}
th, td {
padding-top: 2px;
padding-bottom: 2px;
padding-left: 10px;
padding-right: 10px;
}
.timestamp {
text-align: right;
}
.tableheader{
text-align: center;
}
</style>
<body>
<h3>Itemlist:</h3>
<table>
<tr>
<th class="tableheader">Time</th>
<th class="tableheader">Name</th>
<th class="tableheader">Area</th>
</tr>
{{range .Items}}
<tr>
<th class="timestamp">{{.Time}}</th>
<th>{{.Name}}</th>
<th>{{.Area}}</th>
</tr>
{{end}}
</ul>
</body>
</html>
`
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fileName := "pickit_log.txt"
Items := []FullItem{}
fileBytes, err := ioutil.ReadFile(fileName)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
lines := strings.Split(string(fileBytes), "\n")
for i := len(lines)-1; i >= 0; i-- {
line := lines[i]
if(len(line)<20) {
continue
}
timestamp := line[1:20]
parsed, _ := time.Parse("2006-01-02 15:04:05", timestamp)
restofdata:= line[27:len(line)]
importadata:= strings.SplitN(restofdata, "|", 2)
segmenteddata := strings.SplitN(importadata[0], "-", 2)
itemarea := segmenteddata[1]
itemname := segmenteddata[0]
newItem := FullItem{
Time: parsed.Format("15:04"), //24 hour format
//Time: parsed.Format("3:04 PM"), //12 hour AM/PM format
Name: itemname[1:len(itemname)],
Area: itemarea[7:len(itemarea)],
}
Items = append(Items, newItem)
}
w.Header().Add("Content Type", "text/html")
templates, _ := template.New("doc").Parse(htmlpage)
context := Context{
Title: "Item List",
Items: Items,
}
templates.Lookup("doc").Execute(w, context)
})
http.ListenAndServe(":8080", nil)
}
Once I get stats working when jieguan api is available, I am going to do something like this with the ability to search as well, eventually would like to get it to look like in game also view: