Jump to content
Korean Random
Megagrob

Вывод сообщений в боевой чат

Recommended Posts

а вообще вот накалякал

import BigWorld
from gui.battle_control import g_sessionProvider
                  
class BatteMessage(object):
    
    def __init__(self):
        self.last_time = 0	
        self.teamChannelClientID = 0
        self.squadChannelClientID = 1
        self.commonChannelClientID = 1
        
    def team(self, message):
        return g_sessionProvider.shared.chatCommands.proto.arenaChat.broadcast(message.encode('utf-8'), self.teamChannelClientID)
        
    def common(self, message):
        return g_sessionProvider.shared.chatCommands.proto.arenaChat.broadcast(message.encode('utf-8'), self.commonChannelClientID)
        
    def squad(self, message):
        return g_sessionProvider.shared.chatCommands.proto.unitChat.broadcast(message.encode('utf-8'), self.squadChannelClientID)
                           
    def sendMessages(self, message, type):
        self.time = BigWorld.time()
        if self.time - self.last_time > 0.5:
            if type == 'team': 
                self.team(message)
            elif type == 'squad': 
                self.squad(message)
            elif type == 'common': 
                self.common(message)
            self.last_time = self.time

            
batteMessage = BatteMessage()

batteMessage.sendMessages('team', 'team')
batteMessage.sendMessages('common', 'common')
batteMessage.sendMessages('squad', 'squad')

ток это уже для 9.15.1

  • Upvote 4

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...