Advertisement
Guest User

[0.9.8.1] GameOver Notify v5.1

a guest
Jun 16th, 2015
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.04 KB | None | 0 0
  1. import BigWorld
  2. import GUI
  3. from constants import ARENA_PERIOD
  4. from debug_utils import *
  5. from PlayerEvents import g_playerEvents
  6. from Account import PlayerAccount
  7. from gui import SystemMessages
  8. from messenger import MessengerEntry
  9. from gui.shared.utils.sound import Sound
  10. from gui.WindowsManager import g_windowsManager
  11.  
  12.  
  13.  
  14. g_text = None
  15. g_other_team = 0
  16. g_onetime = 0
  17. g_my_team = 0
  18.  
  19. def PeriodChange(period, *args):
  20.     global g_onetime
  21.     arena = BigWorld.player().arena
  22.     if arena is not None:
  23.         if arena.period == ARENA_PERIOD.AFTERBATTLE and g_onetime != 1:
  24.             g_onetime = 1
  25.             nst_logs('   -> TIME OUT', '#4CFF47')
  26.             nst_text('TIME OUT', 8.0, (76, 255, 71, 255))
  27.             Sound('/ingame_voice/notifications_VO/target_unlocked').play()            
  28.            
  29.  
  30. def nst_logs(message, color='#FF0000'):
  31.     MessengerEntry.g_instance.gui.addClientMessage('<font color="'+color+'">' + message + '</font>')
  32.     LOG_NOTE(message)
  33.  
  34. def nst_text(message, time, color):
  35.     global g_text
  36.     if g_text is not None:
  37.        GUI.delRoot(g_text)
  38.        g_text = None
  39.            
  40.     g_text = GUI.Text(message)
  41.     g_text.horizontalAnchor = 'CENTER'
  42.     g_text.verticalAnchor = 'CENTER'
  43.     g_text.colour = color
  44.     GUI.addRoot(g_text)
  45.     BigWorld.callback(time, nst_del_text)
  46.    
  47.  
  48. def Setup():
  49.     global g_other_team, g_onetime, g_my_team
  50.     g_other_team = 0  
  51.     g_onetime = 0
  52.     g_my_team = 0
  53.  
  54. g_windowsManager.onInitBattleGUI += Setup    
  55.  
  56.  
  57. def nst_del_text():
  58.     global g_text
  59.     if g_text is not None:
  60.         GUI.delRoot(g_text)
  61.         g_text = None    
  62.  
  63.    
  64.  
  65. def TeamBasePointsUpdate(team, baseID, points, capturingStopped):
  66.     global g_onetime
  67.     if g_onetime != 1:
  68.         if points == 50:
  69.             nst_logs('   -> BASE CAPTURING '+str(points)+'%', '#FFFF47')
  70.             Sound('/GUI/dynamic_platoon/starting_dynamic_platoon').play()
  71.             nst_text('BASE CAPTURING 50%', 3.0, (255, 255, 71, 255))
  72.            
  73.         if points == 70:
  74.             nst_logs('   -> BASE CAPTURING '+str(points)+'%', '#FF9F34')
  75.             Sound('/GUI/dynamic_platoon/starting_dynamic_platoon').play()
  76.             nst_text('BASE CAPTURING 70%', 3.0, (255, 149, 34, 255))                
  77.            
  78.         if points == 90:
  79.             nst_logs('   -> BASE CAPTURING '+str(points)+'%', '#FF0000')
  80.             Sound('/GUI/dynamic_platoon/starting_dynamic_platoon').play()
  81.             nst_text('BASE CAPTURING 90%', 3.0, (255, 0, 0, 255))                                
  82.  
  83.  
  84. def TeamBaseCaptured(team, baseID):
  85.     global g_onetime
  86.     if g_onetime != 1:
  87.         g_onetime = 1
  88.         nst_logs('   -> BASE CAPTURED 100%', '#CC0006')
  89.         nst_text('BASE CAPTURED', 8.0, (255, 0, 0, 255))    
  90.         Sound('/ingame_voice/notifications_VO/target_unlocked').play()  
  91.  
  92. def VehicleKilled(victimID, killerID, reason):
  93.     global g_other_team, g_onetime, g_my_team
  94.     arena = BigWorld.player().arena
  95.     if arena is not None:
  96.         total_other_team_players = len(BigWorld.player().arena.vehicles) / 2
  97.         if total_other_team_players != 0:
  98.                
  99.             if BigWorld.player().team == BigWorld.player().arena.vehicles[victimID]['team']:
  100.                 g_my_team = g_my_team + 1
  101.                 c = '#FF0000'
  102.                 if g_my_team > g_other_team:
  103.                     c = '#FF0000'
  104.        
  105.                 if g_my_team < g_other_team:
  106.                     c = '#83FF79'
  107.        
  108.                 if g_my_team == g_other_team:
  109.                     c = '#FFFF93'
  110.                            
  111.                 nst_logs('   -> (My Team) '+str(total_other_team_players - g_my_team)+' vs '+str(total_other_team_players - g_other_team)+' (Enemy team)', c)            
  112.                 if total_other_team_players == g_my_team and g_onetime != 1:
  113.                     g_onetime = 1
  114.                     nst_logs('   -> OUR TEAM DEAD', '#FF0000')
  115.                     nst_text('OUR TEAM DEAD', 8.0, (255, 71, 76, 255))
  116.                     Sound('/ingame_voice/notifications_VO/target_unlocked').play()
  117.                    
  118.        
  119.             if BigWorld.player().team != BigWorld.player().arena.vehicles[victimID]['team']:
  120.                 g_other_team = g_other_team + 1
  121.                 c = '#FF0000'
  122.                 if g_my_team > g_other_team:
  123.                     c = '#FF0000'
  124.        
  125.                 if g_my_team < g_other_team:
  126.                     c = '#83FF79'
  127.        
  128.                 if g_my_team == g_other_team:
  129.                     c = '#FFFF93'    
  130.                            
  131.                 nst_logs('   -> (My Team) '+str(total_other_team_players - g_my_team)+' vs '+str(total_other_team_players - g_other_team)+' (Enemy team)', c)
  132.                 if total_other_team_players == g_other_team and g_onetime != 1:
  133.                     g_onetime = 1
  134.                     nst_logs('   -> ENEMY TEAM DEAD', '#4CFF47')
  135.                     nst_text('ENEMY TEAM DEAD', 8.0, (76, 255, 71, 255))
  136.                     Sound('/ingame_voice/notifications_VO/target_unlocked').play()                  
  137.  
  138.  
  139.  
  140. def avatarReady():
  141.     arena = BigWorld.player().arena
  142.     if arena is not None:
  143.         arena.onTeamBasePointsUpdate += TeamBasePointsUpdate
  144.         arena.onTeamBaseCaptured += TeamBaseCaptured
  145.         arena.onVehicleKilled += VehicleKilled
  146.         arena.onPeriodChange += PeriodChange
  147.  
  148. g_playerEvents.onAvatarReady += avatarReady
  149.  
  150.  
  151.  
  152. # pokazivat nadpis pri zaxode v angar, pri pervom zapuske klienta
  153. already_shown = False
  154. def new_onBecomePlayer(self):
  155.     global already_shown
  156.     pre_onBecomePlayer(self)
  157.     if not already_shown:
  158.         already_shown = True
  159.         SystemMessages.pushMessage('<font color="#FF0000">GameOver Notify v5.1</font><br>Greets to <font color="#FFFF47">333_skorpion_333</font><br>Coder: <font color="#FFFF47">waza123x</font><br>Contacts: waza123@inbox.lv', type=SystemMessages.SM_TYPE.Warning)
  160.  
  161. pre_onBecomePlayer = PlayerAccount.onBecomePlayer        
  162. PlayerAccount.onBecomePlayer = new_onBecomePlayer
  163.  
  164.  
  165. nst_logs('Plugin executed !')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement