Skip to content

Commit

Permalink
NIP Improvements and some internal refactor on d2go library
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorgimenez committed May 8, 2024
1 parent dfa4eac commit ce38b91
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 31 deletions.
22 changes: 3 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,9 @@ All the .nip files contained in the pickit directory will be loaded, so you can

There are some considerations to take into account:
- If item fully matches the pickit rule before being identified, it will be picked up and stashed unidentified.
- If item doesn't match the full rule, will be identified and checked again, if fully matches a rule it will be stashed.
- There are some NIP properties that are **not implemented yet** and the bot will let you know during the startup process, please be sure to not use them:
- plusmindamage
- mindamage (Only working for items with no base damage like rings, amulets, armors, etc.)
- plusmaxdamage
- maxdamage (Only working for items with no base damage like rings, amulets, armors, etc.)
- enhanceddamage (Only working for items with no base damage like rings, amulets, armors, etc.)
- enhanceddefense (Only working for white bases and is not 100% accurate, avoid using it as much as possible)
- itemarmorpercent
- itemmindamagepercent
- itemslashdamage
- itemslashdamagepercent
- itemcrushdamage
- itemcrushdamagepercent
- itemthrustdamage
- itemthrustdamagepercent
- secondarymindamage
- secondarymaxdamage
- damagepercent
- If item doesn't match the full rule, will be identified and checked again, if fully matches a rule it will be stashed otherwise sold to vendor.
- If there is an error on the NIP file or Koolo can not understand it, the application will not start.
- Pickit rules can not be changed in runtime (yet), you will need to restart Koolo to apply changes.

## Development environment
**Note:** This is only required if you want to build the project from source. If you want to run the bot, you can just download the [latest release](https://github.com/hectorgimenez/koolo/releases).
Expand Down
9 changes: 6 additions & 3 deletions cmd/koolo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ package main

import (
"context"
"log"
"log/slog"
"os"

_ "net/http/pprof"

sloggger "github.com/hectorgimenez/koolo/cmd/koolo/log"
koolo "github.com/hectorgimenez/koolo/internal"
"github.com/hectorgimenez/koolo/internal/config"
Expand All @@ -13,9 +19,6 @@ import (
"github.com/hectorgimenez/koolo/internal/server"
"github.com/inkeliz/gowebview"
"golang.org/x/sync/errgroup"
"log"
"log/slog"
"os"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/beefsack/go-astar v0.0.0-20200827232313-4ecf9e304482
github.com/bwmarrin/discordgo v0.28.1
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
github.com/hectorgimenez/d2go v0.0.0-20240506013328-c03c40d385df
github.com/hectorgimenez/d2go v0.0.0-20240508141000-0c6a2c17ab48
github.com/inkeliz/gowebview v1.0.1
github.com/inkeliz/w32 v1.0.2
github.com/lxn/win v0.0.0-20210218163916-a377121e959e
Expand All @@ -18,7 +18,7 @@ require (

require (
git.wow.st/gmp/jni v0.0.0-20200827154156-014cd5c7c4c0 // indirect
github.com/expr-lang/expr v1.16.5 // indirect
github.com/expr-lang/expr v1.16.6 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/net v0.24.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ github.com/bwmarrin/discordgo v0.28.1 h1:gXsuo2GBO7NbR6uqmrrBDplPUx2T3nzu775q/Rd
github.com/bwmarrin/discordgo v0.28.1/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/expr-lang/expr v1.16.5 h1:m2hvtguFeVaVNTHj8L7BoAyt7O0PAIBaSVbjdHgRXMs=
github.com/expr-lang/expr v1.16.5/go.mod h1:uCkhfG+x7fcZ5A5sXHKuQ07jGZRl6J0FCAaf2k4PtVQ=
github.com/expr-lang/expr v1.16.6 h1:u1mrPXbwHtWAih5ZP24ZDG+ht8CB5xB0aBvagkAWPY0=
github.com/expr-lang/expr v1.16.6/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGiUaOtXxdrINDz1b0J1w0SzqDc=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/hectorgimenez/d2go v0.0.0-20240506013328-c03c40d385df h1:dVUf63WuvzO+uNnGiN9DjvuEPQkQZSmgCBZFVRgey1M=
github.com/hectorgimenez/d2go v0.0.0-20240506013328-c03c40d385df/go.mod h1:krdQsTiLKLhoESu3QWk+sGWM2PwiK8M3MEKNBJ07Bmg=
github.com/hectorgimenez/d2go v0.0.0-20240508141000-0c6a2c17ab48 h1:J/6uZ9JntBONIAVrmLWyOXNlIHmOFOxylnoLgr6slPE=
github.com/hectorgimenez/d2go v0.0.0-20240508141000-0c6a2c17ab48/go.mod h1:Y/3quEeywvdPMZ/OSFAwFBvJsJ7F/t7SX7/zcIb4XAE=
github.com/inkeliz/gowebview v1.0.1 h1:4gpLE2qt4kV3DB+xHkHKUeLLiGPN5Xw3or9A3hVqYyA=
github.com/inkeliz/gowebview v1.0.1/go.mod h1:4SNjXp/fogE11MwvJD67kMBmSObY2BBqinEgH8+8eM8=
github.com/inkeliz/w32 v1.0.2 h1:Es8Bmw9ApOY0PVRpGs7wsqIKdK5C3xBkP5TOATfVmtU=
Expand Down
4 changes: 2 additions & 2 deletions internal/action/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func (b *Builder) doesExceedQuantity(i data.Item, rule nip.Rule, stashItems []da
}

// For now, use this only for gems, runes, tokens, ubers. Add more items after testing
allowedTypeGroups := []string{"runes", "ubers", "tokens", "chippedgems", "flawedgems", "gems", "flawlessgems", "perfectgems"}
if !slices.Contains(allowedTypeGroups, i.TypeAsString()) {
allowedTypeGroups := []string{item.TypeRune, item.TypeQuest, item.TypeGem}
if !slices.Contains(allowedTypeGroups, i.Type().Code) {
b.Logger.Debug(fmt.Sprintf("Skipping max quantity check for %s item", i.Name))
return false
}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ func (s *HttpServer) characterSettings(w http.ResponseWriter, r *http.Request) {

availableTZs := make(map[int]string)
for _, tz := range area.Areas {
if tz.CanBeTerrorized {
if tz.CanBeTerrorized() {
availableTZs[int(tz.ID)] = tz.Name
}
}
Expand Down

0 comments on commit ce38b91

Please sign in to comment.