Jump to content

Acis Coupons + Redeem


Recommended Posts

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:

  1. Every player can get a coupon.
  2. Coupons have categories : Silver,Gold,Platinum
  3. Each category has its own reward list (configurable)
  4. Coupons can be deleted , redeemed  and show their rewards by writting /coupons
  5. You will win a random reward based on coupon's category and grade type
  6. Create your own condition and add a new coupon to this player.
  7. 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
  8. Players have daily limit.
  9. 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

 

 

DROP TABLE IF EXISTS `coupons`;
CREATE TABLE `coupons` (
  `owner_objid` int(10) DEFAULT NULL,
  `coupon_id` int(11) NOT NULL DEFAULT '0',
  `coupon_category` varchar(45) DEFAULT NULL,
  `grade` tinyint(3) NOT NULL DEFAULT '0',
  PRIMARY KEY (`coupon_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 
ALTER TABLE `characters` ADD COLUMN `couponsused` tinyint(3) NOT NULL DEFAULT 0 AFTER `death_penalty_level`;
 

 

 

 

Player configs:

 

 

# Maximum coupons per day (0 = disalbe)
# This limit will be lifted at the time you will set in ResetCouponsLimitAt config
CouponsLimit = 5
 
# Time for the daily lift (default 00:00)
ResetCouponsLimitAt = 00:00

 

 

 

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
Edited by melron
  • Upvote 5
Link to comment
Share on other sites

Not bad idea, sort of lucky wheel :P

 

To make it more complete create an item which could be droppable from a Rb, let's say, and this item will generate the coupon code, else some exchange option, x item for the coupon code. :)

Edited by SweeTs
Link to comment
Share on other sites

- Rewards should be handled by a static map <String, List<CouponReward>> (basically a map with 3 entries), where string is the type of coupon. Your coupon will only stores coupon type (gold, silver,...) and not rewards.

- CouponManager coupons List can't be an ArrayList, you will get ConcurrentException. Either use ConcurrentHashMap, or CopyOnWriteArrayList (which is really horrible on .set()).

- final String DELETE_COUPON = "DELETE FROM coupons where coupon_id = ?"; and all other queries must be private static final and set out of the method (or at least passed directly the parameter in prepareStatement).

- getCouponId : use Rnd from commons package, and not Random. The method probably can be cleanup by a lot (using StringUtil.LETTERS_AND_DIGITS) and a scramble method.

 

The whole reward acquisition should be reworked. The basic concept is, your coupon is linked to a RewardType (SILVER, etc), your reward map .get( retrieve all possible rewards. Then you only need to Rnd.get(rewards) to retrieve the associated reward.

 

Atm you pass all possible rewards on each coupon, which is totally uneeded and generate a lot of pointless data. The whole bypass "redeem" needs to be reviewed too.

 

PS : if you want to enforce the coupon type, you can create RewardType enum, and store rewards under an EnumMap rather than a HashMap <String, List<CouponReward>>.

PS2 : at least you thought about coupon id already existing, good job :).

Edited by Tryskell
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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!

 

Simply share it under a v1, v2 model with a little changeset for each version.

 

The only real serious problem impacting the stability of your custom is the ConcurrentException if numerous players got/remove coupons in same time. Use ConcurrentHashMap.newKeySet() to handle it properly. Other changes are readability, performance and optimization.

Edited by Tryskell
Link to comment
Share on other sites

Some comments.

  • Why are you returning null instead of empty list when a list is empty? It is easier and safer to handle empty lists than null statements that throw NPEs

 

Nice try overall. Thanks for the share.

 

I don't agree with this, empty lists, empty string etc have terrible performance, I always go with null checks, NPE means bad code that should be fixed not handled, imho NPE should be an Error and not an exception

Link to comment
Share on other sites

Your opinion versus the whole internet.

 

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

Edited by xxdem
Link to comment
Share on other sites

Why you even share it for free? I mean, you probably spent time on this, maybe even much time.

By the video i see its a unique idea, never seen something on other servers.

 

You probably should fix all the code the guys mentioned above and try to sell it.

because community is in need of new things i guess. It's a good idea to make new shares like old times.

Link to comment
Share on other sites

Why you even share it for free? I mean, you probably spent time on this, maybe even much time.

By the video i see its a unique idea, never seen something on other servers.

 

You probably should fix all the code the guys mentioned above and try to sell it.

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!

Edited by melron
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

    • abortion pills online in Doha Qatar +27791653574 Buy Pills now  +27791653574 abortion pills for sale Doha Qatar Text NowAbortion Clinic Doha Qatar +27791653574 Pregnancy Termination  clinic around Doha Qatar Cytotec 200 mcg price in Doha Qatar +27791653574 contact us now | +27791653574 Breeky Tablets in Doha Qatar Know price/cost  Abortion pills in Doha Qatar | +27791653574 WhatsApp Us Now Abortion pills online in Doha Qatar Breeky tablets for sale in Doha Qatar Cytotec 200 mcg Misoprostol for sale in Doha Qatar Whatever your circumstances, its your right to terminate up 24 weeks into the pregnancy. It’s entirely your decision. And if its something you want to do, rest assured that its legal in Abu Dhabi to have an abortion Marina Whatsapp  Remember abortion is legal in Doha Qatar  so there is no reason to ever visit an illegal service provider. If you have passed the 24 weeks mark, there are other options available to you which we will talk you through and help you to understand. We are here to support you, whatever choice you make about your pregnancy, so you never have to feel alone, we offer safe abortion ( also called termination of pregnancy TOP) for women who are up to 24 weeks pregnant. Depending on the gestation (stage of the pregnancy), we have two services available the medical process (often called the abortion pill) and the surgical procedure (a minor same day surgical treatment.) Our nurses and Doctors are accredited professionals and experts in reproductive healthcare. Our work is strictly governed the choice on termination of pregnancy and we adhere to World health Organisation Guidelines. Safe abortion or termination of pregnancy (TOP) is when a pregnancy is terminated in its early stage before it results into the birth of a child. Abortion may be performed in two different ways. Medical Abortion This is when abortion pills will be swallowed to end the pregnancy Surgical Abortion This is when instruments will be used to remove the foetus. If both abortion procedures are done by a qualified abortion doctor with medical guidance, there is no way it will affect your fertility. How is a safe abortion done On your first visit to our clinic, counselling will be provided and this is optional. Safe abortion The doctor will perform a pregnancy test to confirm the weeks and explain to you in detailed how the safe abortion procedure will be done and how to take care of yourself after the abortion. Side effects of medical safe abortion You will experience cramping like period pains You might vomit Feel Nausea Get a running stomach Experience some bit of fatigue The bleeding might start 2 hours after using the second pills. abortion in Doha Al Bidda Al Dafna Ad Dawhah al Jadidah Al Egla Al HilalAl Jasrah Al Kharayej Al Khulaifat Al MansouraAl Markhiya A l MessilaAl MirqabAl Najada Al Qassar Al Rufaa Al Sadd Al Souq Al Tarfa Al Thumama Barahat Al Jufairi Dahl Al Hamam Doha International Airport Doha Port Duhail Fereej Abdel Aziz Fereej Al Asmakh Fereej Al Nasr Fereej Bin Durham Fereej Bin Mahmoud Fereej Bin Omran Fereej Kulaib Fereej Mohammed Bin Jasim Hamad Medical City Hazm Al Markhiya Industrial AreaJ abal Thuaileb Jelaiah Jeryan Nejaima Lejbailat Lekhwair Leqtaifiya Madinat Khalifa North Madinat Khalifa South Musheireb Najma New Al Hitmi New Al Mirqab New Salata Nuaija Old Airport Old Al Ghanim Old Al Hitmi Old Salata Onaiza Ras Abu Aboud Ras Abu Fontas Rawdat Al Khail Rumeilah Umm Ghuwailina Umm Lekhba Wadi Al BanatWadi Al SailWest Bay
    • abortion pills online in Doha Qatar +27791653574 Buy Pills now  +27791653574 abortion pills for sale Doha Qatar Text NowAbortion Clinic Doha Qatar +27791653574 Pregnancy Termination  clinic around Doha Qatar Cytotec 200 mcg price in Doha Qatar +27791653574 contact us now | +27791653574 Breeky Tablets in Doha Qatar Know price/cost  Abortion pills in Doha Qatar | +27791653574 WhatsApp Us Now Abortion pills online in Doha Qatar Breeky tablets for sale in Doha Qatar Cytotec 200 mcg Misoprostol for sale in Doha Qatar Whatever your circumstances, its your right to terminate up 24 weeks into the pregnancy. It’s entirely your decision. And if its something you want to do, rest assured that its legal in Abu Dhabi to have an abortion Marina Whatsapp  Remember abortion is legal in Doha Qatar  so there is no reason to ever visit an illegal service provider. If you have passed the 24 weeks mark, there are other options available to you which we will talk you through and help you to understand. We are here to support you, whatever choice you make about your pregnancy, so you never have to feel alone, we offer safe abortion ( also called termination of pregnancy TOP) for women who are up to 24 weeks pregnant. Depending on the gestation (stage of the pregnancy), we have two services available the medical process (often called the abortion pill) and the surgical procedure (a minor same day surgical treatment.) Our nurses and Doctors are accredited professionals and experts in reproductive healthcare. Our work is strictly governed the choice on termination of pregnancy and we adhere to World health Organisation Guidelines. Safe abortion or termination of pregnancy (TOP) is when a pregnancy is terminated in its early stage before it results into the birth of a child. Abortion may be performed in two different ways. Medical Abortion This is when abortion pills will be swallowed to end the pregnancy Surgical Abortion This is when instruments will be used to remove the foetus. If both abortion procedures are done by a qualified abortion doctor with medical guidance, there is no way it will affect your fertility. How is a safe abortion done On your first visit to our clinic, counselling will be provided and this is optional. Safe abortion The doctor will perform a pregnancy test to confirm the weeks and explain to you in detailed how the safe abortion procedure will be done and how to take care of yourself after the abortion. Side effects of medical safe abortion You will experience cramping like period pains You might vomit Feel Nausea Get a running stomach Experience some bit of fatigue The bleeding might start 2 hours after using the second pills. abortion in Doha Al Bidda Al Dafna Ad Dawhah al Jadidah Al Egla Al HilalAl Jasrah Al Kharayej Al Khulaifat Al MansouraAl Markhiya A l MessilaAl MirqabAl Najada Al Qassar Al Rufaa Al Sadd Al Souq Al Tarfa Al Thumama Barahat Al Jufairi Dahl Al Hamam Doha International Airport Doha Port Duhail Fereej Abdel Aziz Fereej Al Asmakh Fereej Al Nasr Fereej Bin Durham Fereej Bin Mahmoud Fereej Bin Omran Fereej Kulaib Fereej Mohammed Bin Jasim Hamad Medical City Hazm Al Markhiya Industrial AreaJ abal Thuaileb Jelaiah Jeryan Nejaima Lejbailat Lekhwair Leqtaifiya Madinat Khalifa North Madinat Khalifa South Musheireb Najma New Al Hitmi New Al Mirqab New Salata Nuaija Old Airport Old Al Ghanim Old Al Hitmi Old Salata Onaiza Ras Abu Aboud Ras Abu Fontas Rawdat Al Khail Rumeilah Umm Ghuwailina Umm Lekhba Wadi Al BanatWadi Al SailWest Bay
    • abortion pills online in Doha Qatar +27791653574 Buy Pills now  +27791653574 abortion pills for sale Doha Qatar Text NowAbortion Clinic Doha Qatar +27791653574 Pregnancy Termination  clinic around Doha Qatar Cytotec 200 mcg price in Doha Qatar +27791653574 contact us now | +27791653574 Breeky Tablets in Doha Qatar Know price/cost  Abortion pills in Doha Qatar | +27791653574 WhatsApp Us Now Abortion pills online in Doha Qatar Breeky tablets for sale in Doha Qatar Cytotec 200 mcg Misoprostol for sale in Doha Qatar Whatever your circumstances, its your right to terminate up 24 weeks into the pregnancy. It’s entirely your decision. And if its something you want to do, rest assured that its legal in Abu Dhabi to have an abortion Marina Whatsapp  Remember abortion is legal in Doha Qatar  so there is no reason to ever visit an illegal service provider. If you have passed the 24 weeks mark, there are other options available to you which we will talk you through and help you to understand. We are here to support you, whatever choice you make about your pregnancy, so you never have to feel alone, we offer safe abortion ( also called termination of pregnancy TOP) for women who are up to 24 weeks pregnant. Depending on the gestation (stage of the pregnancy), we have two services available the medical process (often called the abortion pill) and the surgical procedure (a minor same day surgical treatment.) Our nurses and Doctors are accredited professionals and experts in reproductive healthcare. Our work is strictly governed the choice on termination of pregnancy and we adhere to World health Organisation Guidelines. Safe abortion or termination of pregnancy (TOP) is when a pregnancy is terminated in its early stage before it results into the birth of a child. Abortion may be performed in two different ways. Medical Abortion This is when abortion pills will be swallowed to end the pregnancy Surgical Abortion This is when instruments will be used to remove the foetus. If both abortion procedures are done by a qualified abortion doctor with medical guidance, there is no way it will affect your fertility. How is a safe abortion done On your first visit to our clinic, counselling will be provided and this is optional. Safe abortion The doctor will perform a pregnancy test to confirm the weeks and explain to you in detailed how the safe abortion procedure will be done and how to take care of yourself after the abortion. Side effects of medical safe abortion You will experience cramping like period pains You might vomit Feel Nausea Get a running stomach Experience some bit of fatigue The bleeding might start 2 hours after using the second pills. abortion in Doha Al Bidda Al Dafna Ad Dawhah al Jadidah Al Egla Al HilalAl Jasrah Al Kharayej Al Khulaifat Al MansouraAl Markhiya A l MessilaAl MirqabAl Najada Al Qassar Al Rufaa Al Sadd Al Souq Al Tarfa Al Thumama Barahat Al Jufairi Dahl Al Hamam Doha International Airport Doha Port Duhail Fereej Abdel Aziz Fereej Al Asmakh Fereej Al Nasr Fereej Bin Durham Fereej Bin Mahmoud Fereej Bin Omran Fereej Kulaib Fereej Mohammed Bin Jasim Hamad Medical City Hazm Al Markhiya Industrial AreaJ abal Thuaileb Jelaiah Jeryan Nejaima Lejbailat Lekhwair Leqtaifiya Madinat Khalifa North Madinat Khalifa South Musheireb Najma New Al Hitmi New Al Mirqab New Salata Nuaija Old Airport Old Al Ghanim Old Al Hitmi Old Salata Onaiza Ras Abu Aboud Ras Abu Fontas Rawdat Al Khail Rumeilah Umm Ghuwailina Umm Lekhba Wadi Al BanatWadi Al SailWest Bay
    • abortion pills online in Doha Qatar +27791653574 Buy Pills now  +27791653574 abortion pills for sale Doha Qatar Text NowAbortion Clinic Doha Qatar +27791653574 Pregnancy Termination  clinic around Doha Qatar Cytotec 200 mcg price in Doha Qatar +27791653574 contact us now | +27791653574 Breeky Tablets in Doha Qatar Know price/cost  Abortion pills in Doha Qatar | +27791653574 WhatsApp Us Now Abortion pills online in Doha Qatar Breeky tablets for sale in Doha Qatar Cytotec 200 mcg Misoprostol for sale in Doha Qatar Whatever your circumstances, its your right to terminate up 24 weeks into the pregnancy. It’s entirely your decision. And if its something you want to do, rest assured that its legal in Abu Dhabi to have an abortion Marina Whatsapp  Remember abortion is legal in Doha Qatar  so there is no reason to ever visit an illegal service provider. If you have passed the 24 weeks mark, there are other options available to you which we will talk you through and help you to understand. We are here to support you, whatever choice you make about your pregnancy, so you never have to feel alone, we offer safe abortion ( also called termination of pregnancy TOP) for women who are up to 24 weeks pregnant. Depending on the gestation (stage of the pregnancy), we have two services available the medical process (often called the abortion pill) and the surgical procedure (a minor same day surgical treatment.) Our nurses and Doctors are accredited professionals and experts in reproductive healthcare. Our work is strictly governed the choice on termination of pregnancy and we adhere to World health Organisation Guidelines. Safe abortion or termination of pregnancy (TOP) is when a pregnancy is terminated in its early stage before it results into the birth of a child. Abortion may be performed in two different ways. Medical Abortion This is when abortion pills will be swallowed to end the pregnancy Surgical Abortion This is when instruments will be used to remove the foetus. If both abortion procedures are done by a qualified abortion doctor with medical guidance, there is no way it will affect your fertility. How is a safe abortion done On your first visit to our clinic, counselling will be provided and this is optional. Safe abortion The doctor will perform a pregnancy test to confirm the weeks and explain to you in detailed how the safe abortion procedure will be done and how to take care of yourself after the abortion. Side effects of medical safe abortion You will experience cramping like period pains You might vomit Feel Nausea Get a running stomach Experience some bit of fatigue The bleeding might start 2 hours after using the second pills. abortion in Doha Al Bidda Al Dafna Ad Dawhah al Jadidah Al Egla Al HilalAl Jasrah Al Kharayej Al Khulaifat Al MansouraAl Markhiya A l MessilaAl MirqabAl Najada Al Qassar Al Rufaa Al Sadd Al Souq Al Tarfa Al Thumama Barahat Al Jufairi Dahl Al Hamam Doha International Airport Doha Port Duhail Fereej Abdel Aziz Fereej Al Asmakh Fereej Al Nasr Fereej Bin Durham Fereej Bin Mahmoud Fereej Bin Omran Fereej Kulaib Fereej Mohammed Bin Jasim Hamad Medical City Hazm Al Markhiya Industrial AreaJ abal Thuaileb Jelaiah Jeryan Nejaima Lejbailat Lekhwair Leqtaifiya Madinat Khalifa North Madinat Khalifa South Musheireb Najma New Al Hitmi New Al Mirqab New Salata Nuaija Old Airport Old Al Ghanim Old Al Hitmi Old Salata Onaiza Ras Abu Aboud Ras Abu Fontas Rawdat Al Khail Rumeilah Umm Ghuwailina Umm Lekhba Wadi Al BanatWadi Al SailWest Bay
    • abortion pills online in Doha Qatar +27791653574 Buy Pills now  +27791653574 abortion pills for sale Doha Qatar Text NowAbortion Clinic Doha Qatar +27791653574 Pregnancy Termination  clinic around Doha Qatar Cytotec 200 mcg price in Doha Qatar +27791653574 contact us now | +27791653574 Breeky Tablets in Doha Qatar Know price/cost  Abortion pills in Doha Qatar | +27791653574 WhatsApp Us Now Abortion pills online in Doha Qatar Breeky tablets for sale in Doha Qatar Cytotec 200 mcg Misoprostol for sale in Doha Qatar Whatever your circumstances, its your right to terminate up 24 weeks into the pregnancy. It’s entirely your decision. And if its something you want to do, rest assured that its legal in Abu Dhabi to have an abortion Marina Whatsapp  Remember abortion is legal in Doha Qatar  so there is no reason to ever visit an illegal service provider. If you have passed the 24 weeks mark, there are other options available to you which we will talk you through and help you to understand. We are here to support you, whatever choice you make about your pregnancy, so you never have to feel alone, we offer safe abortion ( also called termination of pregnancy TOP) for women who are up to 24 weeks pregnant. Depending on the gestation (stage of the pregnancy), we have two services available the medical process (often called the abortion pill) and the surgical procedure (a minor same day surgical treatment.) Our nurses and Doctors are accredited professionals and experts in reproductive healthcare. Our work is strictly governed the choice on termination of pregnancy and we adhere to World health Organisation Guidelines. Safe abortion or termination of pregnancy (TOP) is when a pregnancy is terminated in its early stage before it results into the birth of a child. Abortion may be performed in two different ways. Medical Abortion This is when abortion pills will be swallowed to end the pregnancy Surgical Abortion This is when instruments will be used to remove the foetus. If both abortion procedures are done by a qualified abortion doctor with medical guidance, there is no way it will affect your fertility. How is a safe abortion done On your first visit to our clinic, counselling will be provided and this is optional. Safe abortion The doctor will perform a pregnancy test to confirm the weeks and explain to you in detailed how the safe abortion procedure will be done and how to take care of yourself after the abortion. Side effects of medical safe abortion You will experience cramping like period pains You might vomit Feel Nausea Get a running stomach Experience some bit of fatigue The bleeding might start 2 hours after using the second pills. abortion in Doha Al Bidda Al Dafna Ad Dawhah al Jadidah Al Egla Al HilalAl Jasrah Al Kharayej Al Khulaifat Al MansouraAl Markhiya A l MessilaAl MirqabAl Najada Al Qassar Al Rufaa Al Sadd Al Souq Al Tarfa Al Thumama Barahat Al Jufairi Dahl Al Hamam Doha International Airport Doha Port Duhail Fereej Abdel Aziz Fereej Al Asmakh Fereej Al Nasr Fereej Bin Durham Fereej Bin Mahmoud Fereej Bin Omran Fereej Kulaib Fereej Mohammed Bin Jasim Hamad Medical City Hazm Al Markhiya Industrial AreaJ abal Thuaileb Jelaiah Jeryan Nejaima Lejbailat Lekhwair Leqtaifiya Madinat Khalifa North Madinat Khalifa South Musheireb Najma New Al Hitmi New Al Mirqab New Salata Nuaija Old Airport Old Al Ghanim Old Al Hitmi Old Salata Onaiza Ras Abu Aboud Ras Abu Fontas Rawdat Al Khail Rumeilah Umm Ghuwailina Umm Lekhba Wadi Al BanatWadi Al SailWest Bay
  • Topics

×
×
  • Create New...