本文整理汇总了C++中PlayerPointer::GetTradeTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::GetTradeTarget方法的具体用法?C++ PlayerPointer::GetTradeTarget怎么用?C++ PlayerPointer::GetTradeTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::GetTradeTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddEnchantment
int32 Item::AddEnchantment( EnchantEntry* Enchantment, uint32 Duration, bool Perm /* = false */, bool apply /* = true */, bool RemoveAtLogout /* = false */, uint32 Slot_, uint32 RandomSuffix )
{
int32 Slot = Slot_;
m_isDirty = true;
/*
if(Perm)
{
if(Slot_)
{
Slot=Slot_;
}
else
{
Slot = FindFreeEnchantSlot(Enchantment);
}
}
else
{
if(Enchantment->EnchantGroups > 1) // replaceable temp enchants
{
Slot = 1;
RemoveEnchantment(1);
}
else
{
Slot = FindFreeEnchantSlot(Enchantment);*/
/*
Slot = Enchantment->type ? 3 : 0;
//that's 's code
for(uint32 Index = ITEM_FIELD_ENCHANTMENT_09; Index < ITEM_FIELD_ENCHANTMENT_32; Index += 3)
{
if(m_uint32Values[Index] == 0) break;;
++Slot;
}
//Slot = FindFreeEnchantSlot(Enchantment);
// reach max of temp enchants
if(Slot >= 11) return -1;
*/
/*}
}
*/
// Create the enchantment struct.
EnchantmentInstance Instance;
Instance.ApplyTime = UNIXTIME;
Instance.BonusApplied = false;
Instance.Slot = Slot;
Instance.Enchantment = Enchantment;
Instance.Duration = Duration;
Instance.RemoveAtLogout = RemoveAtLogout;
Instance.RandomSuffix = RandomSuffix;
// Set the enchantment in the item fields.
uint32 EnchantBase = Slot * 3 + ITEM_FIELD_ENCHANTMENT_1_1;
SetUInt32Value( EnchantBase, Enchantment->Id );
SetUInt32Value( EnchantBase + 1, (uint32)Instance.ApplyTime );
SetUInt32Value( EnchantBase + 2, 0 ); // charges
// Add it to our map.
Enchantments[Slot] = Instance;
if( m_owner == NULL )
return Slot;
PlayerPointer owner = m_owner;
// Add the removal event.
if( Duration )
{
sEventMgr.AddEvent( item_shared_from_this(), &Item::RemoveEnchantment, uint32(Slot), EVENT_REMOVE_ENCHANTMENT1 + Slot, Duration * 1000, 1, 0 );
}
// No need to send the log packet, if the owner isn't in world (we're still loading)
if( !owner->IsInWorld() )
return Slot;
if( apply )
{
WorldPacket EnchantLog( SMSG_ENCHANTMENTLOG, 25 );
EnchantLog << m_owner->GetGUID();
EnchantLog << m_owner->GetGUID();
EnchantLog << m_uint32Values[OBJECT_FIELD_ENTRY];
EnchantLog << Enchantment->Id;
EnchantLog << uint8(0);
owner->GetSession()->SendPacket( &EnchantLog );
if( owner->GetTradeTarget() )
{
owner->SendTradeUpdate();
}
/* Only apply the enchantment bonus if we're equipped */
uint8 slot = m_owner->GetItemInterface()->GetInventorySlotByGuid( GetGUID() );
if( slot > EQUIPMENT_SLOT_START && slot < EQUIPMENT_SLOT_END )
ApplyEnchantmentBonus( Slot, APPLY );
}
owner->SaveToDB(false);
//.........这里部分代码省略.........