当前位置: 首页>>代码示例>>C#>>正文


C# Walker.UpdateCache方法代码示例

本文整理汇总了C#中Walker.UpdateCache方法的典型用法代码示例。如果您正苦于以下问题:C# Walker.UpdateCache方法的具体用法?C# Walker.UpdateCache怎么用?C# Walker.UpdateCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Walker的用法示例。


在下文中一共展示了Walker.UpdateCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run


//.........这里部分代码省略.........
                    if (!this.Client.Player.Connected) continue;

                    // check if a script waypoint is currently running
                    if (walker.IsRunning &&
                        currentWaypoint != null &&
                        currentWaypoint.Type == Waypoint.Types.Script)
                    {
                        continue;
                    }

                    Objects.Location playerLoc = this.Client.Player.Location;
                    IEnumerable<Objects.Creature> creatures = this.Client.BattleList.GetCreatures(false, true),
                        visiblePlayers = this.Client.BattleList.GetPlayers(true, true);
                    List<Objects.Creature> visibleCreatures = new List<Objects.Creature>();
                    foreach (Objects.Creature c in creatures)
                    {
                        if (c.IsVisible) visibleCreatures.Add(c);
                    }

                    foreach (Objects.Creature c in targeting.GetKilledCreatures(creatures))
                    {
                        string name = c.Name.ToLower();
                        foreach (Target t in this.GetTargets())
                        {
                            if (t.Name.ToLower() != name) continue;
                            if (!corpseLocations.Contains(c.Location)) corpseLocations.Add(c.Location);
                            break;
                        }
                    }

                    #region targeting
                    if (targeting.IsRunning)
                    {
                        targeting.UpdateCache(tileCollection, visibleCreatures, visiblePlayers);
                        continue;
                    }
                    else if (this.CurrentSettings.KillBeforeLooting || corpseLocations.Count == 0)
                    {
                        Target t = this.GetBestTarget(tileCollection, creatures, this.Client.BattleList.GetPlayers(true, true), true);
                        if (t != null)
                        {
                            if (this.CurrentSettings.KillBeforeLooting && looter.IsRunning) looter.CancelExecution();
                            if (this.Client.TibiaVersion < 810) this.StopwatchExhaust.Restart(); // restart to avoid instant attack->spell/rune
                            targeting.ExecuteTarget(t, tileCollection, visibleCreatures, visiblePlayers);
                            continue;
                        }
                    }
                    #endregion

                    #region looting
                    if (looter.IsRunning)
                    {
                        looter.UpdateCache(tileCollection);
                        continue;
                    }
                    // loot always if there are no waypoints
                    if (this.Waypoints.Count == 0)
                    {
                        List<ushort> ids = new List<ushort>();
                        foreach (Loot loot in this.GetLoot())
                        {
                            ids.Add(loot.ID);
                        }
                        foreach (Objects.Container c in this.Client.Inventory.GetContainers(1))
                        {
                            if (c.Name.Contains("Backpack")) continue;
开发者ID:KyLuaa,项目名称:bot,代码行数:67,代码来源:Cavebot.cs


注:本文中的Walker.UpdateCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。