convert for test done
This commit is contained in:
+321
-231
@@ -1,5 +1,6 @@
|
||||
using BrewMonster;
|
||||
using BrewMonster.Assets.PerfectWorld.Scripts.Players;
|
||||
using BrewMonster.Assets.PerfectWorld.Scripts.Skills;
|
||||
using BrewMonster.Managers;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts;
|
||||
@@ -56,9 +57,13 @@ public class CECHostPlayer : CECPlayer
|
||||
private int m_iRoleCreateTime;
|
||||
private int m_iRoleLastLoginTime; // Role last login time
|
||||
private int m_iAccountTotalCash;
|
||||
|
||||
private List<CECObject> m_aTabSels = new List<CECObject>();
|
||||
private List<CECSkill> m_aPtSkills = new List<CECSkill>();
|
||||
private List<CECSkill> m_aEquipSkills = new List<CECSkill>();
|
||||
private List<CECSkill> m_aGoblinSkills = new List<CECSkill>();
|
||||
|
||||
|
||||
private CECSkill m_pPrepSkill;
|
||||
private float playerSpeed = 5.0f;
|
||||
private float jumpHeight = 1.5f;
|
||||
private float gravityValue = -9.81f;
|
||||
@@ -965,9 +970,9 @@ public class CECHostPlayer : CECPlayer
|
||||
return;
|
||||
}
|
||||
|
||||
if (false /*CECUIConfig::Instance().GetGameUI().bEnableActionSwitch*/)
|
||||
{ //m_pActionSwitcher = new CECActionSwitcher(this);
|
||||
|
||||
if (true /*CECUIConfig::Instance().GetGameUI().bEnableActionSwitch*/)
|
||||
{
|
||||
m_pActionSwitcher = new CECActionSwitcher(this);
|
||||
}
|
||||
else
|
||||
m_pActionSwitcher = new CECActionSwitcherBase(this);
|
||||
@@ -1455,274 +1460,308 @@ public class CECHostPlayer : CECPlayer
|
||||
{
|
||||
return m_ExtProps.mv.swim_speed;
|
||||
}
|
||||
public bool ApplySkillShortcut(int idSkill, bool bCombo = false /* false */,
|
||||
int idSelTarget = 0/* 0 */, int iForceAtk = -1/* -1 */)
|
||||
public bool ApplySkillShortcut(int idSkill, bool bCombo = false /* false */,
|
||||
int idSelTarget = 0/* 0 */, int iForceAtk = -1/* -1 */)
|
||||
{
|
||||
//StackChecker::ACTrace(4);
|
||||
|
||||
/* if (m_pActionSwitcher != null)
|
||||
m_pActionSwitcher.PostMessge(EMsgActionSwitcher.MSG_CASTSKILL);
|
||||
if (m_pActionSwitcher != null)
|
||||
m_pActionSwitcher.PostMessge((int)EMsgActionSwitcher.MSG_CASTSKILL);
|
||||
|
||||
// Return-town skill is very special, handle it separately
|
||||
if (idSkill == ID_RETURNTOWN_SKILL)
|
||||
return ReturnToTargetTown(0, bCombo);
|
||||
//if (idSkill == ID_RETURNTOWN_SKILL)
|
||||
// return ReturnToTargetTown(0, bCombo);
|
||||
|
||||
if (idSkill == ID_SUMMONPLAYER_SKILL)
|
||||
return SummonPlayer(idSelTarget, bCombo);
|
||||
//if (idSkill == ID_SUMMONPLAYER_SKILL)
|
||||
// return SummonPlayer(idSelTarget, bCombo);
|
||||
|
||||
if (!CanDo(CANDO_SPELLMAGIC))
|
||||
return false;
|
||||
//if (!CanDo(CANDO_SPELLMAGIC))
|
||||
// return false;
|
||||
|
||||
if (InSlidingState())
|
||||
return false;
|
||||
//if (InSlidingState())
|
||||
// return false;
|
||||
|
||||
if (!bCombo)
|
||||
ClearComboSkill();
|
||||
//ClearComboSkill();
|
||||
|
||||
if (!idSelTarget)
|
||||
idSelTarget = m_idSelTarget;
|
||||
if (idSelTarget == 0)
|
||||
idSelTarget = m_idSelTarget;
|
||||
|
||||
CECSkill* pSkill = GetPositiveSkillByID(idSkill);
|
||||
if (!pSkill) pSkill = GetEquipSkillByID(idSkill);
|
||||
if (!pSkill) pSkill = CECComboSkillState::Instance().GetInherentSkillByID(idSkill);
|
||||
if (!pSkill)
|
||||
CECSkill pSkill = GetPositiveSkillByID(idSkill);
|
||||
if (pSkill == null) pSkill = GetEquipSkillByID(idSkill);
|
||||
if (pSkill == null) pSkill = CECComboSkillState.Instance.GetInherentSkillByID((uint)idSkill);
|
||||
if (pSkill == null)
|
||||
{
|
||||
ASSERT(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we press a chargeable skill again when it's being charged,
|
||||
// we cast it out at once
|
||||
if (IsSpellingMagic() && m_pCurSkill && m_pCurSkill->IsCharging() &&
|
||||
m_pCurSkill->GetSkillID() == pSkill->GetSkillID())
|
||||
{
|
||||
m_pCurSkill->EndCharging();
|
||||
g_pGame->GetGameSession()->c2s_CmdContinueAction();
|
||||
return true;
|
||||
}
|
||||
//// If we press a chargeable skill again when it's being charged,
|
||||
//// we cast it out at once
|
||||
//if (IsSpellingMagic() && m_pCurSkill && m_pCurSkill->IsCharging() &&
|
||||
// m_pCurSkill->GetSkillID() == pSkill->GetSkillID())
|
||||
//{
|
||||
// m_pCurSkill->EndCharging();
|
||||
// g_pGame->GetGameSession()->c2s_CmdContinueAction();
|
||||
// return true;
|
||||
//}
|
||||
|
||||
int iCon = CheckSkillCastCondition(pSkill);
|
||||
if (iCon)
|
||||
{
|
||||
ProcessSkillCondition(iCon);
|
||||
return false;
|
||||
}
|
||||
//int iCon = CheckSkillCastCondition(pSkill);
|
||||
//if (iCon)
|
||||
//{
|
||||
// ProcessSkillCondition(iCon);
|
||||
// return false;
|
||||
//}
|
||||
|
||||
// Get force attack flag
|
||||
bool bForceAttack;
|
||||
if (iForceAtk < 0)
|
||||
bForceAttack = glb_GetForceAttackFlag(NULL);
|
||||
else
|
||||
bForceAttack = iForceAtk > 0 ? true : false;
|
||||
//// Get force attack flag
|
||||
bool bForceAttack = true;
|
||||
//if (iForceAtk < 0)
|
||||
// bForceAttack = glb_GetForceAttackFlag(0);
|
||||
//else
|
||||
// bForceAttack = iForceAtk > 0 ? true : false;
|
||||
|
||||
// Check negative effect skill
|
||||
if (pSkill->GetType() == CECSkill::TYPE_ATTACK || pSkill->GetType() == CECSkill::TYPE_CURSE)
|
||||
{
|
||||
if (idSelTarget == m_PlayerInfo.cid)
|
||||
{
|
||||
// Host cannot spell negative effect magic to himself.
|
||||
g_pGame->GetGameRun()->AddFixedChannelMsg(FIXMSG_TARGETWRONG, GP_CHAT_FIGHT);
|
||||
return false;
|
||||
}
|
||||
else if (idSelTarget)
|
||||
{
|
||||
if (AttackableJudge(idSelTarget, bForceAttack) != 1)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//// Check negative effect skill
|
||||
//if (pSkill->GetType() == CECSkill::TYPE_ATTACK || pSkill->GetType() == CECSkill::TYPE_CURSE)
|
||||
//{
|
||||
// if (idSelTarget == m_PlayerInfo.cid)
|
||||
// {
|
||||
// // Host cannot spell negative effect magic to himself.
|
||||
// g_pGame->GetGameRun()->AddFixedChannelMsg(FIXMSG_TARGETWRONG, GP_CHAT_FIGHT);
|
||||
// return false;
|
||||
// }
|
||||
// else if (idSelTarget)
|
||||
// {
|
||||
// if (AttackableJudge(idSelTarget, bForceAttack) != 1)
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
|
||||
// Check whether target type match
|
||||
int idCastTarget = idSelTarget;
|
||||
int iTargetType = pSkill->GetTargetType();
|
||||
//// Check whether target type match
|
||||
//int idCastTarget = idSelTarget;
|
||||
//int iTargetType = pSkill->GetTargetType();
|
||||
|
||||
if (pSkill->GetType() == CECSkill::TYPE_BLESS ||
|
||||
pSkill->GetType() == CECSkill::TYPE_NEUTRALBLESS)
|
||||
{
|
||||
if (!iTargetType || !ISPLAYERID(idSelTarget))
|
||||
idCastTarget = m_PlayerInfo.cid;
|
||||
//if (pSkill->GetType() == CECSkill::TYPE_BLESS ||
|
||||
// pSkill->GetType() == CECSkill::TYPE_NEUTRALBLESS)
|
||||
//{
|
||||
// if (!iTargetType || !ISPLAYERID(idSelTarget))
|
||||
// idCastTarget = m_PlayerInfo.cid;
|
||||
|
||||
// In some case, we shouldn't add bless effect to other players
|
||||
if (ISPLAYERID(idCastTarget) && idCastTarget != m_PlayerInfo.cid)
|
||||
{
|
||||
// If host has set bless skill filter only to himself, bless skill couldn't add to other players
|
||||
BYTE byBLSMask = glb_BuildBLSMask();
|
||||
// // In some case, we shouldn't add bless effect to other players
|
||||
// if (ISPLAYERID(idCastTarget) && idCastTarget != m_PlayerInfo.cid)
|
||||
// {
|
||||
// // If host has set bless skill filter only to himself, bless skill couldn't add to other players
|
||||
// BYTE byBLSMask = glb_BuildBLSMask();
|
||||
|
||||
if (pSkill->GetRangeType() == CECSkill::RANGE_POINT)
|
||||
{
|
||||
if (!IsTeamMember(idCastTarget))
|
||||
{
|
||||
if (byBLSMask & GP_BLSMASK_SELF)
|
||||
idCastTarget = m_PlayerInfo.cid;
|
||||
else
|
||||
{
|
||||
CECElsePlayer* pPlayer = (CECElsePlayer*)g_pGame->GetGameRun()->GetWorld()->GetPlayerMan()->GetPlayer(idCastTarget);
|
||||
if (!pPlayer)
|
||||
{
|
||||
// Ä¿±êÏûʧ
|
||||
return false;
|
||||
}
|
||||
// if (pSkill->GetRangeType() == CECSkill::RANGE_POINT)
|
||||
// {
|
||||
// if (!IsTeamMember(idCastTarget))
|
||||
// {
|
||||
// if (byBLSMask & GP_BLSMASK_SELF)
|
||||
// idCastTarget = m_PlayerInfo.cid;
|
||||
// else
|
||||
// {
|
||||
// CECElsePlayer* pPlayer = (CECElsePlayer*)g_pGame->GetGameRun()->GetWorld()->GetPlayerMan()->GetPlayer(idCastTarget);
|
||||
// if (!pPlayer)
|
||||
// {
|
||||
// // Ä¿±êÏûʧ
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (pPlayer->IsInvader() || pPlayer->IsPariah())
|
||||
{
|
||||
if (byBLSMask & GP_BLSMASK_NORED)
|
||||
idCastTarget = m_PlayerInfo.cid;
|
||||
}
|
||||
// if (pPlayer->IsInvader() || pPlayer->IsPariah())
|
||||
// {
|
||||
// if (byBLSMask & GP_BLSMASK_NORED)
|
||||
// idCastTarget = m_PlayerInfo.cid;
|
||||
// }
|
||||
|
||||
if (!IsFactionMember(pPlayer->GetFactionID()))
|
||||
{
|
||||
if (byBLSMask & GP_BLSMASK_NOMAFIA)
|
||||
idCastTarget = m_PlayerInfo.cid;
|
||||
}
|
||||
// if (!IsFactionMember(pPlayer->GetFactionID()))
|
||||
// {
|
||||
// if (byBLSMask & GP_BLSMASK_NOMAFIA)
|
||||
// idCastTarget = m_PlayerInfo.cid;
|
||||
// }
|
||||
|
||||
if (!IsFactionAllianceMember(pPlayer->GetFactionID()))
|
||||
{
|
||||
if (byBLSMask & GP_BLSMASK_NOALLIANCE)
|
||||
idCastTarget = m_PlayerInfo.cid;
|
||||
}
|
||||
if (GetForce() != pPlayer->GetForce())
|
||||
{
|
||||
if (byBLSMask & GP_BLSMASK_NOFORCE)
|
||||
idCastTarget = m_PlayerInfo.cid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (!IsFactionAllianceMember(pPlayer->GetFactionID()))
|
||||
// {
|
||||
// if (byBLSMask & GP_BLSMASK_NOALLIANCE)
|
||||
// idCastTarget = m_PlayerInfo.cid;
|
||||
// }
|
||||
// if (GetForce() != pPlayer->GetForce())
|
||||
// {
|
||||
// if (byBLSMask & GP_BLSMASK_NOFORCE)
|
||||
// idCastTarget = m_PlayerInfo.cid;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// If host is in duel, bless skill couldn't add to opponent
|
||||
if (IsInDuel() && idSelTarget == m_pvp.idDuelOpp)
|
||||
idCastTarget = m_PlayerInfo.cid;
|
||||
// // If host is in duel, bless skill couldn't add to opponent
|
||||
// if (IsInDuel() && idSelTarget == m_pvp.idDuelOpp)
|
||||
// idCastTarget = m_PlayerInfo.cid;
|
||||
|
||||
// If host is in battle, bless skill couldn't add to enemies
|
||||
if (IsInBattle())
|
||||
{
|
||||
CECElsePlayer* pPlayer = m_pPlayerMan->GetElsePlayer(idCastTarget);
|
||||
if (!InSameBattleCamp(pPlayer))
|
||||
idCastTarget = m_PlayerInfo.cid;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pSkill->GetType() == CECSkill::TYPE_BLESSPET)
|
||||
{
|
||||
CECPet* pPet = g_pGame->GetGameRun()->GetWorld()->GetNPCMan()->GetPetByID(idSelTarget);
|
||||
if (!pPet || pPet->GetMasterID() == GetCharacterID())
|
||||
{
|
||||
// Spell skill on host's pet
|
||||
CECPetData* pPetData = m_pPetCorral->GetActivePet();
|
||||
if (!pPetData ||
|
||||
pPetData->GetClass() != GP_PET_CLASS_COMBAT &&
|
||||
pPetData->GetClass() != GP_PET_CLASS_SUMMON &&
|
||||
pPetData->GetClass() != GP_PET_CLASS_EVOLUTION)
|
||||
return false;
|
||||
// // If host is in battle, bless skill couldn't add to enemies
|
||||
// if (IsInBattle())
|
||||
// {
|
||||
// CECElsePlayer* pPlayer = m_pPlayerMan->GetElsePlayer(idCastTarget);
|
||||
// if (!InSameBattleCamp(pPlayer))
|
||||
// idCastTarget = m_PlayerInfo.cid;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//else if (pSkill->GetType() == CECSkill::TYPE_BLESSPET)
|
||||
//{
|
||||
// CECPet* pPet = g_pGame->GetGameRun()->GetWorld()->GetNPCMan()->GetPetByID(idSelTarget);
|
||||
// if (!pPet || pPet->GetMasterID() == GetCharacterID())
|
||||
// {
|
||||
// // Spell skill on host's pet
|
||||
// CECPetData* pPetData = m_pPetCorral->GetActivePet();
|
||||
// if (!pPetData ||
|
||||
// pPetData->GetClass() != GP_PET_CLASS_COMBAT &&
|
||||
// pPetData->GetClass() != GP_PET_CLASS_SUMMON &&
|
||||
// pPetData->GetClass() != GP_PET_CLASS_EVOLUTION)
|
||||
// return false;
|
||||
|
||||
idCastTarget = m_pPetCorral->GetActivePetNPCID();
|
||||
}
|
||||
// Only fighting pet can be blessed.
|
||||
if (pPet && !pPet->CanBeAttacked())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iTargetType != 0 && !idCastTarget)
|
||||
return false;
|
||||
}
|
||||
// idCastTarget = m_pPetCorral->GetActivePetNPCID();
|
||||
// }
|
||||
// // Only fighting pet can be blessed.
|
||||
// if (pPet && !pPet->CanBeAttacked())
|
||||
// return false;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (iTargetType != 0 && !idCastTarget)
|
||||
// return false;
|
||||
//}
|
||||
|
||||
// iTargetType == 4 means target must be pet. The problem is that pet will
|
||||
// disappear from world after it died, so GetWorld()->GetObject() will return
|
||||
// NULL when host spells revive-pet skill on his dead pet. So, the target
|
||||
// type of revive-pet skill should be 0
|
||||
if (iTargetType)
|
||||
{
|
||||
// Target shoundn't be a corpse ?
|
||||
int iAliveFlag = 0;
|
||||
if (iTargetType == 1)
|
||||
iAliveFlag = 1;
|
||||
else if (iTargetType == 2)
|
||||
iAliveFlag = 2;
|
||||
//// iTargetType == 4 means target must be pet. The problem is that pet will
|
||||
//// disappear from world after it died, so GetWorld()->GetObject() will return
|
||||
//// NULL when host spells revive-pet skill on his dead pet. So, the target
|
||||
//// type of revive-pet skill should be 0
|
||||
//if (iTargetType)
|
||||
//{
|
||||
// // Target shoundn't be a corpse ?
|
||||
// int iAliveFlag = 0;
|
||||
// if (iTargetType == 1)
|
||||
// iAliveFlag = 1;
|
||||
// else if (iTargetType == 2)
|
||||
// iAliveFlag = 2;
|
||||
|
||||
CECObject* pObject = g_pGame->GetGameRun()->GetWorld()->GetObject(idCastTarget, iAliveFlag);
|
||||
if (!pObject)
|
||||
return false;
|
||||
}
|
||||
// CECObject* pObject = g_pGame->GetGameRun()->GetWorld()->GetObject(idCastTarget, iAliveFlag);
|
||||
// if (!pObject)
|
||||
// return false;
|
||||
//}
|
||||
|
||||
if (!IsMeleeing() && !IsSpellingMagic() &&
|
||||
(!iTargetType || idCastTarget == m_PlayerInfo.cid))
|
||||
{
|
||||
// Cast this skill need't checking cast distance
|
||||
if (!pSkill->ReadyToCast())
|
||||
return false;
|
||||
//if (!IsMeleeing() && !IsSpellingMagic() &&
|
||||
// (!iTargetType || idCastTarget == m_PlayerInfo.cid))
|
||||
//{
|
||||
// // Cast this skill need't checking cast distance
|
||||
// if (!pSkill->ReadyToCast())
|
||||
// return false;
|
||||
|
||||
// Prepare to cast skill, if skill isn't INSTANT and FLASHMOVE,
|
||||
// we must stop moving and stand
|
||||
if (!pSkill->IsInstant() && pSkill->GetType() != CECSkill::TYPE_FLASHMOVE)
|
||||
{
|
||||
if (!NaturallyStopMoving())
|
||||
return false; // Couldn't stop naturally, so cancel casting skill
|
||||
}
|
||||
else if (pSkill->GetType() == CECSkill::TYPE_FLASHMOVE)
|
||||
{
|
||||
if (!CanDo(CANDO_FLASHMOVE))
|
||||
return false;
|
||||
}
|
||||
// // Prepare to cast skill, if skill isn't INSTANT and FLASHMOVE,
|
||||
// // we must stop moving and stand
|
||||
// if (!pSkill->IsInstant() && pSkill->GetType() != CECSkill::TYPE_FLASHMOVE)
|
||||
// {
|
||||
// if (!NaturallyStopMoving())
|
||||
// return false; // Couldn't stop naturally, so cancel casting skill
|
||||
// }
|
||||
// else if (pSkill->GetType() == CECSkill::TYPE_FLASHMOVE)
|
||||
// {
|
||||
// if (!CanDo(CANDO_FLASHMOVE))
|
||||
// return false;
|
||||
// }
|
||||
|
||||
m_pPrepSkill = pSkill;
|
||||
CastSkill(m_PlayerInfo.cid, bForceAttack);
|
||||
}
|
||||
else if (IsSpellingMagic() && m_pCurSkill == pSkill)
|
||||
{
|
||||
// If we are casting the same skill and it's in cooling time
|
||||
return false;
|
||||
}
|
||||
else // Have to trace selected object before cast skill
|
||||
{
|
||||
if (!pSkill->ReadyToCast())
|
||||
return false;
|
||||
// m_pPrepSkill = pSkill;
|
||||
CastSkill(m_PlayerInfo.cid, bForceAttack);
|
||||
//}
|
||||
//else if (IsSpellingMagic() && m_pCurSkill == pSkill)
|
||||
//{
|
||||
// // If we are casting the same skill and it's in cooling time
|
||||
// return false;
|
||||
//}
|
||||
//else // Have to trace selected object before cast skill
|
||||
//{
|
||||
// if (!pSkill->ReadyToCast())
|
||||
// return false;
|
||||
|
||||
if (CECCastSkillWhenMove::Instance().IsSkillSupported(pSkill->GetSkillID(), this) &&
|
||||
m_pWorkMan->IsMovingToPosition() &&
|
||||
m_pWorkMan->CanCastSkillImmediately(pSkill->GetSkillID()))
|
||||
{
|
||||
m_pPrepSkill = pSkill;
|
||||
return CastSkill(idCastTarget, bForceAttack);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool bTraceOK = false;
|
||||
bool bUseAutoPF = false;
|
||||
CECPlayerWrapper* pWrapper = CECAutoPolicy::GetInstance().GetPlayerWrapper();
|
||||
if (CECAutoPolicy::GetInstance().IsAutoPolicyEnabled() && pWrapper->GetAttackError() >= 2)
|
||||
bUseAutoPF = true;
|
||||
// if (CECCastSkillWhenMove::Instance().IsSkillSupported(pSkill->GetSkillID(), this) &&
|
||||
// m_pWorkMan->IsMovingToPosition() &&
|
||||
// m_pWorkMan->CanCastSkillImmediately(pSkill->GetSkillID()))
|
||||
// {
|
||||
// m_pPrepSkill = pSkill;
|
||||
// return CastSkill(idCastTarget, bForceAttack);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// bool bTraceOK = false;
|
||||
// bool bUseAutoPF = false;
|
||||
// CECPlayerWrapper* pWrapper = CECAutoPolicy::GetInstance().GetPlayerWrapper();
|
||||
// if (CECAutoPolicy::GetInstance().IsAutoPolicyEnabled() && pWrapper->GetAttackError() >= 2)
|
||||
// bUseAutoPF = true;
|
||||
|
||||
if (!idCastTarget)
|
||||
{
|
||||
idCastTarget = GetCharacterID(); // ±ÜÃâË²ÒÆµÈ¼¼ÄÜʱ idCastTarget Ϊ0µ¼Ö CECWorkTrace::CreateTraceTarget ·µ»Ø¿Õ
|
||||
}
|
||||
if (CECHPWork * pWork = m_pWorkMan->GetWork(CECHPWork::WORK_TRACEOBJECT))
|
||||
{
|
||||
CECHPWorkTrace* pWorkTrace = dynamic_cast<CECHPWorkTrace*>(pWork);
|
||||
if (pWorkTrace->GetTraceReason() == CECHPWorkTrace::TRACE_SPELL &&
|
||||
pWorkTrace->GetTarget() == idCastTarget &&
|
||||
pWorkTrace->GetPrepSkill() == pSkill)
|
||||
return false; // We are just doing the same thing
|
||||
// if (!idCastTarget)
|
||||
// {
|
||||
// idCastTarget = GetCharacterID(); // ±ÜÃâË²ÒÆµÈ¼¼ÄÜʱ idCastTarget Ϊ0µ¼Ö CECWorkTrace::CreateTraceTarget ·µ»Ø¿Õ
|
||||
// }
|
||||
// if (CECHPWork * pWork = m_pWorkMan->GetWork(CECHPWork::WORK_TRACEOBJECT))
|
||||
// {
|
||||
// CECHPWorkTrace* pWorkTrace = dynamic_cast<CECHPWorkTrace*>(pWork);
|
||||
// if (pWorkTrace->GetTraceReason() == CECHPWorkTrace::TRACE_SPELL &&
|
||||
// pWorkTrace->GetTarget() == idCastTarget &&
|
||||
// pWorkTrace->GetPrepSkill() == pSkill)
|
||||
// return false; // We are just doing the same thing
|
||||
|
||||
pWorkTrace->SetTraceTarget(pWorkTrace->CreatTraceTarget(idCastTarget, CECHPWorkTrace::TRACE_SPELL, bForceAttack), bUseAutoPF);
|
||||
pWorkTrace->SetPrepSkill(pSkill);
|
||||
bTraceOK = true;
|
||||
}
|
||||
else if (m_pWorkMan->CanStartWork(CECHPWork::WORK_TRACEOBJECT))
|
||||
{
|
||||
CECHPWorkTrace* pWork = (CECHPWorkTrace*)m_pWorkMan->CreateWork(CECHPWork::WORK_TRACEOBJECT);
|
||||
pWork->SetTraceTarget(pWork->CreatTraceTarget(idCastTarget, CECHPWorkTrace::TRACE_SPELL, bForceAttack), bUseAutoPF);
|
||||
pWork->SetPrepSkill(pSkill);
|
||||
m_pWorkMan->StartWork_p1(pWork);
|
||||
bTraceOK = true;
|
||||
}
|
||||
// pWorkTrace->SetTraceTarget(pWorkTrace->CreatTraceTarget(idCastTarget, CECHPWorkTrace::TRACE_SPELL, bForceAttack), bUseAutoPF);
|
||||
// pWorkTrace->SetPrepSkill(pSkill);
|
||||
// bTraceOK = true;
|
||||
// }
|
||||
// else if (m_pWorkMan->CanStartWork(CECHPWork::WORK_TRACEOBJECT))
|
||||
// {
|
||||
// CECHPWorkTrace* pWork = (CECHPWorkTrace*)m_pWorkMan->CreateWork(CECHPWork::WORK_TRACEOBJECT);
|
||||
// pWork->SetTraceTarget(pWork->CreatTraceTarget(idCastTarget, CECHPWorkTrace::TRACE_SPELL, bForceAttack), bUseAutoPF);
|
||||
// pWork->SetPrepSkill(pSkill);
|
||||
// m_pWorkMan->StartWork_p1(pWork);
|
||||
// bTraceOK = true;
|
||||
// }
|
||||
|
||||
if (!bTraceOK) return false;
|
||||
}
|
||||
}*/
|
||||
// if (!bTraceOK) return false;
|
||||
// }
|
||||
//}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CastSkill(int idTarget, bool bForceAttack, CECObject pTarget = null)
|
||||
{
|
||||
byte byPVPMask = glb_BuildPVPMask(bForceAttack);
|
||||
UnityGameSession.c2s_CmdCastSkill(m_pPrepSkill.GetSkillID(), byPVPMask, 1, idTarget);
|
||||
}
|
||||
public byte glb_BuildPVPMask(bool bForceAttack)
|
||||
{
|
||||
byte byMask = 0;
|
||||
if (bForceAttack)
|
||||
byMask |= (byte)PVPMask.GP_PVPMASK_FORCE;
|
||||
else
|
||||
{
|
||||
/* CECConfigs pConfigs = EC_Game.GetConfigs();
|
||||
|
||||
if (pConfigs->GetGameSettings().bAtk_Player)
|
||||
{
|
||||
byMask |= GP_PVPMASK_FORCE;
|
||||
|
||||
if (pConfigs->GetGameSettings().bAtk_NoMafia)
|
||||
byMask |= GP_PVPMASK_NOMAFIA;
|
||||
|
||||
if (pConfigs->GetGameSettings().bAtk_NoWhite)
|
||||
byMask |= GP_PVPMASK_NOWHITE;
|
||||
|
||||
if (pConfigs->GetGameSettings().bAtk_NoAlliance)
|
||||
byMask |= GP_PVPMASK_NOALLIANCE;
|
||||
|
||||
if (pConfigs->GetGameSettings().bAtk_NoForce)
|
||||
byMask |= GP_PVPMASK_NOFORCE;
|
||||
}*/
|
||||
}
|
||||
|
||||
return byMask;
|
||||
}
|
||||
public bool SelectTarget(int idTarget)
|
||||
{
|
||||
BMLogger.LogError("HoangDev: HostPlayer SelectTarget");
|
||||
@@ -1746,7 +1785,45 @@ public class CECHostPlayer : CECPlayer
|
||||
|
||||
return bRet;
|
||||
}
|
||||
public CECSkill GetPositiveSkillByID(int id, bool bSenior = false)
|
||||
{
|
||||
CECSkill pSenior = null;
|
||||
|
||||
for (int i = 0; i < m_aPtSkills.Count; i++)
|
||||
{
|
||||
if (m_aPtSkills[i].GetSkillID() == id)
|
||||
return m_aPtSkills[i];
|
||||
else if (m_aPtSkills[i].GetJunior().Find((uint)id))
|
||||
pSenior = m_aPtSkills[i];
|
||||
}
|
||||
|
||||
if (bSenior && pSenior != null)
|
||||
return pSenior;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// C# conversion of CECHostPlayer::GetEquipSkillByID
|
||||
// Assumes: GetEquipSkillNum() returns the count of equipment skills
|
||||
// GetEquipSkillByIndex(int) returns a CECSkill at the given index
|
||||
public CECSkill GetEquipSkillByID(int id)
|
||||
{
|
||||
CECSkill pRet = null;
|
||||
|
||||
for (int i = 0; i < GetEquipSkillNum(); i++)
|
||||
{
|
||||
CECSkill pSkill = GetEquipSkillByIndex(i);
|
||||
if (pSkill != null && pSkill.GetSkillID() == id)
|
||||
{
|
||||
pRet = pSkill;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
public int GetEquipSkillNum() { return m_aEquipSkills.Count; }
|
||||
public CECSkill GetEquipSkillByIndex(int n) { return m_aEquipSkills[n]; }
|
||||
bool CanSelectTarget(int idTarget)
|
||||
{
|
||||
if (idTarget == 0 || idTarget == this.GetCharacterID())
|
||||
@@ -2038,7 +2115,20 @@ public class CECHostPlayer : CECPlayer
|
||||
{
|
||||
m_idSelTarget = id;
|
||||
}
|
||||
public bool glb_GetForceAttackFlag(uint pdwParam)
|
||||
{
|
||||
|
||||
/*bool bForceAttack = false;
|
||||
CECInputCtrl* pInputCtrl = g_pGame->GetGameRun()->GetInputCtrl();
|
||||
|
||||
if (pdwParam)
|
||||
bForceAttack = pInputCtrl->IsCtrlPressed(*pdwParam);
|
||||
else
|
||||
bForceAttack = pInputCtrl->KeyIsBeingPressed(VK_CONTROL);
|
||||
|
||||
return bForceAttack;*/
|
||||
return true;
|
||||
}
|
||||
//public float GetSwimSpeedSev()
|
||||
//{
|
||||
// float fSpeedSev = GetSwimSpeed();
|
||||
|
||||
Reference in New Issue
Block a user