Thread: Daily Investment System

Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11  
    Registered Member
    RuneList's Avatar
    Join Date
    May 2020
    Posts
    124
    Thanks given
    139
    Thanks received
    108
    Rep Power
    113
    Damn, might use this. Thank you for the contribution, highly appreciated for both the idea and the snippet
    Reply With Quote  
     

  2. #12  
    *breaks walking*

    Cody_'s Avatar
    Join Date
    Dec 2010
    Posts
    732
    Thanks given
    219
    Thanks received
    203
    Rep Power
    286
    Quote Originally Posted by TheQuantum View Post
    Tried this, but with the return of the dayofWeek, it wouldnt parse to an int for the system to understand. I tried a few different ways to parse it as an integer to set, but everytime it threw it as 0 as it wasnt converted to a variable for some strange reason.
    I'm a little confused on this part. Your dayOfWeek() is an int, what do you mean it wouldn't parse to an int? You shouldn't need to parse or anything like that, just return cal.get(Calendar.DAY_OF_WEEK);





    Quote Originally Posted by TheQuantum View Post
    Player variables are done weirdly because there are already variables in my system that are in use for more common names.
    Naming is whatever, but you should get into the practice of using private variables with getters/setters instead of making everything public.

    Quote Originally Posted by TheQuantum View Post
    do you have any suggestions? i am orginally a php developer, so i been leaning towards that structure and havent learned quite everything with java, in terms of shortening code or other helpful ways. if you have something that would help, i would appreciate help to improve!
    Really all above. This is just a standalone static class, don't include all that 'extends Action' and all of the auto-generated methods and shit.

    Use getters/setters, maybe just make this not a static class, and save the class on the player so you can instead store variables inside of the class instead of player, and avoid the naming issues you said you had. Will keep your player class a lot cleaner as well.
    Reply With Quote  
     

  3. #13  
    Everything is Corrupt
    Corrupt's Avatar
    Join Date
    Oct 2020
    Posts
    115
    Thanks given
    15
    Thanks received
    36
    Rep Power
    63
    Quote Originally Posted by Cody_ View Post
    I'm a little confused on this part. Your dayOfWeek() is an int, what do you mean it wouldn't parse to an int? You shouldn't need to parse or anything like that, just return cal.get(Calendar.DAY_OF_WEEK);







    Naming is whatever, but you should get into the practice of using private variables with getters/setters instead of making everything public.



    Really all above. This is just a standalone static class, don't include all that 'extends Action' and all of the auto-generated methods and shit.

    Use getters/setters, maybe just make this not a static class, and save the class on the player so you can instead store variables inside of the class instead of player, and avoid the naming issues you said you had. Will keep your player class a lot cleaner as well.
    When doing it that method, when it tried to save to the player file as that int, it returned as a different format. Don't ask me why, i actually did that, and even :
    int val = DayOfWeekObject.getValue()
    int dayOfWeek = getDayOfWeek(c.get(Calendar.DAY_OF_WEEK));
    None of those was for some reason sending the right format to the player file and reverting back to 0 everytime, allowing them to do it multiple times. When doing it, it got errors saying that it was Wrong Format.

    As for doing getter/setter, thats something i haven't learned yet, im not sure how those work. I will look into guides on how those work and how it would be able to make files like this better, only way i know how to set player specific variables like that is to making it public so i shall look into that way if it is better.
    Living in a Corrupted World

    Attached image
    Reply With Quote  
     

  4. #14  
    Christ is King

    Makar's Avatar
    Join Date
    Jul 2011
    Age
    29
    Posts
    2,004
    Thanks given
    545
    Thanks received
    965
    Rep Power
    427
    Quote Originally Posted by TheQuantum View Post
    When doing it that method, when it tried to save to the player file as that int, it returned as a different format. Don't ask me why, i actually did that, and even :

    None of those was for some reason sending the right format to the player file and reverting back to 0 everytime, allowing them to do it multiple times. When doing it, it got errors saying that it was Wrong Format.

    As for doing getter/setter, thats something i haven't learned yet, im not sure how those work. I will look into guides on how those work and how it would be able to make files like this better, only way i know how to set player specific variables like that is to making it public so i shall look into that way if it is better.
    If you're using the same serializer for player saving, you should look at how Matrix does their "Manager" system. I am not a fan of that system to begin with but it is more organized than having all the variables in the Player class. Just search your player class for anything with the word "Manager" as the type name (IE: PrayerManager, EmotesManager, AuraManager, etc)
    Attached image
    The best open-source pre-eoc remake project that isn't in its early stages for once
    Darkan Client (727 Client Refactor)
    Darkan World Server
    “It would not be impossible to prove with sufficient repetition and a psychological understanding of the people concerned that a square is in fact a circle. They are mere words, and words can be molded until they clothe ideas and disguise.”
    Reply With Quote  
     

Page 2 of 2 FirstFirst 12

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 30
    Last Post: 08-30-2015, 05:50 AM
  2. Replies: 125
    Last Post: 06-29-2015, 01:05 AM
  3. Daily Voting system. Doesn't require vps or webhost.
    By elfranger243 in forum Snippets
    Replies: 11
    Last Post: 06-26-2014, 04:46 PM
  4. Replies: 10
    Last Post: 08-31-2013, 03:47 PM
  5. Buying Daily Tasks & New person task system
    By JAVA GURU #1023 in forum Buying
    Replies: 2
    Last Post: 03-19-2012, 12:37 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •