diff --git a/CMangos/PlayerMethods.h b/CMangos/PlayerMethods.h index 912913b2c8..dc005d3850 100644 --- a/CMangos/PlayerMethods.h +++ b/CMangos/PlayerMethods.h @@ -444,6 +444,44 @@ namespace LuaPlayer return 1; } + /** + * Returns 'true' if the [Player] satisfies all requirements to complete the repeatable quest entry. + * + * @param uint32 entry + * @return bool canComplete + */ + int CanCompleteRepeatableQuest(lua_State* L, Player* player) + { + uint32 entry = Eluna::CHECKVAL(L, 2); + + Quest const* qInfo = eObjectMgr->GetQuestTemplate(entry); + if (qInfo) + Eluna::Push(L, player->CanCompleteRepeatableQuest(qInfo)); + else + Eluna::Push(L, false); + + return 1; + } + + /** + * Returns 'true' if the [Player] satisfies all requirements to turn in the quest. + * + * @param uint32 entry + * @return bool canReward + */ + int CanRewardQuest(lua_State* L, Player* player) + { + uint32 entry = Eluna::CHECKVAL(L, 2); + + Quest const* qInfo = eObjectMgr->GetQuestTemplate(entry); + if (qInfo) + Eluna::Push(L, player->CanRewardQuest(qInfo, true)); + else + Eluna::Push(L, false); + + return 1; + } + /** * Returns 'true' if the [Player] is a part of the Horde faction, 'false' otherwise. * @@ -1504,6 +1542,17 @@ namespace LuaPlayer Eluna::Push(L, player->GetSession()->GetSessionDbcLocale()); return 1; } + + /** + * Returns the amount of mails in the [Player]s mailbox + * + * @return uint32 count + */ + int GetMailCount(lua_State* L, Player* player) + { + Eluna::Push(L, player->GetMailSize()); + return 1; + } /** * Locks the player controls and disallows all movement and casting. @@ -3762,6 +3811,7 @@ namespace LuaPlayer #ifndef CATA { "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue }, #endif + { "GetMailCount", &LuaPlayer::GetMailCount }, // Setters { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, @@ -3852,6 +3902,8 @@ namespace LuaPlayer { "HasTalent", &LuaPlayer::HasTalent }, { "CanTitanGrip", &LuaPlayer::CanTitanGrip }, #endif + { "CanCompleteRepeatableQuest", &LuaPlayer::CanCompleteRepeatableQuest }, + { "CanRewardQuest", &LuaPlayer::CanRewardQuest }, // Gossip { "GossipMenuAddItem", &LuaPlayer::GossipMenuAddItem }, @@ -3975,12 +4027,9 @@ namespace LuaPlayer { "UpdateHonor", nullptr }, // classic only { "ResetHonor", nullptr }, // classic only { "ClearHonorInfo", nullptr }, // classic only - { "GetMailCount", nullptr }, // not implemented { "GetXP", nullptr }, // not implemented { "GetXPForNextLevel", nullptr }, // not implemented - { "CanCompleteRepeatableQuest", nullptr }, // not implemented - { "CanRewardQuest", nullptr }, // not implemented - + { NULL, NULL } }; };