WriteString() публичный Метод

public WriteString ( String v ) : void
v String
Результат void
Пример #1
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);

                    }
                }
            }
        }
Пример #2
0
 public override byte[] GetBuffer()
 {
     mMsgLen += (ushort)Coding.GetDefauleCoding().GetBytes(legion_name).Length;
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(legion_id);
     outpack.WriteUInt16(3);
     outpack.WriteByte(1);
     outpack.WriteString(legion_name);
     outpack.WriteByte(0);
     return outpack.Flush();
 }
Пример #3
0
     public override byte[] GetBuffer()
     {
         PacketOut outpack = new PacketOut(mKey);
         byte nNameLen = (byte)GameBase.Core.Coding.GetDefauleCoding().GetBytes(name).Length;
         mMsgLen += nNameLen;
         outpack.WriteUInt16(mMsgLen);
         outpack.WriteUInt16(mParam);
         outpack.WriteUInt32(roleid);
         outpack.WriteUInt32(lookface);
         outpack.WriteUInt32(hair);
         outpack.WriteUInt32(gold);
         outpack.WriteUInt32(gamegold);
         outpack.WriteUInt32(exp);
         outpack.WriteUInt32(expparam);
         outpack.WriteUInt32(mentorexp);
         outpack.WriteUInt32(mercenarexp);
         outpack.WriteUInt32(potential);
         outpack.WriteUInt16(attackpower);
         outpack.WriteUInt16(constitution);
         outpack.WriteUInt16(doage);
         outpack.WriteUInt16(decdoage);
         outpack.WriteUInt16(health);
        // outpack.WriteUInt16(soul);
         outpack.WriteUInt16(magic_attack);
         outpack.WriteUInt16(addpoint);
         outpack.WriteUInt16(life);
         outpack.WriteUInt16(maxlife);
         outpack.WriteUInt16(manna);
         outpack.WriteUInt32(param);
         outpack.WriteUInt32(param1);
         outpack.WriteUInt16(pk);
         outpack.WriteByte(level);
         outpack.WriteByte(profession);
         outpack.WriteByte(param2);
         outpack.WriteByte(param3);
         outpack.WriteByte(param4);
         outpack.WriteByte(mentorlevel);
         outpack.WriteByte(param14);
         outpack.WriteByte(guanjue);
        // outpack.WriteUInt16(Mercenarylevel);
         outpack.WriteUInt16(maxpetcall);
         outpack.WriteInt32(exploit);
         outpack.WriteInt32(bonuspoint);
         outpack.WriteByte(edubroodpacksize);
         outpack.WriteByte(winglevel);
         outpack.WriteByte(godpetpackagelimit);
         outpack.WriteByte(demonlev);
         outpack.WriteInt32(demonexp);
         outpack.WriteInt32(demonexpparam);
         outpack.WriteInt32(param5);
         outpack.WriteInt32(godlevel);
         outpack.WriteByte(param9);
         outpack.WriteByte(param11);
         outpack.WriteUInt16(param10);
 
         for (int i = 0; i < param6.Length; i++)
         {
             outpack.WriteInt32(param6[i]);
         }
         outpack.WriteInt32(originalserverid);
         outpack.WriteUInt16(wordtreeareaid);
         for (int i = 0; i < param7.Length; i++)
         {
             outpack.WriteInt32(param7[i]);
         }
         outpack.WriteUInt16(param8);
         outpack.WriteByte(2);
         outpack.WriteString(name);
         for (int i = 0; i < param13.Length; i++)
         {
             outpack.WriteByte(param13[i]);
         }
      
   
         return outpack.Flush();
     }
Пример #4
0
 public override byte[] GetBuffer()
 {
     byte[] data = Coding.GetUtf8Coding().GetBytes(str);
     mMsgLen += (ushort)(1 + data.Length);
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteInt32(type);
     outpack.WriteInt16(tag);
     outpack.WriteByte(tag2);
     outpack.WriteString(str);
     for (int i = 0; i < param1.Length; i++)
     {
         outpack.WriteByte(param1[i]);
     }
     return outpack.Flush();
 }
Пример #5
0
     public override byte[] GetBuffer()
     {
       
         PacketOut outpack = new PacketOut(mKey);
         byte[] data = Coding.GetDefauleCoding().GetBytes(name);
         mMsgLen += (ushort)data.Length;
         outpack.WriteUInt16(mMsgLen);
         outpack.WriteUInt16(mParam);
         outpack.WriteUInt32(id);
         outpack.WriteUInt32(lookface);
         outpack.WriteBuff(param);
         outpack.WriteUInt32(play_id);
         outpack.WriteInt32(life);
         outpack.WriteInt32(life_max);
         outpack.WriteInt16(x);
         outpack.WriteInt16(y);
         outpack.WriteInt16(dir);
         outpack.WriteByte(wuxing);
       
         outpack.WriteBuff(param1);
         outpack.WriteUInt32(monsterid);
         outpack.WriteInt32(param3);
         outpack.WriteInt32(param4);
 outpack.WriteInt32(param5);
   outpack.WriteInt32(star);
  
         outpack.WriteBuff(param2);
         outpack.WriteByte(count);
         outpack.WriteString(name);
         outpack.WriteInt16(0);
         return outpack.Flush();
     }
Пример #6
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     for (int i = 0; i < strcount; i++)
     {
         mMsgLen += (ushort)(1 + Coding.GetDefauleCoding().GetBytes(liststr[i]).Length);
     }
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt16(unTxtAttribute);
     outpack.WriteUInt16(tag);
     outpack.WriteInt32(param);
     outpack.WriteInt32(param1);
     outpack.WriteInt32(param2);
     outpack.WriteByte(strcount);
     for (int i = 0; i < strcount; i++)
     {
         outpack.WriteString(liststr[i]);
     }
     outpack.WriteByte(0);
     outpack.WriteByte(0);
     outpack.WriteByte(0);
     return outpack.Flush();
 }
Пример #7
0
 public override byte[] GetBuffer()
 {
     for (int i = 0; i < str.Length; i++)
     {
         byte[] data = Coding.GetDefauleCoding().GetBytes(str[i]);
         mMsgLen += /*第一个字节为字符串长度*/(ushort)(data.Length + 1);
     }
    
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteInt32(color);
     outpack.WriteInt16(type);
     outpack.WriteInt16(tag);
     outpack.WriteInt32(param);
     outpack.WriteInt32(param1);
     outpack.WriteInt32(param2);
     outpack.WriteByte(amount);
     for (int i = 0; i < str.Length; i++)
     {
         outpack.WriteString(str[i]);
     }
     outpack.WriteByte(0);
     outpack.WriteByte(0);
     outpack.WriteByte(0);
     return outpack.Flush();
 }
Пример #8
0
        public override byte[] GetBuffer()
        {


            byte nNameLen = (byte)GameBase.Core.Coding.GetDefauleCoding().GetBytes(name).Length;
            mMsgLen += nNameLen;
            PacketOut outpack = new PacketOut(mKey);
            outpack.WriteUInt16(mMsgLen);
            outpack.WriteUInt16(mParam);
            outpack.WriteInt32(time);
            outpack.WriteUInt32(id);
            outpack.WriteUInt32(item_id);
            outpack.WriteUInt16(amount);
            outpack.WriteUInt16(amount_limit);
            outpack.WriteByte(tag);
            outpack.WriteByte(status);
            outpack.WriteByte(postion);
            outpack.WriteByte(gem);
            outpack.WriteByte(gem2);
            outpack.WriteByte(magic);
            outpack.WriteByte(magic2);
            outpack.WriteByte(magic3);
            outpack.WriteInt32(param3);
            outpack.WriteInt32(lock_time);
            outpack.WriteInt32(warghost_exp);
            outpack.WriteInt32(param4);
            outpack.WriteInt32(param5);
            outpack.WriteByte(di_attack);
            outpack.WriteByte(shui_attack);
            outpack.WriteByte(huo_attack);
            outpack.WriteByte(feng_attack);
            outpack.WriteByte(add_eff);
            outpack.WriteByte(param6);
            outpack.WriteByte(param7);
            outpack.WriteInt32(properties);
            outpack.WriteInt16(param10);
           
            outpack.WriteByte(gem3);
            outpack.WriteInt32(god_strong);
            outpack.WriteInt16(param12);
            outpack.WriteInt32(god_exp);
            outpack.WriteInt32(param8);
            outpack.WriteInt32(param1);
            outpack.WriteByte(pram9);
            outpack.WriteString(name);
     
            for (int i = 0; i < param2.Length; i++) outpack.WriteByte(param2[i]);
            return outpack.Flush();
        }
