1. The forums are scheduled for deletion on or after December 31, 2024 (JST). Please back up or archive any data you find important to you. If you do not have an account, you cannot login or create an account.

2.1 TSWVote 2.3

Allows in-game voting using the tserverweb.com platform.

  1. XGhozt

    Plugin Developer

    Joined:
    May 12, 2012
    Messages:
    171
    It does not require a full dump of the users inventory. I can't just send the IP because I need to validate that the player is actually on the server. Otherwise, you wouldn't need to be on the server in order to place a vote. And then anyone could add fake votes! :eek:

    Code:
    /v2/users/read
    Description: Returns information about a specified user
     
    Parameters:
    token - A valid token
    type - (defaults to name) name, id or ip indicating what the "user" parameter refers to
    user - The name, ip or id of a currently registered user
     
    Returns:
    group - The group the user belong's to
    id - The user's ID
    name - The name of the user
    ip - The ip of the user 
     
  2. Commaster

    Banned

    Joined:
    Oct 3, 2012
    Messages:
    149
    Your info is outdated. Here's TShocks source:
    Code:
    return new RestObject()
                {
                    {"nickname", player.Name},
                    {"username", null == player.UserAccountName ? "" : player.UserAccountName},
                    {"ip", player.IP},
                    {"group", player.Group.Name},
                    {"position", player.TileX + "," + player.TileY},
                    {"inventory", string.Join(", ", activeItems.Select(p => (p.name + ":" + p.stack)))},
                    {"buffs", string.Join(", ", player.TPlayer.buffType)}
                };
     
  3. XGhozt

    Plugin Developer

    Joined:
    May 12, 2012
    Messages:
    171
    Someone needs to update the documentation then: https://tshock.atlassian.net/wiki/display/TSHOCKPLUGINS/REST+API+Endpoints

    Here, it only says /v2/players/read returns that information!
     
  4. Commaster

    Banned

    Joined:
    Oct 3, 2012
    Messages:
    149
  5. Commaster

    Banned

    Joined:
    Oct 3, 2012
    Messages:
    149
  6. XGhozt

    Plugin Developer

    Joined:
    May 12, 2012
    Messages:
    171
    Well I don't know c#, that's not my lingo. I would ONLY get the IP if I could. But there isn't such an endpoint.
     
  7. CyberzOwl

    CyberzOwl Level 2

    Joined:
    Nov 24, 2013
    Messages:
    38
    Dude this is sick, nice job. Keep up the good work buddy :)
     
    • Like Like x 1
  8. Commaster

    Banned

    Joined:
    Oct 3, 2012
    Messages:
    149
  9. XGhozt

    Plugin Developer

    Joined:
    May 12, 2012
    Messages:
    171
    @Commaster;
    [​IMG]
     
    • Like Like x 1
  10. Commaster

    Banned

    Joined:
    Oct 3, 2012
    Messages:
    149
    That's totally not helping me trying to help you document the voting process properly. Y'now...

    I have to take an 8 hours brake. Hope that you'll finish documenting the permissions by then ^_^
     
    • Like Like x 1
  11. OFF

    OFF
    Account Probation Banned Rating Banned

    Joined:
    Nov 28, 2013
    Messages:
    208
    Honestly, it works fine for me? It's just that I've been working around with /bank give now and that doesn't seem to work (is what my players say) can't test it myself because I've voted already.
     
  12. XGhozt

    Plugin Developer

    Joined:
    May 12, 2012
    Messages:
    171
    It worked for me! :)
    [​IMG]
     
  13. Loganizer

    Plugin Developer

    Joined:
    Dec 2, 2012
    Messages:
    212
  14. OFF

    OFF
    Account Probation Banned Rating Banned

    Joined:
    Nov 28, 2013
    Messages:
    208
    The message didn't work though, I changed the message to: Thank you for voting on Tserverweb ([totalvotes])! You have received 500,000 (500K) Mesos for doing so. Be sure to vote on terraria-servers.com to receive 1,000,000 (1 Mil) Mesos!

    But it just shows Thanks for voting!
     
  15. XGhozt

    Plugin Developer

    Joined:
    May 12, 2012
    Messages:
    171
    Just fixed it. :p
     
    • Like Like x 1
  16. OFF

    OFF
    Account Probation Banned Rating Banned

    Joined:
    Nov 28, 2013
    Messages:
    208
    Now the only problem is that we cannot test it out >_> damnit.
     
  17. XGhozt

    Plugin Developer

    Joined:
    May 12, 2012
    Messages:
    171
    Here you go:
    [​IMG]
     
    • Like Like x 1
  18. OFF

    OFF
    Account Probation Banned Rating Banned

    Joined:
    Nov 28, 2013
    Messages:
    208
    bananaing epic :D
     
    • Like Like x 2
  19. hiarni

    Plugin Developer

    Joined:
    Mar 14, 2014
    Messages:
    127
    Hey Loganizer!

    Maybe you could make the command to votes or votetsw something like that? because c3mod use /vote instead and then getting the wrong gametype error...
    Would be very nice! :)

    EDIT: changed it self
     
    • Like Like x 1
  20. Simon311

    Simon311 TShock Contributor; Moderator
    TShock Contributor Plugin Developer

    Joined:
    Feb 23, 2013
    Messages:
    337
    First of all, you should indeed add threading.
    Second of all, you should not be querying TShock REST API as it gives too much info. You should instead make your own endpoint that reports all the data you need in one query. And you should also not be able to execute commands on the server, instead you should let the server owner specify the command SERVERSIDE, not on your website, and only notify the server when to execute it and who voted.
    Well, the second of all part is more of a security risk for you, since it would only require changing your source to report fake IPs, but then, if someone really wants to fake votes - they could just change TShock's source, or replace original TShock endpoints in some other way.

    You got my point, right? I can fake TShock endpoints and report fake IPs (therefore fake votes). And there isn't really anything you can do. I don't think there is a secure way to implement this, man. Well, unless forcing in-game voters to register online first and somehow log in to their accounts on the server.
     
    • Like Like x 1