1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 00:47:45 +00:00

Housing cleanup

This commit is contained in:
Mordred 2018-11-01 23:56:43 +01:00
parent fd9bf92a25
commit 5479a77d6d
11 changed files with 636 additions and 657 deletions

View file

@ -733,7 +733,7 @@ namespace Core::Common
};
//Structs
struct LandsetStruct
struct LandStruct
{
uint8_t houseSize; //0
uint8_t houseState; // 2

View file

@ -191,7 +191,7 @@ void Core::Db::ZoneDbConnection::doPrepareStatements()
"UPDATE charaglobalitem SET IS_DELETE = 1 WHERE ItemId = ?;",
CONNECTION_BOTH );
prepareStatement( LAND_INS,
/*prepareStatement( LAND_INS,
"INSERT INTO land ( LandSetId ) VALUES ( ? );",
CONNECTION_BOTH );
@ -211,5 +211,5 @@ void Core::Db::ZoneDbConnection::doPrepareStatements()
"colorSlot_5 = ?, colorSlot_6 = ?, colorSlot_7 = ?, ownerPlayerId = ?, nextDrop = ?, "
"dropCount = ?, currentPrice = ?"
" WHERE LandSetId = ?;",
CONNECTION_BOTH );
CONNECTION_BOTH );*/
}

View file

