add: Owsap quest renewal.

This commit is contained in:
2024-06-01 18:45:38 +01:00
parent 652534ae4a
commit 20565c174b
8 changed files with 241 additions and 1 deletions

View File

@ -3,4 +3,5 @@
//#define __AUCTION__
#define __PET_SYSTEM__
#define __QUEST_RENEWAL__ // Quest Page Renewal by Owsap
#endif

View File

@ -1415,6 +1415,10 @@ struct packet_quest_info
WORD size;
WORD index;
BYTE flag;
#if defined(__QUEST_RENEWAL__)
BYTE type;
bool is_confirmed;
#endif
};
enum

View File

@ -199,9 +199,44 @@ namespace quest
CloseState(*pPC->GetRunningQuestState());
pPC->EndRunning();
}
}
#if defined(__QUEST_RENEWAL__)
int CQuestManager::ReadQuestCategoryFile(WORD quest_index)
{
// ¹ÞÀº quest_index¸¦ quest_name·Î º¯È¯ ÈÄ ºñ±³
int quest_type = 0;
string quest_name = CQuestManager::instance().GetQuestNameByIndex(quest_index);
ifstream file((g_stQuestDir + "/questcategory.txt").c_str());
if (file)
{
std::string line;
while (getline(file, line))
{
line.erase(remove(line.begin(), line.end(), ' '), line.end()); // remove all white spaces
if (line.empty() || line.front() == '#')
continue; // Skip empty lines or lines starting with #
int type = stoi(line.substr(0, line.find('\t')));
string name = line.substr(line.find('\t') + 1);
if (test_server)
sys_log(0, "QUEST reading script of %s(%d)", name.c_str(), type);
if (quest_name == name)
{
quest_type = type;
break;
}
}
}
else
sys_err("QUEST Cannot open 'questcategory.txt'");
return quest_type;
}
#endif
void CQuestManager::Input(unsigned int pc, const char* msg)
{
PC* pPC = GetPC(pc);

View File

@ -181,6 +181,10 @@ namespace quest
#endif
void RegisterNPCVnum(DWORD dwVnum);
#if defined(__QUEST_RENEWAL__)
// Quest Category
int ReadQuestCategoryFile(WORD quest_index);
#endif
private:
LPDUNGEON m_pSelectedDungeon;

View File

@ -778,6 +778,20 @@ namespace quest
return false;
}
#if defined(__QUEST_RENEWAL__)
CQuestManager& rkQmgr = CQuestManager::instance();
const LPCHARACTER c_lpCh = rkQmgr.GetCurrentCharacterPtr();
if (c_lpCh != NULL)
{
char szBuf[255]{};
snprintf(szBuf, sizeof(szBuf), "%s.%s", questName, "is_confirmed");
c_lpCh->SetQuestFlag(string(questName) + ".is_confirmed", 1);
if (test_server)
SPDLOG_DEBUG("NPC::OnInfo: pc (name) %s has confirmed the quest %s", c_lpCh->GetName(), questName);
}
#endif
CQuestManager::ExecuteQuestScript(pc, quest_index, itPCQuest->second.st, itQuestScript->second.GetCode(), itQuestScript->second.GetSize());
return true;
}

View File

@ -236,6 +236,14 @@ namespace quest
qi.size = sizeof(struct packet_quest_info);
qi.index = m_RunningQuestState->iIndex;
qi.flag = m_iSendToClient;
#if defined(__QUEST_RENEWAL__)
qi.type = CQuestManager::instance().ReadQuestCategoryFile(qi.index);
qi.is_confirmed = false;
const LPCHARACTER c_lpCh = CQuestManager::instance().GetCurrentCharacterPtr();
if (c_lpCh != NULL)
qi.is_confirmed = static_cast<bool>(c_lpCh->GetQuestFlag(m_stCurQuest + ".is_confirmed"));
#endif
TEMP_BUFFER buf;
buf.write(&qi, sizeof(qi));

View File

@ -43,6 +43,34 @@ namespace quest
QUEST_SEND_ICON_FILE = (1 << 6), // 24자 까지
};
#if defined(__QUEST_RENEWAL__)
enum EQuestType
{
QUEST_TYPE_MAIN,
QUEST_TYPE_SUB,
QUEST_TYPE_LEVELUP,
QUEST_TYPE_EVENT,
QUEST_TYPE_COLLECTION,
QUEST_TYPE_SYSTEM,
QUEST_TYPE_SCROLL,
QUEST_TYPE_DAILY,
QUEST_TYPE_UNEXPOSED,
QUEST_TYPE_MAX
};
enum EQuestSkin
{
QUEST_SKIN_NOWINDOW,
QUEST_SKIN_NORMAL,
QUEST_SKIN_UNKOWN1,
QUEST_SKIN_UNKOWN2,
QUEST_SKIN_SCROLL,
QUEST_SKIN_CINEMATIC,
QUEST_SKIN_COUNT,
QUEST_SKIN_MAX
};
#endif
typedef map<unsigned int, QuestState> QuestInfo;
typedef QuestInfo::iterator QuestInfoIterator;