WriteInt16() 공개 메소드

public WriteInt16 ( short v ) : void
v short
리턴 void
예제 #1
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();
        }
예제 #2
0
        //摊位出售道具
        public void SellItem(PlayerObject play, uint item_id, byte type, int price)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null) return;
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());
            GameStruct.RoleItemInfo item = null;
            if (ptich_obj_id == 0) return;
            if (item_id >= IDManager.eudemon_start_id)
            {

                RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(item_id);
                if (eudemon == null) return;
                item = play.GetItemSystem().FindItem(eudemon.itemid);
                if (item == null) return;
            }
            else
            {
                item = play.GetItemSystem().FindItem(item_id);
                if (item == null) return;
            }

            if (ptich_obj_id == 0) return;
            //判断是否已经在出售摊位列表中- 反作弊
            int nPtichId = play.GetCurrentPtichID();
            for (int i = 0; i < mListPtichInfo[nPtichId].mSellItemList.Count; i++)
            {
                if (mListPtichInfo[nPtichId].mSellItemList[i].item_id == item_id)
                {
                    return;
                }
            }
            //摆摊出售道具已满
            if (mListPtichInfo[nPtichId].mSellItemList.Count >= GameBase.Config.Define.PTICH_SELL_MAX_COUNT)
            {
                return;
            }
            PacketOut outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteInt32(price);
            outpack.WriteInt32(type);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            play.SendData(outpack.Flush(), true);
            //移到摊位状态
            item.postion = NetMsg.MsgItemInfo.ITEMPOSTION_PTICH_PACK;

            PtichSellItemInfo info = new PtichSellItemInfo();
            info.item_id = item_id;
            info.price = price;
            info.sell_type = type;
            mListPtichInfo[nPtichId].mSellItemList.Add(info);
            // {28,0,241,3,8,127,205,7,111,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
        }
예제 #3
0
        //角色摆摊
        //nPtichId 摊位ID
        //play   摆摊对象
        public bool AddPlayPtich(int nPtichId, PlayerObject play)
        {
            if (nPtichId < 0 || nPtichId >= GameBase.Config.Define.PTICH_MAX_COUNT) return false;
            if (PtichHasPlay(nPtichId)) return false;

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

            mListPtichInfo[nPtichId].play = play;

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

            PacketOut outpack = new PacketOut();

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

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

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

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

            return true;
        }
예제 #4
0
        public void BuyItem(PlayerObject play, uint ptich_obj_id, uint item_id)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null)
            {
                play.MsgBox("摆摊中不允许购买!");
                return;
            }
            int ptich_id = -1;
            for (int i = 0; i < mListPtichInfo.Count; i++)
            {
                if (mListPtichInfo[i].PtichObj == null) continue;
                if (mListPtichInfo[i].PtichObj.GetTypeId() == ptich_obj_id)
                {
                    ptich_id = i;
                    break;
                }
            }
            if (ptich_id == -1) return;

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

            RoleItemInfo item = null;
             RoleData_Eudemon eudemon  = null;
             bool bFind = false;
            for (int i = 0; i < mListPtichInfo[ptich_id].mSellItemList.Count; i++)
            {

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

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

            if (item_id >= IDManager.eudemon_start_id)
            {
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK;
                play.GetEudemonSystem().AddTempEudemon(eudemon);//加到临时表

            }
            else
            {
                //添加道具
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;

            }
            play.GetItemSystem().AwardItem(item);
            //删除卖方道具
            //刷新摊位道具栏 卖方
            GetBackItem(mListPtichInfo[ptich_id].play, item_id);
            mListPtichInfo[ptich_id].play.GetItemSystem().DeleteItemByID(item_id);

            //买方
            //{28,0,241,3,140,87,212,7,70,160,1,0,23,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
            PacketOut outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteUInt32(ptich_obj_id);
            outpack.WriteInt32(23); //购买完的标识
            outpack.WriteInt16(0);
            outpack.WriteInt32(1);
            outpack.WriteInt32(0);
            outpack.WriteInt16(0);
            play.SendData(outpack.Flush(), true);
               // this.LookPtich(play, ptich_obj_id);
              //  this.LookPtich(mListPtichInfo[ptich_id].play, ptich_obj_id);
        }
