MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / SyncClientSharedTaskRemoveLocalIfNotExists

Method SyncClientSharedTaskRemoveLocalIfNotExists

zone/task_manager.cpp:1718–1756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1716}
1717
1718void 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

Callers

nothing calls this directly

Calls 6

HasActiveSharedTaskMethod · 0.80
CharacterIDMethod · 0.45
emptyMethod · 0.45
GetCleanNameMethod · 0.45
MessageStringMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected