File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919#define TRINITYCORE_STRING_FORMAT_H
2020
2121#include " Optional.h"
22+ #include " StringFormatFwd.h"
2223#include < fmt/core.h>
2324
2425namespace Trinity
Original file line number Diff line number Diff line change 1+ /*
2+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3+ *
4+ * This program is free software; you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License as published by the
6+ * Free Software Foundation; either version 2 of the License, or (at your
7+ * option) any later version.
8+ *
9+ * This program is distributed in the hope that it will be useful, but WITHOUT
10+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12+ * more details.
13+ *
14+ * You should have received a copy of the GNU General Public License along
15+ * with this program. If not, see <http://www.gnu.org/licenses/>.
16+ */
17+
18+ #ifndef TRINITYCORE_STRING_FORMAT_FWD_H
19+ #define TRINITYCORE_STRING_FORMAT_FWD_H
20+
21+ #include < stdexcept>
22+
23+ namespace fmt
24+ {
25+ inline namespace v10
26+ {
27+ template <typename T, typename Char, typename Enable>
28+ struct formatter ;
29+ }
30+ }
31+
32+ namespace Trinity
33+ {
34+ struct NoArgFormatterBase
35+ {
36+ template <typename ParseContext>
37+ constexpr typename ParseContext::iterator parse (ParseContext& ctx)
38+ {
39+ auto begin = ctx.begin (), end = ctx.end ();
40+ if (begin == end)
41+ return begin;
42+
43+ if (*begin != ' }' )
44+ throw std::invalid_argument (" invalid type specifier" );
45+
46+ return begin;
47+ }
48+ };
49+ }
50+
51+ #endif // TRINITYCORE_STRING_FORMAT_FWD_H
Original file line number Diff line number Diff line change @@ -2034,12 +2034,23 @@ void GameObject::Use(Unit* user)
20342034
20352035 if (info->spellcaster .partyOnly )
20362036 {
2037- Unit* caster = GetOwner ();
2038- if (!caster || caster-> GetTypeId () != TYPEID_PLAYER )
2037+ ObjectGuid ownerGuid = GetOwnerGUID ();
2038+ if (ownerGuid. IsEmpty () )
20392039 return ;
20402040
2041- if (user->GetTypeId () != TYPEID_PLAYER || !user->ToPlayer ()->IsInSameRaidWith (caster->ToPlayer ()))
2042- return ;
2041+ if (ownerGuid != user->GetGUID ())
2042+ {
2043+ if (Unit* owner = ObjectAccessor::GetUnit (*this , ownerGuid))
2044+ ownerGuid = owner->GetCharmerOrOwnerOrOwnGUID ();
2045+
2046+ Player const * playerUser = user->GetCharmerOrOwnerPlayerOrPlayerItself ();
2047+ if (!playerUser)
2048+ return ;
2049+
2050+ Group const * group = playerUser->GetGroup ();
2051+ if (!group || !group->IsMember (ownerGuid))
2052+ return ;
2053+ }
20432054 }
20442055
20452056 user->RemoveAurasByType (SPELL_AURA_MOUNTED);
Original file line number Diff line number Diff line change 2020
2121#include " Define.h"
2222#include " EnumFlag.h"
23+ #include " StringFormatFwd.h"
2324#include < array>
2425#include < functional>
2526#include < list>
2627#include < set>
27- #include < stdexcept>
2828#include < string>
2929#include < type_traits>
3030#include < unordered_set>
@@ -315,33 +315,11 @@ struct std::hash<ObjectGuid>
315315 }
316316};
317317
318- namespace fmt
319- {
320- inline namespace v10
321- {
322- template <typename T, typename Char, typename Enable>
323- struct formatter ;
324-
325318template <>
326- struct formatter <ObjectGuid, char , void >
319+ struct fmt :: formatter<ObjectGuid, char , void > : Trinity::NoArgFormatterBase
327320{
328- template <typename ParseContext>
329- constexpr auto parse (ParseContext& ctx) -> decltype(ctx.begin())
330- {
331- auto begin = ctx.begin (), end = ctx.end ();
332- if (begin == end)
333- return begin;
334-
335- if (*begin != ' }' )
336- throw std::invalid_argument (" invalid type specifier" );
337-
338- return begin;
339- }
340-
341321 template <typename FormatContext>
342322 auto format (ObjectGuid const & guid, FormatContext& ctx) const -> decltype(ctx.out());
343323};
344- }
345- }
346324
347325#endif // TRINITYCORE_OBJECT_GUID_H
Original file line number Diff line number Diff line change 4747#include "LootMgr.h"
4848#include "MotionMaster.h"
4949#include "MovementGenerator.h"
50- #include " MovementPacketBuilder .h"
50+ #include "MovementPackets .h"
5151#include "MoveSpline.h"
5252#include "MoveSplineInit.h"
5353#include "ObjectAccessor.h"
@@ -573,10 +573,10 @@ void Unit::SendFlightSplineSyncUpdate()
573573 if (!movespline->isCyclic() || movespline->Finalized())
574574 return;
575575
576- WorldPacket data (SMSG_FLIGHT_SPLINE_SYNC, 4 + GetPackGUID (). size ()) ;
577- Movement::PacketBuilder::WriteSplineSync (*movespline, data );
578- data << GetPackGUID ();
579- SendMessageToSet (&data , true );
576+ WorldPackets::Movement::FlightSplineSync flightSplineSync ;
577+ flightSplineSync.Guid = GetGUID( );
578+ flightSplineSync.SplineDist = float(movespline->timePassed()) / movespline->Duration ();
579+ SendMessageToSet(flightSplineSync.Write() , true);
580580}
581581
582582void Unit::InterruptMovementBasedAuras()
Original file line number Diff line number Diff line change @@ -83,9 +83,9 @@ namespace Movement
8383 int32 next_timestamp () const { return spline.length (point_Idx + 1 ); }
8484 int32 segment_time_elapsed () const { return next_timestamp () - time_passed; }
8585 int32 timeElapsed () const { return Duration () - time_passed; }
86- int32 timePassed () const { return time_passed; }
8786
8887 public:
88+ int32 timePassed () const { return time_passed; }
8989 int32 Duration () const { return spline.length (); }
9090 MySpline const & _Spline () const { return spline; }
9191 int32 _currentSplineIdx () const { return point_Idx; }
Original file line number Diff line number Diff line change @@ -184,8 +184,4 @@ namespace Movement
184184 data << (move_spline.isCyclic () ? G3D::Vector3::zero () : move_spline.FinalDestination ());
185185 }
186186 }
187- void PacketBuilder::WriteSplineSync (MoveSpline const & move_spline, ByteBuffer& data)
188- {
189- data << (float )move_spline.timePassed () / move_spline.Duration ();
190- }
191187}
Original file line number Diff line number Diff line change 3232#include "LFGPackets.h"
3333#include "MailPackets.h"
3434#include "MiscPackets.h"
35+ #include "MovementPackets.h"
3536#include "NPCPackets.h"
3637#include "PartyPackets.h"
3738#include "PetPackets.h"
Original file line number Diff line number Diff line change 1+ /*
2+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3+ *
4+ * This program is free software; you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License as published by the
6+ * Free Software Foundation; either version 2 of the License, or (at your
7+ * option) any later version.
8+ *
9+ * This program is distributed in the hope that it will be useful, but WITHOUT
10+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12+ * more details.
13+ *
14+ * You should have received a copy of the GNU General Public License along
15+ * with this program. If not, see <http://www.gnu.org/licenses/>.
16+ */
17+
18+ #include " MovementPackets.h"
19+
20+ namespace WorldPackets ::Movement
21+ {
22+ WorldPacket const * FlightSplineSync::Write ()
23+ {
24+ _worldPacket << float (SplineDist);
25+ _worldPacket << Guid.WriteAsPacked ();
26+
27+ return &_worldPacket;
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3+ *
4+ * This program is free software; you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License as published by the
6+ * Free Software Foundation; either version 2 of the License, or (at your
7+ * option) any later version.
8+ *
9+ * This program is distributed in the hope that it will be useful, but WITHOUT
10+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12+ * more details.
13+ *
14+ * You should have received a copy of the GNU General Public License along
15+ * with this program. If not, see <http://www.gnu.org/licenses/>.
16+ */
17+
18+ #ifndef TRINITYCORE_MOVEMENT_PACKETS_H
19+ #define TRINITYCORE_MOVEMENT_PACKETS_H
20+
21+ #include " Packet.h"
22+ #include " ObjectGuid.h"
23+
24+ namespace WorldPackets
25+ {
26+ namespace Movement
27+ {
28+ class FlightSplineSync final : public ServerPacket
29+ {
30+ public:
31+ explicit FlightSplineSync () : ServerPacket(SMSG_FLIGHT_SPLINE_SYNC, 8 + 4 ) { }
32+
33+ WorldPacket const * Write () override ;
34+
35+ ObjectGuid Guid;
36+ float SplineDist = 0 .0f ;
37+ };
38+ }
39+ }
40+
41+ #endif // TRINITYCORE_MOVEMENT_PACKETS_H
You can’t perform that action at this time.
0 commit comments