Inheritance: BaseObject
 public override void ClearThis()
 {
     base.ClearThis();
     this.GetGameMap().RemoveObj(this);
     IDManager.RecoveryTypeID(this.GetTypeId(), this.type);
     mPlay = null;
 }
Example #2
0
        public static GameStruct.MonsterInfo GetMonsterInfo(PlayerObject _play,uint _item_id)
        {
            GameStruct.MonsterInfo MonsterInfo = null;

            GameStruct.RoleItemInfo item = _play.GetItemSystem().FindItem(_item_id);
            if (item == null)
            {
                Log.Instance().WriteLog("幻兽出征失败,无法找到道具id:" + _item_id.ToString());
                return null;
            }

            GameStruct.ItemTypeInfo baseitem = ConfigManager.Instance().GetItemTypeInfo(item.itemid);
            if (baseitem == null)
            {
                Log.Instance().WriteLog("幻兽出征失败,无法找到道具id:code:1" + item.itemid.ToString());
                return null;
            }
            MonsterInfo = ConfigManager.Instance().GetMonsterInfo(baseitem.monster_type);
            if (MonsterInfo == null)
            {
                Log.Instance().WriteLog("幻兽出征失败,无法找到怪物idid:code:1" + baseitem.monster_type.ToString());
                return null;
            }
            return MonsterInfo;
        }
 public void ClearThis(PlayerObject play)
 {
     NetMsg.MsgClearObjectInfo info = new NetMsg.MsgClearObjectInfo();
     info.Create(null, play.GetGamePackKeyEx());
     info.id = GetTypeId();
     play.SendData(info.GetBuffer());
 }
Example #4
0
 public PlayerTrad(PlayerObject _play)
 {
     mnGameGold = mnGold = 0;
     play = _play;
     mbSureTrad = false;
     mListItem = new List<GameStruct.RoleItemInfo>();
     mListEudemon = new List<GameBase.Network.Internal.RoleData_Eudemon>();
 }
Example #5
0
        public PlayerPK(PlayerObject _play)
        {
            play = _play;

            mDecTime = new GameBase.Core.TimeOut();
            mDecTime.SetInterval(Define.PK_DEC_TIME);

            mnNameType = GetNameType();
        }
Example #6
0
 public PlayerEudemon(PlayerObject _play)
 {
     play = _play;
     mDicEudemon = new Dictionary<uint, RoleData_Eudemon>();
     mTempDicEudemon = new List<RoleData_Eudemon>();
     mBattleObj = new List<EudemonObject>();
     mListObj = new List<EudemonObject>();
     mListRecordEudemon = new List<uint>();
 }
Example #7
0
 public void DB_Update(PlayerObject play)
 {
     //发给dbserver 更新爵位信息
     GameBase.Network.Internal.UPDATEGUANJUEDATA updatedb = new GameBase.Network.Internal.UPDATEGUANJUEDATA();
     updatedb.info.id = (uint)play.GetBaseAttr().player_id;
     updatedb.info.name = play.GetName();
     updatedb.info.guanjue = play.GetBaseAttr().guanjue;
     DBServer.Instance().GetDBClient().SendData(updatedb.GetBuffer());
 }
Example #8
0
        public bool Action_Get_Eudemon_Pro(ActionInfo info, PlayerObject play)
        {
            String[] option = info.param.Split(' ');
            int index = Convert.ToInt32(option[0]);
            uint eudemon_id = 0;
            if (index == 0)
            {
                eudemon_id = play.GetUseItemEudemonId();
            }

            RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(eudemon_id);

            if (eudemon == null ) return false;
            String sPro = option[1];
            String op = option[2];
            int value = Convert.ToInt32(option[3]);
            switch (sPro)
            {
                case "quality":
                    {
                        switch (op)
                        {
                            case ">": { return eudemon.quality > value; }
                            case ">=": { return eudemon.quality >= value; }
                            case "=": { return eudemon.quality == value; }
                            case "<": { return eudemon.quality < value; }
                            case "<=": { return eudemon.quality <= value; }
                        }
                        return false;

                    }
                case "wuxing":
                    {
                        switch (op)
                        {
                            case "=": { return eudemon.wuxing == value; }
                            case "!=": { return eudemon.wuxing != value; }
                        }
                        return false;
                    }
                case "level":
                    {
                        switch (op)
                        {
                            case ">": { return eudemon.level > value; }
                            case ">=": { return eudemon.level >= value; }
                            case "=": { return eudemon.level == value; }
                            case "<": { return eudemon.level < value; }
                            case "<=": { return eudemon.level <= value; }
                        }
                        break;
                    }
            }

            return false;
        }
