summaryrefslogtreecommitdiff
path: root/badge.py
diff options
context:
space:
mode:
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)