-
Notifications
You must be signed in to change notification settings - Fork 0
/
combined.min.js
2 lines (2 loc) · 35.9 KB
/
combined.min.js
1
2
var ps2App=angular.module("ps2App",["ngRoute","ps2Controllers"]);ps2App.config(function($routeProvider){$routeProvider.when("/",{templateUrl:"pages/home.html",controller:"mainController"}).when("/outfit/:id",{templateUrl:"pages/outfit.html",controller:"outfitController"}).when("/character/:id",{templateUrl:"pages/character.html",controller:"characterController"}).when("/friends/:id",{templateUrl:"pages/friends.html",controller:"friendsController"})}),angular.module("ps2Controllers",["search","outfit","character"]).controller("mainController",function($scope,$routeParams,search){$scope.term=$routeParams.term,$scope.limit=search.getLimit(),search.getWorlds().then(function(worlds){$scope.worlds=worlds}),$scope.submit=function(){search.findCharacters($scope.term).then(function(characters){$scope.characters=characters}),search.findOutfits($scope.term).then(function(outfits){$scope.outfits=outfits})},$scope.term&&$scope.submit()}).controller("searchController",function($scope,$location){$scope.term="",$scope.submit=function(){$location.path("/").search({term:$scope.term})}}).controller("outfitController",function($scope,$rootScope,$routeParams,outfit){var id=$routeParams.id;$scope.period="weekly",outfit.get(id).then(function(outfit){$scope.outfit=outfit,$rootScope.title=outfit.name}),outfit.getMembers(id).then(function(members){return $scope.members=members,outfit.fillMembersStats(id,members)})}).controller("characterController",function($scope,$rootScope,$routeParams,character){var id=$routeParams.id;$scope.limit=100,$scope.getMore=function(){$scope.limit+=100,character.getKillboard(id,$scope.limit).then(function(events){$scope.events=events})},character.get(id).then(function(character){$scope.character=character,$rootScope.title=character.name}),character.getKillboard(id,$scope.limit).then(function(events){$scope.events=events})}).controller("friendsController",function($scope,$rootScope,$routeParams,character){var id=$routeParams.id;$scope.period="weekly",character.get(id).then(function(character){$scope.character=character,$rootScope.title=character.name}),character.getFriends(id).then(function(friends){$scope.friends=friends})}).filter("formatDuration",function(){return function(seconds){var m=moment.duration(seconds,"s"),str="",count=2,days=Math.floor(m.asDays());return days>0&&(str=str+days+"d ",count--),m.hours()>0&&(str=str+Math.floor(m.hours())+"h ",0==--count)?str:m.minutes()>0&&(str=str+Math.floor(m.minutes())+"m ",0==--count)?str:(m.seconds()>0&&(str=str+Math.floor(m.seconds())+"s ",--count),str)}}).filter("formatTimestamp",function(){var limit=moment().subtract(1,"months");return function(timestamp){return moment.unix(timestamp).isAfter(limit)?moment.unix(timestamp).format("MMM D, HH:mm:ss"):moment.unix(timestamp).format("YYYY MMM D")}}).filter("formatTimestamp2",function(){return function(timestamp){return moment.unix(timestamp).fromNow()}}).filter("factionCode",function(){return function(factionId){var code;switch(factionId){case"1":code="vs";break;case"2":code="nc";break;case"3":code="tr";break;default:code="unkwown"}return code}}),angular.module("character",["ps2Utils"]).factory("character",function($q,$http,ps2Utils){var CHARACTER_URL="http://census.daybreakgames.com/s:mereth/get/ps2:v2/character/?";CHARACTER_URL+="c:join=characters_stat_history^list:1^inject_at:characters_stat_history",CHARACTER_URL+="&c:tree=start:characters_stat_history^field:stat_name",CHARACTER_URL+="&c:join=outfit_member^on:character_id^inject_at:outfit_member(outfit^inject_at:outfit)",CHARACTER_URL+="&c:join=characters_online_status^on:character_id^inject_at:characters_online_status^show:online_status",CHARACTER_URL+="&c:join=faction^inject_at:faction^show:image_path'code_tag";var KILLBOARD_URL="http://census.daybreakgames.com/s:mereth/get/ps2:v2/characters_event/?type=KILL,DEATH";KILLBOARD_URL+="&c:join=character^show:character_id'name.first'battle_rank.value'faction_id^inject_at:character",KILLBOARD_URL+="(",KILLBOARD_URL+="characters_stat_history^on:character_id^terms:stat_name=kills^show:all_time'week.w01'week.w02^inject_at:stat_kills",KILLBOARD_URL+=",characters_stat_history^on:character_id^terms:stat_name=deaths^show:all_time'week.w01'week.w02^inject_at:stat_deaths",KILLBOARD_URL+=",characters_stat_history^on:character_id^terms:stat_name=score^show:all_time'week.w01'week.w02^inject_at:stat_score",KILLBOARD_URL+=",characters_stat_history^on:character_id^terms:stat_name=time^show:all_time'week.w01'week.w02^inject_at:stat_time",KILLBOARD_URL+=",outfit_member^show:outfit_id^inject_at:outfit(outfit^show:name'alias^inject_at:details)",KILLBOARD_URL+=")",KILLBOARD_URL+="&c:join=character^on:attacker_character_id^to:character_id^show:character_id'name.first'battle_rank.value'faction_id^inject_at:attacker_character",KILLBOARD_URL+="(",KILLBOARD_URL+="characters_stat_history^on:character_id^terms:stat_name=kills^show:all_time'week.w01'week.w02^inject_at:stat_kills",KILLBOARD_URL+=",characters_stat_history^on:character_id^terms:stat_name=deaths^show:all_time'week.w01'week.w02^inject_at:stat_deaths",KILLBOARD_URL+=",characters_stat_history^on:character_id^terms:stat_name=score^show:all_time'week.w01'week.w02^inject_at:stat_score",KILLBOARD_URL+=",characters_stat_history^on:character_id^terms:stat_name=time^show:all_time'week.w01'week.w02^inject_at:stat_time",KILLBOARD_URL+=",outfit_member^show:outfit_id^inject_at:outfit(outfit^show:name'alias^inject_at:details)",KILLBOARD_URL+=")",KILLBOARD_URL+="&c:join=item^on:attacker_weapon_id^to:item_id^show:name.en'image_path^inject_at:attacker_weapon",KILLBOARD_URL+="&c:join=vehicle^on:attacker_vehicle_id^to:vehicle_id^show:name.en'image_path^inject_at:attacker_vehicle";var FRIENDS_URL="http://census.daybreakgames.com/s:mereth/get/ps2:v2/characters_friend?";FRIENDS_URL+="c:join=character^on:friend_list.character_id^to:character_id^inject_at:character",FRIENDS_URL+="(",FRIENDS_URL+="characters_stat_history^on:character_id^inject_at:characters_stat_history^list:1",FRIENDS_URL+=",outfit_member^show:outfit_id^inject_at:outfit(outfit^show:name'alias^inject_at:details)",FRIENDS_URL+=")";var transform=function(census_result){var raw=census_result.character_list[0],character={character_id:raw.character_id,name:raw.name.first};raw.outfit_member&&(character.outfit=raw.outfit_member.outfit,character.outfit.alias?character.outfit.label="["+character.outfit.alias+"] "+character.outfit.name:character.outfit.label=character.outfit.name),raw.characters_online_status&&(character.online=raw.characters_online_status.online_status);var faction=ps2Utils.getFaction(raw.faction_id);character.faction_tag=faction.factionTag,character.faction_image=faction.factionImage,character.statistics=null,character.last_update="";var characters_stat_history=raw.characters_stat_history;characters_stat_history&&(character.statistics=ps2Utils.computeStatistics(characters_stat_history),character.last_update=ps2Utils.convertTimezone(characters_stat_history.score.last_save));var rank=raw.battle_rank.value;return character.rank=ps2Utils.getComputedRank(characters_stat_history.score.all_time),character.rank_image="https://census.daybreakgames.com"+ps2Utils.getRankImage(rank,character.faction_tag),character},processKillboard=function(census_result){var events=[];return _.forEach(census_result.characters_event_list,function(event){var model={};model.type=event.table_type;var character=event.character;if("deaths"===model.type&&(character=event.attacker_character),model.suicide=0,event.character_id===event.attacker_character_id){if("kills"===model.type)return;model.suicide=1}if(model.headshot=0,"1"===event.is_headshot&&(model.headshot=1),model.timestamp=event.timestamp,model.faction="",character){var faction=ps2Utils.getFaction(character.faction_id);model.faction=faction.factionTag,model.character_id=character.character_id,model.name=character.name.first,model.rank=character.stat_score?ps2Utils.getComputedRank(character.stat_score.all_time):"N/A",character.outfit&&character.outfit.details&&(model.outfit={outfit_id:character.outfit.outfit_id,name:character.outfit.details.name,alias:character.outfit.details.alias},model.outfit.alias?model.outfit.label="["+model.outfit.alias+"] "+model.outfit.name:model.outfit.label=model.outfit.name),model.kd=ratio(character.stat_kills,character.stat_deaths).toFixed(2),model.spm=(60*ratio(character.stat_score,character.stat_time)).toFixed(0),model.kpm=(60*ratio(character.stat_kills,character.stat_time)).toFixed(2)}event.attacker_weapon&&(model.weapon=event.attacker_weapon.name.en),event.attacker_vehicle&&(model.vehicle=event.attacker_vehicle.name.en,model.weapon===model.vehicle&&delete model.vehicle),model.css=model.faction,model.css+="deaths"===model.type?" active":"",model.css+=model.suicide?" suicide":"",model.css+=model.headshot?" headshot":"",events.push(model)}),events},processFriends=function(data){var friends=[];if(data.returned)return _.forEach(data.characters_friend_list[0].friend_list,function(friend){var character=friend.character;if(!character)return void(console.log&&console.log("character '"+friend.character_id+"' not found."));var characters_stat_history=_.indexBy(character.characters_stat_history,"stat_name");character.statistics=ps2Utils.computeStatistics(characters_stat_history),friend.online?character.characters_online_status=friend.online:character.characters_online_status="0";var outfit=character.outfit;outfit&&outfit.details&&(outfit.display_name=outfit.details.name,outfit.details.alias&&(outfit.display_name="["+outfit.details.alias+"] "+outfit.display_name)),characters_stat_history.score&&(character.rank=ps2Utils.getComputedRank(characters_stat_history.score.all_time),character.last_update=characters_stat_history.score?ps2Utils.convertTimezone(characters_stat_history.score.last_save):"",friends.push(character))}),friends.sort(function(left,right){var diff=left.characters_online_status==right.characters_online_status?0:left.characters_online_status<right.characters_online_status?1:-1;return 0!==diff?diff:left.name.first_lower==right.name.first_lower?0:left.name.first_lower<right.name.first_lower?-1:1}),friends},ratio=function(stat1,stat2){var ratio=0;if(stat1&&stat2){var sumstat1=parseInt(stat1.week.w01)+parseInt(stat1.week.w02),sumstat2=parseInt(stat2.week.w01)+parseInt(stat2.week.w02);0==sumstat2&&(sumstat2=1),ratio=sumstat1/sumstat2}return ratio};return{get:function(id){var deferred=$q.defer();return $http.get(CHARACTER_URL,{params:{character_id:id}}).success(function(result,status){if(result.error)return deferred.reject(result.error);deferred.resolve(transform(result))}).error(function(data,status){deferred.reject(data||"Request failed")}),deferred.promise},getKillboard:function(id,limit){var deferred=$q.defer();return $http.get(KILLBOARD_URL,{params:{character_id:id,"c:limit":limit}}).success(function(result,status){if(result.error)return deferred.reject(result.error);deferred.resolve(processKillboard(result))}).error(function(data,status){deferred.reject(data||"Request failed")}),deferred.promise},getFriends:function(id){var deferred=$q.defer();return $http.get(FRIENDS_URL,{params:{character_id:id}}).success(function(result,status){if(result.error)return deferred.reject(result.error);deferred.resolve(processFriends(result))}).error(function(data,status){deferred.reject(data||"Request failed")}),deferred.promise}}}),angular.module("outfit",["ps2Utils"]).factory("outfit",function($q,$http,ps2Utils){var OUTFIT_URL="http://census.daybreakgames.com/s:mereth/get/ps2:v2/outfit/?";OUTFIT_URL+="c:join=character^on:leader_character_id^to:character_id^inject_at:leader";var MEMBERS_URL="http://census.daybreakgames.com/s:mereth/get/ps2:v2/outfit_member/?";MEMBERS_URL+="c:join=character^on:character_id^inject_at:character",MEMBERS_URL+="&c:join=characters_online_status^on:character_id^inject_at:characters_online_status^show:online_status";var MEMBERS_STATS_URL="http://census.daybreakgames.com/s:mereth/get/ps2:v2/outfit_member/?";MEMBERS_STATS_URL+="&c:join=characters_stat_history^on:character_id^inject_at:characters_stat_history^list:1";var processMembersData=function(data){if(data.returned){var members=[];return _.forEach(data.outfit_member_list,function(member){var character=member.character;if(!character)return void(console.log&&console.log("character '"+member.character_id+"' not found.",member));member.characters_online_status?character.characters_online_status=member.characters_online_status.online_status:character.characters_online_status="0",character.rank=member.character.battle_rank.value,character.member_since=member.member_since,character.outfitRank=member.rank,character.outfitRankOrdinal=member.rank_ordinal,members.push(character)}),members.sort(function(left,right){var diff=left.characters_online_status==right.characters_online_status?0:left.characters_online_status<right.characters_online_status?1:-1;return 0!==diff?diff:left.name.first_lower==right.name.first_lower?0:left.name.first_lower<right.name.first_lower?-1:1}),members}},processMembersStatsData=function(members,data){data.returned&&_.forEach(data.outfit_member_list,function(memberData){var character=_.find(members,function(o){return o.character_id==memberData.character_id});if(!character)return void(console.log&&console.log("character '"+memberData.character_id+"' not found.",memberData));var characters_stat_history=_.indexBy(memberData.characters_stat_history,"stat_name");character.statistics=ps2Utils.computeStatistics(characters_stat_history),character.rank=ps2Utils.getComputedRank(characters_stat_history.score.all_time),character.last_update=characters_stat_history.score?ps2Utils.convertTimezone(characters_stat_history.score.last_save):""})};return{get:function(id){var deferred=$q.defer();return $http.get(OUTFIT_URL,{params:{outfit_id:id}}).success(function(data,status){if(1!=data.returned||!data.outfit_list)return void deferred.reject("Outfit not found");var outfit=data.outfit_list[0],model={outfit_id:id};model.name=outfit.name,model.alias=outfit.alias,model.membersCount=outfit.member_count;var faction=ps2Utils.getFaction(outfit.leader.faction_id);model.factionTag=faction.factionTag,model.factionImage=faction.factionImage,deferred.resolve(model)}).error(function(data,status){deferred.reject(data||"Request failed")}),deferred.promise},getMembers:function(id){var deferred=$q.defer();return $http.get(MEMBERS_URL,{params:{outfit_id:id,"c:limit":2e3}}).success(function(data,status){var members=processMembersData(data);deferred.resolve(members)}).error(function(data,status){deferred.reject(data||"Request failed")}),deferred.promise},fillMembersStats:function(id,members){var deferred=$q.defer();return $http.get(MEMBERS_STATS_URL,{params:{outfit_id:id,"c:limit":1e3}}).success(function(data,status){processMembersStatsData(members,data),deferred.resolve()}).error(function(data,status){deferred.reject(data||"Request failed")}),deferred.promise}}}),angular.module("search",["ps2Utils"]).factory("search",function($q,$http,ps2Utils){var LIMIT=20,processResult=function(result){var srcArray,destArray=[];srcArray=result.character_list?result.character_list:result.outfit_list;for(var i=0;i<srcArray.length;++i){var src=srcArray[i];destArray.push(src)}return destArray},processWorldList=function(result){var worlds=[];return _.forEach(result.world_list,function(world){var region="?";"10"===world.world_id||"13"===world.world_id?region="EU":"1"===world.world_id||"17"===world.world_id?region="US":"25"===world.world_id&&(region="AU"),worlds[world.world_id]={id:world.world_id,name:world.name.en,region:region,label:world.name.en+" ("+region+")"}}),worlds},filterTerm=function(term){return term.trim().toLowerCase()};return{findCharacters:function(term){var deferred=$q.defer();return term="*"+filterTerm(term),$http.get("http://census.daybreakgames.com/s:mereth/get/ps2:v2/character/?c:join=characters_world^inject_at:world&c:show=character_id,name,battle_rank,world,faction_id",{params:{"name.first_lower":term,"c:limit":LIMIT+1}}).success(function(result,status){if(result.error)return void deferred.reject(result.error);deferred.resolve(processResult(result))}).error(function(data,status){deferred.reject(data||"Request failed")}),deferred.promise},findOutfits:function(term){var deferred=$q.defer(),searchParams={"c:limit":LIMIT+1};term=filterTerm(term);var nbchars=term.length;return 0==term.indexOf("[")&&term.lastIndexOf("]")==nbchars-1?searchParams.alias_lower=term.substr(1,nbchars-2):searchParams.name_lower="*"+term,$http.get("http://census.daybreakgames.com/s:mereth/get/ps2:v2/outfit/?c:join=character^on:leader_character_id^to:character_id^inject_at:leader^show:faction_id'world(characters_world^inject_at:world)",{params:searchParams}).success(function(result,status){if(result.error)return void deferred.reject(result.error);deferred.resolve(processResult(result))}).error(function(data,status){deferred.reject(data||"Request failed")}),deferred.promise},getWorlds:function(){var deferred=$q.defer();return $http.get("http://census.daybreakgames.com/s:mereth/get/ps2:v2/world/?c:limit=50").success(function(result,status){if(result.error)return void deferred.reject(result.error);deferred.resolve(processWorldList(result))}).error(function(data,status){deferred.reject(data||"Request failed")}),deferred.promise},getLimit:function(){return LIMIT}}}),angular.module("ps2Utils",[]).factory("ps2Utils",function(){var ranks={1:{nc_image_path:"/files/ps2/images/static/4067.png",tr_image_path:"/files/ps2/images/static/4066.png",vs_image_path:"/files/ps2/images/static/4065.png",xp_max:0},10:{nc_image_path:"/files/ps2/images/static/4092.png",tr_image_path:"/files/ps2/images/static/4093.png",vs_image_path:"/files/ps2/images/static/4094.png",xp_max:40875},100:{nc_image_path:"/files/ps2/images/static/4364.png",tr_image_path:"/files/ps2/images/static/4362.png",vs_image_path:"/files/ps2/images/static/4363.png",xp_max:18868950},11:{nc_image_path:"/files/ps2/images/static/4096.png",tr_image_path:"/files/ps2/images/static/4097.png",vs_image_path:"/files/ps2/images/static/4095.png",xp_max:54375},12:{nc_image_path:"/files/ps2/images/static/4099.png",tr_image_path:"/files/ps2/images/static/4100.png",vs_image_path:"/files/ps2/images/static/4098.png",xp_max:69e3},13:{nc_image_path:"/files/ps2/images/static/4102.png",tr_image_path:"/files/ps2/images/static/4103.png",vs_image_path:"/files/ps2/images/static/4101.png",xp_max:84750},14:{nc_image_path:"/files/ps2/images/static/4105.png",tr_image_path:"/files/ps2/images/static/4106.png",vs_image_path:"/files/ps2/images/static/4104.png",xp_max:101625},15:{nc_image_path:"/files/ps2/images/static/4108.png",tr_image_path:"/files/ps2/images/static/4109.png",vs_image_path:"/files/ps2/images/static/4107.png",xp_max:119625},16:{nc_image_path:"/files/ps2/images/static/4111.png",tr_image_path:"/files/ps2/images/static/4112.png",vs_image_path:"/files/ps2/images/static/4110.png",xp_max:142125},17:{nc_image_path:"/files/ps2/images/static/4113.png",tr_image_path:"/files/ps2/images/static/4115.png",vs_image_path:"/files/ps2/images/static/4114.png",xp_max:165750},18:{nc_image_path:"/files/ps2/images/static/4116.png",tr_image_path:"/files/ps2/images/static/4118.png",vs_image_path:"/files/ps2/images/static/4117.png",xp_max:190500},19:{nc_image_path:"/files/ps2/images/static/4119.png",tr_image_path:"/files/ps2/images/static/4121.png",vs_image_path:"/files/ps2/images/static/4120.png",xp_max:216375},2:{nc_image_path:"/files/ps2/images/static/4070.png",tr_image_path:"/files/ps2/images/static/4069.png",vs_image_path:"/files/ps2/images/static/4068.png",xp_max:375},20:{nc_image_path:"/files/ps2/images/static/4123.png",tr_image_path:"/files/ps2/images/static/4124.png",vs_image_path:"/files/ps2/images/static/4122.png",xp_max:243375},21:{nc_image_path:"/files/ps2/images/static/4126.png",tr_image_path:"/files/ps2/images/static/4127.png",vs_image_path:"/files/ps2/images/static/4125.png",xp_max:279375},22:{nc_image_path:"/files/ps2/images/static/4129.png",tr_image_path:"/files/ps2/images/static/4130.png",vs_image_path:"/files/ps2/images/static/4128.png",xp_max:316500},23:{nc_image_path:"/files/ps2/images/static/4132.png",tr_image_path:"/files/ps2/images/static/4131.png",vs_image_path:"/files/ps2/images/static/4133.png",xp_max:354750},24:{nc_image_path:"/files/ps2/images/static/4135.png",tr_image_path:"/files/ps2/images/static/4134.png",vs_image_path:"/files/ps2/images/static/4136.png",xp_max:394125},25:{nc_image_path:"/files/ps2/images/static/4138.png",tr_image_path:"/files/ps2/images/static/4137.png",vs_image_path:"/files/ps2/images/static/4139.png",xp_max:434625},26:{nc_image_path:"/files/ps2/images/static/4140.png",tr_image_path:"/files/ps2/images/static/4142.png",vs_image_path:"/files/ps2/images/static/4141.png",xp_max:488625},27:{nc_image_path:"/files/ps2/images/static/4143.png",tr_image_path:"/files/ps2/images/static/4145.png",vs_image_path:"/files/ps2/images/static/4144.png",xp_max:543750},28:{nc_image_path:"/files/ps2/images/static/4146.png",tr_image_path:"/files/ps2/images/static/4148.png",vs_image_path:"/files/ps2/images/static/4147.png",xp_max:6e5},29:{nc_image_path:"/files/ps2/images/static/4150.png",tr_image_path:"/files/ps2/images/static/4151.png",vs_image_path:"/files/ps2/images/static/4149.png",xp_max:657375},3:{nc_image_path:"/files/ps2/images/static/4073.png",tr_image_path:"/files/ps2/images/static/4072.png",vs_image_path:"/files/ps2/images/static/4071.png",xp_max:1500},30:{nc_image_path:"/files/ps2/images/static/4153.png",tr_image_path:"/files/ps2/images/static/4154.png",vs_image_path:"/files/ps2/images/static/4152.png",xp_max:715875},31:{nc_image_path:"/files/ps2/images/static/4156.png",tr_image_path:"/files/ps2/images/static/4157.png",vs_image_path:"/files/ps2/images/static/4155.png",xp_max:787875},32:{nc_image_path:"/files/ps2/images/static/4158.png",tr_image_path:"/files/ps2/images/static/4160.png",vs_image_path:"/files/ps2/images/static/4159.png",xp_max:861e3},33:{nc_image_path:"/files/ps2/images/static/4161.png",tr_image_path:"/files/ps2/images/static/4163.png",vs_image_path:"/files/ps2/images/static/4162.png",xp_max:935250},34:{nc_image_path:"/files/ps2/images/static/4164.png",tr_image_path:"/files/ps2/images/static/4166.png",vs_image_path:"/files/ps2/images/static/4165.png",xp_max:1010625},35:{nc_image_path:"/files/ps2/images/static/4167.png",tr_image_path:"/files/ps2/images/static/4168.png",vs_image_path:"/files/ps2/images/static/4169.png",xp_max:1087125},36:{nc_image_path:"/files/ps2/images/static/4170.png",tr_image_path:"/files/ps2/images/static/4171.png",vs_image_path:"/files/ps2/images/static/4172.png",xp_max:1177125},37:{nc_image_path:"/files/ps2/images/static/4173.png",tr_image_path:"/files/ps2/images/static/4174.png",vs_image_path:"/files/ps2/images/static/4175.png",xp_max:1268250},38:{nc_image_path:"/files/ps2/images/static/4178.png",tr_image_path:"/files/ps2/images/static/4177.png",vs_image_path:"/files/ps2/images/static/4176.png",xp_max:1360500},39:{nc_image_path:"/files/ps2/images/static/4181.png",tr_image_path:"/files/ps2/images/static/4180.png",vs_image_path:"/files/ps2/images/static/4179.png",xp_max:1453875},4:{nc_image_path:"/files/ps2/images/static/4075.png",tr_image_path:"/files/ps2/images/static/4076.png",vs_image_path:"/files/ps2/images/static/4074.png",xp_max:3750},40:{nc_image_path:"/files/ps2/images/static/4184.png",tr_image_path:"/files/ps2/images/static/4183.png",vs_image_path:"/files/ps2/images/static/4182.png",xp_max:1548375},41:{nc_image_path:"/files/ps2/images/static/4187.png",tr_image_path:"/files/ps2/images/static/4186.png",vs_image_path:"/files/ps2/images/static/4185.png",xp_max:1656375},42:{nc_image_path:"/files/ps2/images/static/4188.png",tr_image_path:"/files/ps2/images/static/4190.png",vs_image_path:"/files/ps2/images/static/4189.png",xp_max:1765500},43:{nc_image_path:"/files/ps2/images/static/4191.png",tr_image_path:"/files/ps2/images/static/4193.png",vs_image_path:"/files/ps2/images/static/4192.png",xp_max:1875750},44:{nc_image_path:"/files/ps2/images/static/4194.png",tr_image_path:"/files/ps2/images/static/4196.png",vs_image_path:"/files/ps2/images/static/4195.png",xp_max:1987125},45:{nc_image_path:"/files/ps2/images/static/4197.png",tr_image_path:"/files/ps2/images/static/4199.png",vs_image_path:"/files/ps2/images/static/4198.png",xp_max:2099625},46:{nc_image_path:"/files/ps2/images/static/4201.png",tr_image_path:"/files/ps2/images/static/4202.png",vs_image_path:"/files/ps2/images/static/4200.png",xp_max:2230125},47:{nc_image_path:"/files/ps2/images/static/4204.png",tr_image_path:"/files/ps2/images/static/4205.png",vs_image_path:"/files/ps2/images/static/4203.png",xp_max:2361750},48:{nc_image_path:"/files/ps2/images/static/4207.png",tr_image_path:"/files/ps2/images/static/4208.png",vs_image_path:"/files/ps2/images/static/4206.png",xp_max:2494500},49:{nc_image_path:"/files/ps2/images/static/4210.png",tr_image_path:"/files/ps2/images/static/4211.png",vs_image_path:"/files/ps2/images/static/4209.png",xp_max:2628375},5:{nc_image_path:"/files/ps2/images/static/4078.png",tr_image_path:"/files/ps2/images/static/4079.png",vs_image_path:"/files/ps2/images/static/4077.png",xp_max:7125},50:{nc_image_path:"/files/ps2/images/static/4213.png",tr_image_path:"/files/ps2/images/static/4214.png",vs_image_path:"/files/ps2/images/static/4212.png",xp_max:2763375},51:{nc_image_path:"/files/ps2/images/static/4215.png",tr_image_path:"/files/ps2/images/static/4216.png",vs_image_path:"/files/ps2/images/static/4217.png",xp_max:2916375},52:{nc_image_path:"/files/ps2/images/static/4218.png",tr_image_path:"/files/ps2/images/static/4219.png",vs_image_path:"/files/ps2/images/static/4220.png",xp_max:3070500},53:{nc_image_path:"/files/ps2/images/static/4221.png",tr_image_path:"/files/ps2/images/static/4222.png",vs_image_path:"/files/ps2/images/static/4223.png",xp_max:3225750},54:{nc_image_path:"/files/ps2/images/static/4224.png",tr_image_path:"/files/ps2/images/static/4225.png",vs_image_path:"/files/ps2/images/static/4226.png",xp_max:3382125},55:{nc_image_path:"/files/ps2/images/static/4227.png",tr_image_path:"/files/ps2/images/static/4228.png",vs_image_path:"/files/ps2/images/static/4229.png",xp_max:3539625},56:{nc_image_path:"/files/ps2/images/static/4230.png",tr_image_path:"/files/ps2/images/static/4231.png",vs_image_path:"/files/ps2/images/static/4232.png",xp_max:3715125},57:{nc_image_path:"/files/ps2/images/static/4233.png",tr_image_path:"/files/ps2/images/static/4234.png",vs_image_path:"/files/ps2/images/static/4235.png",xp_max:3891750},58:{nc_image_path:"/files/ps2/images/static/4236.png",tr_image_path:"/files/ps2/images/static/4237.png",vs_image_path:"/files/ps2/images/static/4238.png",xp_max:4069500},59:{nc_image_path:"/files/ps2/images/static/4239.png",tr_image_path:"/files/ps2/images/static/4240.png",vs_image_path:"/files/ps2/images/static/4241.png",xp_max:4248375},6:{nc_image_path:"/files/ps2/images/static/4082.png",tr_image_path:"/files/ps2/images/static/4081.png",vs_image_path:"/files/ps2/images/static/4080.png",xp_max:11625},60:{nc_image_path:"/files/ps2/images/static/4242.png",tr_image_path:"/files/ps2/images/static/4243.png",vs_image_path:"/files/ps2/images/static/4244.png",xp_max:4428375},61:{nc_image_path:"/files/ps2/images/static/4246.png",tr_image_path:"/files/ps2/images/static/4247.png",vs_image_path:"/files/ps2/images/static/4245.png",xp_max:4626375},62:{nc_image_path:"/files/ps2/images/static/4249.png",tr_image_path:"/files/ps2/images/static/4250.png",vs_image_path:"/files/ps2/images/static/4248.png",xp_max:4825500},63:{nc_image_path:"/files/ps2/images/static/4252.png",tr_image_path:"/files/ps2/images/static/4253.png",vs_image_path:"/files/ps2/images/static/4251.png",xp_max:5025750},64:{nc_image_path:"/files/ps2/images/static/4255.png",tr_image_path:"/files/ps2/images/static/4256.png",vs_image_path:"/files/ps2/images/static/4254.png",xp_max:5227125},65:{nc_image_path:"/files/ps2/images/static/4258.png",tr_image_path:"/files/ps2/images/static/4259.png",vs_image_path:"/files/ps2/images/static/4257.png",xp_max:5429625},66:{nc_image_path:"/files/ps2/images/static/4260.png",tr_image_path:"/files/ps2/images/static/4262.png",vs_image_path:"/files/ps2/images/static/4261.png",xp_max:5654625},67:{nc_image_path:"/files/ps2/images/static/4263.png",tr_image_path:"/files/ps2/images/static/4265.png",vs_image_path:"/files/ps2/images/static/4264.png",xp_max:5881875},68:{nc_image_path:"/files/ps2/images/static/4266.png",tr_image_path:"/files/ps2/images/static/4268.png",vs_image_path:"/files/ps2/images/static/4267.png",xp_max:6111375},69:{nc_image_path:"/files/ps2/images/static/4269.png",tr_image_path:"/files/ps2/images/static/4271.png",vs_image_path:"/files/ps2/images/static/4270.png",xp_max:6343125},7:{nc_image_path:"/files/ps2/images/static/4085.png",tr_image_path:"/files/ps2/images/static/4084.png",vs_image_path:"/files/ps2/images/static/4083.png",xp_max:17250},70:{nc_image_path:"/files/ps2/images/static/4272.png",tr_image_path:"/files/ps2/images/static/4274.png",vs_image_path:"/files/ps2/images/static/4273.png",xp_max:6577125},71:{nc_image_path:"/files/ps2/images/static/4277.png",tr_image_path:"/files/ps2/images/static/4275.png",vs_image_path:"/files/ps2/images/static/4276.png",xp_max:6833625},72:{nc_image_path:"/files/ps2/images/static/4280.png",tr_image_path:"/files/ps2/images/static/4278.png",vs_image_path:"/files/ps2/images/static/4279.png",xp_max:7092375},73:{nc_image_path:"/files/ps2/images/static/4283.png",tr_image_path:"/files/ps2/images/static/4281.png",vs_image_path:"/files/ps2/images/static/4282.png",xp_max:7353375},74:{nc_image_path:"/files/ps2/images/static/4286.png",tr_image_path:"/files/ps2/images/static/4284.png",vs_image_path:"/files/ps2/images/static/4285.png",xp_max:7616625},75:{nc_image_path:"/files/ps2/images/static/4289.png",tr_image_path:"/files/ps2/images/static/4287.png",vs_image_path:"/files/ps2/images/static/4288.png",xp_max:7882125},76:{nc_image_path:"/files/ps2/images/static/4290.png",tr_image_path:"/files/ps2/images/static/4291.png",vs_image_path:"/files/ps2/images/static/4292.png",xp_max:8174625},77:{nc_image_path:"/files/ps2/images/static/4293.png",tr_image_path:"/files/ps2/images/static/4294.png",vs_image_path:"/files/ps2/images/static/4295.png",xp_max:8471625},78:{nc_image_path:"/files/ps2/images/static/4296.png",tr_image_path:"/files/ps2/images/static/4297.png",vs_image_path:"/files/ps2/images/static/4298.png",xp_max:8773125},79:{nc_image_path:"/files/ps2/images/static/4299.png",tr_image_path:"/files/ps2/images/static/4300.png",vs_image_path:"/files/ps2/images/static/4301.png",xp_max:9079125},8:{nc_image_path:"/files/ps2/images/static/4086.png",tr_image_path:"/files/ps2/images/static/4087.png",vs_image_path:"/files/ps2/images/static/4088.png",xp_max:24e3},80:{nc_image_path:"/files/ps2/images/static/4302.png",tr_image_path:"/files/ps2/images/static/4303.png",vs_image_path:"/files/ps2/images/static/4304.png",xp_max:9389625},81:{nc_image_path:"/files/ps2/images/static/4305.png",tr_image_path:"/files/ps2/images/static/4306.png",vs_image_path:"/files/ps2/images/static/4307.png",xp_max:9731625},82:{nc_image_path:"/files/ps2/images/static/4309.png",tr_image_path:"/files/ps2/images/static/4310.png",vs_image_path:"/files/ps2/images/static/4308.png",xp_max:10078125},83:{nc_image_path:"/files/ps2/images/static/4312.png",tr_image_path:"/files/ps2/images/static/4313.png",vs_image_path:"/files/ps2/images/static/4311.png",xp_max:10429125},84:{nc_image_path:"/files/ps2/images/static/4315.png",tr_image_path:"/files/ps2/images/static/4316.png",vs_image_path:"/files/ps2/images/static/4314.png",xp_max:10784625},85:{nc_image_path:"/files/ps2/images/static/4318.png",tr_image_path:"/files/ps2/images/static/4319.png",vs_image_path:"/files/ps2/images/static/4317.png",xp_max:11144625},86:{nc_image_path:"/files/ps2/images/static/4321.png",tr_image_path:"/files/ps2/images/static/4322.png",vs_image_path:"/files/ps2/images/static/4320.png",xp_max:11540625},87:{
nc_image_path:"/files/ps2/images/static/4324.png",tr_image_path:"/files/ps2/images/static/4325.png",vs_image_path:"/files/ps2/images/static/4323.png",xp_max:11941125},88:{nc_image_path:"/files/ps2/images/static/4326.png",tr_image_path:"/files/ps2/images/static/4327.png",vs_image_path:"/files/ps2/images/static/4328.png",xp_max:12346125},89:{nc_image_path:"/files/ps2/images/static/4329.png",tr_image_path:"/files/ps2/images/static/4330.png",vs_image_path:"/files/ps2/images/static/4331.png",xp_max:12755625},9:{nc_image_path:"/files/ps2/images/static/4089.png",tr_image_path:"/files/ps2/images/static/4090.png",vs_image_path:"/files/ps2/images/static/4091.png",xp_max:31875},90:{nc_image_path:"/files/ps2/images/static/4332.png",tr_image_path:"/files/ps2/images/static/4333.png",vs_image_path:"/files/ps2/images/static/4334.png",xp_max:13169625},91:{nc_image_path:"/files/ps2/images/static/4335.png",tr_image_path:"/files/ps2/images/static/4336.png",vs_image_path:"/files/ps2/images/static/4337.png",xp_max:13624125},92:{nc_image_path:"/files/ps2/images/static/4338.png",tr_image_path:"/files/ps2/images/static/4339.png",vs_image_path:"/files/ps2/images/static/4340.png",xp_max:14083125},93:{nc_image_path:"/files/ps2/images/static/4341.png",tr_image_path:"/files/ps2/images/static/4342.png",vs_image_path:"/files/ps2/images/static/4343.png",xp_max:14546625},94:{nc_image_path:"/files/ps2/images/static/4344.png",tr_image_path:"/files/ps2/images/static/4345.png",vs_image_path:"/files/ps2/images/static/4346.png",xp_max:15014625},95:{nc_image_path:"/files/ps2/images/static/4347.png",tr_image_path:"/files/ps2/images/static/4348.png",vs_image_path:"/files/ps2/images/static/4349.png",xp_max:15487125},96:{nc_image_path:"/files/ps2/images/static/4350.png",tr_image_path:"/files/ps2/images/static/4351.png",vs_image_path:"/files/ps2/images/static/4352.png",xp_max:16020375},97:{nc_image_path:"/files/ps2/images/static/4353.png",tr_image_path:"/files/ps2/images/static/4354.png",vs_image_path:"/files/ps2/images/static/4355.png",xp_max:16558125},98:{nc_image_path:"/files/ps2/images/static/4356.png",tr_image_path:"/files/ps2/images/static/4357.png",vs_image_path:"/files/ps2/images/static/4358.png",xp_max:17100375},99:{nc_image_path:"/files/ps2/images/static/4359.png",tr_image_path:"/files/ps2/images/static/4360.png",vs_image_path:"/files/ps2/images/static/4361.png",xp_max:17647125}},factions={1:{factionTag:"vs",factionImage:"images/vs_32x32.png"},2:{factionTag:"nc",factionImage:"images/nc_32x32.png"},3:{factionTag:"tr",factionImage:"images/tr_32x32.png"},4:{factionTag:"nso",factionImage:"https://fakeimg.pl/32x32/777/000/?retina=1&font_size=16&text=NSO"}},getRankImage=function(rank,faction){var o=ranks[rank];return o?o[faction+"_image_path"]:ranks[100][faction+"_image_path"]},getComputedRank=function(experience){experience*=1;var br100xp=ranks[100].xp_max;if(experience<=br100xp)for(var i=1;i<=100;++i){var rank=ranks[i];if(experience<rank.xp_max)return i-1}var rank=100,rankupxp=943447;for(experience-=br100xp;experience>=rankupxp;)experience-=rankupxp,rank+=1,rankupxp=943447===rankupxp?943448:943447;return rank},convertTimezone=function(unixtime){return 1*unixtime+25200};return{computeStatistics:function(stats){var stats2={time:{all_time:0,monthly:0,weekly:0,daily:0},score:{all_time:0,monthly:0,weekly:0,daily:0},kills:{all_time:0,monthly:0,weekly:0,daily:0},deaths:{all_time:0,monthly:0,weekly:0,daily:0},kdr:{all_time:0,monthly:0,weekly:0,daily:0},spm:{all_time:0,monthly:0,weekly:0,daily:0},kpm:{all_time:0,monthly:0,weekly:0,daily:0}};if(!stats.time)return stats2;stats2.time.all_time=1*stats.time.all_time,stats2.score.all_time=1*stats.score.all_time,stats2.kills.all_time=1*stats.kills.all_time,stats2.deaths.all_time=1*stats.deaths.all_time;for(var sum_time=0,sum_score=0,sum_kills=0,sum_deaths=0,i=1;i<=31;++i){if(i<10)var str_i="d0"+i;else var str_i="d"+i;sum_time+=1*stats.time.day[str_i],sum_score+=1*stats.score.day[str_i],sum_kills+=1*stats.kills.day[str_i],sum_deaths+=1*stats.deaths.day[str_i];var period="";1===i?period="daily":7===i?period="weekly":31===i&&(period="monthly"),period&&(stats2.time[period]=sum_time,stats2.score[period]=sum_score,stats2.kills[period]=sum_kills,stats2.deaths[period]=sum_deaths)}for(var period in stats2.time){var time=stats2.time[period]/60,score=stats2.score[period],kills=stats2.kills[period],deaths=stats2.deaths[period];0==deaths&&(deaths=1),0==time&&(time=1),stats2.kdr[period]=(kills/deaths).toFixed(2),stats2.spm[period]=(score/time).toFixed(0),stats2.kpm[period]=(kills/time).toFixed(2)}return stats2},getRankImage:getRankImage,getComputedRank:getComputedRank,convertTimezone:convertTimezone,getFaction:function(factionId){var faction=factions[factionId];return faction||factions._}}});