mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-04 18:46:37 +00:00
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:
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user