Skip to content

Commit

Permalink
Secrets: Added functionality to Perl/Server for $client->PlayMP3("nam…
Browse files Browse the repository at this point in the history
…e of file").
  • Loading branch information
SecretsOTheP committed Dec 24, 2013
1 parent bddb03b commit a7c15ef
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 12 deletions.
6 changes: 5 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ 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)
Kayen: Implemented SE_ShieldEquipDmgMod (Increase damage in primary hand if shield equiped)
Expand Down
2 changes: 1 addition & 1 deletion common/eq_packet_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/patches/Client62_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/patches/RoF_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/patches/SoD_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/patches/SoF_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/patches/Titanium_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/patches/Underfoot_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/patches/patch_RoF.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/patches/patch_SoD.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
2 changes: 1 addition & 1 deletion utils/patches/patch_Titanium.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/patches/patch_Underfoot.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
10 changes: 10 additions & 0 deletions zone/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8061,4 +8061,14 @@ void Client::SendMarqueeMessage(uint32 type, uint32 priority, uint32 fade_in, ui
strcpy(cms->msg, msg.c_str());

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);
}
1 change: 1 addition & 0 deletions zone/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,7 @@ class Client : public Mob
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);
Expand Down
27 changes: 27 additions & 0 deletions zone/perl_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit a7c15ef

Please sign in to comment.