[Quest API] Add IsRaining() and IsSnowing() to Perl/Lua.

- Add quest::IsRaining() to Perl.
- Add quest::IsSnowing() to Perl.
- Add eq.is_raining() to Lua.
- Add eq.is_snowing() to Lua.

This will allow server operators to tell if a zone is currently raining, snowing, or neither.
This commit is contained in:
Kinglykrab
2022-10-10 19:31:40 -04:00
parent 832bffa811
commit 78e6f86c33
5 changed files with 51 additions and 0 deletions
+12
View File
@@ -3706,6 +3706,16 @@ bool Perl__hasrecipelearned(uint32 recipe_id)
return quest_manager.HasRecipeLearned(recipe_id);
}
bool Perl__IsRaining()
{
return quest_manager.IsRaining();
}
bool Perl__IsSnowing()
{
return quest_manager.IsSnowing();
}
void perl_register_quest()
{
perl::interpreter perl(PERL_GET_THX);
@@ -3752,6 +3762,8 @@ void perl_register_quest()
package.add("delete_data", &Perl__delete_data);
package.add("IsBeneficialSpell", &Perl__IsBeneficialSpell);
package.add("IsEffectInSpell", &Perl__IsEffectInSpell);
package.add("IsRaining", &Perl__IsRaining);
package.add("IsSnowing", &Perl__IsSnowing);
package.add("IsRunning", &Perl__IsRunning);
package.add("LearnRecipe", &Perl__LearnRecipe);
package.add("MerchantCountItem", &Perl__MerchantCountItem);
+18
View File
@@ -3427,6 +3427,22 @@ bool lua_has_recipe_learned(uint32 recipe_id) {
return quest_manager.HasRecipeLearned(recipe_id);
}
bool lua_is_raining() {
if (!zone) {
return false;
}
return zone->IsRaining();
}
bool lua_is_snowing() {
if (!zone) {
return false;
}
return zone->IsSnowing();
}
#define LuaCreateNPCParse(name, c_type, default_value) do { \
cur = table[#name]; \
if(luabind::type(cur) != LUA_TNIL) { \
@@ -3891,6 +3907,8 @@ luabind::scope lua_register_general() {
luabind::def("get_recipe_made_count", &lua_get_recipe_made_count),
luabind::def("get_recipe_name", &lua_get_recipe_name),
luabind::def("has_recipe_learned", &lua_has_recipe_learned),
luabind::def("is_raining", &lua_is_raining),
luabind::def("is_snowing", &lua_is_snowing),
/*
Cross Zone
+16
View File
@@ -3723,3 +3723,19 @@ void QuestManager::LearnRecipe(uint32 recipe_id) {
initiator->LearnRecipe(recipe_id);
}
bool QuestManager::IsRaining() {
if (!zone) {
return false;
}
return zone->IsRaining();
}
bool QuestManager::IsSnowing() {
if (!zone) {
return false;
}
return zone->IsSnowing();
}
+2
View File
@@ -340,6 +340,8 @@ public:
int GetRecipeMadeCount(uint32 recipe_id);
std::string GetRecipeName(uint32 recipe_id);
bool HasRecipeLearned(uint32 recipe_id);
bool IsRaining();
bool IsSnowing();
Client *GetInitiator() const;
NPC *GetNPC() const;
+3
View File
@@ -249,6 +249,9 @@ public:
uint32 GetCurrencyID(uint32 item_id);
uint32 GetCurrencyItemID(uint32 currency_id);
inline bool IsRaining() { return zone_weather == 1; }
inline bool IsSnowing() { return zone_weather == 2; }
std::string GetZoneDescription();
void SendReloadMessage(std::string reload_type);