Files
fc/dev/project/library/imports/db/db1e5306-78dd-4742-a857-e359e8c31280.js
2026-05-24 10:21:26 +08:00

403 lines
9.1 KiB
JavaScript

"use strict";
cc._RF.push(module, 'db1e5MGeN1HQqhX41nowxKA', 'backpack_const');
// Scripts/mod/backpack/backpack_const.js
"use strict";
//
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
// 背包通用常量
// <br/>Create: new Date().toISOString()
//
var BackPackConst = {
Item_PartnerNine: "90900",
Item_PartnerTen: "91000",
Item_PartnerFiveWater: "90501",
Item_PartnerFiveFire: "90502",
Item_PartnerFiveWind: "90503",
Item_PartnerFiveBright: "90504",
Item_PartnerFiveDark: "90505",
Bag_Code: {
BACKPACK: 1,
// 背包
STORAGE: 2,
// 仓库
EQUIPS: 3 // 装备
},
quality: {
white: 0,
// 白
green: 1,
// 绿
blue: 2,
// 蓝
purple: 3,
// 紫
orange: 4,
// 橙
red: 5,
// 红
golden: 6 // 金
},
item_type: {
NORMAL: 0,
// 普通
WEAPON: 1,
// 武器
SHOE: 2,
// 鞋子
CLOTHES: 3,
// 衣服
HAT: 4,
// 头盔
ASSET: 7,
// 资产
MATERIALS: 9,
// 材料
ARTIFACTCHIPS: 10,
// 神器(现在叫 符文)
GOD_EARRING: 23,
// 神装_耳环
GOD_RING: 24,
// 神装_戒指
GOD_NECKLACE: 25,
// 神装_项链
GOD_BANGLE: 26,
// 神装_手镯
HERO_HUN: 29,
WEEK_CARD: 27,
// 周卡
HERO_SKIN: 28,
// 英雄皮肤
ELFIN: 36,
//精靈
ELFIN_EGG: 37,
//精靈蛋
ELFIN_ITEM: 38,
//精靈孵化道具(錘子)
Exclusive: 41,
// 专属武器
ProductsGift: 42,
// 挂機產物禮包
GIFT: 100,
// 礼包
FREE_GIFT: 101,
// 自选礼包
PARTNER_DEBRIS: 102,
// 伙伴碎片
STAR_SOUL: 105,
// 星命
SKIN_DEBRIS: 110,
// 皮肤碎片
ACT_ITEM: 500 // 活動道具
},
item_sub_type: {
OTHERS: 0,
// 其他
EQUIPS: 1,
// 装备
PROPS: 2,
// 道具
HERO: 3,
// 英雄
SPECIAL: 4,
// 特殊
HOLYEQUIPMENT: 5,
// 神装
ELFIN: 6 // 精灵
},
// 背包中物品的使用类型,只区分消耗和非消耗类
item_use_type: {
NO_DIRECT_USE: 0,
// 不能直接使用
CONSUM: 1,
// 消耗,直接使用的
NO_CONSUM: 2,
// 不消耗
EQUIP: 3,
// 穿戴
BATCH_USE: 4 // 批量使用
},
// 道具操作类型
ItemOps: {
None: 0,
Use: 1,
// 使用
Compound: 2,
// 合成
Sell: 3,
// 出售
Recast: 4,
// 重铸
Resolve: 5,
// 分解
Equip: 6,
// 穿戴
Detail: 7,
// 详情
Lookup: 8,
// 查看
Refine: 9,
// 查看
SkinCompound: 10 // 皮肤合成
},
// 道具操作特殊子类型
ItemOpSubType: {
Begin: 10000,
// 使用类
UseSingle: 10101,
// 单个使用
UseBatch: 10102,
// 批量使用
UseGift: 10103,
// 自选礼包
UseSectMore: 10104,
// 多种类礼包批量操作
// 合成类
CompoundPartnerFrag: 10201 // 伙伴碎片合成
},
// 物品tips按钮需要枚举
tips_btn_type: {
source: 1,
//来源
goods_use: 2,
//普通物品使用
boss_source: 3,
//跳转世界boss界面
drama_new_source: 4,
//跳转剧情副本最新的关卡页面
drama_source: 5,
//跳转剧情副本界面
hero_source: 6,
//跳转英雄信息界面--- 僚机
skill_source: 7,
//跳转英雄技能界面
form_source: 8,
//跳转编队阵法界面
call_source: 9,
//跳转召唤界面
artifact_source: 10,
//跳转神器重铸界面
redbag: 11,
//红包
head: 12,
//个人设置头像
chenghao: 13,
//个人设置称号
stone_upgrade: 14,
//跳转宝石升级界面
partner_character: 15,
//跳转形象设置
arena_source: 16,
//跳转竞技场
low_treasure: 17,
//跳转幸运探宝
high_treasure: 18,
//跳转高级探宝
seerpalace_summon: 19,
// 先知殿
seerpalace_change: 20,
// 先知召唤
// tanwei: 20, //摆摊
use_dif: 21,
// 使用
sell: 21,
//出售
sell2: 22,
//按物品表填的价值出售!
fenjie: 30,
//分解
hecheng: 31,
//英雄碎片合成
talent_sell: 32,
//神器合成
upgrade_star: 33,
// 伙伴直升卡,升星的
item_sell: 37,
//道具出售
elfin_hatch: 52,
//跳轉到精靈孵化(使用精靈蛋或孵化道具)
elfin_rouse: 41,
//跳轉到精靈古樹(使用古樹培養道具)
petard: 42,
// 花火大會
return_action: 43,
// 回歸活動
herosoul_shop: 44,
// 英魂商店
elfin_egg_synthetic: 45,
// 精靈蛋合成
elfin_summon: 46,
//跳轉到精靈召喚
// 新增
JumpToSingleHero: 47,
//查看--跳转单角色预览界面
RuneUpStar: 34,
// 符文:升星
RuneReMake: 35,
// 符文:重铸
RuneSell: 36,
// 符文:分解
RuneEquip: 48,
// 符文:穿戴
JumpToWingman: 49,
// 僚机:跳转主界面
GodEquipmentReMake: 50,
// 神装:重铸
UseExchange: 51,
// 新增 材料兑换
SectMoreUse: 53,
//多种类物品批量使用
SkinCompound: 54 // 皮肤合成
},
// 物品消耗使用还是出售
ItemConsumeType: {
use: 1,
sell: 2,
resolve: 3,
special: 4
},
// 神裝階名字
holyequip_jie_name: ["lab_equip_tips_tip4", "lab_equip_tips_tip5", "lab_equip_tips_tip6"],
// 监测是否为装备
checkIsEquip: function checkIsEquip(type) {
return type == this.item_type.WEAPON || type == this.item_type.SHOE || type == this.item_type.CLOTHES || type == this.item_type.HAT;
},
checkIsArtifact: function checkIsArtifact(type) {
return type == BackPackConst.item_type.ARTIFACTCHIPS;
},
// 是否為精靈孵化道具(錘子)
chekcIsElfinItem: function chekcIsElfinItem(_type) {
return _type == BackPackConst.item_type.ELFIN_ITEM;
},
// 是否為精靈蛋
checkIsElfinEgg: function checkIsElfinEgg(_type) {
return _type == BackPackConst.item_type.ELFIN_EGG;
},
checkIsElfin: function checkIsElfin(type) {
return type == BackPackConst.item_type.ELFIN;
},
// 获取品质色
quality_color: function quality_color(quality) {
if (quality == this.quality.green) {
return gdata("color_data", "data_color16", 34);
} else if (quality == this.quality.blue) {
return gdata("color_data", "data_color16", 33);
} else if (quality == this.quality.purple) {
return gdata("color_data", "data_color16", 32);
} else if (quality == this.quality.orange) {
return gdata("color_data", "data_color16", 31);
} else if (quality == this.quality.red) {
return gdata("color_data", "data_color16", 38);
} else if (quality == this.quality.golden) {
return gdata("color_data", "data_color16", 208);
} else if (quality > this.quality.golden) {
return gdata("color_data", "data_color16", 253);
} else {
return gdata("color_data", "data_color16", 1);
}
},
// 通用获取属性值
getAttrValue: function getAttrValue(attr_key, attr_val) {
if (attr_key == null || attr_key == "" || attr_val == null || attr_val == 0) {
return 0;
}
var val_type = gdata("attr_data", "data_type", attr_key);
if (val_type == null || val_type == 1) {
return attr_val;
}
return attr_val * 0.1 + "%";
},
getEquipTipsColor: function getEquipTipsColor(quality) {
quality = quality || 0;
if (quality == this.quality.red) {
return new cc.Color(0xff, 0x9c, 0x97, 0xff);
} else if (quality == this.quality.orange) {
return new cc.Color(0xff, 0xed, 0x8b, 0xff);
} else if (quality == this.quality.purple) {
return new cc.Color(0xd4, 0xae, 0xff, 0xff);
} else if (quality == this.quality.blue) {
return new cc.Color(0x98, 0xfb, 0xff, 0xff);
} else if (quality == this.quality.green) {
return new cc.Color(0x8b, 0xff, 0x8e, 0xff);
} else return new cc.Color(0xd9, 0xd9, 0xd9, 0xff);
}
};
//是否是神裝
BackPackConst.checkIsHolyEquipment = function (_type) {
if (!_type) {
return false;
}
if (_type == BackPackConst.item_type.GOD_EARRING ||
//神裝_耳環
_type == BackPackConst.item_type.GOD_RING ||
//神裝_戒指
_type == BackPackConst.item_type.GOD_NECKLACE ||
//神裝_項鏈
_type == BackPackConst.item_type.GOD_BANGLE) {
//神裝_手鐲
return true;
}
return false;
};
// 统一信息格式
// 道具&&伙伴基本信息统一
BackPackConst.uniformData = function (_data) {
var info = null;
// 编号
if (nx.dt.numGood(_data)) {
// 配置查找
var cfg = game.configs.partner_data.data_partner_base[_data];
if (cfg) {
info = nx.dt.objClone(cfg);
} else {
info = {
id: _data
};
}
} else if (nx.dt.objNEmpty(_data)) {
info = nx.dt.objClone(_data);
}
// 空返
if (nx.dt.objEmpty(info)) {
nx.error("[uniformData]无效编号:", _data);
return null;
}
// 配置填充
if (nx.dt.objEmpty(info.config)) {
var id = info.item_id || info.id;
info.config = Utils.getItemConfig(id);
if (!info.config) {
nx.error("[uniformData]无效编号:", id);
return null;
}
}
return info;
};
module.exports = BackPackConst;
cc._RF.pop();