StreamTemple é um sistema que proporciona uma visualização em tempo real da movimentação de characters em um determinado local do server, isso vai depender das suas configurações...
Esse sistema foi criado por Gesior.pl para versão TFS 1.0 e migrado para a versão TFS 0.4 por Killua
Vamos la galera, em data/globalevents/scripts crie um arquivo .lua e nomeie para stream_temple.lua adicione dentro do mesmo este code:
-- for linux default: '/var/www/streamtemple/stream.json' -- create folder 'streamtemple' in main folder of acc. maker! -- [LINUX] check that folder 'streamtemple' has rights to create new file by anyone local playerJsonInfoPath = '/var/www/streamtemple/stream.json' -- center position of your 'stream' - make sure you set valid left/top corner of image in PHP! -- stream show only players on same 'floor'/'level' local centerPosition = {x = 32349, y = 32222, z = 7} --[[ I RECOMMEND TO NOT SET WIDTH HIGHER THEN 20, BECAUSE IT MAY CAUSE LITTLE LAG ON SERVERS WITH 300-400 ONLINE! ]]-- -- viewWidth is not really width of stream, if viewWidth is '11': -- then stream shows players 11 tiles to the left and 11 tiles to the right from center positon, so real width is 23 tiles! local viewWidth = 11 -- viewHeight is not really height of stream, if viewHeight is '6': -- then stream shows players 6 tiles to the top and 6 tiles to the bottom from center positon, so real height is 13 tiles! local viewHeight = 6 function onThink() -- get players/monsters/npcs in area list local spectators = getSpectators(centerPosition, viewWidth, viewHeight, false) -- generate information local stream = "{" if(spectators) then for _, spectator in pairs(spectators) do local player = spectator if(player) then local playerPosition = getCreaturePosition(player) local playerOutfit = getCreatureOutfit(player) if(centerPosition.z == playerPosition.z) then stream = stream .. '"'..getCreatureName(player)..'":['.. playerPosition.x ..','.. playerPosition.y ..','.. playerPosition.z ..','.. playerOutfit.lookType ..','.. playerOutfit.lookAddons ..','.. playerOutfit.lookHead ..','.. playerOutfit.lookBody ..','.. playerOutfit.lookLegs ..','.. playerOutfit.lookFeet ..','.. getPositionByDirection(player) ..','.. getCreatureLookDirection(player) ..',' .. playerOutfit.lookTypeEx .. ','.. getCreatureSkullType(player) ..'],' end end end end stream = stream .. '}' -- save to file local streampath = io.open(playerJsonInfoPath, "w") streampath:write(stream) streampath:close() return true end
No arquivo acima faça as seguintes alterações:
Aqui altere pro local correto onde ficara localizada a pasta streamtemple na pasta do site.
local playerJsonInfoPath = '/var/www/streamtemple/stream.json'
Aqui você vai botar as coordenada central de acordo com a imagem que vai utilizar.
local centerPosition = {x = 32349, y = 32222, z = 7}
Em globalevents.xml registre esse code:
<!-- Stream Temple --> <globalevent name="stream" interval="700" script="stream_temple.lua"/>
No site você vai adicionar o arquivo .php chamado de streamtemple.php com esse code:
<style type="text/css"> .alpha_wrapper { padding-top: 8px; float: left; position: relative; color: #fff; width: 96px; text-align: center; } .name { white-space: nowrap; color: rgb(0, 255, 0); font-size:10px; width: 50%; margin: 0px auto; padding-bottom: 2px; font-family: Verdana; text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; } .skull { background: transparent url(images/skulls/redskull.gif) no-repeat; position: absolute; top: 31px; left: 57px; width: 11px; height: 11px; width: 50%; margin: 0px auto; } </style> <div style="float:center;text-align:center;margin: 0 auto;text-shadow:0 0 5px #fff;font-family:Georgia,serif;font-weight:strong;font-size:35px;"><img src=megastr.png></div> <!-- Your temple image must have tiles width/height 32px! --> <!-- There is 'streamtemple/temple.png', if you keep your temple image in other format or on other host, edit this. DO NOT FORGET TO EDIT THIS PART OF LINE BELOW: 'width:600px;height:380px', there must be width and height of your temple image! --> <div style="background-image:url('streamtemple/temple.png');width:600px;height:380px;box-shadow:0 0 20px #000;font-family:Arial, sans-serif;border:2px solid black;margin:5px auto;text-align:center;overflow:hidden;position:relative;" id="templeAnimationWindow"></div> <script type="text/javascript"> // -- CONFIG -- // url to stream file - it's NOT full path to that file like 'c:\xampp\...' var playerJsonInfoURL = 'streamtemple/stream.json'; // BEST VALUE IS SAME AS INTERVAL IN GLOBALEVENTS.XML var updateIntervalInSeconds = 1; // It's NOT same position as center of stream in LUA, this position depends on your temple image on www! // set it to position that is in game when you look at top-left corner of your temple image (+/- 1 after tests on www) // -- example: // HARD PART: If your image on www shows 16x8 tiles of 'game screen' and left-top corner positon is '1000,1000' then.. // What is center-position and width/height for LUA script config? [if it's on floor 7..] // YES! It's: Position(1008, 1004, 7), width: 8 (8*2+1 = 17, more then your image!), height: 4 (4*2+1 = 9, more ..!) // --- // but don't worry, if you set it to (32337,32220,7) and set width 15 and height 15 it will work too! (just use more CPU then it should) var leftTopCornetX = 32339; var leftTopCornetY = 32216; // adjust these values (from -32 to 32, it's value in pixels) to make your character stand at same position as in game // you must compare image on www and in game by yourself var imageCorrectionX = 2; var imageCorrectionY = 4; // images URL var itemImagesURL = 'http://item-images.ots.me/1030/'; // outfit generation script URL, you need your own outfit images host, how to create: // http://otland.net/threads/gesior2012-make-your-own-outfits-items-country-flags-hosting-recommended.210844/ var outfitImagesURL = 'outfit.php'; // -- END OF CONFIG -- function disableSelection(target) { if (typeof target.onselectstart!="undefined") { target.onselectstart=function(){return false} } else if (typeof target.style.MozUserSelect!="undefined") { target.style.MozUserSelect="none"; } else { target.onmousedown=function(){return false} } target.style.cursor = "default"; } disableSelection(document.body); var uid = Math.floor(Math.random()*(10000000-1))+10000000; function handler(data) { setTimeout(update, updateIntervalInSeconds * 1000); try { var obj = eval("(" + data + ")"); } catch(err) {} var s = ''; for (x in obj) { var k = obj[x]; s += '<div style="z-index:'+(k[1]-20)+';position:absolute;top:'+(((k[1]-leftTopCornetY)*32)+imageCorrectionY)+'px;left:'+(((k[0]-leftTopCornetX)*32)+imageCorrectionX)+'px;width:64px;height:64px;background:transparent url('; if(k[3] == 0) { s += itemImagesURL + k[11]+'.gif'; } else { var mountID = parseInt(k[9]); if(mountID > 0) { mountID += 65536; } s += outfitImagesURL + '?id='+k[3]+'&addons='+k[4]+'&head='+k[5]+'&body='+k[6]+'&legs='+k[7]+'&feet='+k[8]+'&direction='+(parseInt(k[10])+1); } s += ') no-repeat right bottom;">' + '<div class="alpha_wrapper">' + '<div class="name" style="margin: 5px 19px">'+x.replace(/( )/g,' ')+'</div>' + '<div style="margin-left: 34px; margin-top: -7px; width: 25px; height: 2px; background-color: rgb(0, 191, 0); border: 1px solid black;"></div>'; if(k[12] >= 3) { // known problem: there is no white skull image in Gesior2012, if you got it, you can put it in your /images/skulls/ s += '<div class="skull" style="background-image:url(images/skulls/'+(k[12] == 3 ? 'white' : (k[12] == 4 ? 'red' : 'black')) + 'skull.gif);"> </div>'; } s += '</div></div>'; } document.getElementById('templeAnimationWindow').innerHTML = s; } function update() { var xhr; try { xhr=new XMLHttpRequest(); } catch (e) { try { xhr=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xhr.open("GET", playerJsonInfoURL + "?"+Math.random(), true); xhr.onreadystatechange=function() { // status 4 = query realized without problems if(xhr.readyState==4) { // if query failed for some reason, it will stop animation handler(xhr.responseText); } } xhr.send(null); } update(); </script>
E o outfit.php.
Certo aqui você baixe a pasta abaixo que já com o arquivo stream.json e uma imagem que utilizo no meu servidor.
E baixe essa pasta de outfits pro sistema funcionar perfeitamente: