/** * 道具系統 */ 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; } }