daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Jun 8th, 2017 481 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #=#===========================================================================
  2. #=# Easy Questing System - made by M3rein
  3. #=#===========================================================================
  4. #=# Create your own quests starting from line 72. Be aware of the following:
  5. #=# * Every quest should have a unique ID;
  6. #=# * Every quest should be unique (at least one field has to be different);
  7. #=# * The "Name" field can't be very long;
  8. #=# * The "Desc" field can be quite long;
  9. #=# * The "NPC" field is JUST a name;
  10. #=# * The "Sprite" field is the name of the sprite in "Graphics/Characters";
  11. #=# * The "Location" field is JUST a name;
  12. #=# * The "Color" field is a SYMBOL (starts with ':'). List under "pbColor";
  13. #=# * The "Time" field can be a random string for it to be "?????" in-game;
  14. #=# * The "Completed" field can be pre-set, but is normally only changed in-game
  15. #=#===========================================================================
  16. class Quest
  17.   attr_accessor :id
  18.   attr_accessor :name
  19.   attr_accessor :desc
  20.   attr_accessor :npc
  21.   attr_accessor :sprite
  22.   attr_accessor :location
  23.   attr_accessor :color
  24.   attr_accessor :time
  25.   attr_accessor :completed
  26.   def initialize(id, name, desc, npc, sprite, location, color = :WHITE, time = Time.now, completed = false)
  27.     self.id = id
  28.     self.name = name
  29.     self.desc = desc
  30.     self.npc = npc
  31.     self.sprite = sprite
  32.     self.location = location
  33.     self.color = pbColor(color)
  34.     self.time = time
  35.     self.completed = completed
  36.   end
  37. end
  38.  
  39. def pbColor(color)
  40.   # Mix your own colors: http://www.rapidtables.com/web/color/RGB_Color.htm
  41.   return Color.new(0,0,0)         if color == :BLACK
  42.   return Color.new(255,115,115)   if color == :LIGHTRED
  43.   return Color.new(245,11,11)     if color == :RED
  44.   return Color.new(164,3,3)       if color == :DARKRED
  45.   return Color.new(47,46,46)      if color == :DARKGREY
  46.   return Color.new(100,92,92)     if color == :LIGHTGREY
  47.   return Color.new(226,104,250)   if color == :PINK
  48.   return Color.new(243,154,154)   if color == :PINKTWO
  49.   return Color.new(255,160,50)    if color == :GOLD
  50.   return Color.new(255,186,107)   if color == :LIGHTORANGE
  51.   return Color.new(95,54,6)       if color == :BROWN
  52.   return Color.new(122,76,24)     if color == :LIGHTBROWN
  53.   return Color.new(255,246,152)   if color == :LIGHTYELLOW
  54.   return Color.new(242,222,42)    if color == :YELLOW
  55.   return Color.new(80,111,6)      if color == :DARKGREEN
  56.   return Color.new(154,216,8)     if color == :GREEN
  57.   return Color.new(197,252,70)    if color == :LIGHTGREEN
  58.   return Color.new(74,146,91)     if color == :FADEDGREEN
  59.   return Color.new(6,128,92)      if color == :DARKLIGHTBLUE
  60.   return Color.new(18,235,170)    if color == :LIGHTBLUE
  61.   return Color.new(139,247,215)   if color == :SUPERLIGHTBLUE
  62.   return Color.new(35,203,255)    if color == :BLUE
  63.   return Color.new(3,44,114)      if color == :DARKBLUE
  64.   return Color.new(7,3,114)       if color == :SUPERDARKBLUE
  65.   return Color.new(63,6,121)      if color == :DARKPURPLE
  66.   return Color.new(113,16,209)    if color == :PURPLE
  67.   return Color.new(219,183,37)    if color == :ORANGE
  68.   return Color.new(255,255,255)
  69. end
  70.  
  71. QUESTS = [
  72. # Make sure you take into account all the information given at the top of this script.
  73. # You don't have to give the Quest a color - :SUPERLIGHTBLUE in this example. It will default to White.
  74.    Quest.new(1, "¿No huele un poco raro aquí?", "Busca a los pokemon que están ensuciando el apartamento", "Portero", "trchar039", "Apartamentos Miltos", :GREEN, Time.now, false),
  75. ]
  76.  
  77. class PokeBattle_Trainer
  78.   attr_accessor :quests
  79. end
  80.  
  81. def pbCompletedQuest?(id)
  82.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  83.   for i in 0...$Trainer.quests.size
  84.     return true if $Trainer.quests[i].completed && $Trainer.quests[i].id == id
  85.   end
  86.   return false
  87. end
  88.  
  89. def pbQuestlog
  90.   Questlog.new
  91. end
  92.  
  93. def pbAddQuest(id)
  94.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  95.   for q in QUESTS
  96.     $Trainer.quests << q if q.id == id
  97.   end
  98. end
  99.  
  100. def pbDeleteQuest(id)
  101.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  102.   for q in $Trainer.quests
  103.     $Trainer.quests.delete(q) if q.id == id
  104.   end
  105. end
  106.  
  107. def pbSetQuest(id, completed)
  108.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  109.   for q in $Trainer.quests
  110.     q.completed = completed if q.id == id
  111.   end
  112. end
  113.  
  114. def pbSetQuestName(id, name)
  115.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  116.   for q in $Trainer.quests
  117.     q.name = name if q.id == id
  118.   end
  119. end
  120.  
  121. def pbSetQuestDesc(id, desc)
  122.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  123.   for q in $Trainer.quests
  124.     q.desc = desc if q.id == id
  125.   end
  126. end
  127.  
  128. def pbSetQuestNPC(id, npc)
  129.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  130.   for q in $Trainer.quests
  131.     q.npc = npc if q.id == id
  132.   end
  133. end
  134.  
  135. def pbSetQuestNPCSprite(id, sprite)
  136.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  137.   for q in $Trainer.quests
  138.     q.sprite = sprite if q.id == id
  139.   end
  140. end
  141.  
  142. def pbSetQuestLocation(id, location)
  143.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  144.   for q in $Trainer.quests
  145.     q.location = location if q.id == id
  146.   end
  147. end
  148.  
  149. def pbSetQuestColor(id, color)
  150.   $Trainer.quests = [] if $Trainer.quests.class == NilClass
  151.   for q in $Trainer.quests
  152.     q.color = pbColor(color) if q.id == id
  153.   end
  154. end
  155.  
  156. class QuestSprite < IconSprite
  157.   attr_accessor :quest
  158. end
  159.  
  160. class Questlog
  161.   def initialize
  162.     $Trainer.quests = [] if $Trainer.quests.class == NilClass
  163.     @page = 0
  164.     @sel_one = 0
  165.     @sel_two = 0
  166.     @scene = 0
  167.     @mode = 0
  168.     @box = 0
  169.     @completed = []
  170.     @ongoing = []
  171.     for q in $Trainer.quests
  172.       @ongoing << q if !q.completed
  173.       @completed << q if q.completed
  174.     end
  175.     @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
  176.     @viewport.z = 99999
  177.     @sprites = {}
  178.     @sprites["main"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
  179.     @sprites["main"].z = 1
  180.     @sprites["main"].opacity = 0
  181.     @main = @sprites["main"].bitmap
  182.     pbSetSystemFont(@main)
  183.     pbDrawOutlineText(@main,0,2-178,512,384,"Quest Log",Color.new(255,255,255),Color.new(0,0,0),1)
  184.    
  185.     @sprites["bg0"] = IconSprite.new(0, 0, @viewport)
  186.     @sprites["bg0"].setBitmap("Graphics/Pictures/pokegearbg")
  187.     @sprites["bg0"].opacity = 0
  188.    
  189.     for i in 0..1
  190.       @sprites["btn#{i}"] = IconSprite.new(0, 0, @viewport)
  191.       @sprites["btn#{i}"].setBitmap("Graphics/Pictures/questBtn")
  192.       @sprites["btn#{i}"].x = 84
  193.       @sprites["btn#{i}"].y = 130 + 56 * i
  194.       @sprites["btn#{i}"].src_rect.height = (@sprites["btn#{i}"].bitmap.height / 2).round
  195.       @sprites["btn#{i}"].src_rect.y = i == 0 ? (@sprites["btn#{i}"].bitmap.height / 2).round : 0
  196.       @sprites["btn#{i}"].opacity = 0
  197.     end
  198.     pbDrawOutlineText(@main,0,142-178,512,384,"Ongoing: " + @ongoing.size.to_s,Color.new(255,255,255),Color.new(0,0,0),1)
  199.     pbDrawOutlineText(@main,0,198-178,512,384,"Completed: " + @completed.size.to_s,Color.new(255,255,255),Color.new(0,0,0),1)
  200.  
  201.     12.times do |i|
  202.       Graphics.update
  203.       @sprites["bg0"].opacity += 32 if i < 8
  204.       @sprites["btn0"].opacity += 32 if i > 3
  205.       @sprites["btn1"].opacity += 32 if i > 3
  206.       @sprites["main"].opacity += 64 if i > 7
  207.     end
  208.     pbUpdate
  209.   end
  210.  
  211.   def pbUpdate
  212.     @frame = 0
  213.     loop do
  214.       @frame += 1
  215.       Graphics.update
  216.       Input.update
  217.       if @scene == 0
  218.         break if Input.trigger?(Input::B)
  219.         pbList(@sel_one) if Input.trigger?(Input::C)
  220.         pbSwitch(:DOWN) if Input.trigger?(Input::DOWN)
  221.         pbSwitch(:UP) if Input.trigger?(Input::UP)
  222.       end
  223.       if @scene == 1
  224.         pbMain if Input.trigger?(Input::B)
  225.         pbMove(:DOWN) if Input.trigger?(Input::DOWN)
  226.         pbMove(:UP) if Input.trigger?(Input::UP)
  227.         pbLoad(0) if Input.trigger?(Input::C)
  228.         pbArrows
  229.       end
  230.       if @scene == 2
  231.         pbList(@sel_one) if Input.trigger?(Input::B)
  232.         pbChar if @frame == 6 || @frame == 12 || @frame == 18
  233.         pbLoad(1) if Input.trigger?(Input::RIGHT) && @page == 0
  234.         pbLoad(2) if Input.trigger?(Input::LEFT) && @page == 1
  235.       end
  236.       @frame = 0 if @frame == 18
  237.     end
  238.     pbEnd
  239.     pbDisposeSpriteHash(@sprites)
  240.     @viewport.dispose
  241.     pbWait(1)
  242.   end
  243.  
  244.   def pbArrows
  245.     if @frame == 2 || @frame == 4 || @frame == 14 || @frame == 16
  246.       @sprites["up"].y -= 1 rescue nil
  247.       @sprites["down"].y -= 1 rescue nil
  248.     elsif @frame == 6 || @frame == 8 || @frame == 10 || @frame == 12
  249.       @sprites["up"].y += 1 rescue nil
  250.       @sprites["down"].y += 1 rescue nil
  251.     end
  252.   end
  253.  
  254.   def pbLoad(page)
  255.     return if @mode == 0 ? @ongoing.size == 0 : @completed.size == 0
  256.     quest = @mode == 0 ? @ongoing[@sel_two] : @completed[@sel_two]
  257.     pbWait(1)
  258.     if page == 0
  259.       @scene = 2
  260.       @sprites["bg1"] = IconSprite.new(0, 0, @viewport)
  261.       @sprites["bg1"].setBitmap("Graphics/Pictures/questPage1")
  262.       @sprites["bg1"].opacity = 0
  263.       @sprites["pager"] = IconSprite.new(0, 0, @viewport)
  264.       @sprites["pager"].setBitmap("Graphics/Pictures/questPager")
  265.       @sprites["pager"].x = 442
  266.       @sprites["pager"].y = 3
  267.       @sprites["pager"].z = 1
  268.       @sprites["pager"].opacity = 0
  269.       8.times do
  270.         Graphics.update
  271.         @sprites["up"].opacity -= 32
  272.         @sprites["down"].opacity -= 32
  273.         @sprites["main"].opacity -= 32
  274.         @sprites["bg1"].opacity += 32
  275.         @sprites["pager"].opacity += 32
  276.         @sprites["char"].opacity -= 32 rescue nil
  277.         for i in 0...@ongoing.size
  278.           break if i > 5
  279.           @sprites["ongoing#{i}"].opacity -= 32 rescue nil
  280.         end
  281.         for i in 0...@completed.size
  282.           break if i > 5
  283.           @sprites["completed#{i}"].opacity -= 32 rescue nil
  284.         end
  285.       end
  286.       @sprites["up"].dispose
  287.       @sprites["down"].dispose
  288.       @sprites["char"] = IconSprite.new(0, 0, @viewport)
  289.       @sprites["char"].setBitmap("Graphics/Characters/#{quest.sprite}")
  290.       @sprites["char"].x = 62
  291.       @sprites["char"].y = 130
  292.       @sprites["char"].src_rect.height = (@sprites["char"].bitmap.height / 4).round
  293.       @sprites["char"].src_rect.width = (@sprites["char"].bitmap.width / 4).round
  294.       @sprites["char"].opacity = 0
  295.       @main.clear
  296.       @text.clear rescue nil
  297.       @text2.clear rescue nil
  298.       drawTextExMulti(@main,188,54,318,8,quest.desc,Color.new(255,255,255),Color.new(0,0,0))
  299.       pbDrawOutlineText(@main,188,162,512,384,"From " + quest.npc,Color.new(255,172,115),Color.new(0,0,0))
  300.       pbDrawOutlineText(@main,10,-178,512,384,quest.name,quest.color,Color.new(0,0,0))
  301.       if !quest.completed
  302.         pbDrawOutlineText(@main,8,136,512,384,"Not Completed",pbColor(:LIGHTRED),Color.new(0,0,0))
  303.       else
  304.         pbDrawOutlineText(@main,8,136,512,384,"Completed",pbColor(:LIGHTBLUE),Color.new(0,0,0))
  305.       end
  306.       10.times do |i|
  307.         Graphics.update
  308.         @sprites["main"].opacity += 32
  309.         @sprites["char"].opacity += 32 if i > 1
  310.       end
  311.     elsif page == 1
  312.       @page = 1
  313.       @sprites["bg2"] = IconSprite.new(0, 0, @viewport)
  314.       @sprites["bg2"].setBitmap("Graphics/Pictures/questPage1")
  315.       @sprites["bg2"].x = 512
  316.       @sprites["pager2"] = IconSprite.new(0, 0, @viewport)
  317.       @sprites["pager2"].setBitmap("Graphics/Pictures/questPager")
  318.       @sprites["pager2"].x = 474 + 512
  319.       @sprites["pager2"].y = 3
  320.       @sprites["pager2"].z = 1
  321.       @sprites["char2"].dispose rescue nil
  322.       @sprites["char2"] = IconSprite.new(0, 0, @viewport)
  323.       @sprites["char2"].setBitmap("Graphics/Characters/#{quest.sprite}")
  324.       @sprites["char2"].x = 62 + 512
  325.       @sprites["char2"].y = 130
  326.       @sprites["char2"].z = 1
  327.       @sprites["char2"].src_rect.height = (@sprites["char2"].bitmap.height / 4).round
  328.       @sprites["char2"].src_rect.width = (@sprites["char2"].bitmap.width / 4).round
  329.       @sprites["text2"] = IconSprite.new(@viewport)
  330.       @sprites["text2"].bitmap = Bitmap.new(Graphics.width,Graphics.height)
  331.       @text2 = @sprites["text2"].bitmap
  332.       pbSetSystemFont(@text2)
  333.       pbDrawOutlineText(@text2,188,-122,512,384,"Quest received in:",Color.new(255,255,255),Color.new(0,0,0))
  334.       pbDrawOutlineText(@text2,188,-94,512,384,quest.location,Color.new(255,172,115),Color.new(0,0,0))
  335.       pbDrawOutlineText(@text2,188,-62,512,384,"Quest received at:",Color.new(255,255,255),Color.new(0,0,0))
  336.       time = quest.time.to_s
  337.       txt = time.split(' ')[1] + " " + time.split(' ')[2] + ", " + time.split(' ')[3].split(':')[0] + ":" + time.split(' ')[3].split(':')[1] rescue "?????"
  338.       pbDrawOutlineText(@text2,188,-36,512,384,txt,Color.new(255,172,115),Color.new(0,0,0))
  339.       pbDrawOutlineText(@text2,188,-4,512,384,"Quest received from:",Color.new(255,255,255),Color.new(0,0,0))
  340.       pbDrawOutlineText(@text2,188,22,512,384,quest.npc,Color.new(255,172,115),Color.new(0,0,0))
  341.       pbDrawOutlineText(@text2,188,162,512,384,"From " + quest.npc,Color.new(255,172,115),Color.new(0,0,0))
  342.       pbDrawOutlineText(@text2,10,-178,512,384,quest.name,quest.color,Color.new(0,0,0))
  343.       if !quest.completed
  344.         pbDrawOutlineText(@text2,8,136,512,384,"Not Completed",pbColor(:LIGHTRED),Color.new(0,0,0))
  345.       else
  346.         pbDrawOutlineText(@text2,8,136,512,384,"Completed",pbColor(:LIGHTBLUE),Color.new(0,0,0))
  347.       end
  348.       @sprites["text2"].x = 512
  349.       16.times do
  350.         Graphics.update
  351.         @sprites["bg1"].x -= (@sprites["bg1"].x + 526) * 0.2
  352.         @sprites["pager"].x -= (@sprites["pager"].x + 526) * 0.2 rescue nil
  353.         @sprites["char"].x -= (@sprites["char"].x + 526) * 0.2 rescue nil
  354.         @sprites["main"].x -= (@sprites["main"].x + 526) * 0.2
  355.         @sprites["text"].x -= (@sprites["text"].x + 526) * 0.2 rescue nil
  356.         @sprites["bg2"].x -= (@sprites["bg2"].x + 14) * 0.2
  357.         @sprites["pager2"].x -= (@sprites["pager2"].x - 459) * 0.2
  358.         @sprites["text2"].x -= (@sprites["text2"].x + 14) * 0.2
  359.         @sprites["char2"].x -= (@sprites["char2"].x - 47) * 0.2
  360.       end
  361.       @sprites["main"].x = 0
  362.       @main.clear
  363.     else
  364.       @page = 0
  365.       @sprites["bg1"] = IconSprite.new(0, 0, @viewport)
  366.       @sprites["bg1"].setBitmap("Graphics/Pictures/questPage1")
  367.       @sprites["bg1"].x = -512
  368.       @sprites["pager"] = IconSprite.new(0, 0, @viewport)
  369.       @sprites["pager"].setBitmap("Graphics/Pictures/questPager")
  370.       @sprites["pager"].x = 442 - 512
  371.       @sprites["pager"].y = 3
  372.       @sprites["pager"].z = 1
  373.       @sprites["text"] = IconSprite.new(@viewport)
  374.       @sprites["text"].bitmap = Bitmap.new(Graphics.width,Graphics.height)
  375.       @text = @sprites["text"].bitmap
  376.       pbSetSystemFont(@text)
  377.       @sprites["char"].dispose rescue nil
  378.       @sprites["char"] = IconSprite.new(0, 0, @viewport)
  379.       @sprites["char"].setBitmap("Graphics/Characters/#{quest.sprite}")
  380.       @sprites["char"].x = 62 - 512
  381.       @sprites["char"].y = 130
  382.       @sprites["char"].z = 1
  383.       @sprites["char"].src_rect.height = (@sprites["char"].bitmap.height / 4).round
  384.       @sprites["char"].src_rect.width = (@sprites["char"].bitmap.width / 4).round
  385.       drawTextExMulti(@text,188,54,318,8,quest.desc,Color.new(255,255,255),Color.new(0,0,0))
  386.       pbDrawOutlineText(@text,188,162,512,384,"From " + quest.npc,Color.new(255,172,115),Color.new(0,0,0))
  387.       pbDrawOutlineText(@text,10,-178,512,384,quest.name,quest.color,Color.new(0,0,0))
  388.       if !quest.completed
  389.         pbDrawOutlineText(@text,8,136,512,384,"Not Completed",pbColor(:LIGHTRED),Color.new(0,0,0))
  390.       else
  391.         pbDrawOutlineText(@text,8,136,512,384,"Completed",pbColor(:LIGHTBLUE),Color.new(0,0,0))
  392.       end
  393.       @sprites["text"].x = -512
  394.       16.times do
  395.         Graphics.update
  396.         @sprites["bg1"].x -= (@sprites["bg1"].x - 14) * 0.2
  397.         @sprites["pager"].x -= (@sprites["pager"].x - 457) * 0.2
  398.         @sprites["bg2"].x -= (@sprites["bg2"].x - 526) * 0.2
  399.         @sprites["pager2"].x -= (@sprites["pager2"].x - 526) * 0.2
  400.         @sprites["char2"].x -= (@sprites["char2"].x - 526) * 0.2
  401.         @sprites["text2"].x -= (@sprites["text2"].x - 526) * 0.2
  402.         @sprites["text"].x -= (@sprites["text"].x - 15) * 0.2
  403.         @sprites["char"].x -= (@sprites["char"].x - 76) * 0.2
  404.       end
  405.     end
  406.   end
  407.  
  408.   def pbChar
  409.     @sprites["char"].src_rect.x += (@sprites["char"].bitmap.width / 4).round rescue nil
  410.     @sprites["char"].src_rect.x = 0 if @sprites["char"].src_rect.x >= @sprites["char"].bitmap.width rescue nil
  411.     @sprites["char2"].src_rect.x += (@sprites["char2"].bitmap.width / 4).round rescue nil
  412.     @sprites["char2"].src_rect.x = 0 if @sprites["char2"].src_rect.x >= @sprites["char2"].bitmap.width rescue nil
  413.   end
  414.  
  415.   def pbMain
  416.     pbWait(1)
  417.     12.times do |i|
  418.       Graphics.update
  419.       @sprites["main"].opacity -= 32 rescue nil
  420.       @sprites["bg0"].opacity += 32 if @sprites["bg0"].opacity < 255
  421.       @sprites["bg1"].opacity -= 32 rescue nil if i > 3
  422.       @sprites["bg2"].opacity -= 32 rescue nil if i > 3
  423.       @sprites["pager"].opacity -= 32 rescue nil if i > 3
  424.       @sprites["pager2"].opacity -= 32 rescue nil if i > 3
  425.       @sprites["char"].opacity -= 32 rescue nil
  426.       @sprites["char2"].opacity -= 32 rescue nil
  427.       @sprites["text"].opacity -= 32 rescue nil
  428.       @sprites["up"].opacity -= 32
  429.       @sprites["down"].opacity -= 32
  430.       for j in 0...@ongoing.size
  431.         @sprites["ongoing#{j}"].opacity -= 32 rescue nil
  432.       end
  433.       for j in 0...@completed.size
  434.         @sprites["completed#{j}"].opacity -= 32 rescue nil
  435.       end
  436.     end
  437.     @sprites["up"].dispose
  438.     @sprites["down"].dispose
  439.     @main.clear
  440.     @text.clear rescue nil
  441.     @text2.clear rescue nil
  442.     @sel_two = 0
  443.     @scene = 0
  444.     pbDrawOutlineText(@main,0,2-178,512,384,"Quest Log",Color.new(255,255,255),Color.new(0,0,0),1)
  445.     pbDrawOutlineText(@main,0,142-178,512,384,"Ongoing: " + @ongoing.size.to_s,Color.new(255,255,255),Color.new(0,0,0),1)
  446.     pbDrawOutlineText(@main,0,198-178,512,384,"Completed: " + @completed.size.to_s,Color.new(255,255,255),Color.new(0,0,0),1)
  447.     12.times do |i|
  448.       Graphics.update
  449.       @sprites["bg0"].opacity += 32 if i < 8
  450.       @sprites["btn0"].opacity += 32 if i > 3
  451.       @sprites["btn1"].opacity += 32 if i > 3
  452.       @sprites["main"].opacity += 48 if i > 5
  453.     end
  454.   end
  455.  
  456.   def pbSwitch(dir)
  457.     if dir == :DOWN
  458.       return if @sel_one == 1
  459.       @sprites["btn#{@sel_one}"].src_rect.y = 0
  460.       @sel_one += 1
  461.       @sprites["btn#{@sel_one}"].src_rect.y = (@sprites["btn#{@sel_one}"].bitmap.height / 2).round
  462.     else
  463.       return if @sel_one == 0
  464.       @sprites["btn#{@sel_one}"].src_rect.y = 0
  465.       @sel_one -= 1
  466.       @sprites["btn#{@sel_one}"].src_rect.y = (@sprites["btn#{@sel_one}"].bitmap.height / 2).round
  467.     end
  468.   end
  469.  
  470.   def pbMove(dir)
  471.     pbWait(1)
  472.     if dir == :DOWN
  473.       return if @sel_two == @ongoing.size - 1 && @mode == 0
  474.       return if @sel_two == @completed.size - 1 && @mode == 1
  475.       return if @ongoing.size == 0 && @mode == 0
  476.       return if @completed.size == 0 && @mode == 1
  477.       @sprites["ongoing#{@box}"].src_rect.y = 0 if @mode == 0
  478.       @sprites["completed#{@box}"].src_rect.y = 0 if @mode == 1
  479.       @sel_two += 1
  480.       @box += 1
  481.       @box = 5 if @box > 5
  482.       @sprites["ongoing#{@box}"].src_rect.y = (@sprites["ongoing#{@box}"].bitmap.height / 2).round if @mode == 0
  483.       @sprites["completed#{@box}"].src_rect.y = (@sprites["completed#{@box}"].bitmap.height / 2).round if @mode == 1
  484.       if @box == 5
  485.         @main.clear
  486.         if @mode == 0
  487.           for i in 0...@ongoing.size
  488.             break if i > 5
  489.             j = (i==0 ? -5 : (i==1 ? -4 : (i==2 ? -3 : (i==3 ? -2 : (i==4 ? -1 : 0)))))
  490.             @sprites["ongoing#{i}"].quest = @ongoing[@sel_two+j]
  491.             pbDrawOutlineText(@main,11,-124+52*i,512,384,@ongoing[@sel_two+j].name,@ongoing[@sel_two+j].color,Color.new(0,0,0),1)
  492.           end
  493.           if @sprites["ongoing0"].quest != @ongoing[0]
  494.             @sprites["up"].visible = true
  495.           else
  496.             @sprites["up"].visible = false
  497.           end
  498.           if @sprites["ongoing5"].quest != @ongoing[@ongoing.size - 1]
  499.             @sprites["down"].visible = true
  500.           else
  501.             @sprites["down"].visible = false
  502.           end
  503.           pbDrawOutlineText(@main,0,2-178,512,384,"Ongoing Quests",Color.new(255,255,255),Color.new(0,0,0),1)
  504.         else
  505.           for i in 0...@completed.size
  506.             break if i > 5
  507.             j = (i==0 ? -5 : (i==1 ? -4 : (i==2 ? -3 : (i==3 ? -2 : (i==4 ? -1 : 0)))))
  508.             @sprites["completed#{i}"].quest = @completed[@sel_two+j]
  509.             pbDrawOutlineText(@main,11,-124+52*i,512,384,@completed[@sel_two+j].name,@completed[@sel_two+j].color,Color.new(0,0,0),1)
  510.           end
  511.           if @sprites["completed0"].quest != @completed[0]
  512.             @sprites["up"].visible = true
  513.           else
  514.             @sprites["up"].visible = false
  515.           end
  516.           if @sprites["completed5"].quest != @completed[@completed.size - 1]
  517.             @sprites["down"].visible = true
  518.           else
  519.             @sprites["down"].visible = false
  520.           end
  521.           pbDrawOutlineText(@main,0,2-178,512,384,"Completed Quests",Color.new(255,255,255),Color.new(0,0,0),1)
  522.         end
  523.       end
  524.     else
  525.       return if @sel_two == 0
  526.       return if @ongoing.size == 0 && @mode == 0
  527.       return if @completed.size == 0 && @mode == 1
  528.       @sprites["ongoing#{@box}"].src_rect.y = 0 if @mode == 0
  529.       @sprites["completed#{@box}"].src_rect.y = 0 if @mode == 1
  530.       @sel_two -= 1
  531.       @box -= 1
  532.       @box = 0 if @box < 0
  533.       @sprites["ongoing#{@box}"].src_rect.y = (@sprites["ongoing#{@box}"].bitmap.height / 2).round if @mode == 0
  534.       @sprites["completed#{@box}"].src_rect.y = (@sprites["completed#{@box}"].bitmap.height / 2).round if @mode == 1
  535.       if @box == 0
  536.         @main.clear
  537.         if @mode == 0
  538.           for i in 0...@ongoing.size
  539.             break if i > 5
  540.             @sprites["ongoing#{i}"].quest = @ongoing[@sel_two+i]
  541.             pbDrawOutlineText(@main,11,-124+52*i,512,384,@ongoing[@sel_two+i].name,@ongoing[@sel_two+i].color,Color.new(0,0,0),1)
  542.           end
  543.           if @sprites["ongoing0"].quest != @ongoing[0]
  544.             @sprites["up"].visible = true
  545.           else
  546.             @sprites["up"].visible = false
  547.           end
  548.           if @ongoing.size > 5
  549.             if @sprites["ongoing5"].quest != @ongoing[@ongoing.size - 1]
  550.               @sprites["down"].visible = true
  551.             else
  552.               @sprites["down"].visible = false
  553.             end
  554.           end
  555.           pbDrawOutlineText(@main,0,2-178,512,384,"Ongoing Quests",Color.new(255,255,255),Color.new(0,0,0),1)
  556.         else
  557.           for i in 0...@completed.size
  558.             break if i > 5
  559.             @sprites["completed#{i}"].quest = @completed[@sel_two+i]
  560.             pbDrawOutlineText(@main,11,-124+52*i,512,384,@completed[@sel_two+i].name,@completed[@sel_two+i].color,Color.new(0,0,0),1)
  561.           end
  562.           if @sprites["completed0"].quest != @completed[0]
  563.             @sprites["up"].visible = true
  564.           else
  565.             @sprites["up"].visible = false
  566.           end
  567.           if @completed.size > 5
  568.             if @sprites["completed5"].quest != @completed[@completed.size - 1]
  569.               @sprites["down"].visible = true
  570.             else
  571.               @sprites["down"].visible = false
  572.             end
  573.           end
  574.           pbDrawOutlineText(@main,0,2-178,512,384,"Completed Quests",Color.new(255,255,255),Color.new(0,0,0),1)
  575.         end
  576.       end
  577.     end
  578.   end
  579.  
  580.   def pbList(id)
  581.     pbWait(1)
  582.     @sel_two = 0
  583.     @page = 0
  584.     @scene = 1
  585.     @mode = id
  586.     @box = 0
  587.     @sprites["up"] = IconSprite.new(0, 0, @viewport)
  588.     @sprites["up"].setBitmap("Graphics/Pictures/questArrow")
  589.     @sprites["up"].zoom_x = 1.25
  590.     @sprites["up"].zoom_y = 1.25
  591.     @sprites["up"].x = Graphics.width / 2
  592.     @sprites["up"].y = 36
  593.     @sprites["up"].z = 2
  594.     @sprites["up"].visible = false
  595.     @sprites["down"] = IconSprite.new(0, 0, @viewport)
  596.     @sprites["down"].setBitmap("Graphics/Pictures/questArrow")
  597.     @sprites["down"].zoom_x = 1.25
  598.     @sprites["down"].zoom_y = 1.25
  599.     @sprites["down"].x = Graphics.width / 2 + 21
  600.     @sprites["down"].y = 360
  601.     @sprites["down"].z = 2
  602.     @sprites["down"].angle = 180
  603.     @sprites["down"].visible = @mode == 0 ? @ongoing.size > 6 : @completed.size > 6
  604.     @sprites["down"].opacity = 0
  605.     10.times do |i|
  606.       Graphics.update
  607.       @sprites["btn0"].opacity -= 32 if i > 1
  608.       @sprites["btn1"].opacity -= 32 if i > 1
  609.       @sprites["main"].opacity -= 32 if i > 1
  610.       @sprites["bg1"].opacity -= 32 rescue nil if i > 1
  611.       @sprites["bg2"].opacity -= 32 rescue nil if i > 1
  612.       @sprites["pager"].opacity -= 32 rescue nil if i > 1
  613.       @sprites["pager2"].opacity -= 32 rescue nil if i > 1
  614.       @sprites["char"].opacity -= 32 rescue nil
  615.       @sprites["char2"].opacity -= 32 rescue nil
  616.       @sprites["text"].opacity -= 32 rescue nil if i > 1
  617.       @sprites["text2"].opacity -= 32 rescue nil if i > 1
  618.     end
  619.     @main.clear
  620.     @text.clear rescue nil
  621.     @text2.clear rescue nil
  622.     if id == 0
  623.       for i in 0...@ongoing.size
  624.         break if i > 5
  625.         @sprites["ongoing#{i}"] = QuestSprite.new(0, 0, @viewport)
  626.         @sprites["ongoing#{i}"].setBitmap("Graphics/Pictures/questBtn")
  627.         @sprites["ongoing#{i}"].quest = @ongoing[i]
  628.         @sprites["ongoing#{i}"].x = 94
  629.         @sprites["ongoing#{i}"].y = 42 + 52 * i
  630.         @sprites["ongoing#{i}"].src_rect.height = (@sprites["ongoing#{i}"].bitmap.height / 2).round
  631.         @sprites["ongoing#{i}"].src_rect.y = (@sprites["ongoing#{i}"].bitmap.height / 2).round if i == @sel_two
  632.         @sprites["ongoing#{i}"].opacity = 0
  633.         pbDrawOutlineText(@main,11,-124+52*i,512,384,@ongoing[i].name,@ongoing[i].color,Color.new(0,0,0),1)
  634.       end
  635.       pbDrawOutlineText(@main,0,0,512,384,"No ongoing quests",pbColor(:WHITE),pbColor(:BLACK),1) if @ongoing.size == 0
  636.       pbDrawOutlineText(@main,0,2-178,512,384,"Ongoing Quests",Color.new(255,255,255),Color.new(0,0,0),1)
  637.       12.times do |i|
  638.         Graphics.update
  639.         @sprites["main"].opacity += 32 if i < 8
  640.         for j in 0...@ongoing.size
  641.           break if j > 5
  642.           @sprites["ongoing#{j}"].opacity += 32 if i > 3
  643.         end
  644.       end
  645.     elsif id == 1
  646.       for i in 0...@completed.size
  647.         break if i > 5
  648.         @sprites["completed#{i}"] = QuestSprite.new(0, 0, @viewport)
  649.         @sprites["completed#{i}"].setBitmap("Graphics/Pictures/questBtn")
  650.         @sprites["completed#{i}"].x = 94
  651.         @sprites["completed#{i}"].y = 42 + 52 * i
  652.         @sprites["completed#{i}"].src_rect.height = (@sprites["completed#{i}"].bitmap.height / 2).round
  653.         @sprites["completed#{i}"].src_rect.y = (@sprites["completed#{i}"].bitmap.height / 2).round if i == @sel_two
  654.         @sprites["completed#{i}"].opacity = 0
  655.         pbDrawOutlineText(@main,11,-124+52*i,512,384,@completed[i].name,@completed[i].color,Color.new(0,0,0),1)
  656.       end
  657.       pbDrawOutlineText(@main,0,0,512,384,"No completed quests",pbColor(:WHITE),pbColor(:BLACK),1) if @completed.size == 0
  658.       pbDrawOutlineText(@main,0,2-178,512,384,"Completed Quests",Color.new(255,255,255),Color.new(0,0,0),1)
  659.       12.times do |i|
  660.         Graphics.update
  661.         @sprites["main"].opacity += 32 if i < 8
  662.         @sprites["down"].opacity += 32 if i > 3
  663.         for j in 0...@completed.size
  664.           break if j > 5
  665.           @sprites["completed#{j}"].opacity += 32 if i > 3
  666.         end
  667.       end
  668.     end
  669.   end
  670.  
  671.   def pbEnd
  672.     12.times do |i|
  673.       Graphics.update
  674.       @sprites["bg0"].opacity -= 32 if i > 3
  675.       @sprites["btn0"].opacity -= 32
  676.       @sprites["btn1"].opacity -= 32
  677.       @sprites["main"].opacity -= 32
  678.       @sprites["char"].opacity -= 40 rescue nil
  679.       @sprites["char2"].opacity -= 40 rescue nil
  680.     end
  681.   end
  682. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top