mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Enhance equip upgrade
This commit is contained in:
@@ -3370,8 +3370,11 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destoryOld)
|
|||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 requiredLevel = spellInfo->BaseLevel;
|
if (!item->IsFitToSpellRequirements(spellInfo)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 requiredLevel = spellInfo->BaseLevel;
|
||||||
if (requiredLevel > bot->GetLevel()) {
|
if (requiredLevel > bot->GetLevel()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -3385,9 +3388,6 @@ void PlayerbotFactory::ApplyEnchantAndGemsNew(bool destoryOld)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!item->IsFitToSpellRequirements(spellInfo)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||||
{
|
{
|
||||||
@@ -3604,6 +3604,32 @@ float PlayerbotFactory::CalculateItemScore(uint32 item_id, Player* bot)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (uint8 j = 0; j < MAX_ITEM_PROTO_SPELLS; j++)
|
||||||
|
{
|
||||||
|
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Spells[j].SpellId);
|
||||||
|
if (!spellInfo)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (uint8 i = 0 ; i < 3; i++)
|
||||||
|
{
|
||||||
|
if (spellInfo->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA)
|
||||||
|
{
|
||||||
|
switch (spellInfo->Effects[i].ApplyAuraName)
|
||||||
|
{
|
||||||
|
case SPELL_AURA_MOD_DAMAGE_DONE:
|
||||||
|
// case SPELL_AURA_MOD_HEALING_DONE: duplicated
|
||||||
|
spell_power += spellInfo->Effects[i].BasePoints + 1;
|
||||||
|
break;
|
||||||
|
case SPELL_AURA_MOD_ATTACK_POWER:
|
||||||
|
attack_power += spellInfo->Effects[i].BasePoints + 1;
|
||||||
|
case SPELL_AURA_MOD_SHIELD_BLOCKVALUE:
|
||||||
|
block += spellInfo->Effects[i].BasePoints + 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Basic score
|
// Basic score
|
||||||
float score = (agility + strength + intellect + spirit + stamina + defense + dodge + parry + block +
|
float score = (agility + strength + intellect + spirit + stamina + defense + dodge + parry + block +
|
||||||
resilience + hit + crit + haste + expertise + attack_power + mana_regeneration + spell_power + armor_penetration +
|
resilience + hit + crit + haste + expertise + attack_power + mana_regeneration + spell_power + armor_penetration +
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ class ChatActionContext : public NamedObjectContext<Action>
|
|||||||
creators["de"] = &ChatActionContext::dead;
|
creators["de"] = &ChatActionContext::dead;
|
||||||
creators["trainer"] = &ChatActionContext::trainer;
|
creators["trainer"] = &ChatActionContext::trainer;
|
||||||
creators["maintenance"] = &ChatActionContext::maintenance;
|
creators["maintenance"] = &ChatActionContext::maintenance;
|
||||||
|
creators["equip upgrade"] = &ChatActionContext::equip_upgrade;
|
||||||
creators["attack my target"] = &ChatActionContext::attack_my_target;
|
creators["attack my target"] = &ChatActionContext::attack_my_target;
|
||||||
creators["chat"] = &ChatActionContext::chat;
|
creators["chat"] = &ChatActionContext::chat;
|
||||||
creators["home"] = &ChatActionContext::home;
|
creators["home"] = &ChatActionContext::home;
|
||||||
@@ -213,6 +214,7 @@ class ChatActionContext : public NamedObjectContext<Action>
|
|||||||
static Action* attack_my_target(PlayerbotAI* botAI) { return new AttackMyTargetAction(botAI); }
|
static Action* attack_my_target(PlayerbotAI* botAI) { return new AttackMyTargetAction(botAI); }
|
||||||
static Action* trainer(PlayerbotAI* botAI) { return new TrainerAction(botAI); }
|
static Action* trainer(PlayerbotAI* botAI) { return new TrainerAction(botAI); }
|
||||||
static Action* maintenance(PlayerbotAI* botAI) { return new MaintenanceAction(botAI); }
|
static Action* maintenance(PlayerbotAI* botAI) { return new MaintenanceAction(botAI); }
|
||||||
|
static Action* equip_upgrade(PlayerbotAI* botAI) { return new EquipUpgradeAction(botAI); }
|
||||||
static Action* co(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI); }
|
static Action* co(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI); }
|
||||||
static Action* nc(PlayerbotAI* botAI) { return new ChangeNonCombatStrategyAction(botAI); }
|
static Action* nc(PlayerbotAI* botAI) { return new ChangeNonCombatStrategyAction(botAI); }
|
||||||
static Action* dead(PlayerbotAI* botAI) { return new ChangeDeadStrategyAction(botAI); }
|
static Action* dead(PlayerbotAI* botAI) { return new ChangeDeadStrategyAction(botAI); }
|
||||||
|
|||||||
@@ -129,3 +129,20 @@ bool EquipUpgradesAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EquipUpgradeAction::Execute(Event event)
|
||||||
|
{
|
||||||
|
ListItemsVisitor visitor;
|
||||||
|
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||||
|
|
||||||
|
ItemIds items;
|
||||||
|
for (std::map<uint32, uint32>::iterator i = visitor.items.begin(); i != visitor.items.end(); ++i)
|
||||||
|
{
|
||||||
|
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", i->first);
|
||||||
|
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
|
||||||
|
{
|
||||||
|
items.insert(i->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EquipItems(items);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,4 +34,13 @@ class EquipUpgradesAction : public EquipAction
|
|||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class EquipUpgradeAction : public EquipAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EquipUpgradeAction(PlayerbotAI* botAI, std::string const name = "equip upgrade") : EquipAction(botAI, name) { }
|
||||||
|
|
||||||
|
bool Execute(Event event) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ ChatCommandHandlerStrategy::ChatCommandHandlerStrategy(PlayerbotAI* botAI) : Pas
|
|||||||
supported.push_back("de");
|
supported.push_back("de");
|
||||||
supported.push_back("trainer");
|
supported.push_back("trainer");
|
||||||
supported.push_back("maintenance");
|
supported.push_back("maintenance");
|
||||||
|
supported.push_back("equip upgrade");
|
||||||
supported.push_back("chat");
|
supported.push_back("chat");
|
||||||
supported.push_back("home");
|
supported.push_back("home");
|
||||||
supported.push_back("destroy");
|
supported.push_back("destroy");
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class RacialsStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
|
|||||||
void RacialsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void RacialsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
{
|
{
|
||||||
triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("lifeblood", 71.0f), nullptr)));
|
triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("lifeblood", 71.0f), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("war stomp", 71.0f), nullptr)));
|
// triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("war stomp", 71.0f), nullptr)));
|
||||||
/*triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("war stomp", 71.0f), nullptr)));*/
|
/*triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("war stomp", 71.0f), nullptr)));*/
|
||||||
/*triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("arcane torrent", ACTION_EMERGENCY + 6), nullptr)));
|
/*triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("arcane torrent", ACTION_EMERGENCY + 6), nullptr)));
|
||||||
triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("mana tap", ACTION_EMERGENCY + 6), nullptr)));*/
|
triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("mana tap", ACTION_EMERGENCY + 6), nullptr)));*/
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class ChatTriggerContext : public NamedObjectContext<Trigger>
|
|||||||
creators["de"] = &ChatTriggerContext::dead;
|
creators["de"] = &ChatTriggerContext::dead;
|
||||||
creators["trainer"] = &ChatTriggerContext::trainer;
|
creators["trainer"] = &ChatTriggerContext::trainer;
|
||||||
creators["maintenance"] = &ChatTriggerContext::maintenance;
|
creators["maintenance"] = &ChatTriggerContext::maintenance;
|
||||||
|
creators["equip upgrade"] = &ChatTriggerContext::equip_upgrade;
|
||||||
creators["attack"] = &ChatTriggerContext::attack;
|
creators["attack"] = &ChatTriggerContext::attack;
|
||||||
creators["chat"] = &ChatTriggerContext::chat;
|
creators["chat"] = &ChatTriggerContext::chat;
|
||||||
creators["accept"] = &ChatTriggerContext::accept;
|
creators["accept"] = &ChatTriggerContext::accept;
|
||||||
@@ -166,6 +167,7 @@ class ChatTriggerContext : public NamedObjectContext<Trigger>
|
|||||||
static Trigger* attack(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "attack"); }
|
static Trigger* attack(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "attack"); }
|
||||||
static Trigger* trainer(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "trainer"); }
|
static Trigger* trainer(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "trainer"); }
|
||||||
static Trigger* maintenance(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "maintenance"); }
|
static Trigger* maintenance(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "maintenance"); }
|
||||||
|
static Trigger* equip_upgrade(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "equip upgrade"); }
|
||||||
static Trigger* co(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "co"); }
|
static Trigger* co(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "co"); }
|
||||||
static Trigger* nc(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "nc"); }
|
static Trigger* nc(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "nc"); }
|
||||||
static Trigger* dead(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "de"); }
|
static Trigger* dead(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "de"); }
|
||||||
|
|||||||
Reference in New Issue
Block a user