Skip to content

Commit

Permalink
Merge pull request #122 from NotCoffee418/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
NotCoffee418 authored Nov 4, 2021
2 parents 080eb2a + 2d58477 commit 2895e9f
Show file tree
Hide file tree
Showing 161 changed files with 1,648 additions and 929 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading.Tasks;

namespace TrinityCreator.DBC
namespace TrinityCreator.Shared.DBC
{
class DBCQuery
{
Expand Down Expand Up @@ -61,19 +61,19 @@ public static DataTable GetQuestSortNames()
new string[] { "id", "name" });
}

internal static DataTable GetSpells()
public static DataTable GetSpells()
{
return DbcHandler.LoadDbc("Spell",
new string[] { "m_ID", "m_name_lang_1", "m_description_lang_1" });
}

internal static DataTable GetMap()
public static DataTable GetMap()
{
return DbcHandler.LoadDbc("Map",
new string[] { "m_ID", "m_MapName_lang1" });
}

internal static DataTable GetFaction()
public static DataTable GetFaction()
{
// basic factions
var result = DbcHandler.LoadDbc("Faction", new string[] { "m_ID", "m_name_lang_1" });
Expand All @@ -84,14 +84,14 @@ internal static DataTable GetFaction()
return result;
}

internal static DataTable GetCharTitles()
public static DataTable GetCharTitles()
{
return DbcHandler.LoadDbc("CharTitles",
new string[] { "field0", "field2" });
}


