Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
645a4158ee
@ -31,6 +31,7 @@ const (
|
||||
HeroType = "hero" //卡片资源 例如英雄卡,检验卡
|
||||
EquipmentType = "equi" //武器资源
|
||||
VipType = "vip" //vip
|
||||
AtlasType = "atlas" //
|
||||
)
|
||||
|
||||
type Autogenerated struct {
|
||||
|
@ -409,4 +409,8 @@ type (
|
||||
//推送战斗结束
|
||||
PvpFinishPush(battleId string)
|
||||
}
|
||||
|
||||
ISmithy interface {
|
||||
CheckActivateAtlasCollect(uid string, id string) (code pb.ErrorCode)
|
||||
}
|
||||
)
|
||||
|
@ -38,6 +38,7 @@ type ModuleBase struct {
|
||||
ModuleRtask comm.IRtask //随机任务
|
||||
ModuleSociaty comm.ISociaty //公会
|
||||
ModulePrivilege comm.IPrivilege // 月卡
|
||||
ModuleSmithy comm.ISmithy //
|
||||
}
|
||||
|
||||
//重构模块配置对象
|
||||
@ -114,6 +115,11 @@ func (this *ModuleBase) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.ModulePrivilege = module.(comm.IPrivilege)
|
||||
|
||||
if module, err = this.service.GetModule(comm.ModuleSmithy); err != nil {
|
||||
return
|
||||
}
|
||||
this.ModuleSmithy = module.(comm.ISmithy)
|
||||
return
|
||||
}
|
||||
|
||||
@ -378,12 +384,14 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
attrs map[string]int32 // 属性
|
||||
equips map[string]uint32 // 装备
|
||||
vip map[string]int32 // vip
|
||||
atlas map[string]int32 //
|
||||
)
|
||||
items = make(map[string]int32, 0)
|
||||
heros = make(map[string]int32, 0)
|
||||
attrs = make(map[string]int32, 0)
|
||||
equips = make(map[string]uint32, 0)
|
||||
vip = make(map[string]int32, 0)
|
||||
atlas = make(map[string]int32, 0)
|
||||
|
||||
for _, v := range res {
|
||||
switch v.A {
|
||||
@ -425,7 +433,12 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
code, _ = this.ModulePrivilege.Delivery(session, k)
|
||||
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
|
||||
}
|
||||
|
@ -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)
|
||||
needTemperatureCos = reelcfg.TemperatureCos * (1000 - t) / 1000
|
||||
// 检查炉温 是否够
|
||||
if stove.Temperature < needTemperatureCos {
|
||||
code = pb.ErrorCode_SmithyNoTemperature // 炉温不够 直接返回
|
||||
return
|
||||
}
|
||||
|
||||
if req.Lava > 0 { // 是否是熔岩打造
|
||||
exemption := this.module.configure.GetGlobalConf().ExemptionTemperatureCos // 预计消耗温度
|
||||
raise_temperatureNum := this.module.configure.GetGlobalConf().ExemptionTemperatureCosNum
|
||||
raise_temperatureNum = req.Lava * exemption.N
|
||||
if needTemperatureCos > raise_temperatureNum {
|
||||
exemption_TemperatureCosNum := this.module.configure.GetGlobalConf().ExemptionTemperatureCosNum
|
||||
exemption_TemperatureCosNum = req.Lava * exemption_TemperatureCosNum
|
||||
if needTemperatureCos > exemption_TemperatureCosNum {
|
||||
code = pb.ErrorCode_SmithyLackLava // 缺少熔岩
|
||||
return
|
||||
}
|
||||
@ -111,13 +106,29 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
||||
}
|
||||
costRes = append(costRes, lavaCost)
|
||||
} else {
|
||||
// 检查炉温 是否够
|
||||
if stove.Temperature < needTemperatureCos {
|
||||
code = pb.ErrorCode_SmithyNoTemperature // 炉温不够 直接返回
|
||||
return
|
||||
}
|
||||
stove.Temperature -= needTemperatureCos // 消耗温度
|
||||
update["temperature"] = stove.Temperature
|
||||
}
|
||||
|
||||
costRes = append(costRes, reelcfg.BasicCos...)
|
||||
subAtn := this.module.modelStove.CheckForgeConsume(req.ReelId, stove.Data[req.ReelId].Lv)
|
||||
costRes = append(costRes, subAtn...)
|
||||
//costRes = append(costRes, subAtn...)
|
||||
// 异常处理 防止不消耗该道具 但是技能做了该道具的减免
|
||||
for _, v := range costRes {
|
||||
for _, v1 := range subAtn {
|
||||
if v.A == v1.A && v.T == v1.T {
|
||||
v.N += v1.N
|
||||
}
|
||||
}
|
||||
if v.N < 0 {
|
||||
v.N = 0
|
||||
}
|
||||
}
|
||||
if code = this.module.CheckRes(session, costRes); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
)
|
||||
|
||||
type Smithy struct {
|
||||
@ -43,6 +44,7 @@ func (this *Smithy) OnInstallComp() {
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
this.modelTrade = this.RegisterComp(new(modelTrade)).(*modelTrade)
|
||||
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)
|
||||
}
|
||||
}
|
||||
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