public static void SetTargeting(CursorTarget targeting, uint cursorID, TargetType cursorType) { if (targeting == CursorTarget.Invalid) { return; } TargetingState = targeting; _targetCursorId = cursorID; TargetingType = cursorType; // ## BEGIN - END ## // UOClassicCombatCollection.StartSpelltime(); // ## BEGIN - END ## // bool lastTargetting = IsTargeting; IsTargeting = cursorType < TargetType.Cancel; if (IsTargeting) { //UIManager.RemoveTargetLineGump(LastTarget); } else if (lastTargetting) { CancelTarget(); } }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (IsDestroyed || !AllowedToDraw) { return(false); } ResetHueVector(); // ## BEGIN - END ## // if (Graphic == 0x379F) //energy bolt { if (ProfileManager.CurrentProfile.EnergyBoltArtType != 0) { Graphic = UOClassicCombatCollection.EnergyBoltArt(Graphic); } if (ProfileManager.CurrentProfile.ColorEnergyBolt || ProfileManager.CurrentProfile.EnergyBoltNeonType != 0) { Hue = UOClassicCombatCollection.EnergyBoltHue(Hue); } } // ## BEGIN - END ## // ushort hue = Hue; if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { hue = Constants.OUT_RANGE_COLOR; } else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect) { hue = Constants.DEAD_RANGE_COLOR; } ShaderHueTranslator.GetHueVector(ref HueVector, hue); //Engine.DebugInfo.EffectsRendered++; if (FixedDir) { DrawStatic(batcher, AnimationGraphic, posX, posY, ref HueVector); } else { posX += (int)Offset.X; posY += (int)(Offset.Y + Offset.Z); DrawStaticRotated(batcher, AnimationGraphic, posX, posY, 0, 0, AngleToTarget, ref HueVector); } ref StaticTiles data = ref TileDataLoader.Instance.StaticData[AnimationGraphic];
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } ResetHueVector(); ushort hue = Hue; if (State != 0) { if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER) != 0) { return(false); } if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_INCORRECT_PLACE) != 0) { hue = 0x002B; } if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_TRANSPARENT) != 0) { if (AlphaHue >= 192) { AlphaHue = 0xFF; } else { ProcessAlpha(192); } } } ResetHueVector(); ushort graphic = Graphic; bool partial = ItemData.IsPartialHue; Profile currentProfile = ProfileManager.CurrentProfile; if (currentProfile.HighlightGameObjects && SelectedObject.LastObject == this) { hue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; partial = false; } else if (currentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { hue = Constants.OUT_RANGE_COLOR; partial = false; } else if (World.Player.IsDead && currentProfile.EnableBlackWhiteEffect) { hue = Constants.DEAD_RANGE_COLOR; partial = false; } ShaderHueTranslator.GetHueVector(ref HueVector, hue, partial, 0); //Engine.DebugInfo.MultiRendered++; // ## BEGIN - END ## // if (ProfileManager.CurrentProfile.HighlightTileAtRange && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRange) { HueVector.X = ProfileManager.CurrentProfile.HighlightTileRangeHue; HueVector.Y = 1; } if (ProfileManager.CurrentProfile.HighlightTileAtRangeSpell) { if (GameCursor._spellTime >= 1 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell) { HueVector.X = ProfileManager.CurrentProfile.HighlightTileRangeHueSpell; HueVector.Y = 1; } } if (ProfileManager.CurrentProfile.PreviewFields) { if (UOClassicCombatCollection.MultiFieldPreview(this)) { HueVector.X = 0x0040; HueVector.Y = 1; } if (SelectedObject.LastObject == this) { HueVector.X = 0x0023; HueVector.Y = 1; } } // ## BEGIN - END ## // if (IsHousePreview) { HueVector.Z = 0.5f; } posX += (int)Offset.X; posY += (int)(Offset.Y + Offset.Z); if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector, ref DrawTransparent, false); if (ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(this, this, posX + 22, posY + 22); } if (!(SelectedObject.Object == this || IsHousePreview || FoliageIndex != -1 && Client.Game.GetScene <GameScene>().FoliageIndex == FoliageIndex)) { if (State != 0) { if ((State & (CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER | CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_PREVIEW)) != 0) { return(true); } } if (DrawTransparent) { return(true); } ref UOFileIndex index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000); posX -= index.Width; posY -= index.Height; if (SelectedObject.IsPointInStatic(ArtLoader.Instance.GetTexture(graphic), posX, posY)) { SelectedObject.Object = this; } }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } //Engine.DebugInfo.LandsRendered++; ResetHueVector(); ushort hue = Hue; if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this) { hue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; } else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { hue = Constants.OUT_RANGE_COLOR; } else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect) { hue = Constants.DEAD_RANGE_COLOR; } if (hue != 0) { HueVector.X = hue - 1; HueVector.Y = IsStretched ? ShaderHueTranslator.SHADER_LAND_HUED : ShaderHueTranslator.SHADER_HUED; } else { HueVector.Y = IsStretched ? ShaderHueTranslator.SHADER_LAND : ShaderHueTranslator.SHADER_NONE; } // ## BEGIN - END ## // if (ProfileManager.CurrentProfile.HighlightTileAtRange && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRange) { HueVector.X = ProfileManager.CurrentProfile.HighlightTileRangeHue; HueVector.Y = 1; } if (ProfileManager.CurrentProfile.HighlightTileAtRangeSpell) { if (GameCursor._spellTime >= 1 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell) { HueVector.X = ProfileManager.CurrentProfile.HighlightTileRangeHueSpell; HueVector.Y = 1; } } if (ProfileManager.CurrentProfile.PreviewFields) { if (UOClassicCombatCollection.LandFieldPreview(this)) { HueVector.X = 0x0040; HueVector.Y = 1; } if (SelectedObject.LastObject == this) { HueVector.X = 0x0023; HueVector.Y = 1; } } if (ProfileManager.CurrentProfile != null && ProfileManager.CurrentProfile.HueImpassableView) { if (this.TileData.IsImpassable) { HueVector.X = ProfileManager.CurrentProfile.HueImpassableViewHue; HueVector.Y = 1; } } // ## BEGIN - END ## // if (IsStretched) { posY += Z << 2; // ## BEGIN - END ## // ORIG /* * DrawLand * ( * batcher, Graphic, posX, posY, ref Rectangle, ref Normal0, ref Normal1, ref Normal2, ref Normal3, * ref HueVector * ); */ // ## BEGIN - END ## // if (ProfileManager.CurrentProfile != null && ProfileManager.CurrentProfile.WireFrameView) { DrawLandWF ( batcher, Graphic, posX, posY, ref Rectangle, ref Normal0, ref Normal1, ref Normal2, ref Normal3, ref HueVector, this.TileData.IsImpassable ); } else { DrawLand ( batcher, Graphic, posX, posY, ref Rectangle, ref Normal0, ref Normal1, ref Normal2, ref Normal3, ref HueVector ); } // ## BEGIN - END ## // if (SelectedObject.IsPointInStretchedLand(ref Rectangle, posX, posY)) { SelectedObject.Object = this; } } else { // ## BEGIN - END ## // ORIG //DrawLand(batcher, Graphic, posX, posY, ref HueVector); // ## BEGIN - END ## // if (ProfileManager.CurrentProfile != null && ProfileManager.CurrentProfile.WireFrameView) { DrawLandWF(batcher, Graphic, posX, posY, ref HueVector, this.TileData.IsImpassable); } else { DrawLand(batcher, Graphic, posX, posY, ref HueVector); } // ## BEGIN - END ## // if (SelectedObject.IsPointInLand(posX, posY)) { SelectedObject.Object = this; } } return(true); }
// ## BEGIN - END ## // 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) { // ## BEGIN - END ## // if (this == World.Player && ProfileManager.CurrentProfile.OwnAuraByHP) { ushort color = UOClassicCombatCollection.OwnAuraColorByHP(); AuraManager.Draw(batcher, drawX, drawY, color); } else { // ## BEGIN - END ## // 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) { // ## BEGIN - END ## // ORIG //_viewHue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; //HueVector.Y = 1; // ## BEGIN - END ## // Item item = World.Items.Get(Serial); if (this == item) { _viewHue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; HueVector.Y = 1; } else { _viewHue = Notoriety.GetHue(NotorietyFlag); } // ## BEGIN - END ## // } 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); } } // ## BEGIN - END ## // if (ProfileManager.CurrentProfile.HighlightLastTargetType != 0 && World.Get(TargetManager.LastTargetInfo.Serial) == this) { _viewHue = UOClassicCombatCollection.LastTargetHue(this, _viewHue); HueVector.Y = 1; //if (this == TargetManager.LastTarget) //{ // UIManager.SetTargetLineGump(this); // //needHpLine = true; //} } if (ProfileManager.CurrentProfile.PreviewFields) { if (UOClassicCombatCollection.MobileFieldPreview(this)) { _viewHue = 0x0040; HueVector.Y = 1; } } // ## BEGIN - END ## // 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; // ## BEGIN - END ## // if (ProfileManager.CurrentProfile.GlowingWeaponsType != 0) { if (graphic >= 0x263 && graphic <= 0x28D) // all weps { item.Hue = UOClassicCombatCollection.WeaponsHue(item.Hue); } } // ## BEGIN - END ## // 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, 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); 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); }
private static sbyte DrawInternal ( UltimaBatcher2D batcher, Mobile owner, Item entity, int x, int y, bool mirror, sbyte frameIndex, bool hasShadow, ushort id, byte animGroup, byte dir, bool isHuman, bool isParent = true, bool isMount = false, bool forceUOP = false, float alpha = 0 ) { if (id >= Constants.MAX_ANIMATIONS_DATA_INDEX_COUNT || owner == null) { return(0); } ushort hueFromFile = _viewHue; AnimationDirection direction = AnimationsLoader.Instance.GetBodyAnimationGroup(ref id, ref animGroup, ref hueFromFile, isParent, forceUOP) .Direction[dir]; if (direction == null || direction.Address == -1 || direction.FileIndex == -1) { if (!(_transform && entity == null && !hasShadow)) { return(0); } } if (direction == null || (direction.FrameCount == 0 || direction.Frames == null) && !AnimationsLoader.Instance.LoadAnimationFrames(id, animGroup, dir, ref direction)) { if (!(_transform && entity == null && !hasShadow)) { return(0); } } if (direction == null) { return(0); } direction.LastAccessTime = Time.Ticks; int fc = direction.FrameCount; if (fc > 0 && frameIndex >= fc || frameIndex < 0) { frameIndex = 0; } if (frameIndex < direction.FrameCount) { AnimationFrameTexture frame = direction.Frames[frameIndex]; if (frame == null || frame.IsDisposed) { if (!(_transform && entity == null && !hasShadow)) { return(0); } goto SKIP; } frame.Ticks = Time.Ticks; if (mirror) { x -= frame.Width - frame.CenterX; } else { x -= frame.CenterX; } y -= frame.Height + frame.CenterY; SKIP: if (hasShadow) { batcher.DrawSpriteShadow(frame, x, y, mirror); } else { ushort hue = _viewHue; bool partialHue = false; if (hue == 0) { hue = entity?.Hue ?? owner.Hue; partialHue = !isMount && entity != null && entity.ItemData.IsPartialHue; if ((hue & 0x8000) != 0) { partialHue = true; hue &= 0x7FFF; } if (hue == 0) { hue = hueFromFile; if (hue == 0 && _equipConvData.HasValue) { hue = _equipConvData.Value.Color; } partialHue = false; } } // ## BEGIN - END ## // if (ProfileManager.CurrentProfile.GlowingWeaponsType != 0) { if (id >= 0x263 && id <= 0x28D) // all weps { hue = UOClassicCombatCollection.WeaponsHue(hue); } } // ## BEGIN - END ## // ResetHueVector(); ShaderHueTranslator.GetHueVector(ref HueVector, hue, partialHue, alpha); if (_transform) { const float UPPER_BODY_RATIO = 0.35f; const float MID_BODY_RATIO = 0.60f; const float LOWER_BODY_RATIO = 0.94f; if (entity == null && isHuman) { int frameHeight = frame?.Height ?? 61; _characterFrameStartY = y - (frame != null ? 0 : frameHeight - SIT_OFFSET_Y); _characterFrameHeight = frameHeight; _startCharacterWaistY = (int)(frameHeight * UPPER_BODY_RATIO) + _characterFrameStartY; _startCharacterKneesY = (int)(frameHeight * MID_BODY_RATIO) + _characterFrameStartY; _startCharacterFeetY = (int)(frameHeight * LOWER_BODY_RATIO) + _characterFrameStartY; if (frame == null) { return(0); } } float h3mod = UPPER_BODY_RATIO; float h6mod = MID_BODY_RATIO; float h9mod = LOWER_BODY_RATIO; if (entity != null) { float itemsEndY = y + frame.Height; if (y >= _startCharacterWaistY) { h3mod = 0; } else if (itemsEndY <= _startCharacterWaistY) { h3mod = 1.0f; } else { float upperBodyDiff = _startCharacterWaistY - y; h3mod = upperBodyDiff / frame.Height; if (h3mod < 0) { h3mod = 0; } } if (_startCharacterWaistY >= itemsEndY || y >= _startCharacterKneesY) { h6mod = 0; } else if (_startCharacterWaistY <= y && itemsEndY <= _startCharacterKneesY) { h6mod = 1.0f; } else { float midBodyDiff; if (y >= _startCharacterWaistY) { midBodyDiff = _startCharacterKneesY - y; } else if (itemsEndY <= _startCharacterKneesY) { midBodyDiff = itemsEndY - _startCharacterWaistY; } else { midBodyDiff = _startCharacterKneesY - _startCharacterWaistY; } h6mod = h3mod + midBodyDiff / frame.Height; if (h6mod < 0) { h6mod = 0; } } if (itemsEndY <= _startCharacterKneesY) { h9mod = 0; } else if (y >= _startCharacterKneesY) { h9mod = 1.0f; } else { float lowerBodyDiff = itemsEndY - _startCharacterKneesY; h9mod = h6mod + lowerBodyDiff / frame.Height; if (h9mod < 0) { h9mod = 0; } } } batcher.DrawCharacterSitted(frame, x, y, mirror, h3mod, h6mod, h9mod, ref HueVector); } else if (frame != null) { batcher.DrawSprite(frame, x, y, mirror, ref HueVector); int yy = -(frame.Height + frame.CenterY + 3); int xx = -frame.CenterX; if (mirror) { xx = -(frame.Width - frame.CenterX); } if (xx < owner.FrameInfo.X) { owner.FrameInfo.X = xx; } if (yy < owner.FrameInfo.Y) { owner.FrameInfo.Y = yy; } if (owner.FrameInfo.Width < xx + frame.Width) { owner.FrameInfo.Width = xx + frame.Width; } if (owner.FrameInfo.Height < yy + frame.Height) { owner.FrameInfo.Height = yy + frame.Height; } } if (frame.Contains ( mirror ? x + frame.Width - SelectedObject.TranslatedMousePositionByViewport.X : SelectedObject.TranslatedMousePositionByViewport.X - x, SelectedObject.TranslatedMousePositionByViewport.Y - y )) { SelectedObject.Object = owner; } if (entity != null && entity.ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(owner, entity, mirror ? x + frame.Width : x, y); } } return(AnimationsLoader.Instance.DataIndex[id].MountedHeightOffset); } return(0); }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } ushort graphic = Graphic; ushort hue = Hue; bool partial = ItemData.IsPartialHue; ResetHueVector(); if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this) { hue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; partial = false; } else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { hue = Constants.OUT_RANGE_COLOR; partial = false; } else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect) { hue = Constants.DEAD_RANGE_COLOR; partial = false; } ShaderHueTranslator.GetHueVector(ref HueVector, hue, partial, 0); // ## BEGIN - END ## // if (ProfileManager.CurrentProfile.HighlightTileAtRange && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRange) { HueVector.X = ProfileManager.CurrentProfile.HighlightTileRangeHue; HueVector.Y = 1; } if (ProfileManager.CurrentProfile.HighlightTileAtRangeSpell) { if (GameCursor._spellTime >= 1 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell) { HueVector.X = ProfileManager.CurrentProfile.HighlightTileRangeHueSpell; HueVector.Y = 1; } } if (ProfileManager.CurrentProfile.PreviewFields) { if (UOClassicCombatCollection.StaticFieldPreview(this)) { HueVector.X = 0x0040; HueVector.Y = 1; } if (SelectedObject.LastObject == this) { HueVector.X = 0x0023; HueVector.Y = 1; } } // ## BEGIN - END ## // // ## BEGIN - END ## // ORIG /* * bool isTree = StaticFilters.IsTree(graphic, out _); * * if (isTree && ProfileManager.CurrentProfile.TreeToStumps) * { * graphic = Constants.TREE_REPLACE_GRAPHIC; * } */ // ## BEGIN - END ## // ORIG graphic = UOClassicCombatCollection.ArtloaderFilters(graphic); bool isTree = StaticFilters.IsTree(graphic, out _); // ## BEGIN - END ## // if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector, ref DrawTransparent, ProfileManager.CurrentProfile.ShadowsEnabled && ProfileManager.CurrentProfile.ShadowsStatics && (isTree || ItemData.IsFoliage || StaticFilters.IsRock(graphic))); if (ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(this, this, posX + 22, posY + 22); } if (!(SelectedObject.Object == this || FoliageIndex != -1 && Client.Game.GetScene <GameScene>().FoliageIndex == FoliageIndex)) { if (DrawTransparent) { return(true); } ref UOFileIndex index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000); posX -= index.Width; posY -= index.Height; if (SelectedObject.IsPointInStatic(ArtLoader.Instance.GetTexture(graphic), posX, posY)) { SelectedObject.Object = this; } }
public void Draw(UltimaBatcher2D batcher) { int screenW = ProfileManager.CurrentProfile.GameWindowSize.X; int screenH = ProfileManager.CurrentProfile.GameWindowSize.Y; if (SerialHelper.IsMobile(TargetManager.LastTargetInfo.Serial)) { DrawHealthLineWithMath(batcher, TargetManager.LastTargetInfo.Serial, screenW, screenH); } if (SerialHelper.IsMobile(TargetManager.SelectedTarget)) { DrawHealthLineWithMath(batcher, TargetManager.SelectedTarget, screenW, screenH); } if (SerialHelper.IsMobile(TargetManager.LastAttack)) { DrawHealthLineWithMath(batcher, TargetManager.LastAttack, screenW, screenH); } if (!IsEnabled) { return; } int mode = ProfileManager.CurrentProfile.MobileHPType; if (mode < 0) { return; } int showWhen = ProfileManager.CurrentProfile.MobileHPShowWhen; foreach (Mobile mobile in World.Mobiles) { if (mobile.IsDestroyed) { continue; } int current = mobile.Hits; int max = mobile.HitsMax; if (showWhen == 1 && current == max) { continue; } Point p = mobile.RealScreenPosition; p.X += (int)mobile.Offset.X + 22 + 5; p.Y += (int)(mobile.Offset.Y - mobile.Offset.Z) + 22 + 5; if (mode != 1 && !mobile.IsDead) { if (showWhen == 2 && current != max || showWhen <= 1) { if (mobile.HitsPercentage != 0) { AnimationsLoader.Instance.GetAnimationDimensions ( mobile.AnimIndex, mobile.GetGraphicForAnimation(), /*(byte) m.GetDirectionForAnimation()*/ 0, /*Mobile.GetGroupForAnimation(m, isParent:true)*/ 0, mobile.IsMounted, /*(byte) m.AnimIndex*/ 0, out int centerX, out int centerY, out int width, out int height ); Point p1 = p; p1.Y -= height + centerY + 8 + 22; if (mobile.IsGargoyle && mobile.IsFlying) { p1.Y -= 22; } else if (!mobile.IsMounted) { p1.Y += 22; } p1 = Client.Game.Scene.Camera.WorldToScreen(p1); p1.X -= (mobile.HitsTexture.Width >> 1) + 5; p1.Y -= mobile.HitsTexture.Height; if (mobile.ObjectHandlesOpened) { p1.Y -= Constants.OBJECT_HANDLES_GUMP_HEIGHT + 5; } if (!(p1.X < 0 || p1.X > screenW - mobile.HitsTexture.Width || p1.Y < 0 || p1.Y > screenH)) { mobile.HitsTexture.Draw(batcher, p1.X, p1.Y); } // ## BEGIN - END ## // UOClassicCombatCollection.UpdateOverheads(mobile); if (ProfileManager.CurrentProfile.OverheadRange && mobile != World.Player) { mobile.RangeTexture.Draw(batcher, p1.X - mobile.RangeTexture.Width, p1.Y); } if (ProfileManager.CurrentProfile.OverheadSummonTime && mobile.SummonTime != 0) { mobile.SummonTexture.Draw(batcher, p1.X + mobile.HitsTexture.Width, p1.Y); } if (ProfileManager.CurrentProfile.OverheadPeaceTime && mobile.PeaceTime != 0) { if (ProfileManager.CurrentProfile.OverheadSummonTime && mobile.SummonTime != 0) { mobile.PeaceTexture.Draw(batcher, p1.X + mobile.HitsTexture.Width + mobile.SummonTexture.Width, p1.Y); } else { mobile.PeaceTexture.Draw(batcher, p1.X + mobile.HitsTexture.Width, p1.Y); } } // ## BEGIN - END ## // } } } if (mobile.Serial == TargetManager.LastTargetInfo.Serial || mobile.Serial == TargetManager.SelectedTarget || mobile.Serial == TargetManager.LastAttack) { continue; } p.X -= 5; p = Client.Game.Scene.Camera.WorldToScreen(p); p.X -= BAR_WIDTH_HALF; p.Y -= BAR_HEIGHT_HALF; if (p.X < 0 || p.X > screenW - BAR_WIDTH) { continue; } if (p.Y < 0 || p.Y > screenH - BAR_HEIGHT) { continue; } if (mode >= 1) { // ## BEGIN - END ## // ORIG //DrawHealthLine(batcher, mobile, p.X, p.Y, mobile.Serial != World.Player.Serial); // ## BEGIN - END ## // if (ProfileManager.CurrentProfile.UseOldHealthBars) { DrawOldHealthLine(batcher, mobile, p.X, p.Y, mobile != World.Player); } else { DrawHealthLine(batcher, mobile, p.X, p.Y, mobile.Serial != World.Player.Serial); } // ## BEGIN - END ## // } // ## BEGIN - END ## // if (ProfileManager.CurrentProfile.MobileHamstrungTime && mobile != World.Player) { UOClassicCombatCollection.UpdateHamstrung(mobile); if (mobile.HamstrungTime > 0) { mobile.HamstrungTexture.Draw(batcher, p.X, p.Y); } } // ## BEGIN - END ## // } }
// ## BEGIN - END ## // -- CODE BELOW IS 1:1 LIKE DrawHealthLine() private void DrawOldHealthLine(UltimaBatcher2D batcher, Entity entity, int x, int y, bool passive) { if (entity == null) { return; } Mobile mobile = entity as Mobile; int per = mobile.HitsMax; if (per > 0) { per = mobile.Hits * 100 / per; if (per > 100) { per = 100; } if (per < 1) { per = 0; } else { per = 34 * per / 100; } } // ## BEGIN - END ## // -- CODE ABOVE IS 1:1 LIKE DrawHealthLine() Color color; if (ProfileManager.CurrentProfile.MultipleUnderlinesSelfParty && mobile == World.Player || ProfileManager.CurrentProfile.MultipleUnderlinesSelfParty && World.Party.Contains(mobile)) { if (ProfileManager.CurrentProfile.MultipleUnderlinesSelfPartyBigBars) { //LAYOUT BIGBAR BIGBAR_WIDTH = 50; BIGBAR_HEIGHT = 4; BIGBAR_WIDTH_HALF = BIGBAR_WIDTH / 2 - 14; YSPACING = 1; } else { BIGBAR_WIDTH = 28; BIGBAR_HEIGHT = 3; BIGBAR_WIDTH_HALF = BIGBAR_WIDTH / 2 - 14; // = BAR_WIDTH >> 1; YSPACING = 1; } (Color hpcolor, int maxhp, int maxmana, int maxstam) = UOClassicCombatCollection.CalcUnderlines(mobile); //HP BAR batcher.Draw2D(_edgeHealth, x - 1 - BIGBAR_WIDTH_HALF, y - 1, BIGBAR_WIDTH + 2, BIGBAR_HEIGHT + 1, ref _vectorHue); batcher.Draw2D(_backHealth, x - BIGBAR_WIDTH_HALF + maxhp, y, BIGBAR_WIDTH - maxhp, BIGBAR_HEIGHT, ref _vectorHue); batcher.Draw2D(SolidColorTextureCache.GetTexture(hpcolor), x - BIGBAR_WIDTH_HALF, y, maxhp, BIGBAR_HEIGHT, ref _vectorHue); //MANA BAR batcher.Draw2D(_edgeMana, x - 1 - BIGBAR_WIDTH_HALF, y + BIGBAR_HEIGHT + YSPACING - 1, BIGBAR_WIDTH + 2, BIGBAR_HEIGHT + 1, ref _vectorHue); batcher.Draw2D(_backMana, x - BIGBAR_WIDTH_HALF + maxmana, y + BIGBAR_HEIGHT + YSPACING, BIGBAR_WIDTH - maxmana, BIGBAR_HEIGHT, ref _vectorHue); batcher.Draw2D(SolidColorTextureCache.GetTexture(Color.CornflowerBlue * _alphamodifier), x - BIGBAR_WIDTH_HALF, y + BIGBAR_HEIGHT + YSPACING, maxmana, BIGBAR_HEIGHT, ref _vectorHue); //STAM BAR batcher.Draw2D(_edgeStamina, x - 1 - BIGBAR_WIDTH_HALF, y + BIGBAR_HEIGHT + BIGBAR_HEIGHT + YSPACING + YSPACING - 1, BIGBAR_WIDTH + 2, BIGBAR_HEIGHT + 2, ref _vectorHue); batcher.Draw2D(_backStamina, x - BIGBAR_WIDTH_HALF + maxstam, y + BIGBAR_HEIGHT + BIGBAR_HEIGHT + YSPACING + YSPACING, BIGBAR_WIDTH - maxstam, BIGBAR_HEIGHT, ref _vectorHue); batcher.Draw2D(SolidColorTextureCache.GetTexture(Color.CornflowerBlue * _alphamodifier), x - BIGBAR_WIDTH_HALF, y + BIGBAR_HEIGHT + BIGBAR_HEIGHT + YSPACING + YSPACING, maxstam, BIGBAR_HEIGHT, ref _vectorHue); } else { batcher.Draw2D(_edge, x - 1, y - 1, BAR_WIDTH + 2, OLD_BAR_HEIGHT + 2, ref _vectorHue); batcher.Draw2D(_back, x, y, BAR_WIDTH, OLD_BAR_HEIGHT, ref _vectorHue); if (mobile.IsParalyzed) { color = Color.AliceBlue; } else if (mobile.IsYellowHits) { color = Color.Orange; } else if (mobile.IsPoisoned) { color = Color.LimeGreen; } else { color = Color.CornflowerBlue; } batcher.Draw2D(SolidColorTextureCache.GetTexture(color), x, y, per, OLD_BAR_HEIGHT, ref _vectorHue); } }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } //Engine.DebugInfo.ItemsRendered++; ResetHueVector(); DrawTransparent = false; posX += (int)Offset.X; posY += (int)(Offset.Y + Offset.Z); if (ItemData.IsTranslucent) { HueVector.Z = 0.5f; } if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } if (IsCorpse) { return(DrawCorpse(batcher, posX, posY - 3)); } ushort hue = Hue; ushort graphic = DisplayedGraphic; bool partial = ItemData.IsPartialHue; // ## BEGIN - END ## // if (UOClassicCombatCollection.IsStealthArt(Graphic)) { if (ProfileManager.CurrentProfile.ColorStealth || ProfileManager.CurrentProfile.StealthNeonType != 0) { hue = UOClassicCombatCollection.StealthtHue(hue); } } // ## BEGIN - END ## // if (OnGround) { if (ItemData.IsAnimated) { if (ProfileManager.CurrentProfile.FieldsType == 2) { if (StaticFilters.IsFireField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0020; } else if (StaticFilters.IsParalyzeField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0058; } else if (StaticFilters.IsEnergyField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0070; } else if (StaticFilters.IsPoisonField(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x0044; } else if (StaticFilters.IsWallOfStone(Graphic)) { graphic = Constants.FIELD_REPLACE_GRAPHIC; hue = 0x038A; } } } if (ItemData.IsContainer && SelectedObject.SelectedContainer == this) { hue = 0x0035; partial = false; } } if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this) { hue = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE; partial = false; } else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { hue = Constants.OUT_RANGE_COLOR; } else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect) { hue = Constants.DEAD_RANGE_COLOR; } else { if (!IsLocked && !IsMulti && SelectedObject.LastObject == this) { // TODO: check why i put this. //isPartial = ItemData.Weight == 0xFF; hue = 0x0035; } else if (IsHidden) { hue = 0x038E; } } ShaderHueTranslator.GetHueVector(ref HueVector, hue, partial, HueVector.Z); if (!IsMulti && !IsCoin && Amount > 1 && ItemData.IsStackable) { DrawStaticAnimated(batcher, graphic, posX - 5, posY - 5, ref HueVector, ref DrawTransparent, false); } if (ItemData.IsLight) { Client.Game.GetScene <GameScene>().AddLight(this, this, posX + 22, posY + 22); } if (!SerialHelper.IsValid(Serial) && IsMulti && TargetManager.TargetingState == CursorTarget.MultiPlacement) { HueVector.Z = 0.5f; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector, ref DrawTransparent, false); if (SelectedObject.Object == this || TargetManager.TargetingState == CursorTarget.MultiPlacement) { return(false); } ArtTexture texture = ArtLoader.Instance.GetTexture(graphic); if (texture != null) { ref UOFileIndex index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000); posX -= index.Width; posY -= index.Height; if (SelectedObject.IsPointInStatic(texture, posX, posY)) { SelectedObject.Object = this; } }