Ticket #2898: userNotify.4.2.patch

File userNotify.4.2.patch, 8.4 KB (added by elexis, 8 years ago)

Moved the option to the sound options, as it's not only a lobby option anymore. Chose the patch with that global since it doesn't bug here. Added the target filename of the new sound. Tested and approved.

  • binaries/data/config/default.cfg

    toggle = "Ctrl+F11" ; Enable/di  
    235235[hotkey.selection]
    236236add = Shift                  ; Add units to selection
    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
    244244[hotkey.selection.group.add]
    2452450 = "Shift+0"
    mastergain = 0.9  
    379379musicgain = 0.2
    380380ambientgain = 0.6
    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
    387390[userreport] ; Opt-in online user reporting system
    388391url = "http://feedback.wildfiregames.com/report/upload/v1/"
  • binaries/data/mods/public/audio/interface/ui/chat_alert.ogg

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
  • binaries/data/mods/public/gui/common/functions_utility.js

    Property changes on: binaries/data/mods/public/audio/interface/ui/chat_alert.ogg
    ___________________________________________________________________
    Added: svn:mime-type
    ## -0,0 +1 ##
    +application/octet-stream
    \ No newline at end of property
     
     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
     17    if (!g_LastNickNotification || timeNow > g_LastNickNotification + 3000)
     18        Engine.PlayUISound("audio/interface/ui/chat_alert.ogg", false);
     19
     20    g_LastNickNotification = timeNow;
     21}
     22
    123function getRandom(randomMin, randomMax)
    224{
    325    // Returns a random whole number in a min..max range.
    426    // NOTE: There should probably be an engine function for this,
    527    // since we'd need to keep track of random seeds for replays.
    function formatPlayerInfo(playerDataArra  
    392414            "playerDescriptions": playerDescriptions.observer.join("\n")
    393415        }));
    394416
    395417    return teamDescription.join("\n\n");
    396418}
     419
     420
  • binaries/data/mods/public/gui/credits/texts/programming.json

     
    2222            {"name": "Adrian Fatol"},
    2323            {"nick": "AI-Amsterdam"},
    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"},
    3031            {"nick": "bb", "name": "Bouke Jansen"},
    3132            {"nick": "Ben", "name": "Ben Vinegar"},
  • binaries/data/mods/public/gui/gamesetup/gamesetup.js

    function colorizePlayernameByGUID(guid,  
    18031803    return '[color="'+ color +'"]' + username + '[/color]';
    18041804}
    18051805
    18061806function addChatMessage(msg)
    18071807{
     1808    if (msg.text)
     1809    {
     1810        let userName = g_PlayerAssignments[Engine.GetPlayerGUID() || "local"].name;
     1811
     1812        if (userName != g_PlayerAssignments[msg.guid].name)
     1813            notifyUser(userName, msg.text);
     1814    }
     1815
    18081816    if (!g_FormatChatMessage[msg.type])
    18091817        return;
    18101818
    18111819    let user = colorizePlayernameByGUID(msg.guid || -1, msg.username || "");
    18121820
  • binaries/data/mods/public/gui/lobby/lobby.js

    function addChatMessage(msg)  
    819819        if (Engine.LobbyGetPlayerRole(msg.from) == "moderator")
    820820            msg.from = g_ModeratorPrefix + msg.from;
    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)
    828831        {
    829832            updateSpamMonitor(msg.from);
  • binaries/data/mods/public/gui/options/options.json

     
    163163            "parameters": { "config": "waterreflection", "renderer": "WaterReflection" }
    164164        },
    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        {
    172172            "type": "boolean",
    173173            "label": "Shadows on Water",
     
    228228        {
    229229            "type": "number",
    230230            "label": "UI Gain",
    231231            "tooltip": "UI sound gain",
    232232            "parameters": { "config": "sound.uigain", "function": "SetUIGain", "min": "0" }
     233        },
     234        {
     235            "type": "boolean",
     236            "label": "Nick Notification",
     237            "tooltip": "Receive audio notification when someone types your nick",
     238            "parameters": { "config": "sound.notify.nick" }
    233239        }
    234240    ],
    235241    "lobbySetting":
    236242    [
    237243        {
    238244            "type": "number",
    239             "label": "Chat Backlog", 
    240             "tooltip": "Number of backlogged messages to load when joining the lobby", 
     245            "label": "Chat Backlog",
     246            "tooltip": "Number of backlogged messages to load when joining the lobby",
    241247            "parameters": { "config": "lobby.history", "min": "0" }
    242248        },
    243249        {
    244250            "type": "boolean",
    245251            "label": "Chat Timestamp",
    246             "tooltip": "Show time that messages are posted in the lobby chat", 
     252            "tooltip": "Show time that messages are posted in the lobby chat",
    247253            "parameters": { "config": "lobby.chattimestamp" }
    248254        }
    249255    ]
    250256}
  • binaries/data/mods/public/gui/session/messages.js

    function formatChatCommand(msg)  
    820820        msg.text = msg.text.substr("/me ".length);
    821821
    822822    // Translate or escape text
    823823    if (!msg.text)
    824824        return "";
     825
    825826    if (msg.translate)
    826827    {
    827828        msg.text = translate(msg.text);
    828829        if (msg.translateParameters)
    829830        {
    function formatChatCommand(msg)  
    831832            translateObjectKeys(parameters, msg.translateParameters);
    832833            msg.text = sprintf(msg.text, parameters);
    833834        }
    834835    }
    835836    else
     837    {
    836838        msg.text = escapeText(msg.text);
    837839
     840        let userName = g_PlayerAssignments[Engine.GetPlayerGUID() || "local"].name;
     841
     842        if (userName != g_PlayerAssignments[msg.guid].name)
     843            notifyUser(userName, msg.text);
     844    }
     845
    838846    // GUID for players, playerID for AIs
    839847    let coloredUsername = msg.guid != -1 ? colorizePlayernameByGUID(msg.guid) : colorizePlayernameByID(msg.player);
    840848
    841849    return sprintf(g_ChatCommands[isMe ? "me" : "regular"][msg.context ? "context" : "no-context"], {
    842850        "message": msg.text,