本文整理汇总了C++中MagicInstance::Run方法的典型用法代码示例。如果您正苦于以下问题:C++ MagicInstance::Run方法的具体用法?C++ MagicInstance::Run怎么用?C++ MagicInstance::Run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MagicInstance
的用法示例。
在下文中一共展示了MagicInstance::Run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MagicPacket
void CMagicProcess::MagicPacket(Packet & pkt, Unit * pCaster /*= nullptr*/)
{
MagicInstance instance;
pkt >> instance.bOpcode >> instance.nSkillID;
instance.pSkill = g_pMain->m_MagictableArray.GetData(instance.nSkillID);
if (instance.pSkill == nullptr)
{
TRACE("[%s] Used skill %d but it does not exist.\n", pCaster->GetName().c_str(), instance.nSkillID);
return;
}
pkt >> instance.sCasterID >> instance.sTargetID
>> instance.sData[0] >> instance.sData[1] >> instance.sData[2] >> instance.sData[3]
>> instance.sData[4] >> instance.sData[5] >> instance.sData[6] >> instance.sData[7];
instance.pSkillCaster = g_pMain->GetUnit(instance.sCasterID);
instance.pSkillTarget = g_pMain->GetUnit(instance.sTargetID);
// Prevent users from faking other players or NPCs.
if (pCaster != nullptr // if it's nullptr, it's from AI.
&& (instance.pSkillCaster == nullptr
|| instance.pSkillCaster->isNPC()
|| instance.pSkillCaster != pCaster))
return;
instance.bIsRecastingSavedMagic = false;
instance.Run();
}
示例2: MagicPacket
void CMagicProcess::MagicPacket(Packet & pkt, Unit * pCaster /*= nullptr*/)
{
MagicInstance instance;
pkt >> instance.bOpcode >> instance.nSkillID;
instance.pSkill = g_pMain->m_MagictableArray.GetData(instance.nSkillID);
if (instance.pSkill == nullptr)
{
if (pCaster != nullptr)
TRACE("[%s] Used skill %d but it does not exist.\n", pCaster->GetName().c_str(), instance.nSkillID);
return;
}
pkt >> instance.sCasterID >> instance.sTargetID
>> instance.sData[0] >> instance.sData[1] >> instance.sData[2] >> instance.sData[3]
>> instance.sData[4] >> instance.sData[5] >> instance.sData[6];
// Prevent users from faking other players or NPCs.
if (pCaster != nullptr // if it's nullptr, it's from AI.
&& (instance.sCasterID >= NPC_BAND
|| instance.sCasterID != pCaster->GetID()))
return;
if (instance.bSendSkillFailed)
instance.bSendSkillFailed = false;
CUser * pUser = TO_USER(pCaster);
if (pUser != nullptr) {
if (pUser->isPlayer()) {
if (instance.nSkillID < 400000) {
if (pUser->m_LastSkillID != instance.nSkillID) {
if (instance.pSkill->bType[0] == pUser->m_LastSkillType || instance.pSkill->bType[1] == pUser->m_LastSkillType)
{
if ((UNIXTIME - pUser->m_LastSkillUseTime) <= PLAYER_SKILL_REQUEST_INTERVAL) {
instance.bSendSkillFailed = true;
}
}
} else if (pUser->m_LastSkillID == instance.nSkillID) {
if (instance.pSkill->sReCastTime != 0)
{
if ((UNIXTIME - pUser->m_LastSkillUseTime) * 1000 <= (instance.pSkill->sReCastTime * 100)) {
instance.bSendSkillFailed = true;
}
}
}
}
}
}
instance.bIsRecastingSavedMagic = false;
instance.Run();
}
示例3: CastSkill
bool CNpc::CastSkill(Unit * pTarget, uint32 nSkillID)
{
if (pTarget == nullptr)
return false;
MagicInstance instance;
instance.bSendFail = false;
instance.nSkillID = nSkillID;
instance.sCasterID = GetID();
instance.sTargetID = pTarget->GetID();
instance.Run();
return (instance.bSkillSuccessful);
}
示例4: MagicPacket
void CMagicProcess::MagicPacket(Packet & pkt, Unit * pCaster /*= nullptr*/)
{
if (g_pMain->m_IsMagicTableInUpdateProcess)
return;
MagicInstance instance;
pkt >> instance.bOpcode >> instance.nSkillID;
instance.pSkill = g_pMain->m_MagictableArray.GetData(instance.nSkillID);
if (instance.pSkill == nullptr)
{
if (pCaster != nullptr)
TRACE("[%s] Used skill %d but it does not exist.\n", pCaster->GetName().c_str(), instance.nSkillID);
if (pCaster->isPlayer() && instance.nSkillID < 0)
{
DateTime time;
g_pMain->SendFormattedNotice("%s is currently disconnect for skill hack.",Nation::ALL, pCaster->GetName().c_str());
g_pMain->WriteCheatLogFile(string_format("[ SkillHack - %d:%d:%d ] %s Disconnected for SkillHack.\n", time.GetHour(),time.GetMinute(),time.GetSecond(), pCaster->GetName().c_str()));
TO_USER(pCaster)->Disconnect();
}
return;
}
pkt >> instance.sCasterID >> instance.sTargetID
>> instance.sData[0] >> instance.sData[1] >> instance.sData[2] >> instance.sData[3]
>> instance.sData[4] >> instance.sData[5] >> instance.sData[6];
// Prevent users from faking other players or NPCs.
if (pCaster != nullptr // if it's nullptr, it's from AI.
&& (instance.sCasterID >= NPC_BAND
|| instance.sCasterID != pCaster->GetID()))
return;
instance.bIsRecastingSavedMagic = false;
instance.Run();
}
示例5: MagicPacket
void CMagicProcess::MagicPacket(Packet & pkt, Unit * pCaster /*= nullptr*/)
{
bool bSkillTestMode = false;
if (bSkillTestMode)
{
if (pCaster->isPlayer())
if (!TO_USER(pCaster)->isGM())
return;
}
MagicInstance instance;
pkt >> instance.bOpcode >> instance.nSkillID;
instance.pSkill = g_pMain->m_MagictableArray.GetData(instance.nSkillID);
if (instance.pSkill == nullptr)
{
if (pCaster != nullptr)
TRACE("[%s] Used skill %d but it does not exist.\n", pCaster->GetName().c_str(), instance.nSkillID);
return;
}
pkt >> instance.sCasterID >> instance.sTargetID
>> instance.sData[0] >> instance.sData[1] >> instance.sData[2] >> instance.sData[3]
>> instance.sData[4] >> instance.sData[5] >> instance.sData[6];
// Prevent users from faking other players or NPCs.
if (pCaster != nullptr // if it's nullptr, it's from AI.
&& (instance.sCasterID >= NPC_BAND
|| instance.sCasterID != pCaster->GetID()))
return;
instance.bIsRecastingSavedMagic = false;
instance.Run();
}