From 646e1f541c4b2446e92be3a8804ca20a6f094e74 Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 24 Dec 2013 00:27:57 -0800 Subject: [PATCH] Added lua export for Client:PlayMP3 --- changelog.txt | 2 ++ zone/lua_client.cpp | 9 ++++++++- zone/lua_client.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 50faa0054..ccbf7a95e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,8 @@ Secrets: Added functionality to Perl for $client->PlayMP3("name of file"). Usage varies, but typically you can place an MP3/WAV/XMI in the EQDir//sounds, pfs, s3d, or root client folder and it will play through this Perl function. Example, $client->PlayMP3("combattheme1.mp3") or $client->PlayMP3("TUTBTrade1.mp3") All clients except Secrets of Faydwer and 6.2 have their opcodes identified for this function. The struct + supported params is the same throughout versions. Use $client->PlayMP3 with an invalid sound file to stop playback or simply wait for it to end. +KLS: Added functionality to Lua for Client:PlayMP3(filename) +KLS: Added functionality to Lua for Client:SendMarqueeMessage(type, priority/opacity, fade_in_time_ms, fade_out_time_ms, duration_ms, msg) == 12/16/2013 == Kayen: Implemented SE_ArcheryDoubleAttack (Chance to do an extra archery attack) diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 61e2a9290..f49fb0da0 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -1234,6 +1234,12 @@ void Lua_Client::SendMarqueeMessage(uint32 type, uint32 priority, uint32 fade_in self->SendMarqueeMessage(type, priority, fade_in, fade_out, duration, msg); } +void Lua_Client::PlayMP3(std::string file) +{ + Lua_Safe_Call_Void(); + self->PlayMP3(file.c_str()); +} + luabind::scope lua_register_client() { return luabind::class_("Client") .def(luabind::constructor<>()) @@ -1479,7 +1485,8 @@ luabind::scope lua_register_client() { .def("SetHunger", (void(Lua_Client::*)(int))&Lua_Client::SetHunger) .def("SetThirst", (void(Lua_Client::*)(int))&Lua_Client::SetThirst) .def("SetConsumption", (void(Lua_Client::*)(int, int))&Lua_Client::SetConsumption) - .def("SendMarqueeMessage", (void(Lua_Client::*)(uint32, uint32, uint32, uint32, uint32, std::string))&Lua_Client::SendMarqueeMessage); + .def("SendMarqueeMessage", (void(Lua_Client::*)(uint32, uint32, uint32, uint32, uint32, std::string))&Lua_Client::SendMarqueeMessage) + .def("PlayMP3", (void(Lua_Client::*)(std::string))&Lua_Client::PlayMP3); } luabind::scope lua_register_inventory_where() { diff --git a/zone/lua_client.h b/zone/lua_client.h index f4a45c526..4aedd0df5 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -274,6 +274,7 @@ public: void SetThirst(int in_thirst); void SetConsumption(int in_hunger, int in_thirst); void SendMarqueeMessage(uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, std::string msg); + void PlayMP3(std::string file); }; #endif