Difference between revisions of "Server:Boats"
Line 34: | Line 34: | ||
pps->boat[0] = 0; | pps->boat[0] = 0; | ||
</pre> | </pre> | ||
* | * https://github.com/EQMacEmu/Server/blob/main/zone/client_packet.cpp#L1644 | ||
Boat ID's are stored in the player profile packet (pp.boatname and pp.boatid). | Boat ID's are stored in the player profile packet (pp.boatname and pp.boatid). |
Revision as of 19:20, 29 December 2023
For TAKP server, the boat routes use spawn conditions and are timed with grids. All synchronization has to be achieved via precise timing. Unfortunately, boats can't send send signals across zones. This is hard coded into the client.
If a grid is timed too short or too long, players will either get dropped off in the water or players will end up at the safe spot in the destination zone. Boat zones need to be static.
Server-Side Source
BoatID Constants
The following boats and their ID's are described as enum constants in the server source code: https://github.com/EQMacEmu/Server/blob/main/common/eq_constants.h#L685
//These are NPCIDs in the database. All of these boats send a BoardBoat opcode when boarded. enum Boats { Stormbreaker = 770, //freporte-oot-butcherblock SirensBane = 771, Sea_King = 772, //erudext-erudsxing-qeynos Golden_Maiden = 773, Maidens_Voyage = 838, //timorous-firiona Bloated_Belly = 839, //timorous-overthere Barrel_Barge = 840, //Shuttle timorous-oasis Muckskimmer = 841, Sabrina = 24056, //Shuttle in Erud Island_Shuttle = 96075, //Shuttle to Elf docks in timorous Captains_Skiff = 842, //Shuttle timorous-butcherblock Icebreaker = 110083, //iceclad pirate_runners_skiff = 843 //Shuttle iceclad-nro };
Zone Entry
Each time a client enters a zone, the server checks the client packet's player profile struct for a boatid > 0 and whether the client is currently in Timorous Deep or Firionia Vie. If this is true, the boatid in the player profile struct is set back to 0.
void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) ... if(m_pp.boatid > 0 && (zone->GetZoneID() == timorous || zone->GetZoneID() == firiona)) pps->boat[0] = 0;
Boat ID's are stored in the player profile packet (pp.boatname and pp.boatid).
When you board the boat, the boatid is registered in the PlayerProfile in the code (common/patches/mac_structs), sent by the client to the server, and temporarily stored in the `character_data`.boatid field in the database. So when the boat moves, we send the pc to their destination and the boatid. If the player finds that boatid in their destination zone, it will land on it. Otherwise, it will be sent to the zone safe location.
Boat Route Implementations
Implementing a boat is achieved via entries to the database and the LUA scripting engine. The original implementation on TAKP for most of the boats was done by Cavedude (BB to Tim Deep shuttles was the only route he didn't finish).
Database Settings
The following database tables are used:
- spawn2
- spawngroup
- spawn_conditions
- grid_entries
- grid
- npc_types.boatid
LUA Scripting
Events
- event_spawn
- event_waypoint_arrive
Example Scripts
- https://github.com/EQMacEmu/quests/blob/main/oasis/Barrel_Barge.lua
- https://github.com/EQMacEmu/quests/blob/main/oasis/Muckskimmer.lua
- https://github.com/EQMacEmu/quests/blob/main/firiona/Maidens_Voyage.lua
- https://github.com/EQMacEmu/quests/blob/main/overthere/Bloated_Belly.lua
- https://github.com/EQMacEmu/quests/blob/main/timorous/Barrel_Barge.lua
- https://github.com/EQMacEmu/quests/blob/main/timorous/Bloated_Belly.lua
- https://github.com/EQMacEmu/quests/blob/main/timorous/Captains_Skiff.lua
- https://github.com/EQMacEmu/quests/blob/main/timorous/Island_Shuttle.lua
- https://github.com/EQMacEmu/quests/blob/main/timorous/Maidens_Voyage.lua
- https://github.com/EQMacEmu/quests/blob/main/timorous/Muckskimmer.lua