Jump to content
Korean Random

lazik

User
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

2 Noob

Contacts

  • Nick
    lazik

Recent Profile Visitors

1,647 profile views
  1. lazik

    Gamesense

    OK, I edited all and for M800 is working all. WOT.lsp: ; ;------------------------------------------------------------------------- ; Author adjgam ;------------------------------------------------------------------------- ; ; ; Usage: ; ; POST http://127.0.0.1:<port>/game_event ; ContentType:= 'application/json'; ; ; {"game":"WOT","event":"SETRGB","data": ; { ; "r": 255, ; "g": 0, ; "b": 0, ; } ; } ; (handler "SETRGB" (lambda (data) (let* ( (r (r: data)) (g (g: data)) (b (b: data)) (n(list r g b)) (on-device 'headset show: n ) (on-device 'rgb-per-key-zones show-on-zone: n keypad: ) (on-device 'rgb-2-zone show-on-zone: n two:) (on-device 'rgb-1-zone show-on-zone: n one:)) ) ) ) (handler "HP" (lambda (data) (let* ((v (value: data)) (c (color-between red-color green-color v)) (on-device 'headset show: c ) (on-device 'rgb-per-key-zones show-percent-on-zone: c v function-keys:) (on-device 'rgb-2-zone show-on-zone: c two:) (on-device 'rgb-1-zone show-on-zone: c one:)) ) ) ) ;(handler "HEALTH" (lambda (data) ; (on-device 'rgb-per-key-zones show-percent-on-zone: red-color (value: data) "logo") ;; Other on-device calls for other device types, other code, etc. ; )) ;; Required to initialize this zone on the M800 ;(add-event-per-key-zone-use "HEALTH" "logo") ;(add-event-per-key-zone-use "SETRGB" "keypad") (add-event-per-key-zone-use "HP" "function-keys") mod_gamesense.pyc: import BigWorld import os import os.path import json import httplib, urllib2 from Avatar import PlayerAvatar from items import vehicles from Vehicle import Vehicle from Account import PlayerAccount import Math import math import threading print "[MOD] Gamesense loaded" Autor = 'adjgam' url = '' LastHP = 0 def threadDecorate(object): def decorate(*args, **kwargs): th = threading.Thread(target=object, args=args, kwargs=kwargs) th.setName = object.func_name th.setDaemon = True th.start() return decorate # read GameSense url def Gamesense_ReadUrl(): with open(os.getenv('PROGRAMDATA')+'/SteelSeries/SteelSeries Engine 3/coreProps.json', 'r') as f: data = json.load(f) global url url = 'http://' + data['address'] # register game @threadDecorate def Gamesense_RegisterGame(): data = {"game":"WOT","game_display_name":"World Of Tanks","icon_color_id":11} req = urllib2.Request(url+'/game_metadata') req.add_header('Content-Type', 'application/json') response = urllib2.urlopen(req, json.dumps(data), timeout = 10) # delete game @threadDecorate def Gamesense_DeleteGame(): data = {"game":"WOT"} req = urllib2.Request(url+'/remove_game') req.add_header('Content-Type', 'application/json') response = urllib2.urlopen(req, json.dumps(data), timeout = 10) # register HP event @threadDecorate def Gamesense_RegisterHpEvent(): data = { "game":"WOT", "event":"HP", "min_value":1, "max_value":100, "icon_id":1, "handlers": [{"device-type":"rgb-per-key-zones", "zone":"function-keys", "mode":"percent", "color": {"gradient":{ "zero": {"red":255,"green":0,"blue":0}, "hundred": {"red":0,"green":255,"blue":0}}}, "rate": {"frequency": [{"low": 0, "high": 10, "frequency": 10},{"low": 11, "high": 20, "frequency": 5}, {"low": 21, "high": 100, "frequency": 2}], "repeat_limit": [{"low": 11, "high": 20, "repeat_limit": 10},{"low": 21, "high": 40, "repeat_limit": 10},{"low": 41, "high": 70, "repeat_limit": 5}]}}]} req = urllib2.Request(url+'/bind_game_event') req.add_header('Content-Type', 'application/json') response = urllib2.urlopen(req, json.dumps(data), timeout = 10) # delete game event @threadDecorate def Gamesense_DeleteEvent(EventName): data = {"game":"WOT","event": EventName} req = urllib2.Request(url+'/remove_game_event') req.add_header('Content-Type', 'application/json') response = urllib2.urlopen(req, json.dumps(data), timeout = 10) # post HP change event 0..100 @threadDecorate def HpChange(n): data = {"game":"WOT","event":"HP","data":{"value": n}} req = urllib2.Request(url+'/game_event') req.add_header('Content-Type', 'application/json') response = urllib2.urlopen(req, json.dumps(data), timeout = 10) # change color @threadDecorate def Gamesense_SetRgb(r, g, b): data = {"game":"WOT","event":"SETRGB","data":{"r": r, "g": g, "b": b}} req = urllib2.Request(url+'/game_event') req.add_header('Content-Type', 'application/json') response = urllib2.urlopen(req, json.dumps(data), timeout = 10) # post Keepalive Event @threadDecorate def Gamesense_PostHearBeat(): data = {"game":"WOT"} req = urllib2.Request(url+'/game_heartbeat') req.add_header('Content-Type', 'application/json') response = urllib2.urlopen(req, json.dumps(data), timeout = 10) # gamesense hearbeat 15s = set default @threadDecorate def _loop(): Gamesense_PostHearBeat() BigWorld.callback(10, _loop) # on battle loaded set green def _onInitStepCompleted(self): orig_onInitStepCompleted(self) CheckHp() # on hp change @threadDecorate def CheckHp(): playerVehicle = BigWorld.entity(BigWorld.player().playerVehicleID) global LastHP if playerVehicle is not None and playerVehicle.isStarted and playerVehicle.isPlayerVehicle: HP = playerVehicle.health MaxHP = playerVehicle.typeDescriptor.maxHealth if LastHP == HP: return LastHP = HP if HP>0 and playerVehicle.isAlive(): HPPercent = math.trunc(HP*100/MaxHP) HpChange(HPPercent) else: Gamesense_SetRgb(0 ,0, 0) return return def _onHealthChanged(self, newHealth, attackerID, attackReasonID): orig_onHealthChanged(self, newHealth, attackerID, attackReasonID) CheckHp() def _onLeaveWorld(self): orig_onLeaveWorld(self) Gamesense_SetRgb(0,0,0) def _PlayerAccount_onBecomePlayer(self): orig_PlayerAccount_onBecomePlayer(self) Gamesense_SetRgb(0,0,0) # check file exists if os.path.isfile(os.getenv('PROGRAMDATA')+'/SteelSeries/SteelSeries Engine 3/coreProps.json'): # PlayerAvatar.onLeaveWorld orig_onLeaveWorld = PlayerAvatar.onLeaveWorld PlayerAvatar.onLeaveWorld = _onLeaveWorld # Vehicle.onHealthChanged orig_onHealthChanged = Vehicle.onHealthChanged Vehicle.onHealthChanged = _onHealthChanged # PlayerAvatar._PlayerAvatar__onInitStepCompleted orig_onInitStepCompleted = PlayerAvatar._PlayerAvatar__onInitStepCompleted PlayerAvatar._PlayerAvatar__onInitStepCompleted = _onInitStepCompleted # on login orig_PlayerAccount_onBecomePlayer = PlayerAccount.onBecomePlayer PlayerAccount.onBecomePlayer = _PlayerAccount_onBecomePlayer Gamesense_ReadUrl() Gamesense_RegisterGame() Gamesense_SetRgb(0, 0, 0) # set color (0,0,0) on game init _loop() else: print "[mod] Gamesense: file /SteelSeries/SteelSeries Engine 3/coreProps.json not found" In pyc file I ended 54 line to have proper zone and device. This must be in config to have flexible mod. Now other questions: - can we add frags counter and change colors or keys ilumination (like in CS:GO plugin)? - is there chance to add event for using consumables (example: if used key 4 is turend off etc.) - its possible to recognize that shells on 1, 2, 3 key are active? - can you add fire event? (if tank is on fire for example keyboard is blinks red) - wn8 rating on zone? ... I think if we change in line 54 "device-type":"rgb-per-key-zones" to "device-type":"keyboard" "zone":"function-keys" will work also for other keyboards (excluding MSI GE62 and GE72)
  2. lazik

    Gamesense

    I manualy registred event in gamesense, configured zone to display HP event and now everything works just fine. Problem is in mod - you register all for headset and for other devices should be this changed. Without configuration this cant be flexible mod.
  3. lazik

    Gamesense

    Hmmm, tested with your app and all keys isn't iluminated and nothing changes after sending geme_event data. There is no errors. hmmm....? Tested all variants on this lsp (handler "SETRGB" (lambda (data) (let* ( (r (r: data)) (g (g: data)) (b (b: data)) (n(list r g b)) (on-device 'headset show: n ) (on-device 'rgb-per-key-zones show-on-zone: n keypad: ) (on-device 'rgb-2-zone show-on-zone: n two:) (on-device 'rgb-1-zone show-on-zone: n one:)) ) ) ) (handler "HP" (lambda (data) (let* ((v (value: data)) (c (color-between red-color green-color v)) (on-device 'headset show: c ) (on-device 'rgb-per-key-zones show-percent-on-zone: c v function-keys:) (on-device 'rgb-2-zone show-on-zone: c two:) (on-device 'rgb-1-zone show-on-zone: c one:)) ) ) ) (handler "HEALTH" (lambda (data) (on-device 'rgb-per-key-zones show-percent-on-zone: red-color (value: data) "logo") ;; Other on-device calls for other device types, other code, etc. )) ;; Required to initialize this zone on the M800 (add-event-per-key-zone-use "HEALTH" "logo") (add-event-per-key-zone-use "SETRGB" "keypad") (add-event-per-key-zone-use "HP" "function-keys")
  4. lazik

    Gamesense

    Your examples isn't working. From https://github.com/SteelSeries/gamesense-sdk/blob/master/doc/api/writing-handlers-in-golisp.md (handler "HEALTH" (lambda (data) (let* ((v (value: data)) (c (color-between red-color green-color v)) (on-device 'rgb-per-key-zones show-percent-on-zone: c v function-keys:) (on-device 'rgb-2-zone show-on-zone: c two:) (on-device 'rgb-1-zone show-on-zone: c one:))))) (add-event-per-key-zone-use "HEALTH" "function-keys") So IMVHO should be (handler "SETRGB" (lambda (data) (let* ( (r (r: data)) (g (g: data)) (b (b: data)) (n(list r g b)) ( on-device 'headset show: n ) ( on-device 'rgb-per-key-zones show-on-zone: n function-keys: ) (on-device 'rgb-2-zone show-on-zone: c two:) (on-device 'rgb-1-zone show-on-zone: c one:)) ) ) ) (handler "HP" (lambda (data) (let* ((v (value: data)) (c (color-between red-color green-color v)) ( on-device 'headset show: c ) (on-device 'rgb-per-key-zones show-percent-on-zone: c v function-keys:) (on-device 'rgb-2-zone show-on-zone: c two:) (on-device 'rgb-1-zone show-on-zone: c one:)) ) ) ) (add-event-per-key-zone-use "HP" "function-keys") and this I think looks good but not receive HP value and keys ara not illuminated. BTW after changes in lsp file must be Steelseries Engine restarted and also WoT. Every engine restart port in coreProps.json is changed.
  5. lazik

    Gamesense

    (handler "HP" (lambda (data) (let* ((v (value: data)) (c (color-between red-color green-color v))) ( on-device 'headset show: c ) (on-device show-percent-on-zone: c v function-keys:)) )) (add-event-per-key-zone-use "HP" "function-keys")
  6. lazik

    Gamesense

    @adjgam: M800 have per key zones. When I started to play with gamesense (without success) I prepared settings. In file you can find all mouses and keyboards with settings. Maybe will be helpful. I can't find now mod settings. https://dl.dropboxusercontent.com/u/29707635/WoT/mod_SteelSeriesRGB.py class MouseRival100: DEVICE_TYPE = "rgb-1-zone" ZONES = ["one"] class MouseRival300: DEVICE_TYPE = "rgb-2-zone" ZONES = ["one", "two"] class MouseRival700: DEVICE_TYPE = "rgb-2-zone" ZONES = ["one", "two"] class SenseiMouse: DEVICE_TYPE = "rgb-3-zone" ZONES = ["one", "two", "three"] class SenseiWirelessMouse: DEVICE_TYPE = "rgb-3-zone" ZONES = ["one", "two", "three"] class MSIGE62Keyboard: DEVICE_TYPE = "rgb-3-zone" ZONES = ["one", "two", "three"] class MSIGE72Keyboard: DEVICE_TYPE = "rgb-3-zone" ZONES = ["one", "two", "three"] class APEX350: DEVICE_TYPE = "rgb-5-zone" ZONES = ["one", "two", "three", "four", "five"] class APEXM800: DEVICE_TYPE = "rgb-per-key-zones" ZONES = ["one", "two", "three", "four", "five", "logo", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "a", "s", "d", "f", "g", "h", "j", "k", "l", "z", "x", "c", "v", "b", "n", "m", "keyboard-1", "keyboard-2", "keyboard-3", "keyboard-4", "keyboard-5", "keyboard-6", "keyboard-7", "keyboard-8", "keyboard-9", "keyboard-0", "return", "escape", "backspace", "tab", "spacebar", "caps", "dash", "equal", "l-bracket", "r-bracket", "backslash", "pound", "semicolon", "quote", "backquote", "comma", "period", "slash", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "printscreen", "scrolllock", "pause", "insert", "home", "pageup", "delete", "end", "pagedown", "rightarrow", "leftarrow", "downarrow", "uparrow", "keypad-num-lock", "keypad-divide", "keypad-times", "keypad-minus", "keypad-plus", "keypad-enter", "keypad-period", "keypad-1", "keypad-2", "keypad-3", "keypad-4", "keypad-5", "keypad-6", "keypad-7", "keypad-8", "keypad-9", "keypad-0", "l-ctrl", "l-shift", "l-alt", "l-win", "r-ctrl", "r-shift", "r-alt", "r-win", "ss-key", "win-menu", "m0", "m1", "m2", "m3", "m4", "m5", "function-keys", "number-keys", "q-row", "a-row", "z-row", "macro-keys", "all-macro-keys", "main-keyboard", "nav-cluster", "arrows", "keypad", "keypad-nums", "all"] BTW latest version wan't register events in gamesense:
  7. lazik

    Gamesense

    Can you add M800 ("rgb-per-key-zones") keyboard support? Even better is to add mod settings into WoT to allow choose your configurations (keyboards, mouse, headsets). BTW excellent work, will test this and maybe add some extra features (for sure try to do this)
  8. Please share with 8.11.3 version.
×
×
  • Create New...