上传宝箱兑换

This commit is contained in:
liwei 2023-07-27 15:51:27 +08:00
parent bc56a6c3ea
commit b83c20ac3c
14 changed files with 275 additions and 118 deletions

View File

@ -415,7 +415,7 @@
"LockSlots": [],
"AssistTeam": 0,
"CanFriendHelp": 0,
"Numrounds": 0
"Numrounds": 100
},
{
"id": 122,

View File

@ -2,7 +2,7 @@
{
"Id": 1,
"GroupId": 300001,
"buffID": 770076113,
"buffID": 125004311,
"GroupNum": 3,
"BuffWt": 50,
"TypeWt": 50
@ -10,7 +10,7 @@
{
"Id": 2,
"GroupId": 300001,
"buffID": 770077113,
"buffID": 125004312,
"GroupNum": 3,
"BuffWt": 50,
"TypeWt": 50
@ -18,7 +18,7 @@
{
"Id": 3,
"GroupId": 300001,
"buffID": 770070113,
"buffID": 135006211,
"GroupNum": 3,
"BuffWt": 50,
"TypeWt": 50
@ -26,7 +26,7 @@
{
"Id": 4,
"GroupId": 300002,
"buffID": 770071113,
"buffID": 151513212,
"GroupNum": 1,
"BuffWt": 50,
"TypeWt": 50

View File

@ -13,7 +13,7 @@
{
"a": "attr",
"t": "arenacoin",
"n": 1000
"n": 1
}
],
"push": 0
@ -32,7 +32,7 @@
{
"a": "attr",
"t": "arenacoin",
"n": 1000
"n": 1
}
],
"push": 0
@ -51,7 +51,7 @@
{
"a": "attr",
"t": "arenacoin",
"n": 1000
"n": 1
}
],
"push": 1
@ -70,7 +70,7 @@
{
"a": "attr",
"t": "arenacoin",
"n": 1000
"n": 1
}
],
"push": 1
@ -89,7 +89,7 @@
{
"a": "attr",
"t": "arenacoin",
"n": 1000
"n": 1
}
],
"push": 1
@ -108,7 +108,7 @@
{
"a": "attr",
"t": "arenacoin",
"n": 1000
"n": 1
}
],
"push": 0
@ -127,7 +127,7 @@
{
"a": "attr",
"t": "arenacoin",
"n": 1000
"n": 1
}
],
"push": 0
@ -146,7 +146,7 @@
{
"a": "attr",
"t": "arenacoin",
"n": 1000
"n": 1
}
],
"push": 0

View File

@ -14,7 +14,10 @@
},
"chosetype": 1,
"chosenum": 1,
"startstory": 0,
"constory": 0,
"get": [],
"aginstory": 0,
"lose": [],
"jump": 0,
"num": 0
@ -34,7 +37,10 @@
},
"chosetype": 1,
"chosenum": 2,
"startstory": 0,
"constory": 0,
"get": [],
"aginstory": 0,
"lose": [],
"jump": 0,
"num": 0
@ -54,7 +60,10 @@
},
"chosetype": 1,
"chosenum": 3,
"startstory": 0,
"constory": 0,
"get": [],
"aginstory": 0,
"lose": [],
"jump": 0,
"num": 0
@ -74,7 +83,10 @@
},
"chosetype": 1,
"chosenum": 4,
"startstory": 0,
"constory": 0,
"get": [],
"aginstory": 0,
"lose": [],
"jump": 0,
"num": 0
@ -94,7 +106,10 @@
},
"chosetype": 1,
"chosenum": 5,
"startstory": 0,
"constory": 0,
"get": [],
"aginstory": 0,
"lose": [],
"jump": 0,
"num": 0
@ -114,7 +129,10 @@
},
"chosetype": 1,
"chosenum": 6,
"startstory": 0,
"constory": 0,
"get": [],
"aginstory": 0,
"lose": [],
"jump": 0,
"num": 0
@ -134,7 +152,10 @@
},
"chosetype": 1,
"chosenum": 7,
"startstory": 0,
"constory": 0,
"get": [],
"aginstory": 0,
"lose": [],
"jump": 0,
"num": 0
@ -154,20 +175,13 @@
},
"chosetype": 2,
"chosenum": 0,
"startstory": 50020010,
"constory": 50020030,
"get": [
{
"a": "attr",
"t": "gold",
"n": 100000
}
],
"lose": [
{
"a": "item",
"t": "14020009",
"n": 1
}
1001
],
"aginstory": 12980,
"lose": [],
"jump": 0,
"num": 0
},
@ -186,20 +200,13 @@
},
"chosetype": 2,
"chosenum": 0,
"startstory": 50020010,
"constory": 50020030,
"get": [
{
"a": "attr",
"t": "gold",
"n": 100000
}
],
"lose": [
{
"a": "item",
"t": "14020009",
"n": 1
}
1001
],
"aginstory": 12980,
"lose": [],
"jump": 0,
"num": 0
},
@ -218,59 +225,12 @@
},
"chosetype": 2,
"chosenum": 0,
"startstory": 50020010,
"constory": 50020030,
"get": [
{
"a": "attr",
"t": "gold",
"n": 100000
}
1001
],
"lose": [
{
"a": "item",
"t": "14020009",
"n": 1
}
],
"jump": 0,
"num": 0
},
{
"key": 11,
"taskstarID": 100110,
"lv": 1,
"taskendID": 20090,
"npc": [
"GameMain",
"功能入口-烹饪"
],
"chosetxt": {
"key": "chosetxt_11",
"text": "买乳猪4"
},
"chosetype": 2,
"chosenum": 0,
"get": [],
"lose": [],
"jump": 0,
"num": 0
},
{
"key": 12,
"taskstarID": 100120,
"lv": 1,
"taskendID": 20090,
"npc": [
"GameMain",
"功能入口-烹饪"
],
"chosetxt": {
"key": "chosetxt_12",
"text": "买乳猪5"
},
"chosetype": 2,
"chosenum": 0,
"get": [],
"aginstory": 12980,
"lose": [],
"jump": 0,
"num": 0

View File

@ -8,7 +8,7 @@
"text": "火焰泰坦"
},
"difficulty": 1,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -68,7 +68,7 @@
"text": "火焰泰坦"
},
"difficulty": 2,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -123,7 +123,7 @@
"text": "火焰泰坦"
},
"difficulty": 3,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -183,7 +183,7 @@
"text": "火焰泰坦"
},
"difficulty": 4,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -238,7 +238,7 @@
"text": "火焰泰坦"
},
"difficulty": 5,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -298,7 +298,7 @@
"text": "火焰泰坦"
},
"difficulty": 6,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -358,7 +358,7 @@
"text": "火焰泰坦"
},
"difficulty": 7,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -423,7 +423,7 @@
"text": "火焰泰坦"
},
"difficulty": 8,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -483,7 +483,7 @@
"text": "火焰泰坦"
},
"difficulty": 9,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -548,7 +548,7 @@
"text": "火焰泰坦"
},
"difficulty": 10,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -613,7 +613,7 @@
"text": "火焰泰坦"
},
"difficulty": 11,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -678,7 +678,7 @@
"text": "火焰泰坦"
},
"difficulty": 12,
"BattleReadyID": 121,
"BattleReadyID": 134,
"captionrecommend": [
45003,
44006,
@ -738,7 +738,7 @@
"text": "冰霜泰坦"
},
"difficulty": 1,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -798,7 +798,7 @@
"text": "冰霜泰坦"
},
"difficulty": 2,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -853,7 +853,7 @@
"text": "冰霜泰坦"
},
"difficulty": 3,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -913,7 +913,7 @@
"text": "冰霜泰坦"
},
"difficulty": 4,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -968,7 +968,7 @@
"text": "冰霜泰坦"
},
"difficulty": 5,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -1028,7 +1028,7 @@
"text": "冰霜泰坦"
},
"difficulty": 6,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -1088,7 +1088,7 @@
"text": "冰霜泰坦"
},
"difficulty": 7,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -1153,7 +1153,7 @@
"text": "冰霜泰坦"
},
"difficulty": 8,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -1213,7 +1213,7 @@
"text": "冰霜泰坦"
},
"difficulty": 9,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -1278,7 +1278,7 @@
"text": "冰霜泰坦"
},
"difficulty": 10,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -1343,7 +1343,7 @@
"text": "冰霜泰坦"
},
"difficulty": 11,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,
@ -1408,7 +1408,7 @@
"text": "冰霜泰坦"
},
"difficulty": 12,
"BattleReadyID": 121,
"BattleReadyID": 133,
"captionrecommend": [
45003,
25004,

View File

@ -0,0 +1,20 @@
[
{
"id": 1001,
"item": [
{
"a": "item",
"t": "14020009",
"n": 1
}
],
"money": [
{
"a": "attr",
"t": "gold",
"n": 100000
}
],
"buy": 1
}
]

View File

@ -236,9 +236,7 @@
"get_item": [],
"trigger": 0,
"npc": 10040,
"completetask": [
12070040
],
"completetask": [],
"deliver_npc": 0,
"taskend_removeitem": [],
"auto_accept": 1,

View File

@ -788,8 +788,8 @@ const (
Rtype202 TaskType = 202 //在狩猎体系的副本内消耗X体力
Rtype203 TaskType = 203 //完成指定试卷组
Rtype204 TaskType = 204 //完成任意一场考试
Rtype205 TaskType = 205 //拾取宝箱
)
const (
MailLineEasy int32 = 1 // 简单
MailLineHard int32 = 2 // 困难

View File

@ -48,6 +48,7 @@ func (this *apiComp) BoxReceive(session comm.IUserSession, req *pb.WTaskBoxRecei
ok = false
for k, _ := range box.Boxs {
if k == req.Boxid {
box.Boxs[k] = 1
ok = true
}
}
@ -91,6 +92,18 @@ func (this *apiComp) BoxReceive(session comm.IUserSession, req *pb.WTaskBoxRecei
if errdata = this.module.DispenseRes(session, prop, true); errdata != nil {
return
}
if err = this.module.modelwtask.Change(session.GetUserId(), map[string]interface{}{
"boxs": wtask.Boxs,
}); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
}
go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype205, 1))
session.SendMsg(string(this.module.GetType()), "boxreceive", &pb.WTaskBoxReceiveResp{Tid: req.Tid, Boxid: req.Boxid, Award: award})
return
}

