图鉴资源类型发放
This commit is contained in:
parent
2f9d2d5c96
commit
e556db1c40
11
comm/core.go
11
comm/core.go
@ -26,11 +26,12 @@ type ISC_GateRouteComp interface {
|
|||||||
|
|
||||||
//游戏类资源类型
|
//游戏类资源类型
|
||||||
const (
|
const (
|
||||||
AttrType = "attr" //用户属性资源 例如货币 经验 之类的
|
AttrType = "attr" //用户属性资源 例如货币 经验 之类的
|
||||||
ItemType = "item" //道具物品资源
|
ItemType = "item" //道具物品资源
|
||||||
HeroType = "hero" //卡片资源 例如英雄卡,检验卡
|
HeroType = "hero" //卡片资源 例如英雄卡,检验卡
|
||||||
EquipmentType = "equi" //武器资源
|
EquipmentType = "equi" //武器资源
|
||||||
VipType = "vip" //vip
|
VipType = "vip" //vip
|
||||||
|
AtlasType = "atlas" //
|
||||||
)
|
)
|
||||||
|
|
||||||
type Autogenerated struct {
|
type Autogenerated struct {
|
||||||
|
@ -409,4 +409,8 @@ type (
|
|||||||
//推送战斗结束
|
//推送战斗结束
|
||||||
PvpFinishPush(battleId string)
|
PvpFinishPush(battleId string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ISmithy interface {
|
||||||
|
CheckActivateAtlasCollect(uid string, id string) (code pb.ErrorCode)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
@ -38,6 +38,7 @@ type ModuleBase struct {
|
|||||||
ModuleRtask comm.IRtask //随机任务
|
ModuleRtask comm.IRtask //随机任务
|
||||||
ModuleSociaty comm.ISociaty //公会
|
ModuleSociaty comm.ISociaty //公会
|
||||||
ModulePrivilege comm.IPrivilege // 月卡
|
ModulePrivilege comm.IPrivilege // 月卡
|
||||||
|
ModuleSmithy comm.ISmithy //
|
||||||
}
|
}
|
||||||
|
|
||||||
//重构模块配置对象
|
//重构模块配置对象
|
||||||
@ -114,6 +115,11 @@ func (this *ModuleBase) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.ModulePrivilege = module.(comm.IPrivilege)
|
this.ModulePrivilege = module.(comm.IPrivilege)
|
||||||
|
|
||||||
|
if module, err = this.service.GetModule(comm.ModuleSmithy); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.ModuleSmithy = module.(comm.ISmithy)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,12 +384,14 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
|||||||
attrs map[string]int32 // 属性
|
attrs map[string]int32 // 属性
|
||||||
equips map[string]uint32 // 装备
|
equips map[string]uint32 // 装备
|
||||||
vip map[string]int32 // vip
|
vip map[string]int32 // vip
|
||||||
|
atlas map[string]int32 //
|
||||||
)
|
)
|
||||||
items = make(map[string]int32, 0)
|
items = make(map[string]int32, 0)
|
||||||
heros = make(map[string]int32, 0)
|
heros = make(map[string]int32, 0)
|
||||||
attrs = make(map[string]int32, 0)
|
attrs = make(map[string]int32, 0)
|
||||||
equips = make(map[string]uint32, 0)
|
equips = make(map[string]uint32, 0)
|
||||||
vip = make(map[string]int32, 0)
|
vip = make(map[string]int32, 0)
|
||||||
|
atlas = make(map[string]int32, 0)
|
||||||
|
|
||||||
for _, v := range res {
|
for _, v := range res {
|
||||||
switch v.A {
|
switch v.A {
|
||||||
@ -425,7 +433,12 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
|||||||
code, _ = this.ModulePrivilege.Delivery(session, k)
|
code, _ = this.ModulePrivilege.Delivery(session, k)
|
||||||
this.Debugf("发放月卡资源: %v [%v]", k, code)
|
this.Debugf("发放月卡资源: %v [%v]", k, code)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if len(atlas) > 0 {
|
||||||
|
for k := range atlas {
|
||||||
|
code = this.ModuleSmithy.CheckActivateAtlasCollect(session.GetUserId(), k)
|
||||||
|
this.Debugf("发放图鉴资源: %v [%v]", k, code)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -86,17 +86,12 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
|||||||
// 熟练度减少的温度
|
// 熟练度减少的温度
|
||||||
t := this.module.modelStove.CheckTemperature(req.ReelId, stove.Data[req.ReelId].Lv)
|
t := this.module.modelStove.CheckTemperature(req.ReelId, stove.Data[req.ReelId].Lv)
|
||||||
needTemperatureCos = reelcfg.TemperatureCos * (1000 - t) / 1000
|
needTemperatureCos = reelcfg.TemperatureCos * (1000 - t) / 1000
|
||||||
// 检查炉温 是否够
|
|
||||||
if stove.Temperature < needTemperatureCos {
|
|
||||||
code = pb.ErrorCode_SmithyNoTemperature // 炉温不够 直接返回
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.Lava > 0 { // 是否是熔岩打造
|
if req.Lava > 0 { // 是否是熔岩打造
|
||||||
exemption := this.module.configure.GetGlobalConf().ExemptionTemperatureCos // 预计消耗温度
|
exemption := this.module.configure.GetGlobalConf().ExemptionTemperatureCos // 预计消耗温度
|
||||||
raise_temperatureNum := this.module.configure.GetGlobalConf().ExemptionTemperatureCosNum
|
exemption_TemperatureCosNum := this.module.configure.GetGlobalConf().ExemptionTemperatureCosNum
|
||||||
raise_temperatureNum = req.Lava * exemption.N
|
exemption_TemperatureCosNum = req.Lava * exemption_TemperatureCosNum
|
||||||
if needTemperatureCos > raise_temperatureNum {
|
if needTemperatureCos > exemption_TemperatureCosNum {
|
||||||
code = pb.ErrorCode_SmithyLackLava // 缺少熔岩
|
code = pb.ErrorCode_SmithyLackLava // 缺少熔岩
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -111,13 +106,18 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
|||||||
}
|
}
|
||||||
costRes = append(costRes, lavaCost)
|
costRes = append(costRes, lavaCost)
|
||||||
} else {
|
} else {
|
||||||
|
// 检查炉温 是否够
|
||||||
|
if stove.Temperature < needTemperatureCos {
|
||||||
|
code = pb.ErrorCode_SmithyNoTemperature // 炉温不够 直接返回
|
||||||
|
return
|
||||||
|
}
|
||||||
stove.Temperature -= needTemperatureCos // 消耗温度
|
stove.Temperature -= needTemperatureCos // 消耗温度
|
||||||
update["temperature"] = stove.Temperature
|
update["temperature"] = stove.Temperature
|
||||||
}
|
}
|
||||||
|
|
||||||
costRes = append(costRes, reelcfg.BasicCos...)
|
costRes = append(costRes, reelcfg.BasicCos...)
|
||||||
subAtn := this.module.modelStove.CheckForgeConsume(req.ReelId, stove.Data[req.ReelId].Lv)
|
// subAtn := this.module.modelStove.CheckForgeConsume(req.ReelId, stove.Data[req.ReelId].Lv)
|
||||||
costRes = append(costRes, subAtn...)
|
// costRes = append(costRes, subAtn...)
|
||||||
if code = this.module.CheckRes(session, costRes); code != pb.ErrorCode_Success {
|
if code = this.module.CheckRes(session, costRes); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Smithy struct {
|
type Smithy struct {
|
||||||
@ -43,6 +44,7 @@ func (this *Smithy) OnInstallComp() {
|
|||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
this.modelTrade = this.RegisterComp(new(modelTrade)).(*modelTrade)
|
this.modelTrade = this.RegisterComp(new(modelTrade)).(*modelTrade)
|
||||||
this.modelStove = this.RegisterComp(new(modelStove)).(*modelStove)
|
this.modelStove = this.RegisterComp(new(modelStove)).(*modelStove)
|
||||||
|
this.modelAtlas = this.RegisterComp(new(modelAtlas)).(*modelAtlas)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 接口信息
|
// 接口信息
|
||||||
@ -66,3 +68,25 @@ func (this *Smithy) SendRdTask(session comm.IUserSession, Items []*pb.UserAssets
|
|||||||
this.ModuleRtask.SendToRtask(session, comm.Rtype51, v, k)
|
this.ModuleRtask.SendToRtask(session, comm.Rtype51, v, k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func (this *Smithy) CheckActivateAtlasCollect(uid string, id string) (code pb.ErrorCode) {
|
||||||
|
atlasConf := this.configure.GetSmithyAtlasConf(id)
|
||||||
|
if atlasConf != nil && atlasConf.TypeId == 2 {
|
||||||
|
if list, err := this.modelAtlas.getSmithyAtlasList(uid); err == nil {
|
||||||
|
if _, ok := list.Collect[id]; !ok {
|
||||||
|
list.Collect[id] = &pb.CollectData{
|
||||||
|
Id: id,
|
||||||
|
Score: atlasConf.AtlasScore,
|
||||||
|
Time: configure.Now().Unix(),
|
||||||
|
}
|
||||||
|
list.Score += atlasConf.AtlasScore
|
||||||
|
update := make(map[string]interface{}, 0)
|
||||||
|
update["collect"] = list.Collect
|
||||||
|
update["score"] = list.Score
|
||||||
|
this.modelAtlas.modifySmithyAtlasList(uid, update) // 更新分数信息
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
code = pb.ErrorCode_SmithyNoFoundAtlas
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user