Example #9
0
        //角色摆摊
        //nPtichId 摊位ID
        //play   摆摊对象
        public bool AddPlayPtich(int nPtichId, PlayerObject play)
        {
            if (nPtichId < 0 || nPtichId >= GameBase.Config.Define.PTICH_MAX_COUNT) return false;
            if (PtichHasPlay(nPtichId)) return false;

            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null) return false; //正在摆摊中
            play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_PTICH);

            mListPtichInfo[nPtichId].play = play;

            //设置方向
            play.SetDir(DIR.LEFT_DOWN);

            PacketOut outpack = new PacketOut();

            //网络连接堵塞提示
            //outpack.WriteInt16(16);
            //outpack.WriteInt16(1012);
            //outpack.WriteUInt32(play.GetTypeId());
            //outpack.WriteInt32(0);
            //outpack.WriteInt32(0);
            //play.SendData(outpack.Flush(), true);

            //这个不知道是什么鬼
            //outpack = new PacketOut();
            //outpack.WriteInt16(20);
            //outpack.WriteInt16(1017);
            //outpack.WriteUInt32(play.GetTypeId());
            //outpack.WriteInt32(1);
            //outpack.WriteInt32(4);
            //outpack.WriteInt32(60317); //157, 235, 0, 0
            //play.SendData(outpack.Flush(),true);

            PtichObject obj = new PtichObject(play);
            obj.SetPoint((short)(play.GetCurrentX() + 1), (short)(play.GetCurrentY() + 1));

            play.GetGameMap().AddObject(obj);
            obj.Refresh();
            mListPtichInfo[nPtichId].PtichObj = obj;
            //收到网络协议:长度:28协议号:1010
            outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1010);
            outpack.WriteInt32(101088);
            outpack.WriteUInt32(play.GetTypeId());
            outpack.WriteInt16(obj.GetCurrentX());
            outpack.WriteInt16(obj.GetCurrentY());
            outpack.WriteInt32(0);
            outpack.WriteUInt32(obj.GetTypeId());
            outpack.WriteInt32(9570);
            play.SendData(outpack.Flush(), true);
            //byte[] data4 = { 28, 0, 242, 3, 224, 138, 1, 0, 174, 66, 15, 0, 91, 1, 27, 2, 0, 0, 0, 0, 28, 162, 1, 0, 98, 37, 0, 0 };
            //this.SendData(data4, true);

            return true;
        }
Example #10
0
 public PlayerFight(PlayerObject _play)
 {
     play = _play;
     mAutoTarget = null;
     mnAutoAttackTick = System.Environment.TickCount;
     mnLastAttackTick = System.Environment.TickCount;
     mnYanHunQiangIndex = mnYanHunQiangExIndex = 0;
     mListQiShiTuanGuard = null;
     mLiuXingYunHuoTime = null;
 }
Example #11
0
        public DiYuXieFu(PlayerObject _play, BaseObject _AttackTarget, short x, short y, byte dir, uint _id, int nAi_Id)
            : base(_id, nAi_Id,x,y, false)
        {
            type = GameBase.Config.OBJECTTYPE.CALLOBJECT;

            typeid = IDManager.CreateTypeId(GameBase.Config.OBJECTTYPE.GUARDKNIGHT);
            SetPoint(x, y);
            mRebirthTime = 0;//不允许复活
            mPlay = _play;
            SetDir(dir);
            this.GetAi().SetAttackTarget(_AttackTarget);
        }
