ace/Source/ACE.Adapter/GDLE/Models/Emote.cs
Ty Conner 12e569652f
Switch to System.Text.Json (#4002)
* Switch to System.Text.Json

Removed Newtonsoft.Json and DouglasCrockford.JsMin

* Update GameConfiguration.cs

* Update MasterConfiguration.cs

* Update ThreadConfiguration.cs

* Update StarterSpell.cs

* Update StarterGearFactory.cs

* Update Program_Setup.cs

* Update LifestonedConverter.cs

* Update Program_Setup.cs

* Update Program_Setup.cs

* Update ACE.Adaptor

Shift JSON weenie [de]serialization to System.Text.Json

* Update LifestonedConverter.cs

* Update StarterGearFactory.cs

* Update ACE.Server.csproj

* Update ACE.Server.Tests.csproj

* Update Program.cs

* Update MySqlConfiguration.cs

* Update DDDConfiguration.cs

* Update ModContainer.cs

* Update ModManager.cs

* Update ModMetadata.cs

* Update ModMetadata.cs
2023-12-21 14:15:38 -05:00

96 lines
2.9 KiB
C#

using Lifestoned.DataModel.Gdle;
using Lifestoned.DataModel.Shared;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace ACE.Adapter.GDLE.Models
{
public class Emote
{
[JsonPropertyName("category")]
public uint Category { get; set; }
[JsonIgnore]
[Display(Name = "Emote Category")]
public EmoteCategory EmoteCategory
{
get
{
return (EmoteCategory)Category;
}
set
{
Category = (uint)value;
}
}
[JsonIgnore]
public EmoteType? NewEmoteType { get; set; }
[JsonPropertyName("emotes")]
public List<EmoteAction> Actions { get; set; }
[JsonPropertyName("probability")]
public float? Probability { get; set; }
[JsonPropertyName("vendorType")]
[EmoteCategory(EmoteCategory.Vendor)]
public uint? VendorType { get; set; }
[JsonPropertyName("quest")]
[EmoteCategory(EmoteCategory.QuestFailure)]
[EmoteCategory(EmoteCategory.QuestSuccess)]
[EmoteCategory(EmoteCategory.ReceiveTalkDirect)]
[EmoteCategory(EmoteCategory.TestSuccess)]
[EmoteCategory(EmoteCategory.TestFailure)]
[EmoteCategory(EmoteCategory.GotoSet)]
[EmoteCategory(EmoteCategory.QuestNoFellow)]
public string Quest { get; set; }
[JsonPropertyName("classID")]
[EmoteCategory(EmoteCategory.Refuse)]
[EmoteCategory(EmoteCategory.Give)]
public uint? ClassId { get; set; }
[JsonPropertyName("style")]
[EmoteCategory(EmoteCategory.HeartBeat)]
public uint? Style { get; set; }
[JsonPropertyName("substyle")]
[EmoteCategory(EmoteCategory.HeartBeat)]
public uint? SubStyle { get; set; }
[JsonPropertyName("minhealth")]
[EmoteCategory(EmoteCategory.WoundedTaunt)]
public float? MinHealth { get; set; }
[JsonPropertyName("maxhealth")]
[EmoteCategory(EmoteCategory.WoundedTaunt)]
public float? MaxHealth { get; set; }
[JsonIgnore]
public int? SortOrder { get; set; }
[JsonIgnore]
public bool Deleted { get; set; }
public static bool IsPropertyVisible(string propertyName, Emote emote)
{
PropertyInfo property = typeof(Emote).GetProperty(propertyName);
List<EmoteCategoryAttribute> list = property.GetCustomAttributes(typeof(EmoteCategoryAttribute), inherit: false).Cast<EmoteCategoryAttribute>().ToList();
if (list == null || list.Count < 1)
{
return true;
}
return list.Any((EmoteCategoryAttribute a) => a.CategoryList.Contains(emote.EmoteCategory));
}
}
}