quest rang_3 begin

   state start begin

      when login begin

         if pc.getqf("rang_sistem") == 0 then

            pc.changealignment(-pc.get_alignment()+2000)

         elseif pc.getqf("rang_sistem") == 1 then

            pc.changealignment(-pc.get_alignment()+6000)

         elseif pc.getqf("rang_sistem") == 2 then

            pc.changealignment(-pc.get_alignment()+10000)

         elseif pc.getqf("rang_sistem") == 3 then

            pc.changealignment(-pc.get_alignment()+14000)

         end

         loop_timer("rang_sistem", 30)

      end

      when rang_sistem.timer begin

         if pc.getqf("rang_sistem") == 0 then

            pc.changealignment(-pc.get_alignment()+2000)

         elseif pc.getqf("rang_sistem") == 1 then

            pc.changealignment(-pc.get_alignment()+6000)

         elseif pc.getqf("rang_sistem") == 2 then

            pc.changealignment(-pc.get_alignment()+10000)

         elseif pc.getqf("rang_sistem") == 3 then

            pc.changealignment(-pc.get_alignment()+14000)

         end

      end

      when login begin

         if pc.getqf("rang_sistem") == 0 then

            send_letter("PVP 2")

         end

         if pc.getqf("rang_sistem") == 1 then

            send_letter("PVP 3")

         end

         if pc.getqf("rang_sistem") == 2 then

            send_letter("ULTRA PVP")

         end

      end

      when info or button begin

         if pc.getqf("rang_sistem") == 0 then

            say_title("RANG - PVP 2")

            say("                                                   ")

            say("Odata cu rangul de PVP 2 vei primi 15% critica per-")

            say("manent. Pentru a avansa in rang ai nevoie de 20 de ")

            say_item_vnum(124400)

            say("")

            local rang1 = select ("Vreau PVP 2", "Nu am materialele...")

            if rang1 == 1 then

               if pc.count_item(124400) < 20 then

                  say_title("RANG - PVP 2")

                  say("                                                   ")

                  say("Nu ai materialele necesare, imi pare rau. Revin-o!")

                  say("")

                  send_letter("PVP 2")

                  return

               end

               say_title("RANG - PVP 2")

               say("                                                   ")

               say("Felicitari, ai avansat in rang cu succes!")

               say_galben("Ai primit PVP 2 si 15% critica permanent.")

               say("")

               pc.setqf("rang_sistem", 1)

               pc.remove_item(124400, 20)

               pc.changealignment(-pc.get_alignment()+2000)

               affect.add_collect(15,15,60*60*24*365*60)

               clear_letter("PVP 2")

               return

            end

            if rang1 == 2 then

               send_letter("PVP 2")

            end

         end

         if pc.getqf("rang_sistem") == 1 then

            say_title("RANG - PVP 3")

            say("                                                   ")

            say("Odata cu rangul de PVP 3 vei primi 15% patr. per-")

            say("manent. Pentru a avansa in rang ai nevoie de 20 de ")

            say_item_vnum(134400)

            say("")

            local rang2 = select ("Vreau PVP 3", "Nu am materialele...")

            if rang2 == 1 then

               if pc.count_item(134400) < 20 then

                  say_title("RANG - PVP 3")

                  say("                                                   ")

                  say("Nu ai materialele necesare, imi pare rau. Revin-o!")

                  say("")

                  send_letter("PVP 3")

                  return

               end

               say_title("RANG - PVP 3")

               say("                                                   ")

               say("Felicitari, ai avansat in rang cu succes!")

               say_galben("Ai primit PVP 3 si 15% patrunz. permanent.")

               say("")

               pc.setqf("rang_sistem", 2)

               pc.remove_item(134400, 20)

               pc.changealignment(-pc.get_alignment()+6000)

               affect.add_collect(16,15,60*60*24*365*60)

               clear_letter("PVP 3")

               return

            end

            if rang2 == 2 then

               send_letter("PVP 3")

            end

         end

         if pc.getqf("rang_sistem") == 2 then

            say_title("RANG - ULTRA PVP")

            say("                                                   ")

            say("Odata cu rangul de ULTRA PVP vei primi 2000HP si 10")

            say("semi-om. Pentru a avansa in rang ai nevoie de 20 de")

            say_item_vnum(144400)

            say("")

            local rang3 = select ("Vreau ULTRA PVP", "Nu am materialele...")

            if rang3 == 1 then

               if pc.count_item(144400) < 20 then

                  say_title("RANG - ULTRA PVP")

                  say("                                                   ")

                  say("Nu ai materialele necesare, imi pare rau. Revin-o!")

                  say("")

                  send_letter("ULTRA PVP")

                  return

               end

               say_title("RANG - ULTRA PVP")

               say("                                                   ")

               say("Felicitari, ai avansat in rang cu succes!")

               say_galben("Ai primit ULTRA PVP si 2000HP si 10 semi-om.")

               say("")

               pc.setqf("rang_sistem", 3)

               pc.remove_item(144400, 20)

               pc.changealignment(-pc.get_alignment()+10000)

               affect.add_collect(1,2000,60*60*24*365*60)

               affect.add_collect(17,10,60*60*24*365*60)

               clear_letter("ULTRA PVP")

               return

            end

            if rang3 == 2 then

               send_letter("ULTRA PVP")

            end

         end

      end

   end

end