summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorLivio Recchia <recchialivio@libero.it>2020-04-05 14:52:49 +0200
committerLivio Recchia <recchialivio@libero.it>2020-04-05 14:52:49 +0200
commit19a25076dcddb4c1219909cf7572b85e9b4d4a2a (patch)
treecc25d204a50d85292eb518a08256e4bb5b953983 /plugins
parent2d6470e55dee3cb70f5ac41923792371d6674b3c (diff)
downloadmanachat-19a25076dcddb4c1219909cf7572b85e9b4d4a2a.tar.gz
manachat-19a25076dcddb4c1219909cf7572b85e9b4d4a2a.tar.bz2
manachat-19a25076dcddb4c1219909cf7572b85e9b4d4a2a.tar.xz
manachat-19a25076dcddb4c1219909cf7572b85e9b4d4a2a.zip
Trying to fix something like setting files.
Diffstat (limited to 'plugins')
-rwxr-xr-x[-rw-r--r--]plugins/README.txt0
-rwxr-xr-x[-rw-r--r--]plugins/__init__.py0
-rwxr-xr-x[-rw-r--r--]plugins/__init__.pycbin1925 -> 1925 bytes
-rwxr-xr-x[-rw-r--r--]plugins/autofollow.py0
-rwxr-xr-x[-rw-r--r--]plugins/autofollow.pycbin1266 -> 1266 bytes
-rwxr-xr-x[-rw-r--r--]plugins/autospell.py0
-rwxr-xr-x[-rw-r--r--]plugins/autospell.pycbin1802 -> 1802 bytes
-rwxr-xr-x[-rw-r--r--]plugins/battlebot.py0
-rwxr-xr-x[-rw-r--r--]plugins/battlebot.pycbin5768 -> 5768 bytes
-rwxr-xr-x[-rw-r--r--]plugins/chatbot.py0
-rwxr-xr-x[-rw-r--r--]plugins/chatbot.pycbin2591 -> 2591 bytes
-rwxr-xr-x[-rw-r--r--]plugins/chatlogfile.py0
-rwxr-xr-x[-rw-r--r--]plugins/chatlogfile.pycbin3908 -> 3908 bytes
-rwxr-xr-x[-rw-r--r--]plugins/guildbot/__init__.py0
-rwxr-xr-x[-rw-r--r--]plugins/guildbot/__init__.pycbin763 -> 763 bytes
-rwxr-xr-x[-rw-r--r--]plugins/guildbot/create_db.sql0
-rwxr-xr-x[-rw-r--r--]plugins/guildbot/guilddb.py0
-rwxr-xr-x[-rw-r--r--]plugins/guildbot/guilddb.pycbin6575 -> 6575 bytes
-rwxr-xr-x[-rw-r--r--]plugins/guildbot/handlers.py0
-rwxr-xr-x[-rw-r--r--]plugins/guildbot/handlers.pycbin10189 -> 10189 bytes
-rwxr-xr-x[-rw-r--r--]plugins/lazytree.py0
-rwxr-xr-x[-rw-r--r--]plugins/lazytree.pycbin9158 -> 9158 bytes
-rwxr-xr-x[-rw-r--r--]plugins/manaboy.py121
-rwxr-xr-x[-rw-r--r--]plugins/manaboy.pycbin38016 -> 39617 bytes
-rwxr-xr-x[-rw-r--r--]plugins/msgqueue.py0
-rwxr-xr-x[-rw-r--r--]plugins/msgqueue.pycbin2424 -> 2424 bytes
-rwxr-xr-x[-rw-r--r--]plugins/notify.py0
-rwxr-xr-x[-rw-r--r--]plugins/notify.pycbin2803 -> 2803 bytes
-rwxr-xr-x[-rw-r--r--]plugins/npc.py0
-rwxr-xr-x[-rw-r--r--]plugins/npc.pycbin4036 -> 4036 bytes
-rwxr-xr-x[-rw-r--r--]plugins/restapi.py0
-rwxr-xr-x[-rw-r--r--]plugins/shop.py25
-rwxr-xr-x[-rw-r--r--]plugins/shop.pycbin12766 -> 13383 bytes
33 files changed, 109 insertions, 37 deletions
diff --git a/plugins/README.txt b/plugins/README.txt
index 8324b3d..8324b3d 100644..100755
--- a/plugins/README.txt
+++ b/plugins/README.txt
diff --git a/plugins/__init__.py b/plugins/__init__.py
index 0e40be9..0e40be9 100644..100755
--- a/plugins/__init__.py
+++ b/plugins/__init__.py
diff --git a/plugins/__init__.pyc b/plugins/__init__.pyc
index 4469184..4469184 100644..100755
--- a/plugins/__init__.pyc
+++ b/plugins/__init__.pyc
Binary files differ
diff --git a/plugins/autofollow.py b/plugins/autofollow.py
index ff34bde..ff34bde 100644..100755
--- a/plugins/autofollow.py
+++ b/plugins/autofollow.py
diff --git a/plugins/autofollow.pyc b/plugins/autofollow.pyc
index 159fe47..159fe47 100644..100755
--- a/plugins/autofollow.pyc
+++ b/plugins/autofollow.pyc
Binary files differ
diff --git a/plugins/autospell.py b/plugins/autospell.py
index 30d0ec6..30d0ec6 100644..100755
--- a/plugins/autospell.py
+++ b/plugins/autospell.py
diff --git a/plugins/autospell.pyc b/plugins/autospell.pyc
index 362aab6..362aab6 100644..100755
--- a/plugins/autospell.pyc
+++ b/plugins/autospell.pyc
Binary files differ
diff --git a/plugins/battlebot.py b/plugins/battlebot.py
index 5cba467..5cba467 100644..100755
--- a/plugins/battlebot.py
+++ b/plugins/battlebot.py
diff --git a/plugins/battlebot.pyc b/plugins/battlebot.pyc
index c48b64d..c48b64d 100644..100755
--- a/plugins/battlebot.pyc
+++ b/plugins/battlebot.pyc
Binary files differ
diff --git a/plugins/chatbot.py b/plugins/chatbot.py
index e26928d..e26928d 100644..100755
--- a/plugins/chatbot.py
+++ b/plugins/chatbot.py
diff --git a/plugins/chatbot.pyc b/plugins/chatbot.pyc
index b327a9e..b327a9e 100644..100755
--- a/plugins/chatbot.pyc
+++ b/plugins/chatbot.pyc
Binary files differ
diff --git a/plugins/chatlogfile.py b/plugins/chatlogfile.py
index 7d97c8c..7d97c8c 100644..100755
--- a/plugins/chatlogfile.py
+++ b/plugins/chatlogfile.py
diff --git a/plugins/chatlogfile.pyc b/plugins/chatlogfile.pyc
index c6fad9b..c6fad9b 100644..100755
--- a/plugins/chatlogfile.pyc
+++ b/plugins/chatlogfile.pyc
Binary files differ
diff --git a/plugins/guildbot/__init__.py b/plugins/guildbot/__init__.py
index 0e4ffd5..0e4ffd5 100644..100755
--- a/plugins/guildbot/__init__.py
+++ b/plugins/guildbot/__init__.py
diff --git a/plugins/guildbot/__init__.pyc b/plugins/guildbot/__init__.pyc
index f10c5b9..f10c5b9 100644..100755
--- a/plugins/guildbot/__init__.pyc
+++ b/plugins/guildbot/__init__.pyc
Binary files differ
diff --git a/plugins/guildbot/create_db.sql b/plugins/guildbot/create_db.sql
index bdf1d76..bdf1d76 100644..100755
--- a/plugins/guildbot/create_db.sql
+++ b/plugins/guildbot/create_db.sql
diff --git a/plugins/guildbot/guilddb.py b/plugins/guildbot/guilddb.py
index a720b49..a720b49 100644..100755
--- a/plugins/guildbot/guilddb.py
+++ b/plugins/guildbot/guilddb.py
diff --git a/plugins/guildbot/guilddb.pyc b/plugins/guildbot/guilddb.pyc
index 9de8f66..9de8f66 100644..100755
--- a/plugins/guildbot/guilddb.pyc
+++ b/plugins/guildbot/guilddb.pyc
Binary files differ
diff --git a/plugins/guildbot/handlers.py b/plugins/guildbot/handlers.py
index 6d032b5..6d032b5 100644..100755
--- a/plugins/guildbot/handlers.py
+++ b/plugins/guildbot/handlers.py
diff --git a/plugins/guildbot/handlers.pyc b/plugins/guildbot/handlers.pyc
index a109f0c..a109f0c 100644..100755
--- a/plugins/guildbot/handlers.pyc
+++ b/plugins/guildbot/handlers.pyc
Binary files differ
diff --git a/plugins/lazytree.py b/plugins/lazytree.py
index 64efda0..64efda0 100644..100755
--- a/plugins/lazytree.py
+++ b/plugins/lazytree.py
diff --git a/plugins/lazytree.pyc b/plugins/lazytree.pyc
index b7bb800..b7bb800 100644..100755
--- a/plugins/lazytree.pyc
+++ b/plugins/lazytree.pyc
Binary files differ
diff --git a/plugins/manaboy.py b/plugins/manaboy.py
index 127ddd0..c5480b6 100644..100755
--- a/plugins/manaboy.py
+++ b/plugins/manaboy.py
@@ -39,6 +39,35 @@ disliked_players = preloadArray("bot/disliked.txt")
admins = preloadArray("bot/admins.txt")
friends = preloadArray("bot/friends.txt")
+# ====================== XECUTE =============
+
+def XECUTE(nick, is_whisper, command, args=""):
+ try:
+ import subprocess
+ if args=="":
+ s = subprocess.check_output([command])
+ else:
+ s = subprocess.check_output([command, args])
+ except:
+ s=("Damn! " +match.group(1)+" + has failed!").strip()
+ if is_whisper:
+ whisper(nick,(s))
+ else:
+ mapserv.cmsg_chat_message(s)
+
+# ====================== XCAL =============
+
+def XCAL(nick, message, is_whisper, match):
+ if nick in ignored_players:
+ return
+ XECUTE(nick, is_whisper, "/home/livio/Nextcloud/mcu/prj/test_cparse/a.out",match.group(1))
+
+# === eXecute on Unix ===========
+
+def XUfortune(nick, message, is_whisper, match): XECUTE(nick, is_whisper, "fortune", "-s")
+def XUdate(nick, message, is_whisper, match): XECUTE(nick, is_whisper, "/bin/date")
+def XUpom(nick, message, is_whisper, match): XECUTE(nick, is_whisper, "/usr/games/pom")
+
# ====================== XCOM =============
XCOMList = preloadArray("bot/XCOM.txt")
XCOMServerStatInterested = [] #List of nicks interested in server status change
@@ -147,16 +176,37 @@ def XCOMInvite(nick, message, is_whisper, match):
return
if nick in ignored_players:
return #or say something
- if nick in admins:
+ if nick in admins: # FIXME Do not add if already there!!!
XCOMList.append(match.group(1))
XCOMBroadcast("##W--- " + nick + " (Admin) invited " + match.group(1) + " on XCOM ---" + XCOMBroadcastPrefix + match.group(1) + " XCOM enabled! Use !xcoff to disable, use !xclist to see XCOM online list")
else:
if nick in ignored_players:
whisper(nick, "You cannot invite banned players.")
else:
- whisper(match.group(1), "##W--- " + nick + " invited you on XCOM --- Answer !xcon to join.")
+ whisper(match.group(1), "##W--- " + nick + " invited you to chat on XCOM --- Answer !xcon to join.")
XCOMDelay()
- whisper(nick, "Invited " + match.group(1) + " to join XCOM. Waiting for his/her reply...")
+ whisper(nick, "Invited " + match.group(1) + " to join XCOM. Waiting for his/her reply...")
+
+XCOMServerInvited = []
+def XCOMInviteAll(nick, message, is_whisper, match):
+ XCOMDelay()
+ if not is_whisper:
+ return
+ if nick in ignored_players:
+ return #or say something
+ if nick in admins: # FIXME Do not add if already there!!!
+ for invn in online_users.online_users:
+ if invn in XCOMList:
+ pass
+ elif invn in ignored_players:
+ pass
+ elif invn in XCOMServerInvited:
+ pass
+ else:
+ XCOMServerInvited.append(invn)
+ whisper(invn, "##W--- " + nick + " invited you to chat on XCOM --- Answer !xcon to join.")
+ XCOMDelay()
+
def XCOMEnable(nick, message, is_whisper, match):
XCOMDelay()
@@ -247,22 +297,22 @@ def XCOMUnBan(nick, message, is_whisper, match):
# =============================================
-greetings = {
- "Hi {0}!" : 4,
- "Hey {0}" : 3,
- "Yo {0}" : 2,
- "{0}!!!!" : 1,
- "{0}!!!" : 1,
- "{0}!!" : 1,
- "Hello {0}!!!" : 5,
- "Hello {0}!" : 5,
- "Welcome back {0}!" : 3,
- "Hello {0}! You are looking lovely today!" : 1,
- "Hello {0}! I'm the bot that you can trust: I want your money!" : 1,
- "{0} is back!!" : 1,
+greetings = [
+ "Hi {0}!",
+ "Hey {0}",
+ "Yo {0}",
+ "{0}!!!!",
+ "{0}!!!",
+ "{0}!!",
+ "Hello {0}!!!",
+ "Hello {0}!",
+ "Welcome back {0}!",
+ "Hello {0}! You are looking lovely today!",
+ "Hello {0}! I'm the bot that you can trust: I want your money!",
+ "{0} is back!!",
"Hello and welcome to the Aperture Science \
-computer-aided enrichment center." : 1,
-}
+computer-aided enrichment center.",
+]
drop_items = [
"a bomb", "a bowl of petunias", "a cake", "a candy", "a chocobo",
@@ -397,7 +447,8 @@ dislikebye_answers = [
"Go away!!!",
"Don't come back!",
"Whew...",
- "I need another drink…"
+ "I need another drink…",
+ "*picking my nose*"
]
attack_answers = [
@@ -418,6 +469,7 @@ attack_answers = [
"I will burn you down.",
"The show begins...",
"I'm better than makeup artists, prepare yourself!!!",
+ "Yeah! A challenge!",
]
notattack_answers = [
@@ -440,6 +492,7 @@ story_action_fail = [
"stomped on the soul menhir",
"slipped on a terranite ore",
"got interrupted by phone call",
+ "got disconnected",
]
# FIXME Unused
@@ -453,28 +506,19 @@ story_actions = [
# -----------------------------------------------------------------------------
def say_greeting(nick, _, is_whisper, match):
+ if nick == "Liviobot" :
+ return
if is_whisper:
return
if nick in ignored_players:
return
- total_weight = 0
- for w in greetings.itervalues():
- total_weight += w
-
- random_weight = random.randint(0, total_weight)
- total_weight = 0
- random_greeting = 'Hi {0}'
- for g, w in greetings.iteritems():
- if total_weight >= random_weight:
- random_greeting = g
- break
- total_weight += w
if nick in disliked_players:
mapserv.cmsg_chat_message(random.choice(dislike_answers))
else:
- mapserv.cmsg_chat_message(random_greeting.format(nick))
+ answer = random.choice(greetings)
+ mapserv.cmsg_chat_message(answer.format(nick))
time.sleep(1)
def say_goodbye(nick, _, is_whisper, match):
@@ -485,13 +529,13 @@ def say_goodbye(nick, _, is_whisper, match):
return
total_weight = 0
- for w in greetings.itervalues():
+ for w in bye_answers.itervalues():
total_weight += w
random_weight = random.randint(0, total_weight)
total_weight = 0
random_greeting = 'Hi {0}'
- for g, w in greetings.iteritems():
+ for g, w in bye_answers.iteritems():
if total_weight >= random_weight:
random_greeting = g
break
@@ -970,7 +1014,7 @@ def cmd_say(nick, message, is_whisper, match):
return
if nick not in admins:
return
- set_npc_owner(nick)
+ # ~ set_npc_owner(nick)
msg = message.group(1)
mapserv.cmsg_chat_message(msg)
@@ -1337,18 +1381,25 @@ manaboy_commands = {
'!history' : cmd_history,
'!bug (.+)' : cmd_report_bug,
'!bugs' : cmd_check_bugs,
+
+ '!xcal (.*)' : XCAL,
+ '!xuf': XUfortune,
+ '!xudate': XUdate,
+ '!xupom': XUpom,
'!xcon' : XCOMEnable,
'!xcom' : XCOMEnable,
'!xcoff' : XCOMDisable,
'!xcom off' : XCOMDisable,
'!xclist' : XCOMOnlineList,
'!xci (.*)' : XCOMInvite,
+ '!xcia' : XCOMInviteAll,
'!xcsi (.*)' : XCOMSilentInvite,
'!xcb (.*)' : XCOMBan,
'!xcu (.*)' : XCOMUnBan,
'!xcsion' : XCOMServerInterestEnable,
'!xcsioff' : XCOMServerInterestDisable,
r'(.*)' : XCOMCommunicate,
+
r'^(?i)explain (.*)': say_explain,
r'^(?i)(hello|hi|hey|heya|hiya|yo) (?i)(livio|liviobot)' : say_greeting,
r'^(?i)(hello|hi|hey|heya|hiya) (?i)(all|everybody|everyone)(.*)' : say_greeting,
diff --git a/plugins/manaboy.pyc b/plugins/manaboy.pyc
index a712707..b4f5fd8 100644..100755
--- a/plugins/manaboy.pyc
+++ b/plugins/manaboy.pyc
Binary files differ
diff --git a/plugins/msgqueue.py b/plugins/msgqueue.py
index 25fe2b0..25fe2b0 100644..100755
--- a/plugins/msgqueue.py
+++ b/plugins/msgqueue.py
diff --git a/plugins/msgqueue.pyc b/plugins/msgqueue.pyc
index 5814be1..5814be1 100644..100755
--- a/plugins/msgqueue.pyc
+++ b/plugins/msgqueue.pyc
Binary files differ
diff --git a/plugins/notify.py b/plugins/notify.py
index ace4e0b..ace4e0b 100644..100755
--- a/plugins/notify.py
+++ b/plugins/notify.py
diff --git a/plugins/notify.pyc b/plugins/notify.pyc
index db13ee8..db13ee8 100644..100755
--- a/plugins/notify.pyc
+++ b/plugins/notify.pyc
Binary files differ
diff --git a/plugins/npc.py b/plugins/npc.py
index 5013562..5013562 100644..100755
--- a/plugins/npc.py
+++ b/plugins/npc.py
diff --git a/plugins/npc.pyc b/plugins/npc.pyc
index b0dec22..b0dec22 100644..100755
--- a/plugins/npc.pyc
+++ b/plugins/npc.pyc
Binary files differ
diff --git a/plugins/restapi.py b/plugins/restapi.py
index 5b1d0eb..5b1d0eb 100644..100755
--- a/plugins/restapi.py
+++ b/plugins/restapi.py
diff --git a/plugins/shop.py b/plugins/shop.py
index 44c5db8..be66cea 100644..100755
--- a/plugins/shop.py
+++ b/plugins/shop.py
@@ -7,6 +7,7 @@ import chatbot
import logicmanager
import status
import badge
+import random
from net.inventory import get_item_index
from net.trade import reset_trade_state
from utils import encode_str, extends
@@ -67,6 +68,20 @@ def cleanup():
s.index = 0
s.start_time = 0
+sell_greetings = [
+ "Hi {0}! Welcome to my shop!",
+ "Hey {0}, wanna something?",
+ "Let\'s do business!",
+ "Yeah! Spend your money here!",
+ "Shop here {0}, yes!",
+]
+
+buy_greetings = [
+ "Okay! Let's see what you've got to sell!",
+ "Hmm? Something interesting to trade?",
+ "Hey {0}, I'm not going to buy garbage!",
+ "Uh? Sorry I was\'t listening.",
+]
# =========================================================================
def selllist(nick, message, is_whisper, match):
@@ -75,10 +90,14 @@ def selllist(nick, message, is_whisper, match):
if nick in nobuy:
mapserv.cmsg_chat_message("Special prize for you, " + nick + "!")
time.sleep(5)
+ else:
+ answer = random.choice(sell_greetings)
+ mapserv.cmsg_chat_message(answer.format(nick))
+
+ time.sleep(5)
# ~ return
# Support for 4144's shop (Sell list)
data = '\302\202B1'
-
for id_, (price, amount) in selling.iteritems():
index = get_item_index(id_)
if index < 0:
@@ -99,7 +118,9 @@ def selllist(nick, message, is_whisper, match):
def buylist(nick, message, is_whisper, match):
if not is_whisper:
return
-
+ answer = random.choice(buy_greetings)
+ mapserv.cmsg_chat_message(answer.format(nick))
+ time.sleep(5)
# Support for 4144's shop (Sell list)
data = '\302\202S1'
diff --git a/plugins/shop.pyc b/plugins/shop.pyc
index aa39471..bf34846 100644..100755
--- a/plugins/shop.pyc
+++ b/plugins/shop.pyc
Binary files differ