Official: Chanter.lua

locatelli
VIP
Posts: 71
Joined: Mon Jan 16, 2017 10:38 pm
Has thanked: 11 times
Been thanked: 8 times

Official: Chanter.lua

Post by locatelli » Mon Jan 16, 2017 10:55 pm

Edited a chanter.lua an user gave me on Epvpers to use some spells (Healing light, buffs).
It works good!

New version, I used a it of code from Agonic (thanks :) )

It can be used without autochain, since the multicast is working perfectly!

Code: Select all

--[[

	--------------------------------------------------
	Copyright (C) 2011 Blastradius

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
	--------------------------------------------------

]]--

--- (Private Function) Checks the healing requirements for the provided entity.
--
-- @param	Entity	Contains the entity to perform healing on.
-- @param	double	Contains the
-- @return	bool

function _CheckHeal( Entity )

-- Retrieve the rechargeable health.
	local HealthRecharge = Entity:GetHealthMaximum() - Entity:GetHealthCurrent();
	
	-- Retrieve the state.
	local EntityState = Entity:GetState();
	

	-- Heal 1: Stamina Recovery
	if Entity:GetID() == Player:GetID() and Helper:CheckAvailable( "Stamina Restoration" ) and HealthRecharge > 4000 then
		Helper:CheckExecute( "Stamina Restoration" );
		return false;
	end
	
	-- Heal 2: Recovery Magic
	if Helper:CheckAvailable( "Recovery Magic" ) and Entity:GetHealth() < 60 then
		Helper:CheckExecute( "Recovery Magic" );
		return false;
	end
	
	-- Heal 3: Healing Light
	if Helper:CheckAvailable( 1850 ) and Entity:GetHealth() < 50 and EntityState:GetState( "Recovery Magic" ) == nil then
		Helper:CheckExecute( 1850 )
		return false;
	end
	
	--[[ Heal 3: Healing Burst
	if Helper:CheckAvailable( "Healing Burst" ) and Entity:GetHealth() < 50 then
		Helper:CheckExecute( "Healing Burst", Entity );
		return false;
	end]]

end

--- Perform the attack routine on the selected target.
--
-- @param	Entity	Contains the entity we have targeted.
-- @param	double	Contains the distance to the target
-- @param	bool	Indicates whether or not the target is stunned.
-- @return	bool

local CHAIN_SKILLS =
	{
		"Blast",
		"Thunderbolt Strike",
		"Seismic Crash",
		"Booming Assault",
		"Booming Smash",
		"Vehemence Strike",
		"Split Strike",
		"Booming Strike",
		"Pentacle Shock",
		"Incandescent Blow",
		"Resonance Haze",
		"Resonance Attack",
		"Soul Lock",
		"Repeated Shatter",
		"Soul Crush",
		"Parrying Strike",
		"Splash Swing"
	};
	
local DMG_SKILLS =
	{

"Mountain Crash",
"Inescapable Judgment",
"Infernal Blaze",
"Numbing Blow",
"Meteor Strike",	
"Annihilation",
"Hallowed Strike"

	};
	
function _ExecuteSkillFromList(Entity, Skills)
	for k, Skill  in ipairs(Skills) do
		if Helper:CheckAvailable( Skill ) then
			Helper:CheckExecute( Skill, Entity );
			return false;
		end
	end
	return true;
end

function GetBuff() --belirleme

	-- Loop through the state of the target entity 
	for i = 0, Player:GetState():GetStateSize() - 1, 1 do
	
		-- Retrieve the state from the EntityState.
		local StateIndex = Player:GetState():GetStateIndex( i );

		-- Check if the state is correct and check if it is a debuff.
		if StateIndex ~= nil and StateIndex:IsDebuff() then		
			return true;			
		end
		
	end
	
end

function CountMobs(dist)
	local i = 0;
	
	-- Iterate through all entities
	for ID, Entity in DictionaryIterator( EntityList:GetList()) do
		
		local mobRange = Player:GetPosition():DistanceToPosition( Entity:GetPosition());	
		
		-- Add Mob
		if Entity ~= nil and Entity:IsHostile() and Entity:GetHealth() > 0 and mobRange <= dist then--Entity:IsHostile() and 
			i = i + 1;
		end
	
	end
	
	return i;	
end

