p.onLoadConfig() time.sleep(1) joe.connects(cid=3) joe.says("!mapstats") joe.says("!mystatalias") joe.says("!testscore") joe.says("!tscr") joe.says("!topstats") joe.says("!tops") joe.says("!topxp") joe.says("!txp") superadmin.connects(cid=2) joe.kills(superadmin) joe.kills(superadmin) joe.kills(superadmin) superadmin.kills(joe) superadmin.says("!mapstats") superadmin.says("!mystatalias") superadmin.says("!testscore") superadmin.says("!tscr") superadmin.says("!topstats") superadmin.says("!tops") superadmin.says("!topxp") superadmin.says("!txp")
conf.loadFromString(""" [commands] weaponrestrict: 80 restricted-rw: 0 [messages] warn_kick_message: 'Using %s is not allowed on this server. Please type !rw to see a list of restricted weapons' [punish_method] punish_method: 1 warn_duration: 1h [restricted_weapons] restricted_weapons: RPG-7, SMAW, M320, M26Mass """) # make B3 think it has a config file on the filesystem conf.fileName = os.path.join(os.path.dirname(__file__), '../extplugins/conf/weaponrestrict.ini') p = Weaponrestrictbf3Plugin(fakeConsole, conf) p.onLoadConfig() p.onStartup() joe.connects(cid=1) simon.connects(cid=7) print "----------- Testing Punish Method Set as Kick ------------" joe.kills(simon, 'M320') time.sleep(5) print "----------- Testing Punish Method Set as Warn ------------" p.punish_method = 2 p.warn_duration = '2h' joe.kills(simon, 'M320')
p = StatsPlugin(fakeConsole, conf) p.onStartup() p.onLoadConfig() time.sleep(1) joe.connects(cid=3) joe.says("!mapstats") joe.says("!mystatalias") joe.says("!testscore") joe.says("!tscr") joe.says("!topstats") joe.says("!tops") joe.says("!topxp") joe.says("!txp") superadmin.connects(cid=2) joe.kills(superadmin) joe.kills(superadmin) joe.kills(superadmin) superadmin.kills(joe) superadmin.says("!mapstats") superadmin.says("!mystatalias") superadmin.says("!testscore") superadmin.says("!tscr") superadmin.says("!topstats") superadmin.says("!tops") superadmin.says("!topxp") superadmin.says("!txp")
if __name__ == '__main__': import time from b3.fake import fakeConsole from b3.fake import joe from b3.fake import simon from b3.fake import moderator p = TkPlugin(fakeConsole, "@b3/conf/plugin_tk.xml") p.onStartup() # register events, etc joe.team = b3.TEAM_BLUE simon.team = b3.TEAM_BLUE time.sleep(5) joe.kills(simon) time.sleep(6) simon.kills(joe) time.sleep(2) joe.says('!f 2') time.sleep(2) joe.damages(simon) moderator.says('!forgiveinfo joe') time.sleep(2) joe.damages(simon) joe.damages(simon) moderator.says('!forgiveinfo joe') time.sleep(2) joe.kills(simon) time.sleep(2)