Merge branch 'master' of https://github.com/azerothcore/azerothcore-wotlk into dir-restructure

This commit is contained in:
Yehonal
2017-12-21 11:26:43 +01:00
445 changed files with 49192 additions and 15431 deletions

View File

@@ -34,6 +34,7 @@ Copied events should probably have a new owner
#include "GuildMgr.h"
#include "ArenaTeamMgr.h"
#include "WorldSession.h"
#include "GameEventMgr.h"
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
@@ -139,11 +140,10 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
data.append(dataBuffer);
// TODO: Fix this, how we do know how many and what holidays to send?
uint32 holidayCount = 0;
data << uint32(holidayCount);
for (uint32 i = 0; i < holidayCount; ++i)
data << uint32(sGameEventMgr->modifiedHolidays.size());
for (uint32 entry : sGameEventMgr->modifiedHolidays)
{
HolidaysEntry const* holiday = sHolidaysStore.LookupEntry(666);
HolidaysEntry const* holiday = sHolidaysStore.LookupEntry(entry);
data << uint32(holiday->Id); // m_ID
data << uint32(holiday->Region); // m_region, might be looping

View File

@@ -27,7 +27,7 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
if (!channel)
return;
AreaTableEntry const* zone = GetAreaEntryByAreaID(GetPlayer()->GetZoneId());
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(GetPlayer()->GetZoneId());
if (!zone || !GetPlayer()->CanJoinConstantChannelInZone(channel, zone))
return;
}

View File

@@ -1979,30 +1979,50 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
item = _player->GetItemByGuid(itemGuid);
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
InventoryResult msg;
if (!item)
{
Item* uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (!uItem)
continue;
ItemPosCountVec sDest;
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sDest, uItem, false);
if (msg == EQUIP_ERR_OK)
{
_player->RemoveItem(INVENTORY_SLOT_BAG_0, i, true);
_player->StoreItem(sDest, uItem, true);
Item* uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (uItem) {
if (uItem->IsEquipped()) {
msg = _player->CanUnequipItem(dstpos, true);
if (msg != EQUIP_ERR_OK) {
_player->SendEquipError(msg, uItem, NULL);
continue;
}
}
else
_player->SendEquipError(msg, uItem, NULL);
continue;
if (!item)
{
ItemPosCountVec sDest;
msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sDest, uItem, false);
if (msg == EQUIP_ERR_OK)
{
_player->RemoveItem(INVENTORY_SLOT_BAG_0, i, true);
_player->StoreItem(sDest, uItem, true);
}
else
_player->SendEquipError(msg, uItem, NULL);
continue;
}
}
if (item->GetPos() == dstpos)
continue;
if (item) {
if (item->GetPos() == dstpos)
continue;
_player->SwapItem(item->GetPos(), dstpos);
if (!item->IsEquipped()) {
uint16 _candidatePos;
msg = _player->CanEquipItem(NULL_SLOT, _candidatePos, item, true);
if (msg != EQUIP_ERR_OK) {
_player->SendEquipError(msg, item, NULL);
continue;
}
}
_player->SwapItem(item->GetPos(), dstpos);
}
}
WorldPacket data(SMSG_EQUIPMENT_SET_USE_RESULT, 1);

View File

@@ -360,7 +360,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
continue;
std::string aname;
if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(itr->second->GetZoneId()))
aname = areaEntry->area_name[GetSessionDbcLocale()];
bool s_show = true;
@@ -1934,7 +1934,7 @@ void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/)
return;
}
AreaTableEntry const* atEntry = GetAreaEntryByAreaID(_player->GetAreaId());
AreaTableEntry const* atEntry = sAreaTableStore.LookupEntry(_player->GetAreaId());
if (!atEntry || !(atEntry->flags & AREA_FLAG_WINTERGRASP_2))
return;

View File

@@ -474,16 +474,26 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
plrMover->UpdateFallInformationIfNeed(movementInfo, opcode);
if (movementInfo.pos.GetPositionZ() < -500.0f)
if (movementInfo.pos.GetPositionZ() < plrMover->GetMap()->GetMinHeight(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY()))
if (!plrMover->GetBattleground() || !plrMover->GetBattleground()->HandlePlayerUnderMap(_player))
{
if (plrMover->IsAlive())
{
plrMover->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IS_OUT_OF_BOUNDS);
plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
// player can be alive if GM
if (plrMover->IsAlive())
plrMover->KillPlayer();
}
else if (!plrMover->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IS_OUT_OF_BOUNDS))
{
WorldSafeLocsEntry const* grave = sObjectMgr->GetClosestGraveyard(plrMover->GetPositionX(), plrMover->GetPositionY(), plrMover->GetPositionZ(), plrMover->GetMapId(), plrMover->GetTeamId());
if ( grave)
plrMover->TeleportTo(grave->map_id, grave->x, grave->y, grave->z, plrMover->GetOrientation());
plrMover->Relocate(grave->x, grave->y, grave->z, plrMover->GetOrientation());
}
plrMover->StopMovingOnCurrentPos(); // pussywizard: moving corpse can't release spirit
}
}
@@ -711,5 +721,5 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
agree = false;
}
_player->SetSummonAsSpectator(false);
_player->SummonIfPossible(agree);
_player->SummonIfPossible(agree, summoner_guid);
}