function Attack( Entity, Range, Stunned )

	local Range = Player:GetPosition():DistanceToPosition( Entity:GetPosition());
	local EntityState = Player:GetState()
	--local Entity = EntityList:GetEntity( Player:GetTargetID());
	
	-- Indicates whether or not attacks are allowed for a Cleric. Extra toggle to allow features such as follow-mode support.
	if Settings.Chanter.AllowAttack then
		
		self:CheckAttackFood();
		
		if(not self:_ExecuteSkillFromList(Entity, CHAIN_SKILLS)) then
			return false;
		end
		
		-- Buff 3: Blessing of Wind
		if Helper:CheckAvailable( "Blessing of Wind" ) and Player:GetState():GetState( Helper:CheckName( "Blessing of Wind" )) == nil then
			Helper:CheckExecute( "Blessing of Wind", Player );
			return false;
		end
		
		--[[ AoE Vision
		if Helper:CheckAvailable( "Roaring Wind Bludgeon" ) then --if self:CountMobs(6) >= 2 and Helper:CheckAvailable( "Roaring Wind Bludgeon" ) then
			Helper:CheckExecute( "Roaring Wind Bludgeon" );
			return false;
		end]]

		-- Prepare the attack timer when the target is stunned to determine when to use Soul Crush.
		if Stunned and self.AttackTimer == nil then
		--	self.AttackTimer = Time() + 750;
			self.AttackTimer = Time() + 500;
		elseif not Stunned then
			self.AttackTimer = nil;
		end
		
		if Helper:CheckAvailable( "Stamina Restoration" ) and Player:GetManaCurrent() < Player:GetManaMaximum() - 4000 then
			Helper:CheckExecute( "Stamina Restoration" );
			return false;			
		end
		
		if Helper:CheckAvailable( "Remove Shock" ) then
			Helper:CheckExecute( "Remove Shock" );
			return false;
		end
		
		if self:GetBuff() and Helper:CheckAvailable( "Stamina Radiation" ) then
			Helper:CheckExecute( "Stamina Radiation", Player );
			return false;
		end

		-- Chain Attack 1: Remove Shock
		if not Stunned and Helper:CheckAvailable( "Backshock" ) and ( not Helper:CheckAvailable( "Retribution" ) or Range <= 10 ) then
			Helper:CheckExecute( "Backshock" );
			return false;
		elseif not Stunned and Helper:CheckAvailable( "Retribution" ) then
			Helper:CheckExecute( "Retribution" );	
			return false;
		end

	--------------------------------------------------
	--     P R E P A R I N G   A T T A C K (S)      --
	--------------------------------------------------

	-- Preparing Attack 1.1: Word of Wind
	if ( Settings.Chanter.AllowWoWWhenGrinding or Entity:IsPlayer()) and not Entity:IsDead() and Player:GetDP() >= 2000 and Helper:CheckAvailable( "Word of Wind" ) and Player:GetState():GetState( Helper:CheckName( "Word of Wind" )) == nil then
		Helper:CheckExecute( "Word of Wind" );		
		return false;
	end
	
	-- Preparing Attack 1.2: Divine Protection"
	if ( Settings.Chanter.Allow2kWhenGrinding or Entity:IsPlayer()) and not Entity:IsDead() and Player:GetDP() >= 4000 and Helper:CheckAvailable( "Divine Protection" ) and Player:GetState():GetState( Helper:CheckName( "Divine Protection" )) == nil then
		Helper:CheckExecute( "Divine Protection" );
		return false;	
	end

	-- When the entity is a player ...
	if Entity:IsPlayer() then

		-- Preparing Attack 2.1: Safer Ward
		if Helper:CheckAvailable( "Safer Ward" ) then
			Helper:CheckExecute( "Safer Ward" );
			return false;			
		end
		
		-- Preparing Attack 2.2: Divine Curtain
		if Helper:CheckAvailable( "Divine Curtain" ) and Player:GetState():GetState( Helper:CheckName( "Safer Ward" )) == nil then
			Helper:CheckExecute( "Divine Curtain" );
			return false;			
		end
		
		-- Preparing Attack 2.3: Unstoppable
		if Helper:CheckAvailable( "Unstoppable" ) then
			Helper:CheckExecute( "Unstoppable" );
			return false;			
		end
		
		-- Preparing Attack 2.4: Magic Acceleration
		if Helper:CheckAvailable( "Magic Acceleration" ) and Player:GetHealth() < 70 then
			Helper:CheckExecute( "Magic Acceleration" );
			return false;			
		end
		
		-- Preparing Attack 2.5: Binding Word
		if Helper:CheckAvailable( "Binding Word" ) then
			Helper:CheckExecute( "Binding Word" );
			return false;			
		end
		
		-- Otherwise when the entity is not a player ...
	else

	end

	--------------------------------------------------
	--        R A N G E D   A T T A C K (S)         --
	--------------------------------------------------

	-- Ranged Attack 1: Inescapable Judgement/Soul Strike and Retribution (Chain Skill)
	if not Stunned and Helper:CheckAvailable( "Inescapable Judgment" ) then
		Helper:CheckExecute( "Inescapable Judgment" );	
		return false;	
	end
	
	if Helper:CheckAvailable( "Infernal Blaze" ) and Range > 10 then
		Helper:CheckExecute( "Infernal Blaze" );
		return false;
	end

	--------------------------------------------------
	--        N O R M A L   A T T A C K (S)         --
	--------------------------------------------------

	-- Normal Attack 1: Mountain Crash
	if Helper:CheckAvailable( "Mountain Crash" ) then
		Helper:CheckExecute( "Mountain Crash" );	
		return false;	
	end

	-- Normal Attack 3: Numbing Blow
	if not Stunned and Helper:CheckAvailable( "Numbing Blow" ) then
		Helper:CheckExecute( "Numbing Blow" );
		return false;	
	end

	--------------------------------------------------
	--       I N I T I A L   A T T A C K (S)        --
	--------------------------------------------------

	-- Initial Attack 1: Automatic Attack
	if self.AttackStarted ~= Entity:GetID() then
		self.AttackStarted = Entity:GetID();
		Helper:CheckExecute( "Attack/Chat" );
		return false;		
	end

	-- Initial Attack 2: Meteor Strike
	if Helper:CheckAvailable( "Meteor Strike" ) then
		Helper:CheckExecute( "Meteor Strike" );
		return false;	
	end

	-- Initial Attack 3: Hallowed Strike
	if Helper:CheckAvailable( "Hallowed Strike" ) then
		Helper:CheckExecute( "Hallowed Strike" );
		return false;	
	end

	-- Initial Attack 4: Thunderbolt Strike
	if Helper:CheckAvailable( "Thunderbolt Strike" ) then
		Helper:CheckExecute( "Thunderbolt Strike" );
		return false;	
	end

	-- Initial Attack 5: Annihilation
	if Helper:CheckAvailable( "Annihilation" ) then
		Helper:CheckExecute( "Annihilation" );
		return false;	
	end
	
	if not self:_ExecuteSkillFromList(Entity, DMG_SKILLS) then
		return false;
	end		
	-- Nothing was executed, continue with other functions.
	return true;

	end
end

--- Perform healing checks both in and out of combat.
--
-- @param	bool	Indicates whether or not the function is running before force checks.
-- @return	bool

function Heal( BeforeForce )

	if BeforeForce and Settings.Chanter.AllowBuff and ( self.StateBuffTime == nil or self.StateBuffTime < Time()) then

		local EntityState = Player:GetState();

		if EntityState ~= nil then

				-- Check if this entity has the Blessing of Stone state.
				if Helper:CheckAvailable( "Blessing of Stone" ) and EntityState:GetState( "Blessing of Stone" ) == nil then
					Helper:CheckExecute( "Blessing of Stone", Entity );
					return false;	
				end

						-- Check if this entity has the Prayer of Protection state.
						if Helper:CheckAvailable( "Prayer of Protection" ) and EntityState:GetState( "Prayer of Protection" ) == nil and EntityState:GetState( "Blessing of Stone" ) == nil then
							-- Buff 2: Prayer of Protection
							if Helper:CheckAvailable( "Prayer of Protection" )  then
								Helper:CheckExecute( "Prayer of Protection", Player );
								return false;	
							end
						end

			-- Check if this entity has the Promise of Earth state.
			if Helper:CheckAvailable( "Promise of Earth" ) and EntityState:GetState( "Promise of Earth" ) == nil then
				Helper:CheckExecute( "Promise of Earth", Player );
				return false;
			end

			-- Buff 4: Rage Spell
			if Helper:CheckAvailable( "Rage Spell" ) and EntityState:GetState( "Rage Spell" ) == nil then
				Helper:CheckExecute( "Rage Spell", Player );
				return false;
			end
			
			-- Buff 5: Word of Awakening
			if Helper:CheckAvailable( "Word of Awakening" ) and EntityState:GetState( "Word of Awakening" ) == nil then
				Helper:CheckExecute( "Word of Awakening", Player );	
				return false;
			end
		end
	end

	-- Check if we are allowed to execute our healing routines, after checking the force we can check our own HP.
	if not BeforeForce and Settings.Chanter.AllowHealing then

		-- Check the required direct healing for my own character.
		if not self:_CheckHeal( Player ) then
			
		end

	end

	-- Nothing was executed, continue with other functions.
	return true;

end

--- Perform the required force checks.
--
-- @return	void

