glyph
This commit is contained in:
parent
0538d65440
commit
41ef323b6b
|
@ -20,6 +20,8 @@ internal class Message {
|
|||
public int NegativeVotes { get; set; }
|
||||
public int UserVote { get; set; }
|
||||
|
||||
public int Glyph { get; set; }
|
||||
|
||||
internal Vector3 Position => new(this.X, this.Y, this.Z);
|
||||
}
|
||||
|
||||
|
@ -40,6 +42,8 @@ internal class MessageWithTerritory {
|
|||
public int NegativeVotes { get; init; }
|
||||
public int UserVote { get; set; }
|
||||
|
||||
public int Glyph { get; set; }
|
||||
|
||||
internal Vector3 Position => new(this.X, this.Y, this.Z);
|
||||
|
||||
internal static MessageWithTerritory From(Message message, uint territory) {
|
||||
|
@ -54,6 +58,7 @@ internal class MessageWithTerritory {
|
|||
PositiveVotes = message.PositiveVotes,
|
||||
NegativeVotes = message.NegativeVotes,
|
||||
UserVote = message.UserVote,
|
||||
Glyph = message.Glyph,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,4 +32,6 @@ public class MessageRequest {
|
|||
|
||||
[JsonProperty("word_2_word")]
|
||||
public int? Word2Word { get; set; }
|
||||
|
||||
public int Glyph { get; set; }
|
||||
}
|
||||
|
|
|
@ -8,7 +8,13 @@ using OrangeGuidanceTomestone.Helpers;
|
|||
namespace OrangeGuidanceTomestone;
|
||||
|
||||
internal class Messages : IDisposable {
|
||||
internal const string VfxPath = "bg/ffxiv/fst_f1/common/vfx/eff/b0941trp1d_o.avfx";
|
||||
internal static readonly string[] VfxPaths = {
|
||||
"bg/ffxiv/fst_f1/common/vfx/eff/b0941trp1a_o.avfx",
|
||||
"bg/ffxiv/fst_f1/common/vfx/eff/b0941trp1b_o.avfx",
|
||||
"bg/ffxiv/fst_f1/common/vfx/eff/b0941trp1c_o.avfx",
|
||||
"bg/ffxiv/fst_f1/common/vfx/eff/b0941trp1d_o.avfx",
|
||||
"bg/ffxiv/fst_f1/common/vfx/eff/b0941trp1e_o.avfx",
|
||||
};
|
||||
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
|
@ -64,7 +70,10 @@ internal class Messages : IDisposable {
|
|||
|
||||
PluginLog.Debug($"spawning vfx for {message.Id}");
|
||||
var rotation = Quaternion.CreateFromYawPitchRoll(message.Yaw, 0, 0);
|
||||
if (this.Plugin.Vfx.SpawnStatic(message.Id, VfxPath, message.Position, rotation) == null) {
|
||||
var path = message.Glyph < 0 || message.Glyph >= VfxPaths.Length
|
||||
? VfxPaths[0]
|
||||
: VfxPaths[message.Glyph];
|
||||
if (this.Plugin.Vfx.SpawnStatic(message.Id, path, message.Position, rotation) == null) {
|
||||
PluginLog.Debug("trying again");
|
||||
this.SpawnQueue.Enqueue(message);
|
||||
}
|
||||
|
|
|
@ -35,11 +35,14 @@ internal unsafe class VfxReplacer : IDisposable {
|
|||
}
|
||||
|
||||
var path = fileDescriptor->ResourceHandle->FileName.ToString();
|
||||
if (path != Messages.VfxPath) {
|
||||
var index = Array.IndexOf(Messages.VfxPaths, path);
|
||||
if (index == -1) {
|
||||
goto Original;
|
||||
}
|
||||
|
||||
return this.DefaultRootedResourceLoad(this.Plugin.AvfxFilePath, resourceManager, fileDescriptor, priority, isSync);
|
||||
var letter = (char) ('a' + index);
|
||||
var newPath = Path.Join(this.Plugin.AvfxFilePath, $"sign_{letter}.avfx");
|
||||
return this.DefaultRootedResourceLoad(newPath, resourceManager, fileDescriptor, priority, isSync);
|
||||
|
||||
Original:
|
||||
return this._readSqPackHook.Original(resourceManager, fileDescriptor, priority, isSync);
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<ItemGroup>
|
||||
<EmbeddedResource Include="../server/packs/*.yaml" LinkBase="packs"/>
|
||||
<EmbeddedResource Remove="../server/packs/*_old*.yaml"/>
|
||||
<EmbeddedResource Include="MiniPenumbra\b0941trp1d_o.avfx"/>
|
||||
<EmbeddedResource Include="vfx/b0941trp1*_o.avfx"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -73,10 +73,14 @@ public class Plugin : IDalamudPlugin {
|
|||
private string CopyAvfxFile() {
|
||||
var configDir = this.Interface!.GetPluginConfigDirectory();
|
||||
Directory.CreateDirectory(configDir);
|
||||
var stream = Resourcer.Resource.AsStream("MiniPenumbra/b0941trp1d_o.avfx");
|
||||
var path = Path.Join(configDir, "sign.avfx");
|
||||
stream.CopyTo(File.Create(path));
|
||||
return path;
|
||||
for (var i = 0; i < 5; i++) {
|
||||
var letter = (char) ('a' + i);
|
||||
var stream = Resourcer.Resource.AsStreamUnChecked($"OrangeGuidancetomestone.vfx.b0941trp1{letter}_o.avfx");
|
||||
var path = Path.Join(configDir, $"sign_{letter}.avfx");
|
||||
stream.CopyTo(File.Create(path));
|
||||
}
|
||||
|
||||
return configDir;
|
||||
}
|
||||
|
||||
internal void GetApiKey() {
|
||||
|
|
|
@ -17,6 +17,7 @@ internal class Write : ITab {
|
|||
private int _conj = -1;
|
||||
private int _part2 = -1;
|
||||
private (int, int) _word2 = (-1, -1);
|
||||
private int _glyph;
|
||||
|
||||
internal Write(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
|
@ -135,6 +136,16 @@ internal class Write : ITab {
|
|||
}
|
||||
}
|
||||
|
||||
if (ImGui.BeginCombo("Glyph", this._glyph.ToString())) {
|
||||
for (var i = 0; i < 5; i++) {
|
||||
if (ImGui.Selectable($"{i}", this._glyph == i)) {
|
||||
this._glyph = i;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
|
||||
this.ClearIfNecessary();
|
||||
|
||||
var valid = this.ValidSetup();
|
||||
|
@ -160,6 +171,7 @@ internal class Write : ITab {
|
|||
Template2 = this._part2 == -1 ? null : this._part2,
|
||||
Word2List = this._word2.Item1 == -1 ? null : this._word2.Item1,
|
||||
Word2Word = this._word2.Item2 == -1 ? null : this._word2.Item2,
|
||||
Glyph = this._glyph,
|
||||
};
|
||||
|
||||
var json = JsonConvert.SerializeObject(req);
|
||||
|
@ -182,6 +194,7 @@ internal class Write : ITab {
|
|||
Text = actualText,
|
||||
NegativeVotes = 0,
|
||||
PositiveVotes = 0,
|
||||
Glyph = this._glyph,
|
||||
};
|
||||
|
||||
this.Plugin.Messages.Add(newMsg);
|
||||
|
@ -203,6 +216,7 @@ internal class Write : ITab {
|
|||
this._part1 = this._part2 = this._conj = -1;
|
||||
this._word1 = (-1, -1);
|
||||
this._word2 = (-1, -1);
|
||||
this._glyph = 0;
|
||||
}
|
||||
|
||||
private void ClearIfNecessary() {
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
alter table messages
|
||||
add column glyph integer not null default 0;
|
|
@ -20,6 +20,9 @@ pub struct Message {
|
|||
pub template_2: Option<usize>,
|
||||
pub word_2_list: Option<usize>,
|
||||
pub word_2_word: Option<usize>,
|
||||
|
||||
#[serde(default)]
|
||||
pub glyph: i8,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
|
@ -33,6 +36,7 @@ pub struct RetrievedMessage {
|
|||
pub positive_votes: i32,
|
||||
pub negative_votes: i32,
|
||||
pub user_vote: i64,
|
||||
pub glyph: i64,
|
||||
#[serde(skip)]
|
||||
pub created: NaiveDateTime,
|
||||
#[serde(skip)]
|
||||
|
@ -58,6 +62,7 @@ pub struct RetrievedMessageTerritory {
|
|||
pub positive_votes: i32,
|
||||
pub negative_votes: i32,
|
||||
pub user_vote: i64,
|
||||
pub glyph: i64,
|
||||
#[serde(skip)]
|
||||
pub created: NaiveDateTime,
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ async fn logic(state: Arc<State>, id: i64, location: u32) -> Result<impl Reply,
|
|||
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
||||
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
||||
v2.vote as user_vote,
|
||||
m.glyph,
|
||||
m.created,
|
||||
m.user
|
||||
from messages m
|
||||
|
|
|
@ -35,6 +35,7 @@ async fn logic(state: Arc<State>, id: i64, message_id: Uuid) -> Result<impl Repl
|
|||
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
||||
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
||||
v2.vote as user_vote,
|
||||
m.glyph,
|
||||
m.created
|
||||
from messages m
|
||||
left join votes v on m.id = v.message
|
||||
|
|
|
@ -39,6 +39,7 @@ async fn logic(state: Arc<State>, id: i64, extra: i64, mut query: HashMap<String
|
|||
coalesce(sum(v.vote between 0 and 1), 0) as positive_votes,
|
||||
coalesce(sum(v.vote between -1 and 0), 0) as negative_votes,
|
||||
v2.vote as user_vote,
|
||||
m.glyph,
|
||||
m.created
|
||||
from messages m
|
||||
left join votes v on m.id = v.message
|
||||
|
|
|
@ -57,7 +57,7 @@ async fn logic(state: Arc<State>, id: i64, extra: i64, message: Message) -> Resu
|
|||
|
||||
sqlx::query!(
|
||||
// language=sqlite
|
||||
"insert into messages (id, user, territory, x, y, z, yaw, message) values (?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"insert into messages (id, user, territory, x, y, z, yaw, message, glyph) values (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
message_id,
|
||||
id,
|
||||
territory,
|
||||
|
@ -66,6 +66,7 @@ async fn logic(state: Arc<State>, id: i64, extra: i64, message: Message) -> Resu
|
|||
message.z,
|
||||
message.yaw,
|
||||
text,
|
||||
message.glyph,
|
||||
)
|
||||
.execute(&state.db)
|
||||
.await
|
||||
|
|
Loading…
Reference in New Issue