Jump to content

Facebook Like System


melron

Recommended Posts

Hello members,

Since this section is rly dead and i always like to share things here is another one..

 

How is this working?

  • First of all you have to create your personal l2 page in facebook.
  • After that search in facebook settings to change the url-name of your page to www.facebook.com/L2Tests and not www.facebook.com/HAW#$A#@
  • Create your personal Access Token here
  • It will be generated as short-lived token (means that it will expire in about an hour). change it to long-lived here (means that it will expire after 2 months ,maybe more)
  • Download facebook api restfb-1.46.0
  • Add it in your sources (i will not provide how to...)
  • Implement the code i'm giving

Source / Files

Source Code
Htmls/Database
Config
Dont forget to add the new admin commands in adminCommands.xml

	<aCar name="admin_fbreload" accessLevel="7"/>
	<aCar name="admin_facebook" accessLevel="7"/>
	<aCar name="admin_showPosts" accessLevel="7"/>
	<aCar name="admin_delPost" accessLevel="7"/>
	<aCar name="admin_addPost" accessLevel="7"/>
	<aCar name="admin_turnFb" accessLevel="7"/>
	<aCar name="admin_clean_facebook_database" accessLevel="7"/>
	<aCar name="admin_fb_auto_announce" accessLevel="7"/>


(these commands are used for all actions , you can use these actions direcly by writing the command with the necessary tokens)

 

Videos

 

Admin view

 

 

User view

 

 

More explaination?

 

  • If you successfully passed all the above moves:
  • Set your facebook page name in FacebookPageName in facebook.properties
  • Set your Access Token in FacebookApiToken
  • //facebook command will display the panel you just saw
  • /facebook command for users
  • You can add/remove any of the posts that are inside of your page.
  • You can set an automatic reward:
  • You set the number of  likes you want to collect from the sum of all the pages you have set, item id, item count.
  • When the likes will be >= the num you set, then all the online players will get the reward you set.
  • The players have to like All the posts you added to take the reward.
  • I am mostly using usercommand handlers , if you will too, then don't forget to add one more line in your commandname-e.dat and edit the id of the command (in FaceBook.java) to your id if you have voiced you can add it there.

 

==================================================================================

This code is made for aCis 371 rev.
Note: I havent check it in live server , i just made it in localhost so you have to give a try in my shitty code  and check if any bug will appear.

If anyone wants the buttons (the blue ones) you can get the utx from here (Thanks Sinister Smile)

If someone finds any bug please let me know, i can help. Thank you!
 

Edited by melron
  • Upvote 3
Link to comment
Share on other sites

really nice !
My question is that this will work ONLY IF your facebook name is written in English or Russian letters since only these 2 languages are supported in 99% of servers, is that correct ?

Link to comment
Share on other sites

5 minutes ago, MrPro* said:

really nice !
My question is that this will work ONLY IF your facebook name is written in English or Russian letters since only these 2 languages are supported in 99% of servers, is that correct ?

Well i didnt test this thing but i dont think will be a problem from server side.. its just a save in db (the name) . I have to check the way that facebook sending the user name to check if the letters are corectly appearing so the server can compare . Thanks for this question

Link to comment
Share on other sites

I made a quick review on the code so far looks good I did not test it but seems to be having a little check's and NPE issues and some typos like WHERE obj_id=? that needs to be WHERE obj_Id=?

you can also add some packets like actionfail

Edited by Nightw0lf
Link to comment
Share on other sites

Very nice. I had implemented something similar in my private Esios sources back in 2012 back it was very basic. You took it to another level.

Great job mate, you are learning insanely fast.

 

Link to comment
Share on other sites

15 minutes ago, .Elfocrash said:

Very nice. I had implemented something similar in my private Esios sources back in 2012 back it was very basic. You took it to another level.

Great job mate, you are learning insanely fast.

 

Finally i saw a position comment from you, i'm glad sir

@Ontopic, you did great job you just need to improve some things, your codes proves you're learning but you did very very nice job, congratulations sir.

Edited by GamePsychology
Link to comment
Share on other sites

11 minutes ago, GamePsychology said:

Finally i saw a position comment from you, i'm glad sir

You probably meant positive.

If you check my history, I'm positive to things that worth it and negative to things that don't. That's called being objective.

Link to comment
Share on other sites

27 minutes ago, .Elfocrash said:

You probably meant positive.

If you check my history, I'm positive to things that worth it and negative to things that don't. That's called being objective.

Dear god, i wrote position, exquse me. 

Link to comment
Share on other sites

19 hours ago, Sinister Smile said:

Nice share @melron .This is so unique! Big respect to you!

Thanks mate!

18 hours ago, IpotoniC said:

melron ftw!

Thanks :D

13 hours ago, Nightw0lf said:

I made a quick review on the code so far looks good I did not test it but seems to be having a little check's and NPE issues and some typos like WHERE obj_id=? that needs to be WHERE obj_Id=?

you can also add some packets like actionfail

Thank you mate, Well for field names/sql keywords case doesn't matter.. Only quoted strings like 'Something Else' does case matter

Even with OBJ_ID will be fine
where do you think i should add action fail packets? and why?
Thank you for your hints

1 hour ago, .Elfocrash said:

Very nice. I had implemented something similar in my private Esios sources back in 2012 back it was very basic. You took it to another level.

Great job mate, you are learning insanely fast.

 

Thank you elfo, i'm glad you liked it

1 hour ago, GamePsychology said:

Finally i saw a position comment from you, i'm glad sir

@Ontopic, you did great job you just need to improve some things, your codes proves you're learning but you did very very nice job, congratulations sir.

Thank you sir, I'm not hidding the fact that i'm learning :D I'm always trying for the best i can give.

1 hour ago, PaRaNoiC* said:

add twitch vk.com and youtube 

for youtube like or sub in channel :D

Thanks for the rep, Not bad idea ;)

Edited by melron
Link to comment
Share on other sites

in the commands there are missing checks for null character missing check for command (if command equals) and the return in cases with action fail

String token = "the token";

sould be used config

String token = Config.FACEBOOK_API_TOKEN;

also you can use try with resources for results of database and make better handle on the multiple sql statement uses for better error handle

the admincommand handler has unessasary text from the ban handler :)

the config has wrong title (clan)

the html has no back button on refreshing posts

the user html does not say the likes left

I found 2 NPE's in the method checkForBigString

you could also add the config on server config

you call unessasarily the config somewhere in your code to load

asside the deprications its good :)

 

 

Edited by Nightw0lf
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...