Add Popup2 .. allows for more customization of the popup window. Using PlayMp3 with the SoundControl option for Popup2 enabled will allow you to adjust sound volume as well.

This commit is contained in:
Natedog2012 2017-06-03 16:16:05 -07:00
parent fd6387c830
commit daced25101
12 changed files with 92 additions and 4 deletions

View File

@ -1695,6 +1695,7 @@ struct OnLevelMessage_Struct
uint32 Duration;
uint32 PopupID;
uint32 NegativeID;
uint32 SoundControls;
char ButtonName0[25];
char ButtonName1[25];
};

View File

@ -1849,6 +1849,7 @@ namespace RoF
eq->Text_Count = 4096;
memcpy(eq->Text, emu->Text, sizeof(eq->Text));
OUT(Buttons);
OUT(SoundControls);
OUT(Duration);
OUT(PopupID);
OUT(NegativeID);

View File

@ -1927,6 +1927,7 @@ namespace RoF2
eq->Text_Count = 4096;
memcpy(eq->Text, emu->Text, sizeof(eq->Text));
OUT(Buttons);
OUT(SoundControls);
OUT(Duration);
OUT(PopupID);
OUT(NegativeID);

View File

@ -2092,7 +2092,7 @@ struct OnLevelMessage_Struct {
/*0000*/ uint32 ButtonName1_Count;
/*0000*/ char ButtonName1[25];
/*0000*/ uint8 Buttons;
/*0000*/ uint8 Unknown4275; // Something to do with audio controls
/*0000*/ uint8 SoundControls; // Something to do with audio controls
/*0000*/ uint32 Duration;
/*0000*/ uint32 PopupID; // If none zero, a response packet with 00 00 00 00 <PopupID> is returned on clicking the left button
/*0000*/ uint32 NegativeID; // If none zero, a response packet with 01 00 00 00 <NegativeID> is returned on clicking the right button

View File

@ -2122,7 +2122,7 @@ struct OnLevelMessage_Struct {
/*0000*/ uint32 ButtonName1_Count;
/*0000*/ char ButtonName1[25];
/*0000*/ uint8 Buttons;
/*0000*/ uint8 Unknown4275; // Something to do with audio controls
/*0000*/ uint8 SoundControls; // Something to do with audio controls
/*0000*/ uint32 Duration;
/*0000*/ uint32 PopupID; // If none zero, a response packet with 00 00 00 00 <PopupID> is returned on clicking the left button
/*0000*/ uint32 NegativeID; // If none zero, a response packet with 01 00 00 00 <NegativeID> is returned on clicking the right button

View File

@ -1373,6 +1373,7 @@ namespace SoD
memcpy(eq->Title, emu->Title, sizeof(eq->Title));
memcpy(eq->Text, emu->Text, sizeof(eq->Text));
OUT(Buttons);
OUT(SoundControls);
OUT(Duration);
OUT(PopupID);
OUT(NegativeID);

View File

@ -1760,7 +1760,7 @@ struct OnLevelMessage_Struct {
/*4224*/ char ButtonName0[25]; // If Buttons = 1, these two are the text for the left and right buttons respectively
/*4249*/ char ButtonName1[25];
/*4274*/ uint8 Buttons;
/*4275*/ uint8 Unknown4275; // Something to do with audio controls
/*4275*/ uint8 SoundControls; // Something to do with audio controls
/*4276*/ uint32 Duration;
/*4280*/ uint32 PopupID; // If none zero, a response packet with 00 00 00 00 <PopupID> is returned on clicking the left button
/*4284*/ uint32 NegativeID; // If none zero, a response packet with 01 00 00 00 <NegativeID> is returned on clicking the right button

View File

@ -1607,6 +1607,7 @@ namespace UF
memcpy(eq->Title, emu->Title, sizeof(eq->Title));
memcpy(eq->Text, emu->Text, sizeof(eq->Text));
OUT(Buttons);
OUT(SoundControls);
OUT(Duration);
OUT(PopupID);
OUT(NegativeID);

View File

@ -1801,7 +1801,7 @@ struct OnLevelMessage_Struct {
/*4224*/ char ButtonName0[25]; // If Buttons = 1, these two are the text for the left and right buttons respectively
/*4249*/ char ButtonName1[25];
/*4274*/ uint8 Buttons;
/*4275*/ uint8 Unknown4275; // Something to do with audio controls
/*4275*/ uint8 SoundControls; // Something to do with audio controls
/*4276*/ uint32 Duration;
/*4280*/ uint32 PopupID; // If none zero, a response packet with 00 00 00 00 <PopupID> is returned on clicking the left button
/*4284*/ uint32 NegativeID; // If none zero, a response packet with 01 00 00 00 <NegativeID> is returned on clicking the right button

View File

@ -3929,6 +3929,46 @@ void Client::SendPopupToClient(const char *Title, const char *Text, uint32 Popup
safe_delete(outapp);
}
void Client::SendFullPopup(const char *Title, const char *Text, uint32 PopupID, uint32 NegativeID, uint32 Duration, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 SoundControls) {
auto outapp = new EQApplicationPacket(OP_OnLevelMessage, sizeof(OnLevelMessage_Struct));
OnLevelMessage_Struct *olms = (OnLevelMessage_Struct *)outapp->pBuffer;
if((strlen(Text) > (sizeof(olms->Text)-1)) || (strlen(Title) > (sizeof(olms->Title) - 1)) ) {
safe_delete(outapp);
return;
}
if (ButtonName0 && ButtonName1 && ( (strlen(ButtonName0) > (sizeof(olms->ButtonName0) - 1)) || (strlen(ButtonName1) > (sizeof(olms->ButtonName1) - 1)) ) ) {
safe_delete(outapp);
return;
}
strcpy(olms->Title, Title);
strcpy(olms->Text, Text);
olms->Buttons = Buttons;
if (ButtonName0 == NULL || ButtonName1 == NULL) {
sprintf(olms->ButtonName0, "%s", "Yes");
sprintf(olms->ButtonName1, "%s", "No");
} else {
strcpy(olms->ButtonName0, ButtonName0);
strcpy(olms->ButtonName1, ButtonName1);
}
if(Duration > 0)
olms->Duration = Duration * 1000;
else
olms->Duration = 0xffffffff;
olms->PopupID = PopupID;
olms->NegativeID = NegativeID;
olms->SoundControls = SoundControls;
QueuePacket(outapp);
safe_delete(outapp);
}
void Client::SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...) {
va_list argptr;
char buffer[4096];

View File

@ -945,6 +945,7 @@ public:
inline bool HasSpellScribed(int spellid) { return (FindSpellBookSlotBySpellID(spellid) != -1 ? true : false); }
uint16 GetMaxSkillAfterSpecializationRules(EQEmu::skills::SkillType skillid, uint16 maxSkill);
void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0);
void SendFullPopup(const char *Title, const char *Text, uint32 PopupID = 0, uint32 NegativeID = 0, uint32 Buttons = 0, uint32 Duration = 0, const char *ButtonName0 = 0, const char *ButtonName1 = 0, uint32 SoundControls = 0);
void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...);
bool PendingTranslocate;
time_t TranslocateTime;

View File

@ -6444,6 +6444,47 @@ XS(XS_Client_GetAccountAge) {
XSRETURN(1);
}
XS(XS_Client_Popup2); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_Popup2)
{
dXSARGS;
if (items < 3 || items > 10)
Perl_croak(aTHX_ "Usage: Client::SendFullPopup(THIS, Title, Text, PopupID, NegativeID, Duration, Buttons, ButtonName0, ButtonName1, SoundControls)");
{
Client * THIS;
char* Title = (char *)SvPV_nolen(ST(1));
char* Text = (char *)SvPV_nolen(ST(2));
uint32 PopupID = 0;
uint32 NegativeID = 0;
uint32 Duration = 0;
uint32 Buttons = 0;
char* ButtonName0 = 0;
char* ButtonName1 = 0;
uint32 SoundControls = 0;
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 Client");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (items > 3) { PopupID = (uint32)SvUV(ST(3)); }
if (items > 4) { NegativeID = (uint32)SvUV(ST(4)); }
if (items > 5) { Duration = (uint32)SvUV(ST(5)); }
if (items > 6) { Buttons = (uint32)SvUV(ST(6)); }
if (items > 7) { ButtonName0 = (char *)SvPV_nolen(ST(7)); }
if (items > 8) { ButtonName1 = (char *)SvPV_nolen(ST(8)); }
if (items > 9) { SoundControls = (uint32)SvUV(ST(9)); }
THIS->SendFullPopup(Title, Text, PopupID, NegativeID, Duration, Buttons, ButtonName0, ButtonName1, SoundControls);
}
XSRETURN_EMPTY;
}
#ifdef __cplusplus
extern "C"
@ -6698,6 +6739,7 @@ XS(boot_Client)
newXSproto(strcpy(buf, "CalcEXP"), XS_Client_CalcEXP, file, "$");
newXSproto(strcpy(buf, "GetMoney"), XS_Client_GetMoney, file, "$$$");
newXSproto(strcpy(buf, "GetAccountAge"), XS_Client_GetAccountAge, file, "$");
newXSproto(strcpy(buf, "Popup2"), XS_Client_Popup2, file, "$$$;$$$$$$$");
XSRETURN_YES;
}