Remove Artisan code.

This commit is contained in:
Ottermandias 2024-08-15 15:58:04 +02:00
parent a7c5d513d4
commit fc6604fd5a
3 changed files with 2 additions and 152 deletions

View file

@ -1,7 +1,5 @@
using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Glamourer.GameData;
using Glamourer.Services;
@ -17,7 +15,6 @@ namespace Glamourer.Gui.Customization;
public partial class CustomizationDrawer(
ITextureProvider textures,
CustomizeService _service,
CodeService _codes,
Configuration _config,
FavoriteManager _favorites,
HeightService _heightService)
@ -119,9 +116,6 @@ public partial class CustomizationDrawer(
try
{
if (_codes.Enabled(CodeService.CodeFlag.Artisan))
return DrawArtisan();
DrawRaceGenderSelector();
DrawBodyType();
@ -156,31 +150,6 @@ public partial class CustomizationDrawer(
}
}
private unsafe bool DrawArtisan()
{
for (var i = 0; i < CustomizeArray.Size; ++i)
{
using var id = ImRaii.PushId(i);
int value = _customize.Data[i];
ImGui.SetNextItemWidth(40 * ImGuiHelpers.GlobalScale);
if (ImGui.InputInt(string.Empty, ref value, 0, 0))
{
var newValue = (byte)Math.Clamp(value, 0, byte.MaxValue);
if (newValue != _customize.Data[i])
foreach (var flag in Enum.GetValues<CustomizeIndex>())
{
var (j, _) = flag.ToByteAndMask();
if (j == i)
Changed |= flag.ToFlag();
}
_customize.Data[i] = newValue;
}
}
return Changed != 0;
}
private void UpdateSizes()
{
_spacing = ImGui.GetStyle().ItemSpacing with { X = ImGui.GetStyle().ItemInnerSpacing.X };

View file

@ -27,7 +27,6 @@ public class EquipmentDrawer
private readonly ItemCombo[] _itemCombo;
private readonly BonusItemCombo[] _bonusItemCombo;
private readonly Dictionary<FullEquipType, WeaponCombo> _weaponCombo;
private readonly CodeService _codes;
private readonly TextureService _textures;
private readonly Configuration _config;
private readonly GPoseService _gPose;
@ -38,11 +37,10 @@ public class EquipmentDrawer
private Stain? _draggedStain;
public EquipmentDrawer(FavoriteManager favorites, IDataManager gameData, ItemManager items, CodeService codes, TextureService textures,
public EquipmentDrawer(FavoriteManager favorites, IDataManager gameData, ItemManager items, TextureService textures,
Configuration config, GPoseService gPose, AdvancedDyePopup advancedDyes)
{
_items = items;
_codes = codes;
_textures = textures;
_config = config;
_gPose = gPose;
@ -99,8 +97,6 @@ public class EquipmentDrawer
if (_config.SmallEquip)
DrawEquipSmall(equipDrawData);
else if (!equipDrawData.Locked && _codes.Enabled(CodeService.CodeFlag.Artisan))
DrawEquipArtisan(equipDrawData);
else
DrawEquipNormal(equipDrawData);
}
@ -137,8 +133,6 @@ public class EquipmentDrawer
if (_config.SmallEquip)
DrawWeaponsSmall(mainhand, offhand, allWeapons);
else if (!mainhand.Locked && _codes.Enabled(CodeService.CodeFlag.Artisan))
DrawWeaponsArtisan(mainhand, offhand);
else
DrawWeaponsNormal(mainhand, offhand, allWeapons);
}
@ -186,116 +180,6 @@ public class EquipmentDrawer
return change;
}
#region Artisan
private void DrawEquipArtisan(EquipDrawData data)
{
DrawStainArtisan(data);
ImGui.SameLine();
DrawArmorArtisan(data);
if (!data.DisplayApplication)
return;
ImGui.SameLine();
DrawApply(data);
ImGui.SameLine();
DrawApplyStain(data);
}
private void DrawWeaponsArtisan(in EquipDrawData mainhand, in EquipDrawData offhand)
{
using (var _ = ImRaii.PushId(0))
{
DrawStainArtisan(mainhand);
ImGui.SameLine();
DrawWeapon(mainhand);
}
using (var _ = ImRaii.PushId(1))
{
DrawStainArtisan(offhand);
ImGui.SameLine();
DrawWeapon(offhand);
}
return;
void DrawWeapon(in EquipDrawData current)
{
int setId = current.CurrentItem.PrimaryId.Id;
int type = current.CurrentItem.SecondaryId.Id;
int variant = current.CurrentItem.Variant.Id;
ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale);
if (ImGui.InputInt("##setId", ref setId, 0, 0))
{
var newSetId = (PrimaryId)Math.Clamp(setId, 0, ushort.MaxValue);
if (newSetId.Id != current.CurrentItem.PrimaryId.Id)
current.SetItem(_items.Identify(current.Slot, newSetId, current.CurrentItem.SecondaryId, current.CurrentItem.Variant));
}
ImGui.SameLine();
ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale);
if (ImGui.InputInt("##type", ref type, 0, 0))
{
var newType = (SecondaryId)Math.Clamp(type, 0, ushort.MaxValue);
if (newType.Id != current.CurrentItem.SecondaryId.Id)
current.SetItem(_items.Identify(current.Slot, current.CurrentItem.PrimaryId, newType, current.CurrentItem.Variant));
}
ImGui.SameLine();
ImGui.SetNextItemWidth(40 * ImGuiHelpers.GlobalScale);
if (ImGui.InputInt("##variant", ref variant, 0, 0))
{
var newVariant = (Variant)Math.Clamp(variant, 0, byte.MaxValue);
if (newVariant.Id != current.CurrentItem.Variant.Id)
current.SetItem(_items.Identify(current.Slot, current.CurrentItem.PrimaryId, current.CurrentItem.SecondaryId,
newVariant));
}
}
}
/// <summary> Draw an input for stain that can set arbitrary values instead of choosing valid stains. </summary>
private static void DrawStainArtisan(EquipDrawData data)
{
foreach (var (stain, index) in data.CurrentStains.WithIndex())
{
using var id = ImUtf8.PushId(index);
int stainId = stain.Id;
ImGui.SetNextItemWidth(40 * ImGuiHelpers.GlobalScale);
if (!ImGui.InputInt("##stain", ref stainId, 0, 0))
return;
var newStainId = (StainId)Math.Clamp(stainId, 0, byte.MaxValue);
if (newStainId != stain.Id)
data.SetStains(data.CurrentStains.With(index, newStainId));
}
}
/// <summary> Draw an input for armor that can set arbitrary values instead of choosing items. </summary>
private void DrawArmorArtisan(EquipDrawData data)
{
int setId = data.CurrentItem.PrimaryId.Id;
int variant = data.CurrentItem.Variant.Id;
ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale);
if (ImGui.InputInt("##setId", ref setId, 0, 0))
{
var newSetId = (PrimaryId)Math.Clamp(setId, 0, ushort.MaxValue);
if (newSetId.Id != data.CurrentItem.PrimaryId.Id)
data.SetItem(_items.Identify(data.Slot, newSetId, data.CurrentItem.Variant));
}
ImGui.SameLine();
ImGui.SetNextItemWidth(40 * ImGuiHelpers.GlobalScale);
if (ImGui.InputInt("##variant", ref variant, 0, 0))
{
var newVariant = (byte)Math.Clamp(variant, 0, byte.MaxValue);
if (newVariant != data.CurrentItem.Variant)
data.SetItem(_items.Identify(data.Slot, data.CurrentItem.PrimaryId, newVariant));
}
}
#endregion
#region Small
private void DrawEquipSmall(in EquipDrawData equipDrawData)

View file

@ -23,7 +23,7 @@ public class CodeService
OopsAuRa = 0x000400,
OopsHrothgar = 0x000800,
OopsViera = 0x001000,
Artisan = 0x002000,
//Artisan = 0x002000,
SixtyThree = 0x004000,
Shirts = 0x008000,
World = 0x010000,
@ -182,7 +182,6 @@ public class CodeService
CodeFlag.OopsAuRa => (FullCodes | RaceCodes) & ~CodeFlag.OopsAuRa,
CodeFlag.OopsHrothgar => (FullCodes | RaceCodes) & ~CodeFlag.OopsHrothgar,
CodeFlag.OopsViera => (FullCodes | RaceCodes) & ~CodeFlag.OopsViera,
CodeFlag.Artisan => 0,
CodeFlag.SixtyThree => FullCodes,
CodeFlag.Shirts => 0,
CodeFlag.World => (FullCodes | DyeCodes | GearCodes) & ~CodeFlag.World,
@ -211,7 +210,6 @@ public class CodeService
CodeFlag.OopsAuRa => [ 0x69, 0x93, 0xAF, 0xE4, 0xB8, 0xEC, 0x5F, 0x40, 0xEB, 0x8A, 0x6F, 0xD1, 0x9B, 0xD9, 0x56, 0x0B, 0xEA, 0x64, 0x79, 0x9B, 0x54, 0xA1, 0x41, 0xED, 0xBC, 0x3E, 0x6E, 0x5C, 0xF1, 0x23, 0x60, 0xF8 ],
CodeFlag.OopsHrothgar => [ 0x41, 0xEC, 0x65, 0x05, 0x8D, 0x20, 0x68, 0x5A, 0xB7, 0xEB, 0x92, 0x15, 0x43, 0xCF, 0x15, 0x05, 0x27, 0x51, 0xFE, 0x20, 0xC9, 0xB6, 0x2B, 0x84, 0xD9, 0x6A, 0x49, 0x5A, 0x5B, 0x7F, 0x2E, 0xE7 ],
CodeFlag.OopsViera => [ 0x16, 0xFF, 0x63, 0x85, 0x1C, 0xF5, 0x34, 0x33, 0x67, 0x8C, 0x46, 0x8E, 0x3E, 0xE3, 0xA6, 0x94, 0xF9, 0x74, 0x47, 0xAA, 0xC7, 0x29, 0x59, 0x1F, 0x6C, 0x6E, 0xF2, 0xF5, 0x87, 0x24, 0x9E, 0x2B ],
CodeFlag.Artisan => [ 0xDE, 0x01, 0x32, 0x1E, 0x7F, 0x22, 0x80, 0x3D, 0x76, 0xDF, 0x74, 0x0E, 0xEC, 0x33, 0xD3, 0xF4, 0x1A, 0x98, 0x9E, 0x9D, 0x22, 0x5C, 0xAC, 0x3B, 0xFE, 0x0B, 0xC2, 0x13, 0xB9, 0x91, 0x24, 0x61 ],
CodeFlag.SixtyThree => [ 0xA1, 0x65, 0x60, 0x99, 0xB0, 0x9F, 0xBF, 0xD7, 0x20, 0xC8, 0x29, 0xF6, 0x7B, 0x86, 0x27, 0xF5, 0xBE, 0xA9, 0x5B, 0xB0, 0x20, 0x5E, 0x57, 0x7B, 0xFF, 0xBC, 0x1E, 0x8C, 0x04, 0xF9, 0x35, 0xD3 ],
CodeFlag.Shirts => [ 0xD1, 0x35, 0xD7, 0x18, 0xBE, 0x45, 0x42, 0xBD, 0x88, 0x77, 0x7E, 0xC4, 0x41, 0x06, 0x34, 0x4D, 0x71, 0x3A, 0xC5, 0xCC, 0xA4, 0x1B, 0x7D, 0x3F, 0x3B, 0x86, 0x07, 0xCB, 0x63, 0xD7, 0xF9, 0xDB ],
CodeFlag.World => [ 0xFD, 0xA2, 0xD2, 0xBC, 0xD9, 0x8A, 0x7E, 0x2B, 0x52, 0xCB, 0x57, 0x6E, 0x3A, 0x2E, 0x30, 0xBA, 0x4E, 0xAE, 0x42, 0xEA, 0x5C, 0x57, 0xDF, 0x17, 0x37, 0x3C, 0xCE, 0x17, 0x42, 0x43, 0xAE, 0xD0 ],
@ -246,7 +244,6 @@ public class CodeService
CodeFlag.Elephants => (true, 1, "!", "Appropriate lyrics that can also be found in Glamourer's changelogs.", "Sets every player to the elephant costume in varying shades of pink."),
CodeFlag.Crown => (true, 1, ".", "A famous Shakespearean line.", "Sets every player with a mentor symbol enabled to the clown's hat."),
CodeFlag.Dolphins => (true, 5, ",", "The farewell of the second smartest species on Earth.", "Sets every player to a Namazu hat with different costume bodies."),
CodeFlag.Artisan => (false, 3, ",,!", string.Empty, "Enable a debugging mode for the UI. Not really useful."),
CodeFlag.Face => (false, 3, ",,!", string.Empty, "Enable a debugging mode for the UI. Not really useful."),
CodeFlag.Manderville => (false, 3, ",,!", string.Empty, "Enable a debugging mode for the UI. Not really useful."),
CodeFlag.Smiles => (false, 3, ",,!", string.Empty, "Enable a debugging mode for the UI. Not really useful."),