Example #12
0
 public void AddCachePlay(PlayerObject play)
 {
     for (int i = 0; i < mListCacheRole.Count; i++)
     {
         if (mListCacheRole[i].GetBaseAttr().sAccount == play.GetBaseAttr().sAccount)
         {
             mListCacheRole.RemoveAt(i);
             break;
         }
     }
     mListCacheRole.Add(play);
 }
        public AnShaXieLongObject(PlayerObject _play, short x, short y,byte dir, uint _id, int nAi_Id)
            : base(_id, nAi_Id, x,y,false)
        {
            type = OBJECTTYPE.CALLOBJECT;
            typeid = IDManager.CreateTypeId(OBJECTTYPE.GUARDKNIGHT);
            SetPoint(x, y);
            mRebirthTime = 0;//不允许复活

            mPlay = _play;
            SetDir(dir);
            mnRefreshTick = System.Environment.TickCount;
        }
        private PlayerObject mPlay; //宿主

        #endregion Fields

        #region Constructors

        public GuardKnightObject(PlayerObject _play, short x, short y,byte dir, uint _id, int nAi_Id)
            : base(_id, nAi_Id,x,y, false)
        {
            type = OBJECTTYPE.GUARDKNIGHT;
            typeid = IDManager.CreateTypeId(OBJECTTYPE.GUARDKNIGHT); ;
            SetPoint(x, y);
            mRebirthTime = 0;//不允许复活
            mnSurvivalTick = System.Environment.TickCount;
            mPlay = _play;

            SetDir(dir);
        }
Example #15
0
        public PlayerMagic(PlayerObject _play)
        {
            play = _play;
            mDicMagic = new Dictionary<uint, GameStruct.RoleMagicInfo>();

            mNormalAttackSpeed = new GameBase.Core.TimeOut();
            mNormalAttackSpeed.SetInterval(GameBase.Config.Define.ROLE_ATTACK_SPEED);
            mNormalAttackSpeed.Update();
            mMoveSpeed = new GameBase.Core.TimeOut();
            mMoveSpeed.SetInterval(GameBase.Config.Define.ROLE_MOVE_SPEED);
            mMoveSpeed.Update();
            mMagicAttackSpeed = new List<GameBase.Core.TimeOut>();
        }
Example #16
0
 public PlayerItem(PlayerObject _play)
 {
     //mBagCount = 0;
     mDicItem = new Dictionary<uint, GameStruct.RoleItemInfo>();
     mDicItem.Clear();
     play = _play;
     mDicAddItem = new Dictionary<uint, GameStruct.RoleItemInfo>();
     mDicAddItem.Clear();
     mScriptItemId = 0;
     mWeaponId = 0;
     mFashionId = 0;
     mArmorId = 0;
 }
Example #17
0
 //参数说明
 //_play 创建该特效的宿主
 //nEffid 特效id
 //param 应该是面特效标记,比如是道具 地面特效等等 //标记 10 地面特效 12.清除地面特效
 //param1 未知  15.守护骑士 14.降灵咒雨
 //nTime 对象存活时间[秒]
 public EffectObject(PlayerObject _play, int nEffId, int nParam, int nParam1, int nTime, short nX, short nY)
 {
     mnEffID = nEffId;
     mPlay = _play;
     mnTime = nTime * 1000;
     mnTick = System.Environment.TickCount;
     mnParam = nParam;
     mnParam1 = nParam1;
     type = OBJECTTYPE.EFFECT;
     typeid = IDManager.CreateTypeId(OBJECTTYPE.EFFECT);
     mnAttackTick = System.Environment.TickCount;
     this.SetPoint(nX, nY);
 }
Example #18
0
        public MingGuoShengNv(PlayerObject _play, short x, short y, byte dir, uint _id, int nAi_Id)
            : base(_id, nAi_Id,x,y, false)
        {
            type = OBJECTTYPE.CALLOBJECT;
            typeid = IDManager.CreateTypeId(OBJECTTYPE.GUARDKNIGHT);
            SetPoint(x, y);
            mRebirthTime = 0;//不允许复活

            mPlay = _play;
            SetDir(dir);
            mnRefreshTick = System.Environment.TickCount;
            mMagicAttackTime = new GameBase.Core.TimeOut();
            mMagicAttackTime.SetInterval(5);
        }
Example #19
0
 //提取元宝
 public void GetMoney(PlayerObject play)
 {
     String sAccount = play.GetBaseAttr().sAccount;
     if (!mDicPayRecInfo.ContainsKey(sAccount))
     {
         play.MsgBox("没有可提取的魔石!");
         return;
     }
     int gamegold = mDicPayRecInfo[sAccount].money;
     play.ChangeMoney(GameStruct.MONEYTYPE.GAMEGOLD, gamegold);
     play.MsgBox("提取魔石[" + gamegold.ToString() + "]点!");
     SetPayTag(sAccount);
     mDicPayRecInfo.Remove(sAccount);
 }
Example #20
0
        public WangNianWuLing(PlayerObject _play, short x, short y, byte dir, uint _id, int nAi_Id)
            : base(_id, nAi_Id,x,y, false)
        {
            type = OBJECTTYPE.CALLOBJECT;
            typeid = IDManager.CreateTypeId(OBJECTTYPE.GUARDKNIGHT);
            SetPoint(x, y);
            mRebirthTime = 0;//不允许复活

            mPlay = _play;
            SetDir(dir);
            mnRefreshTick = System.Environment.TickCount;
            mAddHP_Time = new TimeOut();
            mAddHP_Time.SetInterval(2);
        }
Example #21
0
        //军团添加成员
        public void AddMember(uint legion_id,PlayerObject play)
        {
            //已经有军团了
            if(play.GetLegionSystem().IsHaveLegion())return;
            Legion legion = GetLegion(legion_id);
            if (legion == null) return;
            LegionMember member = new LegionMember();
            member.members_name = play.GetName();
            member.money = 0;
            member.rank = GameBase.Config.Define.LEGION_PLACE_PUTONGTUANYUAN;
            legion.GetBaseInfo().list_member.Add(member);
            play.GetLegionSystem().SetLegion(legion,true);

            UpdateLegionInfo(legion_id, play.GetBaseAttr().player_id);
        }
Example #22
0
        public ShenYuanELing(PlayerObject _play,BaseObject _AttackTarget, short x, short y, byte dir, uint _id, int nAi_Id)
            : base(_id, nAi_Id,x,y, false)
        {
            type = OBJECTTYPE.CALLOBJECT;
            mPlay = _play;
            //1.5倍的血量
            this.attr.life = this.attr.life_max =  (int)(mPlay.GetBaseAttr().life * 1.5f);

            typeid = IDManager.CreateTypeId(OBJECTTYPE.GUARDKNIGHT);
            SetPoint(x, y);
            mRebirthTime = 0;//不允许复活

            SetDir(dir);
            this.GetAi().SetAttackTarget(_AttackTarget);
        }
Example #23
0
        public PlayerTimer(PlayerObject _play)
        {
            mi64Effect = 0;
            mi64EffectEx = 0;
            play = _play;

            mXpTime = new GameBase.Core.TimeOut();
            mXpTime.SetInterval(Define.XP_ADD_SECS);
            mXpTime.Update();
            mnXpVal = 0;

            mSPTime = new GameBase.Core.TimeOut();
            mSPTime.SetInterval(Define.SP_ADD_SECS);
            mSPTime.Update();
            mListStatus = new List<GameStruct.RoleStatus>();
            mObject_CALL = null;
        }
        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);
            }
        }
Example #25
0
        public EudemonObject(RoleData_Eudemon info,PlayerObject _play)
        {
            type = OBJECTTYPE.EUDEMON;
            mInfo = info;
            play = _play;
            mPlayObject = new Dictionary<uint, PlayerObject>();
            typeid = info.GetTypeID();
            mMonsterInfo = EudemonObject.GetMonsterInfo(play, info.itemid);
            mbIsCombo = false;
            mAttackSpeed = new GameBase.Core.TimeOut();
            mAttackSpeed.SetInterval(GameBase.Config.Define.ROLE_ATTACK_SPEED);
            mAttackSpeed.Update();

            mMagicAttackSpeed = new List<GameBase.Core.TimeOut>();
            this.SetRiding(false);
            this.SetState(EUDEMONSTATE.NROMAL);
        }
Example #26
0
 //退出队伍
 public void ExitTeam(PlayerObject _play)
 {
     for (int i = 0; i < mlistMember.Count; i++)
       {
           PlayerObject play = mlistMember[i];
           if (play.GetBaseAttr().player_id == _play.GetBaseAttr().player_id)
           {
               _play.SetTeam(null);
               mlistMember.RemoveAt(i);
               break;
           }
        }
       //队伍人数不足就解散队伍
       if (mlistMember.Count == 0)
       {
           DeleteTeam();
       }
 }
Example #27
0
        public bool Action_Fuben_Create(ActionInfo info, PlayerObject play)
        {
            String[] option = info.param.Split(' ');
            uint mapid = Convert.ToUInt32(option[0]);
            byte type = Convert.ToByte(option[1]);
            short x = Convert.ToInt16(option[2]);
            short y = Convert.ToInt16(option[3]);
            GameMap fb_map =  MapManager.Instance().AddFubenMap(mapid);
            if (fb_map == null)
            {
                return false;
            }
            if(type == 1)//单人副本
            {
                play.ChangeFubenMap(fb_map, x, y);
            }
            else if (type == 2)//组队副本
            {

            }
            return true;
        }
