mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-03 17:27:47 +00:00
implement dyeing items + show dyes in examine
This commit is contained in:
parent
bf65499e61
commit
4c75f1fd32
8 changed files with 74 additions and 7 deletions
|
@ -372,7 +372,7 @@ namespace Sapphire::Network::ActorControl
|
||||||
|
|
||||||
Timers = 0x1AB,
|
Timers = 0x1AB,
|
||||||
|
|
||||||
DyeItem = 0x1B5,
|
DyeItem = 0x1B0, // updated 5.21
|
||||||
|
|
||||||
RequestChocoboInventory = 0x1C4,
|
RequestChocoboInventory = 0x1C4,
|
||||||
|
|
||||||
|
|
|
@ -1203,7 +1203,8 @@ namespace Sapphire::Network::Packets::Server
|
||||||
uint32_t appearanceCatalogId;
|
uint32_t appearanceCatalogId;
|
||||||
uint64_t crafterId;
|
uint64_t crafterId;
|
||||||
uint8_t quality;
|
uint8_t quality;
|
||||||
uint8_t unknown[3];
|
uint8_t stain;
|
||||||
|
uint8_t unknown[2];
|
||||||
struct Materia
|
struct Materia
|
||||||
{
|
{
|
||||||
uint16_t materiaId;
|
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);
|
|
@ -1926,6 +1926,36 @@ uint8_t Sapphire::Entity::Player::getNextObjSpawnIndexForActorId( uint32_t actor
|
||||||
return index;
|
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((Sapphire::Common::InventoryType)itemToDyeContainer, (uint16_t)itemToDyeSlot, itemToDye);
|
||||||
|
writeItem(itemToDye);
|
||||||
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::resetObjSpawnIndex()
|
void Sapphire::Entity::Player::resetObjSpawnIndex()
|
||||||
{
|
{
|
||||||
m_objSpawnIndexAllocator.freeAllSpawnIndexes();
|
m_objSpawnIndexAllocator.freeAllSpawnIndexes();
|
||||||
|
|
|
@ -536,6 +536,9 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
void clearTeleportQuery();
|
void clearTeleportQuery();
|
||||||
|
|
||||||
|
void setDyeingInfo(uint32_t itemToDyeContainer, uint32_t itemToDyeSlot, uint32_t dyeBagContainer, uint32_t dyeBagSlot);
|
||||||
|
void dyeItemFromDyeingInfo();
|
||||||
|
|
||||||
/*! prepares zoning / fades out the screen */
|
/*! prepares zoning / fades out the screen */
|
||||||
void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadeOutTime = 0, uint16_t animation = 0 );
|
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;
|
Common::PlayerTeleportQuery m_teleportQuery;
|
||||||
|
|
||||||
|
struct PlayerDyeingInfo
|
||||||
|
{
|
||||||
|
uint32_t itemToDyeContainer;
|
||||||
|
uint32_t itemToDyeSlot;
|
||||||
|
uint32_t dyeBagContainer;
|
||||||
|
uint32_t dyeBagSlot;
|
||||||
|
}; PlayerDyeingInfo m_dyeingInfo;
|
||||||
|
|
||||||
Common::Util::SpawnIndexAllocator< uint8_t > m_objSpawnIndexAllocator;
|
Common::Util::SpawnIndexAllocator< uint8_t > m_objSpawnIndexAllocator;
|
||||||
Common::Util::SpawnIndexAllocator< uint8_t > m_actorSpawnIndexAllocator;
|
Common::Util::SpawnIndexAllocator< uint8_t > m_actorSpawnIndexAllocator;
|
||||||
|
|
||||||
|
|
|
@ -279,10 +279,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
|
||||||
}
|
}
|
||||||
case ClientTriggerType::DyeItem: // Dye item
|
case ClientTriggerType::DyeItem: // Dye item
|
||||||
{
|
{
|
||||||
// param11 = item to dye container
|
player.setDyeingInfo(param11, param12, param2, param4);
|
||||||
// param12 = item to dye slot
|
|
||||||
// param2 = dye bag container
|
|
||||||
// param4 = dye bag slot
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ClientTriggerType::DirectorInitFinish: // Director init finish
|
case ClientTriggerType::DirectorInitFinish: // Director init finish
|
||||||
|
|
|
@ -74,6 +74,7 @@ namespace Sapphire::Network::Packets::Server
|
||||||
auto& entry = m_data.entries[i];
|
auto& entry = m_data.entries[i];
|
||||||
entry.catalogId = pItem->getId();
|
entry.catalogId = pItem->getId();
|
||||||
entry.quality = pItem->isHq();
|
entry.quality = pItem->isHq();
|
||||||
|
entry.stain = (uint8_t)pItem->getStain(); //NOTE: More of this packet may be dye info?
|
||||||
//entry.appearanceCatalogId = pItem->getGlamourId()
|
//entry.appearanceCatalogId = pItem->getGlamourId()
|
||||||
// todo: glamour/materia etc.
|
// todo: glamour/materia etc.
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Sapphire::Network::Packets::Server
|
||||||
m_data.hqFlag = item.isHq() ? 1 : 0;
|
m_data.hqFlag = item.isHq() ? 1 : 0;
|
||||||
m_data.condition = 60000; // 200%
|
m_data.condition = 60000; // 200%
|
||||||
m_data.spiritBond = item.getSpiritbond();
|
m_data.spiritBond = item.getSpiritbond();
|
||||||
m_data.color = 0;
|
m_data.color = item.getStain();
|
||||||
m_data.glamourCatalogId = 0;
|
m_data.glamourCatalogId = 0;
|
||||||
m_data.materia1 = 0;
|
m_data.materia1 = 0;
|
||||||
m_data.materia2 = 0;
|
m_data.materia2 = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue