diff --git a/gdxsv/db.go b/gdxsv/db.go index 0561fcf..a194a9f 100644 --- a/gdxsv/db.go +++ b/gdxsv/db.go @@ -120,7 +120,6 @@ type MLobbySetting struct { McsRegion string `db:"mcs_region" json:"mcs_region"` Comment string `db:"comment" json:"comment"` RuleID string `db:"rule_id" json:"rule_id"` - AutoRebattle int `db:"auto_rebattle" json:"auto_rebattle"` EnableForceStart bool `db:"enable_force_start" json:"enable_force_start"` TeamShuffle bool `db:"team_shuffle" json:"team_shuffle"` PingLimit bool `db:"ping_limit" json:"ping_limit"` diff --git a/gdxsv/db_sqlite.go b/gdxsv/db_sqlite.go index ecfaf9d..cc9c049 100644 --- a/gdxsv/db_sqlite.go +++ b/gdxsv/db_sqlite.go @@ -121,7 +121,6 @@ CREATE TABLE IF NOT EXISTS m_lobby_setting mcs_region text default '', comment text default '', rule_id text default '', - auto_rebattle integer not null, enable_force_start integer not null, team_shuffle integer not null, ping_limit integer not null, @@ -171,7 +170,10 @@ func (db SQLiteDB) Init() error { func (db SQLiteDB) Migrate() error { ctx := context.Background() - tables := []string{"account", "user", "battle_record"} + tables := []string{ + "account", "user", "battle_record", + "m_string", "m_ban", "m_lobby_setting", "m_rule", + } // begin tx tx, err := db.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelDefault}) diff --git a/gdxsv/lbs_lobby.go b/gdxsv/lbs_lobby.go index 068d32c..8392202 100644 --- a/gdxsv/lbs_lobby.go +++ b/gdxsv/lbs_lobby.go @@ -10,6 +10,12 @@ import ( "time" ) +const ( + PingLimitTh = 64 +) + +type LobbySetting MLobbySetting + type LbsLobby struct { app *Lbs Platform string @@ -49,36 +55,6 @@ func NewLobby(app *Lbs, platform, disk string, lobbyID uint16) *LbsLobby { lobby.ZeonRooms[roomID] = NewRoom(app, platform, disk, lobby, roomID, TeamZeon) } - /* - if lobby.LobbySetting.No375MS { - lobby.Rule.RenpoMaskDC = MSMaskAll & ^MSMaskDCGundam & ^MSMaskDCGelgoogS & ^MSMaskDCZeong & ^MSMaskDCElmeth - lobby.Rule.ZeonMaskDC = MSMaskAll & ^MSMaskDCGundam & ^MSMaskDCGelgoogS & ^MSMaskDCZeong & ^MSMaskDCElmeth - } - - if lobby.LobbySetting.Cost630 { - lobby.Rule.RenpoVital = 630 - lobby.Rule.ZeonVital = 630 - } - - if lobby.LobbySetting.BeamMSEvent { - lobby.Rule.RenpoVital = 605 - lobby.Rule.ZeonVital = 605 - lobby.Rule.RenpoMaskDC = MSMaskDCGundam | MSMaskDCGM | MSMaskDCGelgoogS | MSMaskDCGelgoog | MSMaskDCZgokS | MSMaskDCZgok - lobby.Rule.ZeonMaskDC = MSMaskDCGundam | MSMaskDCGM | MSMaskDCGelgoogS | MSMaskDCGelgoog | MSMaskDCZgokS | MSMaskDCZgok - } - - if lobby.LobbySetting.LowCostMSEvent { - lobby.Rule.Timer = 4 - lobby.Rule.RenpoMaskDC = MSMaskDCGuntank | MSMaskDCZgok | MSMaskDCZock | MSMaskDCGogg | MSMaskDCGouf | MSMaskDCGM | MSMaskDCZaku2S | MSMaskDCLGM | MSMaskDCAcguy | MSMaskDCZaku2 | MSMaskDCZaku1 - lobby.Rule.ZeonMaskDC = MSMaskDCGuntank | MSMaskDCZgok | MSMaskDCZock | MSMaskDCGogg | MSMaskDCGouf | MSMaskDCGM | MSMaskDCZaku2S | MSMaskDCLGM | MSMaskDCAcguy | MSMaskDCZaku2 | MSMaskDCZaku1 - } - - if lobby.LobbySetting.HLMMCostEvent { - lobby.Rule.RenpoMaskDC = MSMaskDCGundam | MSMaskDCGelgoogS | MSMaskDCGuntank | MSMaskDCZgok | MSMaskDCZock | MSMaskDCGogg | MSMaskDCGouf | MSMaskDCGM | MSMaskDCZaku2S | MSMaskDCLGM | MSMaskDCAcguy | MSMaskDCZaku2 | MSMaskDCZaku1 - lobby.Rule.ZeonMaskDC = MSMaskDCGelgoog | MSMaskDCGyan | MSMaskDCZgokS | MSMaskDCDom | MSMaskDCGuncannon | MSMaskDCLGundam - } - */ - err := lobby.LoadLobbySetting() if err != nil { if err != sql.ErrNoRows { @@ -157,8 +133,8 @@ func (l *LbsLobby) buildLobbySettingMessages() []*LbsMessage { if l.LobbySetting.TeamShuffle { msgs = append(msgs, toLobbyChatMessage(fmt.Sprintf("%-12s: %v", "TeamShuffle", boolToYesNo(l.LobbySetting.TeamShuffle)))) } - if 0 < l.LobbySetting.AutoRebattle { - msgs = append(msgs, toLobbyChatMessage(fmt.Sprintf("%-12s: %v", "Auto Re Battle", l.LobbySetting.AutoRebattle))) + if 0 < l.Rule.AutoRebattle { + msgs = append(msgs, toLobbyChatMessage(fmt.Sprintf("%-12s: %v", "Auto Re Battle", l.Rule.AutoRebattle))) } if l.LobbySetting.EnableForceStart { msgs = append(msgs, toLobbyChatMessage(fmt.Sprintf("%-12s: %v", "/f Allowed", boolToYesNo(l.LobbySetting.EnableForceStart)))) diff --git a/gdxsv/lbs_lobby_setting.go b/gdxsv/lbs_lobby_setting.go deleted file mode 100644 index ceb8d37..0000000 --- a/gdxsv/lbs_lobby_setting.go +++ /dev/null @@ -1,198 +0,0 @@ -package main - - -const ( - PingLimitTh = 64 -) - -type LobbySetting MLobbySetting - -var BaseLobbySetting = LobbySetting{} - -/* -func (x *LobbySetting) BuildDescription() { - locName, ok := gcpLocationName[x.McsRegion] - if !ok { - locName = "Default Server" - } - if x.McsRegion == "best" { - locName = "Best Server [Auto Detection]" - } - x.Description = fmt.Sprintf("%s
%s", locName, x.Comment) -} -*/ - -// PS2 LobbyID: 1-23 -// DC2 LobbyID: 2, 4-6, 9-17, 19-22 -/* -func init() { - lbsLobbySettings = map[uint16]*LobbySetting{ - // Earth lobbies - 1: { - // PS2 Only - Name: "", - McsRegion: "", - EnableForceStartCmd: true, - Comment: "1", - }, - 2: { - Name: "タクラマカン砂漠", - McsRegion: "", - EnableForceStartCmd: true, - TeamShuffle: true, - Comment: "Default Server", - }, - 3: { - // PS2 Only - Name: "", - McsRegion: "", - PingLimit: true, - EnableForceStartCmd: true, - Comment: "1", - }, - 4: { - Name: "黒海南岸森林地帯", - McsRegion: "asia-east2", - PingLimit: true, - EnableForceStartCmd: true, - }, - 5: { - Name: "オデッサ", - McsRegion: "asia-east2", - TeamShuffle: true, - PingLimit: true, - Comment: "TeamShuffle 3R", - AutoReBattle: 3, - }, - 6: { - Name: "ベルファスト", - McsRegion: "asia-northeast1", - TeamShuffle: true, - PingLimit: true, - Comment: "TeamShuffle 3R", - AutoReBattle: 3, - }, - 7: { - // PS2 Only - Name: "", - McsRegion: "", - EnableForceStartCmd: true, - Comment: "1", - }, - 8: { - // PS2 Only - Name: "", - McsRegion: "", - EnableForceStartCmd: true, - Comment: "1", - }, - 9: { - Name: "ニューヤーク", - McsRegion: "asia-northeast1", - PingLimit: true, - EnableForceStartCmd: true, - }, - 10: { - Name: "グレートキャニオン", - McsRegion: "asia-northeast1", - PingLimit: true, - EnableForceStartCmd: true, - No375MS: true, - Comment: "No 375 Cost MS", - }, - 11: { - Name: "ジャブロー", - McsRegion: "asia-northeast2", - PingLimit: true, - EnableForceStartCmd: true, - }, - 12: { - Name: "地下基地", - McsRegion: "asia-east1", - PingLimit: true, - EnableForceStartCmd: true, - Comment: "For JP vs HK", - }, - - // Universe lobbies - 13: { - Name: "ソロモン", - McsRegion: "best", - EnableForceStartCmd: true, - FreeRule: true, - Comment: "Free Lobby", - }, - 14: { - Name: "ソロモン宙域", - McsRegion: "best", - EnableForceStartCmd: true, - FreeRule: true, - Comment: "Free Lobby", - }, - 15: { - Name: "ア・バオア・クー宙域", - McsRegion: "best", - HLMMCostEvent: true, - Comment: "Event Lobby", - }, - 16: { - Name: "ア・バオア・クー外部", - McsRegion: "best", - HLMMCostEvent: true, - Comment: "Event Lobby", - }, - 17: { - Name: "ア・バオア・クー内部", - McsRegion: "best", - TeamShuffle: true, - HLMMCostEvent: true, - Comment: "Event Lobby (TeamShuffle)", - }, - 18: { - // PS2 Only - Name: "", - McsRegion: "best", - EnableForceStartCmd: true, - FreeRule: true, - Comment: "Free Lobby", - }, - 19: { - Name: "衛星軌道1", - McsRegion: "best", - EnableForceStartCmd: true, - No375MS: true, - Comment: "No 375 Cost MS", - }, - 20: { - Name: "衛星軌道2", - McsRegion: "best", - EnableForceStartCmd: true, - Cost630: true, - Comment: "Cost 630", - }, - 21: { - Name: "サイド6宙域", - McsRegion: "best", - EnableForceStartCmd: true, - Comment: "Private Room", - }, - 22: { - Name: "サイド7内部", - McsRegion: "best", - EnableForceStartCmd: true, - Comment: "Private Room", - }, - } - - for _, x := range lbsLobbySettings { - locName, ok := gcpLocationName[x.McsRegion] - if !ok { - locName = "Default Server" - } - if x.McsRegion == "best" { - locName = "Best Server [Auto Detection]" - } - x.Description = fmt.Sprintf("%s
%s", locName, x.Comment) - } -} -*/