本文整理汇总了C++中setFaction函数的典型用法代码示例。如果您正苦于以下问题:C++ setFaction函数的具体用法?C++ setFaction怎么用?C++ setFaction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setFaction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetMapId
bool Vehicle::Create(uint32 guidlow, Map *map, uint32 Entry, uint32 vehicleId, uint32 team)
{
SetMapId(map->GetId());
SetInstanceId(map->GetInstanceId());
Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE);
if(!InitEntry(Entry, team))
return false;
m_defaultMovementType = IDLE_MOTION_TYPE;
AIM_Initialize();
SetVehicleId(vehicleId);
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
CreatureInfo const *ci = GetCreatureInfo();
setFaction(team == ALLIANCE ? ci->faction_A : ci->faction_H);
SetMaxHealth(ci->maxhealth);
SelectLevel(ci);
SetHealth(GetMaxHealth());
return true;
}
示例2: RemoveSpellsCausingAura
void Vehicle::RemovePassenger(Unit *unit)
{
SeatMap::iterator seat;
for(seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
{
if((seat->second.flags & (SEAT_FULL | SEAT_VEHICLE_FREE | SEAT_VEHICLE_FULL)) && seat->second.passenger == unit)
{
unit->SetVehicleGUID(0);
if(seat->second.vs_flags & SF_MAIN_RIDER)
{
RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->SetMover(unit);
((Player*)unit)->SetClientControl(unit, 1);
((Player*)unit)->SetMoverInQueve(NULL);
((Player*)unit)->RemovePetActionBar();
if(((Player*)unit)->GetGroup())
((Player*)unit)->SetGroupUpdateFlag(GROUP_UPDATE_VEHICLE);
}
unit->SetCharm(NULL);
SetCharmerGUID(NULL);
setFaction(GetCreatureInfo()->faction_A);
}
if(GetVehicleFlags() & VF_NON_SELECTABLE)
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if(seat->second.vs_flags & SF_UNATTACKABLE)
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
// restore player control
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->GetCamera().ResetView();
if(seat->second.vs_flags & SF_CAN_CAST)
{
WorldPacket data0(SMSG_FORCE_MOVE_UNROOT, 10);
data0 << unit->GetPackGUID();
data0 << (uint32)(2); // can rotate
unit->SendMessageToSet(&data0,true);
}
else
{
WorldPacket data1(SMSG_FORCE_MOVE_UNROOT, 10);
data1 << unit->GetPackGUID();
data1 << (uint32)(0); // cannot rotate
unit->SendMessageToSet(&data1,true);
}
}
unit->m_movementInfo.ClearTransportData();
seat->second.passenger = NULL;
seat->second.flags = SEAT_FREE;
unit->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
EmptySeatsCountChanged();
break;
}
}
}
示例3: SetCreatorGUID
void Totem::SetOwner(Unit* owner)
{
SetCreatorGUID(owner->GetGUID());
SetOwnerGUID(owner->GetGUID());
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
}
示例4: SetCreatorGuid
void Totem::SetOwner(Unit* owner)
{
SetCreatorGuid(owner->GetObjectGuid());
SetOwnerGuid(owner->GetObjectGuid());
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
}
示例5: ASSERT
void TempSummon::InitStats(uint32 duration)
{
ASSERT(!IsPet());
m_timer = duration;
m_lifetime = duration;
if (m_type == TEMPSUMMON_MANUAL_DESPAWN)
m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
Unit* owner = GetSummoner();
if (owner)
{
if (IsTrigger() && m_spells[0])
{
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
if (owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true;
}
if (owner->GetTypeId() == TYPEID_PLAYER)
m_CreatedByPlayer = true;
}
if (!m_Properties)
return;
if (owner)
{
if (uint32 slot = m_Properties->Slot)
{
if (owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID())
{
Creature* oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]);
if (oldSummon && oldSummon->IsSummon())
oldSummon->ToTempSummon()->UnSummon();
}
owner->m_SummonSlot[slot] = GetGUID();
}
}
if (m_Properties->Faction)
setFaction(m_Properties->Faction);
else if (IsVehicle() && owner) // properties should be vehicle
setFaction(owner->getFaction());
}
示例6: SetCreatorGUID
void Totem::SetOwner(uint64 guid)
{
SetCreatorGUID(guid);
SetOwnerGUID(guid);
if (Unit *owner = GetOwner())
{
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
}
}
示例7: SetReactState
void Minion::InitStats(uint32 duration) {
TempSummon::InitStats(duration);
SetReactState(REACT_PASSIVE);
SetCreatorGUID(m_owner->GetGUID());
setFaction(m_owner->getFaction());
m_owner->SetMinion(this, true, PET_SLOT_UNK_SLOT);
}
示例8: SetReactState
void Minion::InitStats(uint32 duration)
{
TempSummon::InitStats(duration);
SetReactState(REACT_PASSIVE);
SetCreatorGUID(GetOwner()->GetGUID());
setFaction(GetOwner()->getFaction());
GetOwner()->SetMinion(this, true);
}
示例9: Entity
Enemy::Enemy(int id, std::shared_ptr<Room> room)
: Entity(id, room)
, brain(nullptr)
, hitPoints(0.0)
, damageTickCounter(0)
, bonusTableIndex(DEFAULT_BONUS_TABLE)
{
setAgeless(true);
setGravitated(true);
setPhasing(false);
setFaction(Factions::Enemy);
setDeathType(EntityDeathType::Small);
}
示例10: SetByteValue
void CPlayer::JoinBattleGround(BattleGround* bg)
{
if (bg->isArena())
return;
if (!NativeTeam())
{
m_FakedPlayers.push_back(GetObjectGuid());
SetByteValue(UNIT_FIELD_BYTES_0, 0, getFRace());
setFaction(getFFaction());
}
SetRecache();
FakeDisplayID();
}
示例11: RecachePlayersFromList
void CPlayer::Sometimes()
{
if (GetRecache())
{
RecachePlayersFromList();
RecachePlayersFromBG();
}
if (GetFakeOnNextTick())
{
SetFakeOnNextTick(false);
SetByteValue(UNIT_FIELD_BYTES_0, 0, getFRace());
setFaction(getFFaction());
FakeDisplayID();
SetUInt32Value(PLAYER_BYTES, getFPlayerBytes());
SetUInt32Value(PLAYER_BYTES_2, getFPlayerBytes2());
}
}
示例12: data0
void Vehicle::AddPassenger(Unit *unit, int8 seatId, bool force)
{
SeatMap::iterator seat;
seat = m_Seats.find(seatId);
// this should never happen
if(seat == m_Seats.end())
return;
unit->SetVehicleGUID(GetGUID());
seat->second.passenger = unit;
if(unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->isVehicle())
{
if(((Vehicle*)unit)->GetEmptySeatsCount(true) == 0)
seat->second.flags = SEAT_VEHICLE_FULL;
else
seat->second.flags = SEAT_VEHICLE_FREE;
}
else
{
seat->second.flags = SEAT_FULL;
}
if(unit->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data0(SMSG_FORCE_MOVE_ROOT, 10);
data0 << unit->GetPackGUID();
data0 << (uint32)((seat->second.vs_flags & SF_CAN_CAST) ? 2 : 0);
unit->SendMessageToSet(&data0,true);
}
if(seat->second.vs_flags & SF_MAIN_RIDER)
{
if(!(GetVehicleFlags() & VF_MOVEMENT))
{
GetMotionMaster()->Clear(false);
GetMotionMaster()->MoveIdle();
SetCharmerGUID(unit->GetGUID());
unit->SetUInt64Value(UNIT_FIELD_CHARM, GetGUID());
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->SetMover(this);
((Player*)unit)->SetMoverInQueve(this);
((Player*)unit)->SetClientControl(this, 1);
}
if(canFly() || HasAuraType(SPELL_AURA_FLY) || HasAuraType(SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED))
{
WorldPacket data3(SMSG_MOVE_SET_CAN_FLY, 12);
data3<< GetPackGUID();
data3 << (uint32)(0);
SendMessageToSet(&data3,false);
}
}
SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(GetEntry());
for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
{
if (unit->GetTypeId() == TYPEID_UNIT || itr->second.IsFitToRequirements((Player*)unit))
{
Unit *caster = (itr->second.castFlags & 0x1) ? unit : this;
Unit *target = (itr->second.castFlags & 0x2) ? unit : this;
caster->CastSpell(target, itr->second.spellId, true);
}
}
if(unit->GetTypeId() == TYPEID_PLAYER)
{
// it should be added only on rider enter?
if(((Player*)unit)->GetGroup())
((Player*)unit)->SetGroupUpdateFlag(GROUP_UPDATE_VEHICLE);
((Player*)unit)->GetCamera().SetView(this);
BuildVehicleActionBar((Player*)unit);
}
if(!(GetVehicleFlags() & VF_FACTION))
setFaction(unit->getFaction());
if(GetVehicleFlags() & VF_CANT_MOVE)
{
WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10);
data2<< GetPackGUID();
data2 << (uint32)(2);
SendMessageToSet(&data2,false);
}
if(GetVehicleFlags() & VF_NON_SELECTABLE)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
if(seat->second.vs_flags & SF_UNATTACKABLE)
unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
EmptySeatsCountChanged();
}
示例13: RemoveSpellsCausingAura
void Vehicle::RemovePassenger(Unit *unit)
{
SeatMap::iterator seat;
for(seat = m_Seats.begin(); seat != m_Seats.end(); ++seat)
{
if((seat->second.flags & (SEAT_FULL | SEAT_VEHICLE_FREE | SEAT_VEHICLE_FULL)) && seat->second.passenger == unit)
{
unit->SetVehicleGUID(0);
if(seat->second.vs_flags & SF_MAIN_RIDER)
{
RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->SetMover(unit);
((Player*)unit)->SetClientControl(unit, 1);
((Player*)unit)->SetMoverInQueve(NULL);
((Player*)unit)->RemovePetActionBar();
if(((Player*)unit)->GetGroup())
((Player*)unit)->SetGroupUpdateFlag(GROUP_UPDATE_VEHICLE);
}
unit->SetCharm(NULL);
SetCharmerGUID(NULL);
setFaction(GetCreatureInfo()->faction_A);
}
if(GetVehicleFlags() & VF_NON_SELECTABLE)
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if(GetVehicleFlags() & VF_CAST_AURA && m_VehicleData && m_VehicleData->v_spells[0] != 0)
unit->RemoveAurasDueToSpell(m_VehicleData->v_spells[0]);
if(seat->second.vs_flags & SF_UNATTACKABLE)
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
// restore player control
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->SetFarSightGUID(NULL);
if(seat->second.vs_flags & SF_CAN_CAST)
{
WorldPacket data0(SMSG_FORCE_MOVE_UNROOT, 10);
data0 << unit->GetPackGUID();
data0 << (uint32)(2); // can rotate
unit->SendMessageToSet(&data0,true);
}
else
{
WorldPacket data1(SMSG_FORCE_MOVE_UNROOT, 10);
data1 << unit->GetPackGUID();
data1 << (uint32)(0); // cannot rotate
unit->SendMessageToSet(&data1,true);
}
}
unit->m_SeatData.OffsetX = 0.0f;
unit->m_SeatData.OffsetY = 0.0f;
unit->m_SeatData.OffsetZ = 0.0f;
unit->m_SeatData.Orientation = 0.0f;
unit->m_SeatData.c_time = 0;
unit->m_SeatData.dbc_seat = 0;
unit->m_SeatData.seat = 0;
unit->m_SeatData.s_flags = 0;
unit->m_SeatData.v_flags = 0;
seat->second.passenger = NULL;
seat->second.flags = SEAT_FREE;
EmptySeatsCountChanged();
break;
}
}
}
示例14: setFaction
Balaenidae::Balaenidae(int newfaction)
{
// Choose your own side.
setFaction(newfaction);
}
示例15: setFaction
Runway::Runway(int faction)
{
setFaction(faction);
}