View File

@ -3,6 +3,7 @@ package wtask
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
// 参数校验
@ -14,13 +15,24 @@ func (this *apiComp) ExchangeCheck(session comm.IUserSession, req *pb.WTaskExcha
// /获取系统公告
func (this *apiComp) Exchange(session comm.IUserSession, req *pb.WTaskExchangeReq) (errdata *pb.ErrorData) {
var (
info *pb.DBWTask
conf *cfg.GameWorldDealData
err error
)
if errdata = this.ExchangeCheck(session, req); errdata != nil {
return
}
if _, err = this.module.modelwtask.getUserWTasks(session.GetUserId()); err != nil {
if conf, err = this.module.configure.getGameWorldDeal(req.Eid); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
}
return
}
if info, err = this.module.modelwtask.getUserWTasks(session.GetUserId()); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
@ -29,5 +41,23 @@ func (this *apiComp) Exchange(session comm.IUserSession, req *pb.WTaskExchangeRe
return
}
if info.Exchange[req.Eid] >= conf.Buy {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
Message: err.Error(),
}
return
}
if errdata = this.module.ConsumeRes(session, conf.Item, true); errdata != nil {
return
}
if errdata = this.module.DispenseRes(session, conf.Money, true); errdata != nil {
return
}
info.Exchange[req.Eid]++
session.SendMsg(string(this.module.GetType()), "exchange", &pb.WTaskExchangeReq{Eid: req.Eid})
return
}

