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

public WriteInt32 ( int v ) : void
v int
Результат void
Пример #1
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; 
 }
Пример #2
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);
        }
Пример #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);
        }
Пример #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 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();
 }
Пример #7
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();
 }
Пример #8
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();
 }
Пример #9
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();
 }
Пример #10
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();
 }
Пример #11
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();
 }
Пример #12
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();
   }
Пример #13
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();
 }
Пример #14
0
 public override byte[] GetBuffer()
 {
     PacketOut outpack = new PacketOut(mKey);
     outpack.WriteUInt16(mMsgLen);
     outpack.WriteUInt16(mParam);
     outpack.WriteUInt32(equipid);
     outpack.WriteInt32(postion);
     outpack.WriteInt32(tag);
     outpack.WriteInt32(param);
     outpack.WriteInt32(param1);
     outpack.WriteInt32(param2);
     return outpack.Flush();
 }
Пример #15
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();
     }
Пример #16
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();
 }
Пример #17
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();
     }
Пример #18
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();
 }
Пример #19
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();
 }
Пример #20
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();
        }
Пример #21
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();
 }
Пример #22
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();
        }
Пример #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()
 {
     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();
 }
Пример #25
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}
        }
Пример #26
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();
     }
Пример #27
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;
        }
Пример #28
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();
 }
Пример #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
  //       长度,包识,地图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() ; 
  }