@ -3,326 +3,318 @@
#include <stdint.h>
namespace Core {
namespace Network {
namespace Packets {
////////////////////////////////////////////////////////////////////////////////
/// Lobby Connection IPC Codes
/**
* Server IPC Lobby Type Codes.
*/
enum ServerLobbyIpcType :
uint16_t
{
LobbyError = 0x0002,
LobbyServiceAccountList = 0x000C,
LobbyCharList = 0x000D,
LobbyCharCreate = 0x000E,
LobbyEnterWorld = 0x000F,
LobbyServerList = 0x0015,
LobbyRetainerList = 0x0017,
};
/**
* Client IPC Lobby Type Codes.
*/
enum ClientLobbyIpcType :
uint16_t
{
ReqCharList = 0x0003,
ReqEnterWorld = 0x0004,
ClientVersionInfo = 0x0005,
ReqCharDelete = 0x000A,
ReqCharCreate = 0x000B,
};
////////////////////////////////////////////////////////////////////////////////
/// Zone Connection IPC Codes
/**
* Server IPC Zone Type Codes.
*/
enum ServerZoneIpcType :
uint16_t
namespace Core::Network::Packets
{
// static opcode ( the ones that rarely, if ever, change )
Ping = 0x0065,
Init = 0x0066,
////////////////////////////////////////////////////////////////////////////////
/// Lobby Connection IPC Codes
/**
* Server IPC Lobby Type Codes.
*/
enum ServerLobbyIpcType : uint16_t
{
LobbyError = 0x0002,
LobbyServiceAccountList = 0x000C,
LobbyCharList = 0x000D,
LobbyCharCreate = 0x000E,
LobbyEnterWorld = 0x000F,
LobbyServerList = 0x0015,
LobbyRetainerList = 0x0017,
};
/**
* Client IPC Lobby Type Codes.
*/
enum ClientLobbyIpcType : uint16_t
{
ReqCharList = 0x0003,
ReqEnterWorld = 0x0004,
ClientVersionInfo = 0x0005,
ActorFreeSpawn = 0x0191,
InitZone = 0x019A,
ReqCharDelete = 0x000A,
ReqCharCreate = 0x000B,
};
////////////////////////////////////////////////////////////////////////////////
/// Zone Connection IPC Codes
/**
* Server IPC Zone Type Codes.
*/
enum ServerZoneIpcType : uint16_t
{
// static opcode ( the ones that rarely, if ever, change )
Ping = 0x0065,
Init = 0x0066,
ActorFreeSpawn = 0x0191,
InitZone = 0x019A,
AddStatusEffect = 0x0141,
ActorControl142 = 0x0142,
ActorControl143 = 0x0143,
ActorControl144 = 0x0144,
UpdateHpMpTp = 0x0145,
///////////////////////////////////////////////////
ChatBanned = 0x006B,
Playtime = 0x006C, // updated 4.4
Logout = 0x0077, // updated 4.4
CFNotify = 0x0078,
CFMemberStatus = 0x0079,
CFDutyInfo = 0x007A,
CFPlayerInNeed = 0x007F,
SocialRequestError = 0x00AD,
CFRegistered = 0x00B8, // updated 4.1
SocialRequestResponse = 0x00BB, // updated 4.1
CancelAllianceForming = 0x00C6, // updated 4.2
AddStatusEffect = 0x0141,
ActorControl142 = 0x0142,
ActorControl143 = 0x0143,
ActorControl144 = 0x0144,
UpdateHpMpTp = 0x0145,
///////////////////////////////////////////////////
ChatBanned = 0x006B,
Playtime = 0x006C, // updated 4.4
Logout = 0x0077, // updated 4.4
CFNotify = 0x0078,
CFMemberStatus = 0x0079,
CFDutyInfo = 0x007A,
CFPlayerInNeed = 0x007F,
Chat = 0x00F4, // updated 4.4
SocialList = 0x00FB, // updated 4.4
SocialRequestError = 0x00AD,
UpdateSearchInfo = 0x00FE, // updated 4.4
InitSearchInfo = 0x00FF, // updated 4.4
ExamineSearchComment = 0x0102, // updated 4.1
CFRegistered = 0x00B8, // updated 4.1
SocialRequestResponse = 0x00BB, // updated 4.1
CancelAllianceForming = 0x00C6, // updated 4.2
ServerNotice = 0x0104, // updated 4.4
SetOnlineStatus = 0x0105, // updated 4.4
CountdownInitiate = 0x010C, // updated 4.4
CountdownCancel = 0x010D, // updated 4.4
Chat = 0x00F4, // updated 4.4
SocialList = 0x00FB, // updated 4.4
BlackList = 0x0110, // updated 4.4
UpdateSearchInfo = 0x00FE, // updated 4.4
InitSearchInfo = 0x00FF, // updated 4.4
ExamineSearchComment = 0x0102, // updated 4.1
LogMessage = 0x00D0,
ServerNotice = 0x0104, // updated 4.4
SetOnlineStatus = 0x0105, // updated 4.4
LinkshellList = 0x0117, // updated 4.4
MailDeleteRequest = 0x0118, // updated 4.4
ReqMoogleMailList = 0x0119, // updated 4.4
ReqMoogleMailLetter = 0x01A, // updated 4.4
MailLetterNotification = 0x011B, // updated 4.4
CountdownInitiate = 0x010C, // updated 4.4
CountdownCancel = 0x010D, // updated 4.4
ExamineFreeCompanyInfo = 0x013A, // updated 4.1
CharaFreeCompanyTag = 0x0127, // updated 4.4
FreeCompanyBoardMsg = 0x0128, // updated 4.4
FreeCompanyInfo = 0x0129, // updated 4.4
BlackList = 0x0110, // updated 4.4
StatusEffectList = 0x0149, // updated 4.4
Effect = 0x014C, // updated 4.4
AoeEffect8 = 0x014F, // updated 4.4
AoeEffect16 = 0x0150, // updated 4.4
AoeEffect24 = 0x0151, // updated 4.4
AoeEffect32 = 0x0152, // updated 4.4
PersistantEffect = 0x0153, // updated 4.4
LogMessage = 0x00D0,
GCAffiliation = 0x015D, // updated 4.4
LinkshellList = 0x0117, // updated 4.4
MailDeleteRequest = 0x0118, // updated 4.4
ReqMoogleMailList = 0x0119, // updated 4.4
ReqMoogleMailLetter = 0x01A, // updated 4.4
MailLetterNotification = 0x011B, // updated 4.4
PlayerSpawn = 0x016D, // updated 4.4
NpcSpawn = 0x016E, // updated 4.4
ActorMove = 0x0170, // updated 4.4
ActorSetPos = 0x0172, // updated 4.4
ExamineFreeCompanyInfo = 0x013A, // updated 4.1
CharaFreeCompanyTag = 0x0127, // updated 4.4
FreeCompanyBoardMsg = 0x0128, // updated 4.4
FreeCompanyInfo = 0x0129, // updated 4.4
ActorCast = 0x0174, // updated 4.4
StatusEffectList = 0x0149, // updated 4.4
Effect = 0x014C, // updated 4.4
AoeEffect8 = 0x014F, // updated 4.4
AoeEffect16 = 0x0150, // updated 4.4
AoeEffect24 = 0x0151, // updated 4.4
AoeEffect32 = 0x0152, // updated 4.4
PersistantEffect = 0x0153, // updated 4.4
PartyList = 0x0176, // updated 4.4
HateList = 0x0177, // updated 4.4
GCAffiliation = 0x015D, // updated 4.4
ObjectSpawn = 0x0179, // updated 4.4
ObjectDespawn = 0x017A, // updated 4.4
PlayerSpawn = 0x016D, // updated 4.4
NpcSpawn = 0x016E, // updated 4.4
ActorMove = 0x0170, // updated 4.4
ActorSetPos = 0x0172, // updated 4.4
UpdateClassInfo = 0x017B, // updated 4.4
SilentSetClassJob = 0x017C, // updated 4.4 - seems to be the case, not sure if it's actually used for anything
ActorCast = 0x0174, // updated 4.4
InitUI = 0x017D, // updated 4.4
PlayerStats = 0x017E, // updated 4.4
ActorOwner = 0x017F, // updated 4.4 ?
PlayerStateFlags = 0x0180, // updated 4.4
PlayerClassInfo = 0x0181, // updated 4.4
ModelEquip = 0x0182, // updated 4.4
Examine = 0x0183, // updated 4.4
CharaNameReq = 0x0185, // updated 4.4
SetLevelSync = 0x0186, // not updated for 4.4, not sure what it is anymore
PartyList = 0x0176, // updated 4.4
HateList = 0x0177, // updated 4.4
ItemInfo = 0x018C, // updated 4.4
ContainerInfo = 0x018D, // updated 4.4
InventoryTransactionFinish = 0x018E, // updated 4.4
InventoryTransaction = 0x018F, // updated 4.4
CurrencyCrystalInfo = 0x0190, // updated 4.4
InventoryActionAck = 0x0193, // updated 4.4
UpdateInventorySlot = 0x0194, // updated 4.4
ObjectSpawn = 0x0179, // updated 4.4
ObjectDespawn = 0x017A, // updated 4.4
EventPlay = 0x01A2, // updated 4.4
EventOpenGilShop = 0x01A9, // updated 4.4
DirectorPlayScene = 0x01A6, // updated 4.4
UpdateClassInfo = 0x017B, // updated 4.4
SilentSetClassJob = 0x017C, // updated 4.4 - seems to be the case, not sure if it's actually used for anything
EventStart = 0x01AB, // updated 4.4
EventFinish = 0x01AC, // updated 4.4
InitUI = 0x017D, // updated 4.4
PlayerStats = 0x017E, // updated 4.4
ActorOwner = 0x017F, // updated 4.4 ?
PlayerStateFlags = 0x0180, // updated 4.4
PlayerClassInfo = 0x0181, // updated 4.4
ModelEquip = 0x0182, // updated 4.4
Examine = 0x0183, // updated 4.4
CharaNameReq = 0x0185, // updated 4.4
SetLevelSync = 0x0186, // not updated for 4.4, not sure what it is anymore
EventLinkshell = 0x1169,
ItemInfo = 0x018C, // updated 4.4
ContainerInfo = 0x018D, // updated 4.4
InventoryTransactionFinish = 0x018E, // updated 4.4
InventoryTransaction = 0x018F, // updated 4.4
CurrencyCrystalInfo = 0x0190, // updated 4.4
InventoryActionAck = 0x0193, // updated 4.4
UpdateInventorySlot = 0x0194, // updated 4.4
QuestActiveList = 0x01BF, // updated 4.4
QuestUpdate = 0x01C0, // updated 4.4
QuestCompleteList = 0x01C1, // updated 4.4
EventPlay = 0x01A2, // updated 4.4
EventOpenGilShop = 0x01A9, // updated 4.4
DirectorPlayScene = 0x01A6, // updated 4.4
QuestFinish = 0x01C2, // updated 4.4
MSQTrackerComplete = 0x01C3, // updated 4.4
MSQTrackerProgress = 0x01C4, // updated 4.4
EventStart = 0x01AB, // updated 4.4
EventFinish = 0x01AC, // updated 4.4
QuestMessage = 0x01CA, // updated 4.4
EventLinkshell = 0x1169,
QuestTracker = 0x01CF, // updated 4.4
QuestActiveList = 0x01BF, // updated 4.4
QuestUpdate = 0x01C0, // updated 4.4
QuestCompleteList = 0x01C1, // updated 4.4
Mount = 0x01DF, // updated 4.4
QuestFinish = 0x01C2, // updated 4.4
MSQTrackerComplete = 0x01C3, // updated 4.4
MSQTrackerProgress = 0x01C4, // updated 4.4
DirectorVars = 0x01E1, // updated 4.4
QuestMessage = 0x01CA, // updated 4.4
CFAvailableContents = 0x01FD, // updated 4.2
QuestTracker = 0x01CF, // updated 4.4
WeatherChange = 0x01FC, // updated 4.4
PlayerTitleList = 0x01FD, // updated 4.4
Discovery = 0x01FE, // updated 4.4
Mount = 0x01DF, // updated 4.4
EorzeaTimeOffset = 0x0200, // updated 4.4
DirectorVars = 0x01E1, // updated 4.4
EquipDisplayFlags = 0x020C, // updated 4.4
CFAvailableContents = 0x01FD, // updated 4.2
// housing
LandSetInitialize = 0x0220, // updated 4.4
LandUpdate = 0x0221, // updated 4.4
YardObjectSpawn = 0x0222, // updated 4.4
LandPriceUpdate = 0x0225, // updated 4.3
LandPermission = 0x0229, // updated 4.4
LandSetYardInitialize = 0x022C, // updated 4.4
YardObjectMove = 0x0230, // updated 4.4
LandSetExtending = 0x0251, // updated 4.4
WeatherChange = 0x01FC, // updated 4.4
PlayerTitleList = 0x01FD, // updated 4.4
Discovery = 0x01FE, // updated 4.4
SharedEstateSettingsResponse = 0x023C, // updated 4.4
EorzeaTimeOffset = 0x0200, // updated 4.4
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
PerformNote = 0x0286, // updated 4.3
EquipDisplayFlags = 0x020C, // updated 4.4
PrepareZoning = 0x028F, // updated 4.4
ActorGauge = 0x0292, // updated 4.3
LandsetInitialize = 0x0220, // updated 4.4
YardObjectSpawn = 0x0222, // updated 4.4
LandsetPriceUpdate = 0x0225, // updated 4.3
LandsetPermission = 0x0229, // updated 4.4
LandsetYardInitialize = 0x022C, // updated 4.4
YardObjectMove = 0x0230, // updated 4.4
LandsetExtending = 0x0251, // updated 4.4
LandsetUpdate = 0x0221, // updated 4.4
// Unknown IPC types that still need to be sent
// TODO: figure all these out properly
IPCTYPE_UNK_320 = 0x0249, // updated 4.4
IPCTYPE_UNK_322 = 0x024B, // updated 4.4
SharedEstateSettingsResponse = 0x023C, // updated 4.4
};
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
PerformNote = 0x0286, // updated 4.3
/**
* Client IPC Zone Type Codes.
*/
enum ClientZoneIpcType : uint16_t
{
PrepareZoning = 0x028F, // updated 4.4
ActorGauge = 0x0292, // updated 4.3
PingHandler = 0x0065, // unchanged 4.3
InitHandler = 0x0066, // unchanged 4.3
// Unknown IPC types that still need to be sent
// TODO: figure all these out properly
IPCTYPE_UNK_320 = 0x0249, // updated 4.4
IPCTYPE_UNK_322 = 0x024B, // updated 4.4
FinishLoadingHandler = 0x0069, // unchanged 4.3
};
CFCommenceHandler = 0x006F,
/**
* Client IPC Zone Type Codes.
*/
enum ClientZoneIpcType :
uint16_t
{
PingHandler = 0x0065, // unchanged 4.3
InitHandler = 0x0066, // unchanged 4.3
CFRegisterDuty = 0x0071,
CFRegisterRoulette = 0x0072,
PlayTimeHandler = 0x0073, // unchanged 4.3
LogoutHandler = 0x0074, // unchanged 4.3
FinishLoadingHandler = 0x0069, // unchanged 4.3
CFDutyInfoHandler = 0x0078, // updated 4.2
CFCommenceHandler = 0x006F,
SocialReqSendHandler = 0x00AE, // updated 4.1
CreateCrossWorldLS = 0x00AF, // updated 4.3
ChatHandler = 0x00D3, // updated 4.3
CFRegisterDuty = 0x0071,
CFRegisterRoulette = 0x0072,
PlayTimeHandler = 0x0073, // unchanged 4.3
LogoutHandler = 0x0074, // unchanged 4.3
SocialListHandler = 0x00DB, // updated 4.3
ReqSearchInfoHandler = 0x00E0, // updated 4.3
ReqExamineSearchCommentHandler = 0x00E1, // updated 4.1
CFDutyInfoHandler = 0x0078, // updated 4.2
SetSearchInfoHandler = 0x00DE, // updated 4.3
SocialReqSendHandler = 0x00AE, // updated 4.1
CreateCrossWorldLS = 0x00AF, // updated 4.3
BlackListHandler = 0x00EC, // updated 4.3
PlayerSearchHandler = 0x00E2, // updated 4.2
ChatHandler = 0x00D3, // updated 4.3
LinkshellListHandler = 0x00F4, // updated 4.3
SocialListHandler = 0x00DB, // updated 4.3
ReqSearchInfoHandler = 0x00E0, // updated 4.3
ReqExamineSearchCommentHandler = 0x00E1, // updated 4.1
SearchMarketboard = 0x0103, // updated 4.3
ReqExamineFcInfo = 0x010F, // updated 4.1
SetSearchInfoHandler = 0x00DE, // updated 4.3
FcInfoReqHandler = 0x011A, // updated 4.2
BlackListHandler = 0x00EC, // updated 4.3
PlayerSearchHandler = 0x00E2, // updated 4.2
ReqMarketWishList = 0x012C, // updated 4.3
LinkshellListHandler = 0x00F4, // updated 4.3
ReqJoinNoviceNetwork = 0x0129, // updated 4.2
SearchMarketboard = 0x0103, // updated 4.3
ReqExamineFcInfo = 0x010F, // updated 4.1
ReqCountdownInitiate = 0x012F, // updated 4.4
ReqCountdownCancel = 0x0130, // updated 4.4
ClearWaymarks = 0x0131, // updated 4.4
FcInfoReqHandler = 0x011A, // updated 4.2
ZoneLineHandler = 0x0133, // updated 4.4
ClientTrigger = 0x0134, // updated 4.4 was 13D in 4.3
DiscoveryHandler = 0x0135, // updated 4.4
ReqMarketWishList = 0x012C, // updated 4.3
AddWaymark = 0x013F, // updated 4.3
ReqJoinNoviceNetwork = 0x0129, // updated 4.2
SkillHandler = 0x0137, // updated 4.4
GMCommand1 = 0x0138, // updated 4.4
GMCommand2 = 0x0139, // updated 4.4
ReqCountdownInitiate = 0x012F, // updated 4.4
ReqCountdownCancel = 0x0130, // updated 4.4
ClearWaymarks = 0x0131, // updated 4.4
UpdatePositionHandler = 0x013B, // updated 4.4 was 144
UpdatePositionInstance = 0x0183, // updated 4.3
ZoneLineHandler = 0x0133, // updated 4.4
ClientTrigger = 0x0134, // updated 4.4 was 13D in 4.3
DiscoveryHandler = 0x0135, // updated 4.4
InventoryModifyHandler = 0x0142, // updated 4.4
AddWaymark = 0x013F, // updated 4.3
TalkEventHandler = 0x014B, // updated 4.4
EmoteEventHandler = 0x014C, // updated 4.4
WithinRangeEventHandler = 0x014D, // updated 4.4
OutOfRangeEventHandler = 0x014E, // updated 4.4
EnterTeriEventHandler = 0x014F, // updated 4.4
SkillHandler = 0x0137, // updated 4.4
GMCommand1 = 0x0138, // updated 4.4
GMCommand2 = 0x0139, // updated 4.4
ReturnEventHandler = 0x0154, // updated 4.4
TradeReturnEventHandler = 0x0155, // updated 4.4
UpdatePositionHandler = 0x013B, // updated 4.4 was 144
UpdatePositionInstance = 0x0183, // updated 4.3
LinkshellEventHandler = 0x0150, // updated 4.1 ??
LinkshellEventHandler1 = 0x0151, // updated 4.1 ??
InventoryModifyHandler = 0x0142, // updated 4.4
SetSharedEstateSettings = 0x0177, // updated 4.4
TalkEventHandler = 0x014B, // updated 4.4
EmoteEventHandler = 0x014C, // updated 4.4
WithinRangeEventHandler = 0x014D, // updated 4.4
OutOfRangeEventHandler = 0x014E, // updated 4.4
EnterTeriEventHandler = 0x014F, // updated 4.4
PerformNoteHandler = 0x029B, // updated 4.3
ReturnEventHandler = 0x0154, // updated 4.4
TradeReturnEventHandler = 0x0155, // updated 4.4
ReqEquipDisplayFlagsChange = 0x016F, // updated 4.4
LinkshellEventHandler = 0x0150, // updated 4.1 ??
LinkshellEventHandler1 = 0x0151, // updated 4.1 ??
SetSharedEstateSettings = 0x0177, // updated 4.4
};
PerformNoteHandler = 0x029B, // updated 4.3
////////////////////////////////////////////////////////////////////////////////
/// Chat Connection IPC Codes
/**
* Server IPC Chat Type Codes.
*/
enum ServerChatIpcType : uint16_t
{
Tell = 0x0064, // updated for sb
TellErrNotFound = 0x0066,
};
ReqEquipDisplayFlagsChange = 0x016F, // updated 4.4
/**
* Client IPC Chat Type Codes.
*/
enum ClientChatIpcType : uint16_t
{
TellReq = 0x0064,
};
};
////////////////////////////////////////////////////////////////////////////////
/// Chat Connection IPC Codes
/**
* Server IPC Chat Type Codes.
*/
enum ServerChatIpcType :
uint16_t
{
Tell = 0x0064, // updated for sb
TellErrNotFound = 0x0066,
};
/**
* Client IPC Chat Type Codes.
*/
enum ClientChatIpcType :
uint16_t
{
TellReq = 0x0064,
};
} /* Packets */
} /* Network */
} /* Core */
}
#endif /*_CORE_NETWORK_PACKETS_IPCS_H*/

