Verified Commit afb6935f authored by rakshazi's avatar rakshazi

version 1.0.1

parent a7dda9b9
# 1.0.1
* Restrict import/export only for supported by WarcraftLogs and Raider.IO raids (Legion and up)
* Added changelog
# 1.0.0 Gehennas
**Linux amd64**: [wrbt](/uploads/9cbb661e8c8d236869c9a21177b22437/wrbt) (sha256: c8497f4383764deeef0507be29363f7ce6b34da2990588ff83a7328d923b16dc)
Initial release
1. Grabs guilds from [Raider.IO](https://raider.io) raid progression API _Special thanks to Ludicrous Speed! Guys, you did awesome service!_
2. Grabs reports list for each guild from [Warcraft Logs](https://www.warcraftlogs.com/) API _Special thanks to Kihra! Without you a lot of things in WoW would be much worse!_
3. Parses each report from list (Warcraft Logs API) and gets boss kills/wipes (global counters for each boss/difficulty)
4. Grabs boss info (npc id, name, raid name) from Warcraft Logs API.
5. Export merged data to json
PS: [Gehennas](https://wowhead.com/npc=12259/) is the third boss of Molten Core.
......@@ -98,7 +98,8 @@ func calculate(reports chan *wl.Report, done chan bool) {
continue
}
for _, fight := range report.Fights {
if fight.Boss == 0 || fight.Difficulty == 1 || fight.Difficulty == 10 {
supported := tx.Bucket([]byte("metadatata")).Get(int2byte(fight.Boss)) //Check if we have metadata for that boss
if fight.Boss == 0 || supported == nil || fight.Difficulty == 1 || fight.Difficulty == 10 {
// Thrash fight or LFR or dungeon, ignore it.
continue
}
......
......@@ -6,6 +6,7 @@ import (
"strconv"
api "gitlab.com/rakshazi/warcraftlogs-api"
rio "gitlab.com/wowdata/wrbt/raiderio"
wl "gitlab.com/wowdata/wrbt/warcraftlogs"
bolt "go.etcd.io/bbolt"
)
......@@ -17,11 +18,26 @@ type Meta struct {
ZoneName string
}
//Convert int to byte array
// List of suported raids
var raids = append(rio.Raids, []string{
"Emerald Nightmare",
}...)
// Convert int to byte array
func int2byte(in int) []byte {
return []byte(strconv.Itoa(in))
}
// Check if raid is supported
func isRaidSupported(name string) bool {
for _, raid := range raids {
if name == raid {
return true
}
}
return false
}
// Collect metadata from WarcraftLogs API /zones
func runMetadata() {
var meta = make(chan *api.Zone)
......@@ -31,9 +47,11 @@ func runMetadata() {
}
func saveMetadata(meta chan *api.Zone, done chan bool) {
var total int //Total items in db
var count int //New items
for zone := range meta {
if isRaidSupported(zone.Name) == false {
continue
}
tx, err := db.Begin(true)
if err != nil {
log.Println("Cannot start transaction to save metadata")
......@@ -63,6 +81,7 @@ func saveMetadata(meta chan *api.Zone, done chan bool) {
}
if err := bucket.Put(int2byte(boss.Id), value); err != nil {
log.Println("Cannot save metadata to db", boss.Id, boss.Name, err)
continue
}
count++
}
......@@ -71,6 +90,7 @@ func saveMetadata(meta chan *api.Zone, done chan bool) {
done <- true
}
}
var total int //Total items in db
db.View(func(tx *bolt.Tx) error {
tx.Bucket([]byte("metadata")).ForEach(func(k, v []byte) error {
total++
......
......@@ -9,7 +9,7 @@ var Raids = []string{
"Tomb of Sargeras",
"The Emerald Nightmare",
"The Nighthold",
"Antorus, the Burning Throne",
"Antorus, The Burning Throne",
"Trial of Valor",
}
......
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