本文整理汇总了C++中CMoveShape类的典型用法代码示例。如果您正苦于以下问题:C++ CMoveShape类的具体用法?C++ CMoveShape怎么用?C++ CMoveShape使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMoveShape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDestIntVar
//设置目标整形变量的值,$bound默认为0
double CScript::SetDestIntVar(const char* cmd, char* retStr)
{
double dbRet = 0;
CMoveShape* pMoveShape = dynamic_cast<CMoveShape*>(p_DesShape);
if(!pMoveShape) return dbRet;
char* szValueName= GetStringParam(cmd,0);
if(szValueName)
{
if( strlen(szValueName) >= 2 && szValueName[0]=='$')
{
long lValue = GetIntParam(cmd,1);
if(lValue != ERROR_CODE)
{
long lBound = GetIntParam(cmd,2);
if(lBound == ERROR_CODE)
{
lBound = 0;
}
dbRet = pMoveShape->GetVariableList()->SetVarValue(szValueName,0,lValue);
}
}
M_FREE( szValueName, sizeof(char)*MAX_VAR_LEN );
}
return dbRet;
}
示例2: RegisterTimer
//为当前对象注册一个定时器
double CScript::RegisterTimer(const char* cmd, char* retStr)
{
int nRet = 0;
long lfuturetime = static_cast<long>(GetIntParam(cmd, 0));
if(lfuturetime != ERROR_CODE && lfuturetime != INVILID_VALUE)
{
long lInterTime = static_cast<long>(GetIntParam(cmd, 1));
if(lInterTime != ERROR_CODE && lInterTime != INVILID_VALUE)
{
char* pszScriptName=GetStringParam(cmd,2);
if( pszScriptName )
{
long lUserData = static_cast<long>(GetIntParam(cmd, 3));
if(lUserData != ERROR_CODE && lUserData != INVILID_VALUE)
{
CMoveShape* pMoveShape = dynamic_cast<CMoveShape*>(p_SrcShape);
if( pMoveShape )
{
//添加提示
nRet = pMoveShape->RegisterScriptTimer(lfuturetime,lInterTime,
pszScriptName,lUserData);
}
}
M_FREE( pszScriptName, sizeof(char)*MAX_VAR_LEN );
}
}
}
return nRet;
}
示例3: operator
/// return true to filter shape.
bool operator() ( CShape *pShape )
{
CMoveShape *pDest = static_cast<CMoveShape*>( pShape );
if( pDest->IsDied() )
{
return true;
}
if( pOwner->Distance( pShape ) > lRange )
{
return true;
}
if (!pDest->IsVisible(pOwner) ) // ÒþÐÎ
{
return true;
}
if( pDest->GetExID() == pOwner->GetBefoolID() )
{
return true;
}
if( AIUtilities::IsInGodState( pShape ) )
{
return true;
}
return false;
}
示例4: GetGame
void Script::CallScriptByGUID(const CGUID& shapeGuid, const char* scriptFilename)
{
CMoveShape* shape = GetGame()->FindShape(TYPE_PLAYER, shapeGuid);
if(shape==NULL)
{
CServerRegion* region = dynamic_cast<CServerRegion*>(m_RunEnv.region);
if(region != NULL)
shape = dynamic_cast<CMoveShape*>(region->FindChildObject(TYPE_MONSTER, shapeGuid));
}
if(shape != NULL) // 本地调用脚本
{
RunEnv env;
env.region = dynamic_cast<CRegion*>(shape->GetFather());
env.srcShape = shape;
GetInst(ScriptSys).RunScript(env, scriptFilename);
}
else // 跨服调用脚本
{
CMessage msg(MSG_S2W_QUEST_PlayerRunScript);
msg.Add(shapeGuid); // call guid
msg.Add(scriptFilename); // called script name
msg.SendToSocket(GetGame()->GetWSSocket());
}
}
示例5: Execute
//执行
void COpGood::Execute(CMoveShape* pShape)
{
CMoveShape *pMoveShape = NULL;
if (m_Obj==Obj_Self)
{
pMoveShape = m_pParam->pUser;
}
else
{
pMoveShape = pShape;
}
if (m_Op == MODOP_Sub)
{
if (m_strOrigName.size()>0)
{
//根据原始名删除物品
pMoveShape->DelGoods((char*)m_strOrigName.c_str(),m_nValue);
}
else if(m_nPlace!=0&&m_nPos!=0)
{
//根据容器id和pos删除物品
pMoveShape->DelGoodsAndSendMsg(m_nPlace,m_nPos);
}
else
{
//根据容器id和物品类别删除物品
pMoveShape->DeleteGoods((CS2CContainerObjectMove::PLAYER_EXTEND_ID)m_nPlace,(eGoodsBaseType)m_nGoodType,m_nWeaponType,m_nValue);
}
}
}
示例6: GetStringParam
//设置目标变量GUID的值
double CScript::SetDestGuidVar(const char* cmd, char* retStr)
{
double dbRet = 0;
CMoveShape* pMoveShape = dynamic_cast<CMoveShape*>(p_DesShape);
if(!pMoveShape) return dbRet;
char* szValueName= GetStringParam(cmd,0);
if(szValueName)
{
if( strlen(szValueName) >= 2 && szValueName[0]=='@')
{
char* szGuidName = GetStringParam(cmd,1);
if(szGuidName )
{
if(p_SrcShape)
{
const CGUID& guid = GetScriptGuidValue((CMoveShape*)p_SrcShape, szGuidName);
pMoveShape->GetVariableList()->SetGuidValue(szValueName,&guid);
}
M_FREE( szGuidName, sizeof(char)*MAX_VAR_LEN );
}
}
M_FREE( szValueName, sizeof(char)*MAX_VAR_LEN );
}
return dbRet;
}
示例7: StepEndAI
bool NormalCloseInAttackAI::StepEndAI()
{
if(m_pSkill)
{
CMoveShape* pMoveshape = dynamic_cast<CMoveShape*>(GetGame()->GetRegion()->FindChildObject(m_pSkill->GetSourType(), m_pSkill->GetSourID()));
if(pMoveshape)
{
AnimInfo::tagActionInfo *pActionInfo = pMoveshape->GetAnimInfo()->GetActionInfo();
if(pActionInfo && pMoveshape->GetAction() >= CShape::ACT_PERFORM)
{
pActionInfo->bCurActionLooped = FALSE;
}
}
if (pMoveshape->GetType() == TYPE_PET)
{
CPet *pPet = (CPet*)pMoveshape;
if (pPet->IsMainPlayerPet())
{
tagPetSkillInfo *pPetSkill = pPet->GetPetSkillInfoByID(m_pSkill->GetSkillID());
if(pPetSkill)
pPetSkill->bIsSkillUsingEnd = true;
//pPet->SkillSuccReceived();
}
}
// 删除特效
m_pSkill->DelAllEffectListByStep(CSkillXml::STEP_START);
m_pSkill->DelAllEffectListByStep(CSkillXml::STEP_RUN);
m_pSkill->DelAllEffectListByStep(CSkillXml::STEP_END);
m_pSkill->SetIsDeleted(true);
return true;
}
return false;
}
示例8: AI
void NormalCloseInAttackAI::AI()
{
//CPlayer *pPlayer = GetGame()->GetMainPlayer();
if(!m_pSkill)
return;
CMoveShape* pMoveshape = dynamic_cast<CMoveShape*>(GetGame()->GetRegion()->FindChildObject(m_pSkill->GetSourType(), m_pSkill->GetSourID()));
// 开始阶段可能有吟唱动作
if(pMoveshape && m_pSkill && m_pSkill->GetCurStep() != CSkillXml::STEP_START && m_pSkill->GetRunStepActExQueue())
{
/***********************************************************************/
/* zhaohang fix */
/***********************************************************************/
// 非光环类技能
CSkillListXml::tagSkill *pSkill = CSkillListXml::GetProperty(m_pSkill->GetSkillID());
if (pSkill && (pSkill->bLockSkill || pSkill->dwSkillState == 0))
//tagSkillIni* pSkill = SkillAttrIniSetup::GetSkillIni(m_pSkill->GetSkillID());
//if( pSkill && pSkill->GetSkillBaseAttr() &&
// pSkill->GetSkillBaseAttr()->IsLockSkill() )
{
// 释放阶段无后续动作
if(m_pSkill->GetRunStepActExQueue()->empty())
{
if(pMoveshape->GetAction() == ACT_STAND || pMoveshape->GetAction() == ACT_IDLE)
StepEndAI();
}
}
}
}
示例9: GetIntParam
double CScript::ChangeAttr(const char* CmdStr, char* retStr)
{
OBJECT_TYPE type;
CGUID id;
double value = 0;
double ret = INVILID_VALUE;
int param = GetIntParam(CmdStr, 0);
if(param != ERROR_CODE && param != INVILID_VALUE)
{
type = (OBJECT_TYPE)param;
char* pIdName = GetStringParam(CmdStr, 1);
if(NULL == pIdName) return ret;
id = GetVariableList()->GetGuidValue(pIdName);
if(id == NULL_GUID)
id = GetGeneralVariableList()->GetGuidValue(pIdName);
if(id == NULL_GUID)
id = ((CPlayer*)p_SrcShape)->GetVariableList()->GetGuidValue(pIdName);
CMoveShape* shape = GetGame()->FindShape(type, id);
char* name = GetStringParam(CmdStr, 2);
if(name)
{
value = GetIntParam(CmdStr, 3);
if(value != ERROR_CODE && value != INVILID_VALUE)
{
if(NULL == shape) // 默认id=0时,直接调用SrcShape的SetAttr接口
{
CShape* cShape = GetSrcShape();
if(cShape)
{
((CMoveShape*)cShape)->ChangeAttribute(string(name), value);
((CMoveShape*)cShape)->UpdateAttribute();
ret = 1;
}
}
else
{
shape->ChangeAttribute(string(name), value);
shape->UpdateAttribute();
ret = 1;
}
}
}
M_FREE( pIdName, sizeof(char)*MAX_VAR_LEN );
M_FREE( name, sizeof(char)*MAX_VAR_LEN );
}
else // 参数是字符串
{
AddErrorLogText(CStringReading::LoadString(IDS_GS_FUNCTION, STR_GS_FUNCTION_CHANGEATTRFIRSTVARISSTRING));
}
return ret;
}
示例10: Execute
void GuardSearch::Execute( BaseType::EntityType *entity )
{
CMonster *pSelf = dynamic_cast<CMonster*>( entity->GetOwner() );
ShapeListType player_list;
ShapeListType monster_list;
CServerRegion *pRegion = static_cast<CServerRegion*>( pSelf->GetFather() );
CMoveShape *pTarget = NULL;
if( CanAttackCurrent( pSelf, entity ) )
{
return;
}
// find the around players
pRegion->FindAroundObject( pSelf, TYPE_PLAYER, player_list );
// find the around monsters including the guards.
pRegion->FindAroundObject( pSelf, TYPE_MONSTER, monster_list );
// filter the result
Filter filter( static_cast<CMonster*>( pSelf ) );
filter_shape( player_list, filter );
filter_shape( monster_list, filter );
// retrieve the ai reference
DWORD ai_ref = pSelf->GetAIReferrence( 0 );
if( ai_ref >= 0 )
{
pTarget = SearchByAIRef1( pSelf, player_list, ai_ref );
}
if( pTarget == NULL && ( ai_ref = pSelf->GetAIReferrence( 1 ) ) > 0 )
{
pTarget = SearchByAIRef2( pSelf, player_list, ai_ref );
}
if( pTarget == NULL && ( ai_ref = pSelf->GetAIReferrence( 2 ) ) > 0 )
{
pTarget = SearchByAIRef3( pSelf, monster_list, ai_ref );
}
if( pTarget == NULL && ( ai_ref = pSelf->GetAIReferrence( 3 ) ) > 0 )
{
pTarget = SearchByAIRef4( pSelf, monster_list, ai_ref );
}
if( pTarget != NULL )
{
// search successfully
entity->SetTarget( pTarget->GetExID(), pTarget->GetType() );
}
else if( entity->HasTarget() )
{
AI_EVENT_SENDER( entity ).ReturnPeace();
}
}
示例11: ReturnPeace
void FightObj::ReturnPeace()
{
CMoveShape *target = m_AI->GetTarget();
if(target)
{
TauntEvents events(m_Owner->GetTauntHandler());
events.TargetLost(target->GetExID(), target->GetType());
}
m_AI->ChangeState(ST_RETURN, ReturnEvent(m_EnterFightPos.x, m_EnterFightPos.y));
}
示例12: GetCurrentSpeed
double CScript::GetCurrentSpeed(const char* cmd, char* retStr)
{
double dbRet = 0.0;
CMoveShape* pMoveShape = dynamic_cast<CMoveShape*>(p_SrcShape);
if(pMoveShape)
{
dbRet = pMoveShape->GetSpeed();// SetChangeSpeed(nSpeed);
}
return dbRet;
}
示例13: Run
int SkillTracer::Run(BaseAI *ai)
{
if(timeGetTime() >= m_EndTime)
{
return TIMEOUT;
}
CMoveShape *self = ai->GetOwner();
CServerRegion *rgn = dynamic_cast<CServerRegion*>(self->GetFather());
CMoveShape *target = AIUtils::FindShape(rgn, m_TargetID);
if(target == NULL)
{
return FAILED;
}
#ifdef MONSTER_DIS_FLOAT
float dis = self->RealDistanceF(target);
#else
long dis = self->Distance(target);
#endif
long dx = target->GetTileX();
long dy = target->GetTileY();
if(dis > m_SkillMaxDis)
{
ai->Move(dx, dy);
}
else if(dis < m_SkillMinDis)
{
long dir = GetLineDir(dx, dy, self->GetTileX(), self->GetTileY());
ai->Move(dir);
}
else
{
return Okay;
}
return RUNNING;
}
示例14: GetTarget
BOOL Guard::CanAttackCurrent()
{
if( !HasTarget() )
{
return FALSE;
}
CMoveShape *pTarget = GetTarget();
long dis = m_pOwner->Distance( pTarget );
long attack_range = static_cast<CMonster*>( m_pOwner )->GetAttribute( string( "C_GuardRange" ) );
if( dis > attack_range )
{
return FALSE;
}
CMonster *pSelf = static_cast<CMonster*>( m_pOwner );
DWORD ai_ref = 0;
if( pTarget->GetType() == TYPE_PLAYER )
{
CPlayer *pPlayer = static_cast<CPlayer*>( pTarget );
// ai reference 1
ai_ref = pSelf->GetAIReferrence( 0 );
if( ai_ref >= 0 )
{
if( pPlayer->GetPVPValue() >= ai_ref && !IsSameCamp( pPlayer, pSelf ) )
{
return TRUE;
}
}
// ai reference 2
ai_ref = pSelf->GetAIReferrence( 1 );
if( ai_ref > 0 )
{
if( pPlayer->GetPkValue() >= ai_ref )
{
return TRUE;
}
}
}
// actually, it's not necessary to judge monsters, that because the property for the monsters will
// not changed .So ignored here.
// ...
return FALSE;
}
示例15: UpdateVisualEffect
VOID CExState1::End()
{
if( m_pCurrentVisualEffect )
{
m_pCurrentVisualEffect -> UpdateVisualEffect( this, 1 );
}
CMoveShape* pShape = GetSufferer();
if( pShape )
{
pShape->RemoveState( this );
}
else
{
//##获取不到承载者,有可能。
}
}