Esempio n. 1
0
/* Try to put Point in a specific column.
 * Returns actual Point column.
 */
int bmakecol(int col)
{
	int tcol = 0;

	if (bcrsearch(Bbuff, '\n'))
		bmove1(Bbuff);
	while (tcol < col && Buff() != '\n' && !bisend(Bbuff)) {
		tcol += chwidth(Buff(), tcol, true);
		bmove1(Bbuff);
	}
	return tcol;
}
void PlayerbotDruidAI::DoNonCombatActions()
{
    if (!m_ai)   return;
    if (!m_bot)  return;

    if (!m_bot->isAlive() || m_bot->IsInDuel()) return;

    // Revive
    if (HealPlayer(GetResurrectionTarget()) & RETURN_CONTINUE)
        return;

    // Heal
    if (m_ai->IsHealer())
    {
        if (HealPlayer(GetHealTarget()) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }
    else
    {
        // Is this desirable? Debatable.
        // TODO: In a group/raid with a healer you'd want this bot to focus on DPS (it's not specced/geared for healing either)
        if (HealPlayer(m_bot) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }

    // Buff group
    // the check for group targets is performed by NeedGroupBuff (if group is found for bots by the function)
    if (NeedGroupBuff(GIFT_OF_THE_WILD, MARK_OF_THE_WILD) && m_ai->HasSpellReagents(GIFT_OF_THE_WILD))
    {
        if (Buff(&PlayerbotDruidAI::BuffHelper, GIFT_OF_THE_WILD) & RETURN_CONTINUE)
            return;
    }
    else if (Buff(&PlayerbotDruidAI::BuffHelper, MARK_OF_THE_WILD) & RETURN_CONTINUE)
        return;
    if (Buff(&PlayerbotDruidAI::BuffHelper, THORNS, (m_bot->GetGroup() ? JOB_TANK : JOB_ALL)) & RETURN_CONTINUE)
        return;
    if (OMEN_OF_CLARITY && !m_bot->HasAura(OMEN_OF_CLARITY) && CastSpell(OMEN_OF_CLARITY, m_bot))
        return;

    // hp/mana check
    if (EatDrinkBandage())
        return;

    if (INNERVATE && m_ai->In_Reach(m_bot, INNERVATE) && !m_bot->HasAura(INNERVATE) && m_ai->GetManaPercent() <= 20 && CastSpell(INNERVATE, m_bot))
        return;

    // Return to fighting form AFTER reviving, healing, buffing
    CheckForms();

    // Nothing else to do, Night Elves will cast Shadowmeld to reduce their aggro versus patrols or nearby mobs
    if (SHADOWMELD && !m_bot->HasAura(SHADOWMELD, EFFECT_INDEX_0) && m_ai->CastSpell(SHADOWMELD, *m_bot))
        return;
} // end DoNonCombatActions
Esempio n. 3
0
	//DONE
	vector<string>* StringToStrings(string FullString, const char* Delim, bool TreatConsecutiveDelimAsOne) {
		vector<string>* NewVect = new vector<string>;
		if (FullString.length() == 0) {
			NewVect->push_back(FullString);
			return NewVect;
		}
		string Buff(FullString);
		int Location;
		do {
			Location = int(Buff.find_first_of(Delim));
			if (Location != -1) {
				if (Location == 0) {
					if (!TreatConsecutiveDelimAsOne) {
						string NewString;
						NewVect->push_back(NewString);
					}
					Buff = Buff.substr(Location+1, Buff.length()-(Location+1));
				} else {
					string NewString = Buff.substr(0, Location);
					NewVect->push_back(NewString);
					Buff = Buff.substr(Location+1, Buff.length()-(Location+1));
				}
			}
		} while(Location != -1);
		
		if (Buff.length() != 0 || !TreatConsecutiveDelimAsOne) {
			NewVect->push_back(Buff);
		}
		
		return NewVect;
	}
void PlayerbotPaladinAI::DoNonCombatActions()
{
    if (!m_ai)   return;
    if (!m_bot)  return;

    if (!m_bot->isAlive() || m_bot->IsInDuel()) return;

    CheckAuras();

    //Put up RF if tank
    if (m_ai->IsTank())
        m_ai->SelfBuff(RIGHTEOUS_FURY);
    //Disable RF if not tank
    else if (m_bot->HasAura(RIGHTEOUS_FURY))
        m_bot->RemoveAurasDueToSpell(RIGHTEOUS_FURY);

    // Dispel magic/disease/poison
    if (m_ai->HasDispelOrder() && DispelPlayer() & RETURN_CONTINUE)
        return;

    // Revive
    if (ResurrectPlayer(GetResurrectionTarget()) & RETURN_CONTINUE)
        return;

    // Heal
    if (m_ai->IsHealer())
    {
        if (HealPlayer(GetHealTarget()) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }
    else
    {
        // Is this desirable? Debatable.
        // TODO: In a group/raid with a healer you'd want this bot to focus on DPS (it's not specced/geared for healing either)
        if (HealPlayer(m_bot) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }

    // buff group
    if (Buff(&PlayerbotPaladinAI::BuffHelper, 1) & RETURN_CONTINUE) // Paladin's BuffHelper takes care of choosing the specific Blessing so just pass along a non-zero value
        return;

    // hp/mana check
    if (EatDrinkBandage())
        return;

    // Search and apply stones to weapons
    // Mainhand ...
    Item* stone, * weapon;
    weapon = m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
    if (weapon && weapon->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT) == 0)
    {
        stone = m_ai->FindStoneFor(weapon);
        if (stone)
        {
            m_ai->UseItem(stone, EQUIPMENT_SLOT_MAINHAND);
            m_ai->SetIgnoreUpdateTime(5);
        }
    }
}
Esempio n. 5
0
void GrfComCmdBlk::DumpErrors()
  {
  Strng Buff("");
  /*
  while (SFE.RequestError(Buff))
    gs_pCmd->Print("%s\n", Buff.Str());
  */
  }
Esempio n. 6
0
void PlayerbotDruidAI::DoNonCombatActions()
{
    if (!m_ai)   return;
    if (!m_bot)  return;

    if (!m_bot->isAlive() || m_bot->IsInDuel()) return;

    // Revive
    if (HealPlayer(GetResurrectionTarget()) & RETURN_CONTINUE)
        return;

    // Heal
    if (m_ai->IsHealer())
    {
        if (HealPlayer(GetHealTarget()) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }
    else
    {
        // Is this desirable? Debatable.
        // TODO: In a group/raid with a healer you'd want this bot to focus on DPS (it's not specced/geared for healing either)
        if (HealPlayer(m_bot) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }

    // Buff
    if (m_bot->GetGroup() && m_ai->HasSpellReagents(GIFT_OF_THE_WILD) && Buff(&PlayerbotDruidAI::BuffHelper, GIFT_OF_THE_WILD) & RETURN_CONTINUE)
        return;
    if (Buff(&PlayerbotDruidAI::BuffHelper, MARK_OF_THE_WILD) & RETURN_CONTINUE)
        return;
    if (Buff(&PlayerbotDruidAI::BuffHelper, THORNS, (m_bot->GetGroup() ? JOB_TANK : JOB_ALL)) & RETURN_CONTINUE)
        return;

    // Return to fighting form AFTER reviving, healing, buffing
    CheckForms();

    // hp/mana check
    if (EatDrinkBandage())
        return;

    if (INNERVATE && m_ai->In_Reach(m_bot,INNERVATE) && !m_bot->HasAura(INNERVATE) && m_ai->GetManaPercent() <= 20 && CastSpell(INNERVATE, m_bot))
        return;
} // end DoNonCombatActions
Esempio n. 7
0
void PlayerbotMageAI::DoNonCombatActions()
{
    Player* master = GetMaster();

    if (!m_bot || !master)
        return;

    // Buff armor
    if (MOLTEN_ARMOR)
    {
        if (m_ai->SelfBuff(MOLTEN_ARMOR))
            return;
    }
    else if (MAGE_ARMOR)
    {
        if (m_ai->SelfBuff(MAGE_ARMOR))
            return;
    }
    else if (ICE_ARMOR)
    {
        if (m_ai->SelfBuff(ICE_ARMOR))
            return;
    }
    else if (FROST_ARMOR)
        if (m_ai->SelfBuff(FROST_ARMOR))
            return;

    // buff group
    if (m_bot->GetGroup() && ARCANE_BRILLIANCE && m_ai->HasSpellReagents(ARCANE_BRILLIANCE) && m_ai->Buff(ARCANE_BRILLIANCE, m_bot))
        return;
    if (Buff(&PlayerbotMageAI::BuffHelper, ARCANE_INTELLECT, (JOB_ALL | JOB_MANAONLY)))
        return;

    // conjure food & water + hp/mana check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    // TODO: The beauty of a mage is not only its ability to supply itself with water, but to share its water
    // So, conjure at *least* 1.25 stacks, ready to trade a stack and still have some left for self
    if (m_ai->FindDrink() == NULL && CONJURE_WATER && m_ai->CastSpell(CONJURE_WATER, *m_bot))
    {
        m_ai->TellMaster("I'm conjuring some water.");
        m_ai->SetIgnoreUpdateTime(3);
        return;
    }
    if (m_ai->FindFood() == NULL && CONJURE_FOOD && m_ai->CastSpell(CONJURE_FOOD, *m_bot))
    {
        m_ai->TellMaster("I'm conjuring some food.");
        m_ai->SetIgnoreUpdateTime(3);
        return;
    }

    if (EatDrinkBandage())
        return;
} // end DoNonCombatActions
Esempio n. 8
0
void Zout_to(void)
{
	int tcol = 0, col = (int)getnum("Column: ");
	if (col == -1)
		return;
	--col;

	if (bcrsearch(Bbuff, '\n'))
		bmove1(Bbuff);
	while (tcol < col && Buff() != '\n' && !bisend(Bbuff)) {
		tcol += chwidth(Buff(), tcol, false);
		bmove1(Bbuff);
	}

	if (tcol < col) {
		int wid = chwidth('\t', tcol, true);
		if (tcol + wid < col)
			tcol -= Tabsize - wid;
		tindent(col - tcol);
	}
}
void PlayerbotPaladinAI::DoNonCombatActions()
        {
    if (!m_ai)   return;
    if (!m_bot)  return;

    if (!m_bot->isAlive() || m_bot->IsInDuel()) return;
    
    CheckAuras();

    //Put up RF if tank
    if (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_TANK)
        m_ai->SelfBuff(RIGHTEOUS_FURY);
    //Disable RF if not tank
    else if (m_bot->HasAura(RIGHTEOUS_FURY))
        m_bot->RemoveAurasDueToSpell(RIGHTEOUS_FURY);

    // Revive
    if (HealPlayer(GetResurrectionTarget()) & RETURN_CONTINUE)
        return;

    // Heal
    if (m_ai->IsHealer())
                {
        if (HealPlayer(GetHealTarget()) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
                }
                else
    {
        // Is this desirable? Debatable.
        // TODO: In a group/raid with a healer you'd want this bot to focus on DPS (it's not specced/geared for healing either)
        if (HealPlayer(m_bot) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
            }

    // buff group
    if (Buff(&PlayerbotPaladinAI::BuffHelper, 1) & RETURN_CONTINUE) // Paladin's BuffHelper takes care of choosing the specific Blessing so just pass along a non-zero value
                return;

	//creat water
	if (m_ai->FindDrink() == nullptr && m_bot->getLevel() == 60)
	{
		if (Item* pItem = m_bot->StoreNewItemInInventorySlot(CRYSTAL_WATER, 20))
			m_bot->SendNewItem(pItem, 20, true, false);

		return;
	}

    // hp/mana check
    if (EatDrinkBandage())
                    return;
    // m_ai->TellMaster("DoNonCombatActions() - 10. past EatDrinkBandage()"); // debug
}
Esempio n. 10
0
/* Return current screen col of point. */
int bgetcol(bool flag, int col)
{
	struct mark pmark;

	bmrktopnt(Bbuff, &pmark);
	if (bcrsearch(Bbuff, '\n'))
		bmove1(Bbuff);
	while (!bisatmrk(Bbuff, &pmark) && !bisend(Bbuff)) {
		col += chwidth(Buff(), col, flag);
		bmove1(Bbuff);
	}
	return col;
}
Esempio n. 11
0
void PlayerbotPaladinAI::DoNonCombatActions()
{
    if (!m_ai)   return;
    if (!m_bot)  return;

    if (!m_bot->isAlive() || m_bot->IsInDuel()) return;

    CheckAuras();
    CheckSeals();

    //Put up RF if tank
    if (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_TANK)
        m_ai->SelfBuff(RIGHTEOUS_FURY);
    //Disable RF if not tank
    else if (m_bot->HasAura(RIGHTEOUS_FURY))
        m_bot->RemoveAurasDueToSpell(RIGHTEOUS_FURY);

    // Revive
    if (HealPlayer(GetResurrectionTarget()) & RETURN_CONTINUE)
        return;

    // Heal
    if (m_ai->IsHealer())
    {
        if (HealPlayer(GetHealTarget()) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }
    else
    {
        // Is this desirable? Debatable.
        // TODO: In a group/raid with a healer you'd want this bot to focus on DPS (it's not specced/geared for healing either)
        if (HealPlayer(m_bot) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }

    // buff group
    if (Buff(&PlayerbotPaladinAI::BuffHelper, 1) & RETURN_CONTINUE) // Paladin's BuffHelper takes care of choosing the specific Blessing so just pass along a non-zero value
        return;

    // hp/mana check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    if (EatDrinkBandage())
        return;
    // m_ai->TellMaster("DoNonCombatActions() - 10. past EatDrinkBandage()"); // debug
}
Esempio n. 12
0
/* Support routine to calc column to force to for line up and down */
static int forcecol(void)
{
	static int fcol;

	switch (Lfunc) {
	case ZPREVIOUS_LINE:
	case ZNEXT_LINE:
	case ZPREVIOUS_PAGE:
	case ZNEXT_PAGE:
		break;

	default:
		if (Buff() == NL)
			fcol = COLMAX + 1;
		else
			fcol = bgetcol(true, 0);
	}

	return fcol;
}
Esempio n. 13
0
static void crfixup(void)
{
	char *p = (char *)memchr(Bbuff->curpage->pdata + 1, '\n', curplen(Bbuff) - 1);
	if (!p)
		return;

	if (*(p - 1) != '\r')
		return;

	if (raw_mode)
		return;

	Curbuff->bmode |= FILE_CRLF;

	while (bcsearch(Bbuff, '\r'))
		if (Buff() == '\n') {
			bmove(Bbuff, -1);
			bdelete(Bbuff, 1);
		}

	btostart(Bbuff);
}
Esempio n. 14
0
void SwgSnapshot::encodePersistedBuffs   (Archive::ByteStream &data, DB::BufferString const& dbString) const
{
	// some persisted buffs in the database were written as a AutoDeltaPackedMap of Crc's and uint64
	// the new type ones are marked with a version number followed by a 'v' then the data

	std::string stringRepresentation;
	dbString.getValue (stringRepresentation);
	size_t numchars = stringRepresentation.size();

	int version = -1;

	//format: [<versionNumber>v]<packedData>

	//extract the version
	if (numchars > 0)
	{
		size_t vpos = stringRepresentation.find('v');
		if(vpos == stringRepresentation.npos)
		{
			version = 0;
		}
		else
		{
			std::string versionToken = stringRepresentation.substr(0,vpos);
			sscanf(versionToken.c_str(), versionFormat, &version);

			stringRepresentation = stringRepresentation.substr(vpos+1);
		}
	}
	
	Archive::AutoDeltaMap<uint32, Buff::PackedBuff>::Command tempCommand;
	std::vector<Archive::AutoDeltaMap<uint32, Buff::PackedBuff>::Command> commands;
	char temp[200];

	if(version == 0)
	{
		//string is the old AutoDeltaPackedMap written as [<crc> <packed64>:]*
		uint64 tempPacked64;
		uint32 tempCrc;

		int numbuffs = Archive::countCharacter(stringRepresentation,':');
		commands.reserve(numbuffs);

		int tempPos = 0;
		for (std::string::const_iterator i=stringRepresentation.begin(); i!=stringRepresentation.end(); ++i)
		{
			if (*i==':')
			{
				temp[tempPos]='\0';
				sscanf(temp, oldschoolBuffFormat, &tempCrc, &tempPacked64);

				tempCommand.cmd = Archive::AutoDeltaMap<uint32, Buff::PackedBuff>::Command::ADD;
				tempCommand.key = tempCrc;
				tempCommand.value = Buff::makePackedBuff(tempPacked64);

				commands.push_back(tempCommand);

				tempPos=0;
			}
			else
			{
				temp[tempPos++]=*i;
			}
		}
	}
	else if (version == 1)
	{
		//version 1 written as [<crc> <endtime> <value> <duration>:]*
		uint32 tempCrc = 0, tempEndtime = 0, tempDuration = 0;
		float tempValue = 0.0f;

		int numbuffs = Archive::countCharacter(stringRepresentation,':');
		commands.reserve(numbuffs);

		int tempPos = 0;
		for (std::string::const_iterator i=stringRepresentation.begin(); i!=stringRepresentation.end(); ++i)
		{
			if (*i==':')
			{
				temp[tempPos]='\0';
				sscanf(temp, versionOneFormat, &tempCrc, &tempEndtime, &tempValue, &tempDuration);

				tempCommand.cmd = Archive::AutoDeltaMap<uint32, Buff::PackedBuff>::Command::ADD;
				tempCommand.key = tempCrc;
				tempCommand.value = Buff(tempCrc, tempEndtime, tempValue, tempDuration).getPackedBuffValue();

				commands.push_back(tempCommand);

				tempPos=0;
			}
			else
			{
				temp[tempPos++]=*i;
			}
		}
	}
	else if (version == 2)
	{
		//version 2 written as [<crc> <endtime> <value> <duration> <caster> <stackCount>:]*
		uint32 tempCrc = 0, tempEndtime = 0, tempDuration = 0, tempStackCount = 0;
		float tempValue = 0.0f;
		int64 tempCaster = 0;

		int numbuffs = Archive::countCharacter(stringRepresentation,':');
		commands.reserve(numbuffs);

		int tempPos = 0;
		for (std::string::const_iterator i=stringRepresentation.begin(); i!=stringRepresentation.end(); ++i)
		{
			if (*i==':')
			{
				temp[tempPos]='\0';
				sscanf(temp, versionTwoFormat, &tempCrc, &tempEndtime, &tempValue, &tempDuration, &tempCaster, &tempStackCount);

				tempCommand.cmd = Archive::AutoDeltaMap<uint32, Buff::PackedBuff>::Command::ADD;
				tempCommand.key = tempCrc;
				tempCommand.value = Buff(tempCrc, tempEndtime, tempValue, tempDuration, NetworkId(tempCaster), tempStackCount).getPackedBuffValue();

				commands.push_back(tempCommand);

				tempPos=0;
			}
			else
			{
				temp[tempPos++]=*i;
			}
		}
	}
	else
	{
		//we don't know how to convert this string to buffs, treat it as though there were no buffs there at all
		WARNING(true, ("encodePersistedBuffs: Cannot convert db string with version %d to buffs", version));
	}

	Archive::AutoDeltaMap<uint32, Buff::PackedBuff>::pack(data, commands);

}
Esempio n. 15
0
unsigned BNJ::PullParser::ChunkRead8(char* dest, unsigned destlen,
	unsigned key_enum)
{
	if(_val_idx >= _val_len)
		throw std::runtime_error("No valid parser value!");

	/* out will always point to first empty char. */
	uint8_t* out = (uint8_t*)dest;
	unsigned remaining = destlen;
	bnj_val& val = _valbuff[_val_idx];

	/* Verify enum and type. */
	if(key_enum != 0xFFFFFFFF && val.key_enum != key_enum)
		s_throw_key_error(*this, key_enum);
	if(bnj_val_type(&val) != BNJ_STRING)
		s_throw_type_error(*this, BNJ_STRING);

	while(remaining > _utf8_remaining || !dest){
		bnj_val& val = _valbuff[_val_idx];
		bool completed = !bnj_incomplete(&_pstate, &val);

		/* Can fit entire string fragment in destination. */
		if(dest)
			out = bnj_stpncpy8(out, &val, _utf8_remaining + 1, Buff());
		_utf8_remaining = 0;

		/* If value is not a fragment, then have read the whole value. */
		if(completed)
			return out - (uint8_t*)dest;

		/* Decrement remaining bytes, but add back in null terminator. */
		remaining = destlen - (out - (uint8_t*)dest) + 1;

		/* Just finished reading data from fragment, so must be at end
		 * of unparsed data. Refill the entire buffer. */
		FillBuffer(_len);

		/* Pull will do the work of updating the buffer here.
		 * Jump directly to PARSE_ST so Pull() will not jump back here! */
		_state = PARSE_ST;
		State s = Pull(_ctx.key_set, _ctx.key_set_length);
		assert(ST_DATUM == s);
	}

	/* Save room for null terminator. */
	--remaining;

	/* Copy fragmented char if applicable. */
	if(val.significand_val != BNJ_EMPTY_CP){
		out =
			bnj_utf8_char((uint8_t*)dest, remaining, (uint32_t)val.significand_val);
		if((uint8_t*)dest != out){
			unsigned written = out - (uint8_t*)dest;
			remaining -= written;
			_utf8_remaining -= written;
		}
		else{
			*out = '\0';
			return out - (uint8_t*)dest;
		}
	}

	/* Only copy up to minimum of len and content length. */
	const uint8_t* x = Buff() + val.strval_offset;
	const uint8_t* b = x;
	uint8_t* res = bnj_json2utf8(out, remaining, &b);

	/* Update bytes remaining in the input buffer. */
	_offset += b - x;
	_utf8_remaining -= res - out;
	
	/* Return number of bytes written to output. */
	return res - (uint8_t*)dest;
}
Esempio n. 16
0
void PlayerbotPriestAI::DoNonCombatActions()
{
    if (!m_ai)   return;
    if (!m_bot)  return;

    if (!m_bot->isAlive() || m_bot->IsInDuel()) return;

    uint32 spec = m_bot->GetSpec();

    // selfbuff goes first
    if (m_ai->SelfBuff(INNER_FIRE))
        return;

    // Revive
    if (HealPlayer(GetResurrectionTarget()) & RETURN_CONTINUE)
        return;

    // After revive
    if (spec == PRIEST_SPEC_SHADOW && SHADOWFORM > 0)
        m_ai->SelfBuff(SHADOWFORM);
    if (VAMPIRIC_EMBRACE > 0)
        m_ai->SelfBuff(VAMPIRIC_EMBRACE);

    // Heal
    if (m_ai->IsHealer())
    {
        if (HealPlayer(GetHealTarget()) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }
    else
    {
        // Is this desirable? Debatable.
        // TODO: In a group/raid with a healer you'd want this bot to focus on DPS (it's not specced/geared for healing either)
        if (HealPlayer(m_bot) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }

    // Buffing
    // the check for group targets is performed by NeedGroupBuff (if group is found for bots by the function)
    if (NeedGroupBuff(PRAYER_OF_FORTITUDE, POWER_WORD_FORTITUDE) && m_ai->HasSpellReagents(PRAYER_OF_FORTITUDE))
    {
        if (Buff(&PlayerbotPriestAI::BuffHelper, PRAYER_OF_FORTITUDE) & RETURN_CONTINUE)
            return;
    }
    else if (Buff(&PlayerbotPriestAI::BuffHelper, POWER_WORD_FORTITUDE) & RETURN_CONTINUE)
        return;

    if (NeedGroupBuff(PRAYER_OF_SPIRIT, DIVINE_SPIRIT) && m_ai->HasSpellReagents(PRAYER_OF_FORTITUDE))
    {
        if (Buff(&PlayerbotPriestAI::BuffHelper, PRAYER_OF_SPIRIT) & RETURN_CONTINUE)
            return;
    }
    else if (Buff(&PlayerbotPriestAI::BuffHelper, DIVINE_SPIRIT, (JOB_ALL | JOB_MANAONLY)) & RETURN_CONTINUE)
        return;

    if (NeedGroupBuff(PRAYER_OF_SHADOW_PROTECTION, SHADOW_PROTECTION) && m_ai->HasSpellReagents(PRAYER_OF_FORTITUDE))
    {
        if (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_RESIST_SHADOW && Buff(&PlayerbotPriestAI::BuffHelper, PRAYER_OF_SHADOW_PROTECTION) & RETURN_CONTINUE)
            return;
    }
    else if (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_RESIST_SHADOW && Buff(&PlayerbotPriestAI::BuffHelper, SHADOW_PROTECTION) & RETURN_CONTINUE)
        return;

    if (EatDrinkBandage())
        return;

    // Nothing else to do, Night Elves will cast Shadowmeld to reduce their aggro versus patrols or nearby mobs
    if (SHADOWMELD && !m_bot->HasAura(SHADOWMELD, EFFECT_INDEX_0) && m_ai->CastSpell(SHADOWMELD, *m_bot))
        return;
} // end DoNonCombatActions
Esempio n. 17
0
void PlayerbotPriestAI::DoNonCombatActions()
{
    if (!m_ai)   return;
    if (!m_bot)  return;

    if (!m_bot->isAlive() || m_bot->IsInDuel()) return;

    uint32 spec = m_bot->GetSpec();

    // selfbuff goes first
    if (m_ai->SelfBuff(INNER_FIRE))
        return;

    // Revive
    if (HealPlayer(GetResurrectionTarget()) & RETURN_CONTINUE)
        return;

    // After revive
    if (spec == PRIEST_SPEC_SHADOW && SHADOWFORM > 0)
        m_ai->SelfBuff(SHADOWFORM);
    if (VAMPIRIC_EMBRACE > 0)
        m_ai->SelfBuff(VAMPIRIC_EMBRACE);

    // Heal
    if (m_ai->IsHealer())
    {
        if (HealPlayer(GetHealTarget()) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }
    else
    {
        // Is this desirable? Debatable.
        // TODO: In a group/raid with a healer you'd want this bot to focus on DPS (it's not specced/geared for healing either)
        if (HealPlayer(m_bot) & RETURN_CONTINUE)
            return;// RETURN_CONTINUE;
    }

    // Buff
    if (m_bot->GetGroup())
    {
        if (PRAYER_OF_FORTITUDE && m_ai->HasSpellReagents(PRAYER_OF_FORTITUDE) && m_ai->Buff(PRAYER_OF_FORTITUDE, m_bot))
            return;

        if (PRAYER_OF_SPIRIT && m_ai->HasSpellReagents(PRAYER_OF_SPIRIT) && m_ai->Buff(PRAYER_OF_SPIRIT, m_bot))
            return;

        if (PRAYER_OF_SHADOW_PROTECTION && m_ai->HasSpellReagents(PRAYER_OF_SHADOW_PROTECTION) && m_ai->Buff(PRAYER_OF_SHADOW_PROTECTION, m_bot))
            return;
    }
    if (Buff(&PlayerbotPriestAI::BuffHelper, POWER_WORD_FORTITUDE))
        return;
    if (Buff(&PlayerbotPriestAI::BuffHelper, DIVINE_SPIRIT, (JOB_ALL | JOB_MANAONLY)))
        return;
    if (Buff(&PlayerbotPriestAI::BuffHelper, SHADOW_PROTECTION, (JOB_TANK | JOB_HEAL) ))
        return;

    // hp/mana check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    if (EatDrinkBandage())
        return;
} // end DoNonCombatActions
Esempio n. 18
0
void PlayerbotMageAI::DoNonCombatActions()
{
    Player* master = GetMaster();

    if (!m_bot || !master)
        return;

    // Remove curse on group members if orders allow bot to do so
    if (Player* pCursedTarget = GetDispelTarget(DISPEL_CURSE))
    {
        if (MAGE_REMOVE_CURSE > 0 && (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_NODISPEL) == 0 && CastSpell(MAGE_REMOVE_CURSE, pCursedTarget))
            return;
    }

    // Buff armor
    if (MAGE_ARMOR)
    {
        if (m_ai->SelfBuff(MAGE_ARMOR))
            return;
    }
    else if (ICE_ARMOR)
    {
        if (m_ai->SelfBuff(ICE_ARMOR))
            return;
    }
    else if (FROST_ARMOR)
    {
        if (m_ai->SelfBuff(FROST_ARMOR))
            return;
    }

    if (COMBUSTION && !m_bot->HasSpellCooldown(COMBUSTION) && m_ai->SelfBuff(COMBUSTION))
        return;

    // buff group
    // the check for group targets is performed by NeedGroupBuff (if group is found for bots by the function)
    if (NeedGroupBuff(ARCANE_BRILLIANCE, ARCANE_INTELLECT) && m_ai->HasSpellReagents(ARCANE_BRILLIANCE))
    {
        if (Buff(&PlayerbotMageAI::BuffHelper, ARCANE_BRILLIANCE) & RETURN_CONTINUE)
            return;
    }
    else if (Buff(&PlayerbotMageAI::BuffHelper, ARCANE_INTELLECT, JOB_MANAONLY) & RETURN_CONTINUE)
        return;

    Item* gem = FindManaGem();
    if (!gem && CONJURE_MANA_GEM && m_ai->CastSpell(CONJURE_MANA_GEM, *m_bot))
    {
        m_ai->SetIgnoreUpdateTime(3);
        return;
    }

    // TODO: The beauty of a mage is not only its ability to supply itself with water, but to share its water
    // So, conjure at *least* 1.25 stacks, ready to trade a stack and still have some left for self
    if (m_ai->FindDrink() == nullptr && CONJURE_WATER && m_ai->CastSpell(CONJURE_WATER, *m_bot))
    {
        m_ai->TellMaster("I'm conjuring some water.");
        m_ai->SetIgnoreUpdateTime(3);
        return;
    }
    if (m_ai->FindFood() == nullptr && CONJURE_FOOD && m_ai->CastSpell(CONJURE_FOOD, *m_bot))
    {
        m_ai->TellMaster("I'm conjuring some food.");
        m_ai->SetIgnoreUpdateTime(3);
        return;
    }

    if (EatDrinkBandage())
        return;
} // end DoNonCombatActions
Esempio n. 19
0
void Coin::stat(std::multimap<const char*, Buff>& stat)
{
	// Give the player a little boost when they collect a coin
	if (Item::hasState(Item::WAITING))
		stat.insert(std::pair<const char*, Buff>("Haste", Buff(2.0f, Buff::MULTIPLICATION, Buff::VELOCITY, 1.02f)));
}