Exemplo n.º 1
0
        public void SendInfo(PlayerObject play)
        {
            byte[] data3 = { 41, 0, 238, 7, 28, 162, 1, 0, 91, 1, 27, 2, 144, 1, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 1, 8, 211, 249, 193, 250, 207, 201, 181, 192, 0, 0, 0 };
            //play.SendData(data3, true);
            PacketOut outpack = new PacketOut();
            String    sName   = mPlay.GetName();
            int       nLen    = 33 + GameBase.Core.Coding.GetDefauleCoding().GetBytes(sName).Length;

            outpack.WriteInt16((short)nLen);
            outpack.WriteInt16(2030);
            outpack.WriteUInt32(this.GetTypeId());
            outpack.WriteInt16(this.GetCurrentX());
            outpack.WriteInt16(this.GetCurrentY());
            outpack.WriteInt32(400);//144, 1, 0, 0
            outpack.WriteInt32(34);
            outpack.WriteInt32(0);
            outpack.WriteInt32(76);
            outpack.WriteByte(1);
            outpack.WriteString(sName);
            outpack.WriteByte(0);
            outpack.WriteByte(0);
            outpack.WriteByte(0);
            //  Log.Instance().WriteLog(GamePacketKeyEx.byteToText(outpack.GetNormalBuff()));
            play.SendData(outpack.Flush(), true);
            //   byte[] data3 = { 41, 0, 238, 7, 28, 162, 1, 0, 91, 1, 27, 2, 144, 1, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 1, 8, 211, 249, 193, 250, 207, 201, 181, 192, 0, 0, 0 };
            // this.SendData(data3, true);
        }
Exemplo n.º 2
0
        public static void SendConnectMapServer(GameSession session, int key, int key2)
        {
            byte[] defdata  = { 232, 16, 67, 3 };
            byte[] defdata2 = { 121, 39,  0,  0, 49, 50, 48, 46, 49, 51, 50, 46, 54,
                                57,  46, 49, 52, 55,  0,  0,  0,  0,  0,  0,  0,  0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            byte[] ipdata = Coding.GetDefauleCoding().GetBytes(m_GameServerIP);

            PacketOut packout = new PacketOut(session.GetGamePackKeyEx());

            packout.WriteUInt16(84);
            packout.WriteUInt16(PacketProtoco.S_GAMESERVERINFO);
            packout.WriteInt32(key);
            packout.WriteInt32(key2);
            packout.WriteInt32(m_GameServerPort);
            packout.WriteBuff(defdata);
            packout.WriteBuff(ipdata);
            for (int i = 0; i < 28 - ipdata.Length; i++)
            {
                packout.WriteByte(0);
            }
            packout.WriteBuff(defdata2);

            defdata = packout.Flush();
            server.SendData(session.m_Socket, defdata);
        }
Exemplo n.º 3
0
        public void SendLegionInfo()
        {
            //广播给周围的人刷新自身信息
            play.RefreshRoleInfo();
            NetMsg.MsgSelfLegionInfo self_info = new NetMsg.MsgSelfLegionInfo();
            self_info.Create(null, play.GetGamePackKeyEx());
            if (legion == null)
            {
                self_info.legion_name = "";
                self_info.legion_id   = 0;
                self_info.money       = 0;
                self_info.devote      = 0;
                self_info.place       = 0;
                self_info.title       = 0;
                self_info.title       = 0;
                play.SendData(self_info.GetBuffer());



                return;
            }


            //byte[] dat5 = { 108, 0, 82, 4, 246, 0, 0, 0, 144, 208, 3, 0, 144, 208, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 0, 0, 4/*!!!头衔*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 210, 176, 177, 200, 186, 243, 204, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref dat5, dat5.Length);
            //play.SendData(dat5);
            //byte[] data10 = { 21, 0, 247, 3, 246, 0, 0, 0, 3, 0, 1, 8, 196, 234, 201, 217, 187, 196, 204, 198, 0 };
            //play.GetGamePackKeyEx().EncodePacket(ref data10, data10.Length);
            //play.SendData(data10);

            //return;


            self_info.legion_name = legion.GetBaseInfo().name;
            self_info.legion_id   = legion.GetBaseInfo().id;
            self_info.money       = (int)legion.GetBaseInfo().money;
            self_info.devote      = GetDevote();
            self_info.place       = GetPlace();
            self_info.title       = legion.GetBaseInfo().title;
            play.SendData(self_info.GetBuffer());

            //收到网络协议:长度:21协议号:1015
            byte[]    legion_name = Coding.GetDefauleCoding().GetBytes(legion.GetBaseInfo().name);
            PacketOut outpack     = new PacketOut(play.GetGamePackKeyEx());

            outpack.WriteUInt16((ushort)(12 + legion_name.Length));
            outpack.WriteUInt16(1015);
            outpack.WriteUInt32(legion.GetBaseInfo().id);
            outpack.WriteUInt16(3);
            outpack.WriteByte(1);
            outpack.WriteString(legion.GetBaseInfo().name);
            outpack.WriteByte(0);

            play.SendData(outpack.Flush());
        }
Exemplo n.º 4
0
        public void SetTrading(bool v)
        {
            mIsTrad = v;
            PacketOut outpack = null;

            if (mIsTrad)
            {
                PlayerObject target = UserEngine.Instance().FindPlayerObjectToTypeID(GetTradTarget());
                if (target == null)
                {
                    SetTrading(false);
                    return;
                }
                outpack = new PacketOut(target.GetGamePackKeyEx());
                outpack.WriteUInt16(16);
                outpack.WriteUInt16(1056);
                outpack.WriteUInt32(play.GetTypeId());

                outpack.WriteUInt32(3);
                outpack.WriteUInt32(1);
                target.SendData(outpack.Flush());
            }
            else
            {
                byte[] data = { 16, 0, 32, 4, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0 };
                outpack = new PacketOut(play.GetGamePackKeyEx());
                outpack.WriteBuff(data);
                play.SendData(outpack.Flush());
                play.LeftNotice("交易失败!");

                //返还魔石、金币 道具与装备
                play.ChangeAttribute(GameStruct.UserAttribute.GOLD, mnGold);
                if (mnGameGold > 0)
                {
                    play.ChangeAttribute(GameStruct.UserAttribute.GAMEGOLD, mnGameGold);
                }
                if (mnGold > 0)
                {
                    play.ChangeAttribute(GameStruct.UserAttribute.GOLD, mnGameGold);
                }
                //装备
                for (int i = 0; i < mListItem.Count; i++)
                {
                    play.GetItemSystem().AddTradItem(mListItem[i]);
                }
                //返还幻兽
                for (int i = 0; i < mListEudemon.Count; i++)
                {
                    play.GetEudemonSystem().AddEudemon(mListEudemon[i]);
                }
                mListItem.Clear();
                mListEudemon.Clear();
            }
        }
Exemplo n.º 5
0
        public static void OnConnect(Socket s)
        {
            GameSession session;

            lock (_lock_session)
            {
                session         = new GameSession(s);
                m_DicSession[s] = session;
            }

            //发送key
            PacketOut packout = new PacketOut(session.GetGamePackKeyEx());

            packout.WriteInt16(8); //长度
            packout.WriteUInt16(PacketProtoco.S_KEY);
            packout.WriteInt32(m_Key);
            byte[] data = packout.Flush();
            server.SendData(s, data);
        }
Exemplo n.º 6
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());
                }
            }
        }
Exemplo n.º 7
0
        public void SetTradGameGold(int gamegold)
        {
            if (gamegold <= 0)
            {
                return;
            }
            PlayerObject obj = UserEngine.Instance().FindPlayerObjectToTypeID(GetTradTarget());

            if (obj == null)
            {
                return;
            }
            mnGameGold = gamegold;

            //发给对方
            PacketOut outpack = new PacketOut(obj.GetGamePackKeyEx());

            outpack.WriteUInt16(16);
            outpack.WriteUInt16(1056);
            outpack.WriteInt32(mnGameGold);
            outpack.WriteInt32(12);
            outpack.WriteInt32(0);
            obj.SendData(outpack.Flush());
        }
Exemplo n.º 8
0
        //获取远程摊位
        //id 为从指定序号摊位 -1为自动顺序
        public void GetRemotePtich(PlayerObject play, int id = -1)
        {
            int ptich_id = -1;

            if (id != -1 && id >= 0 && id < mListPtichInfo.Count)
            {
                if (mListPtichInfo[id].play == null)
                {
                    play.MsgBox("该摊位未开放");
                    return;
                }
                ptich_id = id;
            }
            else
            {
                ptich_id = GetRemotePtichId(play.GetCurrentRemotePtichId());
            }

            if (ptich_id == -1)
            {
                return;                 //无摊位 返回
            }
            play.SetCurrentRemotePtichId(ptich_id);

            //远程摊位信息
            String    sName   = mListPtichInfo[ptich_id].play.GetName();
            int       nLen    = 13 + Coding.GetDefauleCoding().GetBytes(sName).Length;
            PacketOut outpack = new PacketOut();

            outpack.WriteInt16((short)nLen);
            outpack.WriteInt16(1015);

            // {19,0,247,3,14,0,0,0,125,0,1,6,203,167,208,161,187,239,0}
            outpack.WriteInt32(ptich_id + 1);
            outpack.WriteInt16(125);
            outpack.WriteByte(1);
            outpack.WriteString(sName);
            outpack.WriteByte(0);
            play.SendData(outpack.Flush(), true);
            for (int i = 0; i < mListPtichInfo[ptich_id].mSellItemList.Count
                 ; i++)
            {
                RoleItemInfo     item_info = null;
                RoleData_Eudemon eudemon   = null;
                if (mListPtichInfo[ptich_id].mSellItemList[i].item_id >= IDManager.eudemon_start_id)
                {
                    eudemon = mListPtichInfo[ptich_id].play.GetEudemonSystem().FindEudemon(
                        mListPtichInfo[ptich_id].mSellItemList[i].item_id);
                    if (eudemon == null)
                    {
                        continue;
                    }
                    item_info = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem(eudemon.itemid);
                }
                else
                {
                    item_info = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem(
                        mListPtichInfo[ptich_id].mSellItemList[i].item_id);
                }

                if (item_info != null)
                {
                    NetMsg.MsgPtichItemInfo msg = new NetMsg.MsgPtichItemInfo(item_info,
                                                                              (uint)(ptich_id + 1), mListPtichInfo[ptich_id].mSellItemList[i].price, mListPtichInfo[ptich_id].mSellItemList[i].sell_type, true);
                    play.SendData(msg.GetBuffer(), true);
                    //发送幻兽信息
                    if (item_info.typeid >= IDManager.eudemon_start_id)
                    {
                        mListPtichInfo[ptich_id].play.GetEudemonSystem().SendLookPtichEudemonInfo(play, eudemon);
                    }
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 10
0
        public void BuyItem(PlayerObject play, uint ptich_obj_id, uint item_id)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null)
            {
                play.MsgBox("摆摊中不允许购买!");
                return;
            }
            int ptich_id = -1;

            for (int i = 0; i < mListPtichInfo.Count; i++)
            {
                if (mListPtichInfo[i].PtichObj == null)
                {
                    continue;
                }
                if (mListPtichInfo[i].PtichObj.GetTypeId() == ptich_obj_id)
                {
                    ptich_id = i;
                    break;
                }
            }
            if (ptich_id == -1)
            {
                return;
            }

            //检测是否有道具
            int  price     = 0;
            byte sell_type = 0;

            RoleItemInfo     item    = null;
            RoleData_Eudemon eudemon = null;
            bool             bFind   = false;

            for (int i = 0; i < mListPtichInfo[ptich_id].mSellItemList.Count; i++)
            {
                if (mListPtichInfo[ptich_id].mSellItemList[i].item_id == item_id)
                {
                    bFind = true;
                    if (item_id >= IDManager.eudemon_start_id)
                    {
                        eudemon = mListPtichInfo[ptich_id].play.GetEudemonSystem().FindEudemon(item_id);
                        if (eudemon == null)
                        {
                            return;
                        }
                        item = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem(eudemon.itemid);
                    }
                    else
                    {
                        item = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem(item_id);
                    }

                    if (item == null)
                    {
                        play.MsgBox("购买失败!");
                        return;
                    }
                    price     = mListPtichInfo[ptich_id].mSellItemList[i].price;
                    sell_type = mListPtichInfo[ptich_id].mSellItemList[i].sell_type;
                    if (sell_type == NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GAMEGOLD)
                    {
                        if (price > play.GetMoneyCount(MONEYTYPE.GOLD))
                        {
                            play.MsgBox("购买失败,魔石不足!");
                            return;
                        }
                        play.ChangeMoney(MONEYTYPE.GAMEGOLD, -price);
                        mListPtichInfo[ptich_id].play.ChangeMoney(MONEYTYPE.GAMEGOLD, price);
                    }
                    else if (sell_type == NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GOLD)
                    {
                        if (price > play.GetMoneyCount(MONEYTYPE.GOLD))
                        {
                            play.MsgBox("购买失败,金币不足!");
                            return;
                        }
                        play.ChangeMoney(MONEYTYPE.GOLD, -price);
                        mListPtichInfo[ptich_id].play.ChangeMoney(MONEYTYPE.GOLD, price);
                    }
                    else
                    {
                        return;
                    }
                    mListPtichInfo[ptich_id].mSellItemList.RemoveAt(i);
                    break;
                }
            }
            if (!bFind)
            {
                play.MsgBox("购买失败,该道具已下架!");
                return;
            }

            if (item_id >= IDManager.eudemon_start_id)
            {
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK;
                play.GetEudemonSystem().AddTempEudemon(eudemon);//加到临时表
            }
            else
            {
                //添加道具
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;
            }
            play.GetItemSystem().AwardItem(item);
            //删除卖方道具
            //刷新摊位道具栏 卖方
            GetBackItem(mListPtichInfo[ptich_id].play, item_id);
            mListPtichInfo[ptich_id].play.GetItemSystem().DeleteItemByID(item_id);

            //买方
            //{28,0,241,3,140,87,212,7,70,160,1,0,23,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
            PacketOut outpack = new PacketOut();

            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteUInt32(ptich_obj_id);
            outpack.WriteInt32(23); //购买完的标识
            outpack.WriteInt16(0);
            outpack.WriteInt32(1);
            outpack.WriteInt32(0);
            outpack.WriteInt16(0);
            play.SendData(outpack.Flush(), true);
            // this.LookPtich(play, ptich_obj_id);
            //  this.LookPtich(mListPtichInfo[ptich_id].play, ptich_obj_id);
        }
Exemplo n.º 11
0
        //查看摊位
        //ptich_obj_id 摊位对象id
        //page 页码
        public void LookPtich(PlayerObject play, uint ptich_obj_id)
        {
            int ptich_id = -1;

            for (int i = 0; i < mListPtichInfo.Count; i++)
            {
                if (mListPtichInfo[i].PtichObj == null)
                {
                    continue;
                }
                if (mListPtichInfo[i].PtichObj.GetTypeId() == ptich_obj_id)
                {
                    ptich_id = i;
                    break;
                }
            }
            if (ptich_id == -1)
            {
                return;
            }
            // 摊位信息
            byte[]    senddata = { 42, 0, 105, 4, 244, 1, 0, 0, 64, 66, 15, 0, 36, 52, 156, 8, 3, 0, 0, 0, 30, 214, 44, 135, 2, 0, 0, 0, 164, 3, 178, 5, 1, 0 };
            PacketOut outpack  = new PacketOut();

            outpack.WriteBuff(senddata);
            outpack.WriteInt16((short)(ptich_id + 1));
            byte[] data2 = { 1, 4, 202, 165, 213, 189 };
            outpack.WriteBuff(data2);
            play.SendData(outpack.Flush(), true);
            //出售的道具信息
            for (int i = 0; i < mListPtichInfo[ptich_id].mSellItemList.Count; i++)
            {
                RoleItemInfo     item_info = null;
                RoleData_Eudemon eudemon   = null;
                if (mListPtichInfo[ptich_id].mSellItemList[i].item_id >= IDManager.eudemon_start_id)
                {
                    eudemon = mListPtichInfo[ptich_id].play.GetEudemonSystem().FindEudemon(
                        mListPtichInfo[ptich_id].mSellItemList[i].item_id);
                    if (eudemon == null)
                    {
                        continue;
                    }
                    item_info = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem(eudemon.itemid);
                }
                else
                {
                    item_info = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem(
                        mListPtichInfo[ptich_id].mSellItemList[i].item_id);
                }

                if (item_info != null)
                {
                    NetMsg.MsgPtichItemInfo msg = new NetMsg.MsgPtichItemInfo(item_info,
                                                                              ptich_obj_id, mListPtichInfo[ptich_id].mSellItemList[i].price, mListPtichInfo[ptich_id].mSellItemList[i].sell_type);
                    play.SendData(msg.GetBuffer(), true);
                    //发送幻兽信息
                    if (item_info.typeid >= IDManager.eudemon_start_id)
                    {
                        mListPtichInfo[ptich_id].play.GetEudemonSystem().SendLookPtichEudemonInfo(play, eudemon);
                        // play.GetEudemonSystem().SendEudemonInfo(eudemon, false, true);
                    }
                }
            }
            //道具id
            //摊位对象id
            //魔石价格
            //道具基础id
            //最大损耗  172, 38,
            //当前损耗  172, 38,
            //摊位栏 3
            //是否鉴定 0.已鉴定 1.未鉴定
            //未知 50
            //第一个宝石 30
            //第二个宝石 30
            //未知 0,0
            //强化等级 12
            //32.未知
            //33.未知
            //34.未知
            //35.未知
            //36/37.38.39 未知
            //40.41. 战魂等级
            //42-51 未知
            //52 地攻击
            //53 水攻击
            //54 火攻击
            //55 风攻击
            //56 特效
            //64 第三个宝石
            // byte[] data = { 101, 0, 84, 4, 13, 11, 150, 7, 67,162,1,0, 172, 13, 0, 0, 132, 70, 2, 0, 172, 38, 172, 38, 3, 0, 50, 30, 30, 0, 0, 12, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 10, 209, 215, 253, 136, 133, 101, 159, 111, 235, 112, 0, 0, 0, 0, 0 };
            //    play.SendData(GameServer.PtichData, true);
            //107075

            //  收到网络协议:长度:98协议号:1108
            //byte[] data1 = { 98, 0, 84, 4, 110, 134, 61, 138, 67, 162, 1, 0, 14, 0, 0, 0, 118, 91, 16, 0, 0, 0, 0, 0, 3, 0, 53, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 9, 198, 230, 210, 236, 202, 222, 79, 208, 205, 0, 0, 0 };
            //play.SendData(data1,true);
//收到网络协议:长度:24协议号:2037
//byte[] data3 = {24,0,245,7,3,0,0,0,110,134,61,138,1,0,0,0,24,0,0,0,138,2,0,0};
//            play.SendData(data3,true);
////收到网络协议:长度:496协议号:2037
//            byte[] data4 = { 240, 1, 245, 7, 3, 0, 0, 0, 110, 134, 61, 138, 60, 0, 0, 0, 6, 0, 0, 0, 159, 8, 0, 0, 7, 0, 0, 0, 159, 8, 0, 0, 10, 0, 0, 0, 81, 0, 0, 0, 8, 0, 0, 0, 150, 0, 0, 0, 9, 0, 0, 0, 83, 94, 121, 19, 55, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 2, 0, 0, 0, 21, 0, 0, 0, 5, 0, 0, 0, 23, 0, 0, 0, 1, 0, 0, 0, 25, 0, 0, 0, 244, 5, 0, 0, 26, 0, 0, 0, 33, 5, 0, 0, 27, 0, 0, 0, 165, 3, 0, 0, 28, 0, 0, 0, 19, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 59, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 11, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 1, 0, 0, 0, 24, 0, 0, 0, 138, 2, 0, 0, 13, 0, 0, 0, 50, 0, 0, 0, 1, 0, 0, 0, 13, 4, 0, 0, 0, 0, 0, 0, 204, 5, 0, 0, 3, 0, 0, 0, 231, 2, 0, 0, 2, 0, 0, 0, 11, 4, 0, 0, 4, 0, 0, 0, 47, 2, 0, 0, 5, 0, 0, 0, 190, 2, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 176, 10, 0, 0, 37, 0, 0, 0, 235, 49, 0, 0, 38, 0, 0, 0, 79, 71, 0, 0, 39, 0, 0, 0, 168, 35, 0, 0, 40, 0, 0, 0, 235, 49, 0, 0, 41, 0, 0, 0, 225, 26, 0, 0, 42, 0, 0, 0, 179, 32, 0, 0, 83, 0, 0, 0, 50, 0, 0, 0 };
//            play.SendData(data4, true);
        }
Exemplo n.º 12
0
        //收摊
        //bSendData 是否回发收摊数据- 玩家下线就不发
        public void ShutPtich(PlayerObject play, bool bSendData = true)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null)
            {
                return;
            }
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());

            if (ptich_obj_id == 0)
            {
                return;
            }

            for (int i = 0; i < mListPtichInfo[play.GetCurrentPtichID()].mSellItemList.Count; i++)
            {
                GameStruct.RoleItemInfo item = null;
                if (mListPtichInfo[play.GetCurrentPtichID()].mSellItemList[i].item_id >= IDManager.eudemon_start_id)
                {
                    RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(
                        mListPtichInfo[play.GetCurrentPtichID()].mSellItemList[i].item_id);
                    if (eudemon == null)
                    {
                        continue;
                    }
                    item = play.GetItemSystem().FindItem(eudemon.itemid);
                }
                else
                {
                    item = play.GetItemSystem().FindItem(
                        mListPtichInfo[play.GetCurrentPtichID()].mSellItemList[i].item_id);
                }

                if (item != null)
                {
                    //放回到包裹
                    //放回到包裹或幻兽背包
                    if (item.typeid >= IDManager.eudemon_start_id)
                    {
                        item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK;
                    }
                    else
                    {
                        item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;
                    }

                    if (bSendData)
                    {
                        PacketOut outpack = new PacketOut();
                        outpack.WriteInt16(28);
                        outpack.WriteInt16(1009);
                        outpack.WriteUInt32(item.id);
                        outpack.WriteUInt32(ptich_obj_id);
                        outpack.WriteInt32((byte)NetMsg.MsgOperateItem.PTICH_GETBACK_SELLITEM);
                        outpack.WriteInt32(0);
                        outpack.WriteInt32(0);
                        outpack.WriteInt32(0);
                        play.SendData(outpack.Flush(), true);
                    }
                }
            }
            mListPtichInfo[play.GetCurrentPtichID()].play = null;
            //移除地图对象
            play.GetGameMap().RemoveObj(mListPtichInfo[play.GetCurrentPtichID()].PtichObj);
            mListPtichInfo[play.GetCurrentPtichID()].PtichObj = null;
            mListPtichInfo[play.GetCurrentPtichID()].mSellItemList.Clear();
            if (bSendData)
            {
                PacketOut outpack = new PacketOut();
                outpack.WriteInt16(16);
                outpack.WriteInt16(2031);
                outpack.WriteUInt32(ptich_obj_id);
                outpack.WriteUInt32(play.GetTypeId());
                outpack.WriteInt32(2);
                play.SendData(outpack.Flush(), true);
            }
            //移除摆摊状态
            play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_PTICH);
        }
