//宝石融合 public void GemFusion(PlayerObject play, uint destid) { //查询所需材料id GameStruct.ItemTypeInfo destitem = ConfigManager.Instance().GetItemTypeInfo(destid); GameStruct.ItemTypeInfo srcitem = ConfigManager.Instance().GetItemTypeInfo(destid - 10); if (destitem == null || srcitem == null) { return; } GameStruct.GemInfo geminfo = ConfigManager.Instance().GetGemInfo(destitem.id); if (geminfo == null) { return; } if (!play.GetItemSystem().DeleteItemByItemID(srcitem.id, geminfo.amount)) { play.MsgBox("合成失败,数量不足"); return; } //给予道具 play.GetItemSystem().AwardItem(destitem.id, NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK); play.MsgBox("合成宝石成功!"); }
/*穿戴的装备是否符合穿戴条件 * level 等级 * profession 职业 * equip_pos 穿戴位置 * item_info 道具信息*/ //2016.1.20 //20多级以下的装备没有做判断- 暂时不写 2016.1.20 public bool IsAccordWithEquip(byte level, byte profession, byte equip_pos, RoleItemInfo item_info) { uint nStartItemId = 0; //起始道具ID int nAddIndex = 0; //索引总数- 就是该部位的装备所有数量 switch (equip_pos) { case NetMsg.MsgItemInfo.ITEMPOSITION_HELMET: //头盔 { switch (profession) { case JOB.WARRIOR: { nStartItemId = 111000; break; } case JOB.MAGE: { nStartItemId = 115000; break; } case JOB.POWER: { nStartItemId = 113000; break; } case JOB.BLOODCLAN: { nStartItemId = 117000; break; } case JOB.UNDEAD_MAGE: { nStartItemId = 119000; break; } case JOB.DRAGONRIDE: { nStartItemId = 112000; break; } } nAddIndex = 14; break; } case NetMsg.MsgItemInfo.ITEMPOSITION_NECKLACE: //项链 { switch (profession) { case JOB.WARRIOR: { nStartItemId = 121000; break; } case JOB.MAGE: { nStartItemId = 125000; break; } case JOB.POWER: { nStartItemId = 123000; break; } case JOB.BLOODCLAN: { nStartItemId = 127000; break; } case JOB.UNDEAD_MAGE: { nStartItemId = 129000; break; } case JOB.DRAGONRIDE: { nStartItemId = 122000; break; } } nAddIndex = 14; break; } case NetMsg.MsgItemInfo.ITEMPOSITION_ARMOR: //盔甲 { switch (profession) { case JOB.WARRIOR: { nStartItemId = 131000; break; } case JOB.MAGE: { nStartItemId = 135000; break; } case JOB.POWER: { nStartItemId = 133000; break; } case JOB.BLOODCLAN: { nStartItemId = 137000; break; } case JOB.UNDEAD_MAGE: { nStartItemId = 139000; break; } case JOB.DRAGONRIDE: { nStartItemId = 132000; break; } } nAddIndex = 14; break; } case NetMsg.MsgItemInfo.ITEMPOSITION_WEAPONR: //武器 { switch (profession) { case JOB.WARRIOR: { if (item_info.itemid >= 420000) { nStartItemId = 420000; //剑 } else { nStartItemId = 410000; //刀 } break; } case JOB.MAGE: { nStartItemId = 440000; break; } case JOB.POWER: { nStartItemId = 490000; break; } case JOB.BLOODCLAN: { nStartItemId = 450000; break; } case JOB.UNDEAD_MAGE: { nStartItemId = 430000; break; } case JOB.DRAGONRIDE: { nStartItemId = 480000; break; } } nAddIndex = 27; break; } case NetMsg.MsgItemInfo.ITEMPOSITION_TREASURE: //手镯 { switch (profession) { case JOB.WARRIOR: { nStartItemId = 141000; break; } case JOB.MAGE: { nStartItemId = 145000; break; } case JOB.POWER: { nStartItemId = 143000; break; } case JOB.BLOODCLAN: { nStartItemId = 147000; break; } case JOB.UNDEAD_MAGE: { nStartItemId = 149010; break; } case JOB.DRAGONRIDE: { nStartItemId = 142000; break; } } nAddIndex = 14; break; } case NetMsg.MsgItemInfo.ITEMPOSITION_SHOES: //鞋子 { switch (profession) { case JOB.WARRIOR: { nStartItemId = 161000; break; } case JOB.MAGE: { nStartItemId = 165000; break; } case JOB.POWER: { nStartItemId = 163000; break; } case JOB.BLOODCLAN: { nStartItemId = 167000; break; } case JOB.UNDEAD_MAGE: { nStartItemId = 169000; break; } case JOB.DRAGONRIDE: { nStartItemId = 162000; break; } } nAddIndex = 10; break; } } GameStruct.ItemTypeInfo type_info = null; for (int i = 0; i < nAddIndex; i++) { type_info = ConfigManager.Instance().GetItemTypeInfo(nStartItemId); if (type_info != null && type_info.req_level >= level) { if (type_info.req_level == level) { break; } nStartItemId -= 10; type_info = ConfigManager.Instance().GetItemTypeInfo(nStartItemId); break; } nStartItemId += 10; } if (type_info == null) { return(false); } //符合穿戴需求 GameStruct.ItemTypeInfo _item_info = ConfigManager.Instance().GetItemTypeInfo(item_info.itemid); if (_item_info == null) { return(false); } //道具名称一样- if (String.Compare(type_info.name, _item_info.name) == 0) { return(true); } return(false); }