예제 #5
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);

                    }
                }
            }
        }
예제 #6
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     mMsgLen += (ushort)(list_item.Count * 40);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteInt16(param);
     outpack.WriteInt32(page);
     outpack.WriteInt32(param1);
     outpack.WriteInt16(param2);
     outpack.WriteInt16((short)list_item.Count);
     outpack.WriteInt32(param3);
     for (int i = 0; i < list_item.Count; i++)
     {
         byte[] namebyte = Coding.GetDefauleCoding().GetBytes(list_item[i].name);
         byte[] namebyteex = null;
         //防止溢出- 2016.1.23
         if (namebyte.Length > 15)
         {
             namebyteex = new byte[15];
             Buffer.BlockCopy(namebyte, 0, namebyteex, 0, 15);
         }
         else
         {
             namebyteex = new byte[namebyte.Length];
             Buffer.BlockCopy(namebyte, 0, namebyteex, 0, namebyte.Length);
         }
         outpack.WriteBuff(namebyteex);
         byte[] byte_ = new byte[16 - namebyteex.Length];
         outpack.WriteBuff(byte_);
         outpack.WriteInt32(0);
         outpack.WriteULong(list_item[i].guanjue);
         outpack.WriteInt32(1);
         outpack.WriteInt32(list_item[i].pos);
         outpack.WriteInt32(0);
       
     }
     return outpack.Flush();
 }
예제 #7
0
 public override byte[] GetBuffer()
 {
     PacketOut packout = new PacketOut(mKey);
     packout.WriteUInt16(mMsgLen);
     packout.WriteUInt16(mParam);
     packout.WriteInt32(time);
     packout.WriteUInt32(id);
     packout.WriteInt16(x);
     packout.WriteInt16(y);
     packout.WriteByte(dir);
     packout.WriteByte(ucMode);
     packout.WriteUInt16(param);
     packout.WriteInt32(param2);
     return packout.Flush();
 }
예제 #8
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteInt32(time);
     outpack.WriteUInt32(id);
     outpack.WriteInt16(x);
     outpack.WriteInt16(y);
     outpack.WriteInt32(param);
     outpack.WriteInt32(param1);
     outpack.WriteInt32(tag);
     return outpack.Flush();
 }
예제 #9
0
 public override byte[] GetBuffer()
 {
     combo.WriteByte(0);
     byte[] combodata = combo.GetBuffer();
    // Log.Instance().WriteLog(Coding.GetDefauleCoding().GetString(combodata));
    
     mMsgLen += (ushort)combodata.Length;
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(count);
     outpack.WriteInt16(type);
     outpack.WriteByte((byte)count);
    
     outpack.WriteBuff(combodata);
     byte[] ret = outpack.Flush();
    // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(ret));
     return ret;
 }
예제 #10
0
  //       长度,包识,地图ID,角色ID,短整数 x,短整数 y,2,地图ID,9535
  //   长度,包识,TIME,角色ID,短整数 x,短整数 y,0,-1,9567
 public byte[] GetMap1Info()
  {
      PacketOut outpack = new PacketOut(mKey);
      mMsgLen = 28;
      mParam = 1010;
      outpack.WriteUInt16(mMsgLen);
      outpack.WriteUInt16(mParam);
      outpack.WriteUInt32(mapid);
      outpack.WriteUInt32(roleid);
      outpack.WriteInt16(x);
      outpack.WriteInt16(y);
      outpack.WriteInt32(dir);
      outpack.WriteUInt32(mapid);
      outpack.WriteInt32(9535);
      return outpack.Flush() ; 
  }
예제 #11
0
  public byte[] GetMap2Info()
 {
     PacketOut outpack = new PacketOut(mKey);
     mMsgLen = 24;
     mParam = 1010;
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(0);
     outpack.WriteUInt32(roleid);
     outpack.WriteInt16(x);
     outpack.WriteInt16(y);
     outpack.WriteInt32(dir);
     outpack.WriteInt32(-1);
     outpack.WriteInt32(9567);
     return null; 
 }
