Merge branch 'master' of https://github.com/EQEmu/Server into feature/ae-scanning-optimizations

This commit is contained in:
Akkadius 2019-12-29 04:47:04 +00:00
commit b11528fbcc
6 changed files with 85 additions and 29 deletions

2
.gitignore vendored
View File

@ -34,3 +34,5 @@ perl/
submodules/* submodules/*
cmake-build-debug/ cmake-build-debug/
.nfs.*

View File

@ -6743,11 +6743,22 @@ void Client::SendStatsWindow(Client* client, bool use_window)
GetRawACNoShield(shield_ac); GetRawACNoShield(shield_ac);
std::string skill_list[] = { std::string skill_list[] = {
"1H Blunt","1H Slashing","2H Blunt","2H Slashing","Abjuration","Alteration","Apply Poison","Archery","Backstab","Bind Wound","Bash","Block","Brass Instruments","Channeling","Conjuration", "1H Blunt","1H Slashing","2H Blunt","2H Slashing","Abjuration",
"Defense","Disarm","Disarm Traps","Divination","Dodge","Double Attack","Dragon Punch","Dual Wield","Eagle Strike","Evocation","Feign Death","Flying Kick","Forage","Hand To Hand","Hide","Kick", "Alteration","Apply Poison","Archery","Backstab","Bind Wound",
"Meditate","Mend","Offense","Parry","Pick Lock","Piercing","Riposte","Round Kick","Safe Fall","Sense Heading","Singing","Sneak","Specialize Abjuration","Specialize Alteration","Specialize Conjuration", "Bash","Block","Brass Instruments","Channeling","Conjuration",
"Specialize Divination","Specialize Evocation","Pick Pockets","Stringed_Instruments","Swimming","Throwing","Tiger Claw","Tracking","Wind Instruments","Fishing","Make Poison","Tinkering","Research","Alchemy", "Defense","Disarm","Disarm Traps","Divination","Dodge",
"Baking","Tailoring","Sense Traps","Blacksmithing","Fletching","Brewing","Alcohol_Tolerance","Begging","Jewelry Making","Pottery","Percussion Instruments","Intimidation","Berserking","Taunt","Frenzy" "Double Attack","Dragon Punch","Dual Wield","Eagle Strike","Evocation",
"Feign Death","Flying Kick","Forage","Hand To Hand","Hide",
"Kick","Meditate","Mend","Offense","Parry",
"Pick Lock","1H Piercing","Riposte","Round Kick","Safe Fall",
"Sense Heading","Singing","Sneak","Specialize Abjuration","Specialize Alteration",
"Specialize Conjuration","Specialize Divination","Specialize Evocation","Pick Pockets","Stringed Instruments",
"Swimming","Throwing","Tiger Claw","Tracking","Wind Instruments",
"Fishing","Make Poison","Tinkering","Research","Alchemy",
"Baking","Tailoring","Sense Traps","Blacksmithing","Fletching",
"Brewing","Alcohol_Tolerance","Begging","Jewelry Making","Pottery",
"Percussion Instruments","Intimidation","Berserking","Taunt","Frenzy",
"Remove Traps","Triple Attack","2H Piercing"
}; };
std::string skill_mods = ""; std::string skill_mods = "";

View File

@ -242,42 +242,61 @@ bool Map::Load(std::string filename, bool force_mmf_overwrite)
return true; return true;
} }
#else #else
bool Map::Load(std::string filename)
/**
* @param filename
* @return
*/
bool Map::Load(const std::string &filename)
{ {
#endif /*USE_MAP_MMFS*/ #endif /*USE_MAP_MMFS*/
FILE *f = fopen(filename.c_str(), "rb"); FILE *map_file = fopen(filename.c_str(), "rb");
if(f) { if (map_file) {
uint32 version; uint32 version;
if(fread(&version, sizeof(version), 1, f) != 1) { if (fread(&version, sizeof(version), 1, map_file) != 1) {
fclose(f); fclose(map_file);
return false; return false;
} }
if(version == 0x01000000) { if (version == 0x01000000) {
LogInfo("Loaded V1 Map File [{}]", filename.c_str()); LogInfo("Loaded V1 Map File [{}]", filename.c_str());
bool v = LoadV1(f); bool loaded_map_file = LoadV1(map_file);
fclose(f); fclose(map_file);
#ifdef USE_MAP_MMFS if (loaded_map_file) {
if (v) LogInfo("Loaded V1 Map File [{}]", filename.c_str());
return SaveMMF(filename, force_mmf_overwrite);
#endif /*USE_MAP_MMFS*/
return v;
} else if(version == 0x02000000) {
LogInfo("Loaded V2 Map File [{}]", filename.c_str());
bool v = LoadV2(f);
fclose(f);
#ifdef USE_MAP_MMFS
if (v)
return SaveMMF(filename, force_mmf_overwrite);
#endif /*USE_MAP_MMFS*/
return v;
} else { } else {
fclose(f); LogError("Failed to load V1 Map File [{}]", filename.c_str());
}
#ifdef USE_MAP_MMFS
if (v)
return SaveMMF(filename, force_mmf_overwrite);
#endif /*USE_MAP_MMFS*/
return loaded_map_file;
}
else if (version == 0x02000000) {
LogInfo("Loading V2 Map File [{}]", filename.c_str());
bool loaded_map_file = LoadV2(map_file);
fclose(map_file);
if (loaded_map_file) {
LogInfo("Loaded V2 Map File [{}]", filename.c_str());
} else {
LogError("Failed to load V2 Map File [{}]", filename.c_str());
}
#ifdef USE_MAP_MMFS
if (v)
return SaveMMF(filename, force_mmf_overwrite);
#endif /*USE_MAP_MMFS*/
return loaded_map_file;
}
else {
fclose(map_file);
return false; return false;
} }
} }

View File

@ -47,7 +47,7 @@ public:
#ifdef USE_MAP_MMFS #ifdef USE_MAP_MMFS
bool Load(std::string filename, bool force_mmf_overwrite = false); bool Load(std::string filename, bool force_mmf_overwrite = false);
#else #else
bool Load(std::string filename); bool Load(const std::string& filename);
#endif #endif
static Map *LoadMapFile(std::string file); static Map *LoadMapFile(std::string file);

View File

@ -610,7 +610,7 @@ int Mob::_GetWalkSpeed() const {
runspeedcap += itembonuses.IncreaseRunSpeedCap + spellbonuses.IncreaseRunSpeedCap + aabonuses.IncreaseRunSpeedCap; runspeedcap += itembonuses.IncreaseRunSpeedCap + spellbonuses.IncreaseRunSpeedCap + aabonuses.IncreaseRunSpeedCap;
aa_mod += aabonuses.BaseMovementSpeed; aa_mod += aabonuses.BaseMovementSpeed;
if (IsClient()) { if (IsClient() && CastToClient()->GetHorseId()) {
Mob *horse = entity_list.GetMob(CastToClient()->GetHorseId()); Mob *horse = entity_list.GetMob(CastToClient()->GetHorseId());
if (horse) { if (horse) {
speed_mod = horse->GetBaseRunspeed(); speed_mod = horse->GetBaseRunspeed();
@ -668,7 +668,7 @@ int Mob::_GetRunSpeed() const {
{ {
speed_mod = 325; speed_mod = 325;
} }
else else if (CastToClient()->GetHorseId())
{ {
Mob* horse = entity_list.GetMob(CastToClient()->GetHorseId()); Mob* horse = entity_list.GetMob(CastToClient()->GetHorseId());
if(horse) if(horse)

View File

@ -10,10 +10,34 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
/**
* @param name
* @return
*/
inline bool file_exists(const std::string& name) {
std::ifstream f(name.c_str());
return f.good();
}
/**
* @param zone_name
* @return
*/
WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) { WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower); std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower);
std::string file_path = Config->MapDir + "water/" + zone_name + std::string(".wtr"); std::string filename;
if (file_exists("maps")) {
filename = "maps";
}
else if (file_exists("Maps")) {
filename = "Maps";
}
else {
filename = Config->MapDir;
}
std::string file_path = filename + "/water/" + zone_name + std::string(".wtr");
LogDebug("Attempting to load water map with path [{}]", file_path.c_str()); LogDebug("Attempting to load water map with path [{}]", file_path.c_str());
FILE *f = fopen(file_path.c_str(), "rb"); FILE *f = fopen(file_path.c_str(), "rb");
if(f) { if(f) {