internal static DataTable GetEmotes()
public static DataTable GetEmotes()
{
return DbcHandler.LoadDbc("Emotes",
new string[] { "id", "description" });
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
using DBCViewer;
using System.Globalization;
using System.Xml;
using TrinityCreator.UI;
using TrinityCreator.Helpers;
using TrinityCreator.Shared.Helpers;
using TrinityCreator.Shared.UI;

namespace TrinityCreator.DBC
namespace TrinityCreator.Shared.DBC
{
class DbcHandler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
class CExceptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TrinityCreator.Database;
using TrinityCreator.Shared.Database;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class Coordinate
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class CreatureFamily : IKeyValue
{
Expand All @@ -10,7 +10,7 @@ public CreatureFamily(int id, string description, int petSpellDataId = 0)
Description = description;
PetSpellDataId = petSpellDataId;
}
public int PetSpellDataId { get; internal set; }
public int PetSpellDataId { get; set; }
public override string ToString()
{
return Description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Windows;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class Currency : INotifyPropertyChanged
{
Expand Down
121 changes: 121 additions & 0 deletions TrinityCreator.Shared/Data/CustomDisplayField.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
using System;
using System.ComponentModel;
using System.Text.RegularExpressions;
using TrinityCreator.Shared.Profiles;

namespace TrinityCreator.Shared.Data
{
/// <summary>
/// See documentation for more info on how to use this
/// </summary>
public class CustomDisplayField : INotifyPropertyChanged
{
// field
private string _inputValue = string.Empty;

/// <summary>
/// Table Name
/// </summary>
public string Table { get; private set; }

/// <summary>
/// Column Name
/// </summary>
public string Column { get; private set; }

/// <summary>
/// Display Name
/// </summary>
public string DisplayName { get; private set; }

/// <summary>
/// Full custom field name, used by Exporter
/// </summary>
public string FullCustomFieldName { get; private set; }

/// <summary>
/// Export type
/// </summary>
public Export.C ExportType { get; private set; }

/// <summary>
/// Value input by user for export
/// </summary>
public string InputValue
{
get
{
return _inputValue;
}
set
{
_inputValue = value;
RaisePropertyChanged("InputValue");
}
}


public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// Creates a CustomDisplayField using the information defined in profile
/// </summary>
/// <param name="databaseTable">database real table name</param>
/// <param name="databaseColumn">database real table column</param>
/// <param name="fullCustomFieldName">eg. Creature.CustomInt.MyCustomDisplayName</param>
/// <returns></returns>
public static CustomDisplayField Create(
string databaseTable,
string databaseColumn,
string fullCustomFieldName)
{
Regex regex = new Regex(
@"(Item|Quest|Creature)\.Custom(Int|Float|Text)\.(.+)");

// return null if not valid or not custom DISPLAY
if (!regex.IsMatch(fullCustomFieldName))
return null;
var result = new CustomDisplayField()
{
Table = databaseTable,
Column = databaseColumn,
FullCustomFieldName = fullCustomFieldName
};

var match = regex.Match(fullCustomFieldName);

// Deternine the creator / export type
switch (match.Groups[1].Value)
{
case "Item":
result.ExportType = Export.C.Item;
break;
case "Quest":
result.ExportType = Export.C.Quest;
break;
case "Creature":
result.ExportType = Export.C.Creature;
break;
default:
throw new ArgumentException(
match.Groups[1].Value + " is not a supported creator for custom display fields.");
}

// Grab DisplayName
result.DisplayName = match.Groups[3].Value;

// Set default value to 0 if type is numeric
if (match.Groups[2].Value == "Int" || match.Groups[2].Value == "Float")
result.InputValue = "0";

// Create object and return
return result;
}

private void RaisePropertyChanged(string property)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class Damage : INotifyPropertyChanged
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class DamageType : IKeyValue
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public abstract class IKeyValue
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemClass : IKeyValue
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemInventoryType : IKeyValue
{
Expand All @@ -11,7 +11,7 @@ public ItemInventoryType(int id, string description, int sheath = 0)

public int Sheath { get; set; }

internal static ItemInventoryType[] GetAllInventoryTypes()
public static ItemInventoryType[] GetAllInventoryTypes()
{
var result = new List<ItemInventoryType>();
result.AddRange(GetNonEquipable());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemMaterial : IKeyValue
{
public ItemMaterial(int id, string description)
: base(id, description) { }

internal static ItemMaterial GetConsumable()
public static ItemMaterial GetConsumable()
{
return new ItemMaterial(-1, "Consumable");
}

internal static ItemMaterial GetUndefined()
public static ItemMaterial GetUndefined()
{
return new ItemMaterial(1, "Not Defined");
}

internal static ItemMaterial GetPlate()
public static ItemMaterial GetPlate()
{
return new ItemMaterial(6, "Plate");
}

internal static ItemMaterial GetChain()
public static ItemMaterial GetChain()
{
return new ItemMaterial(5, "Chainmail");
}

internal static ItemMaterial GetLeather()
public static ItemMaterial GetLeather()
{
return new ItemMaterial(8, "Leather");
}

internal static ItemMaterial GetCloth()
public static ItemMaterial GetCloth()
{
return new ItemMaterial(7, "Cloth");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Linq;
using System.Windows.Media;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemQuality : IKeyValue, INotifyPropertyChanged
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class ItemSubClass : IKeyValue, INotifyPropertyChanged
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Windows.Media.Imaging;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class Socket : IKeyValue
{
Expand All @@ -24,16 +24,16 @@ public static Socket[] GetSocketList()
return new[]
{
new Socket(1, "Meta",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator;component/Resources/metasocket.png",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator.Shared;component/Resources/metasocket.png",
UriKind.Absolute))),
new Socket(2, "Red",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator;component/Resources/redsocket.png",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator.Shared;component/Resources/redsocket.png",
UriKind.Absolute))),
new Socket(4, "Yellow",
new BitmapImage(new Uri(
"pack://application:,,,/TrinityCreator;component/Resources/yellowsocket.png", UriKind.Absolute))),
"pack://application:,,,/TrinityCreator.Shared;component/Resources/yellowsocket.png", UriKind.Absolute))),
new Socket(8, "Blue",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator;component/Resources/bluesocket.png",
new BitmapImage(new Uri("pack://application:,,,/TrinityCreator.Shared;component/Resources/bluesocket.png",
UriKind.Absolute)))
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

namespace TrinityCreator.Data
namespace TrinityCreator.Shared.Data
{
public class TrainerData : IKeyValue
{
Expand Down
Loading

0 comments on commit 2895e9f

Please sign in to comment.