Jump to content

Vehicles (Dev)


Guest AuntieMangos

Recommended Posts

  • Replies 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

ok thanks and the other errors?

do not worry, warning not equal to error, but if you want a clean compilation then,

just find the rows with warning and make fixes such this:

in ObjectMgr.cpp

-    int i=0;
-    for(int j=0;j<val.size()/2;++j)
+    uint32 i=0;
+    for(uint32 j=0; j<val.size()/2; ++j)

and in Creature.cpp

               //fixed speed fur hunter (and summon!?) pets
-               return 1.15;
+               return 1.15f;

Link to comment
Share on other sites

If you want the player when leaving the vehicle to go down near the vehicle, then use this patch:

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 5e4f22a..2d5545d 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -13691,8 +13691,8 @@ void Unit::ExitVehicle()

        float x = GetPositionX();
        float y = GetPositionY();
-        float z = GetPositionZ() + 2.0f;
-        GetClosePoint(x, y, z, 2.0f + v_size);
+        float z = GetPositionZ();
+        GetClosePoint(x, y, z, 0);
        SendMonsterMove(x, y, z, SPLINETYPE_NORMAL, SPLINEFLAG_WALKMODE, 0);
    }
}

this what you were looking for iceis2?

Link to comment
Share on other sites

Urgh, having issues with tassadar's vehicle repo + traponinet's fix :( everything compiles up until spell.cpp (line 1751)

case TARGET_AREAEFFECT_CUSTOM2

running xeross' AHbot and merged groups (which shouldnt affect spell.cpp)

last modified by tassadar 1 day ago - Restore build

anyone else have this error on compile with vc90 win32?

Link to comment
Share on other sites

Hey Guy i have found this on the trinitycore, is it possible to write this with the vehicle system, from mangos:

# HG changeset patch
# User thenecromancer
# Date 1263377798 -3600
# Branch trunk
# Node ID 69b704dd4841b11101aa2171c7859e94d3b6733e
# Parent  fbda5ee13a27365c0d5b9cb66131f76fdc13bb73
Implement vehicles created by player mounts.
Original idea by Elmaster, packet research by Wrong, ty.

diff -r fbda5ee13a27 -r 69b704dd4841 src/game/GroupHandler.cpp
--- a/src/game/GroupHandler.cpp    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/GroupHandler.cpp    Wed Jan 13 11:16:38 2010 +0100
@@ -31,6 +31,7 @@
#include "SocialMgr.h"
#include "Util.h"
#include "SpellAuras.h"
+#include "Vehicle.h"

class Aura;

@@ -775,6 +776,14 @@
            *data << (uint16) 0;
    }

