diff --git a/.gitignore b/.gitignore index daba92762..89dd521c5 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,6 @@ perl/ *cbp submodules/* -cmake-build-debug/ \ No newline at end of file +cmake-build-debug/ + +.nfs.* \ No newline at end of file diff --git a/zone/client.cpp b/zone/client.cpp index 911c090dc..a99b2818a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6743,11 +6743,22 @@ void Client::SendStatsWindow(Client* client, bool use_window) GetRawACNoShield(shield_ac); 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", - "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", - "Meditate","Mend","Offense","Parry","Pick Lock","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" + "1H Blunt","1H Slashing","2H Blunt","2H Slashing","Abjuration", + "Alteration","Apply Poison","Archery","Backstab","Bind Wound", + "Bash","Block","Brass Instruments","Channeling","Conjuration", + "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","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 = ""; diff --git a/zone/map.cpp b/zone/map.cpp index a0e3e6400..dbfa3928e 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -242,46 +242,65 @@ bool Map::Load(std::string filename, bool force_mmf_overwrite) return true; } #else -bool Map::Load(std::string filename) + +/** + * @param filename + * @return + */ +bool Map::Load(const std::string &filename) { #endif /*USE_MAP_MMFS*/ - FILE *f = fopen(filename.c_str(), "rb"); - if(f) { + FILE *map_file = fopen(filename.c_str(), "rb"); + if (map_file) { uint32 version; - if(fread(&version, sizeof(version), 1, f) != 1) { - fclose(f); + if (fread(&version, sizeof(version), 1, map_file) != 1) { + fclose(map_file); return false; } - - if(version == 0x01000000) { + + if (version == 0x01000000) { LogInfo("Loaded V1 Map File [{}]", filename.c_str()); - bool v = LoadV1(f); - fclose(f); + bool loaded_map_file = LoadV1(map_file); + fclose(map_file); + + if (loaded_map_file) { + LogInfo("Loaded V1 Map File [{}]", filename.c_str()); + } else { + 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 v; - } else if(version == 0x02000000) { - LogInfo("Loaded V2 Map File [{}]", filename.c_str()); - bool v = LoadV2(f); - fclose(f); + 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 v; - } else { - fclose(f); + return loaded_map_file; + } + else { + fclose(map_file); return false; } } - + return false; } diff --git a/zone/map.h b/zone/map.h index 8a2ec7f68..eefb43f2d 100644 --- a/zone/map.h +++ b/zone/map.h @@ -47,7 +47,7 @@ public: #ifdef USE_MAP_MMFS bool Load(std::string filename, bool force_mmf_overwrite = false); #else - bool Load(std::string filename); + bool Load(const std::string& filename); #endif static Map *LoadMapFile(std::string file); diff --git a/zone/mob.cpp b/zone/mob.cpp index f4d3acab6..6c04d2c13 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -610,7 +610,7 @@ int Mob::_GetWalkSpeed() const { runspeedcap += itembonuses.IncreaseRunSpeedCap + spellbonuses.IncreaseRunSpeedCap + aabonuses.IncreaseRunSpeedCap; aa_mod += aabonuses.BaseMovementSpeed; - if (IsClient()) { + if (IsClient() && CastToClient()->GetHorseId()) { Mob *horse = entity_list.GetMob(CastToClient()->GetHorseId()); if (horse) { speed_mod = horse->GetBaseRunspeed(); @@ -668,7 +668,7 @@ int Mob::_GetRunSpeed() const { { speed_mod = 325; } - else + else if (CastToClient()->GetHorseId()) { Mob* horse = entity_list.GetMob(CastToClient()->GetHorseId()); if(horse) diff --git a/zone/water_map.cpp b/zone/water_map.cpp index d2e6daad1..ec5575f24 100644 --- a/zone/water_map.cpp +++ b/zone/water_map.cpp @@ -10,10 +10,34 @@ #include #include +/** + * @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) { 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()); FILE *f = fopen(file_path.c_str(), "rb"); if(f) {