Просмотр исходного кода

1.新增一个成就任务类型
2.调整邀请成就超过30人后的奖励

zhengtao 8 месяцев назад
Родитель
Сommit
07193b8a15

+ 9 - 9
game/config/data/achieveTaskConfig.json

@@ -1,11 +1,11 @@
 [
-		{"ID":1,"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://x.com/Mhaya_Official","Order":2},
-		{"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":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}	
+		{"ID":1,"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://x.com/Mhaya_Official","Order":2,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/xicon.png"},
+		{"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,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/tgicon.png"},
+		{"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,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon1.png"},
+		{"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,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/discord.png"},
+		{"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,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon.png"},
+		{"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,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon.png"},
+		{"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,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon.png"},
+		{"ID":8,"Enable":1,"Type":2,"Condition":{"min":21,"max":9999},"Reward":[{"itemBaseType":2,"itemID":6,"amount":25},{"itemBaseType":1,"itemID":7,"amount":5}],"Url":"","Order":9,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/ytbicon.png"},
+		{"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,"Icon":"https://mhaya-img.s3.ap-southeast-1.amazonaws.com/img/roll/xicon.png"}
 ]

+ 1 - 0
game/game_cluster/internal/data/achieveTaskConfig.go

@@ -19,6 +19,7 @@ type AchieveTaskConfigRow struct {
 	Condition RangeInt32   // 完成条件等级
 	Reward    []ItemReward // 奖励
 	Url       string       // 链接
+	Icon      string       // Icon地址
 }
 
 func (p *achieveTaskConfig) Name() string {

+ 15 - 3
game/game_cluster/internal/mdb/models/achieveTask.go

@@ -1,6 +1,8 @@
 package models
 
-import "github.com/mhaya/game/game_cluster/internal/data"
+import (
+	"github.com/mhaya/game/game_cluster/internal/data"
+)
 
 // 离散规则信息
 const (
@@ -26,6 +28,7 @@ type AchieveTaskBase struct {
 	Reward    []data.ItemReward `json:"reward" bson:"reward"`       // 奖励
 	Url       string            `json:"url" bson:"url"`             // 链接
 	Num       int               `json:"num" bson:"num"`             //已完成次数
+	Icon      string            `json:"icon" bson:"icon"`           //Icon
 	RewardNum int               `json:"rewardNum" bson:"rewardNum"` //可领奖次数
 	Status    int               `json:"status" bson:"status"`       //完成状态0未完成  1已完成2已领取奖励
 	Validate  int               `json:"validate" bson:"validate"`   //验证状态 0 未验证 1待验证 2验证成功
@@ -39,19 +42,28 @@ func NewAchieveTask() map[int]*AchieveTaskBase {
 
 func (at AchieveTask) RefreshAchieveTask() {
 	ret := data.AchieveTaskConfig.GetAll()
+
+	for _, t := range at {
+		if _, ok := ret[t.ID]; !ok {
+			delete(at, t.ID)
+		}
+	}
+
 	for _, d := range ret {
 		if _, ok := at[d.ID]; !ok {
 			at[d.ID] = &AchieveTaskBase{
 				ID:        d.ID,
-				Order:     d.Order,
 				Type:      d.Type,
 				Condition: d.Condition,
 				Reward:    d.Reward,
 				RewardNum: 0,
 				Num:       0,
-				Url:       d.Url,
 				Status:    0,
 			}
 		}
+		at[d.ID].Order = d.Order
+		at[d.ID].Url = d.Url
+		at[d.ID].Icon = d.Icon
+		at[d.ID].Reward = d.Reward
 	}
 }

+ 1 - 1
game/game_cluster/nodes/web/controller/jump.go

@@ -16,7 +16,7 @@ func (p *Controller) jump(c *mhayaGin.Context) {
 		code.RenderResult(c, code.Error)
 		return
 	}
-	if pa.Tp < 0 || pa.Tp > 4 {
+	if pa.Tp < 0 {
 		code.RenderResult(c, code.Error)
 		return
 	}