Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Opponent Info
- // @namespace FW
- // @version 0.1
- // @description Opponent info
- // @author Yuri
- // @match http://fantasy-world.pl/game
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- setInterval(function(){
- var format = (num, decimals) => num.toLocaleString('en-US', {
- minimumFractionDigits: 1,
- maximumFractionDigits: 2,
- });
- // ile ma życia
- if($(".object-health-now").length !== 0) {
- let obj = {};
- obj['hp_max'] = 32;
- obj['hp'] = format(parseFloat($(".object-health-now").css('width')));
- obj['hp_percent'] = format(obj['hp'] / obj['hp_max'] * 100);
- obj['info'] = $(".object-health-now").parent().attr('data-tip');
- obj['name'] = obj['info'].split('<br>')[0];
- obj['level'] = obj['info'].split('<small>').pop().split('</small>')[0];
- if($('#opponent_div').length == 0) {
- let opponent_div = document.createElement("div");
- opponent_div.id = 'opponent_div';
- document.body.appendChild(opponent_div);
- } else
- $('#opponent_div').css('display', 'block');
- $('#opponent_div').css({
- "background": "url(https://zapodaj.net/images/3910f787131c7.png)",
- "height": "94px",
- "width": "257px",
- "position": "absolute",
- "left": "20px",
- "top": "50px",
- "z-index": 9999,
- "color": "#eee",
- "box-sizing": "border-box",
- "line-height": "15px",
- "font-size": "12px"
- });
- let e = '<div class="opponent-health" style="width: 174px; background-size: '+(174/100)*obj.hp_percent+'px 15px;height:15px;text-align:center;background-repeat:no-repeat;background-image:url(\'http://fantasy-world.pl/templates/client/default/images/others/health_points.png\'); position:absolute;top:23px;left:43px;">'+obj.hp_percent+'%</div>';
- let f = '<div class="opponent-health" style="width: 174px; height:15px;text-align:center;position:absolute;top:47px;left:43px;">'+obj.info.split('<br>').join(' ').split('Poziom:').join('lvl.')+'</div>';
- $("#opponent_div").html(e + f);
- }else {
- if($('#opponent_div').length !== 0) {
- $('#opponent_div').css('display', 'none');
- }
- }
- },500);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement