Marty-v58/source-server/Srcs/Server/game/src/questlua_dragonsoul.cpp
2024-06-01 15:59:51 -05:00

71 lines
1.5 KiB
C++

#include "stdafx.h"
#include "config.h"
#include "questmanager.h"
#include "char.h"
#undef sys_err
#ifndef __WIN32__
#define sys_err(fmt, args...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, ##args)
#else
#define sys_err(fmt, ...) quest::CQuestManager::instance().QuestError(__FUNCTION__, __LINE__, fmt, __VA_ARGS__)
#endif
namespace quest
{
ALUA(ds_open_refine_window)
{
const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if (NULL == ch)
{
sys_err ("NULL POINT ERROR");
return 0;
}
if (ch->DragonSoul_IsQualified())
ch->DragonSoul_RefineWindow_Open(CQuestManager::instance().GetCurrentNPCCharacterPtr());
return 0;
}
ALUA(ds_give_qualification)
{
const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if (NULL == ch)
{
sys_err ("NULL POINT ERROR");
return 0;
}
ch->DragonSoul_GiveQualification();
return 0;
}
ALUA(ds_is_qualified)
{
const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if (NULL == ch)
{
sys_err ("NULL POINT ERROR");
lua_pushnumber(L, 0);
return 1;
}
lua_pushnumber(L, ch->DragonSoul_IsQualified());
return 1;
}
void RegisterDragonSoulFunctionTable()
{
luaL_reg ds_functions[] =
{
{ "open_refine_window" , ds_open_refine_window },
{ "give_qualification" , ds_give_qualification },
{ "is_qualified" , ds_is_qualified },
{ NULL , NULL }
};
CQuestManager::instance().AddLuaFunctionTable("ds", ds_functions);
}
};
//martysama0134's 623a0779c74cb7565145d45548376308