コード例 #1
0
        /// <summary>
        /// Check all items that belong to this ownerid and fix the OwnerLot if needed
        /// </summary>
        public virtual bool CheckInventory()
        {
            House house = HouseMgr.GetHouse(CurrentRegionID, HouseNumber);

            if (house == null)
            {
                return(false);
            }

            bool isFixed = false;

            var items = DOLDB <InventoryItem> .SelectObjects(DB.Column(nameof(InventoryItem.OwnerID)).IsEqualTo(house.OwnerID).And(DB.Column(nameof(InventoryItem.SlotPosition)).IsGreaterOrEqualTo(FirstDBSlot)).And(DB.Column(nameof(InventoryItem.SlotPosition)).IsLessOrEqualTo(LastDBSlot)).And(DB.Column(nameof(InventoryItem.OwnerLot)).IsEqualTo(0)));

            foreach (InventoryItem item in items)
            {
                item.OwnerLot = (ushort)HouseNumber;
                MarketCache.AddItem(item);
                if (ServerProperties.Properties.MARKET_ENABLE_LOG)
                {
                    log.DebugFormat("CM: Fixed OwnerLot for item '{0}' on CM for lot {1}", item.Name, HouseNumber);
                }
                isFixed = true;
            }
            GameServer.Database.SaveObject(items);

            return(isFixed);
        }
コード例 #2
0
        /// <summary>
        /// Check all items that belong to this ownerid and fix the OwnerLot if needed
        /// </summary>
        public virtual bool CheckInventory()
        {
            House house = HouseMgr.GetHouse(CurrentRegionID, HouseNumber);

            if (house == null)
            {
                return(false);
            }

            bool isFixed = false;

            String sqlWhere = String.Format("OwnerID = '{0}' and SlotPosition >= {1} and SlotPosition <= {2} and OwnerLot = 0", house.OwnerID, FirstDBSlot, LastDBSlot);

            var items = GameServer.Database.SelectObjects <InventoryItem>(sqlWhere);

            foreach (InventoryItem item in items)
            {
                item.OwnerLot = (ushort)HouseNumber;
                GameServer.Database.SaveObject(item);
                MarketCache.AddItem(item);
                if (ServerProperties.Properties.MARKET_ENABLE_LOG)
                {
                    log.DebugFormat("CM: Fixed OwnerLot for item '{0}' on CM for lot {1}", item.Name, HouseNumber);
                }
                isFixed = true;
            }

            return(isFixed);
        }
コード例 #3
0
ファイル: ConsignmentMerchant.cs プロジェクト: mywebext/DOL
        /// <summary>
        /// Check all items that belong to this ownerid and fix the OwnerLot if needed
        /// </summary>
        public virtual bool CheckInventory()
        {
            House house = HouseMgr.GetHouse(CurrentRegionID, HouseNumber);

            if (house == null)
            {
                return(false);
            }

            bool isFixed = false;

            var items = GameServer.Database.SelectObjects <InventoryItem>("`OwnerID` = @OwnerID AND `SlotPosition` >= @SlotPositionMin AND `SlotPosition` <= @SlotPositionMax AND `OwnerLot` = @OwnerLot", new[] { new QueryParameter("@OwnerID", house.OwnerID), new QueryParameter("@SlotPositionMin", FirstDBSlot), new QueryParameter("@SlotPositionMax", LastDBSlot), new QueryParameter("@OwnerLot", 0) });

            foreach (InventoryItem item in items)
            {
                item.OwnerLot = (ushort)HouseNumber;
                MarketCache.AddItem(item);
                if (ServerProperties.Properties.MARKET_ENABLE_LOG)
                {
                    log.DebugFormat("CM: Fixed OwnerLot for item '{0}' on CM for lot {1}", item.Name, HouseNumber);
                }
                isFixed = true;
            }
            GameServer.Database.SaveObject(items);

            return(isFixed);
        }
コード例 #4
0
 /// <summary>
 /// Add an item to this object
 /// </summary>
 public virtual bool OnAddItem(GamePlayer player, InventoryItem item)
 {
     if (ServerProperties.Properties.MARKET_ENABLE_LOG)
     {
         log.DebugFormat("CM: {0}:{1} adding '{2}' to consignment merchant on lot {3}.", player.Name, player.Client.Account.Name, item.Name, HouseNumber);
     }
     return(MarketCache.AddItem(item));
 }