Secrets: Added functionality to Perl/Server for $client->PlayMP3("name of file").

This commit is contained in:
SecretsOTheP 2013-12-24 01:28:32 -05:00
parent bddb03ba3b
commit a7c15ef598
15 changed files with 54 additions and 12 deletions

View File

@ -2,6 +2,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 12/24/2013 ==
Secrets (Akkadius): Perl $client->SilentMessage("Message"); addition, this is a pre-req for a Perl plugin I've shared with EQEmu. This function essentially mimics a player speaking with an NPC - which is used in popup window responses
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.
== 12/16/2013 ==
Kayen: Implemented SE_ArcheryDoubleAttack (Chance to do an extra archery attack)

View File

@ -3483,7 +3483,7 @@ struct MobRename_Struct {
};
struct PlayMP3_Struct {
char filename[128];
char filename[0];
};
//this is for custom title display in the skill window

View File

@ -2665,7 +2665,7 @@ struct MobRename_Struct {
};
struct PlayMP3_Struct {
char filename[128];
char filename[0];
};
//this is for custom title display in the skill window

View File

@ -3635,7 +3635,7 @@ struct MobRename_Struct {
};
struct PlayMP3_Struct {
char filename[128];
char filename[0];
};
//this is for custom title display in the skill window

View File

@ -3232,7 +3232,7 @@ struct MobRename_Struct {
};
struct PlayMP3_Struct {
char filename[128];
char filename[0];
};
//this is for custom title display in the skill window

View File

@ -3095,7 +3095,7 @@ struct MobRename_Struct {
};
struct PlayMP3_Struct {
char filename[128];
char filename[0];
};
//this is for custom title display in the skill window

View File

@ -2724,7 +2724,7 @@ struct MobRename_Struct {
};
struct PlayMP3_Struct {
char filename[128];
char filename[0];
};
//this is for custom title display in the skill window

View File

@ -3275,7 +3275,7 @@ struct MobRename_Struct {
};
struct PlayMP3_Struct {
char filename[128];
char filename[0];
};
//this is for custom title display in the skill window

View File

@ -579,7 +579,7 @@ OP_LoginComplete=0x0000
# discovered opcodes not yet used:
OP_PickLockSuccess=0x0000
OP_PlayMP3=0x0000
OP_PlayMP3=0x277c
OP_ReclaimCrystals=0x0000
OP_DynamicWall=0x0000
OP_OpenDiscordMerchant=0x0000

View File

@ -587,7 +587,7 @@ OP_LoginComplete=0x0000 #
# discovered opcodes not yet used:
OP_PickLockSuccess=0x0000 #
OP_PlayMP3=0x0000 #
OP_PlayMP3=0x82d7 #
OP_ReclaimCrystals=0x0000 #
OP_DynamicWall=0x0000 #
OP_OpenDiscordMerchant=0x0000 #

View File

@ -498,7 +498,7 @@ OP_ItemVerifyRequest=0x0000 #Trevius 03/15/09
OP_ItemVerifyReply=0x0000 #Trevius 03/15/09
#discovered opcodes not yet used:
OP_PlayMP3=0x0000
OP_PlayMP3=0x26ab
OP_FriendsWho=0x48fe
OP_MoveLogRequest=0x7510 #gone I think
OP_MoveLogDisregard=0x0000 #gone I think

View File

@ -581,7 +581,7 @@ OP_LoginComplete=0x0000 #
# discovered opcodes not yet used:
OP_PickLockSuccess=0x0000 #
OP_PlayMP3=0x0000 #
OP_PlayMP3=0x7f72 #
OP_ReclaimCrystals=0x0000 #
OP_DynamicWall=0x0000 #
OP_OpenDiscordMerchant=0x0000 #

View File

@ -8062,3 +8062,13 @@ void Client::SendMarqueeMessage(uint32 type, uint32 priority, uint32 fade_in, ui
QueuePacket(&outapp);
}
void Client::PlayMP3(const char* fname)
{
std::string filename = fname;
EQApplicationPacket *outapp = new EQApplicationPacket(OP_PlayMP3, filename.length() + 1);
PlayMP3_Struct* buf = (PlayMP3_Struct*)outapp->pBuffer;
strncpy(buf->filename, fname, filename.length());
QueuePacket(outapp);
safe_delete(outapp);
}

View File

@ -1158,6 +1158,7 @@ public:
void SetAccountFlag(std::string flag, std::string val);
std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillUseTypes);
void Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_consume);
void PlayMP3(const char* fname);
int mod_client_damage(int damage, SkillUseTypes skillinuse, int hand, const ItemInst* weapon, Mob* other);
bool mod_client_message(char* message, uint8 chan_num);
bool mod_can_increase_skill(SkillUseTypes skillid, Mob* against_who);

View File

@ -5848,6 +5848,32 @@ XS(XS_Client_SilentMessage)
XSRETURN_EMPTY;
}
XS(XS_Client_PlayMP3); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_PlayMP3)
{
dXSARGS;
if (items < 1 || items > 2)
Perl_croak(aTHX_ "Usage: Client::PlayMP3(THIS, fname)");
{
Client * THIS;
char * fname = nullptr;
if (sv_derived_from(ST(0), "Client")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Client *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (items > 1) { fname = (char *)SvPV_nolen(ST(1)); }
THIS->PlayMP3(fname);
}
XSRETURN_EMPTY;
}
#ifdef __cplusplus
extern "C"
#endif
@ -6082,6 +6108,7 @@ XS(boot_Client)
newXSproto(strcpy(buf, "SetThirst"), XS_Client_SetThirst, file, "$$");
newXSproto(strcpy(buf, "SetConsumption"), XS_Client_SetConsumption, file, "$$$");
newXSproto(strcpy(buf, "SilentMessage"), XS_Client_SilentMessage, file, "$$");
newXSproto(strcpy(buf, "PlayMP3"), XS_Client_PlayMP3, file, "$;$");
XSRETURN_YES;
}