Ejemplo n.º 1
0
        public void SendInfo(PlayerObject play = null)
        {
            //  byte[] data2 = {  100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 };
            GameStruct.MonsterInfo info = ConfigManager.Instance().GetMonsterInfo(id);
            if (info == null)
            {
                Log.Instance().WriteLog("获取守护骑士信息失败!!!" + id.ToString());
                return;
            }
            GameBase.Network.PacketOut outpack = null;
            if (play == null)
            {
                outpack = new GameBase.Network.PacketOut();
            }
            else
            {
                outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx());
            }
            outpack.WriteUInt16(81);
            outpack.WriteUInt16(2069);
            outpack.WriteUInt32(GetTypeId());
            outpack.WriteUInt32(play.GetTypeId());
            byte[] data = { 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 };
            outpack.WriteBuff(data);
            outpack.WriteUInt32(info.lookface);
            outpack.WriteInt16(GetCurrentX());
            outpack.WriteInt16(GetCurrentY());
            outpack.WriteInt16(0); //未知
            outpack.WriteUInt16(info.level);
            outpack.WriteUInt32(info.id);
            outpack.WriteInt32(attr.life);
            outpack.WriteInt32(info.life);
            outpack.WriteInt16(GetDir());
            byte[] data1 = { 100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 };
            outpack.WriteBuff(data1);

            if (play != null)
            {
                play.SendData(outpack.Flush());
            }
            else
            {
                //广播
                data = outpack.Flush();
                this.BrocatBuffer(data);
            }
        }
Ejemplo n.º 2
0
        //添加状态
        //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());
            //}
        }
Ejemplo n.º 3
0
        private bool LoadMonsterInfo()
        {
            String text = mPacket.LoadFileToText(TextDefine.CONFIG_FILE_MONSTER);
            CsvFile csv = new CsvFile(text);

            String v;
            GameStruct.MonsterInfo info;
            for (int i = 0; i < csv.GetLine(); i++)
            {
                info = new GameStruct.MonsterInfo();
                v = csv.GetFieldInfoToValue(i, "id");
                info.id = Convert.ToUInt32(v);
                info.name = csv.GetFieldInfoToValue(i, "name");
                v = csv.GetFieldInfoToValue(i, "ai");
                info.ai = Convert.ToUInt16(v);
                v = csv.GetFieldInfoToValue(i, "lookface");
                info.lookface = Convert.ToUInt32(v);
                v = csv.GetFieldInfoToValue(i, "level");
                info.level = Convert.ToUInt16(v);
                v = csv.GetFieldInfoToValue(i, "life");
                info.life = Convert.ToInt32(v);
                v = csv.GetFieldInfoToValue(i, "mana");
                info.mana = Convert.ToInt32(v);
                v = csv.GetFieldInfoToValue(i, "attack_min");
                info.attack_min = Convert.ToUInt32(v);
                v = csv.GetFieldInfoToValue(i, "attack_max");
                info.attack_max = Convert.ToUInt32(v);
                v = csv.GetFieldInfoToValue(i, "defense");
                info.defense = Convert.ToUInt32(v);
                v = csv.GetFieldInfoToValue(i, "dodge");
                info.dodge = Convert.ToUInt16(v);
                v = csv.GetFieldInfoToValue(i, "range");
                info.range = Convert.ToUInt16(v);
                v = csv.GetFieldInfoToValue(i, "attack_speed");
                info.attack_speed = Convert.ToUInt16(v);
                v = csv.GetFieldInfoToValue(i, "move_speed");
                info.move_speed = Convert.ToUInt16(v);
                v = csv.GetFieldInfoToValue(i, "drop_group");
                info.drop_group = Convert.ToUInt32(v);
                v = csv.GetFieldInfoToValue(i, "eudemon_type");
                info.eudemon_type = Convert.ToInt32(v);
                v = csv.GetFieldInfoToValue(i, "die_scripte_id");
                info.die_scripte_id = Convert.ToUInt32(v);
                if (mDicMonster.ContainsKey(info.id))
                {
                    Log.Instance().WriteLog("检测到相同怪物id:" + info.name + " 重复:" + mDicNpc[info.id].name);
                    continue;
                }
                mDicMonster[info.id] = info;
            }
            return true;
        }