-
Posts
1,405 -
Joined
-
Last visited
-
Days Won
32 -
Feedback
0%
Content Type
Articles
Profiles
Forums
Store
Everything posted by melron
-
Sure! i'm learning by my mistakes that's obvious ... and thank you for all your suggestions. about this: A good developer is a lazy developer I do not agree :D why a good dev should be lazy? That is the best part of this thing so... (just my opinion) P.s i'm thinking to remove as you said the name and use direcly the sb but there is one problem. commands like /showcoupons or /deletecoupons or even npcs,html / alert messages etc can be used without any issue but... combobox doesn't accept spaces.. so will fucked up (Golden-Coupon-B-Grade) ? :D also there is another problem there. The bypass for the redeem is sending the name Coupon coupon = player.getCouponsByName(couponName); if the combobox will contains > 1 example Golden . how the manager can delete the coupon(based on id) ? Cant even add something with placeholder to keep these id's
-
Tryskell, The good thing is that your ideas are awesome. The bad thing is, finally this share will belong to you xD I'm gonna listen your advice :P
-
players cant see the id since the name of the coupon (this random string) is generated from this id private static String getCouponName(int id) //the idFactory id { StringBuilder sb = new StringBuilder(); String number = String.valueOf(id); for (int i = 0; i < number.length(); i++) { int j = Character.digit(number.charAt(i), 10); char Char = (char) (j + (Rnd.get(65, 81))); //65 == A , 90 == Z sb.append(Char); } return sb.toString(); } i find it cool :P
-
why to make something new while idFactory is there? I found it great idea since it's generating just id's
-
Anyway idea is new for me :) Update: couponId is now integer with idFactory next id. couponName is generating with the couponId as base grade store/restore changed from ugly level checks to skill 239 level. renamed names of some methods Ty tryskell. table coupons now storing coupon id instead of coupon name removed the 'while' useless check ty pirama for remind it ;)
-
It's just a check for the string if already picked but it could be written with do-while instead of while to remove the Boolean. Ty
-
int gradeLevel = player.getSkillLevel(239); will give 1..6 right? but ordinals from enum are 0..5 so i have to rework the whole thing but for sure will be more readable :P try/catch you mean to catch exceptions while storing the tokens? Integer.parseInt stands there to make a type casting between String-> int right? Done :P Others are fixed :P P.s about Id :P i dont find a reason for rename because ID in l2 is missunderstood since id means identity so , coupon's identity :P
-
Which one? the idea actually came from here :P Updates: coupon manager list replaced with ConcurrentHashMap . Ty Tryskell some queries removed as variables and passed directly in prepareStatement. Ty Tryskell coupon generating id method changed since i have all the necessary tools in some packages (now using StringUtil methods and String instead of char[], Random -> Rnd too). Ty Tryskell the way of storing/getting rewards from coupon changed (@Tryskell i believe rewards should be in the Coupon class since we are talking about the same thing). Ty Tryskell all checks about lists are changed from null check to emptyList() . Ty .Elfocrash added some ternary statements . Ty .Elfocrash added grade type (NG,D,C,B,A,S) . Once the grade stored will not changed. Ty Tryskell grade type setted with multiplier so if you want you can multiple your rewards based on the coupon's grade added 1 more column in coupon table for storing the grade type. different html will apear if player havent coupons and try to talk to the npc. Ty Tryskell redeem bypass changed . Ty Tryskell Thank you guys for your suggestions you are awesome! Thank you guys!!
-
Designatix answered you but it's not only this thing.Imagine this topic in marketplace section with these bugs inside ;) Also there are many shares that deserves your question and not mine for sure :P. I'm gonna update it to be completed and reshare it Thank you for your good words my friend!
-
Well as i can see there are serious problems , should a mod move it to the proper section until it get fixed? It is not worth for someone to get it if its not completed. Nick,Tryskell i love you guys. I will try to fix it as soon as possible :) Thank you pirama,Sweets!
-
Hello members, Since my mobile service provider has an app and allows me play a game in order to win certain prizes like (extra mbs, msgs, talk time ) when i put a code i decided to create something similar to l2. Explaination: Every player can get a coupon. Coupons have categories : Silver,Gold,Platinum Each category has its own reward list (configurable) Coupons can be deleted , redeemed and show their rewards by writting /coupons You will win a random reward based on coupon's category and grade type Create your own condition and add a new coupon to this player. Grade Type added (No grade,D,C,B,A,S) based on the current level of the player, the grade will not change once the coupon activated Players have daily limit. Coupons Task Manager running and every day the time you will set all limits will be lifted. If you guys find any mistakes please let me know i would really appreciate it, cause i want to learn alternative and easier ways ;) The code is working properly. Coded on aCis 370 rev. Video Code Htmls Database Player configs: Special thanks to Tryskell. P.s I do not have voiced command handlers so i used usercommandhandelrs. if you want too, you have to add 1 line in commandname-e.dat 115 114 a,coupons\0
-
Help How To Make It Forbidden
melron replied to milosvamp's question in Request Server Development Help [L2J]
Use sdw's example. I thought it was for aCis. I didnt even see the imports l2jserver :P -
Help How To Make It Forbidden
melron replied to milosvamp's question in Request Server Development Help [L2J]
Well you have 2 options. You will add the next check in showChatWindow() method in super class (L2Npc?) by checking the npc id You will override the method showChatWindow() in your npc instance inside of your method before you send the html add a check like this: List<Integer> classes = Arrays.asList(1,2,3,4,5,6); if (classes.contains(player.getClassId().getId())) return; Fill the list with all healers class ids -
Best of luck bro!
-
What's your pack? maybe it's about synchronization in olympiad instances
-
find the line where the item is updating the enchant value and add some checks.. for example: if (scrollTemplate.isBlessed()) if ((item.getEnchantLevel() + 50) > maxServerEnchant) item.setEnchantLevel(maxServerEnchant); else item.setEnchantLevel(item.getEnchantLevel() + 50); else if (crystal case) if ((item.getEnchantLevel() + 100) > maxServerEnchant) item.setEnchantLevel(maxServerEnchant); else item.setEnchantLevel(item.getEnchantLevel() + 100); else if (ancient case) if ((item.getEnchantLevel() + 500) > maxServerEnchant) item.setEnchantLevel(maxServerEnchant); else item.setEnchantLevel(item.getEnchantLevel() + 500); else { //normal case item.setEnchantLevel(item.getEnchantLevel() + 1); } I dont know the methods you are using to get blessed/crystal etc . but you can take it as example
-
Code Multi Shop [Services/donate Npc] + Vip System
melron replied to 'Baggos''s topic in Server Shares & Files [L2J]
-
Code Multi Shop [Services/donate Npc] + Vip System
melron replied to 'Baggos''s topic in Server Shares & Files [L2J]
I was not offended relax :P If i understand well you mean 99% of the codes that are shared here are from guys that they think the code is useless for them and they say "i will share it to get some reputation"? If yes , i agree in some cases ... besides, why someone will share a 'rare' code without getting some money? Ofcourse there are exceptions ... -
Code Multi Shop [Services/donate Npc] + Vip System
melron replied to 'Baggos''s topic in Server Shares & Files [L2J]
What you mean? i can show you a classic code .online. the way its working isn't correct? All i want to say is, that in this forum 70% of the members (+me) we are trying to improve ourselves and being better but this doesn't mean we cannot make a correct code... -
Code Multi Shop [Services/donate Npc] + Vip System
melron replied to 'Baggos''s topic in Server Shares & Files [L2J]
Why? if the code is properly coded its ready. thats why we are coding :D You can use many many alternative ways of coding, especially in baggos shop. Example this code: if (command.startsWith("donate")) { StringTokenizer st = new StringTokenizer(command); st.nextToken(); try { String type = st.nextToken(); switch (type) { case "Noblesse": Nobless(player); break; case "ChangeSex": Sex(player); break; case "CleanPk": CleanPk(player); break; case "FullRec": Rec(player); break; case "ChangeClass": final NpcHtmlMessage html = new NpcHtmlMessage(0); html.setFile("data/html/mods/donateNpc/50091-2.htm"); player.sendPacket(html); break; } } catch (Exception e) { } } can be written in this way even if switch case maybe will be more safer,readable Method callingMethod = L2MultiShopInstance.class.getMethod(st.nextToken(), L2PcInstance.class); callingMethod.invoke(new L2MultiShopInstance(), player); Ofc there must be some changes for example in methods name so they can be called by exactly the same name of the token ... Nvm the coding style of a person is different from others but this doesn't mean that isn't correct ;) (For sure this example is usefull when you have to call many methods so, you just avoid the switch case ...) -
Yeah you're right :p
-
A system that can be extended , i like it ;) You can start by making 2 methods in L2PcInstance to get/set the vip status in the player. for example: Make a global variable private boolean vip = false; then the 2 methods public void setVip(boolean val) { vip = val; } public boolean isVip() { return vip; } then, you should make a new admincommandhandler : go at ./handler.admincommandhandlers package and create your new .java AdminVip.java inside the only thing you need is actually 1 check : if (command.equals("admin_vip")) if (activeChar.getTarget() != null && activeChar.getTarget() instanceof L2PcInstance) //checking the target if is a player { L2PcInstance target = (L2PcInstance) activeChar.getTarget(); if (target != null) { if (target.isVip()) //checking if is already a vip { activeChar.sendMessage("target already vip"); return false; } // is not vip , rewarding and set vip target.addItem("vipReward", 57, 200, null, true); target.sendMessage("You are now Vip!"); target.setVip(true); } } register this command in ./gameserver.handler.AdminCommandHandler.java registerAdminCommandHandler(new AdminVip()); (dont forget to add the missing import of the AdminVip class) then, depends on your pack you should go in chathandlers and before the message is send to the world,knownlist add a check like this if (!activeChar.isVip()) { activeChar.sendMessage("Only vips can talk here"); return; } .... Note: with the above code the player is vip until restart. if you want to save the status you should make a connection somewhere in your database to store/restore the vip value
-
I didnt understand your problem, explain it better if you can
-
Help Some Skills Don't Finish Cast Animation
melron replied to Ikeryn's question in Request Server Development Help [L2J]
its clearly coolTime problem. edit your xmls and set new cool time there example: <set name="coolTime" val="720" /> P.s if doesnt exists , add it -
Help Disconnect/stuck When Hitting Mobs?
melron replied to sm4rt's question in Request Server Development Help [L2J]
Seems like the player instance is sleeping for some reasons. Maybe a custom feature using sleep on them or something... A strong debug could give you the answer you looking for..
