mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Add new methods. Closes https://github.com/ElunaLuaEngine/Eluna/pull/176 and https://github.com/ElunaLuaEngine/Eluna/issues/171
This commit is contained in:
@@ -228,6 +228,9 @@ ElunaRegister<WorldObject> WorldObjectMethods[] =
|
||||
{ "RegisterEvent", &LuaWorldObject::RegisterEvent },
|
||||
{ "RemoveEventById", &LuaWorldObject::RemoveEventById },
|
||||
{ "RemoveEvents", &LuaWorldObject::RemoveEvents },
|
||||
{ "PlayMusic", &LuaWorldObject::PlayMusic },
|
||||
{ "PlayDirectSound", &LuaWorldObject::PlayDirectSound },
|
||||
{ "PlayDistanceSound", &LuaWorldObject::PlayDistanceSound },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
@@ -381,8 +384,6 @@ ElunaRegister<Unit> UnitMethods[] =
|
||||
{ "CastSpell", &LuaUnit::CastSpell },
|
||||
{ "CastCustomSpell", &LuaUnit::CastCustomSpell },
|
||||
{ "CastSpellAoF", &LuaUnit::CastSpellAoF },
|
||||
{ "PlayDirectSound", &LuaUnit::PlayDirectSound },
|
||||
{ "PlayDistanceSound", &LuaUnit::PlayDistanceSound },
|
||||
{ "Kill", &LuaUnit::Kill },
|
||||
{ "StopSpellCast", &LuaUnit::StopSpellCast },
|
||||
{ "InterruptSpell", &LuaUnit::InterruptSpell },
|
||||
@@ -651,7 +652,6 @@ ElunaRegister<Player> PlayerMethods[] =
|
||||
{ "RemoveItem", &LuaPlayer::RemoveItem },
|
||||
{ "RemoveLifetimeKills", &LuaPlayer::RemoveLifetimeKills },
|
||||
{ "ResurrectPlayer", &LuaPlayer::ResurrectPlayer },
|
||||
{ "PlaySoundToPlayer", &LuaPlayer::PlaySoundToPlayer },
|
||||
{ "EquipItem", &LuaPlayer::EquipItem },
|
||||
{ "ResetSpellCooldown", &LuaPlayer::ResetSpellCooldown },
|
||||
{ "ResetTypeCooldowns", &LuaPlayer::ResetTypeCooldowns },
|
||||
@@ -733,6 +733,8 @@ ElunaRegister<Player> PlayerMethods[] =
|
||||
{ "SaveToDB", &LuaPlayer::SaveToDB },
|
||||
{ "GroupInvite", &LuaPlayer::GroupInvite },
|
||||
{ "GroupCreate", &LuaPlayer::GroupCreate },
|
||||
{ "SendCinematicStart", &LuaPlayer::SendCinematicStart },
|
||||
{ "SendMovieStart", &LuaPlayer::SendMovieStart },
|
||||
#ifdef CLASSIC
|
||||
{ "UpdateHonor", &LuaPlayer::UpdateHonor },
|
||||
{ "ResetHonor", &LuaPlayer::ResetHonor },
|
||||
|
||||
@@ -3713,24 +3713,6 @@ namespace LuaPlayer
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays sound to [Player]
|
||||
*
|
||||
* See [Unit:PlayDirectSound]
|
||||
*
|
||||
* @param uint32 sound : entry of a sound
|
||||
*/
|
||||
int PlaySoundToPlayer(Eluna* /*E*/, lua_State* L, Player* player)
|
||||
{
|
||||
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
SoundEntriesEntry const* soundEntry = sSoundEntriesStore.LookupEntry(soundId);
|
||||
if (!soundEntry)
|
||||
return 0;
|
||||
|
||||
player->PlayDirectSound(soundId, player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to start the taxi/flying to the given pathID
|
||||
*
|
||||
@@ -3944,6 +3926,32 @@ namespace LuaPlayer
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a cinematic for the [Player]
|
||||
*
|
||||
* @param uint32 CinematicSequenceId : entry of a cinematic
|
||||
*/
|
||||
int SendCinematicStart(Eluna* /*E*/, lua_State* L, Player* player)
|
||||
{
|
||||
uint32 CinematicSequenceId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
player->SendCinematicStart(CinematicSequenceId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a movie for the [Player]
|
||||
*
|
||||
* @param uint32 MovieId : entry of a movie
|
||||
*/
|
||||
int SendMovieStart(Eluna* /*E*/, lua_State* L, Player* player)
|
||||
{
|
||||
uint32 MovieId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
|
||||
player->SendMovieStart(MovieId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*int BindToInstance(Eluna* E, lua_State* L, Player* player)
|
||||
{
|
||||
player->BindToInstance();
|
||||
|
||||
@@ -2455,49 +2455,6 @@ namespace LuaUnit
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The [Unit] plays a sound to a [Player], if no [Player] it will play the sound to everyone near
|
||||
*
|
||||
* @param uint32 sound : entry of a sound
|
||||
* @param [Player] player : [Player] to play the sound to
|
||||
*/
|
||||
int PlayDirectSound(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||
{
|
||||
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
|
||||
if (!sSoundEntriesStore.LookupEntry(soundId))
|
||||
return 0;
|
||||
|
||||
if (player)
|
||||
unit->PlayDirectSound(soundId, player);
|
||||
else
|
||||
unit->PlayDirectSound(soundId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The [Unit] plays a sound to a [Player]
|
||||
*
|
||||
* If no [Player] it will play the sound to everyone near
|
||||
* Sound will fade the further you are
|
||||
*
|
||||
* @param uint32 sound : entry of a sound
|
||||
* @param [Player] player : [Player] to play the sound to
|
||||
*/
|
||||
int PlayDistanceSound(Eluna* /*E*/, lua_State* L, Unit* unit)
|
||||
{
|
||||
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
|
||||
if (!sSoundEntriesStore.LookupEntry(soundId))
|
||||
return 0;
|
||||
|
||||
if (player)
|
||||
unit->PlayDistanceSound(soundId, player);
|
||||
else
|
||||
unit->PlayDistanceSound(soundId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given unit state for the [Unit].
|
||||
*
|
||||
|
||||
@@ -834,5 +834,81 @@ namespace LuaWorldObject
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The [WorldObject] plays music to a [Player]
|
||||
*
|
||||
* If no [Player] provided it will play the music to everyone near.
|
||||
* This method does not interrupt previously played music.
|
||||
*
|
||||
* See also [WorldObject:PlayDistanceSound], [WorldObject:PlayDirectSound]
|
||||
*
|
||||
* @param uint32 music : entry of a music
|
||||
* @param [Player] player = nil : [Player] to play the music to
|
||||
*/
|
||||
int PlayMusic(Eluna* /*E*/, lua_State* L, WorldObject* obj)
|
||||
{
|
||||
uint32 musicid = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
|
||||
|
||||
WorldPacket data(SMSG_PLAY_MUSIC, 4);
|
||||
data << uint32(musicid);
|
||||
if (player)
|
||||
player->SendDirectMessage(&data);
|
||||
else
|
||||
obj->SendMessageToSet(&data, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The [WorldObject] plays a sound to a [Player]
|
||||
*
|
||||
* If no [Player] provided it will play the sound to everyone near.
|
||||
* This method will play sound and does not interrupt prvious sound.
|
||||
*
|
||||
* See also [WorldObject:PlayDistanceSound], [WorldObject:PlayMusic]
|
||||
*
|
||||
* @param uint32 sound : entry of a sound
|
||||
* @param [Player] player = nil : [Player] to play the sound to
|
||||
*/
|
||||
int PlayDirectSound(Eluna* /*E*/, lua_State* L, WorldObject* obj)
|
||||
{
|
||||
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
|
||||
if (!sSoundEntriesStore.LookupEntry(soundId))
|
||||
return 0;
|
||||
|
||||
if (player)
|
||||
obj->PlayDirectSound(soundId, player);
|
||||
else
|
||||
obj->PlayDirectSound(soundId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The [WorldObject] plays a sound to a [Player]
|
||||
*
|
||||
* If no [Player] it will play the sound to everyone near.
|
||||
* Sound will fade the further you are from the [WorldObject].
|
||||
* This method interrupts previously playing sound.
|
||||
*
|
||||
* See also [WorldObject:PlayDirectSound], [WorldObject:PlayMusic]
|
||||
*
|
||||
* @param uint32 sound : entry of a sound
|
||||
* @param [Player] player = nil : [Player] to play the sound to
|
||||
*/
|
||||
int PlayDistanceSound(Eluna* /*E*/, lua_State* L, WorldObject* obj)
|
||||
{
|
||||
uint32 soundId = Eluna::CHECKVAL<uint32>(L, 2);
|
||||
Player* player = Eluna::CHECKOBJ<Player>(L, 3, false);
|
||||
if (!sSoundEntriesStore.LookupEntry(soundId))
|
||||
return 0;
|
||||
|
||||
if (player)
|
||||
obj->PlayDistanceSound(soundId, player);
|
||||
else
|
||||
obj->PlayDistanceSound(soundId);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user