Explorar o código

1.0.19版本更新

zhengtao hai 8 meses
pai
achega
35f5c151aa

+ 5 - 4
game/config/data/achieveTaskConfig.json

@@ -3,8 +3,9 @@
 		{"ID":2,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://t.me/mhayafree","Order":1},
 		{"ID":3,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://www.youtube.com/@mhayaPlaytoearn","Order":3},
 		{"ID":4,"Enable":1,"Type":1,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://discord.com/invite/mhaya","Order":4},
-		{"ID":5,"Enable":1,"Type":2,"Condition":{"min":1,"max":5},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"","Order":5},
-		{"ID":6,"Enable":1,"Type":2,"Condition":{"min":6,"max":10},"Reward":[{"itemBaseType":2,"itemID":6,"amount":15},{"itemBaseType":1,"itemID":7,"amount":3}],"Url":"","Order":6},
-		{"ID":7,"Enable":1,"Type":2,"Condition":{"min":11,"max":20},"Reward":[{"itemBaseType":2,"itemID":6,"amount":20},{"itemBaseType":1,"itemID":7,"amount":4}],"Url":"","Order":7},
-		{"ID":8,"Enable":1,"Type":2,"Condition":{"min":21,"max":30},"Reward":[{"itemBaseType":2,"itemID":6,"amount":25},{"itemBaseType":1,"itemID":7,"amount":5}],"Url":"","Order":8}	
+		{"ID":5,"Enable":1,"Type":2,"Condition":{"min":1,"max":5},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"","Order":6},
+		{"ID":6,"Enable":1,"Type":2,"Condition":{"min":6,"max":10},"Reward":[{"itemBaseType":2,"itemID":6,"amount":15},{"itemBaseType":1,"itemID":7,"amount":3}],"Url":"","Order":7},
+		{"ID":7,"Enable":1,"Type":2,"Condition":{"min":11,"max":20},"Reward":[{"itemBaseType":2,"itemID":6,"amount":20},{"itemBaseType":1,"itemID":7,"amount":4}],"Url":"","Order":8},
+		{"ID":8,"Enable":1,"Type":2,"Condition":{"min":21,"max":30},"Reward":[{"itemBaseType":2,"itemID":6,"amount":25},{"itemBaseType":1,"itemID":7,"amount":5}],"Url":"","Order":9},
+		{"ID":9,"Enable":1,"Type":3,"Condition":{"min":1,"max":1},"Reward":[{"itemBaseType":2,"itemID":6,"amount":10},{"itemBaseType":1,"itemID":5,"amount":10000},{"itemBaseType":1,"itemID":7,"amount":2}],"Url":"https://t.me/mhayafree","Order":5}	
 ]

+ 16 - 18
game/game_cluster/internal/mdb/models/player.go

@@ -228,21 +228,23 @@ func (p *Player) RefreshRoll() bool {
 }
 
 func (p *Player) CheckTaskByType1(openid int64, id int) bool {
-	switch id {
-	case 1: //关注关注推特
-		return true
-	case 2: //加入TG频道
-		if third.GetIfChannel(openid) == 1 {
-			return true
-		} else {
-			return false
-		}
-		return true
 
-	case 3: //关注Yutube账号
-		return true
-	case 4: //加入DC频道
-		return true
+	ret := data.AchieveTaskConfig.GetAll()
+	for _, v := range ret {
+		if v.Type == 2 {
+			continue
+		}
+		if v.ID == id {
+			if v.ID == 2 {
+				if third.GetIfChannel(openid) == 1 {
+					return true
+				} else {
+					return false
+				}
+			} else {
+				return true
+			}
+		}
 	}
 	return false
 }
@@ -292,13 +294,9 @@ func (p *Player) FinishAchieveTaskByType2() bool {
 			if !ok {
 				continue
 			}
-			mhayaLogger.Infof("FinishAchieveTaskByType2 1  username :%v,  id : %v,num:%v", p.UserName, v.ID, p.Item[ItemInvite].Num)
-
 			if p.Item[ItemInvite].Num <= ret.Condition.Max && p.AchieveTask[v.ID].Num != ret.Condition.Max {
 				p.AchieveTask[v.ID].Num += 1
-				mhayaLogger.Infof("FinishAchieveTaskByType2 2 username :%v,  id : %v,num:%v", p.UserName, v.ID, p.Item[ItemInvite].Num)
 				if p.AchieveTask[v.ID].Num >= ret.Condition.Min && p.AchieveTask[v.ID].Num <= ret.Condition.Max {
-					mhayaLogger.Infof("FinishAchieveTaskByType2 3 username :%v,  id : %v,num:%v", p.UserName, v.ID, p.Item[ItemInvite].Num)
 					p.AchieveTask[v.ID].Status = 1
 					p.AchieveTask[v.ID].RewardNum += 1
 				}

+ 2 - 0
game/game_cluster/nodes/game/module/player/start.go

@@ -22,6 +22,8 @@ func (p *actorPlayer) start() (*models.Player, int32) {
 	//刷新roll
 	p.Player.RefreshRoll()
 
+	p.Player.InitAchieveTask()
+
 	if len(p.Player.Password) > 0 {
 		p.Player.IsSetPwd = true
 	}

+ 8 - 5
game/game_cluster/nodes/web/controller/controller.go

@@ -187,18 +187,21 @@ func (p *Controller) auth(c *mhayaGin.Context) {
 			code.RenderResult(c, code.LoginError)
 			return
 		}
-		//重新获取认证 需要天原来服务器
+		//重新获取认证 需要天原来服务器
 		oldToken := mdb.RDB.Get(context.Background(), fmt.Sprintf("%v:%v", constant.Token, openId)).Val()
 		if len(oldToken) > 0 {
 			userToken, ok := token.DecodeToken(oldToken)
 			if ok == false {
 				return
 			}
-			ctl, ok := p.GetChildActor(userToken.PlayerID)
-			if !ok {
-				return
+			//如果分配在不同节点需要断开原来服务器
+			if userToken.TargetPath != targetPath {
+				ctl, ok := p.GetChildActor(userToken.PlayerID)
+				if !ok {
+					return
+				}
+				ctl.Call(userToken.TargetPath, "sessionClose", nil)
 			}
-			ctl.Call(userToken.TargetPath, "sessionClose", nil)
 		}
 
 		base64Token := token.New(pa.Pid, openId, playerId, targetPath, "", config.Salt).ToBase64()