//提升神佑 public void Equip_GodExp(PlayerObject play, uint srcid, uint destid) { RoleItemInfo srcinfo = play.GetItemSystem().FindItem(srcid); if (srcinfo == null) { return; } RoleItemInfo destinfo = play.GetItemSystem().FindItem(destid); if (destinfo == null) { return; } if (srcinfo.god_exp >= 90000) { play.MsgBox("已达到最高神佑等级"); return; } int godlv = srcinfo.god_exp / 10000; int addgodexp = 0; switch (godlv) { case 0: { addgodexp = 1000; break; } //提升1级神佑 case 1: { addgodexp = 500; break; } //二级 case 2: { addgodexp = 200; break; } //三级 case 3: { addgodexp = 125; break; } //四级 case 4: { addgodexp = 83; break; } //五级 case 5: { addgodexp = 55; break; } //六级 case 6: { addgodexp = 40; break; } //七级 case 7: { addgodexp = 28; break; } //八级 case 8: { addgodexp = 20; break; } //九级 default: { return; } } int rate = 1;//倍率 switch (destinfo.itemid) { case 1037210: //神谕之石 { rate = 1; break; } case 1037260: //5倍神谕之石 { if (godlv < 3) { return; //最低使用等级是3级 } rate = 5; break; } case 1037261: //10倍神谕之石 { if (godlv < 5) { return; //最低使用等级是5级 } rate = 10; break; } case 1037262: //25倍神谕之石 { if (godlv < 8) { return; //最低使用等级8级 } rate = 25; break; } } srcinfo.god_exp += addgodexp * rate; play.GetItemSystem().DeleteItemByID(destinfo.id); // play.MsgBox("增加神佑经验"+(addgodexp * rate).ToString()); play.GetItemSystem().SendItemInfo(srcinfo); NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.srcid = srcid; ret.destid = destid; byte[] index = { 7, 0, 3, 0 }; ret.type = BitConverter.ToUInt32(index, 0); ret.ret = 1; play.SendData(ret.GetBuffer(), true); }
//提升装备品质 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 Magic_Add_God(PlayerObject play, uint srcid, uint destid) { RoleItemInfo srcinfo = play.GetItemSystem().FindItem(srcid); if (srcinfo == null) { return; } RoleItemInfo destinfo = play.GetItemSystem().FindItem(destid); if (destinfo == null) { return; } if (srcinfo.stronglv >= 12) { play.MsgBox("已达到最高法宝等级"); return; } int godlv = srcinfo.god_exp / 10000; int addgodexp = 0; switch (destinfo.itemid) { case 1037231: //+1创世水晶 { addgodexp = 20; break; } case 1037232: //+2创世水晶 { addgodexp = 60; break; } case 1037233: //+3创世水晶 { addgodexp = 180; break; } } //这四行代码只是为了弥补之前的BUG if (srcinfo.itemid == GameBase.Config.Define.ITEM_DILONGZHILEI_ID && srcinfo.god_strong >= 22500) { srcinfo.god_strong = 0; srcinfo.stronglv++; } //--------------------------------------------------------- if (addgodexp == 0 && srcinfo.itemid != destinfo.itemid) { return; } if (addgodexp == 0) { addgodexp = 20; //默认相同法宝+20经验 } addgodexp = 1000; if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHUGUANGZHANHUN_ID && srcinfo.god_strong >= 7500) { return; } //已经到最高经验值 if (srcinfo.itemid == GameBase.Config.Define.ITEM_DILONGZHILEI_ID && srcinfo.god_strong >= 22500) { return; } if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHENGYAOFUWEN_ID && srcinfo.god_strong >= 30000) { return; } srcinfo.god_strong += addgodexp; if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHUGUANGZHANHUN_ID && srcinfo.god_strong >= 7500) { srcinfo.god_strong = 0; srcinfo.stronglv++; } if (srcinfo.itemid == GameBase.Config.Define.ITEM_DILONGZHILEI_ID && srcinfo.god_strong >= 22500) { srcinfo.god_strong = 0; srcinfo.stronglv++; } if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHENGYAOFUWEN_ID && srcinfo.god_strong >= 30000) { srcinfo.god_strong = 0; srcinfo.stronglv++; } play.GetItemSystem().DeleteItemByID(destinfo.id); play.GetItemSystem().SendItemInfo(srcinfo); NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.srcid = srcid; ret.destid = destid; byte[] ret_code = { 9, 0, 3, 0 };; ret.type = BitConverter.ToUInt32(ret_code, 0); ret.ret = 1; play.SendData(ret.GetBuffer(), true); }
//装备提升魔魂等级参数:玩家对象 道具基本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; }
//法宝追加 public void Magic_Add_God(PlayerObject play, uint srcid, uint destid) { RoleItemInfo srcinfo = play.GetItemSystem().FindItem(srcid); if (srcinfo == null) return; RoleItemInfo destinfo = play.GetItemSystem().FindItem(destid); if (destinfo == null) return; if (srcinfo.stronglv >= 12) { play.MsgBox("已达到最高法宝等级"); return; } int godlv = srcinfo.god_exp / 10000; int addgodexp = 0; switch (destinfo.itemid) { case 1037231: //+1创世水晶 { addgodexp = 20; break; } case 1037232: //+2创世水晶 { addgodexp = 60; break; } case 1037233: //+3创世水晶 { addgodexp = 180; break; } } //这四行代码只是为了弥补之前的BUG if (srcinfo.itemid == GameBase.Config.Define.ITEM_DILONGZHILEI_ID && srcinfo.god_strong >= 22500) { srcinfo.god_strong = 0; srcinfo.stronglv++; } //--------------------------------------------------------- if (addgodexp == 0 && srcinfo.itemid != destinfo.itemid) return; if (addgodexp == 0) addgodexp = 20; //默认相同法宝+20经验 addgodexp = 1000; if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHUGUANGZHANHUN_ID && srcinfo.god_strong >= 7500) { return ;} //已经到最高经验值 if (srcinfo.itemid == GameBase.Config.Define.ITEM_DILONGZHILEI_ID && srcinfo.god_strong >= 22500) { return; } if(srcinfo.itemid == GameBase.Config.Define.ITEM_SHENGYAOFUWEN_ID && srcinfo.god_strong >= 30000){return;} srcinfo.god_strong += addgodexp; if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHUGUANGZHANHUN_ID && srcinfo.god_strong >= 7500) { srcinfo.god_strong = 0; srcinfo.stronglv++; } if (srcinfo.itemid == GameBase.Config.Define.ITEM_DILONGZHILEI_ID && srcinfo.god_strong >= 22500) { srcinfo.god_strong = 0; srcinfo.stronglv++; } if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHENGYAOFUWEN_ID && srcinfo.god_strong >= 30000) { srcinfo.god_strong = 0; srcinfo.stronglv++; } play.GetItemSystem().DeleteItemByID(destinfo.id); play.GetItemSystem().SendItemInfo(srcinfo); NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.srcid = srcid; ret.destid = destid; byte[] ret_code = { 9, 0, 3, 0 }; ; ret.type = BitConverter.ToUInt32(ret_code, 0); ret.ret = 1; play.SendData(ret.GetBuffer(), true); }
//幻魔晶石 装备升级 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 ; }
//提升神佑 public void Equip_GodExp(PlayerObject play, uint srcid, uint destid) { RoleItemInfo srcinfo = play.GetItemSystem().FindItem(srcid); if (srcinfo == null) return; RoleItemInfo destinfo = play.GetItemSystem().FindItem(destid); if (destinfo == null) return; if (srcinfo.god_exp >= 90000) { play.MsgBox("已达到最高神佑等级"); return; } int godlv = srcinfo.god_exp / 10000; int addgodexp = 0; switch (godlv) { case 0: { addgodexp = 1000; break; } //提升1级神佑 case 1: { addgodexp = 500; break; } //二级 case 2: { addgodexp = 200; break; } //三级 case 3: { addgodexp = 125; break; }//四级 case 4: { addgodexp = 83; break; }//五级 case 5: { addgodexp = 55;break;} //六级 case 6: {addgodexp = 40;break;}//七级 case 7: { addgodexp = 28; break; }//八级 case 8: { addgodexp = 20; break; } //九级 default: { return; } } int rate = 1;//倍率 switch(destinfo.itemid) { case 1037210://神谕之石 { rate = 1; break; } case 1037260://5倍神谕之石 { if (godlv < 3) return; //最低使用等级是3级 rate = 5; break; } case 1037261: //10倍神谕之石 { if (godlv < 5) return; //最低使用等级是5级 rate = 10; break; } case 1037262: //25倍神谕之石 { if (godlv < 8) return; //最低使用等级8级 rate = 25; break; } } srcinfo.god_exp += addgodexp * rate; play.GetItemSystem().DeleteItemByID(destinfo.id); // play.MsgBox("增加神佑经验"+(addgodexp * rate).ToString()); play.GetItemSystem().SendItemInfo(srcinfo); NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet(); ret.srcid = srcid; ret.destid = destid; byte[] index = { 7, 0, 3, 0 }; ret.type = BitConverter.ToUInt32(index, 0); ret.ret = 1; play.SendData(ret.GetBuffer(), true); }
//装备提升魔魂等级参数:玩家对象 道具基本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()); }