site history
This commit is contained in:
parent
09b2527115
commit
0282977343
|
@ -23,7 +23,7 @@
|
||||||
"Entity": [
|
"Entity": [
|
||||||
{
|
{
|
||||||
"Name": "Sites",
|
"Name": "Sites",
|
||||||
"Type": "map[int]*Site"
|
"Type": "[]int"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Site": [
|
"Site": [
|
||||||
|
|
|
@ -9,6 +9,7 @@ require (
|
||||||
github.com/iancoleman/strcase v0.2.0
|
github.com/iancoleman/strcase v0.2.0
|
||||||
github.com/pkg/profile v1.6.0
|
github.com/pkg/profile v1.6.0
|
||||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||||
|
golang.org/x/exp v0.0.0-20220428152302-39d4317da171
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|
|
@ -27,10 +27,11 @@ github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKl
|
||||||
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||||
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
|
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
|
||||||
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||||
|
golang.org/x/exp v0.0.0-20220428152302-39d4317da171 h1:TfdoLivD44QwvssI9Sv1xwa5DcL5XQr4au4sZ2F2NV4=
|
||||||
|
golang.org/x/exp v0.0.0-20220428152302-39d4317da171/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57iKi3297KFs0QDbGN60A=
|
|
||||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc=
|
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc=
|
||||||
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
|
|
@ -1987,13 +1987,12 @@ type Entity struct {
|
||||||
Type_ EntityType `json:"type" legend:"plus"` // type
|
Type_ EntityType `json:"type" legend:"plus"` // type
|
||||||
Weapon []EntityWeapon `json:"weapon" legend:"plus"` // weapon
|
Weapon []EntityWeapon `json:"weapon" legend:"plus"` // weapon
|
||||||
WorshipId []int `json:"worshipId" legend:"plus"` // worship_id
|
WorshipId []int `json:"worshipId" legend:"plus"` // worship_id
|
||||||
Sites map[int]*Site `json:"sites" legend:"add"` // Sites
|
Sites []int `json:"sites" legend:"add"` // Sites
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEntity() *Entity {
|
func NewEntity() *Entity {
|
||||||
return &Entity{
|
return &Entity{
|
||||||
Id_: -1,
|
Id_: -1,
|
||||||
Sites: make(map[int]*Site),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (x *Entity) Id() int { return x.Id_ }
|
func (x *Entity) Id() int { return x.Id_ }
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/exp/slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (w *DfWorld) process() {
|
func (w *DfWorld) process() {
|
||||||
|
@ -57,10 +58,9 @@ func (w *DfWorld) processEvents() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *DfWorld) addEntitySite(entityId, siteId int) {
|
func (w *DfWorld) addEntitySite(entityId, siteId int) {
|
||||||
fmt.Println("add site", entityId, siteId)
|
|
||||||
if e, ok := w.Entities[entityId]; ok {
|
if e, ok := w.Entities[entityId]; ok {
|
||||||
if s, ok := w.Sites[siteId]; ok {
|
if !slices.Contains(e.Sites, siteId) {
|
||||||
e.Sites[s.Id_] = s
|
e.Sites = append(e.Sites, siteId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
|
|
||||||
<h5>Sites</h5>
|
<h5>Sites</h5>
|
||||||
<table>
|
<table>
|
||||||
{{- range $i, $s := .Sites }}
|
{{- range .Sites }}
|
||||||
<tr>
|
<tr>
|
||||||
<td> {{ site $s.Id }}</td>
|
<td> {{ site . }}</td>
|
||||||
<td> {{ template "events.html" events (history $s.Id) }}</td>
|
<td> {{ template "events.html" events (history .) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue