summaryrefslogtreecommitdiff
path: root/badge.py
diff options
context:
space:
mode:
authorLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
committerLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
commit9a13903a2f7d3a65fdf15a65fb59cccd622e2066 (patch)
tree9403b7dff39eb5e5d7fa0f79efb69b496add4c4b /badge.py
parent11cc316b74d5f3f283413a33e7693b314741aa4a (diff)
downloadmanachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.gz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.bz2
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.xz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.zip
Initial commit
Diffstat (limited to 'badge.py')
-rw-r--r--badge.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/badge.py b/badge.py
new file mode 100644
index 0000000..c0b5525
--- /dev/null
+++ b/badge.py
@@ -0,0 +1,32 @@
+import net.mapserv as mapserv
+from logicmanager import logic_manager
+
+__all__ = ['is_shop', 'is_afk', 'is_idle']
+
+is_shop = False
+is_afk = False
+is_idle = False
+
+badge_ts = 0
+
+
+def badge_logic(ts):
+ if mapserv.server is None:
+ return
+
+ global badge_ts
+
+ if ts > badge_ts + 30:
+ badge_ts = ts
+ emote = 0xC0
+ if is_shop:
+ emote += 1
+ if is_afk:
+ emote += 2
+ if is_idle:
+ emote += 4
+ if is_shop or is_afk or is_idle:
+ mapserv.cmsg_player_emote(emote)
+
+
+logic_manager.add_logic(badge_logic)