示例#1
0
bool CAccountConnector::__AuthState_RecvHandshake()
{
	TPacketGCHandshake kPacketHandshake;
	if (!Recv(sizeof(kPacketHandshake), &kPacketHandshake))
		return false;

	// HandShake
	{
		Tracenf("HANDSHAKE RECV %u %d", kPacketHandshake.dwTime, kPacketHandshake.lDelta);

		ELTimer_SetServerMSec(kPacketHandshake.dwTime+ kPacketHandshake.lDelta);

		//DWORD dwBaseServerTime = kPacketHandshake.dwTime+ kPacketHandshake.lDelta;
		//DWORD dwBaseClientTime = ELTimer_GetMSec();

		kPacketHandshake.dwTime = kPacketHandshake.dwTime + kPacketHandshake.lDelta + kPacketHandshake.lDelta;
		kPacketHandshake.lDelta = 0;

		Tracenf("HANDSHAKE SEND %u", kPacketHandshake.dwTime);

		if (!Send(sizeof(kPacketHandshake), &kPacketHandshake))
		{
			Tracen(" CAccountConnector::__AuthState_RecvHandshake - SendHandshake Error");
			return false;
		}
	}

	return true;
}
示例#2
0
void CPythonPlayer::UseGuildSkill(DWORD dwSkillSlotIndex)
{
	CInstanceBase* pkInstMain = NEW_GetMainActorPtr();
	if (!pkInstMain)
		return;
	if (!pkInstMain->CanUseSkill())
		return;

	///////////////////////////////////////////////////////////////////////////////////////////////

	if (dwSkillSlotIndex >= SKILL_MAX_NUM)
	{
		Tracenf("CPythonPlayer::UseGuildSkill(dwSkillSlotIndex=%d) It's not available skill slot number", dwSkillSlotIndex);
		return;
	}

	TSkillInstance & rkSkillInst = m_playerStatus.aSkill[dwSkillSlotIndex];

	DWORD dwSkillIndex = rkSkillInst.dwIndex;

	CPythonSkill::TSkillData * pSkillData;
	if (!CPythonSkill::Instance().GetSkillData(dwSkillIndex, &pSkillData))
		return;

	if (__CheckRestSkillCoolTime(dwSkillSlotIndex))
	{
		PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotUseSkill", Py_BuildValue("(is)", GetMainCharacterIndex(), "WAIT_COOLTIME"));
		return;
	}

	if (pSkillData->IsOnlyForGuildWar())
	{
		if (!CPythonGuild::Instance().IsDoingGuildWar())
		{
			PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotUseSkill", Py_BuildValue("(is)", GetMainCharacterIndex(), "ONLY_FOR_GUILD_WAR"));
			return;
		}
	}

	DWORD dwMotionIndex = pSkillData->GetSkillMotionIndex();
	if (!pkInstMain->NEW_UseSkill(dwSkillIndex, dwMotionIndex, 1, false))
	{
		Tracenf("CPythonPlayer::UseGuildSkill(%d) - pkInstMain->NEW_UseSkill - ERROR", dwSkillIndex);
	}

	///////////////////////////////////////////////////////////////////////////////////////////////

	CPythonNetworkStream::Instance().SendGuildUseSkillPacket(dwSkillIndex, 0);
	__RunCoolTime(dwSkillSlotIndex);
}
示例#3
0
void CPythonItem::SetDropSoundFileName(DWORD eItemType, const std::string& c_rstFileName)
{
	if (eItemType>=DROPSOUND_NUM)
		return;

	Tracenf("SetDropSoundFile %d : %s", eItemType, c_rstFileName.c_str());

	SGroundItemInstance::ms_astDropSoundFileName[eItemType]=c_rstFileName;
}
bool CGuildMarkUploader::__LoginState_RecvKeyAgreement()
{
	TPacketKeyAgreement packet;
	if (!Recv(sizeof(packet), &packet))
	{
		return false;
	}

	Tracenf("KEY_AGREEMENT RECV %u", packet.wDataLength);

	TPacketKeyAgreement packetToSend;
	size_t dataLength = TPacketKeyAgreement::MAX_DATA_LEN;
	size_t agreedLength = Prepare(packetToSend.data, &dataLength);
	if (agreedLength == 0)
	{
		// 초기화 실패
		Disconnect();
		return false;
	}
	assert(dataLength <= TPacketKeyAgreement::MAX_DATA_LEN);

	if (Activate(packet.wAgreedLength, packet.data, packet.wDataLength))
	{
		// Key agreement 성공, 응답 전송
		packetToSend.bHeader = HEADER_CG_KEY_AGREEMENT;
		packetToSend.wAgreedLength = (WORD)agreedLength;
		packetToSend.wDataLength = (WORD)dataLength;

		if (!Send(sizeof(packetToSend), &packetToSend))
		{
			Tracen(" CAccountConnector::__AuthState_RecvKeyAgreement - SendKeyAgreement Error");
			return false;
		}
		Tracenf("KEY_AGREEMENT SEND %u", packetToSend.wDataLength);
	}
	else
	{
		// 키 협상 실패
		Disconnect();
		return false;
	}
	return true;
}
void CMapOutdoor::SetShadowTextureSize(WORD size)
{
    if (m_wShadowMapSize != size)
    {
        recreate = true;
        Tracenf("ShadowTextureSize changed %d -> %d", m_wShadowMapSize, size);
    }

    m_wShadowMapSize = size;
}
示例#6
0
void CActorInstance::SetLoopMotion(DWORD dwMotion, float fBlendTime, float fSpeedRatio)
{
	if (!m_pkCurRaceData)
	{
		Tracenf("CActorInstance::SetLoopMotion(dwMotion=%d, fBlendTime=%f, fSpeedRatio=%f)", 
			dwMotion, fBlendTime, fSpeedRatio);
		return;
	}

	MOTION_KEY dwMotionKey;
	if (!m_pkCurRaceData->GetMotionKey(m_wcurMotionMode, dwMotion, &dwMotionKey))
	{
		Tracenf("CActorInstance::SetLoopMotion(dwMotion=%d, fBlendTime=%f, fSpeedRatio=%f) - GetMotionKey(m_wcurMotionMode=%d, dwMotion=%d, &MotionKey) ERROR", 
			dwMotion, fBlendTime, fSpeedRatio, m_wcurMotionMode, dwMotion);
		return;
	}

	__ClearMotion();

	SSetMotionData kSetMotData;
	kSetMotData.dwMotKey=dwMotionKey;
	kSetMotData.fBlendTime=fBlendTime;
	kSetMotData.fSpeedRatio=fSpeedRatio;

	DWORD dwRealMotionKey = __SetMotion(kSetMotData);

	if (0 == dwRealMotionKey)
		return;	

	m_kCurMotNode.iMotionType = MOTION_TYPE_LOOP;
	m_kCurMotNode.fStartTime = GetLocalTime();
	m_kCurMotNode.dwMotionKey = dwRealMotionKey;
	m_kCurMotNode.fEndTime = 0.0f;
	m_kCurMotNode.fSpeedRatio = fSpeedRatio;
	m_kCurMotNode.dwcurFrame = 0;
	m_kCurMotNode.dwFrameCount = GetMotionDuration(dwRealMotionKey) / (1.0f / g_fGameFPS);
	m_kCurMotNode.uSkill = 0;
}
bool CGuildMarkUploader::__LoginState_RecvKeyAgreementCompleted()
{
	TPacketKeyAgreementCompleted packet;
	if (!Recv(sizeof(packet), &packet))
	{
		return false;
	}

	Tracenf("KEY_AGREEMENT_COMPLETED RECV");

	ActivateCipher();

	return true;
}
示例#8
0
bool CAccountConnector::__AuthState_RecvKeyAgreementCompleted()
{
	TPacketKeyAgreementCompleted packet;
	if (!Recv(sizeof(packet), &packet))
	{
		return false;
	}

	Tracenf("KEY_AGREEMENT_COMPLETED RECV");

	ActivateCipher();

	return true;
}
示例#9
0
float CActorInstance::GetMotionDuration(DWORD dwMotionKey)
{
	CGraphicThing * pMotion;
	
	if (!GetMotionThingPointer(dwMotionKey, &pMotion))
	{
		Tracenf("CActorInstance::GetMotionDuration - Cannot get motion: %d / %d",
			GET_MOTION_MODE(dwMotionKey), GET_MOTION_INDEX(dwMotionKey));
		return 0.0f;
	}

	if (0 == pMotion->GetMotionCount())
	{
#ifdef _DEBUG
		Tracenf("CActorInstance::GetMotionDuration - Invalid Motion Key : %d, %d, %d",
				GET_MOTION_MODE(dwMotionKey), GET_MOTION_INDEX(dwMotionKey), GET_MOTION_SUB_INDEX(dwMotionKey));
#endif
		return 0.0f;
	}

	CGrannyMotion * pGrannyMotion = pMotion->GetMotionPointer(0);
	return pGrannyMotion->GetDuration();
}
示例#10
0
bool CFlyingManager::RegisterFlyingData(const char* c_szFilename)
{
	std::string s;
	StringPath(c_szFilename,s);
	DWORD dwRetCRC = GetCaseCRC32(s.c_str(),s.size());

	if (m_kMap_pkFlyData.find(dwRetCRC) != m_kMap_pkFlyData.end())
	{
		return false;
	}
	
	CFlyingData * pFlyingData = CFlyingData::New();
	if (!pFlyingData->LoadScriptFile(c_szFilename))
	{
		Tracenf("CEffectManager::RegisterFlyingData %s - Failed to load flying data file", c_szFilename);
		CFlyingData::Delete(pFlyingData);
		return false;
	}

	m_kMap_pkFlyData.insert(make_pair(dwRetCRC,pFlyingData));	
	return true;
}
示例#11
0
// 리턴값 == SetMotion의 리턴값 == 실제로 애니메이션 데이터를 플레이 했느냐?
bool CActorInstance::InterceptMotion(EMotionPushType iMotionType, WORD wMotion, float fBlendTime, UINT uSkill, float fSpeedRatio)
{
	if (!m_pkCurRaceData)
	{
		Tracef("CActorInstance::InterceptMotion(iMotionType=%d, wMotion=%d, fBlendTime=%f) - m_pkCurRaceData=NULL", iMotionType, wMotion, fBlendTime);
		return false;
	}

	MOTION_KEY dwMotionKey;
	if (!m_pkCurRaceData->GetMotionKey(m_wcurMotionMode, wMotion, &dwMotionKey))
	{
		Tracenf("CActorInstance::InterceptMotion(iLoopType=%d, wMotionMode=%d, wMotion=%d, fBlendTime=%f) - GetMotionKey(m_wcurMotionMode=%d, wMotion=%d, &MotionKey) ERROR", 
			iMotionType, m_wcurMotionMode, wMotion, fBlendTime, m_wcurMotionMode, wMotion);
		return false;
	}

	__ClearMotion();

	int iLoopCount;
	if (MOTION_TYPE_ONCE == iMotionType)
		iLoopCount=1;
	else
		iLoopCount=0;

	SSetMotionData kSetMotData;
	kSetMotData.dwMotKey=dwMotionKey;
	kSetMotData.fBlendTime=fBlendTime;
	kSetMotData.iLoopCount=iLoopCount;
	kSetMotData.fSpeedRatio=fSpeedRatio;
	kSetMotData.uSkill=uSkill;

	DWORD dwRealMotionKey = __SetMotion(kSetMotData);

	if (0 == dwRealMotionKey)
		return false;

	if (m_pFlyEventHandler)
	{
		if (__IsNeedFlyTargetMotion())
		{		
			m_pFlyEventHandler->OnSetFlyTarget();
		}	
	}

	assert(NULL != m_pkCurRaceMotionData);

	// FIX : 위에서 호출한 __SetMotion 함수 내에서 랜덤으로 다른 모션을 선택할 수도 있기 때문에 dwMotionKey값은 유효하지 않고
	// 따라서 해당 키로 산출한 duration은 유효하지 않음. 당연히 현재 play중인 모션의 시간을 구해야 함.. -_-;; 
	// float fDuration=GetMotionDuration(dwMotionKey)/fSpeedRatio;
	float fDuration = GetMotionDuration(dwRealMotionKey) / fSpeedRatio;

	m_kCurMotNode.iMotionType = iMotionType;
	m_kCurMotNode.fStartTime = GetLocalTime();
	m_kCurMotNode.fEndTime = m_kCurMotNode.fStartTime + fDuration;
	m_kCurMotNode.dwMotionKey = dwRealMotionKey;	
	m_kCurMotNode.dwcurFrame = 0;
	m_kCurMotNode.dwFrameCount = fDuration / (1.0f / g_fGameFPS);
	m_kCurMotNode.uSkill = uSkill;
	m_kCurMotNode.fSpeedRatio = fSpeedRatio;

	return true;
}
示例#12
0
bool CPythonPlayer::__UseSkill(DWORD dwSlotIndex)
{
	// PrivateShop
	if (IsOpenPrivateShop())
	{
		return true;
	}

	if (!__CanUseSkill())
	{
		return false;
	}

	if (dwSlotIndex >= SKILL_MAX_NUM)
	{
		Tracenf("CPythonPlayer::__UseSkill(dwSlotIndex=%d) It's not available skill slot number", dwSlotIndex);
		return false;
	}

	TSkillInstance & rkSkillInst = m_playerStatus.aSkill[dwSlotIndex];

	if (__CheckSpecialSkill(rkSkillInst.dwIndex))
	{
		return true;
	}

	CPythonSkill::TSkillData * pSkillData;
	if (!CPythonSkill::Instance().GetSkillData(rkSkillInst.dwIndex, &pSkillData))
	{
		Tracenf("CPythonPlayer::__UseSkill(dwSlotIndex=%d) There is no skill data", dwSlotIndex);
		return false;
	}

	if (pSkillData->IsToggleSkill())
	{
		if (IsSkillActive(dwSlotIndex))
		{
			CPythonNetworkStream::Instance().SendUseSkillPacket(rkSkillInst.dwIndex, dwSlotIndex);
			return false;
		}
	}

	if (!__CheckSkillUsable(dwSlotIndex))
	{
		return false;
	}

	CInstanceBase * pkInstMain = NEW_GetMainActorPtr();
	if (!pkInstMain)
	{
		Tracenf("CPythonPlayer::__UseSkill(dwSlotIndex=%d) There is no main player", dwSlotIndex);
		return false;
	}

	if (pkInstMain->IsUsingSkill())
	{
		return false;
	}

	CInstanceBase * pkInstTarget = NULL;

	// NOTE : 타겟이 필요한 경우
	if (pSkillData->IsNeedTarget() ||
		pSkillData->CanChangeDirection() ||
		pSkillData->IsAutoSearchTarget())
	{
		if (pSkillData->IsNeedCorpse())
			pkInstTarget=__GetDeadTargetInstancePtr();
		else
			pkInstTarget=__GetAliveTargetInstancePtr();

		// 현재 타겟이 없으면..
		if (!pkInstTarget)
		{
			// 업데이트하고..
			__ChangeTargetToPickedInstance();

			// 다시 얻어낸다.
			if (pSkillData->IsNeedCorpse())
				pkInstTarget=__GetDeadTargetInstancePtr();
			else
				pkInstTarget=__GetAliveTargetInstancePtr();
		}

		if (pkInstTarget)
		{
			if (pSkillData->IsOnlyForAlliance())
			{
				if (pkInstMain == pkInstTarget)
				{
					if (!pSkillData->CanUseForMe())
					{
						PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotUseSkill", Py_BuildValue("(is)", GetMainCharacterIndex(), "CANNOT_USE_SELF"));
						return false;
					}
				}
				else if (!pkInstMain->IsAttackableInstance(*pkInstTarget) && pkInstTarget->IsPC())
				{
					DWORD dwSkillRange = __GetSkillTargetRange(*pSkillData);

					if (dwSkillRange > 0)
					{
						float fDistance=pkInstMain->GetDistance(pkInstTarget);
						if (fDistance>=float(dwSkillRange))
						{
							__ReserveUseSkill(pkInstTarget->GetVirtualID(), dwSlotIndex, dwSkillRange);
							return false;
						}
					}
				}
				else
				{
					if (pSkillData->CanUseForMe())
					{
						pkInstTarget = pkInstMain;
						Tracef(" [ALERT] 동료에게 사용하는 기술임에도 적에게 타겟팅 되어있어서 자신에게로 재설정\n");
					}
					else
					{
						PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotUseSkill", Py_BuildValue("(is)", GetMainCharacterIndex(), "ONLY_FOR_ALLIANCE"));
						return false;
					}
				}
			}
			else
			{
				if (pkInstTarget->IsInSafe())
				{
					PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotUseSkill", Py_BuildValue("(is)", GetMainCharacterIndex(), "CANNOT_ATTACK_ENEMY_IN_SAFE_AREA"));
					return false;
				}

				if (pkInstMain->IsAttackableInstance(*pkInstTarget))
				{
					if (!__ProcessEnemySkillTargetRange(*pkInstMain, *pkInstTarget, *pSkillData, dwSlotIndex))
						return false;
				}
				else
				{
					PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotUseSkill", Py_BuildValue("(is)", GetMainCharacterIndex(), "CANNOT_ATTACK"));
					return false;
				}
			}

			pkInstMain->SetFlyTargetInstance(*pkInstTarget);

			if (pkInstMain != pkInstTarget)
			{
				if (pkInstMain->IsFlyTargetObject())
				{
					pkInstMain->NEW_LookAtFlyTarget();
				}
				else
				{
					pkInstMain->NEW_LookAtDestInstance(*pkInstTarget);
				}
			}
		}
		else
		{
			if (pSkillData->IsAutoSearchTarget())
			{
				if (pkInstMain->NEW_GetFrontInstance(&pkInstTarget, 2000.0f))
				{
					SetTarget(pkInstTarget->GetVirtualID());
					if (!__ProcessEnemySkillTargetRange(*pkInstMain, *pkInstTarget, *pSkillData, dwSlotIndex))
						return false;
				}
				else
				{
					PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotUseSkill", Py_BuildValue("(is)", GetMainCharacterIndex(), "NEED_TARGET"));
					return false;
				}
			}

			if (pSkillData->CanUseForMe())
			{
				pkInstTarget = pkInstMain;
				pkInstMain->SetFlyTargetInstance(*pkInstMain);
				Tracef(" [ALERT] 타겟이 없어서 플레이어에게 사용합니다\n");
			}
			else if (pSkillData->IsNeedCorpse())
			{
				PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotUseSkill", Py_BuildValue("(is)", GetMainCharacterIndex(), "ONLY_FOR_CORPSE"));
				return false;
			}
			else
			{
				PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotUseSkill", Py_BuildValue("(is)", GetMainCharacterIndex(), "NEED_TARGET"));
				return false;
			}
		}
	}

	if (pSkillData->CanChangeDirection())
	{
		DWORD dwPickedActorID;
		TPixelPosition kPPosPickedGround;

		if (pkInstTarget && pkInstTarget!=pkInstMain)
		{
			pkInstMain->NEW_LookAtDestInstance(*pkInstTarget);
		}
		else if (__GetPickedActorID(&dwPickedActorID))
		{
			CInstanceBase* pkInstVictim=NEW_FindActorPtr(dwPickedActorID);
			if (pkInstVictim)
				pkInstMain->NEW_LookAtDestInstance(*pkInstVictim);
		}
		else if (__GetPickedGroundPos(&kPPosPickedGround))
		{
			pkInstMain->NEW_LookAtDestPixelPosition(kPPosPickedGround);
		}
		else
		{
			Tracenf("CPythonPlayer::__UseSkill(%d) - 화면 기준 방향 설정을 해야함", dwSlotIndex);
		}
	}

	// 관격술 처리
	DWORD dwTargetMaxCount = pSkillData->GetTargetCount(rkSkillInst.fcurEfficientPercentage);
	DWORD dwRange = __GetSkillTargetRange(*pSkillData);
	if (dwTargetMaxCount>0 && pkInstTarget)
	{
		DWORD dwTargetCount=1;
		std::vector<CInstanceBase*> kVct_pkInstTarget;

		if (pSkillData->IsFanRange())
		{
			if (pkInstMain->NEW_GetInstanceVectorInFanRange(float(dwRange), *pkInstTarget, &kVct_pkInstTarget))
			{
				std::vector<CInstanceBase*>::iterator i;
				for (i=kVct_pkInstTarget.begin(); i!=kVct_pkInstTarget.end(); ++i)
				{
					if (dwTargetCount>=dwTargetMaxCount)
						break;

					CInstanceBase* pkInstEach=*i;

					if (pkInstTarget!=pkInstEach && !pkInstEach->IsDead())
					{
						pkInstMain->AddFlyTargetInstance(*pkInstEach);
						CPythonNetworkStream::Instance().SendAddFlyTargetingPacket(pkInstEach->GetVirtualID(), pkInstEach->GetGraphicThingInstanceRef().OnGetFlyTargetPosition());

						dwTargetCount++;
					}
				}
			}
		}
		else if (pSkillData->IsCircleRange())
		{
			if (pkInstMain->NEW_GetInstanceVectorInCircleRange(float(dwRange), &kVct_pkInstTarget))
			{
				std::vector<CInstanceBase*>::iterator i;
				for (i=kVct_pkInstTarget.begin(); i!=kVct_pkInstTarget.end(); ++i)
				{
					if (dwTargetCount>=dwTargetMaxCount)
						break;

					CInstanceBase* pkInstEach=*i;

					if (pkInstTarget!=pkInstEach && !pkInstEach->IsDead())
					{
						pkInstMain->AddFlyTargetInstance(*pkInstEach);
						CPythonNetworkStream::Instance().SendAddFlyTargetingPacket(pkInstEach->GetVirtualID(), pkInstEach->GetGraphicThingInstanceRef().OnGetFlyTargetPosition());

						dwTargetCount++;
					}
				}
			}
		}

		if (dwTargetCount<dwTargetMaxCount)
		{
			while (dwTargetCount<dwTargetMaxCount)
			{
				TPixelPosition kPPosDst;
				pkInstMain->NEW_GetRandomPositionInFanRange(*pkInstTarget, &kPPosDst);

				kPPosDst.x=kPPosDst.x;
				kPPosDst.y=-kPPosDst.y;

				pkInstMain->AddFlyTargetPosition(kPPosDst);
				CPythonNetworkStream::Instance().SendAddFlyTargetingPacket(0, kPPosDst);

				dwTargetCount++;
			}
		}
	}

	/////
	// NOTE : 멀리서 적을 클릭해놓고 스킬을 쓰면 스킬을 쓴뒤 바로 적을 공격하는 문제를 수정하기 위한 코드 - [levites]
	__ClearReservedAction();
	/////

	if (!pSkillData->IsNoMotion())
	{
		DWORD dwMotionIndex = pSkillData->GetSkillMotionIndex(rkSkillInst.iGrade);
		DWORD dwLoopCount = pSkillData->GetMotionLoopCount(rkSkillInst.fcurEfficientPercentage);
		if (!pkInstMain->NEW_UseSkill(rkSkillInst.dwIndex, dwMotionIndex, dwLoopCount, pSkillData->IsMovingSkill() ? true : false))
		{
			Tracenf("CPythonPlayer::__UseSkill(%d) - pkInstMain->NEW_UseSkill - ERROR", dwSlotIndex);
			return false;
		}
	}

	DWORD dwTargetVID=pkInstTarget ? pkInstTarget->GetVirtualID() : 0;

	__SendUseSkill(dwSlotIndex, dwTargetVID);
	return true;
}