当前位置: 首页>>代码示例>>C++>>正文


C++ MagicInstance::Run方法代码示例

本文整理汇总了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();
}
开发者ID:IIATASAYII,项目名称:snoxd-koserver,代码行数:29,代码来源:MagicProcess.cpp

示例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();
}
开发者ID:MuhammetALICA73,项目名称:koserver,代码行数:54,代码来源:MagicProcess.cpp

示例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);
}
开发者ID:ZeusAFK,项目名称:KODarknessProject,代码行数:16,代码来源:Npc.cpp

示例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();
}
开发者ID:sailei1,项目名称:knightonline,代码行数:38,代码来源:MagicProcess.cpp

示例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();
}
开发者ID:Bestisbig,项目名称:koserver,代码行数:36,代码来源:MagicProcess.cpp


注:本文中的MagicInstance::Run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。