bool Script::GetRandomPosInRange(long regionId, int x, int y, int width, int height, long* randX, long* randY) { CServerRegion* region = NULL; region = GameManager::GetInstance()->GetRgnManager()->FindRgnByTemplateID(RGN_NORMAL, regionId); if(region == NULL) region = GameManager::GetInstance()->GetRgnManager()->FindRgnByTemplateID(RGN_PERSONAL, regionId); if(region == NULL) region = GameManager::GetInstance()->GetRgnManager()->FindRgnByTemplateID(RGN_PERSONAL_HOUSE, regionId); if(region == NULL) region = GameManager::GetInstance()->GetRgnManager()->FindRgnByTemplateID(RGN_TEAM, regionId); if(region == NULL) region = dynamic_cast<CServerRegion*>(m_RunEnv.region); if(region == NULL) return false; return region->GetRandomPosInRange(*randX, *randY, x, y, width, height); }