Editing Server:Boats

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 38: Line 38:
</pre>
</pre>


and temporarily stored in the `character_data`.boatid field in the database. When you depart a boat, the opposite is true. 
and temporarily stored in the `character_data`.boatid field in the database.


Boarding and Leaving a boat have their own associated **OPCODE** and **EVENT** for purposes of scripting.
GM characters can observe player profile packets showing boats being boarded/departed by setting debug logging:
 
 
=== Opcodes ===
 
utils/patches/patch_Mac.conf:
<pre>
OP_BoardBoat=0xbb41
OP_LeaveBoat=0xbc41
OP_ControlBoat=0x2641
</pre>
 
These are the opcodes used by the TAKP client, but actual opcode values changed many times over the years.  Several versions of these opcodes can be found in the TAKP source repository.
 
=== Boat Debugging ===
GM characters can observe player profile packets showing boats being boarded/departed by setting debug logging for Boats database, and they can also observe numerous other data about the boat's arrivals and departures, positions, grids, etc... via quest scripts associated with those Boats.  To enable this information, see [[#Database_Settings]] below.
 
==== Database Settings ====
<pre>
<pre>
UPDATE logsys_categories SET log_to_gmsay = '3' WHERE log_category_description = 'Boats';
UPDATE logsys_categories SET log_to_gmsay = '3' WHERE log_category_description = 'Boats';
Line 67: Line 50:
</pre>
</pre>


Any values between 1 and 3 will enable logging (with increasing levels of detail), and 0 will disable it.
=== Zone Entry ===
 
==== Source ====
The following snippets can be found at https://github.com/EQMacEmu/Server/blob/main/common/eqemu_logsys_log_aliases.h#L480
<pre>
#define LogBoats(message, ...) do {\
    if (LogSys.log_settings[Logs::Boats].is_category_enabled == 1)\
        OutF(LogSys, Logs::General, Logs::Boats, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
 
#define LogBoatsDetail(message, ...) do {\
    if (LogSys.log_settings[Logs::Boats].is_category_enabled == 1)\
        OutF(LogSys, Logs::Detail, Logs::Boats, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
</pre>
 
=== Common Ruletypes ===
 
common/ruletypes.h
<pre>
RULE_INT ( Zone, BoatDistance, 50) //In zones where boat name is not set in the PP, this is how far away from the boat …
…r is the ocean floor, so if you have NPCs that float near the top (sharks, boats) disabling these rules may break them!
RULE_BOOL ( NPC, BoatsRunByDefault, true) // Mainly to make it easier to adjust boats' timing on the fly.
</pre>
 
=== Zone ===
==== API ====
zone/zone.h and zone/zone.cpp:
 
<pre>
bool Zone::IsBoatZone()
</pre>
This function iterates through a hardcoded list of zone ids (qeynos, freporte, erudnext, butcher, oot, erudsxing, timorous, firiona, oasis, overthere, nro, iceclad) and returns true if the current zone id matches one of the zones in this list.
 
 
zone/npc.h and zone/npc.cpp:
 
<pre>
bool NPC::IsBoat()
{
return (GetBaseRace() == SHIP || GetBaseRace() == LAUNCH || GetBaseRace() == CONTROLLED_BOAT || GetBaseRace() == GHOST_SHIP);
}
</pre>
From the context of NPC namespace, you can check if an NPC is a boat both in C++ server source and via LUA quest scripting.
 
zone/mob.h and zone/mob.cpp:
<pre>
bool Mob::IsBoat() const
{
return (GetBaseRace() == SHIP || GetBaseRace() == LAUNCH || GetBaseRace() == CONTROLLED_BOAT || GetBaseRace() == GHOST_SHIP);
}
</pre>
From the context of MOB namespace, you can check if an NPC is a boat both in C++ server source and via LUA quest scripting.
 
zone/client.h
 
The following functions are available for the server interacting with clients (found in the Client:: namespace).
<pre>
uint16 GetBoatID() const { return BoatID; }
uint32 GetBoatNPCID() { return m_pp.boatid; }
char* GetBoatName() { return m_pp.boat; }
void SetBoatID(uint32 boatid);
void SetBoatName(const char* boatname);
void SendToBoat(bool messageonly) // Sometimes, the client doesn't send OP_LeaveBoat, so the boat values don't get cleared.
                              // This can lead difficulty entering the zone, since some people's client's don't like
                              // the boat timeout period.
</pre>
These functions are also exposed via LUA quest scripting.
 
zone/client_packet.h
<pre>
void Handle_OP_BoardBoat(const EQApplicationPacket *app);
void Handle_OP_ControlBoat(const EQApplicationPacket *app);
void Handle_OP_LeaveBoat(const EQApplicationPacket *app);
</pre>
If you need to customize behavior when clients send packets indicating interaction with boats.
 
zone/command.h:
These are GM commands ("#boatinfo" and "#resetboat")
<pre>
void command_boatinfo(Client *c, const Seperator *sep);
void command_resetboat(Client *c, const Seperator *sep);
</pre>
 
zone/entity.h:
<pre>
void GetBoatInfo(Client* client);
uint8 GetClientCountByBoatNPCID(uint32 boatid);
uint8 GetClientCountByBoatID(uint32 entityid);
</pre>
zone/lua_parser_events.h
<pre>
void handle_board_boat(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers);
void handle_leave_boat(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers);
</pre>
 
zone/lua_client.h:
<pre>
int GetBoatID();
void SetBoatID(uint32 in_boatid);
char* GetBoatName();
void SetBoatName(const char* in_boatname);
</pre>
 
zone/mob_movement_manager.h
<pre>
void UpdatePathBoat(Mob *who, float x, float y, float z, MobMovementMode mode);
</pre>
 
==== 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.
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.
<pre>
<pre>
Line 207: Line 79:
* grid_entries
* grid_entries


==== npc_types ====
===== npc_types =====
Boats are implemented as NPCs, so you'll find them in the npc_types table with a race value of Launch (73).  For example,
Boats are implemented as NPCs, so you'll find them in the npc_types table with a race value of Launch (73).  For example,
<pre>
<pre>
Line 218: Line 90:
</pre>
</pre>


==== spawnentry ====
===== spawnentry =====
<pre>
<pre>
INSERT INTO `spawnentry` (`spawngroupID`, `npcID`, `chance`, `mintime`, `maxtime`, `expansion`, `min_expansion`, `max_expansion`) VALUES (448054, 849, 100, 0, 0, 0, 0, 0);
INSERT INTO `spawnentry` (`spawngroupID`, `npcID`, `chance`, `mintime`, `maxtime`, `expansion`, `min_expansion`, `max_expansion`) VALUES (448054, 849, 100, 0, 0, 0, 0, 0);
Line 233: Line 105:
</pre>
</pre>


==== grid ====
===== grid =====
<pre>
<pre>
INSERT INTO `grid` (`id`, `zoneid`, `type`, `type2`) VALUES (16, 68, 4, 1);
INSERT INTO `grid` (`id`, `zoneid`, `type`, `type2`) VALUES (16, 68, 4, 1);
Line 242: Line 114:
INSERT INTO `grid_entries` (`gridid`, `zoneid`, `number`, `x`, `y`, `z`, `heading`, `pause`, `centerpoint`) VALUES (16, 68, 11, 3595, 491, -11.9, 0, 0, 0);
INSERT INTO `grid_entries` (`gridid`, `zoneid`, `number`, `x`, `y`, `z`, `heading`, `pause`, `centerpoint`) VALUES (16, 68, 11, 3595, 491, -11.9, 0, 0, 0);
</pre>
</pre>
==== Complete Example ====
The following is a complete example of database changes that were needed to implement the four shuttles leaving BB docks to the Maiden's Voyage in Timorous Deep:
* https://github.com/EQMacEmu/Server/blob/main/utils/sql/git/required/2023_12_29_BB_to_TD_Shuttles.sql


=== LUA Scripting ===
=== LUA Scripting ===
Line 253: Line 121:
* event_waypoint_arrive
* event_waypoint_arrive
* event_waypoint_depart
* event_waypoint_depart
* event_enter_zone
* event_board_boat
* event_leave_boat
=== Functions ===
* GetBoatNPCID()
* e.self:GetBoatName()
* e.self:SetBoatID(uint32 boatid);
* e.self:SetBoatName(const char* boatname);
void SendToBoat(bool messageonly)
* ent:GetBoatID() or e.self:GetBoatID()
This function can be used from the entity or player namespace, and usually to compare to an integer boatid value.


==== Example Scripts ====
==== Example Scripts ====
Line 279: Line 133:
* https://github.com/EQMacEmu/quests/blob/main/timorous/Maidens_Voyage.lua  
* https://github.com/EQMacEmu/quests/blob/main/timorous/Maidens_Voyage.lua  
* https://github.com/EQMacEmu/quests/blob/main/timorous/Muckskimmer.lua
* https://github.com/EQMacEmu/quests/blob/main/timorous/Muckskimmer.lua
* https://github.com/EQMacEmu/quests/blob/main/timorous/player.lua
* https://github.com/EQMacEmu/quests/blob/main/firiona/player.lua
* https://github.com/EQMacEmu/quests/blob/main/oasis/player.lua
* https://github.com/EQMacEmu/quests/blob/main/butcher/player.lua
* https://github.com/EQMacEmu/quests/blob/main/freporte/player.lua
* https://github.com/EQMacEmu/quests/blob/main/qeynos/player.lua
* https://github.com/EQMacEmu/quests/blob/main/erudnext/player.lua

Please note that all contributions to The Al`Kabor Project Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see The Al'Kabor Project Wiki:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)