Jump to content

TF2 Particle Effect ID API


theapant  ty

Recommended Posts

Folks, 

 

I'm looking for a way to correlate effect id to plain text id name programatically. e.g.,  {"effect": "Green Energy", "id": 9}

 

I was previously using a git.optf2 endpoint, but the site no longer seems to exist. Any suggestions? A REST API that returns JSON would be super ideal, but any help is appreciated. 

 

Thanks,

Link to comment
Share on other sites

If you cant find an existing one id suggest going through the particle page and making one youself. (Alternatively run selenium to pull them directly from the web gui but thats super janky and id suggest not going that route for dynamic population). Hell i could prolly write one in node. It would most likley take 10-30 mins to create it and throw it on heroku. Absolute worst case just make a quick json file and read from it. If you want me to make you one lemme know tho as i wouldnt mind. 

Link to comment
Share on other sites

3 hours ago, Wsdea said:

Get Schema Overview doesn't exactly gives what you need. 

 

Manic updates his list after every update : https://github.com/mninc/pytf/blob/master/pytf2/item_data.py

This looks like it. Use your github token in your headers/url embed and try this api call out to grab that file's contents  

 

 

First things first. You'll need a github account and a token. Once you register on github/sign-in follow this guide to generate an api token https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

 

Next try the call. I left a few ways to do so below. 

 

A token isnt needed here as it's a public repo so this is step is optional. Simply do the following to proceed without a token.

GET https://api.github.com/repos/mninc/pytf/contents/pytf2/item_data.py

 

 

 

 

For embedding your token the url looks like this:

 

GET https://username:[email protected]/repos/mninc/pytf/contents/pytf2/item_data.py

 

For Headers:

 

NOTE: In the headers your token MUST be prefixed with "token "

EX: "token abcd"

 

 

Headers: {"Authorization": 'token inserttokenhere'}

GET https://api.github.com/repos/mninc/pytf/contents/pytf2/item_data.py

The response should look something like this:

 

 

 

 

{
  "name": "item_data.py",
  "path": "pytf2/item_data.py",
  "sha": "ccd68cebd9a9baabc9e77ddad0efc6f19d6d830b",
  "size": 7191,
  "url": "https://api.github.com/repos/mninc/pytf/contents/pytf2/item_data.py?ref=master",
  "html_url": "https://github.com/mninc/pytf/blob/master/pytf2/item_data.py",
  "git_url": "https://api.github.com/repos/mninc/pytf/git/blobs/ccd68cebd9a9baabc9e77ddad0efc6f19d6d830b",
  "download_url": "https://raw.githubusercontent.com/mninc/pytf/master/pytf2/item_data.py",
  "type": "file",
  "content": "IyBodHRwczovL2FwaS5zdGVhbXBvd2VyZWQuY29tL0lFY29uSXRlbXNfNDQw\nL0dldFNjaGVtYU92ZXJ2aWV3L3YwMDAxP2tleT1rZXkmbGFuZ3VhZ2U9ZW4K\nZWZmZWN0cyA9IHsiUGFydGljbGUgMSI6IDEsCiAgICAgICAgICAgIkZseWlu\nZyBCaXRzIjogMiwKICAgICAgICAgICAiTmVtZXNpcyBCdXJzdCI6IDMsCiAg\nICAgICAgICAgIkNvbW11bml0eSBTcGFya2xlIjogNCwKICAgICAgICAgICAi\nSG9seSBHbG93IjogNSwKICAgICAgICAgICAiR3JlZW4gQ29uZmV0dGkiOiA2\nLAogICAgICAgICAgICJQdXJwbGUgQ29uZmV0dGkiOiA3LAogICAgICAgICAg\nICJIYXVudGVkIEdob3N0cyI6IDgsCiAgICAgICAgICAgIkdyZWVuIEVuZXJn\neSI6IDksCiAgICAgICAgICAgIlB1cnBsZSBFbmVyZ3kiOiAxMCwKICAgICAg\nICAgICAiQ2lyY2xpbmcgVEYgTG9nbyI6IDExLAogICAgICAgICAgICJNYXNz\nZWQgRmxpZXMiOiAxMiwKICAgICAgICAgICAiQnVybmluZyBGbGFtZXMiOiAx\nMywKICAgICAgICAgICAiU2NvcmNoaW5nIEZsYW1lcyI6IDE0LAogICAgICAg\nICAgICJTZWFyaW5nIFBsYXNtYSI6IDE1LAogICAgICAgICAgICJWaXZpZCBQ\nbGFzbWEiOiAxNiwKICAgICAgICAgICAiU3VuYmVhbXMiOiAxNywKICAgICAg\nICAgICAiQ2lyY2xpbmcgUGVhY2UgU2lnbiI6IDE4LAogICAgICAgICAgICJD\naXJjbGluZyBIZWFydCI6IDE5LAogICAgICAgICAgICJNYXAgU3RhbXBzIjog\nMjAsCiAgICAgICAgICAgIkdlbnRlZWwgU21va2UiOiAyOCwKICAgICAgICAg\nICAiU3Rvcm15IFN0b3JtIjogMjksCiAgICAgICAgICAgIkJsaXp6YXJkeSBT\ndG9ybSI6IDMwLAogICAgICAgICAgICJOdXRzIG4nIEJvbHRzIjogMzEsCiAg\nICAgICAgICAgIk9yYml0aW5nIFBsYW5ldHMiOiAzMiwKICAgICAgICAgICAi\nT3JiaXRpbmcgRmlyZSI6IDMzLAogICAgICAgICAgICJCdWJibGluZyI6IDM0\nLAogICAgICAgICAgICJTbW9raW5nIjogMzUsCiAgICAgICAgICAgIlN0ZWFt\naW5nIjogMzYsCiAgICAgICAgICAgIkZsYW1pbmcgTGFudGVybiI6IDM3LAog\nICAgICAgICAgICJDbG91ZHkgTW9vbiI6IDM4LAogICAgICAgICAgICJDYXVs\nZHJvbiBCdWJibGVzIjogMzksCiAgICAgICAgICAgIkVlcmllIE9yYml0aW5n\nIEZpcmUiOiA0MCwKICAgICAgICAgICAiS25pZmVzdG9ybSI6IDQzLAogICAg\nICAgICAgICJNaXN0eSBTa3VsbCI6IDQ0LAogICAgICAgICAgICJIYXJ2ZXN0\nIE1vb24iOiA0NSwKICAgICAgICAgICAiSXQncyBBIFNlY3JldCBUbyBFdmVy\neWJvZHkiOiA0NiwKICAgICAgICAgICAiU3Rvcm15IDEzdGggSG91ciI6IDQ3\nLAogICAgICAgICAgICJBdHRyaWJfUGFydGljbGU1NSI6IDU1LAogICAgICAg\nICAgICJLaWxsLWEtV2F0dCI6IDU2LAogICAgICAgICAgICJUZXJyb3ItV2F0\ndCI6IDU3LAogICAgICAgICAgICJDbG91ZCA5IjogNTgsCiAgICAgICAgICAg\nIkFjZXMgSGlnaCI6IDU5LAogICAgICAgICAgICJEZWFkIFByZXNpZGVudHMi\nOiA2MCwKICAgICAgICAgICAiTWlhbWkgTmlnaHRzIjogNjEsCiAgICAgICAg\nICAgIkRpc2NvIEJlYXQgRG93biI6IDYyLAogICAgICAgICAgICJQaG9zcGhv\ncm91cyI6IDYzLAogICAgICAgICAgICJTdWxwaHVyb3VzIjogNjQsCiAgICAg\nICAgICAgIk1lbW9yeSBMZWFrIjogNjUsCiAgICAgICAgICAgIk92ZXJjbG9j\na2VkIjogNjYsCiAgICAgICAgICAgIkVsZWN0cm9zdGF0aWMiOiA2NywKICAg\nICAgICAgICAiUG93ZXIgU3VyZ2UiOiA2OCwKICAgICAgICAgICAiQW50aS1G\ncmVlemUiOiA2OSwKICAgICAgICAgICAiVGltZSBXYXJwIjogNzAsCiAgICAg\nICAgICAgIkdyZWVuIEJsYWNrIEhvbGUiOiA3MSwKICAgICAgICAgICAiUm9i\nb2FjdGl2ZSI6IDcyLAogICAgICAgICAgICJBcmNhbmEiOiA3MywKICAgICAg\nICAgICAiU3BlbGxib3VuZCI6IDc0LAogICAgICAgICAgICJDaGlyb3B0ZXJh\nIFZlbmVuYXRhIjogNzUsCiAgICAgICAgICAgIlBvaXNvbmVkIFNoYWRvd3Mi\nOiA3NiwKICAgICAgICAgICAiU29tZXRoaW5nIEJ1cm5pbmcgVGhpcyBXYXkg\nQ29tZXMiOiA3NywKICAgICAgICAgICAiSGVsbGZpcmUiOiA3OCwKICAgICAg\nICAgICAiRGFya2JsYXplIjogNzksCiAgICAgICAgICAgIkRlbW9uZmxhbWUi\nOiA4MCwKICAgICAgICAgICAiQm9uem8gVGhlIEFsbC1HbmF3aW5nIjogODEs\nCiAgICAgICAgICAgIkFtYXJhbnRoaW5lIjogODIsCiAgICAgICAgICAgIlN0\nYXJlIEZyb20gQmV5b25kIjogODMsCiAgICAgICAgICAgIlRoZSBPb3plIjog\nODQsCiAgICAgICAgICAgIkdoYXN0bHkgR2hvc3RzIEpyIjogODUsCiAgICAg\nICAgICAgIkhhdW50ZWQgUGhhbnRhc20gSnIiOiA4NiwKICAgICAgICAgICAi\nRnJvc3RiaXRlIjogODcsCiAgICAgICAgICAgIk1vbHRlbiBNYWxsYXJkIjog\nODgsCiAgICAgICAgICAgIk1vcm5pbmcgR2xvcnkiOiA4OSwKICAgICAgICAg\nICAiRGVhdGggYXQgRHVzayI6IDkwLAogICAgICAgICAgICJBYmR1Y3Rpb24i\nOiA5MSwKICAgICAgICAgICAiQXRvbWljIjogOTIsCiAgICAgICAgICAgIlN1\nYmF0b21pYyI6IDkzLAogICAgICAgICAgICJFbGVjdHJpYyBIYXQgUHJvdGVj\ndG9yIjogOTQsCiAgICAgICAgICAgIk1hZ25ldGljIEhhdCBQcm90ZWN0b3Ii\nOiA5NSwKICAgICAgICAgICAiVm9sdGFpYyBIYXQgUHJvdGVjdG9yIjogOTYs\nCiAgICAgICAgICAgIkdhbGFjdGljIENvZGV4IjogOTcsCiAgICAgICAgICAg\nIkFuY2llbnQgQ29kZXgiOiA5OCwKICAgICAgICAgICAiTmVidWxhIjogOTks\nCiAgICAgICAgICAgIkRlYXRoIGJ5IERpc2NvIjogMTAwLAogICAgICAgICAg\nICJJdCdzIGEgbXlzdGVyeSB0byBldmVyeW9uZSI6IDEwMSwKICAgICAgICAg\nICAiSXQncyBhIHB1enpsZSB0byBtZSI6IDEwMiwKICAgICAgICAgICAiRXRo\nZXIgVHJhaWwiOiAxMDMsCiAgICAgICAgICAgIk5ldGhlciBUcmFpbCI6IDEw\nNCwKICAgICAgICAgICAiQW5jaWVudCBFbGRyaXRjaCI6IDEwNSwKICAgICAg\nICAgICAiRWxkcml0Y2ggRmxhbWUiOiAxMDYsCiAgICAgICAgICAgIk5ldXRy\nb24gU3RhciI6IDEwNywKICAgICAgICAgICAiVGVzbGEgQ29pbCI6IDEwOCwK\nICAgICAgICAgICAiU3RhcnN0b3JtIEluc29tbmlhIjogMTA5LAogICAgICAg\nICAgICJTdGFyc3Rvcm0gU2x1bWJlciI6IDExMCwKICAgICAgICAgICAiQnJh\naW4gRHJhaW4iOiAxMTEsCiAgICAgICAgICAgIk9wZW4gTWluZCI6IDExMiwK\nICAgICAgICAgICAiSGVhZCBvZiBTdGVhbSI6IDExMywKICAgICAgICAgICAi\nVGhlIEdhbGFjdGljIEdhdGV3YXkiOiAxMTQsCiAgICAgICAgICAgIlRoZSBF\nbGRyaXRjaCBPcGVuaW5nIjogMTE1LAogICAgICAgICAgICJUaGUgRGFyayBE\nb29yd2F5IjogMTE2LAogICAgICAgICAgICJSaW5nIG9mIEZpcmUiOiAxMTcs\nCiAgICAgICAgICAgIlZpY2lvdXMgQ2lyY2xlIjogMTE4LAogICAgICAgICAg\nICJXaGl0ZSBMaWdodG5pbmciOiAxMTksCiAgICAgICAgICAgIk9tbmlzY2ll\nbnQgT3JiIjogMTIwLAogICAgICAgICAgICJDbGFpcnZveWFuY2UiOiAxMjEs\nCiAgICAgICAgICAgIkZpZnRoIERpbWVuc2lvbiI6IDEyMiwKICAgICAgICAg\nICAiVmljaW91cyBWb3J0ZXgiOiAxMjMsCiAgICAgICAgICAgIk1lbmFjaW5n\nIE1pYXNtYSI6IDEyNCwKICAgICAgICAgICAiQWJ5c3NhbCBBdXJhIjogMTI1\nLAogICAgICAgICAgICJXaWNrZWQgV29vZCI6IDEyNiwKICAgICAgICAgICAi\nR2hhc3RseSBHcm92ZSI6IDEyNywKICAgICAgICAgICAiTXlzdGljYWwgTWVk\nbGV5IjogMTI4LAogICAgICAgICAgICJFdGhlcmVhbCBFc3NlbmNlIjogMTI5\nLAogICAgICAgICAgICJUd2lzdGVkIFJhZGlhbmNlIjogMTMwLAogICAgICAg\nICAgICJWaW9sZXQgVm9ydGV4IjogMTMxLAogICAgICAgICAgICJWZXJkYW50\nIFZvcnRleCI6IDEzMiwKICAgICAgICAgICAiVmFsaWFudCBWb3J0ZXgiOiAx\nMzMsCiAgICAgICAgICAgIlNwYXJrbGluZyBMaWdodHMiOiAxMzQsCiAgICAg\nICAgICAgIkZyb3plbiBJY2VmYWxsIjogMTM1LAogICAgICAgICAgICJGcmFn\nbWVudGVkIEdsdW9ucyI6IDEzNiwKICAgICAgICAgICAiRnJhZ21lbnRlZCBR\ndWFya3MiOiAxMzcsCiAgICAgICAgICAgIkZyYWdtZW50ZWQgUGhvdG9ucyI6\nIDEzOCwKICAgICAgICAgICAiRGVmcmFnbWVudGluZyBSZWFsaXR5IjogMTM5\nLAogICAgICAgICAgICJGcmFnbWVudGluZyBSZWFsaXR5IjogMTQxLAogICAg\nICAgICAgICJSZWZyYWdtZW50aW5nIFJlYWxpdHkiOiAxNDIsCiAgICAgICAg\nICAgIlNub3dmYWxsZW4iOiAxNDMsCiAgICAgICAgICAgIlNub3dibGluZGVk\nIjogMTQ0LAogICAgICAgICAgICJQeXJvbGFuZCBEYXlkcmVhbSI6IDE0NSwK\nICAgICAgICAgICAiSG90IjogNzAxLAogICAgICAgICAgICJJc290b3BlIjog\nNzAyLAogICAgICAgICAgICJDb29sIjogNzAzLAogICAgICAgICAgICJFbmVy\nZ3kgT3JiIjogNzA0LAogICAgICAgICAgICJBdHRyaWJfUGFydGljbGUyMDAx\nIjogMjAwMSwKICAgICAgICAgICAiQXR0cmliX1BhcnRpY2xlMjAwMiI6IDIw\nMDIsCiAgICAgICAgICAgIkF0dHJpYl9QYXJ0aWNsZTIwMDMiOiAyMDAzLAog\nICAgICAgICAgICJBdHRyaWJfUGFydGljbGUyMDA0IjogMjAwNCwKICAgICAg\nICAgICAiQXR0cmliX1BhcnRpY2xlMjAwNSI6IDIwMDUsCiAgICAgICAgICAg\nIkF0dHJpYl9QYXJ0aWNsZTIwMDYiOiAyMDA2LAogICAgICAgICAgICJBdHRy\naWJfUGFydGljbGUyMDA3IjogMjAwNywKICAgICAgICAgICAiQXR0cmliX1Bh\ncnRpY2xlMjAwOCI6IDIwMDgsCiAgICAgICAgICAgIlNob3dzdG9wcGVyIjog\nMzAwMSwKICAgICAgICAgICAiSG9seSBHcmFpbCI6IDMwMDMsCiAgICAgICAg\nICAgIic3MiI6IDMwMDQsCiAgICAgICAgICAgIkZvdW50YWluIG9mIERlbGln\naHQiOiAzMDA1LAogICAgICAgICAgICJTY3JlYW1pbmcgVGlnZXIiOiAzMDA2\nLAogICAgICAgICAgICJTa2lsbCBHb3R0ZW4gR2FpbnMiOiAzMDA3LAogICAg\nICAgICAgICJNaWRuaWdodCBXaGlybHdpbmQiOiAzMDA4LAogICAgICAgICAg\nICJTaWx2ZXIgQ3ljbG9uZSI6IDMwMDksCiAgICAgICAgICAgIk1lZ2EgU3Ry\naWtlIjogMzAxMCwKICAgICAgICAgICAiSGF1bnRlZCBQaGFudGFzbSI6IDMw\nMTEsCiAgICAgICAgICAgIkdoYXN0bHkgR2hvc3RzIjogMzAxMiwKICAgICAg\nICAgICAiSGVsbGlzaCBJbmZlcm5vIjogMzAxMywKICAgICAgICAgICAiU3Bl\nY3RyYWwgU3dpcmwiOiAzMDE0LAogICAgICAgICAgICJJbmZlcm5hbCBGbGFt\nZXMiOiAzMDE1LAogICAgICAgICAgICJJbmZlcm5hbCBTbW9rZSI6IDMwMTYs\nCiAgICAgICAgICAgIkFjaWRpYyBCdWJibGVzIG9mIEVudnkiOiAzMDE3LAog\nICAgICAgICAgICJGbGFtbWFibGUgQnViYmxlcyBvZiBBdHRyYWN0aW9uIjog\nMzAxOCwKICAgICAgICAgICAiUG9pc29ub3VzIEJ1YmJsZXMgb2YgUmVncmV0\nIjogMzAxOSwKICAgICAgICAgICAiUm9hcmluZyBSb2NrZXRzIjogMzAyMCwK\nICAgICAgICAgICAiU3Bvb2t5IE5pZ2h0IjogMzAyMSwKICAgICAgICAgICAi\nT21pbm91cyBOaWdodCI6IDMwMjIsCiAgICAgICAgICAgIkJld2l0Y2hlZCI6\nIDMwMjMsCiAgICAgICAgICAgIkFjY3Vyc2VkIjogMzAyNCwKICAgICAgICAg\nICAiRW5jaGFudGVkIjogMzAyNSwKICAgICAgICAgICAiU3RhdGljIE1pc3Qi\nOiAzMDI2LAogICAgICAgICAgICJFZXJpZSBMaWdodG5pbmciOiAzMDI3LAog\nICAgICAgICAgICJUZXJyaWZ5aW5nIFRodW5kZXIiOiAzMDI4LAogICAgICAg\nICAgICJKYXJhdGUgU2hvY2siOiAzMDI5LAogICAgICAgICAgICJOZXRoZXIg\nVm9pZCI6IDMwMzAsCiAgICAgICAgICAgIkdvb2QtSGVhcnRlZCBHb29kaWVz\nIjogMzAzMSwKICAgICAgICAgICAiV2ludGVyeSBXaXNwIjogMzAzMiwKICAg\nICAgICAgICAiQXJjdGljIEF1cm9yYSI6IDMwMzMsCiAgICAgICAgICAgIldp\nbnRlciBTcGlyaXQiOiAzMDM0LAogICAgICAgICAgICJGZXN0aXZlIFNwaXJp\ndCI6IDMwMzUsCiAgICAgICAgICAgIk1hZ2ljYWwgU3Bpcml0IjogMzAzNiwK\nICAgICAgICAgICAiQXR0cmliX1BhcnRpY2xlMjIwMDEiOiAyMjAwMSwKICAg\nICAgICAgICAiQXR0cmliX1BhcnRpY2xlMjIwMDIiOiAyMjAwMiwKICAgICAg\nICAgICAiQXR0cmliX1BhcnRpY2xlMjIwMDMiOiAyMjAwMywKICAgICAgICAg\nICAiQXR0cmliX1BhcnRpY2xlMjIwMDQiOiAyMjAwNCwKICAgICAgICAgICAi\nQXR0cmliX1BhcnRpY2xlMjIwMDUiOiAyMjAwNSwKICAgICAgICAgICAiQXR0\ncmliX1BhcnRpY2xlMjIwMDYiOiAyMjAwNiwKICAgICAgICAgICAiQXR0cmli\nX1BhcnRpY2xlMjIwMDciOiAyMjAwNywKICAgICAgICAgICAiQXR0cmliX1Bh\ncnRpY2xlMjIwMDgiOiAyMjAwOH0KCnF1YWxpdGllcyA9IHsiTm9ybWFsIjog\nMCwKICAgICAgICAgICAgICJHZW51aW5lIjogMSwKICAgICAgICAgICAgICJW\naW50YWdlIjogMywKICAgICAgICAgICAgICJyYXJpdHkzIjogNCwKICAgICAg\nICAgICAgICJVbnVzdWFsIjogNSwKICAgICAgICAgICAgICJVbmlxdWUiOiA2\nLAogICAgICAgICAgICAgIkNvbW11bml0eSI6IDcsCiAgICAgICAgICAgICAi\nVmFsdmUiOiA4LAogICAgICAgICAgICAgIlNlbGYtTWFkZSI6IDksCiAgICAg\nICAgICAgICAiQ3VzdG9taXplZCI6IDEwLAogICAgICAgICAgICAgIlN0cmFu\nZ2UiOiAxMSwKICAgICAgICAgICAgICJDb21wbGV0ZWQiOiAxMiwKICAgICAg\nICAgICAgICJIYXVudGVkIjogMTMsCiAgICAgICAgICAgICAiQ29sbGVjdG9y\nJ3MiOiAxNCwKICAgICAgICAgICAgICJEZWNvcmF0ZWQgV2VhcG9uIjogMTV9\nCgpraWxsc3RyZWFrcyA9IHsiTm9uZSI6IDAsCiAgICAgICAgICAgICAgICJL\naWxsc3RyZWFrIjogMSwKICAgICAgICAgICAgICAgIlNwZWNpYWxpemVkIEtp\nbGxzdHJlYWsiOiAyLAogICAgICAgICAgICAgICAiUHJvZmVzc2lvbmFsIEtp\nbGxzdHJlYWsiOiAzfQoKd2VhciA9IFsiRmFjdG9yeSBOZXciLAogICAgICAg\nICJNaW5pbWFsIFdlYXIiLAogICAgICAgICJGaWVsZC1UZXN0ZWQiLAogICAg\nICAgICJXZWxsLVdvcm4iLAogICAgICAgICJCYXR0bGUgU2NhcnJlZCJdCndl\nYXJfYnJhY2tldHMgPSBbIihGYWN0b3J5IE5ldykiLAogICAgICAgICAgICAg\nICAgICIoTWluaW1hbCBXZWFyKSIsCiAgICAgICAgICAgICAgICAgIihGaWVs\nZC1UZXN0ZWQpIiwKICAgICAgICAgICAgICAgICAiKFdlbGwtV29ybikiLAog\nICAgICAgICAgICAgICAgICIoQmF0dGxlIFNjYXJyZWQpIl0K\n",
  "encoding": "base64",
  "_links": {
    "self": "https://api.github.com/repos/mninc/pytf/contents/pytf2/item_data.py?ref=master",
    "git": "https://api.github.com/repos/mninc/pytf/git/blobs/ccd68cebd9a9baabc9e77ddad0efc6f19d6d830b",
    "html": "https://github.com/mninc/pytf/blob/master/pytf2/item_data.py"
  }
}

 

