mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-28 05:35:46 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74fde3972b | |||
| 5e45bf262d | |||
| e4dc304b5a | |||
| aff1223181 |
+1
-4
@@ -252,7 +252,6 @@ IF(ZLIB_FOUND)
|
||||
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
|
||||
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
|
||||
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_BINARY_DIR}/libs/zlibng")
|
||||
ELSE()
|
||||
SET(ZLIB_LIBRARY_TYPE " zlib")
|
||||
SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY})
|
||||
@@ -313,7 +312,7 @@ IF(LUA_LIBRARY_ENABLED)
|
||||
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
ADD_DEFINITIONS(-DLUA_EQEMU)
|
||||
SET(ZONE_LIBS ${LUA_LIBRARY_LIBS})
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} ${LUA_LIBRARY_LIBS})
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${LUA_LIBRARY_INCLUDE}")
|
||||
|
||||
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
|
||||
@@ -348,8 +347,6 @@ IF(UNIX)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS})
|
||||
|
||||
IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED)
|
||||
MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.")
|
||||
ENDIF()
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
We expect contributors and community members to act professionally and respectfully, and we expect our forums and Discord channels to be dignified environments that expand the community and enhance the learning experience for new members.
|
||||
|
||||
Specifically:
|
||||
|
||||
* Respect people, their ideas, and their work.
|
||||
* Be kind. Be courteous. Be welcoming.
|
||||
* Listen. Consider and acknowledge people's points before responding.
|
||||
* Be respectful of differing viewpoints and experience levels.
|
||||
* Accept constructive criticism and work together toward decisions.
|
||||
* Focus on what is best for the community and users.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of violent threats, trolling, insulting/derogatory comments, abusive or discriminatory language, or personal attacks.
|
||||
* Public or private harassment.
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission.
|
||||
* Conduct which could reasonably be considered inappropriate in a professional setting.
|
||||
* Advocating for or encouraging any of the above behaviors.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, forum posts, Discord messages, and other contributions that are not aligned with this code of conduct.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project.
|
||||
+2
-2
@@ -16,6 +16,6 @@ build:
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- cmd: >-
|
||||
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
|
||||
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
|
||||
|
||||
appveyor PushArtifact build_x64-bots.zip
|
||||
appveyor PushArtifact build_x64-bots.zip
|
||||
@@ -16,6 +16,6 @@ build:
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- cmd: >-
|
||||
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
|
||||
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
|
||||
|
||||
appveyor PushArtifact build_x64-no-bots.zip
|
||||
appveyor PushArtifact build_x64-no-bots.zip
|
||||
@@ -38,7 +38,7 @@ locations other than lua/
|
||||
find_path(LUAJIT_INCLUDE_DIR lua.h
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1 include
|
||||
PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
@@ -49,7 +49,7 @@ find_path(LUAJIT_INCLUDE_DIR lua.h
|
||||
)
|
||||
|
||||
find_library(LUAJIT_LIBRARY
|
||||
NAMES luajit51 luajit5.1 luajit-5.1 luajit lua51
|
||||
NAMES luajit51 luajit5.1 luajit-5.1 luajit
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES lib
|
||||
|
||||
+2
-13
@@ -16,7 +16,6 @@ SET(common_sources
|
||||
database_instances.cpp
|
||||
dbcore.cpp
|
||||
deity.cpp
|
||||
dynamic_zone_base.cpp
|
||||
emu_constants.cpp
|
||||
emu_limits.cpp
|
||||
emu_opcodes.cpp
|
||||
@@ -32,8 +31,6 @@ SET(common_sources
|
||||
eq_stream_proxy.cpp
|
||||
eqtime.cpp
|
||||
event_sub.cpp
|
||||
expedition_base.cpp
|
||||
expedition_lockout_timer.cpp
|
||||
extprofile.cpp
|
||||
faction.cpp
|
||||
file_util.cpp
|
||||
@@ -70,7 +67,6 @@ SET(common_sources
|
||||
rulesys.cpp
|
||||
say_link.cpp
|
||||
serialize_buffer.cpp
|
||||
server_event_scheduler.cpp
|
||||
serverinfo.cpp
|
||||
shareddb.cpp
|
||||
skills.cpp
|
||||
@@ -177,10 +173,10 @@ SET(repositories
|
||||
repositories/base/base_discovered_items_repository.h
|
||||
repositories/base/base_doors_repository.h
|
||||
repositories/base/base_dynamic_zones_repository.h
|
||||
repositories/base/base_dynamic_zone_members_repository.h
|
||||
repositories/base/base_eventlog_repository.h
|
||||
repositories/base/base_expeditions_repository.h
|
||||
repositories/base/base_expedition_lockouts_repository.h
|
||||
repositories/base/base_expedition_members_repository.h
|
||||
repositories/base/base_faction_base_data_repository.h
|
||||
repositories/base/base_faction_list_repository.h
|
||||
repositories/base/base_faction_list_mod_repository.h
|
||||
@@ -254,7 +250,6 @@ SET(repositories
|
||||
repositories/base/base_rule_sets_repository.h
|
||||
repositories/base/base_rule_values_repository.h
|
||||
repositories/base/base_saylink_repository.h
|
||||
repositories/base/base_server_scheduled_events_repository.h
|
||||
repositories/base/base_skill_caps_repository.h
|
||||
repositories/base/base_spawn2_repository.h
|
||||
repositories/base/base_spawnentry_repository.h
|
||||
@@ -341,10 +336,10 @@ SET(repositories
|
||||
repositories/discovered_items_repository.h
|
||||
repositories/doors_repository.h
|
||||
repositories/dynamic_zones_repository.h
|
||||
repositories/dynamic_zone_members_repository.h
|
||||
repositories/eventlog_repository.h
|
||||
repositories/expeditions_repository.h
|
||||
repositories/expedition_lockouts_repository.h
|
||||
repositories/expedition_members_repository.h
|
||||
repositories/faction_base_data_repository.h
|
||||
repositories/faction_list_repository.h
|
||||
repositories/faction_list_mod_repository.h
|
||||
@@ -418,7 +413,6 @@ SET(repositories
|
||||
repositories/rule_sets_repository.h
|
||||
repositories/rule_values_repository.h
|
||||
repositories/saylink_repository.h
|
||||
repositories/server_scheduled_events_repository.h
|
||||
repositories/skill_caps_repository.h
|
||||
repositories/spawn2_repository.h
|
||||
repositories/spawnentry_repository.h
|
||||
@@ -465,14 +459,12 @@ SET(common_headers
|
||||
cli/argh.h
|
||||
cli/eqemu_command_handler.h
|
||||
cli/terminal_color.hpp
|
||||
cron/croncpp.h
|
||||
database/database_dump_service.h
|
||||
data_verification.h
|
||||
database.h
|
||||
database_schema.h
|
||||
dbcore.h
|
||||
deity.h
|
||||
dynamic_zone_base.h
|
||||
emu_constants.h
|
||||
emu_limits.h
|
||||
emu_opcodes.h
|
||||
@@ -496,8 +488,6 @@ SET(common_headers
|
||||
eqtime.h
|
||||
errmsg.h
|
||||
event_sub.h
|
||||
expedition_base.h
|
||||
expedition_lockout_timer.h
|
||||
extprofile.h
|
||||
faction.h
|
||||
file_util.h
|
||||
@@ -549,7 +539,6 @@ SET(common_headers
|
||||
say_link.h
|
||||
seperator.h
|
||||
serialize_buffer.h
|
||||
server_event_scheduler.h
|
||||
serverinfo.h
|
||||
servertalk.h
|
||||
shareddb.h
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "../database.h"
|
||||
#include "../rulesys.h"
|
||||
#include "../eqemu_logsys.h"
|
||||
#include "../repositories/content_flags_repository.h"
|
||||
|
||||
|
||||
WorldContentService::WorldContentService()
|
||||
@@ -100,21 +99,3 @@ bool WorldContentService::IsContentFlagEnabled(const std::string& content_flag)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void WorldContentService::ReloadContentFlags(Database &db)
|
||||
{
|
||||
std::vector<std::string> set_content_flags;
|
||||
auto content_flags = ContentFlagsRepository::GetWhere(db, "enabled = 1");
|
||||
|
||||
set_content_flags.reserve(content_flags.size());
|
||||
for (auto &flags: content_flags) {
|
||||
set_content_flags.push_back(flags.flag_name);
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"Enabled content flags [{}]",
|
||||
implode(", ", set_content_flags)
|
||||
);
|
||||
|
||||
SetContentFlags(set_content_flags);
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Database;
|
||||
|
||||
namespace Expansion {
|
||||
static const int EXPANSION_ALL = -1;
|
||||
static const int EXPANSION_FILTER_MAX = 99;
|
||||
@@ -167,7 +165,6 @@ public:
|
||||
const std::vector<std::string> &GetContentFlags() const;
|
||||
bool IsContentFlagEnabled(const std::string& content_flag);
|
||||
void SetContentFlags(std::vector<std::string> content_flags);
|
||||
void ReloadContentFlags(Database &db);
|
||||
void SetExpansionContext();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,876 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <bitset>
|
||||
#include <cctype>
|
||||
#include <ctime>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
#if __cplusplus > 201402L
|
||||
#include <string_view>
|
||||
#define CRONCPP_IS_CPP17
|
||||
#endif
|
||||
|
||||
namespace cron
|
||||
{
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
#define HAS_STRING_VIEW
|
||||
#define STRING_VIEW std::string_view
|
||||
#define STRING_VIEW_NPOS std::string_view::npos
|
||||
#define CONSTEXPTR constexpr
|
||||
#else
|
||||
#define STRING_VIEW std::string const &
|
||||
#define STRING_VIEW_NPOS std::string::npos
|
||||
#define CONSTEXPTR
|
||||
#endif
|
||||
|
||||
using cron_int = uint8_t;
|
||||
|
||||
constexpr std::time_t INVALID_TIME = static_cast<std::time_t>(-1);
|
||||
|
||||
constexpr size_t INVALID_CRON_INDEX = static_cast<size_t>(-1);
|
||||
|
||||
class cronexpr;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
enum class cron_field
|
||||
{
|
||||
second,
|
||||
minute,
|
||||
hour_of_day,
|
||||
day_of_week,
|
||||
day_of_month,
|
||||
month,
|
||||
year
|
||||
};
|
||||
|
||||
template <typename Traits>
|
||||
static bool find_next(cronexpr const & cex,
|
||||
std::tm& date,
|
||||
size_t const dot);
|
||||
}
|
||||
|
||||
struct bad_cronexpr : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bad_cronexpr(STRING_VIEW message) :
|
||||
std::runtime_error(message.data())
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
struct cron_standard_traits
|
||||
{
|
||||
static const cron_int CRON_MIN_SECONDS = 0;
|
||||
static const cron_int CRON_MAX_SECONDS = 59;
|
||||
|
||||
static const cron_int CRON_MIN_MINUTES = 0;
|
||||
static const cron_int CRON_MAX_MINUTES = 59;
|
||||
|
||||
static const cron_int CRON_MIN_HOURS = 0;
|
||||
static const cron_int CRON_MAX_HOURS = 23;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_WEEK = 0;
|
||||
static const cron_int CRON_MAX_DAYS_OF_WEEK = 6;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
|
||||
|
||||
static const cron_int CRON_MIN_MONTHS = 1;
|
||||
static const cron_int CRON_MAX_MONTHS = 12;
|
||||
|
||||
static const cron_int CRON_MAX_YEARS_DIFF = 4;
|
||||
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
static const inline std::vector<std::string> DAYS = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
static const inline std::vector<std::string> MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
#else
|
||||
static std::vector<std::string>& DAYS()
|
||||
{
|
||||
static std::vector<std::string> days = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
return days;
|
||||
}
|
||||
|
||||
static std::vector<std::string>& MONTHS()
|
||||
{
|
||||
static std::vector<std::string> months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
return months;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct cron_oracle_traits
|
||||
{
|
||||
static const cron_int CRON_MIN_SECONDS = 0;
|
||||
static const cron_int CRON_MAX_SECONDS = 59;
|
||||
|
||||
static const cron_int CRON_MIN_MINUTES = 0;
|
||||
static const cron_int CRON_MAX_MINUTES = 59;
|
||||
|
||||
static const cron_int CRON_MIN_HOURS = 0;
|
||||
static const cron_int CRON_MAX_HOURS = 23;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
|
||||
|
||||
static const cron_int CRON_MIN_MONTHS = 0;
|
||||
static const cron_int CRON_MAX_MONTHS = 11;
|
||||
|
||||
static const cron_int CRON_MAX_YEARS_DIFF = 4;
|
||||
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
static const inline std::vector<std::string> DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
static const inline std::vector<std::string> MONTHS = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
#else
|
||||
|
||||
static std::vector<std::string>& DAYS()
|
||||
{
|
||||
static std::vector<std::string> days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
return days;
|
||||
}
|
||||
|
||||
static std::vector<std::string>& MONTHS()
|
||||
{
|
||||
static std::vector<std::string> months = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
return months;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct cron_quartz_traits
|
||||
{
|
||||
static const cron_int CRON_MIN_SECONDS = 0;
|
||||
static const cron_int CRON_MAX_SECONDS = 59;
|
||||
|
||||
static const cron_int CRON_MIN_MINUTES = 0;
|
||||
static const cron_int CRON_MAX_MINUTES = 59;
|
||||
|
||||
static const cron_int CRON_MIN_HOURS = 0;
|
||||
static const cron_int CRON_MAX_HOURS = 23;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
|
||||
|
||||
static const cron_int CRON_MIN_MONTHS = 1;
|
||||
static const cron_int CRON_MAX_MONTHS = 12;
|
||||
|
||||
static const cron_int CRON_MAX_YEARS_DIFF = 4;
|
||||
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
static const inline std::vector<std::string> DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
static const inline std::vector<std::string> MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
#else
|
||||
static std::vector<std::string>& DAYS()
|
||||
{
|
||||
static std::vector<std::string> days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
return days;
|
||||
}
|
||||
|
||||
static std::vector<std::string>& MONTHS()
|
||||
{
|
||||
static std::vector<std::string> months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
return months;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
class cronexpr;
|
||||
|
||||
template <typename Traits = cron_standard_traits>
|
||||
static cronexpr make_cron(STRING_VIEW expr);
|
||||
|
||||
class cronexpr
|
||||
{
|
||||
std::bitset<60> seconds;
|
||||
std::bitset<60> minutes;
|
||||
std::bitset<24> hours;
|
||||
std::bitset<7> days_of_week;
|
||||
std::bitset<31> days_of_month;
|
||||
std::bitset<12> months;
|
||||
|
||||
friend bool operator==(cronexpr const & e1, cronexpr const & e2);
|
||||
friend bool operator!=(cronexpr const & e1, cronexpr const & e2);
|
||||
|
||||
template <typename Traits>
|
||||
friend bool detail::find_next(cronexpr const & cex,
|
||||
std::tm& date,
|
||||
size_t const dot);
|
||||
|
||||
friend std::string to_string(cronexpr const & cex);
|
||||
|
||||
template <typename Traits>
|
||||
friend cronexpr make_cron(STRING_VIEW expr);
|
||||
};
|
||||
|
||||
inline bool operator==(cronexpr const & e1, cronexpr const & e2)
|
||||
{
|
||||
return
|
||||
e1.seconds == e2.seconds &&
|
||||
e1.minutes == e2.minutes &&
|
||||
e1.hours == e2.hours &&
|
||||
e1.days_of_week == e2.days_of_week &&
|
||||
e1.days_of_month == e2.days_of_month &&
|
||||
e1.months == e2.months;
|
||||
}
|
||||
|
||||
inline bool operator!=(cronexpr const & e1, cronexpr const & e2)
|
||||
{
|
||||
return !(e1 == e2);
|
||||
}
|
||||
|
||||
inline std::string to_string(cronexpr const & cex)
|
||||
{
|
||||
return
|
||||
cex.seconds.to_string() + " " +
|
||||
cex.minutes.to_string() + " " +
|
||||
cex.hours.to_string() + " " +
|
||||
cex.days_of_month.to_string() + " " +
|
||||
cex.months.to_string() + " " +
|
||||
cex.days_of_week.to_string();
|
||||
}
|
||||
|
||||
namespace utils
|
||||
{
|
||||
inline std::time_t tm_to_time(std::tm& date)
|
||||
{
|
||||
return std::mktime(&date);
|
||||
}
|
||||
|
||||
inline std::tm* time_to_tm(std::time_t const * date, std::tm* const out)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
errno_t err = localtime_s(out, date);
|
||||
return 0 == err ? out : nullptr;
|
||||
#else
|
||||
return localtime_r(date, out);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline std::tm to_tm(STRING_VIEW time)
|
||||
{
|
||||
std::istringstream str(time.data());
|
||||
str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
|
||||
|
||||
std::tm result;
|
||||
str >> std::get_time(&result, "%Y-%m-%d %H:%M:%S");
|
||||
if (str.fail()) throw std::runtime_error("Parsing date failed!");
|
||||
|
||||
result.tm_isdst = -1; // DST info not available
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline std::string to_string(std::tm const & tm)
|
||||
{
|
||||
std::ostringstream str;
|
||||
str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
|
||||
str << std::put_time(&tm, "%Y-%m-%d %H:%M:%S");
|
||||
if (str.fail()) throw std::runtime_error("Writing date failed!");
|
||||
|
||||
return str.str();
|
||||
}
|
||||
|
||||
inline std::string to_upper(std::string text)
|
||||
{
|
||||
std::transform(std::begin(text), std::end(text),
|
||||
std::begin(text), static_cast<int(*)(int)>(std::toupper));
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
static std::vector<std::string> split(STRING_VIEW text, char const delimiter)
|
||||
{
|
||||
std::vector<std::string> tokens;
|
||||
std::string token;
|
||||
std::istringstream tokenStream(text.data());
|
||||
while (std::getline(tokenStream, token, delimiter))
|
||||
{
|
||||
tokens.push_back(token);
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
CONSTEXPTR inline bool contains(STRING_VIEW text, char const ch) noexcept
|
||||
{
|
||||
return STRING_VIEW_NPOS != text.find_first_of(ch);
|
||||
}
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline cron_int to_cron_int(STRING_VIEW text)
|
||||
{
|
||||
try
|
||||
{
|
||||
return static_cast<cron_int>(std::stoul(text.data()));
|
||||
}
|
||||
catch (std::exception const & ex)
|
||||
{
|
||||
throw bad_cronexpr(ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
static std::string replace_ordinals(
|
||||
std::string text,
|
||||
std::vector<std::string> const & replacement)
|
||||
{
|
||||
for (size_t i = 0; i < replacement.size(); ++i)
|
||||
{
|
||||
auto pos = text.find(replacement[i]);
|
||||
if (std::string::npos != pos)
|
||||
text.replace(pos, 3 ,std::to_string(i));
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
static std::pair<cron_int, cron_int> make_range(
|
||||
STRING_VIEW field,
|
||||
cron_int const minval,
|
||||
cron_int const maxval)
|
||||
{
|
||||
cron_int first = 0;
|
||||
cron_int last = 0;
|
||||
if (field.size() == 1 && field[0] == '*')
|
||||
{
|
||||
first = minval;
|
||||
last = maxval;
|
||||
}
|
||||
else if (!utils::contains(field, '-'))
|
||||
{
|
||||
first = to_cron_int(field);
|
||||
last = first;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto parts = utils::split(field, '-');
|
||||
if (parts.size() != 2)
|
||||
throw bad_cronexpr("Specified range requires two fields");
|
||||
|
||||
first = to_cron_int(parts[0]);
|
||||
last = to_cron_int(parts[1]);
|
||||
}
|
||||
|
||||
if (first > maxval || last > maxval)
|
||||
{
|
||||
throw bad_cronexpr("Specified range exceeds maximum");
|
||||
}
|
||||
if (first < minval || last < minval)
|
||||
{
|
||||
throw bad_cronexpr("Specified range is less than minimum");
|
||||
}
|
||||
if (first > last)
|
||||
{
|
||||
throw bad_cronexpr("Specified range start exceeds range end");
|
||||
}
|
||||
|
||||
return { first, last };
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
static void set_cron_field(
|
||||
STRING_VIEW value,
|
||||
std::bitset<N>& target,
|
||||
cron_int const minval,
|
||||
cron_int const maxval)
|
||||
{
|
||||
if(value.length() > 0 && value[value.length()-1] == ',')
|
||||
throw bad_cronexpr("Value cannot end with comma");
|
||||
|
||||
auto fields = utils::split(value, ',');
|
||||
if (fields.empty())
|
||||
throw bad_cronexpr("Expression parsing error");
|
||||
|
||||
for (auto const & field : fields)
|
||||
{
|
||||
if (!utils::contains(field, '/'))
|
||||
{
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
auto[first, last] = detail::make_range(field, minval, maxval);
|
||||
#else
|
||||
auto range = detail::make_range(field, minval, maxval);
|
||||
auto first = range.first;
|
||||
auto last = range.second;
|
||||
#endif
|
||||
for (cron_int i = first - minval; i <= last - minval; ++i)
|
||||
{
|
||||
target.set(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto parts = utils::split(field, '/');
|
||||
if (parts.size() != 2)
|
||||
throw bad_cronexpr("Incrementer must have two fields");
|
||||
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
auto[first, last] = detail::make_range(parts[0], minval, maxval);
|
||||
#else
|
||||
auto range = detail::make_range(parts[0], minval, maxval);
|
||||
auto first = range.first;
|
||||
auto last = range.second;
|
||||
#endif
|
||||
|
||||
if (!utils::contains(parts[0], '-'))
|
||||
{
|
||||
last = maxval;
|
||||
}
|
||||
|
||||
auto delta = detail::to_cron_int(parts[1]);
|
||||
if(delta <= 0)
|
||||
throw bad_cronexpr("Incrementer must be a positive value");
|
||||
|
||||
for (cron_int i = first - minval; i <= last - minval; i += delta)
|
||||
{
|
||||
target.set(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static void set_cron_days_of_week(
|
||||
std::string value,
|
||||
std::bitset<7>& target)
|
||||
{
|
||||
auto days = utils::to_upper(value);
|
||||
auto days_replaced = detail::replace_ordinals(
|
||||
days,
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
Traits::DAYS
|
||||
#else
|
||||
Traits::DAYS()
|
||||
#endif
|
||||
);
|
||||
|
||||
if (days_replaced.size() == 1 && days_replaced[0] == '?')
|
||||
days_replaced[0] = '*';
|
||||
|
||||
set_cron_field(
|
||||
days_replaced,
|
||||
target,
|
||||
Traits::CRON_MIN_DAYS_OF_WEEK,
|
||||
Traits::CRON_MAX_DAYS_OF_WEEK);
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static void set_cron_days_of_month(
|
||||
std::string value,
|
||||
std::bitset<31>& target)
|
||||
{
|
||||
if (value.size() == 1 && value[0] == '?')
|
||||
value[0] = '*';
|
||||
|
||||
set_cron_field(
|
||||
value,
|
||||
target,
|
||||
Traits::CRON_MIN_DAYS_OF_MONTH,
|
||||
Traits::CRON_MAX_DAYS_OF_MONTH);
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static void set_cron_month(
|
||||
std::string value,
|
||||
std::bitset<12>& target)
|
||||
{
|
||||
auto month = utils::to_upper(value);
|
||||
auto month_replaced = replace_ordinals(
|
||||
month,
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
Traits::MONTHS
|
||||
#else
|
||||
Traits::MONTHS()
|
||||
#endif
|
||||
);
|
||||
|
||||
set_cron_field(
|
||||
month_replaced,
|
||||
target,
|
||||
Traits::CRON_MIN_MONTHS,
|
||||
Traits::CRON_MAX_MONTHS);
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
inline size_t next_set_bit(
|
||||
std::bitset<N> const & target,
|
||||
size_t /*minimum*/,
|
||||
size_t /*maximum*/,
|
||||
size_t offset)
|
||||
{
|
||||
for (auto i = offset; i < N; ++i)
|
||||
{
|
||||
if (target.test(i)) return i;
|
||||
}
|
||||
|
||||
return INVALID_CRON_INDEX;
|
||||
}
|
||||
|
||||
inline void add_to_field(
|
||||
std::tm& date,
|
||||
cron_field const field,
|
||||
int const val)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case cron_field::second:
|
||||
date.tm_sec += val;
|
||||
break;
|
||||
case cron_field::minute:
|
||||
date.tm_min += val;
|
||||
break;
|
||||
case cron_field::hour_of_day:
|
||||
date.tm_hour += val;
|
||||
break;
|
||||
case cron_field::day_of_week:
|
||||
case cron_field::day_of_month:
|
||||
date.tm_mday += val;
|
||||
break;
|
||||
case cron_field::month:
|
||||
date.tm_mon += val;
|
||||
break;
|
||||
case cron_field::year:
|
||||
date.tm_year += val;
|
||||
break;
|
||||
}
|
||||
|
||||
if (INVALID_TIME == utils::tm_to_time(date))
|
||||
throw bad_cronexpr("Invalid time expression");
|
||||
}
|
||||
|
||||
inline void set_field(
|
||||
std::tm& date,
|
||||
cron_field const field,
|
||||
int const val)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case cron_field::second:
|
||||
date.tm_sec = val;
|
||||
break;
|
||||
case cron_field::minute:
|
||||
date.tm_min = val;
|
||||
break;
|
||||
case cron_field::hour_of_day:
|
||||
date.tm_hour = val;
|
||||
break;
|
||||
case cron_field::day_of_week:
|
||||
date.tm_wday = val;
|
||||
break;
|
||||
case cron_field::day_of_month:
|
||||
date.tm_mday = val;
|
||||
break;
|
||||
case cron_field::month:
|
||||
date.tm_mon = val;
|
||||
break;
|
||||
case cron_field::year:
|
||||
date.tm_year = val;
|
||||
break;
|
||||
}
|
||||
|
||||
if (INVALID_TIME == utils::tm_to_time(date))
|
||||
throw bad_cronexpr("Invalid time expression");
|
||||
}
|
||||
|
||||
inline void reset_field(
|
||||
std::tm& date,
|
||||
cron_field const field)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case cron_field::second:
|
||||
date.tm_sec = 0;
|
||||
break;
|
||||
case cron_field::minute:
|
||||
date.tm_min = 0;
|
||||
break;
|
||||
case cron_field::hour_of_day:
|
||||
date.tm_hour = 0;
|
||||
break;
|
||||
case cron_field::day_of_week:
|
||||
date.tm_wday = 0;
|
||||
break;
|
||||
case cron_field::day_of_month:
|
||||
date.tm_mday = 1;
|
||||
break;
|
||||
case cron_field::month:
|
||||
date.tm_mon = 0;
|
||||
break;
|
||||
case cron_field::year:
|
||||
date.tm_year = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (INVALID_TIME == utils::tm_to_time(date))
|
||||
throw bad_cronexpr("Invalid time expression");
|
||||
}
|
||||
|
||||
inline void reset_all_fields(
|
||||
std::tm& date,
|
||||
std::bitset<7> const & marked_fields)
|
||||
{
|
||||
for (size_t i = 0; i < marked_fields.size(); ++i)
|
||||
{
|
||||
if (marked_fields.test(i))
|
||||
reset_field(date, static_cast<cron_field>(i));
|
||||
}
|
||||
}
|
||||
|
||||
inline void mark_field(
|
||||
std::bitset<7> & orders,
|
||||
cron_field const field)
|
||||
{
|
||||
if (!orders.test(static_cast<size_t>(field)))
|
||||
orders.set(static_cast<size_t>(field));
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
static size_t find_next(
|
||||
std::bitset<N> const & target,
|
||||
std::tm& date,
|
||||
unsigned int const minimum,
|
||||
unsigned int const maximum,
|
||||
unsigned int const value,
|
||||
cron_field const field,
|
||||
cron_field const next_field,
|
||||
std::bitset<7> const & marked_fields)
|
||||
{
|
||||
auto next_value = next_set_bit(target, minimum, maximum, value);
|
||||
if (INVALID_CRON_INDEX == next_value)
|
||||
{
|
||||
add_to_field(date, next_field, 1);
|
||||
reset_field(date, field);
|
||||
next_value = next_set_bit(target, minimum, maximum, 0);
|
||||
}
|
||||
|
||||
if (INVALID_CRON_INDEX == next_value || next_value != value)
|
||||
{
|
||||
set_field(date, field, static_cast<int>(next_value));
|
||||
reset_all_fields(date, marked_fields);
|
||||
}
|
||||
|
||||
return next_value;
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static size_t find_next_day(
|
||||
std::tm& date,
|
||||
std::bitset<31> const & days_of_month,
|
||||
size_t day_of_month,
|
||||
std::bitset<7> const & days_of_week,
|
||||
size_t day_of_week,
|
||||
std::bitset<7> const & marked_fields)
|
||||
{
|
||||
unsigned int count = 0;
|
||||
unsigned int maximum = 366;
|
||||
while (
|
||||
(!days_of_month.test(day_of_month - Traits::CRON_MIN_DAYS_OF_MONTH) ||
|
||||
!days_of_week.test(day_of_week - Traits::CRON_MIN_DAYS_OF_WEEK))
|
||||
&& count++ < maximum)
|
||||
{
|
||||
add_to_field(date, cron_field::day_of_month, 1);
|
||||
|
||||
day_of_month = date.tm_mday;
|
||||
day_of_week = date.tm_wday;
|
||||
|
||||
reset_all_fields(date, marked_fields);
|
||||
}
|
||||
|
||||
return day_of_month;
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static bool find_next(cronexpr const & cex,
|
||||
std::tm& date,
|
||||
size_t const dot)
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
std::bitset<7> marked_fields{ 0 };
|
||||
std::bitset<7> empty_list{ 0 };
|
||||
|
||||
unsigned int second = date.tm_sec;
|
||||
auto updated_second = find_next(
|
||||
cex.seconds,
|
||||
date,
|
||||
Traits::CRON_MIN_SECONDS,
|
||||
Traits::CRON_MAX_SECONDS,
|
||||
second,
|
||||
cron_field::second,
|
||||
cron_field::minute,
|
||||
empty_list);
|
||||
|
||||
if (second == updated_second)
|
||||
{
|
||||
mark_field(marked_fields, cron_field::second);
|
||||
}
|
||||
|
||||
unsigned int minute = date.tm_min;
|
||||
auto update_minute = find_next(
|
||||
cex.minutes,
|
||||
date,
|
||||
Traits::CRON_MIN_MINUTES,
|
||||
Traits::CRON_MAX_MINUTES,
|
||||
minute,
|
||||
cron_field::minute,
|
||||
cron_field::hour_of_day,
|
||||
marked_fields);
|
||||
if (minute == update_minute)
|
||||
{
|
||||
mark_field(marked_fields, cron_field::minute);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = find_next<Traits>(cex, date, dot);
|
||||
if (!res) return res;
|
||||
}
|
||||
|
||||
unsigned int hour = date.tm_hour;
|
||||
auto updated_hour = find_next(
|
||||
cex.hours,
|
||||
date,
|
||||
Traits::CRON_MIN_HOURS,
|
||||
Traits::CRON_MAX_HOURS,
|
||||
hour,
|
||||
cron_field::hour_of_day,
|
||||
cron_field::day_of_week,
|
||||
marked_fields);
|
||||
if (hour == updated_hour)
|
||||
{
|
||||
mark_field(marked_fields, cron_field::hour_of_day);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = find_next<Traits>(cex, date, dot);
|
||||
if (!res) return res;
|
||||
}
|
||||
|
||||
unsigned int day_of_week = date.tm_wday;
|
||||
unsigned int day_of_month = date.tm_mday;
|
||||
auto updated_day_of_month = find_next_day<Traits>(
|
||||
date,
|
||||
cex.days_of_month,
|
||||
day_of_month,
|
||||
cex.days_of_week,
|
||||
day_of_week,
|
||||
marked_fields);
|
||||
if (day_of_month == updated_day_of_month)
|
||||
{
|
||||
mark_field(marked_fields, cron_field::day_of_month);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = find_next<Traits>(cex, date, dot);
|
||||
if (!res) return res;
|
||||
}
|
||||
|
||||
unsigned int month = date.tm_mon;
|
||||
auto updated_month = find_next(
|
||||
cex.months,
|
||||
date,
|
||||
Traits::CRON_MIN_MONTHS,
|
||||
Traits::CRON_MAX_MONTHS,
|
||||
month,
|
||||
cron_field::month,
|
||||
cron_field::year,
|
||||
marked_fields);
|
||||
if (month != updated_month)
|
||||
{
|
||||
if (date.tm_year - dot > Traits::CRON_MAX_YEARS_DIFF)
|
||||
return false;
|
||||
|
||||
res = find_next<Traits>(cex, date, dot);
|
||||
if (!res) return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static cronexpr make_cron(STRING_VIEW expr)
|
||||
{
|
||||
cronexpr cex;
|
||||
|
||||
if (expr.empty())
|
||||
throw bad_cronexpr("Invalid empty cron expression");
|
||||
|
||||
auto fields = utils::split(expr, ' ');
|
||||
fields.erase(
|
||||
std::remove_if(std::begin(fields), std::end(fields),
|
||||
[](STRING_VIEW s) {return s.empty(); }),
|
||||
std::end(fields));
|
||||
if (fields.size() != 6)
|
||||
throw bad_cronexpr("cron expression must have six fields");
|
||||
|
||||
detail::set_cron_field(fields[0], cex.seconds, Traits::CRON_MIN_SECONDS, Traits::CRON_MAX_SECONDS);
|
||||
detail::set_cron_field(fields[1], cex.minutes, Traits::CRON_MIN_MINUTES, Traits::CRON_MAX_MINUTES);
|
||||
detail::set_cron_field(fields[2], cex.hours, Traits::CRON_MIN_HOURS, Traits::CRON_MAX_HOURS);
|
||||
|
||||
detail::set_cron_days_of_week<Traits>(fields[5], cex.days_of_week);
|
||||
|
||||
detail::set_cron_days_of_month<Traits>(fields[3], cex.days_of_month);
|
||||
|
||||
detail::set_cron_month<Traits>(fields[4], cex.months);
|
||||
|
||||
return cex;
|
||||
}
|
||||
|
||||
template <typename Traits = cron_standard_traits>
|
||||
static std::tm cron_next(cronexpr const & cex, std::tm date)
|
||||
{
|
||||
time_t original = utils::tm_to_time(date);
|
||||
if (INVALID_TIME == original) return {};
|
||||
|
||||
if (!detail::find_next<Traits>(cex, date, date.tm_year))
|
||||
return {};
|
||||
|
||||
time_t calculated = utils::tm_to_time(date);
|
||||
if (INVALID_TIME == calculated) return {};
|
||||
|
||||
if (calculated == original)
|
||||
{
|
||||
add_to_field(date, detail::cron_field::second, 1);
|
||||
if (!detail::find_next<Traits>(cex, date, date.tm_year))
|
||||
return {};
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
template <typename Traits = cron_standard_traits>
|
||||
static std::time_t cron_next(cronexpr const & cex, std::time_t const & date)
|
||||
{
|
||||
std::tm val;
|
||||
std::tm* dt = utils::time_to_tm(&date, &val);
|
||||
if (dt == nullptr) return INVALID_TIME;
|
||||
|
||||
time_t original = utils::tm_to_time(*dt);
|
||||
if (INVALID_TIME == original) return INVALID_TIME;
|
||||
|
||||
if(!detail::find_next<Traits>(cex, *dt, dt->tm_year))
|
||||
return INVALID_TIME;
|
||||
|
||||
time_t calculated = utils::tm_to_time(*dt);
|
||||
if (INVALID_TIME == calculated) return calculated;
|
||||
|
||||
if (calculated == original)
|
||||
{
|
||||
add_to_field(*dt, detail::cron_field::second, 1);
|
||||
if(!detail::find_next<Traits>(cex, *dt, dt->tm_year))
|
||||
return INVALID_TIME;
|
||||
}
|
||||
|
||||
return utils::tm_to_time(*dt);
|
||||
}
|
||||
}
|
||||
+26
-76
@@ -703,11 +703,11 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i)",
|
||||
character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
|
||||
character_id, pp->binds[1].zone_id, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
|
||||
character_id, pp->binds[2].zone_id, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
|
||||
character_id, pp->binds[3].zone_id, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
|
||||
character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
|
||||
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
|
||||
character_id, pp->binds[1].zoneId, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
|
||||
character_id, pp->binds[2].zoneId, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
|
||||
character_id, pp->binds[3].zoneId, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
|
||||
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
|
||||
); results = QueryDatabase(query);
|
||||
|
||||
/* HoTT Ability */
|
||||
@@ -870,40 +870,36 @@ void Database::GetCharName(uint32 char_id, char* name) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string Database::GetCharNameByID(uint32 char_id) {
|
||||
const char* Database::GetCharNameByID(uint32 char_id) {
|
||||
std::string query = fmt::format("SELECT `name` FROM `character_data` WHERE id = {}", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
std::string res;
|
||||
|
||||
if (!results.Success()) {
|
||||
return res;
|
||||
return "";
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
return res;
|
||||
return "";
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
res = row[0];
|
||||
return res;
|
||||
return row[0];
|
||||
}
|
||||
|
||||
std::string Database::GetNPCNameByID(uint32 npc_id) {
|
||||
const char* Database::GetNPCNameByID(uint32 npc_id) {
|
||||
std::string query = fmt::format("SELECT `name` FROM `npc_types` WHERE id = {}", npc_id);
|
||||
auto results = QueryDatabase(query);
|
||||
std::string res;
|
||||
|
||||
if (!results.Success()) {
|
||||
return res;
|
||||
return "";
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
return res;
|
||||
return "";
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
res = row[0];
|
||||
return res;
|
||||
return row[0];
|
||||
}
|
||||
|
||||
bool Database::LoadVariables() {
|
||||
@@ -975,24 +971,10 @@ bool Database::SetVariable(const std::string varname, const std::string &varvalu
|
||||
}
|
||||
|
||||
// Get zone starting points from DB
|
||||
bool Database::GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x, float* safe_y, float* safe_z, float* safe_heading, int16* min_status, uint8* min_level, char *flag_needed) {
|
||||
bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe_x, float* safe_y, float* safe_z, int16* minstatus, uint8* minlevel, char *flag_needed) {
|
||||
|
||||
if (zone_short_name == nullptr)
|
||||
return false;
|
||||
|
||||
std::string query = fmt::format(
|
||||
SQL(
|
||||
SELECT
|
||||
`safe_x`, `safe_y`, `safe_z`, `safe_heading`, `min_status`, `min_level`, `flag_needed`
|
||||
FROM
|
||||
zone
|
||||
WHERE
|
||||
`short_name` = '{}'
|
||||
AND
|
||||
(`version` = {} OR `version` = 0)
|
||||
ORDER BY `version` DESC
|
||||
), zone_short_name, instance_version
|
||||
);
|
||||
std::string query = StringFormat("SELECT safe_x, safe_y, safe_z, min_status, min_level, flag_needed FROM zone "
|
||||
" WHERE short_name='%s' AND (version=%i OR version=0) ORDER BY version DESC", short_name, version);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
@@ -1005,24 +987,16 @@ bool Database::GetSafePoints(const char* zone_short_name, uint32 instance_versio
|
||||
|
||||
if (safe_x != nullptr)
|
||||
*safe_x = atof(row[0]);
|
||||
|
||||
if (safe_y != nullptr)
|
||||
*safe_y = atof(row[1]);
|
||||
|
||||
if (safe_z != nullptr)
|
||||
*safe_z = atof(row[2]);
|
||||
|
||||
if (safe_heading != nullptr)
|
||||
*safe_heading = atof(row[3]);
|
||||
|
||||
if (min_status != nullptr)
|
||||
*min_status = atoi(row[4]);
|
||||
|
||||
if (min_level != nullptr)
|
||||
*min_level = atoi(row[5]);
|
||||
|
||||
if (minstatus != nullptr)
|
||||
*minstatus = atoi(row[3]);
|
||||
if (minlevel != nullptr)
|
||||
*minlevel = atoi(row[4]);
|
||||
if (flag_needed != nullptr)
|
||||
strcpy(flag_needed, row[6]);
|
||||
strcpy(flag_needed, row[5]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1382,20 +1356,6 @@ bool Database::SetMQDetectionFlag(const char* accountname, const char* character
|
||||
return results.RowsAffected() != 0;
|
||||
}
|
||||
|
||||
bool Database::SetMQDetectionFlag(const char* accountname, const char* charactername, const std::string &hacked, const char* zone) {
|
||||
//Utilize the "hacker" table, but also give zone information.
|
||||
auto query = fmt::format("INSERT INTO hackers(account, name, hacked, zone) values('{}', '{}', '{}', '{}')",
|
||||
accountname, charactername, hacked, zone);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return results.RowsAffected() != 0;
|
||||
}
|
||||
|
||||
uint8 Database::GetRaceSkill(uint8 skillid, uint8 in_race)
|
||||
{
|
||||
uint16 race_cap = 0;
|
||||
@@ -2019,7 +1979,7 @@ void Database::ClearRaidLeader(uint32 gid, uint32 rid)
|
||||
QueryDatabase(query);
|
||||
}
|
||||
|
||||
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove)
|
||||
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)
|
||||
{
|
||||
|
||||
std::string field;
|
||||
@@ -2057,26 +2017,16 @@ void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win,
|
||||
}
|
||||
}
|
||||
|
||||
if (win) {
|
||||
if (win)
|
||||
field += "wins";
|
||||
} else {
|
||||
else
|
||||
field += "losses";
|
||||
}
|
||||
|
||||
std::string modification;
|
||||
|
||||
if (remove){
|
||||
modification = "-1";
|
||||
} else {
|
||||
modification = "+1";
|
||||
}
|
||||
|
||||
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s%s WHERE player_id=%u",field.c_str(), field.c_str(), modification.c_str(), char_id);
|
||||
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s+1 WHERE player_id=%u",field.c_str(), field.c_str(), 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);
|
||||
|
||||
+22
-5
@@ -45,6 +45,24 @@ namespace EQ
|
||||
class InventoryProfile;
|
||||
}
|
||||
|
||||
struct EventLogDetails_Struct {
|
||||
uint32 id;
|
||||
char accountname[64];
|
||||
uint32 account_id;
|
||||
int16 status;
|
||||
char charactername[64];
|
||||
char targetname[64];
|
||||
char timestamp[64];
|
||||
char descriptiontype[64];
|
||||
char details[128];
|
||||
};
|
||||
|
||||
struct CharacterEventLog_Struct {
|
||||
uint32 count;
|
||||
uint8 eventid;
|
||||
EventLogDetails_Struct eld[255];
|
||||
};
|
||||
|
||||
struct npcDecayTimes_Struct {
|
||||
uint16 minlvl;
|
||||
uint16 maxlvl;
|
||||
@@ -110,7 +128,6 @@ public:
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp);
|
||||
bool SetHackerFlag(const char *accountname, const char *charactername, const char *hacked);
|
||||
bool SetMQDetectionFlag(const char *accountname, const char *charactername, const char *hacked, const char *zone);
|
||||
bool SetMQDetectionFlag(const char *accountname, const char *charactername, const std::string &hacked, const char *zone);
|
||||
bool UpdateName(const char *oldname, const char *newname);
|
||||
bool CopyCharacter(
|
||||
std::string source_character_name,
|
||||
@@ -138,8 +155,8 @@ public:
|
||||
|
||||
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
||||
void GetCharName(uint32 char_id, char* name);
|
||||
std::string GetCharNameByID(uint32 char_id);
|
||||
std::string GetNPCNameByID(uint32 npc_id);
|
||||
const char *GetCharNameByID(uint32 char_id);
|
||||
const char *GetNPCNameByID(uint32 npc_id);
|
||||
void LoginIP(uint32 AccountID, const char* LoginIP);
|
||||
|
||||
/* Instancing */
|
||||
@@ -174,7 +191,7 @@ public:
|
||||
|
||||
/* Adventure related. */
|
||||
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove = false);
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
|
||||
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
|
||||
|
||||
/* Account Related */
|
||||
@@ -242,7 +259,7 @@ public:
|
||||
|
||||
/* General Queries */
|
||||
|
||||
bool GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, float* safe_heading = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
|
||||
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
|
||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
||||
bool LoadPTimers(uint32 charid, PTimerList &into);
|
||||
|
||||
@@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
namespace Convert {
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zone_id;
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1320,18 +1320,18 @@ bool Database::CheckDatabaseConvertPPDeblob(){
|
||||
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||
|
||||
/* Run Bind Home Convert */
|
||||
if (pp->binds[4].zone_id < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
|
||||
if (pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
|
||||
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, 1)",
|
||||
character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
|
||||
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
|
||||
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||
}
|
||||
|
||||
/* Run Bind Convert */
|
||||
if (pp->binds[0].zone_id < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
|
||||
if (pp->binds[0].zoneId < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
|
||||
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, 0)",
|
||||
character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
|
||||
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
|
||||
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||
}
|
||||
/* Run Language Convert */
|
||||
|
||||
@@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/repositories/dynamic_zone_members_repository.h"
|
||||
#include "../common/repositories/dynamic_zones_repository.h"
|
||||
|
||||
#include "database.h"
|
||||
|
||||
@@ -495,8 +493,8 @@ void Database::DeleteInstance(uint16 instance_id)
|
||||
query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
|
||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
||||
query = fmt::format("DELETE FROM dynamic_zones WHERE instance_id={}", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
BuryCorpsesInInstance(instance_id);
|
||||
}
|
||||
@@ -509,7 +507,7 @@ void Database::FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 char
|
||||
|
||||
char ln[128];
|
||||
memset(ln, 0, 128);
|
||||
GetGroupLeadershipInfo(gid, ln);
|
||||
strcpy(ln, GetGroupLeadershipInfo(gid, ln));
|
||||
uint32 l_charid = GetCharacterID((const char*)ln);
|
||||
uint16 l_id = GetInstanceID(zone, l_charid, version);
|
||||
|
||||
@@ -587,8 +585,7 @@ void Database::PurgeExpiredInstances()
|
||||
QueryDatabase(fmt::format("DELETE FROM respawn_times WHERE instance_id IN ({})", imploded_instance_ids));
|
||||
QueryDatabase(fmt::format("DELETE FROM spawn_condition_values WHERE instance_id IN ({})", imploded_instance_ids));
|
||||
QueryDatabase(fmt::format("UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id IN ({})", imploded_instance_ids));
|
||||
DynamicZoneMembersRepository::DeleteByManyInstances(*this, imploded_instance_ids);
|
||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
||||
QueryDatabase(fmt::format("DELETE FROM dynamic_zones WHERE instance_id IN ({})", imploded_instance_ids));
|
||||
}
|
||||
|
||||
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
|
||||
|
||||
@@ -51,7 +51,6 @@ namespace DatabaseSchema {
|
||||
{"character_disciplines", "id"},
|
||||
{"character_enabledtasks", "charid"},
|
||||
{"character_expedition_lockouts", "character_id"},
|
||||
{"character_exp_modifiers", "character_id"},
|
||||
{"character_inspect_messages", "id"},
|
||||
{"character_item_recast", "id"},
|
||||
{"character_languages", "id"},
|
||||
@@ -117,7 +116,6 @@ namespace DatabaseSchema {
|
||||
"character_disciplines",
|
||||
"character_enabledtasks",
|
||||
"character_expedition_lockouts",
|
||||
"character_exp_modifiers",
|
||||
"character_inspect_messages",
|
||||
"character_item_recast",
|
||||
"character_languages",
|
||||
@@ -309,10 +307,10 @@ namespace DatabaseSchema {
|
||||
"banned_ips",
|
||||
"bug_reports",
|
||||
"bugs",
|
||||
"dynamic_zone_members",
|
||||
"dynamic_zones",
|
||||
"eventlog",
|
||||
"expedition_lockouts",
|
||||
"expedition_members",
|
||||
"expeditions",
|
||||
"gm_ips",
|
||||
"group_id",
|
||||
@@ -330,7 +328,7 @@ namespace DatabaseSchema {
|
||||
"reports",
|
||||
"respawn_times",
|
||||
"saylink",
|
||||
"server_scheduled_events",
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -223,10 +223,10 @@ bool DBcore::Open(
|
||||
)
|
||||
{
|
||||
LockMutex lock(&MDatabase);
|
||||
safe_delete_array(pHost);
|
||||
safe_delete_array(pUser);
|
||||
safe_delete_array(pPassword);
|
||||
safe_delete_array(pDatabase);
|
||||
safe_delete(pHost);
|
||||
safe_delete(pUser);
|
||||
safe_delete(pPassword);
|
||||
safe_delete(pDatabase);
|
||||
pHost = strcpy(new char[strlen(iHost) + 1], iHost);
|
||||
pUser = strcpy(new char[strlen(iUser) + 1], iUser);
|
||||
pPassword = strcpy(new char[strlen(iPassword) + 1], iPassword);
|
||||
|
||||
@@ -1,430 +0,0 @@
|
||||
#include "dynamic_zone_base.h"
|
||||
#include "database.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "repositories/instance_list_repository.h"
|
||||
#include "repositories/instance_list_player_repository.h"
|
||||
#include "rulesys.h"
|
||||
#include "servertalk.h"
|
||||
|
||||
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
||||
{
|
||||
LoadRepositoryResult(std::move(entry));
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::Create()
|
||||
{
|
||||
if (m_id != 0)
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
if (GetInstanceID() == 0)
|
||||
{
|
||||
CreateInstance();
|
||||
}
|
||||
|
||||
m_id = SaveToDatabase();
|
||||
|
||||
return m_id;
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::CreateInstance()
|
||||
{
|
||||
if (m_instance_id)
|
||||
{
|
||||
LogDynamicZones("CreateInstance failed, instance id [{}] already created", m_instance_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!m_zone_id)
|
||||
{
|
||||
LogDynamicZones("CreateInstance failed, invalid zone id [{}]", m_zone_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t unused_instance_id = 0;
|
||||
if (!GetDatabase().GetUnusedInstanceID(unused_instance_id)) // todo: doesn't this race with insert?
|
||||
{
|
||||
LogDynamicZones("Failed to find unused instance id");
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_start_time = std::chrono::system_clock::now();
|
||||
m_expire_time = m_start_time + m_duration;
|
||||
|
||||
auto insert_instance = InstanceListRepository::NewEntity();
|
||||
insert_instance.id = unused_instance_id;
|
||||
insert_instance.zone = m_zone_id;
|
||||
insert_instance.version = m_zone_version;
|
||||
insert_instance.start_time = static_cast<int>(std::chrono::system_clock::to_time_t(m_start_time));
|
||||
insert_instance.duration = static_cast<int>(m_duration.count());
|
||||
insert_instance.never_expires = m_never_expires;
|
||||
|
||||
auto instance = InstanceListRepository::InsertOne(GetDatabase(), insert_instance);
|
||||
if (instance.id == 0)
|
||||
{
|
||||
LogDynamicZones("Failed to create instance [{}] for zone [{}]", unused_instance_id, m_zone_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_instance_id = instance.id;
|
||||
|
||||
return m_instance_id;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry)
|
||||
{
|
||||
m_id = dz_entry.id;
|
||||
m_instance_id = dz_entry.instance_id;
|
||||
m_type = static_cast<DynamicZoneType>(dz_entry.type);
|
||||
m_compass.zone_id = dz_entry.compass_zone_id;
|
||||
m_compass.x = dz_entry.compass_x;
|
||||
m_compass.y = dz_entry.compass_y;
|
||||
m_compass.z = dz_entry.compass_z;
|
||||
m_safereturn.zone_id = dz_entry.safe_return_zone_id;
|
||||
m_safereturn.x = dz_entry.safe_return_x;
|
||||
m_safereturn.y = dz_entry.safe_return_y;
|
||||
m_safereturn.z = dz_entry.safe_return_z;
|
||||
m_safereturn.heading = dz_entry.safe_return_heading;
|
||||
m_zonein.x = dz_entry.zone_in_x;
|
||||
m_zonein.y = dz_entry.zone_in_y;
|
||||
m_zonein.z = dz_entry.zone_in_z;
|
||||
m_zonein.heading = dz_entry.zone_in_heading;
|
||||
m_has_zonein = (dz_entry.has_zone_in != 0);
|
||||
// instance_list portion
|
||||
m_zone_id = dz_entry.zone;
|
||||
m_zone_version = dz_entry.version;
|
||||
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
|
||||
m_duration = std::chrono::seconds(dz_entry.duration);
|
||||
m_never_expires = (dz_entry.never_expires != 0);
|
||||
m_expire_time = m_start_time + m_duration;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::AddMemberFromRepositoryResult(
|
||||
DynamicZoneMembersRepository::MemberWithName&& entry)
|
||||
{
|
||||
auto status = DynamicZoneMemberStatus::Unknown;
|
||||
AddInternalMember({ entry.character_id, std::move(entry.character_name), status });
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::SaveToDatabase()
|
||||
{
|
||||
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
|
||||
|
||||
if (m_instance_id != 0)
|
||||
{
|
||||
auto insert_dz = DynamicZonesRepository::NewEntity();
|
||||
insert_dz.instance_id = m_instance_id,
|
||||
insert_dz.type = static_cast<int>(m_type);
|
||||
insert_dz.compass_zone_id = m_compass.zone_id;
|
||||
insert_dz.compass_x = m_compass.x;
|
||||
insert_dz.compass_y = m_compass.y;
|
||||
insert_dz.compass_z = m_compass.z;
|
||||
insert_dz.safe_return_zone_id = m_safereturn.zone_id;
|
||||
insert_dz.safe_return_x = m_safereturn.x;
|
||||
insert_dz.safe_return_y = m_safereturn.y;
|
||||
insert_dz.safe_return_z = m_safereturn.z;
|
||||
insert_dz.safe_return_heading = m_safereturn.heading;
|
||||
insert_dz.zone_in_x = m_zonein.x;
|
||||
insert_dz.zone_in_y = m_zonein.y;
|
||||
insert_dz.zone_in_z = m_zonein.z;
|
||||
insert_dz.zone_in_heading = m_zonein.heading;
|
||||
insert_dz.has_zone_in = m_has_zonein;
|
||||
|
||||
auto inserted_dz = DynamicZonesRepository::InsertOne(GetDatabase(), insert_dz);
|
||||
return inserted_dz.id;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::AddCharacter(uint32_t character_id)
|
||||
{
|
||||
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, character_id);
|
||||
GetDatabase().AddClientToInstance(m_instance_id, character_id);
|
||||
SendInstanceAddRemoveCharacter(character_id, false); // stops client kick timer
|
||||
}
|
||||
|
||||
void DynamicZoneBase::RemoveCharacter(uint32_t character_id)
|
||||
{
|
||||
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, character_id);
|
||||
GetDatabase().RemoveClientFromInstance(m_instance_id, character_id);
|
||||
SendInstanceAddRemoveCharacter(character_id, true); // start client kick timer
|
||||
}
|
||||
|
||||
void DynamicZoneBase::RemoveAllCharacters(bool enable_removal_timers)
|
||||
{
|
||||
if (GetInstanceID() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (enable_removal_timers)
|
||||
{
|
||||
SendInstanceRemoveAllCharacters();
|
||||
}
|
||||
|
||||
DynamicZoneMembersRepository::RemoveAllMembers(GetDatabase(), m_id);
|
||||
GetDatabase().RemoveClientsFromInstance(GetInstanceID());
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
||||
{
|
||||
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
|
||||
|
||||
m_members = members;
|
||||
|
||||
// the lower level instance_list_players needs to be kept updated as well
|
||||
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
|
||||
std::vector<InstanceListPlayerRepository::InstanceListPlayer> insert_players;
|
||||
for (const auto& member : m_members)
|
||||
{
|
||||
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
||||
member_entry.dynamic_zone_id = m_id;
|
||||
member_entry.character_id = member.id;
|
||||
member_entry.is_current_member = true;
|
||||
insert_members.emplace_back(member_entry);
|
||||
|
||||
InstanceListPlayerRepository::InstanceListPlayer player_entry;
|
||||
player_entry.id = static_cast<int>(m_instance_id);
|
||||
player_entry.charid = static_cast<int>(member.id);
|
||||
insert_players.emplace_back(player_entry);
|
||||
}
|
||||
|
||||
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
|
||||
InstanceListPlayerRepository::InsertOrUpdateMany(GetDatabase(), insert_players);
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetCompass(const DynamicZoneLocation& location, bool update_db)
|
||||
{
|
||||
ProcessCompassChange(location);
|
||||
|
||||
if (update_db)
|
||||
{
|
||||
LogDynamicZonesDetail("Saving [{}] compass zone: [{}] xyz: ([{}], [{}], [{}])",
|
||||
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
|
||||
|
||||
DynamicZonesRepository::UpdateCompass(GetDatabase(),
|
||||
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
|
||||
|
||||
SendGlobalLocationChange(ServerOP_DzSetCompass, location);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db)
|
||||
{
|
||||
SetCompass({ zone_id, x, y, z, 0.0f }, update_db);
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetSafeReturn(const DynamicZoneLocation& location, bool update_db)
|
||||
{
|
||||
m_safereturn = location;
|
||||
|
||||
if (update_db)
|
||||
{
|
||||
LogDynamicZonesDetail("Saving [{}] safereturn zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
|
||||
m_id, m_safereturn.zone_id, m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
|
||||
|
||||
DynamicZonesRepository::UpdateSafeReturn(GetDatabase(), m_id, m_safereturn.zone_id,
|
||||
m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
|
||||
|
||||
SendGlobalLocationChange(ServerOP_DzSetSafeReturn, location);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db)
|
||||
{
|
||||
SetSafeReturn({ zone_id, x, y, z, heading }, update_db);
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetZoneInLocation(const DynamicZoneLocation& location, bool update_db)
|
||||
{
|
||||
m_zonein = location;
|
||||
m_has_zonein = true;
|
||||
|
||||
if (update_db)
|
||||
{
|
||||
LogDynamicZonesDetail("Saving [{}] zonein zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
|
||||
m_id, m_zone_id, m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading);
|
||||
|
||||
DynamicZonesRepository::UpdateZoneIn(GetDatabase(), m_id, m_zone_id,
|
||||
m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading, m_has_zonein);
|
||||
|
||||
SendGlobalLocationChange(ServerOP_DzSetZoneIn, location);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetZoneInLocation(float x, float y, float z, float heading, bool update_db)
|
||||
{
|
||||
SetZoneInLocation({ 0, x, y, z, heading }, update_db);
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::GetSecondsRemaining() const
|
||||
{
|
||||
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
||||
return std::max(0, static_cast<int>(remaining));
|
||||
}
|
||||
|
||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerAddRemoveCharacterPacket(
|
||||
uint32_t character_id, bool removed)
|
||||
{
|
||||
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzAddRemoveCharacter, pack_size);
|
||||
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
|
||||
buf->zone_id = GetZoneID();
|
||||
buf->instance_id = GetInstanceID();
|
||||
buf->remove = removed;
|
||||
buf->character_id = character_id;
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerRemoveAllCharactersPacket()
|
||||
{
|
||||
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzRemoveAllCharacters, pack_size);
|
||||
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
|
||||
buf->zone_id = GetZoneID();
|
||||
buf->instance_id = GetInstanceID();
|
||||
buf->remove = true;
|
||||
buf->character_id = 0;
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzLocationPacket(
|
||||
uint16_t server_opcode, const DynamicZoneLocation& location)
|
||||
{
|
||||
constexpr uint32_t pack_size = sizeof(ServerDzLocation_Struct);
|
||||
auto pack = std::make_unique<ServerPacket>(server_opcode, pack_size);
|
||||
auto buf = reinterpret_cast<ServerDzLocation_Struct*>(pack->pBuffer);
|
||||
buf->dz_id = GetID();
|
||||
buf->sender_zone_id = GetCurrentZoneID();
|
||||
buf->sender_instance_id = GetCurrentInstanceID();
|
||||
buf->zone_id = location.zone_id;
|
||||
buf->x = location.x;
|
||||
buf->y = location.y;
|
||||
buf->z = location.z;
|
||||
buf->heading = location.heading;
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::GetDatabaseMemberCount()
|
||||
{
|
||||
return DynamicZoneMembersRepository::GetCountWhere(GetDatabase(),
|
||||
fmt::format("dynamic_zone_id = {} AND is_current_member = TRUE", m_id));
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::HasDatabaseMember(uint32_t character_id)
|
||||
{
|
||||
if (character_id == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto entries = DynamicZoneMembersRepository::GetWhere(GetDatabase(), fmt::format(
|
||||
"dynamic_zone_id = {} AND character_id = {} AND is_current_member = TRUE",
|
||||
m_id, character_id
|
||||
));
|
||||
|
||||
return entries.size() != 0;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::AddInternalMember(const DynamicZoneMember& member)
|
||||
{
|
||||
if (!HasMember(member.id))
|
||||
{
|
||||
m_members.emplace_back(member);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZoneBase::RemoveInternalMember(uint32_t character_id)
|
||||
{
|
||||
m_members.erase(std::remove_if(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) { return member.id == character_id; }
|
||||
), m_members.end());
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::HasMember(uint32_t character_id)
|
||||
{
|
||||
return std::any_of(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::HasMember(const std::string& character_name)
|
||||
{
|
||||
return std::any_of(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) {
|
||||
return strcasecmp(member.name.c_str(), character_name.c_str()) == 0;
|
||||
});
|
||||
}
|
||||
|
||||
DynamicZoneMember DynamicZoneBase::GetMemberData(uint32_t character_id)
|
||||
{
|
||||
auto it = std::find_if(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||
|
||||
DynamicZoneMember member_data;
|
||||
if (it != m_members.end())
|
||||
{
|
||||
member_data = *it;
|
||||
}
|
||||
return member_data;
|
||||
}
|
||||
|
||||
DynamicZoneMember DynamicZoneBase::GetMemberData(const std::string& character_name)
|
||||
{
|
||||
auto it = std::find_if(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) {
|
||||
return strcasecmp(member.name.c_str(), character_name.c_str()) == 0;
|
||||
});
|
||||
|
||||
DynamicZoneMember member_data;
|
||||
if (it != m_members.end())
|
||||
{
|
||||
member_data = *it;
|
||||
}
|
||||
return member_data;
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status)
|
||||
{
|
||||
if (status == DynamicZoneMemberStatus::InDynamicZone && !RuleB(DynamicZone, EnableInDynamicZoneStatus))
|
||||
{
|
||||
status = DynamicZoneMemberStatus::Online;
|
||||
}
|
||||
|
||||
if (character_id == m_leader.id)
|
||||
{
|
||||
m_leader.status = status;
|
||||
}
|
||||
|
||||
auto it = std::find_if(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||
|
||||
if (it != m_members.end() && it->status != status)
|
||||
{
|
||||
it->status = status;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
|
||||
{
|
||||
switch (dz_type)
|
||||
{
|
||||
case DynamicZoneType::Expedition:
|
||||
return "Expedition";
|
||||
case DynamicZoneType::Tutorial:
|
||||
return "Tutorial";
|
||||
case DynamicZoneType::Task:
|
||||
return "Task";
|
||||
case DynamicZoneType::Mission:
|
||||
return "Mission";
|
||||
case DynamicZoneType::Quest:
|
||||
return "Quest";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
|
||||
#define COMMON_DYNAMIC_ZONE_BASE_H
|
||||
|
||||
#include "eq_constants.h"
|
||||
#include "repositories/dynamic_zones_repository.h"
|
||||
#include "repositories/dynamic_zone_members_repository.h"
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Database;
|
||||
class ServerPacket;
|
||||
|
||||
struct DynamicZoneMember
|
||||
{
|
||||
uint32_t id = 0;
|
||||
std::string name;
|
||||
DynamicZoneMemberStatus status = DynamicZoneMemberStatus::Online;
|
||||
|
||||
DynamicZoneMember() = default;
|
||||
DynamicZoneMember(uint32_t id, std::string name_)
|
||||
: id(id), name{std::move(name_)} {}
|
||||
DynamicZoneMember(uint32_t id, std::string name_, DynamicZoneMemberStatus status_)
|
||||
: id(id), name{std::move(name_)}, status(status_) {}
|
||||
|
||||
bool IsOnline() const { return status == DynamicZoneMemberStatus::Online ||
|
||||
status == DynamicZoneMemberStatus::InDynamicZone; }
|
||||
bool IsValid() const { return id != 0 && !name.empty(); }
|
||||
};
|
||||
|
||||
struct DynamicZoneLocation
|
||||
{
|
||||
uint32_t zone_id = 0;
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
float z = 0.0f;
|
||||
float heading = 0.0f;
|
||||
|
||||
DynamicZoneLocation() = default;
|
||||
DynamicZoneLocation(uint32_t zone_id_, float x_, float y_, float z_, float heading_)
|
||||
: zone_id(zone_id_), x(x_), y(y_), z(z_), heading(heading_) {}
|
||||
};
|
||||
|
||||
class DynamicZoneBase
|
||||
{
|
||||
public:
|
||||
virtual ~DynamicZoneBase() = default;
|
||||
DynamicZoneBase(const DynamicZoneBase&) = default;
|
||||
DynamicZoneBase(DynamicZoneBase&&) = default;
|
||||
DynamicZoneBase& operator=(const DynamicZoneBase&) = default;
|
||||
DynamicZoneBase& operator=(DynamicZoneBase&&) = default;
|
||||
DynamicZoneBase() = default;
|
||||
DynamicZoneBase(uint32_t dz_id) : m_id(dz_id) {}
|
||||
DynamicZoneBase(DynamicZoneType type) : m_type(type) {}
|
||||
DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry);
|
||||
|
||||
static std::string GetDynamicZoneTypeName(DynamicZoneType dz_type);
|
||||
|
||||
virtual void SetSecondsRemaining(uint32_t seconds_remaining) = 0;
|
||||
|
||||
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
|
||||
uint32_t GetID() const { return m_id; }
|
||||
uint16_t GetInstanceID() const { return static_cast<uint16_t>(m_instance_id); }
|
||||
uint32_t GetMaxPlayers() const { return m_max_players; }
|
||||
uint32_t GetMemberCount() const { return static_cast<uint32_t>(m_members.size()); }
|
||||
uint32_t GetMinPlayers() const { return m_min_players; }
|
||||
uint32_t GetSecondsRemaining() const;
|
||||
uint16_t GetZoneID() const { return static_cast<uint16_t>(m_zone_id); }
|
||||
uint32_t GetZoneIndex() const { return (m_instance_id << 16) | (m_zone_id & 0xffff); }
|
||||
uint32_t GetZoneVersion() const { return m_zone_version; }
|
||||
DynamicZoneType GetType() const { return m_type; }
|
||||
const std::string& GetLeaderName() const { return m_leader.name; }
|
||||
const std::string& GetName() const { return m_name; }
|
||||
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
||||
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
||||
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
||||
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
|
||||
const DynamicZoneLocation& GetZoneInLocation() const { return m_zonein; }
|
||||
std::chrono::system_clock::duration GetDurationRemaining() const { return m_expire_time - std::chrono::system_clock::now(); }
|
||||
|
||||
void AddCharacter(uint32_t character_id);
|
||||
void AddInternalMember(const DynamicZoneMember& member);
|
||||
void AddMemberFromRepositoryResult(DynamicZoneMembersRepository::MemberWithName&& entry);
|
||||
void ClearInternalMembers() { m_members.clear(); }
|
||||
uint32_t Create();
|
||||
uint32_t GetDatabaseMemberCount();
|
||||
DynamicZoneMember GetMemberData(uint32_t character_id);
|
||||
DynamicZoneMember GetMemberData(const std::string& character_name);
|
||||
bool HasDatabaseMember(uint32_t character_id);
|
||||
bool HasMember(uint32_t character_id);
|
||||
bool HasMember(const std::string& character_name);
|
||||
bool HasMembers() const { return !m_members.empty(); }
|
||||
bool HasZoneInLocation() const { return m_has_zonein; }
|
||||
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
|
||||
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
|
||||
bool IsValid() const { return m_instance_id != 0; }
|
||||
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
|
||||
void RemoveAllCharacters(bool enable_removal_timers = true);
|
||||
void RemoveCharacter(uint32_t character_id);
|
||||
void RemoveInternalMember(uint32_t character_id);
|
||||
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
||||
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
|
||||
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
|
||||
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||
void SetLeader(const DynamicZoneMember& leader) { m_leader = leader; }
|
||||
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
||||
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
||||
void SetName(const std::string& name) { m_name = name; }
|
||||
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
|
||||
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
||||
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
|
||||
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
||||
|
||||
protected:
|
||||
virtual uint16_t GetCurrentInstanceID() { return 0; }
|
||||
virtual uint16_t GetCurrentZoneID() { return 0; }
|
||||
virtual Database& GetDatabase() = 0;
|
||||
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
||||
virtual void SendInstanceAddRemoveCharacter(uint32_t character_id, bool remove) = 0;
|
||||
virtual void SendInstanceRemoveAllCharacters() = 0;
|
||||
virtual void SendGlobalLocationChange(uint16_t server_opcode, const DynamicZoneLocation& location) = 0;
|
||||
|
||||
uint32_t CreateInstance();
|
||||
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
||||
uint32_t SaveToDatabase();
|
||||
|
||||
std::unique_ptr<ServerPacket> CreateServerAddRemoveCharacterPacket(uint32_t character_id, bool removed);
|
||||
std::unique_ptr<ServerPacket> CreateServerRemoveAllCharactersPacket();
|
||||
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
||||
|
||||
uint32_t m_id = 0;
|
||||
uint32_t m_zone_id = 0;
|
||||
uint32_t m_instance_id = 0;
|
||||
uint32_t m_zone_version = 0;
|
||||
uint32_t m_min_players = 0;
|
||||
uint32_t m_max_players = 0;
|
||||
bool m_never_expires = false;
|
||||
bool m_has_zonein = false;
|
||||
std::string m_name;
|
||||
DynamicZoneMember m_leader;
|
||||
DynamicZoneType m_type{ DynamicZoneType::None };
|
||||
DynamicZoneLocation m_compass;
|
||||
DynamicZoneLocation m_safereturn;
|
||||
DynamicZoneLocation m_zonein;
|
||||
std::chrono::seconds m_duration;
|
||||
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||
std::vector<DynamicZoneMember> m_members;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -438,13 +438,6 @@ static const uint8 SkillDamageTypes[EQ::skills::HIGHEST_SKILL + 1] = // change t
|
||||
|
||||
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
||||
|
||||
static const uint32 DB_SPELL_CAZIC_TOUCH = 982;
|
||||
static const uint32 DB_SPELL_TOUCH_OF_VINITRAS = 2859;
|
||||
|
||||
static const uint32 DB_FACTION_GEM_CHOPPERS = 255;
|
||||
static const uint32 DB_FACTION_HERETICS = 265;
|
||||
static const uint32 DB_FACTION_KING_AKANON = 333;
|
||||
|
||||
enum ChatChannelNames : uint16
|
||||
{
|
||||
ChatChannel_Guild = 0,
|
||||
@@ -471,23 +464,4 @@ namespace ZoneBlockedSpellTypes {
|
||||
const uint8 Region = 2;
|
||||
};
|
||||
|
||||
enum class DynamicZoneType
|
||||
{
|
||||
None = 0,
|
||||
Expedition,
|
||||
Tutorial,
|
||||
Task,
|
||||
Mission, // Shared Task
|
||||
Quest
|
||||
};
|
||||
|
||||
enum class DynamicZoneMemberStatus : uint8_t
|
||||
{
|
||||
Unknown = 0,
|
||||
Online,
|
||||
Offline,
|
||||
InDynamicZone,
|
||||
LinkDead
|
||||
};
|
||||
|
||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||
|
||||
@@ -794,7 +794,7 @@ void EQ::inventory::InitializeDynamicLookups() {
|
||||
continue;
|
||||
|
||||
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<mob> == (int)MobVersion::<mob>
|
||||
inventory_dynamic_nongm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
|
||||
inventory_dynamic_nongm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
|
||||
|
||||
// clamp affected fields to the lowest standard
|
||||
inventory_dynamic_nongm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE; // bank size
|
||||
@@ -864,7 +864,7 @@ void EQ::inventory::InitializeDynamicLookups() {
|
||||
}
|
||||
|
||||
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<client> == (int)MobVersion::<client>
|
||||
inventory_dynamic_gm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
|
||||
inventory_dynamic_gm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
|
||||
|
||||
inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later
|
||||
inventory_dynamic_gm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later
|
||||
|
||||
+14
-15
@@ -829,7 +829,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zone_id;
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1772,7 +1772,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ float heading;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -3247,7 +3247,7 @@ struct TraderClick_Struct{
|
||||
};
|
||||
|
||||
struct FormattedMessage_Struct{
|
||||
uint32 unknown0; // 1 means from world server
|
||||
uint32 unknown0;
|
||||
uint32 string_id;
|
||||
uint32 type;
|
||||
char message[0];
|
||||
@@ -3255,7 +3255,7 @@ struct FormattedMessage_Struct{
|
||||
struct SimpleMessage_Struct{
|
||||
uint32 string_id;
|
||||
uint32 color;
|
||||
uint32 unknown8; // 1 means from world server
|
||||
uint32 unknown8;
|
||||
};
|
||||
|
||||
struct GuildMemberUpdate_Struct {
|
||||
@@ -4861,31 +4861,30 @@ struct ExpeditionInviteResponse_Struct
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
struct ExpeditionInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004; // added after titanium
|
||||
/*008*/ uint32 assigned; // padded bool, 0: clear info, 1: fill window info
|
||||
/*008*/ uint32 assigned; // padded bool, 0: not in expedition (clear data), 1: in expedition
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*016*/ char expedition_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
//*208*/ uint32 dz_type; // only in newer clients, if not 1 (expedition type) window does not auto show when dz info assigned
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
struct ExpeditionMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[64]; // variable length, null terminated, max 0x40 (64)
|
||||
/*064*/ uint8 online_status; // 0: unknown, 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
/*000*/ char name[64]; // variable length, null terminated, max 0x40 (64)
|
||||
/*064*/ uint8 expedition_status; // 0: unknown, 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
struct ExpeditionMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count;
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
struct ExpeditionMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
@@ -4908,7 +4907,7 @@ struct ExpeditionLockoutTimers_Struct
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
struct ExpeditionSetLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
|
||||
@@ -127,7 +127,6 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
|
||||
|
||||
/**
|
||||
* RFC 5424
|
||||
@@ -207,7 +206,11 @@ std::string EQEmuLogSys::FormatOutMessageString(
|
||||
const std::string &in_message
|
||||
)
|
||||
{
|
||||
std::string return_string = "[" + GetPlatformName() + "] ";
|
||||
std::string return_string;
|
||||
|
||||
if (IsRfc5424LogCategory(log_category)) {
|
||||
return_string = "[" + GetPlatformName() + "] ";
|
||||
}
|
||||
|
||||
return return_string + "[" + Logs::LogCategoryName[log_category] + "] " + in_message;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,8 @@ namespace Logs {
|
||||
Loot,
|
||||
Expeditions,
|
||||
DynamicZones,
|
||||
Scheduler,
|
||||
Group,
|
||||
Adventure,
|
||||
MaxCategoryID /* Don't Remove this */
|
||||
};
|
||||
|
||||
@@ -200,7 +201,8 @@ namespace Logs {
|
||||
"Loot",
|
||||
"Expeditions",
|
||||
"DynamicZones",
|
||||
"Scheduler",
|
||||
"Group",
|
||||
"Adventure",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -636,14 +636,14 @@
|
||||
OutF(LogSys, Logs::Detail, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogScheduler(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Scheduler].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
#define LogAdventure(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Adventure].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::Adventure, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogSchedulerDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Scheduler].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
#define LogAdventureDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Adventure].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::Adventure, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define Log(debug_level, log_category, message, ...) do {\
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace EQ {
|
||||
void Stop() {
|
||||
if (m_timer) {
|
||||
uv_close((uv_handle_t*)m_timer, [](uv_handle_t* handle) {
|
||||
delete (uv_timer_t *)handle;
|
||||
delete handle;
|
||||
});
|
||||
m_timer = nullptr;
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "expedition_base.h"
|
||||
#include "repositories/expeditions_repository.h"
|
||||
|
||||
ExpeditionBase::ExpeditionBase(uint32_t id, const std::string& uuid,
|
||||
const std::string& expedition_name, const DynamicZoneMember& leader
|
||||
) :
|
||||
m_id(id),
|
||||
m_uuid(uuid),
|
||||
m_expedition_name(expedition_name),
|
||||
m_leader(leader)
|
||||
{
|
||||
}
|
||||
|
||||
void ExpeditionBase::LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry)
|
||||
{
|
||||
m_id = entry.id;
|
||||
m_uuid = std::move(entry.uuid);
|
||||
m_expedition_name = std::move(entry.expedition_name);
|
||||
m_add_replay_on_join = entry.add_replay_on_join;
|
||||
m_is_locked = entry.is_locked;
|
||||
m_leader.id = entry.leader_id;
|
||||
m_leader.name = std::move(entry.leader_name);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef COMMON_EXPEDITION_BASE_H
|
||||
#define COMMON_EXPEDITION_BASE_H
|
||||
|
||||
#include "dynamic_zone_base.h"
|
||||
#include "repositories/expeditions_repository.h"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class ExpeditionBase
|
||||
{
|
||||
public:
|
||||
virtual ~ExpeditionBase() = default;
|
||||
ExpeditionBase(const ExpeditionBase&) = default;
|
||||
ExpeditionBase(ExpeditionBase&&) = default;
|
||||
ExpeditionBase& operator=(const ExpeditionBase&) = default;
|
||||
ExpeditionBase& operator=(ExpeditionBase&&) = default;
|
||||
|
||||
uint32_t GetID() const { return m_id; }
|
||||
uint32_t GetLeaderID() const { return m_leader.id; }
|
||||
const std::string& GetName() const { return m_expedition_name; }
|
||||
const std::string& GetLeaderName() const { return m_leader.name; }
|
||||
const std::string& GetUUID() const { return m_uuid; }
|
||||
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
||||
|
||||
void LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry);
|
||||
|
||||
protected:
|
||||
ExpeditionBase() = default;
|
||||
ExpeditionBase(uint32_t id, const std::string& uuid, const std::string& expedition_name,
|
||||
const DynamicZoneMember& leader);
|
||||
|
||||
uint32_t m_id = 0;
|
||||
bool m_is_locked = false;
|
||||
bool m_add_replay_on_join = true;
|
||||
std::string m_uuid;
|
||||
std::string m_expedition_name;
|
||||
DynamicZoneMember m_leader;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
EQ::Net::ConsoleServer::ConsoleServer(const std::string &addr, int port)
|
||||
{
|
||||
m_server = std::make_unique<EQ::Net::TCPServer>();
|
||||
m_server.reset(new EQ::Net::TCPServer());
|
||||
m_server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||
ConsoleServerConnection *c = new ConsoleServerConnection(this, connection);
|
||||
m_connections.insert(std::make_pair(c->GetUUID(), std::unique_ptr<ConsoleServerConnection>(c)));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../eqemu_logsys.h"
|
||||
|
||||
EQ::Net::ServertalkClient::ServertalkClient(const std::string &addr, int port, bool ipv6, const std::string &identifier, const std::string &credentials)
|
||||
: m_timer(std::make_unique<EQ::Timer>(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this)))
|
||||
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this))))
|
||||
{
|
||||
m_port = port;
|
||||
m_ipv6 = ipv6;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../eqemu_logsys.h"
|
||||
|
||||
EQ::Net::ServertalkLegacyClient::ServertalkLegacyClient(const std::string &addr, int port, bool ipv6)
|
||||
: m_timer(std::make_unique<EQ::Timer>(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this)))
|
||||
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this))))
|
||||
{
|
||||
m_port = port;
|
||||
m_ipv6 = ipv6;
|
||||
|
||||
@@ -13,7 +13,7 @@ void EQ::Net::ServertalkServer::Listen(const ServertalkServerOptions& opts)
|
||||
m_encrypted = opts.encrypted;
|
||||
m_credentials = opts.credentials;
|
||||
m_allow_downgrade = opts.allow_downgrade;
|
||||
m_server = std::make_unique<EQ::Net::TCPServer>();
|
||||
m_server.reset(new EQ::Net::TCPServer());
|
||||
m_server->Listen(opts.port, opts.ipv6, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||
m_unident_connections.push_back(std::make_shared<ServertalkServerConnection>(connection, this, m_encrypted, m_allow_downgrade));
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "../event/event_loop.h"
|
||||
|
||||
void on_close_handle(uv_handle_t* handle) {
|
||||
delete (uv_tcp_t *)handle;
|
||||
delete handle;
|
||||
}
|
||||
|
||||
EQ::Net::TCPConnection::TCPConnection(uv_tcp_t *socket)
|
||||
@@ -115,7 +115,7 @@ void EQ::Net::TCPConnection::Disconnect()
|
||||
connection->m_on_disconnect_cb(connection);
|
||||
}
|
||||
|
||||
delete (uv_tcp_t *)handle;
|
||||
delete handle;
|
||||
});
|
||||
m_socket = nullptr;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "../event/event_loop.h"
|
||||
|
||||
void on_close_tcp_server_handle(uv_handle_t* handle) {
|
||||
delete (uv_tcp_t *)handle;
|
||||
delete handle;
|
||||
}
|
||||
|
||||
EQ::Net::TCPServer::TCPServer()
|
||||
|
||||
@@ -34,8 +34,8 @@ struct EQ::Net::WebsocketServer::Impl
|
||||
|
||||
EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
|
||||
{
|
||||
_impl = std::make_unique<Impl>();
|
||||
_impl->server = std::make_unique<EQ::Net::TCPServer>();
|
||||
_impl.reset(new Impl());
|
||||
_impl->server.reset(new EQ::Net::TCPServer());
|
||||
_impl->server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||
auto wsc = _impl->ws_server.get_connection();
|
||||
WebsocketServerConnection *c = new WebsocketServerConnection(this, connection, wsc);
|
||||
@@ -53,7 +53,7 @@ EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
|
||||
return websocketpp::lib::error_code();
|
||||
});
|
||||
|
||||
_impl->ping_timer = std::make_unique<EQ::Timer>(5000, true, [this](EQ::Timer *t) {
|
||||
_impl->ping_timer.reset(new EQ::Timer(5000, true, [this](EQ::Timer *t) {
|
||||
auto iter = _impl->connections.begin();
|
||||
|
||||
while (iter != _impl->connections.end()) {
|
||||
@@ -67,7 +67,7 @@ EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
|
||||
|
||||
iter++;
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
_impl->methods.insert(std::make_pair("login", MethodHandlerEntry(std::bind(&WebsocketServer::Login, this, std::placeholders::_1, std::placeholders::_2), 0)));
|
||||
_impl->methods.insert(std::make_pair("subscribe", MethodHandlerEntry(std::bind(&WebsocketServer::Subscribe, this, std::placeholders::_1, std::placeholders::_2), 0)));
|
||||
|
||||
@@ -20,7 +20,7 @@ EQ::Net::WebsocketServerConnection::WebsocketServerConnection(WebsocketServer *p
|
||||
std::shared_ptr<TCPConnection> connection,
|
||||
std::shared_ptr<websocket_connection> ws_connection)
|
||||
{
|
||||
_impl = std::make_unique<Impl>();
|
||||
_impl.reset(new Impl());
|
||||
_impl->parent = parent;
|
||||
_impl->connection = connection;
|
||||
_impl->id = EQ::Util::UUID::Generate().ToString();
|
||||
|
||||
+11
-11
@@ -772,13 +772,13 @@ namespace RoF
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -824,8 +824,8 @@ namespace RoF
|
||||
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
@@ -835,7 +835,7 @@ namespace RoF
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
@@ -843,7 +843,7 @@ namespace RoF
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
buf.WriteUInt8(emu->members[i].expedition_status);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
@@ -855,8 +855,8 @@ namespace RoF
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
@@ -867,7 +867,7 @@ namespace RoF
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
@@ -1968,7 +1968,7 @@ namespace RoF
|
||||
|
||||
for (int r = 0; r < 5; r++)
|
||||
{
|
||||
outapp->WriteUInt32(emu->binds[r].zone_id);
|
||||
outapp->WriteUInt32(emu->binds[r].zoneId);
|
||||
outapp->WriteFloat(emu->binds[r].x);
|
||||
outapp->WriteFloat(emu->binds[r].y);
|
||||
outapp->WriteFloat(emu->binds[r].z);
|
||||
|
||||
+11
-11
@@ -821,13 +821,13 @@ namespace RoF2
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -873,8 +873,8 @@ namespace RoF2
|
||||
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
@@ -884,7 +884,7 @@ namespace RoF2
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
@@ -892,7 +892,7 @@ namespace RoF2
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
buf.WriteUInt8(emu->members[i].expedition_status);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
@@ -904,8 +904,8 @@ namespace RoF2
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
@@ -916,7 +916,7 @@ namespace RoF2
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
@@ -2025,7 +2025,7 @@ namespace RoF2
|
||||
|
||||
for (int r = 0; r < 5; r++)
|
||||
{
|
||||
outapp->WriteUInt32(emu->binds[r].zone_id);
|
||||
outapp->WriteUInt32(emu->binds[r].zoneId);
|
||||
outapp->WriteFloat(emu->binds[r].x);
|
||||
outapp->WriteFloat(emu->binds[r].y);
|
||||
outapp->WriteFloat(emu->binds[r].z);
|
||||
|
||||
@@ -1053,7 +1053,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zone_id;
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -2084,7 +2084,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ float heading;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4908,31 +4908,31 @@ struct ExpeditionInviteResponse_Struct
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
struct ExpeditionInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 assigned; // padded bool, 0: clear info, 1: fill window info
|
||||
/*008*/ uint32 assigned; // padded bool, 0: not in expedition (clear data), 1: in expedition
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*016*/ char expedition_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
//*208*/ uint32 dz_type; // only in newer clients, if not 1 (expedition type) window does not auto show when dz info assigned
|
||||
//*208*/ uint32 unknown208; // live sends 01 00 00 00 here but client doesn't read it
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
struct ExpeditionMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
struct ExpeditionMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count; // number of players in window
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
struct ExpeditionMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
@@ -4955,7 +4955,7 @@ struct ExpeditionLockoutTimers_Struct
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
struct ExpeditionSetLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
|
||||
@@ -998,7 +998,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zone_id;
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -2062,7 +2062,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ float heading;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4841,30 +4841,30 @@ struct ExpeditionInviteResponse_Struct
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
struct ExpeditionInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 assigned; // padded bool
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*016*/ char expedition_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
struct ExpeditionMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
struct ExpeditionMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count; // number of players in window
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
struct ExpeditionMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
@@ -4887,7 +4887,7 @@ struct ExpeditionLockoutTimers_Struct
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
struct ExpeditionSetLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
|
||||
+11
-11
@@ -545,13 +545,13 @@ namespace SoD
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -597,8 +597,8 @@ namespace SoD
|
||||
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
@@ -608,7 +608,7 @@ namespace SoD
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
@@ -616,7 +616,7 @@ namespace SoD
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
buf.WriteUInt8(emu->members[i].expedition_status);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
@@ -628,8 +628,8 @@ namespace SoD
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
@@ -640,7 +640,7 @@ namespace SoD
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
@@ -1475,7 +1475,7 @@ namespace SoD
|
||||
eq->level1 = emu->level;
|
||||
// OUT(unknown00022[2]);
|
||||
for (r = 0; r < 5; r++) {
|
||||
OUT(binds[r].zone_id);
|
||||
OUT(binds[r].zoneId);
|
||||
OUT(binds[r].x);
|
||||
OUT(binds[r].y);
|
||||
OUT(binds[r].z);
|
||||
|
||||
@@ -803,7 +803,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zone_id;
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1714,7 +1714,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ float heading;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4196,30 +4196,30 @@ struct ExpeditionInviteResponse_Struct
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
struct ExpeditionInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 assigned; // padded bool
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*016*/ char expedition_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
struct ExpeditionMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
struct ExpeditionMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count; // number of players in window
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
struct ExpeditionMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
@@ -4242,7 +4242,7 @@ struct ExpeditionLockoutTimers_Struct
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
struct ExpeditionSetLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
|
||||
+11
-11
@@ -533,13 +533,13 @@ namespace SoF
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -585,8 +585,8 @@ namespace SoF
|
||||
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
@@ -596,7 +596,7 @@ namespace SoF
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
@@ -604,7 +604,7 @@ namespace SoF
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
buf.WriteUInt8(emu->members[i].expedition_status);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
@@ -616,8 +616,8 @@ namespace SoF
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
@@ -628,7 +628,7 @@ namespace SoF
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
@@ -1140,7 +1140,7 @@ namespace SoF
|
||||
eq->level1 = emu->level;
|
||||
// OUT(unknown00022[2]);
|
||||
for (r = 0; r < 5; r++) {
|
||||
OUT(binds[r].zone_id);
|
||||
OUT(binds[r].zoneId);
|
||||
OUT(binds[r].x);
|
||||
OUT(binds[r].y);
|
||||
OUT(binds[r].z);
|
||||
|
||||
@@ -804,7 +804,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zone_id;
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1742,7 +1742,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ float heading;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4112,29 +4112,29 @@ struct ExpeditionInviteResponse_Struct
|
||||
/*075*/ uint8 unknown079; // padding/garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
struct ExpeditionInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 assigned; // padded bool
|
||||
/*008*/ uint32 max_players;
|
||||
/*012*/ char dz_name[128];
|
||||
/*012*/ char expedition_name[128];
|
||||
/*140*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
struct ExpeditionMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
struct ExpeditionMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count;
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
struct ExpeditionMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
|
||||
@@ -4156,7 +4156,7 @@ struct ExpeditionLockoutTimers_Struct
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
struct ExpeditionSetLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ char leader_name[64];
|
||||
|
||||
+11
-11
@@ -476,13 +476,13 @@ namespace Titanium
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -528,8 +528,8 @@ namespace Titanium
|
||||
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
@@ -539,7 +539,7 @@ namespace Titanium
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
@@ -547,7 +547,7 @@ namespace Titanium
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
buf.WriteUInt8(emu->members[i].expedition_status);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
@@ -559,8 +559,8 @@ namespace Titanium
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
@@ -571,7 +571,7 @@ namespace Titanium
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
@@ -1022,7 +1022,7 @@ namespace Titanium
|
||||
eq->level1 = emu->level;
|
||||
// OUT(unknown00022[2]);
|
||||
for (r = 0; r < 5; r++) {
|
||||
OUT(binds[r].zone_id);
|
||||
OUT(binds[r].zoneId);
|
||||
OUT(binds[r].x);
|
||||
OUT(binds[r].y);
|
||||
OUT(binds[r].z);
|
||||
|
||||
@@ -738,7 +738,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zone_id;
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1509,7 +1509,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ float heading;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -3323,29 +3323,29 @@ struct ExpeditionInviteResponse_Struct
|
||||
/*075*/ uint8 unknown079; // padding/garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
struct ExpeditionInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 assigned; // padded bool
|
||||
/*008*/ uint32 max_players;
|
||||
/*012*/ char dz_name[128];
|
||||
/*012*/ char expedition_name[128];
|
||||
/*140*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
struct ExpeditionMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
struct ExpeditionMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count;
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
struct ExpeditionMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
|
||||
@@ -3367,7 +3367,7 @@ struct ExpeditionLockoutTimers_Struct
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
struct ExpeditionSetLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ char leader_name[64];
|
||||
|
||||
+11
-11
@@ -675,13 +675,13 @@ namespace UF
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -727,8 +727,8 @@ namespace UF
|
||||
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
@@ -738,7 +738,7 @@ namespace UF
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
@@ -746,7 +746,7 @@ namespace UF
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
buf.WriteUInt8(emu->members[i].expedition_status);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
@@ -758,8 +758,8 @@ namespace UF
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
@@ -770,7 +770,7 @@ namespace UF
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
@@ -1705,7 +1705,7 @@ namespace UF
|
||||
eq->level1 = emu->level;
|
||||
// OUT(unknown00022[2]);
|
||||
for (r = 0; r < 5; r++) {
|
||||
OUT(binds[r].zone_id);
|
||||
OUT(binds[r].zoneId);
|
||||
OUT(binds[r].x);
|
||||
OUT(binds[r].y);
|
||||
OUT(binds[r].z);
|
||||
|
||||
+11
-11
@@ -833,7 +833,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zone_id;
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1755,7 +1755,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ float heading;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4277,30 +4277,30 @@ struct ExpeditionInviteResponse_Struct
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
struct ExpeditionInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 assigned; // padded bool
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*016*/ char expedition_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
struct ExpeditionMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
struct ExpeditionMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count; // number of players in window
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
struct ExpeditionMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
@@ -4323,7 +4323,7 @@ struct ExpeditionLockoutTimers_Struct
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
struct ExpeditionSetLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
|
||||
+5
-5
@@ -46,15 +46,15 @@ std::string GetPlatformName()
|
||||
{
|
||||
switch (GetExecutablePlatformInt()) {
|
||||
case EQEmuExePlatform::ExePlatformWorld:
|
||||
return "World";
|
||||
return "WorldServer";
|
||||
case EQEmuExePlatform::ExePlatformQueryServ:
|
||||
return "QS";
|
||||
return "QueryServer";
|
||||
case EQEmuExePlatform::ExePlatformZone:
|
||||
return "Zone";
|
||||
return "ZoneServer";
|
||||
case EQEmuExePlatform::ExePlatformUCS:
|
||||
return "UCS";
|
||||
case EQEmuExePlatform::ExePlatformLogin:
|
||||
return "Login";
|
||||
return "LoginServer";
|
||||
case EQEmuExePlatform::ExePlatformSocket_Server:
|
||||
return "SocketServer";
|
||||
case EQEmuExePlatform::ExePlatformSharedMemory:
|
||||
@@ -70,4 +70,4 @@ std::string GetPlatformName()
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -860,6 +860,7 @@ uint16 GetRaceIDFromPlayerRaceBit(uint32 player_race_bit);
|
||||
|
||||
float GetRaceGenderDefaultHeight(int race, int gender);
|
||||
|
||||
|
||||
// player race-/gender-based model feature validators
|
||||
namespace PlayerAppearance
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
entry.character_id = 0;
|
||||
entry.expedition_name = "";
|
||||
entry.event_name = "";
|
||||
entry.expire_time = "";
|
||||
entry.expire_time = current_timestamp();
|
||||
entry.duration = 0;
|
||||
entry.from_expedition_uuid = "";
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
entry.id = 0;
|
||||
entry.expedition_id = 0;
|
||||
entry.event_name = "";
|
||||
entry.expire_time = "";
|
||||
entry.expire_time = current_timestamp();
|
||||
entry.duration = 0;
|
||||
entry.from_expedition_uuid = "";
|
||||
|
||||
|
||||
+54
-54
@@ -4,22 +4,22 @@
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_DYNAMIC_ZONE_MEMBERS_REPOSITORY_H
|
||||
#define EQEMU_BASE_DYNAMIC_ZONE_MEMBERS_REPOSITORY_H
|
||||
#ifndef EQEMU_BASE_EXPEDITION_MEMBERS_REPOSITORY_H
|
||||
#define EQEMU_BASE_EXPEDITION_MEMBERS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseDynamicZoneMembersRepository {
|
||||
class BaseExpeditionMembersRepository {
|
||||
public:
|
||||
struct DynamicZoneMembers {
|
||||
struct ExpeditionMembers {
|
||||
int id;
|
||||
int dynamic_zone_id;
|
||||
int expedition_id;
|
||||
int character_id;
|
||||
int is_current_member;
|
||||
};
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"dynamic_zone_id",
|
||||
"expedition_id",
|
||||
"character_id",
|
||||
"is_current_member",
|
||||
};
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("dynamic_zone_members");
|
||||
return std::string("expedition_members");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
@@ -67,51 +67,51 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
static DynamicZoneMembers NewEntity()
|
||||
static ExpeditionMembers NewEntity()
|
||||
{
|
||||
DynamicZoneMembers entry{};
|
||||
ExpeditionMembers entry{};
|
||||
|
||||
entry.id = 0;
|
||||
entry.dynamic_zone_id = 0;
|
||||
entry.expedition_id = 0;
|
||||
entry.character_id = 0;
|
||||
entry.is_current_member = 1;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static DynamicZoneMembers GetDynamicZoneMembersEntry(
|
||||
const std::vector<DynamicZoneMembers> &dynamic_zone_memberss,
|
||||
int dynamic_zone_members_id
|
||||
static ExpeditionMembers GetExpeditionMembersEntry(
|
||||
const std::vector<ExpeditionMembers> &expedition_memberss,
|
||||
int expedition_members_id
|
||||
)
|
||||
{
|
||||
for (auto &dynamic_zone_members : dynamic_zone_memberss) {
|
||||
if (dynamic_zone_members.id == dynamic_zone_members_id) {
|
||||
return dynamic_zone_members;
|
||||
for (auto &expedition_members : expedition_memberss) {
|
||||
if (expedition_members.id == expedition_members_id) {
|
||||
return expedition_members;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static DynamicZoneMembers FindOne(
|
||||
static ExpeditionMembers FindOne(
|
||||
Database& db,
|
||||
int dynamic_zone_members_id
|
||||
int expedition_members_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
dynamic_zone_members_id
|
||||
expedition_members_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
DynamicZoneMembers entry{};
|
||||
ExpeditionMembers entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.dynamic_zone_id = atoi(row[1]);
|
||||
entry.expedition_id = atoi(row[1]);
|
||||
entry.character_id = atoi(row[2]);
|
||||
entry.is_current_member = atoi(row[3]);
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int dynamic_zone_members_id
|
||||
int expedition_members_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
dynamic_zone_members_id
|
||||
expedition_members_id
|
||||
)
|
||||
);
|
||||
|
||||
@@ -140,16 +140,16 @@ public:
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
DynamicZoneMembers dynamic_zone_members_entry
|
||||
ExpeditionMembers expedition_members_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(dynamic_zone_members_entry.character_id));
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(dynamic_zone_members_entry.is_current_member));
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(expedition_members_entry.expedition_id));
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(expedition_members_entry.character_id));
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(expedition_members_entry.is_current_member));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -157,24 +157,24 @@ public:
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
dynamic_zone_members_entry.id
|
||||
expedition_members_entry.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static DynamicZoneMembers InsertOne(
|
||||
static ExpeditionMembers InsertOne(
|
||||
Database& db,
|
||||
DynamicZoneMembers dynamic_zone_members_entry
|
||||
ExpeditionMembers expedition_members_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.is_current_member));
|
||||
insert_values.push_back(std::to_string(expedition_members_entry.id));
|
||||
insert_values.push_back(std::to_string(expedition_members_entry.expedition_id));
|
||||
insert_values.push_back(std::to_string(expedition_members_entry.character_id));
|
||||
insert_values.push_back(std::to_string(expedition_members_entry.is_current_member));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -185,29 +185,29 @@ public:
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
dynamic_zone_members_entry.id = results.LastInsertedID();
|
||||
return dynamic_zone_members_entry;
|
||||
expedition_members_entry.id = results.LastInsertedID();
|
||||
return expedition_members_entry;
|
||||
}
|
||||
|
||||
dynamic_zone_members_entry = NewEntity();
|
||||
expedition_members_entry = NewEntity();
|
||||
|
||||
return dynamic_zone_members_entry;
|
||||
return expedition_members_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<DynamicZoneMembers> dynamic_zone_members_entries
|
||||
std::vector<ExpeditionMembers> expedition_members_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &dynamic_zone_members_entry: dynamic_zone_members_entries) {
|
||||
for (auto &expedition_members_entry: expedition_members_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.is_current_member));
|
||||
insert_values.push_back(std::to_string(expedition_members_entry.id));
|
||||
insert_values.push_back(std::to_string(expedition_members_entry.expedition_id));
|
||||
insert_values.push_back(std::to_string(expedition_members_entry.character_id));
|
||||
insert_values.push_back(std::to_string(expedition_members_entry.is_current_member));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
@@ -225,9 +225,9 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<DynamicZoneMembers> All(Database& db)
|
||||
static std::vector<ExpeditionMembers> All(Database& db)
|
||||
{
|
||||
std::vector<DynamicZoneMembers> all_entries;
|
||||
std::vector<ExpeditionMembers> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -239,10 +239,10 @@ public:
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
DynamicZoneMembers entry{};
|
||||
ExpeditionMembers entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.dynamic_zone_id = atoi(row[1]);
|
||||
entry.expedition_id = atoi(row[1]);
|
||||
entry.character_id = atoi(row[2]);
|
||||
entry.is_current_member = atoi(row[3]);
|
||||
|
||||
@@ -252,9 +252,9 @@ public:
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<DynamicZoneMembers> GetWhere(Database& db, std::string where_filter)
|
||||
static std::vector<ExpeditionMembers> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<DynamicZoneMembers> all_entries;
|
||||
std::vector<ExpeditionMembers> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -267,10 +267,10 @@ public:
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
DynamicZoneMembers entry{};
|
||||
ExpeditionMembers entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.dynamic_zone_id = atoi(row[1]);
|
||||
entry.expedition_id = atoi(row[1]);
|
||||
entry.character_id = atoi(row[2]);
|
||||
entry.is_current_member = atoi(row[3]);
|
||||
|
||||
@@ -307,4 +307,4 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_DYNAMIC_ZONE_MEMBERS_REPOSITORY_H
|
||||
#endif //EQEMU_BASE_EXPEDITION_MEMBERS_REPOSITORY_H
|
||||
@@ -1,427 +0,0 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_SERVER_SCHEDULED_EVENTS_REPOSITORY_H
|
||||
#define EQEMU_BASE_SERVER_SCHEDULED_EVENTS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseServerScheduledEventsRepository {
|
||||
public:
|
||||
struct ServerScheduledEvents {
|
||||
int id;
|
||||
std::string description;
|
||||
std::string event_type;
|
||||
std::string event_data;
|
||||
int minute_start;
|
||||
int hour_start;
|
||||
int day_start;
|
||||
int month_start;
|
||||
int year_start;
|
||||
int minute_end;
|
||||
int hour_end;
|
||||
int day_end;
|
||||
int month_end;
|
||||
int year_end;
|
||||
std::string cron_expression;
|
||||
std::string created_at;
|
||||
std::string deleted_at;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"description",
|
||||
"event_type",
|
||||
"event_data",
|
||||
"minute_start",
|
||||
"hour_start",
|
||||
"day_start",
|
||||
"month_start",
|
||||
"year_start",
|
||||
"minute_end",
|
||||
"hour_end",
|
||||
"day_end",
|
||||
"month_end",
|
||||
"year_end",
|
||||
"cron_expression",
|
||||
"created_at",
|
||||
"deleted_at",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("server_scheduled_events");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static ServerScheduledEvents NewEntity()
|
||||
{
|
||||
ServerScheduledEvents entry{};
|
||||
|
||||
entry.id = 0;
|
||||
entry.description = "";
|
||||
entry.event_type = "";
|
||||
entry.event_data = "";
|
||||
entry.minute_start = 0;
|
||||
entry.hour_start = 0;
|
||||
entry.day_start = 0;
|
||||
entry.month_start = 0;
|
||||
entry.year_start = 0;
|
||||
entry.minute_end = 0;
|
||||
entry.hour_end = 0;
|
||||
entry.day_end = 0;
|
||||
entry.month_end = 0;
|
||||
entry.year_end = 0;
|
||||
entry.cron_expression = "";
|
||||
entry.created_at = "";
|
||||
entry.deleted_at = "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static ServerScheduledEvents GetServerScheduledEventsEntry(
|
||||
const std::vector<ServerScheduledEvents> &server_scheduled_eventss,
|
||||
int server_scheduled_events_id
|
||||
)
|
||||
{
|
||||
for (auto &server_scheduled_events : server_scheduled_eventss) {
|
||||
if (server_scheduled_events.id == server_scheduled_events_id) {
|
||||
return server_scheduled_events;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static ServerScheduledEvents FindOne(
|
||||
Database& db,
|
||||
int server_scheduled_events_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
server_scheduled_events_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
ServerScheduledEvents entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.description = row[1] ? row[1] : "";
|
||||
entry.event_type = row[2] ? row[2] : "";
|
||||
entry.event_data = row[3] ? row[3] : "";
|
||||
entry.minute_start = atoi(row[4]);
|
||||
entry.hour_start = atoi(row[5]);
|
||||
entry.day_start = atoi(row[6]);
|
||||
entry.month_start = atoi(row[7]);
|
||||
entry.year_start = atoi(row[8]);
|
||||
entry.minute_end = atoi(row[9]);
|
||||
entry.hour_end = atoi(row[10]);
|
||||
entry.day_end = atoi(row[11]);
|
||||
entry.month_end = atoi(row[12]);
|
||||
entry.year_end = atoi(row[13]);
|
||||
entry.cron_expression = row[14] ? row[14] : "";
|
||||
entry.created_at = row[15] ? row[15] : "";
|
||||
entry.deleted_at = row[16] ? row[16] : "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int server_scheduled_events_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
server_scheduled_events_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
ServerScheduledEvents server_scheduled_events_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[1] + " = '" + EscapeString(server_scheduled_events_entry.description) + "'");
|
||||
update_values.push_back(columns[2] + " = '" + EscapeString(server_scheduled_events_entry.event_type) + "'");
|
||||
update_values.push_back(columns[3] + " = '" + EscapeString(server_scheduled_events_entry.event_data) + "'");
|
||||
update_values.push_back(columns[4] + " = " + std::to_string(server_scheduled_events_entry.minute_start));
|
||||
update_values.push_back(columns[5] + " = " + std::to_string(server_scheduled_events_entry.hour_start));
|
||||
update_values.push_back(columns[6] + " = " + std::to_string(server_scheduled_events_entry.day_start));
|
||||
update_values.push_back(columns[7] + " = " + std::to_string(server_scheduled_events_entry.month_start));
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(server_scheduled_events_entry.year_start));
|
||||
update_values.push_back(columns[9] + " = " + std::to_string(server_scheduled_events_entry.minute_end));
|
||||
update_values.push_back(columns[10] + " = " + std::to_string(server_scheduled_events_entry.hour_end));
|
||||
update_values.push_back(columns[11] + " = " + std::to_string(server_scheduled_events_entry.day_end));
|
||||
update_values.push_back(columns[12] + " = " + std::to_string(server_scheduled_events_entry.month_end));
|
||||
update_values.push_back(columns[13] + " = " + std::to_string(server_scheduled_events_entry.year_end));
|
||||
update_values.push_back(columns[14] + " = '" + EscapeString(server_scheduled_events_entry.cron_expression) + "'");
|
||||
update_values.push_back(columns[15] + " = '" + EscapeString(server_scheduled_events_entry.created_at) + "'");
|
||||
update_values.push_back(columns[16] + " = '" + EscapeString(server_scheduled_events_entry.deleted_at) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
server_scheduled_events_entry.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static ServerScheduledEvents InsertOne(
|
||||
Database& db,
|
||||
ServerScheduledEvents server_scheduled_events_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.id));
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.description) + "'");
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.event_type) + "'");
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.event_data) + "'");
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.minute_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.hour_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.day_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.month_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.year_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.minute_end));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.hour_end));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.day_end));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.month_end));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.year_end));
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.cron_expression) + "'");
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.created_at) + "'");
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.deleted_at) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
server_scheduled_events_entry.id = results.LastInsertedID();
|
||||
return server_scheduled_events_entry;
|
||||
}
|
||||
|
||||
server_scheduled_events_entry = NewEntity();
|
||||
|
||||
return server_scheduled_events_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<ServerScheduledEvents> server_scheduled_events_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &server_scheduled_events_entry: server_scheduled_events_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.id));
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.description) + "'");
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.event_type) + "'");
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.event_data) + "'");
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.minute_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.hour_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.day_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.month_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.year_start));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.minute_end));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.hour_end));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.day_end));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.month_end));
|
||||
insert_values.push_back(std::to_string(server_scheduled_events_entry.year_end));
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.cron_expression) + "'");
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.created_at) + "'");
|
||||
insert_values.push_back("'" + EscapeString(server_scheduled_events_entry.deleted_at) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<ServerScheduledEvents> All(Database& db)
|
||||
{
|
||||
std::vector<ServerScheduledEvents> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
ServerScheduledEvents entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.description = row[1] ? row[1] : "";
|
||||
entry.event_type = row[2] ? row[2] : "";
|
||||
entry.event_data = row[3] ? row[3] : "";
|
||||
entry.minute_start = atoi(row[4]);
|
||||
entry.hour_start = atoi(row[5]);
|
||||
entry.day_start = atoi(row[6]);
|
||||
entry.month_start = atoi(row[7]);
|
||||
entry.year_start = atoi(row[8]);
|
||||
entry.minute_end = atoi(row[9]);
|
||||
entry.hour_end = atoi(row[10]);
|
||||
entry.day_end = atoi(row[11]);
|
||||
entry.month_end = atoi(row[12]);
|
||||
entry.year_end = atoi(row[13]);
|
||||
entry.cron_expression = row[14] ? row[14] : "";
|
||||
entry.created_at = row[15] ? row[15] : "";
|
||||
entry.deleted_at = row[16] ? row[16] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<ServerScheduledEvents> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<ServerScheduledEvents> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
ServerScheduledEvents entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.description = row[1] ? row[1] : "";
|
||||
entry.event_type = row[2] ? row[2] : "";
|
||||
entry.event_data = row[3] ? row[3] : "";
|
||||
entry.minute_start = atoi(row[4]);
|
||||
entry.hour_start = atoi(row[5]);
|
||||
entry.day_start = atoi(row[6]);
|
||||
entry.month_start = atoi(row[7]);
|
||||
entry.year_start = atoi(row[8]);
|
||||
entry.minute_end = atoi(row[9]);
|
||||
entry.hour_end = atoi(row[10]);
|
||||
entry.day_end = atoi(row[11]);
|
||||
entry.month_end = atoi(row[12]);
|
||||
entry.year_end = atoi(row[13]);
|
||||
entry.cron_expression = row[14] ? row[14] : "";
|
||||
entry.created_at = row[15] ? row[15] : "";
|
||||
entry.deleted_at = row[16] ? row[16] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_SERVER_SCHEDULED_EVENTS_REPOSITORY_H
|
||||
@@ -22,10 +22,8 @@
|
||||
#define EQEMU_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../expedition_lockout_timer.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_character_expedition_lockouts_repository.h"
|
||||
#include <unordered_map>
|
||||
|
||||
class CharacterExpeditionLockoutsRepository: public BaseCharacterExpeditionLockoutsRepository {
|
||||
public:
|
||||
@@ -67,78 +65,6 @@ public:
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
struct CharacterExpeditionLockoutsTimeStamp {
|
||||
int id;
|
||||
int character_id;
|
||||
std::string expedition_name;
|
||||
std::string event_name;
|
||||
time_t expire_time;
|
||||
int duration;
|
||||
std::string from_expedition_uuid;
|
||||
};
|
||||
|
||||
static ExpeditionLockoutTimer GetExpeditionLockoutTimerFromEntry(
|
||||
CharacterExpeditionLockoutsTimeStamp&& entry)
|
||||
{
|
||||
ExpeditionLockoutTimer lockout_timer{
|
||||
std::move(entry.from_expedition_uuid),
|
||||
std::move(entry.expedition_name),
|
||||
std::move(entry.event_name),
|
||||
static_cast<uint64_t>(entry.expire_time),
|
||||
static_cast<uint32_t>(entry.duration)
|
||||
};
|
||||
|
||||
return lockout_timer;
|
||||
}
|
||||
|
||||
static std::unordered_map<uint32_t, std::vector<ExpeditionLockoutTimer>> GetManyCharacterLockoutTimers(
|
||||
Database& db, const std::vector<uint32_t>& character_ids,
|
||||
const std::string& expedition_name, const std::string& ordered_event_name)
|
||||
{
|
||||
auto joined_character_ids = fmt::join(character_ids, ",");
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
SELECT
|
||||
character_id,
|
||||
UNIX_TIMESTAMP(expire_time),
|
||||
duration,
|
||||
event_name,
|
||||
from_expedition_uuid
|
||||
FROM character_expedition_lockouts
|
||||
WHERE
|
||||
character_id IN ({})
|
||||
AND expire_time > NOW()
|
||||
AND expedition_name = '{}'
|
||||
ORDER BY
|
||||
FIELD(character_id, {}),
|
||||
FIELD(event_name, '{}') DESC
|
||||
),
|
||||
joined_character_ids,
|
||||
EscapeString(expedition_name),
|
||||
joined_character_ids,
|
||||
EscapeString(ordered_event_name)
|
||||
));
|
||||
|
||||
std::unordered_map<uint32_t, std::vector<ExpeditionLockoutTimer>> lockouts;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
CharacterExpeditionLockoutsTimeStamp entry{};
|
||||
|
||||
int col = 0;
|
||||
entry.character_id = std::strtoul(row[col++], nullptr, 10);
|
||||
entry.expire_time = std::strtoull(row[col++], nullptr, 10);
|
||||
entry.duration = std::strtoul(row[col++], nullptr, 10);
|
||||
entry.event_name = row[col++];
|
||||
entry.expedition_name = expedition_name;
|
||||
entry.from_expedition_uuid = row[col++];
|
||||
|
||||
auto lockout = GetExpeditionLockoutTimerFromEntry(std::move(entry));
|
||||
lockouts[entry.character_id].emplace_back(std::move(lockout));
|
||||
}
|
||||
|
||||
return lockouts;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
@@ -1,249 +0,0 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_DYNAMIC_ZONE_MEMBERS_REPOSITORY_H
|
||||
#define EQEMU_DYNAMIC_ZONE_MEMBERS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_dynamic_zone_members_repository.h"
|
||||
|
||||
class DynamicZoneMembersRepository: public BaseDynamicZoneMembersRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* DynamicZoneMembersRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* DynamicZoneMembersRepository::GetWhereNeverExpires()
|
||||
* DynamicZoneMembersRepository::GetWhereXAndY()
|
||||
* DynamicZoneMembersRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
struct MemberWithName {
|
||||
uint32_t id;
|
||||
uint32_t dynamic_zone_id;
|
||||
uint32_t character_id;
|
||||
int is_current_member;
|
||||
std::string character_name;
|
||||
};
|
||||
|
||||
static std::string SelectMembersWithNames()
|
||||
{
|
||||
return std::string(SQL(
|
||||
SELECT
|
||||
dynamic_zone_members.id,
|
||||
dynamic_zone_members.dynamic_zone_id,
|
||||
dynamic_zone_members.character_id,
|
||||
dynamic_zone_members.is_current_member,
|
||||
character_data.name
|
||||
FROM dynamic_zone_members
|
||||
INNER JOIN character_data ON dynamic_zone_members.character_id = character_data.id
|
||||
));
|
||||
}
|
||||
|
||||
static std::vector<MemberWithName> GetWithNames(Database& db,
|
||||
const std::vector<uint32_t>& dynamic_zone_ids)
|
||||
{
|
||||
if (dynamic_zone_ids.empty())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<MemberWithName> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
{}
|
||||
WHERE dynamic_zone_members.dynamic_zone_id IN ({})
|
||||
AND dynamic_zone_members.is_current_member = TRUE;
|
||||
),
|
||||
SelectMembersWithNames(),
|
||||
fmt::join(dynamic_zone_ids, ",")
|
||||
));
|
||||
|
||||
if (results.Success())
|
||||
{
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
MemberWithName entry{};
|
||||
|
||||
int col = 0;
|
||||
entry.id = strtoul(row[col++], nullptr, 10);
|
||||
entry.dynamic_zone_id = strtoul(row[col++], nullptr, 10);
|
||||
entry.character_id = strtoul(row[col++], nullptr, 10);
|
||||
entry.is_current_member = strtoul(row[col++], nullptr, 10);
|
||||
entry.character_name = row[col++];
|
||||
|
||||
all_entries.emplace_back(std::move(entry));
|
||||
}
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteByInstance(Database& db, int instance_id)
|
||||
{
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
DELETE dynamic_zone_members
|
||||
FROM dynamic_zone_members
|
||||
INNER JOIN dynamic_zones ON dynamic_zone_members.dynamic_zone_id = dynamic_zones.id
|
||||
WHERE dynamic_zones.instance_id = {}
|
||||
), instance_id));
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int DeleteByManyInstances(Database& db, const std::string& joined_instance_ids)
|
||||
{
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
DELETE dynamic_zone_members
|
||||
FROM dynamic_zone_members
|
||||
INNER JOIN dynamic_zones ON dynamic_zone_members.dynamic_zone_id = dynamic_zones.id
|
||||
WHERE dynamic_zones.instance_id IN ({})
|
||||
), joined_instance_ids));
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int GetCountWhere(Database& db, const std::string& where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(fmt::format(
|
||||
"SELECT COUNT(*) FROM {} WHERE {};", TableName(), where_filter));
|
||||
|
||||
uint32_t count = 0;
|
||||
if (results.Success() && results.RowCount() > 0)
|
||||
{
|
||||
auto row = results.begin();
|
||||
count = strtoul(row[0], nullptr, 10);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static void AddMember(Database& db, uint32_t dynamic_zone_id, uint32_t character_id)
|
||||
{
|
||||
db.QueryDatabase(fmt::format(SQL(
|
||||
INSERT INTO {}
|
||||
(dynamic_zone_id, character_id)
|
||||
VALUES
|
||||
({}, {})
|
||||
ON DUPLICATE KEY UPDATE is_current_member = TRUE;
|
||||
),
|
||||
TableName(),
|
||||
dynamic_zone_id,
|
||||
character_id
|
||||
));
|
||||
}
|
||||
|
||||
static void RemoveMember(Database& db, uint32_t dynamic_zone_id, uint32_t character_id)
|
||||
{
|
||||
db.QueryDatabase(fmt::format(SQL(
|
||||
UPDATE {} SET is_current_member = FALSE
|
||||
WHERE dynamic_zone_id = {} AND character_id = {};
|
||||
),
|
||||
TableName(), dynamic_zone_id, character_id
|
||||
));
|
||||
}
|
||||
|
||||
static void RemoveAllMembers(Database& db, uint32_t dynamic_zone_id)
|
||||
{
|
||||
db.QueryDatabase(fmt::format(SQL(
|
||||
UPDATE {} SET is_current_member = FALSE
|
||||
WHERE dynamic_zone_id = {};
|
||||
),
|
||||
TableName(), dynamic_zone_id
|
||||
));
|
||||
}
|
||||
|
||||
static void RemoveAllMembers(Database& db, std::vector<uint32_t> dynamic_zone_ids)
|
||||
{
|
||||
if (!dynamic_zone_ids.empty())
|
||||
{
|
||||
db.QueryDatabase(fmt::format(SQL(
|
||||
UPDATE {} SET is_current_member = FALSE
|
||||
WHERE dynamic_zone_id IN ({});
|
||||
),
|
||||
TableName(), fmt::join(dynamic_zone_ids, ",")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
static int InsertOrUpdateMany(Database& db,
|
||||
const std::vector<DynamicZoneMembers>& dynamic_zone_members_entries)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &dynamic_zone_members_entry: dynamic_zone_members_entries)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.is_current_member));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"INSERT INTO {} ({}) VALUES {} ON DUPLICATE KEY UPDATE is_current_member = TRUE;",
|
||||
TableName(),
|
||||
ColumnsRaw(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_DYNAMIC_ZONE_MEMBERS_REPOSITORY_H
|
||||
@@ -65,242 +65,6 @@ public:
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
struct DynamicZoneInstance
|
||||
{
|
||||
uint32_t id;
|
||||
int instance_id;
|
||||
int type;
|
||||
int compass_zone_id;
|
||||
float compass_x;
|
||||
float compass_y;
|
||||
float compass_z;
|
||||
int safe_return_zone_id;
|
||||
float safe_return_x;
|
||||
float safe_return_y;
|
||||
float safe_return_z;
|
||||
float safe_return_heading;
|
||||
float zone_in_x;
|
||||
float zone_in_y;
|
||||
float zone_in_z;
|
||||
float zone_in_heading;
|
||||
int has_zone_in;
|
||||
int zone;
|
||||
int version;
|
||||
int is_global;
|
||||
uint32_t start_time;
|
||||
int duration;
|
||||
int never_expires;
|
||||
};
|
||||
|
||||
static std::string SelectDynamicZoneJoinInstance()
|
||||
{
|
||||
return std::string(SQL(
|
||||
SELECT
|
||||
dynamic_zones.id,
|
||||
dynamic_zones.instance_id,
|
||||
dynamic_zones.type,
|
||||
dynamic_zones.compass_zone_id,
|
||||
dynamic_zones.compass_x,
|
||||
dynamic_zones.compass_y,
|
||||
dynamic_zones.compass_z,
|
||||
dynamic_zones.safe_return_zone_id,
|
||||
dynamic_zones.safe_return_x,
|
||||
dynamic_zones.safe_return_y,
|
||||
dynamic_zones.safe_return_z,
|
||||
dynamic_zones.safe_return_heading,
|
||||
dynamic_zones.zone_in_x,
|
||||
dynamic_zones.zone_in_y,
|
||||
dynamic_zones.zone_in_z,
|
||||
dynamic_zones.zone_in_heading,
|
||||
dynamic_zones.has_zone_in,
|
||||
instance_list.zone,
|
||||
instance_list.version,
|
||||
instance_list.is_global,
|
||||
instance_list.start_time,
|
||||
instance_list.duration,
|
||||
instance_list.never_expires
|
||||
FROM dynamic_zones
|
||||
INNER JOIN instance_list ON dynamic_zones.instance_id = instance_list.id
|
||||
));
|
||||
}
|
||||
|
||||
static DynamicZoneInstance FillWithInstanceFromRow(MySQLRequestRow& row)
|
||||
{
|
||||
DynamicZoneInstance entry{};
|
||||
|
||||
int col = 0;
|
||||
entry.id = strtoul(row[col++], nullptr, 10);
|
||||
entry.instance_id = strtol(row[col++], nullptr, 10);
|
||||
entry.type = strtol(row[col++], nullptr, 10);
|
||||
entry.compass_zone_id = strtol(row[col++], nullptr, 10);
|
||||
entry.compass_x = strtof(row[col++], nullptr);
|
||||
entry.compass_y = strtof(row[col++], nullptr);
|
||||
entry.compass_z = strtof(row[col++], nullptr);
|
||||
entry.safe_return_zone_id = strtol(row[col++], nullptr, 10);
|
||||
entry.safe_return_x = strtof(row[col++], nullptr);
|
||||
entry.safe_return_y = strtof(row[col++], nullptr);
|
||||
entry.safe_return_z = strtof(row[col++], nullptr);
|
||||
entry.safe_return_heading = strtof(row[col++], nullptr);
|
||||
entry.zone_in_x = strtof(row[col++], nullptr);
|
||||
entry.zone_in_y = strtof(row[col++], nullptr);
|
||||
entry.zone_in_z = strtof(row[col++], nullptr);
|
||||
entry.zone_in_heading = strtof(row[col++], nullptr);
|
||||
entry.has_zone_in = strtol(row[col++], nullptr, 10) != 0;
|
||||
// from instance_list
|
||||
entry.zone = strtol(row[col++], nullptr, 10);
|
||||
entry.version = strtol(row[col++], nullptr, 10);
|
||||
entry.is_global = strtol(row[col++], nullptr, 10);
|
||||
entry.start_time = strtoul(row[col++], nullptr, 10);
|
||||
entry.duration = strtol(row[col++], nullptr, 10);
|
||||
entry.never_expires = strtol(row[col++], nullptr, 10);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static std::vector<DynamicZoneInstance> GetWithInstance(Database& db,
|
||||
const std::vector<uint32_t>& dynamic_zone_ids)
|
||||
{
|
||||
if (dynamic_zone_ids.empty())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<DynamicZoneInstance> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(
|
||||
"{} WHERE dynamic_zones.id IN ({}) ORDER BY dynamic_zones.id;",
|
||||
SelectDynamicZoneJoinInstance(),
|
||||
fmt::join(dynamic_zone_ids, ",")
|
||||
));
|
||||
|
||||
if (results.Success())
|
||||
{
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
DynamicZoneInstance entry = FillWithInstanceFromRow(row);
|
||||
all_entries.emplace_back(std::move(entry));
|
||||
}
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static void UpdateCompass(Database& db, uint32_t dz_id, int zone_id, float x, float y, float z)
|
||||
{
|
||||
if (dz_id != 0)
|
||||
{
|
||||
std::string query = fmt::format(SQL(
|
||||
UPDATE {} SET
|
||||
compass_zone_id = {},
|
||||
compass_x = {},
|
||||
compass_y = {},
|
||||
compass_z = {}
|
||||
WHERE {} = {};
|
||||
), TableName(), zone_id, x, y, z, PrimaryKey(), dz_id);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateSafeReturn(Database& db, uint32_t dz_id, int zone_id, float x, float y, float z, float heading)
|
||||
{
|
||||
if (dz_id != 0)
|
||||
{
|
||||
std::string query = fmt::format(SQL(
|
||||
UPDATE {} SET
|
||||
safe_return_zone_id = {},
|
||||
safe_return_x = {},
|
||||
safe_return_y = {},
|
||||
safe_return_z = {},
|
||||
safe_return_heading = {}
|
||||
WHERE {} = {};
|
||||
), TableName(), zone_id, x, y, z, heading, PrimaryKey(), dz_id);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateZoneIn(Database& db, uint32_t dz_id, uint32_t zone_id, float x, float y, float z, float heading, bool has_zone_in)
|
||||
{
|
||||
if (dz_id != 0)
|
||||
{
|
||||
std::string query = fmt::format(SQL(
|
||||
UPDATE {} SET
|
||||
zone_in_x = {},
|
||||
zone_in_y = {},
|
||||
zone_in_z = {},
|
||||
zone_in_heading = {},
|
||||
has_zone_in = {}
|
||||
WHERE {} = {};
|
||||
), TableName(), x, y, z, heading, has_zone_in, PrimaryKey(), dz_id);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
}
|
||||
}
|
||||
|
||||
struct DynamicZoneInstancePlayerCount
|
||||
{
|
||||
uint32_t id;
|
||||
int type;
|
||||
int instance;
|
||||
int zone;
|
||||
int version;
|
||||
uint32_t start_time;
|
||||
int duration;
|
||||
int member_count;
|
||||
};
|
||||
|
||||
static std::string SelectDynamicZoneInstancePlayerCount()
|
||||
{
|
||||
return std::string(SQL(
|
||||
SELECT
|
||||
dynamic_zones.id,
|
||||
dynamic_zones.type,
|
||||
instance_list.id,
|
||||
instance_list.zone,
|
||||
instance_list.version,
|
||||
instance_list.start_time,
|
||||
instance_list.duration,
|
||||
COUNT(dynamic_zone_members.character_id) member_count
|
||||
FROM dynamic_zones
|
||||
INNER JOIN instance_list ON dynamic_zones.instance_id = instance_list.id
|
||||
LEFT JOIN dynamic_zone_members ON dynamic_zones.id = dynamic_zone_members.dynamic_zone_id
|
||||
AND dynamic_zone_members.is_current_member = TRUE
|
||||
GROUP BY instance_list.id
|
||||
ORDER BY dynamic_zones.id;
|
||||
));
|
||||
};
|
||||
|
||||
static std::vector<DynamicZoneInstancePlayerCount> AllDzInstancePlayerCounts(Database& db)
|
||||
{
|
||||
std::vector<DynamicZoneInstancePlayerCount> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(SelectDynamicZoneInstancePlayerCount());
|
||||
if (results.Success())
|
||||
{
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
DynamicZoneInstancePlayerCount entry{};
|
||||
|
||||
int col = 0;
|
||||
entry.id = strtoul(row[col++], nullptr, 10);
|
||||
entry.type = strtol(row[col++], nullptr, 10);
|
||||
entry.instance = strtol(row[col++], nullptr, 10);
|
||||
entry.zone = strtol(row[col++], nullptr, 10);
|
||||
entry.version = strtol(row[col++], nullptr, 10);
|
||||
entry.start_time = strtoul(row[col++], nullptr, 10);
|
||||
entry.duration = strtol(row[col++], nullptr, 10);
|
||||
entry.member_count = strtol(row[col++], nullptr, 10);
|
||||
|
||||
all_entries.emplace_back(std::move(entry));
|
||||
}
|
||||
}
|
||||
return all_entries;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_DYNAMIC_ZONES_REPOSITORY_H
|
||||
|
||||
@@ -65,58 +65,6 @@ public:
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
struct ExpeditionLockoutsWithTimestamp {
|
||||
uint32_t id;
|
||||
uint32_t expedition_id;
|
||||
std::string event_name;
|
||||
time_t expire_time;
|
||||
int duration;
|
||||
std::string from_expedition_uuid;
|
||||
};
|
||||
|
||||
static std::vector<ExpeditionLockoutsWithTimestamp> GetWithTimestamp(
|
||||
Database& db, const std::vector<uint32_t>& expedition_ids)
|
||||
{
|
||||
if (expedition_ids.empty())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<ExpeditionLockoutsWithTimestamp> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
SELECT
|
||||
id,
|
||||
expedition_id,
|
||||
event_name,
|
||||
UNIX_TIMESTAMP(expire_time),
|
||||
duration,
|
||||
from_expedition_uuid
|
||||
FROM expedition_lockouts
|
||||
WHERE expedition_id IN ({})
|
||||
),
|
||||
fmt::join(expedition_ids, ",")
|
||||
));
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
ExpeditionLockoutsWithTimestamp entry{};
|
||||
|
||||
int col = 0;
|
||||
entry.id = strtoul(row[col++], nullptr, 10);
|
||||
entry.expedition_id = strtoul(row[col++], nullptr, 10);
|
||||
entry.event_name = row[col++];
|
||||
entry.expire_time = strtoull(row[col++], nullptr, 10);
|
||||
entry.duration = strtol(row[col++], nullptr, 10);
|
||||
entry.from_expedition_uuid = row[col++];
|
||||
|
||||
all_entries.emplace_back(std::move(entry));
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
+9
-9
@@ -18,14 +18,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_SERVER_SCHEDULED_EVENTS_REPOSITORY_H
|
||||
#define EQEMU_SERVER_SCHEDULED_EVENTS_REPOSITORY_H
|
||||
#ifndef EQEMU_EXPEDITION_MEMBERS_REPOSITORY_H
|
||||
#define EQEMU_EXPEDITION_MEMBERS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_server_scheduled_events_repository.h"
|
||||
#include "base/base_expedition_members_repository.h"
|
||||
|
||||
class ServerScheduledEventsRepository: public BaseServerScheduledEventsRepository {
|
||||
class ExpeditionMembersRepository: public BaseExpeditionMembersRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
@@ -52,10 +52,10 @@ public:
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* ServerScheduledEventsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* ServerScheduledEventsRepository::GetWhereNeverExpires()
|
||||
* ServerScheduledEventsRepository::GetWhereXAndY()
|
||||
* ServerScheduledEventsRepository::DeleteWhereXAndY()
|
||||
* ExpeditionMembersRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* ExpeditionMembersRepository::GetWhereNeverExpires()
|
||||
* ExpeditionMembersRepository::GetWhereXAndY()
|
||||
* ExpeditionMembersRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
@@ -67,4 +67,4 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_SERVER_SCHEDULED_EVENTS_REPOSITORY_H
|
||||
#endif //EQEMU_EXPEDITION_MEMBERS_REPOSITORY_H
|
||||
@@ -65,186 +65,6 @@ public:
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
struct ExpeditionWithLeader
|
||||
{
|
||||
uint32_t id;
|
||||
std::string uuid;
|
||||
uint32_t dynamic_zone_id;
|
||||
std::string expedition_name;
|
||||
uint32_t min_players;
|
||||
uint32_t max_players;
|
||||
int add_replay_on_join;
|
||||
int is_locked;
|
||||
uint32_t leader_id;
|
||||
std::string leader_name;
|
||||
};
|
||||
|
||||
static std::string SelectExpeditionsJoinLeader()
|
||||
{
|
||||
return std::string(SQL(
|
||||
SELECT
|
||||
expeditions.id,
|
||||
expeditions.uuid,
|
||||
expeditions.dynamic_zone_id,
|
||||
expeditions.expedition_name,
|
||||
expeditions.min_players,
|
||||
expeditions.max_players,
|
||||
expeditions.add_replay_on_join,
|
||||
expeditions.is_locked,
|
||||
expeditions.leader_id,
|
||||
character_data.name leader_name
|
||||
FROM expeditions
|
||||
INNER JOIN character_data ON expeditions.leader_id = character_data.id
|
||||
));
|
||||
}
|
||||
|
||||
static ExpeditionWithLeader FillExpeditionWithLeaderFromRow(MySQLRequestRow& row)
|
||||
{
|
||||
ExpeditionWithLeader entry{};
|
||||
|
||||
int col = 0;
|
||||
entry.id = strtoul(row[col++], nullptr, 10);
|
||||
entry.uuid = row[col++];
|
||||
entry.dynamic_zone_id = strtoul(row[col++], nullptr, 10);
|
||||
entry.expedition_name = row[col++];
|
||||
entry.min_players = strtoul(row[col++], nullptr, 10);
|
||||
entry.max_players = strtoul(row[col++], nullptr, 10);
|
||||
entry.add_replay_on_join = strtoul(row[col++], nullptr, 10);
|
||||
entry.is_locked = strtoul(row[col++], nullptr, 10);
|
||||
entry.leader_id = strtoul(row[col++], nullptr, 10);
|
||||
entry.leader_name = row[col++];
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static std::vector<ExpeditionWithLeader> GetAllWithLeaderName(Database& db)
|
||||
{
|
||||
std::vector<ExpeditionWithLeader> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(
|
||||
"{} ORDER BY expeditions.id;",
|
||||
SelectExpeditionsJoinLeader()
|
||||
));
|
||||
|
||||
if (results.Success())
|
||||
{
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
ExpeditionWithLeader entry = FillExpeditionWithLeaderFromRow(row);
|
||||
all_entries.emplace_back(std::move(entry));
|
||||
}
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static ExpeditionWithLeader GetWithLeaderName(Database& db, uint32_t expedition_id)
|
||||
{
|
||||
ExpeditionWithLeader entry{};
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(
|
||||
"{} WHERE expeditions.id = {};",
|
||||
SelectExpeditionsJoinLeader(),
|
||||
expedition_id
|
||||
));
|
||||
|
||||
if (results.Success() && results.RowCount() > 0)
|
||||
{
|
||||
auto row = results.begin();
|
||||
entry = FillExpeditionWithLeaderFromRow(row);
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
struct CharacterExpedition
|
||||
{
|
||||
uint32_t id;
|
||||
std::string name;
|
||||
uint32_t expedition_id;
|
||||
};
|
||||
|
||||
static std::vector<CharacterExpedition> GetCharactersWithExpedition(
|
||||
Database& db, const std::vector<std::string>& character_names)
|
||||
{
|
||||
if (character_names.empty())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<CharacterExpedition> entries;
|
||||
|
||||
auto joined_character_names = fmt::format("'{}'", fmt::join(character_names, "','"));
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
SELECT
|
||||
character_data.id,
|
||||
character_data.name,
|
||||
MAX(expeditions.id)
|
||||
FROM character_data
|
||||
LEFT JOIN dynamic_zone_members
|
||||
ON character_data.id = dynamic_zone_members.character_id
|
||||
AND dynamic_zone_members.is_current_member = TRUE
|
||||
LEFT JOIN expeditions
|
||||
ON dynamic_zone_members.dynamic_zone_id = expeditions.dynamic_zone_id
|
||||
WHERE character_data.name IN ({})
|
||||
GROUP BY character_data.id
|
||||
ORDER BY FIELD(character_data.name, {})
|
||||
),
|
||||
joined_character_names,
|
||||
joined_character_names
|
||||
));
|
||||
|
||||
if (results.Success())
|
||||
{
|
||||
entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
CharacterExpedition entry{};
|
||||
entry.id = std::strtoul(row[0], nullptr, 10);
|
||||
entry.name = row[1];
|
||||
entry.expedition_id = row[2] ? std::strtoul(row[2], nullptr, 10) : 0;
|
||||
|
||||
entries.emplace_back(std::move(entry));
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static uint32_t GetIDByMemberID(Database& db, uint32_t character_id)
|
||||
{
|
||||
if (character_id == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t expedition_id = 0;
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
SELECT
|
||||
expeditions.id
|
||||
FROM expeditions
|
||||
INNER JOIN dynamic_zone_members
|
||||
ON expeditions.dynamic_zone_id = dynamic_zone_members.dynamic_zone_id
|
||||
WHERE
|
||||
dynamic_zone_members.character_id = {}
|
||||
AND dynamic_zone_members.is_current_member = TRUE;
|
||||
),
|
||||
character_id
|
||||
));
|
||||
|
||||
if (results.Success() && results.RowCount() > 0)
|
||||
{
|
||||
auto row = results.begin();
|
||||
expedition_id = std::strtoul(row[0], nullptr, 10);
|
||||
}
|
||||
|
||||
return expedition_id;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_EXPEDITIONS_REPOSITORY_H
|
||||
|
||||
@@ -65,34 +65,6 @@ public:
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
static int InsertOrUpdateMany(Database& db,
|
||||
const std::vector<InstanceListPlayer>& instance_list_player_entries)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &instance_list_player_entry: instance_list_player_entries)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(instance_list_player_entry.id));
|
||||
insert_values.push_back(std::to_string(instance_list_player_entry.charid));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"INSERT INTO {} ({}) VALUES {} ON DUPLICATE KEY UPDATE id = VALUES(id)",
|
||||
TableName(),
|
||||
ColumnsRaw(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_INSTANCE_LIST_PLAYER_REPOSITORY_H
|
||||
|
||||
@@ -65,15 +65,6 @@ public:
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
static int UpdateDuration(Database& db, int instance_id, uint32_t new_duration)
|
||||
{
|
||||
auto results = db.QueryDatabase(fmt::format(
|
||||
"UPDATE {} SET duration = {} WHERE {} = {};",
|
||||
TableName(), new_duration, PrimaryKey(), instance_id
|
||||
));
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_INSTANCE_LIST_REPOSITORY_H
|
||||
|
||||
+65
-19
@@ -70,6 +70,7 @@ RULE_INT(Character, HPRegenMultiplier, 100, "The hitpoint regeneration is multip
|
||||
RULE_INT(Character, ManaRegenMultiplier, 100, "The mana regeneration is multiplied by value/100 (up to the caps)")
|
||||
RULE_INT(Character, EnduranceRegenMultiplier, 100, "The endurance regeneration is multiplied by value/100 (up to the caps)")
|
||||
RULE_BOOL(Character, OldMinMana, false, "This is used for servers that want to follow older skill cap formulas so they can still have some regen w/o mediate")
|
||||
RULE_INT(Character, ConsumptionMultiplier, 100, "Item's hunger restored = value x item's food level. 100=normal, 50=player eat 2x as fast, 200=player eat 2x as slow")
|
||||
RULE_BOOL(Character, HealOnLevel, false, "Setting whether a player should heal completely when leveling")
|
||||
RULE_BOOL(Character, FeignKillsPet, false, "Setting whether Feign Death kills the player pet")
|
||||
RULE_INT(Character, ItemManaRegenCap, 15, "Limit on mana regeneration granted by items")
|
||||
@@ -162,8 +163,6 @@ RULE_BOOL(Character, UseNoJunkFishing, false, "Disregards junk items when fishin
|
||||
RULE_BOOL(Character, SoftDeletes, true, "When characters are deleted in character select, they are only soft deleted")
|
||||
RULE_INT(Character, DefaultGuild, 0, "If not 0, new characters placed into the guild # indicated")
|
||||
RULE_BOOL(Character, ProcessFearedProximity, false, "Processes proximity checks when feared")
|
||||
RULE_BOOL(Character, EnableCharacterEXPMods, false, "Enables character zone-based experience modifiers.")
|
||||
RULE_BOOL(Character, PVPEnableGuardFactionAssist, true, "Enables faction based assisting against the aggresor in pvp.")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Mercs)
|
||||
@@ -177,10 +176,12 @@ RULE_INT(Mercs, AggroRadius, 100, "Determines the distance from which a merc wil
|
||||
RULE_INT(Mercs, AggroRadiusPuller, 25, "Determines the distance from which a merc will aggro group member's target, if they have the group role of puller (also used to determine the distance at which a healer merc will begin healing a group member, if they have the group role of puller)")
|
||||
RULE_INT(Mercs, ResurrectRadius, 50, "Determines the distance from which a healer merc will attempt to resurrect a group member's corpse")
|
||||
RULE_INT(Mercs, ScaleRate, 100, "Merc scale factor")
|
||||
RULE_BOOL(Mercs, MercsUsePathing, true, "Mercs will use node pathing when moving")
|
||||
RULE_BOOL(Mercs, AllowMercSuspendInCombat, true, "Allow merc suspend in combat")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Guild)
|
||||
RULE_INT(Guild, MaxMembers, 2048, "Maximum number of members a guild can have")
|
||||
RULE_BOOL(Guild, PlayerCreationAllowed, false, "Allow players to create a guild using the window in Underfoot+")
|
||||
RULE_INT(Guild, PlayerCreationLimit, 1, "Only allow use of the UF+ window if the account has < than this number of guild leaders on it")
|
||||
RULE_INT(Guild, PlayerCreationRequiredStatus, 0, "Required status to create a guild")
|
||||
@@ -211,7 +212,6 @@ RULE_CATEGORY(GM)
|
||||
RULE_INT(GM, MinStatusToSummonItem, 250, "Minimum required status to summon items")
|
||||
RULE_INT(GM, MinStatusToZoneAnywhere, 250, "Minimum required status to zone anywhere")
|
||||
RULE_INT(GM, MinStatusToLevelTarget, 100, "Minimum required status to set the level of a player")
|
||||
RULE_INT(GM, MinStatusToBypassLockedServer, 100, "Players >= this status can log in to the server even when it is locked")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(World)
|
||||
@@ -230,6 +230,7 @@ RULE_INT(World, AddMaxClientsStatus, -1, "Accounts with status >= this rule will
|
||||
RULE_BOOL(World, MaxClientsSetByStatus, false, "If true, IP Limiting will be set to the status on the account as long as the status is > MaxClientsPerIP")
|
||||
RULE_BOOL(World, EnableIPExemptions, false, "If true, ip_exemptions table is used, if there is no entry for the IP it will default to RuleI(World, MaxClientsPerIP)")
|
||||
RULE_BOOL(World, ClearTempMerchantlist, true, "Clears temp merchant items when world boots")
|
||||
RULE_BOOL(World, DeleteStaleCorpeBackups, true, "Deletes stale corpse backups older than 2 weeks")
|
||||
RULE_BOOL(World, GMAccountIPList, false, "Check IP list against GM accounts. This increases the security of GM accounts, e.g. if you only allow localhost '127.0.0.1' for GM accounts. Think carefully about what you enter!")
|
||||
RULE_INT(World, MinGMAntiHackStatus, 1, "Minimum status to check against AntiHack list")
|
||||
RULE_INT(World, SoFStartZoneID, -1, "Sets the Starting Zone for SoF Clients separate from Titanium Clients (-1 is disabled)")
|
||||
@@ -241,6 +242,7 @@ RULE_INT(World, PVPMinLevel, 0, "Minimum level to pvp")
|
||||
RULE_BOOL (World, IsGMPetitionWindowEnabled, false, "Setting whether the GM petition window is available")
|
||||
RULE_INT (World, FVNoDropFlag, 0, "Sets the Firiona Vie settings on the client, allowing trading of no-drop items. 1=for all players, 2=for GM only")
|
||||
RULE_BOOL (World, IPLimitDisconnectAll, false, "Disconnect all current clients by IP if they go over the IP limit. This should allow people to quickly reconnect in the case of dead sessions waiting to timeout")
|
||||
RULE_BOOL(World, MaxClientsSimplifiedLogic, false, "New logic that only uses ExemptMaxClientsStatus and MaxClientsPerIP. Done on the loginserver. This mimics the P99-style special IP rules")
|
||||
RULE_INT (World, TellQueueSize, 20, "Maximum tell queue size")
|
||||
RULE_BOOL(World, StartZoneSameAsBindOnCreation, true, "Should the start zone always be the same location as your bind?")
|
||||
RULE_BOOL(World, EnforceCharacterLimitAtLogin, false, "Enforce the limit for characters that are online at login")
|
||||
@@ -251,6 +253,16 @@ RULE_CATEGORY(Zone)
|
||||
RULE_INT(Zone, ClientLinkdeadMS, 90000, "The time a client remains link dead on the server after a sudden disconnection (milliseconds)")
|
||||
RULE_INT(Zone, GraveyardTimeMS, 1200000, "Time until a player corpse is moved to a zone's graveyard, if one is specified for the zone (milliseconds)")
|
||||
RULE_BOOL(Zone, EnableShadowrest, 1, "Enables or disables the Shadowrest zone feature for player corpses. Default is turned on")
|
||||
RULE_BOOL(Zone, UsePlayerCorpseBackups, true, "Keeps backups of player corpses")
|
||||
RULE_INT(Zone, MQWarpExemptStatus, -1, "Required status level to exempt the MQWarpDetector. Set to -1 to disable this feature")
|
||||
RULE_INT(Zone, MQZoneExemptStatus, -1, "Required status level to exempt the MQZoneDetector. Set to -1 to disable this feature")
|
||||
RULE_INT(Zone, MQGateExemptStatus, -1, "Required status level to exempt the MQGateDetector. Set to -1 to disable this feature")
|
||||
RULE_INT(Zone, MQGhostExemptStatus, -1, "Required status level to exempt the MGhostDetector. Set to -1 to disable this feature")
|
||||
RULE_BOOL(Zone, EnableMQWarpDetector, true, "Enable the MQWarp Detector. Set to False to disable this feature")
|
||||
RULE_BOOL(Zone, EnableMQZoneDetector, true, "Enable the MQZone Detector. Set to False to disable this feature")
|
||||
RULE_BOOL(Zone, EnableMQGateDetector, true, "Enable the MQGate Detector. Set to False to disable this feature")
|
||||
RULE_BOOL(Zone, EnableMQGhostDetector, true, "Enable the MQGhost Detector. Set to False to disable this feature")
|
||||
RULE_REAL(Zone, MQWarpDetectionDistanceFactor, 9.0, "Distance factor for MQ-Warp detection. Clients move at 4.4 about if in a straight line but with movement and to acct for lag we raise it a bit")
|
||||
RULE_INT(Zone, AutoShutdownDelay, 5000, "How long a dynamic zone stays loaded while empty (milliseconds)")
|
||||
RULE_INT(Zone, PEQZoneReuseTime, 900, "Time between two uses of the #peqzone command (seconds)")
|
||||
RULE_INT(Zone, PEQZoneDebuff1, 4454, "First debuff casted by #peqzone Default is Cursed Keeper's Blight")
|
||||
@@ -280,6 +292,7 @@ RULE_INT(Map, FindBestZHeightAdjust, 1, "Adds this to the current Z before seeki
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Pathing)
|
||||
RULE_BOOL(Pathing, Guard, true, "Enable pathing for mobs moving to their guard point")
|
||||
RULE_BOOL(Pathing, Find, true, "Enable pathing for FindPerson requests from the client")
|
||||
RULE_BOOL(Pathing, Fear, true, "Enable pathing for fear")
|
||||
RULE_REAL(Pathing, NavmeshStepSize, 100.0f, "Step size for the movement manager")
|
||||
@@ -289,6 +302,9 @@ RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Watermap)
|
||||
// enable these to use the water detection code. Requires Water Maps generated by awater utility
|
||||
RULE_BOOL(Watermap, CheckWaypointsInWaterWhenLoading, false, "Does not apply BestZ as waypoints are loaded if they are in water")
|
||||
RULE_BOOL(Watermap, CheckForWaterAtWaypoints, false, "Check if a mob has moved into/out of water when at waypoints and sets flymode")
|
||||
RULE_BOOL(Watermap, CheckForWaterWhenMoving, false, "Checks if a mob has moved into/out of water each time it's loc is recalculated")
|
||||
RULE_BOOL(Watermap, CheckForWaterOnSendTo, false, "Checks if a mob has moved into/out of water on SendTo")
|
||||
RULE_BOOL(Watermap, CheckForWaterWhenFishing, false, "Only lets a player fish near water (if a water map exists for the zone)")
|
||||
RULE_REAL(Watermap, FishingRodLength, 30, "How far in front of player water must be for fishing to work")
|
||||
@@ -297,11 +313,16 @@ RULE_REAL(Watermap, FishingLineStepSize, 1, "Basic step size for fishing calc, t
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Spells)
|
||||
RULE_REAL(Spells, ResistChance, 2.0, "chance to resist given no resists and same level")
|
||||
RULE_REAL(Spells, ResistMod, 0.40, "Multiplier, chance to resist = this * ResistAmount")
|
||||
RULE_REAL(Spells, PartialHitChance, 0.7, "The chance when a spell is resisted that it will partial hit")
|
||||
RULE_REAL(Spells, PartialHitChanceFear, 0.25, "The chance when a fear spell is resisted that it will partial hit")
|
||||
RULE_INT(Spells, BaseCritChance, 0, "Base percentage chance that everyone has to crit a spell")
|
||||
RULE_INT(Spells, BaseCritRatio, 100, "Base percentage bonus to damage on a successful spell crit. 100=2xdamage")
|
||||
RULE_INT(Spells, WizCritLevel, 12, "Level wizards first get spell crits")
|
||||
RULE_INT(Spells, WizCritChance, 7, "Wizards crit chance, on top of BaseCritChance")
|
||||
RULE_INT(Spells, WizCritRatio, 0, "Wizards crit bonus, on top of BaseCritRatio (should be 0 for Live-like)")
|
||||
RULE_INT(Spells, ResistPerLevelDiff, 85, "Resist per level difference. 85=8.5")
|
||||
RULE_INT(Spells, TranslocateTimeLimit, 0, "If not zero, time in seconds to accept a Translocate")
|
||||
RULE_INT(Spells, SacrificeMinLevel, 46, "First level the spell Sacrifice will work on")
|
||||
RULE_INT(Spells, SacrificeMaxLevel, 69, "Last level the spell Sacrifice will work on")
|
||||
@@ -327,6 +348,7 @@ RULE_INT(Spells, CharismaEffectivenessCap, 255, "Determines how much resist modi
|
||||
RULE_BOOL(Spells, CharismaCharmDuration, false, "Allow CHA resist mod to extend charm duration")
|
||||
RULE_INT(Spells, CharmBreakCheckChance, 25, "Determines chance for a charm break check to occur each buff tick")
|
||||
RULE_BOOL(Spells, CharmDisablesSpecialAbilities, false, "When charm is cast on an NPC, strip their special abilities")
|
||||
RULE_INT(Spells, MaxCastTimeReduction, 50, "Maximum percent your spell cast time can be reduced by spell haste")
|
||||
RULE_INT(Spells, RootBreakFromSpells, 55, "Chance for root to break when cast on")
|
||||
RULE_INT(Spells, DeathSaveCharismaMod, 3, "Determines how much charisma effects chance of death save firing")
|
||||
RULE_INT(Spells, DivineInterventionHeal, 8000, "Divine intervention heal amount")
|
||||
@@ -368,15 +390,13 @@ RULE_BOOL(Spells, AllowItemTGB, false, "Target group buff (/tgb) doesn't work wi
|
||||
RULE_BOOL(Spells, NPCInnateProcOverride, true, "NPC innate procs override the target type to single target")
|
||||
RULE_BOOL(Spells, OldRainTargets, false, "Use old incorrectly implemented maximum targets for rains")
|
||||
RULE_BOOL(Spells, NPCSpellPush, false, "Enable spell push on NPCs")
|
||||
RULE_BOOL(Spells, July242002PetResists, true, "Enable Pets using PCs resist change from July 24 2002")
|
||||
RULE_INT(Spells, AOEMaxTargets, 0, "Max number of targets a Targeted AOE spell can cast on. Set to 0 for no limit.")
|
||||
RULE_BOOL(Spells, AllowDoubleInvis, false, "Allows you to cast invisibility spells on a player that is already invisible")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Combat)
|
||||
RULE_REAL(Combat, AERampageSafeZone, 0.018, "max hit ae ramp reduction range")
|
||||
RULE_INT(Combat, PetBaseCritChance, 0, "Pet base crit chance")
|
||||
RULE_INT(Combat, NPCBashKickLevel, 6, "The level that NPCcan KICK/BASH")
|
||||
RULE_INT(Combat, NPCBashKickStunChance, 15, "Percent chance that a bash/kick will stun")
|
||||
RULE_INT(Combat, MeleeCritDifficulty, 8900, "Value against which is rolled to check if a melee crit is triggered. Lower is easier")
|
||||
RULE_INT(Combat, ArcheryCritDifficulty, 3400, "Value against which is rolled to check if an archery crit is triggered. Lower is easier")
|
||||
RULE_INT(Combat, ThrowingCritDifficulty, 1100, "Value against which is rolled to check if a throwing crit is triggered. Lower is easier")
|
||||
@@ -384,6 +404,7 @@ RULE_BOOL(Combat, NPCCanCrit, false, "Setting whether an NPC can land critical h
|
||||
RULE_BOOL(Combat, UseIntervalAC, true, "Switch whether bonuses, armour class, multipliers, classes and caps should be considered in the calculation of damage values")
|
||||
RULE_INT(Combat, PetAttackMagicLevel, 30, "Level at which pets can cause magic damage")
|
||||
RULE_BOOL(Combat, EnableFearPathing, true, "Setting whether to use pathing during fear")
|
||||
RULE_REAL(Combat, FleeMultiplier, 2.0, "Determines how quickly a NPC will slow down while fleeing. Decrease multiplier to slow NPC down quicker")
|
||||
RULE_BOOL(Combat, FleeGray, true, "If true FleeGrayHPRatio will be used")
|
||||
RULE_INT(Combat, FleeGrayHPRatio, 50, "HP percentage when a Gray NPC begins to flee")
|
||||
RULE_INT(Combat, FleeGrayMaxLevel, 18, "NPC above this level won't do gray/green con flee")
|
||||
@@ -394,6 +415,8 @@ RULE_REAL(Combat, AvgProcsPerMinute, 2.0, "Average proc rate per minute")
|
||||
RULE_REAL(Combat, ProcPerMinDexContrib, 0.075, "Increases the probability of a proc increased by DEX by the value indicated")
|
||||
RULE_REAL(Combat, BaseProcChance, 0.035, "Base chance for procs")
|
||||
RULE_REAL(Combat, ProcDexDivideBy, 11000, "Divisor for the probability of a proc increased by dexterity")
|
||||
RULE_BOOL(Combat, AdjustSpecialProcPerMinute, true, "Set PPM for special abilities like HeadShot (Live does this as of 4-14)")
|
||||
RULE_REAL(Combat, AvgSpecialProcsPerMinute, 2.0, "Unclear what best value is atm")
|
||||
RULE_REAL(Combat, BaseHitChance, 69.0, "Base chance to hit")
|
||||
RULE_REAL(Combat, NPCBonusHitChance, 26.0, "Bonus chance to hit for NPC")
|
||||
RULE_REAL(Combat, HitFalloffMinor, 5.0, "Hit will fall off up to value over the initial level range (percent)")
|
||||
@@ -407,12 +430,22 @@ RULE_REAL(Combat, MinChancetoHit, 5.0, "Minimum percentage chance to hit with re
|
||||
RULE_REAL(Combat, MaxChancetoHit, 95.0, "Maximum percentage chance to hit with regular melee/ranged")
|
||||
RULE_INT(Combat, MinRangedAttackDist, 25, "Minimum Distance to use Ranged Attacks")
|
||||
RULE_BOOL(Combat, ArcheryBonusRequiresStationary, true, "does the 2x archery bonus chance require a stationary npc")
|
||||
RULE_REAL(Combat, ArcheryBaseDamageBonus, 1, "Percentage modifier to base archery Damage 0.5=50% base damage, 1=100%,2=200%")
|
||||
RULE_REAL(Combat, ArcheryNPCMultiplier, 1.0, "Value is multiplied by the regular dmg to get the archery dmg")
|
||||
RULE_BOOL(Combat, AssistNoTargetSelf, true, "When assisting a target that does not have a target: true = target self, false = leave target as was before assist (false = live like)")
|
||||
RULE_INT(Combat, MaxRampageTargets, 3, "Maximum number of people hit with rampage")
|
||||
RULE_INT(Combat, DefaultRampageTargets, 1, "Default number of people to hit with rampage")
|
||||
RULE_BOOL(Combat, RampageHitsTarget, false, "Rampage will hit the target if it still has targets left")
|
||||
RULE_INT(Combat, MaxFlurryHits, 2, "Maximum number of extra hits from flurry")
|
||||
RULE_INT(Combat, MonkDamageTableBonus, 5, "Percentage bonus monks get to their damage table calcs")
|
||||
RULE_INT(Combat, FlyingKickBonus, 25, "Percentage Modifier that this skill gets to str and skill bonuses")
|
||||
RULE_INT(Combat, DragonPunchBonus, 20, "Percentage Modifier that this skill gets to str and skill bonuses")
|
||||
RULE_INT(Combat, EagleStrikeBonus, 15, "Percentage Modifier that this skill gets to str and skill bonuses")
|
||||
RULE_INT(Combat, TigerClawBonus, 10, "Percentage Modifier that this skill gets to str and skill bonuses")
|
||||
RULE_INT(Combat, RoundKickBonus, 5, "Percentage Modifier that this skill gets to str and skill bonuses")
|
||||
RULE_INT(Combat, FrenzyBonus, 0, "Percentage Modifier to damage")
|
||||
RULE_INT(Combat, BackstabBonus, 0, "Percentage Modifier to damage")
|
||||
RULE_BOOL(Combat, ProcTargetOnly, true, "true = procs will only affect our target, false = procs will affect all of our targets")
|
||||
RULE_REAL(Combat, NPCACFactor, 2.25, "If UseIntervalAC is enabled, the armor class for NPC is divided by this value")
|
||||
RULE_INT(Combat, ClothACSoftcap, 75, "If OldACSoftcapRules is true: armorclass softcap for cloth armor")
|
||||
RULE_INT(Combat, LeatherACSoftcap, 100, "If OldACSoftcapRules is true: armorclass softcap for leather armor")
|
||||
@@ -447,15 +480,18 @@ RULE_BOOL (Combat,TauntOverLevel, 1, "Allows you to taunt NPC's over warriors le
|
||||
RULE_REAL (Combat,TauntSkillFalloff, 0.33, "For every taunt skill point that's not maxed you lose this percentage chance to taunt")
|
||||
RULE_BOOL (Combat,EXPFromDmgShield, false, "Determine if damage from a damage shield counts for experience gain")
|
||||
RULE_INT(Combat, MonkACBonusWeight, 15, "Usually, a monk under this weight threshold gets an AC bonus")
|
||||
RULE_INT(Combat, ClientStunLevel, 55, "This is the level where client kicks and bashes can stun the target")
|
||||
RULE_INT(Combat, QuiverHasteCap, 1000, "Quiver haste cap 1000 on live for a while, currently 700 on live")
|
||||
RULE_BOOL(Combat, UseArcheryBonusRoll, false, "Make the 51+ archery bonus require an actual roll")
|
||||
RULE_INT(Combat, ArcheryBonusChance, 50, "Chance for 50+ archery bonus damage if Combat:UseArcheryBonusRoll is true")
|
||||
RULE_INT(Combat, BerserkerFrenzyStart, 35, "Percentage Health Points below which Warrior and Berserker start frenzy")
|
||||
RULE_INT(Combat, BerserkerFrenzyEnd, 45, "Percentage Health Points above which Warrior and Berserker end frenzy")
|
||||
RULE_BOOL(Combat, OneProcPerWeapon, true, "If enabled, One proc per weapon per round")
|
||||
RULE_BOOL(Combat, ProjectileDmgOnImpact, true, "If enabled, projectiles (i.e. arrows) will hit on impact, instead of instantly")
|
||||
RULE_BOOL(Combat, MeleePush, true, "Enable melee push")
|
||||
RULE_BOOL(Combat, ProjectileDmgOnImpact, true, "If enabled, projectiles (ie arrows) will hit on impact, instead of instantly")
|
||||
RULE_BOOL(Combat, MeleePush, true, "Eenable melee push")
|
||||
RULE_INT(Combat, MeleePushChance, 50, "NPC chance the target will be pushed. Made up, 100 actually isn't that bad")
|
||||
RULE_BOOL(Combat, UseLiveCombatRounds, true, "Turn this false if you don't want to worry about fixing up combat rounds for NPCs")
|
||||
RULE_INT(Combat, NPCAssistCap, 5, "Maximum number of NPC that will assist another NPC at once")
|
||||
RULE_INT(Combat, NPCAssistCap, 5, "Maxiumium number of NPC that will assist another NPC at once")
|
||||
RULE_INT(Combat, NPCAssistCapTimer, 6000, "Time a NPC will take to clear assist aggro cap space (milliseconds)")
|
||||
RULE_BOOL(Combat, UseRevampHandToHand, false, "Use h2h revamped dmg/delays I believe this was implemented during SoF")
|
||||
RULE_BOOL(Combat, ClassicMasterWu, false, "Classic Master Wu uses a random special, modern doesn't")
|
||||
@@ -465,8 +501,6 @@ RULE_INT(Combat, LevelToStopACTwinkControl, 50, "Level to stop armorclass twink
|
||||
RULE_BOOL(Combat, ClassicNPCBackstab, false, "True disables NPC facestab - NPC get normal attack if not behind")
|
||||
RULE_BOOL(Combat, UseNPCDamageClassLevelMods, true, "Uses GetClassLevelDamageMod calc in npc_scale_manager")
|
||||
RULE_BOOL(Combat, UseExtendedPoisonProcs, false, "Allow old school poisons to last until characrer zones, at a lower proc rate")
|
||||
RULE_BOOL(Combat, EnableSneakPull, false, "Enable implementation of Sneak Pull")
|
||||
RULE_INT(Combat, SneakPullAssistRange, 400, "Modified range of assist for sneak pull")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(NPC)
|
||||
@@ -486,7 +520,7 @@ RULE_BOOL(NPC, SmartLastFightingDelayMoving, true, "When true, mobs that started
|
||||
RULE_BOOL(NPC, ReturnNonQuestNoDropItems, false, "Returns NO DROP items on NPC that don't have an EVENT_TRADE sub in their script")
|
||||
RULE_INT(NPC, StartEnrageValue, 9, " Percentage HP that an NPC will begin to enrage")
|
||||
RULE_BOOL(NPC, LiveLikeEnrage, false, "If set to true then only player controlled pets will enrage")
|
||||
RULE_BOOL(NPC, EnableMeritBasedFaction, false, "If set to true, faction will be given in the same way as experience (solo/group/raid)")
|
||||
RULE_BOOL(NPC, EnableMeritBasedFaction, false, "If set to true, faction will given in the same way as experience (solo/group/raid)")
|
||||
RULE_INT(NPC, NPCToNPCAggroTimerMin, 500, "Minimum time span after which one NPC aggro another NPC (milliseconds)")
|
||||
RULE_INT(NPC, NPCToNPCAggroTimerMax, 6000, "Maximum time span after which one NPC aggro another NPC (milliseconds)")
|
||||
RULE_BOOL(NPC, UseClassAsLastName, true, "Uses class archetype as LastName for NPC with none")
|
||||
@@ -507,6 +541,7 @@ RULE_INT(Aggro, MeleeRangeAggroMod, 10, "Aggro increase against targets in melee
|
||||
RULE_INT(Aggro, CurrentTargetAggroMod, 0, "Aggro increase against current target. 0% = prefer the current target to any other. Makes it harder for our NPC to switch targets")
|
||||
RULE_INT(Aggro, CriticallyWoundedAggroMod, 100, "Aggro increase against critical wounded targets")
|
||||
RULE_INT(Aggro, SpellAggroMod, 100, "Aggro increase for spells")
|
||||
RULE_INT(Aggro, SongAggroMod, 33, "Aggro increase for songs")
|
||||
RULE_INT(Aggro, PetSpellAggroMod, 10, "Aggro increase for pet spells")
|
||||
RULE_REAL(Aggro, TunnelVisionAggroMod, 0.75, "People not currently the top hate generate this much hate on a Tunnel Vision mob")
|
||||
RULE_INT(Aggro, MaxScalingProcAggro, 400, "Set to -1 for no limit. Maximum amount of aggro that HP scaling SPA effect in a proc will add")
|
||||
@@ -538,6 +573,7 @@ RULE_INT(Range, SpellParticles, 135, "The packet range in which spell particles
|
||||
RULE_INT(Range, DamageMessages, 50, "The packet range in which damage messages are sent (non-crit)")
|
||||
RULE_INT(Range, SpellMessages, 75, "The packet range in which spell damage messages are sent")
|
||||
RULE_INT(Range, SongMessages, 75, "The packet range in which song messages are sent")
|
||||
RULE_INT(Range, MobPositionUpdates, 600, "The packet range in which mob position updates are sent")
|
||||
RULE_INT(Range, ClientPositionUpdates, 300, "Distance in which the own changed position is communicated to other clients")
|
||||
RULE_INT(Range, CriticalDamage, 80, "The packet range in which critical hit messages are sent")
|
||||
RULE_INT(Range, MobCloseScanDistance, 600, "Close scan distance")
|
||||
@@ -557,9 +593,14 @@ RULE_INT(Bots, HealRotationMaxTargets, 12, "Maximum number of heal rotation targ
|
||||
RULE_REAL(Bots, ManaRegen, 2.0, "Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players")
|
||||
RULE_BOOL(Bots, PreferNoManaCommandSpells, true, "Give sorting priority to newer no-mana spells (i.e., 'Bind Affinity')")
|
||||
RULE_BOOL(Bots, QuestableSpawnLimit, false, "Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl")
|
||||
RULE_BOOL(Bots, QuestableSpells, false, "Anita Thrall's (Anita_Thrall.pl) Bot Spell Scriber quests")
|
||||
RULE_INT(Bots, SpawnLimit, 71, "Number of bots a character can have spawned at one time, You + 71 bots is a 12 group pseudo-raid")
|
||||
RULE_BOOL(Bots, UpdatePositionWithTimer, false, "Sends a position update with every positive movement timer check")
|
||||
RULE_BOOL(Bots, UsePathing, true, "Bots will use node pathing when moving")
|
||||
RULE_BOOL(Bots, BotGroupXP, false, "Determines whether client gets experience for bots outside their group")
|
||||
RULE_BOOL(Bots, BotBardUseOutOfCombatSongs, true, "Determines whether bard bots use additional out of combat songs (optional script)")
|
||||
RULE_BOOL(Bots, BotLevelsWithOwner, false, "Auto-updates spawned bots as owner levels/de-levels (false is original behavior)")
|
||||
RULE_BOOL(Bots, BotCharacterLevelEnabled, false, "Enables required level to spawn bots")
|
||||
RULE_INT(Bots, BotCharacterLevel, 0, "If level is greater that value player can spawn bots if BotCharacterLevelEnabled is true")
|
||||
RULE_INT(Bots, CasterStopMeleeLevel, 13, "Level at which caster bots stop melee attacks")
|
||||
RULE_INT(Bots, AllowedClasses, 0xFFFFFFFF, "Bitmask of allowed bot classes")
|
||||
@@ -639,10 +680,12 @@ RULE_INT(Adventure, ItemIDToEnablePorts, 41000, "ItemID to enable adventure port
|
||||
RULE_INT(Adventure, LDoNTrapDistanceUse, 625, "LDoN trap distance use")
|
||||
RULE_REAL(Adventure, LDoNBaseTrapDifficulty, 15.0, "LDoN base trap difficulty")
|
||||
RULE_REAL(Adventure, LDoNCriticalFailTrapThreshold, 10.0, "LDoN critical fail trap threshold")
|
||||
RULE_INT(Adventure, LDoNAdventureExpireTime, 1800, "LDoN adventure expire time (seconds)")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(AA)
|
||||
RULE_INT(AA, ExpPerPoint, 23976503, "Amount of experience per AA. Is the same as the amount of experience to go from level 51 to level 52")
|
||||
RULE_BOOL(AA, Stacking, true, "Allow AA that belong to the same group to stack on SOF+ clients")
|
||||
RULE_BOOL(AA, NormalizedAAEnabled, false, "TSS+ change to AA that normalizes AA experience to a fixed # of white con kills independent of level")
|
||||
RULE_INT(AA, NormalizedAANumberOfWhiteConPerAA, 25, "The number of white con kills per AA point")
|
||||
RULE_BOOL(AA, ModernAAScalingEnabled, false, "Are we linearly scaling AA experience based on total # of earned AA?")
|
||||
@@ -669,11 +712,13 @@ RULE_CATEGORY(QueryServ)
|
||||
RULE_BOOL(QueryServ, PlayerLogChat, false, "Log player chat")
|
||||
RULE_BOOL(QueryServ, PlayerLogTrades, false, "Log player trades")
|
||||
RULE_BOOL(QueryServ, PlayerDropItems, false, "Log player dropping items")
|
||||
RULE_BOOL(QueryServ, PlayerLogHandins, false, "Log player hand ins")
|
||||
RULE_BOOL(QueryServ, PlayerLogHandins, false, "Log player handins")
|
||||
RULE_BOOL(QueryServ, PlayerLogNPCKills, false, "Log player NPC kills")
|
||||
RULE_BOOL(QueryServ, PlayerLogDeletes, false, "Log player deletes")
|
||||
RULE_BOOL(QueryServ, PlayerLogMoves, false, "Log player moves")
|
||||
RULE_BOOL(QueryServ, PlayerLogMerchantTransactions, false, "Log merchant transactions")
|
||||
RULE_BOOL(QueryServ, PlayerLogPCCoordinates, false, "Log player coordinates with certain events")
|
||||
RULE_BOOL(QueryServ, PlayerLogDropItem, false, "Log player drop item")
|
||||
RULE_BOOL(QueryServ, PlayerLogZone, false, "Log player zone events")
|
||||
RULE_BOOL(QueryServ, PlayerLogDeaths, false, "Log player deaths")
|
||||
RULE_BOOL(QueryServ, PlayerLogConnectDisconnect, false, "Logs player connect/disconnect state")
|
||||
@@ -681,9 +726,11 @@ RULE_BOOL(QueryServ, PlayerLogLevels, false, "Log player leveling/deleveling")
|
||||
RULE_BOOL(QueryServ, PlayerLogAARate, false, "Log player AA experience rates")
|
||||
RULE_BOOL(QueryServ, PlayerLogQGlobalUpdate, false, "Log player QGlobal updates")
|
||||
RULE_BOOL(QueryServ, PlayerLogTaskUpdates, false, "Log player Task updates")
|
||||
RULE_BOOL(QueryServ, PlayerLogKeyringAddition, false, "Log player keyring additions")
|
||||
RULE_BOOL(QueryServ, PlayerLogAAPurchases, false, "Log player AA purchases")
|
||||
RULE_BOOL(QueryServ, PlayerLogTradeSkillEvents, false, "Log player tradeskill transactions")
|
||||
RULE_BOOL(QueryServ, PlayerLogIssuedCommandes, false, "Log player issued commands")
|
||||
RULE_BOOL(QueryServ, PlayerLogMoneyTransactions, false, "Log player money transaction/splits")
|
||||
RULE_BOOL(QueryServ, PlayerLogAlternateCurrencyTransactions, false, "Log player alternate currency transactions")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
@@ -741,17 +788,16 @@ RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Expedition)
|
||||
RULE_INT(Expedition, MinStatusToBypassPlayerCountRequirements, 80, "Minimum GM status to bypass minimum player requirements for Expedition creation")
|
||||
RULE_BOOL(Expedition, EmptyDzShutdownEnabled, true, "Enable early instance shutdown after last member of expedition removed")
|
||||
RULE_INT(Expedition, EmptyDzShutdownDelaySeconds, 1500, "Seconds to set dynamic zone instance expiration if early shutdown enabled")
|
||||
RULE_INT(Expedition, WorldExpeditionProcessRateMS, 6000, "Timer interval (ms) that world checks expedition states")
|
||||
RULE_BOOL(Expedition, AlwaysNotifyNewLeaderOnChange, false, "Always notify clients when made expedition leader. If false (live-like) new leaders are only notified when made leader via /dzmakeleader")
|
||||
RULE_REAL(Expedition, LockoutDurationMultiplier, 1.0, "Multiplies lockout duration by this value when new lockouts are added")
|
||||
RULE_INT(Expedition, ChooseLeaderCooldownTime, 2000, "Cooldown time (milliseconds) between choosing a new leader for automatic leader changes")
|
||||
RULE_BOOL(Expedition, EnableInDynamicZoneStatus, false, "Enables the 'In Dynamic Zone' member status in expedition window. If false (live-like) players inside the dz will show as 'Online'")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(DynamicZone)
|
||||
RULE_INT(DynamicZone, ClientRemovalDelayMS, 60000, "Delay (milliseconds) until a client is teleported out of dynamic zone after being removed as member")
|
||||
RULE_BOOL(DynamicZone, EmptyShutdownEnabled, true, "Enable early instance shutdown for dynamic zones that have no members")
|
||||
RULE_INT(DynamicZone, EmptyShutdownDelaySeconds, 1500, "Seconds to set dynamic zone instance expiration if early shutdown enabled")
|
||||
RULE_BOOL(DynamicZone, EnableInDynamicZoneStatus, false, "Enables the 'In Dynamic Zone' member status in dynamic zone window. If false (live-like) players inside the dynamic zone will show as 'Online'")
|
||||
RULE_INT(DynamicZone, WorldProcessRate, 6000, "Timer interval (milliseconds) that systems check their dynamic zone states")
|
||||
RULE_INT(DynamicZone, ClientRemovalDelayMS, 60000, "Delay (ms) until a client is teleported out of dynamic zone after being removed as member")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
#undef RULE_CATEGORY
|
||||
|
||||
@@ -1,247 +0,0 @@
|
||||
#include "../common/database.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "server_event_scheduler.h"
|
||||
#include "../common/cron/croncpp.h"
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
|
||||
ServerEventScheduler::ServerEventScheduler()
|
||||
{
|
||||
m_last_polled_minute = -1;
|
||||
m_events = {};
|
||||
m_active_events = {};
|
||||
}
|
||||
|
||||
ServerEventScheduler::~ServerEventScheduler() = default;
|
||||
|
||||
void ServerEventScheduler::LoadScheduledEvents()
|
||||
{
|
||||
if (!ValidateDatabaseConnection()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::time_t time = std::time(nullptr);
|
||||
std::tm *now = std::localtime(&time);
|
||||
|
||||
m_events = ServerScheduledEventsRepository::GetWhere(*m_database, "deleted_at is null");
|
||||
for (auto &e: m_events) {
|
||||
|
||||
auto start = BuildStartTimeFromEvent(e, now);
|
||||
auto end = BuildEndTimeFromEvent(e, now);
|
||||
|
||||
// data excluded from output because it can be very large
|
||||
|
||||
LogScheduler(
|
||||
"Loaded Event ({}) [{}] type [{}] start [{}/{}/{} {:02}:{:02}:00] end [{}/{}/{} {:02}:{:02}:00] cron [{}] created [{}]",
|
||||
e.id,
|
||||
e.description,
|
||||
e.event_type,
|
||||
start.tm_mon + 1,
|
||||
start.tm_mday,
|
||||
start.tm_year + 1900,
|
||||
start.tm_hour,
|
||||
start.tm_min,
|
||||
end.tm_mon + 1,
|
||||
end.tm_mday,
|
||||
end.tm_year + 1900,
|
||||
end.tm_hour,
|
||||
end.tm_min,
|
||||
e.cron_expression,
|
||||
e.created_at
|
||||
);
|
||||
}
|
||||
|
||||
LogScheduler("Loaded scheduled events [{}]", m_events.size());
|
||||
}
|
||||
|
||||
// checks to see if event is ready to be activated
|
||||
bool ServerEventScheduler::ValidateEventReadyToActivate(
|
||||
ServerScheduledEventsRepository::ServerScheduledEvents &e
|
||||
)
|
||||
{
|
||||
|
||||
// if there is a cron expression, it will try to parse it first before falling back to
|
||||
// alternative time logic
|
||||
if (!e.cron_expression.empty()) {
|
||||
try {
|
||||
auto cron = cron::make_cron<cron::cron_standard_traits>(e.cron_expression);
|
||||
std::time_t cron_now = std::time(nullptr);
|
||||
std::time_t cron_next = cron::cron_next(cron, cron_now);
|
||||
|
||||
// we have to pad our now window just a tad so we don't miss the cron window
|
||||
if ((cron_now + 10) >= cron_next) {
|
||||
LogScheduler("Cron time has been met! Event scheduling ({}) [{}]", e.id, e.description);
|
||||
return true;
|
||||
}
|
||||
|
||||
LogSchedulerDetail("Cron now [{}] cron next [{}]\n", cron_now, cron_next);
|
||||
}
|
||||
catch (cron::bad_cronexpr const &ex) {
|
||||
LogScheduler(
|
||||
"Error: Cron expression error [{}] see [https://github.com/mariusbancila/croncpp#cron-expressions]",
|
||||
ex.what()
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::time_t time = std::time(nullptr);
|
||||
std::tm *now = std::localtime(&time);
|
||||
time_t now_time_unix = mktime(now);
|
||||
auto start = BuildStartTimeFromEvent(e, now);
|
||||
auto end = BuildEndTimeFromEvent(e, now);
|
||||
time_t start_time_unix = mktime(&start);
|
||||
|
||||
bool doesnt_end = (
|
||||
e.year_end == 0 &&
|
||||
e.month_end == 0 &&
|
||||
e.day_end == 0 &&
|
||||
e.hour_end == 0 &&
|
||||
e.minute_end == 0
|
||||
);
|
||||
|
||||
time_t end_time_unix;
|
||||
if (!doesnt_end) {
|
||||
end_time_unix = mktime(&end);
|
||||
}
|
||||
|
||||
if (now_time_unix >= start_time_unix && (doesnt_end || now_time_unix < end_time_unix)) {
|
||||
LogSchedulerDetail(
|
||||
"[ValidateEventReadyToActivate] now_time [{}] start_time [{}] doesnt_end [{}] end_time [{}]",
|
||||
now_time_unix,
|
||||
start_time_unix,
|
||||
doesnt_end ? "true" : "false",
|
||||
end_time_unix
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ServerEventScheduler *ServerEventScheduler::SetDatabase(Database *db)
|
||||
{
|
||||
m_database = db;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
bool ServerEventScheduler::ValidateDatabaseConnection()
|
||||
{
|
||||
if (!m_database) {
|
||||
LogError("[ServerEventScheduler::LoadScheduledEvents] No database connection");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// in this function we simply look at events we have internally and events
|
||||
// in the database and determine if any edits have been made
|
||||
// this helps inform decisions to tell all zones to reload their events
|
||||
bool ServerEventScheduler::CheckIfEventsChanged()
|
||||
{
|
||||
auto events = ServerScheduledEventsRepository::GetWhere(*m_database, "deleted_at is null");
|
||||
|
||||
// first check if the size changed, if it did this is the easiest step
|
||||
if (m_events.size() != events.size()) {
|
||||
LogSchedulerDetail("[CheckIfEventsChanged] Event size has changed");
|
||||
m_events = events;
|
||||
return true;
|
||||
}
|
||||
|
||||
// compare fields of database fields to internal events to see if any fields changed
|
||||
for (auto &e: m_events) {
|
||||
for (auto &dbe: events) {
|
||||
if (dbe.id == e.id) {
|
||||
if (
|
||||
dbe.description != e.description ||
|
||||
dbe.event_type != e.event_type ||
|
||||
dbe.event_data != e.event_data ||
|
||||
dbe.minute_start != e.minute_start ||
|
||||
dbe.hour_start != e.hour_start ||
|
||||
dbe.day_start != e.day_start ||
|
||||
dbe.month_start != e.month_start ||
|
||||
dbe.year_start != e.year_start ||
|
||||
dbe.minute_end != e.minute_end ||
|
||||
dbe.hour_end != e.hour_end ||
|
||||
dbe.day_end != e.day_end ||
|
||||
dbe.month_end != e.month_end ||
|
||||
dbe.year_end != e.year_end ||
|
||||
dbe.cron_expression != e.cron_expression ||
|
||||
dbe.created_at != e.created_at ||
|
||||
dbe.deleted_at != e.deleted_at
|
||||
) {
|
||||
LogSchedulerDetail("[CheckIfEventsChanged] Field change detected");
|
||||
m_events = events;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// checks if event is active
|
||||
bool ServerEventScheduler::IsEventActive(ServerScheduledEventsRepository::ServerScheduledEvents &e)
|
||||
{
|
||||
for (auto &a: m_active_events) {
|
||||
if (a.id == e.id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ServerEventScheduler::RemoveActiveEvent(ServerScheduledEventsRepository::ServerScheduledEvents &e)
|
||||
{
|
||||
m_active_events.erase(
|
||||
std::remove_if(
|
||||
m_active_events.begin(),
|
||||
m_active_events.end(),
|
||||
[&](ServerScheduledEventsRepository::ServerScheduledEvents const &active_event) {
|
||||
return active_event.id == e.id;
|
||||
}
|
||||
),
|
||||
m_active_events.end());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::tm ServerEventScheduler::BuildStartTimeFromEvent(
|
||||
ServerScheduledEventsRepository::ServerScheduledEvents &e,
|
||||
std::tm *now
|
||||
)
|
||||
{
|
||||
struct tm time{};
|
||||
time.tm_year = ((e.year_start > 0) ? e.year_start - 1900 : now->tm_year);
|
||||
time.tm_mon = ((e.month_start > 0) ? e.month_start - 1 : now->tm_mon);
|
||||
time.tm_mday = ((e.day_start > 0) ? e.day_start : now->tm_mday);
|
||||
time.tm_hour = ((e.hour_start > 0) ? e.hour_start : now->tm_hour);
|
||||
time.tm_min = ((e.minute_start > 0) ? e.minute_start : now->tm_min);
|
||||
time.tm_sec = 0;
|
||||
time.tm_isdst = now->tm_isdst;
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
std::tm ServerEventScheduler::BuildEndTimeFromEvent(
|
||||
ServerScheduledEventsRepository::ServerScheduledEvents &e,
|
||||
std::tm *now
|
||||
)
|
||||
{
|
||||
struct tm time{};
|
||||
time.tm_year = ((e.year_end > 0) ? e.year_end - 1900 : now->tm_year);
|
||||
time.tm_mon = ((e.month_end > 0) ? e.month_end - 1 : now->tm_mon);
|
||||
time.tm_mday = ((e.day_end > 0) ? e.day_end : now->tm_mday);
|
||||
time.tm_hour = ((e.hour_end > 0) ? e.hour_end : now->tm_hour);
|
||||
time.tm_min = ((e.minute_end > 0) ? e.minute_end : now->tm_min);
|
||||
time.tm_sec = 0;
|
||||
time.tm_isdst = now->tm_isdst;
|
||||
|
||||
return time;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
#ifndef EQEMU_SERVER_EVENT_SCHEDULER_H
|
||||
#define EQEMU_SERVER_EVENT_SCHEDULER_H
|
||||
|
||||
#include "../common/repositories/server_scheduled_events_repository.h"
|
||||
#include <time.h>
|
||||
#include <chrono>
|
||||
|
||||
namespace ServerEvents {
|
||||
static const std::string EVENT_TYPE_HOT_ZONE_ACTIVE = "hot_zone_activate";
|
||||
static const std::string EVENT_TYPE_BROADCAST = "broadcast";
|
||||
static const std::string EVENT_TYPE_RELOAD_WORLD = "reload_world";
|
||||
static const std::string EVENT_TYPE_RULE_CHANGE = "rule_change";
|
||||
static const std::string EVENT_TYPE_CONTENT_FLAG_CHANGE = "content_flag_change";
|
||||
}
|
||||
|
||||
class ServerEventScheduler {
|
||||
public:
|
||||
virtual ~ServerEventScheduler();
|
||||
ServerEventScheduler();
|
||||
ServerEventScheduler *SetDatabase(Database *db);
|
||||
void LoadScheduledEvents();
|
||||
bool CheckIfEventsChanged();
|
||||
|
||||
protected:
|
||||
|
||||
// events directly from the database
|
||||
std::vector<ServerScheduledEventsRepository::ServerScheduledEvents> m_events;
|
||||
|
||||
// used to track only when it is convenient to undo an action from an active event
|
||||
// typically there should be two separate events to turn something on / off
|
||||
// hotzones use this right now simply to keep us from toggling off the hotzone
|
||||
// every minute we trigger and then immediately turning it right back on
|
||||
std::vector<ServerScheduledEventsRepository::ServerScheduledEvents> m_active_events;
|
||||
|
||||
// simple ticker used to determine when the last polled minute was so that when the minute
|
||||
// changes we fire checking the scheduler
|
||||
int m_last_polled_minute;
|
||||
|
||||
// validates an event is currently active or not
|
||||
bool ValidateEventReadyToActivate(ServerScheduledEventsRepository::ServerScheduledEvents &e);
|
||||
|
||||
// is event active
|
||||
bool IsEventActive(ServerScheduledEventsRepository::ServerScheduledEvents &e);
|
||||
|
||||
// remove active event
|
||||
bool RemoveActiveEvent(ServerScheduledEventsRepository::ServerScheduledEvents &e);
|
||||
|
||||
// build time object from event
|
||||
std::tm BuildStartTimeFromEvent(ServerScheduledEventsRepository::ServerScheduledEvents &e, tm *now);
|
||||
std::tm BuildEndTimeFromEvent(ServerScheduledEventsRepository::ServerScheduledEvents &e, tm *now);
|
||||
|
||||
// reference to database
|
||||
Database *m_database;
|
||||
bool ValidateDatabaseConnection();
|
||||
};
|
||||
|
||||
#endif //EQEMU_SERVER_EVENT_SCHEDULER_H
|
||||
+43
-47
@@ -80,6 +80,7 @@
|
||||
#define ServerOP_UpdateSpawn 0x003f
|
||||
#define ServerOP_SpawnStatusChange 0x0040
|
||||
#define ServerOP_DropClient 0x0041 // DropClient
|
||||
#define ServerOP_ChangeGroupLeader 0x0042
|
||||
#define ServerOP_ReloadTasks 0x0060
|
||||
#define ServerOP_DepopAllPlayersCorpses 0x0061
|
||||
#define ServerOP_ReloadTitles 0x0062
|
||||
@@ -148,25 +149,26 @@
|
||||
#define ServerOP_ExpeditionMemberChange 0x0404
|
||||
#define ServerOP_ExpeditionMemberSwap 0x0405
|
||||
#define ServerOP_ExpeditionMemberStatus 0x0406
|
||||
#define ServerOP_ExpeditionGetMemberStatuses 0x0407
|
||||
#define ServerOP_ExpeditionGetOnlineMembers 0x0407
|
||||
#define ServerOP_ExpeditionDzAddPlayer 0x0408
|
||||
#define ServerOP_ExpeditionDzMakeLeader 0x0409
|
||||
#define ServerOP_ExpeditionDzCompass 0x040a
|
||||
#define ServerOP_ExpeditionDzSafeReturn 0x040b
|
||||
#define ServerOP_ExpeditionDzZoneIn 0x040c
|
||||
#define ServerOP_ExpeditionCharacterLockout 0x040d
|
||||
#define ServerOP_ExpeditionSaveInvite 0x040e
|
||||
#define ServerOP_ExpeditionRequestInvite 0x040f
|
||||
#define ServerOP_ExpeditionReplayOnJoin 0x0410
|
||||
#define ServerOP_ExpeditionLockState 0x0411
|
||||
#define ServerOP_ExpeditionMembersRemoved 0x0412
|
||||
#define ServerOP_ExpeditionDzDuration 0x0413
|
||||
#define ServerOP_ExpeditionLockoutDuration 0x0414
|
||||
#define ServerOP_ExpeditionSecondsRemaining 0x0415
|
||||
#define ServerOP_ExpeditionExpireWarning 0x0416
|
||||
#define ServerOP_ExpeditionChooseNewLeader 0x0417
|
||||
|
||||
#define ServerOP_DzAddRemoveCharacter 0x0450
|
||||
#define ServerOP_DzCharacterChange 0x0450
|
||||
#define ServerOP_DzRemoveAllCharacters 0x0451
|
||||
#define ServerOP_DzSetSecondsRemaining 0x0452
|
||||
#define ServerOP_DzDurationUpdate 0x0453
|
||||
#define ServerOP_DzSetCompass 0x0454
|
||||
#define ServerOP_DzSetSafeReturn 0x0455
|
||||
#define ServerOP_DzSetZoneIn 0x0456
|
||||
|
||||
#define ServerOP_LSInfo 0x1000
|
||||
#define ServerOP_LSStatus 0x1001
|
||||
@@ -221,7 +223,6 @@
|
||||
#define ServerOP_UCSServerStatusRequest 0x4009
|
||||
#define ServerOP_UCSServerStatusReply 0x4010
|
||||
#define ServerOP_HotReloadQuests 0x4011
|
||||
#define ServerOP_UpdateSchedulerEvents 0x4012
|
||||
|
||||
#define ServerOP_CZCastSpellPlayer 0x4500
|
||||
#define ServerOP_CZCastSpellGroup 0x4501
|
||||
@@ -287,7 +288,6 @@
|
||||
#define ServerOP_CZTaskRemoveRaid 0x4561
|
||||
#define ServerOP_CZTaskRemoveGuild 0x4562
|
||||
#define ServerOP_CZClientMessageString 0x4563
|
||||
#define ServerOP_CZLDoNUpdate 0x4564
|
||||
|
||||
#define ServerOP_WWAssignTask 0x4750
|
||||
#define ServerOP_WWCastSpell 0x4751
|
||||
@@ -320,24 +320,8 @@
|
||||
#define ServerOP_QSSendQuery 0x5006
|
||||
#define ServerOP_QSPlayerDropItem 0x5007
|
||||
|
||||
enum {
|
||||
CZLDoNUpdateType_Character = 0,
|
||||
CZLDoNUpdateType_Group,
|
||||
CZLDoNUpdateType_Raid,
|
||||
CZLDoNUpdateType_Guild,
|
||||
CZLDoNUpdateType_Expedition
|
||||
};
|
||||
|
||||
enum {
|
||||
CZLDoNUpdateSubtype_WinAdd = 0,
|
||||
CZLDoNUpdateSubtype_WinRemove,
|
||||
CZLDoNUpdateSubtype_LossAdd,
|
||||
CZLDoNUpdateSubtype_LossRemove,
|
||||
CZLDoNUpdateSubtype_Points
|
||||
};
|
||||
|
||||
/* Query Serv Generic Packet Flag/Type Enumeration */
|
||||
enum { QSG_LFGuild = 0 };
|
||||
enum { QSG_LFGuild = 0 };
|
||||
enum { QSG_LFGuild_PlayerMatches = 0, QSG_LFGuild_UpdatePlayerInfo, QSG_LFGuild_RequestPlayerInfo, QSG_LFGuild_UpdateGuildInfo, QSG_LFGuild_GuildMatches,
|
||||
QSG_LFGuild_RequestGuildInfo };
|
||||
|
||||
@@ -878,6 +862,7 @@ struct ServerGroupLeave_Struct {
|
||||
uint16 instance_id;
|
||||
uint32 gid;
|
||||
char member_name[64]; //kick this member from the group
|
||||
bool checkleader;
|
||||
};
|
||||
|
||||
struct ServerGroupJoin_Struct {
|
||||
@@ -887,10 +872,20 @@ struct ServerGroupJoin_Struct {
|
||||
char member_name[64]; //this person is joining the group
|
||||
};
|
||||
|
||||
struct ServerGroupLeader_Struct {
|
||||
uint32 zoneid;
|
||||
uint16 instance_id;
|
||||
uint32 gid;
|
||||
char leader_name[64];
|
||||
char oldleader_name[64];
|
||||
};
|
||||
|
||||
struct ServerForceGroupUpdate_Struct {
|
||||
uint32 origZoneID;
|
||||
uint16 instance_id;
|
||||
uint32 gid;
|
||||
char leader_name[64];
|
||||
char oldleader_name[64];
|
||||
};
|
||||
|
||||
struct ServerGroupChannelMessage_Struct {
|
||||
@@ -1167,6 +1162,7 @@ struct ServerAdventureRequestAccept_Struct
|
||||
uint32 theme;
|
||||
uint32 id;
|
||||
uint32 member_count;
|
||||
uint32 average_level;
|
||||
};
|
||||
|
||||
struct ServerAdventureRequestCreate_Struct
|
||||
@@ -1175,6 +1171,7 @@ struct ServerAdventureRequestCreate_Struct
|
||||
uint32 theme;
|
||||
uint32 id;
|
||||
uint32 member_count;
|
||||
uint32 average_level;
|
||||
};
|
||||
|
||||
struct ServerSendAdventureData_Struct
|
||||
@@ -1246,6 +1243,7 @@ struct ServerZoneAdventureDataReply_Struct
|
||||
int dest_y;
|
||||
int dest_z;
|
||||
int dest_h;
|
||||
int average_level;
|
||||
};
|
||||
|
||||
struct ServerAdventureFinish_Struct
|
||||
@@ -1879,14 +1877,6 @@ struct CZTaskRemoveGuild_Struct {
|
||||
uint32 task_id;
|
||||
};
|
||||
|
||||
struct CZLDoNUpdate_Struct {
|
||||
uint8 update_type; // 0 - Character, 1 - Group, 2 - Raid, 3 - Guild, 4 - Expedition
|
||||
uint8 update_subtype; // 0 - Win, 1 - Loss, 2 - Points
|
||||
int update_identifier; // Character ID, Group ID, Raid ID, Guild ID, or Expedition ID based on update type
|
||||
uint32 theme_id;
|
||||
int points; // Always 1, except for when Points are used
|
||||
};
|
||||
|
||||
struct WWAssignTask_Struct {
|
||||
uint16 npc_entity_id;
|
||||
uint32 task_id;
|
||||
@@ -1958,7 +1948,7 @@ struct WWRemoveTask_Struct {
|
||||
uint32 task_id;
|
||||
uint8 min_status;
|
||||
uint8 max_status;
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct WWResetActivity_Struct {
|
||||
@@ -2059,15 +2049,19 @@ struct ServerExpeditionMemberStatus_Struct {
|
||||
uint32 character_id;
|
||||
};
|
||||
|
||||
struct ServerExpeditionMemberStatusEntry_Struct {
|
||||
struct ServerExpeditionCharacterEntry_Struct {
|
||||
uint32 expedition_id;
|
||||
uint32 character_id;
|
||||
uint8 online_status; // 0: unknown 1: Online 2: Offline 3: In Dynamic Zone 4: Link Dead
|
||||
uint32 character_zone_id;
|
||||
uint16 character_instance_id;
|
||||
uint8 character_online; // 0: offline 1: online
|
||||
};
|
||||
|
||||
struct ServerExpeditionMemberStatuses_Struct {
|
||||
uint32 expedition_id;
|
||||
struct ServerExpeditionCharacters_Struct {
|
||||
uint32 sender_zone_id;
|
||||
uint16 sender_instance_id;
|
||||
uint32 count;
|
||||
ServerExpeditionMemberStatusEntry_Struct entries[0];
|
||||
ServerExpeditionCharacterEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct ServerExpeditionLockout_Struct {
|
||||
@@ -2111,6 +2105,11 @@ struct ServerExpeditionCharacterID_Struct {
|
||||
uint32_t character_id;
|
||||
};
|
||||
|
||||
struct ServerExpeditionUpdateDuration_Struct {
|
||||
uint32_t expedition_id;
|
||||
uint32_t new_duration_seconds;
|
||||
};
|
||||
|
||||
struct ServerExpeditionExpireWarning_Struct {
|
||||
uint32_t expedition_id;
|
||||
uint32_t minutes_remaining;
|
||||
@@ -2133,10 +2132,12 @@ struct ServerDzCommandMakeLeader_Struct {
|
||||
};
|
||||
|
||||
struct ServerDzLocation_Struct {
|
||||
uint32 dz_id;
|
||||
uint32 owner_id; // system associated with the dz (expedition, shared task, etc)
|
||||
uint16 dz_zone_id;
|
||||
uint16 dz_instance_id;
|
||||
uint32 sender_zone_id;
|
||||
uint16 sender_instance_id;
|
||||
uint32 zone_id;
|
||||
uint32 zone_id; // compass or safereturn zone id
|
||||
float y;
|
||||
float x;
|
||||
float z;
|
||||
@@ -2150,11 +2151,6 @@ struct ServerDzCharacter_Struct {
|
||||
uint32 character_id;
|
||||
};
|
||||
|
||||
struct ServerDzSetDuration_Struct {
|
||||
uint32 dz_id;
|
||||
uint32 seconds;
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
||||
|
||||
+13
-13
@@ -928,8 +928,8 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
|
||||
mutex.Lock();
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("items");
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
items_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
items_hash = std::make_unique<EQ::FixedMemoryHashSet<EQ::ItemData>>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size());
|
||||
items_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
items_hash = std::unique_ptr<EQ::FixedMemoryHashSet<EQ::ItemData>>(new EQ::FixedMemoryHashSet<EQ::ItemData>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
LogError("Error Loading Items: {}", ex.what());
|
||||
@@ -1353,8 +1353,8 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
|
||||
mutex.Lock();
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("faction");
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
faction_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
faction_hash = std::make_unique<EQ::FixedMemoryHashSet<NPCFactionList>>(reinterpret_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size());
|
||||
faction_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
faction_hash = std::unique_ptr<EQ::FixedMemoryHashSet<NPCFactionList>>(new EQ::FixedMemoryHashSet<NPCFactionList>(reinterpret_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size()));
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
LogError("Error Loading npc factions: {}", ex.what());
|
||||
@@ -1555,7 +1555,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) {
|
||||
mutex.Lock();
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("skill_caps");
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
skill_caps_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
skill_caps_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
mutex.Unlock();
|
||||
} catch(std::exception &ex) {
|
||||
LogError("Error loading skill caps: {}", ex.what());
|
||||
@@ -1712,7 +1712,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
|
||||
mutex.Lock();
|
||||
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("spells");
|
||||
spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
spells_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
*records = *reinterpret_cast<uint32*>(spells_mmf->Get());
|
||||
*sp = reinterpret_cast<const SPDat_Spell_Struct*>((char*)spells_mmf->Get() + 4);
|
||||
@@ -1920,7 +1920,7 @@ bool SharedDatabase::LoadBaseData(const std::string &prefix) {
|
||||
mutex.Lock();
|
||||
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("base_data");
|
||||
base_data_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
base_data_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
LogError("Error Loading Base Data: {}", ex.what());
|
||||
@@ -2223,15 +2223,15 @@ bool SharedDatabase::LoadLoot(const std::string &prefix) {
|
||||
EQ::IPCMutex mutex("loot");
|
||||
mutex.Lock();
|
||||
std::string file_name_lt = Config->SharedMemDir + prefix + std::string("loot_table");
|
||||
loot_table_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name_lt);
|
||||
loot_table_hash = std::make_unique<EQ::FixedMemoryVariableHashSet<LootTable_Struct>>(
|
||||
loot_table_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name_lt));
|
||||
loot_table_hash = std::unique_ptr<EQ::FixedMemoryVariableHashSet<LootTable_Struct>>(new EQ::FixedMemoryVariableHashSet<LootTable_Struct>(
|
||||
reinterpret_cast<uint8*>(loot_table_mmf->Get()),
|
||||
loot_table_mmf->Size());
|
||||
loot_table_mmf->Size()));
|
||||
std::string file_name_ld = Config->SharedMemDir + prefix + std::string("loot_drop");
|
||||
loot_drop_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name_ld);
|
||||
loot_drop_hash = std::make_unique<EQ::FixedMemoryVariableHashSet<LootDrop_Struct>>(
|
||||
loot_drop_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name_ld));
|
||||
loot_drop_hash = std::unique_ptr<EQ::FixedMemoryVariableHashSet<LootDrop_Struct>>(new EQ::FixedMemoryVariableHashSet<LootDrop_Struct>(
|
||||
reinterpret_cast<uint8*>(loot_drop_mmf->Get()),
|
||||
loot_drop_mmf->Size());
|
||||
loot_drop_mmf->Size()));
|
||||
mutex.Unlock();
|
||||
} catch(std::exception &ex) {
|
||||
LogError("Error loading loot: {}", ex.what());
|
||||
|
||||
+68
-24
@@ -74,6 +74,18 @@ const std::string str_tolower(std::string s)
|
||||
return s;
|
||||
}
|
||||
|
||||
std::vector<std::string> split(std::string str_to_split, char delimiter)
|
||||
{
|
||||
std::stringstream ss(str_to_split);
|
||||
std::string item;
|
||||
std::vector<std::string> exploded_values;
|
||||
while (std::getline(ss, item, delimiter)) {
|
||||
exploded_values.push_back(item);
|
||||
}
|
||||
|
||||
return exploded_values;
|
||||
}
|
||||
|
||||
const std::string str_toupper(std::string s)
|
||||
{
|
||||
std::transform(
|
||||
@@ -101,32 +113,16 @@ const std::string StringFormat(const char *format, ...)
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<std::string> SplitString(const std::string &str, const char delim) {
|
||||
std::vector<std::string> SplitString(const std::string &str, char delim) {
|
||||
std::vector<std::string> ret;
|
||||
std::string::size_type start = 0;
|
||||
auto end = str.find(delim);
|
||||
while (end != std::string::npos) {
|
||||
ret.emplace_back(str, start, end - start);
|
||||
start = end + 1;
|
||||
end = str.find(delim, start);
|
||||
}
|
||||
// this will catch the last word since the string is unlikely to end with a delimiter
|
||||
if (str.length() > start)
|
||||
ret.emplace_back(str, start, str.length() - start);
|
||||
return ret;
|
||||
}
|
||||
std::stringstream ss(str);
|
||||
std::string item;
|
||||
|
||||
std::string::size_type search_deliminated_string(const std::string &haystack, const std::string &needle, const char deliminator)
|
||||
{
|
||||
// this shouldn't go out of bounds, even without obvious bounds checks
|
||||
auto pos = haystack.find(needle);
|
||||
while (pos != std::string::npos) {
|
||||
auto c = haystack[pos + needle.length()];
|
||||
if ((c == '\0' || c == deliminator) && (pos == 0 || haystack[pos - 1] == deliminator))
|
||||
return pos;
|
||||
pos = haystack.find(needle, pos + needle.length());
|
||||
}
|
||||
return std::string::npos;
|
||||
while(std::getline(ss, item, delim)) {
|
||||
ret.push_back(item);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string implode(std::string glue, std::vector<std::string> src)
|
||||
@@ -346,6 +342,54 @@ void MakeLowerString(const char *source, char *target) {
|
||||
*target = 0;
|
||||
}
|
||||
|
||||
int MakeAnyLenString(char** ret, const char* format, ...) {
|
||||
int buf_len = 128;
|
||||
int chars = -1;
|
||||
va_list argptr, tmpargptr;
|
||||
va_start(argptr, format);
|
||||
while (chars == -1 || chars >= buf_len) {
|
||||
safe_delete_array(*ret);
|
||||
if (chars == -1)
|
||||
buf_len *= 2;
|
||||
else
|
||||
buf_len = chars + 1;
|
||||
*ret = new char[buf_len];
|
||||
va_copy(tmpargptr, argptr);
|
||||
chars = vsnprintf(*ret, buf_len, format, tmpargptr);
|
||||
}
|
||||
va_end(argptr);
|
||||
return chars;
|
||||
}
|
||||
|
||||
uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...) {
|
||||
if (*bufsize == 0)
|
||||
*bufsize = 256;
|
||||
if (*ret == 0)
|
||||
*strlen = 0;
|
||||
int chars = -1;
|
||||
char* oldret = 0;
|
||||
va_list argptr, tmpargptr;
|
||||
va_start(argptr, format);
|
||||
while (chars == -1 || chars >= (int32)(*bufsize - *strlen)) {
|
||||
if (chars == -1)
|
||||
*bufsize += 256;
|
||||
else
|
||||
*bufsize += chars + 25;
|
||||
oldret = *ret;
|
||||
*ret = new char[*bufsize];
|
||||
if (oldret) {
|
||||
if (*strlen)
|
||||
memcpy(*ret, oldret, *strlen);
|
||||
safe_delete_array(oldret);
|
||||
}
|
||||
va_copy(tmpargptr, argptr);
|
||||
chars = vsnprintf(&(*ret)[*strlen], (*bufsize - *strlen), format, tmpargptr);
|
||||
}
|
||||
va_end(argptr);
|
||||
*strlen += chars;
|
||||
return *strlen;
|
||||
}
|
||||
|
||||
uint32 hextoi(const char* num) {
|
||||
if (num == nullptr)
|
||||
return 0;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
const std::string str_tolower(std::string s);
|
||||
const std::string str_toupper(std::string s);
|
||||
const std::string ucfirst(std::string s);
|
||||
std::vector<std::string> split(std::string str_to_split, char delimiter);
|
||||
const std::string StringFormat(const char* format, ...);
|
||||
const std::string vStringFormat(const char* format, va_list args);
|
||||
std::vector<std::string> wrap(std::vector<std::string> &src, std::string character);
|
||||
@@ -176,8 +177,7 @@ std::vector<std::string> join_tuple(const std::string &glue, const std::pair<cha
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<std::string> SplitString(const std::string &s, const char delim = ',');
|
||||
std::string::size_type search_deliminated_string(const std::string &haystack, const std::string &needle, const char deliminator = ',');
|
||||
std::vector<std::string> SplitString(const std::string &s, char delim);
|
||||
std::string EscapeString(const char *src, size_t sz);
|
||||
std::string EscapeString(const std::string &s);
|
||||
bool StringIsNumber(const std::string &s);
|
||||
@@ -198,6 +198,8 @@ char* strn0cpy(char* dest, const char* source, uint32 size);
|
||||
const char *ConvertArray(int input, char *returnchar);
|
||||
const char *ConvertArrayF(float input, char *returnchar);
|
||||
const char *MakeLowerString(const char *source);
|
||||
int MakeAnyLenString(char** ret, const char* format, ...);
|
||||
uint32 AppendAnyLenString(char** ret, uint32* bufsize, uint32* strlen, const char* format, ...);
|
||||
uint32 hextoi(const char* num);
|
||||
uint64 hextoi64(const char* num);
|
||||
void MakeLowerString(const char *source, char *target);
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9166
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9159
|
||||
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9027
|
||||
|
||||
@@ -29,7 +29,7 @@ WorldServer::WorldServer(std::map<std::string, ZoneLaunch *> &zones, const char
|
||||
m_config(config),
|
||||
m_zones(zones)
|
||||
{
|
||||
m_connection = std::make_unique<EQ::Net::ServertalkClient>(config->WorldIP, config->WorldTCPPort, false, "Launcher", config->SharedKey);
|
||||
m_connection.reset(new EQ::Net::ServertalkClient(config->WorldIP, config->WorldTCPPort, false, "Launcher", config->SharedKey));
|
||||
m_connection->OnConnect([this](EQ::Net::ServertalkClient *client) {
|
||||
OnConnected();
|
||||
});
|
||||
@@ -138,4 +138,4 @@ void WorldServer::SendStatus(const char *short_name, uint32 start_count, bool ru
|
||||
|
||||
m_connection->SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
name: CI Static Analysis
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
GCC-10:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Install packages (Ubuntu)
|
||||
run: |
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-10
|
||||
- name: Generate project files
|
||||
run: |
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=OFF -DWITH_CODE_COVERAGE=OFF -DWITH_MAINTAINER_WARNINGS=OFF
|
||||
env:
|
||||
CC: gcc-10
|
||||
CFLAGS: "-fanalyzer -Werror -Wanalyzer-double-fclose -Wanalyzer-double-free -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak -Wanalyzer-null-argument -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument -Wanalyzer-possible-null-dereference -Wanalyzer-stale-setjmp-buffer -Wanalyzer-tainted-array-index -Wanalyzer-unsafe-call-within-signal-handler -Wanalyzer-use-after-free -Wanalyzer-use-of-pointer-in-stale-stack-frame"
|
||||
CI: true
|
||||
- name: Compile source code
|
||||
run: |
|
||||
cmake --build . --config Release > /dev/null
|
||||
Clang-12:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Install packages (Ubuntu)
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
||||
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" -y
|
||||
sudo apt install clang-tools-12 -y
|
||||
- name: Generate project files
|
||||
run: |
|
||||
scan-build-12 --status-bugs cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=OFF -DWITH_CODE_COVERAGE=OFF -DWITH_MAINTAINER_WARNINGS=OFF
|
||||
env:
|
||||
CI: true
|
||||
- name: Compile source code
|
||||
run: |
|
||||
scan-build-12 --status-bugs cmake --build . --config Release > /dev/null
|
||||
-381
@@ -1,381 +0,0 @@
|
||||
name: CI CMake
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ci-cmake:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Ubuntu GCC
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_SANITIZER=Address
|
||||
codecov: ubuntu_gcc
|
||||
|
||||
- name: Ubuntu GCC OSB -O1 No Unaligned64
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_UNALIGNED=ON -DUNALIGNED64_OK=OFF -DWITH_SANITIZER=Undefined
|
||||
build-dir: ../build
|
||||
build-src-dir: ../zlib-ng
|
||||
codecov: ubuntu_gcc_osb
|
||||
cflags: -O1 -g3
|
||||
|
||||
- name: Ubuntu GCC -O3 No Unaligned
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_UNALIGNED=OFF
|
||||
codecov: ubuntu_gcc_o3
|
||||
cflags: -O3
|
||||
|
||||
- name: Ubuntu GCC Link Zlib
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DZLIB_DUAL_LINK=ON
|
||||
|
||||
- name: Ubuntu GCC No AVX2
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_AVX2=OFF -DWITH_SANITIZER=Undefined
|
||||
codecov: ubuntu_gcc_no_avx2
|
||||
|
||||
- name: Ubuntu GCC No SSE2
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_SSE2=OFF -DWITH_SANITIZER=Undefined
|
||||
codecov: ubuntu_gcc_no_sse2
|
||||
|
||||
- name: Ubuntu GCC No SSE4
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_SSE4=OFF -DWITH_SANITIZER=Undefined
|
||||
codecov: ubuntu_gcc_no_sse4
|
||||
|
||||
- name: Ubuntu GCC No PCLMULQDQ
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_PCLMULQDQ=OFF -DWITH_SANITIZER=Undefined
|
||||
codecov: ubuntu_gcc_no_pclmulqdq
|
||||
|
||||
- name: Ubuntu GCC Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Address
|
||||
codecov: ubuntu_gcc_compat_no_opt
|
||||
cflags: -DNOT_TWEAK_COMPILER
|
||||
|
||||
- name: Ubuntu GCC ARM SF
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armsf
|
||||
|
||||
- name: Ubuntu GCC ARM SF Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined
|
||||
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armsf_compat_no_opt
|
||||
|
||||
- name: Ubuntu GCC ARM HF
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armhf
|
||||
|
||||
- name: Ubuntu GCC ARM HF No ACLE
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_ACLE=OFF -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armhf_no_acle
|
||||
|
||||
- name: Ubuntu GCC ARM HF No NEON
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_NEON=OFF -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armhf_no_neon
|
||||
|
||||
- name: Ubuntu GCC ARM HF Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armhf_compat_no_opt
|
||||
|
||||
- name: Ubuntu GCC AARCH64
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_SANITIZER=Address
|
||||
asan-options: detect_leaks=0
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
codecov: ubuntu_gcc_aarch64
|
||||
|
||||
- name: Ubuntu GCC AARCH64 No ACLE
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_ACLE=OFF -DWITH_SANITIZER=Undefined
|
||||
asan-options: detect_leaks=0
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
codecov: ubuntu_gcc_aarch64_no_acle
|
||||
|
||||
- name: Ubuntu GCC AARCH64 No NEON
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_NEON=OFF -DWITH_SANITIZER=Undefined
|
||||
asan-options: detect_leaks=0
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
codecov: ubuntu_gcc_aarch64_no_neon
|
||||
|
||||
- name: Ubuntu GCC AARCH64 Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined
|
||||
asan-options: detect_leaks=0
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
codecov: ubuntu_gcc_aarch64_compat_no_opt
|
||||
|
||||
- name: Ubuntu GCC PPC
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc.cmake
|
||||
packages: qemu gcc-powerpc-linux-gnu libc-dev-powerpc-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_ppc
|
||||
|
||||
- name: Ubuntu GCC PPC64
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64.cmake
|
||||
packages: qemu gcc-powerpc64-linux-gnu libc-dev-ppc64-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_ppc64
|
||||
|
||||
- name: Ubuntu GCC PPC64LE
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc64le-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64le.cmake
|
||||
packages: qemu gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross
|
||||
codecov: ubuntu_gcc_ppc64le
|
||||
|
||||
- name: Ubuntu GCC SPARC64
|
||||
os: ubuntu-latest
|
||||
compiler: sparc64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-sparc64.cmake
|
||||
packages: qemu gcc-sparc64-linux-gnu libc-dev-sparc64-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_sparc64
|
||||
|
||||
- name: Ubuntu GCC S390X
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_s390x
|
||||
|
||||
- name: Ubuntu GCC S390X DFLTCC
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DWITH_DFLTCC_DEFLATE=ON -DWITH_DFLTCC_INFLATE=ON -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_s390x
|
||||
|
||||
- name: Ubuntu GCC S390X DFLTCC Compat
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DZLIB_COMPAT=ON -DWITH_DFLTCC_DEFLATE=ON -DWITH_DFLTCC_INFLATE=ON -DWITH_SANITIZER=Undefined
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_s390x
|
||||
|
||||
- name: Ubuntu MinGW i686
|
||||
os: ubuntu-latest
|
||||
compiler: i686-w64-mingw32-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-i686.cmake
|
||||
packages: wine32 gcc-mingw-w64
|
||||
# Codecov disabled due to gcov locking issue error
|
||||
|
||||
- name: Ubuntu MinGW x86_64
|
||||
os: ubuntu-latest
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-x86_64.cmake
|
||||
packages: wine-stable gcc-mingw-w64
|
||||
codecov: ubuntu_gcc_mingw_x86_64
|
||||
|
||||
- name: Ubuntu Clang
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang
|
||||
|
||||
- name: Ubuntu Clang Inflate Strict
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
cmake-args: -DWITH_INFLATE_STRICT=ON
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang_inflate_strict
|
||||
|
||||
- name: Ubuntu Clang Inflate Allow Invalid Dist
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
cmake-args: -DWITH_INFLATE_ALLOW_INVALID_DIST=ON
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang_inflate_allow_invalid_dist
|
||||
|
||||
- name: Ubuntu Clang Memory Map
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
cflags: -DUSE_MMAP
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang_mmap
|
||||
|
||||
- name: Ubuntu Clang Debug
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang_debug
|
||||
build-config: Debug
|
||||
|
||||
- name: Ubuntu Clang MSAN
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
cmake-args: -GNinja -DWITH_SANITIZER=Memory
|
||||
packages: ninja-build llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
cflags: -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize-memory-track-origins
|
||||
codecov: ubuntu_clang_msan
|
||||
|
||||
- name: Windows MSVC Win32
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A Win32
|
||||
|
||||
- name: Windows MSVC Win64
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A x64
|
||||
|
||||
- name: Windows MSVC ARM No Test
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A ARM
|
||||
|
||||
- name: Windows MSVC ARM64 No Test
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A ARM64
|
||||
|
||||
- name: Windows GCC
|
||||
os: windows-latest
|
||||
compiler: gcc
|
||||
cmake-args: -G Ninja
|
||||
codecov: win64_gcc
|
||||
|
||||
- name: Windows GCC Compat No Opt
|
||||
os: windows-latest
|
||||
compiler: gcc
|
||||
cmake-args: -G Ninja -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF
|
||||
codecov: win64_gcc_compat_no_opt
|
||||
|
||||
- name: macOS Clang
|
||||
os: macos-latest
|
||||
compiler: clang
|
||||
cmake-args: -DWITH_SANITIZER=Address
|
||||
codecov: macos_clang
|
||||
|
||||
- name: macOS GCC
|
||||
os: macos-latest
|
||||
compiler: gcc-10
|
||||
cmake-args: -DWITH_SANITIZER=Undefined
|
||||
packages: gcc@10
|
||||
gcov-exec: gcov-10
|
||||
codecov: macos_gcc
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Checkout test corpora
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: nmoinvaz/corpora
|
||||
path: test/data/corpora
|
||||
|
||||
- name: Install packages (Ubuntu)
|
||||
if: runner.os == 'Linux' && matrix.packages
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386 # Required for wine32
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ${{ matrix.packages }}
|
||||
|
||||
- name: Install packages (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
choco install ninja ${{ matrix.packages }} --no-progress
|
||||
|
||||
- name: Install packages (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install ninja ${{ matrix.packages }}
|
||||
env:
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
|
||||
- name: Install codecov.io tools
|
||||
if: matrix.codecov
|
||||
run: |
|
||||
python -u -m pip install codecov
|
||||
|
||||
- name: Generate project files
|
||||
# Shared libaries turned off for qemu ppc* and sparc & reduce code coverage sources
|
||||
run: |
|
||||
mkdir ${{ matrix.build-dir || '.not-used' }}
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
cmake ${{ matrix.build-src-dir || '.' }} ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=ON -DWITH_CODE_COVERAGE=ON -DWITH_MAINTAINER_WARNINGS=ON
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CFLAGS: ${{ matrix.cflags }}
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
CI: true
|
||||
|
||||
- name: Compile source code
|
||||
run: |
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
cmake --build . --config ${{ matrix.build-config || 'Release' }}
|
||||
|
||||
- name: Run test cases
|
||||
# Don't run tests on Windows ARM
|
||||
if: runner.os != 'Windows' || contains(matrix.name, 'ARM') == false
|
||||
run: |
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
ctest --verbose -C Release --output-on-failure --max-width 120 -j 6
|
||||
env:
|
||||
ASAN_OPTIONS: ${{ matrix.asan-options || 'verbosity=0' }}:abort_on_error=1
|
||||
MSAN_OPTIONS: ${{ matrix.msan-options || 'verbosity=0' }}:abort_on_error=1
|
||||
TSAN_OPTIONS: ${{ matrix.tsan-options || 'verbosity=0' }}:abort_on_error=1
|
||||
LSAN_OPTIONS: ${{ matrix.lsan-options || 'verbosity=0' }}:abort_on_error=1
|
||||
|
||||
- name: Upload coverage report
|
||||
if: matrix.codecov && ( env.CODECOV_TOKEN_SECRET != '' || github.repository == 'zlib-ng/zlib-ng' )
|
||||
shell: bash
|
||||
run: |
|
||||
bash tools/codecov-upload.sh
|
||||
env:
|
||||
# Codecov does not yet support GitHub Actions
|
||||
CODECOV_TOKEN_SECRET: "${{secrets.CODECOV_TOKEN}}"
|
||||
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN || 'e4fdf847-f541-4ab1-9d50-3d27e5913906' }}"
|
||||
CODECOV_FLAGS: "${{ matrix.codecov }}"
|
||||
CODECOV_NAME: "${{ matrix.name }}"
|
||||
CODECOV_EXEC: "${{ matrix.gcov-exec || 'gcov' }}"
|
||||
CODECOV_DIR: "${{ matrix.build-dir || '.' }}"
|
||||
-185
@@ -1,185 +0,0 @@
|
||||
name: CI Configure
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ci-configure:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Ubuntu GCC
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
configure-args: --warn
|
||||
|
||||
- name: Ubuntu GCC OSB
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
configure-args: --warn
|
||||
build-dir: ../build
|
||||
build-src-dir: ../zlib-ng
|
||||
|
||||
- name: Ubuntu GCC Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
|
||||
|
||||
- name: Ubuntu GCC ARM SF
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
configure-args: --warn
|
||||
chost: arm-linux-gnueabi
|
||||
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM SF Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
|
||||
chost: arm-linux-gnueabi
|
||||
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM HF
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
configure-args: --warn
|
||||
chost: arm-linux-gnueabihf
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM HF No ACLE
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
configure-args: --warn --without-acle
|
||||
chost: arm-linux-gnueabihf
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM HF No NEON
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
configure-args: --warn --without-neon
|
||||
chost: arm-linux-gnueabihf
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM HF Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
|
||||
chost: arm-linux-gnueabihf
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC AARCH64
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
configure-args: --warn
|
||||
chost: aarch64-linux-gnu
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
|
||||
- name: Ubuntu GCC AARCH64 No ACLE
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
configure-args: --warn --without-acle
|
||||
chost: aarch64-linux-gnu
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
|
||||
- name: Ubuntu GCC AARCH64 No NEON
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
configure-args: --warn --without-neon
|
||||
chost: aarch64-linux-gnu
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
|
||||
- name: Ubuntu GCC AARCH64 Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
|
||||
chost: aarch64-linux-gnu
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
|
||||
- name: Ubuntu GCC PPC
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc-linux-gnu-gcc
|
||||
configure-args: --warn --static
|
||||
chost: powerpc-linux-gnu
|
||||
packages: qemu gcc-powerpc-linux-gnu libc-dev-powerpc-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: Ubuntu GCC PPC64
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc64-linux-gnu-gcc
|
||||
configure-args: --warn --static
|
||||
chost: powerpc-linux-gnu
|
||||
packages: qemu gcc-powerpc64-linux-gnu libc-dev-ppc64-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: Ubuntu GCC PPC64LE
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc64le-linux-gnu-gcc
|
||||
configure-args: --warn
|
||||
chost: powerpc64le-linux-gnu
|
||||
packages: qemu gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross
|
||||
|
||||
- name: Ubuntu GCC S390X
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
configure-args: --warn --static
|
||||
chost: s390x-linux-gnu
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: Ubuntu GCC S390X DFLTCC
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
configure-args: --warn --static --with-dfltcc-deflate --with-dfltcc-inflate
|
||||
chost: s390x-linux-gnu
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: Ubuntu GCC S390X DFLTCC Compat
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
configure-args: --warn --zlib-compat --static --with-dfltcc-deflate --with-dfltcc-inflate
|
||||
chost: s390x-linux-gnu
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: macOS GCC
|
||||
os: macOS-latest
|
||||
compiler: gcc
|
||||
configure-args: --warn
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Install packages (Ubuntu)
|
||||
if: runner.os == 'Linux' && matrix.packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ${{ matrix.packages }}
|
||||
|
||||
- name: Generate project files
|
||||
run: |
|
||||
mkdir ${{ matrix.build-dir || '.not-used' }}
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
${{ matrix.build-src-dir || '.' }}/configure ${{ matrix.configure-args }}
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CFLAGS: ${{ matrix.cflags }}
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
CHOST: ${{ matrix.chost }}
|
||||
CI: true
|
||||
|
||||
- name: Compile source code
|
||||
run: |
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
make -j2
|
||||
|
||||
- name: Run test cases
|
||||
run: |
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
make test
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
name: CI Fuzz
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'zlib-ng'
|
||||
dry-run: false
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'zlib-ng'
|
||||
fuzz-seconds: 600
|
||||
dry-run: false
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
name: CI Libpng
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
pngtest:
|
||||
name: Ubuntu Clang
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository (zlib-ng)
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Generate project files (zlib-ng)
|
||||
run: |
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -fPIC
|
||||
CI: true
|
||||
|
||||
- name: Compile source code (zlib-ng)
|
||||
run: |
|
||||
cmake --build . --config Release
|
||||
|
||||
- name: Checkout repository (libpng)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: glennrp/libpng
|
||||
path: libpng
|
||||
|
||||
- name: Generate project files (libpng)
|
||||
run: |
|
||||
cd libpng
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DPNG_TESTS=ON -DPNG_STATIC=OFF -DZLIB_INCLUDE_DIR=.. -DZLIB_LIBRARY=$PWD/../libz.a
|
||||
env:
|
||||
CC: clang
|
||||
CI: true
|
||||
|
||||
- name: Compile source code (libpng)
|
||||
run: |
|
||||
cd libpng
|
||||
cmake --build . --config Release
|
||||
|
||||
- name: Run test cases (libpng)
|
||||
run: |
|
||||
cd libpng
|
||||
ctest -C Release --output-on-failure --max-width 120
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
name: CI NMake
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ci-cmake:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Windows NMake x86
|
||||
os: windows-latest
|
||||
makefile: win32/Makefile.msc
|
||||
vc-vars: x86
|
||||
|
||||
- name: Windows NMake x64
|
||||
os: windows-latest
|
||||
makefile: win32/Makefile.msc
|
||||
vc-vars: x86_amd64
|
||||
|
||||
- name: Windows NMake ARM No Test
|
||||
os: windows-latest
|
||||
makefile: win32/Makefile.arm
|
||||
vc-vars: x86_arm
|
||||
|
||||
- name: Windows NMake ARM64 No Test
|
||||
os: windows-latest
|
||||
makefile: win32/Makefile.a64
|
||||
vc-vars: x86_arm64
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Compile source code
|
||||
shell: cmd
|
||||
run: |
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.vc-vars }}
|
||||
nmake -f ${{ matrix.makefile }}
|
||||
|
||||
- name: Run test cases
|
||||
shell: cmd
|
||||
# Don't run tests on Windows ARM
|
||||
if: contains(matrix.vc-vars, 'arm') == false
|
||||
run: |
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.vc-vars }}
|
||||
nmake -f ${{ matrix.makefile }} test
|
||||
nmake -f ${{ matrix.makefile }} testdll
|
||||
-121
@@ -1,121 +0,0 @@
|
||||
name: CI Pkgcheck
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ci-pkgcheck:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Ubuntu GCC
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
|
||||
- name: Ubuntu GCC -m32
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
packages: gcc-multilib
|
||||
cmake-args: -DCMAKE_C_FLAGS=-m32
|
||||
cflags: -m32
|
||||
ldflags: -m32
|
||||
|
||||
- name: Ubuntu GCC ARM HF
|
||||
os: ubuntu-latest
|
||||
chost: arm-linux-gnueabihf
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
|
||||
|
||||
- name: Ubuntu GCC AARCH64
|
||||
os: ubuntu-latest
|
||||
chost: aarch64-linux-gnu
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake
|
||||
packages: qemu gcc-aarch64-linux-gnu libc6-dev-arm64-cross
|
||||
|
||||
- name: Ubuntu GCC PPC
|
||||
os: ubuntu-latest
|
||||
chost: powerpc-linux-gnu
|
||||
compiler: powerpc-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc.cmake
|
||||
packages: qemu gcc-powerpc-linux-gnu libc6-dev-powerpc-cross
|
||||
|
||||
- name: Ubuntu GCC PPC64LE
|
||||
os: ubuntu-latest
|
||||
chost: powerpc64le-linux-gnu
|
||||
compiler: powerpc64le-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64le.cmake
|
||||
packages: qemu gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross
|
||||
|
||||
- name: macOS Clang
|
||||
os: macOS-latest
|
||||
compiler: clang
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Install packages (Ubuntu)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends abigail-tools ninja-build diffoscope ${{ matrix.packages }}
|
||||
|
||||
- name: Install packages (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install ninja diffoscope ${{ matrix.packages }}
|
||||
env:
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
|
||||
- name: Select Xcode version (macOS)
|
||||
# Use a version of Xcode that supports ZERO_AR_DATE until CMake supports
|
||||
# AppleClang linking with libtool using -D argument
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/19852
|
||||
if: runner.os == 'macOS'
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '12.1.1'
|
||||
|
||||
- name: Compare builds
|
||||
run: |
|
||||
sh test/pkgcheck.sh
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CFLAGS: ${{ matrix.cflags }}
|
||||
CHOST: ${{ matrix.chost }}
|
||||
CMAKE_ARGS: ${{ matrix.cmake-args }}
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
|
||||
- name: Compare builds (compat)
|
||||
run: |
|
||||
sh test/pkgcheck.sh --zlib-compat
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CFLAGS: ${{ matrix.cflags }}
|
||||
CHOST: ${{ matrix.chost }}
|
||||
CMAKE_ARGS: ${{ matrix.cmake-args }}
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
|
||||
- name: Check ABI
|
||||
# macOS runner does not contain abigail
|
||||
if: runner.os != 'macOS'
|
||||
run: |
|
||||
sh test/abicheck.sh --refresh_if
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CFLAGS: ${{ matrix.cflags }}
|
||||
CHOST: ${{ matrix.chost }}
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
|
||||
- name: Check ABI (compat)
|
||||
# macOS runner does not contain abigail
|
||||
if: runner.os != 'macOS'
|
||||
run: |
|
||||
sh test/abicheck.sh --zlib-compat --refresh_if
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CFLAGS: ${{ matrix.cflags }}
|
||||
CHOST: ${{ matrix.chost }}
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
name: CI Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
jobs:
|
||||
ci-cmake:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Windows MSVC Win32
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A Win32
|
||||
deploy-name: win32
|
||||
|
||||
- name: Windows MSVC Win32 Compat
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A Win32 -DZLIB_COMPAT=ON
|
||||
deploy-name: win32-compat
|
||||
|
||||
- name: Windows MSVC Win64
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A x64
|
||||
deploy-name: win64
|
||||
|
||||
- name: Windows MSVC Win64 Compat
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A x64 -DZLIB_COMPAT=ON
|
||||
deploy-name: win64-compat
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Set environment variables
|
||||
shell: bash
|
||||
run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
|
||||
|
||||
- name: Generate project files
|
||||
run: |
|
||||
cmake . ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Release -DZLIB_ENABLE_TESTS=ON -DCMAKE_INSTALL_PREFIX=out -DINSTALL_UTILS=ON
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CI: true
|
||||
|
||||
- name: Compile source code
|
||||
run: |
|
||||
cmake --build . --config Release --target install
|
||||
|
||||
- name: Package release (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
cd out
|
||||
7z a -tzip ../zlib-ng-${{ matrix.deploy-name }}.zip bin include lib ../LICENSE.md ../README.md
|
||||
|
||||
- name: Upload release (Windows)
|
||||
uses: svenstaro/upload-release-action@v1-release
|
||||
if: runner.os == 'Windows'
|
||||
with:
|
||||
asset_name: zlib-ng-${{ matrix.deploy-name }}.zip
|
||||
file: zlib-ng-${{ matrix.deploy-name }}.zip
|
||||
tag: ${{env.tag}}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
overwrite: true
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
+1
-11
@@ -13,18 +13,14 @@
|
||||
*.gcno
|
||||
*.gcov
|
||||
|
||||
/adler32_test
|
||||
/adler32_testsh
|
||||
/example
|
||||
/example64
|
||||
/examplesh
|
||||
/libz.so*
|
||||
/libz-ng.so*
|
||||
/makefixed
|
||||
/minigzip
|
||||
/minigzip64
|
||||
/minigzipsh
|
||||
/switchlevels
|
||||
/zlib.pc
|
||||
/zlib-ng.pc
|
||||
/CVE-2003-0107
|
||||
@@ -50,9 +46,8 @@ foo.gz
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
Testing
|
||||
/*.cmake
|
||||
*.cmake
|
||||
*.stackdump
|
||||
*._h
|
||||
zconf.h
|
||||
zconf.h.cmakein
|
||||
zconf.h.included
|
||||
@@ -66,7 +61,6 @@ a.out
|
||||
/Makefile
|
||||
/arch/arm/Makefile
|
||||
/arch/generic/Makefile
|
||||
/arch/power/Makefile
|
||||
/arch/x86/Makefile
|
||||
.kdev4
|
||||
*.kdev4
|
||||
@@ -77,10 +71,6 @@ a.out
|
||||
/zlib.dir
|
||||
/zlibstatic.dir
|
||||
/win32/Debug
|
||||
/build/
|
||||
/build[.-]*/
|
||||
/btmp[12]/
|
||||
/pkgtmp[12]/
|
||||
|
||||
/.idea
|
||||
/cmake-build-debug
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
disable=SC2140,SC2086,SC2046,SC2015,SC1097,SC1035,SC1036,SC1007,SC2154,SC2155,SC2000,SC2034,SC2016,SC1091,SC1090,SC2212,SC2143,SC2129,SC2102,SC2069,SC1041,SC1042,SC1044,SC1046,SC1119,SC1110,SC1111,SC1112,SC1102,SC1105,SC1101,SC1004,SC1003,SC1012,SC2068,SC2065,SC2064,SC2063,SC2059,SC2053,SC2048,SC2044,SC2032,SC2031,SC2030,SC2029,SC2025,SC2024,SC2022,SC2018,SC2019,SC2017,SC2014,SC2013,SC2012,SC2009,SC2001,SC2098,SC2096,SC2094,SC2091,SC2092,SC2088,SC2087,SC2076,SC2072,SC2071,SC2223,SC2221,SC2222,SC2217,SC2207,SC2206,SC2205,SC2190,SC2188,SC2187,SC2185,SC2179,SC2178,SC2174,SC2168,SC2167,SC2163,SC2161,SC2160,SC2153,SC2150,SC2148,SC2147,SC2146,SC2142,SC2139,SC2126,SC2123,SC2120,SC2119,SC2117,SC2114,SC1117,SC2164,SC1083,SC2004,SC2125,SC2128,SC2011,SC1008,SC1019,SC2093,SC1132,SC1129,SC2236,SC2237,SC2231,SC2230,SC2229,SC2106,SC2102,SC2243,SC2244,SC2245,SC2247,SC2248,SC2249,SC2250,SC2251,SC2252,SC2181
|
||||
@@ -0,0 +1,283 @@
|
||||
language: c
|
||||
cache: ccache
|
||||
dist: xenial
|
||||
|
||||
env:
|
||||
global:
|
||||
- BUILDDIR=.
|
||||
- MAKER="make -j2"
|
||||
- TESTER="make test"
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: windows
|
||||
compiler: clang
|
||||
env:
|
||||
- GENERATOR="cmake . "
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
- os: windows
|
||||
compiler: clang
|
||||
env:
|
||||
- GENERATOR="cmake ..\\zlib-ng -DZLIB_COMPAT=ON"
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
- BUILDDIR=..\\build
|
||||
- os: windows
|
||||
compiler: gcc
|
||||
env:
|
||||
- GENERATOR="cmake ."
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: GENERATOR="./configure --warn"
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: GENERATOR="cmake . -DZLIB_COMPAT=OFF -DWITH_GZFILEOP=ON -DWITH_NEW_STRATEGIES=YES -DWITH_OPTIM=ON"
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- GENERATOR="../zlib-ng/configure --warn --zlib-compat"
|
||||
- BUILDDIR=../build
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: GENERATOR="./configure --warn --zlib-compat --without-optimizations --without-new-strategies"
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: GENERATOR="cmake ."
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- GENERATOR="cmake ../zlib-ng"
|
||||
- BUILDDIR=../build
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: GENERATOR="./configure --warn --zlib-compat"
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env:
|
||||
- GENERATOR="cmake ../zlib-ng"
|
||||
- BUILDDIR=../build
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env:
|
||||
- GENERATOR="scan-build -v --status-bugs cmake ../zlib-ng"
|
||||
- MAKER="scan-build -v --status-bugs make"
|
||||
- BUILDDIR=../build
|
||||
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
env: GENERATOR="./configure --warn --zlib-compat"
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
env:
|
||||
- GENERATOR="../zlib-ng/configure --warn --zlib-compat"
|
||||
- BUILDDIR=../build
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
env: GENERATOR="cmake ."
|
||||
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: GENERATOR="./configure --warn --zlib-compat"
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env:
|
||||
- GENERATOR="cmake ../zlib-ng"
|
||||
- BUILDDIR=../build
|
||||
|
||||
# compiling for linux-ppc64le variants
|
||||
- os: linux-ppc64le
|
||||
compiler: gcc
|
||||
env: GENERATOR="cmake ."
|
||||
- os: linux-ppc64le
|
||||
compiler: gcc
|
||||
env:
|
||||
- GENERATOR="cmake ../zlib-ng"
|
||||
- BUILDDIR=../build
|
||||
|
||||
- os: linux-ppc64le
|
||||
compiler: clang
|
||||
env: GENERATOR="./configure --warn --zlib-compat"
|
||||
- os: linux-ppc64le
|
||||
compiler: clang
|
||||
env:
|
||||
- GENERATOR="cmake ../zlib-ng"
|
||||
- BUILDDIR=../build
|
||||
|
||||
# Cross compiling for arm variants
|
||||
- os: linux
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-aarch64-linux-gnu
|
||||
- libc-dev-arm64-cross
|
||||
# For all aarch64 implementations NEON is mandatory, while crypto/crc are not.
|
||||
env:
|
||||
- GENERATOR="./configure --warn --zlib-compat"
|
||||
- CHOST=aarch64-linux-gnu
|
||||
- os: linux
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-aarch64-linux-gnu
|
||||
- libc-dev-arm64-cross
|
||||
# For all aarch64 implementations NEON is mandatory, while crypto/crc are not.
|
||||
env:
|
||||
- GENERATOR="cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake . -DZLIB_COMPAT=ON"
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
- os: linux
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-aarch64-linux-gnu
|
||||
- libc-dev-arm64-cross
|
||||
env:
|
||||
- GENERATOR="./configure --warn --zlib-compat"
|
||||
- CHOST=aarch64-linux-gnu
|
||||
- os: linux
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-aarch64-linux-gnu
|
||||
- libc-dev-arm64-cross
|
||||
env:
|
||||
- GENERATOR="cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake ."
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
# Hard-float subsets
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabihf
|
||||
- libc-dev-armhf-cross
|
||||
env:
|
||||
- GENERATOR="./configure --warn"
|
||||
- CHOST=arm-linux-gnueabihf
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabihf
|
||||
- libc-dev-armhf-cross
|
||||
env:
|
||||
- GENERATOR="cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake . -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf"
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabihf
|
||||
- libc-dev-armhf-cross
|
||||
env:
|
||||
- GENERATOR="./configure --warn --zlib-compat --without-neon"
|
||||
- CHOST=arm-linux-gnueabihf
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabihf
|
||||
- libc-dev-armhf-cross
|
||||
env:
|
||||
- GENERATOR="cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake . -DZLIB_COMPAT=ON -DWITH_NEON=OFF -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf"
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabihf
|
||||
- libc-dev-armhf-cross
|
||||
env:
|
||||
- GENERATOR="./configure --warn --zlib-compat"
|
||||
- CHOST=arm-linux-gnueabihf
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabihf
|
||||
- libc-dev-armhf-cross
|
||||
env:
|
||||
- GENERATOR="cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake . -DZLIB_COMPAT=ON -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf"
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
# Soft-float subset
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabi
|
||||
- libc-dev-armel-cross
|
||||
env:
|
||||
- GENERATOR="./configure"
|
||||
- CHOST=arm-linux-gnueabi
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabi
|
||||
- libc-dev-armel-cross
|
||||
env:
|
||||
- GENERATOR="cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake . -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi"
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabi
|
||||
- libc-dev-armel-cross
|
||||
env:
|
||||
- GENERATOR="./configure --zlib-compat"
|
||||
- CHOST=arm-linux-gnueabi
|
||||
- os: linux
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qemu
|
||||
- gcc-arm-linux-gnueabi
|
||||
- libc-dev-armel-cross
|
||||
env:
|
||||
- GENERATOR="cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake . -DZLIB_COMPAT=ON -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi"
|
||||
- MAKER="cmake --build . --config Release"
|
||||
- TESTER="ctest --verbose -C Release"
|
||||
|
||||
script:
|
||||
- mkdir -p $BUILDDIR
|
||||
- cd $BUILDDIR
|
||||
- $GENERATOR
|
||||
- $MAKER
|
||||
- $TESTER
|
||||
+445
-865
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
CMakeLists.txt cmake build file
|
||||
ChangeLog.zlib history of changes up to the fork from zlib 1.2.11
|
||||
FAQ.zlib Frequently Asked Questions about zlib, as distributed in zlib 1.2.11
|
||||
INDEX this file
|
||||
Makefile dummy Makefile that tells you to ./configure
|
||||
Makefile.in template for Unix Makefile
|
||||
README guess what
|
||||
README.zlib Copy of the original README file distributed in zlib 1.2.11
|
||||
configure configure script for Unix
|
||||
test/example.c zlib usages examples for build testing
|
||||
test/minigzip.c minimal gzip-like functionality for build testing
|
||||
test/infcover.c inf*.c code coverage for build coverage testing
|
||||
treebuild.xml XML description of source file dependencies
|
||||
zconf.h.cmakein zconf.h template for cmake
|
||||
zconf.h.in zconf.h template for configure
|
||||
zlib.3 Man page for zlib
|
||||
zlib.3.pdf Man page in PDF format
|
||||
zlib.map Linux symbol information
|
||||
zlib.pc.in Template for pkg-config descriptor
|
||||
zlib.pc.cmakein zlib.pc template for cmake
|
||||
zlib2ansi perl script to convert source files for C++ compilation
|
||||
|
||||
arch/ architecture-specific code
|
||||
doc/ documentation for formats and algorithms
|
||||
win32/ makefiles for Windows
|
||||
|
||||
zlib public header files (required for library use):
|
||||
zconf.h
|
||||
zlib.h
|
||||
|
||||
private source files used to build the zlib library:
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
crc32.h
|
||||
deflate.c
|
||||
deflate.h
|
||||
gzclose.c
|
||||
gzguts.h
|
||||
gzlib.c
|
||||
gzread.c
|
||||
gzwrite.c
|
||||
infback.c
|
||||
inffast.c
|
||||
inffast.h
|
||||
inffixed.h
|
||||
inflate.c
|
||||
inflate.h
|
||||
inftrees.c
|
||||
inftrees.h
|
||||
trees.c
|
||||
trees.h
|
||||
uncompr.c
|
||||
zutil.c
|
||||
zutil.h
|
||||
@@ -1,37 +0,0 @@
|
||||
Contents
|
||||
--------
|
||||
|
||||
| Name | Description |
|
||||
|:-----------------|:---------------------------------------------------------------|
|
||||
| arch/ | Architecture-specific code |
|
||||
| doc/ | Documentation for formats and algorithms |
|
||||
| test/example.c | Zlib usages examples for build testing |
|
||||
| test/minigzip.c | Minimal gzip-like functionality for build testing |
|
||||
| test/infcover.c | Inflate code coverage for build testing |
|
||||
| win32/ | Shared library version resources for Windows |
|
||||
| CMakeLists.txt | Cmake build script |
|
||||
| configure | Bash configure/build script |
|
||||
| adler32.c | Compute the Adler-32 checksum of a data stream |
|
||||
| chunkset.* | Inline functions to copy small data chunks |
|
||||
| compress.c | Compress a memory buffer |
|
||||
| deflate.* | Compress data using the deflate algorithm |
|
||||
| deflate_fast.c | Compress data using the deflate algorithm with fast strategy |
|
||||
| deflate_medium.c | Compress data using the deflate algorithm with medium strategy |
|
||||
| deflate_slow.c | Compress data using the deflate algorithm with slow strategy |
|
||||
| functable.* | Struct containing function pointers to optimized functions |
|
||||
| gzguts.h | Internal definitions for gzip operations |
|
||||
| gzlib.c | Functions common to reading and writing gzip files |
|
||||
| gzread.c | Read gzip files |
|
||||
| gzwrite.c | Write gzip files |
|
||||
| infback.* | Inflate using a callback interface |
|
||||
| inflate.* | Decompress data |
|
||||
| inffast.* | Decompress data with speed optimizations |
|
||||
| inffixed_tbl.h | Table for decoding fixed codes |
|
||||
| inftrees.h | Generate Huffman trees for efficient decoding |
|
||||
| trees.* | Output deflated data using Huffman coding |
|
||||
| uncompr.c | Decompress a memory buffer |
|
||||
| zconf.h.cmakein | zconf.h template for cmake |
|
||||
| zendian.h | BYTE_ORDER for endian tests |
|
||||
| zlib.3 | Man page for zlib |
|
||||
| zlib.map | Linux symbol information |
|
||||
| zlib.pc.in | Pkg-config template |
|
||||
@@ -0,0 +1,64 @@
|
||||
Overview
|
||||
========
|
||||
|
||||
There are several methods for compiling and installing zlib-ng, depending
|
||||
on your favorite operating system and development toolkits.
|
||||
This document will attempt to give a general overview of some of them.
|
||||
|
||||
PS: We do not recommend running 'make install' unless you know what you
|
||||
are doing, as this can override the system default zlib library, and
|
||||
any wrong configuration or incompatability of zlib-ng can make the
|
||||
whole system unusable.
|
||||
|
||||
On linux distros, an alternative way to use zlib-ng instead of zlib
|
||||
for specific programs exist, use LD_PRELOAD.
|
||||
If the program is dynamically linked with zlib, then zlib-ng can take
|
||||
its place without risking system-wide instability. Ex:
|
||||
LD_PRELOAD=/opt/zlib-ng/libz.so.1.2.11.zlib-ng /usr/bin/program
|
||||
|
||||
|
||||
Configure
|
||||
=========
|
||||
|
||||
Using the configure script is currently the main method of setting up the
|
||||
makefiles and preparing for compilation. Configure will attempt to detect
|
||||
the specifics of your system, and enable some of the relevant options for you.
|
||||
|
||||
Configure accepts several command-line options, some of the most important
|
||||
ones are detailed below.
|
||||
|
||||
--zlib-compat
|
||||
This enables options that will ensure that zlib-ng is compiled with all the
|
||||
functions that a standard zlib library contains, you will need to use this
|
||||
if you are going to be using zlib-ng as a drop-in replacement for zlib.
|
||||
|
||||
--without-optimizations
|
||||
This will disable zlib-ng specific optimizations (does not disable strategies).
|
||||
|
||||
--without-new-strategies
|
||||
This will disable specially optimized strategies, such as deflate_quick and
|
||||
deflate_medium.
|
||||
|
||||
Run configure like this:
|
||||
./configure --zlib-compat
|
||||
|
||||
Then you can compile using make:
|
||||
make
|
||||
make test
|
||||
|
||||
|
||||
Cmake
|
||||
=====
|
||||
|
||||
Cmake is an alternative to configure, basically letting you do the same thing,
|
||||
but with different tools and user interfaces.
|
||||
|
||||
Start by initializing cmake:
|
||||
cmake .
|
||||
|
||||
Then you can start the configuration tui to set the wanted options
|
||||
ccmake .
|
||||
|
||||
You can now compile using make:
|
||||
make
|
||||
make test
|
||||
+27
-103
@@ -29,8 +29,8 @@ TEST_LIBS=$(LIBNAME1).a
|
||||
LDSHARED=$(CC)
|
||||
LDSHAREDFLAGS=-shared
|
||||
|
||||
VER=2.0.0-RC2
|
||||
VER1=2
|
||||
VER=1.9.9
|
||||
VER1=1
|
||||
|
||||
STATICLIB=$(LIBNAME1).a
|
||||
SHAREDLIB=$(LIBNAME1).so
|
||||
@@ -51,7 +51,7 @@ RCOBJS=
|
||||
STRIP=
|
||||
RANLIB=ranlib
|
||||
LDCONFIG=ldconfig
|
||||
LDSHAREDLIBC=
|
||||
LDSHAREDLIBC=-lc
|
||||
EXE=
|
||||
|
||||
SRCDIR=.
|
||||
@@ -71,64 +71,12 @@ mandir = ${prefix}/share/man
|
||||
man3dir = ${mandir}/man3
|
||||
pkgconfigdir = ${libdir}/pkgconfig
|
||||
|
||||
OBJZ = \
|
||||
adler32.o \
|
||||
chunkset.o \
|
||||
compare258.o \
|
||||
compress.o \
|
||||
crc32.o \
|
||||
crc32_comb.o \
|
||||
deflate.o \
|
||||
deflate_fast.o \
|
||||
deflate_medium.o \
|
||||
deflate_quick.o \
|
||||
deflate_slow.o \
|
||||
functable.o \
|
||||
infback.o \
|
||||
inffast.o \
|
||||
inflate.o \
|
||||
inftrees.o \
|
||||
insert_string.o \
|
||||
trees.o \
|
||||
uncompr.o \
|
||||
zutil.o \
|
||||
$(ARCH_STATIC_OBJS)
|
||||
|
||||
OBJG = \
|
||||
gzlib.o \
|
||||
gzread.o \
|
||||
gzwrite.o
|
||||
|
||||
OBJZ = adler32.o compress.o crc32.o deflate.o deflate_fast.o deflate_medium.o deflate_slow.o functable.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o $(ARCH_STATIC_OBJS)
|
||||
OBJG = gzclose.o gzlib.o gzread.o gzwrite.o
|
||||
OBJC = $(OBJZ) $(OBJG)
|
||||
|
||||
PIC_OBJZ = \
|
||||
adler32.lo \
|
||||
chunkset.lo \
|
||||
compare258.lo \
|
||||
compress.lo \
|
||||
crc32.lo \
|
||||
crc32_comb.lo \
|
||||
deflate.lo \
|
||||
deflate_fast.lo \
|
||||
deflate_medium.lo \
|
||||
deflate_quick.lo \
|
||||
deflate_slow.lo \
|
||||
functable.lo \
|
||||
infback.lo \
|
||||
inffast.lo \
|
||||
inflate.lo \
|
||||
inftrees.lo \
|
||||
insert_string.lo \
|
||||
trees.lo \
|
||||
uncompr.lo \
|
||||
zutil.lo \
|
||||
$(ARCH_SHARED_OBJS)
|
||||
|
||||
PIC_OBJG = \
|
||||
gzlib.lo \
|
||||
gzread.lo \
|
||||
gzwrite.lo
|
||||
|
||||
PIC_OBJZ = adler32.lo compress.lo crc32.lo deflate.lo deflate_fast.lo deflate_medium.lo deflate_slow.lo functable.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo $(ARCH_SHARED_OBJS)
|
||||
PIC_OBJG = gzclose.lo gzlib.lo gzread.lo gzwrite.lo
|
||||
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
|
||||
|
||||
OBJS = $(OBJC)
|
||||
@@ -137,9 +85,11 @@ PIC_OBJS = $(PIC_OBJC)
|
||||
|
||||
all: static shared
|
||||
|
||||
static: adler32_test$(EXE) example$(EXE) minigzip$(EXE) fuzzers makefixed$(EXE) maketrees$(EXE) makecrct$(EXE)
|
||||
static: example$(EXE) minigzip$(EXE) fuzzers
|
||||
|
||||
shared: adler32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE)
|
||||
shared: examplesh$(EXE) minigzipsh$(EXE)
|
||||
|
||||
all64: example64$(EXE) minigzip64$(EXE)
|
||||
|
||||
check: test
|
||||
|
||||
@@ -231,23 +181,17 @@ $(STATICLIB): $(OBJS)
|
||||
$(AR) $(ARFLAGS) $@ $(OBJS)
|
||||
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
|
||||
|
||||
adler32_test.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/adler32_test.c
|
||||
|
||||
example.o:
|
||||
$(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/example.c
|
||||
|
||||
minigzip.o:
|
||||
$(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/minigzip.c
|
||||
|
||||
makefixed.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makefixed.c
|
||||
example64.o:
|
||||
$(CC) $(CFLAGS) -DWITH_GZFILEOP -D_FILE_OFFSET_BITS=64 $(INCLUDES) -c -o $@ $(SRCDIR)/test/example.c
|
||||
|
||||
maketrees.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/maketrees.c
|
||||
|
||||
makecrct.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makecrct.c
|
||||
minigzip64.o:
|
||||
$(CC) $(CFLAGS) -DWITH_GZFILEOP -D_FILE_OFFSET_BITS=64 $(INCLUDES) -c -o $@ $(SRCDIR)/test/minigzip.c
|
||||
|
||||
zlibrc.o: win32/zlib$(SUFFIX)1.rc
|
||||
$(RC) $(RCFLAGS) -o $@ win32/zlib$(SUFFIX)1.rc
|
||||
@@ -265,7 +209,7 @@ $(OBJG): %.o: $(SRCDIR)/%.c
|
||||
|
||||
$(SHAREDTARGET): $(PIC_OBJS) $(DEFFILE) $(RCOBJS)
|
||||
ifneq ($(SHAREDTARGET),)
|
||||
$(LDSHARED) $(CFLAGS) $(LDSHAREDFLAGS) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC)
|
||||
$(LDSHARED) $(LDSHAREDFLAGS) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
@@ -276,56 +220,38 @@ ifneq ($(SHAREDLIB),$(SHAREDTARGET))
|
||||
endif
|
||||
endif
|
||||
|
||||
adler32_test$(EXE): adler32_test.o $(OBJG) $(STATICLIB)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ adler32_test.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
example$(EXE): example.o $(OBJG) $(STATICLIB)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
$(CC) $(LDFLAGS) -o $@ example.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
minigzip$(EXE): minigzip.o $(OBJG) $(STATICLIB)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
adler32_testsh$(EXE): adler32_test.o $(OBJG) $(SHAREDTARGET)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ adler32_test.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
|
||||
$(CC) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
examplesh$(EXE): example.o $(OBJG) $(SHAREDTARGET)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
|
||||
$(CC) $(LDFLAGS) -o $@ example.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
minigzipsh$(EXE): minigzip.o $(OBJG) $(SHAREDTARGET)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
|
||||
$(CC) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
makefixed$(EXE): makefixed.o $(OBJG) $(STATICLIB)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ makefixed.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
example64$(EXE): example64.o $(OBJG) $(STATICLIB)
|
||||
$(CC) $(LDFLAGS) -o $@ example64.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
maketrees$(EXE): maketrees.o $(OBJG) $(STATICLIB)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ maketrees.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
makecrct$(EXE): makecrct.o $(OBJG) $(STATICLIB)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ makecrct.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
minigzip64$(EXE): minigzip64.o $(OBJG) $(STATICLIB)
|
||||
$(CC) $(LDFLAGS) -o $@ minigzip64.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) $@
|
||||
endif
|
||||
@@ -400,11 +326,11 @@ clean:
|
||||
@if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) clean; fi
|
||||
@if [ -f test/Makefile ]; then $(MAKE) -C test clean; fi
|
||||
rm -f *.o *.lo *~ \
|
||||
adler32_test$(EXE) example$(EXE) minigzip$(EXE) \
|
||||
adler32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
|
||||
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
|
||||
example64$(EXE) minigzip64$(EXE) \
|
||||
checksum_fuzzer$(EXE) compress_fuzzer$(EXE) example_small_fuzzer$(EXE) example_large_fuzzer$(EXE) \
|
||||
example_flush_fuzzer$(EXE) example_dict_fuzzer$(EXE) minigzip_fuzzer$(EXE) \
|
||||
infcover makefixed$(EXE) maketrees$(EXE) makecrct$(EXE) \
|
||||
infcover \
|
||||
$(STATICLIB) $(IMPORTLIB) $(SHAREDLIB) $(SHAREDLIBV) $(SHAREDLIBM) \
|
||||
foo.gz so_locations \
|
||||
_match.s maketree
|
||||
@@ -412,8 +338,6 @@ clean:
|
||||
rm -f *.gcda *.gcno *.gcov
|
||||
rm -f a.out a.exe
|
||||
rm -f *.pc
|
||||
rm -f *._h
|
||||
rm -rf btmp1 btmp2 pkgtmp1 pkgtmp2
|
||||
|
||||
maintainer-clean: distclean
|
||||
distclean: clean
|
||||
|
||||
+11
-136
@@ -1,41 +1,10 @@
|
||||
## zlib-ng
|
||||
*zlib data compression library for the next generation systems*
|
||||
zlib-ng - zlib for the next generation systems
|
||||
|
||||
Maintained by Hans Kristian Rosbach
|
||||
aka Dead2 (zlib-ng àt circlestorm dót org)
|
||||
|
||||
|CI|Status|
|
||||
|:-|-|
|
||||
|GitHub Actions|[](https://github.com/zlib-ng/zlib-ng/actions) [](https://github.com/zlib-ng/zlib-ng/actions) [](https://github.com/zlib-ng/zlib-ng/actions)|
|
||||
|Buildkite|[](https://buildkite.com/circlestorm-productions/zlib-ng)|
|
||||
|CodeFactor|[](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng)|
|
||||
|OSS-Fuzz|[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zlib-ng)
|
||||
|Codecov|[](https://codecov.io/github/zlib-ng/zlib-ng/)|
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Zlib compatible API with support for dual-linking
|
||||
* Modernized native API based on zlib API for ease of porting
|
||||
* Modern C99 syntax and a clean code layout
|
||||
* Deflate medium and quick algorithms based on Intels zlib fork
|
||||
* Support for CPU intrinsics when available
|
||||
* Adler32 implementation using SSSE3, AVX2, Neon & VSX
|
||||
* CRC32-B implementation using PCLMULQDQ & ACLE
|
||||
* Hash table implementation using CRC32-C intrinsics on x86 and ARM
|
||||
* Slide hash implementations using SSE2, AVX2, Neon & VSX
|
||||
* Compare256/258 implementations using SSE4.2 & AVX2
|
||||
* Inflate chunk copying using SSE2, AVX2 & Neon
|
||||
* Support for hardware-accelerated deflate using IBM Z DFLTCC
|
||||
* Unaligned memory read/writes and large bit buffer improvements
|
||||
* Includes improvements from Cloudflare and Intel forks
|
||||
* Configure, CMake, and NMake build system support
|
||||
* Comprehensive set of CMake unit tests
|
||||
* Code sanitizers, fuzzing, and coverage
|
||||
* GitHub Actions continuous integration on Windows, macOS, and Linux
|
||||
* Emulated CI for ARM, AARCH64, PPC, PPC64, SPARC64, S390x using qemu
|
||||
|
||||
Fork Motivation
|
||||
Fork Motivation and History
|
||||
---------------------------
|
||||
|
||||
The motivation for this fork was due to seeing several 3rd party
|
||||
@@ -69,97 +38,17 @@ various dead code, all contrib and example code as there is little
|
||||
point in having those in this fork for various reasons.
|
||||
|
||||
A lot of improvements have gone into zlib-ng since its start, and
|
||||
numerous people and companies have contributed both small and big
|
||||
improvements, or valuable testing.
|
||||
numerous people have contributed both small and big improvements,
|
||||
or valuable testing.
|
||||
|
||||
Please read LICENSE.md, it is very simple and very liberal.
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
There are two ways to build zlib-ng:
|
||||
|
||||
### Cmake
|
||||
|
||||
To build zlib-ng using the cross-platform makefile generator cmake.
|
||||
|
||||
```
|
||||
cmake .
|
||||
cmake --build . --config Release
|
||||
ctest --verbose -C Release
|
||||
```
|
||||
|
||||
Alternatively, you can use the cmake configuration GUI tool ccmake:
|
||||
|
||||
```
|
||||
ccmake .
|
||||
```
|
||||
|
||||
### Configure
|
||||
|
||||
To build zlib-ng using the bash configure script:
|
||||
|
||||
```
|
||||
./configure
|
||||
make
|
||||
make test
|
||||
```
|
||||
|
||||
Build Options
|
||||
-------------
|
||||
| CMake | configure | Description | Default |
|
||||
|:-------------------------|:-------------------------|:--------------------------------------------------------------------------------------|---------|
|
||||
| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF |
|
||||
| ZLIB_ENABLE_TESTS | | Build test binaries | ON |
|
||||
| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON |
|
||||
| WITH_OPTIM | --without-optimizations | Build with optimisations | ON |
|
||||
| WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON |
|
||||
| WITH_NATIVE_INSTRUCTIONS | --native | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF |
|
||||
| WITH_SANITIZER | --with-sanitizer | Build with sanitizer (memory, address, undefined) | OFF |
|
||||
| WITH_FUZZERS | --with-fuzzers | Build test/fuzz | OFF |
|
||||
| WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF |
|
||||
| WITH_CODE_COVERAGE | | Enable code coverage reporting | OFF |
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
WARNING: We do not recommend manually installing unless you really
|
||||
know what you are doing, because this can potentially override the system
|
||||
default zlib library, and any incompatibility or wrong configuration of
|
||||
zlib-ng can make the whole system unusable, requiring recovery or reinstall.
|
||||
If you still want a manual install, we recommend using the /opt/ path prefix.
|
||||
|
||||
For Linux distros, an alternative way to use zlib-ng (if compiled in
|
||||
zlib-compat mode) instead of zlib, is through the use of the
|
||||
_LD_PRELOAD_ environment variable. If the program is dynamically linked
|
||||
with zlib, then zlib-ng will temporarily be used instead by the program,
|
||||
without risking system-wide instability.
|
||||
|
||||
```
|
||||
LD_PRELOAD=/opt/zlib-ng/libz.so.1.2.11.zlib-ng /usr/bin/program
|
||||
```
|
||||
|
||||
### Cmake
|
||||
|
||||
To install zlib-ng system-wide using cmake:
|
||||
|
||||
```
|
||||
cmake --build . --target install
|
||||
```
|
||||
|
||||
### Configure
|
||||
|
||||
To install zlib-ng system-wide using the configure script:
|
||||
|
||||
```
|
||||
make install
|
||||
```
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Zlib-ng is a aiming to be open to contributions, and we would be
|
||||
delighted to receive pull requests on github.
|
||||
Zlib-ng is a young project, and we aim to be open to contributions,
|
||||
and we would be delighted to receive pull requests on github.
|
||||
Just remember that any code you submit must be your own and it must
|
||||
be zlib licensed.
|
||||
Help with testing and reviewing of pull requests etc is also very
|
||||
@@ -184,23 +73,9 @@ The deflate and zlib specifications were written by L. Peter Deutsch.
|
||||
zlib was originally created by Jean-loup Gailly (compression)
|
||||
and Mark Adler (decompression).
|
||||
|
||||
Advanced Build Options
|
||||
----------------------
|
||||
|
||||
| CMake | configure | Description | Default |
|
||||
|:--------------------------------|:----------------------|:--------------------------------------------------------------------|------------------------|
|
||||
| ZLIB_DUAL_LINK | | Dual link tests with system zlib | OFF |
|
||||
| | --force-sse2 | Assume SSE2 instructions are always available | ON (x86), OFF (x86_64) |
|
||||
| WITH_AVX2 | | Build with AVX2 intrinsics | ON |
|
||||
| WITH_SSE2 | | Build with SSE2 intrinsics | ON |
|
||||
| WITH_SSE4 | | Build with SSE4 intrinsics | ON |
|
||||
| WITH_PCLMULQDQ | | Build with PCLMULQDQ intrinsics | ON |
|
||||
| WITH_ACLE | --without-acle | Build with ACLE intrinsics | ON |
|
||||
| WITH_NEON | --without-neon | Build with NEON intrinsics | ON |
|
||||
| WITH_POWER8 | | Build with POWER8 optimisations | ON |
|
||||
| WITH_DFLTCC_DEFLATE | --with-dfltcc-deflate | Use DEFLATE COMPRESSION CALL instruction for compression on IBM Z | OFF |
|
||||
| WITH_DFLTCC_INFLATE | --with-dfltcc-inflate | Use DEFLATE COMPRESSION CALL instruction for decompression on IBM Z | OFF |
|
||||
| WITH_UNALIGNED | | Allow optimizations that use unaligned reads if safe on current arch| ON |
|
||||
| WITH_INFLATE_STRICT | | Build with strict inflate distance checking | OFF |
|
||||
| WITH_INFLATE_ALLOW_INVALID_DIST | | Build with zero fill for inflate invalid distances | OFF |
|
||||
| INSTALL_UTILS | | Copy minigzip and minideflate during install | OFF |
|
||||
Build Status
|
||||
------------
|
||||
|
||||
Travis CI: [](https://travis-ci.org/zlib-ng/zlib-ng/)
|
||||
Buildkite: [](https://buildkite.com/circlestorm-productions/zlib-ng)
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
ZLIB DATA COMPRESSION LIBRARY
|
||||
|
||||
zlib 1.2.11 is a general purpose data compression library. All the code is
|
||||
thread safe. The data format used by the zlib library is described by RFCs
|
||||
(Request for Comments) 1950 to 1952 in the files
|
||||
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
||||
rfc1952 (gzip format).
|
||||
|
||||
All functions of the compression library are documented in the file zlib.h
|
||||
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
|
||||
of the library is given in the file test/example.c which also tests that
|
||||
the library is working correctly. Another example is given in the file
|
||||
test/minigzip.c. The compression library itself is composed of all source
|
||||
files in the root directory.
|
||||
|
||||
To compile all files and run the test program, follow the instructions given at
|
||||
the top of Makefile.in. In short "./configure; make test", and if that goes
|
||||
well, "make install" should work for most flavors of Unix. For Windows, use
|
||||
one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
|
||||
make_vms.com.
|
||||
|
||||
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
|
||||
<info@winimage.com> for the Windows DLL version. The zlib home page is
|
||||
http://zlib.net/ . Before reporting a problem, please check this site to
|
||||
verify that you have the latest version of zlib; otherwise get the latest
|
||||
version and check whether the problem still exists or not.
|
||||
|
||||
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
|
||||
|
||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
||||
issue of Dr. Dobb's Journal; a copy of the article is available at
|
||||
http://marknelson.us/1997/01/01/zlib-engine/ .
|
||||
|
||||
The changes made in version 1.2.11 are documented in the file ChangeLog.
|
||||
|
||||
Unsupported third party contributions are provided in directory contrib/ .
|
||||
|
||||
zlib is available in Java using the java.util.zip package, documented at
|
||||
http://java.sun.com/developer/technicalArticles/Programming/compression/ .
|
||||
|
||||
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
|
||||
at CPAN (Comprehensive Perl Archive Network) sites, including
|
||||
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
|
||||
|
||||
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
||||
available in Python 1.5 and later versions, see
|
||||
http://docs.python.org/library/zlib.html .
|
||||
|
||||
zlib is built into tcl: http://wiki.tcl.tk/4610 .
|
||||
|
||||
An experimental package to read and write files in .zip format, written on top
|
||||
of zlib by Gilles Vollant <info@winimage.com>, is available in the
|
||||
contrib/minizip directory of zlib.
|
||||
|
||||
|
||||
Notes for some targets:
|
||||
|
||||
- For Windows DLL versions, please see win32/DLL_FAQ.txt
|
||||
|
||||
- For 64-bit Irix, deflate.c must be compiled without any optimization. With
|
||||
-O, one libpng test fails. The test works in 32 bit mode (with the -n32
|
||||
compiler flag). The compiler bug has been reported to SGI.
|
||||
|
||||
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
|
||||
when compiled with cc.
|
||||
|
||||
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
|
||||
necessary to get gzprintf working correctly. This is done by configure.
|
||||
|
||||
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
||||
other compilers. Use "make test" to check your compiler.
|
||||
|
||||
- gzdopen is not supported on RISCOS or BEOS.
|
||||
|
||||
- For PalmOs, see http://palmzlib.sourceforge.net/
|
||||
|
||||
|
||||
Acknowledgments:
|
||||
|
||||
The deflate format used by zlib was defined by Phil Katz. The deflate and
|
||||
zlib specifications were written by L. Peter Deutsch. Thanks to all the
|
||||
people who reported problems and suggested various improvements in zlib; they
|
||||
are too numerous to cite here.
|
||||
|
||||
Copyright notice:
|
||||
|
||||
(C) 1995-2017 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
|
||||
If you use the zlib library in a product, we would appreciate *not* receiving
|
||||
lengthy legal documents to sign. The sources are provided for free but without
|
||||
warranty of any kind. The library has been entirely written by Jean-loup
|
||||
Gailly and Mark Adler; it does not include third-party code. We make all
|
||||
contributions to and distributions of this project solely in our personal
|
||||
capacity, and are not conveying any rights to any intellectual property of
|
||||
any third parties.
|
||||
|
||||
If you redistribute modified sources, we would appreciate that you include in
|
||||
the file ChangeLog history information documenting your changes. Please read
|
||||
the FAQ for more information on the distribution of modified source versions.
|
||||
+32
-39
@@ -3,13 +3,24 @@
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#include "zbuild.h"
|
||||
#include "zutil.h"
|
||||
#include "functable.h"
|
||||
#include "adler32_p.h"
|
||||
|
||||
uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len);
|
||||
static uint32_t adler32_combine_(uint32_t adler1, uint32_t adler2, z_off64_t len2);
|
||||
|
||||
#define DO1(buf, i) {adler += (buf)[i]; sum2 += adler;}
|
||||
#define DO2(buf, i) DO1(buf, i); DO1(buf, i+1);
|
||||
#define DO4(buf, i) DO2(buf, i); DO2(buf, i+2);
|
||||
#define DO8(buf, i) DO4(buf, i); DO4(buf, i+4);
|
||||
#define DO16(buf) DO8(buf, 0); DO8(buf, 8);
|
||||
|
||||
/* ========================================================================= */
|
||||
Z_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len) {
|
||||
uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len) {
|
||||
uint32_t sum2;
|
||||
unsigned n;
|
||||
|
||||
@@ -18,15 +29,15 @@ Z_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t l
|
||||
adler &= 0xffff;
|
||||
|
||||
/* in case user likes doing a byte at a time, keep it fast */
|
||||
if (UNLIKELY(len == 1))
|
||||
if (len == 1)
|
||||
return adler32_len_1(adler, buf, sum2);
|
||||
|
||||
/* initial Adler-32 value (deferred check for len == 1 speed) */
|
||||
if (UNLIKELY(buf == NULL))
|
||||
if (buf == NULL)
|
||||
return 1L;
|
||||
|
||||
/* in case short lengths are provided, keep it somewhat fast */
|
||||
if (UNLIKELY(len < 16))
|
||||
if (len < 16)
|
||||
return adler32_len_16(adler, buf, len, sum2);
|
||||
|
||||
/* do length NMAX blocks -- requires just one modulo operation */
|
||||
@@ -39,15 +50,15 @@ Z_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t l
|
||||
#endif
|
||||
do {
|
||||
#ifdef UNROLL_MORE
|
||||
DO16(adler, sum2, buf); /* 16 sums unrolled */
|
||||
DO16(buf); /* 16 sums unrolled */
|
||||
buf += 16;
|
||||
#else
|
||||
DO8(adler, sum2, buf, 0); /* 8 sums unrolled */
|
||||
DO8(buf, 0); /* 8 sums unrolled */
|
||||
buf += 8;
|
||||
#endif
|
||||
} while (--n);
|
||||
adler %= BASE;
|
||||
sum2 %= BASE;
|
||||
MOD(adler);
|
||||
MOD(sum2);
|
||||
}
|
||||
|
||||
/* do remaining bytes (less than NMAX, still just one modulo) */
|
||||
@@ -55,12 +66,12 @@ Z_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t l
|
||||
#ifdef UNROLL_MORE
|
||||
while (len >= 16) {
|
||||
len -= 16;
|
||||
DO16(adler, sum2, buf);
|
||||
DO16(buf);
|
||||
buf += 16;
|
||||
#else
|
||||
while (len >= 8) {
|
||||
len -= 8;
|
||||
DO8(adler, sum2, buf, 0);
|
||||
DO8(buf, 0);
|
||||
buf += 8;
|
||||
#endif
|
||||
}
|
||||
@@ -69,34 +80,22 @@ Z_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t l
|
||||
adler += *buf++;
|
||||
sum2 += adler;
|
||||
}
|
||||
adler %= BASE;
|
||||
sum2 %= BASE;
|
||||
MOD(adler);
|
||||
MOD(sum2);
|
||||
}
|
||||
|
||||
/* return recombined sums */
|
||||
return adler | (sum2 << 16);
|
||||
}
|
||||
|
||||
#ifdef ZLIB_COMPAT
|
||||
unsigned long Z_EXPORT PREFIX(adler32_z)(unsigned long adler, const unsigned char *buf, size_t len) {
|
||||
return (unsigned long)functable.adler32((uint32_t)adler, buf, len);
|
||||
}
|
||||
#else
|
||||
uint32_t Z_EXPORT PREFIX(adler32_z)(uint32_t adler, const unsigned char *buf, size_t len) {
|
||||
uint32_t ZEXPORT PREFIX(adler32_z)(uint32_t adler, const unsigned char *buf, size_t len) {
|
||||
return functable.adler32(adler, buf, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
#ifdef ZLIB_COMPAT
|
||||
unsigned long Z_EXPORT PREFIX(adler32)(unsigned long adler, const unsigned char *buf, unsigned int len) {
|
||||
return (unsigned long)functable.adler32((uint32_t)adler, buf, len);
|
||||
}
|
||||
#else
|
||||
uint32_t Z_EXPORT PREFIX(adler32)(uint32_t adler, const unsigned char *buf, uint32_t len) {
|
||||
uint32_t ZEXPORT PREFIX(adler32)(uint32_t adler, const unsigned char *buf, uint32_t len) {
|
||||
return functable.adler32(adler, buf, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
static uint32_t adler32_combine_(uint32_t adler1, uint32_t adler2, z_off64_t len2) {
|
||||
@@ -109,11 +108,11 @@ static uint32_t adler32_combine_(uint32_t adler1, uint32_t adler2, z_off64_t len
|
||||
return 0xffffffff;
|
||||
|
||||
/* the derivation of this formula is left as an exercise for the reader */
|
||||
len2 %= BASE; /* assumes len2 >= 0 */
|
||||
MOD63(len2); /* assumes len2 >= 0 */
|
||||
rem = (unsigned)len2;
|
||||
sum1 = adler1 & 0xffff;
|
||||
sum2 = rem * sum1;
|
||||
sum2 %= BASE;
|
||||
MOD(sum2);
|
||||
sum1 += (adler2 & 0xffff) + BASE - 1;
|
||||
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
|
||||
if (sum1 >= BASE) sum1 -= BASE;
|
||||
@@ -124,16 +123,10 @@ static uint32_t adler32_combine_(uint32_t adler1, uint32_t adler2, z_off64_t len
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
#ifdef ZLIB_COMPAT
|
||||
unsigned long Z_EXPORT PREFIX(adler32_combine)(unsigned long adler1, unsigned long adler2, z_off_t len2) {
|
||||
return (unsigned long)adler32_combine_((uint32_t)adler1, (uint32_t)adler2, len2);
|
||||
}
|
||||
|
||||
unsigned long Z_EXPORT PREFIX4(adler32_combine)(unsigned long adler1, unsigned long adler2, z_off64_t len2) {
|
||||
return (unsigned long)adler32_combine_((uint32_t)adler1, (uint32_t)adler2, len2);
|
||||
}
|
||||
#else
|
||||
uint32_t Z_EXPORT PREFIX4(adler32_combine)(uint32_t adler1, uint32_t adler2, z_off64_t len2) {
|
||||
uint32_t ZEXPORT PREFIX(adler32_combine)(uint32_t adler1, uint32_t adler2, z_off_t len2) {
|
||||
return adler32_combine_(adler1, adler2, len2);
|
||||
}
|
||||
|
||||
uint32_t ZEXPORT PREFIX(adler32_combine64)(uint32_t adler1, uint32_t adler2, z_off64_t len2) {
|
||||
return adler32_combine_(adler1, adler2, len2);
|
||||
}
|
||||
#endif
|
||||
|
||||
+40
-16
@@ -12,11 +12,45 @@
|
||||
#define NMAX 5552
|
||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
||||
|
||||
#define DO1(sum1, sum2, buf, i) {(sum1) += buf[(i)]; (sum2) += (sum1);}
|
||||
#define DO2(sum1, sum2, buf, i) {DO1(sum1, sum2, buf, i); DO1(sum1, sum2, buf, i+1);}
|
||||
#define DO4(sum1, sum2, buf, i) {DO2(sum1, sum2, buf, i); DO2(sum1, sum2, buf, i+2);}
|
||||
#define DO8(sum1, sum2, buf, i) {DO4(sum1, sum2, buf, i); DO4(sum1, sum2, buf, i+4);}
|
||||
#define DO16(sum1, sum2, buf) {DO8(sum1, sum2, buf, 0); DO8(sum1, sum2, buf, 8);}
|
||||
/* use NO_DIVIDE if your processor does not do division in hardware --
|
||||
try it both ways to see which is faster */
|
||||
#ifdef NO_DIVIDE
|
||||
/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
|
||||
(thank you to John Reiser for pointing this out) */
|
||||
# define CHOP(a) \
|
||||
do { \
|
||||
uint32_t tmp = a >> 16; \
|
||||
a &= 0xffff; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
} while (0)
|
||||
# define MOD28(a) \
|
||||
do { \
|
||||
CHOP(a); \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
# define MOD(a) \
|
||||
do { \
|
||||
CHOP(a); \
|
||||
MOD28(a); \
|
||||
} while (0)
|
||||
# define MOD63(a) \
|
||||
do { /* this assumes a is not negative */ \
|
||||
z_off64_t tmp = a >> 32; \
|
||||
a &= 0xffffffffL; \
|
||||
a += (tmp << 8) - (tmp << 5) + tmp; \
|
||||
tmp = a >> 16; \
|
||||
a &= 0xffffL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
tmp = a >> 16; \
|
||||
a &= 0xffffL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
#else
|
||||
# define MOD(a) a %= BASE
|
||||
# define MOD28(a) a %= BASE
|
||||
# define MOD63(a) a %= BASE
|
||||
#endif
|
||||
|
||||
static inline uint32_t adler32_len_1(uint32_t adler, const unsigned char *buf, uint32_t sum2) {
|
||||
adler += buf[0];
|
||||
@@ -36,18 +70,8 @@ static inline uint32_t adler32_len_16(uint32_t adler, const unsigned char *buf,
|
||||
}
|
||||
if (adler >= BASE)
|
||||
adler -= BASE;
|
||||
sum2 %= BASE; /* only added so many BASE's */
|
||||
MOD28(sum2); /* only added so many BASE's */
|
||||
return adler | (sum2 << 16);
|
||||
}
|
||||
|
||||
static inline uint32_t adler32_len_64(uint32_t adler, const unsigned char *buf, size_t len, uint32_t sum2) {
|
||||
while (len >= 16) {
|
||||
len -= 16;
|
||||
DO16(adler, sum2, buf);
|
||||
buf += 16;
|
||||
}
|
||||
/* Process tail (len < 16). */
|
||||
return adler32_len_16(adler, buf, len, sum2);
|
||||
}
|
||||
|
||||
#endif /* ADLER32_P_H */
|
||||
|
||||
@@ -6,27 +6,19 @@ CC=
|
||||
CFLAGS=
|
||||
SFLAGS=
|
||||
INCLUDES=
|
||||
ACLEFLAG=
|
||||
NEONFLAG=
|
||||
SUFFIX=
|
||||
|
||||
SRCDIR=.
|
||||
SRCTOP=../..
|
||||
TOPDIR=$(SRCTOP)
|
||||
|
||||
all: \
|
||||
adler32_neon.o adler32_neon.lo \
|
||||
armfeature.o armfeature.lo \
|
||||
chunkset_neon.o chunkset_neon.lo \
|
||||
crc32_acle.o crc32_acle.lo \
|
||||
slide_neon.o slide_neon.lo \
|
||||
insert_string_acle.o insert_string_acle.lo
|
||||
all: adler32_neon.o adler32_neon.lo armfeature.o armfeature.lo crc32_acle.o crc32_acle.lo fill_window_arm.o fill_window_arm.lo insert_string_acle.o insert_string_acle.lo
|
||||
|
||||
adler32_neon.o:
|
||||
$(CC) $(CFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c
|
||||
|
||||
adler32_neon.lo:
|
||||
$(CC) $(SFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c
|
||||
$(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c
|
||||
|
||||
armfeature.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c
|
||||
@@ -34,29 +26,23 @@ armfeature.o:
|
||||
armfeature.lo:
|
||||
$(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c
|
||||
|
||||
chunkset_neon.o:
|
||||
$(CC) $(CFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_neon.c
|
||||
|
||||
chunkset_neon.lo:
|
||||
$(CC) $(SFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_neon.c
|
||||
|
||||
crc32_acle.o:
|
||||
$(CC) $(CFLAGS) $(ACLEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c
|
||||
|
||||
crc32_acle.lo:
|
||||
$(CC) $(SFLAGS) $(ACLEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c
|
||||
$(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c
|
||||
|
||||
slide_neon.o:
|
||||
$(CC) $(CFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_neon.c
|
||||
fill_window_arm.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/fill_window_arm.c
|
||||
|
||||
slide_neon.lo:
|
||||
$(CC) $(SFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_neon.c
|
||||
fill_window_arm.lo:
|
||||
$(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/fill_window_arm.c
|
||||
|
||||
insert_string_acle.o:
|
||||
$(CC) $(CFLAGS) $(ACLEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c
|
||||
|
||||
insert_string_acle.lo:
|
||||
$(CC) $(SFLAGS) $(ACLEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c
|
||||
$(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c
|
||||
|
||||
mostlyclean: clean
|
||||
clean:
|
||||
|
||||
@@ -2,16 +2,24 @@
|
||||
* Copyright (C) 2017 ARM Holdings Inc.
|
||||
* Author: Adenilson Cavalcanti <adenilson.cavalcanti@arm.com>
|
||||
*
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#ifdef ARM_NEON_ADLER32
|
||||
#ifdef _M_ARM64
|
||||
# include <arm64_neon.h>
|
||||
#else
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
#include "../../zutil.h"
|
||||
#include "../../adler32_p.h"
|
||||
#include "adler32_neon.h"
|
||||
#if defined(__ARM_NEON__) || defined(__ARM_NEON)
|
||||
#include <arm_neon.h>
|
||||
#include "adler32_p.h"
|
||||
|
||||
static void NEON_accum32(uint32_t *s, const unsigned char *buf, size_t len) {
|
||||
static const uint8_t taps[32] = {
|
||||
@@ -101,7 +109,7 @@ uint32_t adler32_neon(uint32_t adler, const unsigned char *buf, size_t len) {
|
||||
|
||||
for (i = 0; i < len; i += n) {
|
||||
if ((i + n) > len)
|
||||
n = (int)(len - i);
|
||||
n = len - i;
|
||||
|
||||
if (n < 16)
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/* Copyright (C) 1995-2011, 2016 Mark Adler
|
||||
* Copyright (C) 2017 ARM Holdings Inc.
|
||||
* Author: Adenilson Cavalcanti <adenilson.cavalcanti@arm.com>
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#ifndef __ADLER32_NEON__
|
||||
#define __ADLER32_NEON__
|
||||
|
||||
#if defined(__ARM_NEON__) || defined(__ARM_NEON)
|
||||
// Depending on the compiler flavor, size_t may be defined in one or the other header. See:
|
||||
// http://stackoverflow.com/questions/26410466/gcc-linaro-compiler-throws-error-unknown-type-name-size-t
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
uint32_t adler32_neon(uint32_t adler, const unsigned char *buf, size_t len);
|
||||
#endif
|
||||
#endif
|
||||
@@ -8,6 +8,6 @@
|
||||
extern int arm_cpu_has_neon;
|
||||
extern int arm_cpu_has_crc32;
|
||||
|
||||
void Z_INTERNAL arm_check_features(void);
|
||||
void ZLIB_INTERNAL arm_check_features(void);
|
||||
|
||||
#endif /* ARM_H_ */
|
||||
|
||||
@@ -1,69 +1,50 @@
|
||||
#include "../../zutil.h"
|
||||
#include "zutil.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
# include <sys/auxv.h>
|
||||
# include <asm/hwcap.h>
|
||||
#elif defined(__FreeBSD__) && defined(__aarch64__)
|
||||
# include <machine/armreg.h>
|
||||
# ifndef ID_AA64ISAR0_CRC32_VAL
|
||||
# define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
|
||||
# endif
|
||||
#elif defined(__APPLE__)
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/auxv.h>
|
||||
# include <asm/hwcap.h>
|
||||
#elif defined(_WIN32)
|
||||
# include <winapifamily.h>
|
||||
# include <winapifamily.h>
|
||||
#endif
|
||||
|
||||
static int arm_has_crc32() {
|
||||
#if defined(__linux__) && defined(HWCAP2_CRC32)
|
||||
return (getauxval(AT_HWCAP2) & HWCAP2_CRC32) != 0 ? 1 : 0;
|
||||
#elif defined(__FreeBSD__) && defined(__aarch64__)
|
||||
return getenv("QEMU_EMULATING") == NULL
|
||||
&& ID_AA64ISAR0_CRC32_VAL(READ_SPECIALREG(id_aa64isar0_el1)) >= ID_AA64ISAR0_CRC32_BASE;
|
||||
#elif defined(__APPLE__)
|
||||
int hascrc32;
|
||||
size_t size = sizeof(hascrc32);
|
||||
return sysctlbyname("hw.optional.armv8_crc32", &hascrc32, &size, NULL, 0) == 0
|
||||
&& hascrc32 == 1;
|
||||
return (getauxval(AT_HWCAP2) & HWCAP2_CRC32) != 0 ? 1 : 0;
|
||||
#elif defined(ARM_NOCHECK_ACLE)
|
||||
return 1;
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* AArch64 has neon. */
|
||||
#if !defined(__aarch64__) && !defined(_M_ARM64)
|
||||
static inline int arm_has_neon() {
|
||||
#if defined(__linux__) && defined(HWCAP_NEON)
|
||||
#if !defined(__aarch64__)
|
||||
static inline int arm_has_neon()
|
||||
{
|
||||
#if defined(__linux__) && defined(HWCAP_NEON)
|
||||
return (getauxval(AT_HWCAP) & HWCAP_NEON) != 0 ? 1 : 0;
|
||||
#elif defined(__APPLE__)
|
||||
int hasneon;
|
||||
size_t size = sizeof(hasneon);
|
||||
return sysctlbyname("hw.optional.neon", &hasneon, &size, NULL, 0) == 0
|
||||
&& hasneon == 1;
|
||||
#elif defined(_M_ARM) && defined(WINAPI_FAMILY_PARTITION)
|
||||
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
|
||||
#elif defined(_M_ARM) && defined(WINAPI_FAMILY_PARTITION)
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
|
||||
return 1; /* Always supported */
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ARM_NOCHECK_NEON)
|
||||
#if defined(ARM_NOCHECK_NEON)
|
||||
return 1;
|
||||
#else
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Z_INTERNAL int arm_cpu_has_neon;
|
||||
Z_INTERNAL int arm_cpu_has_crc32;
|
||||
ZLIB_INTERNAL int arm_cpu_has_neon;
|
||||
ZLIB_INTERNAL int arm_cpu_has_crc32;
|
||||
|
||||
void Z_INTERNAL arm_check_features(void) {
|
||||
#if defined(__aarch64__) || defined(_M_ARM64)
|
||||
arm_cpu_has_neon = 1; /* always available */
|
||||
void ZLIB_INTERNAL arm_check_features(void) {
|
||||
#if defined(__aarch64__)
|
||||
arm_cpu_has_neon = 1; /* always available */
|
||||
#else
|
||||
arm_cpu_has_neon = arm_has_neon();
|
||||
arm_cpu_has_neon = arm_has_neon();
|
||||
#endif
|
||||
arm_cpu_has_crc32 = arm_has_crc32();
|
||||
arm_cpu_has_crc32 = arm_has_crc32();
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/* chunkset_neon.c -- NEON inline functions to copy small data chunks.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#ifdef ARM_NEON_CHUNKSET
|
||||
#ifdef _M_ARM64
|
||||
# include <arm64_neon.h>
|
||||
#else
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
#include "../../zbuild.h"
|
||||
#include "../../zutil.h"
|
||||
|
||||
typedef uint8x16_t chunk_t;
|
||||
|
||||
#define HAVE_CHUNKMEMSET_1
|
||||
#define HAVE_CHUNKMEMSET_2
|
||||
#define HAVE_CHUNKMEMSET_4
|
||||
#define HAVE_CHUNKMEMSET_8
|
||||
|
||||
static inline void chunkmemset_1(uint8_t *from, chunk_t *chunk) {
|
||||
*chunk = vld1q_dup_u8(from);
|
||||
}
|
||||
|
||||
static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) {
|
||||
*chunk = vreinterpretq_u8_s16(vdupq_n_s16(*(int16_t *)from));
|
||||
}
|
||||
|
||||
static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) {
|
||||
*chunk = vreinterpretq_u8_s32(vdupq_n_s32(*(int32_t *)from));
|
||||
}
|
||||
|
||||
static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) {
|
||||
*chunk = vcombine_u8(vld1_u8(from), vld1_u8(from));
|
||||
}
|
||||
|
||||
#define CHUNKSIZE chunksize_neon
|
||||
#define CHUNKCOPY chunkcopy_neon
|
||||
#define CHUNKCOPY_SAFE chunkcopy_safe_neon
|
||||
#define CHUNKUNROLL chunkunroll_neon
|
||||
#define CHUNKMEMSET chunkmemset_neon
|
||||
#define CHUNKMEMSET_SAFE chunkmemset_safe_neon
|
||||
|
||||
static inline void loadchunk(uint8_t const *s, chunk_t *chunk) {
|
||||
*chunk = vld1q_u8(s);
|
||||
}
|
||||
|
||||
static inline void storechunk(uint8_t *out, chunk_t *chunk) {
|
||||
vst1q_u8(out, *chunk);
|
||||
}
|
||||
|
||||
#include "chunkset_tpl.h"
|
||||
|
||||
#endif
|
||||
@@ -5,16 +5,21 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARM_ACLE_CRC_HASH
|
||||
#ifndef _MSC_VER
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
#include "../../zutil.h"
|
||||
#ifdef __ARM_FEATURE_CRC32
|
||||
# include <arm_acle.h>
|
||||
# ifdef ZLIB_COMPAT
|
||||
# include <zconf.h>
|
||||
# else
|
||||
# include <zconf-ng.h>
|
||||
# endif
|
||||
# ifdef __linux__
|
||||
# include <stddef.h>
|
||||
# endif
|
||||
|
||||
uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) {
|
||||
Z_REGISTER uint32_t c;
|
||||
Z_REGISTER const uint16_t *buf2;
|
||||
Z_REGISTER const uint32_t *buf4;
|
||||
register uint32_t c;
|
||||
register const uint16_t *buf2;
|
||||
register const uint32_t *buf4;
|
||||
|
||||
c = ~crc;
|
||||
if (len && ((ptrdiff_t)buf & 1)) {
|
||||
@@ -31,7 +36,7 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) {
|
||||
buf4 = (const uint32_t *) buf;
|
||||
}
|
||||
|
||||
#if defined(__aarch64__)
|
||||
# if defined(__aarch64__)
|
||||
if ((len > sizeof(uint32_t)) && ((ptrdiff_t)buf & sizeof(uint32_t))) {
|
||||
c = __crc32w(c, *buf4++);
|
||||
len -= sizeof(uint32_t);
|
||||
@@ -39,7 +44,7 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) {
|
||||
|
||||
const uint64_t *buf8 = (const uint64_t *) buf4;
|
||||
|
||||
#ifdef UNROLL_MORE
|
||||
# ifdef UNROLL_MORE
|
||||
while (len >= 4 * sizeof(uint64_t)) {
|
||||
c = __crc32d(c, *buf8++);
|
||||
c = __crc32d(c, *buf8++);
|
||||
@@ -47,7 +52,7 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) {
|
||||
c = __crc32d(c, *buf8++);
|
||||
len -= 4 * sizeof(uint64_t);
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
while (len >= sizeof(uint64_t)) {
|
||||
c = __crc32d(c, *buf8++);
|
||||
@@ -69,7 +74,7 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) {
|
||||
}
|
||||
|
||||
buf = (const unsigned char *) buf2;
|
||||
#else /* __aarch64__ */
|
||||
# else /* __aarch64__ */
|
||||
|
||||
# ifdef UNROLL_MORE
|
||||
while (len >= 8 * sizeof(uint32_t)) {
|
||||
@@ -98,7 +103,7 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) {
|
||||
} else {
|
||||
buf = (const unsigned char *) buf4;
|
||||
}
|
||||
#endif /* __aarch64__ */
|
||||
# endif /* __aarch64__ */
|
||||
|
||||
if (len) {
|
||||
c = __crc32b(c, *buf);
|
||||
@@ -107,4 +112,4 @@ uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) {
|
||||
c = ~c;
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
#endif /* __ARM_FEATURE_CRC32 */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
static __forceinline unsigned long __builtin_ctzl(unsigned long value) {
|
||||
return _arm_clz(_arm_rbit(value));
|
||||
return _arm_clz(_arm_rbit(value));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
/* fill_window_arm.c -- Optimized hash table shifting for ARM with support for NEON instructions
|
||||
* Copyright (C) 2017 Mika T. Lindqvist
|
||||
*
|
||||
* Authors:
|
||||
* Mika T. Lindqvist <postmaster@raasu.org>
|
||||
* Jun He <jun.he@arm.com>
|
||||
*
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#include "zbuild.h"
|
||||
#include "deflate.h"
|
||||
#include "deflate_p.h"
|
||||
#include "functable.h"
|
||||
|
||||
extern ZLIB_INTERNAL int read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
|
||||
|
||||
#if defined(__ARM_NEON__) || defined(__ARM_NEON)
|
||||
#include <arm_neon.h>
|
||||
|
||||
/* SIMD version of hash_chain rebase */
|
||||
static inline void slide_hash_chain(Pos *table, unsigned int entries, uint16_t window_size) {
|
||||
register uint16x8_t v, *p;
|
||||
register size_t n;
|
||||
|
||||
size_t size = entries*sizeof(table[0]);
|
||||
Assert((size % sizeof(uint16x8_t) * 8 == 0), "hash table size err");
|
||||
|
||||
Assert(sizeof(Pos) == 2, "Wrong Pos size");
|
||||
v = vdupq_n_u16(window_size);
|
||||
|
||||
p = (uint16x8_t *)table;
|
||||
n = size / (sizeof(uint16x8_t) * 8);
|
||||
do {
|
||||
p[0] = vqsubq_u16(p[0], v);
|
||||
p[1] = vqsubq_u16(p[1], v);
|
||||
p[2] = vqsubq_u16(p[2], v);
|
||||
p[3] = vqsubq_u16(p[3], v);
|
||||
p[4] = vqsubq_u16(p[4], v);
|
||||
p[5] = vqsubq_u16(p[5], v);
|
||||
p[6] = vqsubq_u16(p[6], v);
|
||||
p[7] = vqsubq_u16(p[7], v);
|
||||
p += 8;
|
||||
} while (--n);
|
||||
}
|
||||
#else
|
||||
/* generic version for hash rebase */
|
||||
static inline void slide_hash_chain(Pos *table, unsigned int entries, uint16_t window_size) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < entries; i++) {
|
||||
table[i] = (table[i] >= window_size) ? (table[i] - window_size) : NIL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void fill_window_arm(deflate_state *s) {
|
||||
register unsigned n;
|
||||
unsigned long more; /* Amount of free space at the end of the window. */
|
||||
unsigned int wsize = s->w_size;
|
||||
|
||||
Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
||||
|
||||
do {
|
||||
more = s->window_size - s->lookahead - s->strstart;
|
||||
|
||||
/* If the window is almost full and there is insufficient lookahead,
|
||||
* move the upper half to the lower one to make room in the upper half.
|
||||
*/
|
||||
if (s->strstart >= wsize+MAX_DIST(s)) {
|
||||
memcpy(s->window, s->window+wsize, wsize);
|
||||
s->match_start -= wsize;
|
||||
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
||||
s->block_start -= wsize;
|
||||
|
||||
/* Slide the hash table (could be avoided with 32 bit values
|
||||
at the expense of memory usage). We slide even when level == 0
|
||||
to keep the hash table consistent if we switch back to level > 0
|
||||
later. (Using level 0 permanently is not an optimal usage of
|
||||
zlib, so we don't care about this pathological case.)
|
||||
*/
|
||||
|
||||
slide_hash_chain(s->head, s->hash_size, wsize);
|
||||
slide_hash_chain(s->prev, wsize, wsize);
|
||||
more += wsize;
|
||||
}
|
||||
if (s->strm->avail_in == 0)
|
||||
break;
|
||||
|
||||
/* If there was no sliding:
|
||||
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
|
||||
* more == window_size - lookahead - strstart
|
||||
* => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
|
||||
* => more >= window_size - 2*WSIZE + 2
|
||||
* In the BIG_MEM or MMAP case (not yet supported),
|
||||
* window_size == input_size + MIN_LOOKAHEAD &&
|
||||
* strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
|
||||
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
||||
* If there was sliding, more >= WSIZE. So in all cases, more >= 2.
|
||||
*/
|
||||
Assert(more >= 2, "more < 2");
|
||||
|
||||
n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
|
||||
s->lookahead += n;
|
||||
|
||||
/* Initialize the hash value now that we have some input: */
|
||||
if (s->lookahead + s->insert >= MIN_MATCH) {
|
||||
unsigned int str = s->strstart - s->insert;
|
||||
unsigned int insert_cnt = s->insert;
|
||||
unsigned int slen;
|
||||
|
||||
s->ins_h = s->window[str];
|
||||
|
||||
if (unlikely(s->lookahead < MIN_MATCH))
|
||||
insert_cnt += s->lookahead - MIN_MATCH;
|
||||
slen = insert_cnt;
|
||||
if (str >= (MIN_MATCH - 2))
|
||||
{
|
||||
str += 2 - MIN_MATCH;
|
||||
insert_cnt += MIN_MATCH - 2;
|
||||
}
|
||||
if (insert_cnt > 0)
|
||||
{
|
||||
functable.insert_string(s, str, insert_cnt);
|
||||
s->insert -= slen;
|
||||
}
|
||||
}
|
||||
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
||||
* but this is not important since only literal bytes will be emitted.
|
||||
*/
|
||||
} while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
|
||||
|
||||
/* If the WIN_INIT bytes after the end of the current data have never been
|
||||
* written, then zero those bytes in order to avoid memory check reports of
|
||||
* the use of uninitialized (or uninitialised as Julian writes) bytes by
|
||||
* the longest match routines. Update the high water mark for the next
|
||||
* time through here. WIN_INIT is set to MAX_MATCH since the longest match
|
||||
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
|
||||
*/
|
||||
if (s->high_water < s->window_size) {
|
||||
unsigned long curr = s->strstart + (unsigned long)s->lookahead;
|
||||
unsigned long init;
|
||||
|
||||
if (s->high_water < curr) {
|
||||
/* Previous high water mark below current data -- zero WIN_INIT
|
||||
* bytes or up to end of window, whichever is less.
|
||||
*/
|
||||
init = s->window_size - curr;
|
||||
if (init > WIN_INIT)
|
||||
init = WIN_INIT;
|
||||
memset(s->window + curr, 0, init);
|
||||
s->high_water = curr + init;
|
||||
} else if (s->high_water < curr + WIN_INIT) {
|
||||
/* High water mark at or above current data, but below current data
|
||||
* plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
|
||||
* to end of window, whichever is less.
|
||||
*/
|
||||
init = curr + WIN_INIT;
|
||||
if (init > s->window_size)
|
||||
init = s->window_size;
|
||||
init -= s->high_water;
|
||||
memset(s->window + s->high_water, 0, init);
|
||||
s->high_water += init;
|
||||
}
|
||||
}
|
||||
|
||||
Assert((unsigned long)s->strstart <= s->window_size - MIN_LOOKAHEAD, "not enough room for search");
|
||||
}
|
||||
@@ -5,18 +5,49 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARM_ACLE_CRC_HASH
|
||||
#ifndef _MSC_VER
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
#include "../../zbuild.h"
|
||||
#include "../../deflate.h"
|
||||
|
||||
#define UPDATE_HASH(s, h, val) \
|
||||
h = __crc32w(0, val)
|
||||
|
||||
#define INSERT_STRING insert_string_acle
|
||||
#define QUICK_INSERT_STRING quick_insert_string_acle
|
||||
|
||||
#include "../../insert_string_tpl.h"
|
||||
#if defined(__ARM_FEATURE_CRC32) && defined(ARM_ACLE_CRC_HASH)
|
||||
#include <arm_acle.h>
|
||||
#include "zbuild.h"
|
||||
#include "deflate.h"
|
||||
|
||||
/* ===========================================================================
|
||||
* Insert string str in the dictionary and set match_head to the previous head
|
||||
* of the hash chain (the most recent string with same hash key). Return
|
||||
* the previous length of the hash chain.
|
||||
* IN assertion: all calls to to INSERT_STRING are made with consecutive
|
||||
* input characters and the first MIN_MATCH bytes of str are valid
|
||||
* (except for the last MIN_MATCH-1 bytes of the input file).
|
||||
*/
|
||||
Pos insert_string_acle(deflate_state *const s, const Pos str, unsigned int count) {
|
||||
Pos p, lp, ret;
|
||||
|
||||
if (unlikely(count == 0)) {
|
||||
return s->prev[str & s->w_mask];
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
lp = str + count - 1; /* last position */
|
||||
|
||||
for (p = str; p <= lp; p++) {
|
||||
uint32_t val, h, hm;
|
||||
memcpy(&val, &s->window[p], sizeof(val));
|
||||
|
||||
if (s->level >= TRIGGER_LEVEL)
|
||||
val &= 0xFFFFFF;
|
||||
|
||||
h = __crc32w(0, val);
|
||||
hm = h & s->hash_mask;
|
||||
|
||||
Pos head = s->head[hm];
|
||||
if (head != p) {
|
||||
s->prev[p & s->w_mask] = head;
|
||||
s->head[hm] = p;
|
||||
if (p == lp)
|
||||
ret = head;
|
||||
} else if (p == lp) {
|
||||
ret = p;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user