function Force()

	--[[
	Step #1 - Prioritize the force members/spirits based on the target's target.
	Step #4 - (AllowHealing) Check the required healing of the prioritized force members/spirits.
	Step #5 - (AllowHealing) Check if multiple force members are required to be healed.
	Step #6 - (AllowHealing) Check the required healing of the non-prioritized force members.
	Step #7 - (AllowHealing) Check if the prioritized force members/spirits require healing over time.
	Step #8 - (AllowBuff) Check the positive state of the prioritized force members/spirits.
	Step #9 - (AllowBuff) Check the positive state of the non-prioritized force members.
	]]--

	-- Contains the amount of force members that would benefit from a group heal.
	local GroupCount = 0;

	-- Contains a list of entities that have been targeted by group members.
	local PriorityList = {};

	-- Contains a list of entities that should be checked for required healing.
	local PriorityListHeal = {};

	-- Contains the entity belonging to a possible master to assist.
	local MasterEntity = EntityList:GetEntity( Settings.MasterName );

	-- Step #1 - Prioritize the force members/spirits based on the target's target.
	for ID, Force in DictionaryIterator( ForceList:GetList()) do

		-- Retrieve the entity for the current force member.
		local Entity = EntityList:GetEntity( Force:GetID());

		-- Check if the entity is available and is not dead.
		if Entity ~= nil and not Entity:IsDead() then

			-- Check if the current force member has selected an entity.
			if Entity:GetTargetID() ~= 0 then
				PriorityList[Entity:GetTargetID()] = true;
			end

			-- Check if the current force member would benefit from a group heal.
			if Settings.Chanter.AllowHealing and Player:GetPosition():DistanceToPosition( Entity:GetPosition()) < 25 and ( Entity:GetHealthMaximum() - Entity:GetHealthCurrent()) >= 2300 then
				GroupCount = GroupCount + 1;
			end

		end

	end

	-- Check the states of the master entity and add it to the priority healing list to enable further checks.
	if MasterEntity ~= nil and not MasterEntity:IsDead() then
			PriorityListHeal[MasterEntity:GetID()] = MasterEntity;
	end

	-- Step #2 - Check the states of the prioritized force members/spirits
	for k,v in pairs( PriorityList ) do

		-- Retrieve the entity for the current index.
		local Entity = EntityList:GetEntity( k );

		-- Check if the entity has been found and is not friendly or dead.
		if Entity ~= nil and not Entity:IsFriendly() and not Entity:IsDead() then

			-- Retrieve the entity for the target of the current entity.
			Entity = EntityList:GetEntity( Entity:GetTargetID());

			-- Check if the target entity has been found and is either a group member or a summoned entity that belongs to a group member.
			if Entity ~= nil and not Entity:IsDead() and (( Entity:GetOwnerID() ~= 0 and ForceList:GetForce( Entity:GetOwnerID()) ~= nil ) or ForceList:GetForce( Entity:GetID()) ~= nil ) then

				-- Add the current entity into the healing priority list to handle after checking spirit states.
				if Settings.Chanter.AllowHealing then
					PriorityListHeal[Entity:GetID()] = Entity;
				end

			end

		end

	end


	-- Check if we are allowed to run the healing-orientated routines.
	if Settings.Chanter.AllowHealing then

		-- Retrieve the target entity.
		local TargetEntity = EntityList:GetEntity( Player:GetTargetID());

		-- Step #4 - Check the required healing of the prioritized force members/spirits.
		for k,v in pairs( PriorityListHeal ) do

			-- Check the required direct healing for this force members/spirits.
			if not self:_CheckHeal( v ) then
				
			end

		end

		-- Step #6 - Check the required healing of the non-prioritized force members.
		for ID, Force in DictionaryIterator( ForceList:GetList()) do

			-- Check if the current force member has already been checked through the priorities.
			if PriorityListHeal[Force:GetID()] == nil then

				-- Get the entity from the EntityList.
				local Entity = EntityList:GetEntity( Force:GetID());

				-- Check the required direct healing for this force member.
				if Entity ~= nil and not self:_CheckHeal( Entity ) then
					
				end

			end

		end

		-- Step #7 - Check if the prioritized force members/spirits require healing over time.
		if Settings.Chanter.AllowBuff and ( self.StateBuffTime == nil or self.StateBuffTime < Time()) then

			-- Loop through the prioritized force members/spirits to check the required healing over time spells.
			for k,v in pairs( PriorityListHeal ) do

				-- Retrieve the entity state for this entity.
				local EntityState = v:GetState();

				-- Retrieve the range to this entity to check if the entity is in range to use a heal-over-time ability.
				local Range = Player:GetPosition():DistanceToPosition( v:GetPosition());

				-- Check the validity of the entity state and the range of the entity.
				if EntityState ~= nil and ( Settings.Chanter.AllowApproach or Range < 25 ) then

					-- Check if should give the current entity the Rebirth Spell heal-over-time.
					if v:GetHealth() < 100 and Helper:CheckAvailable( "Rebirth Spell" ) and EntityState:GetState( Helper:CheckName( "Rebirth Spell" )) == nil then
						Helper:CheckExecute( "Rebirth Spell", v );
						
					end
				end

			end

		end

	end

	-- Check if we are allowed to buff and perform the routine when required.
	if Settings.Chanter.AllowBuff and Settings.Chanter.AllowBuffForce and ( self.StateBuffTime == nil or self.StateBuffTime < Time()) then

		-- Step #8 - Check the positive state of the prioritized force members/spirits.
		for k,v in pairs( PriorityListHeal ) do

			-- Retrieve the entity state for this entity.
			local EntityState = v:GetState();

			-- Retrieve the range to this entity to check if the entity is in range to use a heal-over-time ability.
			local Range = Player:GetPosition():DistanceToPosition( v:GetPosition());

			--[[ Check the validity of the entity state and the range of the entity.
			if EntityState ~= nil and ( Settings.Chanter.AllowApproach or Range < 25 ) then

						-- Check if this entity has the Blessing of Health state.
						if Helper:CheckAvailable( "Blessing of Health I" ) and EntityState:GetState( "Blessing of Health I" ) == nil and EntityState:GetState( "Blessing of Health II" ) == nil then
							Helper:CheckExecute( "Blessing of Health", Entity );
							return false;	
						end

						-- Check if this entity has the Blessing of Rock state.
						if Helper:CheckAvailable( "Blessing of Rock I" ) and EntityState:GetState( "Blessing of Rock I" ) == nil and EntityState:GetState( "Blessing of Stone I" ) == nil then
							-- Buff 2: Blessing of Rock
							if Helper:CheckAvailable( "Blessing of Stone I" ) then
								Helper:CheckExecute( "Blessing of Stone", v );
								return false;
							-- Buff 2: Blessing of Stone
							elseif Helper:CheckAvailable( "Blessing of Rock I" )  then
								Helper:CheckExecute( "Blessing of Rock", v );
								return false;	
							end
						end

			end]]

		end

		-- Step #9 - (AllowBuff) Check the positive state of the non-prioritized force members.
		for ID, Force in DictionaryIterator( ForceList:GetList()) do

			-- Check if the current force member has already been checked through the priorities.
			if PriorityListHeal[Force:GetID()] == nil then

				-- Get the entity from the EntityList.
				local Entity = EntityList:GetEntity( Force:GetID());

				-- Check the vailidity of the retrieved entity.
				if Entity ~= nil and not Entity:IsDead() then

					-- Retrieve the entity state for this entity.
					local EntityState = Entity:GetState();

					-- Retrieve the range to this entity to check if the entity is in range to use a heal-over-time ability.
					local Range = Player:GetPosition():DistanceToPosition( Entity:GetPosition());

					-- Check the validity of the entity state and the range of the entity.
					if EntityState ~= nil and ( Settings.Chanter.AllowApproach or Range < 25 ) then

						-- Check if this entity has the Blessing of Health state.
						if Helper:CheckAvailable( "Blessing of Health I" ) and EntityState:GetState( "Blessing of Health I" ) == nil and EntityState:GetState( "Blessing of Health II" ) == nil then
							Helper:CheckExecute( "Blessing of Health", Entity );
						return false;	
						end

						--[[ Check if this entity has the Blessing of Rock state.
						if Helper:CheckAvailable( "Blessing of Rock I" ) and EntityState:GetState( "Blessing of Rock I" ) == nil and EntityState:GetState( "Blessing of Stone I" ) == nil then
							-- Buff 2: Blessing of Rock
							if Helper:CheckAvailable( "Blessing of Stone I" ) then
								Helper:CheckExecute( "Blessing of Stone", Entity );
								return false;	
							-- Buff 2: Blessing of Stone
							elseif Helper:CheckAvailable( "Blessing of Rock I" )  then
								Helper:CheckExecute( "Blessing of Rock", Entity );
								return false;	
							end
						end]]
					end

				end

				-- Check the required direct healing for this force member.
				if Entity ~= nil and not self:_CheckHeal( Entity ) then
					
				end

			end

		end

		-- Increment the state timer to postpone additional checks.
		self.StateBuffTime = Time() + 2000;

	end

	-- Nothing was executed, continue with other functions.
	return true;

