Example #1
0
        protected override void ProcessAction_Move(GameStruct.Action act)
        {
            byte runvalue = 1;
            if (act.GetObjectCount() > 0)
            {
                runvalue = (byte)act.GetObject(0);
            }
            //取现有列表- 不在范围内的就通知客户端了
            foreach (RefreshObject refobj in this.GetVisibleList().Values)
            {
                BaseObject obj = refobj.obj;
                if (obj.type == OBJECTTYPE.PLAYER)
                {
                  //  Console.WriteLine("距离:x"+Math.Abs(this.GetCurrentX() - obj.GetCurrentX()).ToString()+" y:"+Math.Abs(this.GetCurrentY() - obj.GetCurrentY()).ToString());
                    if (!obj.GetPoint().CheckVisualDistance(this.GetCurrentX(), this.GetCurrentY(), GameBase.Config.Define.MAX_EUDEMON_OTHER_PLAY_DISTANCE))
                    {

                        NetMsg.MsgClearObjectInfo info = new NetMsg.MsgClearObjectInfo();
                        info.id = this.GetTypeId();
                        (obj as PlayerObject).SendData(info.GetBuffer(),true);
                        obj.GetVisibleList().Remove(this.GetGameID());
                    }
                }
            }
            this.RefreshVisibleObject();
            foreach(RefreshObject refobj in this.GetVisibleList().Values)
            {
                BaseObject obj = refobj.obj;
                if (obj.type == OBJECTTYPE.PLAYER)
                {
                    if (!obj.GetVisibleList().ContainsKey(this.GetGameID()))
                    {
                        obj.AddVisibleObject(this, true);
                        this.SendEudemonInfo();
                    }
                    //if (this.GetVisibleList().ContainsKey(obj.GetGameID()))
                    //{
                    //    this.AddVisibleObject(obj, true);
                    //    this.SendEudemonInfo();
                    //}
                }
            }

            NetMsg.MsgMoveInfo move = new NetMsg.MsgMoveInfo();
            move.id = this.GetTypeId();
            move.x = this.GetCurrentX();
            move.y = this.GetCurrentY();
            move.dir = this.GetDir();
            move.ucMode = runvalue;
            this.BrocatBuffer(move.GetBuffer());

            //if (mRefreshList.Count > 0)
            //{
            //    foreach (BaseObject o in mRefreshList.Values)
            //    {
            //        switch (o.type)
            //        {

            //            case OBJECTTYPE.PLAYER:
            //                {

            //                    // if (o.GetGameID() == play.GetGameID()) continue;
            //                    this.SendMoveInfo(o, runvalue);
            //                    break;
            //                }
            //        }
            //    }
            //    mRefreshList.Clear();
            //}
        }
Example #2
0
        protected override void ProcessAction_Move(GameStruct.Action act)
        {
            byte runvalue = 1;
            if (act.GetObjectCount() > 0)
            {
                runvalue = (byte)act.GetObject(0);
            }

            RefreshVisibleObject();
            if (mVisibleList.Count > 0)
            {
                foreach (RefreshObject obj in mVisibleList.Values)
                {
                    BaseObject o = obj.obj;
                    switch (o.type)
                    {
                        case OBJECTTYPE.NPC:
                            {
                                if (obj.bRefreshTag) break;
                                this.SendNpcInfo(o);
                                obj.bRefreshTag = true;
                                break;
                            }
                        case OBJECTTYPE.MONSTER:
                        case OBJECTTYPE.CALLOBJECT:
                            {
                                if (obj.bRefreshTag) break;
                                this.SendMonsterInfo(o);
                                obj.bRefreshTag = true;
                                break;
                            }
                        case OBJECTTYPE.PLAYER:
                            {

                                this.SendRoleMoveInfo(o, runvalue, obj);
                                break;
                            }
                        case OBJECTTYPE.DROPITEM:
                            {
                                if (obj.bRefreshTag) break;
                                this.SendDropItemInfo(o);
                                obj.bRefreshTag = true;
                                break;
                            }
                        case OBJECTTYPE.EUDEMON:
                            {
                                if (obj.bRefreshTag) break;

                                (o as EudemonObject).SendEudemonInfo(this);
                                obj.bRefreshTag = true;
                                break;
                            }
                        case OBJECTTYPE.ROBOT:
                            {
                                if (obj.bRefreshTag) break;
                                (o as RobotObject).SendRobotInfo(this);
                                obj.bRefreshTag = true;
                                break;
                            }
                        case OBJECTTYPE.GUARDKNIGHT:
                            {
                                if (obj.bRefreshTag) break;
                                (o as GuardKnightObject).SendInfo(this);
                                obj.bRefreshTag = true;
                                break;
                            }
                        case OBJECTTYPE.EFFECT:
                            {
                                if (obj.bRefreshTag) break;
                                (o as EffectObject).SendInfo(this);
                                obj.bRefreshTag = true;
                                break;
                            }
                        case OBJECTTYPE.PTICH:  //摊位
                            {
                                if (obj.bRefreshTag) break;
                                (o as PtichObject).SendInfo(this);
                                obj.bRefreshTag = true;
                                break;
                            }
                    }
                    //加入到对方视野中-
                    o.AddVisibleObject(this);

                }
                //   mRefreshList.Clear();
            }
        }
Example #3
0
        protected override void ProcessAction_Injured(GameStruct.Action act)
        {
            BaseObject target = act.GetObject(0) as BaseObject;
            uint value = (uint)act.GetObject(1);

            if (!IsDie())
            {

                //亡灵巫师- 被攻击后如果有召唤巫环状态- 就同时召唤出三个亡灵攻击对方。
                if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_ZHAOHUANWUHUAN) != null &&
                    this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING) != null && mZhaoHuanWuHuanObj == null)
                {
                    int nNewX = target.GetCurrentX() - DIR._DELTA_X[this.GetDir()];
                    int nNewY = target.GetCurrentY() - DIR._DELTA_Y[this.GetDir()];
                    MonsterObject Object_CALL = null;
                    uint[] CallObj_ID = { GameBase.Config.Define.DIYUXIEFU_MONSTER_ID, GameBase.Config.Define.SHIHUNWULING_MONSTER_ID, GameBase.Config.Define.SHENYUANELING_MONSTER_ID };
                    for (int i = 0; i < CallObj_ID.Length; i++)
                    {
                        GameStruct.MonsterInfo monster_info = ConfigManager.Instance().GetMonsterInfo(CallObj_ID[i]);
                        if (monster_info != null)
                        {
                            Object_CALL = new DiYuXieFu(this, target, (short)nNewX, (short)nNewY, this.GetDir(), monster_info.id, monster_info.ai);
                            this.GetGameMap().AddObject(Object_CALL, null);
                            Object_CALL.Alive(false);
                        }
                    }
                    SetZhaoHuanWuHuanObj(target);
                }
            }
            mTarget = target;
        }
Example #4
0
        protected override void ProcessAction_Die(GameStruct.Action act)
        {
            //变为幽灵
            //TransformGhost();

            //死亡标记
            BaseObject obj = act.GetObject(0) as BaseObject;
            NetMsg.MsgMonsterDieInfo die = new NetMsg.MsgMonsterDieInfo();
            die.monsterid = this.GetTypeId();
            die.roleid = obj.GetTypeId();
            die.role_x = this.GetCurrentX();
            die.role_y = this.GetCurrentY();
            die.tag = 14;
            this.BroadcastBuffer(die.GetBuffer(), true);

            m_bGhost = true;
            mnGhostTick = System.Environment.TickCount;
            //死亡之后自动攻击目标为Null
            this.GetFightSystem().SetAutoAttackTarget(null);

            this.GetPKSystem().Die(obj);
            //亡念巫灵原地复活//要在删除状态之前调用该代码
            if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_WANGNIANWULING) != null)
            {
                this.Alive(true);
            }

            //移除一些死亡后的状态
            this.GetTimerSystem().Die_DeleteState();

            //死亡后幻兽也要召回
            this.GetEudemonSystem().Eudemon_ReCallAll();
            //死亡后骑乘幻兽中就下马
            if (this.GetMountID() > 0)
            {
                this.TakeOffMount(0);
            }
            this.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_DIE);
        }
Example #5
0
        protected override void ProcessAction_Injured(GameStruct.Action act)
        {
            BaseObject attack_obj = act.GetObject(0) as BaseObject;
            NetMsg.MsgAttackInfo info = act.GetObject(2) as NetMsg.MsgAttackInfo;
            if (attack_obj == null) return;
            uint injured = (uint)act.GetObject(1) ; //受伤害的值
            mTarget = attack_obj;

            this.GetAi().Injured(attack_obj);

            //死亡-- 锁定后不允许死亡
            if (IsDie() && !this.IsLock() && info.tag == 2/*单体攻击*/)
            {
                GameStruct.Action action;
                //死亡
                action = new GameStruct.Action(GameStruct.Action.DIE, null);
                action.AddObject(attack_obj);
                action.AddObject(injured);
                this.PushAction(action);
            }
            //魔法攻击要延迟一秒下发死亡消息

            if (info.tag == 21 && IsDie() && !this.IsLock())
            {
                mnDieMagicTick = System.Environment.TickCount;
                mDieMagicInfo = act;
            }
        }
Example #6
0
        protected override void ProcessAction_Die(GameStruct.Action act)
        {
            PlayerObject play = act.GetObject(0) as PlayerObject;
            BaseObject baseobj = act.GetObject(0) as BaseObject;
            if (play == null && baseobj.type == OBJECTTYPE.EUDEMON)
            {
                play = (baseobj as EudemonObject).GetOwnerPlay();
            }
            //根据打出的伤害获得经验值
            uint injured = (uint)act.GetObject(1);

            NetMsg.MsgMonsterDieInfo info = new NetMsg.MsgMonsterDieInfo();
            info.roleid = baseobj.GetTypeId();
            info.role_x = baseobj.GetCurrentX();
            info.role_y = baseobj.GetCurrentY();
            info.injuredvalue = 0;
            info.monsterid = this.GetTypeId();
            byte[] msg = info.GetBuffer();

             //掉落道具
            this.DropItem(baseobj);

            //RefreshVisibleObject();
            //if (mRefreshList.Count > 0)
            //{

            //    this.GetGameMap().BroadcastBuffer(this,msg);
            //    //掉落道具
            //    this.DropItem(play);

            //}
            this.BrocatBuffer(msg);
            LastDieTime = System.Environment.TickCount;
            if (play == null && baseobj.type != OBJECTTYPE.EUDEMON) return;
            //计算经验
            play.AddExp((int)injured, play.GetLevel(), this.GetLevel());
            //死亡的幻兽加灵气值复活
            play.GetEudemonSystem().Eudemon_Alive(this);

            this.GetAi().Die();

            this.GetAi().SetAttackTarget(null);

            mAliveTime.Update();
            //执行死亡脚本- 最后一击的击杀者执行该脚本
            if (mInfo.die_scripte_id > 0 && play != null)
            {
                ScripteManager.Instance().ExecuteAction(mInfo.die_scripte_id, play);
            }
        }