//提升装备品质 public void EquipQuality(PlayerObject play, uint srcid, uint materialid) { const int LINGHUNJINGSHI = 1037160; //灵魂晶石ID const int LINGHUNWANG = 1037169; //灵魂王 const int SHENQIZHILEI = 1037200; //神祈之泪 // const int HUNWUSHENQIZHILEI = 1025754; //魂武神祈之泪 const int MAX_QUALIY = 7; //最高品质 神器 GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid); GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid); if (item == null || materialitem == null) { return; } if (item.GetQuality() == MAX_QUALIY) { return; //已达到最高品质 } int rand = GameStruct.IRandom.Random(1, 100); bool bUpdate = false; if (!play.GetItemSystem().IsEquip(item.itemid)) { return; //不是装备就不提升了 } NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.Create(null, play.GetGamePackKeyEx()); ret.srcid = srcid; ret.destid = materialid; ret.type = 196610;//{2,0,3,0} if (materialitem.itemid == LINGHUNJINGSHI || materialitem.itemid == SHENQIZHILEI) { //检测是否有足够的灵魂晶石或者神祈之类 if (!play.GetItemSystem().DeleteItemByID(materialid)) { return; } if (rand < this.RateSuccForQuality(item)) { item.UpQuality(); bUpdate = true; ret.ret = 1; } } else if (materialitem.itemid == LINGHUNWANG && item.GetQuality() <= 4 /*极品武器以下可以用灵魂王升级*/) { //检测是否有足够的灵魂王 if (!play.GetItemSystem().DeleteItemByID(materialid)) { return; } item.UpQuality(); bUpdate = true; ret.ret = 1; } if (bUpdate) { //锻造者名称- if (item.forgename.Length == 0) { item.forgename = play.GetName(); } play.GetItemSystem().UpdateItemInfo(item.id); } play.SendData(ret.GetBuffer()); }
//幻魔晶石 装备升级 public void EquipLevel(PlayerObject play, uint srcid, uint materialid) { const int HUANMOJINGSHI = 1037170; //幻魔晶石id const int HUANMOZHIXIN = 1037179; //幻魔之心 const int MAX_LEVEL_EQUIP1 = 9; //其他装备的提升等级 const int MAX_LEVEL_EQUIP2 = 25; //武器的提升等级 GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid); GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid); if (item == null || materialitem == null) { return; } bool bUpdate = false; NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.Create(null, play.GetGamePackKeyEx()); ret.srcid = srcid; ret.destid = materialid; ret.type = 196612;//{4,0,3,0} int l = RateSuccForEquipLevel(item); if (item.IsShield() || item.IsArmor() || item.IsHelmet()) { if (item.GetLevel() > MAX_LEVEL_EQUIP1) { return; } if (materialitem.itemid == HUANMOZHIXIN) { if (!play.GetItemSystem().DeleteItemByID(materialid)) { return; } item.UpLevel(); bUpdate = true; ret.ret = 1; } else if (materialitem.itemid == HUANMOJINGSHI) { if (!play.GetItemSystem().DeleteItemByID(materialid)) { return; } if (GameStruct.IRandom.Random(1, 100) < l) { item.UpLevel(); bUpdate = true; ret.ret = 1; } } } else { if (item.GetLevel() > MAX_LEVEL_EQUIP2) { return; } if (materialitem.itemid == HUANMOZHIXIN) { if (!play.GetItemSystem().DeleteItemByID(materialid)) { return; } item.UpLevel(); ret.ret = 1; bUpdate = true; } else if (materialitem.itemid == HUANMOJINGSHI) { if (!play.GetItemSystem().DeleteItemByID(materialid)) { return; } if (GameStruct.IRandom.Random(1, 100) < l) { item.UpLevel(); ret.ret = 1; bUpdate = true; } } } if (bUpdate) { play.GetItemSystem().UpdateItemInfo(item.id); } play.SendData(ret.GetBuffer()); return; }
//装备提升魔魂等级参数:玩家对象 道具基本id 道具id 是否百分百成功 public void EquipStrong(PlayerObject play, uint srcid, uint materialid) { const int MOHUNJINGSHI = 1037150; //魔魂晶石id const int MOHUNZHIXIN = 1037159; //魔魂之心id GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid); GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid); if (item == null || materialitem == null) { return; } if (item.GetStrongLevel() >= MAX_STRONGLEVEL) { return; } if (item.GetStrongLevel() >= mListStrong.Count) { return; } int rand = GameStruct.IRandom.Random(1, 100); bool bUpdate = false; NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.Create(null, play.GetGamePackKeyEx()); ret.srcid = srcid; ret.destid = materialid; ret.type = 196611;//{3,0,3,0} if (materialitem.itemid != MOHUNJINGSHI && item.GetStrongLevel() > 9) { return; //大于9级后必须使用魔魂晶石提升等级 } if (materialitem.itemid == MOHUNJINGSHI) { //检测是否有足够的魔魂晶石 if (!play.GetItemSystem().DeleteItemByID(materialid)) { return; } if (rand < mListStrong[item.GetStrongLevel()].chance) { item.UpStrongLevel(1); bUpdate = true; ret.ret = 1; } else { ret.ret = 0; //强化等级9以下不往下掉了 2016.1.24 if (item.GetStrongLevel() > 9 && item.DecStrongLevel()) { bUpdate = true; } } } else if (materialitem.itemid == MOHUNZHIXIN) //魔魂之心必成功 { if (!play.GetItemSystem().DeleteItemByID(materialid)) { return; } item.UpStrongLevel(1); bUpdate = true; ret.ret = 1; } if (bUpdate) { play.GetItemSystem().UpdateItemInfo(item.id); } play.SendData(ret.GetBuffer()); }
//幻魔晶石 装备升级 public void EquipLevel(PlayerObject play,uint srcid,uint materialid) { const int HUANMOJINGSHI = 1037170; //幻魔晶石id const int HUANMOZHIXIN = 1037179; //幻魔之心 const int MAX_LEVEL_EQUIP1 = 9; //其他装备的提升等级 const int MAX_LEVEL_EQUIP2 = 25; //武器的提升等级 GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid); GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid); if (item == null || materialitem == null) return; bool bUpdate = false; NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.Create(null, play.GetGamePackKeyEx()); ret.srcid = srcid; ret.destid = materialid; ret.type = 196612;//{4,0,3,0} int l = RateSuccForEquipLevel(item); if (item.IsShield() || item.IsArmor() || item.IsHelmet()) { if (item.GetLevel() > MAX_LEVEL_EQUIP1) return ; if (materialitem.itemid == HUANMOZHIXIN) { if (!play.GetItemSystem().DeleteItemByID(materialid)) return; item.UpLevel(); bUpdate = true; ret.ret = 1; } else if(materialitem.itemid == HUANMOJINGSHI) { if (!play.GetItemSystem().DeleteItemByID(materialid)) return; if (GameStruct.IRandom.Random(1, 100) < l) { item.UpLevel(); bUpdate = true; ret.ret = 1; } } } else { if (item.GetLevel() > MAX_LEVEL_EQUIP2) return ; if (materialitem.itemid == HUANMOZHIXIN) { if (!play.GetItemSystem().DeleteItemByID(materialid)) return; item.UpLevel(); ret.ret = 1; bUpdate = true; } else if(materialitem.itemid == HUANMOJINGSHI) { if (!play.GetItemSystem().DeleteItemByID(materialid)) return; if (GameStruct.IRandom.Random(1, 100) < l) { item.UpLevel(); ret.ret = 1; bUpdate = true; } } } if (bUpdate) { play.GetItemSystem().UpdateItemInfo(item.id); } play.SendData(ret.GetBuffer()); return ; }
//装备提升魔魂等级参数:玩家对象 道具基本id 道具id 是否百分百成功 public void EquipStrong(PlayerObject play, uint srcid, uint materialid) { const int MOHUNJINGSHI = 1037150; //魔魂晶石id const int MOHUNZHIXIN = 1037159; //魔魂之心id GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid); GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid); if (item == null || materialitem == null) return; if (item.GetStrongLevel() >= MAX_STRONGLEVEL) return; if (item.GetStrongLevel() >= mListStrong.Count) return; int rand = GameStruct.IRandom.Random(1, 100); bool bUpdate = false; NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.Create(null, play.GetGamePackKeyEx()); ret.srcid = srcid; ret.destid = materialid; ret.type = 196611;//{3,0,3,0} if (materialitem.itemid != MOHUNJINGSHI && item.GetStrongLevel() > 9) return; //大于9级后必须使用魔魂晶石提升等级 if (materialitem.itemid == MOHUNJINGSHI) { //检测是否有足够的魔魂晶石 if (!play.GetItemSystem().DeleteItemByID(materialid)) return; if (rand < mListStrong[item.GetStrongLevel()].chance) { item.UpStrongLevel(1); bUpdate = true; ret.ret = 1; } else { ret.ret = 0; //强化等级9以下不往下掉了 2016.1.24 if (item.GetStrongLevel() > 9 && item.DecStrongLevel()) bUpdate = true; } } else if(materialitem.itemid == MOHUNZHIXIN) //魔魂之心必成功 { if (!play.GetItemSystem().DeleteItemByID(materialid)) return; item.UpStrongLevel(1); bUpdate = true; ret.ret = 1; } if (bUpdate) { play.GetItemSystem().UpdateItemInfo(item.id); } play.SendData(ret.GetBuffer()); }
//提升装备品质 public void EquipQuality(PlayerObject play, uint srcid, uint materialid) { const int LINGHUNJINGSHI = 1037160; //灵魂晶石ID const int LINGHUNWANG = 1037169; //灵魂王 const int SHENQIZHILEI = 1037200; //神祈之泪 // const int HUNWUSHENQIZHILEI = 1025754; //魂武神祈之泪 const int MAX_QUALIY = 7; //最高品质 神器 GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid); GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid); if (item == null || materialitem == null) return; if (item.GetQuality() == MAX_QUALIY) return; //已达到最高品质 int rand = GameStruct.IRandom.Random(1, 100); bool bUpdate = false; if (!play.GetItemSystem().IsEquip(item.itemid)) return; //不是装备就不提升了 NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.Create(null, play.GetGamePackKeyEx()); ret.srcid = srcid; ret.destid = materialid; ret.type = 196610;//{2,0,3,0} if (materialitem.itemid == LINGHUNJINGSHI || materialitem.itemid == SHENQIZHILEI) { //检测是否有足够的灵魂晶石或者神祈之类 if (!play.GetItemSystem().DeleteItemByID(materialid)) return; if (rand < this.RateSuccForQuality(item)) { item.UpQuality(); bUpdate = true; ret.ret = 1; } } else if(materialitem.itemid == LINGHUNWANG && item.GetQuality() <= 4/*极品武器以下可以用灵魂王升级*/) { //检测是否有足够的灵魂王 if (!play.GetItemSystem().DeleteItemByID(materialid)) return; item.UpQuality(); bUpdate = true; ret.ret = 1; } if (bUpdate) { //锻造者名称- if (item.forgename.Length == 0) { item.forgename = play.GetName(); } play.GetItemSystem().UpdateItemInfo(item.id); } play.SendData(ret.GetBuffer()); }