Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/game/AggressorAI.cpp b/src/game/AggressorAI.cpp
- index 615fd3f..4391b7b 100644
- --- a/src/game/AggressorAI.cpp
- +++ b/src/game/AggressorAI.cpp
- @@ -103,7 +103,7 @@ void AggressorAI::EnterEvadeMode()
- //i_tracker.Reset(TIME_INTERVAL_LOOK);
- }
- - if (!m_creature->isCharmed())
- + if (!m_creature->isCharmed() && (!m_creature->GetVehicle() || !m_creature->GetVehicleGUID()))
- {
- m_creature->RemoveAllAuras();
- diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
- index fc1c96e..e9fd8f0 100644
- --- a/src/game/BattleGroundMgr.cpp
- +++ b/src/game/BattleGroundMgr.cpp
- @@ -1348,11 +1348,15 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
- *data << (uint32)0x00000001; // count of next fields
- *data << (uint32)((BattleGroundEYScore*)itr->second)->FlagCaptures; // flag captures
- break;
- + case BATTLEGROUND_SA:
- + *data << (uint32)0x00000002; // count of next fields
- + *data << (uint32)((BattleGroundSAScore*)itr->second)->DemolishersDestroyed; // demolishers destroyed
- + *data << (uint32)((BattleGroundSAScore*)itr->second)->GatesDestroyed; // gates destroyed
- + break;
- case BATTLEGROUND_NA:
- case BATTLEGROUND_BE:
- case BATTLEGROUND_AA:
- case BATTLEGROUND_RL:
- - case BATTLEGROUND_SA: // wotlk
- case BATTLEGROUND_DS: // wotlk
- case BATTLEGROUND_RV: // wotlk
- case BATTLEGROUND_IC: // wotlk
- diff --git a/src/game/BattleGroundSA.h b/src/game/BattleGroundSA.h
- index 31a3ffa..9324999 100644
- --- a/src/game/BattleGroundSA.h
- +++ b/src/game/BattleGroundSA.h
- @@ -24,8 +24,10 @@ class BattleGround;
- class BattleGroundSAScore : public BattleGroundScore
- {
- public:
- - BattleGroundSAScore() {};
- + BattleGroundSAScore(): DemolishersDestroyed(0), GatesDestroyed(0) {};
- virtual ~BattleGroundSAScore() {};
- + uint32 DemolishersDestroyed;
- + uint32 GatesDestroyed;
- };
- class BattleGroundSA : public BattleGround
- diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
- index 3539a2a..213d2cd 100644
- --- a/src/game/Chat.cpp
- +++ b/src/game/Chat.cpp
- @@ -528,6 +528,8 @@ ChatCommand * ChatHandler::getCommandTable()
- { "spell_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptsCommand, "", NULL },
- { "spell_target_position", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL },
- { "spell_threats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL },
- + { "vehicle_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadVehicleDataCommand, "", NULL },
- + { "vehicle_seat_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadVehicleSeatDataCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- @@ -2040,7 +2042,7 @@ Creature* ChatHandler::getSelectedCreature()
- if(!m_session)
- return NULL;
- - return m_session->GetPlayer()->GetMap()->GetAnyTypeCreature(m_session->GetPlayer()->GetSelectionGuid());
- + return ObjectAccessor::GetAnyTypeCreature(*m_session->GetPlayer(),m_session->GetPlayer()->GetSelectionGuid());
- }
- /**
- diff --git a/src/game/Chat.h b/src/game/Chat.h
- index 5b56d0b..c1ead9e 100644
- --- a/src/game/Chat.h
- +++ b/src/game/Chat.h
- @@ -446,6 +446,8 @@ class ChatHandler
- bool HandleReloadSpellTargetPositionCommand(char* args);
- bool HandleReloadSpellThreatsCommand(char* args);
- bool HandleReloadSpellPetAurasCommand(char* args);
- + bool HandleReloadVehicleDataCommand(char* args);
- + bool HandleReloadVehicleSeatDataCommand(char* args);
- bool HandleResetAchievementsCommand(char* args);
- bool HandleResetAllCommand(char* args);
- diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
- index 75d314b..77a2277 100644
- --- a/src/game/Creature.cpp
- +++ b/src/game/Creature.cpp
- @@ -42,6 +42,7 @@
- #include "GridNotifiers.h"
- #include "GridNotifiersImpl.h"
- #include "CellImpl.h"
- +#include "Vehicle.h"
- // apply implementation of the singletons
- #include "Policies/SingletonImp.h"
- @@ -1408,6 +1409,8 @@ void Creature::SetDeathState(DeathState s)
- return;
- Unit::SetDeathState(CORPSE);
- + if(IsVehicle())
- + ((Vehicle*)this)->Die();
- }
- if (s == JUST_ALIVED)
- @@ -1536,6 +1539,32 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
- return true;
- }
- + // Heal immunity
- + if (IsVehicle() && !(((Vehicle*)this)->GetVehicleFlags() & VF_CAN_BE_HEALED))
- + {
- + switch(spellInfo->Effect[index])
- + {
- + case SPELL_EFFECT_APPLY_AURA:
- + switch(spellInfo->EffectApplyAuraName[index])
- + {
- + case SPELL_AURA_PERIODIC_HEAL:
- + case SPELL_AURA_OBS_MOD_HEALTH:
- + case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
- + case SPELL_AURA_MOD_REGEN:
- + return true;
- + default: break;
- + }
- + break;
- + case SPELL_EFFECT_HEAL:
- + case SPELL_EFFECT_HEAL_MAX_HEALTH:
- + // NOTE : this too?
- + case SPELL_EFFECT_HEAL_MECHANICAL:
- + case SPELL_EFFECT_HEAL_PCT:
- + return true;
- + default : break;
- + }
- + }
- +
- return Unit::IsImmuneToSpellEffect(spellInfo, index);
- }
- @@ -1768,7 +1797,7 @@ bool Creature::CanInitiateAttack()
- if (hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED))
- return false;
- - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
- + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PLAYER_CONTROLLED))
- return false;
- if (isPassiveToHostile())
- @@ -2050,6 +2079,29 @@ bool Creature::IsInEvadeMode() const
- return !i_motionMaster.empty() && i_motionMaster.GetCurrentMovementGeneratorType() == HOME_MOTION_TYPE;
- }
- +float Creature::GetBaseSpeed() const
- +{
- + if( IsPet() )
- + {
- + switch( ((Pet*)this)->getPetType() )
- + {
- + case SUMMON_PET:
- + case HUNTER_PET:
- + {
- + //fixed speed fur hunter (and summon!?) pets
- + return 1.15f;
- + }
- + case GUARDIAN_PET:
- + case MINI_PET:
- + {
- + //speed of CreatureInfo for guardian- and minipets
- + break;
- + }
- + }
- + }
- + return m_creatureInfo->speed_run;
- +}
- +
- bool Creature::HasSpell(uint32 spellID) const
- {
- uint8 i;
- diff --git a/src/game/Creature.h b/src/game/Creature.h
- index 70200da..26b6a9d 100644
- --- a/src/game/Creature.h
- +++ b/src/game/Creature.h
- @@ -118,6 +118,7 @@ struct CreatureInfo
- int32 resistance6;
- uint32 spells[CREATURE_MAX_SPELLS];
- uint32 PetSpellDataId;
- + uint32 VehicleEntry;
- uint32 mingold;
- uint32 maxgold;
- char const* AIName;
- @@ -197,6 +198,16 @@ struct CreatureDataAddonAura
- SpellEffectIndex effect_idx;
- };
- +struct CreatureDataAddonPassengers
- +{
- + CreatureDataAddonPassengers() : entry(0), guid(0), seat_idx(-1) {}
- +
- + uint32 entry;
- + uint32 guid;
- + int8 seat_idx;
- +};
- +
- +// from `creature_addon` table
- // from `creature_addon` and `creature_template_addon`tables
- struct CreatureDataAddon
- {
- @@ -207,6 +218,8 @@ struct CreatureDataAddon
- uint8 pvp_state; // UnitPVPStateFlags
- uint32 emote;
- uint32 splineFlags;
- + uint32 vehicle_id;
- + CreatureDataAddonPassengers const* passengers; // loaded as char* "entry1 seatid1 entry2 seatid2 ... "
- CreatureDataAddonAura const* auras; // loaded as char* "spell1 eff1 spell2 eff2 ... "
- };
- @@ -576,6 +589,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
- MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
- void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
- + float GetBaseSpeed() const;
- // for use only in LoadHelper, Map::Add Map::CreatureCellRelocation
- Cell const& GetCurrentCell() const { return m_currentCell; }
- diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
- index da481e2..00dced4 100644
- --- a/src/game/CreatureAI.cpp
- +++ b/src/game/CreatureAI.cpp
- @@ -27,6 +27,10 @@ CreatureAI::~CreatureAI()
- void CreatureAI::AttackedBy( Unit* attacker )
- {
- + // vehicle dont have threat list, so this is unnecessary, because it calls move chase
- + if(m_creature->IsVehicle())
- + return;
- +
- if(!m_creature->getVictim())
- AttackStart(attacker);
- }
- diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp
- index 4ddfa91..640f890 100644
- --- a/src/game/CreatureAISelector.cpp
- +++ b/src/game/CreatureAISelector.cpp
- @@ -47,7 +47,7 @@ namespace FactorySelector
- // excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI
- Unit *owner=NULL;
- if ((creature->IsPet() && ((Pet*)creature)->isControlled() &&
- - ((owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER)) || creature->isCharmed())
- + ((owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER)) || (creature->isCharmed() && !creature->IsVehicle()))
- ai_factory = ai_registry.GetRegistryItem("PetAI");
- else if (creature->IsTotem())
- ai_factory = ai_registry.GetRegistryItem("TotemAI");
- diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
- index a3856be..77a5d78 100644
- --- a/src/game/CreatureEventAI.cpp
- +++ b/src/game/CreatureEventAI.cpp
- @@ -913,6 +913,7 @@ void CreatureEventAI::JustReachedHome()
- void CreatureEventAI::EnterEvadeMode()
- {
- + m_creature->ExitVehicle();
- m_creature->RemoveAllAuras();
- m_creature->DeleteThreatList();
- m_creature->CombatStop(true);
- diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h
- index f0a7bac..d39089a 100644
- --- a/src/game/DBCEnums.h
- +++ b/src/game/DBCEnums.h
- @@ -441,6 +441,12 @@ enum VehicleFlags
- enum VehicleSeatFlags
- {
- + SEAT_FREE = 0x01, // free seat
- + SEAT_FULL = 0x02, // seat occupied by player/creature
- + // special cases
- + SEAT_VEHICLE_FREE = 0x04, // seat occupied by vehicle, but that vehicle is free
- + SEAT_VEHICLE_FULL = 0x08, // seat occupied by vehicle and that vehicle is full too
- +
- SEAT_FLAG_HIDE_PASSENGER = 0x00000200, // Passenger is hidden
- SEAT_FLAG_CAN_CONTROL = 0x00000800, // Lua_UnitInVehicleControlSeat
- SEAT_FLAG_CAN_ATTACK = 0x00004000, // Can attack, cast spells and use items from vehicle?
- diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
- index 2d3fb78..d01d1f3 100644
- --- a/src/game/DBCStructure.h
- +++ b/src/game/DBCStructure.h
- @@ -1762,7 +1762,7 @@ struct VehicleEntry
- uint32 m_uiLocomotionType; // 34
- float m_msslTrgtImpactTexRadius; // 35
- uint32 m_uiSeatIndicatorType; // 36
- - // 37, new in 3.1 - powerType
- + uint32 m_powerType; // 37, new in 3.1 - powerType
- // 38, new in 3.1
- // 39, new in 3.1
- };
- @@ -1816,6 +1816,8 @@ struct VehicleSeatEntry
- int32 m_uiSkin; // 44
- uint32 m_flagsB; // 45
- // 46-57 added in 3.1, floats mostly
- +
- + bool IsUsable() const { return m_flags & SEAT_FLAG_USABLE; }
- };
- struct WMOAreaTableEntry
- diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h
- index c26acd8..ef6a443 100644
- --- a/src/game/DBCfmt.h
- +++ b/src/game/DBCfmt.h
- @@ -106,7 +106,7 @@ const char TaxiPathEntryfmt[]="niii";
- const char TaxiPathNodeEntryfmt[]="diiifffiiii";
- const char TeamContributionPointsfmt[]="df";
- const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
- -const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifixxx";
- +const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifiixx";
- const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
- const char WMOAreaTableEntryfmt[]="niiixxxxxiixxxxxxxxxxxxxxxxx";
- const char WorldMapAreaEntryfmt[]="xinxffffixx";
- diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
- index a1c836b..1413a77 100644
- --- a/src/game/GameObject.cpp
- +++ b/src/game/GameObject.cpp
- @@ -1628,6 +1628,18 @@ float GameObject::GetObjectBoundingRadius() const
- return DEFAULT_WORLD_OBJECT_SIZE;
- }
- +void GameObject::DealSiegeDamage(uint32 damage)
- +{
- + m_actualHealth -= damage;
- +
- + // TODO : there are a lot of thinghts to do here
- + if(m_actualHealth < 0)
- + {
- + m_actualHealth = GetGOInfo()->destructibleBuilding.intactNumHits;
- + SetLootState(GO_JUST_DEACTIVATED);
- + }
- +}
- +
- bool GameObject::IsInSkillupList(Player* player) const
- {
- return m_SkillupSet.find(player->GetObjectGuid()) != m_SkillupSet.end();
- diff --git a/src/game/GameObject.h b/src/game/GameObject.h
- index b6e69f7..3750f09 100644
- --- a/src/game/GameObject.h
- +++ b/src/game/GameObject.h
- @@ -704,12 +704,14 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
- GridReference<GameObject> &GetGridRef() { return m_gridRef; }
- uint64 GetRotation() const { return m_rotation; }
- + void DealSiegeDamage(uint32 damage);
- protected:
- uint32 m_spellId;
- time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
- uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
- LootState m_lootState;
- bool m_spawnedByDefault;
- + int32 m_actualHealth; // current health state
- time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
- // For traps this: spell casting cooldown, for doors/buttons: reset time.
- diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp
- index ba2eb06..ac6a654 100644
- --- a/src/game/GridNotifiers.cpp
- +++ b/src/game/GridNotifiers.cpp
- @@ -93,7 +93,10 @@ VisibleNotifier::Notify()
- {
- // target aura duration for caster show only if target exist at caster client
- if ((*vItr) != &player && (*vItr)->isType(TYPEMASK_UNIT))
- + {
- player.SendAurasForTarget((Unit*)(*vItr));
- + ((Unit*)(*vItr))->SendHeartBeat(false);
- + }
- // non finished movements show to player
- if ((*vItr)->GetTypeId()==TYPEID_UNIT && ((Creature*)(*vItr))->isAlive())
- diff --git a/src/game/Group.h b/src/game/Group.h
- index c1a87cf..d809916 100644
- --- a/src/game/Group.h
- +++ b/src/game/Group.h
- @@ -135,7 +135,8 @@ enum GroupUpdateFlags
- GROUP_UPDATE_FLAG_PET_AURAS = 0x00040000, // uint64 mask, for each bit set uint32 spellid + uint8 unk, pet auras...
- GROUP_UPDATE_FLAG_VEHICLE_SEAT = 0x00080000, // uint32 vehicle_seat_id (index from VehicleSeat.dbc)
- GROUP_UPDATE_PET = 0x0007FC00, // all pet flags
- - GROUP_UPDATE_FULL = 0x0007FFFF, // all known flags
- + GROUP_UPDATE_VEHICLE = 0x000FFC00, // all vehicle flags
- + GROUP_UPDATE_FULL = 0x000FFFFF, // all known flags
- };
- #define GROUP_UPDATE_FLAGS_COUNT 20
- diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
- index d340b1a..27d6b77 100644
- --- a/src/game/GroupHandler.cpp
- +++ b/src/game/GroupHandler.cpp
- @@ -28,6 +28,7 @@
- #include "Group.h"
- #include "SocialMgr.h"
- #include "Util.h"
- +#include "Vehicle.h"
- /* differeces from off:
- -you can uninvite yourself - is is useful
- @@ -719,7 +720,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
- }
- }
- - Pet *pet = player->GetPet();
- + Unit *pet = player->GetCharmOrPet();
- if (mask & GROUP_UPDATE_FLAG_PET_GUID)
- *data << (pet ? pet->GetObjectGuid() : ObjectGuid());
- @@ -797,6 +798,11 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
- else
- *data << uint64(0);
- }
- +
- + if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
- + {
- + *data << (uint32) player->m_movementInfo.GetTransportDBCSeat();
- + }
- }
- /*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
- @@ -818,7 +824,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
- return;
- }
- - Pet *pet = player->GetPet();
- + Unit *pet = player->GetCharmOrPet();
- WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8);
- data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
- @@ -826,7 +832,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
- uint32 mask1 = 0x00040BFF; // common mask, real flags used 0x000040BFF
- if(pet)
- - mask1 = 0x7FFFFFFF; // for hunters and other classes with pets
- + mask1 = 0xFFFFFFFF; // for hunters and other classes with pets
- Powers powerType = player->getPowerType();
- data << uint32(mask1); // group update mask
- @@ -880,6 +886,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
- }
- }
- data.put<uint64>(petMaskPos, petauramask); // GROUP_UPDATE_FLAG_PET_AURAS
- + data << (uint32) player->m_movementInfo.GetTransportDBCSeat();
- }
- else
- {
- diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
- index bad1513..60e71ae 100644
- --- a/src/game/Level3.cpp
- +++ b/src/game/Level3.cpp
- @@ -74,6 +74,9 @@ bool ChatHandler::HandleReloadAllCommand(char* /*args*/)
- HandleReloadReservedNameCommand((char*)"");
- HandleReloadMangosStringCommand((char*)"");
- HandleReloadGameTeleCommand((char*)"");
- +
- + HandleReloadVehicleDataCommand((char*)"");
- + HandleReloadVehicleSeatDataCommand((char*)"");
- return true;
- }
- @@ -921,6 +924,22 @@ bool ChatHandler::HandleReloadMailLevelRewardCommand(char* /*args*/)
- return true;
- }
- +bool ChatHandler::HandleReloadVehicleDataCommand(char* /*args*/)
- +{
- + sLog.outString( "Re-Loading `vehicle_data` Table!" );
- + sObjectMgr.LoadVehicleData();
- + SendGlobalSysMessage("DB table `vehicle_data` reloaded.");
- + return true;
- +}
- +
- +bool ChatHandler::HandleReloadVehicleSeatDataCommand(char* /*args*/)
- +{
- + sLog.outString( "Re-Loading `vehicle_seat_data` Table!" );
- + sObjectMgr.LoadVehicleSeatData();
- + SendGlobalSysMessage("DB table `vehicle_seat_data` reloaded.");
- + return true;
- +}
- +
- bool ChatHandler::HandleLoadScriptsCommand(char* args)
- {
- if (!LoadScriptingModule(args))
- diff --git a/src/game/Map.h b/src/game/Map.h
- index 3f1ee0f..82f59ed 100644
- --- a/src/game/Map.h
- +++ b/src/game/Map.h
- @@ -39,7 +39,6 @@
- #include <bitset>
- #include <list>
- -class Creature;
- class Unit;
- class WorldPacket;
- class InstanceData;
- diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
- index b4f632a..7774b60 100644
- --- a/src/game/MovementHandler.cpp
- +++ b/src/game/MovementHandler.cpp
- @@ -44,6 +44,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
- if(!GetPlayer()->IsBeingTeleportedFar())
- return;
- + if (_player->GetVehicleKit())
- + _player->GetVehicleKit()->RemoveAllPassengers();
- +
- // get the teleport destination
- WorldLocation &loc = GetPlayer()->GetTeleportDest();
- @@ -262,6 +265,8 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
- data << mover->GetPackGUID(); // write guid
- movementInfo.Write(data); // write data
- mover->SendMessageToSetExcept(&data, _player);
- + mover->m_movementInfo = movementInfo;
- + mover->SetPosition(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o);
- }
- void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket &recv_data)
- @@ -348,12 +353,10 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
- ObjectGuid guid;
- recv_data >> guid;
- - if(_player->GetMover()->GetObjectGuid() != guid)
- - {
- - sLog.outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is %s and should be %s",
- - _player->GetMover()->GetGuidStr().c_str(), guid.GetString().c_str());
- - return;
- - }
- + if (Unit *pMover = ObjectAccessor::GetUnit(*GetPlayer(), guid))
- + GetPlayer()->SetMover(pMover);
- + else
- + GetPlayer()->SetMover(NULL);
- }
- void WorldSession::HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data)
- @@ -359,23 +364,13 @@ void WorldSession::HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data)
- DEBUG_LOG("WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
- recv_data.hexlike();
- - ObjectGuid old_mover_guid;
- + ObjectGuid guid;
- MovementInfo mi;
- - recv_data >> old_mover_guid.ReadAsPacked();
- + recv_data >> guid.ReadAsPacked();
- recv_data >> mi;
- - if(_player->GetMover()->GetObjectGuid() == old_mover_guid)
- - {
- - sLog.outError("HandleMoveNotActiveMover: incorrect mover guid: mover is %s and should be %s instead of %s",
- - _player->GetMover()->GetGuidStr().c_str(),
- - _player->GetGuidStr().c_str(),
- - old_mover_guid.GetString().c_str());
- - recv_data.rpos(recv_data.wpos()); // prevent warnings spam
- - return;
- - }
- -
- - _player->m_movementInfo = mi;
- + GetPlayer()->m_movementInfo = mi;
- }
- void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
- @@ -386,18 +379,171 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
- recv_data >> guid.ReadAsPacked();
- recv_data >> mi;
- - ObjectGuid vehicleGUID = _player->GetCharmGuid();
- + ObjectGuid vehicleGUID = _player->GetVehicleGUID();
- if (vehicleGUID.IsEmpty()) // something wrong here...
- return;
- _player->m_movementInfo = mi;
- - // using charm guid, because we don't have vehicle guid...
- - if(Vehicle *vehicle = _player->GetMap()->GetVehicle(vehicleGUID))
- + if(Vehicle *vehicle = ObjectAccessor::GetVehicle(vehicleGUID))
- + {
- + if(vehicle->GetVehicleFlags() & VF_DESPAWN_AT_LEAVE)
- + vehicle->Dismiss();
- + else
- + _player->ExitVehicle();
- + }
- +}
- +
- +void WorldSession::HandleRequestVehicleExit(WorldPacket &recv_data)
- +{
- + sLog.outDebug("WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT");
- + recv_data.hexlike();
- +
- + GetPlayer()->ExitVehicle();
- +}
- +
- +void WorldSession::HandleRequestVehiclePrevSeat(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Recvd CMSG_REQUEST_VEHICLE_PREV_SEAT");
- + recv_data.hexlike();
- +
- + GetPlayer()->ChangeSeat(-1, false);
- +}
- +
- +void WorldSession::HandleRequestVehicleNextSeat(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Recvd CMSG_REQUEST_VEHICLE_NEXT_SEAT");
- + recv_data.hexlike();
- +
- + GetPlayer()->ChangeSeat(-1, true);
- +}
- +
- +void WorldSession::HandleRequestVehicleSwitchSeat(WorldPacket &recv_data)
- +{
- + sLog.outDebug("WORLD: Recvd CMSG_REQUEST_VEHICLE_SWITCH_SEAT");
- + recv_data.hexlike();
- +
- + uint64 vehicleGUID = _player->GetVehicleGUID();
- +
- + if(!vehicleGUID) // something wrong here...
- + return;
- +
- + if(Vehicle *vehicle = ObjectAccessor::GetVehicle(vehicleGUID))
- {
- - // Aura::HandleAuraControlVehicle will call Player::ExitVehicle
- - vehicle->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
- + ObjectGuid guid;
- + recv_data >> guid.ReadAsPacked();
- +
- + int8 seatId = 0;
- + recv_data >> seatId;
- +
- + if(!guid.IsEmpty())
- + {
- + if(vehicleGUID != guid.GetRawValue())
- + {
- + if(Vehicle *veh = ObjectAccessor::GetVehicle(guid.GetRawValue()))
- + {
- + if(!_player->IsWithinDistInMap(veh, 10))
- + return;
- +
- + if(Vehicle *v = veh->FindFreeSeat(&seatId, false))
- + {
- + vehicle->RemovePassenger(_player);
- + _player->EnterVehicle(v, seatId, false);
- + }
- + }
- + return;
- + }
- + }
- + if(Vehicle *v = vehicle->FindFreeSeat(&seatId, false))
- + {
- + vehicle->RemovePassenger(_player);
- + _player->EnterVehicle(v, seatId, false);
- + }
- + }
- +}
- +
- +void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
- +{
- + sLog.outDebug("WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE");
- + recv_data.hexlike();
- +
- + uint64 vehicleGUID = _player->GetVehicleGUID();
- +
- + if(!vehicleGUID) // something wrong here...
- + return;
- +
- + if(recv_data.GetOpcode() == CMSG_REQUEST_VEHICLE_PREV_SEAT)
- + {
- + _player->ChangeSeat(-1, false);
- + return;
- + }
- + else if(recv_data.GetOpcode() == CMSG_REQUEST_VEHICLE_NEXT_SEAT)
- + {
- + _player->ChangeSeat(-1, true);
- + return;
- + }
- +
- + ObjectGuid guid, guid2;
- + recv_data >> guid.ReadAsPacked();
- +
- + MovementInfo mi;
- + recv_data >> mi;
- + _player->m_movementInfo = mi;
- +
- + recv_data >> guid2.ReadAsPacked(); //guid of vehicle or of vehicle in target seat
- +
- + int8 seatId;
- + recv_data >> seatId;
- +
- + if(guid.GetRawValue() == guid2.GetRawValue())
- + _player->ChangeSeat(seatId, false);
- + else if(Vehicle *vehicle = ObjectAccessor::GetVehicle(guid2.GetRawValue()))
- + {
- + if(vehicle->HasEmptySeat(seatId))
- + {
- + _player->ExitVehicle();
- + _player->EnterVehicle(vehicle, seatId);
- + }
- + }
- +}
- +
- +void WorldSession::HandleEnterPlayerVehicle(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Recvd CMSG_PLAYER_VEHICLE_ENTER");
- + recv_data.hexlike();
- +
- + ObjectGuid guid;
- + recv_data >> guid;
- +
- + if (Player* pl = ObjectAccessor::FindPlayer(guid))
- + {
- + if (!pl->GetVehicleKit())
- + return;
- + if (!pl->IsInSameRaidWith(GetPlayer()))
- + return;
- + if (!pl->IsWithinDistInMap(GetPlayer(), INTERACTION_DISTANCE))
- + return;
- + if (pl->GetTransport())
- + return;
- + GetPlayer()->EnterVehicle(pl->GetVehicleKit());
- + }
- +}
- +
- +void WorldSession::HandleEjectPasenger(WorldPacket &recv_data)
- +{
- + DEBUG_LOG("WORLD: Recvd CMSG_EJECT_PASSENGER");
- + recv_data.hexlike();
- +
- + if(recv_data.GetOpcode()==CMSG_EJECT_PASSENGER)
- + {
- + if (GetPlayer()->GetVehicleKit())
- + {
- + ObjectGuid guid;
- + recv_data >> guid;
- + if(Player* Pl = ObjectAccessor::FindPlayer(guid))
- + Pl->ExitVehicle();
- + }
- }
- }
- @@ -489,13 +635,21 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data)
- bool WorldSession::VerifyMovementInfo(MovementInfo const& movementInfo, ObjectGuid const& guid) const
- {
- // ignore wrong guid (player attempt cheating own session for not own guid possible...)
- - if (guid != _player->GetMover()->GetObjectGuid())
- + Unit *mover = _player->GetMover();
- + if (guid != _player->GetMover()->GetObjectGuid())
- return false;
- if (!MaNGOS::IsValidMapCoord(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o))
- return false;
- - if (movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT))
- + if((movementInfo.HasMovementFlag (MOVEFLAG_ONTRANSPORT)) && (movementInfo.HasMovementFlag (MOVEFLAG_ROOT)))
- + {
- + if(mover->GetVehicle() && mover->GetVehicleGUID() && mover->GetTypeId()==TYPEID_PLAYER)
- + {
- + _player->ExitVehicle();
- + }
- + }
- + else if (movementInfo.HasMovementFlag (MOVEFLAG_ONTRANSPORT) && !mover->GetVehicle() && !mover->GetVehicleGUID())
- {
- // transports size limited
- // (also received at zeppelin/lift leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
- @@ -531,6 +685,9 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
- {
- plMover->m_transport = (*iter);
- (*iter)->AddPassenger(plMover);
- +
- + if (plMover->GetVehicleKit())
- + plMover->GetVehicleKit()->RemoveAllPassengers();
- break;
- }
- }
- @@ -549,6 +706,18 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
- plMover->SetInWater( !plMover->IsInWater() || plMover->GetTerrain()->IsUnderWater(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z) );
- }
- + if (movementInfo.HasMovementFlag(MOVEFLAG_SWIMMING))
- + {
- + if(mover->GetTypeId() == TYPEID_UNIT)
- + {
- + if(((Creature*)mover)->IsVehicle() && !((Creature*)mover)->CanSwim())
- + {
- + // NOTE : we should enter evade mode here, but...
- + ((Vehicle*)mover)->SetSpawnDuration(1);
- + }
- + }
- + }
- +
- plMover->SetPosition(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o);
- plMover->m_movementInfo = movementInfo;
- @@ -586,6 +755,10 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
- else // creature charmed
- {
- if (mover->IsInWorld())
- + {
- mover->GetMap()->CreatureRelocation((Creature*)mover, movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o);
- + if(((Creature*)mover)->IsVehicle())
- + ((Vehicle*)mover)->RellocatePassengers(mover->GetMap());
- + }
- }
- }
- diff --git a/src/game/Object.cpp b/src/game/Object.cpp
- index c334551..da1f69e 100644
- --- a/src/game/Object.cpp
- +++ b/src/game/Object.cpp
- @@ -270,13 +270,16 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
- }
- }
- }
- + if (unit->GetVehicle() || unit->GetVehicleGUID())
- + unit->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
- +
- }
- break;
- case TYPEID_PLAYER:
- {
- Player *player = ((Player*)unit);
- - if(player->GetTransport())
- + if(player->GetTransport() || player->GetVehicle())
- player->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
- else
- player->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
- @@ -284,6 +287,9 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
- // remove unknown, unused etc flags for now
- player->m_movementInfo.RemoveMovementFlag(MOVEFLAG_SPLINE_ENABLED);
- + if(((Unit*)this)->GetVehicleGUID())
- + player->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
- +
- if(player->IsTaxiFlying())
- {
- MANGOS_ASSERT(player->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
- @@ -1145,7 +1151,14 @@ void WorldObject::Relocate(float x, float y, float z, float orientation)
- m_orientation = orientation;
- if(isType(TYPEMASK_UNIT))
- + {
- ((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, orientation);
- + if(GetTypeId() == TYPEID_UNIT)
- + {
- + if(((Creature*)this)->IsVehicle() && IsInWorld())
- + ((Vehicle*)this)->RellocatePassengers(GetMap());
- + }
- + }
- }
- void WorldObject::Relocate(float x, float y, float z)
- @@ -1155,7 +1168,11 @@ void WorldObject::Relocate(float x, float y, float z)
- m_positionZ = z;
- if(isType(TYPEMASK_UNIT))
- + {
- ((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, GetOrientation());
- + if(((Creature*)this)->IsVehicle() && IsInWorld())
- + ((Vehicle*)this)->RellocatePassengers(GetMap());
- + }
- }
- void WorldObject::SetOrientation(float orientation)
- @@ -1770,6 +1787,42 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
- return pCreature;
- }
- +Vehicle* WorldObject::SummonVehicle(uint32 id, float x, float y, float z, float ang, uint32 vehicleId)
- +{
- + Vehicle *v = new Vehicle;
- +
- + Map *map = GetMap();
- + Team team = TEAM_NONE;
- + if (GetTypeId()==TYPEID_PLAYER)
- + team = ((Player*)this)->GetTeam();
- +
- + if(!v->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, GetPhaseMask(), id, vehicleId, team))
- + {
- + delete v;
- + return NULL;
- + }
- +
- + if (x == 0.0f && y == 0.0f && z == 0.0f)
- + GetClosePoint(x, y, z, v->GetObjectBoundingRadius());
- +
- + v->Relocate(x, y, z, ang);
- +
- + if(!v->IsPositionValid())
- + {
- + sLog.outError("ERROR: Vehicle (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
- + v->GetGUIDLow(), v->GetEntry(), v->GetPositionX(), v->GetPositionY());
- + delete v;
- + return NULL;
- + }
- + map->Add((Creature*)v);
- + v->AIM_Initialize();
- +
- + if(GetTypeId()==TYPEID_UNIT && ((Creature*)this)->AI())
- + ((Creature*)this)->AI()->JustSummoned((Creature*)v);
- +
- + return v;
- +}
- +
- namespace MaNGOS
- {
- class NearUsedPosDo
- diff --git a/src/game/Object.h b/src/game/Object.h
- index 84df5f4..b1fb271 100644
- --- a/src/game/Object.h
- +++ b/src/game/Object.h
- @@ -70,6 +70,7 @@ class Map;
- class UpdateMask;
- class InstanceData;
- class TerrainInfo;
- +class Vehicle;
- typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType;
- @@ -493,6 +494,9 @@ class MANGOS_DLL_SPEC WorldObject : public Object
- bool isActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); }
- ViewPoint& GetViewPoint() { return m_viewPoint; }
- +
- + Vehicle* SummonVehicle(uint32 id, float x, float y, float z, float ang, uint32 vehicleId = NULL);
- +
- protected:
- explicit WorldObject();
- diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
- index 56176ae..ae27f87 100644
- --- a/src/game/ObjectAccessor.cpp
- +++ b/src/game/ObjectAccessor.cpp
- @@ -52,6 +52,21 @@ ObjectAccessor::~ObjectAccessor()
- }
- }
- +Creature*
- +ObjectAccessor::GetAnyTypeCreature(WorldObject const &u, ObjectGuid guid)
- +{
- + if(guid.IsPlayer() || !u.IsInWorld())
- + return NULL;
- +
- + if(guid.IsPet())
- + return u.GetMap()->GetPet(guid);
- +
- + if(guid.IsVehicle())
- + return u.GetMap()->GetVehicle(guid);
- +
- + return u.GetMap()->GetCreature(guid);
- +}
- +
- Unit*
- ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid)
- {
- @@ -61,10 +76,7 @@ ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid)
- if(guid.IsPlayer())
- return FindPlayer(guid);
- - if (!u.IsInWorld())
- - return NULL;
- -
- - return u.GetMap()->GetAnyTypeCreature(guid);
- + return GetAnyTypeCreature(u, guid);
- }
- Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
- diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h
- index 5b9445f..c28d41c 100644
- --- a/src/game/ObjectAccessor.h
- +++ b/src/game/ObjectAccessor.h
- @@ -40,6 +40,7 @@
- class Creature;
- class Unit;
- class GameObject;
- +class Vehicle;
- class WorldObject;
- class Map;
- @@ -100,13 +101,21 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
- // global (obj used for map only location local guid objects (pets currently)
- static Unit* GetUnitInWorld(WorldObject const& obj, ObjectGuid guid);
- - // FIXME: map local object with global search
- + // map local object with global search
- static Creature* GetCreatureInWorld(ObjectGuid guid) { return FindHelper<Creature>(guid); }
- static GameObject* GetGameObjectInWorld(ObjectGuid guid) { return FindHelper<GameObject>(guid); }
- + static Pet* GetGameObjectInWorld(ObjectGuid guid, Pet* /*fake*/) { return FindHelper<Pet>(guid); }
- + static Vehicle* GetGameObjectInWorld(ObjectGuid guid, Vehicle* /*fake*/) { return FindHelper<Vehicle>(guid); }
- // Search player at any map in world and other objects at same map with `obj`
- // Note: recommended use Map::GetUnit version if player also expected at same map only
- static Unit* GetUnit(WorldObject const& obj, ObjectGuid guid);
- + static Creature* GetAnyTypeCreature(WorldObject const &, ObjectGuid guid);
- + //static Player* GetPlayer(Unit const &, uint64 guid) { return FindPlayer(guid); }
- + //static Corpse* GetCorpse(WorldObject const &u, uint64 guid);
- + //static Pet* GetPet(uint64 guid) { return GetObjectInWorld(guid, (Pet*)NULL); }
- + static Vehicle* GetVehicle(ObjectGuid guid) { return GetGameObjectInWorld(guid, (Vehicle*)NULL); }
- + //static Player* FindPlayer(uint64);
- // Player access
- static Player* FindPlayer(ObjectGuid guid); // if need player at specific map better use Map::GetPlayer
- @@ -175,6 +184,9 @@ inline Unit* ObjectAccessor::GetUnitInWorld(WorldObject const& obj, ObjectGuid g
- if (guid.IsPet())
- return obj.IsInWorld() ? obj.GetMap()->GetPet(guid) : NULL;
- + if (guid.IsVehicle())
- + return obj.IsInWorld() ? ((Unit*)obj.GetMap()->GetVehicle(guid)) : NULL;
- +
- return GetCreatureInWorld(guid);
- }
- diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
- index 462c673..9f5091e 100644
- --- a/src/game/ObjectMgr.cpp
- +++ b/src/game/ObjectMgr.cpp
- @@ -830,6 +830,93 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
- endAura.effect_idx = EFFECT_INDEX_0;
- }
- +void ObjectMgr::ConvertCreatureAddonPassengers(CreatureDataAddon* addon, char const* table, char const* guidEntryStr)
- +{
- + // Now add the passengers, format "creature_entry/guid seatindex creature_entry/guid seatindex..."
- + char *p,*s;
- + std::vector<int> val;
- + s=p=(char*)reinterpret_cast<char const*>(addon->passengers);
- + if(p)
- + {
- + while (p[0]!=0)
- + {
- + ++p;
- + if (p[0]==' ')
- + {
- + val.push_back(atoi(s));
- + s=++p;
- + }
- + }
- + if (p!=s)
- + val.push_back(atoi(s));
- +
- + // free char* loaded memory
- + delete[] (char*)reinterpret_cast<char const*>(addon->passengers);
- +
- + // wrong list
- + if (val.size()%2)
- + {
- + addon->auras = NULL;
- + sLog.outErrorDb("Creature (%s: %u) has wrong `passengers` data in `%s`.",guidEntryStr,addon->guidOrEntry,table);
- + return;
- + }
- + }
- +
- + // empty list
- + if(val.empty())
- + {
- + addon->passengers = NULL;
- + return;
- + }
- +
- + // replace by new structures array
- + const_cast<CreatureDataAddonPassengers*&>(addon->passengers) = new CreatureDataAddonPassengers[val.size()/2+1];
- +
- + uint32 i=0;
- + for(uint32 j=0; j<val.size()/2; ++j)
- + {
- + CreatureDataAddonPassengers& cPas = const_cast<CreatureDataAddonPassengers&>(addon->passengers[i]);
- + if(guidEntryStr == "Entry")
- + cPas.entry = (uint32)val[2*j+0];
- + else
- + cPas.guid = (uint32)val[2*j+0];
- + cPas.seat_idx = (int8)val[2*j+1];
- + if ( cPas.seat_idx > 7 )
- + {
- + sLog.outErrorDb("Creature (%s: %u) has wrong seat %u for creature %u in `passengers` field in `%s`.",guidEntryStr,addon->guidOrEntry,cPas.seat_idx,cPas.entry,table);
- + continue;
- + }
- + if(cPas.entry == 0 && cPas.guid == 0)
- + {
- + sLog.outErrorDb("Creature (%s: %u) has NULL creature entry/guid in `passengers` field in `%s`.",guidEntryStr,addon->guidOrEntry,table);
- + continue;
- + }
- + if(cPas.entry > 0)
- + {
- + if(!sCreatureStorage.LookupEntry<CreatureInfo>(cPas.entry))
- + {
- + sLog.outErrorDb("Creature (%s: %u) has wrong creature entry/guid %u `passengers` field in `%s`.",guidEntryStr,addon->guidOrEntry,cPas.entry,table);
- + continue;
- + }
- + }
- + else
- + {
- + if(mCreatureDataMap.find(cPas.guid)==mCreatureDataMap.end())
- + {
- + sLog.outErrorDb("Creature (%s: %u) has wrong creature entry/guid %u `passengers` field in `%s`.",guidEntryStr,addon->guidOrEntry,cPas.guid,table);
- + continue;
- + }
- + }
- + ++i;
- + }
- +
- + // fill terminator element (after last added)
- + CreatureDataAddonPassengers& endPassenger = const_cast<CreatureDataAddonPassengers&>(addon->passengers[i]);
- + endPassenger.entry = 0;
- + endPassenger.guid = 0;
- + endPassenger.seat_idx = -1;
- +}
- +
- void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment)
- {
- creatureaddons.Load();
- @@ -866,6 +953,7 @@ void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entry
- }
- ConvertCreatureAddonAuras(const_cast<CreatureDataAddon*>(addon), creatureaddons.GetTableName(), entryName);
- + ConvertCreatureAddonPassengers(const_cast<CreatureDataAddon*>(addon), creatureaddons.GetTableName(), entryName);
- }
- }
- @@ -6420,6 +6508,8 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
- return m_ItemGuids.Generate();
- case HIGHGUID_UNIT:
- return m_CreatureGuids.Generate();
- + case HIGHGUID_VEHICLE:
- + return m_VehicleGuids.Generate();
- case HIGHGUID_PLAYER:
- return m_CharGuids.Generate();
- case HIGHGUID_GAMEOBJECT:
- @@ -9656,6 +9746,126 @@ CreatureInfo const* GetCreatureTemplateStore(uint32 entry)
- return sCreatureStorage.LookupEntry<CreatureInfo>(entry);
- }
- +void ObjectMgr::LoadVehicleData()
- +{
- + mVehicleData.clear();
- +
- + QueryResult *result = WorldDatabase.Query("SELECT entry, flags, Spell1, Spell2, Spell3, Spell4, Spell5, Spell6, Spell7, Spell8, Spell9, Spell10, req_aura FROM vehicle_data");
- + if(!result)
- + {
- + barGoLink bar( 1 );
- + bar.step();
- +
- + sLog.outString();
- + sLog.outString( ">> Loaded 0 vehicle data" );
- + sLog.outErrorDb("`vehicle_data` table is empty!");
- + return;
- + }
- +
- + uint32 count = 0;
- +
- + barGoLink bar( result->GetRowCount() );
- + do
- + {
- + bar.step();
- +
- + Field* fields = result->Fetch();
- +
- + VehicleDataStructure VDS;
- + // NOTE : we can use spellid or creature id
- + uint32 v_entry = fields[0].GetUInt32();
- + VDS.v_flags = fields[1].GetUInt32();
- + for(uint8 j = 0; j < MAX_VEHICLE_SPELLS; j++)
- + {
- + VDS.v_spells[j] = fields[j+2].GetUInt32();
- + }
- + VDS.req_aura = fields[12].GetUInt32();
- +
- + VehicleEntry const *vehicleInfo = sVehicleStore.LookupEntry(v_entry);
- + if(!vehicleInfo)
- + {
- + sLog.outErrorDb("Vehicle id %u listed in `vehicle_data` does not exist",v_entry);
- + continue;
- + }
- + for(uint8 j = 0; j < MAX_VEHICLE_SPELLS; j++)
- + {
- + if(VDS.v_spells[j])
- + {
- + SpellEntry const* j_spell = sSpellStore.LookupEntry(VDS.v_spells[j]);
- + if(!j_spell)
- + {
- + sLog.outErrorDb("Spell %u listed in `vehicle_data` does not exist, skipped",VDS.v_spells[j]);
- + VDS.v_spells[j] = 0;
- + }
- + }
- + }
- + if(VDS.req_aura)
- + {
- + SpellEntry const* i_spell = sSpellStore.LookupEntry(VDS.req_aura);
- + if(!i_spell)
- + {
- + sLog.outErrorDb("Spell %u listed in `vehicle_data` does not exist, skipped",VDS.req_aura);
- + VDS.req_aura = 0;
- + }
- + }
- +
- + mVehicleData[v_entry] = VDS;
- + ++count;
- + }
- + while (result->NextRow());
- +
- + delete result;
- +
- + sLog.outString();
- + sLog.outString( ">> Loaded %u vehicle data", count );
- +}
- +
- +void ObjectMgr::LoadVehicleSeatData()
- +{
- + mVehicleSeatData.clear();
- +
- + QueryResult *result = WorldDatabase.Query("SELECT seat,flags FROM vehicle_seat_data");
- +
- + if( !result )
- + {
- + barGoLink bar( 1 );
- +
- + bar.step();
- +
- + sLog.outString();
- + sLog.outString( ">> Loaded 0 vehicle seat data" );
- + sLog.outErrorDb("`vehicle_seat_data` table is empty!");
- + return;
- + }
- + uint32 count = 0;
- +
- + barGoLink bar( result->GetRowCount() );
- + do
- + {
- + bar.step();
- +
- + Field *fields = result->Fetch();
- + uint32 entry = fields[0].GetUInt32();
- + uint32 flag = fields[1].GetUInt32();
- +
- + VehicleSeatEntry const *vsInfo = sVehicleSeatStore.LookupEntry(entry);
- + if(!vsInfo)
- + {
- + sLog.outErrorDb("Vehicle seat %u listed in `vehicle_seat_data` does not exist",entry);
- + continue;
- + }
- +
- + mVehicleSeatData[entry] = flag;
- + ++count;
- + }
- + while (result->NextRow());
- +
- + delete result;
- +
- + sLog.outString();
- + sLog.outString( ">> Loaded %u vehicle seat data", count );
- +}
- +
- Quest const* GetQuestTemplateStore(uint32 entry)
- {
- return sObjectMgr.GetQuestTemplate(entry);
- diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
- index ab56405..da2cbd6 100644
- --- a/src/game/ObjectMgr.h
- +++ b/src/game/ObjectMgr.h
- @@ -675,6 +675,8 @@ extern LanguageDesc lang_description[LANGUAGES_COUNT];
- MANGOS_DLL_SPEC LanguageDesc const* GetLanguageDescByID(uint32 lang);
- class PlayerDumpReader;
- +// vehicle system
- +#define MAX_VEHICLE_SPELLS 6
- template<typename T>
- class IdGenerator
- @@ -694,6 +696,16 @@ class IdGenerator
- T m_nextGuid;
- };
- +struct VehicleDataStructure
- +{
- + uint32 v_flags; // vehicle flags, see enum CustomVehicleFLags
- + uint32 v_spells[MAX_VEHICLE_SPELLS]; // spells
- + uint32 req_aura; // requieres aura on player to enter (eg. in wintergrasp)
- +};
- +
- +typedef UNORDERED_MAP<uint32, VehicleDataStructure> VehicleDataMap;
- +typedef std::map<uint32,uint32> VehicleSeatDataMap;
- +
- class ObjectMgr
- {
- friend class PlayerDumpReader;
- @@ -984,6 +996,9 @@ class ObjectMgr
- void LoadVendors() { LoadVendors("npc_vendor", false); }
- void LoadTrainerSpell();
- + void LoadVehicleData();
- + void LoadVehicleSeatData();
- +
- std::string GeneratePetName(uint32 entry);
- uint32 GetBaseXP(uint32 level) const;
- uint32 GetXPForLevel(uint32 level) const;
- @@ -1248,6 +1263,24 @@ class ObjectMgr
- int GetOrNewIndexForLocale(LocaleConstant loc);
- + VehicleDataMap mVehicleData;
- + VehicleSeatDataMap mVehicleSeatData;
- +
- + uint32 GetSeatFlags(uint32 seatid)
- + {
- + VehicleSeatDataMap::iterator i = mVehicleSeatData.find(seatid);
- + if(i == mVehicleSeatData.end())
- + return NULL;
- + else
- + return i->second;
- + }
- + VehicleDataStructure const* GetVehicleData(uint32 entry) const
- + {
- + VehicleDataMap::const_iterator itr = mVehicleData.find(entry);
- + if(itr==mVehicleData.end()) return NULL;
- + return &itr->second;
- + }
- +
- SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
- {
- return mSpellClickInfoMap.equal_range(creature_id);
- @@ -1324,6 +1357,7 @@ class ObjectMgr
- ObjectGuidGenerator<HIGHGUID_GAMEOBJECT> m_GameobjectGuids;
- ObjectGuidGenerator<HIGHGUID_CORPSE> m_CorpseGuids;
- ObjectGuidGenerator<HIGHGUID_INSTANCE> m_InstanceGuids;
- + ObjectGuidGenerator<HIGHGUID_VEHICLE> m_VehicleGuids;
- QuestMap mQuestTemplates;
- @@ -1392,6 +1426,7 @@ class ObjectMgr
- void CheckScriptTexts(ScriptMapMap const& scripts,std::set<int32>& ids);
- void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment);
- void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr);
- + void ConvertCreatureAddonPassengers(CreatureDataAddon* addon, char const* table, char const* guidEntryStr);
- void LoadQuestRelationsHelper(QuestRelationsMap& map, char const* table);
- void LoadVendors(char const* tableName, bool isTemplates);
- diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
- index 4f0fbe0..647f38d 100644
- --- a/src/game/Opcodes.cpp
- +++ b/src/game/Opcodes.cpp
- @@ -1168,10 +1168,10 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
- /*0x473*/ { "CMSG_CHAR_CUSTOMIZE", STATUS_AUTHED, &WorldSession::HandleCharCustomizeOpcode },
- /*0x474*/ { "SMSG_CHAR_CUSTOMIZE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x475*/ { "SMSG_PET_RENAMEABLE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- - /*0x476*/ { "CMSG_REQUEST_VEHICLE_EXIT", STATUS_NEVER, &WorldSession::Handle_NULL },
- - /*0x477*/ { "CMSG_REQUEST_VEHICLE_PREV_SEAT", STATUS_NEVER, &WorldSession::Handle_NULL },
- - /*0x478*/ { "CMSG_REQUEST_VEHICLE_NEXT_SEAT", STATUS_NEVER, &WorldSession::Handle_NULL },
- - /*0x479*/ { "CMSG_REQUEST_VEHICLE_SWITCH_SEAT", STATUS_NEVER, &WorldSession::Handle_NULL },
- + /*0x476*/ { "CMSG_REQUEST_VEHICLE_EXIT", STATUS_LOGGEDIN, &WorldSession::HandleRequestVehicleExit },
- + /*0x477*/ { "CMSG_REQUEST_VEHICLE_PREV_SEAT", STATUS_LOGGEDIN, &WorldSession::HandleRequestVehiclePrevSeat },
- + /*0x478*/ { "CMSG_REQUEST_VEHICLE_NEXT_SEAT", STATUS_LOGGEDIN, &WorldSession::HandleRequestVehicleNextSeat },
- + /*0x479*/ { "CMSG_REQUEST_VEHICLE_SWITCH_SEAT", STATUS_LOGGEDIN, &WorldSession::HandleRequestVehicleSwitchSeat },
- /*0x47A*/ { "CMSG_PET_LEARN_TALENT", STATUS_LOGGEDIN, &WorldSession::HandlePetLearnTalent },
- /*0x47B*/ { "CMSG_PET_UNLEARN_TALENTS", STATUS_NEVER, &WorldSession::Handle_NULL },
- /*0x47C*/ { "SMSG_SET_PHASE_SHIFT", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- @@ -1205,7 +1205,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
- /*0x498*/ { "SMSG_SERVER_FIRST_ACHIEVEMENT", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x499*/ { "SMSG_PET_LEARNED_SPELL", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x49A*/ { "SMSG_PET_REMOVED_SPELL", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- - /*0x49B*/ { "CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE", STATUS_NEVER, &WorldSession::Handle_NULL },
- + /*0x49B*/ { "CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE", STATUS_LOGGEDIN, &WorldSession::HandleChangeSeatsOnControlledVehicle},
- /*0x49C*/ { "CMSG_HEARTH_AND_RESURRECT", STATUS_LOGGEDIN, &WorldSession::HandleHearthandResurrect },
- /*0x49D*/ { "SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x49E*/ { "SMSG_CRITERIA_DELETED", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- @@ -1218,8 +1218,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
- /*0x4A5*/ { "UMSG_UNKNOWN_1189", STATUS_NEVER, &WorldSession::Handle_NULL },
- /*0x4A6*/ { "SMSG_BATTLEGROUND_INFO_THROTTLED", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x4A7*/ { "SMSG_PLAYER_VEHICLE_DATA", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- - /*0x4A8*/ { "CMSG_UNKNOWN_1192", STATUS_NEVER, &WorldSession::Handle_NULL },
- - /*0x4A9*/ { "CMSG_EJECT_PASSENGER", STATUS_NEVER, &WorldSession::Handle_NULL },
- + /*0x4A8*/ { "CMSG_PLAYER_VEHICLE_ENTER", STATUS_LOGGEDIN, &WorldSession::HandleEnterPlayerVehicle },
- + /*0x4A9*/ { "CMSG_EJECT_PASSENGER", STATUS_LOGGEDIN, &WorldSession::HandleEjectPasenger },
- /*0x4AA*/ { "SMSG_PET_GUIDS", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x4AB*/ { "SMSG_CLIENTCACHE_VERSION", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x4AC*/ { "UMSG_UNKNOWN_1196", STATUS_NEVER, &WorldSession::Handle_NULL },
- diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
- index 4c7410d..37d8db4 100644
- --- a/src/game/Pet.cpp
- +++ b/src/game/Pet.cpp
- @@ -32,7 +32,7 @@ Pet::Pet(PetType type) :
- Creature(CREATURE_SUBTYPE_PET),
- m_resetTalentsCost(0), m_resetTalentsTime(0), m_usedTalentCount(0),
- m_removed(false), m_happinessTimer(7500), m_petType(type), m_duration(0),
- -m_bonusdamage(0), m_auraUpdateMask(0), m_loading(false),
- +m_bonusdamage(0), m_loading(false),
- m_declinedname(NULL), m_petModeFlags(PET_MODE_DEFAULT)
- {
- m_name = "Pet";
- diff --git a/src/game/Pet.h b/src/game/Pet.h
- index 620791d..92ae7b5 100644
- --- a/src/game/Pet.h
- +++ b/src/game/Pet.h
- @@ -237,10 +237,6 @@ class Pet : public Creature
- time_t m_resetTalentsTime;
- uint32 m_usedTalentCount;
- - const uint64& GetAuraUpdateMask() const { return m_auraUpdateMask; }
- - void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); }
- - void ResetAuraUpdateMask() { m_auraUpdateMask = 0; }
- -
- // overwrite Creature function for name localization back to WorldObject version without localization
- const char* GetNameForLocaleIdx(int32 locale_idx) const { return WorldObject::GetNameForLocaleIdx(locale_idx); }
- @@ -252,7 +248,6 @@ class Pet : public Creature
- PetType m_petType;
- int32 m_duration; // time until unsummon (used mostly for summoned guardians and not used for controlled pets)
- int32 m_bonusdamage;
- - uint64 m_auraUpdateMask;
- bool m_loading;
- DeclinedName *m_declinedname;
- diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
- index f1ce925..3d65220 100644
- --- a/src/game/PetHandler.cpp
- +++ b/src/game/PetHandler.cpp
- @@ -313,7 +313,7 @@ void WorldSession::HandlePetNameQueryOpcode( WorldPacket & recv_data )
- void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
- {
- - Creature* pet = _player->GetMap()->GetAnyTypeCreature(petguid);
- + Creature* pet = ObjectAccessor::GetAnyTypeCreature(*_player, petguid);
- if(!pet || !pet->GetCharmInfo() || pet->GetCharmInfo()->GetPetNumber() != petnumber)
- {
- WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+1+4+1));
- @@ -353,7 +353,12 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
- recv_data >> petguid;
- - Creature* pet = _player->GetMap()->GetAnyTypeCreature(petguid);
- + // FIXME: charmed case
- + //Pet* pet = ObjectAccessor::Instance().GetPet(petguid);
- + if(ObjectAccessor::FindPlayer(petguid))
- + return;
- +
- + Creature* pet = ObjectAccessor::GetAnyTypeCreature(*_player, petguid);
- if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
- {
- @@ -542,7 +547,8 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
- return;
- // pet/charmed
- - if (Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid))
- + Creature* pet = ObjectAccessor::GetAnyTypeCreature(*_player, guid);
- + if (pet)
- {
- if (pet->IsPet())
- {
- @@ -596,7 +602,10 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
- uint8 state; //1 for on, 0 for off
- recvPacket >> guid >> spellid >> state;
- - Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
- + if(ObjectAccessor::FindPlayer(guid))
- + return;
- +
- + Creature* pet=ObjectAccessor::GetAnyTypeCreature(*_player,guid);
- if (!pet || (guid != _player->GetPetGuid() && guid != _player->GetCharmGuid()))
- {
- sLog.outError("HandlePetSpellAutocastOpcode. %s isn't pet of %s .", guid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
- @@ -626,6 +635,23 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
- void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
- {
- DETAIL_LOG("WORLD: CMSG_PET_CAST_SPELL");
- + recvPacket.hexlike();
- + recvPacket.print_storage();
- +
- + //2 - 0 - 0 - 43 - 129 - 0 - 80 - 241 | - 42 - 211 - 253 - 0 | - 0 | - 2 |- 96 - 0 - 0 - 0 | - 0 - 26
- + //- 164 - 59 - 196 - 174 - 98 - 131 | - 194 - 182 - 171 - 218| - 67 - 0 - 48 - 93| - 0 - 196 - 32
- + //- 177| - 242 - 193 - 22 - 110 - 224 - 67 - 203 - 166 | - 68 - 61 - 133 - 1| - 240 - 66 - 1 - 183 |
- + //- 0 - 0 - 0 - 217| - 2 - 43 - 129 - 80 - 241 - 0 - 10 - 0 - 0 - 0 - 0 - 76 - 109 - 175 - 0
- + //- 238 - 115 - 58 - 196 - 20 - 110 - 121 - 194 - 187 - 107 - 217 - 67 - 32 - 44 - 27 - 62 - 217
- + //- 1 - 36 - 129 - 80 - 241 - 0 - 0 - 160 - 64 - 0 - 0 - 160 - 64 - 0 - 0 - 160 - 64 - 192 - 233
- + //- 172 - 62 - 4 - 0 - 0 - 0 - 7 - 230 - 0 - 0 - 0 -
- +
- + //5 - 0 - 0 - 43 - 129 - 0 - 80 - 241 | - 85 - 211 - 253 - 0 | - 0 | - 2 | - 96 - 0 - 0 - 0 | - 0 - 69 - 60 - 61
- + //- 196 - 171 - 248 - 107| - 194 - 8 - 236 - 218 | - 67 - 0 - 177 - 11 | - 46 - 196 - 89 - 16 | - 14 - 195
- + //- 5 - 38 - 231 - 67 - 23 - 221 | - 110 - 62 - 15 - 3 | - 240 - 66 -| 1 - 183 | - 0 - 0 - 0 - 217 | - 5 - 43
- + //- 129 - 80 - 241 - 0 - 10 - 0 - 0 - 0 - 0 - 233 - 41 - 203 - 0 - 106 - 207 - 59 - 196 - 179 - 173 - 83
- + //- 194 - 8 - 108 - 217 - 67 - 127 - 153 - 170 - 64 - 217 - 4 - 36 - 129 - 80 - 241 - 0 - 0 - 160 - 64
- + //- 0 - 0 - 160 - 64 - 0 - 0 - 160 - 64 - 7 - 77 - 175 - 64 - 4 - 0 - 0 - 0 - 7 - 195 - 0 - 0 - 0 -
- ObjectGuid guid;
- uint32 spellid;
- @@ -636,7 +662,10 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
- DEBUG_LOG("WORLD: CMSG_PET_CAST_SPELL, %s, cast_count: %u, spellid %u, unk_flags %u", guid.GetString().c_str(), cast_count, spellid, unk_flags);
- - Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
- + if (guid.IsPlayer())
- + return;
- +
- + Creature* pet = ObjectAccessor::GetAnyTypeCreature(*_player,guid);
- if (!pet || (guid != _player->GetPetGuid() && guid != _player->GetCharmGuid()))
- {
- diff --git a/src/game/Player.cpp b/src/game/Player.cpp
- index 444cf99..4626896 100644
- --- a/src/game/Player.cpp
- +++ b/src/game/Player.cpp
- @@ -459,7 +459,6 @@ Player::Player (WorldSession *session): Unit(), m_mover(this), m_camera(this), m
- // group is initialized in the reference constructor
- SetGroupInvite(NULL);
- m_groupUpdateMask = 0;
- - m_auraUpdateMask = 0;
- duel = NULL;
- @@ -1747,6 +1746,11 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
- m_movementInfo.ClearTransportData();
- }
- + if (GetVehicleKit())
- + GetVehicleKit()->RemoveAllPassengers();
- +
- + ExitVehicle();
- +
- // The player was ported to another map and looses the duel immediately.
- // We have to perform this check before the teleport, otherwise the
- // ObjectAccessor won't find the flag.
- @@ -2223,7 +2227,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
- return NULL;
- // exist (we need look pets also for some interaction (quest/etc)
- - Creature *unit = GetMap()->GetAnyTypeCreature(guid);
- + Creature *unit = ObjectAccessor::GetAnyTypeCreature(*this,guid);
- if (!unit)
- return NULL;
- @@ -3984,6 +3988,7 @@ void Player::InitVisibleBits()
- updateVisualBits.SetBit(PLAYER_BYTES_3);
- updateVisualBits.SetBit(PLAYER_DUEL_TEAM);
- updateVisualBits.SetBit(PLAYER_GUILD_TIMESTAMP);
- + updateVisualBits.SetBit(UNIT_NPC_FLAGS);
- // PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)...
- for(uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET)
- @@ -6012,7 +6017,9 @@ ActionButton const* Player::GetActionButton(uint8 button)
- bool Player::SetPosition(float x, float y, float z, float orientation, bool teleport)
- {
- - // prevent crash when a bad coord is sent by the client
- + if(!Unit::SetPosition(x, y, z, orientation, teleport))
- + return false;
- +
- if(!MaNGOS::IsValidMapCoord(x,y,z,orientation))
- {
- DEBUG_LOG("Player::SetPosition(%f, %f, %f, %f, %d) .. bad coordinates for player %d!",x,y,z,orientation,teleport,GetGUIDLow());
- @@ -8493,6 +8500,41 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
- break;
- case 3703: // Shattrath City
- break;
- + case 4384: // SA
- + /*if (bg && bg->GetTypeID() == BATTLEGROUND_SA)
- + bg->FillInitialWorldStates(data);
- + else
- + {*/
- + // 1-3 A defend, 4-6 H defend, 7-9 unk defend, 1 - ok, 2 - half destroyed, 3 - destroyed
- + data << uint32(0xf09) << uint32(0x4); // 7 3849 Gate of Temple
- + data << uint32(0xe36) << uint32(0x4); // 8 3638 Gate of Yellow Moon
- + data << uint32(0xe27) << uint32(0x4); // 9 3623 Gate of Green Emerald
- + data << uint32(0xe24) << uint32(0x4); // 10 3620 Gate of Blue Sapphire
- + data << uint32(0xe21) << uint32(0x4); // 11 3617 Gate of Red Sun
- + data << uint32(0xe1e) << uint32(0x4); // 12 3614 Gate of Purple Ametyst
- +
- + data << uint32(0xdf3) << uint32(0x0); // 13 3571 bonus timer (1 - on, 0 - off)
- + data << uint32(0xded) << uint32(0x0); // 14 3565
Advertisement
Add Comment
Please, Sign In to add comment