Skip to content

Commit

Permalink
Add welcome message
Browse files Browse the repository at this point in the history
  • Loading branch information
SerVB committed Nov 23, 2018
1 parent fbb2dba commit 4cabb54
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/scripts/client/gui/mods/mod_recent_stat_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from gui.battle_control.arena_info.arena_dp import ArenaDataProvider
from gui.battle_control.arena_info.player_format import PlayerFullNameFormatter, PlayerFormatResult
from notification.NotificationListView import NotificationListView

from mod_recent_stat_loader import ModRecentStat
from mod_recent_stat_logging import logInfo
Expand Down Expand Up @@ -34,4 +35,16 @@ def formatNew(self, vInfoVO, playerName=None):
formatOld = PlayerFullNameFormatter.format
PlayerFullNameFormatter.format = formatNew


def nlv_getMessagesListNew(self):
result = nlv_getMessagesListOld(self)

result.insert(0, modRecentStat.getWelcomeMessage())

return result


nlv_getMessagesListOld = NotificationListView._NotificationListView__getMessagesList
NotificationListView._NotificationListView__getMessagesList = nlv_getMessagesListNew

logInfo("Mod initialization is finished.")
18 changes: 18 additions & 0 deletions src/scripts/client/gui/mods/mod_recent_stat_loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# https://www.apache.org/licenses/LICENSE-2.0.html

from copy import deepcopy
from threading import Thread
import time
import traceback
Expand All @@ -24,8 +25,25 @@ def __init__(self, configFormat=None, configMain=None, configWgId=None):
self._playerIdToData = dict()
self._wgStats = WgStats(self._configMain, self._configWgId)

self._welcomeMessage = self._loadWelcomeMessage()

logInfo("Mod loading is finished: main = %s, format = %s." % (self._configMain, self._configFormat))

def getWelcomeMessage(self):
return deepcopy(self._welcomeMessage)

@staticmethod
def _loadWelcomeMessage():
defaultMessage = {
"message": {
"message": "The Recent Stat of You<br>Info: <a href='#'>https://github.com/SerVB/TheRecentStatOfYou</a><br>Donate: <a href='#'>https://github.com/SerVB/donate</a>",
"icon": "../maps/icons/library/MessageIcon-1.png"
},
"notify": False
}

return defaultMessage

def loadPlayerDataByVehicleList(self, vehicles):
# type: (dict) -> None
startTime = time.time()
Expand Down

0 comments on commit 4cabb54

Please sign in to comment.