//添加状态 //nStatus 状态id //nTime 持续时间- 秒 0为无限时间 //bCover 是否覆盖该状态 public void AddStatus(int nStatus, int nTime = 0, bool bCover = true) { if (this.QueryStatus(GameStruct.RoleStatus.STATUS_DIE) != null) { return; } bool bAdd = false; bool bSendState = true; GameStruct.RoleStatus status = null; for (int i = 0; i < mListStatus.Count; i++) { status = mListStatus[i]; if (status.nStatus == nStatus) { if (bCover) { status.nTime = nTime * 1000; status.nLastTick = System.Environment.TickCount; } else { status.nTime += nTime * 1000; } bAdd = true; break; } } if (!bAdd) { status = new GameStruct.RoleStatus(); status.nStatus = nStatus; status.nTime = nTime * 1000; mListStatus.Add(status); } int nOldEff = GetEffect(); switch (nStatus) { case GameStruct.RoleStatus.STATUS_XPFULL: //XP爆气-- 下降 { //mi64Effect &= ~ Define.KEEPEFFECT_XPFULL; //play.ChangeAttribute(GameStruct.UserAttribute.STATUS1, 64,true); break; } case GameStruct.RoleStatus.STATUS_XPFULL_ATTACK: //xp爆气- 技能被单击 { this.DeleteStatus(GameStruct.RoleStatus.STATUS_XPFULL); //删除xp爆气buff mXpTime.SetInterval(Define.XP_MAX_FULL_SECS); mXpTime.Update(); mi64Effect |= Define.KEEPEFFECT_XPFULL; break; } case GameStruct.RoleStatus.STATUS_MOLONGSHOUHU: //魔龙守护 { play.ChangeAttribute(GameStruct.UserAttribute.MOLONGSHOUHU_STATUS, 1, true); ushort nMagicLv = play.GetMagicSystem().GetMagicLevel(GameStruct.MagicTypeInfo.MOLONGSHOUHU); GameStruct.MagicTypeInfo magicInfo = ConfigManager.Instance().GetMagicTypeInfo(GameStruct.MagicTypeInfo.MOLONGSHOUHU, (byte)nMagicLv); if (magicInfo != null) { //没有实际效果-- 待修正 //添加buff- int nDefense = (int)magicInfo.power; byte[] data1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); outpack.WriteUInt16(48); outpack.WriteUInt16(1127); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteInt32(nTime); outpack.WriteInt32(nDefense); outpack.WriteBuff(data1); play.SendData(outpack.Flush()); } break; } case GameStruct.RoleStatus.STATUS_STEALTH: //潜行 { mi64Effect |= Define.KEEPEFFECT_LURKER; break; } case GameStruct.RoleStatus.STATUS_CRIME: //闪蓝 { mi64Effect |= Define.KEEPEFFECT_CRIME; break; } case GameStruct.RoleStatus.STATUS_RED: //红名 { mi64Effect |= Define.KEEPEFFECT_RED; break; } case GameStruct.RoleStatus.STATUS_BLOCK: //黑名 { mi64Effect |= Define.KEEPEFFECT_DEEPRED; break; } case GameStruct.RoleStatus.STATUS_FLY: //雷霆万钧单独处理.要把xp满的包发下去 { mi64Effect |= Define.KEEPEFFECT_FLY; NetMsg.MsgUserAttribute msg = new NetMsg.MsgUserAttribute(); msg.role_id = play.GetTypeId(); msg.Create(null, null); msg.AddAttribute(GameStruct.UserAttribute.STATUS, (uint)GetEffect(false)); msg.AddAttribute(GameStruct.UserAttribute.STATUS1, (uint)GetEffect()); //这是xp满的标识 play.BroadcastBuffer(msg.GetBuffer(), true); bSendState = false; break; } case GameStruct.RoleStatus.STATUS_HIDDEN: { mi64Effect |= Define.KEEPEFFECT_HIDDEN; break; } case GameStruct.RoleStatus.STATUS_HEILONGWU: { mi64Effect |= Define.KEEPEFFECT_HEILONGWU; break; } case GameStruct.RoleStatus.STATUS_YUANSUZHANGKONG: { //修改元素掌控状态 play.ChangeAttribute(GameStruct.UserAttribute.YUANSUZHANGKONG, 512, true); //添加buff byte[] data1 = { 48, 0, 103, 4 }; byte[] data2 = { 128, 81, 1, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 }; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); outpack.WriteBuff(data1); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data2); play.SendData(outpack.Flush()); bSendState = false; break; } case GameStruct.RoleStatus.STATUS_JUYANSHENGDUN: //法师 巨岩圣盾 { byte[] data1 = { 48, 0, 103, 4 }; byte[] data2 = { 132, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 }; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); outpack.WriteBuff(data1); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data2); play.SendData(outpack.Flush()); bSendState = false; break; } case GameStruct.RoleStatus.STATUS_ANSHAXIELONG: //亡灵巫师- 暗杀邪龙 { if (mObject_CALL != null) { mObject_CALL.ClearThis(); } GameStruct.MonsterInfo monster = ConfigManager.Instance().GetMonsterInfo(Define.ANSHAXIELONG_MONSTER_ID); if (monster == null) { Log.Instance().WriteLog("创建暗沙邪龙失败!!,无此怪物id!"); break; } int nx = play.GetCurrentX() + GameStruct.DIR._DELTA_X[play.GetDir()]; int ny = play.GetCurrentY() + GameStruct.DIR._DELTA_Y[play.GetDir()]; mObject_CALL = new AnShaXieLongObject(play, (short)nx, (short)ny, play.GetDir(), monster.id, monster.ai); play.GetGameMap().AddObject(mObject_CALL, null); mObject_CALL.RefreshVisibleObject(); mObject_CALL.Alive(false); break; } case GameStruct.RoleStatus.STATUS_MINGGUOSHENGNV: //冥国圣女 { if (mObject_CALL != null) { mObject_CALL.ClearThis(); } GameStruct.MonsterInfo monster = ConfigManager.Instance().GetMonsterInfo(Define.MINGGUOSHENGNV_MONSTER_ID); if (monster == null) { Log.Instance().WriteLog("创建冥国圣女失败!!,无此怪物id!"); break; } int nx = play.GetCurrentX() + GameStruct.DIR._DELTA_X[play.GetDir()]; int ny = play.GetCurrentY() + GameStruct.DIR._DELTA_Y[play.GetDir()]; mObject_CALL = new MingGuoShengNv(play, (short)nx, (short)ny, play.GetDir(), monster.id, monster.ai); play.GetGameMap().AddObject(mObject_CALL, null); mObject_CALL.RefreshVisibleObject(); mObject_CALL.Alive(false); break; } case GameStruct.RoleStatus.STATUS_WANGNIANWULING: //亡念巫灵 { if (mObject_CALL != null) { mObject_CALL.ClearThis(); } GameStruct.MonsterInfo monster = ConfigManager.Instance().GetMonsterInfo(Define.WANGNIANWULONG_MONSTER_ID); if (monster == null) { Log.Instance().WriteLog("创建亡念巫灵失败!!,无此怪物id!"); break; } int nx = play.GetCurrentX() + GameStruct.DIR._DELTA_X[play.GetDir()]; int ny = play.GetCurrentY() + GameStruct.DIR._DELTA_Y[play.GetDir()]; mObject_CALL = new WangNianWuLing(play, (short)nx, (short)ny, play.GetDir(), monster.id, monster.ai); play.GetGameMap().AddObject(mObject_CALL, null); mObject_CALL.RefreshVisibleObject(); mObject_CALL.Alive(false); break; } case GameStruct.RoleStatus.STATUS_HUASHENWANGLING: { mi64EffectEx |= Define.KEEPEFFECT_HUASHENWULING; break; } case GameStruct.RoleStatus.STATUS_HUASHENWUSHI: { DeleteStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING); break; } case GameStruct.RoleStatus.STATUS_ZHAOHUANWUHUAN: { mi64Effect |= Define.KEEPEFFECT_ZHAOHUANWUHUAN; break; } case GameStruct.RoleStatus.STATUS_MIXINSHU: //血族 迷心术 { mi64EffectEx |= Define.KEEPEFFECT_MIXINSHU; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); //buff byte[] data = { 120, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; outpack.WriteUInt16(48); outpack.WriteUInt16(1127); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data); play.SendData(outpack.Flush()); break; } case GameStruct.RoleStatus.STATUS_XUEXI: //血族 血袭 { mi64EffectEx |= Define.KEEPEFFECT_XUEXI; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); byte[] data = { 60, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; outpack.WriteUInt16(48); outpack.WriteUInt16(1127); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data); play.SendData(outpack.Flush()); break; } case GameStruct.RoleStatus.STATUS_DIE: //死亡状态 { mi64Effect |= Define.KEEPEFFECT_DIE; break; } } if (bSendState) { this.SendState(); // play.ChangeAttribute(state, GetEffect(state == GameStruct.UserAttribute.STATUS1),true); } //if (GetEffect() != nOldEff) //{ // play.ChangeAttribute(state, GetEffect()); //} }
//添加状态 //nStatus 状态id //nTime 持续时间- 秒 0为无限时间 //bCover 是否覆盖该状态 public void AddStatus(int nStatus, int nTime = 0, bool bCover = true) { if (this.QueryStatus(GameStruct.RoleStatus.STATUS_DIE) != null) { return; } bool bAdd = false; bool bSendState = true; GameStruct.RoleStatus status = null; for (int i = 0; i < mListStatus.Count; i++) { status = mListStatus[i]; if (status.nStatus == nStatus) { if (bCover) { status.nTime = nTime * 1000; status.nLastTick = System.Environment.TickCount; } else { status.nTime += nTime * 1000; } bAdd = true; break; } } if (!bAdd) { status = new GameStruct.RoleStatus(); status.nStatus = nStatus; status.nTime = nTime * 1000; mListStatus.Add(status); } int nOldEff = GetEffect(); switch (nStatus) { case GameStruct.RoleStatus.STATUS_XPFULL: //XP爆气-- 下降 { //mi64Effect &= ~ Define.KEEPEFFECT_XPFULL; //play.ChangeAttribute(GameStruct.UserAttribute.STATUS1, 64,true); break; } case GameStruct.RoleStatus.STATUS_XPFULL_ATTACK: //xp爆气- 技能被单击 { this.DeleteStatus(GameStruct.RoleStatus.STATUS_XPFULL); //删除xp爆气buff mXpTime.SetInterval(Define.XP_MAX_FULL_SECS); mXpTime.Update(); mi64Effect |= Define.KEEPEFFECT_XPFULL; break; } case GameStruct.RoleStatus.STATUS_MOLONGSHOUHU: //魔龙守护 { play.ChangeAttribute(GameStruct.UserAttribute.MOLONGSHOUHU_STATUS, 1,true); ushort nMagicLv = play.GetMagicSystem().GetMagicLevel(GameStruct.MagicTypeInfo.MOLONGSHOUHU); GameStruct.MagicTypeInfo magicInfo = ConfigManager.Instance().GetMagicTypeInfo(GameStruct.MagicTypeInfo.MOLONGSHOUHU, (byte)nMagicLv); if (magicInfo != null) { //没有实际效果-- 待修正 //添加buff- int nDefense = (int)magicInfo.power; byte[] data1 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); outpack.WriteUInt16(48); outpack.WriteUInt16(1127); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteInt32(nTime); outpack.WriteInt32(nDefense); outpack.WriteBuff(data1); play.SendData(outpack.Flush()); } break; } case GameStruct.RoleStatus.STATUS_STEALTH: //潜行 { mi64Effect |= Define.KEEPEFFECT_LURKER; break; } case GameStruct.RoleStatus.STATUS_CRIME: //闪蓝 { mi64Effect |= Define.KEEPEFFECT_CRIME; break; } case GameStruct.RoleStatus.STATUS_RED: //红名 { mi64Effect |= Define.KEEPEFFECT_RED; break; } case GameStruct.RoleStatus.STATUS_BLOCK: //黑名 { mi64Effect |= Define.KEEPEFFECT_DEEPRED; break; } case GameStruct.RoleStatus.STATUS_FLY: //雷霆万钧单独处理.要把xp满的包发下去 { mi64Effect |= Define.KEEPEFFECT_FLY; NetMsg.MsgUserAttribute msg = new NetMsg.MsgUserAttribute(); msg.role_id = play.GetTypeId(); msg.Create(null, null); msg.AddAttribute(GameStruct.UserAttribute.STATUS, (uint)GetEffect(false)); msg.AddAttribute(GameStruct.UserAttribute.STATUS1, (uint)GetEffect());//这是xp满的标识 play.BroadcastBuffer(msg.GetBuffer(), true); bSendState = false; break; } case GameStruct.RoleStatus.STATUS_HIDDEN: { mi64Effect |= Define.KEEPEFFECT_HIDDEN; break; } case GameStruct.RoleStatus.STATUS_HEILONGWU: { mi64Effect |= Define.KEEPEFFECT_HEILONGWU; break; } case GameStruct.RoleStatus.STATUS_YUANSUZHANGKONG: { //修改元素掌控状态 play.ChangeAttribute(GameStruct.UserAttribute.YUANSUZHANGKONG,512,true); //添加buff byte[] data1 = { 48, 0, 103, 4 }; byte[] data2 = { 128, 81, 1, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 }; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); outpack.WriteBuff(data1); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data2); play.SendData(outpack.Flush()); bSendState = false; break; } case GameStruct.RoleStatus.STATUS_JUYANSHENGDUN: //法师 巨岩圣盾 { byte[] data1 = { 48, 0, 103, 4 }; byte[] data2 = { 132, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 }; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); outpack.WriteBuff(data1); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data2); play.SendData(outpack.Flush()); bSendState = false; break; } case GameStruct.RoleStatus.STATUS_ANSHAXIELONG://亡灵巫师- 暗杀邪龙 { if (mObject_CALL != null) { mObject_CALL.ClearThis(); } GameStruct.MonsterInfo monster = ConfigManager.Instance().GetMonsterInfo(Define.ANSHAXIELONG_MONSTER_ID); if (monster == null) { Log.Instance().WriteLog("创建暗沙邪龙失败!!,无此怪物id!"); break; } int nx = play.GetCurrentX()+GameStruct.DIR._DELTA_X[play.GetDir()]; int ny = play.GetCurrentY() + GameStruct.DIR._DELTA_Y[play.GetDir()]; mObject_CALL = new AnShaXieLongObject(play, (short)nx, (short)ny, play.GetDir(), monster.id, monster.ai); play.GetGameMap().AddObject(mObject_CALL, null); mObject_CALL.RefreshVisibleObject(); mObject_CALL.Alive(false); break; } case GameStruct.RoleStatus.STATUS_MINGGUOSHENGNV: //冥国圣女 { if (mObject_CALL != null) { mObject_CALL.ClearThis(); } GameStruct.MonsterInfo monster = ConfigManager.Instance().GetMonsterInfo(Define.MINGGUOSHENGNV_MONSTER_ID); if (monster == null) { Log.Instance().WriteLog("创建冥国圣女失败!!,无此怪物id!"); break; } int nx = play.GetCurrentX() + GameStruct.DIR._DELTA_X[play.GetDir()]; int ny = play.GetCurrentY() + GameStruct.DIR._DELTA_Y[play.GetDir()]; mObject_CALL = new MingGuoShengNv(play, (short)nx, (short)ny, play.GetDir(), monster.id, monster.ai); play.GetGameMap().AddObject(mObject_CALL, null); mObject_CALL.RefreshVisibleObject(); mObject_CALL.Alive(false); break; } case GameStruct.RoleStatus.STATUS_WANGNIANWULING: //亡念巫灵 { if (mObject_CALL != null) { mObject_CALL.ClearThis(); } GameStruct.MonsterInfo monster = ConfigManager.Instance().GetMonsterInfo(Define.WANGNIANWULONG_MONSTER_ID); if (monster == null) { Log.Instance().WriteLog("创建亡念巫灵失败!!,无此怪物id!"); break; } int nx = play.GetCurrentX() + GameStruct.DIR._DELTA_X[play.GetDir()]; int ny = play.GetCurrentY() + GameStruct.DIR._DELTA_Y[play.GetDir()]; mObject_CALL = new WangNianWuLing(play, (short)nx, (short)ny, play.GetDir(), monster.id, monster.ai); play.GetGameMap().AddObject(mObject_CALL, null); mObject_CALL.RefreshVisibleObject(); mObject_CALL.Alive(false); break; } case GameStruct.RoleStatus.STATUS_HUASHENWANGLING: { mi64EffectEx |= Define.KEEPEFFECT_HUASHENWULING; break; } case GameStruct.RoleStatus.STATUS_HUASHENWUSHI: { DeleteStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING); break; } case GameStruct.RoleStatus.STATUS_ZHAOHUANWUHUAN: { mi64Effect |= Define.KEEPEFFECT_ZHAOHUANWUHUAN; break; } case GameStruct.RoleStatus.STATUS_MIXINSHU: //血族 迷心术 { mi64EffectEx |= Define.KEEPEFFECT_MIXINSHU; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); //buff byte[] data = { 120, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; outpack.WriteUInt16(48); outpack.WriteUInt16(1127); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data); play.SendData(outpack.Flush()); break; } case GameStruct.RoleStatus.STATUS_XUEXI: //血族 血袭 { mi64EffectEx |= Define.KEEPEFFECT_XUEXI; GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); byte[] data = { 60, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; outpack.WriteUInt16(48); outpack.WriteUInt16(1127); outpack.WriteUInt32(play.GetTypeId()); outpack.WriteBuff(data); play.SendData(outpack.Flush()); break; } case GameStruct.RoleStatus.STATUS_DIE: //死亡状态 { mi64Effect |= Define.KEEPEFFECT_DIE; break; } } if (bSendState) { this.SendState(); // play.ChangeAttribute(state, GetEffect(state == GameStruct.UserAttribute.STATUS1),true); } //if (GetEffect() != nOldEff) //{ // play.ChangeAttribute(state, GetEffect()); //} }