mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Merge pull request #1014 from EQEmu/gettaskname
Add gettaskname(task_id) to Perl/Lua.
This commit is contained in:
commit
58b9b719f4
@ -2628,6 +2628,23 @@ XS(XS__istaskappropriate) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__gettaskname);
|
||||
XS(XS__gettaskname) {
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
Perl_croak(aTHX_ "Usage: quest::gettaskname(uint32 task_id)");
|
||||
}
|
||||
|
||||
dXSTARG;
|
||||
uint32 task_id = (int) SvIV(ST(0));
|
||||
std::string task_name = quest_manager.gettaskname(task_id);
|
||||
|
||||
sv_setpv(TARG, task_name.c_str());
|
||||
XSprePUSH;
|
||||
PUSHTARG;
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__popup); // prototype to pass -Wmissing-prototypes
|
||||
XS(XS__popup) {
|
||||
dXSARGS;
|
||||
@ -4049,6 +4066,7 @@ EXTERN_C XS(boot_quest) {
|
||||
newXS(strcpy(buf, "getplayercorpsecount"), XS__getplayercorpsecount, file);
|
||||
newXS(strcpy(buf, "getplayercorpsecountbyzoneid"), XS__getplayercorpsecountbyzoneid, file);
|
||||
newXS(strcpy(buf, "gettaskactivitydonecount"), XS__gettaskactivitydonecount, file);
|
||||
newXS(strcpy(buf, "gettaskname"), XS__gettaskname, file);
|
||||
newXS(strcpy(buf, "givecash"), XS__givecash, file);
|
||||
newXS(strcpy(buf, "gmmove"), XS__gmmove, file);
|
||||
newXS(strcpy(buf, "gmsay"), XS__gmsay, file);
|
||||
|
||||
@ -733,6 +733,10 @@ bool lua_is_task_appropriate(int task) {
|
||||
return quest_manager.istaskappropriate(task);
|
||||
}
|
||||
|
||||
std::string lua_get_task_name(uint32 task_id) {
|
||||
return quest_manager.gettaskname(task_id);
|
||||
}
|
||||
|
||||
void lua_popup(const char *title, const char *text, uint32 id, uint32 buttons, uint32 duration) {
|
||||
quest_manager.popup(title, text, id, buttons, duration);
|
||||
}
|
||||
@ -1724,6 +1728,7 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("active_tasks_in_set", &lua_active_tasks_in_set),
|
||||
luabind::def("completed_tasks_in_set", &lua_completed_tasks_in_set),
|
||||
luabind::def("is_task_appropriate", &lua_is_task_appropriate),
|
||||
luabind::def("get_task_name", (std::string(*)(uint32))&lua_get_task_name),
|
||||
luabind::def("popup", &lua_popup),
|
||||
luabind::def("clear_spawn_timers", &lua_clear_spawn_timers),
|
||||
luabind::def("zone_emote", &lua_zone_emote),
|
||||
|
||||
@ -2441,6 +2441,16 @@ bool QuestManager::istaskappropriate(int task) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string QuestManager::gettaskname(uint32 task_id) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (RuleB(TaskSystem, EnableTaskSystem)) {
|
||||
return taskmanager->GetTaskName(task_id);
|
||||
}
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
void QuestManager::clearspawntimers() {
|
||||
if(!zone)
|
||||
return;
|
||||
|
||||
@ -214,6 +214,7 @@ public:
|
||||
int activetasksinset(int taskset);
|
||||
int completedtasksinset(int taskset);
|
||||
bool istaskappropriate(int task);
|
||||
std::string gettaskname(uint32 task_id);
|
||||
void clearspawntimers();
|
||||
void ze(int type, const char *str);
|
||||
void we(int type, const char *str);
|
||||
|
||||
@ -955,6 +955,17 @@ bool TaskManager::AppropriateLevel(int TaskID, int PlayerLevel) {
|
||||
|
||||
}
|
||||
|
||||
std::string TaskManager::GetTaskName(uint32 task_id)
|
||||
{
|
||||
if (task_id > 0 && task_id < MAXTASKS) {
|
||||
if (Tasks[task_id] != nullptr) {
|
||||
return Tasks[task_id]->Title;
|
||||
}
|
||||
}
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
int TaskManager::GetTaskMinLevel(int TaskID)
|
||||
{
|
||||
if (Tasks[TaskID]->MinLevel)
|
||||
|
||||
@ -299,6 +299,7 @@ public:
|
||||
bool AppropriateLevel(int TaskID, int PlayerLevel);
|
||||
int GetTaskMinLevel(int TaskID);
|
||||
int GetTaskMaxLevel(int TaskID);
|
||||
std::string GetTaskName(uint32 task_id);
|
||||
void TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, int TaskSetID);
|
||||
void TaskQuestSetSelector(Client *c, ClientTaskState *state, Mob *mob, int count, int *tasks); // task list provided by QuestManager (perl/lua)
|
||||
void SendActiveTasksToClient(Client *c, bool TaskComplete=false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user