Misc fixes/Misc DB updates
This commit is contained in:
@@ -45,11 +45,10 @@ namespace Game.DataStorage
|
||||
{
|
||||
do
|
||||
{
|
||||
var id = result.Read<uint>(indexField == -1 ? 0 : indexField);
|
||||
|
||||
var obj = new T();
|
||||
|
||||
int dbIndex = 0;
|
||||
var fields = typeof(T).GetFields();
|
||||
foreach (var f in typeof(T).GetFields())
|
||||
{
|
||||
Type type = f.FieldType;
|
||||
@@ -81,6 +80,12 @@ namespace Game.DataStorage
|
||||
case TypeCode.UInt32:
|
||||
f.SetValue(obj, ReadArray<uint>(result, dbIndex, array.Length));
|
||||
break;
|
||||
case TypeCode.Int64:
|
||||
f.SetValue(obj, ReadArray<long>(result, dbIndex, array.Length));
|
||||
break;
|
||||
case TypeCode.UInt64:
|
||||
f.SetValue(obj, ReadArray<ulong>(result, dbIndex, array.Length));
|
||||
break;
|
||||
case TypeCode.Single:
|
||||
f.SetValue(obj, ReadArray<float>(result, dbIndex, array.Length));
|
||||
break;
|
||||
@@ -89,8 +94,18 @@ namespace Game.DataStorage
|
||||
break;
|
||||
case TypeCode.Object:
|
||||
if (arrayElementType == typeof(Vector3))
|
||||
f.SetValue(obj, new Vector3(ReadArray<float>(result, dbIndex, 3)));
|
||||
break;
|
||||
{
|
||||
float[] values = ReadArray<float>(result, dbIndex, array.Length * 3);
|
||||
|
||||
Vector3[] vectors = new Vector3[array.Length];
|
||||
for (var i = 0; i < array.Length; ++i)
|
||||
vectors[i] = new Vector3(values[(i * 3)..(3 + (i * 3))]);
|
||||
|
||||
f.SetValue(obj, vectors);
|
||||
|
||||
dbIndex += array.Length * 3;
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", arrayElementType.Name);
|
||||
break;
|
||||
@@ -123,6 +138,12 @@ namespace Game.DataStorage
|
||||
case TypeCode.UInt32:
|
||||
f.SetValue(obj, result.Read<uint>(dbIndex++));
|
||||
break;
|
||||
case TypeCode.Int64:
|
||||
f.SetValue(obj, result.Read<long>(dbIndex++));
|
||||
break;
|
||||
case TypeCode.UInt64:
|
||||
f.SetValue(obj, result.Read<ulong>(dbIndex++));
|
||||
break;
|
||||
case TypeCode.Single:
|
||||
f.SetValue(obj, result.Read<float>(dbIndex++));
|
||||
break;
|
||||
@@ -150,7 +171,7 @@ namespace Game.DataStorage
|
||||
}
|
||||
else if (type == typeof(FlagArray128))
|
||||
{
|
||||
f.SetValue(obj, new FlagArray128(ReadArray<uint>(result, dbIndex, 4)));
|
||||
f.SetValue(obj, new FlagArray128(ReadArray<int>(result, dbIndex, 4)));
|
||||
dbIndex += 4;
|
||||
}
|
||||
break;
|
||||
@@ -161,6 +182,7 @@ namespace Game.DataStorage
|
||||
}
|
||||
}
|
||||
|
||||
var id = (uint)fields[indexField == -1 ? 0 : indexField].GetValue(obj);
|
||||
base[id] = obj;
|
||||
}
|
||||
while (result.NextRow());
|
||||
|
||||
@@ -439,6 +439,9 @@ namespace Game.DataStorage
|
||||
case TypeCode.UInt32:
|
||||
f.SetValue(obj, GetFieldValueArray<uint>(fieldIndex, atr.Length));
|
||||
break;
|
||||
case TypeCode.Int64:
|
||||
f.SetValue(obj, GetFieldValueArray<long>(fieldIndex, atr.Length));
|
||||
break;
|
||||
case TypeCode.UInt64:
|
||||
f.SetValue(obj, GetFieldValueArray<ulong>(fieldIndex, atr.Length));
|
||||
break;
|
||||
|
||||
@@ -79,13 +79,13 @@ namespace Game.DataStorage
|
||||
public ushort UwAmbience;
|
||||
public ushort ZoneMusic;
|
||||
public ushort UwZoneMusic;
|
||||
public byte ExplorationLevel;
|
||||
public sbyte ExplorationLevel;
|
||||
public ushort IntroSound;
|
||||
public uint UwIntroSound;
|
||||
public byte FactionGroupMask;
|
||||
public float AmbientMultiplier;
|
||||
public byte MountFlags;
|
||||
public ushort PvpCombastWorldStateID;
|
||||
public short PvpCombastWorldStateID;
|
||||
public byte WildBattlePetLevelMin;
|
||||
public byte WildBattlePetLevelMax;
|
||||
public byte WindSettingsID;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Game.DataStorage
|
||||
{
|
||||
public sealed class FactionRecord
|
||||
{
|
||||
public ulong[] ReputationRaceMask = new ulong[4];
|
||||
public long[] ReputationRaceMask = new long[4];
|
||||
public LocalizedString Name;
|
||||
public string Description;
|
||||
public uint Id;
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace Game.DataStorage
|
||||
public uint VendorStackCount;
|
||||
public float PriceVariance;
|
||||
public float PriceRandomValue;
|
||||
public uint[] Flags = new uint[4];
|
||||
public int[] Flags = new int[4];
|
||||
public int FactionRelated;
|
||||
public ushort ItemNameDescriptionID;
|
||||
public ushort RequiredTransmogHoliday;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Game.DataStorage
|
||||
|
||||
public sealed class PlayerConditionRecord
|
||||
{
|
||||
public ulong RaceMask;
|
||||
public long RaceMask;
|
||||
public string FailureDescription;
|
||||
public uint Id;
|
||||
public ushort MinLevel;
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Game.DataStorage
|
||||
|
||||
public sealed class SkillLineAbilityRecord
|
||||
{
|
||||
public ulong RaceMask;
|
||||
public long RaceMask;
|
||||
public uint Id;
|
||||
public ushort SkillLine;
|
||||
public uint Spell;
|
||||
@@ -326,8 +326,8 @@ namespace Game.DataStorage
|
||||
public uint Id;
|
||||
public byte DifficultyID;
|
||||
public short InterruptFlags;
|
||||
public uint[] AuraInterruptFlags = new uint[2];
|
||||
public uint[] ChannelInterruptFlags = new uint[2];
|
||||
public int[] AuraInterruptFlags = new int[2];
|
||||
public int[] ChannelInterruptFlags = new int[2];
|
||||
public uint SpellID;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace Game.DataStorage
|
||||
public uint Id;
|
||||
public Vector3 AttachmentOffset;
|
||||
public Vector3 CameraOffset;
|
||||
public VehicleSeatFlags Flags;
|
||||
public VehicleSeatFlagsB FlagsB;
|
||||
public int Flags;
|
||||
public int FlagsB;
|
||||
public int FlagsC;
|
||||
public sbyte AttachmentID;
|
||||
public float EnterPreDelay;
|
||||
@@ -111,17 +111,27 @@ namespace Game.DataStorage
|
||||
|
||||
public bool CanEnterOrExit()
|
||||
{
|
||||
return (Flags.HasAnyFlag(VehicleSeatFlags.CanEnterOrExit) ||
|
||||
return (HasSeatFlag(VehicleSeatFlags.CanEnterOrExit) ||
|
||||
//If it has anmation for enter/ride, means it can be entered/exited by logic
|
||||
Flags.HasAnyFlag(VehicleSeatFlags.HasLowerAnimForEnter | VehicleSeatFlags.HasLowerAnimForRide));
|
||||
HasSeatFlag(VehicleSeatFlags.HasLowerAnimForEnter | VehicleSeatFlags.HasLowerAnimForRide));
|
||||
}
|
||||
public bool CanSwitchFromSeat() { return (Flags & VehicleSeatFlags.CanSwitch) != 0; }
|
||||
public bool CanSwitchFromSeat() { return Flags.HasAnyFlag((int)VehicleSeatFlags.CanSwitch); }
|
||||
public bool IsUsableByOverride()
|
||||
{
|
||||
return Flags.HasAnyFlag(VehicleSeatFlags.Uncontrolled | VehicleSeatFlags.Unk18)
|
||||
|| FlagsB.HasAnyFlag(VehicleSeatFlagsB.UsableForced | VehicleSeatFlagsB.UsableForced2 |
|
||||
return HasSeatFlag(VehicleSeatFlags.Uncontrolled | VehicleSeatFlags.Unk18)
|
||||
|| HasSeatFlag(VehicleSeatFlagsB.UsableForced | VehicleSeatFlagsB.UsableForced2 |
|
||||
VehicleSeatFlagsB.UsableForced3 | VehicleSeatFlagsB.UsableForced4);
|
||||
}
|
||||
public bool IsEjectable() { return FlagsB.HasAnyFlag(VehicleSeatFlagsB.Ejectable); }
|
||||
public bool IsEjectable() { return HasSeatFlag(VehicleSeatFlagsB.Ejectable); }
|
||||
|
||||
public bool HasSeatFlag(VehicleSeatFlags flag)
|
||||
{
|
||||
return Flags.HasAnyFlag((int)flag);
|
||||
}
|
||||
|
||||
public bool HasSeatFlag(VehicleSeatFlagsB flag)
|
||||
{
|
||||
return FlagsB.HasAnyFlag((int)flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user