Пример #9
0
        public override byte[] GetBuffer()
        {
            strlist.Add(str1);
            strlist.Add(str2);
            strlist.Add(str3);
            strlist.Add(str4);
            PacketOut pout = new PacketOut(mKey);
            ushort nLen = 0;
            String str;
          
            for (int i = 0; i < strlist.Count; i++)
            {
                str = (String)strlist[i];
                nLen += (ushort)(Coding.GetDefauleCoding().GetBytes(str).Length + sizeof(byte));
            }
            mMsgLen += 1;
            mMsgLen += nLen;
            pout.WriteUInt16(mMsgLen);
            pout.WriteUInt16(mParam);
            pout.WriteInt32(rgba);
            pout.WriteUInt16(type);
            pout.WriteUInt16(tag);
            pout.WriteInt32(param);
            pout.WriteInt32(param1);
            pout.WriteInt32(param2);
            pout.WriteByte(btype);
          
            pout.WriteString(str1);
           
            pout.WriteString(str2);

            pout.WriteByte(0);
            pout.WriteString(str3);
       

            //pout.WriteString(str4);

            
            pout.WriteByte(0);
            pout.WriteUInt16(param3);
            return pout.Flush();
        }
Пример #10
0
        public override byte[] GetBuffer()
        {
            mMsgLen++; //字符串长度
            for (int i = 0; i < str.Count; i++)
            {
                mMsgLen += (ushort)(1 + Coding.GetDefauleCoding().GetBytes(str[i]).Length);
            }
            PacketOut outpack = new PacketOut(mKey);
            outpack.WriteUInt16(mMsgLen);
            outpack.WriteUInt16(mParam);
            outpack.WriteUInt32(role_id);
            outpack.WriteUInt32(face_sex);
            outpack.WriteUInt32(face_sex1);
            for (int i = 0; i < param.Length; i++)
            {
                outpack.WriteInt32(param[i]);
            }
            outpack.WriteUInt32(legion_id);
            outpack.WriteUInt32(armor_id);
            outpack.WriteUInt32(wepon_id);
            outpack.WriteInt32(param1);
            outpack.WriteUInt32(rid_id);
            //如果是坐骑有一个标识。。目前暂时不太清楚这个参数有什么用
            if (rid_id > 0)
            {
                //2015.10.15  20下标是角色缩放。。。
                param11[22] = 75; //这个是幻兽星级,根据幻兽星级显示坐骑的外观
            }
        
            outpack.WriteInt16(x);
            outpack.WriteInt16(y);
            outpack.WriteUInt32(hair_id);
            outpack.WriteByte(dir);
            outpack.WriteByte(TodayGuideCountByOther);
            outpack.WriteUInt16(param2);
            outpack.WriteUInt32(action);
            outpack.WriteByte(level);
            outpack.WriteByte(job);

            outpack.WriteInt16(param6);
            outpack.WriteByte(param7);
            outpack.WriteInt16(param8);
            outpack.WriteByte(guanjue);
 
            outpack.WriteBuff(param9);
            outpack.WriteByte(legion_title);
            outpack.WriteBuff(param10);
            outpack.WriteInt16(legion_place);
            //public byte[] param11 = new byte[35];
            //public uint legion_id1; //军团id?
            outpack.WriteBuff(param11);
            outpack.WriteUInt32(legion_id1);
            for (int i = 0; i < param5.Length; i++)
            {
                outpack.WriteByte(param5[i]);
            }
            outpack.WriteByte((byte)str.Count);
            for (int i = 0; i < str.Count; i++)
            {
                outpack.WriteString(str[i]);
              //  outpack.WriteByte(0);
            }
            for (int i = 0; i < param3.Length; i++)
            {
                outpack.WriteByte(param3[i]);
            }
           // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(outpack.GetNormalBuff()));
            return outpack.Flush();
        }
Пример #11
0
        public override byte[] GetBuffer()
        {
            if (forgetname.Length > 0)
            {
                mMsgLen = (ushort)(mMsgLen + Coding.GetDefauleCoding().GetBytes(forgetname).Length + 1);
            }
            PacketOut outpack = new PacketOut();
            outpack.WriteUInt16(mMsgLen);
            outpack.WriteUInt16(mParam);
            outpack.WriteUInt32(id);
            outpack.WriteUInt32(ptich_obj_id);
            outpack.WriteInt32(price);
            outpack.WriteUInt32(base_item_id);
            outpack.WriteInt16(max_dura);
            outpack.WriteInt16(cur_dura);
            outpack.WriteByte(tag);
            outpack.WriteByte(status);
            outpack.WriteByte(postion);
            outpack.WriteByte(gem1);
            outpack.WriteByte(gem2);
            outpack.WriteInt16(param1);
            outpack.WriteByte(strong_lv);
            outpack.WriteInt32(param2);
            outpack.WriteInt32(param3);
            outpack.WriteInt16(soul_lv);
            outpack.WriteBuff(param4);
            outpack.WriteByte(di_attack);
            outpack.WriteByte(shui_attack);
            outpack.WriteByte(huo_attack);
            outpack.WriteByte(feng_attack);
            outpack.WriteByte(effect);
            outpack.WriteByte(gem3);
            outpack.WriteBuff(param5);
            if (forgetname.Length > 0)
            {
                //六个空字节
                outpack.WriteInt32(0);
                outpack.WriteInt16(0);

                outpack.WriteByte(1);
                outpack.WriteString(forgetname);
                outpack.WriteByte(0);
                outpack.WriteByte(0);
                outpack.WriteByte(0);
            }
            else
            {
                outpack.WriteInt32(0);
            }
         
            return outpack.Flush();
        }
Пример #12
0
        public override byte[] GetBuffer()
        {

            mMsgLen += (ushort)GameBase.Core.Coding.GetDefauleCoding().GetBytes(text).Length;
            mMsgLen += (ushort)param3.Length;
            PacketOut outpack = new PacketOut(mKey);
            outpack.WriteUInt16(mMsgLen);
            outpack.WriteUInt16(mParam);
            outpack.WriteInt32(param);
            outpack.WriteUInt16(param2);
            outpack.WriteByte(optionid);
            outpack.WriteUInt16(interactType);
           
            outpack.WriteString(text);
            for(int i = 0;i < param3.Length;i++)
            {
                outpack.WriteByte(param3[i]);
            }

            return outpack.Flush();
        }
