[Quest API] Add Popup methods to Perl/Lua. (#2533)

* [Quest API] Add Popup methods to Perl/Lua.

# Perl
- Add `quest::popupcentermessage(message)` to Perl.
- Add `quest::popupcolormessage(color, message)` to Perl.
- Add `quest::popupindent()` to Perl.
- Add `quest::popuplink(link)` to Perl.
- Add `quest::popuplink(link, message)` to Perl.

# Lua
- Add `eq.popup(title, message)` to Lua.
- Add `eq.popup(title, message, popup_id)` to Lua.
- Add `eq.popup(title, message, popup_id, buttons)` to Lua.
- Add `eq.popup_center_message(message)` to Lua.
- Add `eq.popup_color_message(color, message)` to Lua.
- Add `eq.popup_indent()` to Lua.
- Add `eq.popup_link(link)` to Lua.
- Add `eq.popup_link(link, message)` to Lua.

# Notes
- Adds the Perl plugins like PWAutoCenter, PWIndent, and PWHyperlink.
- Parses out HTML `<>` tags automatically in `popupautocenter` to properly center stuff like colored messages. (Doesn't work with links)
- This lets Lua users have similar functionality to Perl users.

* Add tables and break.

* Add indent_count to indent method.

* Move to Dialogue Window.
This commit is contained in:
Kinglykrab
2022-11-14 14:05:24 -05:00
committed by GitHub
parent 31e5622dad
commit 9c967c24b8
4 changed files with 272 additions and 1 deletions
+61
View File
@@ -26,6 +26,7 @@
#include "../common/misc_functions.h"
#include "../common/eqemu_logsys.h"
#include "dialogue_window.h"
#include "embperl.h"
#include "embxs.h"
#include "entity.h"
@@ -3748,6 +3749,54 @@ std::string Perl__getaaname(int aa_id)
return zone->GetAAName(aa_id);
}
std::string Perl__popupbreak() {
return DialogueWindow::Break();
}
std::string Perl__popupbreak(uint32 break_count) {
return DialogueWindow::Break(break_count);
}
std::string Perl__popupcentermessage(std::string message) {
return DialogueWindow::CenterMessage(message);
}
std::string Perl__popupcolormessage(std::string color, std::string message) {
return DialogueWindow::ColorMessage(color, message);
}
std::string Perl__popupindent() {
return DialogueWindow::Indent();
}
std::string Perl__popupindent(uint32 indent_count) {
return DialogueWindow::Indent(indent_count);
}
std::string Perl__popuplink(std::string link) {
return DialogueWindow::Link(link);
}
std::string Perl__popuplink(std::string link, std::string message) {
return DialogueWindow::Link(link, message);
}
std::string Perl__popuptable(std::string message) {
return DialogueWindow::Table(message);
}
std::string Perl__popuptablecell() {
return DialogueWindow::TableCell();
}
std::string Perl__popuptablecell(std::string message) {
return DialogueWindow::TableCell(message);
}
std::string Perl__popuptablerow(std::string message) {
return DialogueWindow::TableRow(message);
}
void perl_register_quest()
{
perl::interpreter perl(PERL_GET_THX);
@@ -4220,6 +4269,18 @@ void perl_register_quest()
package.add("popup", (void(*)(const char*, const char*, int))&Perl__popup);
package.add("popup", (void(*)(const char*, const char*, int, int))&Perl__popup);
package.add("popup", (void(*)(const char*, const char*, int, int, int))&Perl__popup);
package.add("popupbreak", (std::string(*)())&Perl__popupbreak);
package.add("popupbreak", (std::string(*)(uint32))&Perl__popupbreak);
package.add("popupcentermessage", &Perl__popupcentermessage);
package.add("popupcolormessage", &Perl__popupcolormessage);
package.add("popupindent", (std::string(*)())&Perl__popupindent);
package.add("popupindent", (std::string(*)(uint32))&Perl__popupindent);
package.add("popuplink", (std::string(*)(std::string))&Perl__popuplink);
package.add("popuplink", (std::string(*)(std::string, std::string))&Perl__popuplink);
package.add("popuptable", &Perl__popuptable);
package.add("popuptablecell", (std::string(*)())&Perl__popuptablecell);
package.add("popuptablecell", (std::string(*)(std::string))&Perl__popuptablecell);
package.add("popuptablerow", &Perl__popuptablerow);
package.add("processmobswhilezoneempty", &Perl__processmobswhilezoneempty);
package.add("pvp", &Perl__pvp);
package.add("qs_player_event", &Perl__qs_player_event);