Exemplo n.º 13
0
        //摊位取回道具
        public void GetBackItem(PlayerObject play, uint item_id)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null)
            {
                return;
            }
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());

            GameStruct.RoleItemInfo item = null;
            if (ptich_obj_id == 0)
            {
                return;
            }
            if (item_id >= IDManager.eudemon_start_id)
            {
                RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(item_id);
                if (eudemon == null)
                {
                    return;
                }
                item = play.GetItemSystem().FindItem(eudemon.itemid);
                if (item == null)
                {
                    return;
                }
            }
            else
            {
                item = play.GetItemSystem().FindItem(item_id);
                if (item == null)
                {
                    return;
                }
            }

            int nPtichId = play.GetCurrentPtichID();

            for (int i = 0; i < mListPtichInfo[nPtichId].mSellItemList.Count; i++)
            {
                if (mListPtichInfo[nPtichId].mSellItemList[i].item_id == item_id)
                {
                    mListPtichInfo[nPtichId].mSellItemList.RemoveAt(i);
                    break;
                }
            }
            //放回到包裹或幻兽背包
            if (item_id >= IDManager.eudemon_start_id)
            {
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK;
            }
            else
            {
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;
            }

            PacketOut outpack = new PacketOut();

            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteUInt32(ptich_obj_id);
            outpack.WriteInt32((byte)NetMsg.MsgOperateItem.PTICH_GETBACK_SELLITEM);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            play.SendData(outpack.Flush(), true);
        }
