/
teleport.go
65 lines (56 loc) · 1.54 KB
/
teleport.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"fmt"
"github.com/Gophercraft/core/realm/wdb/models"
"github.com/Gophercraft/core/tempest"
)
type GameTele struct {
ID int64 `xorm:"'entry'"`
PositionX float32 `xorm:"'x'"`
PositionY float32 `xorm:"'y'"`
PositionZ float32 `xorm:"'z'"`
Orientation float32 `xorm:"'o'"`
Map uint32 `xorm:"'map'"`
Name string `xorm:"'name'"`
}
func (gt GameTele) TableName() string {
return "worldports"
}
type AreatriggerTeleport struct {
ID uint32 `xorm:"'id'"`
Name string `xorm:"'name'"`
RequiredLevel uint32 `xorm:"'required_level'"`
RequiredItem uint32 `xorm:"'required_item'"`
RequiredItem2 uint32 `xorm:"'required_item2'"`
RequiredQuestDone uint32 `xorm:"'required_quest_done'"`
TargetMap uint32 `xorm:"'target_map'"`
TargetPositionX float32 `xorm:"'target_position_x'"`
TargetPositionY float32 `xorm:"'target_position_y'"`
TargetPositionZ float32 `xorm:"'target_position_z'"`
TargetPositionO float32 `xorm:"'target_orientation'"`
}
func extractGameTeleports() {
var gt []GameTele
err := DB.Find(>)
if err != nil {
panic(err)
}
fl := openFile("DB/PortLocation.txt")
printTimestamp(fl)
wr := openTextWriter(fl)
for _, pl := range gt {
if err := wr.Encode(&models.PortLocation{
ID: pl.Name,
Location: tempest.C4Vector{
X: pl.PositionX,
Y: pl.PositionY,
Z: pl.PositionZ,
W: pl.Orientation,
},
Map: pl.Map,
}); err != nil {
panic(fmt.Sprintf("error in encode %s", err))
}
}
fl.Close()
}