+    if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
+    {
+        if(player->GetVehicle()){
+            Vehicle* vv=player->GetVehicle();
+            *data << (uint32) vv->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat];
+        }
+    }
+
    if (mask & GROUP_UPDATE_FLAG_PET_AURAS)
    {
        if(pet)
diff -r fbda5ee13a27 -r 69b704dd4841 src/game/MovementHandler.cpp
--- a/src/game/MovementHandler.cpp    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/MovementHandler.cpp    Wed Jan 13 11:16:38 2010 +0100
@@ -358,6 +358,20 @@
        plMover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
        plMover->UpdateFallInformationIfNeed(movementInfo, opcode);

+        // If on vehicle, update carried players
+        if (Vehicle *vehicle=plMover->GetVehicleKit())
+        {
+            if (plMover->IsVehicle())
+            {
+                for (int i=0; i < 8; ++i)
+                {
+                    if (Unit *passenger = vehicle->GetPassenger(i))
+                        if (passenger != NULL && passenger->GetTypeId() == TYPEID_PLAYER)
+                            ((Player*)passenger)->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
+                }
+            }
+        }
+
        if (movementInfo.z < -500.0f)
        {
            if (plMover->InBattleGround()
diff -r fbda5ee13a27 -r 69b704dd4841 src/game/Opcodes.cpp
--- a/src/game/Opcodes.cpp    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/Opcodes.cpp    Wed Jan 13 11:16:38 2010 +0100
@@ -1219,9 +1219,9 @@
    /*0x4A4*/ { "CMSG_QUERY_VEHICLE_STATUS",                    STATUS_NEVER,    &WorldSession::Handle_NULL                     },
    /*0x4A5*/ { "UMSG_UNKNOWN_1189",                            STATUS_NEVER,    &WorldSession::Handle_NULL                     },
    /*0x4A6*/ { "SMSG_UNKNOWN_1190",                            STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
-    /*0x4A7*/ { "SMSG_UNKNOWN_1191",                            STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
-    /*0x4A8*/ { "CMSG_UNKNOWN_1192",                            STATUS_NEVER,    &WorldSession::Handle_NULL                     },
-    /*0x4A9*/ { "CMSG_EJECT_PASSENGER",                         STATUS_NEVER,    &WorldSession::Handle_NULL                     },
+    /*0x4A7*/ { "SMSG_PLAYER_VEHICLE_DATA",                     STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
+    /*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 -r fbda5ee13a27 -r 69b704dd4841 src/game/Opcodes.h
--- a/src/game/Opcodes.h    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/Opcodes.h    Wed Jan 13 11:16:38 2010 +0100
@@ -1227,8 +1227,8 @@
    CMSG_QUERY_VEHICLE_STATUS                       = 0x4A4, // not found
    UMSG_UNKNOWN_1189                               = 0x4A5, // not found, old SMSG_PET_GUIDS
    SMSG_UNKNOWN_1190                               = 0x4A6, // smsg unk, "You can't do that yet"
-    SMSG_UNKNOWN_1191                               = 0x4A7, // smsg guid+uint32 (vehicle)
-    CMSG_UNKNOWN_1192                               = 0x4A8, // cmsg uint64
+    SMSG_PLAYER_VEHICLE_DATA                        = 0x4A7, // smsg guid+uint32 (vehicle)
+    CMSG_PLAYER_VEHICLE_ENTER                       = 0x4A8, // cmsg uint64
    CMSG_EJECT_PASSENGER                            = 0x4A9, // cmsg uint64
    SMSG_PET_GUIDS                                  = 0x4AA, // shifted+5
    SMSG_CLIENTCACHE_VERSION                        = 0x4AB, // shifted+5
diff -r fbda5ee13a27 -r 69b704dd4841 src/game/Player.cpp
--- a/src/game/Player.cpp    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/Player.cpp    Wed Jan 13 11:16:38 2010 +0100
@@ -3981,6 +3981,7 @@
    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 += 4)
diff -r fbda5ee13a27 -r 69b704dd4841 src/game/SpellAuraEffects.cpp
--- a/src/game/SpellAuraEffects.cpp    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/SpellAuraEffects.cpp    Wed Jan 13 11:16:38 2010 +0100
@@ -3471,7 +3471,7 @@
            if(GetSpellProto()->Effect[i] == SPELL_EFFECT_SUMMON
                && GetSpellProto()->EffectMiscValue[i] == GetMiscValue())
                display_id = 0;
-        target->Mount(display_id);
+        target->Mount(display_id,ci->VehicleId);
    }
    else
    {
diff -r fbda5ee13a27 -r 69b704dd4841 src/game/Unit.cpp
--- a/src/game/Unit.cpp    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/Unit.cpp    Wed Jan 13 11:16:38 2010 +0100
@@ -11099,7 +11099,7 @@
    return uint32((WeaponSpeed * PPM) / 600.0f);   // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
}

-void Unit::Mount(uint32 mount)
+void Unit::Mount(uint32 mount, uint32 VehicleId)
{
    RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT);

@@ -11121,6 +11121,27 @@
            else
                ((Player*)this)->UnsummonPetTemporaryIfAny();
        }
+
+        if(VehicleId !=0)
+        {
+            if(VehicleEntry const *ve = sVehicleStore.LookupEntry(VehicleId))
+            {
+
+                if (CreateVehicleKit(VehicleId))
+                {
+                    GetVehicleKit()->Reset();
+
+                    // Send others that we now have a vehicle
+                    WorldPacket data( SMSG_PLAYER_VEHICLE_DATA, GetPackGUID().size()+4);
+                    data.appendPackGUID(GetGUID());
+                    data << uint32(VehicleId);
+                    SendMessageToSet( &data,true );
+
+                    data.Initialize(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
+                    ((Player*)this)->GetSession()->SendPacket( &data );
+                }
+            }
+        }
    }

}
@@ -11148,6 +11169,16 @@
        else
            ((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
    }
+    if(GetTypeId()==TYPEID_PLAYER && GetVehicleKit())
+    {
+        // Send other players that we are no longer a vehicle
+        WorldPacket data( SMSG_PLAYER_VEHICLE_DATA, 8+4 );
+        data.appendPackGUID(GetGUID());
+        data << uint32(0);
+        ((Player*)this)->SendMessageToSet(&data, true);
+        // Remove vehicle class from player
+        RemoveVehicleKit();
+    }
}

void Unit::SetInCombatWith(Unit* enemy)
@@ -14956,6 +14987,22 @@
    return true;
}

+void Unit::RemoveVehicleKit()
+{
+    if (!m_vehicleKit)
+        return;
+
+    m_vehicleKit->Uninstall();
+    delete m_vehicleKit;
+
+    m_vehicleKit = NULL;
+
+    m_updateFlag &= ~UPDATEFLAG_VEHICLE;
+    m_unitTypeMask &= ~UNIT_MASK_VEHICLE;
+    RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+    RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
+}
+
Unit *Unit::GetVehicleBase() const
{
    return m_vehicle ? m_vehicle->GetBase() : NULL;
diff -r fbda5ee13a27 -r 69b704dd4841 src/game/Unit.h
--- a/src/game/Unit.h    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/Unit.h    Wed Jan 13 11:16:38 2010 +0100
@@ -631,6 +631,7 @@
    UNIT_NPC_FLAG_STABLEMASTER          = 0x00400000,       // 100%
    UNIT_NPC_FLAG_GUILD_BANKER          = 0x00800000,       // cause client to send 997 opcode
    UNIT_NPC_FLAG_SPELLCLICK            = 0x01000000,       // cause client to send 1015 opcode (spell click), dynamic, set at loading and don't must be set in DB
+    UNIT_NPC_FLAG_PLAYER_VEHICLE        = 0x02000000,       // players with mounts that have vehicle data should have it set
    UNIT_NPC_FLAG_GUARD                 = 0x10000000,       // custom flag for guards
    UNIT_NPC_FLAG_OUTDOORPVP            = 0x20000000,       // custom flag for outdoor pvp creatures
};
@@ -1272,7 +1273,7 @@

        bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT ); }
        uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); }
-        void Mount(uint32 mount);
+        void Mount(uint32 mount, uint32 vehicleId=0);
        void Unmount();

        uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
@@ -1913,6 +1914,7 @@
        bool IsAIEnabled, NeedChangeAI;
        MovementInfo m_movementInfo;
        bool CreateVehicleKit(uint32 id);
+        void RemoveVehicleKit();
        Vehicle *GetVehicleKit()const { return m_vehicleKit; }
        Vehicle *GetVehicle()   const { return m_vehicle; }
        bool IsOnVehicle(const Unit *unit) const { return m_vehicle && m_vehicle == unit->GetVehicleKit(); }
diff -r fbda5ee13a27 -r 69b704dd4841 src/game/Vehicle.cpp
--- a/src/game/Vehicle.cpp    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/Vehicle.cpp    Wed Jan 13 11:16:38 2010 +0100
@@ -151,9 +151,18 @@
void Vehicle::Reset()
{
    sLog.outDebug("Vehicle::Reset");
-    InstallAllAccessories();
    if(m_usableSeatNum)
-        me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+    {
+        if (me->GetTypeId() == TYPEID_PLAYER)
+        {
+            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
+        }
+        else
+        {
+            InstallAllAccessories();
+            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+        }
+    }
}

void Vehicle::RemoveAllPassengers()
@@ -275,7 +284,12 @@
        assert(m_usableSeatNum);
        --m_usableSeatNum;
        if(!m_usableSeatNum)
-            me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+        {
+            if (me->GetTypeId() == TYPEID_PLAYER)
+                me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
+            else
+                me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+        }
    }

    if(seat->second.seatInfo->m_flags && !(seat->second.seatInfo->m_flags & 0x400))
@@ -292,21 +306,24 @@
    unit->m_movementInfo.t_time = 0; // 1 for player
    unit->m_movementInfo.t_seat = seat->first;

-    if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->m_flags & 0x800) // not right
+    if(me->GetTypeId() == TYPEID_UNIT
+        && unit->GetTypeId() == TYPEID_PLAYER 
+        && seat->first == 0 && seat->second.seatInfo->m_flags & 0x800) // not right
        if (!me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
            assert(false);

-    if(me->GetTypeId() == TYPEID_UNIT)
+    if(me->IsInWorld())
    {
-        if(me->IsInWorld())
+        unit->SendMonsterMoveTransport(me);
+
+        if(me->GetTypeId() == TYPEID_UNIT)
        {
-            unit->SendMonsterMoveTransport(me);
+            if(((Creature*)me)->IsAIEnabled)
+                ((Creature*)me)->AI()->PassengerBoarded(unit, seat->first, true);
+
            // move self = move all passengers
            me->GetMap()->CreatureRelocation((Creature*)me, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
        }
-
-        if(((Creature*)me)->IsAIEnabled)
-            ((Creature*)me)->AI()->PassengerBoarded(unit, seat->first, true);
    }

    //if(unit->GetTypeId() == TYPEID_PLAYER)
@@ -334,7 +351,12 @@
    if(seat->second.seatInfo->IsUsable())
    {
        if(!m_usableSeatNum)
-            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+        {
+            if (me->GetTypeId() == TYPEID_PLAYER)
+                me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE);
+            else
+                me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+        }
        ++m_usableSeatNum;
    }

@@ -342,7 +364,9 @@

    //SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);

-    if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->m_flags & 0x800)
+    if(me->GetTypeId() == TYPEID_UNIT
+        && unit->GetTypeId() == TYPEID_PLAYER 
+        && seat->first == 0 && seat->second.seatInfo->m_flags & 0x800)
        me->RemoveCharmedBy(unit);

    if(me->GetTypeId() == TYPEID_UNIT && ((Creature*)me)->IsAIEnabled)
diff -r fbda5ee13a27 -r 69b704dd4841 src/game/WorldSession.cpp
--- a/src/game/WorldSession.cpp    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/WorldSession.cpp    Wed Jan 13 11:16:38 2010 +0100
@@ -30,6 +30,7 @@
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Player.h"
+#include "Vehicle.h"
#include "ObjectMgr.h"
#include "Group.h"
#include "Guild.h"
@@ -937,6 +938,39 @@
    SendPacket(&data);
}

+
+void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
+{
+    // Read guid
+    uint64 guid;
+    data >> guid;
+
+    if(Player* pl=ObjectAccessor::FindPlayer(guid))
+    {
+        if (!pl->GetVehicleKit())
+            return;
+        if (!pl->IsInRaidWith(_player))
+            return;
+        if(!pl->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
+            return;
+        _player->EnterVehicle(pl);
+    }
+}
+
+void WorldSession::HandleEjectPasenger(WorldPacket &data)
+{
+    if(data.GetOpcode()==CMSG_EJECT_PASSENGER)
+    {
+        if(Vehicle* Vv= _player->GetVehicleKit())
+        {
+            uint64 guid;
+            data >> guid;
+            if(Player* Pl=ObjectAccessor::FindPlayer(guid))
+                Pl->ExitVehicle();
+        }
+    }
+ }
+
void WorldSession::SetPlayer( Player *plr )
{
    _player = plr;
diff -r fbda5ee13a27 -r 69b704dd4841 src/game/WorldSession.h
--- a/src/game/WorldSession.h    Wed Jan 13 10:47:51 2010 +0100
+++ b/src/game/WorldSession.h    Wed Jan 13 11:16:38 2010 +0100
@@ -748,6 +748,8 @@
        bool HandleOnItemOpen(Item *pItem);
        bool HandleOnGoClick(GameObject *pGameObject);
        void HandleOnCreatureKill(Creature *pCreature);
+        void HandleEjectPasenger(WorldPacket &data);
+        void HandleEnterPlayerVehicle(WorldPacket &data);
    private:
        // private trade methods
        void moveItems(Item* myItems[], Item* hisItems[]);

is for mammoth, three seat passengers.

thanks.

Link to comment
Share on other sites

Please update the core to 9919, as Jethrogibbs said, and fix the compile and merge errors, which appear at the Player.cpp, because the code for the XP is moved to Group.cpp :(

oh oh can i answer wojita? huh can I? I know I Know!!! **ooo ooo ooo Mistah Kottahh**

the answer that you are going to get from Mr. Tasss is going to be : "If you do not have the patience to wait until we implement that core revision: Do it yourself!"

right? Thought so...

and I agree with him to boot!

Link to comment
Share on other sites

traponinet on the Arena Turnement come a error:

needed in places tournament

You certainly use unifieddb, right? then just import these fixes in the database mangos:

REPLACE INTO `gameobject` (`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,
`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES 
(300008, 571, 1, 1, 8432, 702.216, 547.315, 0.900956, 0, 0, 0.435396, 0.900239, 600, 0, 1),
(300008, 571, 1, 1, 8481.56, 903.669, 547.293, 1.70287, 0, 0, 0.752227, 0.658904, 600, 0, 1),
(300008, 571, 1, 1, 8589.45, 937.076, 548.657, 3.0332, 0, 0, 0.998532, 0.0541679, 600, 0, 1),
(300008, 571, 1, 1, 8575.6, 677.852, 547.374, 1.92826, 0, 0, 0.821552, 0.570133, 600, 0, 1);

UPDATE gameobject_template SET data0 = 64682 WHERE entry IN (194618,194622);
UPDATE creature_template SET minlevel = 80, maxlevel = 80, minhealth = 50000, maxhealth = 50000 WHERE entry IN (33844,33845);
UPDATE creature_template SET KillCredit1 = 33339 WHERE entry = 33272;
UPDATE creature_template SET KillCredit1 = 33341 WHERE entry = 33229;
UPDATE creature_template SET KillCredit1 = 33340 WHERE entry = 33243;

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use