end

--- Perform the required pause checks.
--
-- @return	bool

function Pause()

	self:CheckAttackFood();
  
	if Helper:CheckAvailable( "Stamina Restoration" ) and Player:GetManaCurrent() < Player:GetManaMaximum() - 3000 then
		Helper:CheckExecute( "Stamina Restoration" );
		return false;			
	end
	
	if Helper:CheckAvailable( "Rebirth Spell" ) and Player:GetHealth() < 99 and Player:GetState():GetState( "Rebirth Spell" ) == nil then
		Helper:CheckExecute( "Rebirth Spell", Player );
		return false;
	end
	
	if Player:GetHealth() < 80 and Helper:CheckAvailable( "Recovery Magic" ) then
        Helper:CheckExecute( "Recovery Magic" );
        return false;
    end
	
	 if Player:GetState():GetState("Hit Mantra Effect") == nil and Helper:CheckAvailable( "Hit Mantra" ) then
        Helper:CheckExecute( "Hit Mantra" );
        return false;
    end
    if Player:GetState():GetState("Invincibility Mantra") == nil and Helper:CheckAvailable( "Invincibility Mantra" ) then
        Helper:CheckExecute( "Invincibility Mantra" );
        return false;
    end
    if Player:GetState():GetState("Celerity Mantra Effect") == nil and Helper:CheckAvailable( "Celerity Mantra" ) then
        Helper:CheckExecute( "Celerity Mantra" );
        return false;
    end

	
	-- Nothing was executed, continue with other functions.
	return true;

end

function CheckAttackFood()
 
stateID = {10051,10064,10224,10225,9976,9989};
foodName = {"Minor Focus Agent","Lesser Focus Agent","Focus Agent","Greater Focus Agent","Major Focus Agent","Fine Focus Agent"};
flag = 0;
 
    for _,v in ipairs(stateID) do
        if Player:GetState():GetState( v ) ~= nil then
            flag = flag + 1;
        end
    end
 
    if flag == 0 then
        for a,b in ipairs(foodName) do
            if Helper:CheckAvailableInventory( b ) then
                PlayerInput:Inventory( b );
                break;
            end
        end
    end
return true;
 
 
end
Settings

Code: Select all

self.Chanter = {
			AllowBuff  = true,
			AllowHealing = true,
			AllowBuffForce = true,
			AllowApproach = true,
			AllowAttack = true,
			AllowWoWWhenGrinding = true,
			Allow2kWhenGrinding = true,
		};
Last edited by locatelli on Sat Jul 22, 2017 8:18 am, edited 5 times in total.

Online
User avatar
nucular
Site Admin
Posts: 260
Joined: Sat Jan 07, 2017 9:08 pm
Has thanked: 27 times
Been thanked: 388 times

Re: Chanter.lua

Post by nucular » Mon Jan 16, 2017 11:00 pm

Hi locatelli,

thanks for this post.

Please edit your Lua and add return false; to Check Execute Calls.
This bug is now fixed. ;-)
If you downloaded before 23:35 please redownload latest AionScript version. I made an stealth update without saying. :lol:

Code: Select all

	-- Heal 1: Stamina Recovery
	if Entity:GetID() == Player:GetID() and Helper:CheckAvailable( "Stamina Restoration" ) and HealthRecharge > 4000 then
		Helper:CheckExecute( "Stamina Restoration" );
		return false;
	end

locatelli
VIP
Posts: 71
Joined: Mon Jan 16, 2017 10:38 pm
Has thanked: 11 times
Been thanked: 8 times

Re: Chanter.lua

Post by locatelli » Mon Jan 16, 2017 11:31 pm

Updated the script!

Pizda
Posts: 2
Joined: Tue Feb 14, 2017 3:57 am

Re: Official: Chanter.lua

Post by Pizda » Fri Mar 03, 2017 3:19 am

Hello, could you please share your settings.lua? Im missing some chanter inputs under settings so im getting few errors using your script.

locatelli
VIP
Posts: 71
Joined: Mon Jan 16, 2017 10:38 pm
Has thanked: 11 times
Been thanked: 8 times

Re: Official: Chanter.lua

Post by locatelli » Fri Mar 03, 2017 6:04 pm

I added the settings

Pizda
Posts: 2
Joined: Tue Feb 14, 2017 3:57 am

Re: Official: Chanter.lua

Post by Pizda » Sat Mar 04, 2017 8:45 pm

Nice, thank you.
Everything works now, good job with the script :)

locatelli
VIP
Posts: 71
Joined: Mon Jan 16, 2017 10:38 pm
Has thanked: 11 times
Been thanked: 8 times

Re: Official: Chanter.lua

Post by locatelli » Sun Mar 05, 2017 1:43 am

Maybe I'll update this script soon!

andres
Posts: 5
Joined: Thu Feb 02, 2017 6:45 am
Has thanked: 2 times

Re: Official: Chanter.lua

Post by andres » Wed Apr 05, 2017 10:15 pm

Hello good afternoon, I have a doubt it is possible to put a chanter that supports me to make instances in duo, or that only heals me or something by style, I appreciate you give me an idea please.

Online
User avatar
nucular
Site Admin
Posts: 260
Joined: Sat Jan 07, 2017 9:08 pm
Has thanked: 27 times
Been thanked: 388 times

Re: Official: Chanter.lua

Post by nucular » Fri Apr 07, 2017 7:10 am

Hi, that's possible but you have to implement the healing yourself. ;-)

Scripting/OfficialGrinderFramework/Settings/<yoursupportcharname>.lua (Copy from ExamplePlayer.lua).

Set

Code: Select all

self.MasterName = nil;
to

Code: Select all

self.MasterName = "<yoursupportcharname>";
Your bot will now follow you and attack the same targets.
Please note that for healing, you have to implement the function "Force()" inside Classes/Chanter.lua otherwise the support chanter will just heal himself.
See Cleric.lua for an example how to do it.

vivi
Posts: 21
Joined: Wed Feb 08, 2017 11:21 pm
Been thanked: 4 times

Re: Official: Chanter.lua

Post by vivi » Mon Apr 10, 2017 2:18 pm

Here it is chanter lua i used before to go support mode, it works for 1 target healing and it works outside party too if you dont want to leech exp, it also has the vision skill so for that you have to go in party ofc.

Code: Select all

--[[

--------------------------------------------------
Copied and modified the original chanter script
--------------------------------------------------

]]--

--- (Private Function) Check required healing for the entity.
--
-- @param Entity Entity to check.
-- @param IsPriority Indicates only priority healing to be executed.
-- @return bool

function _Heal( Entity, IsPriority )

-- Retrieve the rechargeable health.
local HealthRecharge = Entity:GetHealthMaximum() - Entity:GetHealthMaximum();

-- Retrieve the state.
local EntityState = Entity:GetState();

-- Heal 1: Recovery Magic
if Helper:CheckAvailable( "Recovery Magic" ) and (( IsPriority and HealthRecharge >= 2526 ) or ( not IsPriority and Entity:GetHealth() < 60 )) then
Helper:CheckExecute( "Recovery Magic", Entity );
return false;
end

-- Heal 2: Stamina Recovery
if Entity:GetID() == Player:GetID() and Helper:CheckAvailable( "Stamina Restoration" ) and (( IsPriority and Entity:GetHealth() < 40 ) or ( not IsPriority and Entity:GetHealth() < 50 )) then
Helper:CheckExecute( "Stamina Restoration" );
return false;
end
if Player:GetManaCurrent() < 4500 and Helper:CheckAvailable( "Stamina Restoration" ) then
Helper:CheckExecute( "Stamina Restoration" );
return false;
end 
-- Heal 3: Healing Burst
if Helper:CheckAvailable( "Healing Burst" ) and (( IsPriority and Entity:GetHealth() < 40 ) or ( not IsPriority and Entity:GetHealth() < 50 )) then
Helper:CheckExecute( "Healing Burst", Entity );
return false;
end

-- Heal 4: Healing Light
if EntityState:GetState( Helper:CheckName( "Recovery Magic" )) == nil and Helper:CheckAvailable( "Healing Light" ) and (( IsPriority and Entity:GetHealth() < 50 ) or ( not IsPriority and Entity:GetHealth() < 60 )) then
Helper:CheckExecute( "Healing Light", Entity );
return false;
end

end

--- Perform the attack routine on the selected target.
--
-- @param Entity Contains the entity we have targeted.
-- @param double Contains the distance to the target
-- @param bool Indicates whether or not the target is stunned.
-- @return bool

function Attack( Entity, Range, Stunned )


-----------------------------------
--BUFF Food Checks / Scrolls;
if Settings.CritFood then
--self:CheckCritFood();
end

if Settings.AttackFood then
--self:CheckAttackFood();
end

if Settings.NaturalHeal then
--self:CheckNaturalHeal();
end

if Settings.AttackScroll then
--self:CheckAttackScroll();
end

if Settings.RunScroll then
--self:CheckRunScroll();
end

-----------------------------------





-- Prepare the attack timer when the target is stunned to determine when to use Soul Crush.
if Stunned and self.AttackTimer == nil then
self.AttackTimer = Time() + 750;
elseif not Stunned then
self.AttackTimer = nil;
end

--
-- Binding Word (Physical Charged Attack)
--


local EntityState = Player:GetState();


if Helper:CheckAvailable( "Word of Inspiration" ) and EntityState:GetState( "Word of Inspiration" ) == nil then
Helper:CheckExecute( "Word of Inspiration" );
return false;
end
if Helper:CheckAvailable( "Elemental Screen" ) and EntityState:GetState( "Elemental Screen" ) == nil then
Helper:CheckExecute( "Elemental Screen" );
return false;
end
if Helper:CheckAvailable( "Divine Curtain" ) and EntityState:GetState( "Divine Curtain" ) == nil then
Helper:CheckExecute( "Divine Curtain" );
return false;
end
if Helper:CheckAvailable( "Magic Acceleration" ) and EntityState:GetState( "Magic Acceleration" ) == nil then
Helper:CheckExecute( "Magic Acceleration" );
return false;
end
--------------------------------------------------
-- H E A L I N G --
--------------------------------------------------

self:_Heal( Player, true );

--------------------------------------------------
-- C H A I N A T T A C K (S) --
--------------------------------------------------

-- Chain Attack 1: Remove Shock
if not Stunned and Helper:CheckAvailable( "Backshock" ) and ( not Helper:CheckAvailable( "Retribution" ) or Range <= 10 ) then
Helper:CheckExecute( "Backshock" );
return false;
elseif not Stunned and Helper:CheckAvailable( "Retribution" ) then
Helper:CheckExecute( "Retribution" );
return false;
elseif Helper:CheckAvailable( "Remove Shock" ) then
Helper:CheckExecute( "Remove Shock" );
return false;
end

