/**
* 道具系统
*/
public class ItemBase implements Serializable {
/**
* 不可装备
*/
public static final int ITEM_POS_NONE = 0;
/**
* 头部
*/
public static final int ITEM_POS_HEAD = 1;
/**
* 胸部(盔甲)
*/
public static final int ITEM_POS_ARMOR = 2;
/**
* 脚部(靴子)
*/
public static final int ITEM_POS_BOOT = 3;
/**
* 武器
*/
public static final int ITEM_POS_WEAPON = 4;
/**
* 腰部
*/
public static final int ITEM_POS_WAIST = 5;
/**
* 项链
*/
public static final int ITEM_POS_NECKLACE = 6;
/**
* 饰品(戒指)
*/
public static final int ITEM_POS_DECORATE = 7;
/**
* 宠物
*/
public static final int ITEM_POS_PET = 100;
static final String DESC_ITEM_POS_NONE = "不可装备";
static final String DESC_ITEM_POS_HEAD = "头部";
static final String DESC_ITEM_POS_ARMOR = "胸部(盔甲)";
static final String DESC_ITEM_POS_BOOT = "脚部(靴子)";
static final String DESC_ITEM_POS_WEAPON = "武器";
static final String DESC_ITEM_POS_WAIST = "腰部";
static final String DESC_ITEM_POS_NECKLACE = "项链";
static final String DESC_ITEM_POS_DECORATE = "饰品(戒指)";
static final String DESC_ITEM_POS_PET = "宠物";
// *************************end :道具装备部位编码*****************************
// *************************start:道具类型编码********************************
/**
* 武器装备
*/
public static final int ITEMTYPE_DEVICE = 1;
/**
* 暗器
*/
// public static final int ITEMTYPE_HIDDENWEAPON = 2;
/**
* 战斗物品
*/
public static final int ITEMTYPE_BATTLEPROP = 3;
/**
* 宝石
*/
public static final int ITEMTYPE_BAOSHI = 30;
/**
* 魂石
*/
// public static final int ITEMTYPE_HUNSHI = 5;
/**
* 特殊道具
*/
public static final int ITEMTYPE_SPECIAL = 6;
/**
* 任务道具
*/
public static final int ITEMTYPE_TASK = 7;
/**
* 套装
*/
public static final int ITEMTYPE_SUIT = 8;
/**
* 宝箱
*/
public static final int ITEMTYPE_BOX = 9;
/**
* 配方
*/
public static final int ITEMTYPE_PRES = 10;
/**
* 宠物蛋
*/
public static final int ITEMTYPE_PETEGG = 11;
/**
* 可授权游戏道具
*/
public static final int ITEMTYPE_SHOWAUTHORITY = 21;
/**
* 采集类材料
*/
public static final int ITEMTYPE_MATERIAL_COLLECTION = 22;
/**
* 合成类材料
*/
public static final int ITEMTYPE_MATERIAL_COMPOSE = 23;
/**
* 普通杂物
*/
public static final int ITEMTYPE_WASTE = 24;
/**
* 技能书
*/
public static final int ITEMTYPE_SKILLBOOK = 25;
/**
* 宠物
*/
public static final int ITEMTYPE_PET = 26;
/**
* 礼物
*/
public static final int ITEMTYPE_PRESENT = 27;
/**
* 陷阱
*/
public static final int ITEMTYPE_TRAP = 28;
/**
* 宝石碎片
*/
public static final int ITEMTYPE_SUIPIAN = 31;
/** 任务可使用道具 */
public static final int ITEM_TASKUSE = 35;
/** 副本cd重置 */
public static final int ITEM_FBCD_RESET = 36;
/**
* 除任务道具、武器装备以外的所有道具统称为普通道具
*/
public static final int ITEMTYPE_NORMAL = 0;
// **************************end:道具类型编码**************************************
/**
* 是否可丢弃 可丢弃
*/
public static final int DROPLIMIT_YES = 1;
/**
* 是否可丢弃 不可丢弃
*/
public static final int DROPLIMIT_NO = 0;
static final String DESC_DROPLIMIT_YES = "可丢弃";
static final String DESC_DROPLIMIT_NO = "不可丢弃";
public static final int TRADELIMIT_YES = 1;
public static final int TRADELIMIT_NO = 0;
static final String DESC_TRADELIMIT_YES = "可以交易";
static final String DESC_TRADELIMIT_NO = "不能交易";
/**
* 稀有度 0等级 普通(白装)
*/
public static final int RAREVALUE_LV0_NORAML = 0;
/**
* 稀有度 (蓝装)
*/
public static final int RAREVALUE_LV1_BLUE = 1;
/**
* 稀有度 (绿装)
*/
public static final int RAREVALUE_LV2_GREEN = 2;
/**
* 稀有度 (紫装)
*/
public static final int RAREVALUE_LV3_PURPLE = 3;
static final String DESC_RAREVALUE_LV0_NORAML = "普通(白装)";
static final String DESC_RAREVALUE_LV1_BLUE = "(蓝装)";
static final String DESC_RAREVALUE_LV2_GREEN = "(绿装)";
static final String DESC_RAREVALUE_LV3_PURPLE = "(紫装)";
private Integer itemType_id;
// private ItemType itemType;// 道具类型实体
private Integer itemEquPosId;// 道具装备位置 0: 不可装备 1:头部 2:盔甲 3:靴子 4:武器 5:腰部 6:项链
// 7:饰品
private Integer tradeLimitSystem;// 人-机 交易判断 1可交易 0不可交易
private Integer tradeLimitPlayer;// 人-人 交易判断 1可交易 0不可交易
private Integer rareValue;// 稀有度 0:普通(白装) 1:人民币(蓝装) 2:金币(绿装) 3:无法购买的稀有品(紫装)
private Long price;// 价格-银两 (游戏币)
private Long goldBlock;// 价格-元宝 (人民币兑换的)
private String descMsg; // 道具描述信息
private Integer maxCascade;// 最大层叠数量
private Long devote; // 价格-贡献
private Integer codeValue;// 标识物品分类(商城分类查询)
private int maxHold;// 最大可获得数(包括银行)
/**
* 使用限制-成就
*/
private Integer useLimitGlory;
/**
* 使用限制 0:通用 1:男 2 女
*/
private Integer useLimitSex;
/**
* 等级限制 默认0 最低0级使用
*/
private Integer useLimitGrade;
/**
* 是否可丢弃 默认1 可丢弃 0不可以丢弃
*/
private Integer dropLimit;
private Set<ItemReSchool> schools = new HashSet<ItemReSchool>(0);// 可使用职业列表
private Set<EffectRelation> effectRelations;// 道具PK效果列表
public ItemBase() {
this.itemEquPosId = Integer.valueOf(0);// 装备位置 默认0为不能装备
this.tradeLimitSystem = Integer.valueOf(1);// 人-机交易设定为默认可交易
this.tradeLimitPlayer = Integer.valueOf(1);// 人-人交易设定为默认可交易
this.useLimitSex = Integer.valueOf(0); // 使用性别限制默认为通用
this.maxCascade = Integer.valueOf(1);// 最大可叠加数默认为可叠加1
this.goldBlock = Long.valueOf(0);
}
public String toString() {
return "id:" + this.getId() + "-" + "策划编号:" + this.getCode() + "-"
+ "道具名称:" + this.getName() + "-" + "道具类型:"
+ this.getItemType().getName() + "-" + "装备部位:"
+ this.getEquPosShow() + "-" + "等级限制:"
+ this.getUseLimitGrade() + "-" + "性别:" + this.getUseLimitSex()
+ "--价格-游戏币:" + this.getPrice() + "--价格-人民币:"
+ this.getGoldBlock() + "-装备稀有度:" + this.getRareValueShow()
+ "-是否可人人交易:" + this.getTradeLimitPlayerShow() + "-"
+ "是否可人机交易:" + this.getTradeLimitSystemShow();
}
public ItemBase(Integer id) {
this.id = id;
}
public String getItemClassNameByItemTypeId() {
return getItemClassNameByItemTypeId(this.getItemType().getId());
}
public String getItemTypeParam() {
return getItemClassNameByItemTypeId(this.getItemType().getId());
}
public static String getItemClassNameByItemTypeId(Integer itemTypeId) {
ItemType itemType = ServiceManager.baseService
.getObjectByID_ItemType(itemTypeId);
if (itemType != null && itemType.getCode() != null) {
return itemType.getCode();
}
return ItemBase.class.getSimpleName();
}
public String getItemTypeShow() {
return this.getItemType().getName();
}
public static String getItemTypeShow(String className) {
ItemType itemType = getItemTypeByCode(className);
if (itemType != null && itemType.getName() != null) {
return itemType.getName();
}
return "";
}
public static ItemType getItemTypeByCode(String className) {
ItemType itemType = ServiceManager.itemService
.getItemTypeByCode(className);
return itemType;
}
public static int getItemTypeByParam(String className) {
ItemType itemType = getItemTypeByCode(className);
if (itemType != null && itemType.getId() > 0) {
return itemType.getId();
}
return ITEMTYPE_NORMAL;
}
public static ItemBase getDeclaredItemBase(String className) {
return (ItemBase) util.object.ObjectUtil.getDeclaredObject(
ItemBase.class.getPackage().getName(), className);
}
public String getCode() {
return code;
}
public ItemType getItemType() {
return getItemType(itemType_id);
}
public static ItemType getItemType(int itemType_id) {
return ServiceManager.baseService.getObjectByID_ItemType(itemType_id);
}
public Integer getItemEquPosId() {
return this.itemEquPosId;
}
public void setItemEquPosId(Integer itemEquPosId) {
this.itemEquPosId = itemEquPosId;
}
public Integer getTradeLimitSystem() {
return this.tradeLimitSystem;
}
public void setTradeLimitSystem(Integer tradeLimitSystem) {
this.tradeLimitSystem = tradeLimitSystem;
}
public Integer getTradeLimitPlayer() {
return this.tradeLimitPlayer;
}
public void setTradeLimitPlayer(Integer tradeLimitPlayer) {
this.tradeLimitPlayer = tradeLimitPlayer;
}
public Integer getUseLimitSex() {
return this.useLimitSex;
}
public void setUseLimitSex(Integer useLimitSex) {
this.useLimitSex = useLimitSex;
}
public Integer getRareValue() {
return this.rareValue;
}
public void setRareValue(Integer rareValue) {
this.rareValue = rareValue;
}
public Long getPrice() {
return this.price;
}
public void setPrice(Long price) {
this.price = price;
}
public Long getGoldBlock() {
return this.goldBlock;
}
public void setGoldBlock(Long goldBlock) {
this.goldBlock = goldBlock;
}
public String getDescMsg() {
return this.descMsg;
}
public void setDescMsg(String descMsg) {
this.descMsg = descMsg;
}
public String getPicUrl() {
return this.code + ".png";
}
public Integer getMaxCascade() {
if (maxCascade == null) {
return 1;
} else if (maxCascade == 0) {
return 1;
} else {
return this.maxCascade;
}
}
public void setMaxCascade(Integer maxCascade) {
this.maxCascade = maxCascade;
}
public String getTradeLimitPlayerShow() {
return DescUtil.getDescByPropertyValue(ItemBase.class.getName(),
"TRADELIMIT_", this.tradeLimitPlayer);
}
public String getTradeLimitSystemShow() {
return DescUtil.getDescByPropertyValue(ItemBase.class.getName(),
"TRADELIMIT_", this.tradeLimitSystem);
}
public static String getRareValueShow(int rareValue) {
return DescUtil.getDescByPropertyValue(ItemBase.class.getName(),
"RAREVALUE_", rareValue);
}
public String getRareValueShow() {
if (this.rareValue == null) {
this.rareValue = RAREVALUE_LV0_NORAML;
}
return getRareValueShow(this.rareValue);
}
public static String getEquPosShow(int itemEquPosId) {
return DescUtil.getDescByPropertyValue(ItemBase.class.getName(),
"ITEM_POS_", itemEquPosId);
}
public String getEquPosShow() {
if (this.getItemEquPosId() == null) {
this.itemEquPosId = ITEM_POS_NONE;
}
return getEquPosShow(this.itemEquPosId);
}
/**
* 是否可丢弃 默认1 可丢弃 0不可以丢弃
*/
public String getDropLimitShow() {
if (this.dropLimit == null) {
this.setDropLimit(DROPLIMIT_YES);
}
return getDropLimitShow(this.dropLimit);
}
public static String getDropLimitShow(int dropLimit) {
return DescUtil.getDescByPropertyValue(ItemBase.class.getName(),
"DROPLIMIT_", dropLimit);
}
public Set<EffectRelation> getEffectRelations() {
return effectRelations;
}
public void setEffectRelations(Set<EffectRelation> effectRelations) {
this.effectRelations = effectRelations;
}
public Integer getDropLimit() {
return dropLimit;
}
public void setDropLimit(Integer dropLimit) {
this.dropLimit = dropLimit;
}
/**
* @param schools
* the schools to set
*/
public void setSchools(Set<ItemReSchool> schools) {
this.schools = schools;
}
/**
* @return the schools
*/
public Set<ItemReSchool> getSchools() {
return schools;
}
public Integer getUseLimitGrade() {
return useLimitGrade;
}
public void setUseLimitGrade(Integer useLimitGrade) {
this.useLimitGrade = useLimitGrade;
}
public String getUseLimit_jobShow() {
return getUseLimit_jobShow(this.schools);
}
public static String getUseLimit_jobShow(Set<ItemReSchool> schools) {
String result = null;
if (schools != null && schools.size() > 0) {
Iterator<ItemReSchool> its = schools.iterator();
while (its.hasNext()) {
ItemReSchool item = (ItemReSchool) its.next();
if (result != null) {
result = result + "[" + item.getSchool().getCodeDesc()
+ "]";
} else {
result = "[" + item.getSchool().getCodeDesc() + "]";
}
}
}
return result;
}
public Long getDevote() {
return devote;
}
public void setDevote(Long devote) {
this.devote = devote;
}
public Integer getItemType_id() {
return itemType_id;
}
public void setItemType_id(Integer itemType_id) {
this.itemType_id = itemType_id;
}
public Integer getCodeValue() {
return codeValue;
}
public void setCodeValue(Integer codeValue) {
this.codeValue = codeValue;
}
public String getCodeValueShow() {
if (codeValue != null) {
ItemReCode itemReCode = ServiceManager.baseService
.getObjectByID_ItemReCode(codeValue);
if (itemReCode != null)
return itemReCode.getName();
}
return DESC_NONE;
}
public int getRecommend() {
return ServiceManager.itemService.getItemCanRecommend(id);
}
public String getRecommendShow() {
if (getRecommend() == 0) {
return DESC_NO;
} else {
return DESC_YES;
}
}
public Integer getUseLimitGlory() {
return useLimitGlory;
}
public void setUseLimitGlory(Integer useLimitGlory) {
this.useLimitGlory = useLimitGlory;
}
public int getMaxHold() {
return maxHold;
}
public void setMaxHold(int maxHold) {
this.maxHold = maxHold;
}
}