mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 16:41:29 +00:00
Rework Bot::GetBotArcheryRange
This commit is contained in:
parent
baf2f23ce6
commit
811872c17f
50
zone/bot.cpp
50
zone/bot.cpp
@ -234,45 +234,28 @@ void Bot::SetBotSpellID(uint32 newSpellID) {
|
|||||||
this->npc_spells_id = newSpellID;
|
this->npc_spells_id = newSpellID;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Bot::GetBotArcheryRange() {
|
uint32 Bot::GetBotArcheryRange()
|
||||||
uint32 result = 0;
|
{
|
||||||
|
const ItemInst *range_inst = GetBotItem(MainRange);
|
||||||
|
const ItemInst *ammo_inst = GetBotItem(MainAmmo);
|
||||||
|
|
||||||
ItemInst* rangeItem = GetBotItem(MainRange);
|
// empty slots
|
||||||
|
if (!range_inst || !ammo_inst)
|
||||||
if(!rangeItem)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const Item_Struct* botweapon = rangeItem->GetItem();
|
const Item_Struct *range_item = range_inst->GetItem();
|
||||||
|
const Item_Struct *ammo_item = ammo_inst->GetItem();
|
||||||
|
|
||||||
uint32 archeryMaterial;
|
// no item struct for whatever reason
|
||||||
uint32 archeryColor;
|
if (!range_item || !ammo_item)
|
||||||
uint32 archeryBowID;
|
|
||||||
uint32 archeryAmmoID;
|
|
||||||
|
|
||||||
if(botweapon && botweapon->ItemType == ItemTypeBow) {
|
|
||||||
uint32 range = 0;
|
|
||||||
|
|
||||||
archeryMaterial = atoi(botweapon->IDFile + 2);
|
|
||||||
archeryBowID = botweapon->ID;
|
|
||||||
archeryColor = botweapon->Color;
|
|
||||||
range =+ botweapon->Range;
|
|
||||||
|
|
||||||
rangeItem = GetBotItem(MainAmmo);
|
|
||||||
if(rangeItem)
|
|
||||||
botweapon = rangeItem->GetItem();
|
|
||||||
|
|
||||||
if(!botweapon || (botweapon->ItemType != ItemTypeArrow)) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
range += botweapon->Range;
|
// bad item types
|
||||||
|
if (range_item->ItemType != ItemTypeBow || ammo_item->ItemType != ItemTypeArrow)
|
||||||
|
return 0;
|
||||||
|
|
||||||
archeryAmmoID = botweapon->ID;
|
// everything is good!
|
||||||
|
return range_item->Range + ammo_item->Range;
|
||||||
result = range;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::ChangeBotArcherWeapons(bool isArcher) {
|
void Bot::ChangeBotArcherWeapons(bool isArcher) {
|
||||||
@ -14364,8 +14347,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<BotGroup>::iterator botGroupItr = botGroup.begin();
|
for(auto botGroupItr = botGroup.begin(); botGroupItr != botGroup.end(); ++botGroupItr) {
|
||||||
for(botGroupItr; botGroupItr != botGroup.end(); ++botGroupItr) {
|
|
||||||
// Don't try to re-spawn the botgroup's leader.
|
// Don't try to re-spawn the botgroup's leader.
|
||||||
if(botGroupItr->BotID == botGroupLeader->GetBotID()) { continue; }
|
if(botGroupItr->BotID == botGroupLeader->GetBotID()) { continue; }
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user