Exemplo n.º 14
0
        //摊位出售道具
        public void SellItem(PlayerObject play, uint item_id, byte type, int price)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null)
            {
                return;
            }
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());

            GameStruct.RoleItemInfo item = null;
            if (ptich_obj_id == 0)
            {
                return;
            }
            if (item_id >= IDManager.eudemon_start_id)
            {
                RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(item_id);
                if (eudemon == null)
                {
                    return;
                }
                item = play.GetItemSystem().FindItem(eudemon.itemid);
                if (item == null)
                {
                    return;
                }
            }
            else
            {
                item = play.GetItemSystem().FindItem(item_id);
                if (item == null)
                {
                    return;
                }
            }

            if (ptich_obj_id == 0)
            {
                return;
            }
            //判断是否已经在出售摊位列表中- 反作弊
            int nPtichId = play.GetCurrentPtichID();

            for (int i = 0; i < mListPtichInfo[nPtichId].mSellItemList.Count; i++)
            {
                if (mListPtichInfo[nPtichId].mSellItemList[i].item_id == item_id)
                {
                    return;
                }
            }
            //摆摊出售道具已满
            if (mListPtichInfo[nPtichId].mSellItemList.Count >= GameBase.Config.Define.PTICH_SELL_MAX_COUNT)
            {
                return;
            }
            PacketOut outpack = new PacketOut();

            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteInt32(price);
            outpack.WriteInt32(type);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            play.SendData(outpack.Flush(), true);
            //移到摊位状态
            item.postion = NetMsg.MsgItemInfo.ITEMPOSTION_PTICH_PACK;


            PtichSellItemInfo info = new PtichSellItemInfo();

            info.item_id   = item_id;
            info.price     = price;
            info.sell_type = type;
            mListPtichInfo[nPtichId].mSellItemList.Add(info);
            // {28,0,241,3,8,127,205,7,111,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
        }