connect UdGuildMapInfo to GenerateUdGuildMaps

This commit is contained in:
wish
2022-11-14 01:46:09 +11:00
parent d3fbc53f9f
commit b0f83d8943

View File

@@ -400,7 +400,13 @@ type Tile struct {
Unk2 uint32 Unk2 uint32
} }
type mapProg struct { type MapData struct {
ID uint32
NextID uint32
Tiles []Tile
}
type MapProg struct {
ID uint32 ID uint32
Unk uint16 Unk uint16
Tiles []Tile Tiles []Tile
@@ -411,29 +417,9 @@ func handleMsgMhfGetUdGuildMapInfo(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetUdGuildMapInfo) pkt := p.(*mhfpacket.MsgMhfGetUdGuildMapInfo)
// rudimentary example // rudimentary example
interceptionPoints := map[uint16]int32{0: 2000, 58079: 50} interceptionPoints := map[uint16]int32{0: 200000, 58079: 50}
var guildProg []mapProg var guildProg []MapProg
mapData := []struct { mapData := GenerateUdGuildMaps()
ID uint32
NextID uint32
Tiles []Tile
}{
{ID: 1, NextID: 1, Tiles: []Tile{
{ID: 101, NextID: 102, BranchIndex: 1, Type: 1},
{ID: 102, NextID: 103, BranchID: 202, BranchIndex: 2, Type: 3, PointsReq: 500},
{ID: 103, BranchIndex: 3, Type: 2, PointsReq: 500},
{ID: 202, QuestFile: 58079, BranchIndex: 1, Type: 4, PointsReq: 100, Unk1: 1, Unk2: 1},
}}, {ID: 2, NextID: 3, Tiles: []Tile{
{ID: 105, NextID: 205, BranchIndex: 1, Type: 1},
{ID: 205, NextID: 305, BranchIndex: 2, Type: 0, PointsReq: 500},
{ID: 305, NextID: 405, BranchIndex: 3, Type: 0, PointsReq: 500},
{ID: 405, NextID: 505, BranchIndex: 4, Type: 0, PointsReq: 500},
{ID: 505, BranchIndex: 5, Type: 2, PointsReq: 5000},
}}, {ID: 3, NextID: 1, Tiles: []Tile{
{ID: 512, NextID: 412, BranchIndex: 1, Type: 1},
{ID: 412, BranchIndex: 2, Type: 2, PointsReq: 500},
}},
}
unkData := []struct { unkData := []struct {
Unk0 uint32 Unk0 uint32
@@ -450,7 +436,7 @@ func handleMsgMhfGetUdGuildMapInfo(s *Session, p mhfpacket.MHFPacket) {
bf.WriteUint16(uint16(len(mapData))) bf.WriteUint16(uint16(len(mapData)))
for _, _map := range mapData { for _, _map := range mapData {
guildProg = append(guildProg, mapProg{ID: _map.ID, Unk: 1, Tiles: _map.Tiles}) guildProg = append(guildProg, MapProg{ID: _map.ID, Unk: 1, Tiles: _map.Tiles})
bf.WriteUint32(_map.ID) bf.WriteUint32(_map.ID)
bf.WriteUint32(_map.NextID) bf.WriteUint32(_map.NextID)
for _, tile := range _map.Tiles { for _, tile := range _map.Tiles {
@@ -568,9 +554,7 @@ func getNeighbourTiles(tiles [][]uint16, tile uint16) []uint16 {
return vals return vals
} }
func handleMsgMhfGenerateUdGuildMap(s *Session, p mhfpacket.MHFPacket) { func GenerateUdGuildMaps() []MapData {
pkt := p.(*mhfpacket.MsgMhfGenerateUdGuildMap)
tiles := make([][]uint16, 5) tiles := make([][]uint16, 5)
for i := range tiles { for i := range tiles {
tiles[i] = make([]uint16, 12) tiles[i] = make([]uint16, 12)
@@ -579,7 +563,7 @@ func handleMsgMhfGenerateUdGuildMap(s *Session, p mhfpacket.MHFPacket) {
} }
} }
var guildMaps [][]Tile var guildMaps []MapData
for i := 0; i < 5; i++ { for i := 0; i < 5; i++ {
var startTile, endTile uint16 var startTile, endTile uint16
@@ -656,16 +640,37 @@ func handleMsgMhfGenerateUdGuildMap(s *Session, p mhfpacket.MHFPacket) {
mapTile.NextID = tilePath[j+1] mapTile.NextID = tilePath[j+1]
case len(tilePath) - 1: case len(tilePath) - 1:
mapTile.Type = 2 mapTile.Type = 2
mapTile.PointsReq = 5000
default: default:
mapTile.NextID = tilePath[j+1] mapTile.NextID = tilePath[j+1]
mapTile.PointsReq = int32((j + 1) * 200) }
switch i {
case 0:
mapTile.PointsReq = int32(2500 + 150*(j-1))
case 1:
mapTile.PointsReq = int32(5500 + 600*(j-1))
case 2:
mapTile.PointsReq = int32(6500 + 800*(j-1))
case 3:
mapTile.PointsReq = int32(7500 + 1000*(j-1))
case 4:
mapTile.PointsReq = int32(8500 + 1000*(j-1))
} }
mapTiles = append(mapTiles, mapTile) mapTiles = append(mapTiles, mapTile)
} }
guildMaps = append(guildMaps, mapTiles) if i >= 4 {
guildMaps = append(guildMaps, MapData{uint32(i + 1), 3, mapTiles})
} else {
guildMaps = append(guildMaps, MapData{uint32(i + 1), uint32(i + 2), mapTiles})
}
} }
return guildMaps
}
func handleMsgMhfGenerateUdGuildMap(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGenerateUdGuildMap)
// GenerateUdGuildMaps()
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4)) doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
} }