-- Chain Attack 2: Meteor Strike
if Helper:CheckAvailable( "Pentacle Shock" ) then
Helper:CheckExecute( "Pentacle Shock" );
return false;
elseif Helper:CheckAvailable( "Incandescent Blow" ) then
Helper:CheckExecute( "Incandescent Blow" );
return false;
end

-- Chain Attack 4 Part I: Hallowed Strike
if Helper:CheckAvailable( "Booming Smash" ) then
Helper:CheckExecute( "Booming Smash" );
return false;
elseif Helper:CheckAvailable( "Booming Assault" ) then
Helper:CheckExecute( "Booming Assault" );
return false;
end

-- Chain Attack 3: Infernal Blaze (Parrying Strike, if available, is preferred).
if not Stunned and Helper:CheckAvailable( "Parrying Strike" ) and Helper:CheckAvailable( "Infernal Blaze" ) then
Helper:CheckExecute( "Parrying Strike" );
return false;
elseif not Stunned and Helper:CheckAvailable( "Infernal Blaze" ) then
Helper:CheckExecute( "Infernal Blaze" );
return false;
end

-- Chain Attack 4 Part II: Hallowed Strike
if Helper:CheckAvailable( "Booming Strike" ) then
Helper:CheckExecute( "Booming Strike" );
return false;
end

--------------------------------------------------
-- C O N D I T I O N A L A T T A C K (S) --
--------------------------------------------------

-- Conditional Attack 1: Seismic Crash
if Helper:CheckAvailable( "Seismic Crash" ) then
Helper:CheckExecute( "Seismic Crash" );
return false;
end

-- Conditional Attack 2: Resonance Haze
if Helper:CheckAvailable( "Resonance Haze" ) then
Helper:CheckExecute( "Resonance Haze" );
return false;
end

-- Conditional Attack 3: Soul Lock
if Helper:CheckAvailable( "Soul Lock" ) then
Helper:CheckExecute( "Soul Lock" );
return false;
end 

-- Conditional Attack 4: Parrying Strike
if not Stunned and Helper:CheckAvailable( "Parrying Strike" ) then
Helper:CheckExecute( "Parrying Strike" );
return false;
end

-- Conditional Attack 5: Soul Crush
if self.AttackTimer ~= nil and self.AttackTimer < Time() and Helper:CheckAvailable( "Soul Crush" ) then
Helper:CheckExecute( "Soul Crush" );
return false;
end

--------------------------------------------------
-- P R E P A R I N G A T T A C K (S) --
--------------------------------------------------

-- When the entity is a player ...
if Entity:IsPlayer() then
if Helper:CheckAvailable( "Word of Wind" ) and Player:GetDP() >=2000 then
Helper:CheckExecute( "Word of Wind");
return false;
elseif Helper:CheckAvailable( "Divine Protection" ) and Player:GetDP() >=4000 then
Helper:CheckExecute( "Divine Protection");
return false;
end

-- Preparing Attack 1: Confident Defense
if Helper:CheckAvailable( "Confident Defense" ) then
Helper:CheckExecute( "Confident Defense" );
return false;
end 

-- Preparing Attack 2: Protective Ward
if Helper:CheckAvailable( "Protective Ward" ) then
Helper:CheckExecute( "Protective Ward" );
return false;
end

-- Preparing Attack 3: Marchutan's Protection/Yustiel's Protection
if Player:GetDP() >= 2000 then
if Helper:CheckAvailable( "Marchutan's Protection" ) then
Helper:CheckExecute( "Marchutan's Protection" );
return false;
elseif Helper:CheckAvailable( "Yustiel's Protection" ) then
Helper:CheckExecute( "Yustiel's Protection" );
return false;
end
end

-- Otherwise when the entity is not a player ...
else



-- Preparing Attack 4: Word of Revival (Also in Pause)
if Player:GetHealthCurrent() < Player:GetHealthMaximum() and Player:GetState():GetState( Helper:CheckName( "Word of Life" )) == nil and Helper:CheckAvailable( "Word of Life" ) then
Helper:CheckExecute( "Word of Life", Player );
return false;
end

end

--------------------------------------------------
-- H E A L I N G --
--------------------------------------------------

self:_Heal( Player, false );

--------------------------------------------------
-- R A N G E D A T T A C K (S) --
--------------------------------------------------

-- Ranged Attack 1: Inescapable Judgement/Soul Strike and Retribution (Chain Skill)
if not Stunned and Helper:CheckAvailable( "Inescapable Judgment" ) then
Helper:CheckExecute( "Inescapable Judgment" );
return false;
elseif not Stunned and Helper:CheckAvailable( "Soul Strike" ) then
Helper:CheckExecute( "Soul Strike" );
return false;
end

--------------------------------------------------
-- N O R M A L A T T A C K (S) --
--------------------------------------------------

-- Normal Attack 1: Mountain Crash
if Helper:CheckAvailable( "Mountain Crash" ) then
Helper:CheckExecute( "Mountain Crash" );
return false;
end

-- Normal Attack 2: Disorienting Blow
if not Stunned and Helper:CheckAvailable( "Disorienting Blow" ) then
Helper:CheckExecute( "Disorienting Blow" );
return false;
end

-- Normal Attack 3: Numbing Blow 
if not Stunned and Helper:CheckAvailable( "Numbing Blow" ) then
Helper:CheckExecute( "Numbing Blow" );
return false;
end

--------------------------------------------------
-- I N I T I A L A T T A C K (S) --
--------------------------------------------------

-- Initial Attack 1: Automatic Attack
if self.AttackStarted ~= Entity:GetID() then
self.AttackStarted = Entity:GetID();
Helper:CheckExecute( "Attack/Chat" );
return false;
end

