Skip to content

Commit

Permalink
fix auto rebattle to work
Browse files Browse the repository at this point in the history
  • Loading branch information
inada-s committed Jan 31, 2021
1 parent 7498c90 commit fd95b69
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 233 deletions.
1 change: 0 additions & 1 deletion gdxsv/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
6 changes: 4 additions & 2 deletions gdxsv/db_sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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})
Expand Down
40 changes: 8 additions & 32 deletions gdxsv/lbs_lobby.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import (
"time"
)

const (
PingLimitTh = 64
)

type LobbySetting MLobbySetting

type LbsLobby struct {
app *Lbs
Platform string
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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))))
Expand Down
198 changes: 0 additions & 198 deletions gdxsv/lbs_lobby_setting.go

This file was deleted.

0 comments on commit fd95b69

Please sign in to comment.