本文整理汇总了C++中GetPhaseMask函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPhaseMask函数的具体用法?C++ GetPhaseMask怎么用?C++ GetPhaseMask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPhaseMask函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteFromDB
void Corpse::SaveToDB()
{
// prevent DB data inconsistence problems and duplicates
SQLTransaction trans = CharacterDatabase.BeginTransaction();
DeleteFromDB(trans);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
stmt->setUInt32(0, GetGUIDLow()); // corpseGuid
stmt->setUInt32(1, GUID_LOPART(GetOwnerGUID())); // guid
stmt->setFloat (2, GetPositionX()); // posX
stmt->setFloat (3, GetPositionY()); // posY
stmt->setFloat (4, GetPositionZ()); // posZ
stmt->setFloat (5, GetOrientation()); // orientation
stmt->setUInt16(6, GetMapId()); // mapId
stmt->setUInt32(7, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
stmt->setString(8, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
stmt->setUInt32(9, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
stmt->setUInt32(10, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
stmt->setUInt32(11, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId
stmt->setUInt8 (12, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
stmt->setUInt8 (13, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
stmt->setUInt32(14, uint32(m_time)); // time
stmt->setUInt8 (15, GetType()); // corpseType
stmt->setUInt32(16, GetInstanceId()); // instanceId
stmt->setUInt16(17, GetPhaseMask()); // phaseMask
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
}
示例2: MANGOS_ASSERT
void Corpse::SaveToDB()
{
// bones should not be saved to DB (would be deleted on startup anyway)
MANGOS_ASSERT(GetType() != CORPSE_BONES);
// prevent DB data inconsistence problems and duplicates
CharacterDatabase.BeginTransaction();
DeleteFromDB();
std::ostringstream ss;
ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,map,time,corpse_type,instance,phaseMask) VALUES ("
<< GetGUIDLow() << ", "
<< GetOwnerGuid().GetCounter() << ", "
<< GetPositionX() << ", "
<< GetPositionY() << ", "
<< GetPositionZ() << ", "
<< GetOrientation() << ", "
<< GetMapId() << ", "
<< uint64(m_time) << ", "
<< uint32(GetType()) << ", "
<< int(GetInstanceId()) << ", "
<< uint16(GetPhaseMask()) << ")"; // prevent out of range error
CharacterDatabase.Execute(ss.str().c_str());
CharacterDatabase.CommitTransaction();
}
示例3: DeleteFromDB
void Corpse::SaveToDB()
{
// prevent DB data inconsistence problems and duplicates
SQLTransaction trans = CharacterDatabase.BeginTransaction();
DeleteFromDB(trans);
uint16 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
stmt->setUInt32(index++, GetGUIDLow()); // corpseGuid
stmt->setUInt32(index++, GUID_LOPART(GetOwnerGUID())); // guid
stmt->setFloat (index++, GetPositionX()); // posX
stmt->setFloat (index++, GetPositionY()); // posY
stmt->setFloat (index++, GetPositionZ()); // posZ
stmt->setFloat (index++, GetOrientation()); // orientation
stmt->setUInt16(index++, GetMapId()); // mapId
stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
stmt->setString(index++, _ConcatFields(CORPSE_FIELD_ITEMS, EQUIPMENT_SLOT_END)); // itemCache
stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_SKIN_ID)); // bytes1
stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_FACIAL_HAIR_STYLE_ID)); // bytes2
stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
stmt->setUInt32(index++, uint32(m_time)); // time
stmt->setUInt8 (index++, GetType()); // corpseType
stmt->setUInt32(index++, GetInstanceId()); // instanceId
stmt->setUInt32(index++, GetPhaseMask()); // phaseMask
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
}
示例4: DeleteFromDB
void Corpse::SaveToDB()
{
// prevent DB data inconsistence problems and duplicates
SQLTransaction trans = CharacterDatabase.BeginTransaction();
DeleteFromDB(trans);
std::ostringstream ss;
ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,displayId,itemCache,bytes1,bytes2,guild,flags,dynFlags,time,corpse_type,instance,phaseMask) VALUES ("
<< GetGUIDLow() << ", "
<< GUID_LOPART(GetOwnerGUID()) << ", "
<< GetPositionX() << ", "
<< GetPositionY() << ", "
<< GetPositionZ() << ", "
<< GetOrientation() << ", "
<< GetZoneId() << ", "
<< GetMapId() << ", "
<< GetUInt32Value(CORPSE_FIELD_DISPLAY_ID) << ", '";
for (uint16 i = 0; i < EQUIPMENT_SLOT_END; ++i)
ss << GetUInt32Value(CORPSE_FIELD_ITEM+i) << " ";
ss << "', "
<< GetUInt32Value(CORPSE_FIELD_BYTES_1) << ", "
<< GetUInt32Value(CORPSE_FIELD_BYTES_2) << ", "
<< GetUInt32Value(CORPSE_FIELD_GUILD) << ", "
<< GetUInt32Value(CORPSE_FIELD_FLAGS) << ", "
<< GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS) << ", "
<< uint64(m_time) << ", "
<< uint32(GetType()) << ", "
<< int(GetInstanceId()) << ", "
<< uint16(GetPhaseMask()) << ")"; // prevent out of range error
trans->Append(ss.str().c_str());
CharacterDatabase.CommitTransaction(trans);
}
示例5: DeleteFromDB
void Corpse::SaveToDB()
{
// prevent DB data inconsistence problems and duplicates
CharacterDatabase.BeginTransaction();
DeleteFromDB();
std::ostringstream ss;
ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance,phaseMask) VALUES ("
<< GetGUIDLow() << ", "
<< GUID_LOPART(GetOwnerGUID()) << ", "
<< GetPositionX() << ", "
<< GetPositionY() << ", "
<< GetPositionZ() << ", "
<< GetOrientation() << ", "
<< GetZoneId() << ", "
<< GetMapId() << ", '";
for (uint16 i = 0; i < m_valuesCount; ++i)
ss << GetUInt32Value(i) << " ";
ss << "',"
<< uint64(m_time) <<", "
<< uint32(GetType()) << ", "
<< int(GetInstanceId()) << ", "
<< uint16(GetPhaseMask()) << ")"; // prevent out of range error
CharacterDatabase.Execute(ss.str().c_str());
CharacterDatabase.CommitTransaction();
}
示例6: GetMap
Creature* Transport::AddNPCPassengerInInstance (uint32 entry, float x, float y, float z, float o, uint32 anim)
{
Map* map = GetMap();
Creature* pCreature = new Creature;
if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0))
{
delete pCreature;
return NULL;
}
pCreature->SetTransport(this);
pCreature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
pCreature->m_movementInfo.guid = GetGUID();
pCreature->m_movementInfo.t_pos.Relocate(x, y, z, o);
o += GetOrientation();
MapManager::NormalizeOrientation(o);
pCreature->Relocate(GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))), GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())), z + GetPositionZ(), o);
if (!pCreature->IsPositionValid())
{
sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", pCreature->GetGUIDLow(), pCreature->GetEntry(), pCreature->GetPositionX(), pCreature->GetPositionY());
delete pCreature;
return NULL;
}
map->Add(pCreature);
m_NPCPassengerSet.insert(pCreature);
pCreature->setActive(true);
sScriptMgr->OnAddCreaturePassenger(this, pCreature);
return pCreature;
}
示例7: GetCreatureAddon
void Vehicle::InstallAllAccessories()
{
if(!GetMap())
return;
CreatureDataAddon const *cainfo = GetCreatureAddon();
if(!cainfo || !cainfo->passengers)
return;
for (CreatureDataAddonPassengers const* cPassanger = cainfo->passengers; cPassanger->seat_idx != -1; ++cPassanger)
{
// Continue if seat already taken
if(GetPassenger(cPassanger->seat_idx))
continue;
uint32 guid = 0;
bool isVehicle = false;
// Set guid and check whatever it is
if(cPassanger->guid != 0)
guid = cPassanger->guid;
else
{
CreatureDataAddon const* passAddon;
passAddon = ObjectMgr::GetCreatureTemplateAddon(cPassanger->entry);
if(passAddon && passAddon->vehicle_id != 0)
isVehicle = true;
else
guid = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT);
}
// Create it
Creature *pPassenger = new Creature;
if(!isVehicle)
{
uint32 entry = cPassanger->entry;
if(entry == 0)
{
CreatureData const* data = sObjectMgr.GetCreatureData(guid);
if(!data)
continue;
entry = data->id;
}
if(!pPassenger->Create(guid, GetMap(), GetPhaseMask(), entry, 0))
continue;
pPassenger->LoadFromDB(guid, GetMap());
pPassenger->Relocate(GetPositionX(), GetPositionY(), GetPositionZ());
GetMap()->Add(pPassenger);
pPassenger->AIM_Initialize();
}
else
pPassenger = (Creature*)SummonVehicle(cPassanger->entry, GetPositionX(), GetPositionY(), GetPositionZ(), 0);
// Enter vehicle...
pPassenger->EnterVehicle(this, cPassanger->seat_idx, true);
// ...and send update. Without this, client wont show this new creature/vehicle...
WorldPacket data;
pPassenger->BuildHeartBeatMsg(&data);
pPassenger->SendMessageToSet(&data, false);
}
}
示例8: GetMap
uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim)
{
Map* map = GetMap();
CreatureInfo const *ci = sObjectMgr.GetCreatureTemplate(entry);
if (!ci)
return 0;
Creature* pCreature = NULL;
if(ci->ScriptID)
pCreature = sScriptMgr.GetCreatureScriptedClass(ci->ScriptID);
if(pCreature == NULL)
pCreature = new Creature();
if (!pCreature->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0))
{
delete pCreature;
return 0;
}
pCreature->SetTransport(this);
pCreature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
pCreature->m_movementInfo.guid = GetGUID();
pCreature->m_movementInfo.t_pos.Relocate(x, y, z, o);
if (anim)
pCreature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim);
pCreature->Relocate(
GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))),
GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())),
z + GetPositionZ() ,
o + GetOrientation());
pCreature->SetHomePosition(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ(), pCreature->GetOrientation());
if(!pCreature->IsPositionValid())
{
sLog.outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY());
delete pCreature;
return 0;
}
map->Add(pCreature);
m_NPCPassengerSet.insert(pCreature);
if (tguid == 0)
{
++currenttguid;
tguid = currenttguid;
}
else
currenttguid = std::max(tguid, currenttguid);
pCreature->SetGUIDTransport(tguid);
sScriptMgr.OnAddCreaturePassenger(this, pCreature);
return tguid;
}
示例9: GetMap
Creature * Transport::AddNPCPassengerCreature(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim)
{
Map* map = GetMap();
Creature * pCreature = new Creature;
if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0))
{
delete pCreature;
return NULL;
}
pCreature->SetTransport(this);
pCreature->m_movementInfo.guid = GetGUID();
pCreature->m_movementInfo.t_pos.Relocate(x, y, z, o);
if (anim)
pCreature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim);
pCreature->Relocate(
GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))),
GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())),
z + GetPositionZ() ,
o + GetOrientation());
pCreature->SetHomePosition(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ(), pCreature->GetOrientation());
if(!pCreature->IsPositionValid())
{
sLog->outError(LOG_FILTER_TRANSPORTS, "Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", pCreature->GetGUIDLow(), pCreature->GetEntry(), pCreature->GetPositionX(), pCreature->GetPositionY());
delete pCreature;
return NULL;
}
map->AddToMap(pCreature);
m_NPCPassengerSet.insert(pCreature);
if (tguid == 0)
{
++currenttguid;
tguid = currenttguid;
}
else
currenttguid = std::max(tguid, currenttguid);
pCreature->SetGUIDTransport(tguid);
sScriptMgr->OnAddCreaturePassenger(this, pCreature);
return pCreature;
}
示例10: GetMap
Creature* Transport::AddNPCPassenger(uint32 entry, float x, float y, float z, float o, uint32 anim)
{
Map* map = GetMap();
//make it world object so it will not be unloaded with grid
auto const creature = new Creature(true);
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0))
{
delete creature;
return nullptr;
}
creature->SetTransport(this);
creature->m_movementInfo.t_pos.Relocate(x, y, z, o);
if (anim)
creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim);
creature->Relocate(
GetPositionX() + (x * std::cos(GetOrientation()) + y * std::sin(GetOrientation() + float(M_PI))),
GetPositionY() + (y * std::cos(GetOrientation()) + x * std::sin(GetOrientation())),
z + GetPositionZ(),
o + GetOrientation());
creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
creature->SetTransportHomePosition(creature->m_movementInfo.t_pos);
if (!creature->IsPositionValid())
{
TC_LOG_ERROR("entities.transport", "Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY());
delete creature;
return nullptr;
}
map->AddToMap(creature);
m_NPCPassengerSet.insert(creature);
creature->setActive(true);
sScriptMgr->OnAddCreaturePassenger(this, creature);
return creature;
}
示例11: GetMap
Creature* Transport::CreateNPCPassenger(uint32 entry, float x, float y, float z, float o, CreatureData const* data /*= NULL*/)
{
Map* map = GetMap();
Creature* creature = new Creature();
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0.0f, 0.0f, 0.0f, 0.0f, data))
{
delete creature;
return NULL;
}
creature->SetTransport(this);
creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
creature->m_movementInfo.guid = GetGUID();
creature->m_movementInfo.t_pos.Relocate(x, y, z, o);
o += GetOrientation();
MapManager::NormalizeOrientation(o);
creature->Relocate(GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))),
GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())),
z + GetPositionZ(), o);
creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
if (!creature->IsPositionValid())
{
sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",creature->GetGUIDLow(),creature->GetEntry(),creature->GetPositionX(),creature->GetPositionY());
delete creature;
return NULL;
}
map->AddToMap(creature);
AddPassenger(creature);
creature->SetWorldObject(true); //so it will not be unloaded with grid
sScriptMgr->OnAddCreaturePassenger(this, creature);
return creature;
}
示例12: GetMap
// gunship data
Creature* Transport::AddNPCPassengerInInstance(uint32 entry, float x, float y, float z, float o, uint32 anim)
{
Map* map = GetMap();
Creature* creature = new Creature;
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0))
{
delete creature;
return 0;
}
creature->SetTransport(this);
creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
creature->m_movementInfo.guid = GetGUID();
creature->m_movementInfo.transport.pos.Relocate(x, y, z, o);
creature->Relocate(
GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))),
GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())),
z + GetPositionZ(),
o + GetOrientation());
creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
if (!creature->IsPositionValid())
{
delete creature;
return 0;
}
map->AddToMap(creature);
m_NPCPassengerSet.insert(creature);
creature->setActive(true);
sScriptMgr->OnAddCreaturePassenger(this, creature);
return creature;
}
示例13: return
float Position::GetDistance(Position const& pos) const
{
return (GetPhaseMask() & pos.GetPhaseMask()) ?
((Location)*this).GetDistance((Location)pos) :
MAX_VISIBILITY_DISTANCE + 1.0f;
};