Merge branch 'develop' into sdk
This commit is contained in:
commit
7b711cf054
@ -28,14 +28,14 @@ func GetGroupId(N int) int {
|
|||||||
data, err := gamedata.GetData(CFG_CHAMPSHIP_GROUP)
|
data, err := gamedata.GetData(CFG_CHAMPSHIP_GROUP)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug("GetGroupId err:%v, N=%d", err, N)
|
log.Debug("GetGroupId err:%v, N=%d", err, N)
|
||||||
return 0
|
return 1
|
||||||
}
|
}
|
||||||
for k, v := range data {
|
for k, v := range data {
|
||||||
if N >= gamedata.GetIntValue(v, "Min") && N <= gamedata.GetIntValue(v, "Max") {
|
if N >= gamedata.GetIntValue(v, "Min") && N <= gamedata.GetIntValue(v, "Max") {
|
||||||
return GoUtil.Int(k)
|
return GoUtil.Int(k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0
|
return 11
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetChessScore(ChessLv int) int {
|
func GetChessScore(ChessLv int) int {
|
||||||
|
|||||||
@ -481,17 +481,18 @@ func (c *ChampshipMgr) group(iszero bool) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
ChampshipData.AutoId++
|
ChampshipData.AutoId++
|
||||||
StartId := ChampshipData.AutoId
|
StartId := ChampshipData.AutoId
|
||||||
|
numGroups := (len(g[i]) + 9) / 10 // 向上取整,计算需要的组数
|
||||||
|
ChampshipData.AutoId += numGroups
|
||||||
for j := 0; j < len(g[i]); j++ {
|
for j := 0; j < len(g[i]); j++ {
|
||||||
ChampshipData.GroupInfo[g[i][j]] = ChampshipData.AutoId
|
groupIndex := StartId + j/10
|
||||||
|
ChampshipData.GroupInfo[g[i][j]] = groupIndex
|
||||||
UserData := ChampshipData.Pool[g[i][j]]
|
UserData := ChampshipData.Pool[g[i][j]]
|
||||||
ChampshipData.Rank[ChampshipData.AutoId] = append(ChampshipData.Rank[ChampshipData.AutoId], &ChampshipRank{
|
ChampshipData.Rank[groupIndex] = append(ChampshipData.Rank[groupIndex], &ChampshipRank{
|
||||||
Uid: UserData.Uid,
|
Uid: UserData.Uid,
|
||||||
Score: UserData.Score,
|
Score: UserData.Score,
|
||||||
Time: UserData.Time,
|
Time: UserData.Time,
|
||||||
})
|
})
|
||||||
if len(ChampshipData.Rank[ChampshipData.AutoId]) == 10 {
|
log.Debug("group AutoId:%d, Uid:%d, Score:%f, Time:%d", groupIndex, UserData.Uid, UserData.Score, UserData.Time)
|
||||||
ChampshipData.AutoId++
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for j := StartId; j <= ChampshipData.AutoId; j++ { // 填充机器人
|
for j := StartId; j <= ChampshipData.AutoId; j++ { // 填充机器人
|
||||||
RobotNum := 30 - len(ChampshipData.Rank[j])
|
RobotNum := 30 - len(ChampshipData.Rank[j])
|
||||||
@ -902,17 +903,11 @@ func CreateRobot(M float64, GroupId int) *ChampshipRobot {
|
|||||||
PerScore = math.Round((M/10*0.34)/(float64(GoUtil.NextZeroTimestampDuration())/1800)*100) / 100
|
PerScore = math.Round((M/10*0.34)/(float64(GoUtil.NextZeroTimestampDuration())/1800)*100) / 100
|
||||||
Score = 2
|
Score = 2
|
||||||
}
|
}
|
||||||
num, err := db.RedisZCard(RANK_USER)
|
|
||||||
if err != nil {
|
|
||||||
num = 0
|
|
||||||
}
|
|
||||||
id := rand.Intn(int(num)) + 1
|
|
||||||
rinfo, err := db.RedisZGetByIndexWithScore(RANK_USER, int64(id))
|
|
||||||
playerSimpleData := G_GameLogicPtr.GetSimplePlayerByUid(GoUtil.Int(rinfo.Member))
|
|
||||||
return &ChampshipRobot{
|
return &ChampshipRobot{
|
||||||
Max: M / 10,
|
Max: M / 10,
|
||||||
Type: Type,
|
Type: Type,
|
||||||
Name: randnameCfg.GetRandName(),
|
Name: randnameCfg.GetRandName(),
|
||||||
|
PetName: randnameCfg.GetRandName(),
|
||||||
Avatar: avatarCfg.GetRandInitId(),
|
Avatar: avatarCfg.GetRandInitId(),
|
||||||
Face: faceCfg.GetRandInitId(),
|
Face: faceCfg.GetRandInitId(),
|
||||||
Level: GoUtil.RandNum(1, 10),
|
Level: GoUtil.RandNum(1, 10),
|
||||||
@ -920,9 +915,6 @@ func CreateRobot(M float64, GroupId int) *ChampshipRobot {
|
|||||||
Time: GoUtil.Now(),
|
Time: GoUtil.Now(),
|
||||||
Score: Score,
|
Score: Score,
|
||||||
PerScore: PerScore,
|
PerScore: PerScore,
|
||||||
Playroom: playerSimpleData.Playroom,
|
|
||||||
DressSet: playerSimpleData.DressSet,
|
|
||||||
FurSet: playerSimpleData.PetFur,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -327,6 +327,14 @@ func ReqGmCommand_(player *Player, Command string) error {
|
|||||||
ActivityInfo := player.GetActivityInfo(activity.ACT_TYPE_MINING)
|
ActivityInfo := player.GetActivityInfo(activity.ACT_TYPE_MINING)
|
||||||
MiningMod.ZeroUpdate(ActivityInfo.Id)
|
MiningMod.ZeroUpdate(ActivityInfo.Id)
|
||||||
player.MiningBackData()
|
player.MiningBackData()
|
||||||
|
case "miningSetPass":
|
||||||
|
MiningMod := player.PlayMod.getMiningMod()
|
||||||
|
Id, _ := strconv.Atoi(arg[1])
|
||||||
|
MiningMod.Pass = Id
|
||||||
|
MiningMod.Mining = 0
|
||||||
|
MiningMod.Map = nil
|
||||||
|
MiningMod.Gem = nil
|
||||||
|
player.MiningBackData()
|
||||||
case "catnipReload":
|
case "catnipReload":
|
||||||
CatnipMod := player.PlayMod.getCatnipMod()
|
CatnipMod := player.PlayMod.getCatnipMod()
|
||||||
CatnipMod.ZeroUpdate(-1)
|
CatnipMod.ZeroUpdate(-1)
|
||||||
|
|||||||
@ -1349,6 +1349,26 @@ func (p *Player) AddHighOrder2() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Player) DeleteHighOrder() {
|
||||||
|
OrderMod := p.PlayMod.getOrderMod()
|
||||||
|
ChessMod := p.PlayMod.getChessMod()
|
||||||
|
ChessList := ChessMod.GetUnlockChessList()
|
||||||
|
for k, v := range OrderMod.GetOrderList() {
|
||||||
|
if v.Type != order.Extra_type {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(v.MergeId) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
chessId := v.MergeId[0]
|
||||||
|
chessNum := len(v.MergeId)
|
||||||
|
elementNum := GoUtil.ElemNumber(ChessList, chessId)
|
||||||
|
if elementNum < chessNum {
|
||||||
|
OrderMod.DeleteOrder(k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Player) FormatPetOrderItem(Items []*item.Item) []*item.Item {
|
func (p *Player) FormatPetOrderItem(Items []*item.Item) []*item.Item {
|
||||||
var NewItems []*item.Item
|
var NewItems []*item.Item
|
||||||
PlayroomMod := p.PlayMod.getPlayroomMod()
|
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||||
|
|||||||
@ -439,6 +439,10 @@ func (o *OrderMod) CreateNormalOrder(lv int, Emit []int, EnergyMul, OrderType in
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *OrderMod) DeleteOrder(OrderId int) {
|
||||||
|
delete(o.OrderList, OrderId)
|
||||||
|
}
|
||||||
|
|
||||||
// 生成超级订单
|
// 生成超级订单
|
||||||
func (o *OrderMod) CreateSuperOrder(lv int, Emit []int, EnergyMul int) error {
|
func (o *OrderMod) CreateSuperOrder(lv int, Emit []int, EnergyMul int) error {
|
||||||
if len(Emit) == 0 {
|
if len(Emit) == 0 {
|
||||||
|
|||||||
@ -1193,6 +1193,9 @@ func (p *Player) initActivity() {
|
|||||||
Title: v.Title,
|
Title: v.Title,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
p.TeLog("activity_ids", map[string]interface{}{
|
||||||
|
"info": p.activity,
|
||||||
|
})
|
||||||
p.ActivityLogin()
|
p.ActivityLogin()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -413,6 +413,8 @@ func ReqRewardOrder(player *Player, buf []byte) error {
|
|||||||
player.AddOrder()
|
player.AddOrder()
|
||||||
player.AddHighOrder()
|
player.AddHighOrder()
|
||||||
player.AddHighOrder2()
|
player.AddHighOrder2()
|
||||||
|
// 删除无法完成的回收订单 TODO 需前端配合开发
|
||||||
|
// player.DeleteHighOrder()
|
||||||
player.InitOrderItem()
|
player.InitOrderItem()
|
||||||
// 存钱罐增加钻石
|
// 存钱罐增加钻石
|
||||||
PiggyBankMod := player.PlayMod.getPiggyBankMod()
|
PiggyBankMod := player.PlayMod.getPiggyBankMod()
|
||||||
|
|||||||
@ -648,3 +648,13 @@ func NotifyPlayer(uid, pushid int, title, content string) {
|
|||||||
}
|
}
|
||||||
log.Debug("notification send uid %d, type %d , res %s", uid, pushid, string(body))
|
log.Debug("notification send uid %d, type %d , res %s", uid, pushid, string(body))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ElemNumber(list []int, ele int) int {
|
||||||
|
count := 0
|
||||||
|
for _, v := range list {
|
||||||
|
if v == ele {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|||||||
@ -96,8 +96,20 @@ func TestFixUserData(t *testing.T) {
|
|||||||
func TestRandInt(t *testing.T) {
|
func TestRandInt(t *testing.T) {
|
||||||
p1 := new(game.Player)
|
p1 := new(game.Player)
|
||||||
p1.InitPlayer("3625212")
|
p1.InitPlayer("3625212")
|
||||||
SevenMod := p1.GetSevenLoginMod()
|
p1.DeleteHighOrder()
|
||||||
SevenMod.BackData()
|
}
|
||||||
|
|
||||||
|
func TestII(t *testing.T) {
|
||||||
|
for i := 10; i >= 0; i-- {
|
||||||
|
fmt.Printf("i: %d\n", i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLevelUp(t *testing.T) {
|
||||||
|
p1 := new(game.Player)
|
||||||
|
p1.InitPlayer("3625212")
|
||||||
|
PlayerBaseMod := p1.GetPlayerBaseMod()
|
||||||
|
PlayerBaseMod.AddExp(p1, 10000, 10000)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEndless(t *testing.T) {
|
func TestEndless(t *testing.T) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user