Jump to content

Acis Coupons + Redeem


Recommended Posts

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!

i love your idea, i always try to do new things (but since i'm newbie on java i can only imagine them xD) so it's good to see new things. I'll be waiting for the update :D

Link to comment
Share on other sites

i love your idea, i always try to do new things (but since i'm newbie on java i can only imagine them xD) so it's good to see new things. I'll be waiting for the update :D

if you can imagine ( that is good ) just try to write it ( is not so hard ) 

 

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!

is not so bad ( drama ) ... just need 1 simple rework 

Link to comment
Share on other sites

if you can imagine ( that is good ) just try to write it ( is not so hard ) 

Well, it's not that easy, my ideas are not that simple for a newbie to make them..

Link to comment
Share on other sites

Can't get it, so you're saying that few unnecessary calls that give you a dummy empty list are cleaner than nullptr ? Its obvious that this emptylist should be used on other cases but here? Explain me why this is worst and I will go to fck off right away

 

final ArrayList<Coupon> coupons = getCoupons(player);

if (coupons == null)

{

     //msg and exit

}

{

else

{

   for (Coupon c : coupons)

        c.something();

}

 

if getCoupons returns empty list instead of null, the flow of the rest code is dumb and nonsense. null checks are as fast as 1 == 1

 

I personally believe (and most ppl on the internet, so far, since the time I checked it) it's not to the developer to care about null behavior. Or at least, as low as possible.

 

An empty list for looping does nothing, since it iterates on nothing it doesn't reach internal content of loop. The overhead is minimal.

 

It's just cleaner code-wise and in the developer's mind, you are sure you won't face any null, anywhere, anytime. So building new methods associated to such empty container become "easier".

 

Performance-wise, you win almost nothing using null since you call a static list (and what would be heavy with my method is the creation of the list).

 

But well since you explained you see it as a "error" and not an "exception" (so far it's called NullPointerException, not NullPointerError :D), what you say is correct, for yourself. If you seek on the internet the "standard" behavior, however, it's not that. After it's personal preferences, personally when I see a null I drop it, it remembers me the dark age of L2JIL where everything was tested using null, even if not needed ; so you were losing tracks of what could be null and what couldn't.

Link to comment
Share on other sites

Imagine this topic in marketplace section with these bugs inside ;)

 

Most of shares made for L2JFrozen so far (with all due respect for sharers).

Edited by Tryskell
Link to comment
Share on other sites

One interesting thing to add : grade type is counted as part of reward list. That way your system works even for low/mid rates servers.

 

Grade could be written on coupon in order player doesn't accumulate them when he reach lvl 80 (so a grade C coupon will still be a grade C coupon).

 

Obviously you have to write more reward lists :D.

 

Another thing : create a specific HTM for no coupon behavior (instead of the 20 non clickable "+").

Edited by Tryskell
Link to comment
Share on other sites

I personally believe (and most ppl on the internet, so far, since the time I checked it) it's not to the developer to care about null behavior. Or at least, as low as possible.

 

An empty list for looping does nothing, since it iterates on nothing it doesn't reach internal content of loop. The overhead is minimal.

 

It's just cleaner code-wise and in the developer's mind, you are sure you won't face any null, anywhere, anytime. So building new methods associated to such empty container become "easier".

 

Performance-wise, you win almost nothing using null since you call a static list (and what would be heavy with my method is the creation of the list).

 

But well since you explained you see it as a "error" and not an "exception" (so far it's called NullPointerException, not NullPointerError :D), what you say is correct, for yourself. If you seek on the internet the "standard" behavior, however, it's not that. After it's personal preferences, personally when I see a null I drop it, it remembers me the dark age of L2JIL where everything was tested using null, even if not needed ; so you were losing tracks of what could be null and what couldn't.

 

Most of shares made for L2JFrozen so far (with all due respect for sharers).

 

One interesting thing to add : grade type is counted as part of reward list. That way your system works even for low/mid rates servers.

 

Grade could be written on coupon in order player doesn't accumulate them when he reach lvl 80 (so a grade C coupon will still be a grade C coupon).

 

Obviously you have to write more reward lists :D.

stop the drug plz or change simple yous first message ... why you need 3 message ? you talk alone ?

Edited by pirama
Link to comment
Share on other sites

stop the drug plz or change simple yous first message ... why you need 3 message ? you talk alone ?

 

I thought you would have enough time to post between each.

Link to comment
Share on other sites

Tryskell, Pirama, with all respect guys, please don't start this flame and here. Respect Merlon's share.

 

Thanks!

ah Baggo You Don't Know What Real Love Means,This flame is just love :D 

 

on Topic nice idea melron thanks for share

Link to comment
Share on other sites

ah Baggo You Don't Know What Real Love Means,This flame is just love :D

 

on Topic nice idea melron thanks for share

hahahah pirama love you re, more than Tryskell. :o 

 

Merlon thanks for this share mate.. It's a fresh idea.  :1010:

Edited by 'Baggos'
Link to comment
Share on other sites

On the other hand if coupons were empty you dont even need to check.

All you do is:

 for (Coupon c : coupons)

        c.something();

 

No null checks, no NPE possibility, safer and cleaner code.

And if you seriously look at me in the face and tell me that returning null and checking it for performance reasons is better then you are not as smart as i thought you were.

 

idk how java optimizes empty list or empty loops, I don't even think it does, I always prefer nullptr due to the fact that things are straightforward once you have it. Imagine storing it somewhere and having to check if the character has any coupons, personally I prefer coupons == null than a dumb list.isEmpty() on an immutable empty list, I believe this case is just coding style, but my C background forces me to go with nullptr.

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.




  • Posts

    • DISCORD : utchiha_market telegram  https://t.me/utchiha_market SELLIX STORE : https://utchiha-market.mysellix.io/ Join the server for more products : https://discord.gg/hoodservices
    • 🌟 Welcome to the dawn of a new adventure in the realm of Lineage 2 Supreme! 🌟 Prepare yourself for an epic journey that transcends time and space. Our upcoming project promises to deliver the ultimate mid-rate experience, where heroes are forged and legends are born. Stay tuned for updates as we embark on this thrilling journey together. The realm of Lineage 2 awaits, and destiny beckons. Are you ready to answer the call? www.l2supreme.cc https://discord.com/invite/QA32rQ77nM
    • Official Website @>> https://www.eventbrite.com/e/biopeak-male-enhancement-reviews-warning-important-information-no-one-will-tell-you-tickets-894184589177   Biopeak Male Enhancement:- Considering the mind-boggling interest in their products, the organization needed to confine the quantity of units ready to move. We considered what compelled this sugary treat to surprise the world, and we discussed whether it satisfied our grand assumptions,    https://www.facebook.com/BiopeakMaleEnhancementInUS/ https://www.facebook.com/Get.BiopeakMaleEnhancementUS/   https://trybiopeakme.clubeo.com/calendar/2024/04/29/biopeak-male-enhancement-reviews-the-disturbing-biopeak-supplements-truth https://trybiopeakme.clubeo.com/calendar/2024/04/28/biopeak-male-enhancement-reviews-warning-important-information-no-one-will-tell-you https://trybiopeakme.clubeo.com/calendar/2024/04/28/biopeak-male-enhancement-reviews-truth-exposed-2024-biopeak-supplements-usa-for-men https://medium.com/@BiopeakMaleEnhancementBuyNow/biopeak-male-enhancement-reviews-revitalize-your-sexual-biopeak-supplements-health-with-1b0dcc117608 https://medium.com/@BiopeakMaleEnhancementBuyNow/biopeak-male-enhancement-reviews-warning-usa-ca-important-information-no-one-will-tell-you-f375f53b3cd9 https://medium.com/@BiopeakMaleEnhancementBuyNow/biopeak-male-enhancement-reviews-truth-exposed-2024-is-biopeak-supplements-it-scam-or-real-9b8fc49be4c3 https://medium.com/@BiopeakMaleEnhancementBuyNow/be-informed-biopeak-male-enhancement-reviews-on-scam-alert-this-enhancement-for-male-female-2d49c8f9ec17   Nexalyn Norway Official Links   https://www.facebook.com/NexalynInNorway/ https://www.facebook.com/NexalynNorway/ https://nexalyn-norway.company.site/ https://nexalyn-norway.jimdosite.com/ https://nexalyn-norway-1.jimdosite.com/   https://infogram.com/nexalyn-norway-reviews-advarsel-viktig-informasjon-ingen-vil-fortelle-deg-1h0n25oyjvynz4p?live https://medium.com/@NexalynNorway/nexalyn-norway-reviews-truth-exposed-2024-nexalyn-tablet-iceland-for-men-ad3f06ce6c83 https://medium.com/@NexalynNorway/nexalyn-norway-reviews-2024-er-nexalyn-tablet-iceland-lovlig-eller-svindel-ac2a9a8506d3 https://medium.com/@NexalynNorway/nexalyn-norway-reviews-revitalisere-din-nexalyn-tablet-seksuelle-helse-med-a0d44852760c https://bonniedgrafh.clubeo.com/calendar/2024/04/26/nexalyn-norway-reviews-does-it-really-work https://bonniedgrafh.clubeo.com/calendar/2024/04/26/nexalyn-norway-reviews-revitalisere-din-nexalyn-tablet-seksuelle-helse-med https://bonniedgrafh.clubeo.com/calendar/2024/04/27/nexalyn-norway-reviews-advarsel-viktig-informasjon-ingen-vil-fortelle-deg https://bonniedgrafh.clubeo.com/calendar/2024/04/26/nexalyn-norway-reviews-testo-booster-pills-real-buyers-alert https://medium.com/@NexalynNorway/v%C3%A6r-informert-nexalyn-norway-reviews-om-svindelvarsel-denne-forbedringen-for-mannlig-og-kvinnelig-f52047570116
    • WELCOME TO THE BOXID MARKETPLACE THE BOXID is the best place to buy accounts in bulk. Also on THE BOXID there are any services for digital marketing and arbitrage! We offer cheap accounts and provide flexible prices, discounts and bonuses for loyal customers. If you want to make a bulk order, specify the quantity of items in the checkout form or contact our manager and ask for help with your bulk purchase. We sell social media at the most affordable price! https://theboxid.com/category/accounts/
    • Hello, I am adapting it to acis 401, and when I run it in the game it tells me: No rights defined for admin command 'admin_search'. Admin tried to use admin command 'admin_search', but has no access to use it.   Also try to adapt it in AdminAdmin.java with else in the last lines using it as admin_buscar (buscar = search in spanish) and I get the same error: No rights defined for admin command 'admin_buscar'. Admin tried to use admin command 'admin_search', but has no access to use it. I have the AdminSearch.java like this: package net.sf.l2j.gameserver.handler.admincommandhandlers; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; import net.sf.l2j.commons.lang.StringUtil; import net.sf.l2j.commons.math.MathUtil; import net.sf.l2j.gameserver.data.xml.ItemData; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.WorldObject; import net.sf.l2j.gameserver.model.actor.Player; import net.sf.l2j.gameserver.model.item.kind.Item; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; public class AdminSearch implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "admin_search" }; private static final int PAGE_LIMIT = 15; @Override public void useAdminCommand(String command, Player activeChar) { if (command.startsWith("admin_search")) { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); if (!st.hasMoreTokens()) { final NpcHtmlMessage html = new NpcHtmlMessage(0); html.setFile("data/html/admin/search.htm"); html.replace("%items%", ""); html.replace("%pages%", ""); activeChar.sendPacket(html); } else { final String item = st.nextToken(); int page = 1; if (st.hasMoreTokens()) { try { page = Integer.parseInt(st.nextToken()); } catch (NumberFormatException e) { page = 1; } } results(activeChar, item, page); } } return; } private static void results(Player activeChar, String item, int page) { final NpcHtmlMessage html = new NpcHtmlMessage(0); html.setFile("data/html/admin/search.htm"); //List<Item> items = new ArrayList<>();//no sirvio List<Object> items = Arrays.asList(ItemData.getInstance().getAllItems()); for (Object itemName : items) if (itemName != null) if (((WorldObject) itemName).getName().toLowerCase().contains(item.toLowerCase())) items.add(itemName); if (items.isEmpty()) { html.replace("%items%", "<tr><td>No items found with word " + item + ".</td></tr>"); html.replace("%pages%", ""); activeChar.sendPacket(html); return; } final int max = Math.min(100, MathUtil.countPagesNumber(items.size(), PAGE_LIMIT)); items = items.subList((page - 1) * PAGE_LIMIT, Math.min(page * PAGE_LIMIT, items.size())); final StringBuilder sb = new StringBuilder(); for (Object itemName : items) { String actualName = getFontedWord(item, ((WorldObject) itemName).getName()); StringUtil.append(sb, "<tr><td>", actualName, " (", ((Item) itemName).getItemId(), ")", "</td></tr>"); } html.replace("%items%", sb.toString()); sb.setLength(0); for (int i = 0; i < max; i++) { final int pagenr = i + 1; if (page == pagenr) StringUtil.append(sb, pagenr, "&nbsp;"); else StringUtil.append(sb, "<a action=\"bypass -h admin_search ", item, " ", pagenr, "\">", pagenr, "</a>&nbsp;"); } html.replace("%pages%", sb.toString()); activeChar.sendPacket(html); } private static String getFontedWord(String word, String tt) { int position = tt.toLowerCase().indexOf(word.toLowerCase()); StringBuilder str = new StringBuilder(tt); String font = "<FONT COLOR=\"LEVEL\">"; str.insert(position, font); str.insert(position + (font.length() + word.length()), "</FONT>"); return str.toString(); } @Override public String[] getAdminCommandList() { return ADMIN_COMMANDS; } } Can someone give me a hand and tell me what I'm doing wrong?  
  • Topics

×
×
  • Create New...