本文整理汇总了C++中Creature::AddSplineFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ Creature::AddSplineFlag方法的具体用法?C++ Creature::AddSplineFlag怎么用?C++ Creature::AddSplineFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Creature
的用法示例。
在下文中一共展示了Creature::AddSplineFlag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void RandomMovementGenerator<Creature>::Initialize(Creature &creature)
{
if (!creature.isAlive())
return;
if (creature.CanFly())
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
else
creature.AddSplineFlag(SPLINEFLAG_WALKMODE);
creature.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
_setRandomLocation(creature);
}
示例2:
void RandomMovementGenerator<Creature>::Initialize(Creature &creature)
{
if (!creature.isAlive())
return;
if (creature.canFly() && !(creature.canWalk() &&
creature.IsAtGroundLevel(creature.GetPositionX(), creature.GetPositionY(), creature.GetPositionZ())))
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
else
creature.AddSplineFlag(SPLINEFLAG_WALKMODE);
creature.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
_setRandomLocation(creature);
}
示例3: traveller
//-----------------------------------------------//
void WaypointMovementGenerator<Creature>::LoadPath(Creature &creature)
{
//DETAIL_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "LoadPath: loading waypoint path for creature %u, %u", creature.GetGUIDLow(), creature.GetDBTableGUIDLow());
i_path = sWaypointMgr.GetPath(creature.GetDBTableGUIDLow());
// We may LoadPath() for several occasions:
// 1: When creature.MovementType=2
// 1a) Path is selected by creature.guid == creature_movement.id
// 1b) Path for 1a) does not exist and then use path from creature.GetEntry() == creature_movement_template.entry
// 2: When creature_template.MovementType=2
// 2a) Creature is summoned and has creature_template.MovementType=2
// Creators need to be sure that creature_movement_template is always valid for summons.
// Mob that can be summoned anywhere should not have creature_movement_template for example.
// No movement found for guid
if (!i_path)
{
sLog.outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path",
creature.GetName(), creature.GetEntry(), creature.GetDBTableGUIDLow());
return;
}
if (creature.canFly())
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
// We have to set the destination here (for the first point), right after Initialize. Without, we may not have valid xyz for GetResetPosition
CreatureTraveller traveller(creature);
MoveToNextNode(traveller);
}
示例4: traveller
bool
HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff)
{
CreatureTraveller traveller( owner);
i_destinationHolder.UpdateTraveller(traveller, time_diff, false);
if (time_diff > i_travel_timer)
{
owner.AddSplineFlag(SPLINEFLAG_WALKMODE);
// restore orientation of not moving creature at returning to home
if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE)
{
if(CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow()))
{
owner.SetOrientation(data->orientation);
WorldPacket packet;
owner.BuildHeartBeatMsg(&packet);
owner.SendMessageToSet(&packet, false);
}
}
owner.AI()->JustReachedHome();
return false;
}
i_travel_timer -= time_diff;
return true;
}
示例5: traveller
bool
HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff)
{
CreatureTraveller traveller( owner);
if (i_destinationHolder.UpdateTraveller(traveller, time_diff, false))
{
if (!IsActive(owner)) // force stop processing (movement can move out active zone with cleanup movegens list)
return true; // not expire now, but already lost
}
if (time_diff > i_travel_timer)
{
owner.AddSplineFlag(SPLINEFLAG_WALKMODE);
// restore orientation of not moving creature at returning to home
if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE)
{
if(CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow()))
{
owner.SetOrientation(data->orientation);
WorldPacket packet;
owner.BuildHeartBeatMsg(&packet);
owner.SendMessageToSet(&packet, false);
}
}
owner.LoadCreatureAddon(true);
owner.AI()->JustReachedHome();
return false;
}
i_travel_timer -= time_diff;
return true;
}
示例6: traveller
bool
HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff)
{
CreatureTraveller traveller( owner);
if (i_destinationHolder.UpdateTraveller(traveller, time_diff, false))
{
if (!IsActive(owner)) // force stop processing (movement can move out active zone with cleanup movegens list)
return true; // not expire now, but already lost
}
if (time_diff > i_travel_time)
{
owner.AddSplineFlag(SPLINEFLAG_WALKMODE);
// restore orientation of not moving creature at returning to home
if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE)
{
// such a mob might need very exact spawning point, hence relocate to spawn-position
if (CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetGUIDLow()))
{
owner.Relocate(data->posX, data->posY, data->posZ, data->orientation);
owner.SendHeartBeat(false);
}
}
owner.LoadCreatureAddon(true);
owner.AI()->JustReachedHome();
return false;
}
i_travel_time -= time_diff;
return true;
}
示例7: traveller
void WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
{
if (!i_path || i_path->empty())
return;
if (Stopped())
return;
if (WaypointBehavior *behavior = i_path->at(i_currentNode).behavior)
{
if (behavior->model2 != 0)
creature.SetDisplayId(behavior->model2);
creature.SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
}
if (m_isArrivalDone)
i_currentNode = (i_currentNode+1) % i_path->size();
m_isArrivalDone = false;
if (creature.CanFly())
creature.AddSplineFlag(SPLINEFLAG_FLYING);
creature.addUnitState(UNIT_STAT_ROAMING_MOVE);
const WaypointNode &node = i_path->at(i_currentNode);
CreatureTraveller traveller(creature);
i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z);
}
示例8: traveller
bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
{
if (creature.hasUnitState(UNIT_STAT_NOT_MOVE))
{
i_nextMoveTime.Update(i_nextMoveTime.GetExpiry()); // Expire the timer
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
return true;
}
i_nextMoveTime.Update(diff);
if (i_destinationHolder.HasArrived() && !creature.IsStopped() && !creature.canFly())
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
if (!i_destinationHolder.HasArrived() && creature.IsStopped())
creature.addUnitState(UNIT_STAT_ROAMING_MOVE);
CreatureTraveller traveller(creature);
if (i_destinationHolder.UpdateTraveller(traveller, diff, false, true))
{
if (!IsActive(creature)) // force stop processing (movement can move out active zone with cleanup movegens list)
return true; // not expire now, but already lost
if (i_nextMoveTime.Passed())
{
float x,y,z;
if(i_destinationHolder.HasDestination())
i_destinationHolder.GetLocationNowNoMicroMovement(x,y,z);
else
creature.GetPosition(x,y,z);
if (creature.canFly() && !(creature.canWalk() && creature.IsAtGroundLevel(x,y,z)))
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
else
creature.AddSplineFlag(SPLINEFLAG_WALKMODE);
_setRandomLocation(creature);
}
else if (creature.isPet() && creature.GetOwner() && !creature.IsWithinDist(creature.GetOwner(), PET_FOLLOW_DIST+2.5f))
{
creature.AddSplineFlag(SPLINEFLAG_WALKMODE);
_setRandomLocation(creature);
}
}
return true;
}
示例9: urand
void RandomCircleMovementGenerator<Creature>::Initialize(Creature &creature)
{
if (!creature.isAlive())
return;
if (creature.canFly() && !(creature.canWalk() &&
creature.IsAtGroundLevel(creature.GetPositionX(), creature.GetPositionY(), creature.GetPositionZ())))
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
else
creature.AddSplineFlag(SPLINEFLAG_WALKMODE);
creature.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
m_bClockWise = urand(0, 1) ? true : false;
i_wpId = 0;
fillSplineWayPoints(creature);
SplineFlags flags = SplineFlags(SPLINEFLAG_FORWARD | SPLINEFLAG_UNKNOWN7 | SPLINEFLAG_FLYING | creature.GetSplineFlags());
creature.SendSplineMove(&m_splineMap, SPLINETYPE_NORMAL, flags, 500, NULL);
}
示例10:
void ChaseMovementGenerator<Creature>::Initialize(Creature &owner)
{
owner.addUnitState(UNIT_STAT_CHASE|UNIT_STAT_CHASE_MOVE);
owner.RemoveSplineFlag(SPLINEFLAG_WALKMODE);
if (((Creature*)&owner)->canFly())
owner.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
_setTargetLocation(owner);
}
示例11:
void ChaseMovementGenerator<Creature>::Initialize(Creature &owner)
{
owner.addUnitState(UNIT_STAT_CHASE|UNIT_STAT_CHASE_MOVE);
owner.RemoveSplineFlag(SPLINEFLAG_WALKMODE);
_setTargetLocation(owner);
float x,y,z;
i_destinationHolder.GetDestination(x,y,z);
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly() &&
!(((Creature*)&owner)->canWalk() && ((Creature*)&owner)->IsAtGroundLevel(x,y,z)))
owner.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
}
示例12: traveller
//-----------------------------------------------//
void WaypointMovementGenerator<Creature>::LoadPath(Creature &creature)
{
DETAIL_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "LoadPath: loading waypoint path for %s", creature.GetGuidStr().c_str());
i_path = sWaypointMgr.GetPath(creature.GetGUIDLow());
// We may LoadPath() for several occasions:
// 1: When creature.MovementType=2
// 1a) Path is selected by creature.guid == creature_movement.id
// 1b) Path for 1a) does not exist and then use path from creature.GetEntry() == creature_movement_template.entry
// 2: When creature_template.MovementType=2
// 2a) Creature is summoned and has creature_template.MovementType=2
// Creators need to be sure that creature_movement_template is always valid for summons.
// Mob that can be summoned anywhere should not have creature_movement_template for example.
// No movement found for guid
if (!i_path)
{
i_path = sWaypointMgr.GetPathTemplate(creature.GetEntry());
// No movement found for entry
if (!i_path)
{
sLog.outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path",
creature.GetName(), creature.GetEntry(), creature.GetGUIDLow());
return;
}
}
// We have to set the destination here (for the first point), right after Initialize. Without, we may not have valid xyz for GetResetPosition
CreatureTraveller traveller(creature);
if (creature.CanFly())
creature.AddSplineFlag(SPLINEFLAG_FLYING);
const WaypointNode &node = i_path->at(i_currentNode);
i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z);
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
}
示例13:
void HomeMovementGenerator<Creature>::Finalize(Creature& owner)
{
if (i_travel_timer == 0)
{
owner.AddSplineFlag(SPLINEFLAG_WALKMODE);
// restore orientation of not moving creature at returning to home
if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE)
{
// such a mob might need very exact spawning point, hence relocate to spawn-position
if (CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetGUIDLow()))
{
owner.Relocate(data->posX, data->posY, data->posZ, data->orientation);
owner.SendHeartBeat(false);
}
}
if (owner.GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_REACH_HOME)
owner.ClearTemporaryFaction();
owner.LoadCreatureAddon(true);
owner.AI()->JustReachedHome();
}
}
示例14: cos
void
RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature)
{
float X,Y,Z,z,nx,ny,nz,wander_distance,ori,dist;
creature.GetRespawnCoord(X, Y, Z, &ori, &wander_distance);
z = creature.GetPositionZ();
Map const* map = creature.GetBaseMap();
// For 2D/3D system selection
//bool is_land_ok = creature.canWalk(); // not used?
//bool is_water_ok = creature.canSwim(); // not used?
bool is_air_ok = creature.canFly();
const float angle = rand_norm_f()*(M_PI_F*2.0f);
const float range = rand_norm_f()*wander_distance;
const float distanceX = range * cos(angle);
const float distanceY = range * sin(angle);
nx = X + distanceX;
ny = Y + distanceY;
// prevent invalid coordinates generation
MaNGOS::NormalizeMapCoord(nx);
MaNGOS::NormalizeMapCoord(ny);
dist = distanceX*distanceX + distanceY*distanceY;
if (is_air_ok) // 3D system above ground and above water (flying mode)
{
// Limit height change
const float distanceZ = rand_norm_f() * sqrtf(dist)/2.0f;
nz = Z + distanceZ;
float tz = map->GetHeight(nx, ny, nz-2.0f, false); // Map check only, vmap needed here but need to alter vmaps checks for height.
float wz = map->GetWaterLevel(nx, ny);
// Problem here, we must fly above the ground and water, not under. Let's try on next tick
if (tz >= nz || wz >= nz)
return;
}
//else if (is_water_ok) // 3D system under water and above ground (swimming mode)
else // 2D only
{
nz = Z;
if (!map->IsNextZcoordOK(nx, ny, nz, dist))
return; // let's forget this bad coords where a z cannot be find and retry at next tick
creature.UpdateGroundPositionZ(nx, ny, nz, dist);
}
Traveller<Creature> traveller(creature);
creature.SetOrientation(creature.GetAngle(nx, ny));
i_destinationHolder.SetDestination(traveller, nx, ny, nz);
creature.addUnitState(UNIT_STAT_ROAMING_MOVE);
if (is_air_ok && !(creature.canWalk() && creature.IsAtGroundLevel(nx, ny, nz)))
{
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
}
//else if (is_water_ok) // Swimming mode to be done with more than this check
else
{
i_nextMoveTime.Reset(urand(500+i_destinationHolder.GetTotalTravelTime(), 10000+i_destinationHolder.GetTotalTravelTime()));
creature.AddSplineFlag(SPLINEFLAG_WALKMODE);
}
}
示例15:
void ConfusedMovementGenerator<Creature>::Finalize(Creature &unit)
{
unit.clearUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_CONFUSED_MOVE);
unit.AddSplineFlag(SPLINEFLAG_WALKMODE);
}