View File

@ -18,6 +18,7 @@ const (
gamerdtasknpc = "game_rdtasknpc.json"
gamesearchitemall = "game_searchitemall.json"
gamesearchitembox = "game_searchitembox.json"
game_worlddeal = "game_worlddeal.json"
)
type configureComp struct {
@ -43,6 +44,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
gamerdtasknpc: cfg.NewGameRdtaskNpc,
gamesearchitemall: cfg.NewGameSearchitemAll,
gamesearchitembox: cfg.NewGameSearchitemBox,
game_worlddeal: cfg.NewGameWorldDeal,
})
this.condlTask = make(map[int32][]*cfg.GameWorldTaskData)
configure.RegisterConfigure(gameWorldTask, cfg.NewGameBuriedCondi, this.updateconfigure)
@ -236,3 +238,21 @@ func (this *configureComp) getGameSearchitemBox(id int32) (conf *cfg.GameSearchi
}
return
}
func (this *configureComp) getGameWorldDeal(id int32) (conf *cfg.GameWorldDealData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_worlddeal); err != nil {
return
} else {
if conf, ok = v.(*cfg.GameWorldDeal).GetDataMap()[id]; !ok {
err = comm.NewNotFoundConfErr(modulename, gameWorldTask, id)
this.module.Errorf("err:%v", err)
return
}
}
return
}

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameWorldDeal struct {
_dataMap map[int32]*GameWorldDealData
_dataList []*GameWorldDealData
}
func NewGameWorldDeal(_buf []map[string]interface{}) (*GameWorldDeal, error) {
_dataList := make([]*GameWorldDealData, 0, len(_buf))
dataMap := make(map[int32]*GameWorldDealData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameWorldDealData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameWorldDeal{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameWorldDeal) GetDataMap() map[int32]*GameWorldDealData {
return table._dataMap
}
func (table *GameWorldDeal) GetDataList() []*GameWorldDealData {
return table._dataList
}
func (table *GameWorldDeal) Get(key int32) *GameWorldDealData {
return table._dataMap[key]
}

View File

@ -0,0 +1,67 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameWorldDealData struct {
Id int32
Item []*Gameatn
Money []*Gameatn
Buy int32
}
const TypeId_GameWorldDealData = -139216148
func (*GameWorldDealData) GetTypeId() int32 {
return -139216148
}
func (_v *GameWorldDealData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["item"].([]interface{}); !_ok_ { err = errors.New("item error"); return }
_v.Item = make([]*Gameatn, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gameatn
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
_v.Item = append(_v.Item, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["money"].([]interface{}); !_ok_ { err = errors.New("money error"); return }
_v.Money = make([]*Gameatn, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ *Gameatn
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
_v.Money = append(_v.Money, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buy"].(float64); !_ok_ { err = errors.New("buy error"); return }; _v.Buy = int32(_tempNum_) }
return
}
func DeserializeGameWorldDealData(_buf map[string]interface{}) (*GameWorldDealData, error) {
v := &GameWorldDealData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -98,6 +98,7 @@ type Tables struct {
Privilege *GamePrivilege
WorldTask *GameWorldTask
WorldAll *GameWorldAll
WorldDeal *GameWorldDeal
Teaching *GameTeaching
HeroStrategy *GameHeroStrategy
FightGlobalEvent *GameFightGlobalEvent
@ -742,6 +743,12 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.WorldAll, err = NewGameWorldAll(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_worlddeal") ; err != nil {
return nil, err
}
if tables.WorldDeal, err = NewGameWorldDeal(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_teaching") ; err != nil {
return nil, err
}