mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 07:38:36 +00:00
[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:
+29
-27
@@ -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);
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ public:
|
||||
|
||||
/* Adventure related. */
|
||||
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win = false, bool remove = false);
|
||||
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
|
||||
|
||||
/* Account Related */
|
||||
|
||||
@@ -974,4 +974,22 @@ enum class DynamicZoneMemberStatus : uint8_t
|
||||
LinkDead
|
||||
};
|
||||
|
||||
enum LDoNThemes {
|
||||
Unused = 0,
|
||||
GUK,
|
||||
MIR,
|
||||
MMC,
|
||||
RUJ,
|
||||
TAK
|
||||
};
|
||||
|
||||
enum LDoNThemeBits {
|
||||
UnusedBit = 0,
|
||||
GUKBit = 1,
|
||||
MIRBit = 2,
|
||||
MMCBit = 4,
|
||||
RUJBit = 8,
|
||||
TAKBit = 16
|
||||
};
|
||||
|
||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
entry.zone_in_time = 1800;
|
||||
entry.win_points = 0;
|
||||
entry.lose_points = 0;
|
||||
entry.theme = 1;
|
||||
entry.theme = LDoNThemes::GUK;
|
||||
entry.zone_in_zone_id = 0;
|
||||
entry.zone_in_x = 0;
|
||||
entry.zone_in_y = 0;
|
||||
|
||||
@@ -717,7 +717,7 @@ public:
|
||||
entry.itemclass = 0;
|
||||
entry.itemtype = 0;
|
||||
entry.ldonprice = 0;
|
||||
entry.ldontheme = 0;
|
||||
entry.ldontheme = LDoNThemes::Unused;
|
||||
entry.ldonsold = 0;
|
||||
entry.light = 0;
|
||||
entry.lore = "";
|
||||
|
||||
+10
-6
@@ -271,9 +271,11 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
CZLDoNUpdateSubtype_Loss,
|
||||
CZLDoNUpdateSubtype_Points,
|
||||
CZLDoNUpdateSubtype_Win
|
||||
CZLDoNUpdateSubtype_AddLoss,
|
||||
CZLDoNUpdateSubtype_AddPoints,
|
||||
CZLDoNUpdateSubtype_AddWin,
|
||||
CZLDoNUpdateSubtype_RemoveLoss,
|
||||
CZLDoNUpdateSubtype_RemoveWin,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -297,9 +299,11 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
WWLDoNUpdateType_Loss,
|
||||
WWLDoNUpdateType_Points,
|
||||
WWLDoNUpdateType_Win
|
||||
WWLDoNUpdateType_AddLoss,
|
||||
WWLDoNUpdateType_AddPoints,
|
||||
WWLDoNUpdateType_AddWin,
|
||||
WWLDoNUpdateType_RemoveLoss,
|
||||
WWLDoNUpdateType_RemoveWin
|
||||
};
|
||||
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user