|
|
@@ -1,5 +1,5 @@
|
|
|
import random
|
|
|
-from common import font, queries
|
|
|
+from common import font, queries, userstatus
|
|
|
|
|
|
|
|
|
class CommandHelpers():
|
|
|
@@ -118,16 +118,16 @@ class GameHelpers():
|
|
|
rolls.append(random.randint(1, type))
|
|
|
return rolls
|
|
|
|
|
|
- def get_info(self, user_id):
|
|
|
- total_joins = queries.get_user_total_joins(self, user_id)
|
|
|
- total_kicks = queries.get_user_total_kicks(self, user_id)
|
|
|
- total_kicked = queries.get_user_total_kicked(self, user_id)
|
|
|
- total_messages = queries.get_user_total_messages(self, user_id)
|
|
|
- total_actions = queries.get_user_total_actions(self, user_id)
|
|
|
- total_notices = queries.get_user_total_notices(self, user_id)
|
|
|
- total_cursewords_added = queries.get_user_total_curseword_added(self, user_id)
|
|
|
- total_curseadjectives_added = queries.get_user_total_curseadjective_added(self, user_id)
|
|
|
- gamestats = queries.get_user_gamestats(self, user_id)
|
|
|
+ def get_info(self, user):
|
|
|
+ total_joins = queries.get_user_total_joins(self, user.id)
|
|
|
+ total_kicks = queries.get_user_total_kicks(self, user.id)
|
|
|
+ total_kicked = queries.get_user_total_kicked(self, user.id)
|
|
|
+ total_messages = queries.get_user_total_messages(self, user.id)
|
|
|
+ total_actions = queries.get_user_total_actions(self, user.id)
|
|
|
+ total_notices = queries.get_user_total_notices(self, user.id)
|
|
|
+ total_cursewords_added = queries.get_user_total_curseword_added(self, user.id)
|
|
|
+ total_curseadjectives_added = queries.get_user_total_curseadjective_added(self, user.id)
|
|
|
+ gamestats = queries.get_user_gamestats(self, user.id)
|
|
|
xp_spent = gamestats[0]
|
|
|
level = gamestats[1]
|
|
|
coin = gamestats[2]
|
|
|
@@ -165,13 +165,21 @@ class GameHelpers():
|
|
|
print('wealth_karma:' + str(wealth_karma) + ' = (coin:' + str(coin) + ' * 50) / total_xp:' + str(total_xp))
|
|
|
charity_karma = (coin_given * 10.1) / total_xp
|
|
|
print('charity_karma:' + str(charity_karma) + ' = (coin_given:' + str(coin_given) + ' * 10) / total_xp:' + str(total_xp))
|
|
|
- karma = float(karma_correction) + float(curse_add_karma) + float(charity_karma) - float(join_karma) - float(kick_karma) - float(shout_karma) - float(wealth_karma)
|
|
|
- print('karma: ' + str(karma) + ' = float(karma_correction:' + str(karma_correction) + ') + float(curse_karma:' + str(curse_add_karma) + ') + float(charity_karma:' + str(charity_karma) + ') - float(join_karma:' + str(join_karma) + ') - float(kick_karma:' + str(kick_karma) + ') - float(shout_karma:' + str(shout_karma) + ') - float(wealth_karma:' + str(wealth_karma) + ')')
|
|
|
+ elite_karma_bonus = 0
|
|
|
+ i = 0
|
|
|
+ for channel in self.channels:
|
|
|
+ if userstatus.atleast_voiced(self, user.name, channel[i]):
|
|
|
+ print(channel[i])
|
|
|
+ elite_karma_bonus += 1
|
|
|
+ print(elite_karma_bonus)
|
|
|
+ i += 1
|
|
|
+ karma = float(karma_correction) + float(curse_add_karma) + float(charity_karma) + elite_karma_bonus - float(join_karma) - float(kick_karma) - float(shout_karma) - float(wealth_karma)
|
|
|
+ print('karma: ' + str(karma) + ' = float(karma_correction:' + str(karma_correction) + ') + float(curse_karma:' + str(curse_add_karma) + ') + float(charity_karma:' + str(charity_karma) + ') + elite_karma_bonus:' + str(elite_karma_bonus) + ' - float(join_karma:' + str(join_karma) + ') - float(kick_karma:' + str(kick_karma) + ') - float(shout_karma:' + str(shout_karma) + ') - float(wealth_karma:' + str(wealth_karma) + ')')
|
|
|
|
|
|
return level, xp, xp_spent, total_xp, karma, coin, coin_spent, coin_given, ap, ap_spent
|
|
|
|
|
|
- def player_info(self, user_id):
|
|
|
- level, xp, xp_spent, total_xp, karma, coin, coin_spent, coin_given, ap, ap_spent = GameHelpers.get_info(self, user_id)
|
|
|
+ def player_info(self, user):
|
|
|
+ level, xp, xp_spent, total_xp, karma, coin, coin_spent, coin_given, ap, ap_spent = GameHelpers.get_info(self, user)
|
|
|
#return 'Level: ' + str(level) + font.grey + ", " + font.reset + "XP: " + str(int(xp)) + "/" + font.grey + str(round(total_xp, 4)) + ", " + font.reset + "AP: " + str(int(ap)) + font.grey + ", " + font.reset + "coin: " + str(coin) + font.grey + "[S " + str(coin_spent) + ", G " + str(coin_given) + "], " + font.reset + "karma: " + str(round(karma, 4))
|
|
|
return 'Level: ' + str(level) + font.grey + ", " + font.reset + "XP: " + str(int(xp)) + "/" + font.grey + str(int(total_xp)) + ", " + font.reset + "AP: " + str(int(ap)) + font.grey + ", " + font.reset + "coin: " + str(coin) + font.grey + "[S " + str(coin_spent) + ", G " + str(coin_given) + "], " + font.reset + "karma: " + str(round(karma, 4))
|
|
|
|
|
|
@@ -186,6 +194,6 @@ class GameHelpers():
|
|
|
message = ""
|
|
|
for record in result:
|
|
|
if not int(record[column]) < 1:
|
|
|
- level, xp, xp_spent, total_xp, karma, coin, coin_spent, coin_given, ap, ap_spent = GameHelpers.get_info(self, record.id)
|
|
|
+ level, xp, xp_spent, total_xp, karma, coin, coin_spent, coin_given, ap, ap_spent = GameHelpers.get_info(self, record)
|
|
|
message += font.red + str(record[1]) + font.grey + " L " + font.green + str(level) + font.grey + ", XP " + font.green + str(int(xp)) + font.grey + "/" + str(int(total_xp)) + ", A " + font.green + str(int(ap)) + font.grey + ", C " + font.green + str(coin) + font.grey + ", K " + font.green + str(round(karma, 2)) + font.grey + ", "
|
|
|
return message[:-2]
|