예제 #12
0
 public override byte[] GetBuffer()
 {
   
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(id);
     outpack.WriteUInt32(targetid);
     //outpack.WriteInt16(x);
     //outpack.WriteInt16(y);
     outpack.WriteUInt16(magicid);
     outpack.WriteUInt16(level);
     outpack.WriteByte(dir);
     outpack.WriteByte(type);
     outpack.WriteInt16(param);
     for (int i = 0; i < param1.Length; i++) { outpack.WriteInt32(param1[i]); }
     outpack.WriteUInt32(targetid);
     outpack.WriteUInt32(value);
     for (int i = 0; i < param2.Length; i++) { outpack.WriteInt32(param2[i]); }
     return outpack.Flush();
 }
예제 #13
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(roleid);
     outpack.WriteInt16(x);
     outpack.WriteInt16(y);
     outpack.WriteUInt16(magicid);
     outpack.WriteUInt16(magiclv);
     outpack.WriteByte(dir);
     outpack.WriteByte(param);
     for (int i = 0; i < param1.Length; i++)
     {
         outpack.WriteInt32(param1[i]);
     }
         return outpack.Flush();
 }
예제 #14
0
        public override byte[] GetBuffer()
        {
            byte[] bBuff = new byte[18];
            PacketOut outpack = new PacketOut(mKey);
            mMsgLen += (ushort)(List_Obj.Count * (28 + 1)+bBuff.Length);
            if (bSigle)
            {
                mMsgLen += 13;
            }
            outpack.WriteUInt16(mMsgLen);
            outpack.WriteUInt16(mParam);
            outpack.WriteUInt32(nID);
            //单体魔法攻击是对方的id,这样才会有轨迹特效
            if (bSigle)
            {
                outpack.WriteUInt32(nTargetID);
            }
            else
            {
                outpack.WriteInt16(nX);
                outpack.WriteInt16(nY);
            }
            outpack.WriteUInt16(nMagicID);
            outpack.WriteUInt16(nMagicLv);
            outpack.WriteByte(bDir);
            //int nCount = List_Obj.Count == 0 ? 1 : List_Obj.Count;
            outpack.WriteByte((byte)List_Obj.Count);
            outpack.WriteBuff(bBuff);
            if (bSigle)
            {
                bBuff = new byte[43];
            }
            else
            {
                bBuff = new byte[20];
            }
           
            for (int i = 0; i < List_Obj.Count; i++)
            {
                outpack.WriteUInt32(List_Obj[i]);
                outpack.WriteInt32(List_Value[i]);
                outpack.WriteBuff(bBuff);
            }
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);

            outpack.WriteBuff(bBuff);
          //  Log.Instance().WriteLog(GameBase.Network.GamePacketKeyEx.byteToText(outpack.GetNormalBuff()));
            return outpack.Flush();
        } 
예제 #15
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();
     }
예제 #16
0
   public override byte[] GetBuffer()
   {
       PacketOut packout = new PacketOut(mKey);
       packout.WriteUInt16(mMsgLen);
       packout.WriteUInt16(mParam);
       packout.WriteUInt32(mnID);
       packout.WriteInt16(mnX);
       packout.WriteInt16(mnY);
       packout.WriteInt32(lookface);
 
       byte[] data = { 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
       packout.WriteBuff(data);
       //packout.WriteUInt16(mnState);
       //packout.WriteUInt16(mnParam2);
       //packout.WriteUInt16(mnParam3);
       //packout.WriteUInt16(mnParam4);
       //packout.WriteUInt16(mnParam5);
       return packout.Flush();
   }
예제 #17
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(typeid);
     outpack.WriteInt16(type);
     outpack.WriteInt16(fightpower);
     outpack.WriteInt16(level);
     outpack.WriteInt16(param);
     return outpack.Flush();
 }
예제 #18
0
 public override byte[] GetBuffer()
 {
     PacketOut packout = new PacketOut(mKey);
     packout.WriteUInt16(mMsgLen);
     packout.WriteUInt16(mParam);
     packout.WriteInt32(ID);
     packout.WriteUInt32(MapID);
     packout.WriteInt16(x);
     packout.WriteInt16(y);
     packout.WriteInt32(Param);
     packout.WriteUInt32(MapID2);
     packout.WriteInt32(LoadTag);
     return packout.Flush();
 }
