架构优化

This commit is contained in:
hahwu 2026-02-02 10:24:07 +08:00
parent e59cbc9360
commit 8d496bfbda
5 changed files with 10 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import (
proto "server/msg"
"server/pkg/github.com/name5566/leaf/log"
"sort"
"sync"
"time"
)
@ -21,6 +22,7 @@ type ChampshipMgr struct {
}
type ChampshipData struct {
mu sync.RWMutex
AutoId int
RobotId int
Rank map[int][]*ChampshipRank // 锦标赛排行榜

View File

@ -1219,6 +1219,10 @@ func (p *Player) AddHighOrder() {
}
// 高级产物订单
/**
当玩家生成了两个一样的最高等级产物自动生成一个订单收掉它们
注意当现有订单无论是自动或固定订单中已有两个或三个最高等级产物订单的时候不执行此逻辑
*/
func (p *Player) AddHighOrder2() {
OrderMod := p.PlayMod.getOrderMod()
ChessMod := p.PlayMod.getChessMod()
@ -1237,7 +1241,7 @@ func (p *Player) AddHighOrder2() {
ChessMap[v]++
}
for ChessId, Num := range ChessMap {
if Num < 3 {
if Num < 2 {
continue
}
add := true

View File

@ -25,6 +25,7 @@ func InitReward(Diamond float64, Order, Lv int) []*item.Item {
ItemDiamond := endlessCfg.GeDiamondByItemId(RandItem)
LastDiamond := Diamond - ItemDiamond
ItemNum := int(LastDiamond / PerDiamond)
ItemNum = ItemNum / 5 * 5 // 道具数量为5的倍数
return []*item.Item{item.NewItem(item.ITEM_ENERGY_ID, ItemNum), item.NewItem(RandItem, 1)}
}
if Num == 3 {
@ -45,6 +46,7 @@ func InitReward(Diamond float64, Order, Lv int) []*item.Item {
ItemDiamond = endlessCfg.GeDiamondByItemId(RandItem2)
LastDiamond = LastDiamond - ItemDiamond
ItemNum := int(LastDiamond / PerDiamond)
ItemNum = ItemNum / 5 * 5 // 道具数量为5的倍数
return []*item.Item{item.NewItem(item.ITEM_ENERGY_ID, ItemNum), item.NewItem(RandItem1, 1), item.NewItem(RandItem2, 1)}
}

Binary file not shown.

View File

@ -23,7 +23,7 @@ func TestOrderStart(t *testing.T) {
func TestOrderFinish(t *testing.T) {
p1 := new(game.Player)
p1.InitPlayer("bbb004")
p1.InitPlayer("3659896")
game.G_GameLogicPtr.SetPlayer(p1)
ChessMod := p1.GetChessMod()
err := ChessMod.FinishOrder([]int{1, 2, 3})