Follow along with the video below to see how to install our site as a web app on your home screen.
Notka: This feature may not be available in some browsers.
import time
import locale
import math
class ModuleWall:
wallspos = []
walls = []
lastwall = {}
def getName(self):
return "MagicWall Timer"
def getVersion(self):
return "2.6"
def getFunDef(self,nr):
if (nr==0): return (0,200,self.findWall);
if (nr==1): return (0,100,self.printWall);
if (nr==2): return (0,500,self.delWall);
return ();
def getConfigParam(self,nr):
if (nr==0): return ('rad','def:4 radius of detection(to reduce CPU)');
return ();
def findWall(self,params):
me=tareader.readSelfCharacter();
rad=4;
try: rad=int(params['rad']);
except: pass;
for y in range(-5,5):
for x in range(-7,7):
if abs(x)>rad or abs(y)>rad:
continue;
topPos=tareader.mapGetPointTopPos(x,y,0);
itemID = tareader.mapGetPointItemId(x,y,0,topPos);
if itemID == 0x851 or itemID == 0x850 or itemID == 10181 and me['moving'] == 0:
wall = { 'x': me['x']+x, 'y': me['y']+y, 'time': time.time()+20};
wallpos = { 'x': me['x']+x, 'y': me['y']+y };
if self.walls.count(wall) < 1 and self.wallspos.count(wallpos) < 1:
self.wallspos.append(wallpos);
self.walls.append(wall);
return;
def printWall(self,params):
me=tareader.readSelfCharacter();
for wall in (self.walls):
if wall['time'] - time.time() > -1 and me['moving'] == 0:
eraseloc=self.lastwall.get((wall['x'],wall['y']),-1);
if eraseloc != -1 and eraseloc!=(wall['x']-me['x'],wall['y']-me['y']):
tasender.printText(420+50*eraseloc[0],300+50*eraseloc[1],255,255,255," ");
timeint=math.ceil(wall['time']-time.time())
if timeint<3:
tasender.printText(420+50*(wall['x']-me['x']),300+50*(wall['y']-me['y']),255,128,0,locale.format("%d ",timeint));
else:
tasender.printText(420+50*(wall['x']-me['x']),300+50*(wall['y']-me['y']),255,255,255,locale.format("%d ",timeint));
self.lastwall[(wall['x'],wall['y'])]=(wall['x']-me['x'],wall['y']-me['y']);
return;
def delWall(self,params):
me=tareader.readSelfCharacter();
for wall in (self.walls):
if time.time() >= wall['time']+.8:
tasender.printText(420+50*(wall['x']-me['x']),300+50*(wall['y']-me['y']),255,255,255," ");
self.walls.remove(wall);
for wallpos in (self.wallspos):
if self.walls<self.wallspos:
self.wallspos.remove(wallpos);
return;
tibiaauto.registerPlugin(ModuleWall);