[Quest API] Add remove LDoN Win/Loss to Perl and Lua. (#1611)

* [Quest API] Add remove LDoN Win/Loss to Perl and Lua.
- Add $client->RemoveLDoNLoss(theme_id) to Perl.
- Add $client->RemoveLDoNWin(theme_id) to Perl.
- Add quest::removeldonloss(theme_id) to Perl.
- Add quest::removeldonwin(theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbyexpeditionid(expedition_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonlossbyclientname(client_name, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbyexpeditionid(expedition_id, theme_id) to Perl.
- Add quest::crosszoneremoveldonwinbyclientname(client_name, theme_id) to Perl.
- Add quest::worldwideaddldonloss(theme_id, min_status, max_status) to Perl.
- Add quest::worldwideaddldonwin(theme_id, min_status, max_status) to Perl.
- Add client:RemoveLDoNLoss(theme_id) to Lua.
- Add client:RemoveLDoNWin(theme_id) to Lua.
- Add eq.remove_ldon_loss(theme_id) to Lua.
- Add eq.remove_ldon_win(theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_expedition_id(expedition_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_loss_by_client_name(client_name, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_expedition_id(expedition_id, theme_id) to Lua.
- Add eq.cross_zone_remove_ldon_win_by_client_name(client_name, theme_id) to Lua.
- Add eq.world_wide_add_ldon_loss(theme_id, min_status, max_status) to Lua.
- Add eq.world_wide_add_ldon_win(theme_id, min_status, max_status) to Lua.
Adds enum for LDoN Themes and Theme Bitmasks so we're not using magic numbers.
Adds item links to item messages and augment messages on rejection/restriction/Lore.

* Update client_packet.cpp

* Update client_packet.cpp

* Update servertalk.h

Alphabetical.
This commit is contained in:
Kinglykrab
2021-10-20 15:11:14 -04:00
committed by GitHub
parent c838564023
commit efab0c4b6b
18 changed files with 1337 additions and 635 deletions
+29 -27
View File
@@ -2042,62 +2042,64 @@ void Database::ClearRaidLeader(uint32 gid, uint32 rid)
QueryDatabase(query);
}
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove)
{
std::string field;
switch(theme)
{
case 1:
{
switch(theme) {
case LDoNThemes::GUK: {
field = "guk_";
break;
}
case 2:
{
case LDoNThemes::MIR: {
field = "mir_";
break;
}
case 3:
{
case LDoNThemes::MMC: {
field = "mmc_";
break;
}
case 4:
{
case LDoNThemes::RUJ: {
field = "ruj_";
break;
}
case 5:
{
case LDoNThemes::TAK: {
field = "tak_";
break;
}
default:
{
default: {
return;
}
}
if (win)
field += "wins";
else
field += "losses";
field += win ? "wins" : "losses";
std::string field_operation = remove ? "-" : "+";
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s+1 WHERE player_id=%u",field.c_str(), field.c_str(), char_id);
std::string query = fmt::format(
"UPDATE `adventure_stats` SET {} = {} {} 1 WHERE player_id = {}",
field,
field,
field_operation,
char_id
);
auto results = QueryDatabase(query);
if (results.RowsAffected() != 0)
if (results.RowsAffected() != 0) {
return;
}
query = StringFormat("INSERT INTO `adventure_stats` SET %s=1, player_id=%u", field.c_str(), char_id);
QueryDatabase(query);
if (!remove) {
query = fmt::format(
"INSERT INTO `adventure_stats` SET {} = 1, player_id = {}",
field,
char_id
);
QueryDatabase(query);
}
}
bool Database::GetAdventureStats(uint32 char_id, AdventureStats_Struct *as)
{
std::string query = StringFormat(
std::string query = fmt::format(
"SELECT "
"`guk_wins`, "
"`mir_wins`, "
@@ -2112,7 +2114,7 @@ bool Database::GetAdventureStats(uint32 char_id, AdventureStats_Struct *as)
"FROM "
"`adventure_stats` "
"WHERE "
"player_id = %u ",
"player_id = {}",
char_id
);
auto results = QueryDatabase(query);