// ## 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); }