Skip to content

Instantly share code, notes, and snippets.

@EricsonWillians
Last active March 15, 2016 06:58
Show Gist options
  • Save EricsonWillians/b0dfb460fd3287bceb0a to your computer and use it in GitHub Desktop.
Save EricsonWillians/b0dfb460fd3287bceb0a to your computer and use it in GitHub Desktop.
Python script for sorcerers that use Tibia Auto.
"""
Insane Sorcerer Script for Tibia Auto (Tested with 8.6 client) and for http://tibiaauto.net/forum/,
By Ericson Willians (Rederick Deathwill): https://github.com/EricsonWillians
Instructions:
You just have to activate it and it will throw exori morts and frigos in all the visible targets,
The target on the battle may change, so don't be scared if the target changes suddenly,
Just be cautious and use it in relatively safe spawns (Since it can be too dangerous, due to the target change).
The script uses Utamo Vita and Utani Gran Hur constantly, so that you can forget about it.
The default rune is a SD, and since the script is called "Insane Sorcerer", I find it more than adequate,
But don't worry, for it's really easy to customize the whole thing to work for a Druid.
BEWARE:
Use it on OTs only, since it's pretty obvious that you attack and change targets fast and in a deeply inhuman fashion.
And of course, remember to list your party friends within the list within setTarget, so that they can avoid a miserable death.
OBS:
The script is written in a non-pythonic java-like camelCase fashion because I value consistency above conventions
(Considering the native / default style of T.A., of course)
"""
from random import randint
def getDelayValue():
return randint(10000, 15000)
class InsaneSorcerer:
def __init__(self):
self.cid = 0
self.saveChoice = 0
self.saveDelay = getDelayValue()
self.spellChoice = 0
self.spells = ["exori mort", "exori frigo", "utamo vita", "utani gran hur"]
self.exceptions = ["Magic", "Loot"]
self.SUDDEN_DEATH = 3155
def getName(self):
return "Insane Sorcerer"
def getVersion(self):
return "1.0"
def getFunDef(self, nr):
if nr == 0:
return (0, 3000, self.setTarget)
elif nr == 1:
return (0, 1300, self.kill)
elif nr == 2:
return (0, self.saveDelay, self.save)
return ()
def getConfigParam(self, nr):
if nr == 0:
pass
return ()
def setTarget(self, params):
if tareader.readBattleListMax() > -1:
creature = tareader.readVisibleCreature(tareader.readBattleListMin())
cname = creature["name"]
try:
if tareader.readSelfCharacter()['z'] == creature['z']:
for toBeIgnored in ['', tareader.readSelfCharacter()["name"], "Windrunner gump", "Fafefifofu", "Dark skull"]:
if cname != toBeIgnored and self.exceptions[0] not in cname and self.exceptions[1] not in cname:
if tareader.getMemIntValue(taitem.getValueForConst("addrAttackedCreature")) != creature["tibiaId"]:
self.cid = creature["tibiaId"]
tareader.setMemIntValue(taitem.getValueForConst("addrAttackedCreature"), creature["tibiaId"])
else:
tasender.useItemOnCreature(self.SUDDEN_DEATH, creature["tibiaId"]);
except Exception, e:
f = open("log.txt", 'w')
f.write(str(e))
return ()
def kill(self, params):
if tareader.readBattleListMax() > -1 and tareader.getMemIntValue(taitem.getValueForConst("addrAttackedCreature")) == self.cid:
if not self.spellChoice:
tasender.say(self.spells[0])
self.spellChoice = 1
else:
tasender.say(self.spells[1])
self.spellChoice = 0
return ()
def save(self, params):
if not self.saveChoice:
tasender.say(self.spells[2])
self.saveChoice = 1
else:
tasender.say(self.spells[3])
self.saveChoice = 0
self.saveDelay = getDelayValue()
return ()
tibiaauto.registerPlugin(InsaneSorcerer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment