Merge branch 'master' of github.com:TrinityCore/TrinityCore
Conflicts: src/server/game/DataStores/DBCStores.cpp src/server/game/DataStores/DBCfmt.h src/server/game/Server/Protocol/Opcodes.cpp
This commit is contained in:
@@ -382,29 +382,29 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
||||
// current/stable/not_in_slot
|
||||
if (mode >= PET_SAVE_AS_CURRENT)
|
||||
{
|
||||
uint32 owner = GUID_LOPART(GetOwnerGUID());
|
||||
uint32 ownerLowGUID = GUID_LOPART(GetOwnerGUID());
|
||||
std::string name = m_name;
|
||||
CharacterDatabase.EscapeString(name);
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
trans = CharacterDatabase.BeginTransaction();
|
||||
// remove current data
|
||||
trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner, m_charmInfo->GetPetNumber());
|
||||
|
||||
// prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
|
||||
if (mode <= PET_SAVE_LAST_STABLE_SLOT)
|
||||
trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'",
|
||||
PET_SAVE_NOT_IN_SLOT, owner, uint32(mode));
|
||||
PET_SAVE_NOT_IN_SLOT, ownerLowGUID, uint32(mode));
|
||||
|
||||
// prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
|
||||
if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT))
|
||||
if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT))
|
||||
trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u')",
|
||||
owner, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
ownerLowGUID, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
// save pet
|
||||
std::ostringstream ss;
|
||||
ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType) "
|
||||
<< "VALUES ("
|
||||
<< m_charmInfo->GetPetNumber() << ','
|
||||
<< GetEntry() << ','
|
||||
<< owner << ','
|
||||
<< ownerLowGUID << ','
|
||||
<< GetNativeDisplayId() << ','
|
||||
<< uint32(getLevel()) << ','
|
||||
<< GetUInt32Value(UNIT_FIELD_PETEXPERIENCE) << ','
|
||||
|
||||
@@ -941,7 +941,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
|
||||
return false;
|
||||
}
|
||||
|
||||
SetMap(sMapMgr->CreateMap(info->mapId, this, 0));
|
||||
SetMap(sMapMgr->CreateMap(info->mapId, this));
|
||||
|
||||
uint8 powertype = cEntry->powerType;
|
||||
|
||||
@@ -2244,7 +2244,9 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
if (!sMapMgr->CanPlayerEnter(mapid, this, false))
|
||||
return false;
|
||||
|
||||
Map* map = sMapMgr->CreateMap(mapid, this, 0);
|
||||
// If the map is not created, assume it is possible to enter it.
|
||||
// It will be created in the WorldPortAck.
|
||||
Map* map = sMapMgr->FindBaseMap(mapid);
|
||||
if (!map || map->CanEnter(this))
|
||||
{
|
||||
//lets reset near teleport flag if it wasn't reset during chained teleports
|
||||
@@ -5126,8 +5128,6 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
||||
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
|
||||
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND);
|
||||
|
||||
setDeathState(ALIVE);
|
||||
|
||||
SetMovement(MOVE_LAND_WALK);
|
||||
SetMovement(MOVE_UNROOT);
|
||||
|
||||
@@ -5157,6 +5157,8 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
||||
// update visibility
|
||||
UpdateObjectVisibility();
|
||||
|
||||
setDeathState(ALIVE);
|
||||
|
||||
if (!applySickness)
|
||||
return;
|
||||
|
||||
@@ -16972,7 +16974,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
|
||||
// NOW player must have valid map
|
||||
// load the player's map here if it's not already loaded
|
||||
Map* map = sMapMgr->CreateMap(mapId, this, instanceId);
|
||||
Map* map = sMapMgr->CreateMap(mapId, this);
|
||||
|
||||
if (!map)
|
||||
{
|
||||
@@ -16990,14 +16992,14 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
RelocateToHomebind();
|
||||
}
|
||||
|
||||
map = sMapMgr->CreateMap(mapId, this, 0);
|
||||
map = sMapMgr->CreateMap(mapId, this);
|
||||
if (!map)
|
||||
{
|
||||
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
|
||||
mapId = info->mapId;
|
||||
Relocate(info->positionX, info->positionY, info->positionZ, 0.0f);
|
||||
sLog->outError("Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
|
||||
map = sMapMgr->CreateMap(mapId, this, 0);
|
||||
map = sMapMgr->CreateMap(mapId, this);
|
||||
if (!map)
|
||||
{
|
||||
sLog->outError("Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
|
||||
|
||||
@@ -2516,6 +2516,41 @@ class Player : public Unit, public GridObject<Player>
|
||||
void AddWhisperWhiteList(uint64 guid) { WhisperList.push_back(guid); }
|
||||
bool IsInWhisperWhiteList(uint64 guid);
|
||||
|
||||
//! Return collision height sent to client
|
||||
float GetCollisionHeight(bool mounted)
|
||||
{
|
||||
if (mounted)
|
||||
{
|
||||
CreatureDisplayInfoEntry const* mountDisplayInfo = sCreatureDisplayInfoStore.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID));
|
||||
if (!mountDisplayInfo)
|
||||
return GetCollisionHeight(false);
|
||||
|
||||
CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId);
|
||||
if (!mountModelData)
|
||||
return GetCollisionHeight(false);
|
||||
|
||||
CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
|
||||
ASSERT(displayInfo);
|
||||
CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
|
||||
ASSERT(modelData);
|
||||
|
||||
float scaleMod = GetFloatValue(OBJECT_FIELD_SCALE_X); // 99% sure about this
|
||||
|
||||
return scaleMod * mountModelData->MountHeight + modelData->CollisionHeight * 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
//! Dismounting case - use basic default model data
|
||||
CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
|
||||
ASSERT(displayInfo);
|
||||
CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
|
||||
ASSERT(modelData);
|
||||
|
||||
return modelData->CollisionHeight;
|
||||
}
|
||||
//! TODO: Need a proper calculation for collision height when mounted
|
||||
}
|
||||
|
||||
protected:
|
||||
// Gamemaster whisper whitelist
|
||||
WhisperListContainer WhisperList;
|
||||
|
||||
@@ -98,7 +98,7 @@ void MapManager::LoadTransports()
|
||||
m_TransportsByMap[*i].insert(t);
|
||||
|
||||
//If we someday decide to use the grid to track transports, here:
|
||||
t->SetMap(sMapMgr->CreateMap(mapid, t, 0));
|
||||
t->SetMap(sMapMgr->CreateBaseMap(mapid));
|
||||
t->AddToWorld();
|
||||
|
||||
++count;
|
||||
@@ -365,9 +365,9 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
if (keyFrames[keyFrames.size() - 1].node->mapid != keyFrames[0].node->mapid)
|
||||
teleport = true;
|
||||
|
||||
WayPoint pos(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0,
|
||||
m_WayPoints[0] = WayPoint(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0,
|
||||
keyFrames[0].node->arrivalEventID, keyFrames[0].node->departureEventID);
|
||||
m_WayPoints[0] = pos;
|
||||
|
||||
t += keyFrames[0].node->delay * 1000;
|
||||
|
||||
uint32 cM = keyFrames[0].node->mapid;
|
||||
@@ -387,12 +387,11 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
float newX, newY, newZ;
|
||||
newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev;
|
||||
newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev;
|
||||
newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev;
|
||||
float newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev;
|
||||
float newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev;
|
||||
float newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev;
|
||||
|
||||
bool teleport = false;
|
||||
teleport = false;
|
||||
if (keyFrames[i].node->mapid != cM)
|
||||
{
|
||||
teleport = true;
|
||||
@@ -400,9 +399,8 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
}
|
||||
|
||||
// sLog->outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ);
|
||||
WayPoint pos(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
|
||||
if (teleport)
|
||||
m_WayPoints[t] = pos;
|
||||
m_WayPoints[t] = WayPoint(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
|
||||
}
|
||||
|
||||
if (tFrom < tTo) // caught in tFrom dock's "gravitational pull"
|
||||
@@ -439,25 +437,18 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
else
|
||||
t += (long)keyFrames[i + 1].tTo % 100;
|
||||
|
||||
bool teleport = false;
|
||||
teleport = false;
|
||||
if ((keyFrames[i + 1].node->actionFlag == 1) || (keyFrames[i + 1].node->mapid != keyFrames[i].node->mapid))
|
||||
{
|
||||
teleport = true;
|
||||
cM = keyFrames[i + 1].node->mapid;
|
||||
}
|
||||
|
||||
WayPoint pos(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport,
|
||||
m_WayPoints[t] = WayPoint(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport,
|
||||
0, keyFrames[i + 1].node->arrivalEventID, keyFrames[i + 1].node->departureEventID);
|
||||
// sLog->outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport);
|
||||
/*
|
||||
if (keyFrames[i+1].delay > 5)
|
||||
pos.delayed = true;
|
||||
*/
|
||||
//if (teleport)
|
||||
m_WayPoints[t] = pos;
|
||||
|
||||
t += keyFrames[i + 1].node->delay * 1000;
|
||||
// sLog->outString("------");
|
||||
}
|
||||
|
||||
uint32 timer = t;
|
||||
@@ -503,7 +494,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
|
||||
|
||||
RemoveFromWorld();
|
||||
ResetMap();
|
||||
Map* newMap = sMapMgr->CreateMap(newMapid, this, 0);
|
||||
Map* newMap = sMapMgr->CreateBaseMap(newMapid);
|
||||
SetMap(newMap);
|
||||
ASSERT (GetMap());
|
||||
AddToWorld();
|
||||
|
||||
@@ -5242,6 +5242,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
break;
|
||||
case CLASS_ROGUE: // 39511, 40997, 40998, 41002, 41005, 41011
|
||||
case CLASS_WARRIOR: // 39511, 40997, 40998, 41002, 41005, 41011
|
||||
case CLASS_DEATH_KNIGHT:
|
||||
triggered_spell_id = RAND(39511, 40997, 40998, 41002, 41005, 41011);
|
||||
cooldown_spell_id = 39511;
|
||||
break;
|
||||
@@ -11933,6 +11934,12 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
|
||||
else
|
||||
player->UnsummonPetTemporaryIfAny();
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
|
||||
data.append(GetPackGUID());
|
||||
data << uint32(sWorld->GetGameTime()); // Packet counter
|
||||
data << player->GetCollisionHeight(true);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT);
|
||||
@@ -11946,6 +11953,15 @@ void Unit::Unmount()
|
||||
SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0);
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT);
|
||||
|
||||
if (Player* thisPlayer = ToPlayer())
|
||||
{
|
||||
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
|
||||
data.append(GetPackGUID());
|
||||
data << uint32(sWorld->GetGameTime()); // Packet counter
|
||||
data << thisPlayer->GetCollisionHeight(false);
|
||||
thisPlayer->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_DISMOUNT, 8);
|
||||
data.appendPackGUID(GetGUID());
|
||||
SendMessageToSet(&data, true);
|
||||
|
||||
Reference in New Issue
Block a user