示例#1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Level != 0)
            {
                hash ^= Level.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Desc.Length != 0)
            {
                hash ^= Desc.GetHashCode();
            }
            if (IsOpen != false)
            {
                hash ^= IsOpen.GetHashCode();
            }
            if (SkillId.Length != 0)
            {
                hash ^= SkillId.GetHashCode();
            }
            if (HeroId.Length != 0)
            {
                hash ^= HeroId.GetHashCode();
            }
            hash ^= levelDesc_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#2
0
        public void AddUnitPart <T>(HeroId unitClassId, Func <IAbilityUnit, T> factory) where T : IAbilityUnitPart
        {
            foreach (var keyValuePair in this.AbilityManager.Value.Units)
            {
                var unit = keyValuePair.Value;
                if ((unit.SourceUnit as Hero).HeroId == unitClassId)
                {
                    unit.AddPart(factory);
                }
            }

            foreach (var unitComposer in this.UnitComposers)
            {
                if (unitComposer.Metadata.HeroIds.Contains((uint)unitClassId))
                {
                    unitComposer.Value.AssignPart <T>(factory);
                }
            }
        }
示例#3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (HeroId != 0)
            {
                hash ^= HeroId.GetHashCode();
            }
            if (PlayerHeroValue != 0)
            {
                hash ^= PlayerHeroValue.GetHashCode();
            }
            if (HeroPlayerValue != 0)
            {
                hash ^= HeroPlayerValue.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#4
0
        private void AddHero(HeroId id)
        {
            var name = id.ToString();

            if (this.heroes.ContainsKey(name))
            {
                return;
            }

            if (this.Renderer == null)
            {
                this.loadTextures.Add(id);
            }
            else
            {
                this.Renderer.TextureManager.LoadHeroFromDota(id);
            }

            if (this.savedHeroes.TryGetValue(name, out var savedValue))
            {
                this.heroes[name] = savedValue;
            }
            else
            {
                this.heroes[name] = this.defaultValue;
            }

            if (this.SizeCalculated)
            {
                this.CalculateSize();
                this.ParentMenu.CalculateWidth();
            }

            if (this.heroes.Count >= 5)
            {
                EntityManager9.UnitAdded -= this.OnUnitAdded;
            }
        }
示例#5
0
文件: Hero.cs 项目: liligege/wz_game
        public override int GetHashCode()
        {
            int hash = 1;

            if (HeroId != 0L)
            {
                hash ^= HeroId.GetHashCode();
            }
            hash ^= equip_.GetHashCode();
            if (PetId != 0L)
            {
                hash ^= PetId.GetHashCode();
            }
            if (HorseId != 0L)
            {
                hash ^= HorseId.GetHashCode();
            }
            if (MingjiangId != 0L)
            {
                hash ^= MingjiangId.GetHashCode();
            }
            return(hash);
        }
示例#6
0
        // Token: 0x0600022B RID: 555 RVA: 0x00017C70 File Offset: 0x00015E70
        private void AddHero(HeroId id)
        {
            string key = id.ToString();

            if (this.heroes.ContainsKey(key))
            {
                return;
            }
            if (base.Renderer == null)
            {
                this.loadTextures.Add(id);
            }
            else
            {
                base.Renderer.TextureManager.LoadFromDota(id, false, false);
            }
            bool value;

            if (this.savedHeroes.TryGetValue(key, out value))
            {
                this.heroes[key] = value;
            }
            else
            {
                this.heroes[key] = this.defaultValue;
            }
            if (base.SizeCalculated)
            {
                float num = base.DisplayNameSize.X + base.MenuStyle.LeftIndent + base.MenuStyle.RightIndent + 10f + base.MenuStyle.TextureArrowSize * 2f + (float)this.heroes.Count * base.MenuStyle.TextureHeroSize.X;
                base.Size = new Vector2(num, base.MenuStyle.Height);
                base.ParentMenu.CalculateWidth(false);
            }
            if (this.heroes.Count >= 5)
            {
                EntityManager9.UnitAdded -= this.OnUnitAdded;
            }
        }
示例#7
0
文件: Hero.cs 项目: liligege/wz_game
        public override int GetHashCode()
        {
            int hash = 1;

            if (HeroId != 0L)
            {
                hash ^= HeroId.GetHashCode();
            }
            if (ConfId != 0)
            {
                hash ^= ConfId.GetHashCode();
            }
            if (Level != 0)
            {
                hash ^= Level.GetHashCode();
            }
            if (BreakLevel != 0)
            {
                hash ^= BreakLevel.GetHashCode();
            }
            if (Exp != 0)
            {
                hash ^= Exp.GetHashCode();
            }
            hash ^= awakeInfo_.GetHashCode();
            if (AwakeLevel != 0)
            {
                hash ^= AwakeLevel.GetHashCode();
            }
            if (TianmingLevel != 0)
            {
                hash ^= TianmingLevel.GetHashCode();
            }
            hash ^= Attributes.GetHashCode();
            return(hash);
        }
示例#8
0
        private float GetDuration(HeroId heroId, Vector3 position, bool start)
        {
            if (start)
            {
                var end = this.teleports.LastOrDefault(x => x.HeroId == heroId);
                if (end == null)
                {
                    return(3f);
                }

                return(end.RemainingDuration);
            }

            var duration = 3f;

            if (EntityManager9.EnemyFountain.Distance2D(position) < 1000)
            {
                return(duration);
            }

            if (EntityManager9.RadiantOutpost.Distance2D(position) < 1000 || EntityManager9.DireOutpost.Distance2D(position) < 1000)
            {
                duration = 6f;
            }

            var sleepers = this.teleportSleeper.Count(x => x.Value.IsSleeping && x.Key.Distance2D(position) < TeleportCheckRadius);

            if (sleepers > 0)
            {
                duration += (sleepers * 0.5f) + 1.5f;
            }

            this.teleportSleeper[position] = new Sleeper(TeleportCheckDuration);

            return(duration);
        }
        private void Modifier(Hero hero, Modifier modifier, Vector3 position, string modifierName, int sleepTime, HeroId heroId = 0)
        {
            try
            {
                var abilityTextureName = modifier.TextureName;

                if (modifierName.StartsWith("modifier_rune"))
                {
                    abilityTextureName = modifierName.Substring("modifier_".Length);
                }

                var heroTextureName = hero.Name;
                if (MultiSleeper <string> .Sleeping($"Modifers_{abilityTextureName}_{heroTextureName}"))
                {
                    return;
                }

                var player = hero.Player;
                if (player == null)
                {
                    return;
                }

                Verification.ModifierVerification(position, heroTextureName, abilityTextureName, player.Id + 1, heroId);
                MultiSleeper <string> .Sleep($"Modifers_{abilityTextureName}_{heroTextureName}", sleepTime);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
示例#10
0
 public ExportHeroAttribute(HeroId id)
     : base(typeof(IHero))
 {
     this.Id = id;
 }
示例#11
0
        public async Task <Hero> GetHeroAsync(IAuthenticationScope authenticationScope, HeroId heroId)
        {
            var battleTag = $"{heroId.BattleTag.Name}-{heroId.BattleTag.Index}";

            using (var client = CreateClient(authenticationScope))
            {
                var hero = await client.GetHeroAsync(battleTag, heroId.Id);

                var items = await client.GetDetailedHeroItemsAsync(battleTag, heroId.Id);

                var followerItems = await client.GetDetailedFollowerItemsAsync(battleTag, heroId.Id);

                var mapper = new HeroMapper(heroId, items, followerItems);
                return(mapper.Map(hero));
            }
        }
示例#12
0
 public VaperMenu(HeroId id)
 {
     this.Factory = MenuFactory.Create("Vaper");
     this.General = new GeneralMenu(this.Factory);
     this.Hero    = new HeroMenu(this.Factory, id.ToString());
 }
示例#13
0
 public void LoadHeroFromDota(HeroId heroId, bool rounded = false, bool icon = false)
 {
     this.LoadHeroFromDota(heroId.ToString(), rounded, icon);
 }
示例#14
0
 public async Task LoadHeroTexture(HeroId id)
 {
     RendererManager.TextureManager.LoadFromDota($"{id}", $@"panorama/images/heroes/{id}_png.vtex_c");
     await Task.Delay(150);
 }
示例#15
0
 public SpellAttribute(AbilityId abilityId, HeroId heroId)
 {
     AbilityId = abilityId;
     HeroId    = heroId;
     UnitName  = heroId.ToString();
 }
示例#16
0
 public HeroIdAttribute(HeroId heroId)
 {
     this.HeroId = heroId;
 }
示例#17
0
 public Menu SetTexture(HeroId id)
 {
     return(this.SetTexture(id.ToString()));
 }
示例#18
0
        protected override void OverlaySpells(IEnumerable <Ability> spells, Vector2 position, HeroId heroId, float mana, Vector2 extraSize)
        {
            foreach (var spell in spells)
            {
                if (spell.IsHidden)
                {
                    continue;
                }

                if (spell.IsInAbilityPhase)
                {
                    RendererManager.DrawTexture("Divine.BeAware.Resources.Textures.spell_phase.png", new RectangleF(position.X, position.Y, extraSize.X, extraSize.Y));
                }

                var level        = spell.Level;
                var manaCast     = spell.ManaCost;
                var isEnoughMana = mana >= manaCast;
                var cooldown     = spell.Cooldown;
                var isCooldown   = cooldown > 0;
                var isLevel      = level > 0;

                var extraRange = new Vector2(level > 4 ? (level - 4) * 5.5f : 0, 0);

                if (isCooldown || !isEnoughMana || !isLevel)
                {
                    if (isLevel)
                    {
                        extraRange.Y = 13;
                    }

                    var color = !isLevel ? new Color(100, 10, 10, 190) : (isEnoughMana ? new Color(40, 40, 40, 180) : new Color(25, 25, 130, 190));
                    RendererManager.DrawFilledRectangle(new RectangleF(position.X + 1, position.Y, extraSize.X - 1, extraSize.Y), color, color, 0);
                }

                var notinvospell = heroId != HeroId.npc_dota_hero_invoker || (spell.AbilitySlot != AbilitySlot.Slot_4 && spell.AbilitySlot != AbilitySlot.Slot_5);
                if (notinvospell)
                {
                    for (var lvl = 1; lvl <= level; lvl++)
                    {
                        var rect = new RectangleF(position.X + (extraSize.X * 0.212f * lvl) - extraSize.X * 0.08f, position.Y + 3, extraSize.X * 0.115f, extraSize.X * 0.115f);
                        RendererManager.DrawFilledRectangle(rect, Color.Zero, new Color(255, 255, 0), 0);
                    }
                }

                if (isCooldown)
                {
                    var cooldownText = (cooldown > 1 ? Math.Min(Math.Ceiling(cooldown), 99) : Math.Round(cooldown, 1)).ToString();
                    var cooldownSize = extraSize.X / 2 + 3;
                    var textSize     = RendererManager.MeasureText(cooldownText, cooldownSize);

                    var pos = position + new Vector2(extraSize.X / 2 - textSize.X / 2, (extraSize.Y / 2) - (textSize.Y / 2) + (extraRange.Y - 2));
                    RendererManager.DrawText(cooldownText, pos, Color.WhiteSmoke, cooldownSize);
                }

                if (!isEnoughMana && !isCooldown)
                {
                    var manaText = Math.Min(Math.Ceiling(manaCast - mana), 999).ToString(CultureInfo.InvariantCulture);
                    var textSize = RendererManager.MeasureText(manaText, extraSize.X / 2 + 1);

                    Vector2 pos;
                    if (!notinvospell)
                    {
                        pos = position + new Vector2(extraSize.X / 2 - textSize.X / 2, (extraSize.Y / 2) - (textSize.Y / 2) + (extraRange.Y - 2));
                    }
                    else
                    {
                        pos = position + new Vector2(extraSize.X / 2 - textSize.X / 2, (extraSize.Y / 2) - (textSize.Y / 2) + (extraRange.Y - 2));
                    }

                    RendererManager.DrawText(manaText, pos, Color.LightBlue, extraSize.X / 2 + 1);
                }

                RendererManager.DrawRectangle(new RectangleF(position.X, position.Y, extraSize.X + 1 + extraRange.X, extraSize.Y + extraRange.Y), Color.Black, 1);

                position += new Vector2(extraSize.X + extraRange.X, 0);
            }
        }
示例#19
0
 public HeroMapper(HeroId heroId, DetailedHeroItemsDto items, DetailedFollowersDto followerItems)
 {
     _heroId          = heroId;
     _items           = ExtractItemsFromHero(items);
     _itemsByFollower = ExtractItemsFromFollowers(followerItems);
 }
        public async Task SeedData()
        {
            db.Database.EnsureCreated();

            await CleanUp();

            if (db.Superpowers.Any())
            {
                return;
            }

            var nightVision = new Superpower("NIGHT_VISION", "Night vision");

            db.Superpowers.Add(nightVision);

            var xRayVision = new Superpower("X_RAY_VISION", "X-ray vision");

            db.Superpowers.Add(xRayVision);

            var superSpeed = new Superpower("SUPER_SPEED", "Super speed");

            db.Superpowers.Add(superSpeed);

            var superStrength = new Superpower("SUPER_STRENGTH", "Super strength");

            db.Superpowers.Add(superStrength);

            var fly = new Superpower("FLY", "Fly ability");

            db.Superpowers.Add(fly);

            var wisdom = new Superpower("WISDOM", "Wisdom");

            db.Superpowers.Add(wisdom);


            var nypd = new Customer(CustomerId.NewId(), "NYPD", "N.Y. Police");

            db.Customers.Add(nypd);
            var un = new Customer(CustomerId.NewId(), "UN", "United Nations");

            db.Customers.Add(un);

            var batman = new Hero(HeroId.NewId(), "Batman", 1_000M)
                         .AddPower(nightVision)
                         .AddPower(superStrength);
            var darkWing = new Hero(HeroId.NewId(), "Dark Wing", 800M)
                           .AddPower(superSpeed)
                           .AddPower(nightVision);
            var captainAmerica = new Hero(HeroId.NewId(), "Captain America", 1_100M)
                                 .AddPower(superStrength);
            var hulk = new Hero(HeroId.NewId(), "Hulk", 500M)
                       .AddPower(superStrength);
            var superman = new Hero(HeroId.NewId(), "Superman", 2_000M)
                           .AddPower(superStrength)
                           .AddPower(xRayVision)
                           .AddPower(superSpeed)
                           .AddPower(fly);
            var wonderWoman = new Hero(HeroId.NewId(), "Wonder Woman", 2_500M)
                              .AddPower(superStrength)
                              .AddPower(superSpeed)
                              .AddPower(wisdom);

            db.Heroes.Add(batman);
            db.Heroes.Add(darkWing);
            db.Heroes.Add(captainAmerica);
            db.Heroes.Add(hulk);
            db.Heroes.Add(superman);
            db.Heroes.Add(wonderWoman);

            await db.SaveChangesAsync();
        }
示例#21
0
 public SpellAttribute(AbilityId abilityId, HeroId heroId, string unitName)
 {
     AbilityId = abilityId;
     HeroId    = heroId;
     UnitName  = unitName;
 }
示例#22
0
 public static string LocalizeName(HeroId id)
 {
     return(LocalizeName(id.ToString()));
 }
示例#23
0
 public Config(HeroId id)
 {
     this.Factory = MenuFactory.Create("BAIO");
     this.General = new GeneralMenu(this.Factory);
     this.Hero    = new HeroMenu(this.Factory, id.ToString());
 }
示例#24
0
        protected override void OverlaySpells(IEnumerable <Ability> spells, Vector2 position, HeroId heroId, float mana, Vector2 extraSize)
        {
            foreach (var spell in spells)
            {
                if (spell.IsHidden)
                {
                    continue;
                }

                if (spell.IsInAbilityPhase)
                {
                    RendererManager.DrawTexture("Divine.BeAware.Resources.Textures.spell_phase.png", new RectangleF(position.X, position.Y, extraSize.X, extraSize.Y));
                }

                var level      = spell.Level;
                var manaCast   = spell.ManaCost;
                var enoughMana = mana >= manaCast;
                var cooldown   = spell.Cooldown;

                if (cooldown > 0 || !enoughMana || level <= 0)
                {
                    var color = level <= 0 ? new Color(10, 10, 10, 210) : (enoughMana ? new Color(40, 40, 40, 180) : new Color(25, 25, 130, 190));
                    RendererManager.DrawFilledRectangle(new RectangleF(position.X + 1, position.Y, extraSize.X - 1, extraSize.Y), color, color, 0);
                }

                var notinvospell = heroId != HeroId.npc_dota_hero_invoker || (spell.AbilitySlot != AbilitySlot.Slot_4 && spell.AbilitySlot != AbilitySlot.Slot_5);
                if (notinvospell)
                {
                    var levelText = level.ToString();
                    var textSize  = RendererManager.MeasureText(levelText, extraSize.X / 2);

                    RendererManager.DrawFilledRectangle(new RectangleF(position.X + 1, position.Y, textSize.X + 2, textSize.Y + 1), Color.Zero, new Color(0, 0, 0, 220), 0);
                    RendererManager.DrawText(levelText, new Vector2(position.X + 1, position.Y), new Color(168, 168, 168), extraSize.X / 2);
                }

                if (cooldown > 0)
                {
                    var cooldownText = (cooldown > 1 ? Math.Min(Math.Ceiling(cooldown), 99) : Math.Round(cooldown, 1)).ToString();
                    var cooldownSize = extraSize.X / 2 + 3;
                    var textSize     = RendererManager.MeasureText(cooldownText, cooldownSize);

                    RendererManager.DrawText(cooldownText, position + new Vector2(extraSize.X / 2 - textSize.X / 2, (extraSize.Y / 2) - (textSize.Y / 2)), Color.WhiteSmoke, cooldownSize);
                }

                if (!enoughMana && cooldown <= 0)
                {
                    var manaText = Math.Min(Math.Ceiling(manaCast - mana), 999).ToString(CultureInfo.InvariantCulture);
                    var textSize = RendererManager.MeasureText(manaText, extraSize.X / 2 + 1);

                    Vector2 pos;
                    if (!notinvospell)
                    {
                        pos = position + new Vector2(extraSize.X / 2 - textSize.X / 2, (float)((extraSize.Y / 1.5) - (textSize.Y / 2)));
                    }
                    else
                    {
                        pos = position + new Vector2((float)(extraSize.X / 1.5 - textSize.X / 2), (float)((extraSize.Y / 1.5) - (textSize.Y / 2)));
                    }

                    RendererManager.DrawText(manaText, pos, Color.LightBlue, extraSize.X / 2 + 1);
                }

                RendererManager.DrawRectangle(new RectangleF(position.X, position.Y, extraSize.X + 1, extraSize.Y), Color.Black, 1);

                position += new Vector2(extraSize.X, 0);
            }
        }
示例#25
0
 protected abstract void OverlaySpells(IEnumerable <Ability> spells, Vector2 position, HeroId heroId, float mana, Vector2 extraSize);
示例#26
0
文件: HeroAttribute.cs 项目: Mej0/a
 public HeroAttribute(HeroId id)
 {
     Id = id;
 }