예제 #19
0
     public override byte[] GetBuffer()
     {
 
         if (legion_id1 == 0)
         {
             legion_id1 = legion_id;
         }
         PacketOut outpack = new PacketOut(mKey);
         outpack.WriteUInt16(mMsgLen);
         outpack.WriteUInt16(mParam);
         outpack.WriteUInt32(legion_id);
         outpack.WriteInt32(money);
         outpack.WriteInt32(devote);
         outpack.WriteBuff(param);
         outpack.WriteInt32(param1);
         outpack.WriteInt32(param2);
         outpack.WriteInt16(param3);
         outpack.WriteInt16(place);
         outpack.WriteInt16(param4);
         outpack.WriteByte(title);
         outpack.WriteBuff(param5);
         byte[] byte_name = Coding.GetDefauleCoding().GetBytes(legion_name);
         outpack.WriteBuff(byte_name);
         int nLen = 18 - byte_name.Length;
         if (nLen > 0)
         {
             byte[] byte_len = new byte[nLen];
             byte_len = new byte[nLen];
             outpack.WriteBuff(byte_len);
         }
         outpack.WriteUInt32(legion_id1);
         outpack.WriteBuff(param6);
         return outpack.Flush();
     }
예제 #20
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();
 }
예제 #21
0
 public override byte[] GetBuffer()
 {
     PacketOut packout = new PacketOut(mKey);
     packout.WriteUInt16(mMsgLen);
     packout.WriteUInt16(mParam);
     packout.WriteUInt32(id);
     packout.WriteInt32(param);
     packout.WriteInt32(param1);
     for(int i = 0;i < param2.Length;i++)
     {
         packout.WriteInt32(param2[i]);
     }
     packout.WriteUInt32(lookface);
     packout.WriteInt16(x);
     packout.WriteInt16(y);
     packout.WriteUInt16(hp_);
     packout.WriteUInt16(level);
     packout.WriteUInt32(typeid);
     packout.WriteInt32(maxhp);
     packout.WriteInt32(hp);
     packout.WriteInt32(dir);
     return packout.Flush();
 }
예제 #22
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();
 }
예제 #23
0
        //摊位取回道具
        public void GetBackItem(PlayerObject play, uint item_id)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null) return;
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());
            GameStruct.RoleItemInfo item = null;
            if (ptich_obj_id == 0) return;
            if (item_id >= IDManager.eudemon_start_id)
            {

                RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(item_id);
                if (eudemon == null) return;
                item = play.GetItemSystem().FindItem(eudemon.itemid);
                if (item == null) return;
            }
            else
            {
                item = play.GetItemSystem().FindItem(item_id);
                if (item == null) return;
            }

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

            }
            else
            {
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;
            }

            PacketOut outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteUInt32(ptich_obj_id);
            outpack.WriteInt32((byte)NetMsg.MsgOperateItem.PTICH_GETBACK_SELLITEM);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            play.SendData(outpack.Flush(), true);
        }
예제 #24
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(28);
     outpack.WriteUInt16(1010);
     outpack.WriteUInt32(playid);
     outpack.WriteUInt32(npcid);
     outpack.WriteInt16(npc_x);
     outpack.WriteInt16(npc_y);
     outpack.WriteInt32(0);
     outpack.WriteInt32(dialog_type);
     outpack.WriteInt32(9596);
     return outpack.Flush();
 }
예제 #25
0
        //查看摊位
        //ptich_obj_id 摊位对象id
        //page 页码
        public void LookPtich(PlayerObject play, uint ptich_obj_id)
        {
            int ptich_id = -1;
            for (int i = 0; i < mListPtichInfo.Count; i++)
            {
                if (mListPtichInfo[i].PtichObj == null) continue;
                if (mListPtichInfo[i].PtichObj.GetTypeId() == ptich_obj_id)
                {
                    ptich_id = i;
                    break;
                }
            }
            if (ptich_id == -1) return;
            // 摊位信息
            byte[] senddata = { 42, 0, 105, 4, 244, 1, 0, 0, 64, 66, 15, 0, 36, 52, 156, 8, 3, 0, 0, 0, 30, 214, 44, 135, 2, 0, 0, 0, 164, 3, 178, 5, 1, 0 };
            PacketOut outpack = new PacketOut();
            outpack.WriteBuff(senddata);
            outpack.WriteInt16((short)(ptich_id + 1));
            byte[] data2 = { 1, 4, 202, 165, 213, 189 };
            outpack.WriteBuff(data2);
            play.SendData(outpack.Flush(), true);
            //出售的道具信息
            for (int i = 0; i < mListPtichInfo[ptich_id].mSellItemList.Count; i++)
            {
                RoleItemInfo item_info = null;
                RoleData_Eudemon eudemon = null;
                if (mListPtichInfo[ptich_id].mSellItemList[i].item_id >= IDManager.eudemon_start_id)
                {
                    eudemon = mListPtichInfo[ptich_id].play.GetEudemonSystem().FindEudemon(
                        mListPtichInfo[ptich_id].mSellItemList[i].item_id);
                    if (eudemon == null) continue;
                    item_info = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem( eudemon.itemid);
                }
                else
                {
                    item_info = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem(
                    mListPtichInfo[ptich_id].mSellItemList[i].item_id);
                }

                if (item_info != null)
                {
                    NetMsg.MsgPtichItemInfo msg = new NetMsg.MsgPtichItemInfo(item_info,
                        ptich_obj_id, mListPtichInfo[ptich_id].mSellItemList[i].price,mListPtichInfo[ptich_id].mSellItemList[i].sell_type);
                    play.SendData(msg.GetBuffer(), true);
                    //发送幻兽信息
                    if (item_info.typeid >= IDManager.eudemon_start_id)
                    {
                        mListPtichInfo[ptich_id].play.GetEudemonSystem().SendLookPtichEudemonInfo(play, eudemon);
                       // play.GetEudemonSystem().SendEudemonInfo(eudemon, false, true);
                    }
                }

            }
            //道具id
            //摊位对象id
            //魔石价格
            //道具基础id
            //最大损耗  172, 38,
            //当前损耗  172, 38,
            //摊位栏 3
            //是否鉴定 0.已鉴定 1.未鉴定
            //未知 50
            //第一个宝石 30
            //第二个宝石 30
            //未知 0,0
            //强化等级 12
            //32.未知
            //33.未知
            //34.未知
            //35.未知
            //36/37.38.39 未知
            //40.41. 战魂等级
            //42-51 未知
            //52 地攻击
            //53 水攻击
            //54 火攻击
            //55 风攻击
            //56 特效
            //64 第三个宝石
            // byte[] data = { 101, 0, 84, 4, 13, 11, 150, 7, 67,162,1,0, 172, 13, 0, 0, 132, 70, 2, 0, 172, 38, 172, 38, 3, 0, 50, 30, 30, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 10, 209, 215, 253, 136, 133, 101, 159, 111, 235, 112, 0, 0, 0, 0, 0 };
            //    play.SendData(GameServer.PtichData, true);
            //107075

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

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

                 }
                 else
                 {
                     item = play.GetItemSystem().FindItem(
                  mListPtichInfo[play.GetCurrentPtichID()].mSellItemList[i].item_id);
                 }

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

                    }
                    else
                    {
                        item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;
                    }

                    if (bSendData)
                    {
                        PacketOut outpack = new PacketOut();
                        outpack.WriteInt16(28);
                        outpack.WriteInt16(1009);
                        outpack.WriteUInt32(item.id);
                        outpack.WriteUInt32(ptich_obj_id);
                        outpack.WriteInt32((byte)NetMsg.MsgOperateItem.PTICH_GETBACK_SELLITEM);
                        outpack.WriteInt32(0);
                        outpack.WriteInt32(0);
                        outpack.WriteInt32(0);
                        play.SendData(outpack.Flush(), true);
                    }
                }
            }
            mListPtichInfo[play.GetCurrentPtichID()].play = null;
            //移除地图对象
            play.GetGameMap().RemoveObj(mListPtichInfo[play.GetCurrentPtichID()].PtichObj);
            mListPtichInfo[play.GetCurrentPtichID()].PtichObj = null;
            mListPtichInfo[play.GetCurrentPtichID()].mSellItemList.Clear();
            if (bSendData)
            {
                PacketOut outpack = new PacketOut();
                outpack.WriteInt16(16);
                outpack.WriteInt16(2031);
                outpack.WriteUInt32(ptich_obj_id);
                outpack.WriteUInt32(play.GetTypeId());
                outpack.WriteInt32(2);
                play.SendData(outpack.Flush(), true);
            }
            //移除摆摊状态
            play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_PTICH);
        }
