Jump to content

Recommended Posts

Posted (edited)

class 1 l2_merchant : merchant

{

parameter:

   string   fnHi = "l2r_shop_welcome.htm";

   int   donationCoin = 57;



   //clan donations

   int   costLevel3 = 1;

   int   costLevel4 = 1;

   int   costLevel5 = 1;

   int   costLevel6 = 1;

   int   costLevel7 = 1;

   int   costLevel8 = 1;



   //noble

   int   costNoble = 1;



   //wyvern

   //int   WyvernPrice = 1;



   // third class

   int   cost = 0;

   int   requiredLevel = 1;

   string   name = "do_not_meet_requirements_class.htm";









handler:

   EventHandler TALKED (talker)

   {

      myself::ShowPage (talker, fnHi);

      return;

   }



   EventHandler MENU_SELECTED (talker, i0, i1, i2, i4, ask, reply)

   {

      if (ask == -303)

      {

         super;

      }



      if (reply == 111)

      {

         if (talker.level <= 78 && talker.level >= 70)

         {

            myself::IncrementParam (talker, 0, 7000000);

            myself::IncrementParam (talker, 1, 7000000);

            myself::ShowPage (talker, fnHi);

            return;

         }

         else if (talker.level <= 70 && talker.level >= 50)

         {

            myself::IncrementParam (talker, 0, 1000000);

            myself::IncrementParam (talker, 1, 1000000);

            myself::ShowPage (talker, fnHi);

            return;

         }

         else if (talker.level <= 50 && talker.level >= 20)

         {

            myself::IncrementParam (talker, 0, 500000);

            myself::IncrementParam (talker, 1, 500000);

            myself::ShowPage (talker, fnHi);

            return;

         }

         else if (talker.level <= 20)

         {

            myself::IncrementParam (talker, 0, 50000);

            myself::IncrementParam (talker, 1, 50000);

            myself::ShowPage (talker, fnHi);

            return;

         }

      }

      if (reply == 222)

      {

         if (talker.level <= 78 && talker.level >= 70)

         {

            myself::IncrementParam (talker, 0, -7000000);

            myself::ShowPage (talker, fnHi);

            return;

         }

         else if (talker.level <= 70 && talker.level >= 50)

         {

            myself::IncrementParam (talker, 0, -1000000);

            myself::ShowPage (talker, fnHi);

            return;

         }

         else if (talker.level <= 50 && talker.level >= 20)

         {

            myself::IncrementParam (talker, 0, -500000);

            myself::ShowPage (talker, fnHi);

            return;

         }

         else if (talker.level <= 20 && talker.level >= 10)

         {

            myself::IncrementParam (talker, 0, -5000);

            myself::ShowPage (talker, fnHi);

            return;

         }

      }

      //ride wyvern

      //if (reply == 91)

      //{

      //    if( ( myself::OwnItemCount( talker, donationCoin ) >= WyvernPrice && talker.yongma_type == 1 ) && talker.strider_level >= 55 )

      //   {

      //     myself::DeleteItem1( talker, donationCoin, WyvernPrice );

      //     myself::RideWyvern( talker, 1012621 );

      //     myself::ShowPage (talker, fnHi);

      //   }

      //   else

      //   {

      //      myself::Say ("You must have be riding a level 55+ Strider to fly a Wyvern.");

      //      myself::ShowPage (talker, fnHi);

      //      return;

      //   }

      //}



      if (reply == 91)

      {

         if (talker.level >= requiredLevel)

            {

               if (myself::IsInCategory(7, talker.occupation))

               {

                  if (myself::OwnItemCount (talker, 57) >= cost)

                  {

                     //class change portion

                     if (talker.occupation == 2)

                     {

                        myself::ClassChange (talker, 88);

                     }

                     else if (talker.occupation == 3)

                     {

                        myself::ClassChange (talker, 89);

                     }

                     else if (talker.occupation == 5)

                     {

                        myself::ClassChange (talker, 90);

                     }

                     else if (talker.occupation == 6)

                     {

                        myself::ClassChange (talker, 91);

                     }

                     else if (talker.occupation == 9)

                     {

                        myself::ClassChange (talker, 92);

                     }

                     else if (talker.occupation == 8)

                     {

                        myself::ClassChange (talker, 93);

                     }

                     else if (talker.occupation == 12)

                     {

                        myself::ClassChange (talker, 94);

                     }

                     else if (talker.occupation == 13)

                     {

                        myself::ClassChange (talker, 95);

                     }

                     else if (talker.occupation == 14)

                     {

                        myself::ClassChange (talker, 96);

                     }

                     else if (talker.occupation == 16)

                     {

                        myself::ClassChange (talker, 97);

                     }

                     else if (talker.occupation == 17)

                     {

                        myself::ClassChange (talker, 98);

                     }

                     else if (talker.occupation == 20)

                     {

                        myself::ClassChange (talker, 99);

                     }

                     else if (talker.occupation == 21)

                     {

                        myself::ClassChange (talker, 100);

                     }

                     else if (talker.occupation == 23)

                     {

                        myself::ClassChange (talker, 101);

                     }

                     else if (talker.occupation == 24)

                     {

                        myself::ClassChange (talker, 102);

                     }

                     else if (talker.occupation == 27)

                     {

                        myself::ClassChange (talker, 103);

                     }

                     else if (talker.occupation == 28)

                     {

                        myself::ClassChange (talker, 104);

                     }

                     else if (talker.occupation == 30)

                     {

                        myself::ClassChange (talker, 105);

                     }

                     else if (talker.occupation == 33)

                     {

                        myself::ClassChange (talker, 106);

                     }

                     else if (talker.occupation == 34)

                     {

                        myself::ClassChange (talker, 107);

                     }

                     else if (talker.occupation == 36)

                     {

                        myself::ClassChange (talker, 108);

                     }

                     else if (talker.occupation == 37)

                     {

                        myself::ClassChange (talker, 109);

                     }

                     else if (talker.occupation == 40)

                     {

                        myself::ClassChange (talker, 110);

                     }

                     else if (talker.occupation == 41)

                     {

                        myself::ClassChange (talker, 111);

                     }

                     else if (talker.occupation == 43)

                     {

                        myself::ClassChange (talker, 112);

                     }

                     else if (talker.occupation == 46)

                     {

                        myself::ClassChange (talker, 113);

                     }

                     else if (talker.occupation == 48)

                     {

                        myself::ClassChange (talker, 114);

                     }

                     else if (talker.occupation == 51)

                     {

                        myself::ClassChange (talker, 115);

                     }

                     else if (talker.occupation == 52)

                     {

                        myself::ClassChange (talker, 116);

                     }

                     else if (talker.occupation == 55)

                     {

                        myself::ClassChange (talker, 117);

                     }

                     else if (talker.occupation == 57)

                     {

                        myself::ClassChange (talker, 118);

                     }

                     //end class change portion

                     myself::DeleteItem1 (talker, 57, cost);

                     myself::ShowPage (talker, fnHi);

                     myself::AddUseSkillDesire( talker, 1150209, 0, 0, 1000000 );

                     return;

                  }

               }

            }

            myself::ShowPage (talker, "do_not_meet_requirements_class.htm");

         }

      //clan donations

      if (ask == 41)

      {

         if (reply == 3)

         {

            i0 = costLevel3;

         }

         else if (reply == 4)

         {

            i0 = costLevel4;

         }

         else if (reply == 5)

         {

            i0 = costLevel5;

         }

         else if (reply == 6)

         {

            i0 = costLevel6;

         }

         else if (reply == 7)

         {

            i0 = costLevel7;

         }

         else if (reply == 8)

         {

            i0 = costLevel8;

         }

         if (myself::OwnItemCount (talker, donationCoin) >= i0)

         {

            if (talker.pledge_id != 0)

            {

               i1 = myself::GetPledgeSkillLevel(talker);

               if (i1 + 1 == reply)   //clan right level for choice selected

               {

                  myself::PledgeLevelUp (talker, reply);

                  myself::DeleteItem1 (talker, donationCoin, i0);

                  myself::SoundEffect( talker, "ItemSound.quest_fanfare_2" );

                  myself::ShowPage (talker, fnHi);

                  return;

               }

               else if (i1 + 1 > reply)   //clan too high of level

               {

                  myself::Say ("Sorry, " + talker.name + " your clan is already a higher level than the option you have selected.");

                  myself::ShowPage (talker, fnHi);

                  return;

               }

               else if (i1 + 1 < reply)   //clan too low of level

               {

                  myself::Say ("Sorry, " + talker.name + " your clan is too low for the option you have selected.");

                  myself::ShowPage (talker, fnHi);

                  return;

               }

            }

         }

         else

         {

         myself::ShowPage (talker, "do_not_meet_requirements.htm");

         return;

         }

      }



      // + 15 donations

      else if (ask == 200 || ask == 300 || ask == 400)

      {

         if (ask == 200)

         {

            if (myself::OwnItemCount (talker, donationCoin) < 25000)

            {

               return;

            }

            myself::DeleteItem1 (talker, donationCoin, 25000);

            myself::GiveItemEx (talker, reply, 15, 1);

            myself::Say ("+15 Has been created!");

            myself::ShowPage (talker, fnHi);

            return;

         }

         else if (ask == 300)

         {

            if (myself::OwnItemCount (talker, donationCoin) < 50000)

            {

               return;

            }

            myself::DeleteItem1 (talker, donationCoin, 50000);

            myself::GiveItemEx (talker, reply, 15, 1);

            myself::Say ("+15 Has been created!");

            myself::ShowPage (talker, fnHi);

            return;

         }

         else if (ask == 400)

         {

            if (myself::OwnItemCount (talker, donationCoin) < 100000)

            {

               return;

            }

            myself::DeleteItem1 (talker, donationCoin, 100000);

            myself::GiveItemEx (talker, reply, 15, 1);

            myself::Say ("+15 Has been created!");

            myself::ShowPage (talker, fnHi);

            return;

         }

         else

         {

            myself::Say ("Sorry " + talker.name + " but you don't have enough to buy that.");

            myself::ShowPage (talker, fnHi);

            return;

         }

      }

      //noblesse donation

      else if (reply == 1454) //ask == 78 && reply == 1

      {

         if (myself::OwnItemCount (talker, 5011) != 0)   //check star

         {

            if (myself::OwnItemCount (talker, donationCoin) >= costNoble)

            {

               if (talker.nobless_type < 1)   //check already noble

               {

                  if (myself::IsInCategory(@fourth_class_group, talker.occupation) ==1)   //check class

                  {

                     if (talker.level >= 76)   //check level

                     {

                        myself::SetNobless(talker);

                        myself::DeleteItem1 (talker, donationCoin, costNoble);

                        myself::GiveItem1(talker, 7694, 1);

                        myself::ShowPage (talker, fnHi);

                        myself::SoundEffect(talker, "ItemSound.quest_finish");

                        if (myself::HaveMemo (talker, 951) == 1)

                        {

                           myself::RemoveMemo(talker, 951);

                        }

                        return;

                     }

                     myself::Say ("Sorry, " + talker.name + " you must be level 76+ to become Noblesse.");

                     return;

                  }

                  myself::Say ("Sorry, " + talker.name + " you must be on Fourth class to become Noblesse.");

                  return;

               }

               myself::Say ("Sorry, " + talker.name + " you are already Noblesse.");

               return;

            }

            //myself::Say ("Sorry, " + talker.name + " you need more SoJ to become Noblesse.");

            return;

         }

         myself::Say ("Sorry, " + talker.name + " you need the star of Destiny to become Noblesse.");

         return;

      }



   }

}

