CChar * CChar::Use_Figurine( CItem * pItem, bool bCheckFollowerSlots ) { ADDTOCALLSTACK("CChar::Use_Figurine"); // NOTE: The figurine is NOT destroyed. bool bCreatedNewNpc = false; if ( !pItem ) return NULL; if ( pItem->m_uidLink.IsValidUID() && pItem->m_uidLink.IsChar() && pItem->m_uidLink != GetUID() && !IsPriv(PRIV_GM) ) { SysMessageDefault(DEFMSG_MSG_FIGURINE_NOTYOURS); return NULL; } // Create a new NPC if there's no one linked to this figurine CChar *pPet = pItem->m_itFigurine.m_UID.CharFind(); if ( !pPet ) { CREID_TYPE id = pItem->m_itFigurine.m_ID; if ( !id ) { id = CItemBase::FindCharTrack(pItem->GetID()); if ( !id ) { DEBUG_ERR(("FIGURINE id 0%x, no creature\n", pItem->GetDispID())); return NULL; } } bCreatedNewNpc = true; pPet = CreateNPC(id); ASSERT(pPet); pPet->SetName(pItem->GetName()); if ( pItem->GetHue() ) { pPet->m_prev_Hue = pItem->GetHue(); pPet->SetHue(pItem->GetHue()); } } if ( bCheckFollowerSlots && IsSetOF(OF_PetSlots) ) { if ( !FollowersUpdate(pPet, static_cast<short>(maximum(1, pPet->GetDefNum("FOLLOWERSLOTS", true, true))), true) ) { SysMessageDefault(DEFMSG_PETSLOTS_TRY_CONTROL); if ( bCreatedNewNpc ) pPet->Delete(); return NULL; } } if ( pPet->IsDisconnected() ) pPet->StatFlag_Clear(STATF_Ridden); // pull the creature out of IDLE space pItem->m_itFigurine.m_UID.InitUID(); pPet->m_dirFace = m_dirFace; pPet->NPC_PetSetOwner(this); pPet->MoveToChar(pItem->GetTopLevelObj()->GetTopPoint()); pPet->Update(); pPet->Skill_Start(SKILL_NONE); // was NPCACT_RIDDEN pPet->SoundChar(CRESND_RAND1); return pPet; }