Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions WowPacketParser/Enums/Housing.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
namespace WowPacketParser.Enums
{
public enum HousingResult : byte
{
Success = 0,
ActionLockedByCombat = 1,
CannotAfford = 2,
CharterComplete = 3,
CollisionInvalid = 4,
DbError = 5,
DecorCannotBeRedeemed = 6,
DecorItemNotDestroyable = 7,
DecorNotFound = 8,
DecorNotFoundInStorage = 9,
DuplicateCharterSignature = 10,
FilterRejected = 11,
FixtureCantDeleteDoor = 12,
FixtureHookEmpty = 13,
FixtureHookOccupied = 14,
FixtureHouseTypeMismatch = 15,
FixtureNotFound = 16,
FixtureNotOwned = 17,
FixtureSizeMismatch = 18,
FixtureTypeMismatch = 19,
GenericFailure = 20,
GuildMoreAccountsNeeded = 21,
GuildMoreActivePlayersNeeded = 22,
GuildNotLoaded = 23,
HouseEditLockFailed = 24,
HouseExteriorRootNotFound = 25,
HookNotChildOfFixture = 26,
HouseNotFound = 27,
IncorrectFaction = 28,
InvalidDecorItem = 29,
InvalidDistance = 30,
InvalidGuild = 31,
InvalidHouse = 32,
InvalidInstance = 33,
InvalidInteraction = 34,
InvalidMap = 35,
InvalidNeighborhoodName = 36,
InvalidRoomLayout = 37,
LockedByOtherPlayer = 38,
LockOperationFailed = 39,
MaxDecorReached = 40,
MissingCoreFixture = 41,
MissingDye = 42,
MissingExpansionAccess = 43,
MissingFactionMap = 44,
MissingPrivateNeighborhoodInvite = 45,
MissingTheme = 46,
MoreHouseSlotsNeeded = 47,
MoreSignaturesNeeded = 48,
NeighborhoodNotFound = 49,
NotInDecorEditMode = 50,
NoNeighborhoodOwnershipRequests = 51,
NotInFixtureEditMode = 52,
NotInLayoutEditMode = 53,
NotInsideHouse = 54,
NotOnOwnedPlot = 55,
OperationAborted = 56,
PermissionDenied = 57,
PlacementTargetInvalid = 58,
PlayerNotFound = 59,
PlayerNotInInstance = 60,
PlotNotFound = 61,
PlotNotVacant = 62,
PlotReservationCooldown = 63,
PlotReserved = 64,
RoomNotFound = 65,
RoomUpdateFailed = 66,
RpcFailure = 67,
ServiceNotAvailable = 68,
StaticDataNotFound = 69,
TimeoutLimit = 70,
TimerunningNotAllowed = 71,
TokenRequired = 72,
TooManyRequests = 73,
TransactionFailure = 74,
UnlockOperationFailed = 75
}

public enum HousingGuidType : byte
{
Decor = 1,
RoomComponent = 2,
House = 3,
Neighborhood = 4,
}
}
2 changes: 2 additions & 0 deletions WowPacketParser/Enums/Version/V11_2_7_64632/Opcodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,9 @@ public static BiDictionary<Opcode, int> Opcodes(Direction direction)
{ Opcode.CMSG_HOUSING_FIXTURE_DELETE_FIXTURE, 0x310007 },
{ Opcode.CMSG_HOUSING_FIXTURE_SET_CORE_FIXTURE, 0x310005 },
{ Opcode.CMSG_HOUSING_FIXTURE_SET_EDIT_MODE, 0x310000 },
{ Opcode.CMSG_HOUSING_HOUSE_STATUS, 0x350005 },
{ Opcode.CMSG_HOUSING_GET_CURRENT_HOUSE_INFO, 0x350006 },
{ Opcode.CMSG_HOUSING_GET_PLAYER_PERMISSIONS, 0x350007 },
{ Opcode.CMSG_HOUSING_RESET_KIOSK_MODE, 0x350008 },
{ Opcode.CMSG_HOUSING_ROOM_ADD, 0x320001 },
{ Opcode.CMSG_HOUSING_ROOM_APPLY_COMPONENT_MATERIALS, 0x320006 },
Expand Down
2 changes: 2 additions & 0 deletions WowPacketParser/Enums/Version/V11_2_7_64632/Opcodes_64877.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@ public static BiDictionary<Opcode, int> Opcodes(Direction direction)
{ Opcode.CMSG_HOUSING_FIXTURE_DELETE_FIXTURE, 0x310007 },
{ Opcode.CMSG_HOUSING_FIXTURE_SET_CORE_FIXTURE, 0x310005 },
{ Opcode.CMSG_HOUSING_FIXTURE_SET_EDIT_MODE, 0x310000 },
{ Opcode.CMSG_HOUSING_HOUSE_STATUS, 0x350005 },
{ Opcode.CMSG_HOUSING_GET_CURRENT_HOUSE_INFO, 0x350006 },
{ Opcode.CMSG_HOUSING_GET_PLAYER_PERMISSIONS, 0x350007 },
{ Opcode.CMSG_HOUSING_RESET_KIOSK_MODE, 0x350008 },
{ Opcode.CMSG_HOUSING_ROOM_ADD, 0x320001 },
{ Opcode.CMSG_HOUSING_ROOM_APPLY_COMPONENT_MATERIALS, 0x320006 },
Expand Down
4 changes: 2 additions & 2 deletions WowPacketParser/Misc/Filters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static bool CheckFilter(WowGuid guid)
var result = true;

