Core/Housing: fix room removal DB2 option contract
This commit is contained in:
@@ -36,13 +36,13 @@ namespace Housing
|
||||
bool const metadataValid =
|
||||
RoomComponentOptionMeta::Instance.FileDataId == RoomComponentOptionFileDataId69587 &&
|
||||
RoomComponentOptionMeta::Instance.LayoutHash == RoomComponentOptionLayoutHash69587 &&
|
||||
RoomComponentOptionMeta::Instance.FieldCount == 11 &&
|
||||
RoomComponentOptionMeta::Instance.FileFieldCount == 11 &&
|
||||
RoomComponentOptionMeta::Instance.FieldCount == 8 &&
|
||||
RoomComponentOptionMeta::Instance.FileFieldCount == 8 &&
|
||||
RoomComponentOptionMeta::Instance.GetRecordSize() == sizeof(RoomComponentOptionEntry);
|
||||
|
||||
return metadataValid && sRoomComponentOptionStore.GetTableHash() != 0 &&
|
||||
sRoomComponentOptionStore.GetLayoutHash() == RoomComponentOptionLayoutHash69587 &&
|
||||
sRoomComponentOptionStore.GetFieldCount() == 11 &&
|
||||
sRoomComponentOptionStore.GetFieldCount() == 8 &&
|
||||
sRoomComponentOptionStore.GetNumRows() != 0;
|
||||
}
|
||||
|
||||
@@ -74,14 +74,14 @@ namespace Housing
|
||||
continue;
|
||||
|
||||
RoomComponentOptionEntry const* best = nullptr;
|
||||
for (RoomComponentOptionEntry const& option : sRoomComponentOptionStore)
|
||||
for (RoomComponentOptionEntry const* option : sRoomComponentOptionStore)
|
||||
{
|
||||
if (option.MeshStyleFilterID != uint32(component.MeshStyleFilterID) ||
|
||||
option.HouseThemeID != themeId || option.Type != optionType || option.ID == 0)
|
||||
if (!option || option->MeshStyleFilterID != component.MeshStyleFilterID ||
|
||||
option->HouseThemeID != themeId || option->Type != optionType || option->ID == 0)
|
||||
continue;
|
||||
|
||||
if (!best || option.ID < best->ID)
|
||||
best = &option;
|
||||
if (!best || option->ID < best->ID)
|
||||
best = option;
|
||||
}
|
||||
|
||||
if (best)
|
||||
@@ -324,14 +324,15 @@ namespace Housing
|
||||
mutation.RestoredFileDataId = cosmetic && cosmetic->ModelFileDataID > 0
|
||||
? uint32(cosmetic->ModelFileDataID)
|
||||
: uint32(component->ModelFileDataID);
|
||||
mutation.RestoredOptionId = cosmetic ? cosmetic->ID : 0;
|
||||
mutation.RestoredOptionId = cosmetic ? int32(cosmetic->ID) : 0;
|
||||
mutation.RestoredComponentType = component->Type;
|
||||
mutation.RestoredHouseThemeId = cosmetic ? cosmetic->HouseThemeID : 0;
|
||||
mutation.RestoredTextureId = cosmetic ? cosmetic->RoomComponentTextureID : 0;
|
||||
mutation.RestoredTypeParam = cosmetic ? cosmetic->TypeParam : 0;
|
||||
mutation.RestoredTextureId = 0;
|
||||
mutation.RestoredTypeParam = 0;
|
||||
|
||||
QueryResult visualRows = CharacterDatabase.PQuery(
|
||||
"SELECT EntityGuid, FileDataID, RoomComponentOptionID FROM housing_room_component_entity "
|
||||
"SELECT EntityGuid, FileDataID, RoomComponentOptionID, RoomComponentTextureID "
|
||||
"FROM housing_room_component_entity "
|
||||
"WHERE HouseGuid = '{}' AND RoomGuid = '{}' AND RoomComponentID = {} "
|
||||
"ORDER BY EntityGuid LIMIT 3",
|
||||
removedRoom.HouseGuid.ToString(), survivingRoomGuid.ToString(), survivingComponentId);
|
||||
@@ -346,16 +347,18 @@ namespace Housing
|
||||
ObjectGuid const entityGuid = ObjectGuid::FromString(visualFields[0].GetString());
|
||||
uint32 const fileDataId = visualFields[1].GetUInt32();
|
||||
int32 const optionId = visualFields[2].GetInt32();
|
||||
if (entityGuid.GetHigh() != HighGuid::MeshObject)
|
||||
int32 const textureId = visualFields[3].GetInt32();
|
||||
if (entityGuid.GetHigh() != HighGuid::MeshObject || textureId < 0)
|
||||
return false;
|
||||
|
||||
if (optionId == doorwayWall->ID && fileDataId == uint32(doorwayWall->ModelFileDataID))
|
||||
if (optionId == int32(doorwayWall->ID) && fileDataId == uint32(doorwayWall->ModelFileDataID))
|
||||
{
|
||||
if (!mutation.WallEntityGuid.IsEmpty())
|
||||
return false;
|
||||
mutation.WallEntityGuid = entityGuid;
|
||||
mutation.RestoredTextureId = textureId;
|
||||
}
|
||||
else if (optionId == doorway->ID && fileDataId == uint32(doorway->ModelFileDataID))
|
||||
else if (optionId == int32(doorway->ID) && fileDataId == uint32(doorway->ModelFileDataID))
|
||||
{
|
||||
if (!mutation.DoorwayEntityGuid.IsEmpty())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user