Пример #13
0
        //查看幻兽- 把自身装备信息发给对方
        public void SendLookEudemonInfo(PlayerObject target)
        {
            uint play_id = play.GetTypeId();

            PacketOut outpack = new PacketOut();

            EudemonObject obj = null;
            for (int i = 0; i < mListObj.Count; i++)
            {
                obj = mListObj[i];
                uint itemid = obj.GetEudemonInfo().itemid;
                RoleItemInfo item_info = play.GetItemSystem().FindItem(itemid);
                RoleData_Eudemon info = obj.GetEudemonInfo();
                if (item_info == null) continue;
                //发送道具信息
                outpack = new PacketOut();
                int nLen = 84 + Coding.GetDefauleCoding().GetBytes(item_info.forgename).Length;
                outpack.WriteInt16((short)nLen);
                outpack.WriteInt16(1008); //道具信息
                outpack.WriteUInt32(play_id);
                outpack.WriteUInt32(info.GetTypeID());
                outpack.WriteUInt32(item_info.itemid);
                outpack.WriteInt32(0);
                outpack.WriteByte(NetMsg.MsgItemInfo.TAG_LOOKROLEEUDEMONINFO); //幻兽背包
                outpack.WriteByte(0);
                outpack.WriteByte(NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK);//幻兽背包
                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, 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 };
                outpack.WriteBuff(_data);
                outpack.WriteString(item_info.forgename);
                outpack.WriteByte(0);
                outpack.WriteByte(0);
                outpack.WriteByte(0);
                target.SendData(outpack.Flush(), true);
                //target.GetItemSystem().SendItemInfo(item_info, NetMsg.MsgItemInfo.TAG_LOOKROLEEUDEMONINFO);

                //发送幻兽详细信息
                NetMsg.MsgEudemonInfo msg = new NetMsg.MsgEudemonInfo();

                msg.id = info.GetTypeID();
                msg.tag = 2;
                msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Max, info.atk_max);
                msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Min, info.atk_min);
                msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Max, info.magicatk_max);
                msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Min, info.magicatk_min);
                msg.AddAttribute(GameStruct.EudemonAttribute.Defense, info.defense);
                msg.AddAttribute(GameStruct.EudemonAttribute.Magic_Defense, info.magicdef);
                msg.AddAttribute(GameStruct.EudemonAttribute.Life, info.life);
                msg.AddAttribute(GameStruct.EudemonAttribute.Life_Max, info.life_max);
                msg.AddAttribute(GameStruct.EudemonAttribute.Intimacy, info.intimacy);
                msg.AddAttribute(GameStruct.EudemonAttribute.Level, info.level);
                msg.AddAttribute(GameStruct.EudemonAttribute.WuXing, info.wuxing);
                msg.AddAttribute(GameStruct.EudemonAttribute.Luck, info.luck);
                msg.AddAttribute(GameStruct.EudemonAttribute.Recall_Count, info.recall_count);
                msg.AddAttribute(EudemonAttribute.Card, info.card);
                msg.AddAttribute(EudemonAttribute.Exp, info.exp);
                msg.AddAttribute(EudemonAttribute.Quality, info.quality);
                msg.AddAttribute(EudemonAttribute.Init_Atk, info.GetInitAtk());
                msg.AddAttribute(EudemonAttribute.Init_Magic_Atk, info.GetInitMagicAtk());
                msg.AddAttribute(EudemonAttribute.Init_Defense, info.GetInitDefense());
                msg.AddAttribute(EudemonAttribute.Init_Life, info.init_life);
                msg.AddAttribute(EudemonAttribute.Life_Grow_Rate, ConvertGrowRate(info.life_grow_rate));
                msg.AddAttribute(EudemonAttribute.Atk_Min_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate));
                msg.AddAttribute(EudemonAttribute.Atk_Max_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate_max));
                msg.AddAttribute(EudemonAttribute.MagicAtk_Min_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate));
                msg.AddAttribute(EudemonAttribute.MagicAtk_Max_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate_max));
                msg.AddAttribute(EudemonAttribute.Defense_Grow_Rate, ConvertGrowRate(info.defense_grow_rate));
                msg.AddAttribute(EudemonAttribute.MagicDefense_Grow_Rate, ConvertGrowRate(info.magicdef_grow_rate));
                GameStruct.MonsterInfo _info = EudemonObject.GetMonsterInfo(play, info.itemid);
                if (_info != null)
                {
                    msg.AddAttribute(EudemonAttribute.Riding, _info.eudemon_type);
                }
                target.SendData(msg.GetBuffer(), true);

            }
             //   收到网络协议:长度:99协议号:1008
            //byte[] data1 = {99,0,240,3,73,48,96,5,253,159,138,131,93,92,16,0,0,0,0,0,7,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,14,218,164,186,211,189,228,193,233,161,164,206,172,193,208,0,0,0};
            //            target.SendData(data1,true);
            //            //收到网络协议:长度:143协议号:1116
            //byte[] data2 = {143,0,92,4,253,159,138,131,183,4,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,73,48,96,5,220,3,0,0,220,3,0,0,199,1,52,2,6,0,3,0,0,0,0,0,29,26,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,93,92,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,14,218,164,186,211,189,228,193,233,161,164,206,172,193,208,0,0};
            //              target.SendData(data2,true);
            //            //收到网络协议:长度:24协议号:2037
            //              byte[] data3 = { 24, 0, 245, 7, 2, 0, 0, 0, 253, 159, 138, 131, 1, 0, 0, 0, 24, 0, 0, 0, 7, 0, 0, 0 };
            //              target.SendData(data3, true);
            ////收到网络协议:长度:496协议号:2037
            //byte[] data4 = {240,1,245,7,2,0,0,0,253,159,138,131,60,0,0,0,6,0,0,0,220,3,0,0,7,0,0,0,220,3,0,0,10,0,0,0,37,0,0,0,8,0,0,0,149,0,0,0,9,0,0,0,51,235,16,0,55,0,0,0,0,0,0,0,12,0,0,0,3,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,3,0,0,0,21,0,0,0,5,0,0,0,23,0,0,0,1,0,0,0,25,0,0,0,202,0,0,0,26,0,0,0,188,4,0,0,27,0,0,0,142,3,0,0,28,0,0,0,9,0,0,0,50,0,0,0,1,0,32,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,0,0,0,0,24,0,0,0,7,0,0,0,13,0,0,0,48,0,0,0,1,0,0,0,38,0,0,0,0,0,0,0,83,0,0,0,3,0,0,0,250,0,0,0,2,0,0,0,221,1,0,0,4,0,0,0,182,1,0,0,5,0,0,0,196,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,82,0,0,0,0,0,0,0,36,0,0,0,162,10,0,0,37,0,0,0,233,3,0,0,38,0,0,0,208,8,0,0,39,0,0,0,234,25,0,0,40,0,0,0,144,50,0,0,41,0,0,0,164,46,0,0,42,0,0,0,72,20,0,0,83,0,0,0,50,0,0,0};
            //target.SendData(data4, true);
            //收到网络协议:长度:20协议号:1103
            //{20,0,79,4,253,159,138,131,0,0,0,0,213,7,0,0,0,0,0,0}
            //收到网络协议:长度:20协议号:1103
            //{20,0,79,4,253,159,138,131,0,0,0,0,233,3,0,0,0,0,0,0}
            //收到网络协议:长度:20协议号:1103
            //{20,0,79,4,253,159,138,131,0,0,0,0,185,11,0,0,0,0,0,0}
            //收到网络协议:长度:20协议号:1103
            //{20,0,79,4,253,159,138,131,0,0,0,0,230,7,0,0,0,0,0,0}
            //收到网络协议:长度:172协议号:1117
            //byte[] data5 = { 172, 0, 93, 4 };
            //    byte[] data6 = {0,0,0,0,0,70,0,0,0,0,1,0,12,228,48,138,92,92,16,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,15,0,0,0,15,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,4,0,0,0,0,0,15,0,26,18,104,0,107,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,11,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,218,164,186,211,189,228,193,233,161,164,206,172,193,208,0,0,0,0,0,0,0,0,0,0,0,0};
            //    PacketOut outpack = new PacketOut();
            //    outpack.WriteBuff(data5);
            //    outpack.WriteUInt32(play.GetTypeId());
            //    outpack.WriteBuff(data6);
            //    target.SendData(outpack.Flush(), true);
            //for (int i = 0; i < mListObj.Count; i++);
            //{
            //    EudemonObject obj = mListObj[i];
            //    GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(obj.GetEudemonInfo().itemid);
            //    if (item == null) continue;
            //    target.GetItemSystem().SendItemInfo(item, NetMsg.MsgItemInfo.TAG_LOOKROLEEUDEMONINFO);
            //    target.GetEudemonSystem().SendEudemonInfo(obj.GetEudemonInfo(),false,true);
            //}
        }
Пример #14
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());
        }
Пример #15
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);
 }
Пример #16
0
        public void ProcessNetMsg(ushort tag, byte[] netdata)
        {
            PlayerObject play = this;
            // Log.Instance().WriteLog("协议号:" + tag.ToString());
            // Log.Instance().WriteLog("data:"+GamePacketKeyEx.byteToText(netdata));
            switch (tag)
            {
                case PacketProtoco.C_MOVE:
                    {

                        //被锁定之后无法进行操作
                        NetMsg.MsgMoveInfo moveinfo = new NetMsg.MsgMoveInfo();
                        moveinfo.Create(netdata, session.GetGamePackKeyEx());
                        byte[] movebuf = null;
                        //角色移动
                        if (moveinfo.id == this.GetTypeId())
                        {
                            if (this.IsLock()) return;
                            //摆摊状态
                            if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null) return;
                            if (this.Move(moveinfo))
                            {
                                moveinfo.id = this.GetTypeId();
                                moveinfo.x = this.GetCurrentX();
                                moveinfo.y = this.GetCurrentY();
                                moveinfo.dir = this.GetDir();
                                movebuf = moveinfo.GetBuffer();
                                //发给自己
                                this.SendData(movebuf);

                            }
                            break;
                        }
                        //幻兽移动
                        play.GetEudemonSystem().Move(moveinfo);

                        //正在跳舞中- 就设置停止跳舞标记
                        if (this.IsDancing())
                        {
                            this.SetDancing(0);
                        }
                        // this.GetGameMap().BroadcastMove(play, movebuf);
                        break;
                    }
                case PacketProtoco.C_OPENNPC: //单击npc
                    {
                        PackIn inpack = new PackIn(netdata);
                        inpack.ReadUInt16();
                        uint npcid = inpack.ReadUInt32();
                        ScripteManager.Instance().ExecuteActionForNpc(npcid, this);
                        break;
                    }
                case PacketProtoco.C_NPCREPLY: //点击npc选项
                    {

                        PackIn inpack = new PackIn(netdata);
                        inpack.ReadUInt16();
                        inpack.ReadUInt32();
                        inpack.ReadUInt16();
                        byte selectindex = inpack.ReadByte();
                        inpack.ReadInt16();
                        String szStr = inpack.ReadString();
                        if (selectindex == 255) //退出该npc对话脚本
                        {
                            this.SetTaskID(0);
                            break;
                        }
                        if ((selectindex > 0))
                        {
                            ScripteManager.Instance().ExecuteOptionId(selectindex, this, szStr);

                        }
                        else if (this.GetTaskID() != 0) //回调-
                        {
                            ScripteManager.Instance().ExecuteOptionId(play.GetTaskID(), this, szStr);
                            this.SetTaskID(0);
                        }
                        break;
                    }
                case PacketProtoco.C_ATTACK:        //攻击
                    {
                        //检测是否是安全区- 防作弊
                        if (this.GetGameMap().IsSafeArea(this.GetCurrentX(), this.GetCurrentY()))
                        {
                            this.LeftNotice("该区域内禁止PK!");
                            break;
                        }
                        NetMsg.MsgAttackInfo info = new NetMsg.MsgAttackInfo();
                        info.Create(netdata, this.GetGamePackKeyEx());
                        if (info.tag == 21)//魔法攻击 要解密
                        {
                            uint nData = ((info.usPosX) ^ (info.roleId) ^ 0x2ED6);
                            info.usPosX = (ushort)(0xFFFF & (BaseFunc.ExchangeShortBits(nData, 16 - 1) + 0xDD12));
                            nData = ((info.usPosY) ^ (info.roleId) ^ 0xB99B);
                            info.usPosY = (ushort)(0xFFFF & (BaseFunc.ExchangeShortBits(nData, 16 - 5) + 0x76DE));
                            info.idTarget = (BaseFunc.ExchangeLongBits((info.idTarget), 13) ^ (info.roleId) ^ 0x5F2D2463) + 0x8B90B51A;
                            info.usType = 0xFFFF & (BaseFunc.ExchangeShortBits(((info.usType) ^ (info.roleId) ^ 0x915D), 16 - 3) + 0x14BE);
                        }

                        if (info.roleId == this.GetTypeId()) //角色攻击
                        {
                            //被锁定之后无法进行操作
                            this.GetFightSystem().SetFighting();
                            //摆摊状态
                            if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null) return;
                            if (this.IsLock() || this.IsDie()) return;
                            //潜行状态就移除
                            if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_STEALTH) != null)
                            {
                                this.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_STEALTH);
                            }
                            switch (info.tag)
                            {
                                case 2:     //普通攻击
                                    {
                                        // this.Attack(info);
                                        GetFightSystem().Attack(info);
                                        break;
                                    }
                                case 21:     //魔法攻击
                                    {

                                        //this.MagicAttack(info);
                                        GetFightSystem().MagicAttack(info);
                                        break;
                                    }
                            }
                            //正在跳舞中- 就设置停止跳舞标记
                            if (this.IsDancing())
                            {
                                this.SetDancing(0);
                            }
                            break;
                        }
                        //幻兽攻击
                        this.GetEudemonSystem().Eudemon_Attack(info);
                        break;
                    }
                case PacketProtoco.C_MSGIEM:    //道具操作信息
                    {
                        //被锁定后是无法使用道具的
                        if (this.IsLock()) break;
                        NetMsg.MsgOperateItem info = new NetMsg.MsgOperateItem();
                        info.Create(netdata);
                        switch (info.usAction)
                        {
                            //case NetMsg.MsgOperateItem.ITEMACT_EQUIP:   //穿戴装备
                            //    {
                            //        this.GetItemSystem().Equip(info.id, info.dwData);
                            //        break;
                            //    }
                            case NetMsg.MsgOperateItem.ITEMACT_BUY: //购买道具
                                {
                                    //魔石商店 1207为魔石商店的id
                                    switch (info.id)
                                    {
                                        case GameBase.Config.Define.GMAESHOPID: //魔石商店
                                            {
                                                this.GetItemSystem().BuyGameShopItem(info.dwData, info.amount);
                                                break;
                                            }
                                        case GameBase.Config.Define.LOOKFACEID: //头像商店
                                            {
                                                this.GetItemSystem().ChangeLookFace(info.dwData);
                                                break;
                                            }
                                        case GameBase.Config.Define.HAIRID:     //发型商店
                                            {
                                                this.GetItemSystem().ChangeHair(info.dwData);
                                                break;
                                            }

                                        default:
                                            {
                                                //普通的npc商店
                                                this.GetItemSystem().BuyItem(info.id, info.dwData);
                                                break;
                                            }
                                    }

                                    break;
                                }
                            case NetMsg.MsgOperateItem.ITEMACT_SELL: //卖出道具
                                {
                                    this.GetItemSystem().SellItem(info.id, info.dwData);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.ITEMACT_UNEQUIP: //卸下装备
                                {
                                    this.GetItemSystem().UnEquip(info.id, info.dwData);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.ITEMACT_USE: //使用道具
                                {
                                    //
                                    this.GetItemSystem().UseItem(info.id, info.dwData, (short)info.amount, (short)info.param1);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.ITEMACT_REPAIREQUIP:
                                {
                                    this.GetItemSystem().RepairEquip(info.param1, info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.ITEMACT_DROP:    //丢弃道具,从道具栏
                                {
                                    this.GetItemSystem().DropItemBag(info.id);
                                    break;
                                }

                            case NetMsg.MsgOperateItem.ITEMACT_OPENGEM: //装备打洞
                                {
                                    //Log.Instance().WriteLog("装备打洞:" + play.GetName() + " " + GamePacketKeyEx.byteToText(netdata));
                                    EquipOperation.Instance().OpenGem(this, info.id, (uint)BaseFunc.MakeLong(info.amount,info.param1));
                                    break;
                                }
                            case NetMsg.MsgOperateItem.STRONGACT_SAVEMONEY: //仓库存钱
                                {
                                    this.GetItemSystem().SaveStrongMoney((int)info.dwData);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.STRONGACT_GIVEMONEY: //仓库取钱
                                {
                                    this.GetItemSystem().GiveStrongMoney((int)info.dwData);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.EUDEMONACT_RECALL: //幻兽召回
                                {
                                    this.GetEudemonSystem().Eudemon_ReCall(info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.EUDEMONACT_FIT://幻兽合体
                                {
                                    this.GetEudemonSystem().Eudemon_Fit(info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.EUDEMONACT_BREAK_UP: //幻兽解体
                                {
                                    this.GetEudemonSystem().Eudemon_BreakUp(info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.EUDEMON_EVOLUTION:  //幻兽进化
                                {
                                    this.GetEudemonSystem().Eudemon_Evolution(info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.EUDEMON_DELETE_MAGIC: //删除幻兽技能
                                {
                                    this.GetEudemonSystem().Eudemon_DeleteMagic(info.id, (ushort)info.amount);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.TAKEMOUNT: //骑乘
                                {
                                    //如果幻兽出征了,先召回
                                    EudemonObject obj = this.GetEudemonSystem().GetEudmeonObject(info.id);
                                    if (obj == null) break;
                                    GameStruct.RoleItemInfo item = this.GetItemSystem().FindItem(obj.GetEudemonInfo().itemid);
                                    if (item == null) break;
                                    this.TakeMount(obj.GetTypeId(), item.itemid);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.TAKEOFFMOUNT: //下马
                                {
                                    this.TakeOffMount(info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.GET_EXPBALL_EXP: //获取经验球的等级
                                {
                                    int id = BaseFunc.MakeLong(info.amount, info.param1);
                                    if (id == this.GetTypeId())
                                    {
                                        this.LeftNotice("经验球不允许给人物使用");
                                        break;
                                    }
                                  //  收到网络协议:长度:28协议号:1009
                                    //{28,0,241,3,122,243,157,131,32,147,105,18,50,0,0,0,122,243,157,131,0,0,0,0,0,0,0,0}
                                    break;
                                }
                            case NetMsg.MsgOperateItem.USE_EXPBALL_EXP: //使用经验球
                                {
                                    int id = BaseFunc.MakeLong(info.amount, info.param1);
                                    if (id == this.GetTypeId())
                                    {
                                        this.LeftNotice("经验球不允许给人物使用");
                                        break;
                                    }
                                    //给幻兽使用
                                    RoleData_Eudemon eudemon_info = this.GetEudemonSystem().FindEudemon((uint)id);
                                    EudemonObject _obj = this.GetEudemonSystem().GetEudmeonObject((uint)id);
                                    if (_obj == null || eudemon_info == null) break;
                                    eudemon_info.level = 0;
                                  //  _obj.GetAttr().level = 0;
                                    _obj.ChangeAttribute(EudemonAttribute.Level, this.GetBaseAttr().level + GameBase.Config.Define.EXPBALL_EUDEMON_MAXLEVEL, false);
                                    //删除经验球
                                    this.GetItemSystem().DeleteItemByID(info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GOLD: //摊位以金币方式出售道具
                                {
                                    PtichManager.Instance().SellItem(this, info.id, (byte)NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GOLD, (int)info.dwData);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GAMEGOLD: //摊位以魔石方式出售道具
                                {
                                    PtichManager.Instance().SellItem(this, info.id, (byte)NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GAMEGOLD, (int)info.dwData);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.PTICH_GETBACK_SELLITEM: //摊位取回道具
                                {
                                    PtichManager.Instance().GetBackItem(this, info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.PTICH_BUY_ITEM: //购买摊位道具
                                {
                                    PtichManager.Instance().BuyItem(this, info.dwData, info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.GET_REMOTE_PTICH://获取远程摊位
                                {
                                    PtichManager.Instance().GetRemotePtich(this);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.BUY_REMOTE_PTICH_ITEM:   //购买远程摊位道具
                                {

                                    PtichManager.Instance().BuyRemotePtichItem(this,info.id);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.GET_REMOTE_PTICH_ID: //获取远程摊位- 从指定摊位号
                                {
                                    PtichManager.Instance().GetRemotePtich(this,(int) (info.dwData - 1)/*客户端传上来的是以1为下标*/);
                                    break;
                                }
                            case NetMsg.MsgOperateItem.EUDEMON_FOOD: //幻兽喂食圣兽魔晶
                                {
                                    if (this.GetMoneyCount(MONEYTYPE.GAMEGOLD) < 19) return;
                                    uint eudemon_id = (uint)BaseFunc.MakeLong(info.amount, info.param1);
                                    EudemonObject eudemon = this.GetEudemonSystem().GetBattleEudemon(eudemon_id);

                                    if (eudemon == null ) break;
                                    //幻兽等级不能超过角色九级以上
                                    if (eudemon.GetAttr().level + 50 > this.GetBaseAttr().level + 8)
                                    {
                                        eudemon.ChangeAttribute(EudemonAttribute.Level, this.GetBaseAttr().level + 8 - eudemon.GetAttr().level);
                                    }
                                    //最高255级
                                    else if (eudemon.GetAttr().level + 50 > 255)
                                    {
                                        eudemon.ChangeAttribute(EudemonAttribute.Level, 255 - eudemon.GetAttr().level);

                                    }
                                    else eudemon.ChangeAttribute(EudemonAttribute.Level, 50);
                                    eudemon.CalcAttribute();
                                    this.ChangeMoney(MONEYTYPE.GAMEGOLD, -19);
                                    break;
                                }
                            default: {
                                //Log.Instance().WriteLog("未知操作封包:" + play.GetName() + " " + GamePacketKeyEx.byteToText(netdata));
                                break;
                            }
                        }

                        break;
                    }
                case PacketProtoco.C_MSGTALK:
                    {
                        NetMsg.MsgTalkInfo talkinfo = new NetMsg.MsgTalkInfo();
                        talkinfo.Create(netdata);
                        String talk = talkinfo.GetTalkText();
                        if (talk.Length > 0)
                        {
                            if (talk[0] == '\\' && this.IsGM())
                            {
                                //GM命令--
                                GMCommand.ExecuteGMCommand(talk, this);
                            }
                            if (talk[0] == '\\') //普通命令--
                            {
                                GMCommand.ExecuteNormalCommand(talk, this);
                            }
                        }

                        PacketOut outpack;
                        switch (talkinfo.unTxtAttribute)
                        {
                            case NetMsg.MsgTalkInfo._TXTATR_TALK: //公聊
                                {
                                    outpack = new PacketOut();
                                    outpack.WriteUInt16((ushort)(netdata.Length + 2));
                                    outpack.WriteBuff(netdata);
                                    this.BroadcastBuffer(outpack.Flush(), false);
                                    break;
                                }
                            case NetMsg.MsgTalkInfo._TXTATR_PRIVATE: //私聊
                                {
                                    String targetname = talkinfo.GetTalkTargetText();
                                    PlayerObject targetobj = UserEngine.Instance().FindPlayerObjectToName(targetname);
                                    if (targetobj != null)
                                    {
                                        outpack = new PacketOut(targetobj.GetGamePackKeyEx());
                                        outpack.WriteUInt16((ushort)(netdata.Length + 2));
                                        outpack.WriteBuff(netdata);
                                        targetobj.SendData(outpack.Flush());
                                    }
                                    break;
                                }
                            case NetMsg.MsgTalkInfo._TXTATR_REJECT: //驳回
                                {
                                    String targetname = talkinfo.GetTalkTargetText();
                                    PlayerObject targetobj = UserEngine.Instance().FindPlayerObjectToName(targetname);
                                    if (targetobj != null)
                                    {
                                        switch (talkinfo.GetTalkText())
                                        {
                                            case "a": //好友请求驳回
                                                {
                                                    break;
                                                }
                                            case "b": //交易请求驳回
                                                {
                                                    this.GetTradSystem().SetTradTarget(0);
                                                    targetobj.GetTradSystem().SetTradTarget(0);
                                                    targetobj.LeftNotice("对方拒绝你的交易请求");
                                                    break;
                                                }
                                            case "c": //队伍请求
                                                {
                                                    break;
                                                }
                                        }
                                    }
                                    break;
                                }
                        }

                        break;
                    }
                case PacketProtoco.C_PICKDROPITEM: //拾取道具
                    {
                        NetMsg.MsgDropItem item = new NetMsg.MsgDropItem();
                        item.Create(netdata, null);
                        BaseObject obj = GetGameMap().GetObject(item.id);
                        if (obj == null) break;
                        if (this.IsDie() || this.IsLock()) break;//死亡或者被锁定
                        if (this.GetCurrentX() != obj.GetCurrentX() || this.GetCurrentY() != obj.GetCurrentY())
                        {
                            //连击技能或者xp技能没校验过坐标。。 就校验一下坐标 2015.11.21
                            //该道具暂时不可拾取-
                            this.ScroolRandom(this.GetCurrentX(), this.GetCurrentY());

                        }
                        if ((obj as DropItemObject).IsOwner() && (obj as DropItemObject).GetOwnerId() != this.GetTypeId())
                        {
                            this.LeftNotice("该道具暂时无法拾取!");
                            return;
                        }

                        //在地图
                        GameStruct.RoleItemInfo roleitem = (obj as DropItemObject).GetRoleItemInfo();
                        (obj as DropItemObject).BroadcastInfo(2);
                        this.GetGameMap().RemoveObj(obj);
                        //捡起来放到背包
                        if (roleitem == null) //怪物爆的
                        {
                            this.GetItemSystem().AwardItem(obj.GetTypeId(), NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK);
                        }
                        else
                        {
                            //玩家丢的
                            //如果是幻兽蛋,就得有幻兽数据
                            if (roleitem.postion == NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK)
                            {
                                this.GetEudemonSystem().AddTempEudemon((obj as DropItemObject).GetRoleEudemonInfo());
                            }
                            this.GetItemSystem().AwardItem(roleitem);

                        }

                        break;
                    }
                case PacketProtoco.C_CHANGEPKMODE: //更改pk模式
                    {
                        bool isrecall = false;
                        NetMsg.MsgChangePkMode action = new NetMsg.MsgChangePkMode();
                        action.Create(netdata, GetGamePackKeyEx());
                        switch (action.tag)
                        {
                            case NetMsg.MsgAction.TYPE_CHANGEPKMODE:
                                {
                                    if (action.value >= 0 && action.value <= 5)
                                    {
                                        this.SetPkMode((byte)action.value);
                                        isrecall = true;

                                    }
                                    break;
                                }
                            //xp技能单击
                            case NetMsg.MsgAction.TYPE_XPFULL:
                                {
                                    GetTimerSystem().XPFull((short)action.value);
                                    //测试--
                                    //PacketOut outpack = new PacketOut(this.GetGamePackKeyEx());
                                    //outpack.WriteUInt16(28);
                                    //outpack.WriteUInt16(1017);
                                    //outpack.WriteUInt32(this.GetTypeId());
                                    //outpack.WriteUInt32(2);
                                    //outpack.WriteInt32(36);
                                    //outpack.WriteInt32(64);
                                    //outpack.WriteInt32(71);
                                    //outpack.WriteInt32(2048);
                                    //byte[] data = outpack.Flush();
                                    //this.SendData(data);

                                    break;
                                }
                            //幻兽出征
                            case NetMsg.MsgAction.TYPE_EUDEMON_BATTLE:
                                {
                                    //value = id;
                                    this.GetEudemonSystem().Eudemon_Battle((uint)action.value);
                                    break;
                                }
                            //表情动作
                            case NetMsg.MsgAction.TYPE_FACEACTION:
                                {
                                    if (this.IsLock()) break;

                                    uint nAction = BitConverter.ToUInt32(netdata, 18);
                                    this.SetCurrentAction(nAction);
                                    action.SetKey(null);
                                    this.BroadcastBuffer(action.GetBuffer());
                                    //迷心术
                                    if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_MIXINSHU) != null)
                                    {
                                        foreach (RefreshObject refobj in this.GetVisibleList().Values)
                                        {
                                            BaseObject obj = refobj.obj;
                                            if (obj.type == OBJECTTYPE.PLAYER)
                                            {
                                                (obj as PlayerObject).PlayAction(nAction);
                                            }
                                        }
                                    }
                                    break;
                                }
                            //获取角色详细信息
                            case NetMsg.MsgAction.TYPE_FRIENDINFO:
                                {
                                    this.GetFriendSystem().GetFriendInfo(action.value);

                                    break;
                                }
                            //复活角色
                            case NetMsg.MsgAction.TYPE_ALIVE:
                                {
                                    //要是鬼魂状态 并且死亡超过等于二十秒
                                    if (IsGhost() && System.Environment.TickCount - mnGhostTick >= GameBase.Config.Define.ALIVE_TIME)
                                    {

                                        Alive();

                                    }

                                    break;
                                }
                            case NetMsg.MsgAction.TYPE_FLY_DOWN:    //雷霆万钧 下降
                                {
                                    play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_FLY);
                                    play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_XPFULL_ATTACK);
                                    if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_HEILONGWU) != null)
                                    {
                                        play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_HEILONGWU);
                                    }
                                    break;

                                }
                            case NetMsg.MsgAction.TYPE_EUDEMON_RANK: //查看幻兽排行榜
                                {
                                    //data1 从总星排行开始 超出100名为0
                                    byte[] data1 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
                                    //{36,0,102,4,114,189,89,134,39,31,97,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,85,0,0,0,0}
                                    PacketOut outpack = new PacketOut();
                                    outpack.WriteInt16(36);
                                    outpack.WriteInt16(1126);
                                    outpack.WriteUInt32((uint)action.value);
                                    outpack.WriteUInt32(this.GetTypeId());
                                    outpack.WriteInt16(0);
                                    outpack.WriteBuff(data1);
                                    this.SendData(outpack.Flush(), true);
                                    break;
                                }
                            case NetMsg.MsgAction.TYPE_EUDEMON_SOULINFO: //主幻兽增加分数信息
                                {

                                    EudemonObject obj = this.GetEudemonSystem().GetEudmeonObject((uint)action.time);
                                    if (obj == null) break;
                                    this.GetEudemonSystem().SetSoulEudemon((uint)action.time);
                                    GameStruct.EudemonSoulInfo soulinfo = ConfigManager.Instance().GetEudemonSoulInfo((int)(obj.GetEudemonInfo().quality / 100));
                                    if (soulinfo == null)
                                    {
                                        this.MsgBox("获取幻化信息错误!!");
                                        Log.Instance().WriteLog("获取幻化信息错误:名称:" + play.GetName() + " 品质:" + obj.GetEudemonInfo().quality.ToString()
                                            + "道具id:" + obj.GetEudemonInfo().itemid.ToString());
                                        break;
                                    }
                                    //125为等级需求
                                  //  byte[] data1 = { 32, 0, 244, 7, 73, 0, 6, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0/*, 9, 0, 0, 0, 1, 0, 0, 0*/ };
                                    PacketOut outpack = new PacketOut();
                                    outpack.WriteInt16(32);
                                    outpack.WriteInt16(2036);
                                    outpack.WriteInt16(73);
                                    outpack.WriteInt16(6);
                                    outpack.WriteInt32(soulinfo.level);
                                    outpack.WriteInt32(soulinfo.fu_star);
                                    outpack.WriteInt32(0);//亲密度
                                    outpack.WriteInt32(0);
                                    outpack.WriteInt32(0);
                                  //  outpack.WriteBuff(data1);
                                    //这个问成长率总分
                                    outpack.WriteInt32(obj.GetEudemonInfo().quality);
                                   // outpack.WriteInt32(9);
                                    outpack.WriteInt32(1);
                                    play.SendData(outpack.Flush(), true);
                                    break;
                                }
                            case NetMsg.MsgAction.TYPE_EUDEMON_SOUL: //幻兽幻化
                                {
                                    this.GetEudemonSystem().Eudemon_Soul((uint)action.value);
                                    break;
                                }
                            case NetMsg.MsgAction.TYPE_LOOKROLEINFO: //查看装备
                                {
                                    PlayerObject obj = UserEngine.Instance().FindPlayerObjectToTypeID((uint)action.value);
                                    if (obj == null) break;

                                    obj.GetItemSystem().SendLookRoleInfo(this);
                                    break;
                                }
                            case NetMsg.MsgAction.TYPE_LOOKEUDEMONINFO: //查看幻兽
                                {
                                    PlayerObject obj = UserEngine.Instance().FindPlayerObjectToTypeID((uint)action.value);
                                    if (obj == null) break;

                                    obj.GetEudemonSystem().SendLookEudemonInfo(this);
                                    break;
                                }
                            case NetMsg.MsgAction.TYPE_FINDPATH: //单击地图自动寻路
                                {
                                    short x = BaseFunc.LoWord(action.type);
                                    short y = BaseFunc.HiWord(action.type);
                                    if (!this.GetGameMap().CanMove(x, y)) break;

                                    //{28,0,242,3,1,0,0,0,73,48,96,5,195,1,159,1,0,0,0,0,232,3,0,0,166,38,0,0}
                                    PacketOut outpack = new PacketOut();
                                    outpack.WriteInt16(28);
                                    outpack.WriteInt16(1010);
                                    outpack.WriteInt32(1);
                                    outpack.WriteUInt32(this.GetTypeId());
                                    outpack.WriteInt16(x);
                                    outpack.WriteInt16(y);
                                    outpack.WriteInt32(0);
                                    outpack.WriteUInt32(this.GetGameMap().GetMapInfo().id);
                                    outpack.WriteInt32(9894);
                                    this.SendData(outpack.Flush(), true);
                                    break;
                                }
                            case NetMsg.MsgAction.TYPE_CONTINUEGAME:    //继续游戏
                                {

                                    PacketOut outpack = new PacketOut();
                                    outpack.WriteInt16(28);
                                    outpack.WriteInt16(1010);
                                    outpack.WriteInt32(System.Environment.TickCount);
                                    outpack.WriteUInt32(this.GetTypeId());
                                    outpack.WriteInt32(0);
                                    outpack.WriteInt32(0);
                                    outpack.WriteInt32(0);
                                    outpack.WriteInt32(9630);
                                    this.SendData(outpack.Flush(), true);
                                    break;
                                }
                            case NetMsg.MsgAction.TYPE_PTICH: //摆摊有关
                                {
                                    if (this.GetCurrentPtichID() == -1) break;
                                    PtichManager.Instance().AddPlayPtich(this.GetCurrentPtichID(), this);
                                    break;
                                }
                            case  NetMsg.MsgAction.TYPE_SHUT_PTICH: //收摊
                                {

                                    PtichManager.Instance().ShutPtich(this,true);

                                    break;
                                }
                            case 9528:
                                {
                                    //{242,3,180,167,114,0,174,66,15,0,70,1,211,1,0,0,0,0,0,0,0,0,56,37,0,0,}
                                 //   Log.Instance().WriteLog(GamePacketKeyEx.byteToText(netdata));
                                    break;
                                }
                            case 9855: //开启远程浏览
                                {
                                    break;
                                }
                            case NetMsg.MsgAction.TYPE_LOOK_PTICH: //查看摊位
                                {
                                    uint ptich_obj_id = (uint)action.time;
                                    PtichManager.Instance().LookPtich(this, ptich_obj_id);
                                    //Log.Instance().WriteLog(GamePacketKeyEx.byteToText(netdata));
                                    break;
                                }
                        }
                        //是否回发-
                        if (isrecall)
                        {
                            this.SendData(action.GetBuffer());
                        }
                        break; ;
                    }
                //保存热键信息
                case PacketProtoco.C_HOTKEY:
                    {
                        // Log.Instance().WriteLog("data:" + GamePacketKeyEx.byteToText(netdata));
                        NetMsg.MsgHotKey hotkey = new NetMsg.MsgHotKey();
                        hotkey.Create(netdata, GetGamePackKeyEx());
                        switch (hotkey.tag)
                        {
                            case NetMsg.MsgHotKey.TAG_SAVEHOTKEY: //保存热键
                                {
                                    String[] hotkeyarr = hotkey.GetHotKeyArr();
                                    if (hotkeyarr != null)
                                    {
                                        this.ClearHotKey(hotkey.GetGroup());
                                        for (int i = 0; i < hotkeyarr.Length; i++)
                                        {
                                            GameStruct.HotkeyInfo info = new GameStruct.HotkeyInfo(hotkey.GetGroup(), hotkeyarr[i]);
                                            if (info.index == 0 && info.id == 0) continue;
                                            this.AddHotKeyInfo(info);
                                        }
                                    }
                                    break;
                                }
                            case NetMsg.MsgHotKey.TAG_WANGLING_STATE: //切换亡灵形态
                                {
                                    if (this.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING) != null)
                                    {
                                        this.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING);
                                    }
                                    else
                                    {
                                        this.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_HUASHENWANGLING);
                                    }

                                    break;
                                }
                            case NetMsg.MsgHotKey.WORLD_CHAT: //魔法飞鸽
                                {
                                    //this.MsgBox("游戏当前禁止发送飞鸽!");
                                    //break;
                                   // hotkey.str;
                                    int Index = WorldPigeon.Instance().AddText(this.GetName(), this.GetTypeId(), hotkey.str);
                                    if (Index > 1)
                                    {
                                        this.MsgBox("发布飞鸽成功,目前排在:" + Index.ToString() + "位");
                                    }
                                    else if (Index == -1)
                                    {
                                        this.MsgBox("你已经发过一次飞鸽了,请等上一次的飞鸽发完。");
                                    }

                                    break;
                                }
                            case NetMsg.MsgHotKey.CHANGE_EUDEMON_NAME:  //更改幻兽名字
                                {
                                   // hotkey.type 幻兽id
                                  //  hotkey.str
                                    if (hotkey.str.Length > 8) return;
                                    EudemonObject obj = this.GetEudemonSystem().GetEudmeonObject((uint)hotkey.type);
                                    if (obj == null) return;
                                    GameStruct.RoleItemInfo role_item = this.GetItemSystem().FindItem(obj.GetEudemonInfo().itemid);
                                    if (role_item == null) return;
                                    role_item.forgename = hotkey.str;
                                   // {21,0,247,3,114,189,89,134,24,0,1,8,210,187,184,246,201,181,177,198,0}
                                    PacketOut outpack = new PacketOut();
                                    outpack.WriteInt16((short)(11 + Coding.GetDefauleCoding().GetBytes(role_item.forgename).Length + 2));
                                    outpack.WriteInt16(1015);
                                    outpack.WriteUInt32((uint)hotkey.type);
                                    outpack.WriteInt16(24);
                                    outpack.WriteByte(1);
                                    outpack.WriteString(role_item.forgename);
                                    outpack.WriteByte(0);
                                    this.BroadcastBuffer(outpack.Flush(), true);

                                    this.GetItemSystem().UpdateItemInfo(role_item.id);
                                    this.GetEudemonSystem().SendEudemonInfo(obj.GetEudemonInfo());

                                    //出战的时候也要同步改名
                                    if (this.GetEudemonSystem().GetBattleEudemon((uint)hotkey.type) != null)
                                    {
                                        obj.SendEudemonInfo();
                                    }
                                    break;
                                }
                            case 288: //进入/离开名人堂
                                {
                                    this.MsgBox("名人堂下一个版本开放!");
                                    break;
                                }
                        }

                        break;
                    }
                case PacketProtoco.C_EQUIPOPERATION:
                    {
                        NetMsg.MsgEquipOperation equip = new NetMsg.MsgEquipOperation();
                        equip.Create(netdata, null);
                      //  Log.Instance().WriteLog(GamePacketKeyEx.byteToText(netdata));
                        switch (equip.type)
                        {
                            //提升魔魂等级
                            case NetMsg.MsgEquipOperation.EQUIPSTRONG:
                            case NetMsg.MsgEquipOperation.EQUIPSTRONGEX:
                                {
                                    EquipOperation.Instance().EquipStrong(this, equip.itemid, equip.materialid);
                                    break;
                                }
                            //提升幻魔等级
                            case NetMsg.MsgEquipOperation.EQUIPLEVEL:
                                {
                                    EquipOperation.Instance().EquipLevel(this, equip.itemid, equip.materialid);
                                    break;
                                }
                            //提升装备品质
                            case NetMsg.MsgEquipOperation.EQUIPQUALITY:
                                {
                                    EquipOperation.Instance().EquipQuality(this, equip.itemid, equip.materialid);
                                    break;
                                }
                            //宝石镶嵌
                            case NetMsg.MsgEquipOperation.GEMSET:
                                {
                                    byte index = 0;//第几个洞
                                    uint gemid = 0;
                                    if (equip.materialid != 0)
                                    {
                                        gemid = equip.materialid;
                                        index = 0;
                                    }
                                    else if (equip.param != 0)
                                    {
                                        gemid = equip.param;
                                        index = 1;
                                    }
                                    else if (equip.param1 != 0)
                                    {
                                        gemid = equip.param1;
                                        index = 2;
                                    }
                                    if (gemid == 0) return;
                                    EquipOperation.Instance().GemSet(this, gemid, equip.itemid, index);
                                    break;
                                }
                            case NetMsg.MsgEquipOperation.MAMIC_ADD_GOD:
                                {
                                    EquipOperation.Instance().Magic_Add_God(this, equip.itemid, equip.materialid);
                                    break;
                                }
                            //宝石融合
                            case NetMsg.MsgEquipOperation.GEMFUSION:
                                {
                                    EquipOperation.Instance().GemFusion(this, equip.itemid);
                                    break;
                                }
                                //宝石替换
                            case NetMsg.MsgEquipOperation.GEMREPLACE:
                                {
                                    EquipOperation.Instance().GemReplace(this, netdata);
                                    break;
                                }
                            case NetMsg.MsgEquipOperation.EQUIP_GODEXP://提升神佑
                                {
                                    EquipOperation.Instance().Equip_GodExp(this,equip.itemid, equip.materialid);
                                    break;
                                }
                            case NetMsg.MsgEquipOperation.GUANJUE_GOLD:
                                {
                                    GuanJueManager.Instance().Donation(this, MONEYTYPE.GOLD, (int)equip.itemid);
                                    break;
                                }
                            case NetMsg.MsgEquipOperation.GUANJUE_GAMEGOLD:
                                {
                                    GuanJueManager.Instance().Donation(this, MONEYTYPE.GAMEGOLD, (int)equip.itemid);
                                    break;
                                }
                            case NetMsg.MsgEquipOperation.EXIT_GAME:
                                {
                                   byte[] data = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0};
                                    PacketOut outpack = new PacketOut();
                                    outpack.WriteInt16(32);
                                    outpack.WriteInt16(1032);
                                    outpack.WriteInt32(System.Environment.TickCount);
                                    outpack.WriteBuff(data);
                                    this.SendData(outpack.Flush(), true);
                                    break;
                                }

                        }

                        break;
                    }
                case PacketProtoco.C_STRONGPACK:
                    {

                        NetMsg.MsgStrongPack msgstrongpack = new NetMsg.MsgStrongPack();
                        msgstrongpack.Create(netdata);

                        switch (msgstrongpack.param)
                        {
                            case NetMsg.MsgStrongPack.STRONGPACK_TYPE: //仓库操作
                                {
                                    switch (msgstrongpack.type)
                                    {
                                        case NetMsg.MsgStrongPack.STRONGPACK_TYPE_SAVE: //存道具
                                            {
                                                if (this.GetItemSystem().GetStrongItemCount() >= PlayerItem.MAX_STRONGITEM) return; //仓库道具已满,存不了了
                                                this.GetItemSystem().MoveItem(msgstrongpack.itemid, (ushort)NetMsg.MsgItemInfo.ITEMPOSTION_STRONG_PACK);
                                                break;
                                            }
                                        case NetMsg.MsgStrongPack.STRONGPACK_TYPE_GIVE://取道具
                                            {
                                                if (this.GetItemSystem().IsItemFull()) return; //包裹道具已满,存不了了
                                                this.GetItemSystem().MoveItem(msgstrongpack.itemid, (ushort)NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK);
                                                break;
                                            }
                                    }

                                    break;
                                }
                            case NetMsg.MsgStrongPack.CHEST_TYPE:
                                {
                                    switch (msgstrongpack.type)
                                    {
                                        case NetMsg.MsgStrongPack.CHEST_TYPE_GIVE: //取回衣柜时装
                                            {
                                                this.GetItemSystem().Give_FashionChest(msgstrongpack.itemid);
                                                break;
                                            }
                                    }
                                    break;
                                }
                        }
                        break;
                    }
                case PacketProtoco.C_GETFRIENDINFO:
                    {
                        //for (int i = 0; i < 10; i++)
                        //{
                        //    NetMsg.MsgFriendInfo info = new NetMsg.MsgFriendInfo();
                        //    info.Create(null, this.GetGamePackKeyEx());
                        //    info.level = 130;
                        //    info.type = 15;
                        //    info.actorid = this.GetTypeId() + 1;
                        //    info.name = "狂拽酷炫屌炸天"+i.ToString();
                        //    info.Online = 1;
                        //    this.SendData(info.GetBuffer());
                        //}

                        //info = new NetMsg.MsgFriendInfo();
                        //info.Create(null, this.GetGamePackKeyEx());
                        //info.level = 130;
                        //info.type = 15;
                        //info.actorid = this.GetTypeId() + 2;
                        //info.name = "离线人物";
                        //info.Online = 0;
                        //this.SendData(info.GetBuffer());
                        //  this.GetFriendSystem().SendAllFriendInfo();
                        break;
                    }
                case PacketProtoco.C_ADDFRIEND:
                    {
                        NetMsg.MsgFriendInfo info = new NetMsg.MsgFriendInfo();
                        info.Create(netdata);
                        switch (info.type)
                        {
                            case NetMsg.MsgFriendInfo.TYPE_ADDFRIEND:
                                {
                                    this.GetFriendSystem().RequestAddFriend(info);
                                    break;
                                }
                            case NetMsg.MsgFriendInfo.TYPE_AGREED: //接收好友请求
                                {
                                    this.GetFriendSystem().AddFriend(info.playerid, NetMsg.MsgFriendInfo.TYPE_FRIEND);
                                    break;
                                }
                            case NetMsg.MsgFriendInfo.TYPE_REFUSE: //拒绝好友请求
                                {
                                    this.GetFriendSystem().RefuseFriend(info.playerid);
                                    break;
                                }
                            case NetMsg.MsgFriendInfo.TYPE_KILL:  //绝交
                                {
                                    this.GetFriendSystem().DeleteFriend(info.playerid);
                                    break;
                                }
                        }

                        break;
                    }
                case PacketProtoco.C_TRAD:
                    {
                        NetMsg.MsgTradInfo info = new NetMsg.MsgTradInfo();
                        info.Create(netdata, null);

                        switch (info.type)
                        {
                            case NetMsg.MsgTradInfo.REQUEST_TRAD:
                                {
                                    this.GetTradSystem().RequstTrad(info);
                                    break;
                                }
                            case NetMsg.MsgTradInfo.QUIT_TRAD:
                                {
                                    this.GetTradSystem().QuitTrad(info);
                                    break;
                                }
                            case NetMsg.MsgTradInfo.GOLD_TRAD:
                                {
                                    this.GetTradSystem().SetTradGold((int)info.typeid);
                                    break;
                                }
                            case NetMsg.MsgTradInfo.GAMEGOLD_TRAD:
                                {
                                    this.GetTradSystem().SetTradGameGold((int)info.typeid);
                                    break;
                                }
                            case NetMsg.MsgTradInfo.ITEM_TRAD:
                                {
                                    this.GetTradSystem().AddTradItem(info.typeid);
                                    break;
                                }
                            case NetMsg.MsgTradInfo.SURE_TRAD:
                                {
                                    this.GetTradSystem().SureTrad();
                                    break;
                                }
                        }
                        break;
                    }
                case PacketProtoco.C_GUANJUE:
                    {
                        PackIn inguanjue = new PackIn(netdata);
                        inguanjue.ReadUInt16();
                        short type = inguanjue.ReadInt16();
                        byte page = inguanjue.ReadByte();
                        if (type == 2) //请求获得爵位数据
                        {
                            GuanJueManager.Instance().RequestData(this, page);
                        }

                        //                        byte[] data = {162,1,12,8,2,0,0,0,0,0,5,0,0,0,0,0,10,0,226,12,16,0,205,168,204,236,177,166,56,0,0,0,0,0,0,0,0,0,0,0,0,0,128,226,104,182,10,0,0,0,1,0,0,0,0,0,0,0,119,109,

                        //15,0,161,254,192,230,194,228,161,254,0,0,0,0,0,0,0,0,0,0,0,0,80,231,196,204,9,0,0,0,1,0,0,0,1,0,0,0,130,72,16,0,185,243,215,229,193,236,208,228,0,0,0,0,0,0

                        //,0,0,0,0,0,0,0,190,229,228,8,0,0,0,1,0,0,0,2,0,0,0,230,90,15,0,126,194,182,45,194,182,45,193,250,126,0,0,0,0,0,0,0,0,0,0,98,3,137,149,7,0,0,0,3,0,0,0,3,0,0

                        //,0,30,145,15,0,126,204,236,200,244,211,208,199,233,126,0,0,0,0,0,0,0,0,0,0,176,56,161,110,6,0,0,0,3,0,0,0,4,0,0,0,236,69,15,0,193,233,202,166,0,0,0,0,0,0,0

                        //,0,0,0,0,0,0,0,0,0,195,147,65,41,5,0,0,0,3,0,0,0,5,0,0,0,179,169,15,0,213,189,198,199,161,162,208,204,204,236,0,0,0,0,0,0,0,0,0,0,184,62,118,7,4,0,0,0,3,0,

                        //0,0,6,0,0,0,213,95,16,0,40,95,136,181,165,235,164,240,213,108,215,237,0,0,0,0,0,0,0,0,0,59,223,155,3,0,0,0,3,0,0,0,7,0,0,0,206,207,15,0,182,192,185,194,161

                        //,162,176,212,204,236,0,0,0,0,0,0,0,0,0,0,128,149,127,73,3,0,0,0,3,0,0,0,8,0,0,0,40,79,15,0,196,234,199,225,190,205,210,170,192,203,0,0,0,0,0,0,0,0,0,0,115,

                        //166,15,67,3,0,0,0,3,0,0,0,9,0,0,0};
                        //                        this.GetGamePackKeyEx().EncodePacket(ref data, data.Length);
                        //                        this.SendData(data);
                        break;
                    }
                case PacketProtoco.C_DANCING: //跳舞
                    {
                        PackIn inpack = new PackIn(netdata);
                        short _param = inpack.ReadInt16();
                        uint role_id = inpack.ReadUInt32();
                        uint target_id = inpack.ReadUInt32();
                        int param1 = inpack.ReadInt32();
                        short magic_id = inpack.ReadInt16();
                        short magic_lv = inpack.ReadInt16();

                        PacketOut outpack = new PacketOut();
                        switch (param1)
                        {
                            case 1280: //请求跳舞
                                {
                                    BaseObject targetobj = play.GetGameMap().FindObjectForID(target_id);
                                    if (targetobj == null)
                                    {
                                        return;
                                    }
                                    //距离太远
                                    if (Math.Abs(this.GetCurrentX() - targetobj.GetCurrentX()) > 2 ||
                                        Math.Abs(this.GetCurrentY() - targetobj.GetCurrentY()) > 2)
                                    {
                                        this.LeftNotice("离对方太远了,再走近点吧。");
                                        return;
                                    }
                                    //     收到网络协议:长度:28协议号:1049
                                    byte[] data1 = { 2, 5, 0, 0, 232, 0, 0, 0, 131, 0, 0, 0, 255, 255, 255, 255 };
                                    outpack.WriteUInt16(28);
                                    outpack.WriteUInt16(1049);
                                    outpack.WriteUInt32(this.GetTypeId());
                                    outpack.WriteUInt32(target_id);
                                    outpack.WriteBuff(data1);
                                    play.BroadcastBuffer(outpack.Flush(), true);

                                    outpack = new PacketOut();

                                    byte[] data2 = { 3, 5, 0, 0, 25, 2, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255 };
                                    outpack.WriteUInt16(28);
                                    outpack.WriteUInt16(1049);
                                    outpack.WriteUInt32(this.GetTypeId());
                                    outpack.WriteUInt32(target_id);
                                    outpack.WriteBuff(data2);
                                    play.BroadcastBuffer(outpack.Flush(), true);
                                    mnDancingId = magic_id;
                                    mnDancingTick = System.Environment.TickCount;
                                    break;
                                }
                            case 1285: //停止跳舞
                                {
                                    if (mnDancingId > 0 && System.Environment.TickCount - mnDancingTick > 2000)
                                    {
                                        byte[] data1 = { 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                                        outpack = new PacketOut();
                                        outpack.WriteUInt16(28);
                                        outpack.WriteUInt16(1049);
                                        outpack.WriteUInt32(this.GetTypeId());
                                        outpack.WriteUInt32(target_id);
                                        outpack.WriteBuff(data1);
                                        play.BroadcastBuffer(outpack.Flush(), true);
                                        mnDancingId = 0;
                                    }

                                    break;
                                }
                        }

                        //Log.Instance().WriteLog(GameBase.Network.GamePacketKeyEx.byteToText(netdata));
                        break;
                    }
                default:
                    {
                        Debug.WriteLine("未知封包,协议号:" + tag.ToString());
                        break;
                    }
            }
        }