local lua_mongo = _G.lua_mongo -- local Msg = require("core.Msg") -- local Util = require("common.Util") -- local Grid = require("bag.Grid") -- local ItemDefine = require("bag.ItemDefine") local EquipExcel = require("excel.equip").equip -- local EquipLogic = require("equip.EquipLogic") local ItemDefine = require("bag.ItemDefine") local Util = require("common.Util") local HeroLogic = require("hero.HeroLogic") local HeroExcel = require("excel.hero") -- 装备品质 EQUIP_COLOR_1 = 1 -- 绿 EQUIP_COLOR_2 = 2 -- 蓝 EQUIP_COLOR_3 = 3 -- 紫 EQUIP_COLOR_4 = 4 -- 橙 EQUIP_COLOR_5 = 5 -- 红 -- 装备洗练时, 品质权重 EQUIPWASH_COLOR_WEIGHT = { [EQUIP_COLOR_1] = 30, [EQUIP_COLOR_2] = 25, [EQUIP_COLOR_3] = 20, [EQUIP_COLOR_4] = 15, [EQUIP_COLOR_5] = 10, } -- 装备洗练时, 品质与属性值的倍数范围(需要除以100) EQUIPWASH_COLOR_MUL = { [EQUIP_COLOR_1] = {61, 75}, [EQUIP_COLOR_2] = {76, 90}, [EQUIP_COLOR_3] = {91, 105}, [EQUIP_COLOR_4] = {106, 120}, [EQUIP_COLOR_5] = {121, 135}, } -- 生成戒指、护符的基础属性的最终值 local function generateNewBaseAttr(equipId) local equipCfg = EquipExcel[equipId] local baseAttr = Util.copyTable(equipCfg.base) local randMul = math.random(equipCfg.randomseed[1][1], equipCfg.randomseed[1][2]) for _, attrInfo in ipairs(baseAttr) do attrInfo[2] = math.floor(attrInfo[2] * randMul / 100) end return baseAttr end -- 生成装备基础属性的随机加成值 function GenEquipBaseRandomVal(equipId) local val = 1 local equipCfg = EquipExcel[equipId] if equipCfg and equipCfg.baserandom then local valAreaTb = equipCfg.baserandom[1] local minVal = (valAreaTb[1] or 1) * 100 local maxVal = (valAreaTb[2] or 1) * 100 val = math.random(minVal, maxVal) val = val / 100 end return val end -- 创建装备 function createGrid(id) local equipCfg = EquipExcel[id] if not equipCfg then assert() return end local equip = {} equip.id = id equip.uuid = lua_mongo.id() --唯一标识 equip.attr = nil --当前属性 equip.skill = nil equip.quality = 1 --默认为1 equip.putUuid = nil --装备者 equip.washAttr = nil --当前洗练属性 equip.washQuality = nil --当前洗练品质 equip.baseRandVal = GenEquipBaseRandomVal(id) if equipCfg.subType == ItemDefine.EQUIP_SUBTYPE_RING or equipCfg.subType == ItemDefine.EQUIP_SUBTYPE_AMULET then equip.quality = equipCfg.quality equip.baseAttr = generateNewBaseAttr(id) end return equip end -- function createTempGrid(id, washAttr, washQuality) if not EquipExcel[id] then assert() return end local equip = {} equip.id = id equip.attr = washAttr --当前属性 equip.quality = washQuality --默认为1 return equip end -- 获取穿戴装备的英雄的职业 function GetEquipOwnerJob(human, equipGrid) local jobId = 2 --默认是战士职业 if not human or not equipGrid or not equipGrid.putUuid then return jobId end local heroGrid = HeroLogic.getHeroGridByUuid(human, equipGrid.putUuid) if not heroGrid then return jobId end local heroCfg = HeroExcel.hero[heroGrid.id] if not heroCfg then return jobId end jobId = heroCfg.job or 0 return jobId end -- 合并装备套装属性(用于装备等级>=15级的装备) function MergeEquipSuitIm(targetData, sourceData) if not targetData or not sourceData or not next(sourceData) then return end targetData[#targetData+1] = {sourceData[1], sourceData[2]} end