Ticket #2898: userNotify.4.patch

File userNotify.4.patch, 6.2 KB (added by Andy Alt, 8 years ago)
  • binaries/data/config/default.cfg

     
    237237milonly = Alt                ; Add only military units to selection
    238238idleonly = "I"               ; Select only idle units
    239239remove = Ctrl                ; Remove units from selection
    240 cancel = Esc                 ; Un-select all units and cancel building placement 
     240cancel = Esc                 ; Un-select all units and cancel building placement
    241241idleworker = Period          ; Select next idle worker
    242242idlewarrior = ForwardSlash   ; Select next idle warrior
    243243offscreen = Alt              ; Include offscreen units in selection
     
    381381actiongain = 0.7
    382382uigain = 0.7
    383383
     384[sound.notify]
     385nick = true
     386
    384387[tinygettext]
    385388debug = false                     ; Print error messages each time a translation for an English string is not found.
    386389
  • binaries/data/mods/public/gui/common/functions_utility.js

     
     1/**
     2 * Used by notifyUser() to limit the number of pings
     3 */
     4var g_LastNickNotification = -1;
     5
     6/**
     7 * Plays a sound if user's nick is mentioned in chat
     8 */
     9function notifyUser(userName, msgText)
     10{
     11    if (Engine.ConfigDB_GetValue("user", "sound.notify.nick") != "true" ||
     12         msgText.toLowerCase().indexOf(userName.toLowerCase()) == -1)
     13            return;
     14
     15    let timeNow = new Date().getTime();
     16    print (timeNow + "\n");
     17    print (g_LastNickNotification + "\n");
     18
     19    if (!g_LastNickNotification || timeNow > g_LastNickNotification + 3000)
     20        Engine.PlayUISound("audio/interface/select/resource/sel_metal_01.ogg", false);
     21
     22    g_LastNickNotification = timeNow;
     23    print (timeNow + "\n");
     24    print (g_LastNickNotification + "\n");
     25}
     26
    127function getRandom(randomMin, randomMax)
    228{
    329    // Returns a random whole number in a min..max range.
     
    173199    {
    174200        if (word.toLowerCase().indexOf(lastWord.toLowerCase()) != 0)
    175201            continue;
    176 
     202
    177203        text = wordSplit.join(" ");
    178204        if (text.length > 0)
    179205            text += " ";
     
    302328        });
    303329    }).join("\n\n");
    304330}
     331
     332
  • binaries/data/mods/public/gui/credits/texts/programming.json

     
    2424            {"nick": "Alan", "name": "Alan Kemp"},
    2525            {"nick": "aBothe", "name": "Alexander Bothe"},
    2626            {"nick": "alpha123", "name": "Peter P. Cannici"},
     27            {"nick": "andy5995", "name": "Andy Alt"},
    2728            {"nick": "Aurium", "name": "Aurélio Heckert"},
    2829            {"nick": "badmadblacksad", "name": "Martin F"},
    2930            {"name": "Mikołaj \"Bajter\" Korcz"},
  • binaries/data/mods/public/gui/gamesetup/gamesetup.js

     
    18041804
    18051805function addChatMessage(msg)
    18061806{
     1807    if (msg.text)
     1808    {
     1809        let userName = g_PlayerAssignments[Engine.GetPlayerGUID() || "local"].name;
     1810
     1811        if (userName != g_PlayerAssignments[msg.guid].name)
     1812            notifyUser(userName, msg.text);
     1813    }
     1814
    18071815    if (!g_FormatChatMessage[msg.type])
    18081816        return;
    18091817
  • binaries/data/mods/public/gui/lobby/lobby.js

     
    821821
    822822        // Highlight local user's nick
    823823        if (g_Username != msg.from)
     824        {
    824825            msg.text = msg.text.replace(g_Username, colorPlayerName(g_Username));
     826            notifyUser(g_Username, msg.text);
     827        }
    825828
    826829        // Run spam test if it's not a historical message
    827830        if (!msg.datetime)
  • binaries/data/mods/public/gui/options/options.json

     
    165165        {
    166166            "type": "boolean",
    167167            "label": "Water Refraction",
    168             "tooltip": "Use a real water refraction map and not transparency", 
     168            "tooltip": "Use a real water refraction map and not transparency",
    169169            "parameters": { "config": "waterrefraction", "renderer": "WaterRefraction" }
    170170        },
    171171        {
     
    236236    [
    237237        {
    238238            "type": "number",
    239             "label": "Chat Backlog", 
    240             "tooltip": "Number of backlogged messages to load when joining the lobby", 
     239            "label": "Chat Backlog",
     240            "tooltip": "Number of backlogged messages to load when joining the lobby",
    241241            "parameters": { "config": "lobby.history", "min": "0" }
    242242        },
    243243        {
    244244            "type": "boolean",
    245245            "label": "Chat Timestamp",
    246             "tooltip": "Show time that messages are posted in the lobby chat", 
     246            "tooltip": "Show time that messages are posted in the lobby chat",
    247247            "parameters": { "config": "lobby.chattimestamp" }
     248        },
     249        {
     250            "type": "boolean",
     251            "label": "Nick Notification",
     252            "tooltip": "Receive audio notification when someone types your nick",
     253            "parameters": { "config": "sound.notify.nick" }
    248254        }
    249255    ]
    250256}
  • binaries/data/mods/public/gui/session/messages.js

     
    826826    // Translate or escape text
    827827    if (!msg.text)
    828828        return "";
     829
    829830    if (msg.translate)
    830831    {
    831832        msg.text = translate(msg.text);
     
    837838        }
    838839    }
    839840    else
     841    {
    840842        msg.text = escapeText(msg.text);
    841843
     844        let userName = g_PlayerAssignments[Engine.GetPlayerGUID() || "local"].name;
     845
     846        if (userName != g_PlayerAssignments[msg.guid].name)
     847            notifyUser(userName, msg.text);
     848    }
     849
    842850    // GUID for players, playerID for AIs
    843851    let coloredUsername = msg.guid != -1 ? colorizePlayernameByGUID(msg.guid) : colorizePlayernameByID(msg.player);
    844852