Skip to content

Instantly share code, notes, and snippets.

@gokselpirnal
Last active October 31, 2018 14:07
Show Gist options
  • Save gokselpirnal/71d69cb2673e339a33efe3dee46d62e4 to your computer and use it in GitHub Desktop.
Save gokselpirnal/71d69cb2673e339a33efe3dee46d62e4 to your computer and use it in GitHub Desktop.
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 < 90){
drink(drug,done,res.user.stamina)
}else{
if(res.user.addiction > 5){
heal(done);
}else{
done()
}
}
},
error: function(){
power(done)
}
});
}
var heal = function(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:1,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(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 acceptGangRob = function(){
console.log('%c Çete soygunu kabul ediliyor.','background: black; color: white')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/gangrobbery/accept',
data: {"mm":[],"mc":[],"kp":[]},
success: function(res){
console.log('%c Güç: ' + res.user.stamina, 'background: orange; color: black')
if(res.user.stamina < 25){
power(function(){getWaitingRob(false)})
}
},
});
}
var executeGangRob = function(){
console.log('%c Çete soygunu gerçekleştiriliyor.','background: black; color: white')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/gangrobbery/execute',
data: {"mm":[],"mc":[],"kp":[]},
success: function(res){
console.log('%c Güç: ' + res.user.stamina, 'background: orange; color: black')
if(res.user.stamina < 25){
power(function(){getWaitingRob(true)})
}
},
});
}
var planGangRob = function(){
console.log('%c Çete soygununa çağırılıyor','background: black; color: white')
$.ajax({
type: "POST",
url: 'https://www.thecrims.com/api/v1/gangrobbery/plan',
data: {"id":3,"mm":[],"mc":[],"kp":[]}
});
}
var getWaitingRob = function(leader){
$.ajax({
type: "GET",
url: 'https://www.thecrims.com/api/v1/robberies',
success: function(res){
if(leader){
if(res.planned_robbery){
if(res.planned_robbery.required_members <= res.planned_robbery.accepted_invitations.length){
executeGangRob()
}
}else{
planGangRob()
}
}else{
if(res.planned_robbery){
var user = res.planned_robbery.waiting_invitations.find(function(user){
return user.id == userId
})
if(user && user.id == userId){
acceptGangRob();
}
}
}
}
});
}
var bot = function(leader){
userChannel.bind('update-robberies', function(){
getWaitingRob(leader);
})
}
// soygunları başlatacak ve yapıcak kişide bot(true)
// soygunlara sadece kabul edek kişide bot(false)
@VanAres
Copy link

VanAres commented Oct 31, 2018

Hello i am new.. this is works?
How i can run this?

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