本文整理汇总了C++中CNpc::GetProtoID方法的典型用法代码示例。如果您正苦于以下问题:C++ CNpc::GetProtoID方法的具体用法?C++ CNpc::GetProtoID怎么用?C++ CNpc::GetProtoID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNpc
的用法示例。
在下文中一共展示了CNpc::GetProtoID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClientEvent
void CUser::ClientEvent(uint16 sNpcID)
{
// Ensure AI's loaded
if (!g_pMain->m_bPointCheckFlag
|| isDead())
return;
int32 iEventID = 0;
CNpc *pNpc = g_pMain->GetNpcPtr(sNpcID);
if (pNpc == nullptr
|| !isInRange(pNpc, MAX_NPC_RANGE))
return;
m_sEventNid = sNpcID;
m_sEventSid = pNpc->GetProtoID(); // For convenience purposes with Lua scripts.
// Aww.
if (pNpc->GetType() == NPC_KISS)
{
KissUser();
return;
}
FastGuard lock(g_pMain->m_questNpcLock);
QuestNpcList::iterator itr = g_pMain->m_QuestNpcList.find(pNpc->GetProtoID());
if (itr == g_pMain->m_QuestNpcList.end())
return;
// Copy it. We should really lock the list, but nevermind.
QuestHelperList & pList = itr->second;
_QUEST_HELPER * pHelper = nullptr;
foreach(itr, pList)
{
if ((*itr) == nullptr
|| (*itr)->sEventDataIndex
|| (*itr)->bEventStatus
|| ((*itr)->bNation != 3 && (*itr)->bNation != GetNation())
|| ((*itr)->bClass != 5 && !JobGroupCheck((*itr)->bClass)))
continue;
pHelper = (*itr);
break;
}
if (pHelper == nullptr)
return;
QuestV2RunEvent(pHelper, pHelper->nEventTriggerIndex);
}
示例2: GetNpcPtr
CNpc* CRoomEvent::GetNpcPtr( int sid )
{
if (m_mapRoomNpcArray.IsEmpty())
{
TRACE("### RoomEvent-GetNpcPtr() : monster empty ###\n");
return nullptr;
}
foreach_stlmap (itr, m_mapRoomNpcArray)
{
CNpc *pNpc = g_pMain->GetNpcPtr(itr->first);
if (pNpc == nullptr
|| pNpc->GetProtoID() != sid)
continue;
return pNpc;
}
示例3: ClientEvent
void CUser::ClientEvent(uint16 sNpcID)
{
// Ensure AI's loaded
if (!g_pMain->m_bPointCheckFlag
|| isDead())
return;
int32 iEventID = 0;
CNpc *pNpc = g_pMain->GetNpcPtr(sNpcID);
if (pNpc == nullptr
|| !isInRange(pNpc, MAX_NPC_RANGE))
return;
m_sEventNid = sNpcID;
m_sEventSid = pNpc->GetProtoID(); // For convenience purposes with Lua scripts.
if (pNpc->GetProtoID() == SAW_BLADE_SSID)
{
HpChange(-5000 / 10);
return;
}
else if (pNpc->GetProtoID() == CHAOS_CUBE_SSID && !pNpc->isDead())
{
uint8 nEventRoomUserCount = g_pMain->TempleEventGetRoomUsers(GetEventRoom());
uint8 nItemRewardRankFirst = nEventRoomUserCount / 3;
uint8 nItemRewardRankSecond = (nEventRoomUserCount - 1) * 2;
int32 nUserRank = GetPlayerRank(RANK_TYPE_CHAOS_DUNGEON);
uint32 nItemID = 0;
if (nUserRank == 0)
nItemID = ITEM_KILLING_BLADE;
else if (nUserRank < nItemRewardRankFirst)
nItemID = ITEM_LIGHT_PIT;
else if (nUserRank >= nItemRewardRankFirst && nUserRank <= nItemRewardRankSecond)
nItemID = ITEM_DRAIN_RESTORE;
else if (nUserRank > nItemRewardRankSecond)
nItemID = ITEM_KILLING_BLADE;
GiveItem(nItemID);
g_pMain->ShowNpcEffect(GetSocketID(),251,GetZoneID());
g_pMain->KillNpc(sNpcID);
return;
}
else if (pNpc->GetType() == NPC_KISS)
{
KissUser();
return;
}
Guard lock(g_pMain->m_questNpcLock);
QuestNpcList::iterator itr = g_pMain->m_QuestNpcList.find(pNpc->GetProtoID());
if (itr == g_pMain->m_QuestNpcList.end())
return;
QuestHelperList & pList = itr->second;
_QUEST_HELPER * pHelper = nullptr;
foreach (itr, pList)
{
if ((*itr) == nullptr
|| (*itr)->sEventDataIndex
|| (*itr)->bEventStatus
|| ((*itr)->bNation != 3 && (*itr)->bNation != GetNation())
|| ((*itr)->bClass != 5 && !JobGroupCheck((*itr)->bClass)))
continue;
pHelper = (*itr);
break;
}
if (pHelper == nullptr)
return;
QuestV2RunEvent(pHelper, pHelper->nEventTriggerIndex);
}