Skip to content

Commit

Permalink
Merge branch 'master' into FixElunaConf
Browse files Browse the repository at this point in the history
  • Loading branch information
iThorgrim authored Jan 26, 2025
2 parents 376e36b + 32d15a0 commit 6fbdcbf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/LuaEngine/LuaFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ ElunaRegister<GameObject> GameObjectMethods[] =
{ "SetGoState", &LuaGameObject::SetGoState },
{ "SetLootState", &LuaGameObject::SetLootState },
{ "SetRespawnTime", &LuaGameObject::SetRespawnTime },
{ "SetRespawnDelay", &LuaGameObject::SetRespawnDelay },

// Boolean
{ "IsTransport", &LuaGameObject::IsTransport },
Expand Down
15 changes: 15 additions & 0 deletions src/LuaEngine/methods/GameObjectMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,20 @@ namespace LuaGameObject
go->SetRespawnTime(respawn);
return 0;
}

/**
* Sets the respawn or despawn time for the gameobject.
*
* Respawn time is also used as despawn time depending on gameobject settings
*
* @param int32 delay = 0 : cooldown time in seconds to respawn or despawn the object. 0 means never
*/
int SetRespawnDelay(lua_State* L, GameObject* go)
{
int32 respawn = Eluna::CHECKVAL<int32>(L, 2);

go->SetRespawnDelay(respawn);
return 0;
}
};
#endif
14 changes: 12 additions & 2 deletions src/LuaEngine/methods/ItemTemplateMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,23 @@ namespace LuaItemTemplate
}

/**
* Returns the [ItemTemplate]'s name.
* Returns the [ItemTemplate]'s name in the [Player]'s locale.
*
* @param [LocaleConstant] locale = DEFAULT_LOCALE : locale to return the [ItemTemplate] name in (it's optional default: LOCALE_enUS)
*
* @return string name
*/
int GetName(lua_State* L, ItemTemplate* itemTemplate)
{
Eluna::Push(L, itemTemplate->Name1);
uint32 loc_idx = Eluna::CHECKVAL<uint32>(L, 2, LocaleConstant::LOCALE_enUS);

const ItemLocale* itemLocale = eObjectMgr->GetItemLocale(itemTemplate->ItemId);
std::string name = itemTemplate->Name1;

if (itemLocale && !itemLocale->Name[loc_idx].empty())
name = itemLocale->Name[loc_idx];

Eluna::Push(L, name);
return 1;
}

Expand Down

0 comments on commit 6fbdcbf

Please sign in to comment.