Hello!
So I just noticed that if you want to join to the ship defense after the leader started AND the cooldown is enabled the other characters cannot connect (idk if it's fixed already or not, sorry if it is.) because the cooldown is put on the characters on creating the instance and when you're trying to join it's already on cooldown.
Here's a fix for it:
/// In ShipDefense.h add after:
bool IsRunning(const LPCHARACTER c_lpChar);
/// This:
bool CanJoin(const LPCHARACTER c_lpChar);
/// In ShipDefense.cpp add after:
bool CShipDefenseManager::IsRunning(const LPCHARACTER c_lpChar)
{
[...]
}
/// This:
bool CShipDefenseManager::CanJoin(const LPCHARACTER c_lpChar)
{
if (c_lpChar == nullptr)
return false;
const LPPARTY c_lpParty = c_lpChar->GetParty();
if (c_lpParty == nullptr)
return false;
if (m_mapShipDefense.empty())
return false;
ShipDefenseMap::const_iterator f = m_mapShipDefense.find(c_lpParty->GetLeaderPID());
if (f != m_mapShipDefense.end())
return true;
return false;
}
/// In questlua_shipdefense_mgr.cpp
/// Add before:
void RegisterShipDefenseManagerFunctionTable()
{
[...]
}
/// This:
int ship_defense_mgr_can_join(lua_State* L)
{
const LPCHARACTER c_lpChar = CQuestManager::instance().GetCurrentCharacterPtr();
if (c_lpChar == nullptr)
{
lua_pushboolean(L, false);
return 1;
}
CShipDefenseManager& rkShipDefenseMgr = CShipDefenseManager::instance();
lua_pushboolean(L, rkShipDefenseMgr.CanJoin(c_lpChar));
return 1;
}
/// Add after:
{ "set_alliance_hp_pct", ship_defense_mgr_set_alliance_hp_pct },
/// This:
{ "can_join", ship_defense_mgr_can_join},
-- In quest_functions add:
ship_defense_mgr.can_join
-- In shipdefense.quest change this:
if pc.getqf("cooldown") > get_time() then
-- To this:
if pc.getqf("cooldown") > get_time() and not ship_defense_mgr.can_join() then