예제 #28
0
        public override byte[] GetBuffer()
        {
            PacketOut outpack = new PacketOut(mKey);
            mMsgLen += (ushort)(152/*道具数据结构信息*/* list_item.Count);
            outpack.WriteUInt16(mMsgLen);
            outpack.WriteUInt16(mParam);
            outpack.WriteInt32(tag);
            outpack.WriteByte(param1);
            outpack.WriteByte(type);
            outpack.WriteInt16(action);
            outpack.WriteInt32(param2);
            outpack.WriteUInt32(playid);
            outpack.WriteInt32((int)list_item.Count);
            byte[] data = null;
            for (int i = 0; i < list_item.Count; i++)
            {
                GameStruct.RoleItemInfo item = list_item[i];
                GameStruct.ItemTypeInfo baseitem = MapServer.ConfigManager.Instance().GetItemTypeInfo(list_item[i].itemid);
                if (baseitem == null)
                {
                    data = new byte[152];
                    outpack.WriteBuff(data);
                    continue;
                }

               outpack.WriteUInt32(item.id);
         
                outpack.WriteUInt32(item.itemid);
              //当前耐久度
                outpack.WriteUInt16(item.amount);
                //最大耐久度
                outpack.WriteUInt16(baseitem.amount_limit);

                outpack.WriteByte(0);  //状态 1.未鉴定 0.已鉴定
                outpack.WriteByte((byte)item.gem1);
                outpack.WriteByte((byte)item.gem2);
                outpack.WriteByte((byte)0); //技能
                outpack.WriteByte((byte)0); //技能
               
                outpack.WriteByte(item.GetStrongLevel());
                outpack.WriteByte((byte)0); //技能
                outpack.WriteInt32(0);
                outpack.WriteInt32(0);//装备锁住时间
                outpack.WriteInt32(item.war_ghost_exp);
                outpack.WriteInt32(0);
                outpack.WriteInt32(0);
                outpack.WriteByte(item.di_attack);//地攻击
                outpack.WriteByte(item.shui_attack);//水攻击
                outpack.WriteByte(item.huo_attack);//火攻击
                outpack.WriteByte(item.feng_attack);//风攻击
                outpack.WriteByte(0);//特效
                outpack.WriteByte(0);
                outpack.WriteByte(0);
                outpack.WriteInt16(0);
                outpack.WriteInt32(0);//道具属性 什么封印道具 系统赠送道具 魂契武器的标识
                outpack.WriteByte((byte)item.gem3);//第三个宝石
                outpack.WriteInt32(item.god_strong); //神炼强度
                outpack.WriteInt16((short)item.god_exp); //神佑经验
                outpack.WriteInt32(0); //未激活时间 
                data = new byte[21];
                outpack.WriteBuff(data);
  


                //写名称-
                 byte[] namebyte = Coding.GetDefauleCoding().GetBytes(baseitem.name);
                 outpack.WriteBuff(namebyte);
                 data = new byte[68 - namebyte.Length];
                 outpack.WriteBuff(data);
 
            }

           // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(outpack.GetNormalBuff()));
            return outpack.Flush();
        }
예제 #29
0
        public static void OnConnect(Socket s)
        {
            GameSession session;
            lock (_lock_session)
            {
                session = new GameSession(s);
                m_DicSession[s] = session;
            }

            //发送key
            PacketOut packout = new PacketOut(session.GetGamePackKeyEx());
            packout.WriteInt16(8); //长度
            packout.WriteUInt16(PacketProtoco.S_KEY);
            packout.WriteInt32(m_Key);
            byte[] data = packout.Flush();
            server.SendData(s, data);
        }
예제 #30
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();
        }