Merge pull request #15 from EQEmu/master

Merge master into my branch
This commit is contained in:
Paul Coene 2020-05-28 08:19:35 -04:00 committed by GitHub
commit 9195e5e961
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 59 deletions

View File

@ -17,9 +17,13 @@
|:---:|:---:|:---:|
|**Install Count**|![Windows Install Count](http://analytics.akkadius.com/?install_count&windows_count)|![Linux Install Count](http://analytics.akkadius.com/?install_count&linux_count)|
### > Windows
* [Install](https://eqemu.gitbook.io/server/categories/how-to-guides/installation/server-installation-windows)
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-windows)
### > Debian/Ubuntu/CentOS/Fedora
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-linux)
* You can use curl or wget to kick off the installer (whichever your OS has)
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh

View File

@ -514,7 +514,6 @@ void Database::BuryCorpsesInInstance(uint16 instance_id) {
void Database::DeleteInstance(uint16 instance_id)
{
std::string query;
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
@ -603,9 +602,20 @@ void Database::PurgeExpiredInstances()
return;
}
std::vector<std::string> instance_ids;
for (auto row = results.begin(); row != results.end(); ++row) {
DeleteInstance(atoi(row[0]));
instance_ids.emplace_back(row[0]);
}
std::string imploded_instance_ids = implode(",", instance_ids);
QueryDatabase(fmt::format("DELETE FROM instance_list WHERE id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM instance_list_player WHERE id IN ({})", imploded_instance_ids));
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));
}
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)

View File

@ -1,5 +1,6 @@
#include "uuid.h"
#include <ios>
#include <fmt/format.h>
#ifdef _WIN32

View File

@ -2,7 +2,7 @@
#include <string>
#include <vector>
#include <ios>
#include <ostream>
namespace EQ
{

View File

@ -84,6 +84,7 @@ if (-d "bin") {
#############################################
# run routines
#############################################
get_windows_wget();
check_xml_to_json_conversion() if $ARGV[0] eq "convert_xml";
do_self_update_check_routine() if !$skip_self_update_check;
get_perl_version();
@ -699,6 +700,15 @@ sub get_perl_version
no warnings;
}
sub get_windows_wget {
if (!-e "bin/wget.exe" && $OS eq "Windows") {
if (!-d "bin") {
mkdir("bin");
}
`powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/Akkadius/eqemu-install-v2/master/windows/wget.exe', 'bin\\wget.exe') "`
}
}
sub do_self_update_check_routine
{
@ -1048,10 +1058,6 @@ sub show_menu_prompt
fetch_latest_windows_appveyor();
$dc = 1;
}
elsif ($input eq "windows_server_download_bots") {
fetch_latest_windows_binaries_bots();
$dc = 1;
}
elsif ($input eq "windows_server_latest_bots") {
fetch_latest_windows_appveyor_bots();
$dc = 1;
@ -1371,11 +1377,10 @@ sub get_remote_file
$wget = `wget -N --no-cache --cache=no --no-check-certificate --quiet -O $destination_file $request_url`;
}
elsif ($OS eq "Windows") {
$wget =
`powershell -Command "\$ProgressPreference = 'SilentlyContinue'; Invoke-RestMethod -ContentType \"application/octet-stream\" -Uri $request_url -OutFile $destination_file"`
$wget = `bin\\wget.exe -N --no-cache --cache=no --no-check-certificate --quiet -O $destination_file $request_url`;
}
print "[Download] Saved [" . $destination_file . "] from [" . $request_url . "]\n" if !$silent_download;
if (($OS eq "Linux" && $wget =~ /unable to resolve/i) || ($OS eq "Windows" && $wget =~ /404/i || $wget =~ /could not be resolved/i)) {
if ($wget =~ /unable to resolve/i) {
print "Error, no connection or failed request...\n\n";
#die;
}
@ -1627,13 +1632,13 @@ sub fetch_latest_windows_binaries
sub fetch_latest_windows_appveyor_bots
{
print "[Update] Fetching Latest Windows Binaries with Bots (unstable) from Appveyor... \n";
get_remote_file("https://ci.appveyor.com/api/projects/KimLS/server/artifacts/eqemu-x86-bots.zip",
"updates_staged/eqemu-x86-bots.zip",
get_remote_file("https://ci.appveyor.com/api/projects/KimLS/server-87crp/artifacts/build_x64.zip",
"updates_staged/eqemu-x64-bots.zip",
1);
print "[Update] Fetched Latest Windows Binaries (unstable) from Appveyor... \n";
print "[Update] Extracting... --- \n";
unzip('updates_staged/eqemu-x86-bots.zip', 'updates_staged/binaries/');
unzip('updates_staged/eqemu-x64-bots.zip', 'updates_staged/binaries/');
my @files;
my $start_dir = "updates_staged/binaries";
find(
@ -1651,33 +1656,6 @@ sub fetch_latest_windows_appveyor_bots
rmtree('updates_staged');
}
sub fetch_latest_windows_binaries_bots
{
print "[Update] Fetching Latest Windows Binaries with Bots...\n";
get_remote_file($install_repository_request_url . "master_windows_build_bots.zip",
"updates_staged/master_windows_build_bots.zip",
1);
print "[Update] Fetched Latest Windows Binaries with Bots...\n";
print "[Update] Extracting...\n";
unzip('updates_staged/master_windows_build_bots.zip', 'updates_staged/binaries/');
my @files;
my $start_dir = "updates_staged/binaries";
find(
sub {push @files, $File::Find::name unless -d;},
$start_dir
);
for my $file (@files) {
$destination_file = $file;
$destination_file =~ s/updates_staged\/binaries\///g;
print "[Install] Installing [" . $bin_dir . $destination_file . "]\n";
copy_file($file, $bin_dir . $destination_file);
}
print "[Update] Done...\n";
rmtree('updates_staged');
}
sub do_windows_login_server_setup
{
print "[Install] Pulling down Loginserver database tables...\n";

View File

@ -1523,12 +1523,12 @@ XS(XS__addldonpoints) {
if (items != 2)
Perl_croak(aTHX_ "Usage: quest::addldonpoints(int points, int theme_id)");
long points = (long) SvIV(ST(0));
unsigned long theme_id = (unsigned long) SvUV(ST(1));
long points = (long)SvIV(ST(0));
unsigned long theme_id = (unsigned long)SvUV(ST(1));
quest_manager.addldonpoints(points, theme_id);
quest_manager.addldonpoints(points, theme_id);
XSRETURN_EMPTY;
XSRETURN_EMPTY;
}
XS(XS__addldonwin);
@ -1537,8 +1537,8 @@ XS(XS__addldonwin) {
if (items != 2)
Perl_croak(aTHX_ "Usage: quest::addldonwin(int wins, int theme_id)");
long wins = (long) SvIV(ST(0));
unsigned long theme_id = (unsigned long) SvUV(ST(1));
long wins = (long)SvIV(ST(0));
unsigned long theme_id = (unsigned long)SvUV(ST(1));
quest_manager.addldonwin(wins, theme_id);
@ -1551,8 +1551,8 @@ XS(XS__addldonloss) {
if (items != 2)
Perl_croak(aTHX_ "Usage: quest::addldonloss(int losses, int theme_id)");
long losses = (long) SvIV(ST(0));
unsigned long theme_id = (unsigned long) SvUV(ST(1));
long losses = (long)SvIV(ST(0));
unsigned long theme_id = (unsigned long)SvUV(ST(1));
quest_manager.addldonloss(losses, theme_id);
@ -1565,7 +1565,7 @@ XS(XS__setnexthpevent) {
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::setnexthpevent(int at_mob_percentage)");
int at = (int) SvIV(ST(0));
int at = (int)SvIV(ST(0));
quest_manager.setnexthpevent(at);
@ -1578,7 +1578,7 @@ XS(XS__setnextinchpevent) {
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::setnextinchpevent(int at_mob_percentage)");
int at = (int) SvIV(ST(0));
int at = (int)SvIV(ST(0));
quest_manager.setnextinchpevent(at);
@ -1591,7 +1591,7 @@ XS(XS__sethp) {
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::sethp(int mob_health_percentage [0-100])");
int hpperc = (int) SvIV(ST(0));
int hpperc = (int)SvIV(ST(0));
quest_manager.sethp(hpperc);
@ -1604,29 +1604,41 @@ XS(XS__respawn) {
if (items != 2)
Perl_croak(aTHX_ "Usage: quest::respawn(int npc_type_id, int grid_id)");
int npc_type_id = (int) SvIV(ST(0));
int grid_id = (int) SvIV(ST(1));
int npc_type_id = (int)SvIV(ST(0));
int grid_id = (int)SvIV(ST(1));
quest_manager.respawn(npc_type_id, grid_id);
XSRETURN_EMPTY;
}
//64 bit windows seems to optimize something poorly here causing access violations.
//If you don't do anything with index before passing it to perl it gets optimized out
//Disabling optimization right now for msvc on this function is the best solution.
#ifdef _MSC_VER
#pragma optimize( "", off )
#endif
XS(XS__ChooseRandom);
XS(XS__ChooseRandom) {
dXSARGS;
if (items < 1)
Perl_croak(aTHX_ "Usage: quest::ChooseRandom(option1, option2, option3, option4, option5...[no limit])");
dXSTARG;
int index = zone->random.Int(0, items - 1);
SV* RETVAL = ST(index);
SV *tmp = ST(0);
ST(0) = ST(index);
ST(index) = tmp;
XSprePUSH;
PUSHs(RETVAL);
XSRETURN(1); //return 1 element from the stack (ST(0))
}
#ifdef _MSC_VER
#pragma optimize( "", on )
#endif
XS(XS__set_proximity);
XS(XS__set_proximity) {
dXSARGS;