diff --git a/CMakeLists.txt b/CMakeLists.txt index ef14a40d5..1d7cf1d90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,14 @@ ELSE(MSVC) ADD_DEFINITIONS(-DHAS_UNION_SEMUN) ENDIF(MSVC) +#FreeBSD support +IF(UNIX) + IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + ADD_DEFINITIONS(-DFREEBSD) + SET(FREEBSD TRUE) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") +ENDIF(UNIX) + #use stdint.h types if they exist for this platform (we have to guess otherwise) CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H) IF(HAVE_STDINT_H) diff --git a/common/Mutex.cpp b/common/Mutex.cpp index a866c5530..e556b05d3 100644 --- a/common/Mutex.cpp +++ b/common/Mutex.cpp @@ -74,7 +74,7 @@ Mutex::Mutex() { #else pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); -#if defined(__CYGWIN__) || defined(__APPLE__) +#if defined(__CYGWIN__) || defined(__APPLE__) || defined(FREEBSD) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); #else pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); diff --git a/common/memory_mapped_file.cpp b/common/memory_mapped_file.cpp index ca2ae0c6d..28455d0bd 100644 --- a/common/memory_mapped_file.cpp +++ b/common/memory_mapped_file.cpp @@ -29,6 +29,9 @@ #include #endif #include "eqemu_exception.h" +#ifdef FREEBSD +#include +#endif namespace EQEmu { diff --git a/common/patches/RoF.cpp b/common/patches/RoF.cpp index 0f62d1081..f9bd001b3 100644 --- a/common/patches/RoF.cpp +++ b/common/patches/RoF.cpp @@ -1859,7 +1859,7 @@ ENCODE(OP_ZoneSpawns) } float SpawnSize = emu->size; - if(!((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522))) + if(!((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))) { PacketSize += 60; @@ -1985,7 +1985,7 @@ ENCODE(OP_ZoneSpawns) VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown18 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown19 - if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522)) + if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) { for(k = 0; k < 9; ++k) { diff --git a/common/patches/SoD.cpp b/common/patches/SoD.cpp index 7cbeae210..cfbfba2ef 100644 --- a/common/patches/SoD.cpp +++ b/common/patches/SoD.cpp @@ -1003,7 +1003,7 @@ ENCODE(OP_ZoneSpawns) { } float SpawnSize = emu->size; - if(!((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522))) + if(!((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))) { PacketSize -= (sizeof(structs::EquipStruct) * 9); @@ -1200,7 +1200,7 @@ ENCODE(OP_ZoneSpawns) { Buffer += sizeof(structs::Spawn_Struct_Position); - if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522)) + if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) { for(k = 0; k < 9; ++k) { @@ -1225,7 +1225,7 @@ ENCODE(OP_ZoneSpawns) { } - if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522)) + if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) { structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; diff --git a/common/patches/Underfoot.cpp b/common/patches/Underfoot.cpp index 44c65cc8b..f84eec93a 100644 --- a/common/patches/Underfoot.cpp +++ b/common/patches/Underfoot.cpp @@ -1015,7 +1015,7 @@ ENCODE(OP_ZoneSpawns) { } float SpawnSize = emu->size; - if(!((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522))) + if(!((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))) { PacketSize -= (sizeof(structs::EquipStruct) * 9); @@ -1212,7 +1212,7 @@ ENCODE(OP_ZoneSpawns) { Buffer += sizeof(structs::Spawn_Struct_Position); - if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522)) + if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) { for(k = 0; k < 9; ++k) { @@ -1237,7 +1237,7 @@ ENCODE(OP_ZoneSpawns) { } - if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu ->race == 130) || (emu->race == 330) || (emu->race == 522)) + if((emu->NPC == 0) || (emu->race <=12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) { structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; diff --git a/eqlaunch/CMakeLists.txt b/eqlaunch/CMakeLists.txt index 14257fef9..66f68298f 100644 --- a/eqlaunch/CMakeLists.txt +++ b/eqlaunch/CMakeLists.txt @@ -26,7 +26,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(eqlaunch "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(eqlaunch "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(eqlaunch "z") TARGET_LINK_LIBRARIES(eqlaunch "m") TARGET_LINK_LIBRARIES(eqlaunch "rt") diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt index 5ded6a0c7..43b8b3076 100644 --- a/loginserver/CMakeLists.txt +++ b/loginserver/CMakeLists.txt @@ -53,7 +53,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(loginserver "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(loginserver "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(loginserver "z") TARGET_LINK_LIBRARIES(loginserver "m") TARGET_LINK_LIBRARIES(loginserver "rt") diff --git a/queryserv/CMakeLists.txt b/queryserv/CMakeLists.txt index 4e319ddad..5108aa2f7 100644 --- a/queryserv/CMakeLists.txt +++ b/queryserv/CMakeLists.txt @@ -32,7 +32,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(queryserv "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(queryserv "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(queryserv "z") TARGET_LINK_LIBRARIES(queryserv "m") TARGET_LINK_LIBRARIES(queryserv "rt") diff --git a/shared_memory/CMakeLists.txt b/shared_memory/CMakeLists.txt index 902ffb2ff..6003e61b3 100644 --- a/shared_memory/CMakeLists.txt +++ b/shared_memory/CMakeLists.txt @@ -31,7 +31,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(shared_memory "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(shared_memory "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(shared_memory "z") TARGET_LINK_LIBRARIES(shared_memory "m") TARGET_LINK_LIBRARIES(shared_memory "rt") diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt index 1218541a3..8649bcf10 100644 --- a/ucs/CMakeLists.txt +++ b/ucs/CMakeLists.txt @@ -34,7 +34,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(ucs "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(ucs "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(ucs "z") TARGET_LINK_LIBRARIES(ucs "m") TARGET_LINK_LIBRARIES(ucs "rt") diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt index 768072677..f974a671f 100644 --- a/world/CMakeLists.txt +++ b/world/CMakeLists.txt @@ -80,7 +80,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(world "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(world "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(world "z") TARGET_LINK_LIBRARIES(world "m") TARGET_LINK_LIBRARIES(world "rt") diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index d2a757e14..037a63f88 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -180,7 +180,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(zone "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(zone "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(zone "z") TARGET_LINK_LIBRARIES(zone "m") TARGET_LINK_LIBRARIES(zone "rt") diff --git a/zone/bot.cpp b/zone/bot.cpp index f6bdd6667..47f974444 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3745,6 +3745,7 @@ void Bot::AI_Process() { if(IsBotArcher() && ranged_timer.Check(false)) { if(GetTarget()->GetHPRatio() <= 99.0f) + // Mob::DoArcheryAttackDmg() takes care of Bot Range and Ammo procs BotRangedAttack(GetTarget()); } else if(!IsBotArcher() && (!(IsBotCaster() && GetLevel() > 12)) && GetTarget() && !IsStunned() && !IsMezzed() && (GetAppearance() != eaDead)) { @@ -3763,6 +3764,9 @@ void Bot::AI_Process() { if(attack_timer.Check()) { Attack(GetTarget(), SLOT_PRIMARY); + ItemInst *wpn = GetBotItem(SLOT_PRIMARY); + TryWeaponProc(wpn, GetTarget(), SLOT_PRIMARY); + bool tripleSuccess = false; if(BotOwner && GetTarget() && CanThisClassDoubleAttack()) { @@ -5374,7 +5378,7 @@ std::string Bot::RaceIdToString(uint16 raceId) { Result = std::string("Iksar"); break; case 130: - Result == std::string("Vah Shir"); + Result = std::string("Vah Shir"); break; case 330: Result = std::string("Froglok"); @@ -11767,6 +11771,25 @@ void Bot::CalcItemBonuses() if(itemtmp->Haste != 0) if(itembonuses.haste < itemtmp->Haste) itembonuses.haste = itemtmp->Haste; + if(GetClass() == BARD && itemtmp->BardValue != 0) { + if(itemtmp->BardType == ItemTypeBrassInstr) + itembonuses.brassMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemTypeDrumInstr) + itembonuses.percussionMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemUseSinging) + itembonuses.singingMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemTypeStringInstr) + itembonuses.stringedMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemTypeWindInstr) + itembonuses.windMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemUseAllInstruments) { + itembonuses.brassMod += itemtmp->BardValue; + itembonuses.percussionMod += itemtmp->BardValue; + itembonuses.singingMod += itemtmp->BardValue; + itembonuses.stringedMod += itemtmp->BardValue; + itembonuses.windMod += itemtmp->BardValue; + } + } if ((itemtmp->Worn.Effect != 0) && (itemtmp->Worn.Type == ET_WornEffect)) { // latent effects ApplySpellsBonuses(itemtmp->Worn.Effect, itemtmp->Worn.Level, &itembonuses); } @@ -11832,6 +11855,25 @@ void Bot::CalcItemBonuses() if(itemtmp->Haste != 0) if(itembonuses.haste < itemtmp->Haste) itembonuses.haste = itemtmp->Haste; + if(GetClass() == BARD && itemtmp->BardValue != 0) { + if(itemtmp->BardType == ItemTypeBrassInstr) + itembonuses.brassMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemTypeDrumInstr) + itembonuses.percussionMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemUseSinging) + itembonuses.singingMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemTypeStringInstr) + itembonuses.stringedMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemTypeWindInstr) + itembonuses.windMod += itemtmp->BardValue; + else if(itemtmp->BardType == ItemUseAllInstruments) { + itembonuses.brassMod += itemtmp->BardValue; + itembonuses.percussionMod += itemtmp->BardValue; + itembonuses.singingMod += itemtmp->BardValue; + itembonuses.stringedMod += itemtmp->BardValue; + itembonuses.windMod += itemtmp->BardValue; + } + } if ((itemtmp->Worn.Effect != 0) && (itemtmp->Worn.Type == ET_WornEffect)) { // latent effects ApplySpellsBonuses(itemtmp->Worn.Effect, itemtmp->Worn.Level, &itembonuses); } @@ -11869,6 +11911,10 @@ void Bot::CalcBotStats(bool showtext) { GetBotOwner()->Message(15, "Base stats:"); GetBotOwner()->Message(15, "Level: %i HP: %i AC: %i Mana: %i STR: %i STA: %i DEX: %i AGI: %i INT: %i WIS: %i CHA: %i", GetLevel(), base_hp, AC, max_mana, STR, STA, DEX, AGI, INT, WIS, CHA); GetBotOwner()->Message(15, "Resists-- Magic: %i, Poison: %i, Fire: %i, Cold: %i, Disease: %i, Corruption: %i.",MR,PR,FR,CR,DR,Corrup); + // Test Code + if(GetClass() == BARD) + GetBotOwner()->Message(15, "Bard Skills-- Brass: %i, Percussion: %i, Singing: %i, Stringed: %i, Wind: %i", + GetSkill(BRASS_INSTRUMENTS), GetSkill(PERCUSSION_INSTRUMENTS), GetSkill(SINGING), GetSkill(STRINGED_INSTRUMENTS), GetSkill(WIND_INSTRUMENTS)); } /*if(this->Save()) @@ -11884,6 +11930,16 @@ void Bot::CalcBotStats(bool showtext) { GetBotOwner()->Message(15, "I'm updated."); GetBotOwner()->Message(15, "Level: %i HP: %i AC: %i Mana: %i STR: %i STA: %i DEX: %i AGI: %i INT: %i WIS: %i CHA: %i", GetLevel(), max_hp, GetAC(), max_mana, GetSTR(), GetSTA(), GetDEX(), GetAGI(), GetINT(), GetWIS(), GetCHA()); GetBotOwner()->Message(15, "Resists-- Magic: %i, Poison: %i, Fire: %i, Cold: %i, Disease: %i, Corruption: %i.",GetMR(),GetPR(),GetFR(),GetCR(),GetDR(),GetCorrup()); + // Test Code + if(GetClass() == BARD) { + GetBotOwner()->Message(15, "Bard Skills-- Brass: %i, Percussion: %i, Singing: %i, Stringed: %i, Wind: %i", + GetSkill(BRASS_INSTRUMENTS) + GetBrassMod(), + GetSkill(PERCUSSION_INSTRUMENTS) + GetPercMod(), + GetSkill(SINGING) + GetSingMod(), + GetSkill(STRINGED_INSTRUMENTS) + GetStringMod(), + GetSkill(WIND_INSTRUMENTS) + GetWindMod()); + GetBotOwner()->Message(15, "Bard Skill Mods-- Brass: %i, Percussion: %i, Singing: %i, Stringed: %i, Wind: %i", GetBrassMod(), GetPercMod(), GetSingMod(), GetStringMod(), GetWindMod()); + } } } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index acad8933a..ec26fa736 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12549,11 +12549,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) // char *GuildName = (char *)app->pBuffer; -#ifdef FREEBSD - if(strlen(GuildName) > 60) -#else if(strnlen(GuildName, 64) > 60) -#endif { Message(clientMessageError, "Guild name too long."); return; diff --git a/zone/effects.cpp b/zone/effects.cpp index e84959c92..55ca41630 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -706,6 +706,15 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ if(!center->CheckLosFN(curmob)) continue; } + else { // check to stop casting beneficial ae buffs (to wit: bard songs) on enemies... + // This does not check faction for beneficial AE buffs..only agro and attackable. + // I've tested for spells that I can find without problem, but a faction-based + // check may still be needed. Any changes here should also reflect in BardAEPulse() -U + if(caster->IsAttackAllowed(curmob, true)) + continue; + if(caster->CheckAggro(curmob)) + continue; + } //if we get here... cast the spell. if(IsTargetableAESpell(spell_id) && bad) @@ -812,6 +821,14 @@ void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool aff if(!center->CheckLosFN(curmob)) continue; } + else { // check to stop casting beneficial ae buffs (to wit: bard songs) on enemies... + // See notes in AESpell() above for more info. + if(caster->IsAttackAllowed(curmob, true)) + continue; + if(caster->CheckAggro(curmob)) + continue; + } + //if we get here... cast the spell. curmob->BardPulse(spell_id, caster); }