本文整理汇总了C++中Map::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::Add方法的具体用法?C++ Map::Add怎么用?C++ Map::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void PoolGroup<Creature>::Spawn1Object(PoolObject* obj, bool instantly)
{
if (CreatureData const* data = sObjectMgr.GetCreatureData(obj->guid))
{
sObjectMgr.AddCreatureToGrid(obj->guid, data);
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
// temporary limit pool system full power work to continents
if (mapEntry && !mapEntry->Instanceable())
{
// Spawn if necessary (loaded grids only)
Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid));
// We use spawn coords to spawn
if (map && map->IsLoaded(data->posX, data->posY))
{
Creature* pCreature = new Creature;
//DEBUG_LOG("Spawning creature %u",obj->guid);
if (!pCreature->LoadFromDB(obj->guid, map))
{
delete pCreature;
return;
}
else
{
// if new spawn replaces a just despawned creature, not instantly spawn but set respawn timer
if(!instantly)
{
pCreature->SetRespawnTime( pCreature->GetRespawnDelay() );
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY) || pCreature->IsWorldBoss())
pCreature->SaveRespawnTime();
}
map->Add(pCreature);
}
}
// for not loaded grid just update respawn time (avoid work for instances until implemented support)
else if(!instantly)
{
sObjectMgr.SaveCreatureRespawnTime(obj->guid, 0 /*map->GetInstanceId()*/, time(NULL) + data->spawntimesecs);
}
}
}
}
示例2: if
void PoolGroup<Creature>::Spawn1Object(MapPersistentState& mapState, PoolObject* obj, bool instantly)
{
if (CreatureData const* data = sObjectMgr.GetCreatureData(obj->guid))
{
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
// for non-instanceable maps pool spawn can be at different map from provided mapState
if (MapPersistentState* dataMapState = mapState.GetMapId() == data->mapid ? &mapState : sMapPersistentStateMgr.GetPersistentState(data->mapid, 0))
{
dataMapState->AddCreatureToGrid(obj->guid, data);
Map* dataMap = dataMapState->GetMap();
// We use spawn coords to spawn
if (dataMap && dataMap->IsLoaded(data->posX, data->posY))
{
Creature* pCreature = new Creature;
//DEBUG_LOG("Spawning creature %u",obj->guid);
if (!pCreature->LoadFromDB(obj->guid, dataMap))
{
delete pCreature;
return;
}
else
{
// if new spawn replaces a just despawned creature, not instantly spawn but set respawn timer
if(!instantly)
{
pCreature->SetRespawnTime( pCreature->GetRespawnDelay() );
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY) || pCreature->IsWorldBoss())
pCreature->SaveRespawnTime();
}
dataMap->Add(pCreature);
}
}
// for not loaded grid just update respawn time (avoid work for instances until implemented support)
else if(!instantly)
{
dataMapState->SaveCreatureRespawnTime(obj->guid, time(NULL) + data->spawntimesecs);
}
}
}
}
示例3: if
void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj, bool instantly)
{
if (GameObjectData const* data = sObjectMgr.GetGOData(obj->guid))
{
sObjectMgr.AddGameobjectToGrid(obj->guid, data);
// Spawn if necessary (loaded grids only)
// this base map checked as non-instanced and then only existed
Map* map = const_cast<Map*>(sMapMgr.CreateBaseMap(data->mapid));
// We use current coords to unspawn, not spawn coords since creature can have changed grid
// (avoid work for instances until implemented support)
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{
GameObject* pGameobject = new GameObject;
//DEBUG_LOG("Spawning gameobject %u", obj->guid);
if (!pGameobject->LoadFromDB(obj->guid, map))
{
delete pGameobject;
return;
}
else
{
if (pGameobject->isSpawnedByDefault())
{
// if new spawn replaces a just despawned object, not instantly spawn but set respawn timer
if (!instantly)
{
pGameobject->SetRespawnTime( pGameobject->GetRespawnDelay() );
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY))
pGameobject->SaveRespawnTime();
}
map->Add(pGameobject);
}
}
}
// for not loaded grid just update respawn time (avoid work for instances until implemented support)
else if (!map->Instanceable() && !instantly)
{
// for spawned by default object only
if (data->spawntimesecs >= 0)
sObjectMgr.SaveGORespawnTime(obj->guid,map->GetInstanceId(),time(NULL) + data->spawntimesecs);
}
}
}
示例4: AddCharInfo
const CharInfo& AddCharInfo(wchar_t t)
{
bUpdated = true;
infoByChar.Add(t, (uint32)infos.size());
infos.emplace_back();
CharInfo& ci = infos.back();
FT_Face* pFace = &face;
ci.glyphID = FT_Get_Char_Index(*pFace, t);
if(ci.glyphID == 0)
{
pFace = &fallbackFont;
ci.glyphID = FT_Get_Char_Index(*pFace, t);
}
FT_Load_Glyph(*pFace, ci.glyphID, FT_LOAD_DEFAULT);
if((*pFace)->glyph->format != FT_GLYPH_FORMAT_BITMAP)
{
FT_Render_Glyph((*pFace)->glyph, FT_RENDER_MODE_NORMAL);
}
ci.topOffset = (*pFace)->glyph->bitmap_top;
ci.leftOffset = (*pFace)->glyph->bitmap_left;
ci.advance = (float)(*pFace)->glyph->advance.x / 64.0f;
Image img = ImageRes::Create(Vector2i((*pFace)->glyph->bitmap.width, (*pFace)->glyph->bitmap.rows));
Colori* pDst = img->GetBits();
uint8* pSrc = (*pFace)->glyph->bitmap.buffer;
uint32 nLen = (*pFace)->glyph->bitmap.width * (*pFace)->glyph->bitmap.rows;
for(uint32 i = 0; i < nLen; i++)
{
pDst[0].w = pSrc[0];
Reinterpret<VectorBase<uint8, 3>>(pDst[0]) = VectorBase<uint8, 3>(255, 255, 255);
pSrc++;
pDst++;
}
uint32 nIndex = spriteMap->AddSegment(img);
ci.coords = spriteMap->GetCoords(nIndex);
return ci;
}
示例5:
void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj) {
if (GameObjectData const* data = sObjectMgr->GetGOData(obj->guid)) {
sObjectMgr->AddGameobjectToGrid(obj->guid, data);
// Spawn if necessary (loaded grids only)
// this base map checked as non-instanced and then only existed
Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid));
// We use current coords to unspawn, not spawn coords since creature can have changed grid
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) {
GameObject* pGameobject = new GameObject;
//sLog->outDebug(LOG_FILTER_POOLSYS, "Spawning gameobject %u", guid);
if (!pGameobject->LoadFromDB(obj->guid, map)) {
delete pGameobject;
return;
} else {
if (pGameobject->isSpawnedByDefault())
map->Add(pGameobject);
}
}
}
}
示例6: AddNPCPassengerInInstance
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);
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 NULL;
}
map->Add(pCreature);
m_NPCPassengerSet.insert(pCreature);
pCreature->setActive(true);
sScriptMgr->OnAddCreaturePassenger(this, pCreature);
return pCreature;
}
示例7: GetSize
FontSize* GetSize(uint32 nSize)
{
if(m_currentSize != nSize)
{
FT_Set_Pixel_Sizes(m_face, 0, nSize);
m_currentSize = nSize;
}
if(fallbackFontSize != nSize)
{
FT_Set_Pixel_Sizes(fallbackFont, 0, nSize);
fallbackFontSize = nSize;
}
auto it = m_sizes.find(nSize);
if(it != m_sizes.end())
return it->second;
FontSize* pMap = new FontSize(m_gl, m_face);
m_sizes.Add(nSize, pMap);
return pMap;
}
示例8:
bool PoolGroup<Creature>::Spawn1Object(uint32 guid)
{
if (CreatureData const* data = objmgr.GetCreatureData(guid))
{
objmgr.AddCreatureToGrid(guid, data);
// Spawn if necessary (loaded grids only)
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid));
// We use spawn coords to spawn
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{
Creature* pCreature = new Creature;
//sLog.outDebug("Spawning creature %u",guid);
if (!pCreature->LoadFromDB(guid, map))
delete pCreature;
else
map->Add(pCreature);
}
return true;
}
return false;
}
示例9:
void PoolGroup<Creature>::Spawn1Object(PoolObject* obj)
{
if (CreatureData const* data = sObjectMgr->GetCreatureData(obj->guid))
{
sObjectMgr->AddCreatureToGrid(obj->guid, data);
// Spawn if necessary (loaded grids only)
Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(data->mapid));
// We use spawn coords to spawn
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{
Creature* creature = new Creature;
//sLog->outDebug("Spawning creature %u",guid);
if (!creature->LoadFromDB(obj->guid, map))
{
delete creature;
return;
}
else
map->Add(creature);
}
}
}
示例10: if
void PoolGroup<Creature>::Spawn1Object(PoolObject* obj, bool instantly)
{
if (CreatureData const* data = sObjectMgr.GetCreatureData(obj->guid))
{
sObjectMgr.AddCreatureToGrid(obj->guid, data);
// Spawn if necessary (loaded grids only)
Map* map = const_cast<Map*>(sMapMgr.CreateBaseMap(data->mapid));
// We use spawn coords to spawn (avoid work for instances until implemented support)
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{
Creature* pCreature = new Creature;
//sLog.outDebug("Spawning creature %u",obj->guid);
if (!pCreature->LoadFromDB(obj->guid, map))
{
delete pCreature;
return;
}
else
{
// if new spawn replaces a just despawned creature, not instantly spawn but set respawn timer
if(!instantly)
{
pCreature->SetRespawnTime( pCreature->GetRespawnDelay() );
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY) || pCreature->isWorldBoss())
pCreature->SaveRespawnTime();
}
map->Add(pCreature);
}
}
// for not loaded grid just update respawn time (avoid work for instances until implemented support)
else if(!map->Instanceable() && !instantly)
{
sObjectMgr.SaveCreatureRespawnTime(obj->guid,map->GetInstanceId(),time(NULL) + data->spawntimesecs);
}
}
}
示例11: freyja_model__lwo_import
int freyja_model__lwo_import(char *filename)
{
Map<unsigned int, unsigned int> trans;
lw_face_t *face;
lw_material_t *material;
Lwo lwo;
float vert[3];
int i, j, v, t;
if (lwo.Load(filename))
return -1;
freyjaBegin(FREYJA_MODEL);
// Start a new mesh
freyjaBegin(FREYJA_MESH);
// Start a new vertex group
freyjaBegin(FREYJA_VERTEX_GROUP);
for (i = 0; i < lwo.VertexCount(); i++)
{
lwo.Vertex(i, vert);
// Store vertices in group
v = freyjaVertexCreate3f(vert[0], vert[1], vert[2]);
#ifdef DEBUG_LWO_VERTS
printf("%i = %f %f %f\n", v, vert[0], vert[1], vert[2]);
#endif
// Generates id translator list
trans.Add(i, v);
}
freyjaEnd(); // FREYJA_GROUP
for (i = 0; i < lwo.FaceCount(); i++)
{
face = lwo.Face(i);
if (!face)
continue;
// Ignore non polygons
if (face->index_cnt < 3)
continue;
// Start a new polygon
freyjaBegin(FREYJA_POLYGON);
for (j = 0; j < face->index_cnt; j++)
{
// Store vertices by true id, using translator list
freyjaPolygonVertex1i(trans[face->index[j]]);
#ifdef DEBUG_LWO_TRANS
printf("trans[%i] = %i\n", face->index[j], trans[face->index[j]]);
#endif
material = lwo.Material(face->material);
if (material)
{
// Generate color by texel hack, store it's index
t = freyjaTexCoordCreate2f(material->r, material->g);
freyjaPolygonTexCoord1i(t);
t = freyjaTexCoordCreate2f(material->b, material->a);
freyjaPolygonTexCoord1i(t);
}
else
{
t = freyjaTexCoordCreate2f(0.0, 0.0);
freyjaPolygonTexCoord1i(t);
t = freyjaTexCoordCreate2f(0.0, 0.0);
freyjaPolygonTexCoord1i(t);
}
}
freyjaPolygonMaterial1i(0);
freyjaEnd(); // FREYJA_POLYGON
}
freyjaEnd(); // FREYJA_MESH
freyjaEnd(); // FREYJA_MODEL
return 0;
}
示例12: AddCapturePoint
bool OutdoorPvPObjective::AddCapturePoint(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
{
sLog.outDebug("OutdoorPvPObjective: creating capture point %u and capture point creature",entry);
// check info existence
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry);
if (!goinfo)
return false;
CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(OPVP_TRIGGER_CREATURE_ENTRY);
if(!cinfo)
return false;
// create capture point creature
uint32 displayId = objmgr.ChooseDisplayId(0, cinfo, NULL);
uint32 creature_guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT);
CreatureData& cdata = objmgr.NewOrExistCreatureData(creature_guid);
cdata.id = OPVP_TRIGGER_CREATURE_ENTRY;
cdata.mapid = map;
cdata.displayid = displayId;
cdata.equipmentId = cinfo->equipmentId;
cdata.posX = x;
cdata.posY = y;
cdata.posZ = z;
cdata.orientation = o;
cdata.spawntimesecs = 1;
cdata.spawndist = 0;
cdata.currentwaypoint = 0;
cdata.curhealth = cinfo->maxhealth;
cdata.curmana = cinfo->maxmana;
cdata.is_dead = false;
cdata.movementType = cinfo->MovementType;
cdata.spawnMask = 1;
cdata.phaseMask = PHASEMASK_NORMAL;
objmgr.AddCreatureToGrid(creature_guid, &cdata);
m_CapturePointCreature = MAKE_NEW_GUID(creature_guid, OPVP_TRIGGER_CREATURE_ENTRY, HIGHGUID_UNIT);
// create capture point go
uint32 guid = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT);
GameObjectData& data = objmgr.NewGOData(guid);
data.id = entry;
data.mapid = map;
data.posX = x;
data.posY = y;
data.posZ = z;
data.orientation = o;
data.rotation0 = rotation0;
data.rotation1 = rotation1;
data.rotation2 = rotation2;
data.rotation3 = rotation3;
data.spawntimesecs = 1;
data.animprogress = 100;
data.spawnMask = 1;
data.go_state = GO_STATE_READY;
data.phaseMask = PHASEMASK_NORMAL;
objmgr.AddGameobjectToGrid(guid, &data);
m_CapturePoint = MAKE_NEW_GUID(guid, entry, HIGHGUID_GAMEOBJECT);
// get the needed values from goinfo
m_ShiftMaxPhase = goinfo->raw.data[17];
m_ShiftMaxCaptureSpeed = m_ShiftMaxPhase / float(goinfo->raw.data[16]);
m_NeutralValue = goinfo->raw.data[12];
// add to map if map is already loaded
Map * pMap = MapManager::Instance().FindMap(map);
if(!pMap)
return true;
// add GO...
GameObject * go = new GameObject;
if(!go->Create(guid,entry, pMap, PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100, GO_STATE_READY))
{
sLog.outError("OutdoorPvPObjective: Gameobject template %u not found in database.", entry);
delete go;
}
else
{
go->SetRespawnTime(0);
objmgr.SaveGORespawnTime(go->GetDBTableGUIDLow(), 0, 0); //this is useless this isn't spawned through db so it doesn't has dbtableguid (it's just 0)
pMap->Add(go);
}
// add creature...
Creature* pCreature = new Creature;
if (!pCreature->Create(creature_guid, pMap,PHASEMASK_NORMAL, OPVP_TRIGGER_CREATURE_ENTRY, 0))
{
sLog.outError("OutdoorPvPObjective: Can't create creature entry: %u",entry);
delete pCreature;
}
else
{
pCreature->AIM_Initialize();
pCreature->Relocate(x, y, z, o);
//.........这里部分代码省略.........
示例13: ReadLayer
//.........这里部分代码省略.........
Scanner scanner(content);
if (property == "Name")
{
name = content;
}
else if (property == "Dimensions")
{
if (!scanner.Next(width))
throw "Could not parse width";
if (!scanner.Next(height))
throw "Could not parse height";
}
else if (property == "Data")
{
while (scanner.HasMoreTokens())
{
int32_t element;
if (!scanner.Next(element))
throw "Could not parse data";
data.push_back(element);
}
}
else if (property == "Position")
{
int32_t x, y;
if (!scanner.Next(x))
throw "Could not parse position";
if (!scanner.Next(y))
throw "Could not parse position";
attr.SetPosition(x, y);
}
else if (property == "Origin")
{
int32_t x, y;
if (!scanner.Next(x))
throw "Could not parse origin";
if (!scanner.Next(y))
throw "Could not parse origin";
attr.SetOrigin(x, y);
}
else if (property == "Scale")
{
float x, y;
if (!scanner.Next(x))
throw "Could not parse scale";
if (!scanner.Next(y))
throw "Could not parse scale";
attr.SetScale(x, y);
}
else if (property == "Rotation")
{
float rotation;
if (!scanner.Next(rotation))
throw "Could not parse rotation";
attr.SetRotation(rotation);
}
else if (property == "Opacity")
{
float opacity;
if (!scanner.Next(opacity))
throw "Could not parse opacity";
attr.SetOpacity(opacity);
}
else if (property == "BlendMode")
{
uint32_t mode;
if (!scanner.Next(mode))
throw "Could not parse blend mode";
attr.SetBlendMode(mode);
}
else if (property == "BlendColor")
{
uint32_t color;
if (!scanner.Next(color, 16))
throw "Could not parse blend color";
attr.SetBlendColor(color);
}
else if (property == "Priority")
{
int32_t priority;
if (!scanner.Next(priority))
throw "Could not parser priority";
attr.SetDepth(priority);
}
else
{
throw "Unexpected token " + property;
}
child = child->GetNext();
}
if (data.size() != width * height)
throw "Incorrect number of tile entries for layer";
map.Add(Layer(name, width, height, data, attr));
VerboseLog("Done Reading Layer");
}
示例14: HandleWpShowCommand
//.........这里部分代码省略.........
handler->SendSysMessage("|cffff33ffPath no found.|r");
handler->SetSentErrorMessage(true);
return false;
}
handler->PSendSysMessage(
"|cff00ff00DEBUG: wp on, PathID: |cff00ffff%u|r", pathid);
// Delete all visuals for this NPC
QueryResult result2 =
WorldDatabase.PQuery(
"SELECT wpguid FROM waypoint_data WHERE id = '%u' and wpguid <> 0",
pathid);
if (result2) {
bool hasError = false;
do {
Field *fields = result2->Fetch();
uint32 wpguid = fields[0].GetUInt32();
Creature* pCreature =
handler->GetSession()->GetPlayer()->GetMap()->GetCreature(
MAKE_NEW_GUID(wpguid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
if (!pCreature) {
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED,
wpguid);
hasError = true;
WorldDatabase.PExecute(
"DELETE FROM creature WHERE guid = '%u'",
wpguid);
} else {
pCreature->CombatStop();
pCreature->DeleteFromDB();
pCreature->AddObjectToRemoveList();
}
} while (result2->NextRow());
if (hasError) {
handler->PSendSysMessage(LANG_WAYPOINT_TOOFAR1);
handler->PSendSysMessage(LANG_WAYPOINT_TOOFAR2);
handler->PSendSysMessage(LANG_WAYPOINT_TOOFAR3);
}
}
do {
Field *fields = result->Fetch();
uint32 point = fields[0].GetUInt32();
float x = fields[1].GetFloat();
float y = fields[2].GetFloat();
float z = fields[3].GetFloat();
uint32 id = VISUAL_WAYPOINT;
Player *chr = handler->GetSession()->GetPlayer();
Map *map = chr->GetMap();
float o = chr->GetOrientation();
Creature* wpCreature = new Creature;
if (!wpCreature->Create(
sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete wpCreature;
return false;
}
示例15: TeleportPlayer
//.........这里部分代码省略.........
taxi_end = plr->m_taxi.GetTaxiDestination();
joinLoc = WorldLocation(plr->GetMapId(), plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetOrientation());
}
else
{
// Mount spell id storing
if (plr->IsMounted())
{
Unit::AuraList const& auras = plr->GetAurasByType(SPELL_AURA_MOUNTED);
if (!auras.empty())
mount_spell = (*auras.begin())->GetId();
}
if(!mount_spell && plr->getClass() == CLASS_DRUID)
{
Unit::AuraList const& auras = plr->GetAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (!auras.empty())
mount_spell = (*auras.begin())->GetId();
}
//Nearest graveyard if in dungeon
if (plr->GetMap()->IsDungeon())
{
if (const WorldSafeLocsEntry* entry = sObjectMgr.GetClosestGraveYard(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetMapId(), plr->GetTeam()))
joinLoc = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.f);
else
joinLoc = plr->GetLocation();
}
else
joinLoc = plr->GetLocation();
}
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid='%u'", GUID_LOPART(plr->GetGUID()));
CharacterDatabase.PExecute("INSERT INTO group_member(groupId,memberGuid,assistant,subgroup,lfg_join_x,lfg_join_y,lfg_join_z,lfg_join_o,lfg_join_map,taxi_start,taxi_end,mount_spell) "
"VALUES('%u','%u','%u','%u','%f','%f','%f','%f','%u','%u','%u','%u')",
m_Id, GUID_LOPART(plr->GetGUID()), 0, 1, joinLoc.x(), joinLoc.y(), joinLoc.z(), joinLoc.orientation, joinLoc.mapid, taxi_start, taxi_end, mount_spell);
//Set info to player
plr->m_lookingForGroup.joinLoc = joinLoc;
plr->m_lookingForGroup.taxi_start = taxi_start;
plr->m_lookingForGroup.taxi_end = taxi_end;
plr->m_lookingForGroup.mount_spell = mount_spell;
plr->m_lookingForGroup.roles = GetPlayerRole(plr->GetGUID());
if (IsRandom())
plr->CastSpell(plr, LFG_RANDOM_COOLDOWN, true);
}
// resurrect the player
if (!plr->isAlive())
{
plr->ResurrectPlayer(1.0f);
plr->SpawnCorpseBones();
}
// stop taxi flight at port
if (plr->isInFlight())
{
plr->GetMotionMaster()->MovementExpired(false);
plr->GetMotionMaster()->Clear(false, true);
plr->GetMotionMaster()->MoveIdle();
plr->m_taxi.ClearTaxiDestinations();
}
plr->ScheduleDelayedOperation(DELAYED_LFG_ENTER_DUNGEON);
plr->ScheduleDelayedOperation(DELAYED_SAVE_PLAYER);
plr->ScheduleDelayedOperation(DELAYED_LFG_CLEAR_LOCKS);
if(IsMixed())
{
plr->m_lookingForGroup.SetMixedDungeon(dungeonInfo->start_map);
if(newPlr)
plr->setFaction(sWorld.getConfig(CONFIG_UINT32_TEAM_BG_FACTION_BLUE));
}
if (IsInDungeon())
{
if(newPlr)
{
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *player = itr->getSource();
if (!player || player->GetMapId() != GetDungeonInfo()->map)
continue;
plr->TeleportTo(player->GetLocation());
return;
}
}
plr->TeleportTo(dungeonInfo->start_map, dungeonInfo->start_x, dungeonInfo->start_y, dungeonInfo->start_z, dungeonInfo->start_o);
return;
}
//Must re-add player to reset id...
Map *map = plr->GetMap();
if(map->GetId() == dungeonInfo->start_map)
{
map->Remove(plr, false);
map->Add(plr);
}
plr->TeleportTo(dungeonInfo->start_map, dungeonInfo->start_x,
dungeonInfo->start_y, dungeonInfo->start_z, dungeonInfo->start_o);
}