self._parent.bot("^1MUTE ^3%s" % self._victim.exactName) self.console.say("^1MUTE ^3%s" % self._victim.exactName) self.console.write('mute %s %s' % (self._victim.cid, '')) self._victim = None def end_vote_no(self, yes, no): self.console.say(self._parent.getMessage('failed_vote')) self._victim = None if __name__ == '__main__': from b3.fake import fakeConsole from b3.fake import superadmin, reg, admin fakeConsole.setCvar('g_mapcycle', 'mapcycle.txt') setattr(fakeConsole.game, 'fs_basepath', '/home/gabriel/.q3a') setattr(fakeConsole.game, 'fs_game', 'q3ut4') p = Voting2GPlugin(fakeConsole, '@b3/extplugins/conf/voting2g.xml') p.onStartup() superadmin.connects(cid=1) reg.connects(cid=2) admin.connects(cid=3) time.sleep(2) superadmin.says("!maplist") time.sleep(2) admin.says("!votemap ut4_turnpike") time.sleep(1) reg.says("!vy")
prepare_fakeparser_for_tests() from b3.fake import fakeConsole from b3.fake import admin from poweradminbf3 import Poweradminbf3Plugin from b3.config import XmlConfigParser conf = XmlConfigParser() conf.setXml(""" <configuration plugin="poweradminbf3"> <settings name="commands"> <set name="loadconfig">40</set> </settings> <settings name="preferences"> <set name="config_path">%(script_dir)s</set> </settings> </configuration> """ % {'script_dir': os.path.abspath(os.path.join(os.path.dirname(__file__), '../extplugins/conf/serverconfigs'))}) p = Poweradminbf3Plugin(fakeConsole, conf) p.onLoadConfig() p.onStartup() admin.connects(2) admin.says('!loadconfig hardcore-tdm') time.sleep(2) admin.says('!loadconfig hardcore-') time.sleep(2)
# -*- encoding: utf-8 -*- import os from tests import prepare_fakeparser_for_tests prepare_fakeparser_for_tests() from b3.fake import fakeConsole from b3.fake import admin from poweradminbf3 import Poweradminbf3Plugin from b3.config import XmlConfigParser conf = XmlConfigParser() conf.setXml(""" <configuration plugin="poweradminbf3"> <settings name="commands"> <set name="listconfig">40</set> </settings> <settings name="preferences"> <set name="config_path">%(script_dir)s</set> </settings> </configuration> """ % {'script_dir': os.path.abspath(os.path.join(os.path.dirname(__file__), '../extplugins/conf/serverconfigs'))}) p = Poweradminbf3Plugin(fakeConsole, conf) p.onLoadConfig() p.onStartup() admin.connects(2) admin.says('!listconfig')
from b3.fake import admin, joe import time from b3.config import XmlConfigParser conf = XmlConfigParser() conf.setXml(""" <configuration plugin="stats"> <settings name="settings"> <set name="logfile">admin.log</set> <set name="loglevel">40</set> <set name="log2console">false</set> </settings> </configuration> """) p = ActionloggerPlugin(fakeConsole, conf) p.onStartup() p.onLoadConfig() time.sleep(1) joe.connects(cid=3) joe.says("!help") admin.connects(cid=2) admin.says("hello all") admin.says("!help") admin.says("@admins") admin.says2team("&warn joe rule1")
if self._victim.connected: self._parent.bot("^1MUTE ^3%s" % self._victim.exactName) self.console.say("^1MUTE ^3%s" % self._victim.exactName) self.console.write('mute %s %s' % (self._victim.cid, '')) self._victim = None def end_vote_no(self, yes, no): self.console.say(self._parent.getMessage('failed_vote')) self._victim = None if __name__ == '__main__': from b3.fake import fakeConsole from b3.fake import superadmin, reg, admin fakeConsole.setCvar('g_mapcycle','mapcycle.txt') setattr(fakeConsole.game,'fs_basepath','/home/gabriel/.q3a') setattr(fakeConsole.game,'fs_game','q3ut4') p = Voting2GPlugin(fakeConsole, '@b3/extplugins/conf/voting2g.xml') p.onStartup() superadmin.connects(cid=1) reg.connects(cid=2) admin.connects(cid=3) time.sleep(2) superadmin.says("!maplist") time.sleep(2) admin.says("!votemap ut4_turnpike") time.sleep(1) reg.says("!vy")