2017-05-03 19:52:54 +02:00
|
|
|
/* Crimes.js */
|
2017-05-04 07:05:48 +02:00
|
|
|
function commitShopliftCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeShoplift;
|
2017-05-08 16:33:26 +02:00
|
|
|
Player.startCrime(0, 0.5, 0.5, 0.5, 0.5, 0, 1000, 2000); //$500/s, .25 exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function commitMugCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeMug;
|
2017-05-08 16:33:26 +02:00
|
|
|
Player.startCrime(0, 1, 1, 1, 1, 0, 3000, 4000); //$750/s, .2 exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function commitDealDrugsCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeDrugs;
|
2017-05-08 16:33:26 +02:00
|
|
|
Player.startCrime(0, 2, 2, 2, 2, 2, 10000, 10000); //$1000/s, .2 exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function commitTraffickArmsCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeTraffickArms;
|
2017-05-08 16:33:26 +02:00
|
|
|
Player.startCrime(0, 8, 8, 8, 8, 12, 60000, 40000); //$1500/s, .2 combat exp/s, .3 cha exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function commitHomicideCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeHomicide;
|
2017-05-08 16:33:26 +02:00
|
|
|
Player.startCrime(0, 2, 2, 2, 2, 0, 1000, 3000); //$333.3/s, 0.66 combat exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
2017-05-08 18:00:34 +02:00
|
|
|
function commitGrandTheftAutoCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeGrandTheftAuto;
|
2017-05-10 19:42:46 +02:00
|
|
|
Player.startCrime(0, 8, 8, 8, 40, 20, 150000, 80000); //$1875/2, .1 exp/s, .5 exp/s, .25 exp/s
|
2017-05-08 18:00:34 +02:00
|
|
|
}
|
|
|
|
|
2017-05-04 07:05:48 +02:00
|
|
|
function commitKidnapCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeKidnap;
|
2017-05-08 18:00:34 +02:00
|
|
|
Player.startCrime(0, 20, 20, 20, 20, 20, 300000, 120000); //$2500/s. .167 exp/s
|
|
|
|
}
|
|
|
|
|
|
|
|
function commitAssassinationCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeAssassination;
|
|
|
|
Player.startCrime(0, 75, 75, 75, 75, 0, 1000000, 300000); //$3333.33/s, .25 exp/s
|
|
|
|
}
|
|
|
|
|
|
|
|
function commitHeistCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeHeist;
|
|
|
|
Player.startCrime(90, 90, 90, 90, 90, 90, 25000000, 600000); //$41,666.67/s, .15exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeSuccess(crime, moneyGained) {
|
|
|
|
var chance = 0;
|
|
|
|
switch (crime) {
|
|
|
|
case CONSTANTS.CrimeShoplift:
|
|
|
|
chance = determineCrimeChanceShoplift();
|
|
|
|
break;
|
|
|
|
case CONSTANTS.CrimeMug:
|
|
|
|
chance = determineCrimeChanceMug();
|
|
|
|
break;
|
|
|
|
case CONSTANTS.CrimeDrugs:
|
|
|
|
chance = determineCrimeChanceDealDrugs();
|
|
|
|
break;
|
|
|
|
case CONSTANTS.CrimeTraffickArms:
|
|
|
|
chance = determineCrimeChanceTraffickArms();
|
|
|
|
break;
|
|
|
|
case CONSTANTS.CrimeHomicide:
|
|
|
|
chance = determineCrimeChanceHomicide();
|
|
|
|
break;
|
2017-05-08 18:00:34 +02:00
|
|
|
case CONSTANTS.CrimeGrandTheftAuto:
|
|
|
|
chance = determineCrimeChanceGrandTheftAuto();
|
|
|
|
break;
|
2017-05-04 07:05:48 +02:00
|
|
|
case CONSTANTS.CrimeKidnap:
|
|
|
|
chance = determineCrimeChanceKidnap();
|
|
|
|
break;
|
2017-05-08 18:00:34 +02:00
|
|
|
case CONSTANTS.CrimeAssassination:
|
|
|
|
chance = determineCrimeChanceAssassination();
|
|
|
|
break;
|
|
|
|
case CONSTANTS.CrimeHeist:
|
|
|
|
chance = determineCrimeChanceHeist();
|
|
|
|
break;
|
2017-05-04 07:05:48 +02:00
|
|
|
default:
|
|
|
|
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
|
|
|
|
return;
|
|
|
|
}
|
2017-05-04 09:05:43 +02:00
|
|
|
if (Math.random() <= chance) {
|
2017-05-04 07:05:48 +02:00
|
|
|
//Success
|
|
|
|
Player.gainMoney(moneyGained);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
//Failure
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceShoplift() {
|
2017-05-04 20:37:57 +02:00
|
|
|
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
|
2017-05-04 07:05:48 +02:00
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-05-10 22:21:15 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) * 10;
|
2017-05-04 20:37:57 +02:00
|
|
|
|
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceMug() {
|
2017-05-04 20:37:57 +02:00
|
|
|
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
|
2017-05-04 07:05:48 +02:00
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-05-10 22:21:15 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) * 5;
|
2017-05-04 20:37:57 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceDealDrugs() {
|
2017-05-10 22:21:15 +02:00
|
|
|
var chance = ((2*Player.charisma / CONSTANTS.MaxSkillLevel +
|
2017-05-04 20:37:57 +02:00
|
|
|
Player.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel));
|
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceTraffickArms() {
|
2017-05-04 20:37:57 +02:00
|
|
|
var chance = ((Player.charisma / CONSTANTS.MaxSkillLevel +
|
2017-05-04 07:05:48 +02:00
|
|
|
Player.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-05-08 16:33:26 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) / 2;
|
2017-05-04 20:37:57 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceHomicide() {
|
2017-05-04 20:37:57 +02:00
|
|
|
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
|
2017-05-04 07:05:48 +02:00
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-05-04 20:37:57 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel));
|
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
2017-05-08 18:00:34 +02:00
|
|
|
function determineCrimeChanceGrandTheftAuto() {
|
|
|
|
var chance = ((Player.hacking_skill / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
4 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel +
|
|
|
|
2 * Player.charisma / CONSTANTS.MaxSkillLevel)) / 8;
|
|
|
|
return Math.min(chance, 1);
|
|
|
|
}
|
|
|
|
|
2017-05-04 07:05:48 +02:00
|
|
|
function determineCrimeChanceKidnap() {
|
|
|
|
return ((Player.charisma / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-05-08 18:00:34 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) / 6;
|
|
|
|
return Math.min(chance, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceAssassination() {
|
|
|
|
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) / 8;
|
|
|
|
return Math.min(chance, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceHeist() {
|
|
|
|
var chance = ((Player.hacking_skill / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.charisma / CONSTANTS.MaxSkillLevel)) / 18;
|
2017-05-04 20:37:57 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|