GetBuffer() public méthode

public GetBuffer ( ) : byte[]
Résultat byte[]
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;
        }
Exemple #2
0
        //public RoleData_Eudemon AwardEudemon(uint itemid)
        //{
        //}
        //创建物品参数说明
        //postion:道具位置
        //amount:数量
        //stronglv: 强化等级
        //gem1: 第一洞宝石 255为打孔
        //gem2: 第二洞镶嵌的宝石 255为打孔
        //gem3: 第三洞镶嵌的宝石 255为打孔
        //warghost_exp: 战魂等级 最高9级
        //di_attack : 地攻击 最高255级
        //shui_attack: 水攻击 最高255级
        //huo_attack: 火攻击 最高255级
        //feng_attack: 风攻击 最高255级
        //limit: 是否叠加
        public GameStruct.RoleItemInfo AwardItem(uint itemid, byte postion, byte amount = 1, byte stronglv = 0,byte gem1 = 0,byte gem2 = 0,byte gem3 = 0,byte warghost_exp = 0,
            byte di_attack = 0,byte shui_attack = 0,byte huo_attack = 0,byte feng_attack = 0,bool limit = true/*是否叠加*/)
        {
            //是金币
            if (IsGold(itemid))
            {
                return null;
            }
            GameStruct.ItemTypeInfo baseitem = ConfigManager.Instance().GetItemTypeInfo(itemid);
            if (baseitem == null)
            {
                Log.Instance().WriteLog("创建道具失败,道具不存在 id:" + itemid.ToString());
              //  return null;
                if (!GameServer.IsTestMode()) return null;
                baseitem = new GameStruct.ItemTypeInfo();
                baseitem.id = itemid;
            }

            GameStruct.RoleItemInfo item = null;
            //可叠加
            if (!IsEquip(baseitem.id) && limit && baseitem.amount_limit > 1)
            {
                item = ItemLimit(itemid, (byte)baseitem.amount);
                if(item  != null)
                {
                    return item;
                }
            }
            uint key = (uint)mDicAddItem.Count + 1;

            item = new GameStruct.RoleItemInfo();
            item.itemid = baseitem.id;
            item.postion = postion;
            item.stronglv = stronglv;
            item.gem1 = gem1;
            item.gem2 = gem2;
            item.gem3 = gem3;
            item.war_ghost_exp = warghost_exp * 100;
            item.di_attack = di_attack;
            item.shui_attack = shui_attack;
            item.huo_attack = huo_attack;
            item.feng_attack = feng_attack;
            item.amount = baseitem.amount;
               // item.amount = IsEquip(baseitem.id) == true ? baseitem.amount_limit : amount;

            //宝石属性
            GameStruct.GemInfo gem = ConfigManager.Instance().GetGemInfo(item.itemid);
            if (gem != null)
            {
                item.gem1 = (uint)gem.type;
            }
            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 = postion;
            dbitem.item.itemid = item.itemid;
            dbitem.item.stronglv = stronglv;

            dbitem.item.amount = amount;
            dbitem.sortid = key;
            DBServer.Instance().GetDBClient().SendData(dbitem.GetBuffer());
            return item;
        }