bool OnGS2C_LookInfoMonster(struct pk::GS2C_LookInfoMonster *value) { if ( !gMap ) { return false; } TIME_COST_BEGIN; CMonster* pMonster = CMonster::create(); TIME_COST_LOG_IF("OnGS2C_LookInfoMonster CMonster::create",3); if ( pMonster ) { pMonster->SetId(value->id); pMonster->SetDataID(value->monster_data_id); pMonster->SetMoveSpeed(value->moveSpeed); pMonster->SetStateFlag(value->status); pMonster->SetCamp(value->camp); pMonster->SetProperty(RoleProperty_HP,value->hp); pMonster->SetProperty(RoleProperty_hp_max,value->hpMax); pMonster->SetProperty(RoleProperty_MP,value->mp); pMonster->SetProperty(RoleProperty_mp_max,value->mpMax); pMonster->EnterMap(gMap,value->x,value->y); TIME_COST_LOG_IF("OnGS2C_LookInfoMonster CMonster::EnterMap",3); if ( value->posInfos.size() > 0 ) { APath path; CHero::PosInfoToPath(value->x,value->y,value->posInfos,path); pMonster->Move(path,value->movedMs); } } return true; }
bool OnGS2C_MonsterMoveInfo(GS2C_MonsterMoveInfo *value) { CMonster* pMonster = GetMapMonster(value->id); if ( pMonster ) { ////just for test //if(pMonster->GetPropertyInt(RoleProperty_Cloth) == 9006) //{ // CCLOG("move info,cur posX:%d,posY:%d", value->posX,value->posY); // for ( size_t i = 0;i<value->posInfos.size();++i ) // { // pk::PosInfo pt = value->posInfos[i]; // CCLOG(" path,(%d,%d)", pt.x,pt.y); // } //} APath path; CHero::PosInfoToPath(value->posX,value->posY,value->posInfos,path); pMonster->Move(path); } return true; }