-- Initial Attack 2: Meteor Strike
if Helper:CheckAvailable( "Meteor Strike" ) then
Helper:CheckExecute( "Meteor Strike" );
return false;
end

-- Initial Attack 3: Hallowed Strike
if Helper:CheckAvailable( "Hallowed Strike" ) then
Helper:CheckExecute( "Hallowed Strike" );
return false;
end

-- Nothing was executed, continue with other functions.
return true;

end

--- Perform healing checks both in and our of combat.
--
-- @param bool Indicates whether or not the function is running before force checks.
-- @return bool

function Heal( BeforeForce )

-- Nothing was executed, continue with other functions.
return true;

end

function Force()
-- Retrieve the entity for the current force member.

local partyE = EntityList:GetEntity( "HEALING_TARGET_NAME" );

if partyE ~= nil then
local Range = Player:GetPosition():DistanceToPosition( partyE:GetPosition());
if partyE:GetHealth() < 60 and Range <= 23 then
if Helper:CheckAvailable( "Recovery Magic" ) then
Helper:CheckExecute( "Recovery Magic", partyE );
return false;
end 
end

if partyE:GetHealth() < 30 and Range <= 23 then
if Helper:CheckAvailable( "Healing Burst" ) then
Helper:CheckExecute( "Healing Burst", partyE );
return false;
end 
end
if partyE:GetHealth() < 20 and Range <= 23 then
if Helper:CheckAvailable( "Healing Light" ) then
Helper:CheckExecute( "Healing Light", partyE );
return false;
end 
end
end
return true;
end

--- Perform the safety checks before moving to the next target.
--
-- @return bool

function Pause()
if DialogList:GetDialog( "loot_roll_dialog" ):IsVisible() then
DialogList:GetDialog( "loot_roll_dialog/abandon" ):click() 
end
--------------------------------------------------
-- H E A L I N G --
--------------------------------------------------

-- Heal 5: Word of Revival (Also in Attack)
if Player:GetHealthCurrent() < Player:GetHealthMaximum() and Player:GetState():GetState( Helper:CheckName( "Word of Life" )) == nil and Helper:CheckAvailable( "Word of Life" ) then
Helper:CheckExecute( "Word of Life", Player );
return false;
end

-- Heal 6: Magic Recovery
if Helper:CheckAvailable( "Magic Recovery" ) and Player:GetManaCurrent() < Player:GetManaMaximum() - 2500 then
Helper:CheckExecute( "Magic Recovery", Player );
return false;
end

-- Heal 0: Non-Priority Healing
self:_Heal( Player, false );

--------------------------------------------------
-- B U F F I N G --
--------------------------------------------------

-- Check if the state checking timer has expired.
if ( self.StateBuffTime == nil or self.StateBuffTime < Time()) then

-- Retrieve the state.
local EntityState = Player:GetState();


-- Buff 1: Magic of Incitement (Vision)
if Helper:CheckAvailable( "Magic of Incitement" ) then
Helper:CheckExecute( "Magic of Incitement" );
return false;
end

-- Buff 3: Promise of Wind
if Helper:CheckAvailable( "Promise of Earth" ) and EntityState:GetState( Helper:CheckName( "Promise of Earth" )) == nil then
Helper:CheckExecute( "Promise of Earth", Player );
return false;
end

-- Buff 3: Blessing of Wind. IDK BUFFING DONT WORKING
--if Helper:CheckAvailable( "Prayer of Protection" ) and EntityState:GetState( Helper:CheckName( "Prayer of Protection 5" )) == nil then
-- Helper:CheckExecute( "Prayer of Protection", Player );
-- return false;
--end

-- Buff 4: Rage Spell
--if Helper:CheckAvailable( "Rage Spell" ) and EntityState:GetState( "Rage Spell" ) == nil then
--Helper:CheckExecute( "Rage Spell", Player );
--return false;
--end

-- Update the state checking timer.
self.StateBuffTime = Time() + 1000;

end

-- Nothing was executed, continue with other functions.
return true;

end
---------------Buff Scrolls-------------
function CheckCritFood()

stateID = {10224,10225,9976,9989,10051,10064};
foodName = {"Calydon Meat Dumpling","Wild Ginseng Pickle","Tasty Calydon Meat Dumpling","Tasty Wild Ginseng Pickle","Innesi Herb Dumpling","Poma Wine Herb Dumpling","Tasty Innesi Herb Dumpling","Tasty Poma Wine Herb Dumpling"};
flag = 0;

for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end

if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end


return true;
end

--------------------------------
function CheckAttackFood()

stateID = {10051,10064,10224,10225,9976,9989};
foodName = {"Minor Focus Agent","Lesser Focus Agent","Focus Agent","Greater Focus Agent","Major Focus Agent","Fine Focus Agent"};
flag = 0;

for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end

if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end
return true;


end
-----------------------------------
function CheckNaturalHeal()

stateID = {10044,10094};
foodName = {"Minor Rally Serum","Lesser Rally Serum","Rally Serum","Greater Rally Serum","Major Rally Serum","Fine Rally Serum","Tasty Ormea Cocktail"};
flag = 0;

for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end

if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end
return true;

end
-------------------------------------
function CheckAttackScroll()

stateID = {9959};
foodName = {"Courage Scroll"};
flag = 0;

for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end

if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end
return true;

end
--------------------------
function CheckRunScroll()

stateID = {9960};
foodName = {"Running Scroll"};
flag = 0;

for _,v in ipairs(stateID) do
if Player:GetState():GetState( v ) ~= nil then
flag = flag + 1;
end
end

if flag == 0 then
for a,b in ipairs(foodName) do
if Helper:CheckAvailableInventory( b ) then
PlayerInput:Inventory( b );
break;
end
end
end
return true;

end

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest