mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 16:17:46 +00:00
Merge pull request #651 from Arazati/develop-serious
implemented dyeable items
This commit is contained in:
commit
96774b5f55
9 changed files with 77 additions and 6 deletions
|
@ -372,7 +372,7 @@ namespace Sapphire::Network::ActorControl
|
|||
|
||||
Timers = 0x1AB,
|
||||
|
||||
DyeItem = 0x1B5,
|
||||
DyeItem = 0x1B0, // updated 5.21
|
||||
|
||||
RequestChocoboInventory = 0x1C4,
|
||||
|
||||
|
|
|
@ -289,11 +289,11 @@ namespace Sapphire::Network::Packets
|
|||
|
||||
FinishLoadingHandler = 0x007D, // updated 5.21
|
||||
|
||||
CFCommenceHandler = 0x006F,
|
||||
CFCommenceHandler = 0x0201, // updated 5.21
|
||||
|
||||
|
||||
CFRegisterDuty = 0x0071,
|
||||
CFRegisterRoulette = 0xFF72,
|
||||
CFRegisterDuty = 0x00C4, // updated 5.21
|
||||
CFRegisterRoulette = 0x030F, // updated 5.21
|
||||
PlayTimeHandler = 0x0276, // updated 5.1
|
||||
LogoutHandler = 0x0365, // updated 5.21
|
||||
CancelLogout = 0x008F, // updated 5.1
|
||||
|
|
|
@ -1201,7 +1201,8 @@ namespace Sapphire::Network::Packets::Server
|
|||
uint32_t appearanceCatalogId;
|
||||
uint64_t crafterId;
|
||||
uint8_t quality;
|
||||
uint8_t unknown[3];
|
||||
uint8_t stain;
|
||||
uint8_t unknown[2];
|
||||
struct Materia
|
||||
{
|
||||
uint16_t materiaId;
|
||||
|
|
27
src/scripts/action/common/ActionDye2472.cpp
Normal file
27
src/scripts/action/common/ActionDye2472.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/Action.h>
|
||||
#include <Inventory/Item.h>
|
||||
|
||||
class ActionDye2472 :
|
||||
public Sapphire::ScriptAPI::ActionScript
|
||||
{
|
||||
public:
|
||||
ActionDye2472() :
|
||||
Sapphire::ScriptAPI::ActionScript( 2472 )
|
||||
{
|
||||
}
|
||||
|
||||
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||
{
|
||||
auto sourceChara = action.getSourceChara();
|
||||
|
||||
if( !sourceChara->isPlayer() )
|
||||
return;
|
||||
|
||||
//TODO: Effect
|
||||
sourceChara->getAsPlayer()->dyeItemFromDyeingInfo();
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT(ActionDye2472);
|
|
@ -1961,6 +1961,36 @@ uint8_t Sapphire::Entity::Player::getNextObjSpawnIndexForActorId( uint32_t actor
|
|||
return index;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::setDyeingInfo( uint32_t itemToDyeContainer, uint32_t itemToDyeSlot, uint32_t dyeBagContainer, uint32_t dyeBagSlot )
|
||||
{
|
||||
m_dyeingInfo.itemToDyeContainer = itemToDyeContainer;
|
||||
m_dyeingInfo.itemToDyeSlot = itemToDyeSlot;
|
||||
m_dyeingInfo.dyeBagContainer = dyeBagContainer;
|
||||
m_dyeingInfo.dyeBagSlot = dyeBagSlot;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::dyeItemFromDyeingInfo()
|
||||
{
|
||||
uint32_t itemToDyeContainer = m_dyeingInfo.itemToDyeContainer;
|
||||
uint32_t itemToDyeSlot = m_dyeingInfo.itemToDyeSlot;
|
||||
uint32_t dyeBagContainer = m_dyeingInfo.dyeBagContainer;
|
||||
uint32_t dyeBagSlot = m_dyeingInfo.dyeBagSlot;
|
||||
|
||||
sendStateFlags(); // Retail sends all 0s to unlock player after a dye? Possibly not setting a flag when the action is started in the backend..?
|
||||
auto itemToDye = getItemAt( itemToDyeContainer, itemToDyeSlot );
|
||||
auto dyeToUse = getItemAt( dyeBagContainer, dyeBagSlot );
|
||||
|
||||
if ( !itemToDye || !dyeToUse ) return;
|
||||
|
||||
uint32_t stainColorID = dyeToUse->getAdditionalData();
|
||||
itemToDye->setStain( stainColorID );
|
||||
|
||||
// TODO: subtract/remove dye used
|
||||
|
||||
insertInventoryItem( static_cast< Sapphire::Common::InventoryType >( itemToDyeContainer ), static_cast< uint16_t >( itemToDyeSlot ), itemToDye );
|
||||
writeItem( itemToDye );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::resetObjSpawnIndex()
|
||||
{
|
||||
m_objSpawnIndexAllocator.freeAllSpawnIndexes();
|
||||
|
|
|
@ -536,6 +536,9 @@ namespace Sapphire::Entity
|
|||
|
||||
void clearTeleportQuery();
|
||||
|
||||
void setDyeingInfo( uint32_t itemToDyeContainer, uint32_t itemToDyeSlot, uint32_t dyeBagContainer, uint32_t dyeBagSlot );
|
||||
void dyeItemFromDyeingInfo();
|
||||
|
||||
/*! prepares zoning / fades out the screen */
|
||||
void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadeOutTime = 0, uint16_t animation = 0 );
|
||||
|
||||
|
@ -1114,6 +1117,14 @@ namespace Sapphire::Entity
|
|||
|
||||
Common::PlayerTeleportQuery m_teleportQuery;
|
||||
|
||||
struct PlayerDyeingInfo
|
||||
{
|
||||
uint32_t itemToDyeContainer;
|
||||
uint32_t itemToDyeSlot;
|
||||
uint32_t dyeBagContainer;
|
||||
uint32_t dyeBagSlot;
|
||||
} m_dyeingInfo;
|
||||
|
||||
Common::Util::SpawnIndexAllocator< uint8_t > m_objSpawnIndexAllocator;
|
||||
Common::Util::SpawnIndexAllocator< uint8_t > m_actorSpawnIndexAllocator;
|
||||
|
||||
|
|
|
@ -282,6 +282,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
|
|||
// param12 = item to dye slot
|
||||
// param2 = dye bag container
|
||||
// param4 = dye bag slot
|
||||
player.setDyeingInfo( param11, param12, param2, param4 );
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::DirectorInitFinish: // Director init finish
|
||||
|
|
|
@ -74,6 +74,7 @@ namespace Sapphire::Network::Packets::Server
|
|||
auto& entry = m_data.entries[i];
|
||||
entry.catalogId = pItem->getId();
|
||||
entry.quality = pItem->isHq();
|
||||
entry.stain = static_cast< uint8_t >( pItem->getStain() );
|
||||
//entry.appearanceCatalogId = pItem->getGlamourId()
|
||||
// todo: glamour/materia etc.
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Sapphire::Network::Packets::Server
|
|||
m_data.hqFlag = item.isHq() ? 1 : 0;
|
||||
m_data.condition = 60000; // 200%
|
||||
m_data.spiritBond = item.getSpiritbond();
|
||||
m_data.color = 0;
|
||||
m_data.color = item.getStain();
|
||||
m_data.glamourCatalogId = 0;
|
||||
m_data.materia1 = 0;
|
||||
m_data.materia2 = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue