Merge branch 'main' into feature/diva

This commit is contained in:
wish
2023-02-28 20:22:35 +11:00
8 changed files with 906 additions and 922 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -73,6 +73,7 @@
{"Name": "HunterSupport", "Enabled": false},
{"Name": "NBoost", "Enabled": false},
{"Name": "NetCafe", "Enabled": true},
{"Name": "OfficialCafe", "Enabled": true},
{"Name": "HLRenewing", "Enabled": true},
{"Name": "EXRenewing", "Enabled": true}
],

View File

@@ -89,8 +89,10 @@ func Courses() []Course {
{Aliases: []string{"Hiden", "Secret"}, ID: 10}, // Secret
{Aliases: []string{"HunterSupport", "HunterAid", "Support", "Aid", "Royal"}, ID: 11}, // Royal
{Aliases: []string{"NBoost", "NetCafeBoost", "Boost"}, ID: 12},
// 13-25 do nothing
{Aliases: []string{"NetCafe", "Cafe", "InternetCafe"}, ID: 26},
// 13-19 = (unknown), 20 = DEBUG, 21 = COG_LINK_EXPIRED, 22 = 360_GOLD, 23 = PS3_TROP
{Aliases: []string{"COG"}, ID: 24},
{Aliases: []string{"NetCafe", "Cafe", "InternetCafe"}, ID: 25},
{Aliases: []string{"OfficialCafe", "Official"}, ID: 26},
{Aliases: []string{"HLRenewing", "HLR", "HLRenewal", "HLRenew"}, ID: 27},
{Aliases: []string{"EXRenewing", "EXR", "EXRenewal", "EXRenew"}, ID: 28},
{Aliases: []string{"Free"}, ID: 29},

View File

@@ -0,0 +1,17 @@
BEGIN;
DROP TABLE IF EXISTS public.account_ban;
DROP TABLE IF EXISTS public.account_history;
DROP TABLE IF EXISTS public.account_moderation;
DROP TABLE IF EXISTS public.account_sub;
DROP TABLE IF EXISTS public.history;
DROP TABLE IF EXISTS public.questlists;
DROP TABLE IF EXISTS public.schema_migrations;
END;

View File

@@ -79,7 +79,7 @@ func updateRights(s *Session) {
rights := []mhfpacket.ClientRight{{1, 0, 0}}
var netcafeBitSet bool
for _, course := range s.courses {
if (course.ID == 9 || course.ID == 26) && !netcafeBitSet {
if (course.ID == 9 || course.ID == 25 || course.ID == 26) && !netcafeBitSet {
netcafeBitSet = true
rightsInt += 0x40000000 // set netcafe bit
rights = append(rights, mhfpacket.ClientRight{ID: 30})

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"io"
"net"
"strings"
"sync"
"erupe-ce/config"
@@ -112,7 +113,11 @@ func (s *Server) handleEntranceServerConnection(conn net.Conn) {
s.logger.Debug("Got entrance server command:\n", zap.String("raw", hex.Dump(pkt)))
data := makeSv2Resp(s.erupeConfig, s)
local := false
if strings.Split(conn.RemoteAddr().String(), ":")[0] == "127.0.0.1" {
local = true
}
data := makeSv2Resp(s.erupeConfig, s, local)
if len(pkt) > 5 {
data = append(data, makeUsrResp(pkt, s)...)
}

View File

@@ -17,7 +17,7 @@ var season uint8
// Server Channels
var currentplayers uint16
func encodeServerInfo(config *config.Config, s *Server) []byte {
func encodeServerInfo(config *config.Config, s *Server, local bool) []byte {
serverInfos := config.Entrance.Entries
bf := byteframe.NewByteFrame()
@@ -30,7 +30,11 @@ func encodeServerInfo(config *config.Config, s *Server) []byte {
if si.IP == "" {
si.IP = config.Host
}
bf.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(si.IP).To4()))
if local {
bf.WriteUint32(0x0100007F) // 127.0.0.1
} else {
bf.WriteUint32(binary.LittleEndian.Uint32(net.ParseIP(si.IP).To4()))
}
bf.WriteUint16(16 + uint16(serverIdx))
bf.WriteUint16(0x0000)
bf.WriteUint16(uint16(len(si.Channels)))
@@ -85,9 +89,9 @@ func makeHeader(data []byte, respType string, entryCount uint16, key byte) []byt
return bf.Data()
}
func makeSv2Resp(config *config.Config, s *Server) []byte {
func makeSv2Resp(config *config.Config, s *Server, local bool) []byte {
serverInfos := config.Entrance.Entries
rawServerData := encodeServerInfo(config, s)
rawServerData := encodeServerInfo(config, s, local)
bf := byteframe.NewByteFrame()
bf.WriteBytes(makeHeader(rawServerData, "SV2", uint16(len(serverInfos)), 0x00))
return bf.Data()

View File

@@ -8,6 +8,7 @@ import (
"erupe-ce/server/channelserver"
"fmt"
"math/rand"
"strings"
"time"
"go.uber.org/zap"
@@ -51,7 +52,11 @@ func (s *Session) makeSignInResp(uid int) []byte {
ps.Uint8(bf, s.server.erupeConfig.PatchServerFile, false)
}
}
ps.Uint8(bf, fmt.Sprintf("%s:%d", s.server.erupeConfig.Host, s.server.erupeConfig.Entrance.Port), false)
if strings.Split(s.rawConn.RemoteAddr().String(), ":")[0] == "127.0.0.1" {
ps.Uint8(bf, fmt.Sprintf("127.0.0.1:%d", s.server.erupeConfig.Entrance.Port), false)
} else {
ps.Uint8(bf, fmt.Sprintf("%s:%d", s.server.erupeConfig.Host, s.server.erupeConfig.Entrance.Port), false)
}
lastPlayed := uint32(0)
for _, char := range chars {