View file

@ -1541,8 +1541,7 @@ struct FFXIVIpcEquipDisplayFlags :
* Structural representation of the packet sent by the server
* to mount a player
*/
struct FFXIVIpcMount :
FFXIVIpcBasePacket< Mount >
struct FFXIVIpcMount : FFXIVIpcBasePacket< Mount >
{
uint32_t id;
};
@ -1551,8 +1550,7 @@ struct FFXIVIpcMount :
* Structural representation of the packet sent by the server
* to mount a player
*/
struct FFXIVIpcDirectorVars :
FFXIVIpcBasePacket< DirectorVars >
struct FFXIVIpcDirectorVars : FFXIVIpcBasePacket< DirectorVars >
{
/*! DirectorType | ContentId */
uint32_t m_directorId;
@ -1565,22 +1563,19 @@ struct FFXIVIpcDirectorVars :
};
struct FFXIVIpcActorGauge :
FFXIVIpcBasePacket< ActorGauge >
struct FFXIVIpcActorGauge : FFXIVIpcBasePacket< ActorGauge >
{
uint8_t classJobId;
uint8_t data[15]; // depends on classJobId
};
struct FFXIVIpcPerformNote :
FFXIVIpcBasePacket< PerformNote >
struct FFXIVIpcPerformNote : FFXIVIpcBasePacket< PerformNote >
{
uint8_t data[32];
};
//IPCs
struct FFXIVIpcLandsetPermission :
FFXIVIpcBasePacket<LandsetPermission >
struct FFXIVIpcLandPermission : FFXIVIpcBasePacket<LandPermission >
{
Common::HousePermissionSet freeCompanyHouse; // 00
uint64_t unkown1;
@ -1594,25 +1589,22 @@ struct FFXIVIpcLandsetPermission :
uint64_t unkown5;
};
struct FFXIVIpcLandsetUpdate :
FFXIVIpcBasePacket< LandsetUpdate >
struct FFXIVIpcLandUpdate : FFXIVIpcBasePacket< LandUpdate >
{
uint16_t landSetId;
uint16_t unknow0;
uint16_t unknow1;
uint16_t unknow2;
Common::LandsetStruct landset;
Common::LandStruct land;
};
struct FFXIVIpcLandsetPriceUpdate :
FFXIVIpcBasePacket< LandsetPriceUpdate >
struct FFXIVIpcLandPriceUpdate : FFXIVIpcBasePacket< LandPriceUpdate >
{
uint32_t price;
uint32_t timeLeft;
};
struct FFXIVIpcLandsetExtend :
FFXIVIpcBasePacket< LandsetExtending >
struct FFXIVIpcLandSetExtend : FFXIVIpcBasePacket< LandSetExtending >
{
struct
{
@ -1623,11 +1615,10 @@ struct FFXIVIpcLandsetExtend :
} landset[30];
};
struct FFXIVIpcLandsetInitialize :
FFXIVIpcBasePacket< LandsetInitialize >
struct FFXIVIpcLandSetInitialize : FFXIVIpcBasePacket< LandSetInitialize >
{
uint16_t unknown0;
uint16_t wardNum; // set 1 for "Mist, Ward 2"
uint16_t landSetId; // set 1 for "Mist, Ward 2"
uint16_t zoneId;
uint16_t worldId;
uint8_t unknown1;
@ -1638,11 +1629,10 @@ struct FFXIVIpcLandsetInitialize :
uint8_t unknown6;
uint8_t unknown7;
uint8_t unknown8;
Common::LandsetStruct landset[30];
Common::LandStruct land[30];
};
struct FFXIVIpcYardObjectSpawn :
FFXIVIpcBasePacket<YardObjectSpawn>
struct FFXIVIpcYardObjectSpawn : FFXIVIpcBasePacket<YardObjectSpawn>
{
uint8_t landSetId;
uint8_t objectArray;
@ -1654,8 +1644,7 @@ struct FFXIVIpcYardObjectSpawn :
uint16_t pos_z;
};
struct FFXIVIpcYardObjectMove :
FFXIVIpcBasePacket<YardObjectMove>
struct FFXIVIpcYardObjectMove : FFXIVIpcBasePacket<YardObjectMove>
{
uint16_t itemRotation;
uint8_t objectArray;
@ -1668,8 +1657,7 @@ struct FFXIVIpcYardObjectMove :
uint16_t unknown3;
};
struct FFXIVIpcLandsetYardInitialize :
FFXIVIpcBasePacket< LandsetYardInitialize >
struct FFXIVIpcLandSetYardInitialize : FFXIVIpcBasePacket< LandSetYardInitialize >
{
uint32_t unknown1; //always 0xFFFFFFFF
uint32_t unknown2; //always 0xFFFFFFFF

View file

@ -848,7 +848,7 @@ uint16_t Core::Entity::Player::calculateEquippedGearItemLevel()
it++;
}
return std::max( static_cast< int32_t >( iLvlResult / 13 ), 9999 );
return static_cast< uint16_t >( std::min( static_cast< int32_t >( iLvlResult / 13 ), 9999 ) );
}

View file

@ -25,7 +25,7 @@ TYPE_FORWARD( Item );
TYPE_FORWARD( ItemContainer );
TYPE_FORWARD( Session );
TYPE_FORWARD( ZonePosition );
TYPE_FORWARD( Landset )
TYPE_FORWARD( Land )
namespace StatusEffect {
TYPE_FORWARD( StatusEffect );

View file

@ -9,7 +9,7 @@
#include "Actor/Player.h"
#include "Actor/Actor.h"
#include "Landset.h"
#include "Land.h"
#include "Forwards.h"
#include "HousingZone.h"
@ -21,13 +21,13 @@ using namespace Core::Common;
using namespace Core::Network::Packets;
using namespace Core::Network::Packets::Server;
Core::HousingZone::HousingZone( uint8_t wardNum,
Core::HousingZone::HousingZone( uint8_t landSetId,
uint16_t territoryId,
uint32_t guId,
const std::string& internalName,
const std::string& contentName ) :
Zone( territoryId, guId, internalName, contentName ),
m_wardNum( wardNum ),
m_landSetId( landSetId ),
m_zoneId( territoryId )
{
@ -35,12 +35,12 @@ Core::HousingZone::HousingZone( uint8_t wardNum,
bool Core::HousingZone::init()
{
uint32_t landsetId;
for( landsetId = 0; landsetId < 60; landsetId++ )
uint32_t landId;
for( landId = 0; landId < 60; landId++ )
{
auto pObject = make_Landset( m_territoryId, getWardNum(), landsetId );
auto pObject = make_Land( m_territoryId, getLandSetId(), landId );
pObject->setHouseSize( 1 );
m_landsetPtrMap[ landsetId ] = pObject;
m_landPtrMap[ landId ] = pObject;
}
return true;
@ -54,7 +54,7 @@ Core::HousingZone::~HousingZone()
void Core::HousingZone::onPlayerZoneIn(Entity::Player& player)
{
auto pLog = g_fw.get< Logger >();
pLog->debug( "HousingZone::onPlayerZoneIn: Zone#" + std::to_string(getGuId()) + "|"
pLog->debug( "HousingZone::onPlayerZoneIn: Zone#" + std::to_string( getGuId() ) + "|"
", Entity#" + std::to_string( player.getId() ) );
uint32_t yardPacketNum;
@ -64,7 +64,7 @@ void Core::HousingZone::onPlayerZoneIn(Entity::Player& player)
for( yardPacketNum = 0; yardPacketNum < yardPacketTotal; yardPacketNum++ )
{
auto landsetYardInitializePacket = makeZonePacket< FFXIVIpcLandsetYardInitialize >(player.getId());
auto landsetYardInitializePacket = makeZonePacket< FFXIVIpcLandSetYardInitialize >( player.getId() );
landsetYardInitializePacket->data().unknown1 = 0xFFFFFFFF;
landsetYardInitializePacket->data().unknown2 = 0xFFFFFFFF;
landsetYardInitializePacket->data().unknown3 = 0xFF;
@ -80,9 +80,9 @@ void Core::HousingZone::onPlayerZoneIn(Entity::Player& player)
void Core::HousingZone::sendMap( Entity::Player& player )
{
auto landsetInitializePacket = makeZonePacket< FFXIVIpcLandsetInitialize >( player.getId() );
auto landsetInitializePacket = makeZonePacket< FFXIVIpcLandSetInitialize >( player.getId() );
landsetInitializePacket->data().wardNum = m_wardNum;
landsetInitializePacket->data().landSetId = m_landSetId;
landsetInitializePacket->data().zoneId = m_territoryId;
//TODO: get current WorldId
landsetInitializePacket->data().worldId = 67;
@ -92,8 +92,7 @@ void Core::HousingZone::sendMap( Entity::Player& player )
uint8_t count = 0;
for( uint8_t i = startIndex; i < ( startIndex + 30 ); i++ )
{
memcpy( &landsetInitializePacket->data().landset[ count ],
&getLandset( i )->getLandset(), sizeof( Common::LandsetStruct ) );
memcpy( &landsetInitializePacket->data().land[ count ], &getLand( i )->getLand(), sizeof( Common::LandStruct ) );
count++;
}
@ -109,19 +108,19 @@ void Core::HousingZone::onUpdate( uint32_t currTime )
{
for( uint8_t i = 0; i < 60; i++ )
{
getLandset( i )->Update( currTime );
getLand( i )->Update( currTime );
}
}
uint8_t Core::HousingZone::getWardNum() const
uint8_t Core::HousingZone::getLandSetId() const
{
return m_wardNum;
return m_landSetId;
}
Core::LandsetPtr Core::HousingZone::getLandset( uint8_t id )
Core::LandPtr Core::HousingZone::getLand( uint8_t id )
{
auto it = m_landsetPtrMap.find( id );
if( it == m_landsetPtrMap.end() )
auto it = m_landPtrMap.find( id );
if( it == m_landPtrMap.end() )
return nullptr;
return it->second;

View file

@ -9,7 +9,7 @@ namespace Core
class HousingZone : public Zone
{
public:
HousingZone( uint8_t wardNum,
HousingZone( uint8_t landSetId,
uint16_t territoryId,
uint32_t guId,
const std::string& internalName,
@ -26,14 +26,14 @@ namespace Core
bool isPlayerSubInstance( Entity::Player& player );
/* returns current ward number for this zone */
uint8_t getWardNum() const;
Core::LandsetPtr getLandset( uint8_t id );
uint8_t getLandSetId() const;
Core::LandPtr getLand( uint8_t id );
const uint32_t m_wardMaxNum = 18;
private:
using LandsetPtrMap = std::unordered_map< uint8_t, Core::LandsetPtr >;
LandsetPtrMap m_landsetPtrMap;
uint8_t m_wardNum;
using LandPtrMap = std::unordered_map< uint8_t, Core::LandPtr >;
LandPtrMap m_landPtrMap;
uint8_t m_landSetId;
uint32_t m_zoneId;
};

View file

@ -0,0 +1,346 @@
#include <set>
#include <Common.h>
#include <Logging/Logger.h>
#include <Util/Util.h>
#include <Util/UtilMath.h>
#include <Exd/ExdDataGenerated.h>
#include <Database/DatabaseDef.h>
#include <MySqlBase.h>
#include <Connection.h>
#include <Network/GamePacketNew.h>
#include <Network/PacketDef/Zone/ServerZoneDef.h>
#include "Actor/Player.h"
#include "Inventory/ItemContainer.h"
#include "Inventory/Item.h"
#include "Forwards.h"
#include "Land.h"
#include "Framework.h"
extern Core::Framework g_fw;
using namespace Core::Common;
Core::Land::Land( uint16_t zoneId, uint8_t wardNum, uint8_t landId ) :
m_zoneId( zoneId ),
m_wardNum( wardNum ),
m_landId( landId ),
m_currentPrice( 0 ),
m_nextDrop( 0 )
{
m_landKey = ( m_zoneId << 16 ) | ( m_wardNum << 8 ) | m_landId;
memset( &m_land, 0x00, sizeof( LandStruct ) );
load();
}
Core::Land::~Land()
{
}
void Core::Land::load()
{
/* auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
auto res = pDb->query( "SELECT * FROM land WHERE Id = " + std::to_string( m_landKey ) );
if( !res->next() )
{
setHouseSize( HouseSizeType::smallHouse );//ToDo: get house site from ExD (Landset first 60 rows)
m_currentPrice = m_initPrice;
m_land.color[ 7 ] = 0xFF;
m_ownerPlayerId = 0;
m_nextDrop = 0;
setState( HouseStateType::forSell );
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::LAND_INS );
stmt->setUInt( 1, m_landKey );
pDb->directExecute( stmt );
Init();
}
else
{
Init();
if( getState() == HouseStateType::privateHouse || getState() == HouseStateType::sold )
{
m_ownerPlayerId = res->getUInt( "ownerPlayerId" );
}
else if( getState() == HouseStateType::forSell )
{
m_currentPrice = res->getUInt( "currentPrice" );
m_nextDrop = res->getUInt( "nextDrop" );
m_ownerPlayerId = 0;
}
}
ItemsOutdoorContainer = make_ItemContainer( InventoryType::HousingOutdoorItems,
m_maxItems,
"housingoutdooritems", true );*/
}
uint32_t Core::Land::convertItemIdToHousingItemId( uint32_t itemId )
{
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
auto info = pExdData->get< Core::Data::Item >( itemId );
return info->additionalData;
}
void Core::Land::setPreset( uint32_t id )
{
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
auto info = pExdData->get< Core::Data::HousingPreset >( convertItemIdToHousingItemId( id ) );
setRoof( info->exteriorRoof );
setWall( info->exteriorWall );
setWindow( info->exteriorWindow );
setBasementWall( info->basementWall );
setFloorFlooring( info->otherFloorFlooring );
setFloorWall( info->otherFloorWall );
}
//Primary State
void Core::Land::setHouseSize( uint8_t size )
{
m_land.houseSize = size;
}
void Core::Land::setState( uint8_t state )
{
m_land.houseState = state;
}
void Core::Land::setOwnership( uint8_t state )
{
m_land.iconColor = state;
}
void Core::Land::setSharing( uint8_t state )
{
m_land.iconAddIcon = state;
}
uint8_t Core::Land::getHouseSize()
{
return m_land.houseSize;
}
uint8_t Core::Land::getState()
{
return m_land.houseState;
}
uint8_t Core::Land::getOwnership()
{
return m_land.iconColor;
}
uint8_t Core::Land::getSharing()
{
return m_land.iconAddIcon;
}
//Free Comapny
void Core::Land::setFreeCompany( uint32_t id, uint32_t icon, uint32_t color )
{
m_land.fcId = id;
m_land.fcIcon = icon;
m_land.fcIconColor = color; //RGBA
}
uint32_t Core::Land::getFcId()
{
return m_land.fcIcon;
}
uint32_t Core::Land::getFcIcon()
{
return m_land.fcIcon;
}
uint32_t Core::Land::getFcColor()
{
return m_land.fcIconColor;
}
//House Data
void Core::Land::setRoof( uint16_t id )
{
m_land.exteriorRoof = convertItemIdToHousingItemId( id );
}
void Core::Land::setFacade( uint16_t id )
{
m_land.exteriorWall = convertItemIdToHousingItemId( id );
}
void Core::Land::setWindow( uint16_t id )
{
m_land.exteriorWindow = convertItemIdToHousingItemId( id );
}
void Core::Land::setDoor( uint16_t id )
{
m_land.exteriorDoor = convertItemIdToHousingItemId( id );
}
void Core::Land::setFloorWall( uint16_t id )
{
m_land.otherFloorWall = convertItemIdToHousingItemId( id );
}
void Core::Land::setFloorFlooring( uint16_t id )
{
m_land.otherFloorFlooring = convertItemIdToHousingItemId( id );
}
void Core::Land::setWall( uint16_t id )
{
m_land.exteriorWall = convertItemIdToHousingItemId( id );
}
void Core::Land::setSign( uint16_t id )
{
m_land.gardenSign = convertItemIdToHousingItemId( id );
}
void Core::Land::setBasementWall( uint16_t id )
{
m_land.basementWall = convertItemIdToHousingItemId( id );
}
uint16_t Core::Land::getRoof()
{
return m_land.exteriorRoof;
}
uint16_t Core::Land::getFacade()
{
return m_land.exteriorWall;
}
uint16_t Core::Land::getWindow()
{
return m_land.exteriorWindow;
}
uint16_t Core::Land::getDoor()
{
return m_land.exteriorDoor;
}
uint16_t Core::Land::getSign()
{
return m_land.gardenSign;
}
uint16_t Core::Land::getWall()
{
return m_land.basementWall;
}
uint16_t Core::Land::getFloorWall()
{
return m_land.otherFloorFlooring;
}
uint16_t Core::Land::getFloorFlooring()
{
return m_land.otherFloorFlooring;
}
uint16_t Core::Land::getBasememtWall()
{
return m_land.basementWall;
}
//Color
void Core::Land::setColor( uint8_t slot, uint8_t color )
{
m_land.color[ slot ] = color;
}
uint8_t Core::Land::getColor( uint8_t slot )
{
return m_land.color[ slot ];
}
//Player
void Core::Land::setPlayerOwner( uint32_t id )
{
m_ownerPlayerId = id;
}
uint32_t Core::Land::getPlayerOwner()
{
return m_ownerPlayerId;
}
uint32_t Core::Land::getLandKey()
{
return m_landKey;
}
LandStruct Core::Land::getLand()
{
return m_land;
}
uint32_t Core::Land::getMaxItems()
{
return m_maxItems;
}
void Core::Land::Init()
{
switch( getHouseSize() )
{
case HouseSizeType::smallHouse:
m_initPrice = 3750000;
m_maxItems = 20;
break;
case HouseSizeType::mediumHouse:
m_initPrice = 20000000;
m_maxItems = 30;
break;
case HouseSizeType::bigHouse:
m_initPrice = 50000000;
m_maxItems = 40;
break;
default:
break;
}
}
void Core::Land::UpdateDatabase()
{
/*auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
std::string exec = "UPDATE land SET landset='" +
std::string( reinterpret_cast< const char* >( &m_land ) ) + "', nextDrop=" +
std::to_string( m_nextDrop ) + ", currentPrice=" +
std::to_string( m_currentPrice ) +
" WHERE Id =" + std::to_string( m_landKey );
pDb->execute( exec );*/
}
void Core::Land::Update( uint32_t currTime )
{
if( m_currentPrice == 0 && getState() == HouseStateType::forSale )
{
m_currentPrice = m_initPrice;
m_nextDrop = 0;
UpdateDatabase();
}
if( m_nextDrop < currTime && getState() == HouseStateType::forSale )
{
m_currentPrice = ( m_currentPrice / 100 ) * 90;
m_nextDrop = currTime + 86400;
UpdateDatabase();
}
onUpdate();
}
void Core::Land::onUpdate()
{
}

View file

@ -1,11 +1,11 @@
#ifndef LANDSET_H_
#define LANDSET_H_
#ifndef LAND_H_
#define LAND_H_
#include <Common.h>
#include "ForwardsZone.h"
namespace Core
{
class Landset
class Land
{
public:
enum HouseSizeType : uint8_t
@ -19,7 +19,7 @@ namespace Core
enum HouseStateType : uint8_t
{
none,
forSell,
forSale,
sold,
fcHouse,
privateHouse
@ -30,8 +30,8 @@ namespace Core
heart = 0x06
};
Landset( uint16_t zoneId, uint8_t wardNum, uint8_t landsetId );
virtual ~Landset();
Land( uint16_t zoneId, uint8_t wardNum, uint8_t landId );
virtual ~Land();
void load();
@ -85,20 +85,20 @@ namespace Core
void UpdateDatabase();
void Update( uint32_t currTime );
void onUpdate();
uint32_t getLandsetKey();
uint32_t getLandKey();
Common::LandsetStruct getLandset();
Common::LandStruct getLand();
uint32_t getMaxItems();
private:
uint32_t convertItemIdToHousingItemId( uint32_t itemId );
void Init();
uint32_t m_landsetKey;
uint32_t m_landKey;
uint8_t m_wardNum;
uint8_t m_landsetId;
uint8_t m_landId;
uint16_t m_zoneId;
Common::LandsetStruct m_landset;
Common::LandStruct m_land;
uint32_t m_ownerPlayerId;

View file

@ -1,346 +0,0 @@
#include <set>
#include <Common.h>
#include <Logging/Logger.h>
#include <Util/Util.h>
#include <Util/UtilMath.h>
#include <Exd/ExdDataGenerated.h>
#include <Database/DatabaseDef.h>
#include <MySqlBase.h>
#include <Connection.h>
#include <Network/GamePacketNew.h>
#include <Network/PacketDef/Zone/ServerZoneDef.h>
#include "Actor/Player.h"
#include "Inventory/ItemContainer.h"
#include "Inventory/Item.h"
#include "Forwards.h"
#include "Landset.h"
#include "Framework.h"
extern Core::Framework g_fw;
using namespace Core::Common;
Core::Landset::Landset( uint16_t zoneId, uint8_t wardNum, uint8_t landsetId ) :
m_zoneId( zoneId ),
m_wardNum( wardNum ),
m_landsetId( landsetId ),
m_currentPrice( 0 ),
m_nextDrop( 0 )
{
m_landsetKey = ( m_zoneId << 16 ) | ( m_wardNum << 8 ) | m_landsetId;
memset( &m_landset, 0x00, sizeof( LandsetStruct ) );
load();
}
Core::Landset::~Landset()
{
}
void Core::Landset::load()
{
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
auto res = pDb->query( "SELECT * FROM landset WHERE Id = " + std::to_string( m_landsetKey ) );
if( !res->next() )
{
setHouseSize( HouseSizeType::smallHouse );//ToDo: get house site from ExD (Landset first 60 rows)
m_currentPrice = m_initPrice;
m_landset.color[ 7 ] = 0xFF;
m_ownerPlayerId = 0;
m_nextDrop = 0;
setState( HouseStateType::forSell );
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::LAND_INS );
stmt->setUInt( 1, m_landsetKey );
pDb->directExecute( stmt );
Init();
}
else
{
Init();
if( getState() == HouseStateType::privateHouse || getState() == HouseStateType::sold )
{
m_ownerPlayerId = res->getUInt( "ownerPlayerId" );
}
else if( getState() == HouseStateType::forSell )
{
m_currentPrice = res->getUInt( "currentPrice" );
m_nextDrop = res->getUInt( "nextDrop" );
m_ownerPlayerId = 0;
}
}
ItemsOutdoorContainer = make_ItemContainer( InventoryType::HousingOutdoorItems,
m_maxItems,
"housingoutdooritems", true );
}
uint32_t Core::Landset::convertItemIdToHousingItemId( uint32_t itemId )
{
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
auto info = pExdData->get< Core::Data::Item >( itemId );
return info->additionalData;
}
void Core::Landset::setPreset( uint32_t id )
{
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
auto info = pExdData->get< Core::Data::HousingPreset >( convertItemIdToHousingItemId( id ) );
setRoof( info->exteriorRoof );
setWall( info->exteriorWall );
setWindow( info->exteriorWindow );
setBasementWall( info->basementWall );
setFloorFlooring( info->otherFloorFlooring );
setFloorWall( info->otherFloorWall );
}
//Primary State
void Core::Landset::setHouseSize( uint8_t size )
{
m_landset.houseSize = size;
}
void Core::Landset::setState( uint8_t state )
{
m_landset.houseState = state;
}
void Core::Landset::setOwnership( uint8_t state )
{
m_landset.iconColor = state;
}
void Core::Landset::setSharing( uint8_t state )
{
m_landset.iconAddIcon = state;
}
uint8_t Core::Landset::getHouseSize()
{
return m_landset.houseSize;
}
uint8_t Core::Landset::getState()
{
return m_landset.houseState;
}
uint8_t Core::Landset::getOwnership()
{
return m_landset.iconColor;
}
uint8_t Core::Landset::getSharing()
{
return m_landset.iconAddIcon;
}
//Free Comapny
void Core::Landset::setFreeCompany( uint32_t id, uint32_t icon, uint32_t color )
{
m_landset.fcId = id;
m_landset.fcIcon = icon;
m_landset.fcIconColor = color; //RGBA
}
uint32_t Core::Landset::getFcId()
{
return m_landset.fcIcon;
}
uint32_t Core::Landset::getFcIcon()
{
return m_landset.fcIcon;
}
uint32_t Core::Landset::getFcColor()
{
return m_landset.fcIconColor;
}
//House Data
void Core::Landset::setRoof( uint16_t id )
{
m_landset.exteriorRoof = convertItemIdToHousingItemId( id );
}
void Core::Landset::setFacade( uint16_t id )
{
m_landset.exteriorWall = convertItemIdToHousingItemId( id );
}
void Core::Landset::setWindow( uint16_t id )
{
m_landset.exteriorWindow = convertItemIdToHousingItemId( id );
}
void Core::Landset::setDoor( uint16_t id )
{
m_landset.exteriorDoor = convertItemIdToHousingItemId( id );
}
void Core::Landset::setFloorWall( uint16_t id )
{
m_landset.otherFloorWall = convertItemIdToHousingItemId( id );
}
void Core::Landset::setFloorFlooring( uint16_t id )
{
m_landset.otherFloorFlooring = convertItemIdToHousingItemId( id );
}
void Core::Landset::setWall( uint16_t id )
{
m_landset.exteriorWall = convertItemIdToHousingItemId( id );
}
void Core::Landset::setSign( uint16_t id )
{
m_landset.gardenSign = convertItemIdToHousingItemId( id );
}
void Core::Landset::setBasementWall( uint16_t id )
{
m_landset.basementWall = convertItemIdToHousingItemId( id );
}
uint16_t Core::Landset::getRoof()
{
return m_landset.exteriorRoof;
}
uint16_t Core::Landset::getFacade()
{
return m_landset.exteriorWall;
}
uint16_t Core::Landset::getWindow()
{
return m_landset.exteriorWindow;
}
uint16_t Core::Landset::getDoor()
{
return m_landset.exteriorDoor;
}
uint16_t Core::Landset::getSign()
{
return m_landset.gardenSign;
}
uint16_t Core::Landset::getWall()
{
return m_landset.basementWall;
}
uint16_t Core::Landset::getFloorWall()
{
return m_landset.otherFloorFlooring;
}
uint16_t Core::Landset::getFloorFlooring()
{
return m_landset.otherFloorFlooring;
}
uint16_t Core::Landset::getBasememtWall()
{
return m_landset.basementWall;
}
//Color
void Core::Landset::setColor( uint8_t slot, uint8_t color )
{
m_landset.color[ slot ] = color;
}
uint8_t Core::Landset::getColor( uint8_t slot )
{
return m_landset.color[ slot ];
}
//Player
void Core::Landset::setPlayerOwner( uint32_t id )
{
m_ownerPlayerId = id;
}
uint32_t Core::Landset::getPlayerOwner()
{
return m_ownerPlayerId;
}
uint32_t Core::Landset::getLandsetKey()
{
return m_landsetKey;
}
LandsetStruct Core::Landset::getLandset()
{
return m_landset;
}
uint32_t Core::Landset::getMaxItems()
{
return m_maxItems;
}
void Core::Landset::Init()
{
switch( getHouseSize() )
{
case HouseSizeType::smallHouse:
m_initPrice = 3750000;
m_maxItems = 20;
break;
case HouseSizeType::mediumHouse:
m_initPrice = 20000000;
m_maxItems = 30;
break;
case HouseSizeType::bigHouse:
m_initPrice = 50000000;
m_maxItems = 40;
break;
default:
break;
}
}
void Core::Landset::UpdateDatabase()
{
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
std::string exec = "UPDATE land SET landset='" +
std::string( reinterpret_cast< const char* >( &m_landset ) ) + "', nextDrop=" +
std::to_string( m_nextDrop ) + ", currentPrice=" +
std::to_string( m_currentPrice ) +
" WHERE Id =" + std::to_string( m_landsetKey );
pDb->execute( exec );
}
void Core::Landset::Update( uint32_t currTime )
{
if( m_currentPrice == 0 && getState() == HouseStateType::forSell )
{
m_currentPrice = m_initPrice;
m_nextDrop = 0;
UpdateDatabase();
}
if( m_nextDrop < currTime && getState() == HouseStateType::forSell )
{
m_currentPrice = ( m_currentPrice / 100 ) * 90;
m_nextDrop = currTime + 86400;
UpdateDatabase();
}
onUpdate();
}
void Core::Landset::onUpdate()
{
}