mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-21 16:09:19 +01:00
fix welcome.png
This commit is contained in:
parent
e6062db88b
commit
509659c0e6
1 changed files with 224 additions and 93 deletions
|
|
@ -1,8 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlTypes;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Media;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -19,7 +21,7 @@ namespace Dalamud
|
||||||
private readonly Dalamud dalamud;
|
private readonly Dalamud dalamud;
|
||||||
|
|
||||||
private TextureWrap welcomeTex;
|
private TextureWrap welcomeTex;
|
||||||
private const float WelcomeTexScale = 0.74f;
|
private const float WelcomeTexScale = 1f;
|
||||||
private const float TippyScale = 1;
|
private const float TippyScale = 1;
|
||||||
|
|
||||||
private TextureWrap bubbleTex;
|
private TextureWrap bubbleTex;
|
||||||
|
|
@ -27,7 +29,8 @@ namespace Dalamud
|
||||||
|
|
||||||
private long frames = 0;
|
private long frames = 0;
|
||||||
|
|
||||||
private Stopwatch tippyTimer = new Stopwatch();
|
private readonly Stopwatch tippyFrameTimer = new Stopwatch();
|
||||||
|
private readonly Stopwatch tippyLogicTimer = new Stopwatch();
|
||||||
|
|
||||||
public bool IsEnabled = true;
|
public bool IsEnabled = true;
|
||||||
|
|
||||||
|
|
@ -35,10 +38,16 @@ namespace Dalamud
|
||||||
{
|
{
|
||||||
this.dalamud = dalamud;
|
this.dalamud = dalamud;
|
||||||
|
|
||||||
this.dalamud.ClientState.OnLogin += (sender, args) => this.isTippyDrawing = true;
|
this.dalamud.ClientState.OnLogin += (sender, args) => {
|
||||||
|
this.isTippyDrawing = true;
|
||||||
|
this.tippyLogicTimer.Restart();
|
||||||
|
};
|
||||||
this.dalamud.ClientState.OnLogout += (sender, args) => {
|
this.dalamud.ClientState.OnLogout += (sender, args) => {
|
||||||
this.isTippyDrawing = false;
|
this.isTippyDrawing = false;
|
||||||
this.tippyState = TippyState.Intro;
|
|
||||||
|
this.tippyText = string.Empty;
|
||||||
|
this.tippyState = TippyState.BeforeIntro;
|
||||||
|
this.showTippyButton = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.welcomeTex = this.dalamud.InterfaceManager.LoadImage(
|
this.welcomeTex = this.dalamud.InterfaceManager.LoadImage(
|
||||||
|
|
@ -48,21 +57,7 @@ namespace Dalamud
|
||||||
this.bubbleTex = this.dalamud.InterfaceManager.LoadImage(
|
this.bubbleTex = this.dalamud.InterfaceManager.LoadImage(
|
||||||
Path.Combine(dalamud.StartInfo.AssetDirectory, "UIRes", "bubble.png"));
|
Path.Combine(dalamud.StartInfo.AssetDirectory, "UIRes", "bubble.png"));
|
||||||
|
|
||||||
this.tippyTimer.Start();
|
this.tippyFrameTimer.Start();
|
||||||
|
|
||||||
SetTippyAnim(TippyAnimState.Idle, true);
|
|
||||||
this.isTippyDrawing = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadTippyFrames(TippyAnimState anim, int start, int end) {
|
|
||||||
var frames = new TextureWrap[end - start];
|
|
||||||
|
|
||||||
for (var i = start; i < end; i++) {
|
|
||||||
frames[i - start] = this.dalamud.InterfaceManager.LoadImage(
|
|
||||||
Path.Combine(dalamud.StartInfo.AssetDirectory, "UIRes", "tippy", $"tile{i:D4}.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.tippyAnimFrames[anim] = frames;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw()
|
public void Draw()
|
||||||
|
|
@ -72,9 +67,10 @@ namespace Dalamud
|
||||||
|
|
||||||
if (this.frames < 2000)
|
if (this.frames < 2000)
|
||||||
{
|
{
|
||||||
ImGui.SetNextWindowSize(new Vector2(this.welcomeTex.Width, this.welcomeTex.Height + 28) * ImGui.GetIO().FontGlobalScale * WelcomeTexScale, ImGuiCond.Always);
|
ImGui.SetNextWindowSize(new Vector2(this.welcomeTex.Width, this.welcomeTex.Height) * ImGui.GetIO().FontGlobalScale * WelcomeTexScale, ImGuiCond.Always);
|
||||||
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0f, 0f));
|
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0f, 0f));
|
||||||
|
ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0f);
|
||||||
|
|
||||||
ImGui.Begin("Please wait...",
|
ImGui.Begin("Please wait...",
|
||||||
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar);
|
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar);
|
||||||
|
|
@ -83,11 +79,46 @@ namespace Dalamud
|
||||||
|
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
|
|
||||||
ImGui.PopStyleVar();
|
ImGui.PopStyleVar(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.frames++;
|
this.frames++;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
ImGui.Begin("Tippy AI debug");
|
||||||
|
|
||||||
|
ImGui.Text("State: " + this.tippyState);
|
||||||
|
|
||||||
|
foreach (var tippyAnimData in this.tippyAnimDatas)
|
||||||
|
{
|
||||||
|
if (ImGui.Button(tippyAnimData.Key.ToString()))
|
||||||
|
SetTippyAnim(tippyAnimData.Key, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.InputTextMultiline("Text Override", ref this.tippyText, 200, new Vector2(300, 120));
|
||||||
|
ImGui.Checkbox("Show button", ref this.showTippyButton);
|
||||||
|
ImGui.Checkbox("IsTippyDrawing", ref this.isTippyDrawing);
|
||||||
|
|
||||||
|
if (ImGui.Button("Play intro")) {
|
||||||
|
this.isTippyDrawing = true;
|
||||||
|
|
||||||
|
this.tippyText = string.Empty;
|
||||||
|
this.tippyState = TippyState.BeforeIntro;
|
||||||
|
this.showTippyButton = false;
|
||||||
|
|
||||||
|
this.tippyLogicTimer.Restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.Button("SetNewTip"))
|
||||||
|
SetNewTip();
|
||||||
|
|
||||||
|
foreach (var lastGeneralTip in this.lastGeneralTips) {
|
||||||
|
ImGui.Text(lastGeneralTip);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.End();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (this.isTippyDrawing)
|
if (this.isTippyDrawing)
|
||||||
DrawTippy();
|
DrawTippy();
|
||||||
}
|
}
|
||||||
|
|
@ -96,11 +127,14 @@ namespace Dalamud
|
||||||
|
|
||||||
private enum TippyState
|
private enum TippyState
|
||||||
{
|
{
|
||||||
|
BeforeIntro,
|
||||||
Intro,
|
Intro,
|
||||||
Tips
|
Tips,
|
||||||
|
Timeout,
|
||||||
|
Parse
|
||||||
}
|
}
|
||||||
|
|
||||||
private TippyState tippyState = TippyState.Intro;
|
private TippyState tippyState = TippyState.BeforeIntro;
|
||||||
|
|
||||||
private enum TippyAnimState
|
private enum TippyAnimState
|
||||||
{
|
{
|
||||||
|
|
@ -115,9 +149,6 @@ namespace Dalamud
|
||||||
CheckingYouOut
|
CheckingYouOut
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<TippyAnimState, TextureWrap[]> tippyAnimFrames =
|
|
||||||
new Dictionary<TippyAnimState, TextureWrap[]>();
|
|
||||||
|
|
||||||
private static readonly string[] GeneralTips = new[] {
|
private static readonly string[] GeneralTips = new[] {
|
||||||
"Vuln stacks really don't affect damage \nyou receive by that much, so ignore\nany healer that complains about you\nnot doing mechanics correctly.",
|
"Vuln stacks really don't affect damage \nyou receive by that much, so ignore\nany healer that complains about you\nnot doing mechanics correctly.",
|
||||||
"Wiping the party is an excellent\nmethod to clear away bad status\neffects, including death.",
|
"Wiping the party is an excellent\nmethod to clear away bad status\neffects, including death.",
|
||||||
|
|
@ -129,7 +160,6 @@ namespace Dalamud
|
||||||
"If you want to leave your party quickly\nand blame disconnect, just change\nyour PC time!",
|
"If you want to leave your party quickly\nand blame disconnect, just change\nyour PC time!",
|
||||||
"Also try the OwO plugin!",
|
"Also try the OwO plugin!",
|
||||||
"I will never leave you!",
|
"I will never leave you!",
|
||||||
"I'm always watching.",
|
|
||||||
"You cannot hide any longer.",
|
"You cannot hide any longer.",
|
||||||
"Powered by XIVLauncher!",
|
"Powered by XIVLauncher!",
|
||||||
"When playing Hunter, specialize your\npet into taunting to help out your tank!",
|
"When playing Hunter, specialize your\npet into taunting to help out your tank!",
|
||||||
|
|
@ -138,6 +168,8 @@ namespace Dalamud
|
||||||
"This text is powered by duck energy!"
|
"This text is powered by duck energy!"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static readonly string Intro =
|
||||||
|
"Hi, I'm Tippy!\n\nI'm your new friend and assistant.\n\nI will help you get better at FFXIV!";
|
||||||
private static readonly string GoodSong = "Man, this song is great!";
|
private static readonly string GoodSong = "Man, this song is great!";
|
||||||
|
|
||||||
private static readonly string[] PldTips = new[] {
|
private static readonly string[] PldTips = new[] {
|
||||||
|
|
@ -223,21 +255,47 @@ namespace Dalamud
|
||||||
private string currentTip = string.Empty;
|
private string currentTip = string.Empty;
|
||||||
private long lastTipFrame = 0;
|
private long lastTipFrame = 0;
|
||||||
|
|
||||||
private string tippyTextOverride = string.Empty;
|
private string tippyText = string.Empty;
|
||||||
private bool showTippyButton = true;
|
private bool showTippyButton = false;
|
||||||
|
|
||||||
|
private SoundPlayer sounds = new SoundPlayer();
|
||||||
|
|
||||||
|
private Random rand = new Random();
|
||||||
|
|
||||||
|
private void PlayTada() {
|
||||||
|
this.sounds.SoundLocation = Path.Combine(dalamud.StartInfo.AssetDirectory, "UIRes", "tada.wav");
|
||||||
|
this.sounds.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlayChord()
|
||||||
|
{
|
||||||
|
this.sounds.SoundLocation = Path.Combine(dalamud.StartInfo.AssetDirectory, "UIRes", "chord.wav");
|
||||||
|
this.sounds.Play();
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawTippy()
|
private void DrawTippy()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(this.currentTip))
|
if (this.tippyState == TippyState.BeforeIntro && this.tippyLogicTimer.ElapsedMilliseconds > 8000) {
|
||||||
{
|
PlayTada();
|
||||||
this.currentTip = CalcNewTip();
|
SetTippyAnim(TippyAnimState.GetAttention, true);
|
||||||
this.lastTipFrame = this.frames;
|
this.tippyText = Intro;
|
||||||
|
this.showTippyButton = true;
|
||||||
|
this.tippyState = TippyState.Intro;
|
||||||
|
} else if (this.tippyState == TippyState.BeforeIntro) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.frames - this.lastTipFrame > 2000)
|
switch (tippyState) {
|
||||||
{
|
case TippyState.Tips:
|
||||||
this.currentTip = CalcNewTip();
|
if (this.tippyLogicTimer.ElapsedMilliseconds > 120000 && string.IsNullOrEmpty(this.tippyText))
|
||||||
this.lastTipFrame = this.frames;
|
SetNewTip();
|
||||||
|
break;
|
||||||
|
case TippyState.Timeout:
|
||||||
|
if (this.tippyLogicTimer.ElapsedMilliseconds > 60000) {
|
||||||
|
SetNewTip();
|
||||||
|
this.tippyState = TippyState.Tips;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var displaySize = ImGui.GetIO().DisplaySize;
|
var displaySize = ImGui.GetIO().DisplaySize;
|
||||||
|
|
@ -249,28 +307,19 @@ namespace Dalamud
|
||||||
|
|
||||||
ImGui.PushStyleColor(ImGuiCol.WindowBg, new Vector4(0, 0, 0, 0));
|
ImGui.PushStyleColor(ImGuiCol.WindowBg, new Vector4(0, 0, 0, 0));
|
||||||
|
|
||||||
ImGui.Begin("###TippyWindow", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoMouseInputs | ImGuiWindowFlags.NoFocusOnAppearing);
|
ImGui.Begin("###TippyWindow", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoMouseInputs | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoBringToFrontOnFocus);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(this.tippyTextOverride))
|
ImGui.PushFont(InterfaceManager.FoolsFont);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(this.tippyText))
|
||||||
{
|
{
|
||||||
switch (tippyState)
|
DrawTextBox(this.tippyText);
|
||||||
{
|
|
||||||
case TippyState.Intro:
|
|
||||||
DrawTextBox("Hi, I'm Tippy!\n\nI'm your new friend and assistant.\n\nI will help you get better at FFXIV!");
|
|
||||||
break;
|
|
||||||
case TippyState.Tips:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DrawTextBox(this.tippyTextOverride);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGui.SetCursorPosX(230);
|
ImGui.SetCursorPosX(230);
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 55);
|
ImGui.SetCursorPosY(18 + 55);
|
||||||
|
|
||||||
DrawTippyAnim();
|
DrawTippyAnim();
|
||||||
|
|
||||||
|
|
@ -284,9 +333,42 @@ namespace Dalamud
|
||||||
|
|
||||||
if (this.showTippyButton) {
|
if (this.showTippyButton) {
|
||||||
ImGui.SetNextWindowPos(tippyPos + new Vector2(117, 117), ImGuiCond.Always);
|
ImGui.SetNextWindowPos(tippyPos + new Vector2(117, 117), ImGuiCond.Always);
|
||||||
ImGui.SetNextWindowSize(new Vector2(90, 40), ImGuiCond.Always);
|
ImGui.SetNextWindowSize(new Vector2(95, 40), ImGuiCond.Always);
|
||||||
|
//ImGui.SetNextWindowFocus();
|
||||||
ImGui.Begin("###TippyButton", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse);
|
ImGui.Begin("###TippyButton", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse);
|
||||||
ImGui.Button("OK!", new Vector2(80, 20));
|
|
||||||
|
if (ImGui.Button("OK!", new Vector2(80, 20)))
|
||||||
|
{
|
||||||
|
switch (tippyState) {
|
||||||
|
case TippyState.Intro:
|
||||||
|
this.showTippyButton = false;
|
||||||
|
this.tippyText = string.Empty;
|
||||||
|
SetTippyAnim(TippyAnimState.Idle, true);
|
||||||
|
|
||||||
|
this.tippyState = TippyState.Tips;
|
||||||
|
this.tippyLogicTimer.Restart();
|
||||||
|
break;
|
||||||
|
case TippyState.Tips:
|
||||||
|
SetTippyAnim(TippyAnimState.Idle, true);
|
||||||
|
this.tippyText = string.Empty;
|
||||||
|
this.showTippyButton = false;
|
||||||
|
|
||||||
|
this.tippyLogicTimer.Restart();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TippyState.Parse:
|
||||||
|
Process.Start("https://na.finalfantasyxiv.com/jobguide/pvp/");
|
||||||
|
|
||||||
|
this.showTippyButton = false;
|
||||||
|
this.tippyText = string.Empty;
|
||||||
|
SetTippyAnim(TippyAnimState.Idle, true);
|
||||||
|
|
||||||
|
this.tippyState = TippyState.Tips;
|
||||||
|
this.tippyLogicTimer.Restart();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,27 +378,10 @@ namespace Dalamud
|
||||||
|
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
|
|
||||||
ImGui.Begin("Tippy AI debug");
|
|
||||||
|
|
||||||
ImGui.Text("State: " + this.tippyState);
|
|
||||||
|
|
||||||
foreach (var tippyAnimData in this.tippyAnimDatas) {
|
|
||||||
if (ImGui.Button(tippyAnimData.Key.ToString()))
|
|
||||||
SetTippyAnim(tippyAnimData.Key, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.InputTextMultiline("Text Override", ref this.tippyTextOverride, 200, new Vector2(300, 120));
|
|
||||||
ImGui.Checkbox("Show button", ref this.showTippyButton);
|
|
||||||
|
|
||||||
ImGui.End();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawTextBox(string text) {
|
private void DrawTextBox(string text) {
|
||||||
ImGui.PushFont(InterfaceManager.FoolsFont);
|
|
||||||
|
|
||||||
var beforeBubbleCursor = ImGui.GetCursorPos();
|
var beforeBubbleCursor = ImGui.GetCursorPos();
|
||||||
ImGui.Image(this.bubbleTex.ImGuiHandle, new Vector2(this.bubbleTex.Width, this.bubbleTex.Height) * ImGui.GetIO().FontGlobalScale * BubbleScale);
|
ImGui.Image(this.bubbleTex.ImGuiHandle, new Vector2(this.bubbleTex.Width, this.bubbleTex.Height) * ImGui.GetIO().FontGlobalScale * BubbleScale);
|
||||||
|
|
@ -398,8 +463,6 @@ namespace Dalamud
|
||||||
var frameCoords = GetTippyTexCoords(this.startTippyFrame + this.currentTippyFrame);
|
var frameCoords = GetTippyTexCoords(this.startTippyFrame + this.currentTippyFrame);
|
||||||
var botRight = ToSpriteSheetScale(frameCoords + this.tippySingleSize);
|
var botRight = ToSpriteSheetScale(frameCoords + this.tippySingleSize);
|
||||||
|
|
||||||
Log.Verbose($"Drawing Tippy: {this.tippyAnim} {this.currentTippyFrame} / {FramesInTippyAnimation} up:{this.tippyAnimUp} {this.tippyAnimDone} cx:{frameCoords.X} cy:{frameCoords.Y} rx:{botRight.X} ry:{botRight.Y}");
|
|
||||||
|
|
||||||
if (this.currentTippyFrame > FramesInTippyAnimation - 2) {
|
if (this.currentTippyFrame > FramesInTippyAnimation - 2) {
|
||||||
this.tippyAnimDone = true;
|
this.tippyAnimDone = true;
|
||||||
if (!this.tippyLoopAnim)
|
if (!this.tippyLoopAnim)
|
||||||
|
|
@ -412,13 +475,10 @@ namespace Dalamud
|
||||||
this.tippyAnimUp = true;
|
this.tippyAnimUp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ImGui.Image(this.tippySpriteSheet.ImGuiHandle, this.tippySingleSize * ImGui.GetIO().FontGlobalScale * TippyScale, ToSpriteSheetScale(frameCoords), botRight);
|
ImGui.Image(this.tippySpriteSheet.ImGuiHandle, this.tippySingleSize * ImGui.GetIO().FontGlobalScale * TippyScale, ToSpriteSheetScale(frameCoords), botRight);
|
||||||
|
|
||||||
ImGui.Text(this.currentTippyFrame.ToString());
|
this.currentFrameTime += this.tippyFrameTimer.ElapsedMilliseconds;
|
||||||
|
this.tippyFrameTimer.Restart();
|
||||||
this.currentFrameTime += this.tippyTimer.ElapsedMilliseconds;
|
|
||||||
this.tippyTimer.Restart();
|
|
||||||
|
|
||||||
if (this.currentFrameTime >= this.minFrameTime) {
|
if (this.currentFrameTime >= this.minFrameTime) {
|
||||||
if (this.tippyAnimUp)
|
if (this.tippyAnimUp)
|
||||||
|
|
@ -433,30 +493,105 @@ namespace Dalamud
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string CalcNewTip()
|
private Queue<string> lastGeneralTips = new Queue<string>();
|
||||||
|
|
||||||
|
private string GetGeneralTip()
|
||||||
{
|
{
|
||||||
var rand = new Random();
|
var gti = this.rand.Next(0, GeneralTips.Length);
|
||||||
|
var generalTip = GeneralTips[gti];
|
||||||
|
|
||||||
|
while (this.lastGeneralTips.Any(x => x == generalTip)) {
|
||||||
|
gti = this.rand.Next(0, GeneralTips.Length);
|
||||||
|
generalTip = GeneralTips[gti];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastGeneralTips.Enqueue(generalTip);
|
||||||
|
|
||||||
|
if (this.lastGeneralTips.Count > 5)
|
||||||
|
this.lastGeneralTips.Dequeue();
|
||||||
|
|
||||||
|
return generalTip;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetNewTip()
|
||||||
|
{
|
||||||
|
var anim = this.rand.Next(0, 3);
|
||||||
|
switch (anim) {
|
||||||
|
case 0: SetTippyAnim(TippyAnimState.PointLeft, true);
|
||||||
|
break;
|
||||||
|
case 1: SetTippyAnim(TippyAnimState.GetAttention2, true);
|
||||||
|
break;
|
||||||
|
case 2: SetTippyAnim(TippyAnimState.GetAttention, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var lp = this.dalamud.ClientState.LocalPlayer;
|
var lp = this.dalamud.ClientState.LocalPlayer;
|
||||||
|
|
||||||
var gti = rand.Next(0, GeneralTips.Length);
|
var generalTip = GetGeneralTip();
|
||||||
var generalTip = GeneralTips[gti];
|
|
||||||
|
|
||||||
if (lp == null || rand.Next(0, 32) < 8)
|
var choice = this.rand.Next(0, 28);
|
||||||
|
|
||||||
|
|
||||||
|
Log.Information($"Choice: {choice}");
|
||||||
|
|
||||||
|
var classJob = 14u;
|
||||||
|
if (lp != null)
|
||||||
|
classJob = lp.ClassJob.Id;
|
||||||
|
|
||||||
|
var hasJobTips = jobTipDict.TryGetValue(classJob, out var ccTips);
|
||||||
|
|
||||||
|
if (choice < 8)
|
||||||
{
|
{
|
||||||
return generalTip;
|
this.tippyText = generalTip;
|
||||||
|
|
||||||
|
PlayTada();
|
||||||
|
this.showTippyButton = true;
|
||||||
|
}
|
||||||
|
else if (choice == 9 || choice == 10) {
|
||||||
|
this.tippyState = TippyState.Timeout;
|
||||||
|
this.tippyText = "Analyzing ERP logs...";
|
||||||
|
SetTippyAnim(TippyAnimState.Reading, true);
|
||||||
|
this.showTippyButton = false;
|
||||||
|
|
||||||
|
this.tippyLogicTimer.Restart();
|
||||||
|
|
||||||
|
PlayChord();
|
||||||
|
}
|
||||||
|
else if (choice == 11) {
|
||||||
|
this.tippyState = TippyState.Timeout;
|
||||||
|
this.tippyText = "I'm always watching.";
|
||||||
|
SetTippyAnim(TippyAnimState.CheckingYouOut, true);
|
||||||
|
this.showTippyButton = false;
|
||||||
|
|
||||||
|
this.tippyLogicTimer.Restart();
|
||||||
|
|
||||||
|
PlayChord();
|
||||||
|
}
|
||||||
|
else if (choice == 12)
|
||||||
|
{
|
||||||
|
this.tippyState = TippyState.Parse;
|
||||||
|
this.tippyText = "It seems like you are parsing grey.\n\nDo you want me to help you play your\njob better?";
|
||||||
|
SetTippyAnim(TippyAnimState.Reading, true);
|
||||||
|
this.showTippyButton = true;
|
||||||
|
|
||||||
|
this.tippyLogicTimer.Restart();
|
||||||
|
|
||||||
|
PlayChord();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (jobTipDict.TryGetValue(lp.ClassJob.Id, out var ccTips))
|
if (hasJobTips)
|
||||||
{
|
{
|
||||||
var ti = rand.Next(0, ccTips.Length);
|
var ti = rand.Next(0, ccTips.Length);
|
||||||
return ccTips[ti];
|
this.tippyText = ccTips[ti];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return generalTip;
|
this.tippyText = generalTip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayTada();
|
||||||
|
this.showTippyButton = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -464,11 +599,7 @@ namespace Dalamud
|
||||||
{
|
{
|
||||||
this.welcomeTex.Dispose();
|
this.welcomeTex.Dispose();
|
||||||
this.tippySpriteSheet.Dispose();
|
this.tippySpriteSheet.Dispose();
|
||||||
|
this.bubbleTex.Dispose();
|
||||||
foreach (var anim in this.tippyAnimFrames.Values.SelectMany(x => x))
|
|
||||||
{
|
|
||||||
anim.Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue