This commit is contained in:
wh_zcy 2023-04-13 18:41:44 +08:00
commit f6e8cc96be
60 changed files with 1253 additions and 3383 deletions

View File

@ -5,12 +5,8 @@
"color": 1,
"effects": "",
"access": 123,
"star": 0,
"race": 0,
"img": "wp_icon_10035",
"ico": "wp_icon_10035",
"intr": "Currency used to purchase goods",
"tipstxt": "Insufficient gold coins"
"intr": "Currency used to purchase goods"
},
{
"key": "diamond",
@ -18,12 +14,8 @@
"color": 2,
"effects": "",
"access": 158,
"star": 0,
"race": 0,
"img": "wp_icon_10036",
"ico": "wp_icon_10036",
"intr": "Currency used to purchase goods",
"tipstxt": "Diamond shortage"
"intr": "Currency used to purchase goods"
},
{
"key": "exp",
@ -31,12 +23,8 @@
"color": 3,
"effects": "",
"access": 113,
"star": 0,
"race": 0,
"img": "icon_hy",
"ico": "icon_hy",
"intr": "Currency used to purchase goods",
"tipstxt": "Lack of experience"
"intr": "Currency used to purchase goods"
},
{
"key": "friendPoint",
@ -44,12 +32,8 @@
"color": 1,
"effects": "",
"access": 115,
"star": 0,
"race": 0,
"img": "wp_icon_10014",
"ico": "wp_icon_10014",
"intr": "Currency used to purchase goods",
"tipstxt": "Insufficient friendship points"
"intr": "Currency used to purchase goods"
},
{
"key": "palyexp",
@ -57,12 +41,8 @@
"color": 3,
"effects": "",
"access": 113,
"star": 0,
"race": 0,
"img": "wp_icon_0002",
"ico": "wp_icon_0002",
"intr": "Currency used to purchase goods",
"tipstxt": "Lack of experience"
"intr": "Currency used to purchase goods"
},
{
"key": "guildexp",
@ -70,12 +50,8 @@
"color": 1,
"effects": "",
"access": 157,
"star": 0,
"race": 0,
"img": "wp_icon_10024",
"ico": "wp_icon_10024",
"intr": "Currency used to purchase goods",
"tipstxt": "Lack of guildexp"
"intr": "Currency used to purchase goods"
},
{
"key": "guildactive",
@ -83,12 +59,8 @@
"color": 1,
"effects": "",
"access": 157,
"star": 0,
"race": 0,
"img": "wp_icon_0001",
"ico": "wp_icon_0001",
"intr": "Currency used to purchase goods",
"tipstxt": "Insufficient guildactive"
"intr": "Currency used to purchase goods"
},
{
"key": "guildcoin",
@ -96,12 +68,8 @@
"color": 3,
"effects": "",
"access": 157,
"star": 0,
"race": 0,
"img": "wp_icon_10017",
"ico": "wp_icon_10017",
"intr": "Currency used to purchase goods",
"tipstxt": "Insufficient guildcoin"
"intr": "Currency used to purchase goods"
},
{
"key": "starcoin",
@ -109,12 +77,8 @@
"color": 3,
"effects": "",
"access": 158,
"star": 0,
"race": 0,
"img": "wp_icon_10017",
"ico": "wp_icon_10017",
"intr": "Currency used to purchase goods",
"tipstxt": "Insufficient guildcoin"
"intr": "Currency used to purchase goods"
},
{
"key": "vipexp",
@ -122,12 +86,8 @@
"color": 3,
"effects": "",
"access": 158,
"star": 0,
"race": 0,
"img": "wp_icon_0002",
"ico": "wp_icon_0002",
"intr": "Currency used to purchase goods",
"tipstxt": "Lack of experience"
"intr": "Currency used to purchase goods"
},
{
"key": "arenacoin",
@ -135,12 +95,8 @@
"color": 3,
"effects": "",
"access": 156,
"star": 0,
"race": 0,
"img": "icon_ry",
"ico": "icon_ry",
"intr": "Currency used to purchase goods",
"tipstxt": "Lack of experience"
"intr": "Currency used to purchase goods"
},
{
"key": "ps",
@ -148,12 +104,8 @@
"color": 3,
"effects": "",
"access": 156,
"star": 0,
"race": 0,
"img": "wp_icon_0002",
"ico": "wp_icon_0002",
"intr": "Currency used to purchase goods",
"tipstxt": "Lack of experience"
"intr": "Currency used to purchase goods"
},
{
"key": "heroexp",
@ -161,12 +113,8 @@
"color": 3,
"effects": "",
"access": 0,
"star": 0,
"race": 0,
"img": "wp_icon_10009",
"ico": "wp_icon_10009",
"intr": "Currency used to purchase goods",
"tipstxt": "Lack of experience"
"intr": "Currency used to purchase goods"
},
{
"key": "moongold",
@ -174,11 +122,7 @@
"color": 5,
"effects": "",
"access": 107,
"star": 0,
"race": 0,
"img": "wp_icon_10009",
"ico": "wp_icon_10009",
"intr": "Currency used to purchase goods",
"tipstxt": "Lack of experience"
"intr": "Currency used to purchase goods"
}
]

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@
"access": 0,
"heroid": "13002",
"img": "sbkp_js_13002",
"ico": "",
"intr": {
"key": "shirenyu10001",
"text": "作为教习,食人鱼一直秉承着严厉的教习态度,在他手下训练的英雄可以获得巨大提升"
@ -41,7 +40,6 @@
"access": 0,
"heroid": "13001",
"img": "sbkp_js_13001",
"ico": "",
"intr": {
"key": "shirenyu10002",
"text": "闪闪"
@ -70,7 +68,6 @@
"access": 0,
"heroid": "44002",
"img": "sbkp_js_44002",
"ico": "",
"intr": {
"key": "shirenyu10003",
"text": "蛇先生"
@ -99,7 +96,6 @@
"access": 0,
"heroid": "24005",
"img": "sbkp_js_24005",
"ico": "",
"intr": {
"key": "shirenyu10004",
"text": "金猴"
@ -139,7 +135,6 @@
"access": 0,
"heroid": "14005",
"img": "sbkp_js_14005",
"ico": "",
"intr": {
"key": "shirenyu10005",
"text": "鹤大师"
@ -168,7 +163,6 @@
"access": 0,
"heroid": "44006",
"img": "sbkp_js_44006",
"ico": "",
"intr": {
"key": "shirenyu10006",
"text": "悍娇虎"
@ -197,7 +191,6 @@
"access": 0,
"heroid": "43001",
"img": "sbkp_js_43001",
"ico": "",
"intr": {
"key": "shirenyu10007",
"text": "盖"
@ -226,7 +219,6 @@
"access": 0,
"heroid": "35002",
"img": "sbkp_js_35002",
"ico": "",
"intr": {
"key": "shirenyu10008",
"text": "希卡普"
@ -255,7 +247,6 @@
"access": 0,
"heroid": "45004",
"img": "sbkp_js_45004",
"ico": "",
"intr": {
"key": "shirenyu10009",
"text": "穿靴猫"
@ -295,7 +286,6 @@
"access": 0,
"heroid": "35001",
"img": "sbkp_js_35001",
"ico": "",
"intr": {
"key": "shirenyu10010",
"text": "师父"
@ -335,7 +325,6 @@
"access": 0,
"heroid": "25001",
"img": "sbkp_js_25001",
"ico": "",
"intr": {
"key": "shirenyu10011",
"text": "阿宝"
@ -375,7 +364,6 @@
"access": 0,
"heroid": "45001",
"img": "sbkp_js_45001",
"ico": "",
"intr": {
"key": "shirenyu10012",
"text": "乌龟大师"
@ -415,7 +403,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_ss",
"ico": "",
"intr": {
"key": "shirenyu20001",
"text": "石锁,传闻是师父在训练阿宝时经常使用到的道具"
@ -455,7 +442,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_kz",
"ico": "",
"intr": {
"key": "shirenyu20002",
"text": "双头空竹"
@ -484,7 +470,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_pj",
"ico": "",
"intr": {
"key": "shirenyu20003",
"text": "木爬架"
@ -513,7 +498,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_bdw",
"ico": "",
"intr": {
"key": "shirenyu20004",
"text": "不倒翁"
@ -542,7 +526,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_pc",
"ico": "",
"intr": {
"key": "shirenyu20005",
"text": "棒槌"
@ -571,7 +554,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_tl",
"ico": "",
"intr": {
"key": "shirenyu20006",
"text": "铜铃"
@ -600,7 +582,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_tj",
"ico": "",
"intr": {
"key": "shirenyu20007",
"text": "尖刺吊环"
@ -629,7 +610,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_tj01",
"ico": "",
"intr": {
"key": "shirenyu20008",
"text": "陀螺"
@ -658,7 +638,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_zl",
"ico": "",
"intr": {
"key": "shirenyu20009",
"text": "大转轮"
@ -698,7 +677,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_mp",
"ico": "",
"intr": {
"key": "shirenyu20010",
"text": "木头牌"
@ -738,7 +716,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_sjg",
"ico": "",
"intr": {
"key": "shirenyu20011",
"text": "双节棍"
@ -778,7 +755,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_yd",
"ico": "",
"intr": {
"key": "shirenyu20012",
"text": "练功带"
@ -818,7 +794,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_tj",
"ico": "",
"intr": {
"key": "shirenyu20013",
"text": "七彩花棍"
@ -858,7 +833,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_fb",
"ico": "",
"intr": {
"key": "shirenyu20014",
"text": "流星飞镖"
@ -887,7 +861,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_mxl",
"ico": "",
"intr": {
"key": "shirenyu20015",
"text": "冥想锣"
@ -916,7 +889,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_ct",
"ico": "",
"intr": {
"key": "shirenyu20016",
"text": "彩条龙"
@ -945,7 +917,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_kqms",
"ico": "",
"intr": {
"key": "shirenyu20017",
"text": "孔雀毛扇"
@ -983,7 +954,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_ph",
"ico": "",
"intr": {
"key": "shirenyu20018",
"text": "平衡木"
@ -1021,7 +991,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_th",
"ico": "",
"intr": {
"key": "shirenyu20019",
"text": "铁环"
@ -1059,7 +1028,6 @@
"access": 0,
"heroid": "",
"img": "wg_icon_tj",
"ico": "",
"intr": {
"key": "shirenyu20020",
"text": "太极球"

View File

@ -83,6 +83,7 @@ const (
ModulePractice core.M_Modules = "practice" //熊猫武馆 练功系统
ModulePandaAtlas core.M_Modules = "atlas" //熊猫图鉴
ModuleParkour core.M_Modules = "parkour" //跑酷系统
ModuleTools core.M_Modules = "tools" //工具
)
// 数据表名定义处

View File

@ -115,7 +115,8 @@ func GetRandNum(min, max int32) int32 {
if max == min {
return min
}
n, _ := rand.Int(rand.Reader, big.NewInt(int64(max-min)))
n, _ := rand.Int(rand.Reader, big.NewInt(int64(max-min+1))) //+1 是因为 rand方法范围是[0, max)
return int32(n.Int64()) + min
}

View File

@ -451,4 +451,9 @@ type (
//pvp切磋结果通知
ChallengeResults(bid, red, bule string, winSide int32)
}
ITools interface {
GetGroupDataByLottery(lotteryId int32, vipLv int32, lv int32) (items []*cfg.Gameatn)
GetGlobalConf() *cfg.GameGlobalData
}
)

View File

@ -55,11 +55,11 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
return
}
this.module.modelArena.recoverTicket(session, red)
if cd = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.configure.GetGlobalConf().ArenaTicketCos}, true); cd != pb.ErrorCode_Success {
if cd = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.ModuleTools.GetGlobalConf().ArenaTicketCos}, true); cd != pb.ErrorCode_Success {
return
}
// if red.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos {
// red.Ticket -= this.module.configure.GetGlobalConf().ArenaTicketCos
// if red.Ticket > this.module.ModuleTools.GetGlobalConf().ArenaTicketCos {
// red.Ticket -= this.module.ModuleTools.GetGlobalConf().ArenaTicketCos
// } else {
// code = pb.ErrorCode_ArenaTicketNotEnough
// return

View File

@ -34,7 +34,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ArenaInfoReq) (code
return
}
if err == mgo.MongodbNil {
global = this.module.configure.GetGlobalConf()
global = this.module.ModuleTools.GetGlobalConf()
if model, err = this.module.GetDBNodule(session, comm.TableUser, time.Hour); err != nil {
code = pb.ErrorCode_DBError
this.module.Errorln(err)

View File

@ -59,11 +59,11 @@ func (this *apiComp) Plot(session comm.IUserSession, req *pb.ArenaPlotReq) (code
return
}
this.module.modelArena.recoverTicket(session, info)
if cd = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.configure.GetGlobalConf().ArenaTicketCos}, true); cd != pb.ErrorCode_Success {
if cd = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.ModuleTools.GetGlobalConf().ArenaTicketCos}, true); cd != pb.ErrorCode_Success {
return
}
// if info.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos {
// info.Ticket -= this.module.configure.GetGlobalConf().ArenaTicketCos
// if info.Ticket > this.module.ModuleTools.GetGlobalConf().ArenaTicketCos {
// info.Ticket -= this.module.ModuleTools.GetGlobalConf().ArenaTicketCos
// } else {
// code = pb.ErrorCode_ArenaTicketNotEnough
// return

View File

@ -394,7 +394,7 @@ func (this *modelArena) recoverTicket(session comm.IUserSession, info *pb.DBAren
ticket int32
ticketNum int32
)
global := this.module.configure.GetGlobalConf()
global := this.module.ModuleTools.GetGlobalConf()
ticket = int32(this.module.ModuleItems.QueryItemAmount(info.Uid, comm.ArenaTicket))
if ticket < global.ArenaTicketMax && info.Lastrtickettime > 0 {
duration = configure.Now().Sub(time.Unix(info.Lastrtickettime, 0))
@ -422,14 +422,14 @@ func (this *modelArena) reddot(session comm.IUserSession) bool {
return false
}
if err == mgo.MongodbNil {
global := this.module.configure.GetGlobalConf()
global := this.module.ModuleTools.GetGlobalConf()
if global.ArenaTicketMax >= global.ArenaTicketCos.N {
return true
}
return false
}
ticket := int32(this.module.ModuleItems.QueryItemAmount(info.Uid, comm.ArenaTicket))
if ticket > this.module.configure.GetGlobalConf().ArenaTicketCos.N {
if ticket > this.module.ModuleTools.GetGlobalConf().ArenaTicketCos.N {
return true
}
return false

View File

@ -130,7 +130,7 @@ func (this *Arena) GetMatcheBattleRoles(uid string) (captain int32, rules []*pb.
ais []*pb.ArenaPlayer
code pb.ErrorCode
)
global = this.configure.GetGlobalConf()
global = this.ModuleTools.GetGlobalConf()
if info, err = this.modelArena.queryPlayerInfo(uid); err != nil && err != mgo.MongodbNil {
return
}

View File

@ -59,8 +59,9 @@ func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (cod
code = pb.ErrorCode_DBError
return
}
reward := this.module.configure.GetDropReward(box.Drop)
user := this.module.ModuleUser.GetUser(session.GetUserId())
reward := this.module.ModuleTools.GetGroupDataByLottery(box.Drop, user.Vip, user.Lv)
//reward := this.module.configure.GetDropReward(box.Drop)
this.module.DispenseRes(session, reward, true)
atns = make([]*pb.UserAssets, len(reward))
for i, v := range reward {

View File

@ -6,7 +6,6 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"sync"
@ -167,7 +166,7 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
}
groupID = szID[comm.GetRandW(szW)] // 获得小组ID
fmt.Printf("获得小组ID :%d", groupID)
fmt.Printf("大组类型为1的,获得小组ID :%ddropID%d", groupID, lotteryId)
key := int64(lotteryId)<<31 + int64(groupID)
// 小组ID 类型判断
if this.Stype[key] == 1 { // 该小组的道具为权重掉落必定从N个道具中随机出1个道具
@ -186,7 +185,7 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
index := comm.GetRandW(szW)
_data := this.GetLotterConfById(szID[index])
fmt.Printf("获得最终的道具 :%d", _data.Id)
count := comm.GetRandNum(_data.Min, _data.Max+1)
count := comm.GetRandNum(_data.Min, _data.Max)
// 随机获得的数量
items = append(items, &cfg.Gameatn{
A: _data.Itemid.A,
@ -198,8 +197,9 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
} else if this.Stype[key] == 2 { // 该小组中的道具为概率掉落,每个道具都会随机一次是否会掉落(单位为千分比)
for _, v := range this._groupType2[key] {
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
if _data.Itemwt >= comm.GetRandNum(0, 1000) { // 命中
count := comm.GetRandNum(_data.Min, _data.Max+1)
fmt.Printf("大组类型1小组类型2获得道具 :%v, 该道具Cid:%d", _data.Itemid, v)
if _data.Itemwt >= comm.GetRandNum(1, 1000) { // 命中
count := comm.GetRandNum(_data.Min, _data.Max)
items = append(items, &cfg.Gameatn{
A: _data.Itemid.A,
T: _data.Itemid.T,
@ -223,8 +223,10 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
}
}
}
// 类型为2 可能会同时获得多个组id
for k, v := range gourp {
fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id)
if v.Itemwt >= comm.GetRandNum(0, 1000) { // 命中
szGroupID = append(szGroupID, k)
key := int64(lotteryId)<<31 + int64(k)
@ -244,7 +246,7 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
index := comm.GetRandW(szW)
_data := this.GetLotterConfById(szID[index])
fmt.Printf("获得最终的道具 :%d", _data.Id)
count := comm.GetRandNum(_data.Min, _data.Max+1)
count := comm.GetRandNum(_data.Min, _data.Max)
// 随机获得的数量
items = append(items, &cfg.Gameatn{
A: _data.Itemid.A,
@ -255,8 +257,9 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
} else if this.Stype[key] == 2 {
for _, v := range this._groupType2[key] {
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
if _data.Itemwt >= comm.GetRandNum(0, 1000) { // 命中
count := comm.GetRandNum(_data.Min, _data.Max+1)
fmt.Printf("大组类型2小组类型2获得道具 :%v该道具Cid:%d", _data.Itemid, v)
if _data.Itemwt >= comm.GetRandNum(1, 1000) { // 命中
count := comm.GetRandNum(_data.Min, _data.Max)
items = append(items, &cfg.Gameatn{
A: _data.Itemid.A,
T: _data.Itemid.T,
@ -321,22 +324,22 @@ func (this *MCompConfigure) GetConfigure(name string) (v interface{}, err error)
}
//全局配置
func (this *MCompConfigure) GetGlobalConf() *cfg.GameGlobalData {
var (
configure *cfg.GameGlobal
ok bool
)
if v, err := this.GetConfigure(game_global); err != nil {
log.Errorf("get global conf err:%v", err)
return nil
} else {
if configure, ok = v.(*cfg.GameGlobal); !ok {
log.Errorf("%T no is *cfg.Game_global", v)
return nil
}
}
return configure.GetDataList()[0] // 返回对象信息
}
// func (this *MCompConfigure) GetGlobalConf() *cfg.GameGlobalData {
// var (
// configure *cfg.GameGlobal
// ok bool
// )
// if v, err := this.GetConfigure(game_global); err != nil {
// log.Errorf("get global conf err:%v", err)
// return nil
// } else {
// if configure, ok = v.(*cfg.GameGlobal); !ok {
// log.Errorf("%T no is *cfg.Game_global", v)
// return nil
// }
// }
// return configure.GetDataList()[0] // 返回对象信息
// }
func (this *MCompConfigure) GetGlobalInitConf() (configure *cfg.GameInitial, err error) {
var (
@ -408,40 +411,6 @@ func (this *MCompConfigure) GetDropData(dropId int32) (data []*cfg.GameDropData)
return
}
// todo 调用drop 表 获取掉落信息
func (this *MCompConfigure) GetMultipleDropReward(count, dropId int32, items []*pb.UserAssets) (resData []*pb.UserAssets) {
res := make([]*cfg.Gameatn, 0)
for i := 0; i < int(count); i++ {
data := this.GetDropData(dropId)
szW := make([]int32, 0)
for _, value := range data {
szW = append(szW, value.P)
}
if len(szW) > 0 {
index := comm.GetRandW(szW)
res = append(res, data[index].Prize...)
}
}
for _, v := range res {
bFind := false
for _, v1 := range items {
if v.A == v1.A && v.T == v1.T {
v1.N += v.N
bFind = true
}
}
if !bFind {
items = append(items, &pb.UserAssets{
A: v.A,
T: v.T,
N: v.N,
})
}
}
resData = append(resData, items...)
return
}
func (this *MCompConfigure) GetDropReward(dropId int32) (result []*cfg.Gameatn) {
result = make([]*cfg.Gameatn, 0)

View File

@ -56,7 +56,7 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.
}
//校验门票
ticketAtn := a.module.configure.GetGlobalConf().DispatchNumtools
ticketAtn := a.module.ModuleTools.GetGlobalConf().DispatchNumtools
if code = a.module.CheckRes(session, []*cfg.Gameatn{ticketAtn}); code != pb.ErrorCode_Success {
code = pb.ErrorCode_DispatchTicketNoEnough
return

View File

@ -35,7 +35,7 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
return
}
freeCount := a.module.configure.GetGlobalConf().DispatchFreecheck
freeCount := a.module.ModuleTools.GetGlobalConf().DispatchFreecheck
nb := &pb.Noticeboard{
Lv: 1, //公告初始升级
FreeCount: freeCount,
@ -55,9 +55,9 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
//恢复门票
one := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
if one >= 1 {
itemId := a.module.configure.GetGlobalConf().DispatchNumtools.T
itemId := a.module.ModuleTools.GetGlobalConf().DispatchNumtools.T
left := a.module.ModuleItems.QueryItemAmount(uid, itemId)
limit := a.module.configure.GetGlobalConf().DispatchNumoftimes
limit := a.module.ModuleTools.GetGlobalConf().DispatchNumoftimes
if int32(left) < limit {
add := limit - int32(left)
atn := &cfg.Gameatn{A: "item", T: itemId, N: add}
@ -66,7 +66,7 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
}
//周任务重置
n := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
day := a.module.configure.GetGlobalConf().DispatchWeektaskcheck
day := a.module.ModuleTools.GetGlobalConf().DispatchWeektaskcheck
if int32(n) >= day {
d.Nb.WeekCount = 0
d.Nb.WeekReceived = []int32{}

View File

@ -36,13 +36,13 @@ func (a *apiComp) Refresh(session comm.IUserSession, req *pb.DispatchRefreshReq)
return
}
} else {
refreshCount := a.module.configure.GetGlobalConf().DispatchRefreshtimes
refreshCount := a.module.ModuleTools.GetGlobalConf().DispatchRefreshtimes
if d.Nb.RefreshCount >= refreshCount {
code = pb.ErrorCode_DispatchRefreshMax
return
}
//消耗金币
money := a.module.configure.GetGlobalConf().DispatchCheckmoney
money := a.module.ModuleTools.GetGlobalConf().DispatchCheckmoney
if code = a.module.CheckRes(session, []*cfg.Gameatn{money}); code != pb.ErrorCode_Success {
return
}

View File

@ -27,7 +27,7 @@ func (a *apiComp) Weekrecive(session comm.IUserSession, req *pb.DispatchWeekReci
}
//派发奖励
wr := a.module.configure.GetGlobalConf().DispatchWeektaskreward
wr := a.module.ModuleTools.GetGlobalConf().DispatchWeektaskreward
for i, v := range wr {
if req.Idx == int32(i+1) {
if d.Nb.WeekCount >= v.N {

View File

@ -42,7 +42,7 @@ func (this *modelDispatch) initDispatch(uid string, dispatch *pb.DBDispatch) *pb
return nil
}
freeCount := this.module.configure.GetGlobalConf().DispatchFreecheck
freeCount := this.module.ModuleTools.GetGlobalConf().DispatchFreecheck
dis := &pb.DBDispatch{
Uid: uid,
Nb: &pb.Noticeboard{

View File

@ -40,7 +40,7 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
code = pb.ErrorCode_ConfigNoFound
return
}
gole := this.module.configure.GetGlobalConf().EquipmentConsumption[conf.Color-1]
gole := this.module.ModuleTools.GetGlobalConf().EquipmentConsumption[conf.Color-1]
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{{A: comm.AttrType, T: comm.ResGold, N: gole}}, true); code != pb.ErrorCode_Success {
return
}

View File

@ -40,7 +40,7 @@ func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewar
return
}
globalConf := this.moduleFriend.configure.GetGlobalConf()
globalConf := this.moduleFriend.ModuleTools.GetGlobalConf()
if code = this.moduleFriend.DispenseRes(session, globalConf.FriendPeize, true); code != pb.ErrorCode_Success {
this.moduleFriend.Error("好友领奖励",
log.Field{Key: "uid", Value: uid},

View File

@ -61,7 +61,7 @@ func (this *Friend) Start() (err error) {
err = this.ModuleBase.Start()
this.service.RegisterFunctionName(string(comm.Rpc_ModuleFriendUseAssitHero), this.RpcUseAssisHero)
this.service.RegisterFunctionName(string(comm.Rpc_ModuleFriendDB), this.RpcFriendDB)
this.globalConf = this.configure.GetGlobalConf()
this.globalConf = this.ModuleTools.GetGlobalConf()
if this.globalConf == nil {
err = errors.New("global config not found")
}

View File

@ -52,7 +52,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
code = pb.ErrorCode_SystemError
return
}
global = this.module.configure.GetGlobalConf()
global = this.module.ModuleTools.GetGlobalConf()
for _, v := range conf.Salelist {
price = append(price, v)
}

View File

@ -36,7 +36,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
normalDraw bool // 是否是普通抽
)
update = make(map[string]interface{})
cfgDraw = this.module.configure.GetGlobalConf() // 读取抽卡配置文件
cfgDraw = this.module.ModuleTools.GetGlobalConf() // 读取抽卡配置文件
if cfgDraw == nil {
return
}
@ -81,7 +81,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
starIndex := this.module.modelHero.GetRandW(starWeight) // 3 4 5 星索引
// 特殊规则 DrawCard_5StarsInRange 第2-30次抽奖必出一个5星英雄普通卡池
inRangeConf := this.module.configure.GetGlobalConf().DrawCard5StarsInRange
inRangeConf := this.module.ModuleTools.GetGlobalConf().DrawCard5StarsInRange
if len(inRangeConf) == 3 {
iStart := inRangeConf[0] // 抽卡开始
iEnd := inRangeConf[1] // 抽卡结束
@ -121,7 +121,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
}
}
}
inRangeConf1 := this.module.configure.GetGlobalConf().DrawCard5StarsInRange1
inRangeConf1 := this.module.ModuleTools.GetGlobalConf().DrawCard5StarsInRange1
if len(inRangeConf1) == 3 {
iStart := inRangeConf1[0] // 抽卡开始
iEnd := inRangeConf1[1] // 抽卡结束
@ -142,7 +142,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
heroRecord.Star5 = 0
}
// 修改卡池
newPoll := this.module.configure.GetGlobalConf().DrawCard5StarsInRange1Pool
newPoll := this.module.ModuleTools.GetGlobalConf().DrawCard5StarsInRange1Pool
if newPoll != "" {
strPool[len(strPool)-1] = newPoll
}
@ -163,7 +163,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
heroRecord.Star5 = 0
}
// 修改卡池
newPoll := this.module.configure.GetGlobalConf().DrawCard5StarsInRange1Pool
newPoll := this.module.ModuleTools.GetGlobalConf().DrawCard5StarsInRange1Pool
if newPoll != "" {
strPool[len(strPool)-1] = newPoll
}

View File

@ -42,11 +42,12 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.HeroInfoReq) (code
if err = dbModel.GetListObj(uid, v, hero); err == nil {
rsp.Base = append(rsp.Base, hero)
} else {
this.module.Errorf("err:%v", err)
this.module.Errorf("err:%v,heroid:%s,uid:%s", err, v, uid)
}
}
}
}
rsp.Uid = uid
session.SendMsg(string(this.module.GetType()), HeroSubTypeInfo, rsp)
return

View File

@ -89,7 +89,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
curItemCount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), t))
if curItemCount < talentConf.Point { // 如果数量不够 则取找其他物品替代
leftCount := talentConf.Point - curItemCount // 需要其他物品的数量
generaltp := this.module.configure.GetGlobalConf().Generaltp
generaltp := this.module.ModuleTools.GetGlobalConf().Generaltp
fp := &cfg.Gameatn{
A: generaltp.A,
T: generaltp.T,

View File

@ -39,7 +39,7 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe
chanegCard = make([]*pb.DBHero, 0)
// 检查消耗够不够
if code = this.module.ConsumeRes(session, this.module.configure.GetGlobalConf().TalentReset, true); code != pb.ErrorCode_Success {
if code = this.module.ConsumeRes(session, this.module.ModuleTools.GetGlobalConf().TalentReset, true); code != pb.ErrorCode_Success {
return
}

View File

@ -879,7 +879,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
// 如果技能是满级 则转成其他道具
if this.checkHeroAllSkillMax(hero) {
list := this.moduleHero.configure.GetGlobalConf().Moonshopmoney
list := this.moduleHero.ModuleTools.GetGlobalConf().Moonshopmoney
if list != nil {
for pos, v := range list {

View File

@ -460,7 +460,7 @@ func (this *Hero) PushHeroProperty(session comm.IUserSession, heros []*pb.DBHero
// 充值了多少钱
func (this *Hero) RechargeMoney(uid string, money int32) {
conf := this.configure.GetGlobalConf()
conf := this.ModuleTools.GetGlobalConf()
if conf != nil {
if len(conf.DrawCardRechargeReward) != 2 {
return
@ -489,7 +489,7 @@ func (this *Hero) RechargeMoney(uid string, money int32) {
// 多少天没登录
func (this *Hero) NoLoginDay(uid string, day int32) {
conf := this.configure.GetGlobalConf()
conf := this.ModuleTools.GetGlobalConf()
if conf != nil {
if len(conf.DrawCardRegressionReward) != 2 {
return
@ -533,7 +533,7 @@ func (this *Hero) ContinuousRestriction(uid string, heroCid string, drawCount in
}
for heroid, index := range record.Star5Hero {
if heroid == heroCid {
conf := this.configure.GetGlobalConf() //.
conf := this.ModuleTools.GetGlobalConf() //.
iMaxCOunt := conf.DrawCardContinuousRestrictionStar5
if drawCount-index <= iMaxCOunt { // 连续n次还获得该英雄 直接替换其他英雄
@ -577,7 +577,7 @@ func (this *Hero) CheckCondition(uid string) bool {
defer this.modelRecord.ChangeHeroRecord(uid, update)
record, _ := this.modelRecord.GetHeroRecord(uid)
if v, ok := record.Condition["recharge"]; ok {
conf := this.configure.GetGlobalConf() //.
conf := this.ModuleTools.GetGlobalConf() //.
if len(conf.DrawCardRechargeReward) == 2 {
curCount = conf.DrawCardRechargeReward[1]
}
@ -597,7 +597,7 @@ func (this *Hero) CheckCondition(uid string) bool {
}
}
if v, ok := record.Condition["login"]; ok {
conf := this.configure.GetGlobalConf() //.
conf := this.ModuleTools.GetGlobalConf() //.
if len(conf.DrawCardRegressionReward) == 2 {
curCount = conf.DrawCardRegressionReward[1]
}
@ -763,7 +763,7 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou
}
func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) {
inRangeConf := this.configure.GetGlobalConf().DrawCard5StarsInRange
inRangeConf := this.ModuleTools.GetGlobalConf().DrawCard5StarsInRange
if len(inRangeConf) == 3 {
iStart := inRangeConf[0] // 抽卡开始
iEnd := inRangeConf[1] // 抽卡结束
@ -796,8 +796,8 @@ func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex
func (this *Hero) InRange(heroRecord *pb.DBHeroRecord, strPool []string, update map[string]interface{}) (starIndex int32, pool string) {
starIndex = 3 // 默认3星
inRangeConf1 := this.configure.GetGlobalConf().DrawCard5StarsInRange1
pool = this.configure.GetGlobalConf().DrawCard5StarsInRange1Pool
inRangeConf1 := this.ModuleTools.GetGlobalConf().DrawCard5StarsInRange1
pool = this.ModuleTools.GetGlobalConf().DrawCard5StarsInRange1Pool
if len(inRangeConf1) == 3 {
iStart := inRangeConf1[0] // 抽卡开始
iEnd := inRangeConf1[1] // 抽卡结束
@ -914,7 +914,7 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string
//DrawCard_ContinuousRestriction_Camp
func (this *Hero) DrawCardContinuousRestrictionCamp(cardId string, race map[int32]int32, sz []int32, data []*cfg.GameDrawCardData) (card string) {
card = cardId
cfgDraw := this.configure.GetGlobalConf() // 读取抽卡配置文件
cfgDraw := this.ModuleTools.GetGlobalConf() // 读取抽卡配置文件
if cfgDraw == nil || race == nil {
return
}

View File

@ -30,7 +30,7 @@ func (this *apiComp) Reset(session comm.IUserSession, req *pb.HoroscopeResetReq)
code = pb.ErrorCode_DBError
return
}
conf = this.module.configure.GetGlobalConf()
conf = this.module.ModuleTools.GetGlobalConf()
if info.Lastrest > 0 {
if configure.Now().Sub(time.Unix(info.Lastrest, 0)).Seconds() < float64(conf.HoroscopeResetCd) {
code = pb.ErrorCode_HoroscopeRestCDNoEnd

View File

@ -34,7 +34,7 @@ func (this *apiComp) BuyPhysical(session comm.IUserSession, req *pb.ItemsBuyPhys
return
}
if needs = this.module.configure.GetGlobalConf().PsBuy; needs == nil && len(needs) == 0 {
if needs = this.module.ModuleTools.GetGlobalConf().PsBuy; needs == nil && len(needs) == 0 {
code = pb.ErrorCode_ConfigNoFound
return
}

View File

@ -137,12 +137,12 @@ func (this *ConfigureComp) GetPackItemByType(itmes []*pb.DB_UserItemData, bagtyp
}
func (this *ConfigureComp) GetchallengeDataCount() (count int, err error) {
count = len(this.GetGlobalConf().CopsBuy)
count = len(this.module.ModuleTools.GetGlobalConf().CopsBuy)
return
}
func (this *ConfigureComp) GetchallengeData(buy int) (result *cfg.Gameatn) {
for i, v := range this.GetGlobalConf().CopsBuy {
for i, v := range this.module.ModuleTools.GetGlobalConf().CopsBuy {
if i == buy-1 {
result = v
return

View File

@ -502,7 +502,7 @@ func (this *ModelItemsComp) buyTicket(session comm.IUserSession, buy int32) (inf
return
}
atn := this.module.configure.GetGlobalConf().CopsBuyGet
atn := this.module.ModuleTools.GetGlobalConf().CopsBuyGet
res := &cfg.Gameatn{
A: atn.A,
@ -543,7 +543,7 @@ func (this *ModelItemsComp) recoverTicket(session comm.IUserSession) (code pb.Er
info.Lasttimeunifiedticket = configure.Now().Unix()
info.Buyunifiedticket = 0
}
global := this.module.configure.GetGlobalConf()
global := this.module.ModuleTools.GetGlobalConf()
playerlv := this.module.configure.GetPlayerlvConf(user.Lv)
ticket = int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), comm.UnifiedTicket))
if ticket < global.DreamlandFightnum && info.Recovertimeunifiedticket > 0 {

View File

@ -40,6 +40,7 @@ type ModuleBase struct {
ModulePrivilege comm.IPrivilege // 月卡
ModuleSmithy comm.ISmithy //
ModulePractice comm.IPractice //练功房
ModuleTools comm.ITools //工具类 获取一些通用配置
}
//重构模块配置对象
@ -125,6 +126,10 @@ func (this *ModuleBase) Start() (err error) {
return
}
this.ModulePractice = module.(comm.IPractice)
if module, err = this.service.GetModule(comm.ModuleTools); err != nil {
return
}
this.ModuleTools = module.(comm.ITools)
return
}

View File

@ -84,10 +84,10 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
// cd = pb.ErrorCode_CacheReadError
// }
// if umfantasy.Ticket < this.module.configure.GetGlobalConf().DreamlandCos {
// if umfantasy.Ticket < this.module.ModuleTools.GetGlobalConf().DreamlandCos {
// cd = pb.ErrorCode_MoonfantasyNotEnoughbattles
// }
// umfantasy.Ticket -= this.module.configure.GetGlobalConf().DreamlandCos
// umfantasy.Ticket -= this.module.ModuleTools.GetGlobalConf().DreamlandCos
if boss, err = this.module.configure.GetMonsterById(mdata.Monster); err != nil {
cd = pb.ErrorCode_ConfigNoFound
return

View File

@ -95,7 +95,7 @@ func (this *modelDreamComp) trigger(session comm.IUserSession) {
chat *pb.DBChat
err error
)
globalconf = this.module.configure.GetGlobalConf()
globalconf = this.module.ModuleTools.GetGlobalConf()
if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil {
return
@ -149,7 +149,7 @@ func (this *modelDreamComp) triggerbyid(session comm.IUserSession, boosid string
mdata *pb.DBMoonFantasy
chat *pb.DBChat
)
globalconf = this.module.configure.GetGlobalConf()
globalconf = this.module.ModuleTools.GetGlobalConf()
if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil {
return

View File

@ -41,7 +41,7 @@ func (this *modelUserMF) queryUsermfantasy(uId string) (info *pb.DBUserMFantasy,
this.module.Errorf("err:%v", err)
}
if err == mgo.MongodbNil {
global := this.module.configure.GetGlobalConf()
global := this.module.ModuleTools.GetGlobalConf()
info = &pb.DBUserMFantasy{
Id: primitive.NewObjectID().Hex(),
Uid: uId,
@ -83,7 +83,7 @@ func (this *modelUserMF) recoverTicket(session comm.IUserSession, info *pb.DBUse
info.BuyNum = 0
}
// this.module.ModuleItems.RecoverTicket(session)
global := this.module.configure.GetGlobalConf()
global := this.module.ModuleTools.GetGlobalConf()
ticket = int32(this.module.ModuleItems.QueryItemAmount(info.Uid, comm.MoonFantasyTicket))
if ticket < global.DreamlandFightnum && info.Lastrtickettime > 0 {
duration = configure.Now().Sub(time.Unix(info.Lastrtickettime, 0))

View File

@ -107,14 +107,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
// 记录爬塔明细数据
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
sz := make([]*pb.LineUp, 5)
for i, v := range req.Report.Info.Redflist[0].Team {
leadpos := req.Report.Info.Redflist[0].Leadpos
szLine := make([]*pb.LineUp, 0)
for _, v := range req.Report.Info.Redflist[0].Team {
if v != nil {
sz[i] = &pb.LineUp{
szLine = append(szLine, &pb.LineUp{
Cid: v.HeroID,
Star: v.Star,
Lv: v.Lv,
}
})
}
}
// 数据直接插入跨服数据库中
@ -126,9 +127,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
PagodaId: pagoda.PagodaId,
Type: pagoda.Type,
Nickname: userinfo.Name,
Icon: "", // icon 暂无
Icon: "",
Lv: userinfo.Lv,
CostTime: req.Report.Costtime,
Leadpos: leadpos,
Line: szLine,
}
costTime = newData.CostTime
// 数据写到跨服中

View File

@ -30,7 +30,7 @@ func (this *apiComp) GymRefresh(session comm.IUserSession, req *pb.PracticeGymRe
code = pb.ErrorCode_DBError
return
}
refreshAtns = this.module.configure.GetGlobalConf().MrylFlushed
refreshAtns = this.module.ModuleTools.GetGlobalConf().MrylFlushed
if len(refreshAtns) == 0 {
code = pb.ErrorCode_ConfigNoFound
return

View File

@ -45,7 +45,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.PracticeInfoReq) (c
if room.Npcstate == 3 { //CD中
cd := int32(configure.Now().Sub(time.Unix(room.Refresh, 0)).Seconds())
if cd >= this.module.configure.GetGlobalConf().PandamasChallengeCd {
if cd >= this.module.ModuleTools.GetGlobalConf().PandamasChallengeCd {
if err = this.module.modelPandata.refreshnpc(room); err != nil {
this.module.Errorln(err)
code = pb.ErrorCode_DBError

View File

@ -51,7 +51,7 @@ func (this *apiComp) NPCBattkleFinish(session comm.IUserSession, req *pb.Practic
room.Npcstate = 1
room.Battlenum++
if room.Battlenum >= this.module.configure.GetGlobalConf().PandamasFightNum {
if room.Battlenum >= this.module.ModuleTools.GetGlobalConf().PandamasFightNum {
room.Npcstate = 3
room.Refresh = configure.Now().Unix()
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{

View File

@ -252,7 +252,7 @@ func (this *Practice) ChallengeResults(bid, red, bule string, winSide int32) {
if v.Uid == red {
v.Unionname = redsociaty
v.Figure = reduser.Figure
v.End = configure.Now().Add(time.Minute * time.Duration(this.configure.GetGlobalConf().PandamasTiguandiaoxiangCd)).Unix()
v.End = configure.Now().Add(time.Minute * time.Duration(this.ModuleTools.GetGlobalConf().PandamasTiguandiaoxiangCd)).Unix()
keep = true
break
}
@ -263,7 +263,7 @@ func (this *Practice) ChallengeResults(bid, red, bule string, winSide int32) {
Name: reduser.Name,
Unionname: redsociaty,
Figure: reduser.Figure,
End: configure.Now().Add(time.Minute * time.Duration(this.configure.GetGlobalConf().PandamasTiguandiaoxiangCd)).Unix(),
End: configure.Now().Add(time.Minute * time.Duration(this.ModuleTools.GetGlobalConf().PandamasTiguandiaoxiangCd)).Unix(),
})
}
@ -280,7 +280,7 @@ func (this *Practice) ChallengeResults(bid, red, bule string, winSide int32) {
if v.Uid == bule {
v.Unionname = bulesociaty
v.Figure = buleuser.Figure
v.End = configure.Now().Add(time.Minute * time.Duration(this.configure.GetGlobalConf().PandamasTiguandiaoxiangCd)).Unix()
v.End = configure.Now().Add(time.Minute * time.Duration(this.ModuleTools.GetGlobalConf().PandamasTiguandiaoxiangCd)).Unix()
keep = true
break
}
@ -291,7 +291,7 @@ func (this *Practice) ChallengeResults(bid, red, bule string, winSide int32) {
Name: buleuser.Name,
Unionname: bulesociaty,
Figure: buleuser.Figure,
End: configure.Now().Add(time.Minute * time.Duration(this.configure.GetGlobalConf().PandamasTiguandiaoxiangCd)).Unix(),
End: configure.Now().Add(time.Minute * time.Duration(this.ModuleTools.GetGlobalConf().PandamasTiguandiaoxiangCd)).Unix(),
})
}
for i, v := range buleroom.Statuers {

View File

@ -88,8 +88,8 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
needTemperatureCos = reelcfg.TemperatureCos * (1000 - t) / 1000 // 千分比
if req.Lava > 0 { // 熔岩打造
exemption := this.module.configure.GetGlobalConf().ExemptionTemperatureCos // 预计消耗温度
gloabNum := this.module.configure.GetGlobalConf().ExemptionTemperatureCosNum
exemption := this.module.ModuleTools.GetGlobalConf().ExemptionTemperatureCos // 预计消耗温度
gloabNum := this.module.ModuleTools.GetGlobalConf().ExemptionTemperatureCosNum
if needTemperatureCos > req.Lava*gloabNum {
code = pb.ErrorCode_SmithyLackLava // 缺少熔岩
return
@ -155,7 +155,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
}
// 总次数校验
maxHitCount := this.module.configure.GetGlobalConf().GameMakeTunkNum
maxHitCount := this.module.ModuleTools.GetGlobalConf().GameMakeTunkNum
if hitLen > maxHitCount {
code = pb.ErrorCode_ReqParameterError
this.module.Errorf("铁匠铺小游戏打造次数超过上限,当前打造次数:%d, 配置总次数:%d", hitLen, maxHitCount)

View File

@ -14,7 +14,7 @@ func (this *apiComp) CustomerCheck(session comm.IUserSession, req *pb.SmithyCust
}
func (this *apiComp) Customer(session comm.IUserSession, req *pb.SmithyCustomerReq) (code pb.ErrorCode, data proto.Message) {
customerCount := this.module.configure.GetGlobalConf().SmithyMaxNpc
customerCount := this.module.ModuleTools.GetGlobalConf().SmithyMaxNpc
if customerCount <= 0 {
code = pb.ErrorCode_ConfigNoFound
return

View File

@ -36,8 +36,8 @@ func (this *apiComp) Rise(session comm.IUserSession, req *pb.SmithyRiseReq) (cod
code = pb.ErrorCode_SmithyMaxTemperature
return
}
raise := this.module.configure.GetGlobalConf().RaiseTemperature
raise_temperatureNum := this.module.configure.GetGlobalConf().RaiseTemperatureNum
raise := this.module.ModuleTools.GetGlobalConf().RaiseTemperature
raise_temperatureNum := this.module.ModuleTools.GetGlobalConf().RaiseTemperatureNum
cost = append(cost, &cfg.Gameatn{
A: raise.A,
T: raise.T,

View File

@ -28,7 +28,7 @@ func (this *apiComp) Formation(session comm.IUserSession, req *pb.SociatyBFormat
return
}
ggd := this.module.configure.GetGlobalConf()
ggd := this.module.ModuleTools.GetGlobalConf()
if ggd == nil {
code = pb.ErrorCode_ConfigNoFound
return

View File

@ -18,7 +18,7 @@ func (this *apiComp) BossmainCheck(session comm.IUserSession, req *pb.SociatyBMa
func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
ggd := this.module.configure.GetGlobalConf()
ggd := this.module.ModuleTools.GetGlobalConf()
if ggd == nil {
code = pb.ErrorCode_ConfigNoFound
return

View File

@ -21,7 +21,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.SociatyBuyReq) (code
return
}
ggd := this.module.configure.GetGlobalConf()
ggd := this.module.ModuleTools.GetGlobalConf()
if ggd == nil {
code = pb.ErrorCode_ConfigNoFound
return

View File

@ -68,7 +68,7 @@ func (this *Sociaty) Start() (err error) {
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociatyUpdate), this.RpcUpdateSociaty)
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociatyTask), this.RpcUpdateUserTask)
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociatyGetTask), this.RpcGetUserTask)
this.globalConf = this.configure.GetGlobalConf()
this.globalConf = this.ModuleTools.GetGlobalConf()
if this.globalConf == nil {
err = errors.New("global config not found")
return

View File

@ -0,0 +1,589 @@
package tools
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"sync"
)
const (
game_global = "game_global.json" //全局配置表
game_initial = "game_initial.json" //初始化表
game_gamecolor = "game_gamecolor.json" //颜色表
game_playerlv = "game_playerlv.json" //玩家等级
game_facemod = "game_facemod.json" //形象配置表
game_drop = "game_drop.json" //掉落
new_hero = "game_hero.json"
// 签到
game_signreset = "game_signreset.json"
game_sign = "game_sign.json"
game_item = "game_item.json"
game_vip = "game_vip.json"
game_equip = "game_equip.json" //装备信息表
game_lottery = "game_lottery.json"
)
///配置管理基础组件
type MCompConfigure struct {
cbase.ModuleCompBase
hlock sync.RWMutex
_dropMap map[int32][]*cfg.GameDropData // 掉落表 key 是DiropId
_sign map[int32]*cfg.GameSignData
_group map[int64][]int32 // key 小组ID value cid
// 类型为1 的数据 该大组中的小组为权重掉落必定从N个小组中随机出1个小组
_lotteryType1 map[int32][]int32 // key 大组ID value cid
// 类型为2 的数据 有多个小组ID
_lotteryType2 map[int32][]int32 // key 大组ID value 小组ID
// 小组类型为1
_groupType1 map[int64][]int32 //value cid
// 小组类型为2
_groupType2 map[int64][]int32 //value cid
Btype map[int32]int32
Stype map[int64]int32 // subtype
SNum map[int64]int32 // 小组产出数量
}
//组件初始化接口
func (this *MCompConfigure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.ModuleCompBase.Init(service, module, comp, options)
err = this.LoadConfigure(game_global, cfg.NewGameGlobal)
err = this.LoadConfigure(game_initial, cfg.NewGameInitial)
err = this.LoadConfigure(game_gamecolor, cfg.NewGameGameColor)
err = this.LoadConfigure(new_hero, cfg.NewGameHero)
err = this.LoadConfigure(game_playerlv, cfg.NewGamePlayerlv)
err = this.LoadConfigure(game_facemod, cfg.NewGameFacemod)
err = this.LoadConfigure(game_signreset, cfg.NewGameSignReset)
err = this.LoadConfigure(game_equip, cfg.NewGameEquip)
//err = this.LoadConfigure(game_sign, cfg.NewGameSign)
err = this.LoadConfigure(game_item, cfg.NewGameItem)
err = this.LoadConfigure(game_vip, cfg.NewGameVip)
err = this.LoadConfigure(game_lottery, cfg.NewGameLottery)
this._dropMap = make(map[int32][]*cfg.GameDropData, 0)
this._sign = make(map[int32]*cfg.GameSignData, 0)
configure.RegisterConfigure(game_drop, cfg.NewGameDrop, this.LoadDropData)
configure.RegisterConfigure(game_sign, cfg.NewGameSign, this.LoadSignData)
this._group = make(map[int64][]int32, 0)
this._lotteryType1 = make(map[int32][]int32, 0)
this._lotteryType2 = make(map[int32][]int32, 0)
this._groupType1 = make(map[int64][]int32, 0)
this._groupType2 = make(map[int64][]int32, 0)
this.Btype = make(map[int32]int32, 0)
this.Stype = make(map[int64]int32, 0)
this.SNum = make(map[int64]int32, 0)
configure.RegisterConfigure(game_lottery, cfg.NewGameLottery, this.LoadGroupData)
return
}
func (this *MCompConfigure) LoadGroupData() {
if v, err := this.GetConfigure(game_lottery); err == nil {
if configure, ok := v.(*cfg.GameLottery); ok {
this.hlock.Lock()
defer this.hlock.Unlock()
this._group = make(map[int64][]int32, 0)
this._lotteryType1 = make(map[int32][]int32, 0)
this._lotteryType2 = make(map[int32][]int32, 0)
this._groupType1 = make(map[int64][]int32, 0)
this._groupType2 = make(map[int64][]int32, 0)
this.Btype = make(map[int32]int32, 0)
this.Stype = make(map[int64]int32, 0)
this.SNum = make(map[int64]int32, 0)
for _, value := range configure.GetDataList() {
key := int64(value.Lotteryid)<<31 + int64(value.Groupid)
this._group[key] = append(this._group[key], value.Id)
if _, ok := this.Btype[value.Lotteryid]; !ok {
this.Btype[value.Lotteryid] = value.Type
}
if _, ok := this.Stype[key]; !ok {
this.Stype[key] = value.Subtype
}
if _, ok := this.SNum[key]; !ok {
this.SNum[key] = value.Groupnum
}
if this.Btype[value.Lotteryid] == 1 {
this._lotteryType1[value.Lotteryid] = append(this._lotteryType1[value.Lotteryid], value.Id)
} else if this.Btype[value.Lotteryid] == 2 {
this._lotteryType2[value.Lotteryid] = append(this._lotteryType2[value.Lotteryid], value.Id)
}
if this.Stype[key] == 1 { // 小组ID为1
this._groupType1[key] = append(this._groupType1[key], value.Id)
} else if this.Stype[key] == 2 {
this._groupType2[key] = append(this._groupType2[key], value.Id)
}
}
return
}
} else {
log.Errorf("get LoadGroupData conf err:%v", err)
}
return
}
// 实际掉落逻辑 (传入 掉落组ID vip等级 玩家等级 返回获得的道具)
func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32, lv int32) (items []*cfg.Gameatn) {
if _, ok := this._lotteryType1[lotteryId]; !ok {
if _, ok := this._lotteryType2[lotteryId]; !ok {
fmt.Printf("not found config lotterId:%d", lotteryId)
return
}
}
// 优先校验大组ID 的类型
if this.Btype[lotteryId] == 1 { // 该大组中的小组为权重掉落必定从N个小组中随机出1个小组
var (
szW []int32 // 权重数组
szID []int32 // 小组ID 数组
groupID int32
gourp map[int32]int32 // key 小组ID value 权重
)
gourp = make(map[int32]int32, 0)
// 随机小组id
for _, v := range this._lotteryType1[lotteryId] {
if _data := this.GetLotterConfById(v); _data != nil {
if (_data.Playerlvmax == 0 || _data.Playerlvmin <= lv && lv <= _data.Playerlvmax) && (_data.VIPmax == 0 || _data.VIPmin <= vipLv && vipLv <= _data.VIPmax) { // 过滤等级等条件
if _, ok := gourp[_data.Groupid]; !ok {
gourp[_data.Groupid] = _data.Groupwt // 小组ID 权重赋值
szW = append(szW, _data.Groupwt)
szID = append(szID, _data.Groupid)
}
}
}
}
groupID = szID[comm.GetRandW(szW)] // 获得小组ID
fmt.Printf("大组类型为1的,获得小组ID :%ddropID%d", groupID, lotteryId)
key := int64(lotteryId)<<31 + int64(groupID)
// 小组ID 类型判断
if this.Stype[key] == 1 { // 该小组的道具为权重掉落必定从N个道具中随机出1个道具
for i := 0; i < int(this.SNum[key]); i++ {
szW = make([]int32, 0)
szID = make([]int32, 0)
gourp = make(map[int32]int32, 0)
for _, v := range this._groupType1[key] {
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
if _, ok := gourp[_data.Groupid]; !ok {
szW = append(szW, _data.Itemwt)
szID = append(szID, _data.Id)
}
}
}
index := comm.GetRandW(szW)
_data := this.GetLotterConfById(szID[index])
fmt.Printf("获得最终的道具 :%d", _data.Id)
count := comm.GetRandNum(_data.Min, _data.Max)
// 随机获得的数量
items = append(items, &cfg.Gameatn{
A: _data.Itemid.A,
T: _data.Itemid.T,
N: _data.Itemid.N * count,
})
}
return
} else if this.Stype[key] == 2 { // 该小组中的道具为概率掉落,每个道具都会随机一次是否会掉落(单位为千分比)
for _, v := range this._groupType2[key] {
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
fmt.Printf("大组类型1小组类型2获得道具 :%v, 该道具Cid:%d", _data.Itemid, v)
if _data.Itemwt >= comm.GetRandNum(1, 1000) { // 命中
count := comm.GetRandNum(_data.Min, _data.Max)
items = append(items, &cfg.Gameatn{
A: _data.Itemid.A,
T: _data.Itemid.T,
N: _data.Itemid.N * count, // 小组产出数量
})
}
}
}
return
}
} else if this.Btype[lotteryId] == 2 { // 该大组中的小组为概率掉落,每个小组都会随机一次是否会掉落(单位为千分比)
// 每个小组id 都随机取一次
var szGroupID []int32 // 获得的权重数组
gourp := make(map[int32]*cfg.GameLotteryData, 0) // key 小组ID value 权重
for _, v := range this._lotteryType2[lotteryId] {
if _data := this.GetLotterConfById(v); _data != nil {
if (_data.Playerlvmax == 0 || _data.Playerlvmin <= lv && lv <= _data.Playerlvmax) && (_data.VIPmax == 0 || _data.VIPmin <= vipLv && vipLv <= _data.VIPmax) { // 过滤等级等条件
if _, ok := gourp[_data.Groupid]; !ok {
gourp[_data.Groupid] = _data // 小组ID 权重赋值
}
}
}
}
// 类型为2 可能会同时获得多个组id
for k, v := range gourp {
fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id)
if v.Itemwt >= comm.GetRandNum(0, 1000) { // 命中
szGroupID = append(szGroupID, k)
key := int64(lotteryId)<<31 + int64(k)
if this.Stype[key] == 1 { // 随机一组数据
for i := 0; i < int(this.SNum[key]); i++ {
szW := make([]int32, 0)
szID := make([]int32, 0)
gourp := make(map[int32]int32, 0)
for _, v := range this._groupType1[key] {
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
if _, ok := gourp[_data.Groupid]; !ok {
szW = append(szW, _data.Itemwt)
szID = append(szID, _data.Id)
}
}
}
index := comm.GetRandW(szW)
_data := this.GetLotterConfById(szID[index])
fmt.Printf("获得最终的道具 :%d", _data.Id)
count := comm.GetRandNum(_data.Min, _data.Max)
// 随机获得的数量
items = append(items, &cfg.Gameatn{
A: _data.Itemid.A,
T: _data.Itemid.T,
N: _data.Itemid.N * count,
})
}
} else if this.Stype[key] == 2 {
for _, v := range this._groupType2[key] {
if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值
fmt.Printf("大组类型2小组类型2获得道具 :%v该道具Cid:%d", _data.Itemid, v)
if _data.Itemwt >= comm.GetRandNum(1, 1000) { // 命中
count := comm.GetRandNum(_data.Min, _data.Max)
items = append(items, &cfg.Gameatn{
A: _data.Itemid.A,
T: _data.Itemid.T,
N: _data.Itemid.N * count, // 小组产出数量
})
}
}
}
}
}
}
}
return
}
func (this *MCompConfigure) LoadConfigure(name string, fn interface{}) (err error) {
return configure.RegisterConfigure(name, fn, nil)
}
//加载一个配置文件
func (this *MCompConfigure) LoadDropData() {
if v, err := this.GetConfigure(game_drop); err == nil {
if configure, ok := v.(*cfg.GameDrop); ok {
this.hlock.Lock()
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
if value.Condition == 0 {
this._dropMap[value.Dropid] = append(this._dropMap[value.Dropid], value)
} else {
key := value.Condition
key = value.Dropid*100 + key
this._dropMap[key] = append(this._dropMap[key], value)
for _, v1 := range this._dropMap[value.Dropid] {
this._dropMap[key] = append(this._dropMap[key], v1)
}
}
}
return
}
} else {
log.Errorf("get game_pagoda conf err:%v", err)
}
return
}
//加载多个配置文件
func (this *MCompConfigure) LoadMultiConfigure(confs map[string]interface{}) (err error) {
for k, v := range confs {
err = configure.RegisterConfigure(k, v, nil)
if err != nil {
log.Errorf("配置文件:%s解析失败!", k)
break
}
}
return
}
//读取配置数据
func (this *MCompConfigure) GetConfigure(name string) (v interface{}, err error) {
return configure.GetConfigure(name)
}
//全局配置
func (this *MCompConfigure) GetGlobalConf() *cfg.GameGlobalData {
var (
configure *cfg.GameGlobal
ok bool
)
if v, err := this.GetConfigure(game_global); err != nil {
log.Errorf("get global conf err:%v", err)
return nil
} else {
if configure, ok = v.(*cfg.GameGlobal); !ok {
log.Errorf("%T no is *cfg.Game_global", v)
return nil
}
}
return configure.GetDataList()[0] // 返回对象信息
}
func (this *MCompConfigure) GetGlobalInitConf() (configure *cfg.GameInitial, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_initial); err == nil {
if configure, ok = v.(*cfg.GameInitial); !ok {
err = fmt.Errorf("%T no is *cfg.Game_comInitial", v)
return
}
}
return
}
// 主角等级经验配置列表
func (this *MCompConfigure) GetPlayerlvConfList() (list []*cfg.GamePlayerlvData) {
if v, err := this.GetConfigure(game_playerlv); err != nil {
return
} else {
if configure, ok := v.(*cfg.GamePlayerlv); !ok {
err = fmt.Errorf("%T no is *cfg.Game_playerlv", v)
return
} else {
if configure != nil {
list = configure.GetDataList()
}
}
}
return
}
// 玩家等级经验配置表
func (this *MCompConfigure) GetPlayerlvConf(lv int32) (data *cfg.GamePlayerlvData) {
if v, err := this.GetConfigure(game_playerlv); err != nil {
return
} else {
if configure, ok := v.(*cfg.GamePlayerlv); !ok {
err = fmt.Errorf("%T no is *cfg.Game_playerlv", v)
return
} else {
if configure != nil {
data = configure.GetDataMap()[lv]
}
}
}
return
}
// 玩家形象预设配置
func (this *MCompConfigure) GetPlayerFigureConf() (list []*cfg.GameFacemodData) {
if v, err := this.GetConfigure(game_facemod); err != nil {
return
} else {
if configure, ok := v.(*cfg.GameFacemod); !ok {
err = fmt.Errorf("%T no is *cfg.Game_playerlv", v)
return
} else {
if configure != nil {
list = configure.GetDataList()
}
}
}
return
}
func (this *MCompConfigure) GetDropData(dropId int32) (data []*cfg.GameDropData) {
data = this._dropMap[dropId]
return
}
func (this *MCompConfigure) GetDropReward(dropId int32) (result []*cfg.Gameatn) {
result = make([]*cfg.Gameatn, 0)
data := this.GetDropData(dropId)
if len(data) == 0 {
return
}
szW := make([]int32, 0)
for _, value := range data {
szW = append(szW, value.P)
}
index := comm.GetRandW(szW)
result = append(result, data[index].Prize...)
return
}
func (this *MCompConfigure) GetColor(id int32) (item *cfg.GameGameColorData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_gamecolor); err == nil {
return
} else {
if item, ok = v.(*cfg.GameGameColor).GetDataMap()[id]; !ok {
err = fmt.Errorf("on found color:%d", id)
}
}
return
}
// 获取英雄原始星级
func (this *MCompConfigure) GetHeroConfig(heroCfgId string) *cfg.GameHeroData {
if v, err := this.GetConfigure(new_hero); err == nil {
if configure, ok := v.(*cfg.GameHero); ok {
if v, ok := configure.GetDataMap()[heroCfgId]; ok {
return v
}
}
}
return nil
}
// 获取英雄原始星级
func (this *MCompConfigure) GetHeroConfigStar(heroCfgId string) int32 {
if v, err := this.GetConfigure(new_hero); err == nil {
if configure, ok := v.(*cfg.GameHero); ok {
if v, ok := configure.GetDataMap()[heroCfgId]; ok {
return v.Star
}
}
}
return 0
}
// 获取签到信息
func (this *MCompConfigure) GetSignConf(day, group int32) *cfg.GameSignData {
if v, ok := this._sign[day<<8+group]; ok {
return v
}
return nil
}
// 获取组id
func (this *MCompConfigure) GetSignResetConf(id int32) int32 {
if v, err := this.GetConfigure(game_signreset); err == nil {
if configure, ok := v.(*cfg.GameSignReset); ok {
if configure != nil {
return configure.Get(id).Groups
}
}
}
return -1
}
func (this *MCompConfigure) LoadSignData() {
if v, err := this.GetConfigure(game_sign); err == nil {
if configure, ok := v.(*cfg.GameSign); ok {
this.hlock.Lock()
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
this._sign[value.Day<<8+value.Group] = value
}
return
}
} else {
log.Errorf("get game_sign conf err:%v", err)
}
return
}
func (this *MCompConfigure) GetHeroConfigData() (data []*cfg.GameHeroData) {
if v, err := this.GetConfigure(new_hero); err == nil {
if configure, ok := v.(*cfg.GameHero); ok {
return configure.GetDataList()
}
}
return nil
}
//读取物品配置
func (this *MCompConfigure) GetItemConfigureData(id string) (item *cfg.GameItemData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_item); err != nil {
log.Errorf("err:%v", err)
return
} else {
if item, ok = v.(*cfg.GameItem).GetDataMap()[id]; !ok {
err = fmt.Errorf("no found item:%s configure", id)
log.Errorf("err:%v", err)
return
}
}
return
}
func (this *MCompConfigure) GetVipConfigureData(lv int32) (item *cfg.GameVipData) {
if v, err := this.GetConfigure(game_vip); err == nil {
if configure, ok := v.(*cfg.GameVip); ok {
item = configure.Get(lv)
}
}
return
}
func (this *MCompConfigure) GetItemConfigureByType(useType int32) (item []*cfg.GameItemData) {
if v, err := this.GetConfigure(game_item); err == nil {
for _, v1 := range v.(*cfg.GameItem).GetDataMap() {
if v1.Usetype == useType {
item = append(item, v1)
}
}
}
return
}
func (this *MCompConfigure) GetEquipmentConfigureById(equipmentId string) (configure *cfg.GameEquipData) {
if v, err := this.GetConfigure(game_equip); err == nil {
configure = v.(*cfg.GameEquip).Get(equipmentId)
return
}
return
}
func (this *MCompConfigure) GetAllItemConfigure() (item []*cfg.GameItemData) {
if v, err := this.GetConfigure(game_item); err == nil {
for _, v1 := range v.(*cfg.GameItem).GetDataMap() {
item = append(item, v1)
}
}
return
}
func (this *MCompConfigure) GetAllEquipmentConfigure() (configure []*cfg.GameEquipData) {
if v, err := this.GetConfigure(game_equip); err == nil {
for _, v1 := range v.(*cfg.GameEquip).GetDataMap() {
configure = append(configure, v1)
}
return
}
return
}
func (this *MCompConfigure) GetLotterConfById(id int32) (data *cfg.GameLotteryData) {
if v, err := this.GetConfigure(game_lottery); err == nil {
if configure, ok := v.(*cfg.GameLottery); ok {
return configure.Get(id)
}
}
return
}

50
modules/tools/module.go Normal file
View File

@ -0,0 +1,50 @@
package tools
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
func NewModule() core.IModule {
m := new(Tools)
return m
}
type Tools struct {
modules.ModuleBase
configure *MCompConfigure
}
//模块名
func (this *Tools) GetType() core.M_Modules {
return comm.ModuleTools
}
//模块初始化接口 注册用户创建角色事件
func (this *Tools) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
//模块初始化接口 注册用户创建角色事件
func (this *Tools) Start() (err error) {
err = this.ModuleBase.Start()
return
}
//装备组件
func (this *Tools) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure)
}
func (this *Tools) GetGroupDataByLottery(lotteryId int32, vipLv int32, lv int32) (items []*cfg.Gameatn) {
items = this.configure.GetGroupDataByLottery(lotteryId, vipLv, lv)
return
}
func (this *Tools) GetGlobalConf() *cfg.GameGlobalData {
return this.configure.GetGlobalConf()
}

View File

@ -44,7 +44,7 @@ func (this *ModelExpand) GetUserExpand(uid string) (result *pb.DBUserExpand, err
}
} else {
if err = this.Get(uid, result); err != nil && mongo.ErrNoDocuments == err {
globalConf := this.module.configure.GetGlobalConf()
globalConf := this.module.ModuleTools.GetGlobalConf()
initUpdate := map[string]interface{}{
"uid": uid,
"modifynameCount": 1, //修改名称1次

View File

@ -85,7 +85,7 @@ func (this *User) Start() (err error) {
this.service.RegisterFunctionName(Rpc_QueryUser, this.RpcQueryUser)
//date 3.10
this.service.RegisterFunctionName(Rpc_CreateSociaty, this.RpcCreateSociaty)
this.globalConf = this.configure.GetGlobalConf()
this.globalConf = this.ModuleTools.GetGlobalConf()
if this.globalConf == nil {
err = errors.New("global config not found")
}
@ -479,7 +479,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
return
}
}
ggd := this.configure.GetGlobalConf()
ggd := this.ModuleTools.GetGlobalConf()
if ggd == nil {
return
}
@ -808,7 +808,7 @@ func (this *User) recoverUserPs(uid string) {
if u == nil {
return
}
ggd := this.configure.GetGlobalConf()
ggd := this.ModuleTools.GetGlobalConf()
if ggd == nil {
return
}

View File

@ -256,7 +256,7 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR
atno = make([]*pb.UserAtno, 0)
conf := this.configure.GetVikingBossConfigData(bossId, difficulty)
tasks := make([]*comm.TaskParam, 0)
// costRes := this.configure.GetGlobalConf().VikingExpeditionCos
// costRes := this.ModuleTools.GetGlobalConf().VikingExpeditionCos
// if costRes == nil {
// code = pb.ErrorCode_ConfigNoFound
// return

View File

@ -329,9 +329,9 @@ func (this *ModelWorldtask) filterTask(userLv, des int32, wt *pb.DBWorldtask) (t
func (this *ModelWorldtask) randomTask(userLv, des int32, wt *pb.DBWorldtask) (taskIds []int32) {
var num int32
if des == 1 {
num = this.moduleWorldtask.configure.GetGlobalConf().DailyNum
num = this.moduleWorldtask.ModuleTools.GetGlobalConf().DailyNum
} else if des == 4 {
num = this.moduleWorldtask.configure.GetGlobalConf().WeekNum
num = this.moduleWorldtask.ModuleTools.GetGlobalConf().WeekNum
}
tIds := this.filterTask(userLv, des, wt)

View File

@ -88,7 +88,7 @@ type DBStove struct {
Skill map[int32]int32 `protobuf:"bytes,5,rep,name=skill,proto3" json:"skill" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 台子技能
Forge map[int32]int32 `protobuf:"bytes,6,rep,name=forge,proto3" json:"forge" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 套装类型 value 打造次数
Temperature int32 `protobuf:"varint,7,opt,name=temperature,proto3" json:"temperature"` // 炉子温度
RecoveTime int64 `protobuf:"varint,8,opt,name=recoveTime,proto3" json:"recoveTime"` // 恢复满时间
RecoveTime int64 `protobuf:"varint,8,opt,name=recoveTime,proto3" json:"recoveTime" bson:"recoveTime"` //恢复满时间
Hit map[int32]int32 `protobuf:"bytes,9,rep,name=hit,proto3" json:"hit" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}

View File

@ -360,7 +360,7 @@ func convertServiceSttings(config *comm.GameConfig, id int, stype string, ip str
sseting.Sys["configure"] = map[string]interface{}{
"ConfigurePath": "./json",
"TimestampFile": "./timestamp.text",
"TimestampFile": fmt.Sprintf("/home/www/default/changetime/_data_dreamworksserver_s%s.txt", config.AreaId),
}
sseting.Sys["wordfilter"] = map[string]interface{}{
"WorldFile": "./wordfilter.json",

View File

@ -39,6 +39,7 @@ import (
"go_dreamfactory/modules/sociaty"
"go_dreamfactory/modules/sys"
"go_dreamfactory/modules/task"
"go_dreamfactory/modules/tools"
"go_dreamfactory/modules/troll"
"go_dreamfactory/modules/user"
"go_dreamfactory/modules/viking"
@ -115,6 +116,7 @@ func main() {
dispatch.NewModule(),
atlas.NewModule(),
practice.NewModule(),
tools.NewModule(),
)
}

View File

@ -20,7 +20,6 @@ type GamePandamasJxData struct {
Access int32
Heroid string
Img string
Ico string
Intr string
Description string
Duration int32
@ -47,7 +46,6 @@ func (_v *GamePandamasJxData)Deserialize(_buf map[string]interface{}) (err error
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["access"].(float64); !_ok_ { err = errors.New("access error"); return }; _v.Access = int32(_tempNum_) }
{ var _ok_ bool; if _v.Heroid, _ok_ = _buf["heroid"].(string); !_ok_ { err = errors.New("heroid error"); return } }
{ var _ok_ bool; if _v.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } }
{ var _ok_ bool; if _v.Ico, _ok_ = _buf["ico"].(string); !_ok_ { err = errors.New("ico error"); return } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["intr"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Intr error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Intr, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["description"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Description error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Description, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["duration"].(float64); !_ok_ { err = errors.New("duration error"); return }; _v.Duration = int32(_tempNum_) }

View File

@ -16,12 +16,8 @@ type GameCoinData struct {
Color int32
Effects string
Access int32
Star int32
Race int32
Img string
Ico string
Intr string
Tipstxt string
}
const TypeId_GameCoinData = 1416227927
@ -36,12 +32,8 @@ func (_v *GameCoinData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["color"].(float64); !_ok_ { err = errors.New("color error"); return }; _v.Color = int32(_tempNum_) }
{ var _ok_ bool; if _v.Effects, _ok_ = _buf["effects"].(string); !_ok_ { err = errors.New("effects error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["access"].(float64); !_ok_ { err = errors.New("access error"); return }; _v.Access = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["race"].(float64); !_ok_ { err = errors.New("race error"); return }; _v.Race = int32(_tempNum_) }
{ var _ok_ bool; if _v.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } }
{ var _ok_ bool; if _v.Ico, _ok_ = _buf["ico"].(string); !_ok_ { err = errors.New("ico error"); return } }
{ var _ok_ bool; if _v.Intr, _ok_ = _buf["intr"].(string); !_ok_ { err = errors.New("intr error"); return } }
{ var _ok_ bool; if _v.Tipstxt, _ok_ = _buf["tipstxt"].(string); !_ok_ { err = errors.New("tipstxt error"); return } }
return
}

View File

@ -19,23 +19,18 @@ type GameItemData struct {
Index int32
SpecialType int32
Time int32
Reddottype int32
Effects string
BoxId int32
SynthetizeNum int32
Access []int32
UseSkip int32
UpperLimit int32
Uselv int32
Isani int32
Star int32
Race int32
Img string
Ico string
Intr string
Sale []*Gameatn
SynthetizeDeplete []*Gameatn
DecomposeDeplete []*Gameatn
Tipstxt string
}
const TypeId_GameItemData = -984700967
@ -53,6 +48,7 @@ func (_v *GameItemData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["index"].(float64); !_ok_ { err = errors.New("index error"); return }; _v.Index = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["special_type"].(float64); !_ok_ { err = errors.New("special_type error"); return }; _v.SpecialType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["time"].(float64); !_ok_ { err = errors.New("time error"); return }; _v.Time = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["reddottype"].(float64); !_ok_ { err = errors.New("reddottype error"); return }; _v.Reddottype = int32(_tempNum_) }
{ var _ok_ bool; if _v.Effects, _ok_ = _buf["effects"].(string); !_ok_ { err = errors.New("effects error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["box_id"].(float64); !_ok_ { err = errors.New("box_id error"); return }; _v.BoxId = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["synthetize_num"].(float64); !_ok_ { err = errors.New("synthetize_num error"); return }; _v.SynthetizeNum = int32(_tempNum_) }
@ -72,12 +68,7 @@ func (_v *GameItemData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["use_skip"].(float64); !_ok_ { err = errors.New("use_skip error"); return }; _v.UseSkip = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["upper_limit"].(float64); !_ok_ { err = errors.New("upper_limit error"); return }; _v.UpperLimit = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["uselv"].(float64); !_ok_ { err = errors.New("uselv error"); return }; _v.Uselv = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["isani"].(float64); !_ok_ { err = errors.New("isani error"); return }; _v.Isani = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["race"].(float64); !_ok_ { err = errors.New("race error"); return }; _v.Race = int32(_tempNum_) }
{ var _ok_ bool; if _v.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } }
{ var _ok_ bool; if _v.Ico, _ok_ = _buf["ico"].(string); !_ok_ { err = errors.New("ico error"); return } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["intr"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Intr error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Intr, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{
var _arr_ []interface{}
@ -121,7 +112,6 @@ func (_v *GameItemData)Deserialize(_buf map[string]interface{}) (err error) {
}
}
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["tipstxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Tipstxt error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Tipstxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
return
}