WriteUInt16() public method

public WriteUInt16 ( ushort v ) : void
v ushort
return void
Esempio n. 1
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();
 }
Esempio n. 2
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);
     return base.GetBuffer();
 }
Esempio n. 3
0
        public static void SendConnectMapServer(GameSession session, int key, int key2)
        {
            byte[] defdata = { 232, 16, 67, 3 };
            byte[] defdata2 = { 121, 39, 0, 0, 49, 50, 48, 46, 49, 51, 50, 46, 54,
                                          57, 46, 49, 52, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            byte[] ipdata = Coding.GetDefauleCoding().GetBytes(m_GameServerIP);

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

            defdata = packout.Flush();
            server.SendData(session.m_Socket, defdata);
        }
Esempio n. 4
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();
 }
Esempio n. 5
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();
 }
Esempio n. 6
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();
     }
Esempio n. 7
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();
 }
Esempio n. 8
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteInt32(time);
     outpack.WriteUInt32(roleid);
     outpack.WriteInt16(x);
     outpack.WriteInt16(y);
     outpack.WriteInt32(type);
     outpack.WriteInt16(_x);
     outpack.WriteInt16(_y);
     outpack.WriteInt32(tag);
    
     return outpack.Flush();
 }
Esempio n. 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;
 }
Esempio n. 10
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; 
 }
Esempio n. 11
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(id);
     outpack.WriteUInt32(param1);
     outpack.WriteUInt32(tag);
     outpack.WriteUInt32(roleid);
     outpack.WriteUInt32(param2);
     outpack.WriteUInt32(param3);
     return outpack.Flush();
 }
Esempio n. 12
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() ; 
  }
Esempio n. 13
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();
 }
Esempio n. 14
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();
 }
Esempio n. 15
0
        public override byte[] GetBuffer()
        {
            PacketOut outpack = new PacketOut(mKey);
            mMsgLen += (ushort)(list_value.Count * 8);
            outpack.WriteUInt16(mMsgLen);
            outpack.WriteUInt16(mParam);
            outpack.WriteInt32(tag);
            outpack.WriteUInt32(id);
            outpack.WriteInt32(list_item.Count);
            for (int i = 0; i < list_item.Count; i++)
            {
                outpack.WriteInt32((int)list_item[i]);
                outpack.WriteInt32(list_value[i]);
            }

            return outpack.Flush();
        }
Esempio n. 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();
   }
Esempio n. 17
0
 public override byte[] GetBuffer()
 {
     param3 = eudemonid;
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(playerid);
     outpack.WriteUInt32(eudemonid);
     outpack.WriteInt32(param1);
     outpack.WriteInt32(param2);
     outpack.WriteUInt32(param3);
     outpack.WriteInt32(action);
     return outpack.Flush();
 }
Esempio n. 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();
 }
Esempio n. 19
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(playerid);
     outpack.WriteUInt32(fightpower);
     outpack.WriteByte(type);
     outpack.WriteByte(Online);
     outpack.WriteByte(level);
     outpack.WriteByte(param);
     byte[] namebyte = Coding.GetDefauleCoding().GetBytes(name);
     outpack.WriteBuff(namebyte);
     byte[] end = new byte[32 - namebyte.Length];
     outpack.WriteBuff(end);
     return outpack.Flush();
 }
Esempio n. 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();
 }
Esempio n. 21
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();
     }
Esempio n. 22
0
 public override byte[] GetBuffer()
 {
     mMsgLen += (ushort)(amount * 8);
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(role_id);
     outpack.WriteInt32(amount);
     for (int i = 0; i < amount; i++)
     {
         outpack.WriteInt32((int)list_type[i]);
         outpack.WriteUInt32(list_value[i]);
     }
     list_type.Clear();
     list_value.Clear();
    
     return outpack.Flush();
 }
Esempio n. 23
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();
     }
Esempio n. 24
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();
 }
Esempio n. 25
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();
 }
Esempio n. 26
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();
 }
Esempio n. 27
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(id);
     outpack.WriteInt32(type);
     outpack.WriteInt32(param);
     outpack.WriteInt32(sp);
     return outpack.Flush();
 }
Esempio n. 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();
        }
Esempio n. 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);
        }
Esempio n. 30
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();
        }