public void Draw() { if (!enable) { return; } if (combatOnly) { if (!pluginInterface.ClientState.Condition[Dalamud.Game.ClientState.ConditionFlag.InCombat]) { return; } } Dalamud.Game.ClientState.Actors.ActorTable actorTable = pluginInterface.ClientState.Actors; if (actorTable[0] is Dalamud.Game.ClientState.Actors.Types.PlayerCharacter pc) { if (pc.ClassJob.Id != 25) { return; } updateTime(pc); ImGui.SetNextWindowSizeConstraints(new Vector2(170, 10), new Vector2(float.MaxValue, float.MaxValue)); var windowFlag = ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar; if (clickThrough) { windowFlag = windowFlag | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoMouseInputs; } if (ImGui.Begin("mp tick bar", windowFlag)) { var width = 150; var height = 8; var windowPos = ImGui.GetWindowPos(); var basePos = new Vector2(windowPos.X + 5, windowPos.Y + 2); var timestamp = (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - mpTickTimestamp) % 3000; ImGui.Text(mpTickTimestamp == 0 ? "Uninitialized" : String.Format("{0:N2}", 3 - timestamp / 1000.0)); ImGui.GetWindowDrawList().AddRect(new Vector2(basePos.X - 1, basePos.Y - 1), new Vector2(basePos.X + width + 1, basePos.Y + height + 1), ImGui.GetColorU32(new Vector4(0.000f, 0.000f, 0.000f, 1.000f)), 0, ImDrawCornerFlags.None, 1); var boundaryPosX = basePos.X + width * (3 - boundaryTime) / 3; ImGui.GetWindowDrawList().AddRectFilled(basePos, new Vector2(boundaryPosX, basePos.Y + height), ImGui.GetColorU32(leftColor)); ImGui.GetWindowDrawList().AddRectFilled(new Vector2(boundaryPosX, basePos.Y), new Vector2(basePos.X + width, basePos.Y + height), ImGui.GetColorU32(rightColor)); var cursorPosXOffset = width * timestamp / (float)3000.0; var cursorPosX = basePos.X + cursorPosXOffset; ImGui.GetWindowDrawList().AddRectFilled(new Vector2(cursorPosX, windowPos.Y), new Vector2(cursorPosX + 2, windowPos.Y + 12), ImGui.GetColorU32(new Vector4(1.000f, 1.000f, 1.000f, 1.000f))); ImGui.End(); } } }
private void ChatBubbles() { if (!skipfont) { if (font.IsLoaded()) { ImGui.PushFont(font); if (bubblesWindow) { Dalamud.Game.ClientState.Actors.ActorTable actorTable = pluginInterface.ClientState.Actors; List <Dalamud.Game.ClientState.Actors.Types.Chara> charaTable = new List <Dalamud.Game.ClientState.Actors.Types.Chara>(); for (var k = 0; k < this.pluginInterface.ClientState.Actors.Length; k++) { var actor = this.pluginInterface.ClientState.Actors[k]; if (actor == null) { continue; } if (actor is Dalamud.Game.ClientState.Actors.Types.NonPlayer.Npc npc) { } if (actor is Dalamud.Game.ClientState.Actors.Types.Chara chara) { if (drawDebug) { if (pluginInterface.Framework.Gui.WorldToScreen(new SharpDX.Vector3(actor.Position.X, actor.Position.Z + AddHeight(chara), actor.Position.Y), out SharpDX.Vector2 pos2)) { ImGui.SetNextWindowPos(new Num.Vector2(pos2.X + 30, pos2.Y)); ImGui.Begin(chara.Name + "Info", ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.AlwaysAutoResize); ImGui.Text(chara.Name); //ImGui.Text("G: " + chara.Customize[(int)Dalamud.Game.ClientState.Actors.CustomizeIndex.Gender].ToString()); //ImGui.Text("R: " + chara.Customize[(int)Dalamud.Game.ClientState.Actors.CustomizeIndex.Race].ToString()); //ImGui.Text("H: " + chara.Customize[(int)Dalamud.Game.ClientState.Actors.CustomizeIndex.Height].ToString()); //ImGui.Text("A: " + AddHeight(chara).ToString()); //ImGui.Text(k.ToString()); ImGui.Text(actor.ActorId.ToString()); ImGui.Text(actor.Address.ToString("X")); ImGui.End(); } ImGui.Begin("XXX", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.AlwaysAutoResize); ImGui.Text(pluginInterface.ClientState.LocalPlayer.Address.ToString("X")); ImGui.End(); } } if (actor is Dalamud.Game.ClientState.Actors.Types.PlayerCharacter pc) { charaTable.Add(pc); } } foreach (Dalamud.Game.ClientState.Actors.Types.PlayerCharacter actor in charaTable) { try { foreach (ChatText chat in chatBubble) { if (chat.Sender == actor.Name && chat.Sender.Length > 0) { DrawChatBubble(actor, chat); } } } catch (Exception) { //Do nothing } CleanupBubbles(); } //ImGui.End(); } ImGui.PopFont(); } } else { skipfont = false; } }
private void DrawWindow() { if (check) { IntPtr baseUi = getBaseUIObj(); if (baseUi == IntPtr.Zero) { return; } IntPtr baseUiProperties = Marshal.ReadIntPtr(baseUi, 0x20); if (baseUiProperties == IntPtr.Zero) { return; } IntPtr tempCastBar = getUI2ObjByName(baseUiProperties, "_CastBar", 1); if (tempCastBar != IntPtr.Zero) { wait = 1000; if (config) { ImGui.SetNextWindowSize(new Num.Vector2(300, 500), ImGuiCond.FirstUseEver); ImGui.Begin("SlideCast Config", ref config); ImGui.Checkbox("Enable", ref enabled); ImGui.InputInt("Time (cs)", ref slideTime); ImGui.TextWrapped("The time for slidecasting is 50cs (half a second) by default.\n" + "Lower numbers make it later in the cast, higher numbers earlier in the cast.\n" + "Apart from missed packets, 50cs is the exact safe time to slidecast."); ImGui.ColorEdit4("Bar Colour", ref slideCol, ImGuiColorEditFlags.NoInputs); ImGui.Checkbox("Enable Debug Mode", ref debug); ImGui.Separator(); /* * ImGui.ColorEdit4("Start", ref colp1_s); * ImGui.ColorEdit4("End", ref colp2_s); * if (ImGui.Button("Set")) * { * col1_s = new Colour(colp1_s.X, colp1_s.Y, colp1_s.Z, colp1_s.W); * col2_s = new Colour(colp2_s.X, colp2_s.Y, colp2_s.Z, colp2_s.W); * * diffH_s = col2_s.Hue - col1_s.Hue; * diffS_s = col2_s.Saturation - col1_s.Saturation; * diffB_s = col2_s.Brightness - col1_s.Brightness; * } */ if (ImGui.Button("Save and Close Config")) { SaveConfig(); config = false; } ImGui.End(); } if (enabled) { if (castBar != tempCastBar) { castBar = IntPtr.Zero; } if (castBar != IntPtr.Zero) { cbCastLast = cbCastPer; cbX = Marshal.ReadInt16(castBar + 0x1BC); cbY = Marshal.ReadInt16(castBar + 0x1BE); cbScale = Marshal.PtrToStructure <float>(castBar + 0x1AC); cbCastTime = Marshal.ReadInt16(castBar + 0x2BC); cbCastPer = Marshal.PtrToStructure <float>(castBar + 0x2C0); int plus = 0; cbSpell = new List <byte>(); while (Marshal.ReadByte(castBar + 0x242 + plus) != 0) { cbSpell.Add(Marshal.ReadByte(castBar + 0x242 + plus)); plus++; } cbSpellname = ""; foreach (byte bit in cbSpell) { cbSpellname += (char)bit; } if (cbCastLast == cbCastPer) { if (cbCastSameCount < 5) { cbCastSameCount++; } } else { cbCastSameCount = 0; } if (cbCastPer == 5) { col_s = new Colour(col1_s.R / 255f, col1_s.G / 255f, col1_s.B / 255f); } if (Marshal.ReadByte(castBar + 0x182).ToString() != "84") { ImGui.Begin("SlideCast", ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoBackground); ImGui.SetWindowPos(new Num.Vector2(cbX, cbY)); ImGui.SetWindowSize(new Num.Vector2(220 * cbScale, 60 * cbScale)); //float time = (float)cbCastTime - (0.01f * cbCastPer * (float)cbCastTime); float slidePer = ((float)cbCastTime - (float)slideTime) / (float)cbCastTime; ImGui.GetWindowDrawList().AddRectFilled( new Num.Vector2(ImGui.GetWindowPos().X + (48 * cbScale) + (152 * slidePer * cbScale), ImGui.GetWindowPos().Y + (20 * cbScale)), new Num.Vector2(ImGui.GetWindowPos().X + (48 * cbScale) + 5 + (152 * slidePer * cbScale), ImGui.GetWindowPos().Y + (29 * cbScale)), ImGui.GetColorU32(slideCol)); ImGui.End(); } if (uiCastBar) { if (cbCastTime == 0) { cbCastTime++; } if (cbCastSameCount < 5) { double castTimeSec = ((double)cbCastTime / 100) - ((double)cbCastTime / 100) * (cbCastPer / 100); ImGui.Begin("uiCastBar_Self", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoBackground); col_s.setHSB(col1_s.Hue + (int)(diffH_s * (cbCastPer / 100)), col1_s.Saturation + (int)(diffS_s * (cbCastPer / 100)), col1_s.Brightness + (int)(diffB_s * (cbCastPer / 100))); Num.Vector2 centre = DrawCircleProgress(40f, 10f, 100, cbCastPer, col_s); ImGui.GetWindowDrawList().AddCircleFilled( new Num.Vector2(centre.X, centre.Y), 35f, ImGui.GetColorU32(new Num.Vector4(0.2f, 0.2f, 0.2f, 0.2f)), 100); ImGui.GetWindowDrawList().AddCircle( new Num.Vector2(centre.X, centre.Y), 45f, ImGui.GetColorU32(new Num.Vector4(0.4f, 0.4f, 0.4f, 0.4f)), 100); ImGui.GetWindowDrawList().AddCircleFilled( new Num.Vector2(centre.X, centre.Y), 35f, ImGui.GetColorU32(new Num.Vector4(0.4f, 0.4f, 0.4f, 0.4f)), 100); ImGui.SetCursorPos(new Num.Vector2( centre.X - ImGui.GetWindowPos().X - (ImGui.CalcTextSize(cbSpellname).X) / 2, centre.Y - 15f - ImGui.GetWindowPos().Y)); ShadowFont(cbSpellname); ImGui.SetCursorPos(new Num.Vector2( centre.X - ImGui.GetWindowPos().X - (ImGui.CalcTextSize(String.Format("{0:0.00}", castTimeSec)).X) / 2, centre.Y - ImGui.GetWindowPos().Y)); ShadowFont(String.Format("{0:0.00}", castTimeSec)); ImGui.SetCursorPos(new Num.Vector2( centre.X - ImGui.GetWindowPos().X - (ImGui.CalcTextSize(cbCastPer.ToString() + "%").X) / 2, centre.Y + 15f - ImGui.GetWindowPos().Y)); ShadowFont(cbCastPer.ToString() + "%%"); ImGui.End(); } if (pluginInterface.ClientState.LocalPlayer != null) { if (pluginInterface.ClientState.LocalPlayer.TargetActorID != 0) { Dalamud.Game.ClientState.Actors.ActorTable actorTable = pluginInterface.ClientState.Actors; for (var k = 0; k < this.pluginInterface.ClientState.Actors.Length; k++) { var actor = this.pluginInterface.ClientState.Actors[k]; if (actor == null) { continue; } if (pluginInterface.ClientState.LocalPlayer.TargetActorID == actor.ActorId) { float targetSpellCast = Marshal.PtrToStructure <float>(actor.Address + 0x1C74); float targetSpellTime = Marshal.PtrToStructure <float>(actor.Address + 0x1C78); float targetSpellPer = 100 * (1 - ((targetSpellTime - targetSpellCast) / targetSpellTime)); ImGui.Begin("uiCastBar_Target", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoBackground); ImGui.Text(targetSpellCast.ToString()); ImGui.Text(targetSpellTime.ToString()); ImGui.Text(targetSpellPer.ToString()); Num.Vector2 centreT = DrawCircleProgress(40f, 10f, 100, targetSpellPer, col_s); ImGui.GetWindowDrawList().AddCircleFilled( new Num.Vector2(centreT.X, centreT.Y), 35f, ImGui.GetColorU32(new Num.Vector4(0.2f, 0.2f, 0.2f, 0.2f)), 100); ImGui.GetWindowDrawList().AddCircle( new Num.Vector2(centreT.X, centreT.Y), 45f, ImGui.GetColorU32(new Num.Vector4(0.4f, 0.4f, 0.4f, 0.4f)), 100); ImGui.GetWindowDrawList().AddCircleFilled( new Num.Vector2(centreT.X, centreT.Y), 35f, ImGui.GetColorU32(new Num.Vector4(0.4f, 0.4f, 0.4f, 0.4f)), 100); if (Marshal.ReadInt16(actor.Address + 0x1C44) != 0) { //var actionRow = actionSheet.GetRow(Marshal.ReadInt16(actor.Address + 0x1C44)); //ImGui.Text(actionRow.Name); ImGui.Text("THINGY"); } ImGui.End(); } } } } } } else { castBar = tempCastBar; } if (debug) { ImGui.Begin("SlideCast DEBUG", ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar); ImGui.SetWindowPos(new Num.Vector2(cbX, cbY)); ImGui.SetWindowSize(new Num.Vector2(220 * cbScale, 60 * cbScale)); //float time = (float)cbCastTime - (0.01f * cbCastPer * (float)cbCastTime); float slidePer = ((float)cbCastTime - (float)slideTime) / (float)cbCastTime; ImGui.GetWindowDrawList().AddRectFilled( new Num.Vector2(ImGui.GetWindowPos().X + (48 * cbScale) + (152 * slidePer * cbScale), ImGui.GetWindowPos().Y + (20 * cbScale)), new Num.Vector2(ImGui.GetWindowPos().X + (48 * cbScale) + 5 + (152 * slidePer * cbScale), ImGui.GetWindowPos().Y + (29 * cbScale)), ImGui.GetColorU32(slideCol)); ImGui.End(); ImGui.Begin("Slidecast Debug Values"); ImGui.Text("cbX: " + cbX.ToString()); ImGui.Text("cbY: " + cbY.ToString()); ImGui.Text("cbS: " + cbScale.ToString()); ImGui.Text("cbCastTime: " + cbCastTime.ToString()); ImGui.Text("cbCastPer: " + cbCastPer.ToString()); ImGui.Text("Mem Addr: " + castBar.ToString("X")); ImGui.Text("Spell: " + cbSpellname); ImGui.Text(col_s.Hue.ToString()); ImGui.Text(col_s.Saturation.ToString()); ImGui.Text(col_s.Brightness.ToString()); ImGui.End(); } } } else { check = false; } } if (wait > 0) { wait--; } else { check = true; } }
private void DrawWindow() { if (config) { ImGui.SetNextWindowSize(new Num.Vector2(300, 500), ImGuiCond.FirstUseEver); ImGui.Begin("VoidList Config"); float footer = (ImGui.GetStyle().ItemSpacing.Y) / 2 + ImGui.GetFrameHeightWithSpacing(); ImGui.BeginChild("scrolling", new Num.Vector2(0, -footer), false); ImGui.Checkbox("Enable", ref enabled); ImGui.Columns(4); ImGui.Text("Who"); ImGui.NextColumn(); ImGui.Text("When"); ImGui.NextColumn(); ImGui.Text("Why"); ImGui.NextColumn(); ImGui.NextColumn(); int delete = -1; for (int i = 0; i < voidList.Count(); i++) { ImGui.Text(voidList[i].Name); ImGui.NextColumn(); ImGui.Text(voidList[i].Time.ToString()); ImGui.NextColumn(); ImGui.Text(voidList[i].Reason); ImGui.NextColumn(); if (ImGui.Button("Remove##" + i.ToString())) { delete = i; } ImGui.NextColumn(); } if (delete != -1) { voidList.RemoveAt(delete); } ImGui.Columns(1); ImGui.Separator(); if (ImGui.Button("Refresh")) { for (var k = 0; k < this.pluginInterface.ClientState.Actors.Length; k++) { RerenderActor(this.pluginInterface.ClientState.Actors[k]); } } if (pluginInterface.ClientState.LocalPlayer != null) { if (pluginInterface.ClientState.LocalPlayer.TargetActorID != 0) { TargetID = pluginInterface.ClientState.LocalPlayer.TargetActorID; } else { TargetID = 0; } Dalamud.Game.ClientState.Actors.ActorTable actorTable = pluginInterface.ClientState.Actors; for (var k = 0; k < this.pluginInterface.ClientState.Actors.Length; k++) { var actor = this.pluginInterface.ClientState.Actors[k]; if (actor == null) { continue; } if (actor.ActorId == TargetID && actor is Dalamud.Game.ClientState.Actors.Types.PlayerCharacter) { ImGui.Text("Name: " + actor.Name); ImGui.InputText(reason, buff, 128); if (ImGui.Button("Void Player")) { voidList.Add(new Void(actor, System.Text.Encoding.Default.GetString(buff))); buff = new byte[128]; } } } } ImGui.EndChild(); if (ImGui.Button("Save and Close Config")) { SaveConfig(); config = false; } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Changes will only be saved for the current session unless you do this!"); } ImGui.End(); } if (enabled && !pluginInterface.ClientState.Condition[Dalamud.Game.ClientState.ConditionFlag.BoundByDuty]) { for (var k = 0; k < this.pluginInterface.ClientState.Actors.Length; k++) { var actor = this.pluginInterface.ClientState.Actors[k]; if (actor == null) { continue; } if (actor is Dalamud.Game.ClientState.Actors.Types.PlayerCharacter pc) { foreach (Void person in voidList) { if (person.ActorId == actor.ActorId) { HideActor(actor); } } } } } }