Merge branch '4.3.4' of github.com:TrinityCore/TrinityCore into 4.3.4_phases

This commit is contained in:
Subv
2014-06-01 22:43:24 -05:00
12 changed files with 72 additions and 55 deletions
@@ -0,0 +1 @@
UPDATE `quest_template` SET `NextQuestId`=1106,`ExclusiveGroup`=-1104 WHERE `Id` IN (1104,1105);
@@ -0,0 +1,6 @@
ALTER TABLE `creature`
ADD `PhaseId` INT(10) DEFAULT '0' AFTER `phaseMask`,
ADD `PhaseGroup` INT(10) DEFAULT '0' AFTER `PhaseId`;
ALTER TABLE `gameobject`
ADD `PhaseId` INT(10) DEFAULT '0' AFTER `phaseMask`,
ADD `PhaseGroup` INT(10) DEFAULT '0' AFTER `PhaseId`;
+12 -1
View File
@@ -708,6 +708,8 @@ Player::Player(WorldSession* session): Unit(true)
m_areaUpdateId = 0;
m_team = 0;
m_needsZoneUpdate = false;
m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
@@ -6721,6 +6723,15 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation, bool t
// mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
//AURA_INTERRUPT_FLAG_JUMP not sure
// Update player zone if needed
if (m_needsZoneUpdate)
{
uint32 newZone, newArea;
GetZoneAndAreaId(newZone, newArea);
UpdateZone(newZone, newArea);
m_needsZoneUpdate = false;
}
// group update
if (GetGroup())
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
@@ -27884,4 +27895,4 @@ void Player::UpdatePhasing()
}
GetSession()->SendSetPhaseShift(GetPhases(), terrainswaps, worldAreaSwaps);
}
}
+4 -1
View File
@@ -1893,7 +1893,8 @@ class Player : public Unit, public GridObject<Player>
void UpdatePvP(bool state, bool override=false);
void UpdateZone(uint32 newZone, uint32 newArea);
void UpdateArea(uint32 newArea);
void SetNeedsZoneUpdate(bool needsUpdate) { m_needsZoneUpdate = needsUpdate; }
void UpdateZoneDependentAuras(uint32 zone_id); // zones
void UpdateAreaDependentAuras(uint32 area_id); // subzones
@@ -2812,6 +2813,8 @@ class Player : public Unit, public GridObject<Player>
bool IsAlwaysDetectableFor(WorldObject const* seer) const;
uint8 m_grantableLevels;
bool m_needsZoneUpdate;
CUFProfile* _CUFProfiles[MAX_CUF_PROFILES];
+3 -4
View File
@@ -494,10 +494,9 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: %u", newZone);
// use server size data
uint32 newzone, newarea;
GetPlayer()->GetZoneAndAreaId(newzone, newarea);
GetPlayer()->UpdateZone(newzone, newarea);
// use server side data, but only after update the player position. See Player::UpdatePosition().
GetPlayer()->SetNeedsZoneUpdate(true);
//GetPlayer()->SendInitWorldStates(true, newZone);
}
+10 -6
View File
@@ -411,19 +411,23 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recvData)
uint32 count;
recvData >> count; // quest count, max=25
if (count >= MAX_QUEST_LOG_SIZE)
if (count > MAX_QUEST_LOG_SIZE)
{
recvData.rfinish();
return;
}
WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4+(4+4)*count);
data << uint32(count); // count
// Read quest ids and add the in a unordered_set so we don't send POIs for the same quest multiple times
std::unordered_set<uint32> questIds;
for (uint32 i = 0; i < count; ++i)
questIds.insert(recvData.read<uint32>()); // quest id
WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4 + (4 + 4)*questIds.size());
data << uint32(questIds.size()); // count
for (auto itr = questIds.begin(); itr != questIds.end(); ++itr)
{
uint32 questId;
recvData >> questId; // quest id
uint32 questId = *itr;
bool questOk = false;
+1
View File
@@ -33,6 +33,7 @@
#include "Cryptography/BigNumber.h"
#include "Opcodes.h"
#include "AccountMgr.h"
#include <unordered_set>
class Creature;
class GameObject;
@@ -26,7 +26,7 @@
#include "ScriptedCreature.h"
#include "blackrock_spire.h"
uint32 const DragonspireRunes[7] = { GO_HALL_RUNE_1, GO_HALL_RUNE_2, GO_HALL_RUNE_3, GO_HALL_RUNE_4, GO_HALL_RUNE_5, GO_HALL_RUNE_6, GO_HALL_RUNE_7 };
//uint32 const DragonspireRunes[7] = { GO_HALL_RUNE_1, GO_HALL_RUNE_2, GO_HALL_RUNE_3, GO_HALL_RUNE_4, GO_HALL_RUNE_5, GO_HALL_RUNE_6, GO_HALL_RUNE_7 };
uint32 const DragonspireMobs[3] = { NPC_BLACKHAND_DREADWEAVER, NPC_BLACKHAND_SUMMONER, NPC_BLACKHAND_VETERAN };
@@ -143,7 +143,7 @@ uint32 m_auiSpellSummonWeapon[]=
};
const float CAPERNIAN_DISTANCE = 20.0f; //she casts away from the target
const float KAEL_VISIBLE_RANGE = 50.0f;
//const float KAEL_VISIBLE_RANGE = 50.0f;
const float afGravityPos[3] = {795.0f, 0.0f, 70.0f};
@@ -1867,13 +1867,6 @@ public:
{
npc_shadowmoon_tuber_nodeAI(Creature* creature) : ScriptedAI(creature) { }
void Reset() override
{
tapped = false;
tuberGUID = 0;
resetTimer = 60000;
}
void SetData(uint32 id, uint32 data) override
{
if (id == TYPE_BOAR && data == DATA_BOAR)
@@ -1884,49 +1877,23 @@ public:
// Despawn the tuber
if (GameObject* tuber = me->FindNearestGameObject(GO_SHADOWMOON_TUBER_MOUND, 5.0f))
{
tuberGUID = tuber->GetGUID();
// @Workaround: find how to properly despawn the GO
tuber->SetPhaseMask(2, true);
tuber->SetLootState(GO_JUST_DEACTIVATED);
me->DespawnOrUnsummon();
}
}
}
void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
{
if (!tapped && spell->Id == SPELL_WHISTLE)
if (spell->Id == SPELL_WHISTLE)
{
if (Creature* boar = me->FindNearestCreature(NPC_BOAR_ENTRY, 30.0f))
{
// Disable trigger and force nearest boar to walk to him
tapped = true;
boar->SetWalk(false);
boar->GetMotionMaster()->MovePoint(POINT_TUBER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
}
}
}
void UpdateAI(uint32 diff) override
{
if (tapped)
{
if (resetTimer <= diff)
{
// Respawn the tuber
if (tuberGUID)
if (GameObject* tuber = GameObject::GetGameObject(*me, tuberGUID))
// @Workaround: find how to properly respawn the GO
tuber->SetPhaseMask(1, true);
Reset();
}
else
resetTimer -= diff;
}
}
private:
bool tapped;
uint64 tuberGUID;
uint32 resetTimer;
};
CreatureAI* GetAI(Creature* creature) const override
+28
View File
@@ -64,6 +64,34 @@ namespace Trinity
std::advance(it, urand(0, container.size() - 1));
return *it;
}
/**
* @fn bool Trinity::Containers::Intersects(Iterator first1, Iterator last1, Iterator first2, Iterator last2)
*
* @brief Checks if two SORTED containers have a common element
*
* @param first1 Iterator pointing to start of the first container
* @param last1 Iterator pointing to end of the first container
* @param first2 Iterator pointing to start of the second container
* @param last2 Iterator pointing to end of the second container
*
* @return true if containers have a common element, false otherwise.
*/
template<class Iterator1, class Iterator2>
bool Intersects(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
{
while (first1 != last1 && first2 != last2)
{
if (*first1 < *first2)
++first1;
else if (*first2 < *first1)
++first2;
else
return true;
}
return false;
}
}
//! namespace Containers
}
+2 -5
View File
@@ -27,11 +27,10 @@ ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos,
size_t size, size_t valueSize)
{
std::ostringstream ss;
ACE_Stack_Trace trace;
ss << "Attempted to " << (add ? "put" : "get") << " value with size: "
<< valueSize << " in ByteBuffer (pos: " << pos << " size: " << size
<< ")\n\n" << trace.c_str();
<< ")";
message().assign(ss.str());
}
@@ -40,12 +39,10 @@ ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size,
size_t valueSize)
{
std::ostringstream ss;
ACE_Stack_Trace trace;
ss << "Attempted to put a "
<< (valueSize > 0 ? "NULL-pointer" : "zero-sized value")
<< " in ByteBuffer (pos: " << pos << " size: " << size << ")\n\n"
<< trace.c_str();
<< " in ByteBuffer (pos: " << pos << " size: " << size << ")";
message().assign(ss.str());
}