Skip to content

Instantly share code, notes, and snippets.

@gokselpirnal
Last active April 27, 2020 18:30
Show Gist options
  • Save gokselpirnal/2be422be49bb6db528e8e07b7a6a348e to your computer and use it in GitHub Desktop.
Save gokselpirnal/2be422be49bb6db528e8e07b7a6a348e to your computer and use it in GitHub Desktop.
thecrims-bot
var getRobberies = function(done){
console.log('%c Soygun seçiliyor.','background: black; color: white')
$.ajax({
type: "GET",
url: 'https://www.thecrims.com/api/v1/robberies',
success: function(res){
done(res.single_robberies
.filter(robbery => robbery.successprobability == 100)
.sort((a, b) => b.difficulty - a.difficulty)
.find((x, index) => index == 0))
}
});
}
var getNightClubs = function(done){
console.log('%c Klüplere bakılıyor.','background: black; color: white')
$.ajax({
type: "GET",
url: 'https://www.thecrims.com/api/v1/nightclubs',
success: function(res){
done(res.favorites.length > 0 ? res.favorites : res.nightclubs)
}
});
}
var joinClub = function(club,done){
console.log('%c '+club.name + ' klübüne girdi.','background: black; color: white')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/nightclub',
data: {id:club.id,mm:[],mc:[],kp:[]},
success: function(res){
done(res)
},
error: function(){
console.log('%c Bilet bitti :(','background: red; color: white')
}
});
}
var drink = function(drug,done,currentStamina){
var amount = currentStamina ? parseInt((100-currentStamina)/drug.stamina) : 1;
if(amount > 99){
amount = 99
}
console.log('%c ' +amount +' adet ' + drug.name + ' içiliyor','background: yellow; color: black')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/nightclub/drug',
data: {id: drug.id, quantity: amount, mm: [], mc: [], kp: []},
success: function(res){
console.log('%c Güç: ' + res.user.stamina,'background: green; color: white')
if(res.user.stamina < 100){
drink(drug,done,res.user.stamina)
}else{
if(res.user.addiction > 5){
heal(res.user.addiction,done);
}else{
done()
}
}
},
error: function(){
power(done)
}
});
}
var heal = function(quantity,done){
console.log('%c Tedaviye gidiliyor.','background: black; color: white')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/hospital/healing',
data: {id:10,quantity:quantity,mm:[],mc:[],kp:[]},
success: function(res){
console.log('%c Bağımlılık: ' + res.user.addiction, 'background: green; color: white')
if(res.user.addiction > 0){
heal(res.user.addiction,done)
}else{
done()
}
}
});
}
var power = function(done){
getNightClubs(function(clubs){
var clubIndex = Math.floor(Math.random() * Math.floor(clubs.length));
joinClub(clubs[clubIndex],function(res){
var drugIndex = Math.floor(Math.random() * Math.floor(res.nightclub.products.drugs.length));
drink(res.nightclub.products.drugs[drugIndex],done)
})
})
}
setInterval(function() {
if(+document.querySelector('#user-profile-stamina').innerText.replace(/[^0-9]/g,'') < 25) {
power(()=>{});
document.querySelector('#user-profile-stamina').innerText="100%"
}
}, 2500);
var getRobberies = function(done){
console.log('%c Soygun seçiliyor.','background: black; color: white')
$.ajax({
type: "GET",
url: 'https://www.thecrims.com/api/v1/robberies',
success: function(res){
done(res.single_robberies
.filter(robbery => robbery.successprobability == 100)
.sort((a, b) => b.difficulty - a.difficulty)
.find((x, index) => index == 0))
}
});
}
var getNightClubs = function(done){
console.log('%c Klüplere bakılıyor.','background: black; color: white')
$.ajax({
type: "GET",
url: 'https://www.thecrims.com/api/v1/nightclubs',
success: function(res){
done(res.favorites.length > 0 ? res.favorites : res.nightclubs)
}
});
}
var joinClub = function(club,done){
console.log('%c '+club.name + ' klübüne girdi.','background: black; color: white')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/nightclub',
data: {id:club.id,mm:[],mc:[],kp:[]},
success: function(res){
done(res)
},
error: function(){
console.log('%c Bilet bitti :(','background: red; color: white')
}
});
}
var drink = function(drug,done,currentStamina){
var amount = currentStamina ? parseInt((100-currentStamina)/drug.stamina) : 1;
if(amount > 99){
amount = 99
}
console.log('%c ' +amount +' adet ' + drug.name + ' içiliyor','background: yellow; color: black')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/nightclub/drug',
data: {id: drug.id, quantity: amount, mm: [], mc: [], kp: []},
success: function(res){
console.log('%c Güç: ' + res.user.stamina,'background: green; color: white')
if(res.user.stamina < 100){
drink(drug,done,res.user.stamina)
}else{
if(res.user.addiction > 5){
heal(res.user.addiction,done);
}else{
done()
}
}
},
error: function(){
power(done)
}
});
}
var heal = function(quantity,done){
console.log('%c Tedaviye gidiliyor.','background: black; color: white')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/hospital/healing',
data: {id:10,quantity:quantity,mm:[],mc:[],kp:[]},
success: function(res){
console.log('%c Bağımlılık: ' + res.user.addiction, 'background: green; color: white')
if(res.user.addiction > 0){
heal(res.user.addiction,done)
}else{
done()
}
}
});
}
var power = function(done){
getNightClubs(function(clubs){
var clubIndex = Math.floor(Math.random() * Math.floor(clubs.length));
joinClub(clubs[clubIndex],function(res){
var drugIndex = Math.floor(Math.random() * Math.floor(res.nightclub.products.drugs.length));
drink(res.nightclub.products.drugs[drugIndex],done)
})
})
}
var rob = function(robbery,done){
console.log('%c '+robbery.translated_name + ' soyuluyor.','background: black; color: white')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/rob',
data: {id:robbery.id,mm:[],mc:[],kp:[]},
success: function(res){
console.log('%c Güç: ' + res.user.stamina, 'background: orange; color: black')
if(res.user.stamina < robbery.energy){
done()
}else{
rob(robbery,done)
}
}
});
}
var bot = function(index){
getRobberies(function(robbery){
rob(robbery,function(){
power(function(){
bot(index)
})
})
})
}
bot()
@co3moz
Copy link

co3moz commented Apr 28, 2018

var getRobberies = function(done){
	console.log('%c Soygun seçiliyor.','background: black; color: white')
	$.ajax({
  		type: "GET",
  		url: 'https://www.thecrims.com/api/v1/robberies',
  		success: function(res){
  			done(res.single_robberies
                           .filter(robbery => robbery.successprobability == 100)
                           .sort((a, b) => b.difficulty - a.difficulty)
                           .find((x, index) => index == 0))
  		}
	});
}

@co3moz
Copy link

co3moz commented May 25, 2018

var getRobberies = function (done) {
  console.log('%c Soygun seçiliyor.', 'background: black; color: white')
  $.ajax({
    type: "GET",
    url: 'https://www.thecrims.com/api/v1/robberies',
    success: function (res) {
      done(res.single_robberies
        .filter(robbery => robbery.successprobability == 100)
        .map(x => (x.k = (x.min_reward + x.max_reward) * 50 / x.energy, x))
        .sort((a, b) => b.k - a.k)
        .find((x, index) => index == 0))
    }
  });
}

Para bazlı sıralama

@marek42x
Copy link

marek42x commented Oct 7, 2019

what do i do with the file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment