Skip to content

Commit

Permalink
Merge pull request #17 from phantomindex/master
Browse files Browse the repository at this point in the history
Improved search with candy
  • Loading branch information
phantomindex committed Jan 9, 2017
2 parents 369a081 + 54e8358 commit 39eb0c9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 44 deletions.
48 changes: 26 additions & 22 deletions pokemonSystem/scripts/games/pokemonSystem.js
Expand Up @@ -409,7 +409,7 @@
}

function rareChance(action) {
var toggle = $.inidb.get('settings', 'rChance');
var toggle = $.inidb.get('settings', 'rChance');

if (toggle == 'true') {
$.say($.lang.get('waifugames.rare.over'));
Expand All @@ -421,7 +421,7 @@
$.inidb.set('settings', 'rChance', 'true');

} else {
return;
return;
}
}

Expand Down Expand Up @@ -637,7 +637,10 @@
* @param {Number} id
*/
function addharem(username, id) {
var atk = 1, def = 1, love = 1, lewd = 1;
var atk = 1,
def = 1,
love = 1,
lewd = 1;

if (!waifuExists(id)) {
$.say($.lang.get('waifugames.exist.404', $.whisperPrefix(username)));
Expand Down Expand Up @@ -719,15 +722,16 @@
* @param {String} sender
*/
function useCandy(username, amount, id) {
if (getCandy(username) < 1) {
$.say($.lang.get('waifugames.candy.nostock', $.whisperPrefix(username)));
return;
}
if (id === undefined) {
id = getWaifuId(amount);
amount = 1;
if (getCandy(username) < 1) {
$.say($.lang.get('waifugames.candy.nostock', $.whisperPrefix(username)));
return;
}
if (id === '') {
id = getWaifuId(amount);
amount = 1;
} else {
id = getWaifuId(id);
id = getWaifuId(id);
amount = amount;
}

if (!waifuExists(id)) {
Expand All @@ -740,13 +744,13 @@
return;
}

$.inidb.incr(username, 'team', id, 100*amount);
$.inidb.incr(username, 'pAttack', id, 1*amount);
$.inidb.incr(username, 'pDefense', id, 1*amount);
$.inidb.incr(username, 'pLove', id, 1*amount);
$.inidb.incr(username, 'pLewdness', id, 1*amount);
$.inidb.decr(username, 'pcandy', 1*amount);
$.say($.lang.get('waifuGames.candy.use', $.whisperPrefix(username), replace(getWaifu(id)), replace2(getWaifu(id)), (100*amount), getEXP(username, id), getLevel(username, id), getCandy(username, id)));
$.inidb.incr(username, 'team', id, 100 * amount);
$.inidb.incr(username, 'pAttack', id, 1 * amount);
$.inidb.incr(username, 'pDefense', id, 1 * amount);
$.inidb.incr(username, 'pLove', id, 1 * amount);
$.inidb.incr(username, 'pLewdness', id, 1 * amount);
$.inidb.decr(username, 'pcandy', 1 * amount);
$.say($.lang.get('waifuGames.candy.use', $.whisperPrefix(username), replace(getWaifu(id)), replace2(getWaifu(id)), (100 * amount), getEXP(username, id), getLevel(username, id), getCandy(username, id)));
}

/*
Expand All @@ -766,7 +770,7 @@
attacker = $.userPrefix(username);

if (!action == '') {
id =getWaifuId(action);
id = getWaifuId(action);
player1 = getWaifu(getWaifuId(action));
} else {
id = getRandomharemIdFromUser(username);
Expand Down Expand Up @@ -828,16 +832,16 @@
return;
}
if ($.isOnline($.channelName)) {
startBattle(sender, action.toLowerCase(), args.slice(1).join(' '));
}
startBattle(sender, action.toLowerCase(), args.slice(1).join(' '));
}
}

if (command.equalsIgnoreCase('candy')) {
if (action === undefined) {
$.say($.lang.get('waifugames.candy.get', $.whisperPrefix(sender), getCandy(sender)));
return;
} else {
useCandy(sender, action, subAction);
useCandy(sender, action, args.slice(1).join(' '));
}
}

Expand Down
49 changes: 27 additions & 22 deletions waifuGames/scripts/games/waifuGames.js
Expand Up @@ -409,7 +409,7 @@
}

function rareChance(action) {
var toggle = $.inidb.get('settings', 'rChance');
var toggle = $.inidb.get('settings', 'rChance');

if (toggle == 'true') {
$.say($.lang.get('waifugames.rare.over'));
Expand All @@ -421,7 +421,7 @@
$.inidb.set('settings', 'rChance', 'true');

} else {
return;
return;
}
}

Expand Down Expand Up @@ -637,7 +637,10 @@
* @param {Number} id
*/
function addHarem(username, id) {
var atk = 1, def = 1, love = 1, lewd = 1;
var atk = 1,
def = 1,
love = 1,
lewd = 1;

if (!waifuExists(id)) {
$.say($.lang.get('waifugames.exist.404', $.whisperPrefix(username)));
Expand Down Expand Up @@ -720,15 +723,17 @@
*/
function useCandy(username, amount, id) {

if (getCandy(username) < 1) {
$.say($.lang.get('waifugames.candy.nostock', $.whisperPrefix(username)));
return;
}
if (id === undefined) {
id = getWaifuId(amount);
amount = 1;
if (getCandy(username) < 1) {
$.say($.lang.get('waifugames.candy.nostock', $.whisperPrefix(username)));
return;
}

if (id === '') {
id = getWaifuId(amount);
amount = 1;
} else {
id = getWaifuId(id);
id = getWaifuId(id);
amount = amount;
}

if (!waifuExists(id)) {
Expand All @@ -742,13 +747,13 @@
}


$.inidb.incr(username, 'harem', id, 100*amount);
$.inidb.incr(username, 'wAttack', id, 1*amount);
$.inidb.incr(username, 'wDefense', id, 1*amount);
$.inidb.incr(username, 'wLove', id, 1*amount);
$.inidb.incr(username, 'wLewdness', id, 1*amount);
$.inidb.decr(username, 'candy', 1*amount);
$.say($.lang.get('waifuGames.candy.use', $.whisperPrefix(username), replace(getWaifu(id)), replace2(getWaifu(id)), (100*amount), getEXP(username, id), getLevel(username, id), getCandy(username, id)));
$.inidb.incr(username, 'harem', id, 100 * amount);
$.inidb.incr(username, 'wAttack', id, 1 * amount);
$.inidb.incr(username, 'wDefense', id, 1 * amount);
$.inidb.incr(username, 'wLove', id, 1 * amount);
$.inidb.incr(username, 'wLewdness', id, 1 * amount);
$.inidb.decr(username, 'candy', 1 * amount);
$.say($.lang.get('waifuGames.candy.use', $.whisperPrefix(username), replace(getWaifu(id)), replace2(getWaifu(id)), (100 * amount), getEXP(username, id), getLevel(username, id), getCandy(username, id)));
}

/*
Expand All @@ -768,7 +773,7 @@
attacker = $.userPrefix(username);

if (!action == '') {
id =getWaifuId(action);
id = getWaifuId(action);
player1 = getWaifu(getWaifuId(action));
} else {
id = getRandomHaremIdFromUser(username);
Expand Down Expand Up @@ -830,16 +835,16 @@
return;
}
if ($.isOnline($.channelName)) {
startBattle(sender, action.toLowerCase(), args.slice(1).join(' '));
}
startBattle(sender, action.toLowerCase(), args.slice(1).join(' '));
}
}

if (command.equalsIgnoreCase('candy')) {
if (action === undefined) {
$.say($.lang.get('waifugames.candy.get', $.whisperPrefix(sender), getCandy(sender)));
return;
} else {
useCandy(sender, action, subAction);
useCandy(sender, action, args.slice(1).join(' '));
}
}

Expand Down

0 comments on commit 39eb0c9

Please sign in to comment.