Major Voting Improvements!

Discussion in 'Empire Updates' started by Aikar, Feb 19, 2014.

  1. new promo is a stick with kb 2 sharp 5. Named: Golf Club
    PandasEatRamen likes this.
  2. A little birdy told me /promo top10
  3. Thanks Aikar!
  4. dat bow :O
  5. Is this gonna be in /shop? Or just /promo top10?
  6. ill add it tomorrow, going to bed now
    cadgamer101 and bemvino87 like this.
  7. unb 10 :O
  8. How long will the promo be in game? I'm away for the weekend and can't log me alts in D:
  9. So getting this promo .. :D
  10. Do you mean [I]surprise[/I]?:p
  11. Can't do it on my iPhone lol, sorreh
    cadgamer101 likes this.
  12. Oh yeah! Your in the butter zone now babe!
  13. Huh?
  14. Translation of my Signature "Your in the butter zone now babe!" = Your actions are smooth like butter! Meaning your cool, awesome or something in that ball park. Your a smooth talker or have a cool attitude or aura.
  15. When I passed the 220 days mark and I only received a single vault voucher I became sad, since I expected to eventually receive all the ones that I would have received if the voting system was up all the time I was voting before.

    Now, I can't say I'm non-partial on this, I really do want the prices that I did not get for voting before the system was up, and perhaps the decision to not give them to players is a good thought one, considering the quantity of items that would enter play.

    Still, if perhaps the reason was simply that there was no easy way to give all those items without overwhelming people with items, then here I present some code that could help:

    Code:
    private boolean shouldGetEvery(int i, String key) {
        if (shouldGetAt(i, key)) {
            return true;
        } else if ((voteBonus % i == 0) && !hasMetaKey(key + voteBonus)) {
            setMetaKey(key + voteBonus);
            return true;
        }
        /****************************
        Begin - Backlog claiming code
        *****************************/
        if (hasMetaKey(key + ".current")) { //The backlog is cleared, the user has received everything.
            return false;
        } else if ( voteBonus % i-1 == 0) { //A little faster than normal, so eventually we'll catch up
            int start = 2*i;
            String value = getMetaKey(key + ".latest"); //Latest backlog prize claimed.
            if (value != null) {
                start = Integer.parseInt(value);
            }
            for (int test = start; test < voteBonus; test += i) {
                if ( !hasMetaKey(key + test) ){
                    setMetaKey(key + test);
                    setMetaKey(key + ".latest", Integer.toString(test) );
                    return true;
                }
            }
            setMetaKey(key + ".current");    //We finish with the backlog, so don't run the code again.
        }
        /****************************
        End - Backlog claiming code
        *****************************/
        return false;
    }
    
    private void setMetaKey(String key, String value){
        EmpireMetaKey metaKey = new EmpireMetaKey("votereward." + key, 0);
        EmpireUser.getUser(player).setMeta(metaKey,value);
    }
    
    private String getMetaKey(String key){
        EmpireMetaKey metaKey = new EmpireMetaKey("voterewar." + key, 0);
        return EmpireUser.getUser(player).getMeta(metaKey).getString();
    }
    
  16. Most people did get the things they missed, when I came online 3 days after this was in place, I had lots of the mail.
  17. Yes, the code ensures that you get at least 1 of everything you should have gotten, but only 1. Lets take vault vouches, for example, they are awarded every 20 days of voting, so when someone reaches 200 voting streak, he will have receive 10 vault vouchers.

    If someone had over 20 voting streak when the voting update happened, then the code ensures that they will receive 1 vault voucher, but if someone already had 200 voting streak, he will only receive the 1, the other 9 are never delivered.

    As I stated before, perhaps this is intentional, perhaps Aikar considered that is was not fair to give the rewards retroactively, if that is the case, then I will accept the decision. I wrote that code just in case the issue was motivated not by a conscious decision, but for lack of an acceptable implementation that would not flood high voters with mail.

    I would love to get the backlogged items so, as I said before, I'm not impartial over this, but when I saw in Aikar's code that he actually kept a record of exactly what reward each player had received, I had hope that it was proof that he had intended to give the backlogged items eventually.
  18. You will, you probably have to get to a new 'high' of a streak.
  19. Unless the code that Aikar published is not the code in use, then you won't get any backlogged rewards.

    The day the voting improvements came into effect was the day I gained my 200 voting streak, and I received a lot of mail, including 1 vault voucher.

    Then, 20 days latter, when I gained my 220 voting streak, I received another vault voucher. So now I have 2, but there is nothing in the code that would give me the 9 backlogged vault vouchers.

    Again, if this is by design, I have nothing to say about it, but if not, then I have posted one possible solution.
    607 likes this.
  20. Semi-Ultra Bump?