|
楼主 |
发表于 2012-9-13 15:40:13
|
显示全部楼层
本帖最后由 =|HERO|=Depower 于 2012-9-13 15:43 编辑
=|HERO|=ZeRooo 发表于 2012-9-13 15:31
1000盾求教程 - //Modified by HERO houzi
- defaults.text.size=10;
- defaults.text.color='ff8a00';
- defaults.text.font='0oAmGAtL60NkDOrkfA/Purista-SemiBold.ttf';
- //Background
- image({file:'0p4cUbkIy0ufpwLvMw/hero1.png', x:0, y:0});
- // Script
- function secondstotime(secs)
- {
- var t = new Date(1970,0,1);
- t.setSeconds(secs);
- var s = t.toTimeString().substr(0,8);
- if(secs > 86399)
- s = Math.floor((t - Date.parse('1/1/70')) / 3600000) + s.substr(2);
- return s;
- }
- // 1April's list sort script
- // func(list of objects, field of objects to use for sort)
- var getSortedList=function(list,field){
- if(typeof(list)!='object') return list;
- var slist=[];
- for(var n in list) slist.push([n,list[n]]);
- slist.sort(function(a,b){
- var v1=a[1], v2=b[1];
- v1=(typeof(v1)!='object' || typeof(v1[field])!='number')?0:v1[field];
- v2=(typeof(v2)!='object' || typeof(v2[field])!='number')?0:v2[field];
- return v2-v1;
- });
- if(list instanceof Array) {
- var ret=[];
- for(var i in slist) ret.push(slist[i][1]);
- return ret;
- } else {
- var ret={};
- for(var i in slist) ret[slist[i][0]]=slist[i][1];
- return ret;
- }
- };
- //time
- // Tiempo
- var tiempo=p.stats.global.time/3600;
- var tiempomin=p.stats.global.time/60;
- var tiempom=tiempomin.toFixed(0)-tiempo.toFixed(0)*60+60
- // Fav. kit
- var score2kit={
- assault:p.stats.scores.assault,
- engineer:p.stats.scores.engineer,
- recon:p.stats.scores.recon,
- support:p.stats.scores.support
- };
- var favkit='assault';
- var favkitscore=0;
- for(var kit in score2kit){
- if(score2kit[kit]<=favkitscore) continue;
- favkitscore=score2kit[kit];
- favkit=kit;
- }
- var kit_sx=0;
- var kit_sy=0;
- if(favkit == 'assault')
- {kit_sx=0;
- kit_sy=0;}
- else if(favkit == 'engineer')
- {kit_sx=16;
- kit_sy=0;}
- else if(favkit == 'support')
- {kit_sx=0;
- kit_sy=16;}
- else
- {kit_sx=16;
- kit_sy=16;}
- kdrcolor = '';
- kdr=(p.stats.global.kills/p.stats.global.deaths);
- if(kdr >= 0) {kdrcolor='de0000';}
- if(kdr >= 1) {kdrcolor='ff4800';}
- wlrcolor = '';
- wlr=(p.stats.global.wins/p.stats.global.losses);
- if(wlr >= 0) {wlrcolor='de0000';}
- if(wlr >= 1) {wlrcolor='ff4800';}
- //MAIN SIGNATURE ******
- // Rank / Country / Name
- var rcnx=303;
- var rcny=18;
- //KIT
- //Kit image
- image({file:'06xhlEg8G19UvkJiy4/kits_white.png', x:rcnx-55, y:5, w:18, h:18, sx:kit_sx,sy:kit_sy,sw:16,sh:16});
- // Rank image
- image({file:p.stats.rank.img_tiny, x:6, y:rcny-15});
- // Flag
- image({file:'flags/cn.png', x:rcnx-34, y:rcny-9, w:16, h:11});
- //Player Name
- text({text:p.name, font:'0oAmGAtL60NkDOrkfA/Purista-Bold.ttf', x:39, y:21, size:16, color:'FFFFFF'});
- //ACTUAL STATS
- var firstcol=4;
- var firstcolstat=118;
- var secondcol=121;
- var secondcolstat=222;
- //FIRST COLUMN NAME
- text({x:firstcol, y:39, text:'Score', color:'6a6a6a'});
- text({x:firstcol, y:53, text:'Kills', color:'6a6a6a'});
- text({x:firstcol, y:67, text:'Deaths', color:'6a6a6a'});
- text({x:firstcol, y:81, text:'K/D', color:'6a6a6a'});
- text({x:firstcol, y:95, text:'SPM', color:'6a6a6a'});
- //FIRST COLUMN STAT
- text({x:firstcolstat, y:39, text:p.stats.scores.score, align:'right'});
- text({x:firstcolstat, y:53, text:p.stats.global.kills, align:'right'});
- text({x:firstcolstat, y:67, text:p.stats.global.deaths, align:'right'});
- text({x:firstcolstat, y:81, text:(p.stats.global.kills/p.stats.global.deaths).toFixed(2), align:'right', color:kdrcolor});
- text({x:firstcolstat, y:95, text:(p.stats.scores.score/tiempomin).toFixed(1), align:'right'});
- //SECOND COLUMN NAME
- text({x:secondcol, y:39, text:'Wins', color:'6a6a6a'});
- text({x:secondcol, y:53, text:'Losses', color:'6a6a6a'});
- text({x:secondcol, y:67, text:'W/L', color:'6a6a6a'});
- text({x:secondcol, y:81, text:'Time', color:'6a6a6a'});
- text({x:secondcol, y:95, text:'Skill', color:'6a6a6a'});
- //SECOND COLUMN STAT
- text({x:secondcolstat, y:39, text:p.stats.global.wins, align:'right'});
- text({x:secondcolstat, y:53, text:p.stats.global.losses, align:'right'});
- text({x:secondcolstat, color:wlrcolor, y:67, text:(p.stats.global.wins/p.stats.global.losses).toFixed(2), align:'right'});
- text({x:secondcolstat, y:81, text:secondstotime(p.stats.global.time), align:'right'});
- text({x:secondcolstat, y:95, text:(p.stats.global.elo).toFixed(0), align:'right'});
- // get weapons list sorted by number of kills
- var bestweaps=getSortedList(p.stats.vehicles,'kills');
- //bestwep
- // find best gun in sorted weapons list, excluding pistols
- wcount=0;
- for (n in bestweaps) {
- if (bestweaps[n].category!='Pistols' && wcount!=1) {
- wcount++;
- if (wcount==1) weapy=33;
- image({x:224, y:weapy-3, file:bestweaps[n].img, w:62, h:38});
- wtext='';
- wtext='[ '+bestweaps[n].name+' ]';
- text({x:224, y:weapy+3, size:7, text:wtext});
- wtext=bestweaps[n].kills + ' kills';
- text({x:325, y:weapy+28, size:7, text:wtext, align:'right'});
- }
- }
复制代码 这个是上图所用代码。很简单的,可以控制想显示什么东西(什么都可以),字体及大小,背景图案,整体大小等等。 |
|