mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Feature: Added player:CanRewardQuest(questId)/player:CanCompleteRepeatableQuest(questId) (#141)
This commit is contained in:
@@ -99,6 +99,8 @@ Eluna API for AC:
|
|||||||
- Added vendor entry as argument to `Player:SendListInventory(object, vendorentry)`: https://github.com/azerothcore/mod-eluna/pull/48
|
- Added vendor entry as argument to `Player:SendListInventory(object, vendorentry)`: https://github.com/azerothcore/mod-eluna/pull/48
|
||||||
- Added `Player:GetPlayerSettingValue()` and `Player:UpdatePlayerSetting()`: https://github.com/azerothcore/mod-eluna/pull/125
|
- Added `Player:GetPlayerSettingValue()` and `Player:UpdatePlayerSetting()`: https://github.com/azerothcore/mod-eluna/pull/125
|
||||||
- Added `Player:GetTrader()`: https://github.com/azerothcore/mod-eluna/pull/126
|
- Added `Player:GetTrader()`: https://github.com/azerothcore/mod-eluna/pull/126
|
||||||
|
- Added `Player:CanCompleteRepeatableQuest(questId)`: https://github.com/azerothcore/mod-eluna/pull/141
|
||||||
|
- Added `Player:CanRewardQuest(questId)`: https://github.com/azerothcore/mod-eluna/pull/141
|
||||||
|
|
||||||
### Group
|
### Group
|
||||||
- Added `Group:GetGroupType()`: https://github.com/azerothcore/mod-eluna/pull/82
|
- Added `Group:GetGroupType()`: https://github.com/azerothcore/mod-eluna/pull/82
|
||||||
|
|||||||
@@ -606,6 +606,8 @@ ElunaRegister<Player> PlayerMethods[] =
|
|||||||
#ifndef CLASSIC
|
#ifndef CLASSIC
|
||||||
{ "IsInArenaTeam", &LuaPlayer::IsInArenaTeam },
|
{ "IsInArenaTeam", &LuaPlayer::IsInArenaTeam },
|
||||||
#endif
|
#endif
|
||||||
|
{ "CanRewardQuest", &LuaPlayer::CanRewardQuest },
|
||||||
|
{ "CanCompleteRepeatableQuest", &LuaPlayer::CanCompleteRepeatableQuest },
|
||||||
{ "CanCompleteQuest", &LuaPlayer::CanCompleteQuest },
|
{ "CanCompleteQuest", &LuaPlayer::CanCompleteQuest },
|
||||||
{ "CanEquipItem", &LuaPlayer::CanEquipItem },
|
{ "CanEquipItem", &LuaPlayer::CanEquipItem },
|
||||||
{ "IsFalling", &LuaPlayer::IsFalling },
|
{ "IsFalling", &LuaPlayer::IsFalling },
|
||||||
|
|||||||
@@ -473,6 +473,46 @@ namespace LuaPlayer
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 'true' if the [Player] satisfies all requirements to complete the quest entry.
|
||||||
|
*
|
||||||
|
* @param uint32 questId
|
||||||
|
* @return bool CanCompleteRepeatableQuest
|
||||||
|
*/
|
||||||
|
int CanCompleteRepeatableQuest(lua_State* L, Player* player)
|
||||||
|
{
|
||||||
|
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
const Quest* quest = sObjectMgr->GetQuestTemplate(questId); // Retrieve the Quest object
|
||||||
|
if (!quest)
|
||||||
|
{
|
||||||
|
Eluna::Push(L, false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eluna::Push(L, player->CanCompleteRepeatableQuest(quest));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns 'true' if the [Player] satisfies all requirements to reward the quest entry.
|
||||||
|
*
|
||||||
|
* @param uint32 questId
|
||||||
|
* @return bool CanRewardQuest
|
||||||
|
*/
|
||||||
|
int CanRewardQuest(lua_State* L, Player* player)
|
||||||
|
{
|
||||||
|
uint32 questId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
|
const Quest* quest = sObjectMgr->GetQuestTemplate(questId); // Retrieve the Quest object
|
||||||
|
if (!quest)
|
||||||
|
{
|
||||||
|
Eluna::Push(L, false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eluna::Push(L, player->CanRewardQuest(quest, true)); // Modify the second argument as needed
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns 'true' if the [Player] satisfies all requirements to complete the quest entry.
|
* Returns 'true' if the [Player] satisfies all requirements to complete the quest entry.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user