Example #28
0
 //播放动作-
 //action_id :动作id
 //play : 参数如果不为空,则只对该角色播放动作,否则广播
 public void PlayFaceAcion(uint action_id,PlayerObject play = null)
 {
     PacketOut outpack ;
     if(play == null)
     {
         outpack = new PacketOut();
     }else
     {
         outpack = new PacketOut(play.GetGamePackKeyEx());
     }
     outpack.WriteUInt16(28);
     outpack.WriteUInt16(1010);
     outpack.WriteUInt32(0);
     outpack.WriteUInt32(this.GetTypeId());
     outpack.WriteUInt32(23855267);
     outpack.WriteUInt32(mInfo.dir);
     outpack.WriteUInt32(action_id);
     outpack.WriteUInt32(9530);
     byte[] data = outpack.Flush();
     if(play != null)
     {
         play.SendData(data);
         return;
     }
     //this.RefreshVisibleObject();
     foreach (RefreshObject o in mVisibleList.Values)
     {
         BaseObject obj = o.obj;
         if (obj.type == OBJECTTYPE.PLAYER)
         {
             PlayerObject _play = obj as PlayerObject;
             outpack = new PacketOut(_play.GetGamePackKeyEx());
             outpack.WriteBuff(data);
             _play.SendData(outpack.Flush());
         }
     }
 }
Example #29
0
        //发送机器人的角色信息
        //play 玩家对象
        public void SendRobotInfo(PlayerObject play/*bool boRepeat = true*/)
        {
            uint legion_id = RobotLegionManager.GetInstance().GetLegionId(mInfo.legion_name);
            NetMsg.MsgRoleInfo role = new NetMsg.MsgRoleInfo();
            role.Create(null, play.GetGamePackKeyEx());
            role.role_id = this.GetTypeId();
            role.x = mInfo.x;
            role.y = mInfo.y;
            role.armor_id = mInfo.armor_id;
            role.wepon_id = mInfo.wepon_id;
            role.face_sex = role.face_sex1 = mInfo.lookface;
            role.dir = mInfo.dir;
            role.guanjue = mInfo.guanjue;
            role.hair_id = mInfo.hair;
            role.rid_id = mInfo.rid_id;
            role.str.Add(mInfo.name);

            //军团
            if (mInfo.legion_name.Length > 0)
            {
                role.legion_id = legion_id;
                role.legion_title = mInfo.legion_title;
                role.legion_place = mInfo.legion_place;
                role.legion_id1 = legion_id;
            }
            play.SendData(role.GetBuffer());
            //军团名称-
            if (legion_id > 0)
            {
                NetMsg.MsgLegionName legion = new NetMsg.MsgLegionName();
                legion.Create(null, play.GetGamePackKeyEx());
                legion.legion_id = legion_id;
                legion.legion_name = mInfo.legion_name;
                play.SendData(legion.GetBuffer());
                //if (boRepeat)
                //{
                //    mListPlay.Add(play.GetTypeId());
                //}
            }
            //取该玩家对象- 如果是王、女王、公爵则行礼
            //2015.11.21 遇到玩家就行礼
            //GameStruct.GUANGJUELEVEL lv = play.GetGuanJue();
            //if (lv == GameStruct.GUANGJUELEVEL.KING ||
            //    lv == GameStruct.GUANGJUELEVEL.QUEEN ||
            //    lv == GameStruct.GUANGJUELEVEL.DUKE
            //    )
            //{
              //      this.PlayFaceAcion(Define._ACTION_GENUFLECT, play);
               // }
            this.PlayFaceAcion(Define._ACTION_GENUFLECT, play);
        }
Example #30
0
 //退出军团
 public void QuitLegion(PlayerObject play)
 {
     Legion legion =  play.GetLegionSystem().GetLegion();
     if(legion == null)return;
     uint legion_id = legion.GetBaseInfo().id;
     play.GetLegionSystem().SetLegion(null,true);
     int player_id = play.GetBaseAttr().player_id;
     for (int i = 0; i < legion.GetBaseInfo().list_member.Count; i++)
     {
         if (legion.GetBaseInfo().list_member[i].members_name == play.GetName())
         {
             legion.GetBaseInfo().list_member[i].id = 0;
             break;
         }
     }
     this.UpdateLegionInfo(legion_id, player_id);
 }