| 1716 | } |
| 1717 | |
| 1718 | void TaskManager::SyncClientSharedTaskRemoveLocalIfNotExists(Client *c, ClientTaskState *cts) |
| 1719 | { |
| 1720 | // has active shared task |
| 1721 | if (cts->HasActiveSharedTask()) { |
| 1722 | auto members = SharedTaskMembersRepository::GetWhere( |
| 1723 | database, |
| 1724 | fmt::format( |
| 1725 | "character_id = {}", |
| 1726 | c->CharacterID() |
| 1727 | ) |
| 1728 | ); |
| 1729 | |
| 1730 | // if we don't actually have a membership anywhere, remove ourself locally |
| 1731 | if (members.empty()) { |
| 1732 | LogTasksDetail( |
| 1733 | "Client [{}] Shared task [{}] doesn't exist in world, removing from local", |
| 1734 | c->GetCleanName(), |
| 1735 | cts->m_active_shared_task.task_id |
| 1736 | ); |
| 1737 | |
| 1738 | std::string delete_where = fmt::format( |
| 1739 | "charid = {} and taskid = {}", |
| 1740 | c->CharacterID(), |
| 1741 | cts->m_active_shared_task.task_id |
| 1742 | ); |
| 1743 | CharacterTasksRepository::DeleteWhere(database, delete_where); |
| 1744 | CharacterActivitiesRepository::DeleteWhere(database, delete_where); |
| 1745 | |
| 1746 | c->MessageString(Chat::Yellow, TaskStr::NO_LONGER_MEMBER_TITLE, |
| 1747 | m_task_data[cts->m_active_shared_task.task_id].title.c_str()); |
| 1748 | |
| 1749 | // remove as active task if doesn't exist |
| 1750 | cts->m_active_shared_task = {}; |
| 1751 | |
| 1752 | // persist removal from local record |
| 1753 | SaveClientState(c, cts); |
| 1754 | } |
| 1755 | } |
| 1756 | } |
| 1757 | |
| 1758 | // in a case where a client somehow lost local state with what state exists in world - we need |
| 1759 | // to perform an inverse sync where we inject the task |
nothing calls this directly
no test coverage detected