-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from NotCoffee418/dev
Dev
- Loading branch information
Showing
161 changed files
with
1,648 additions
and
929 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
TrinityCreator/Data/Damage.cs → TrinityCreator.Shared/Data/Damage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
TrinityCreator/Data/DamageType.cs → TrinityCreator.Shared/Data/DamageType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
TrinityCreator/Data/IKeyValue.cs → TrinityCreator.Shared/Data/IKeyValue.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
TrinityCreator/Data/ItemClass.cs → TrinityCreator.Shared/Data/ItemClass.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
TrinityCreator/Data/ItemMaterial.cs → TrinityCreator.Shared/Data/ItemMaterial.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
TrinityCreator/Data/ItemSubClass.cs → TrinityCreator.Shared/Data/ItemSubClass.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
TrinityCreator/Data/TrainerData.cs → TrinityCreator.Shared/Data/TrainerData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.