GameBase.Network.Internal.AddRoleData_Item.GetBuffer C# (CSharp) Méthode

GetBuffer() public méthode

public GetBuffer ( ) : byte[]
Résultat byte[]
        public byte[] GetBuffer()
        {
            PacketOut outpack = new PacketOut();
            outpack.WriteBuff(InternalPacket.HEAD);
            outpack.WriteUInt16(mParam);
            outpack.WriteUInt32(gameid);
            outpack.WriteUInt32(sortid);
            outpack.WriteBuff(item.GetBuffer());
            //outpack.WriteInt32(playerid);
            //outpack.WriteUInt32(itemid);
            //outpack.WriteUInt16(postion);
            //outpack.WriteByte(stronglv);
            //outpack.WriteByte(gemcount);
            //outpack.WriteUInt32(gem1);
            //outpack.WriteUInt32(gem2);
            //outpack.WriteString(forgename);
            //outpack.WriteUInt16(amount);
            //outpack.WriteInt32(war_ghost_exp);
            //outpack.WriteByte(di_attack);
            //outpack.WriteByte(shui_attack);
            //outpack.WriteByte(huo_attack);
            //outpack.WriteByte(feng_attack);
            //outpack.WriteInt32(property);
            //outpack.WriteByte(gem3);
            //outpack.WriteInt32(god_strong);
            //outpack.WriteInt32(god_exp);
            outpack.WriteBuff(InternalPacket.TAIL);
            return outpack.GetBuffer();
        }

Usage Example

Exemple #1
0
        //这个函数用于玩家丢弃的道具,然后又捡起来应用..所以不叠加
        public GameStruct.RoleItemInfo AwardItem(GameStruct.RoleItemInfo info)
        {
            if (IsGold(info.itemid))
            {
                play.ChangeAttribute(GameStruct.UserAttribute.GOLD, info.property);
                play.LeftNotice(string.Format("获得{0}金币!", info.property));
                return null;
            }
            GameStruct.ItemTypeInfo baseitem = ConfigManager.Instance().GetItemTypeInfo(info.itemid);
            if (baseitem == null)
            {
                Log.Instance().WriteLog("创建道具失败,道具不存在 id:" + info.itemid.ToString());
                //  return null;
                if (!GameServer.IsTestMode()) return null;
                baseitem = new GameStruct.ItemTypeInfo();
                baseitem.id = info.itemid;
            }
            uint key = (uint)mDicAddItem.Count + 1;

            GameStruct.RoleItemInfo item = new GameStruct.RoleItemInfo();
            item.itemid = baseitem.id;
            item.postion = info.postion;
            item.stronglv = info.stronglv;
            item.gemcount = info.gemcount;
            item.amount = info.amount;
            item.gem1= info.gem1;
            item.gem2 = info.gem2;
            item.forgename = info.forgename;
            item.war_ghost_exp = info.war_ghost_exp;
            item.di_attack = info.di_attack;
            item.huo_attack = info.huo_attack;
            item.shui_attack = info.shui_attack;
            item.feng_attack = info.feng_attack;
            item.property = info.property;
            item.gem3 = info.gem3;
            item.god_strong = info.god_strong;
            item.god_exp = info.god_exp;

            item.typeid = info.typeid;
            mDicAddItem[key] = item;

            //发给dbserver 通知增加这个道具
            GameBase.Network.Internal.AddRoleData_Item dbitem = new GameBase.Network.Internal.AddRoleData_Item();
            dbitem.item.playerid = play.GetBaseAttr().player_id;
            dbitem.gameid = play.GetGameID();
            dbitem.item.postion = item.postion;
            dbitem.item.itemid = item.itemid;
            dbitem.item.stronglv = item.stronglv;

            dbitem.item.amount = item.amount;
            dbitem.item.gem1 = item.gem1;
            dbitem.item.gem2 = item.gem2;
            dbitem.item.forgename = item.forgename;
            dbitem.item.war_ghost_exp = item.war_ghost_exp;
            dbitem.item.di_attack = item.di_attack;
            dbitem.item.huo_attack = item.huo_attack;
            dbitem.item.shui_attack = item.shui_attack;
            dbitem.item.feng_attack = item.feng_attack;
            dbitem.item.property = item.property;
            dbitem.item.gem3 = item.gem3;
            dbitem.item.god_strong = item.god_strong;
            dbitem.item.god_exp = item.god_exp;
            dbitem.sortid = key;
            DBServer.Instance().GetDBClient().SendData(dbitem.GetBuffer());
            return item;
        }
All Usage Examples Of GameBase.Network.Internal.AddRoleData_Item::GetBuffer