if (guid.HasEntry())
result = CheckFilter(Utilities.ObjectTypeToStore(guid.GetObjectType()), (int)guid.GetEntry());
result = CheckFilter(guid.GetStoreNameType(), (int)guid.GetEntry());

return result;
}
Expand All @@ -97,7 +97,7 @@ public static bool CheckFilter(WowGuid128 guid)
var result = true;

if (guid.GetObjectType() == ObjectType.Player || guid.HasEntry())
result = CheckFilter(Utilities.ObjectTypeToStore(guid.GetObjectType()), (int)guid.GetEntry());
result = CheckFilter(guid.GetStoreNameType(), (int)guid.GetEntry());

return result;
}
Expand Down
62 changes: 41 additions & 21 deletions WowPacketParser/Misc/WowGuid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ public ObjectType GetObjectType()
}
}

public StoreNameType GetStoreNameType()
{
return GetHighType() switch
{
HighGuidType.Player => StoreNameType.Player,
HighGuidType.Item => StoreNameType.Item,
HighGuidType.Transport => StoreNameType.GameObject,
HighGuidType.Creature => StoreNameType.Unit,
HighGuidType.Vehicle => StoreNameType.Unit,
HighGuidType.Pet => StoreNameType.Unit,
HighGuidType.GameObject => StoreNameType.GameObject,
HighGuidType.Cast => StoreNameType.Spell,
_ => StoreNameType.None
};
}

public static bool operator ==(WowGuid first, WowGuid other)
{
if (ReferenceEquals(first, other))
Expand Down Expand Up @@ -157,31 +173,35 @@ public override ulong GetLow()

public override string ToString()
{
if (Low == 0 && High == 0)
return "Full: 0x0";

if (HasEntry())
switch (GetHighType())
{
StoreNameType type = StoreNameType.None;
if (GetHighType() == HighGuidType.Cast)
type = StoreNameType.Spell;
else
type = Utilities.ObjectTypeToStore(GetObjectType());

// ReSharper disable once UseStringInterpolation
return string.Format("Full: 0x{0}{1} {2}/{3} R{4}/S{5} Map: {6} Entry: {7} Low: {8}", High.ToString("X16"), Low.ToString("X16"),
GetHighType(), GetSubType(), GetRealmId(), GetServerId(), StoreGetters.GetName(StoreNameType.Map, GetMapId()),
StoreGetters.GetName(type, (int)GetEntry()), GetLow());
case HighGuidType.Null: return "Full: 0x0";
case HighGuidType.Housing: return FormatHousing();
default:
break;
}

// TODO: Implement extra format for battleground, see WowGuid64.ToString()
if (HasEntry())
return $"Full: 0x{High:X16}{Low:X16} {GetHighType()}/{GetSubType()} R{GetRealmId()}/S{GetServerId()} Map: {StoreGetters.GetName(StoreNameType.Map, GetMapId())} Entry: {StoreGetters.GetName(GetStoreNameType(), (int)GetEntry())} Low: {GetLow()}";

string name = StoreGetters.GetName(this);
var name = StoreGetters.GetName(this);
return $"Full: 0x{High:X16}{Low:X16} {GetHighType()}/{GetSubType()} R{GetRealmId()}/S{GetServerId()} Map: {StoreGetters.GetName(StoreNameType.Map, GetMapId())} Low: {GetLow() + (string.IsNullOrEmpty(name) ? string.Empty : (" Name: " + name))}";
}

// ReSharper disable once UseStringInterpolation
return string.Format("Full: 0x{0}{1} {2}/{3} R{4}/S{5} Map: {6} Low: {7}", High.ToString("X16"), Low.ToString("X16"),
GetHighType(), GetSubType(), GetRealmId(), GetServerId(), StoreGetters.GetName(StoreNameType.Map, GetMapId()),
GetLow() + (String.IsNullOrEmpty(name) ? String.Empty : (" Name: " + name)));
private string FormatHousing()
{
var subType = (HousingGuidType)((High >> 53) & 0x1F);
var formatted = $"Full: 0x{High:X16}{Low:X16} {GetHighType()}/{subType} ";
formatted += subType switch
{
HousingGuidType.Decor => $"Arg1: {(High >> 32) & 0xFFFF} DecorID: {High & 0xFFFFFFFF} ",
HousingGuidType.RoomComponent => $"HouseRoomID: {High & 0xFFFFFFFF} ",
HousingGuidType.House => $"Arg1: {Low & 0x7FFF} Arg2: {(Low >> 15) & 0x3F} ",
HousingGuidType.Neighborhood => $"NeighborhoodMapID: {(High >> 32) & 0xFFFF} Arg2: {High & 0xFFFFFFFF} ",
_ => $"SubType: Unknown({(byte)subType}) ",
};
formatted += $"Low: {GetLow()}";
return formatted;
}
}

Expand Down Expand Up @@ -260,7 +280,7 @@ public override string ToString()
// name next to the entry (from a database, if enabled)
if (HasEntry())
{
var type = Utilities.ObjectTypeToStore(GetObjectType());
var type = GetStoreNameType();

return "Full: 0x" + Low.ToString("X8") + " Type: " + GetHighType()
+ " Entry: " + StoreGetters.GetName(type, (int)GetEntry()) + " Low: " + GetLow();
Expand Down
Loading
Loading