Skip to content

Commit

Permalink
Update SQL Writer output (#3694)
Browse files Browse the repository at this point in the history
* Update SQL Writer output

* Update SQLWriter.cs

* Add PacketOpCodeNames

* Update PropertyInt.cs

* Update PropertyInt.cs
  • Loading branch information
LtRipley36706 authored Oct 19, 2021
1 parent 78f466a commit 880c031
Show file tree
Hide file tree
Showing 21 changed files with 940 additions and 107 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `biota_properties_emote_action`
CHANGE COLUMN `motion` `motion` INT UNSIGNED NULL DEFAULT NULL ;
2 changes: 1 addition & 1 deletion Source/ACE.Adapter/Lifestoned/LifestonedConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public static bool TryConvert(global::Lifestoned.DataModel.Gdle.Weenie input, ou
Delay = action.Delay ?? 0,
Extent = action.Extent ?? 0,

Motion = (int?)action.Motion,
Motion = (uint?)action.Motion,

Message = action.Message,
TestString = action.TestString,
Expand Down
2 changes: 1 addition & 1 deletion Source/ACE.Database/Adapter/BiotaConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ public static ACE.Database.Models.Shard.Biota ConvertFromEntityBiota(ACE.Entity.
Type = value2.Type,
Delay = value2.Delay,
Extent = value2.Extent,
Motion = (int?)value2.Motion,
Motion = (uint?)value2.Motion,
Message = value2.Message,
TestString = value2.TestString,
Min = value2.Min,
Expand Down
2 changes: 1 addition & 1 deletion Source/ACE.Database/Adapter/BiotaUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ private static void CopyValueInto(ACE.Entity.Models.PropertiesEmoteAction value,
existingValue.Type = value.Type;
existingValue.Delay = value.Delay;
existingValue.Extent = value.Extent;
existingValue.Motion = (int?)value.Motion;
existingValue.Motion = (uint?)value.Motion;
existingValue.Message = value.Message;
existingValue.TestString = value.TestString;
existingValue.Min = value.Min;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;

namespace ACE.Database.Models.Shard
Expand All @@ -11,7 +11,7 @@ public partial class BiotaPropertiesEmoteAction
public uint Type { get; set; }
public float Delay { get; set; }
public float Extent { get; set; }
public int? Motion { get; set; }
public uint? Motion { get; set; }
public string Message { get; set; }
public string TestString { get; set; }
public int? Min { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class WeeniePropertiesEmoteAction
public uint Type { get; set; }
public float Delay { get; set; }
public float Extent { get; set; }
public int? Motion { get; set; }
public uint? Motion { get; set; }
public string Message { get; set; }
public string TestString { get; set; }
public int? Min { get; set; }
Expand Down
38 changes: 16 additions & 22 deletions Source/ACE.Database/SQLFormatters/SQLWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ protected string GetValueEnumName(PropertyInt property, int value)
case PropertyInt.Hatred2Bits:
case PropertyInt.Hatred3Bits:
return ((FactionBits)value).ToString();
case PropertyInt.CharacterTitleId:
return ((CharacterTitle)value).ToString();
}

return property.GetValueEnumName(value);
Expand Down Expand Up @@ -219,40 +221,32 @@ protected string GetValueEnumName(PropertyDataId property, uint value)
break;
case PropertyDataId.WieldedTreasureType:
string treasureW = "";
if (TreasureWielded != null)
if (TreasureWielded != null && TreasureWielded.ContainsKey(value))
{
if (TreasureWielded.ContainsKey(value))
foreach (var item in TreasureWielded[value])
{
foreach (var item in TreasureWielded[value])
{
treasureW += GetValueForTreasureDID(item);
}
return treasureW;
treasureW += GetValueForTreasureDID(item);
}
return treasureW;
}
else if (TreasureDeath != null)
else if (TreasureDeath != null && TreasureDeath.ContainsKey(value))
{
if (TreasureDeath.ContainsKey(value))
return $"Loot Tier: {TreasureDeath[value].Tier}";
return $"Loot Tier: {TreasureDeath[value].Tier}";
}
break;
case PropertyDataId.DeathTreasureType:
string treasureD = "";
if (TreasureDeath != null)
if (TreasureDeath != null && TreasureDeath.ContainsKey(value))
{
if (TreasureDeath.ContainsKey(value))
return $"Loot Tier: {TreasureDeath[value].Tier}";
return $"Loot Tier: {TreasureDeath[value].Tier}";
}
else if (TreasureWielded != null)
else if (TreasureWielded != null && TreasureWielded.ContainsKey(value))
{
if (TreasureWielded.ContainsKey(value))
foreach (var item in TreasureWielded[value])
{
foreach (var item in TreasureWielded[value])
{
treasureD += GetValueForTreasureDID(item);
}
return treasureD;
treasureD += GetValueForTreasureDID(item, true);
}
return treasureD;
}
break;
case PropertyDataId.PCAPRecordedObjectDesc:
Expand All @@ -268,11 +262,11 @@ protected string GetValueEnumName(PropertyDataId property, uint value)
return property.GetValueEnumName(value);
}

protected string GetValueForTreasureDID(TreasureWielded item)
protected string GetValueForTreasureDID(TreasureWielded item, bool isUsedInDeath = false)
{
string treasure = "";

treasure += Environment.NewLine + $" Wield ";
treasure += Environment.NewLine + $" {(isUsedInDeath ? " Drop" : "Wield")} ";
if (item.StackSize > 1)
treasure += $"{item.StackSize}x ";
treasure += $"{WeenieNames[item.WeenieClassId]} ({item.WeenieClassId})";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void CreateSQLINSERTStatement(IList<HousePortal> input, StreamWriter writ
{
writer.WriteLine("INSERT INTO `house_portal` (`house_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `last_Modified`)");

var lineGenerator = new Func<int, string>(i => $"{input[i].HouseId}, 0x{input[i].ObjCellId:X8}, {input[i].OriginX}, {input[i].OriginY}, {input[i].OriginZ}, {input[i].AnglesW}, {input[i].AnglesX}, {input[i].AnglesY}, {input[i].AnglesZ}, '{input[i].LastModified:yyyy-MM-dd HH:mm:ss}')" + Environment.NewLine + $"/* @teleloc 0x{input[i].ObjCellId:X8} [{input[i].OriginX:F6} {input[i].OriginY:F6} {input[i].OriginZ:F6}] {input[i].AnglesW:F6} {input[i].AnglesX:F6} {input[i].AnglesY:F6} {input[i].AnglesZ:F6} */");
var lineGenerator = new Func<int, string>(i => $"{input[i].HouseId}, 0x{input[i].ObjCellId:X8}, {input[i].OriginX:0.######}, {input[i].OriginY:0.######}, {input[i].OriginZ:0.######}, {input[i].AnglesW:0.######}, {input[i].AnglesX:0.######}, {input[i].AnglesY:0.######}, {input[i].AnglesZ:0.######}, '{input[i].LastModified:yyyy-MM-dd HH:mm:ss}')" + Environment.NewLine + $"/* @teleloc 0x{input[i].ObjCellId:X8} [{input[i].OriginX:F6} {input[i].OriginY:F6} {input[i].OriginZ:F6}] {input[i].AnglesW:F6} {input[i].AnglesX:F6} {input[i].AnglesY:F6} {input[i].AnglesZ:F6} */");

ValuesWriter(input.Count, lineGenerator, writer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public void CreateSQLINSERTStatement(IList<LandblockInstance> input, StreamWrite
$"0x{value.Guid.ToString("X8")}, " +
$"{value.WeenieClassId.ToString().PadLeft(5)}, " +
$"0x{value.ObjCellId:X8}, " +
$"{value.OriginX}, " +
$"{value.OriginY}, " +
$"{value.OriginZ}, " +
$"{value.AnglesW}, " +
$"{value.AnglesX}, " +
$"{value.AnglesY}, " +
$"{value.AnglesZ}, " +
$"{value.OriginX:0.######}, " +
$"{value.OriginY:0.######}, " +
$"{value.OriginZ:0.######}, " +
$"{value.AnglesW:0.######}, " +
$"{value.AnglesX:0.######}, " +
$"{value.AnglesY:0.######}, " +
$"{value.AnglesZ:0.######}, " +
$"{value.IsLinkChild.ToString().PadLeft(5)}, " +
$"'{value.LastModified:yyyy-MM-dd HH:mm:ss}'" +
$"); /* {label} */" +
Expand Down
60 changes: 30 additions & 30 deletions Source/ACE.Database/SQLFormatters/World/SpellSQLWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void CreateSQLINSERTStatement(Spell input, StreamWriter writer)
if (input.StatModVal.HasValue)
{
spellLineHdr += ", `stat_Mod_Val`";
spellLine += $", {input.StatModVal}";
spellLine += $", {input.StatModVal:0.######}";
}

if (input.EType.HasValue)
Expand Down Expand Up @@ -116,25 +116,25 @@ public void CreateSQLINSERTStatement(Spell input, StreamWriter writer)
if (input.NumProjectilesVariance.HasValue)
{
spellLineHdr += ", `num_Projectiles_Variance`";
spellLine += $", {input.NumProjectilesVariance}";
spellLine += $", {input.NumProjectilesVariance:0.######}";
}

if (input.SpreadAngle.HasValue)
{
spellLineHdr += ", `spread_Angle`";
spellLine += $", {input.SpreadAngle}";
spellLine += $", {input.SpreadAngle:0.######}";
}

if (input.VerticalAngle.HasValue)
{
spellLineHdr += ", `vertical_Angle`";
spellLine += $", {input.VerticalAngle}";
spellLine += $", {input.VerticalAngle:0.######}";
}

if (input.DefaultLaunchAngle.HasValue)
{
spellLineHdr += ", `default_Launch_Angle`";
spellLine += $", {input.DefaultLaunchAngle}";
spellLine += $", {input.DefaultLaunchAngle:0.######}";
}

if (input.NonTracking.HasValue)
Expand All @@ -146,65 +146,65 @@ public void CreateSQLINSERTStatement(Spell input, StreamWriter writer)
if (input.CreateOffsetOriginX.HasValue)
{
spellLineHdr += ", `create_Offset_Origin_X`";
spellLine += $", {input.CreateOffsetOriginX}";
spellLine += $", {input.CreateOffsetOriginX:0.######}";
}
if (input.CreateOffsetOriginY.HasValue)
{
spellLineHdr += ", `create_Offset_Origin_Y`";
spellLine += $", {input.CreateOffsetOriginY}";
spellLine += $", {input.CreateOffsetOriginY:0.######}";
}
if (input.CreateOffsetOriginZ.HasValue)
{
spellLineHdr += ", `create_Offset_Origin_Z`";
spellLine += $", {input.CreateOffsetOriginZ}";
spellLine += $", {input.CreateOffsetOriginZ:0.######}";
}

if (input.PaddingOriginX.HasValue)
{
spellLineHdr += ", `padding_Origin_X`";
spellLine += $", {input.PaddingOriginX}";
spellLine += $", {input.PaddingOriginX:0.######}";
}
if (input.PaddingOriginY.HasValue)
{
spellLineHdr += ", `padding_Origin_Y`";
spellLine += $", {input.PaddingOriginY}";
spellLine += $", {input.PaddingOriginY:0.######}";
}
if (input.PaddingOriginZ.HasValue)
{
spellLineHdr += ", `padding_Origin_Z`";
spellLine += $", {input.PaddingOriginZ}";
spellLine += $", {input.PaddingOriginZ:0.######}";
}

if (input.DimsOriginX.HasValue)
{
spellLineHdr += ", `dims_Origin_X`";
spellLine += $", {input.DimsOriginX}";
spellLine += $", {input.DimsOriginX:0.######}";
}
if (input.DimsOriginY.HasValue)
{
spellLineHdr += ", `dims_Origin_Y`";
spellLine += $", {input.DimsOriginY}";
spellLine += $", {input.DimsOriginY:0.######}";
}
if (input.DimsOriginZ.HasValue)
{
spellLineHdr += ", `dims_Origin_Z`";
spellLine += $", {input.DimsOriginZ}";
spellLine += $", {input.DimsOriginZ:0.######}";
}

if (input.PeturbationOriginX.HasValue)
{
spellLineHdr += ", `peturbation_Origin_X`";
spellLine += $", {input.PeturbationOriginX}";
spellLine += $", {input.PeturbationOriginX:0.######}";
}
if (input.PeturbationOriginY.HasValue)
{
spellLineHdr += ", `peturbation_Origin_Y`";
spellLine += $", {input.PeturbationOriginY}";
spellLine += $", {input.PeturbationOriginY:0.######}";
}
if (input.PeturbationOriginZ.HasValue)
{
spellLineHdr += ", `peturbation_Origin_Z`";
spellLine += $", {input.PeturbationOriginZ}";
spellLine += $", {input.PeturbationOriginZ:0.######}";
}

if (input.ImbuedEffect.HasValue)
Expand Down Expand Up @@ -252,7 +252,7 @@ public void CreateSQLINSERTStatement(Spell input, StreamWriter writer)
if (input.DrainPercentage.HasValue)
{
spellLineHdr += ", `drain_Percentage`";
spellLine += $", {input.DrainPercentage}";
spellLine += $", {input.DrainPercentage:0.######}";
}

if (input.DamageRatio.HasValue)
Expand Down Expand Up @@ -300,7 +300,7 @@ public void CreateSQLINSERTStatement(Spell input, StreamWriter writer)
if (input.LossPercent.HasValue)
{
spellLineHdr += ", `loss_Percent`";
spellLine += $", {input.LossPercent}";
spellLine += $", {input.LossPercent:0.######}";
}

if (input.SourceLoss.HasValue)
Expand Down Expand Up @@ -330,13 +330,13 @@ public void CreateSQLINSERTStatement(Spell input, StreamWriter writer)
if (input.Index.HasValue)
{
spellLineHdr += ", `index`";
spellLine += $", {input.Index}";
spellLine += $", {input.Index} /* {(input.Name.Contains("Tie") ? ("PortalLinkType." + (PortalLinkType)input.Index).ToString() : ("PortalRecallType." + (PortalRecallType)input.Index).ToString())} */";
}

if (input.Link.HasValue)
{
spellLineHdr += ", `link`";
spellLine += $", {input.Link}";
spellLine += $", {input.Link} /* PortalSummonType.{((PortalSummonType)input.Link).ToString()} */";
}

if (input.PositionObjCellId.HasValue)
Expand All @@ -347,37 +347,37 @@ public void CreateSQLINSERTStatement(Spell input, StreamWriter writer)
if (input.PositionOriginX.HasValue)
{
spellLineHdr += ", `position_Origin_X`";
spellLine += $", {input.PositionOriginX}";
spellLine += $", {input.PositionOriginX:0.######}";
}
if (input.PositionOriginY.HasValue)
{
spellLineHdr += ", `position_Origin_Y`";
spellLine += $", {input.PositionOriginY}";
spellLine += $", {input.PositionOriginY:0.######}";
}
if (input.PositionOriginZ.HasValue)
{
spellLineHdr += ", `position_Origin_Z`";
spellLine += $", {input.PositionOriginZ}";
spellLine += $", {input.PositionOriginZ:0.######}";
}
if (input.PositionAnglesW.HasValue)
{
spellLineHdr += ", `position_Angles_W`";
spellLine += $", {input.PositionAnglesW}";
spellLine += $", {input.PositionAnglesW:0.######}";
}
if (input.PositionAnglesX.HasValue)
{
spellLineHdr += ", `position_Angles_X`";
spellLine += $", {input.PositionAnglesX}";
spellLine += $", {input.PositionAnglesX:0.######}";
}
if (input.PositionAnglesY.HasValue)
{
spellLineHdr += ", `position_Angles_Y`";
spellLine += $", {input.PositionAnglesY}";
spellLine += $", {input.PositionAnglesY:0.######}";
}
if (input.PositionAnglesZ.HasValue)
{
spellLineHdr += ", `position_Angles_Z`";
spellLine += $", {input.PositionAnglesZ}";
spellLine += $", {input.PositionAnglesZ:0.######}";
}

if (input.MinPower.HasValue)
Expand All @@ -395,7 +395,7 @@ public void CreateSQLINSERTStatement(Spell input, StreamWriter writer)
if (input.PowerVariance.HasValue)
{
spellLineHdr += ", `power_Variance`";
spellLine += $", {input.PowerVariance}";
spellLine += $", {input.PowerVariance:0.######}";
}

if (input.DispelSchool.HasValue)
Expand All @@ -419,7 +419,7 @@ public void CreateSQLINSERTStatement(Spell input, StreamWriter writer)
if (input.NumberVariance.HasValue)
{
spellLineHdr += ", `number_Variance`";
spellLine += $", {input.NumberVariance}";
spellLine += $", {input.NumberVariance:0.######}";
}

if (input.DotDuration.HasValue)
Expand Down
Loading

0 comments on commit 880c031

Please sign in to comment.