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();
if(cur_hp > max_hp)
cur_hp = max_hp;
if(cur_hp <= 0) {
SetHP(max_hp/5);
SetMana(0);
BuffFadeAll();
SpellOnTarget(756, this); // Rezz effects
}
if(cur_mana > max_mana)
cur_mana = max_mana;
cur_end = max_end;
}
@ -1140,7 +1140,7 @@ void Bot::GenerateArmorClass() {
iksarlevel -= 10;
if(iksarlevel > 25)
iksarlevel = 25;
if(iksarlevel > 0)
displayed += (iksarlevel * 12 / 10);
}
@ -1535,7 +1535,7 @@ bool Bot::IsBotNameAvailable(char *botName, std::string* errorMessage) {
*errorMessage = std::string(results.ErrorMessage());
return false;
}
if (results.RowCount())
return false;
@ -1568,7 +1568,7 @@ bool Bot::Save() {
auto botOwner = GetBotOwner();
if (botOwner)
botOwner->Message(13, results.ErrorMessage().c_str());
return false;
}
@ -1607,7 +1607,7 @@ bool Bot::Save() {
auto botOwner = GetBotOwner();
if (botOwner)
botOwner->Message(13, results.ErrorMessage().c_str());
return false;
}
SaveBuffs();
@ -2043,7 +2043,7 @@ void Bot::BotMeditate(bool isSitting) {
if(IsSitting())
Stand();
}
if(IsSitting()) {
if(!rest_timer.Enabled())
rest_timer.Start(RuleI(Character, RestRegenTimeToActivate) * 1000);
@ -2087,14 +2087,14 @@ void Bot::BotRangedAttack(Mob* other) {
BuffFadeByEffect(SE_Invisibility2);
invisible = false;
}
if(invisible_undead) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2);
invisible_undead = false;
}
if(invisible_animals) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
BuffFadeByEffect(SE_InvisVsAnimals);
@ -2218,11 +2218,11 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes
const Item_Struct* botweapon = 0;
if(inst)
botweapon = inst->GetItem();
if(botweapon) {
if(botweapon->ItemType == ItemTypeShield)
hate += botweapon->AC;
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;
if(inst)
botweapon = inst->GetItem();
if(botweapon)
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())
FaceTarget(GetTarget());
SetHasBeenSummoned(false);
} else if(!IsRooted()) {
if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) {
@ -2410,7 +2410,7 @@ void Bot::AI_Process() {
} else {
if(GetTarget())
FaceTarget(GetTarget());
SetHasBeenSummoned(false);
}
return;
@ -2619,7 +2619,7 @@ void Bot::AI_Process() {
entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_START, GetName());
this->berserk = true;
}
if (berserk && this->GetHPRatio() > 30) {
entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_END, GetName());
this->berserk = false;
@ -2846,16 +2846,16 @@ void Bot::PetAIProcess() {
aa_skill += botPet->GetOwner()->GetAA(aaWardersAlacrity);
if(aa_skill >= 1)
aa_chance += ((aa_skill > 5 ? 5 : aa_skill) * 4);
if(aa_skill >= 6)
aa_chance += ((aa_skill - 5 > 3 ? 3 : aa_skill - 5) * 7);
if(aa_skill >= 9)
aa_chance += ((aa_skill - 8 > 3 ? 3 : aa_skill - 8) * 3);
if(aa_skill >= 12)
aa_chance += ((aa_skill - 11) * 1);
//aa_chance += botPet->GetOwner()->GetAA(aaCompanionsAlacrity) * 3;
@ -3035,7 +3035,7 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
uint8 materialFromSlot = 0xFF;
for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) {
itemID = GetBotItemBySlot(i);
if(itemID != 0) {
if(itemID != 0) {
materialFromSlot = Inventory::CalcMaterialFromSlot(i);
if(materialFromSlot != 0xFF)
this->SendWearChange(materialFromSlot);
@ -3273,7 +3273,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(item) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialPrimary].Material = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialPrimary].Color = GetEquipmentColor(MaterialPrimary);
}
}
@ -3284,7 +3284,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
if(item) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialSecondary].Material = atoi(&item->IDFile[2]);
ns->spawn.colors[MaterialSecondary].Color = GetEquipmentColor(MaterialSecondary);
}
}
@ -4138,7 +4138,7 @@ bool Bot::Bot_Command_CharmTarget(int charmtype, Mob *target) {
charmid = 198;
else if((charmlevel >= 31) && (charmlevel <= 46))
charmid = 197;
else if((charmlevel >= 18) && (charmlevel <= 30))
else if((charmlevel >= 18) && (charmlevel <= 30))
charmid = 196;
break;
case 3: // Druid
@ -4240,7 +4240,7 @@ bool Bot::Bot_Command_RezzTarget(Mob *target) {
rezid = 2172;
else if(rezlevel >= 37)
rezid = 388;
else if(rezlevel >= 32)
else if(rezlevel >= 32)
rezid = 2171;
else if(rezlevel >= 27)
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" };
bool success = false;
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 (j == 22)
j = 9999;
how_many_slots++;
if(!GetBotItem(j)) {
if(j == MainPrimary) {
@ -4447,7 +4447,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
if((mWeaponItem->Slots & (1 << j))) {
if (j == 22)
j = 9999;
swap_item = GetBotItem(j);
failedLoreCheck = false;
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());
parse->EventNPC(EVENT_ATTACK, this, from, "", 0);
}
attacked_timer.Start(CombatEventTimer_expire);
// if spell is lifetap add hp to the caster
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(this->GetOwnerID())
entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName());
if(other) {
RemoveFromHateList(other);
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.");
return false;
}
FaceTarget(GetTarget());
ItemInst* weapon = nullptr;
if(Hand == MainPrimary) {
weapon = GetBotItem(MainPrimary);
OffHandAtk(false);
}
if(Hand == MainSecondary) {
weapon = GetBotItem(MainSecondary);
OffHandAtk(true);
@ -4731,7 +4731,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
uint32 hate = 0;
if (weapon)
hate = (weapon->GetItem()->Damage + weapon->GetItem()->ElemDmgAmt);
int weapon_damage = GetWeaponDamage(other, weapon, &hate);
if (hate == 0 && weapon_damage > 1)
hate = weapon_damage;
@ -4896,14 +4896,14 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
BuffFadeByEffect(SE_Invisibility2);
invisible = false;
}
if(invisible_undead) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2);
invisible_undead = false;
}
if(invisible_animals){
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
BuffFadeByEffect(SE_InvisVsAnimals);
@ -4963,7 +4963,7 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint32 points, uint16
base1 = eff.base1;
base2 = eff.base2;
slot = eff.slot;
//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.
//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: {
if(type == focusTwincast)
value = base1;
}
break;
}
/*
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
int32 cast_time = GetActSpellCasttime(spell_id, spells[spell_id].cast_time);
GetSympatheticProcChances(ProcBonus, ProcChance, cast_time, ProcRateMod);
if(zone->random.Real(0, 1) <= ProcChance)
value = focus_id;
else
value = 0;
}
@ -5247,7 +5245,6 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint32 points, uint16
value = base1;
break;
}
}
//Check for spell skill limits.
if ((LimitSpellSkill) && (!SpellSkill_Found))
@ -5289,7 +5286,7 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) {
ItemInst* ins = GetBotItem(x);
if (!ins)
continue;
TempItem = ins->GetItem();
if (TempItem && TempItem->Focus.Effect > 0 && TempItem->Focus.Effect != SPELL_UNKNOWN) {
if(rand_effectiveness) {
@ -5400,7 +5397,7 @@ int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) {
aa_value = aa.second.first;
if (aa_AA < 1 || aa_value < 1)
continue;
Total3 = CalcBotAAFocus(bottype, aa_AA, aa_value, spell_id);
if (Total3 > 0 && realTotal3 >= 0 && Total3 > realTotal3) {
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])
return 0;
break;
case SE_LimitCastTimeMin:
if (spells[spell_id].cast_time < (uint32)focus_spell.base[i])
return 0;
@ -5501,8 +5498,8 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
return 0;
}
break;
case SE_LimitSpellType:
switch(focus_spell.base[i]) {
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]);
}
break;
case SE_LimitManaMin:
if(spell.mana < focus_spell.base[i])
return 0;
@ -5712,19 +5709,19 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel
case SE_FcBaseEffects: {
if (bottype == BotfocusFcBaseEffects)
value = focus_spell.base[i];
break;
}
case SE_FcDamagePctCrit: {
if(bottype == BotfocusFcDamagePctCrit)
value = focus_spell.base[i];
break;
}
case SE_FcIncreaseNumHits: {
if(bottype == BotfocusIncreaseNumHits)
value = focus_spell.base[i];
break;
}
default:
@ -5791,7 +5788,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) {
damage = -3;
Log.Out(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack.");
}
float riposte_chance = 0.0f;
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);
@ -5802,7 +5799,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) {
RollTable[0] = (bonus + (itembonuses.HeroicDEX / 25));
}
}
bool bBlockFromRear = false;
bool bShieldBlockFromRear = false;
if (this->IsBot()) {
@ -5894,7 +5891,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) {
if (damage < 0)
return true;
return false;
}
@ -5977,11 +5974,11 @@ void Bot::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage,
const Item_Struct* botweapon = 0;
if(inst)
botweapon = inst->GetItem();
if(botweapon) {
if(botweapon->ItemType == ItemTypeShield)
hate += botweapon->AC;
hate = (hate * (100 + GetFuriousBash(botweapon->Focus.Effect)) / 100);
}
}
@ -6046,7 +6043,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) {
const Item_Struct* botpiercer = nullptr;
if(inst)
botpiercer = inst->GetItem();
if(!botpiercer || (botpiercer->ItemType != ItemType1HPiercing)) {
BotGroupSay(this, "I can't backstab with this weapon!");
return;
@ -6218,7 +6215,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) {
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))
canBash = true;
if(!canBash || zone->random.Int(0, 100) > 25)
skill_to_use = SkillKick;
else
@ -6671,7 +6668,7 @@ void Bot::SetAttackTimer() {
} else {
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));
TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true);
@ -6982,7 +6979,7 @@ int32 Bot::GetActSpellDuration(uint16 spell_id, int32 duration) {
increase += 30;
if (GetAA(aaSpellCastingReinforcementMastery) == 1)
increase += 20;
break;
}
@ -7001,7 +6998,7 @@ float Bot::GetAOERange(uint16 spell_id) {
range = spells[spell_id].aoerange;
if(range == 0)
range = spells[spell_id].range;
if(range == 0)
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() );
if(IsSilenced() && !IsDiscipline(spell_id))
Message_StringID(13, SILENCED_STRING);
if(IsAmnesiad() && IsDiscipline(spell_id))
Message_StringID(13, MELEE_SILENCE);
if(casting_spell_id)
AI_Event_SpellCastFinished(false, casting_spell_slot);
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);
if(casting_spell_id)
AI_Event_SpellCastFinished(false, casting_spell_slot);
return false;
}
@ -7073,7 +7070,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t
InterruptSpell(173, 0x121, false);
return false;
}
if(slot < MAX_PP_MEMSPELL && !CheckFizzle(spell_id)) {
int fizzle_msg = IsBardSong(spell_id) ? MISS_NOTE : SPELL_FIZZLE;
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 Result = false;
if(GetClass() == BARD)
if(GetClass() == BARD)
cast_time = 0;
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
ConvertedWisInt = WisInt;
if(GetLevel() < 41) {
wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
base_mana = (GetLevel() * 15);
@ -7280,7 +7277,7 @@ int32 Bot::GenerateBaseManaPoints() {
MindLesserFactor = ((WisInt - 199) / 2);
else
MindLesserFactor = 0;
MindFactor = WisInt - MindLesserFactor;
if(WisInt > 100)
bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
@ -7297,7 +7294,7 @@ int32 Bot::GenerateBaseManaPoints() {
ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
} else
ConvertedWisInt = WisInt;
if(GetLevel() < 41) {
wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
base_mana = (GetLevel() * 15);
@ -7314,7 +7311,7 @@ int32 Bot::GenerateBaseManaPoints() {
MindLesserFactor = ((WisInt - 199) / 2);
else
MindLesserFactor = 0;
MindFactor = (WisInt - MindLesserFactor);
if(WisInt > 100)
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(!ApplyNextBardPulse(bardsong, this, bardsong_slot))
InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong);
stopLogic = true;
}
return true;
@ -7381,7 +7378,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, uint16
}
else
SpellOnTarget(thespell, g->members[i]);
if(g->members[i] && g->members[i]->GetPetID())
SpellOnTarget(thespell, g->members[i]->GetPet());
}
@ -7548,7 +7545,7 @@ int32 Bot::CalcSTR() {
int32 mod = aabonuses.STR;
if(val > 255 && GetLevel() <= 60)
val = 255;
STR = (val + mod);
if(STR < 1)
STR = 1;
@ -7565,7 +7562,7 @@ int32 Bot::CalcSTA() {
int32 mod = aabonuses.STA;
if(val > 255 && GetLevel() <= 60)
val = 255;
STA = (val + mod);
if(STA < 1)
STA = 1;
@ -7599,7 +7596,7 @@ int32 Bot::CalcDEX() {
int32 mod = aabonuses.DEX;
if(val > 255 && GetLevel() <= 60)
val = 255;
DEX = (val + mod);
if(DEX < 1)
DEX = 1;
@ -7616,12 +7613,12 @@ int32 Bot::CalcINT() {
int32 mod = aabonuses.INT;
if(val > 255 && GetLevel() <= 60)
val = 255;
INT = (val + mod);
if(INT < 1)
INT = 1;
int m = GetMaxINT();
if(INT > m)
INT = m;
@ -7634,7 +7631,7 @@ int32 Bot::CalcWIS() {
int32 mod = aabonuses.WIS;
if(val > 255 && GetLevel() <= 60)
val = 255;
WIS = (val + mod);
if(WIS < 1)
@ -7652,7 +7649,7 @@ int32 Bot::CalcCHA() {
int32 mod = aabonuses.CHA;
if(val > 255 && GetLevel() <= 60)
val = 255;
CHA = (val + mod);
if(CHA < 1)
@ -8049,10 +8046,10 @@ void Bot::DoEnduranceUpkeep() {
if(cost_redux > 0) {
if(upkeep <= cost_redux)
continue;
upkeep -= cost_redux;
}
if((upkeep+upkeep_sum) > GetEndurance())
BuffFadeBySlot(buffs_i);
else
@ -8196,7 +8193,7 @@ bool Bot::CanHeal() {
if(botSpell.SpellId != 0)
result = true;
return result;
}
@ -9010,7 +9007,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if (!results.Success())
return;
for (int i = 0; i < 7; i++) {
for (int i = 0; i < 7; i++) {
uint8 slotmaterial = Inventory::CalcMaterialFromSlot((uint8)slots[i]);
c->GetTarget()->CastToBot()->SendWearChange(slotmaterial);
}
@ -9030,7 +9027,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
return;
}
if(!strcasecmp(sep->arg[1], "help") && !strcasecmp(sep->arg[2], "armorcolor")){
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)");
@ -9504,7 +9501,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
failedLoreCheck = true;
}
}
if(c->CheckLoreConflict(itm))
failedLoreCheck = true;
}
@ -9645,12 +9642,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
binder = g->members[i];
}
}
if(!hasbinder)
c->Message(15, "You must have a Cleric in your group.");
}
}
if(hasbinder) {
binder->CastToBot()->BotGroupSay(binder->CastToBot(), "Attempting to bind you %s.", c->GetName());
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];
}
}
if(!hasruneer)
c->Message(15, "You must have an Enchanter in your group.");
}
}
if(hasruneer) {
if (c->GetLevel() <= 12) {
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);
}
}
if(!hasmezzer)
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:
if(casterlevel >= 15)
hascaster = true;
break;
case WIZARD:
if(casterlevel >= 14)
hascaster = true;
break;
case NECROMANCER:
if(casterlevel >= 17)
hascaster = true;
break;
case MAGICIAN:
if(casterlevel >= 13)
hascaster = true;
break;
default:
break;
@ -9932,12 +9929,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
}
}
if(!hascaster)
c->Message(15, "You don't see anyone in your group that can cast Identify.");
} else
c->Message(15, "You don't see anyone in your group that can cast Identify.");
return;
}
@ -9961,12 +9958,12 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
break;
}
}
if(!hasrezzer)
c->Message(15, "You must have a Cleric in your group!");
} else
c->Message(15, "You must have a Cleric in your group!");
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.");
return;
}
if(!strcasecmp(sep->arg[2], "water")) {
c->GetTarget()->CastToBot()->SetPetChooserID(0);
} else if(!strcasecmp(sep->arg[2], "fire")) {
@ -10007,7 +10004,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
} else
c->GetTarget()->CastToBot()->SetPetChooserID(4);
}
if(c->GetTarget()->GetPet()) {
uint16 id = c->GetTarget()->GetPetID();
c->GetTarget()->SetPetID(0);
@ -10016,7 +10013,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
} else
c->Message(15, "You must target your Magician bot!");
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!");
return;
}
if(c->IsGrouped()) {
bool hassummoner = false;
Mob *t = c->GetTarget();
@ -10060,10 +10057,10 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
}
}
if (!hassummoner)
c->Message(15, "You must have a Necromancer or Shadow Knight in your group.");
return;
}
}
@ -10084,7 +10081,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
if(pacer->Bot_Command_CalmTarget(target)) {
if(target->FindType(SE_Lull) || target->FindType(SE_Harmony) || target->FindType(SE_InstantHate))
c->Message(0, "I have successfully pacified %s.", target->GetCleanName());
return;
} else
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(target->FindType(SE_Lull) || target->FindType(SE_Harmony) || target->FindType(SE_InstantHate))
c->Message(0, "I have successfully pacified %s.", target->GetCleanName());
return;
} else
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!");
return;
}
uint32 DBtype = c->GetTarget()->GetBodyType();
Mob *Charmer;
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.");
} else
c->Message(15, "You must target an Enchanter, Necromancer, or Druid bot.");
return;
}
@ -10290,18 +10287,18 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
evac = g->members[i];
}
}
if(!hasevac)
c->Message(15, "You must have a Druid in your group.");
}
}
if((hasevac) && (c->GetLevel() >= 18)) {
evac->CastToBot()->BotGroupSay(evac->CastToBot(), "Attempting to evacuate you, %s.", c->GetName());
evac->CastToClient()->CastSpell(2183, c->GetID(), 1, -1, -1);
} else if((hasevac) && (c->GetLevel() <= 17))
evac->CastToBot()->BotGroupSay(evac->CastToBot(), "I'm not level 18 yet.", c->GetName());
return;
}
@ -11470,7 +11467,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
for(int i = 0; i < MAX_GROUP_MEMBERS; i++) {
if(!g->members[i])
continue;
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.");
return;
@ -11559,7 +11556,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(13, "Unable to create botgroup.");
return;
}
Group *newBotGroup = botGroupLeader->GetGroup();
if(!newBotGroup) {
c->Message(13, "Unable to find valid botgroup");
@ -11576,7 +11573,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
safe_delete(botGroupMember);
return;
}
if(!botGroupMember) {
safe_delete(botGroupMember);
continue;
@ -11664,15 +11661,15 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
float Size = target->GetSize();
if (!strcasecmp(sep->arg[1], "hair"))
HairStyle = atoi(sep->arg[2]);
if (!strcasecmp(sep->arg[1], "haircolor"))
HairColor = atoi(sep->arg[2]);
if (!strcasecmp(sep->arg[1], "beard") || !strcasecmp(sep->arg[1], "beardcolor")) {
if (!Gender || Race == 8) {
if (!strcasecmp(sep->arg[1], "beard"))
Beard = atoi(sep->arg[2]);
if (!strcasecmp(sep->arg[1], "beardcolor"))
BeardColor = atoi(sep->arg[2]);
} else {
@ -11680,7 +11677,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
return;
}
}
if (!strcasecmp(sep->arg[1], "face"))
LuclinFace = atoi(sep->arg[2]);
@ -11688,19 +11685,19 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
EyeColor1 = EyeColor2 = atoi(sep->arg[2]);
c->Message(0, "Eye Values = 0 - 11");
}
if(!strcasecmp(sep->arg[1], "heritage") || !strcasecmp(sep->arg[1], "tattoo") || !strcasecmp(sep->arg[1], "details")) {
if(Race == 522) {
if(!strcasecmp(sep->arg[1], "heritage")) {
DrakkinHeritage = atoi(sep->arg[2]);
c->Message(0, "Heritage Values = 0 - 6");
}
if(!strcasecmp(sep->arg[1], "tattoo")) {
DrakkinTattoo = atoi(sep->arg[2]);
c->Message(0, "Tattoo Values = 0 - 7");
}
if(!strcasecmp(sep->arg[1], "details")) {
DrakkinDetails = atoi(sep->arg[2]);
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.");
} else
c->Message(0, "Usage #bot stance [name] [stance (id)] (Passive = 0, Balanced = 1, Efficient = 2, Reactive = 3, Aggressive = 4, Burn = 5, BurnAE = 6)");
return;
}
@ -11899,7 +11896,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
}
} else
c->Message(0, "Usage #bot groupmessages [on|off] [bot name|all]");
return;
}
@ -11967,7 +11964,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
tempBot->UseDiscipline(defensiveSpellID, tempBot->GetID());
} else
c->Message(13, "You must name a valid bot.");
return;
}
@ -12555,7 +12552,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(0, "Usage #bot bardoutofcombat [on|off]");
return;
}
if(!strcasecmp(sep->arg[1], "showhelm")) {
bool showhelm = true;
if (sep->arg[2]) {
@ -12567,10 +12564,10 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
c->Message(0, "Usage #bot showhelm [on|off]");
return;
}
Mob *target = c->GetTarget();
if (target && target->IsBot() && (c == target->GetOwner()->CastToClient())) {
Bot* b = target->CastToBot();
Bot* b = target->CastToBot();
if (b) {
b->SetShowHelm(showhelm);
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
c->Message(0, "Usage #bot showhelm [on|off]");
return;
}
}
@ -12738,7 +12735,7 @@ Mob* EntityList::GetMobByBotID(uint32 botID) {
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
if(!it->second)
continue;
if(it->second->IsBot() && it->second->CastToBot()->GetBotID() == botID) {
Result = it->second;
break;
@ -13032,7 +13029,7 @@ uint32 Bot::CalcCurrentWeight() {
for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) {
inst = GetBotItem(i);
if(inst) {
TempItem = inst->GetItem();
TempItem = inst->GetItem();
if (TempItem)
Total += TempItem->Weight;
}
@ -13041,7 +13038,7 @@ uint32 Bot::CalcCurrentWeight() {
float Packrat = ((float)spellbonuses.Packrat + (float)aabonuses.Packrat);
if (Packrat > 0)
Total = (uint32)((float)Total * (1.0f - ((Packrat * 1.0f) / 100.0f)));
return Total;
}
@ -13174,7 +13171,7 @@ void Bot::SetDefaultBotStance() {
BotStanceType defaultStance = BotStanceBalanced;
if (GetClass() == WARRIOR)
defaultStance = BotStanceAggressive;
_baseBotStance = BotStancePassive;
_botStance = defaultStance;
}
@ -13324,21 +13321,21 @@ void Bot::SetPrevHealRotationMember( Bot* healer ) {
Bot* Bot::GetHealRotationLeader( ) {
if(_healRotationLeader)
return entity_list.GetBotByBotID(_healRotationLeader);
return 0;
}
Bot* Bot::GetNextHealRotationMember( ) {
if(_healRotationMemberNext)
return entity_list.GetBotByBotID(_healRotationMemberNext);
return 0;
}
Bot* Bot::GetPrevHealRotationMember( ) {
if(_healRotationMemberNext)
return entity_list.GetBotByBotID(_healRotationMemberPrev);
return 0;
}
@ -13352,7 +13349,7 @@ bool Bot::AddHealRotationTarget( Mob* target ) {
} else if(!strcasecmp(tempTarget->GetCleanName(), target->GetCleanName())) {
if(tempTarget->GetID() != target->GetID())
_healRotationTargets[i] = target->GetID();
return false;
}
}