[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
+70 -81
View File
@@ -318,7 +318,7 @@ Client::Client(EQStreamInterface* ieqs)
adventure_stats_timer = nullptr;
adventure_leaderboard_timer = nullptr;
adv_data = nullptr;
adv_requested_theme = 0;
adv_requested_theme = LDoNThemes::Unused;
adv_requested_id = 0;
adv_requested_member_count = 0;
@@ -1375,9 +1375,8 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points) {
return false;
}
switch (theme_id)
{
case 0: { // No theme, so distribute evenly across all
switch (theme_id) {
case LDoNThemes::Unused: { // No theme, so distribute evenly across all
int split_points = (points / 5);
int guk_points = (split_points + (points % 5));
int mir_points = split_points;
@@ -1421,47 +1420,52 @@ bool Client::UpdateLDoNPoints(uint32 theme_id, int points) {
m_pp.ldon_points_ruj += ruj_points;
m_pp.ldon_points_tak += tak_points;
points -= split_points;
if (split_points != 0) // if anything left, recursively loop thru again
if (split_points != 0) { // if anything left, recursively loop thru again
UpdateLDoNPoints(0, split_points);
}
break;
}
case 1: {
case LDoNThemes::GUK: {
if(points < 0) {
if(m_pp.ldon_points_guk < (0 - points))
if(m_pp.ldon_points_guk < (0 - points)) {
return false;
}
}
m_pp.ldon_points_guk += points;
break;
}
case 2: {
case LDoNThemes::MIR: {
if(points < 0) {
if(m_pp.ldon_points_mir < (0 - points))
if(m_pp.ldon_points_mir < (0 - points)) {
return false;
}
}
m_pp.ldon_points_mir += points;
break;
}
case 3: {
case LDoNThemes::MMC: {
if(points < 0) {
if(m_pp.ldon_points_mmc < (0 - points))
if(m_pp.ldon_points_mmc < (0 - points)) {
return false;
}
}
m_pp.ldon_points_mmc += points;
break;
}
case 4: {
case LDoNThemes::RUJ: {
if(points < 0) {
if(m_pp.ldon_points_ruj < (0 - points))
if(m_pp.ldon_points_ruj < (0 - points)) {
return false;
}
}
m_pp.ldon_points_ruj += points;
break;
}
case 5: {
case LDoNThemes::TAK: {
if(points < 0) {
if(m_pp.ldon_points_tak < (0 - points))
if(m_pp.ldon_points_tak < (0 - points)) {
return false;
}
}
m_pp.ldon_points_tak += points;
break;
@@ -5490,15 +5494,15 @@ uint32 Client::GetLDoNPointsTheme(uint32 t)
{
switch(t)
{
case 1:
case LDoNThemes::GUK:
return m_pp.ldon_points_guk;
case 2:
case LDoNThemes::MIR:
return m_pp.ldon_points_mir;
case 3:
case LDoNThemes::MMC:
return m_pp.ldon_points_mmc;
case 4:
case LDoNThemes::RUJ:
return m_pp.ldon_points_ruj;
case 5:
case LDoNThemes::TAK:
return m_pp.ldon_points_tak;
default:
return 0;
@@ -5509,15 +5513,15 @@ uint32 Client::GetLDoNWinsTheme(uint32 t)
{
switch(t)
{
case 1:
case LDoNThemes::GUK:
return m_pp.ldon_wins_guk;
case 2:
case LDoNThemes::MIR:
return m_pp.ldon_wins_mir;
case 3:
case LDoNThemes::MMC:
return m_pp.ldon_wins_mmc;
case 4:
case LDoNThemes::RUJ:
return m_pp.ldon_wins_ruj;
case 5:
case LDoNThemes::TAK:
return m_pp.ldon_wins_tak;
default:
return 0;
@@ -5528,77 +5532,62 @@ uint32 Client::GetLDoNLossesTheme(uint32 t)
{
switch(t)
{
case 1:
case LDoNThemes::GUK:
return m_pp.ldon_losses_guk;
case 2:
case LDoNThemes::MIR:
return m_pp.ldon_losses_mir;
case 3:
case LDoNThemes::MMC:
return m_pp.ldon_losses_mmc;
case 4:
case LDoNThemes::RUJ:
return m_pp.ldon_losses_ruj;
case 5:
case LDoNThemes::TAK:
return m_pp.ldon_losses_tak;
default:
return 0;
}
}
void Client::AddLDoNLoss(uint32 theme_id)
{
switch (theme_id)
{
case 1:
m_pp.ldon_losses_guk += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false);
void Client::UpdateLDoNWinLoss(uint32 theme_id, bool win, bool remove) {
switch (theme_id) {
case LDoNThemes::GUK:
if (win) {
m_pp.ldon_wins_guk += (remove ? -1 : 1);
} else {
m_pp.ldon_losses_guk += (remove ? -1 : 1);
}
break;
case 2:
m_pp.ldon_losses_mir += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false);
case LDoNThemes::MIR:
if (win) {
m_pp.ldon_wins_mir += (remove ? -1 : 1);
} else {
m_pp.ldon_losses_mir += (remove ? -1 : 1);
}
break;
case 3:
m_pp.ldon_losses_mmc += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false);
case LDoNThemes::MMC:
if (win) {
m_pp.ldon_wins_mmc += (remove ? -1 : 1);
} else {
m_pp.ldon_losses_mmc += (remove ? -1 : 1);
}
break;
case 4:
m_pp.ldon_losses_ruj += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false);
case LDoNThemes::RUJ:
if (win) {
m_pp.ldon_wins_ruj += (remove ? -1 : 1);
} else {
m_pp.ldon_losses_ruj += (remove ? -1 : 1);
}
break;
case 5:
m_pp.ldon_losses_tak += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false);
case LDoNThemes::TAK:
if (win) {
m_pp.ldon_wins_tak += (remove ? -1 : 1);
} else {
m_pp.ldon_losses_tak += (remove ? -1 : 1);
}
break;
default:
return;
}
}
void Client::AddLDoNWin(uint32 theme_id)
{
switch (theme_id)
{
case 1:
m_pp.ldon_wins_guk += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true);
break;
case 2:
m_pp.ldon_wins_mir += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true);
break;
case 3:
m_pp.ldon_wins_mmc += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true);
break;
case 4:
m_pp.ldon_wins_ruj += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true);
break;
case 5:
m_pp.ldon_wins_tak += 1;
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true);
break;
default:
return;
}
}
database.UpdateAdventureStatsEntry(CharacterID(), theme_id, win, remove);
}
@@ -5981,7 +5970,7 @@ void Client::NewAdventure(int id, int theme, const char *text, int member_count,
void Client::ClearPendingAdventureData()
{
adv_requested_id = 0;
adv_requested_theme = 0;
adv_requested_theme = LDoNThemes::Unused;
safe_delete_array(adv_requested_data);
adv_requested_member_count = 0;
}