Fix merge ...

This commit is contained in:
Michael Cook (mackal) 2015-06-19 21:48:34 -04:00
parent 6621a125e6
commit 635ac692ea

View File

@ -172,17 +172,17 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
end_regen = CalcEnduranceRegen(); end_regen = CalcEnduranceRegen();
if(cur_hp > max_hp) if(cur_hp > max_hp)
cur_hp = max_hp; cur_hp = max_hp;
if(cur_hp <= 0) { if(cur_hp <= 0) {
SetHP(max_hp/5); SetHP(max_hp/5);
SetMana(0); SetMana(0);
BuffFadeAll(); BuffFadeAll();
SpellOnTarget(756, this); // Rezz effects SpellOnTarget(756, this); // Rezz effects
} }
if(cur_mana > max_mana) if(cur_mana > max_mana)
cur_mana = max_mana; cur_mana = max_mana;
cur_end = max_end; cur_end = max_end;
} }
@ -1140,7 +1140,7 @@ void Bot::GenerateArmorClass() {
iksarlevel -= 10; iksarlevel -= 10;
if(iksarlevel > 25) if(iksarlevel > 25)
iksarlevel = 25; iksarlevel = 25;
if(iksarlevel > 0) if(iksarlevel > 0)
displayed += (iksarlevel * 12 / 10); displayed += (iksarlevel * 12 / 10);
} }
@ -1535,7 +1535,7 @@ bool Bot::IsBotNameAvailable(char *botName, std::string* errorMessage) {
*errorMessage = std::string(results.ErrorMessage()); *errorMessage = std::string(results.ErrorMessage());
return false; return false;
} }
if (results.RowCount()) if (results.RowCount())
return false; return false;
@ -1568,7 +1568,7 @@ bool Bot::Save() {
auto botOwner = GetBotOwner(); auto botOwner = GetBotOwner();
if (botOwner) if (botOwner)
botOwner->Message(13, results.ErrorMessage().c_str()); botOwner->Message(13, results.ErrorMessage().c_str());
return false; return false;
} }
@ -1607,7 +1607,7 @@ bool Bot::Save() {
auto botOwner = GetBotOwner(); auto botOwner = GetBotOwner();
if (botOwner) if (botOwner)
botOwner->Message(13, results.ErrorMessage().c_str()); botOwner->Message(13, results.ErrorMessage().c_str());
return false; return false;
} }
SaveBuffs(); SaveBuffs();
@ -2043,7 +2043,7 @@ void Bot::BotMeditate(bool isSitting) {
if(IsSitting()) if(IsSitting())
Stand(); Stand();
} }
if(IsSitting()) { if(IsSitting()) {
if(!rest_timer.Enabled()) if(!rest_timer.Enabled())
rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000); rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000);
@ -2087,14 +2087,14 @@ void Bot::BotRangedAttack(Mob* other) {
BuffFadeByEffect(SE_Invisibility2); BuffFadeByEffect(SE_Invisibility2);
invisible = false; invisible = false;
} }
if(invisible_undead) { if(invisible_undead) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack."); Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2); BuffFadeByEffect(SE_InvisVsUndead2);
invisible_undead = false; invisible_undead = false;
} }
if(invisible_animals) { if(invisible_animals) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack."); Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
BuffFadeByEffect(SE_InvisVsAnimals); BuffFadeByEffect(SE_InvisVsAnimals);
@ -2218,11 +2218,11 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes
const Item_Struct* botweapon = 0; const Item_Struct* botweapon = 0;
if(inst) if(inst)
botweapon = inst->GetItem(); botweapon = inst->GetItem();
if(botweapon) { if(botweapon) {
if(botweapon->ItemType == ItemTypeShield) if(botweapon->ItemType == ItemTypeShield)
hate += botweapon->AC; hate += botweapon->AC;
hate = (hate * (100 + GetFuriousBash(botweapon->Focus.Effect)) / 100); hate = (hate * (100 + GetFuriousBash(botweapon->Focus.Effect)) / 100);
} }
} }
@ -2278,7 +2278,7 @@ void Bot::ApplySpecialAttackMod(SkillUseTypes skill, int32 &dmg, int32 &mindmg)
const Item_Struct* botweapon = 0; const Item_Struct* botweapon = 0;
if(inst) if(inst)
botweapon = inst->GetItem(); botweapon = inst->GetItem();
if(botweapon) if(botweapon)
dmg += botweapon->AC * (RuleI(Combat, SpecialAttackACBonus))/100; dmg += botweapon->AC * (RuleI(Combat, SpecialAttackACBonus))/100;
} }
@ -2391,7 +2391,7 @@ void Bot::AI_Process() {
if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (DistanceSquaredNoZ(static_cast<glm::vec3>(m_Position), m_PreSummonLocation) < 10)) { if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (DistanceSquaredNoZ(static_cast<glm::vec3>(m_Position), m_PreSummonLocation) < 10)) {
if(GetTarget()) if(GetTarget())
FaceTarget(GetTarget()); FaceTarget(GetTarget());
SetHasBeenSummoned(false); SetHasBeenSummoned(false);
} else if(!IsRooted()) { } else if(!IsRooted()) {
if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) { if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) {
@ -2410,7 +2410,7 @@ void Bot::AI_Process() {
} else { } else {
if(GetTarget()) if(GetTarget())
FaceTarget(GetTarget()); FaceTarget(GetTarget());
SetHasBeenSummoned(false); SetHasBeenSummoned(false);
} }
return; return;
@ -2619,7 +2619,7 @@ void Bot::AI_Process() {
entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_START, GetName()); entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_START, GetName());
this->berserk = true; this->berserk = true;
} }
if (berserk && this->GetHPRatio() > 30) { if (berserk && this->GetHPRatio() > 30) {
entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_END, GetName()); entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_END, GetName());
this->berserk = false; this->berserk = false;
@ -2846,16 +2846,16 @@ void Bot::PetAIProcess() {
aa_skill += botPet->GetOwner()->GetAA(aaWardersAlacrity); aa_skill += botPet->GetOwner()->GetAA(aaWardersAlacrity);
if(aa_skill >= 1) if(aa_skill >= 1)
aa_chance += ((aa_skill > 5 ? 5 : aa_skill) * 4); aa_chance += ((aa_skill > 5 ? 5 : aa_skill) * 4);
if(aa_skill >= 6) if(aa_skill >= 6)
aa_chance += ((aa_skill - 5 > 3 ? 3 : aa_skill - 5) * 7); aa_chance += ((aa_skill - 5 > 3 ? 3 : aa_skill - 5) * 7);
if(aa_skill >= 9) if(aa_skill >= 9)
aa_chance += ((aa_skill - 8 > 3 ? 3 : aa_skill - 8) * 3); aa_chance += ((aa_skill - 8 > 3 ? 3 : aa_skill - 8) * 3);
if(aa_skill >= 12) if(aa_skill >= 12)
aa_chance += ((aa_skill - 11) * 1); aa_chance += ((aa_skill - 11) * 1);
//aa_chance += botPet->GetOwner()->GetAA(aaCompanionsAlacrity) * 3; //aa_chance += botPet->GetOwner()->GetAA(aaCompanionsAlacrity) * 3;
@ -3035,7 +3035,7 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
uint8 materialFromSlot = 0xFF; uint8 materialFromSlot = 0xFF;
for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) { for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) {
itemID = GetBotItemBySlot(i); itemID = GetBotItemBySlot(i);
if(itemID != 0) { if(itemID != 0) {
materialFromSlot = Inventory::CalcMaterialFromSlot(i); materialFromSlot = Inventory::CalcMaterialFromSlot(i);
if(materialFromSlot != 0xFF) if(materialFromSlot != 0xFF)
this->SendWearChange(materialFromSlot); this->SendWearChange(materialFromSlot);
@ -3273,7 +3273,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(item) { if(item) {
if(strlen(item->IDFile) > 2) if(strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialPrimary].Material = atoi(&item->IDFile[2]); ns->spawn.equipment[MaterialPrimary].Material = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialPrimary].Color = GetEquipmentColor(MaterialPrimary); ns->spawn.colors[MaterialPrimary].Color = GetEquipmentColor(MaterialPrimary);
} }
} }
@ -3284,7 +3284,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(item) { if(item) {
if(strlen(item->IDFile) > 2) if(strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialSecondary].Material = atoi(&item->IDFile[2]); ns->spawn.equipment[MaterialSecondary].Material = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialSecondary].Color = GetEquipmentColor(MaterialSecondary); ns->spawn.colors[MaterialSecondary].Color = GetEquipmentColor(MaterialSecondary);
} }
} }
@ -4138,7 +4138,7 @@ bool Bot::Bot_Command_CharmTarget(int charmtype, Mob *target) {
charmid = 198; charmid = 198;
else if((charmlevel >= 31) && (charmlevel <= 46)) else if((charmlevel >= 31) && (charmlevel <= 46))
charmid = 197; charmid = 197;
else if((charmlevel >= 18) && (charmlevel <= 30)) else if((charmlevel >= 18) && (charmlevel <= 30))
charmid = 196; charmid = 196;
break; break;
case 3: // Druid case 3: // Druid
@ -4240,7 +4240,7 @@ bool Bot::Bot_Command_RezzTarget(Mob *target) {
rezid = 2172; rezid = 2172;
else if(rezlevel >= 37) else if(rezlevel >= 37)
rezid = 388; rezid = 388;
else if(rezlevel >= 32) else if(rezlevel >= 32)
rezid = 2171; rezid = 2171;
else if(rezlevel >= 27) else if(rezlevel >= 27)
rezid = 391; rezid = 391;
@ -4382,11 +4382,11 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
"Left Finger", "Right Finger", "Chest", "Legs", "Feet", "Waist", "Ammo", "Powersource" }; "Left Finger", "Right Finger", "Chest", "Legs", "Feet", "Waist", "Ammo", "Powersource" };
bool success = false; bool success = false;
int how_many_slots = 0; int how_many_slots = 0;
for(int j = EmuConstants::EQUIPMENT_BEGIN; j <= (EmuConstants::EQUIPMENT_END + 1); ++j) { for(int j = EmuConstants::EQUIPMENT_BEGIN; j <= (EmuConstants::EQUIPMENT_END + 1); ++j) {
if((mWeaponItem->Slots & (1 << j))) { if((mWeaponItem->Slots & (1 << j))) {
if (j == 22) if (j == 22)
j = 9999; j = 9999;
how_many_slots++; how_many_slots++;
if(!GetBotItem(j)) { if(!GetBotItem(j)) {
if(j == MainPrimary) { if(j == MainPrimary) {
@ -4447,7 +4447,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
if((mWeaponItem->Slots & (1 << j))) { if((mWeaponItem->Slots & (1 << j))) {
if (j == 22) if (j == 22)
j = 9999; j = 9999;
swap_item = GetBotItem(j); swap_item = GetBotItem(j);
failedLoreCheck = false; failedLoreCheck = false;
for (int k = AUG_BEGIN; k < EmuConstants::ITEM_COMMON_SIZE; ++k) { for (int k = AUG_BEGIN; k < EmuConstants::ITEM_COMMON_SIZE; ++k) {
@ -4634,7 +4634,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_
Log.Out(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); Log.Out(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName());
parse->EventNPC(EVENT_ATTACK, this, from, "", 0); parse->EventNPC(EVENT_ATTACK, this, from, "", 0);
} }
attacked_timer.Start(CombatEventTimer_expire); attacked_timer.Start(CombatEventTimer_expire);
// if spell is lifetap add hp to the caster // if spell is lifetap add hp to the caster
if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) { if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) {
@ -4685,7 +4685,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
if ((IsCasting() && (GetClass() != BARD) && !IsFromSpell) || other == nullptr || (GetHP() < 0) || (GetAppearance() == eaDead) || (!IsAttackAllowed(other))) { if ((IsCasting() && (GetClass() != BARD) && !IsFromSpell) || other == nullptr || (GetHP() < 0) || (GetAppearance() == eaDead) || (!IsAttackAllowed(other))) {
if(this->GetOwnerID()) if(this->GetOwnerID())
entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName()); entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName());
if(other) { if(other) {
RemoveFromHateList(other); RemoveFromHateList(other);
Log.Out(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetCleanName()); Log.Out(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetCleanName());
@ -4697,14 +4697,14 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect."); Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect.");
return false; return false;
} }
FaceTarget(GetTarget()); FaceTarget(GetTarget());
ItemInst* weapon = nullptr; ItemInst* weapon = nullptr;
if(Hand == MainPrimary) { if(Hand == MainPrimary) {
weapon = GetBotItem(MainPrimary); weapon = GetBotItem(MainPrimary);
OffHandAtk(false); OffHandAtk(false);
} }
if(Hand == MainSecondary) { if(Hand == MainSecondary) {
weapon = GetBotItem(MainSecondary); weapon = GetBotItem(MainSecondary);
OffHandAtk(true); OffHandAtk(true);
@ -4731,7 +4731,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
uint32 hate = 0; uint32 hate = 0;
if (weapon) if (weapon)
hate = (weapon->GetItem()->Damage + weapon->GetItem()->ElemDmgAmt); hate = (weapon->GetItem()->Damage + weapon->GetItem()->ElemDmgAmt);
int weapon_damage = GetWeaponDamage(other, weapon, &hate); int weapon_damage = GetWeaponDamage(other, weapon, &hate);
if (hate == 0 && weapon_damage > 1) if (hate == 0 && weapon_damage > 1)
hate = weapon_damage; hate = weapon_damage;
@ -4896,14 +4896,14 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
BuffFadeByEffect(SE_Invisibility2); BuffFadeByEffect(SE_Invisibility2);
invisible = false; invisible = false;
} }
if(invisible_undead) { if(invisible_undead) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack."); Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2); BuffFadeByEffect(SE_InvisVsUndead2);
invisible_undead = false; invisible_undead = false;
} }
if(invisible_animals){ if(invisible_animals){
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack."); Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
BuffFadeByEffect(SE_InvisVsAnimals); BuffFadeByEffect(SE_InvisVsAnimals);
@ -4963,7 +4963,7 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint32 points, uint16
base1 = eff.base1; base1 = eff.base1;
base2 = eff.base2; base2 = eff.base2;
slot = eff.slot; slot = eff.slot;
//AA Foci's can contain multiple focus effects within the same AA. //AA Foci's can contain multiple focus effects within the same AA.
//To handle this we will not automatically return zero if a limit is found. //To handle this we will not automatically return zero if a limit is found.
//Instead if limit is found and multiple effects, we will reset the limit check //Instead if limit is found and multiple effects, we will reset the limit check
@ -5175,10 +5175,8 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint32 points, uint16
case SE_FcTwincast: { case SE_FcTwincast: {
if(type == focusTwincast) if(type == focusTwincast)
value = base1; value = base1;
}
break; break;
} }
/* /*
case SE_SympatheticProc: case SE_SympatheticProc:
{ {
@ -5188,10 +5186,10 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint32 points, uint16
int16 ProcRateMod = base1; //Baseline is 100 for most Sympathetic foci int16 ProcRateMod = base1; //Baseline is 100 for most Sympathetic foci
int32 cast_time = GetActSpellCasttime(spell_id, spells[spell_id].cast_time); int32 cast_time = GetActSpellCasttime(spell_id, spells[spell_id].cast_time);
GetSympatheticProcChances(ProcBonus, ProcChance, cast_time, ProcRateMod); GetSympatheticProcChances(ProcBonus, ProcChance, cast_time, ProcRateMod);
if(zone->random.Real(0, 1) <= ProcChance) if(zone->random.Real(0, 1) <= ProcChance)
value = focus_id; value = focus_id;
else else
value = 0; value = 0;
} }
@ -5247,7 +5245,6 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint32 points, uint16
value = base1; value = base1;
break; break;
} }
}
//Check for spell skill limits. //Check for spell skill limits.
if ((LimitSpellSkill) && (!SpellSkill_Found)) if ((LimitSpellSkill) && (!SpellSkill_Found))
@ -5289,7 +5286,7 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) {
ItemInst* ins = GetBotItem(x); ItemInst* ins = GetBotItem(x);
if (!ins) if (!ins)
continue; continue;
TempItem = ins->GetItem(); TempItem = ins->GetItem();
if (TempItem && TempItem->Focus.Effect > 0 && TempItem->Focus.Effect != SPELL_UNKNOWN) { if (TempItem && TempItem->Focus.Effect > 0 && TempItem->Focus.Effect != SPELL_UNKNOWN) {
if(rand_effectiveness) { if(rand_effectiveness) {
@ -5400,7 +5397,7 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) {
aa_value = aa.second.first; aa_value = aa.second.first;
if (aa_AA < 1 || aa_value < 1) if (aa_AA < 1 || aa_value < 1)
continue; continue;
Total3 = CalcBotAAFocus(bottype, aa_AA, aa_value, spell_id); Total3 = CalcBotAAFocus(bottype, aa_AA, aa_value, spell_id);
if (Total3 > 0 && realTotal3 >= 0 && Total3 > realTotal3) { if (Total3 > 0 && realTotal3 >= 0 && Total3 > realTotal3) {
realTotal3 = Total3; realTotal3 = Total3;
@ -5470,7 +5467,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
if (spell.classes[(GetClass() % 16) - 1] < focus_spell.base[i]) if (spell.classes[(GetClass() % 16) - 1] < focus_spell.base[i])
return 0; return 0;
break; break;
case SE_LimitCastTimeMin: case SE_LimitCastTimeMin:
if (spells[spell_id].cast_time < (uint32)focus_spell.base[i]) if (spells[spell_id].cast_time < (uint32)focus_spell.base[i])
return 0; return 0;
@ -5501,8 +5498,8 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
return 0; return 0;
} }
break; break;
case SE_LimitSpellType: case SE_LimitSpellType:
switch(focus_spell.base[i]) { switch(focus_spell.base[i]) {
case 0: case 0:
@ -5517,7 +5514,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
Log.Out(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); Log.Out(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]);
} }
break; break;
case SE_LimitManaMin: case SE_LimitManaMin:
if(spell.mana < focus_spell.base[i]) if(spell.mana < focus_spell.base[i])
return 0; return 0;
@ -5712,19 +5709,19 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
case SE_FcBaseEffects: { case SE_FcBaseEffects: {
if (bottype == BotfocusFcBaseEffects) if (bottype == BotfocusFcBaseEffects)
value = focus_spell.base[i]; value = focus_spell.base[i];
break; break;
} }
case SE_FcDamagePctCrit: { case SE_FcDamagePctCrit: {
if(bottype == BotfocusFcDamagePctCrit) if(bottype == BotfocusFcDamagePctCrit)
value = focus_spell.base[i]; value = focus_spell.base[i];
break; break;
} }
case SE_FcIncreaseNumHits: { case SE_FcIncreaseNumHits: {
if(bottype == BotfocusIncreaseNumHits) if(bottype == BotfocusIncreaseNumHits)
value = focus_spell.base[i]; value = focus_spell.base[i];
break; break;
} }
default: default:
@ -5791,7 +5788,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) {
damage = -3; damage = -3;
Log.Out(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack."); Log.Out(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack.");
} }
float riposte_chance = 0.0f; float riposte_chance = 0.0f;
if (CanRiposte && damage > 0 && CanThisClassRiposte() && !other->BehindMob(this, other->GetX(), other->GetY())) { if (CanRiposte && damage > 0 && CanThisClassRiposte() && !other->BehindMob(this, other->GetX(), other->GetY())) {
riposte_chance = ((100.0f + (float)defender->GetAABonuses().RiposteChance + (float)defender->GetSpellBonuses().RiposteChance + (float)defender->GetItemBonuses().RiposteChance) / 100.0f); riposte_chance = ((100.0f + (float)defender->GetAABonuses().RiposteChance + (float)defender->GetSpellBonuses().RiposteChance + (float)defender->GetItemBonuses().RiposteChance) / 100.0f);
@ -5802,7 +5799,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) {
RollTable[0] = (bonus + (itembonuses.HeroicDEX / 25)); RollTable[0] = (bonus + (itembonuses.HeroicDEX / 25));
} }
} }
bool bBlockFromRear = false; bool bBlockFromRear = false;
bool bShieldBlockFromRear = false; bool bShieldBlockFromRear = false;
if (this->IsBot()) { if (this->IsBot()) {
@ -5894,7 +5891,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) {
if (damage < 0) if (damage < 0)
return true; return true;
return false; return false;
} }
@ -5977,11 +5974,11 @@ void Bot::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage,
const Item_Struct* botweapon = 0; const Item_Struct* botweapon = 0;
if(inst) if(inst)
botweapon = inst->GetItem(); botweapon = inst->GetItem();
if(botweapon) { if(botweapon) {
if(botweapon->ItemType == ItemTypeShield) if(botweapon->ItemType == ItemTypeShield)
hate += botweapon->AC; hate += botweapon->AC;
hate = (hate * (100 + GetFuriousBash(botweapon->Focus.Effect)) / 100); hate = (hate * (100 + GetFuriousBash(botweapon->Focus.Effect)) / 100);
} }
} }
@ -6046,7 +6043,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) {
const Item_Struct* botpiercer = nullptr; const Item_Struct* botpiercer = nullptr;
if(inst) if(inst)
botpiercer = inst->GetItem(); botpiercer = inst->GetItem();
if(!botpiercer || (botpiercer->ItemType != ItemType1HPiercing)) { if(!botpiercer || (botpiercer->ItemType != ItemType1HPiercing)) {
BotGroupSay(this, "I can't backstab with this weapon!"); BotGroupSay(this, "I can't backstab with this weapon!");
return; return;
@ -6218,7 +6215,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
bool canBash = false; bool canBash = false;
if((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(MainSecondary) && m_inv.GetItem(MainSecondary)->GetItem()->ItemType == ItemTypeShield) || (m_inv.GetItem(MainPrimary) && (m_inv.GetItem(MainPrimary)->GetItem()->ItemType == ItemType2HSlash || m_inv.GetItem(MainPrimary)->GetItem()->ItemType == ItemType2HBlunt || m_inv.GetItem(MainPrimary)->GetItem()->ItemType == ItemType2HPiercing) && GetAA(aa2HandBash) >= 1)) if((GetRace() == OGRE || GetRace() == TROLL || GetRace() == BARBARIAN) || (m_inv.GetItem(MainSecondary) && m_inv.GetItem(MainSecondary)->GetItem()->ItemType == ItemTypeShield) || (m_inv.GetItem(MainPrimary) && (m_inv.GetItem(MainPrimary)->GetItem()->ItemType == ItemType2HSlash || m_inv.GetItem(MainPrimary)->GetItem()->ItemType == ItemType2HBlunt || m_inv.GetItem(MainPrimary)->GetItem()->ItemType == ItemType2HPiercing) && GetAA(aa2HandBash) >= 1))
canBash = true; canBash = true;
if(!canBash || zone->random.Int(0, 100) > 25) if(!canBash || zone->random.Int(0, 100) > 25)
skill_to_use = SkillKick; skill_to_use = SkillKick;
else else
@ -6671,7 +6668,7 @@ void Bot::SetAttackTimer() {
} else { } else {
delay = ItemToUse->Delay; delay = ItemToUse->Delay;
} }
speed = (RuleB(Spells, Jun182014HundredHandsRevamp) ? static_cast<int>(((delay / haste_mod) + ((hhe / 1000.0f) * (delay / haste_mod))) * 100) : static_cast<int>(((delay / haste_mod) + ((hhe / 100.0f) * delay)) * 100)); speed = (RuleB(Spells, Jun182014HundredHandsRevamp) ? static_cast<int>(((delay / haste_mod) + ((hhe / 1000.0f) * (delay / haste_mod))) * 100) : static_cast<int>(((delay / haste_mod) + ((hhe / 100.0f) * delay)) * 100));
TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true); TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true);
@ -6982,7 +6979,7 @@ int32 Bot::GetActSpellDuration(uint16 spell_id, int32 duration) {
increase += 30; increase += 30;
if (GetAA(aaSpellCastingReinforcementMastery) == 1) if (GetAA(aaSpellCastingReinforcementMastery) == 1)
increase += 20; increase += 20;
break; break;
} }
@ -7001,7 +6998,7 @@ float Bot::GetAOERange(uint16 spell_id) {
range = spells[spell_id].aoerange; range = spells[spell_id].aoerange;
if(range == 0) if(range == 0)
range = spells[spell_id].range; range = spells[spell_id].range;
if(range == 0) if(range == 0)
range = 10; range = 10;
@ -7048,14 +7045,14 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t
Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() ); Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() );
if(IsSilenced() && !IsDiscipline(spell_id)) if(IsSilenced() && !IsDiscipline(spell_id))
Message_StringID(13, SILENCED_STRING); Message_StringID(13, SILENCED_STRING);
if(IsAmnesiad() && IsDiscipline(spell_id)) if(IsAmnesiad() && IsDiscipline(spell_id))
Message_StringID(13, MELEE_SILENCE); Message_StringID(13, MELEE_SILENCE);
if(casting_spell_id) if(casting_spell_id)
AI_Event_SpellCastFinished(false, casting_spell_slot); AI_Event_SpellCastFinished(false, casting_spell_slot);
return false; return false;
} }
} }
@ -7064,7 +7061,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t
Message_StringID(13, SPELL_WOULDNT_HOLD); Message_StringID(13, SPELL_WOULDNT_HOLD);
if(casting_spell_id) if(casting_spell_id)
AI_Event_SpellCastFinished(false, casting_spell_slot); AI_Event_SpellCastFinished(false, casting_spell_slot);
return false; return false;
} }
@ -7073,7 +7070,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t
InterruptSpell(173, 0x121, false); InterruptSpell(173, 0x121, false);
return false; return false;
} }
if(slot < MAX_PP_MEMSPELL && !CheckFizzle(spell_id)) { if(slot < MAX_PP_MEMSPELL && !CheckFizzle(spell_id)) {
int fizzle_msg = IsBardSong(spell_id) ? MISS_NOTE : SPELL_FIZZLE; int fizzle_msg = IsBardSong(spell_id) ? MISS_NOTE : SPELL_FIZZLE;
InterruptSpell(fizzle_msg, 0x121, spell_id); InterruptSpell(fizzle_msg, 0x121, spell_id);
@ -7233,7 +7230,7 @@ bool Bot::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
bool Bot::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 aa_id) { bool Bot::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 aa_id) {
bool Result = false; bool Result = false;
if(GetClass() == BARD) if(GetClass() == BARD)
cast_time = 0; cast_time = 0;
Result = Mob::DoCastSpell(spell_id, target_id, slot, cast_time, mana_cost, oSpellWillFinish, item_slot, aa_id); Result = Mob::DoCastSpell(spell_id, target_id, slot, cast_time, mana_cost, oSpellWillFinish, item_slot, aa_id);
@ -7263,7 +7260,7 @@ int32 Bot::GenerateBaseManaPoints() {
} }
else else
ConvertedWisInt = WisInt; ConvertedWisInt = WisInt;
if(GetLevel() < 41) { if(GetLevel() < 41) {
wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000); wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
base_mana = (GetLevel() * 15); base_mana = (GetLevel() * 15);
@ -7280,7 +7277,7 @@ int32 Bot::GenerateBaseManaPoints() {
MindLesserFactor = ((WisInt - 199) / 2); MindLesserFactor = ((WisInt - 199) / 2);
else else
MindLesserFactor = 0; MindLesserFactor = 0;
MindFactor = WisInt - MindLesserFactor; MindFactor = WisInt - MindLesserFactor;
if(WisInt > 100) if(WisInt > 100)
bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40); bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
@ -7297,7 +7294,7 @@ int32 Bot::GenerateBaseManaPoints() {
ConvertedWisInt -= ((WisInt - 201) * 5 / 4); ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
} else } else
ConvertedWisInt = WisInt; ConvertedWisInt = WisInt;
if(GetLevel() < 41) { if(GetLevel() < 41) {
wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000); wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
base_mana = (GetLevel() * 15); base_mana = (GetLevel() * 15);
@ -7314,7 +7311,7 @@ int32 Bot::GenerateBaseManaPoints() {
MindLesserFactor = ((WisInt - 199) / 2); MindLesserFactor = ((WisInt - 199) / 2);
else else
MindLesserFactor = 0; MindLesserFactor = 0;
MindFactor = (WisInt - MindLesserFactor); MindFactor = (WisInt - MindLesserFactor);
if(WisInt > 100) if(WisInt > 100)
bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40); bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
@ -7339,7 +7336,7 @@ bool Bot::DoFinishedSpellAETarget(uint16 spell_id, Mob* spellTarget, uint16 slot
if(GetClass() == BARD) { if(GetClass() == BARD) {
if(!ApplyNextBardPulse(bardsong, this, bardsong_slot)) if(!ApplyNextBardPulse(bardsong, this, bardsong_slot))
InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong); InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong);
stopLogic = true; stopLogic = true;
} }
return true; return true;
@ -7381,7 +7378,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, uint16
} }
else else
SpellOnTarget(thespell, g->members[i]); SpellOnTarget(thespell, g->members[i]);
if(g->members[i] && g->members[i]->GetPetID()) if(g->members[i] && g->members[i]->GetPetID())
SpellOnTarget(thespell, g->members[i]->GetPet()); SpellOnTarget(thespell, g->members[i]->GetPet());
} }
@ -7548,7 +7545,7 @@ int32 Bot::CalcSTR() {
int32 mod = aabonuses.STR; int32 mod = aabonuses.STR;
if(val > 255 && GetLevel() <= 60) if(val > 255 && GetLevel() <= 60)
val = 255; val = 255;
STR = (val + mod); STR = (val + mod);
if(STR < 1) if(STR < 1)
STR = 1; STR = 1;
@ -7565,7 +7562,7 @@ int32 Bot::CalcSTA() {
int32 mod = aabonuses.STA; int32 mod = aabonuses.STA;
if(val > 255 && GetLevel() <= 60) if(val > 255 && GetLevel() <= 60)
val = 255; val = 255;
STA = (val + mod); STA = (val + mod);
if(STA < 1) if(STA < 1)
STA = 1; STA = 1;
@ -7599,7 +7596,7 @@ int32 Bot::CalcDEX() {
int32 mod = aabonuses.DEX; int32 mod = aabonuses.DEX;
if(val > 255 && GetLevel() <= 60) if(val > 255 && GetLevel() <= 60)
val = 255; val = 255;
DEX = (val + mod); DEX = (val + mod);
if(DEX < 1) if(DEX < 1)
DEX = 1; DEX = 1;
@ -7616,12 +7613,12 @@ int32 Bot::CalcINT() {
int32 mod = aabonuses.INT; int32 mod = aabonuses.INT;
if(val > 255 && GetLevel() <= 60) if(val > 255 && GetLevel() <= 60)
val = 255; val = 255;
INT = (val + mod); INT = (val + mod);
if(INT < 1) if(INT < 1)
INT = 1; INT = 1;
int m = GetMaxINT(); int m = GetMaxINT();
if(INT > m) if(INT > m)
INT = m; INT = m;
@ -7634,7 +7631,7 @@ int32 Bot::CalcWIS() {
int32 mod = aabonuses.WIS; int32 mod = aabonuses.WIS;
if(val > 255 && GetLevel() <= 60) if(val > 255 && GetLevel() <= 60)
val = 255; val = 255;
WIS = (val + mod); WIS = (val + mod);
if(WIS < 1) if(WIS < 1)
@ -7652,7 +7649,7 @@ int32 Bot::CalcCHA() {
int32 mod = aabonuses.CHA; int32 mod = aabonuses.CHA;
if(val > 255 && GetLevel() <= 60) if(val > 255 && GetLevel() <= 60)
val = 255; val = 255;
CHA = (val + mod); CHA = (val + mod);
if(CHA < 1) if(CHA < 1)
@ -8049,10 +8046,10 @@ void Bot::DoEnduranceUpkeep() {
if(cost_redux > 0) { if(cost_redux > 0) {
if(upkeep <= cost_redux) if(upkeep <= cost_redux)
continue; continue;
upkeep -= cost_redux; upkeep -= cost_redux;
} }
if((upkeep+upkeep_sum) > GetEndurance()) if((upkeep+upkeep_sum) > GetEndurance())
BuffFadeBySlot(buffs_i); BuffFadeBySlot(buffs_i);
else else
@ -8196,7 +8193,7 @@ bool Bot::CanHeal() {
if(botSpell.SpellId != 0) if(botSpell.SpellId != 0)
result = true; result = true;
return result; return result;
} }
@ -9010,7 +9007,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if (!results.Success()) if (!results.Success())
return; return;
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
uint8 slotmaterial = Inventory::CalcMaterialFromSlot((uint8)slots[i]); uint8 slotmaterial = Inventory::CalcMaterialFromSlot((uint8)slots[i]);
c->GetTarget()->CastToBot()->SendWearChange(slotmaterial); c->GetTarget()->CastToBot()->SendWearChange(slotmaterial);
} }
@ -9030,7 +9027,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
return; return;
} }
if(!strcasecmp(sep->arg[1], "help") && !strcasecmp(sep->arg[2], "armorcolor")){ if(!strcasecmp(sep->arg[1], "help") && !strcasecmp(sep->arg[2], "armorcolor")){
c->Message(0, "-----------------#bot armorcolor help-----------------------------"); c->Message(0, "-----------------#bot armorcolor help-----------------------------");
c->Message(0, "Armor: -1(All), 2(Helm), 7(Arms), 9(Bracer), 12(Hands), 17(Chest/Robe), 18(Legs), 19(Boots)"); c->Message(0, "Armor: -1(All), 2(Helm), 7(Arms), 9(Bracer), 12(Hands), 17(Chest/Robe), 18(Legs), 19(Boots)");
@ -9504,7 +9501,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
failedLoreCheck = true; failedLoreCheck = true;
} }
} }
if(c->CheckLoreConflict(itm)) if(c->CheckLoreConflict(itm))
failedLoreCheck = true; failedLoreCheck = true;
} }
@ -9645,12 +9642,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
binder = g->members[i]; binder = g->members[i];
} }
} }
if(!hasbinder) if(!hasbinder)
c->Message(15, "You must have a Cleric in your group."); c->Message(15, "You must have a Cleric in your group.");
} }
} }
if(hasbinder) { if(hasbinder) {
binder->CastToBot()->BotGroupSay(binder->CastToBot(), "Attempting to bind you %s.", c->GetName()); binder->CastToBot()->BotGroupSay(binder->CastToBot(), "Attempting to bind you %s.", c->GetName());
binder->CastToNPC()->CastSpell(35, c->GetID(), 1, -1, -1); binder->CastToNPC()->CastSpell(35, c->GetID(), 1, -1, -1);
@ -9671,12 +9668,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
runeer = g->members[i]; runeer = g->members[i];
} }
} }
if(!hasruneer) if(!hasruneer)
c->Message(15, "You must have an Enchanter in your group."); c->Message(15, "You must have an Enchanter in your group.");
} }
} }
if(hasruneer) { if(hasruneer) {
if (c->GetLevel() <= 12) { if (c->GetLevel() <= 12) {
runeer->CastToBot()->BotGroupSay(runeer->CastToBot(), "I need to be level 13 or higher for this..."); runeer->CastToBot()->BotGroupSay(runeer->CastToBot(), "I need to be level 13 or higher for this...");
@ -9886,7 +9883,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
mezzer->CastToBot()->MesmerizeTarget(target); mezzer->CastToBot()->MesmerizeTarget(target);
} }
} }
if(!hasmezzer) if(!hasmezzer)
c->Message(15, "You must have an Enchanter in your group."); c->Message(15, "You must have an Enchanter in your group.");
} }
@ -9905,22 +9902,22 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
case ENCHANTER: case ENCHANTER:
if(casterlevel >= 15) if(casterlevel >= 15)
hascaster = true; hascaster = true;
break; break;
case WIZARD: case WIZARD:
if(casterlevel >= 14) if(casterlevel >= 14)
hascaster = true; hascaster = true;
break; break;
case NECROMANCER: case NECROMANCER:
if(casterlevel >= 17) if(casterlevel >= 17)
hascaster = true; hascaster = true;
break; break;
case MAGICIAN: case MAGICIAN:
if(casterlevel >= 13) if(casterlevel >= 13)
hascaster = true; hascaster = true;
break; break;
default: default:
break; break;
@ -9932,12 +9929,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
} }
} }
if(!hascaster) if(!hascaster)
c->Message(15, "You don't see anyone in your group that can cast Identify."); c->Message(15, "You don't see anyone in your group that can cast Identify.");
} else } else
c->Message(15, "You don't see anyone in your group that can cast Identify."); c->Message(15, "You don't see anyone in your group that can cast Identify.");
return; return;
} }
@ -9961,12 +9958,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
break; break;
} }
} }
if(!hasrezzer) if(!hasrezzer)
c->Message(15, "You must have a Cleric in your group!"); c->Message(15, "You must have a Cleric in your group!");
} else } else
c->Message(15, "You must have a Cleric in your group!"); c->Message(15, "You must have a Cleric in your group!");
return; return;
} }
@ -9979,7 +9976,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->GetTarget()->CastToBot()->BotGroupSay(c->GetTarget()->CastToBot(), "I don't have any pets yet."); c->GetTarget()->CastToBot()->BotGroupSay(c->GetTarget()->CastToBot(), "I don't have any pets yet.");
return; return;
} }
if(!strcasecmp(sep->arg[2], "water")) { if(!strcasecmp(sep->arg[2], "water")) {
c->GetTarget()->CastToBot()->SetPetChooserID(0); c->GetTarget()->CastToBot()->SetPetChooserID(0);
} else if(!strcasecmp(sep->arg[2], "fire")) { } else if(!strcasecmp(sep->arg[2], "fire")) {
@ -10007,7 +10004,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} else } else
c->GetTarget()->CastToBot()->SetPetChooserID(4); c->GetTarget()->CastToBot()->SetPetChooserID(4);
} }
if(c->GetTarget()->GetPet()) { if(c->GetTarget()->GetPet()) {
uint16 id = c->GetTarget()->GetPetID(); uint16 id = c->GetTarget()->GetPetID();
c->GetTarget()->SetPetID(0); c->GetTarget()->SetPetID(0);
@ -10016,7 +10013,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
} else } else
c->Message(15, "You must target your Magician bot!"); c->Message(15, "You must target your Magician bot!");
return; return;
} }
@ -10026,7 +10023,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(15, "You must select player with his corpse in the zone!"); c->Message(15, "You must select player with his corpse in the zone!");
return; return;
} }
if(c->IsGrouped()) { if(c->IsGrouped()) {
bool hassummoner = false; bool hassummoner = false;
Mob *t = c->GetTarget(); Mob *t = c->GetTarget();
@ -10060,10 +10057,10 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
} }
} }
if (!hassummoner) if (!hassummoner)
c->Message(15, "You must have a Necromancer or Shadow Knight in your group."); c->Message(15, "You must have a Necromancer or Shadow Knight in your group.");
return; return;
} }
} }
@ -10084,7 +10081,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(pacer->Bot_Command_CalmTarget(target)) { if(pacer->Bot_Command_CalmTarget(target)) {
if(target->FindType(SE_Lull) || target->FindType(SE_Harmony) || target->FindType(SE_InstantHate)) if(target->FindType(SE_Lull) || target->FindType(SE_Harmony) || target->FindType(SE_InstantHate))
c->Message(0, "I have successfully pacified %s.", target->GetCleanName()); c->Message(0, "I have successfully pacified %s.", target->GetCleanName());
return; return;
} else } else
c->Message(0, "I failed to pacify %s.", target->GetCleanName()); c->Message(0, "I failed to pacify %s.", target->GetCleanName());
@ -10097,7 +10094,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(pacer->Bot_Command_CalmTarget(target)) { if(pacer->Bot_Command_CalmTarget(target)) {
if(target->FindType(SE_Lull) || target->FindType(SE_Harmony) || target->FindType(SE_InstantHate)) if(target->FindType(SE_Lull) || target->FindType(SE_Harmony) || target->FindType(SE_InstantHate))
c->Message(0, "I have successfully pacified %s.", target->GetCleanName()); c->Message(0, "I have successfully pacified %s.", target->GetCleanName());
return; return;
} else } else
c->Message(0, "I failed to pacify %s.", target->GetCleanName()); c->Message(0, "I failed to pacify %s.", target->GetCleanName());
@ -10116,7 +10113,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(15, "You must select a monster!"); c->Message(15, "You must select a monster!");
return; return;
} }
uint32 DBtype = c->GetTarget()->GetBodyType(); uint32 DBtype = c->GetTarget()->GetBodyType();
Mob *Charmer; Mob *Charmer;
uint32 CharmerClass = 0; uint32 CharmerClass = 0;
@ -10202,7 +10199,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(15, "You must target your Enchanter, Necromancer, or Druid bot."); c->Message(15, "You must target your Enchanter, Necromancer, or Druid bot.");
} else } else
c->Message(15, "You must target an Enchanter, Necromancer, or Druid bot."); c->Message(15, "You must target an Enchanter, Necromancer, or Druid bot.");
return; return;
} }
@ -10290,18 +10287,18 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
evac = g->members[i]; evac = g->members[i];
} }
} }
if(!hasevac) if(!hasevac)
c->Message(15, "You must have a Druid in your group."); c->Message(15, "You must have a Druid in your group.");
} }
} }
if((hasevac) && (c->GetLevel() >= 18)) { if((hasevac) && (c->GetLevel() >= 18)) {
evac->CastToBot()->BotGroupSay(evac->CastToBot(), "Attempting to evacuate you, %s.", c->GetName()); evac->CastToBot()->BotGroupSay(evac->CastToBot(), "Attempting to evacuate you, %s.", c->GetName());
evac->CastToClient()->CastSpell(2183, c->GetID(), 1, -1, -1); evac->CastToClient()->CastSpell(2183, c->GetID(), 1, -1, -1);
} else if((hasevac) && (c->GetLevel() <= 17)) } else if((hasevac) && (c->GetLevel() <= 17))
evac->CastToBot()->BotGroupSay(evac->CastToBot(), "I'm not level 18 yet.", c->GetName()); evac->CastToBot()->BotGroupSay(evac->CastToBot(), "I'm not level 18 yet.", c->GetName());
return; return;
} }
@ -11470,7 +11467,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
for(int i = 0; i < MAX_GROUP_MEMBERS; i++) { for(int i = 0; i < MAX_GROUP_MEMBERS; i++) {
if(!g->members[i]) if(!g->members[i])
continue; continue;
if((g->members[i]->IsClient() && g->members[i]->CastToClient()->GetAggroCount()) || g->members[i]->IsEngaged()) { if((g->members[i]->IsClient() && g->members[i]->CastToClient()->GetAggroCount()) || g->members[i]->IsEngaged()) {
c->Message(0, "You can't spawn bots while your group is engaged."); c->Message(0, "You can't spawn bots while your group is engaged.");
return; return;
@ -11559,7 +11556,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(13, "Unable to create botgroup."); c->Message(13, "Unable to create botgroup.");
return; return;
} }
Group *newBotGroup = botGroupLeader->GetGroup(); Group *newBotGroup = botGroupLeader->GetGroup();
if(!newBotGroup) { if(!newBotGroup) {
c->Message(13, "Unable to find valid botgroup"); c->Message(13, "Unable to find valid botgroup");
@ -11576,7 +11573,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
safe_delete(botGroupMember); safe_delete(botGroupMember);
return; return;
} }
if(!botGroupMember) { if(!botGroupMember) {
safe_delete(botGroupMember); safe_delete(botGroupMember);
continue; continue;
@ -11664,15 +11661,15 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
float Size = target->GetSize(); float Size = target->GetSize();
if (!strcasecmp(sep->arg[1], "hair")) if (!strcasecmp(sep->arg[1], "hair"))
HairStyle = atoi(sep->arg[2]); HairStyle = atoi(sep->arg[2]);
if (!strcasecmp(sep->arg[1], "haircolor")) if (!strcasecmp(sep->arg[1], "haircolor"))
HairColor = atoi(sep->arg[2]); HairColor = atoi(sep->arg[2]);
if (!strcasecmp(sep->arg[1], "beard") || !strcasecmp(sep->arg[1], "beardcolor")) { if (!strcasecmp(sep->arg[1], "beard") || !strcasecmp(sep->arg[1], "beardcolor")) {
if (!Gender || Race == 8) { if (!Gender || Race == 8) {
if (!strcasecmp(sep->arg[1], "beard")) if (!strcasecmp(sep->arg[1], "beard"))
Beard = atoi(sep->arg[2]); Beard = atoi(sep->arg[2]);
if (!strcasecmp(sep->arg[1], "beardcolor")) if (!strcasecmp(sep->arg[1], "beardcolor"))
BeardColor = atoi(sep->arg[2]); BeardColor = atoi(sep->arg[2]);
} else { } else {
@ -11680,7 +11677,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
return; return;
} }
} }
if (!strcasecmp(sep->arg[1], "face")) if (!strcasecmp(sep->arg[1], "face"))
LuclinFace = atoi(sep->arg[2]); LuclinFace = atoi(sep->arg[2]);
@ -11688,19 +11685,19 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
EyeColor1 = EyeColor2 = atoi(sep->arg[2]); EyeColor1 = EyeColor2 = atoi(sep->arg[2]);
c->Message(0, "Eye Values = 0 - 11"); c->Message(0, "Eye Values = 0 - 11");
} }
if(!strcasecmp(sep->arg[1], "heritage") || !strcasecmp(sep->arg[1], "tattoo") || !strcasecmp(sep->arg[1], "details")) { if(!strcasecmp(sep->arg[1], "heritage") || !strcasecmp(sep->arg[1], "tattoo") || !strcasecmp(sep->arg[1], "details")) {
if(Race == 522) { if(Race == 522) {
if(!strcasecmp(sep->arg[1], "heritage")) { if(!strcasecmp(sep->arg[1], "heritage")) {
DrakkinHeritage = atoi(sep->arg[2]); DrakkinHeritage = atoi(sep->arg[2]);
c->Message(0, "Heritage Values = 0 - 6"); c->Message(0, "Heritage Values = 0 - 6");
} }
if(!strcasecmp(sep->arg[1], "tattoo")) { if(!strcasecmp(sep->arg[1], "tattoo")) {
DrakkinTattoo = atoi(sep->arg[2]); DrakkinTattoo = atoi(sep->arg[2]);
c->Message(0, "Tattoo Values = 0 - 7"); c->Message(0, "Tattoo Values = 0 - 7");
} }
if(!strcasecmp(sep->arg[1], "details")) { if(!strcasecmp(sep->arg[1], "details")) {
DrakkinDetails = atoi(sep->arg[2]); DrakkinDetails = atoi(sep->arg[2]);
c->Message(0, "Details Values = 0 - 7"); c->Message(0, "Details Values = 0 - 7");
@ -11847,7 +11844,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(13, "You must name a valid bot."); c->Message(13, "You must name a valid bot.");
} else } else
c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)"); c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)");
return; return;
} }
@ -11899,7 +11896,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
} else } else
c->Message(0, "Usage #bot groupmessages [on|off] [bot name|all]"); c->Message(0, "Usage #bot groupmessages [on|off] [bot name|all]");
return; return;
} }
@ -11967,7 +11964,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
tempBot->UseDiscipline(defensiveSpellID, tempBot->GetID()); tempBot->UseDiscipline(defensiveSpellID, tempBot->GetID());
} else } else
c->Message(13, "You must name a valid bot."); c->Message(13, "You must name a valid bot.");
return; return;
} }
@ -12555,7 +12552,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(0, "Usage #bot bardoutofcombat [on|off]"); c->Message(0, "Usage #bot bardoutofcombat [on|off]");
return; return;
} }
if(!strcasecmp(sep->arg[1], "showhelm")) { if(!strcasecmp(sep->arg[1], "showhelm")) {
bool showhelm = true; bool showhelm = true;
if (sep->arg[2]) { if (sep->arg[2]) {
@ -12567,10 +12564,10 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(0, "Usage #bot showhelm [on|off]"); c->Message(0, "Usage #bot showhelm [on|off]");
return; return;
} }
Mob *target = c->GetTarget(); Mob *target = c->GetTarget();
if (target && target->IsBot() && (c == target->GetOwner()->CastToClient())) { if (target && target->IsBot() && (c == target->GetOwner()->CastToClient())) {
Bot* b = target->CastToBot(); Bot* b = target->CastToBot();
if (b) { if (b) {
b->SetShowHelm(showhelm); b->SetShowHelm(showhelm);
c->Message(0, "Your bot will %s show their helmet.", (showhelm ? "now" : "no longer")); c->Message(0, "Your bot will %s show their helmet.", (showhelm ? "now" : "no longer"));
@ -12578,7 +12575,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} }
} else } else
c->Message(0, "Usage #bot showhelm [on|off]"); c->Message(0, "Usage #bot showhelm [on|off]");
return; return;
} }
} }
@ -12738,7 +12735,7 @@ Mob* EntityList::GetMobByBotID(uint32 botID) {
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) { for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
if(!it->second) if(!it->second)
continue; continue;
if(it->second->IsBot() && it->second->CastToBot()->GetBotID() == botID) { if(it->second->IsBot() && it->second->CastToBot()->GetBotID() == botID) {
Result = it->second; Result = it->second;
break; break;
@ -13032,7 +13029,7 @@ uint32 Bot::CalcCurrentWeight() {
for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) { for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) {
inst = GetBotItem(i); inst = GetBotItem(i);
if(inst) { if(inst) {
TempItem = inst->GetItem(); TempItem = inst->GetItem();
if (TempItem) if (TempItem)
Total += TempItem->Weight; Total += TempItem->Weight;
} }
@ -13041,7 +13038,7 @@ uint32 Bot::CalcCurrentWeight() {
float Packrat = ((float)spellbonuses.Packrat + (float)aabonuses.Packrat); float Packrat = ((float)spellbonuses.Packrat + (float)aabonuses.Packrat);
if (Packrat > 0) if (Packrat > 0)
Total = (uint32)((float)Total * (1.0f - ((Packrat * 1.0f) / 100.0f))); Total = (uint32)((float)Total * (1.0f - ((Packrat * 1.0f) / 100.0f)));
return Total; return Total;
} }
@ -13174,7 +13171,7 @@ void Bot::SetDefaultBotStance() {
BotStanceType defaultStance = BotStanceBalanced; BotStanceType defaultStance = BotStanceBalanced;
if (GetClass() == WARRIOR) if (GetClass() == WARRIOR)
defaultStance = BotStanceAggressive; defaultStance = BotStanceAggressive;
_baseBotStance = BotStancePassive; _baseBotStance = BotStancePassive;
_botStance = defaultStance; _botStance = defaultStance;
} }
@ -13324,21 +13321,21 @@ void Bot::SetPrevHealRotationMember( Bot* healer ) {
Bot* Bot::GetHealRotationLeader( ) { Bot* Bot::GetHealRotationLeader( ) {
if(_healRotationLeader) if(_healRotationLeader)
return entity_list.GetBotByBotID(_healRotationLeader); return entity_list.GetBotByBotID(_healRotationLeader);
return 0; return 0;
} }
Bot* Bot::GetNextHealRotationMember( ) { Bot* Bot::GetNextHealRotationMember( ) {
if(_healRotationMemberNext) if(_healRotationMemberNext)
return entity_list.GetBotByBotID(_healRotationMemberNext); return entity_list.GetBotByBotID(_healRotationMemberNext);
return 0; return 0;
} }
Bot* Bot::GetPrevHealRotationMember( ) { Bot* Bot::GetPrevHealRotationMember( ) {
if(_healRotationMemberNext) if(_healRotationMemberNext)
return entity_list.GetBotByBotID(_healRotationMemberPrev); return entity_list.GetBotByBotID(_healRotationMemberPrev);
return 0; return 0;
} }
@ -13352,7 +13349,7 @@ bool Bot::AddHealRotationTarget( Mob* target ) {
} else if(!strcasecmp(tempTarget->GetCleanName(), target->GetCleanName())) { } else if(!strcasecmp(tempTarget->GetCleanName(), target->GetCleanName())) {
if(tempTarget->GetID() != target->GetID()) if(tempTarget->GetID() != target->GetID())
_healRotationTargets[i] = target->GetID(); _healRotationTargets[i] = target->GetID();
return false; return false;
} }
} }