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