diff --git a/README.md b/README.md index 1b08d54be..e999b7050 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/common/database_instances.cpp b/common/database_instances.cpp index 617a2baf6..4f7c1b8a2 100644 --- a/common/database_instances.cpp +++ b/common/database_instances.cpp @@ -514,9 +514,8 @@ 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); QueryDatabase(query); @@ -603,9 +602,20 @@ void Database::PurgeExpiredInstances() return; } + std::vector 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) diff --git a/common/util/uuid.cpp b/common/util/uuid.cpp index 633ffebaf..7acd1517f 100644 --- a/common/util/uuid.cpp +++ b/common/util/uuid.cpp @@ -1,5 +1,6 @@ #include "uuid.h" +#include #include #ifdef _WIN32 diff --git a/common/util/uuid.h b/common/util/uuid.h index 3b37fc2d2..d1e49a0e7 100644 --- a/common/util/uuid.h +++ b/common/util/uuid.h @@ -2,7 +2,7 @@ #include #include -#include +#include namespace EQ { @@ -32,4 +32,4 @@ namespace EQ std::vector m_bytes; }; } -} \ No newline at end of file +} diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index e094e0cce..4c510ff9f 100755 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -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"; diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 6b4d75719..f95730eb0 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -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;