Exemplo n.º 1
0
 def test_startup():
     p._initial_heartbeat_delay = 10
     p.onStartup()
     time.sleep(5)
     print "_heartbeat_sent : %s" % p._heartbeat_sent
     time.sleep(20)
     print "_heartbeat_sent : %s" % p._heartbeat_sent
     fakeConsole.queueEvent(b3.events.Event(b3.events.EVT_STOP, None, None))
Exemplo n.º 2
0
 def test_startup():
     p._initial_heartbeat_delay = 10
     p.onStartup()
     time.sleep(5)
     print "_heartbeat_sent : %s" % p._heartbeat_sent
     time.sleep(20)
     print "_heartbeat_sent : %s" % p._heartbeat_sent
     fakeConsole.queueEvent(b3.events.Event(b3.events.EVT_STOP, None, None))
 def test_teamMisc(self):
     joe.says('!ts join')
     joe.team = b3.TEAM_SPEC
     joe.setvar(self.p, 'switchtarget', 'team')
     fakeConsole.queueEvent(b3.events.Event(b3.events.EVT_CLIENT_SQUAD_CHANGE, (joe.team, joe.squad), joe))
     time.sleep(.1)
     tsclient = self.p.tsGetClient(joe)
     self.assertNotEqual(tsclient, None)
     self.assertEqual(tsclient['cid'], self.p.tsChannelIdB3)
Exemplo n.º 4
0
 def test_team1(self):
     joe.says('!ts join')
     joe.team = b3.TEAM_BLUE
     joe.setvar(self.p, 'switchtarget', 'team')
     fakeConsole.queueEvent(
         b3.events.Event(b3.events.EVT_CLIENT_TEAM_CHANGE, joe.team, joe))
     time.sleep(.1)
     tsclient = self.p.tsGetClient(joe)
     self.assertNotEqual(tsclient, None)
     self.assertEqual(tsclient['cid'], self.p.tsChannelIdTeam1)
 def test_squadsTeam2(self):
     joe.says('!ts join')
     joe.team = b3.TEAM_RED
     joe.setvar(self.p, 'switchtarget', 'squad')
     for i in range(1, 9):
         joe.squad = i
         fakeConsole.queueEvent(b3.events.Event(b3.events.EVT_CLIENT_SQUAD_CHANGE, (joe.team, joe.squad), joe))
         time.sleep(.1)
         tsclient = self.p.tsGetClient(joe)
         self.assertNotEqual(tsclient, None)
         self.assertEqual(tsclient['cid'], self.p.tsChannelIdSquadsTeam2[i])
Exemplo n.º 6
0
 def test_squadsTeam2(self):
     joe.says('!ts join')
     joe.team = b3.TEAM_RED
     joe.setvar(self.p, 'switchtarget', 'squad')
     for i in range(1, 9):
         joe.squad = i
         fakeConsole.queueEvent(
             b3.events.Event(b3.events.EVT_CLIENT_SQUAD_CHANGE,
                             (joe.team, joe.squad), joe))
         time.sleep(.1)
         tsclient = self.p.tsGetClient(joe)
         self.assertNotEqual(tsclient, None)
         self.assertEqual(tsclient['cid'], self.p.tsChannelIdSquadsTeam2[i])
Exemplo n.º 7
0
<configuration plugin="vehiclecontrolbf3">
    <settings name="messages">
        <set name="no_vehicle_respawn">Combat vehicles will NOT respawn on this map! Use them wisely.</set>
    </settings>
    <disable_vehicle_respawn>
        <map>MP_001</map>
        <map>MP_003</map>
    </disable_vehicle_respawn>
    <whitelist_gametypes>
        <gametype>ConquestLarge0</gametype>
        <gametype>ConquestSmall0</gametype>
        <gametype>ConquestAssaultLarge0</gametype>
        <gametype>ConquestAssaultSmall0</gametype>
        <gametype>ConquestAssaultSmall1</gametype>
    </whitelist_gametypes>
</configuration>
""")
# make B3 think it has a config file on the filesystem
conf.fileName = os.path.join(os.path.dirname(__file__),
                             '../extplugins/conf/vehiclecontrolbf3.xml')

p = Vehiclecontrolbf3Plugin(fakeConsole, conf)
p.onLoadConfig()
p.onStartup()

fakeConsole.game.gameType = 'ConquestLarge0'

print "----------------------------Should skip disabling vehicles"
fakeConsole.game.mapName = "MP_003"
fakeConsole.queueEvent(b3.events.Event(b3.events.EVT_GAME_ROUND_START, None))
# make B3 think it has a config file on the filesystem
conf.fileName = os.path.join(os.path.dirname(__file__), '../extplugins/conf/plugin_poweradminbf3.xml')

time.sleep(.5)
print "-"*50
p = Poweradminbf3Plugin(fakeConsole, conf)
p.onLoadConfig()
p.onStartup()

def my_getNextMap():
    return nextmap

def my_getHardName(mapname):
    return "MP_007"

fakeConsole.getNextMap = my_getNextMap
fakeConsole.getHardName = my_getHardName


assert p._configmanager is True

print "------------------------ should load b3_main.cfg"
nextmap = "Caspian Border (Squad Deathmatch)"
fakeConsole.queueEvent(b3.events.Event(b3.events.EVT_GAME_ROUND_END, None))

# create a file "b3_teamdeathmatch0.cfg" in config folder to test below
#time.sleep(1)

#print "------------------------ should load b3_teamdeathmatch0.cfg"
#nextmap = "Caspian Border (Team Deathmatch)"
#fakeConsole.queueEvent(b3.events.Event(b3.events.EVT_GAME_ROUND_END, None))
print "\n\n####################################### test scrambleTeams()"
for i in range(12):
    fakeConsole.clients.newClient(cid='p%s'%i, guid='p%s'%i, name="Player %s"%i, teamId=1)
printTeams()
p._scrambler.scrambleTeams()
printTeams()
p._scrambler.scrambleTeams()
printTeams()


print "\n\n####################################### test !scramblemode"
superadmin.says('!scramblemode')
superadmin.says('!scramblemode random')
superadmin.says('!scramblemode score')

print "\n\n####################################### test scrambling by score"
generate_scores()
superadmin.says('!scramblemode score')
printTeams()
p._scrambler.scrambleTeams()
printTeams()

print "\n\n####################################### test scrambling at next round change"
print "\n\t------------ Should scramble after second event ---------------"
generate_scores()
fakeConsole.queueEvent(b3.events.Event(b3.events.EVT_GAME_ROUND_START, 2, None))
printTeams()
print "\n\t------------ Should not scramble after second event ---------------"
fakeConsole.queueEvent(b3.events.Event(b3.events.EVT_GAME_ROUND_START, 2, None))