forked from BenDol/otclient-candybot
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PvP Friend Healer (only spell currently)
Some small bugfixes to walker and settings loading
- Loading branch information
Showing
11 changed files
with
205 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--[[ | ||
@Authors: zygzagZ | ||
@Details: Friend healer event logic | ||
]] | ||
|
||
PvpModule.Healer = {} | ||
Healer = PvpModule.Healer | ||
|
||
-- Variables | ||
|
||
Healer.lastTarget = 0 | ||
|
||
-- Methods | ||
|
||
function Healer.init() | ||
|
||
end | ||
|
||
function Healer.terminate() | ||
|
||
end | ||
|
||
function Healer.connect() | ||
connect(Player, { onHealthPercentChange = Healer.onHealthChange }) | ||
addEvent(function() | ||
local spec = g_map.getSpectators(g_game.getLocalPlayer():getPosition(), true) | ||
for k, v in pairs(spec) do | ||
if v:isPlayer() then | ||
Healer.onHealthChange(v, v:getHealthPercent()) | ||
end | ||
end | ||
end) | ||
end | ||
|
||
function Healer.disconnect() | ||
disconnect(Player, { onHealthPercentChange = Healer.onHealthChange }) | ||
end | ||
|
||
function Healer.onHealthChange(friend, health) | ||
local player = g_game.getLocalPlayer() | ||
if table.contains(PvpModule.Friends, friend:getName()) then | ||
if health <= CandyBot.getOption('HealerTreshold') then | ||
if player:getHealthPercent() >= CandyBot.getOption('HealerSelfHealth') and player:getManaPercent() >= CandyBot.getOption('HealerSelfMana') then | ||
if g_map.isSightClear(player:getPosition(), friend:getPosition()) then | ||
g_game.talk(CandyBot.getOption('HealerSpell'):gsub("friend", friend:getName())) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.