protected BasicCombatClass(AmeisenBotStateMachine stateMachine) { WowInterface = WowInterface.I; StateMachine = stateMachine; Configureables = new Dictionary <string, dynamic>() { { "HealingItemHealthThreshold", 30.0 }, { "HealingItemManaThreshold", 30.0 } }; CooldownManager = new CooldownManager(WowInterface.CharacterManager.SpellBook.Spells); RessurrectionTargets = new Dictionary <string, DateTime>(); TargetManagerDps = new TargetManager(new DpsTargetSelectionLogic(), TimeSpan.FromMilliseconds(250)); TargetManagerTank = new TargetManager(new TankTargetSelectionLogic(), TimeSpan.FromMilliseconds(250)); TargetManagerHeal = new TargetManager(new HealTargetSelectionLogic(), TimeSpan.FromMilliseconds(250)); MyAuraManager = new AuraManager(() => WowInterface.ObjectManager.Player?.Auras); TargetAuraManager = new AuraManager(() => WowInterface.ObjectManager.Target?.Auras); GroupAuraManager = new GroupAuraManager(WowInterface); TargetInterruptManager = new InterruptManager(new List <WowUnit>() { WowInterface.ObjectManager.Target }, null); EventCheckFacing = new TimegatedEvent(TimeSpan.FromMilliseconds(500)); EventAutoAttack = new TimegatedEvent(TimeSpan.FromMilliseconds(500)); }
protected override void LoadContent() { base.LoadContent(); Client.Load(); const int TEXTURE_WIDTH = 32; const int TEXTURE_HEIGHT = 2048; uint[] buffer = new uint[TEXTURE_WIDTH * TEXTURE_HEIGHT * 2]; HuesLoader.Instance.CreateShaderColors(buffer); _hueSamplers[0] = new Texture2D(GraphicsDevice, TEXTURE_WIDTH, TEXTURE_HEIGHT); _hueSamplers[0].SetData(buffer, 0, TEXTURE_WIDTH * TEXTURE_HEIGHT); _hueSamplers[1] = new Texture2D(GraphicsDevice, TEXTURE_WIDTH, TEXTURE_HEIGHT); _hueSamplers[1].SetData(buffer, TEXTURE_WIDTH * TEXTURE_HEIGHT, TEXTURE_WIDTH * TEXTURE_HEIGHT); GraphicsDevice.Textures[1] = _hueSamplers[0]; GraphicsDevice.Textures[2] = _hueSamplers[1]; AuraManager.CreateAuraTexture(); UIManager.InitializeGameCursor(); AnimatedStaticsManager.Initialize(); SetScene(new LoginScene()); SetWindowPositionBySettings(); }
protected BasicCombatClass(WowInterface wowInterface, AmeisenBotFsm stateMachine) { WowInterface = wowInterface; StateMachine = stateMachine; C = new Dictionary <string, dynamic>() { { "HealingItemHealthThreshold", 30.0 }, { "HealingItemManaThreshold", 30.0 } }; CooldownManager = new CooldownManager(WowInterface.CharacterManager.SpellBook.Spells); RessurrectionTargets = new Dictionary <string, DateTime>(); TargetManagerDps = new TargetManager(new DpsTargetSelectionLogic(wowInterface), TimeSpan.FromMilliseconds(250)); TargetManagerTank = new TargetManager(new TankTargetSelectionLogic(wowInterface), TimeSpan.FromMilliseconds(250)); TargetManagerHeal = new TargetManager(new HealTargetSelectionLogic(wowInterface), TimeSpan.FromMilliseconds(250)); MyAuraManager = new AuraManager(wowInterface); TargetAuraManager = new AuraManager(wowInterface); GroupAuraManager = new GroupAuraManager(wowInterface); TargetInterruptManager = new InterruptManager(); EventCheckFacing = new(TimeSpan.FromMilliseconds(500)); EventAutoAttack = new(TimeSpan.FromMilliseconds(500)); }
public override void UnloadContent() { SDL.SDL_GetWindowBordersSize(Window.Handle, out int top, out int left, out int bottom, out int right); Settings.GlobalSettings.WindowPosition = new Point(Math.Max(0, Window.ClientBounds.X - left), Math.Max(0, Window.ClientBounds.Y - top)); Settings.GlobalSettings.Save(); Plugin.OnClosing(); _hues_sampler[0]?.Dispose(); _hues_sampler[0] = null; _hues_sampler[1]?.Dispose(); _hues_sampler[1] = null; _scene?.Dispose(); AuraManager.Dispose(); UIManager.Dispose(); Texture2DCache.Dispose(); //NOTE: We force the sockets to disconnect in case they haven't already been disposed //This is good practice since the Client can be quit while the socket is still active if (NetClient.LoginSocket.IsDisposed == false) { NetClient.LoginSocket.Disconnect(); } if (NetClient.Socket.IsDisposed == false) { NetClient.Socket.Disconnect(); } base.UnloadContent(); }
protected override void LoadContent() { Client.Load(); uint[] hues = HuesLoader.Instance.CreateShaderColors(); int size = HuesLoader.Instance.HuesCount; Texture2D texture0 = new Texture2D(GraphicsDevice, 32, size * 2); texture0.SetData(hues, 0, size * 2); Texture2D texture1 = new Texture2D(GraphicsDevice, 32, size); texture1.SetData(hues, size, size); GraphicsDevice.Textures[1] = texture0; GraphicsDevice.Textures[2] = texture1; AuraManager.CreateAuraTexture(); UIManager.InitializeGameCursor(); base.LoadContent(); SetScene(new LoginScene()); SetWindowPositionBySettings(); }
private void Awake() { if (instance != null) { Debug.Log("Il y a plus d'une instance de WeaponSwitch dans la scene!"); return; } instance = this; }
public override void UnloadContent() { SDL.SDL_GetWindowBordersSize(Window.Handle, out int top, out int left, out int bottom, out int right); Settings.GlobalSettings.WindowPosition = new Point(Math.Max(0, Window.ClientBounds.X - left), Math.Max(0, Window.ClientBounds.Y - top)); _scene?.Unload(); Settings.GlobalSettings.Save(); Plugin.OnClosing(); ArtLoader.Instance.Dispose(); GumpsLoader.Instance.Dispose(); TexmapsLoader.Instance.Dispose(); AnimationsLoader.Instance.Dispose(); LightsLoader.Instance.Dispose(); TileDataLoader.Instance.Dispose(); AnimDataLoader.Instance.Dispose(); ClilocLoader.Instance.Dispose(); FontsLoader.Instance.Dispose(); HuesLoader.Instance.Dispose(); MapLoader.Instance.Dispose(); MultiLoader.Instance.Dispose(); MultiMapLoader.Instance.Dispose(); ProfessionLoader.Instance.Dispose(); SkillsLoader.Instance.Dispose(); SoundsLoader.Instance.Dispose(); SpeechesLoader.Instance.Dispose(); Verdata.File?.Dispose(); World.Map?.Destroy(); //NOTE: My dispose related changes, see if they're still necessary _hues_sampler[0]?.Dispose(); _hues_sampler[0] = null; _hues_sampler[1]?.Dispose(); _hues_sampler[1] = null; _scene?.Dispose(); AuraManager.Dispose(); UIManager.Dispose(); Texture2DCache.Dispose(); RenderedText.Dispose(); //NOTE: We force the sockets to disconnect in case they haven't already been disposed //This is good practice since the Client can be quit while the socket is still active if (NetClient.LoginSocket.IsDisposed == false) { NetClient.LoginSocket.Disconnect(); } if (NetClient.Socket.IsDisposed == false) { NetClient.Socket.Disconnect(); } base.UnloadContent(); }
/// <summary> Validates the existence of an engine auras component.</summary> protected virtual bool GetAurasComponent <T>() where T : AuraManager { if (_auraManager == null) { _auraManager = GetComponentInParent <T>(); if (_auraManager == null) { Debug.LogWarning(string.Format("{0} could not find an auras component of type {1}. Aura will not be applied.", name, typeof(T).Name)); EndEffect(); return(false); } } return(true); }
protected override void LoadContent() { base.LoadContent(); Client.Load(); const int TEXTURE_WIDHT = 32; const int TEXTURE_HEIGHT = 2048 * 1; uint[] buffer = new uint[TEXTURE_WIDHT * TEXTURE_HEIGHT * 2]; HuesLoader.Instance.CreateShaderColors(buffer); _hues_sampler[0] = new Texture2D( GraphicsDevice, TEXTURE_WIDHT, TEXTURE_HEIGHT); _hues_sampler[0].SetData(buffer, 0, TEXTURE_WIDHT * TEXTURE_HEIGHT, true); _hues_sampler[1] = new Texture2D( GraphicsDevice, TEXTURE_WIDHT, TEXTURE_HEIGHT); _hues_sampler[1].SetData(buffer, TEXTURE_WIDHT * TEXTURE_HEIGHT, TEXTURE_WIDHT * TEXTURE_HEIGHT, true); GraphicsDevice.Textures[1] = _hues_sampler[0]; GraphicsDevice.Textures[2] = _hues_sampler[1]; GraphicsDevice.Textures[1].UnityTexture.filterMode = UnityEngine.FilterMode.Point; GraphicsDevice.Textures[2].UnityTexture.filterMode = UnityEngine.FilterMode.Point; // File.WriteAllBytes(Path.Combine(UnityEngine.Application.persistentDataPath, "hue1.png"), UnityEngine.ImageConversion.EncodeToPNG(_hues_sampler[0].UnityTexture as UnityEngine.Texture2D)); // File.WriteAllBytes(Path.Combine(UnityEngine.Application.persistentDataPath, "hue2.png"), UnityEngine.ImageConversion.EncodeToPNG(_hues_sampler[1].UnityTexture as UnityEngine.Texture2D)); AuraManager.CreateAuraTexture(); UIManager.InitializeGameCursor(); AnimatedStaticsManager.Initialize(); SetScene(new LoginScene()); SetWindowPositionBySettings(); }
public override void UnloadContent() { SDL.SDL_GetWindowBordersSize(Window.Handle, out int top, out int left, out int bottom, out int right); Settings.GlobalSettings.WindowPosition = new Point(Math.Max(0, Window.ClientBounds.X - left), Math.Max(0, Window.ClientBounds.Y - top)); Settings.GlobalSettings.Save(); Plugin.OnClosing(); _hues_sampler[0]?.Dispose(); _hues_sampler[0] = null; _hues_sampler[1]?.Dispose(); _hues_sampler[1] = null; _scene?.Dispose(); AuraManager.Dispose(); UIManager.Dispose(); Texture2DCache.Dispose(); base.UnloadContent(); }
protected BasicCombatClassBia10(AmeisenBotInterfaces bot) { Bot = bot; SpellAbortFunctions = new List <Func <bool> >(); ResurrectionTargets = new Dictionary <string, DateTime>(); CooldownManager = new CooldownManager(Bot.Character.SpellBook.Spells); InterruptManager = new InterruptManager(); MyAuraManager = new AuraManager(Bot); TargetAuraManager = new AuraManager(Bot); GroupAuraManager = new GroupAuraManager(Bot); EventCheckFacing = new TimegatedEvent(TimeSpan.FromMilliseconds(500)); Configureables = new Dictionary <string, dynamic> { { "HealthItemThreshold", 30.0 }, { "ManaItemThreshold", 30.0 } }; }
protected override void LoadContent() { base.LoadContent(); Client.Load(); uint[] buffer = new uint[32 * 3000 * 2]; HuesLoader.Instance.CreateShaderColors(buffer); _hues_sampler[0] = new Texture2D( GraphicsDevice, 32, 3000); _hues_sampler[0].SetData(buffer, 0, buffer.Length / 2); _hues_sampler[1] = new Texture2D( GraphicsDevice, 32, 3000); _hues_sampler[1].SetData(buffer, (buffer.Length / 2) - 1, buffer.Length / 2); GraphicsDevice.Textures[1] = _hues_sampler[0]; GraphicsDevice.Textures[2] = _hues_sampler[1]; // File.WriteAllBytes(Path.Combine(UnityEngine.Application.persistentDataPath, "hue1.png"), UnityEngine.ImageConversion.EncodeToPNG(_hues_sampler[0].UnityTexture as UnityEngine.Texture2D)); // File.WriteAllBytes(Path.Combine(UnityEngine.Application.persistentDataPath, "hue2.png"), UnityEngine.ImageConversion.EncodeToPNG(_hues_sampler[1].UnityTexture as UnityEngine.Texture2D)); AuraManager.CreateAuraTexture(); UIManager.InitializeGameCursor(); SetScene(new LoginScene()); SetWindowPositionBySettings(); }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY, float depth) { if (IsDestroyed || !AllowedToDraw) { return(false); } bool charSitting = false; ushort overridedHue = 0; AnimationsLoader.SittingInfoData seatData = AnimationsLoader.SittingInfoData.Empty; _equipConvData = null; FrameInfo.X = 0; FrameInfo.Y = 0; FrameInfo.Width = 0; FrameInfo.Height = 0; posY -= 3; int drawX = posX + (int)Offset.X; int drawY = posY + (int)(Offset.Y - Offset.Z); drawX += 22; drawY += 22; bool hasShadow = !IsDead && !IsHidden && ProfileManager.CurrentProfile.ShadowsEnabled; if (AuraManager.IsEnabled) { AuraManager.Draw ( batcher, drawX, drawY, ProfileManager.CurrentProfile.PartyAura && World.Party.Contains(this) ? ProfileManager.CurrentProfile.PartyAuraHue : Notoriety.GetHue(NotorietyFlag), depth + 1f ); } bool isHuman = IsHuman; bool isGargoyle = Client.Version >= ClientVersion.CV_7000 && (Graphic == 666 || Graphic == 667 || Graphic == 0x02B7 || Graphic == 0x02B6); Vector3 hueVec = ShaderHueTranslator.GetHueVector(0, false, AlphaHue / 255f); if (ProfileManager.CurrentProfile.HighlightGameObjects && ReferenceEquals(SelectedObject.LastObject, this)) { overridedHue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; hueVec.Y = 1; } else if (SelectedObject.HealthbarObject == this) { overridedHue = Notoriety.GetHue(NotorietyFlag); } else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { overridedHue = Constants.OUT_RANGE_COLOR; hueVec.Y = 1; } else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect) { overridedHue = Constants.DEAD_RANGE_COLOR; hueVec.Y = 1; } else if (IsHidden) { overridedHue = 0x038E; } else { overridedHue = 0; if (IsDead) { if (!isHuman) { overridedHue = 0x0386; } } else { if (ProfileManager.CurrentProfile.HighlightMobilesByPoisoned) { if (IsPoisoned) { overridedHue = ProfileManager.CurrentProfile.PoisonHue; } } if (ProfileManager.CurrentProfile.HighlightMobilesByParalize) { if (IsParalyzed && NotorietyFlag != NotorietyFlag.Invulnerable) { overridedHue = ProfileManager.CurrentProfile.ParalyzedHue; } } if (ProfileManager.CurrentProfile.HighlightMobilesByInvul) { if (NotorietyFlag != NotorietyFlag.Invulnerable && IsYellowHits) { overridedHue = ProfileManager.CurrentProfile.InvulnerableHue; } } } } bool isAttack = Serial == TargetManager.LastAttack; bool isUnderMouse = TargetManager.IsTargeting && ReferenceEquals(SelectedObject.LastObject, this); if (Serial != World.Player.Serial) { if (isAttack || isUnderMouse) { overridedHue = Notoriety.GetHue(NotorietyFlag); } } ProcessSteps(out byte dir); byte layerDir = dir; AnimationsLoader.Instance.GetAnimDirection(ref dir, ref IsFlipped); ushort graphic = GetGraphicForAnimation(); byte animGroup = GetGroupForAnimation(this, graphic, true); byte animIndex = AnimIndex; Item mount = FindItemByLayer(Layer.Mount); sbyte mountOffsetY = 0; if (isHuman && mount != null && mount.Graphic != 0x3E96) { ushort mountGraphic = mount.GetGraphicForAnimation(); byte animGroupMount = 0; if (mountGraphic != 0xFFFF && mountGraphic < Constants.MAX_ANIMATIONS_DATA_INDEX_COUNT) { mountOffsetY = AnimationsLoader.Instance.DataIndex[mountGraphic].MountedHeightOffset; if (hasShadow) { DrawInternal ( batcher, this, null, drawX, drawY + 10, hueVec, IsFlipped, animIndex, true, graphic, animGroup, dir, isHuman, true, false, false, depth, mountOffsetY, overridedHue, charSitting ); animGroupMount = GetGroupForAnimation(this, mountGraphic); DrawInternal ( batcher, this, mount, drawX, drawY, hueVec, IsFlipped, animIndex, true, mountGraphic, animGroupMount, dir, isHuman, true, false, false, depth, mountOffsetY, overridedHue, charSitting ); } else { animGroupMount = GetGroupForAnimation(this, mountGraphic); } DrawInternal ( batcher, this, mount, drawX, drawY, hueVec, IsFlipped, animIndex, false, mountGraphic, animGroupMount, dir, isHuman, true, true, false, depth, mountOffsetY, overridedHue, charSitting ); drawY += mountOffsetY; } } else { if (TryGetSittingInfo(out seatData)) { animGroup = (byte)PEOPLE_ANIMATION_GROUP.PAG_STAND; animIndex = 0; ProcessSteps(out dir); AnimationsLoader.Instance.FixSittingDirection ( ref dir, ref IsFlipped, ref drawX, ref drawY, ref seatData ); drawY += SIT_OFFSET_Y; if (dir == 3) { if (IsGargoyle) { drawY -= 30 - SIT_OFFSET_Y; animGroup = 42; } else { animGroup = 25; } } else if (IsGargoyle) { animGroup = 42; } else { charSitting = true; } } else if (hasShadow) { DrawInternal ( batcher, this, null, drawX, drawY, hueVec, IsFlipped, animIndex, true, graphic, animGroup, dir, isHuman, true, false, false, depth, mountOffsetY, overridedHue, charSitting ); } } DrawInternal ( batcher, this, null, drawX, drawY, hueVec, IsFlipped, animIndex, false, graphic, animGroup, dir, isHuman, true, false, isGargoyle, depth, mountOffsetY, overridedHue, charSitting ); if (!IsEmpty) { for (int i = 0; i < Constants.USED_LAYER_COUNT; i++) { Layer layer = LayerOrder.UsedLayers[layerDir, i]; Item item = FindItemByLayer(layer); if (item == null) { continue; } if (IsDead && (layer == Layer.Hair || layer == Layer.Beard)) { continue; } if (isHuman) { if (IsCovered(this, layer)) { continue; } if (item.ItemData.AnimID != 0) { graphic = item.ItemData.AnimID; if (isGargoyle) { FixGargoyleEquipments(ref graphic); } if (AnimationsLoader.Instance.EquipConversions.TryGetValue(Graphic, out Dictionary <ushort, EquipConvData> map)) { if (map.TryGetValue(item.ItemData.AnimID, out EquipConvData data)) { _equipConvData = data; graphic = data.Graphic; } } DrawInternal ( batcher, this, item, drawX, drawY, hueVec, IsFlipped, animIndex, false, graphic, isGargoyle /*&& item.ItemData.IsWeapon*/ && seatData.Graphic == 0 ? GetGroupForAnimation(this, graphic, true) : animGroup, dir, isHuman, false, false, isGargoyle, depth, mountOffsetY, overridedHue, charSitting ); } else { if (item.ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(this, item, drawX, drawY); } } _equipConvData = null; } else { if (item.ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(this, item, drawX, drawY); /*DrawInternal * ( * batcher, * this, * item, * drawX, * drawY, * IsFlipped, * animIndex, * false, * graphic, * animGroup, * dir, * isHuman, * false, * alpha: HueVector.Z * ); */ //break; } } } } //if (FileManager.Animations.SittingValue != 0) //{ // ref var sittingData = ref FileManager.Animations.SittingInfos[FileManager.Animations.SittingValue - 1]; // if (FileManager.Animations.Direction == 3 && sittingData.DrawBack && // HasEquipment && Equipment[(int) Layer.Cloak] == null) // { // } //} // FrameInfo.X = Math.Abs(FrameInfo.X); FrameInfo.Y = Math.Abs(FrameInfo.Y); FrameInfo.Width = FrameInfo.X + FrameInfo.Width; FrameInfo.Height = FrameInfo.Y + FrameInfo.Height; return(true); }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { _equipConvData = null; _transform = false; AnimationsLoader.Instance.SittingValue = 0; FrameInfo.X = 0; FrameInfo.Y = 0; FrameInfo.Width = 0; FrameInfo.Height = 0; posY -= 3; int drawX = posX + (int)Offset.X; int drawY = posY + (int)(Offset.Y - Offset.Z); drawX += 22; drawY += 22; bool hasShadow = !IsDead && !IsHidden && ProfileManager.Current.ShadowsEnabled; if (AuraManager.IsEnabled) { AuraManager.Draw(batcher, drawX, drawY, ProfileManager.Current.PartyAura && World.Party.Contains(this) ? ProfileManager.Current.PartyAuraHue : Notoriety.GetHue(NotorietyFlag)); } bool isHuman = IsHuman; bool isGargoyle = Client.Version >= ClientVersion.CV_7000 && (Graphic == 666 || Graphic == 667 || Graphic == 0x02B7 || Graphic == 0x02B6); if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this) { _viewHue = 0x0023; HueVector.Y = 1; } else if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { _viewHue = Constants.OUT_RANGE_COLOR; HueVector.Y = 1; } else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect) { _viewHue = Constants.DEAD_RANGE_COLOR; HueVector.Y = 1; } else if (IsHidden) { _viewHue = 0x038E; } else if (SelectedObject.HealthbarObject == this) { _viewHue = Notoriety.GetHue(NotorietyFlag); } else { _viewHue = 0; if (IsDead) { if (!isHuman) { _viewHue = 0x0386; } } else if (ProfileManager.Current.HighlightMobilesByFlags) { if (IsPoisoned) { _viewHue = ProfileManager.Current.PoisonHue; } if (IsParalyzed) { _viewHue = ProfileManager.Current.ParalyzedHue; } if (NotorietyFlag != NotorietyFlag.Invulnerable && IsYellowHits) { _viewHue = ProfileManager.Current.InvulnerableHue; } } } bool isAttack = Serial == TargetManager.LastAttack; bool isUnderMouse = TargetManager.IsTargeting && SelectedObject.LastObject == this; //bool needHpLine = false; if (this != World.Player) { if (isAttack || isUnderMouse) { _viewHue = Notoriety.GetHue(NotorietyFlag); } //if (this == TargetManager.LastTarget) //{ // UIManager.SetTargetLineGump(this); // //needHpLine = true; //} } ProcessSteps(out byte dir); byte layerDir = dir; AnimationsLoader.Instance.GetAnimDirection(ref dir, ref IsFlipped); ushort graphic = GetGraphicForAnimation(); byte animGroup = GetGroupForAnimation(this, graphic, true); sbyte animIndex = AnimIndex; AnimationsLoader.Instance.Direction = dir; AnimationsLoader.Instance.AnimGroup = animGroup; Item mount = FindItemByLayer(Layer.Mount); if (isHuman && mount != null) { AnimationsLoader.Instance.SittingValue = 0; ushort mountGraphic = mount.GetGraphicForAnimation(); if (mountGraphic != 0xFFFF) { if (hasShadow) { DrawInternal(batcher, this, null, drawX, drawY + 10, IsFlipped, ref animIndex, true, graphic, isHuman); AnimationsLoader.Instance.AnimGroup = GetGroupForAnimation(this, mountGraphic); DrawInternal(batcher, this, mount, drawX, drawY, IsFlipped, ref animIndex, true, mountGraphic, isHuman); } else { AnimationsLoader.Instance.AnimGroup = GetGroupForAnimation(this, mountGraphic); } drawY += DrawInternal(batcher, this, mount, drawX, drawY, IsFlipped, ref animIndex, false, mountGraphic, isHuman, isMount: true); } } else { if ((AnimationsLoader.Instance.SittingValue = IsSitting()) != 0) { animGroup = (byte)PEOPLE_ANIMATION_GROUP.PAG_STAND; animIndex = 0; ProcessSteps(out dir); AnimationsLoader.Instance.Direction = dir; AnimationsLoader.Instance.FixSittingDirection(ref dir, ref IsFlipped, ref drawX, ref drawY); if (AnimationsLoader.Instance.Direction == 3) { if (IsGargoyle) { drawY -= 30; animGroup = 42; } else { animGroup = 25; } } else if (IsGargoyle) { animGroup = 42; } else { _transform = true; } } else if (hasShadow) { DrawInternal(batcher, this, null, drawX, drawY, IsFlipped, ref animIndex, true, graphic, isHuman); } } AnimationsLoader.Instance.AnimGroup = animGroup; DrawInternal(batcher, this, null, drawX, drawY, IsFlipped, ref animIndex, false, graphic, isHuman); for (int i = 0; i < Constants.USED_LAYER_COUNT; i++) { Layer layer = LayerOrder.UsedLayers[layerDir, i]; Item item = FindItemByLayer(layer); if (item == null) { continue; } if (IsDead && (layer == Layer.Hair || layer == Layer.Beard)) { continue; } if (isHuman) { if (IsCovered(this, layer)) { continue; } if (item.ItemData.AnimID != 0) { graphic = item.ItemData.AnimID; if (isGargoyle) { if (graphic == 469) { // gargoyle robe graphic = 342; } else if (graphic == 0x03CA) { // gargoyle dead shroud graphic = 0x0223; } } if (AnimationsLoader.Instance.EquipConversions.TryGetValue(Graphic, out Dictionary <ushort, EquipConvData> map)) { if (map.TryGetValue(item.ItemData.AnimID, out EquipConvData data)) { _equipConvData = data; graphic = data.Graphic; } } if (AnimationsLoader.Instance.SittingValue == 0 && IsGargoyle && item.ItemData.IsWeapon) { AnimationsLoader.Instance.AnimGroup = GetGroupForAnimation(this, graphic); DrawInternal(batcher, this, item, drawX, drawY, IsFlipped, ref animIndex, false, graphic, isHuman, false); AnimationsLoader.Instance.AnimGroup = animGroup; } else { DrawInternal(batcher, this, item, drawX, drawY, IsFlipped, ref animIndex, false, graphic, isHuman, false); } } else { if (item.ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(this, this, drawX, drawY); } } _equipConvData = null; } else { if (item.ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(this, this, drawX, drawY); break; } } } //if (FileManager.Animations.SittingValue != 0) //{ // ref var sittingData = ref FileManager.Animations.SittingInfos[FileManager.Animations.SittingValue - 1]; // if (FileManager.Animations.Direction == 3 && sittingData.DrawBack && // HasEquipment && Equipment[(int) Layer.Cloak] == null) // { // } //} // FrameInfo.X = Math.Abs(FrameInfo.X); FrameInfo.Y = Math.Abs(FrameInfo.Y); FrameInfo.Width = FrameInfo.X + FrameInfo.Width; FrameInfo.Height = FrameInfo.Y + FrameInfo.Height; return(true); }
protected BasicCombatClass(WowInterface wowInterface, AmeisenBotStateMachine stateMachine) { WowInterface = wowInterface; StateMachine = stateMachine; CooldownManager = new CooldownManager(WowInterface.CharacterManager.SpellBook.Spells); RessurrectionTargets = new Dictionary <string, DateTime>(); ITargetSelectionLogic targetSelectionLogic = Role switch { CombatClassRole.Dps => targetSelectionLogic = new DpsTargetSelectionLogic(wowInterface), CombatClassRole.Heal => targetSelectionLogic = new HealTargetSelectionLogic(wowInterface), CombatClassRole.Tank => targetSelectionLogic = new TankTargetSelectionLogic(wowInterface), _ => null, }; TargetManager = new TargetManager(targetSelectionLogic, TimeSpan.FromMilliseconds(250)); Spells = new Dictionary <string, Spell>(); WowInterface.CharacterManager.SpellBook.OnSpellBookUpdate += () => { Spells.Clear(); foreach (Spell spell in WowInterface.CharacterManager.SpellBook.Spells.OrderBy(e => e.Rank).GroupBy(e => e.Name).Select(e => e.First())) { if (!Spells.ContainsKey(spell.Name)) { Spells.Add(spell.Name, spell); } } }; MyAuraManager = new AuraManager ( null, null, TimeSpan.FromSeconds(1), () => { if (WowInterface.ObjectManager.Player != null) { return(WowInterface.ObjectManager.Player.Auras.Select(e => e.Name).ToList()); } else { return(null); } }, () => { if (WowInterface.ObjectManager.Player != null) { return(WowInterface.ObjectManager.Player.Auras.Select(e => e.Name).ToList()); } else { return(null); } }, null, DispellDebuffsFunction ); TargetAuraManager = new AuraManager ( null, null, TimeSpan.FromSeconds(1), () => { if (WowInterface.ObjectManager.Target != null) { return(WowInterface.ObjectManager.Target.Auras.Select(e => e.Name).ToList()); } else { return(null); } }, () => { if (WowInterface.ObjectManager.Target != null) { return(WowInterface.ObjectManager.Target.Auras.Select(e => e.Name).ToList()); } else { return(null); } }, DispellBuffsFunction, null ); GroupAuraManager = new GroupAuraManager(WowInterface); TargetInterruptManager = new InterruptManager(new List <WowUnit>() { WowInterface.ObjectManager.Target }, null); ActionEvent = new TimegatedEvent(TimeSpan.FromMilliseconds(50)); NearInterruptUnitsEvent = new TimegatedEvent(TimeSpan.FromMilliseconds(250)); UpdatePriorityUnits = new TimegatedEvent(TimeSpan.FromMilliseconds(1000)); WalkBehindEnemy = false; }
void Start () { AuraManager.Instance = this; }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { ResetHueVector(); int sittigIndex = 0; _equipConvData = null; _transform = false; FrameInfo.X = 0; FrameInfo.Y = 0; FrameInfo.Width = 0; FrameInfo.Height = 0; posY -= 3; int drawX = posX + (int)Offset.X; int drawY = posY + (int)(Offset.Y - Offset.Z); drawX += 22; drawY += 22; bool hasShadow = !IsDead && !IsHidden && ProfileManager.CurrentProfile.ShadowsEnabled; if (AuraManager.IsEnabled) { AuraManager.Draw(batcher, drawX, drawY, ProfileManager.CurrentProfile.PartyAura && World.Party.Contains(this) ? ProfileManager.CurrentProfile.PartyAuraHue : Notoriety.GetHue(NotorietyFlag)); } bool isHuman = IsHuman; bool isGargoyle = Client.Version >= ClientVersion.CV_7000 && (Graphic == 666 || Graphic == 667 || Graphic == 0x02B7 || Graphic == 0x02B6); if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this) { _viewHue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; HueVector.Y = 1; } else if (SelectedObject.HealthbarObject == this) { _viewHue = Notoriety.GetHue(NotorietyFlag); } else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { _viewHue = Constants.OUT_RANGE_COLOR; HueVector.Y = 1; } else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect) { _viewHue = Constants.DEAD_RANGE_COLOR; HueVector.Y = 1; } else if (IsHidden) { _viewHue = 0x038E; } else { _viewHue = 0; if (IsDead) { if (!isHuman) { _viewHue = 0x0386; } } else if (ProfileManager.CurrentProfile.HighlightMobilesByFlags) { if (IsPoisoned) { _viewHue = ProfileManager.CurrentProfile.PoisonHue; } if (IsParalyzed) { _viewHue = ProfileManager.CurrentProfile.ParalyzedHue; } if (NotorietyFlag != NotorietyFlag.Invulnerable && IsYellowHits) { _viewHue = ProfileManager.CurrentProfile.InvulnerableHue; } } } bool isAttack = Serial == TargetManager.LastAttack; bool isUnderMouse = TargetManager.IsTargeting && SelectedObject.LastObject == this; if (Serial != World.Player.Serial) { if (isAttack || isUnderMouse) { _viewHue = Notoriety.GetHue(NotorietyFlag); } } ProcessSteps(out byte dir); byte layerDir = dir; AnimationsLoader.Instance.GetAnimDirection(ref dir, ref IsFlipped); ushort graphic = GetGraphicForAnimation(); byte animGroup = GetGroupForAnimation(this, graphic, true); sbyte animIndex = AnimIndex; Item mount = FindItemByLayer(Layer.Mount); if (isHuman && mount != null) { ushort mountGraphic = mount.GetGraphicForAnimation(); byte animGroupMount = 0; if (mountGraphic != 0xFFFF) { if (hasShadow) { DrawInternal ( batcher, this, null, drawX, drawY + 10, IsFlipped, animIndex, true, graphic, animGroup, dir, isHuman, alpha: HueVector.Z ); animGroupMount = GetGroupForAnimation(this, mountGraphic); DrawInternal ( batcher, this, mount, drawX, drawY, IsFlipped, animIndex, true, mountGraphic, animGroupMount, dir, isHuman, alpha: HueVector.Z ); } else { animGroupMount = GetGroupForAnimation(this, mountGraphic); } drawY += DrawInternal ( batcher, this, mount, drawX, drawY, IsFlipped, animIndex, false, mountGraphic, animGroupMount, dir, isHuman, isMount: true, alpha: HueVector.Z ); } } else { if ((sittigIndex = IsSitting()) != 0) { animGroup = (byte)PEOPLE_ANIMATION_GROUP.PAG_STAND; animIndex = 0; ProcessSteps(out dir); AnimationsLoader.Instance.FixSittingDirection ( ref dir, ref IsFlipped, ref drawX, ref drawY, sittigIndex ); drawY += SIT_OFFSET_Y; if (dir == 3) { if (IsGargoyle) { drawY -= 30 - SIT_OFFSET_Y; animGroup = 42; } else { animGroup = 25; } } else if (IsGargoyle) { animGroup = 42; } else { _transform = true; } } else if (hasShadow) { DrawInternal ( batcher, this, null, drawX, drawY, IsFlipped, animIndex, true, graphic, animGroup, dir, isHuman, alpha: HueVector.Z ); } } DrawInternal ( batcher, this, null, drawX, drawY, IsFlipped, animIndex, false, graphic, animGroup, dir, isHuman, alpha: HueVector.Z, forceUOP: isGargoyle ); if (!IsEmpty) { for (int i = 0; i < Constants.USED_LAYER_COUNT; i++) { Layer layer = LayerOrder.UsedLayers[layerDir, i]; Item item = FindItemByLayer(layer); if (item == null) { continue; } if (IsDead && (layer == Layer.Hair || layer == Layer.Beard)) { continue; } if (isHuman) { if (IsCovered(this, layer)) { continue; } if (item.ItemData.AnimID != 0) { graphic = item.ItemData.AnimID; if (isGargoyle) { switch (graphic) { // gargoyle robe case 0x01D5: graphic = 0x0156; break; // gargoyle dead shroud case 0x03CA: graphic = 0x0223; break; // gargoyle spellbook case 0x03D8: graphic = 329; break; // gargoyle necrobook case 0x0372: graphic = 330; break; // gargoyle chivalry book case 0x0374: graphic = 328; break; // gargoyle bushido book case 0x036F: graphic = 327; break; // gargoyle ninjitsu book case 0x036E: graphic = 328; break; // gargoyle masteries book case 0x0426: graphic = 0x042B; break; // gargoyle mysticism book seems ok. Mha! } } if (AnimationsLoader.Instance.EquipConversions.TryGetValue(Graphic, out Dictionary <ushort, EquipConvData> map)) { if (map.TryGetValue(item.ItemData.AnimID, out EquipConvData data)) { _equipConvData = data; graphic = data.Graphic; } } // Seems like all Gargoyle equipment has the 'IsWeapon' flag if (sittigIndex == 0 && IsGargoyle /*&& item.ItemData.IsWeapon*/) { DrawInternal ( batcher, this, item, drawX, drawY, IsFlipped, animIndex, false, graphic, GetGroupForAnimation(this, graphic, true), dir, isHuman, true, alpha: HueVector.Z, forceUOP: true ); } else { DrawInternal ( batcher, this, item, drawX, drawY, IsFlipped, animIndex, //item.AnimIndex, false, graphic, animGroup, dir, isHuman, false, alpha: HueVector.Z ); } } else { if (item.ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(this, this, drawX, drawY); } } _equipConvData = null; } else { if (item.ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(this, this, drawX, drawY); /*DrawInternal * ( * batcher, * this, * item, * drawX, * drawY, * IsFlipped, * animIndex, * false, * graphic, * animGroup, * dir, * isHuman, * false, * alpha: HueVector.Z * ); */ //break; } } } } //if (FileManager.Animations.SittingValue != 0) //{ // ref var sittingData = ref FileManager.Animations.SittingInfos[FileManager.Animations.SittingValue - 1]; // if (FileManager.Animations.Direction == 3 && sittingData.DrawBack && // HasEquipment && Equipment[(int) Layer.Cloak] == null) // { // } //} // FrameInfo.X = Math.Abs(FrameInfo.X); FrameInfo.Y = Math.Abs(FrameInfo.Y); FrameInfo.Width = FrameInfo.X + FrameInfo.Width; FrameInfo.Height = FrameInfo.Y + FrameInfo.Height; return(true); }
public void LoadGameFilesFromFileSystem() { Log.Trace("Checking for Ultima Online installation..."); Log.PushIndent(); try { UOFileManager.UoFolderPath = Settings.GlobalSettings.UltimaOnlineDirectory; } catch (FileNotFoundException) { Log.Error("Wrong Ultima Online installation folder."); throw; } Log.Trace("Done!"); Log.Trace($"Ultima Online installation folder: {UOFileManager.UoFolderPath}"); Log.PopIndent(); Log.Trace("Loading files..."); Log.PushIndent(); UOFileManager.LoadFiles(); Log.PopIndent(); uint[] hues = UOFileManager.Hues.CreateShaderColors(); int size = UOFileManager.Hues.HuesCount; Texture2D texture0 = new Texture2D(GraphicsDevice, 32, size * 2); texture0.SetData(hues, 0, size * 2); Texture2D texture1 = new Texture2D(GraphicsDevice, 32, size); texture1.SetData(hues, size, size); GraphicsDevice.Textures[1] = texture0; GraphicsDevice.Textures[2] = texture1; AuraManager.CreateAuraTexture(); Log.Trace("Network calibration..."); Log.PushIndent(); PacketHandlers.Load(); //ATTENTION: you will need to enable ALSO ultimalive server-side, or this code will have absolutely no effect! UltimaLive.Enable(); PacketsTable.AdjustPacketSizeByVersion(UOFileManager.ClientVersion); Log.Trace("Done!"); Log.PopIndent(); Log.Trace("Loading plugins..."); Log.PushIndent(); UIManager.InitializeGameCursor(); foreach (var p in Settings.GlobalSettings.Plugins) { Plugin.Create(p); } Log.Trace("Done!"); Log.PopIndent(); UoAssist.Start(); }
protected BasicCombatClass(WowInterface wowInterface) { WowInterface = wowInterface; CooldownManager = new CooldownManager(WowInterface.CharacterManager.SpellBook.Spells); RessurrectionTargets = new Dictionary <string, DateTime>(); Spells = new Dictionary <string, Spell>(); WowInterface.CharacterManager.SpellBook.OnSpellBookUpdate += () => { Spells.Clear(); foreach (Spell spell in WowInterface.CharacterManager.SpellBook.Spells) { Spells.Add(spell.Name, spell); } }; MyAuraManager = new AuraManager( null, null, TimeSpan.FromSeconds(1), () => { if (WowInterface.ObjectManager.Player != null) { return(WowInterface.ObjectManager.Player.Auras.Select(e => e.Name).ToList()); } else { return(null); } }, () => { if (WowInterface.ObjectManager.Player != null) { return(WowInterface.ObjectManager.Player.Auras.Select(e => e.Name).ToList()); } else { return(null); } }, null, DispellDebuffsFunction); TargetAuraManager = new AuraManager( null, null, TimeSpan.FromSeconds(1), () => { if (WowInterface.ObjectManager.Target != null) { return(WowInterface.ObjectManager.Target.Auras.Select(e => e.Name).ToList()); } else { return(null); } }, () => { if (WowInterface.ObjectManager.Target != null) { return(WowInterface.ObjectManager.Target.Auras.Select(e => e.Name).ToList()); } else { return(null); } }, DispellBuffsFunction, null); TargetInterruptManager = new InterruptManager(WowInterface.ObjectManager.Target, null); }
// Use this for initialization void Start() { particleSys = transform.GetChild(0).gameObject; aura = transform.parent.gameObject.GetComponent<AuraManager>(); }
public void InitializeTileObject() { grid = GameObject.Find("Grid").GetComponent<LevelGrid>(); transform.parent = grid.gameObject.transform; List<GameObject> possibleSpawns = new List<GameObject>(); for(int i = 0; i < grid.spawnTiles.Count; i++) { GameObject tile = grid.spawnTiles[i].gameObject; for (int j = 0; j < tile.GetComponent<BasicTile>().spawnTags.Length; j++) { if (gameObject.CompareTag(tile.GetComponent<BasicTile>().spawnTags[j]) && !tile.GetComponent<BasicTile>().IsOccupied && tile.GetComponent<BasicTile>().IsSpawn) { possibleSpawns.Add(tile); } } } if (possibleSpawns.Count <= 0) { presentTile = null; print("No spawns!"); } else { presentTile = possibleSpawns[Random.Range(0, possibleSpawns.Count - 1)]; presentTile.GetComponent<BasicTile>().IsOccupied = true; presentTile.GetComponent<BasicTile>().CharacterStepping = this; nextTile = null; } if (gameObject.GetComponent<AuraManager>() != null) { aura = gameObject.GetComponent<AuraManager>(); } turnManager = GameObject.Find("AITurnManager").GetComponent<AITurnManager>(); animatedMesh = transform.GetChild(1).gameObject.GetComponent<Animator>(); isMoving = false; orientation = BasicTile.Orientation.Forward; movementPoints = maxMovementPoints; actionPoints = maxActionPoints; hP = maxHP; sanity = maxSanity; //UI // descriptionBox = gameObject.transform.FindChild("PlayerCanvas").FindChild("MouseOverText").GetComponent<Image>(); }