The Code will:

Increase EXP (reply=111)

Decrease EXP (reply=222)

Sell any Multisells (ask=-303&reply=MULTISELLID)

Set final class change (reply=91) (gladiator -> duelist)

Increases Clan levels

Variable option to set cost item and cost amount

Edited by Mr.Parker
  • Upvote 1
Posted (edited)

Why no switchcase instead of this if else sled? xDD

the excuse which i always use...

"sry i started python as first language"  :dat:

 

So imma go like ... (y they are all if elif)

 

g5JbwgS.png

Edited by bravetobe
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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

    • My official facebook profile!: https://www.facebook.com/spectrumL2 Specifications: Revamped L2JACIS revision FROM the core Private project!!! Revision that has been receiving corrections for over 3 years!!! Events already installed in the revision: TVT CTF KTB PARTY FARM SPOIL EVENT CRAZY RATES TOURNAMENT TIME ZONE (INSTANCE) All working correctly!!! SIEGE ESSENTIAL FEATURES: Walls fix Gates fix Flags fix 100% functional: OLYMPIADS: Implemented settings Hero receives enchanted Weapons with equal status PvP Weapons Optional /true/false Hero can acquire all Hero Weapons Optional true/false OTHER IMPLEMENTATIONS: Teleport fixed (directly to Giran) Teleport effect classic Vip skins vip collor name Pack NPCs with effect already configured BOSES already configured Mobs already configured CLASS BALANCE SPECIAL SYSTEM We have a SPECIAL system developed for Class Balance with only 1 digit in XML %tage of configurable debuffs Player limitation system in BOSES or PvP zones BS blocking system in FLEG zones or events Among others dozens of improvements made in the review... price: 390 USD !  OBS: WE CAN CHANGE THE BANNER AND NAME OF THE SERVICE TO THE ONE OF YOUR PREFERENCE BUT THE SETTINGS MUST BE KEPT ANY CHANGES REQUIRE ADDITION        
    • Server is Online – 1,000+ Active Players! We’re excited to announce the addition of a Europe Proxy to improve connectivity for our EU players! Clans can now benefit from VIP Access to help you catch up faster. 🎯 If you're a clan leader with at least 9 active members, join our Discord and open a ticket to claim your VIP rewards!  
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock