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)| |**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 ### > 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 ### > 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) * 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 > 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) void Database::DeleteInstance(uint16 instance_id)
{ {
std::string query; std::string query;
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id); query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
@ -603,9 +602,20 @@ void Database::PurgeExpiredInstances()
return; return;
} }
std::vector<std::string> instance_ids;
for (auto row = results.begin(); row != results.end(); ++row) { 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) void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)

View File

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

View File

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

View File

@ -84,6 +84,7 @@ if (-d "bin") {
############################################# #############################################
# run routines # run routines
############################################# #############################################
get_windows_wget();
check_xml_to_json_conversion() if $ARGV[0] eq "convert_xml"; check_xml_to_json_conversion() if $ARGV[0] eq "convert_xml";
do_self_update_check_routine() if !$skip_self_update_check; do_self_update_check_routine() if !$skip_self_update_check;
get_perl_version(); get_perl_version();
@ -699,6 +700,15 @@ sub get_perl_version
no warnings; 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 sub do_self_update_check_routine
{ {
@ -1048,10 +1058,6 @@ sub show_menu_prompt
fetch_latest_windows_appveyor(); fetch_latest_windows_appveyor();
$dc = 1; $dc = 1;
} }
elsif ($input eq "windows_server_download_bots") {
fetch_latest_windows_binaries_bots();
$dc = 1;
}
elsif ($input eq "windows_server_latest_bots") { elsif ($input eq "windows_server_latest_bots") {
fetch_latest_windows_appveyor_bots(); fetch_latest_windows_appveyor_bots();
$dc = 1; $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`; $wget = `wget -N --no-cache --cache=no --no-check-certificate --quiet -O $destination_file $request_url`;
} }
elsif ($OS eq "Windows") { elsif ($OS eq "Windows") {
$wget = $wget = `bin\\wget.exe -N --no-cache --cache=no --no-check-certificate --quiet -O $destination_file $request_url`;
`powershell -Command "\$ProgressPreference = 'SilentlyContinue'; Invoke-RestMethod -ContentType \"application/octet-stream\" -Uri $request_url -OutFile $destination_file"`
} }
print "[Download] Saved [" . $destination_file . "] from [" . $request_url . "]\n" if !$silent_download; 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"; print "Error, no connection or failed request...\n\n";
#die; #die;
} }
@ -1627,13 +1632,13 @@ sub fetch_latest_windows_binaries
sub fetch_latest_windows_appveyor_bots sub fetch_latest_windows_appveyor_bots
{ {
print "[Update] Fetching Latest Windows Binaries with Bots (unstable) from Appveyor... \n"; 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", get_remote_file("https://ci.appveyor.com/api/projects/KimLS/server-87crp/artifacts/build_x64.zip",
"updates_staged/eqemu-x86-bots.zip", "updates_staged/eqemu-x64-bots.zip",
1); 1);
print "[Update] Fetched Latest Windows Binaries (unstable) from Appveyor... \n"; print "[Update] Fetched Latest Windows Binaries (unstable) from Appveyor... \n";
print "[Update] Extracting... --- \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 @files;
my $start_dir = "updates_staged/binaries"; my $start_dir = "updates_staged/binaries";
find( find(
@ -1651,33 +1656,6 @@ sub fetch_latest_windows_appveyor_bots
rmtree('updates_staged'); 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 sub do_windows_login_server_setup
{ {
print "[Install] Pulling down Loginserver database tables...\n"; print "[Install] Pulling down Loginserver database tables...\n";

View File

@ -1612,21 +1612,33 @@ XS(XS__respawn) {
XSRETURN_EMPTY; 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);
XS(XS__ChooseRandom) { XS(XS__ChooseRandom) {
dXSARGS; dXSARGS;
if (items < 1) if (items < 1)
Perl_croak(aTHX_ "Usage: quest::ChooseRandom(option1, option2, option3, option4, option5...[no limit])"); Perl_croak(aTHX_ "Usage: quest::ChooseRandom(option1, option2, option3, option4, option5...[no limit])");
dXSTARG;
int index = zone->random.Int(0, items - 1); int index = zone->random.Int(0, items - 1);
SV* RETVAL = ST(index);
SV *tmp = ST(0); XSprePUSH;
ST(0) = ST(index); PUSHs(RETVAL);
ST(index) = tmp;
XSRETURN(1); //return 1 element from the stack (ST(0)) 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);
XS(XS__set_proximity) { XS(XS__set_proximity) {
dXSARGS; dXSARGS;