From c750a0876158de5837ee7679618cad9a5a7d0051 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 28 Jun 2022 19:26:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=AD=A6=E5=99=A8=E5=A5=97?= =?UTF-8?q?=E8=A3=85=E6=95=88=E6=9E=9C=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/equipment/api_equip.go | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/modules/equipment/api_equip.go b/modules/equipment/api_equip.go index 7173d36d0..5731c0469 100644 --- a/modules/equipment/api_equip.go +++ b/modules/equipment/api_equip.go @@ -88,13 +88,37 @@ func (this *apiComp) Equip(session comm.IUserSession, agrs map[string]interface{ } } } - for i, _ := range equipments { - if i != int(confs[i].Pos) { - log.Errorf("Equip conf:%v Target:%d Incorrect range!", confs[i], i) - code = pb.ErrorCode_SystemError - return + msuit := true + subsit := true + for i, v := range equipments { //校验装备位置 + if v != nil { + if i != int(confs[i].Pos) { + log.Errorf("Equip conf:%v Target:%d Incorrect range!", confs[i], i) + code = pb.ErrorCode_SystemError + return + } + } else { + if i < 4 { + msuit = false //主套装没有 + } else { + subsit = false //辅套装没有 + } } } + + if msuit { //前4个位置都有装备 判断是否存在套装 + if confs[0].Suittype == confs[1].Suittype && + confs[1].Suittype == confs[2].Suittype && + confs[2].Suittype == confs[3].Suittype { + + } + } + if subsit { //后2个位置都有装备 判断是否存在套装 + if confs[4].Suittype == confs[5].Suittype { + + } + } + //更新装备数据加成 if code = this.module.hero.UpdateEquipment(hero, equipments); code == pb.ErrorCode_Success { if err = this.module.modelEquipment.UpdateByHeroId(session.GetUserId(), updatequipment...); err != nil { log.Errorf("Equip err%v", err)