tBKwtWS %!s(int64=7) %!d(string=hai) anos
pai
achega
36ff5597a6

+ 5 - 10
irc/commands/common.py

@@ -162,7 +162,11 @@ class GameHelpers():
         coin_given = userrecord[3]
         coin_spent = userrecord[4]
         ap_spent = userrecord[5]
-        total_xp = ((level + joins + (given * received) + messages + (messages_words / 4) + (messages_characters / 10) + ((actions + (actions_words / 4) + (actions_characters / 10)) * 2) + ((notices + (notices_words / 4) + (notices_characters / 10)) / 2)) / 120) - (level * 5) + float(coin_spent) + float(ap_spent / 4)
+        
+        chatxp = messages + (messages_words / 4) + (messages_characters / 10) + ((actions + (actions_words / 4) + (actions_characters / 10)) * 2) + ((notices + (notices_words / 4) + (notices_characters / 10)) / 2)
+        kickxp = given * received
+        total_xp = ((joins + kickxp + chatxp) / 120) + float(coin_spent + ap_spent / 4) - (level * 5) 
+        
         xp = total_xp - xp_spent
         ap = total_xp + xp - float(ap_spent)
         total_messages = messages + actions + notices
@@ -171,23 +175,14 @@ class GameHelpers():
         if total_xp < 1:
             total_xp = 1
         joinkarma = (((messages / 19) - joins) / total_xp) /10
-        print("Joinkarma: (" + str(messages) + " / 20) - " + str(joins) + " = " + str(joinkarma))
         words_per_message = (total_words / 6) - total_messages
-        print("Words per message: = (" + str(total_words) + " / 6) - " + str(total_messages) + " = " + str(words_per_message))
         characters_per_message = (total_characters / 20) - total_messages
-        print("Characters per message: (" + str(total_characters) + " / 20) - " + str(total_messages) + " = " + str(characters_per_message))
         characters_per_word = (total_characters / 6) - total_words
-        print("Characters per word: (" + str(total_characters) + " / 6) - " + str(total_words) + ") = " + str(characters_per_word))
         chatkarma = ((words_per_message + characters_per_message + characters_per_message + characters_per_word) / total_xp) / 100
-        print("Chat karma: ((" + str(words_per_message) + " + " + str(characters_per_message) + " + " + str(characters_per_word) + ") / " + str(total_xp) + ") / 100 = " + str(chatkarma))
         kickkarma = ((given * received) / total_xp) / 2
-        print("Kick karma: (" + str(given) + " * " + str(received) + ") / "+ str(total_xp) + " = " + str(kickkarma))
         xpkarma = xp / 25
-        print("XP Karma: " + str(xp) + " /  25 = " + str(xpkarma))
         coinkarma = (coin - coin_given / (xp_spent + 1)) / 99
-        print("Coin karma: (" + str(coin) + " / (" + str(xp_spent + 1) + ")) / 99 = " + str(coinkarma))
         karma = float(joinkarma) + float(chatkarma) - float(kickkarma) + float(xpkarma) - float(coinkarma)
-        print("karma: " + str(joinkarma) + " + "+ str(chatkarma) + " - " + str(kickkarma) + " + " + str(xpkarma) + " - " + str(coinkarma) + " = " + str(karma))
         
         return level, xp, xp_spent, total_xp, karma, coin, coin_spent, coin_given, ap, ap_spent
     

+ 1 - 1
irc/commands/games.py

@@ -180,7 +180,7 @@ def do_command(self, connection, event):
                 elif ap < 1:
                     connection.privmsg(replyto, "Insuficcient AP, you need at least 1.")
                 else:
-                    self.db.run("UPDATE users SET level=level+1, xp_spent=xp_spent+10 WHERE LOWER(name)=%s AND network=%s", (user, self.network, ))
+                    self.db.run("UPDATE users SET level=level+1, xp_spent=xp_spent+10, ap_spent=ap_spent+1 WHERE LOWER(name)=%s AND network=%s", (user, self.network, ))
                     self.db.run("UPDATE users SET coin=coin+0.3 WHERE level>0 AND network=%s", (self.network, ))
             elif len(command.split()) == 2:
                 try:

+ 8 - 2
pyRot.e4p

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE Project SYSTEM "Project-5.1.dtd">
 <!-- eric project file for project pyRot -->
-<!-- Saved: 2018-02-02, 20:24:47 -->
+<!-- Saved: 2018-02-11, 18:33:38 -->
 <!-- Copyright (C) 2018 tBKwtWS,  -->
 <Project version="5.1">
   <Language>en_US</Language>
@@ -34,17 +34,21 @@
     <Source>irc/events/on_pubmsg.py</Source>
     <Source>irc/events/on_welcome.py</Source>
     <Source>irc/events/on_whoreply.py</Source>
-    <Source>irc/original_testbot.py</Source>
+    <Source>uwsgi-hello-world-test.py</Source>
     <Source>webgui/manage.py</Source>
     <Source>webgui/stats/__init__.py</Source>
     <Source>webgui/stats/admin.py</Source>
     <Source>webgui/stats/apps.py</Source>
     <Source>webgui/stats/migrations/__init__.py</Source>
     <Source>webgui/stats/models.py</Source>
+    <Source>webgui/stats/templates/stats/network.html</Source>
+    <Source>webgui/stats/templates/stats/networks.html</Source>
     <Source>webgui/stats/tests.py</Source>
     <Source>webgui/stats/urls.py</Source>
     <Source>webgui/stats/views.py</Source>
     <Source>webgui/webgui/__init__.py</Source>
+    <Source>webgui/webgui/common/convert_units.py</Source>
+    <Source>webgui/webgui/routers.py</Source>
     <Source>webgui/webgui/settings.py</Source>
     <Source>webgui/webgui/urls.py</Source>
     <Source>webgui/webgui/wsgi.py</Source>
@@ -55,6 +59,7 @@
   <Interfaces/>
   <Others>
     <Other>pyRot.e4p</Other>
+    <Other>requirements.txt</Other>
   </Others>
   <MainScript>irc/bot.py</MainScript>
   <Vcs>
@@ -62,6 +67,7 @@
   </Vcs>
   <FiletypeAssociations>
     <FiletypeAssociation pattern="*.e4p" type="OTHERS"/>
+    <FiletypeAssociation pattern="*.html" type="SOURCES"/>
     <FiletypeAssociation pattern="*.idl" type="INTERFACES"/>
     <FiletypeAssociation pattern="*.md" type="OTHERS"/>
     <FiletypeAssociation pattern="*.py" type="SOURCES"/>

+ 3 - 3
webgui/stats/templates/stats/networks.html

@@ -63,15 +63,15 @@
                                     {% endif %}
                                     <div class="item">
                                         <i class="hashtag icon"></i>
-                                            {{ totalchannels }}
+                                            {{ network.channelcount }}
                                     </div>
                                     <div class="item">
                                         <i class="users icon"></i>
-                                            {{ totalusers }}
+                                            {{ network.usercount }}
                                     </div>
                                     <div class="item">
                                         <i class="comments outline icon"></i>
-                                            {{ totalmessages }}
+                                            {{ network.messagecount }}
                                     </div>
                                 </div>
                             </div>

+ 1 - 1
webgui/stats/views.py

@@ -15,7 +15,7 @@ def networks(request):
     totalusers = convert_units.shorten_number(len(users))
     networkslist = {}
     for network in networks:
-        networkslist[network.name] = {'channelcount': 0, 'usercount': 0, 'messagecount': 0, 'xpspentcount': 0, 'coinspentcount': 0, 'coingivencount': 0}
+        networkslist[network.name] = {'' 'channelcount': 0, 'usercount': 0, 'messagecount': 0, 'xpspentcount': 0, 'coinspentcount': 0, 'coingivencount': 0}
     isxpspent = False
     for user in users:
         networkslist[user.network.name]['usercount'] += 1