You'll notice the content key holds some base64. That is what you're after.

 

simply decode the contents from base64 to ascii and bam you've got your json. 

 

Here's a few examples on how to decode base64 to ascii.

 

 

Python:

 

<<< import base64
<<< encoded = 'YmFzZTY0IGVuY29kZWQgc3RyaW5n'
<<< data = base64.b64decode(encoded)
<<< print(data)

 

NodeJs:

'use strict';

let data = 'c3RhY2thYnVzZS5jb20=';
let buff = new Buffer(data, 'base64');
let text = buff.toString('ascii');

console.log('"' + data + '" converted from Base64 to ASCII is "' + text + '"');

 

Let me know if you need help with any part. 

 

 

 

-Zeus

 

 

 

Link to comment
Share on other sites

You guys/gals are awesome thank you!!  Bunch of options here, but for simplicity I threw together the logic using the GetSchemaOverview API and in the spirit of giving back, here is what I created in node-red as well as the js code snippets from the orange functions so hopefully someone can re-use parts of that as I assume most won't be using node-red. It's a bit more cumbersome than needed, but I wanted to create something once that could be used throughout all my projects. Let me know if there are any questions

 

@Zeus thanks a lot for basically creating all the logic for me ;)) I was really tempted to use it, but was a bit worried that sometime in the future manic would stop supporting it. Never met them though so quite possible they plan to be for a while

 

image.thumb.png.c84bd0e2e339074cb9af41fac518d965.png

 

API sample call: http://127.0.0.1:1880/tf2-schema?type=quality

 

function getQuality() {
    var temp =  [];
    Object.keys(msg.payload.result.qualities).forEach(function(quality) {
        temp.push({"name": msg.payload.result.qualityNames[quality], "id":msg.payload.result.qualities[quality]})
    });
    return temp;
}

msg.payload = getQuality();
return msg;

function getEffects() {
    var temp =  [];
    msg.payload.result.attribute_controlled_attached_particles.forEach(function(effect) {
        temp.push({"name": effect.name, "id":effect.id})
    });
    return temp;
}

msg.payload = getEffects();
return msg;
// getting name from id (flip if needed)
function getQualityName(id) {
    return data.filter(function (ef) {
        return ef.id == id;
    })[0].name;
}

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...