本文整理汇总了C#中System.Objects.GetItems方法的典型用法代码示例。如果您正苦于以下问题:C# Objects.GetItems方法的具体用法?C# Objects.GetItems怎么用?C# Objects.GetItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Objects
的用法示例。
在下文中一共展示了Objects.GetItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LootItems
//.........这里部分代码省略.........
if (this.Parent.CurrentSettings.EatFood &&
this.Parent.StopwatchFoodEater.Elapsed.TotalSeconds > 20 &&
this.Parent.Client.ItemList.Food.All.Contains(item.ID))
{
if (item.Count <= 1) item.Use();
else
{
for (int i = 0; i < Math.Min(item.Count, (ushort)3); i++)
{
item.Use();
Thread.Sleep(rand.Next(200, 325));
}
}
this.Parent.StopwatchFoodEater.Restart();
Thread.Sleep(rand.Next(200, 350));
index--;
continue;
}
// check if we want to loot this item
Loot loot = null;
foreach (Loot l in loots)
{
if (l.ID == item.ID)
{
loot = l;
break;
}
}
if (loot == null)
{
index--;
continue;
}
// loot this item
bool successful = false;
switch (loot.Destination)
{
case Loot.Destinations.Ground:
Objects.Map.Tile playerTile = tiles.GetTile(count: this.Parent.Client.Player.ID);
if (playerTile == null) break;
List<Map.Tile> adjacentTiles = tiles.GetAdjacentTileCollection(playerTile).GetTiles().ToList();
adjacentTiles.Shuffle();
foreach (Objects.Map.Tile tile in adjacentTiles)
{
if (!tile.IsWalkable()) continue;
item.Move(new Objects.ItemLocation(tile.WorldLocation));
successful = true;
break;
}
break;
case Loot.Destinations.EmptyContainer:
Objects.ItemLocation toItem = this.Parent.Client.Inventory.GetFirstSuitableSlot(item, loot.Index);
if (toItem == null) break;
item.Move(toItem);
successful = true;
break;
}
// if successful, check if it's looted
// if it wasn't looted, try again
if (successful)
{
if (!item.WaitForInteraction(800))
{
retryCount++;
continue;
}
if (this.Parent.ItemLooted != null) this.Parent.ItemLooted(item);
if (!this.Parent.CurrentSettings.FastLooting) Thread.Sleep(rand.Next(400, 700));
}
retryCount = 0;
index--;
}
if (this.Parent.CurrentSettings.OpenContainers &&
!this.Cancel &&
lootContainer.IsOpen &&
lootContainer.ItemsAmount > 0)
{
bool found = false;
foreach (Objects.Item item in lootContainer.GetItems().Reverse())
{
if (item.HasFlag(Enums.ObjectPropertiesFlags.IsContainer))
{
for (int i = 0; i < 3; i++)
{
item.Use();
if (item.WaitForInteraction(800)) break;
}
found = true;
break;
}
}
if (found) this.LootItems(lootContainer, loots, this.CachedTiles);
}
}