mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-06 02:37:47 +00:00
house class + fixes
This commit is contained in:
parent
282e6acbfc
commit
762b5f4047
9 changed files with 132 additions and 8 deletions
|
@ -37,7 +37,7 @@ public:
|
|||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( pTerritory );
|
||||
auto pHouMgr = pFw->get< Core::HousingMgr >();
|
||||
|
||||
LandPurchaseResult res = pHouMgr->purchseLand( player, activeLand.plot,
|
||||
LandPurchaseResult res = pHouMgr->purchaseLand( player, activeLand.plot,
|
||||
static_cast< uint8_t >( result.param2 ) );
|
||||
|
||||
switch( res )
|
||||
|
|
|
@ -21,6 +21,7 @@ TYPE_FORWARD( Cell );
|
|||
TYPE_FORWARD( Zone );
|
||||
TYPE_FORWARD( HousingZone );
|
||||
TYPE_FORWARD( HousingMgr );
|
||||
TYPE_FORWARD( House );
|
||||
TYPE_FORWARD( InstanceContent );
|
||||
TYPE_FORWARD( Item );
|
||||
TYPE_FORWARD( ItemContainer );
|
||||
|
|
67
src/servers/sapphire_zone/Zone/House.cpp
Normal file
67
src/servers/sapphire_zone/Zone/House.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#include <set>
|
||||
|
||||
#include <Logging/Logger.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
|
||||
#include "House.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include "Framework.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
||||
Core::House::House( uint32_t houseId, uint32_t landSetId, uint8_t landId, uint8_t wardNum, uint16_t zoneId ) :
|
||||
m_houseId( houseId ),
|
||||
m_landSetId( landSetId ),
|
||||
m_landId( landId ),
|
||||
m_wardNum( wardNum ),
|
||||
m_zoneId( zoneId )
|
||||
{
|
||||
memset( &m_houseParts, 0x00, 8 );
|
||||
memset( &m_HouseMsg, 0x00, 193 );
|
||||
}
|
||||
|
||||
Core::House::~House()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint32_t Core::House::getLandSetId()
|
||||
{
|
||||
return m_landSetId;
|
||||
}
|
||||
|
||||
uint8_t Core::House::getLandId()
|
||||
{
|
||||
return m_landId;
|
||||
}
|
||||
|
||||
uint8_t Core::House::getWardNum()
|
||||
{
|
||||
return m_wardNum;
|
||||
}
|
||||
|
||||
uint32_t Core::House::getHouseId()
|
||||
{
|
||||
return m_houseId;
|
||||
}
|
||||
|
||||
uint8_t Core::House::getHousePartColor( Common::HousePartSlot slot )
|
||||
{
|
||||
return m_housePartsColor[ slot ];
|
||||
}
|
||||
|
||||
void Core::House::setHousePart( Common::HousePartSlot slot, uint32_t id )
|
||||
{
|
||||
m_houseParts[ slot ] = id;
|
||||
}
|
||||
|
||||
void Core::House::setHousePartColor( Common::HousePartSlot slot, uint32_t id )
|
||||
{
|
||||
m_housePartsColor[ slot ] = id;
|
||||
}
|
||||
|
||||
uint32_t Core::House::getHousePart( Common::HousePartSlot slot )
|
||||
{
|
||||
return m_houseParts[ slot ];
|
||||
}
|
47
src/servers/sapphire_zone/Zone/House.h
Normal file
47
src/servers/sapphire_zone/Zone/House.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
#ifndef SAPPHIRE_HOUSE_H
|
||||
#define SAPPHIRE_HOUSE_H
|
||||
|
||||
#include "Forwards.h"
|
||||
#include <Common.h>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
||||
class House
|
||||
{
|
||||
|
||||
public:
|
||||
House( uint32_t houseId, uint32_t landSetId, uint8_t landId, uint8_t wardNum, uint16_t zoneId );
|
||||
virtual ~House();
|
||||
|
||||
//gerneral
|
||||
uint32_t getLandSetId();
|
||||
uint8_t getLandId();
|
||||
uint8_t getWardNum();
|
||||
uint16_t getZoneId();
|
||||
uint32_t getHouseId();
|
||||
|
||||
//functions
|
||||
void setHousePart( Common::HousePartSlot slot, uint32_t id );
|
||||
void setHousePartColor( Common::HousePartSlot slot, uint32_t id );
|
||||
uint32_t getHousePart( Common::HousePartSlot slot );
|
||||
uint8_t getHousePartColor( Common::HousePartSlot slot );
|
||||
|
||||
private:
|
||||
uint32_t m_landSetId;
|
||||
uint8_t m_landId;
|
||||
uint8_t m_wardNum;
|
||||
uint16_t m_zoneId;
|
||||
uint32_t m_houseId;
|
||||
|
||||
uint32_t m_houseParts[8];
|
||||
uint8_t m_housePartsColor[8];
|
||||
|
||||
char m_HouseMsg[193];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SAPPHIRE_HOUSE_H
|
|
@ -43,7 +43,7 @@ bool Core::HousingMgr::init()
|
|||
return true;
|
||||
}
|
||||
|
||||
uint16_t Core::HousingMgr::getNexLandId()
|
||||
uint16_t Core::HousingMgr::getNextLandId()
|
||||
{
|
||||
return ++m_lastLandId;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ uint32_t Core::HousingMgr::toLandSetId( uint16_t territoryTypeId, uint8_t wardId
|
|||
|
||||
void Core::HousingMgr::insertHousingZone( Core::Data::HousingZonePtr hZone )
|
||||
{
|
||||
uint16_t id = getNexLandId();
|
||||
uint16_t id = getNextLandId();
|
||||
m_housingZonePtrMap[id] = hZone;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void Core::HousingMgr::sendLandSignFree( Entity::Player& player, uint8_t wardId,
|
|||
player.queuePacket( plotPricePacket );
|
||||
}
|
||||
|
||||
Core::LandPurchaseResult Core::HousingMgr::purchseLand( Entity::Player& player, uint8_t plot, uint8_t state )
|
||||
Core::LandPurchaseResult Core::HousingMgr::purchaseLand( Entity::Player& player, uint8_t plot, uint8_t state )
|
||||
{
|
||||
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Core
|
|||
bool init();
|
||||
|
||||
uint32_t toLandSetId( uint16_t territoryTypeId, uint8_t wardId ) const;
|
||||
uint16_t getNexLandId();
|
||||
uint16_t getNextLandId();
|
||||
void insertHousingZone( Core::Data::HousingZonePtr hZone );
|
||||
Core::Data::HousingZonePtr getHousingZone( uint16_t id );
|
||||
Core::Data::HousingZonePtr getHousingZoneByLandSetId( uint32_t id );
|
||||
|
@ -31,7 +31,7 @@ namespace Core
|
|||
|
||||
void sendLandSignOwned( Entity::Player& player, uint8_t wardId, uint8_t plotId, uint16_t territoryTypeId );
|
||||
void sendLandSignFree( Entity::Player& player, uint8_t wardId, uint8_t plotId, uint16_t territoryTypeId );
|
||||
LandPurchaseResult purchseLand( Entity::Player& player, uint8_t plot, uint8_t state );
|
||||
LandPurchaseResult purchaseLand( Entity::Player& player, uint8_t plot, uint8_t state );
|
||||
|
||||
bool relinquishLand( Entity::Player& player, uint8_t plot );
|
||||
|
||||
|
|
|
@ -108,10 +108,9 @@ void Core::HousingZone::onPlayerZoneIn( Entity::Player& player )
|
|||
for( uint8_t i = startIndex, count = 0; i < ( startIndex + 30 ); i++, count++ )
|
||||
{
|
||||
landSetMap->data().landInfo[ count ].status = 1;
|
||||
//memcpy( , &getLand( i )->getLand(), sizeof( Common::LandStruct ) );
|
||||
}
|
||||
|
||||
//player.queuePacket( landSetMap );
|
||||
player.queuePacket( landSetMap );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -152,6 +152,13 @@ uint16_t Core::Land::getZoneId() const
|
|||
return m_zoneId;
|
||||
}
|
||||
|
||||
Core::HousePtr Core::Land::getHouse() const
|
||||
{
|
||||
if( !m_house )
|
||||
return nullptr;
|
||||
return m_house;
|
||||
}
|
||||
|
||||
Core::Common::LandType Core::Land::getLandType() const
|
||||
{
|
||||
return m_type;
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace Core
|
|||
uint8_t getLandId() const;
|
||||
uint16_t getZoneId() const;
|
||||
Common::LandType getLandType() const;
|
||||
Core::HousePtr getHouse() const;
|
||||
|
||||
//Free Comapny
|
||||
void setFreeCompany( uint32_t id, uint32_t icon, uint32_t color );
|
||||
|
@ -79,6 +80,8 @@ namespace Core
|
|||
uint32_t m_ownerPlayerId;
|
||||
Core::Data::HousingLandSetPtr m_landInfo;
|
||||
|
||||
Core::HousePtr m_house;
|
||||
|
||||
//item storage
|
||||
Core::ItemContainerPtr ItemsOutdoorContainer;
|
||||
uint32_t m_maxItems;
|
||||
|
|
Loading…
Add table
Reference in a new issue