Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Claim Time Addon by Sixth (v.1.1) ----------------
- # - Make that green bar not-so-static! | Updated:
- # | 22/09/2014
- # REQUIRES Venka's Multiple Crafting Script! ----------------
- #==============================================================================
- #------------------------------------------------------------------------------
- # Change Log:
- #------------------------------------------------------------------------------
- # 22/09/2014 - Noobishness kicked in again!
- # Fixed the note-tags. It is now possible to make negative
- # "bonuses" for real.
- # Also re-made the percentage bonuses. They work differently now.
- # Read the note-tag manual for more info.
- # Added a maximum claiming time option too.
- # 21/09/2014 - Initial release.
- #------------------------------------------------------------------------------
- # Introduction:
- #------------------------------------------------------------------------------
- # This script will allow you to change the claiming time for each recipes
- # separately. The claiming time is the time when the player needs to press the
- # button for getting the success reward. By default, it is set in the
- # Customize Section of Venka's script with the 'Crafting_Buffer' setup option.
- # However, that setup is a global setup and will affect all of your recipes.
- # This is what you can change with this addon.
- # The addon also makes it possible to scale the claiming time for the recipes
- # dynamically according to the player's level in the used craft type.
- # ...
- # What? Not enough? >.>
- # Alright, then how about some note-tags on your equips to manipulate the
- # claiming time even more? Yeah, you bet you can do that too with this addon!
- #------------------------------------------------------------------------------
- # Usage Manual - New Recipe Setting:
- #------------------------------------------------------------------------------
- # With this addon, a new option is available in the recipe settings.
- # The new setting looks like this:
- #
- # :claiming_time => n
- #
- # Where 'n' is an integer number and stands for frame count, so putting 60 there
- # means that the claiming time will be 1 second.
- # Example: :claiming_time => 45
- #
- # Adding this line in the recipe settings will overwrite the default time window
- # for claiming the success rewards. Omitting this will simply take the default
- # claiming time for the recipe.
- # And this is not all of what the addon changes!
- # By configuring the settings below, you can make craft level dependant
- # claiming times as well! How awesome, right? :P
- #------------------------------------------------------------------------------
- # Usage Manual - Note-tags:
- #------------------------------------------------------------------------------
- # There are 3 note-tags which you can use.
- # One will directly add the specified value to the claiming time, another one
- # will add a percentage value, and yet another one can disable the success time
- # entirely!
- # All of the note-tags are stack-able, so be careful with claiming time equip
- # bonuses, because they can scale exponentially to a very high amount if you
- # don't plan your equipment availability in your game ahead!
- #
- # Ok, here are the note-tags!
- #
- # To add a direct bonus to the claiming time, use this note-tag:
- #
- # <claim_time_bonus +n> Adds 'n' value.
- # <claim_time_bonus -n> Subtracts 'n' value.
- #
- # Where 'n' is an integer number and stands for frame count (60 = 1 second).
- # Example: <claim_time_bonus +10> Adds 10 frame count to the claiming time.
- # Example: <claim_time_bonus -15> Subtracts 15 frame count from the claiming time.
- #
- # To add a percentage multiplier to the claiming gauge, use this note-tag:
- #
- # <claim_time_bonus_perc +n> Adds 'n' percentage.
- # <claim_time_bonus_perc -n> Subtracts 'n' percentage.
- #
- # Where 'n' is an integer number and stands for percentages, so putting +20 there
- # means that the total accumulated bonus will get an additional 20% bonus time.
- # Example: <claim_time_bonus_perc +25> Adds 25% to the total claiming time.
- # Example: <claim_time_bonus_perc -15> Subtracts 15% from the total claiming time.
- #
- # Again, all of the note-tags are stack-able, even the percentage ones!
- # It is possible to stack an amount so high, that the player don't even need to
- # press the button for getting the success rewards, he will get it anyway.
- # To prevent this from happening, you can use the 'Max_Claim_Time' option to
- # limit the maximum claiming time the player can accumulate.
- # It is also possible to get negative amounts, but in that case, the claim time
- # will just stick to 0, instead of going into negative numbers. This is to
- # prevent some unexpected behaviours.
- #
- # To disable the success claiming time completely, use the following note-tag:
- #
- # <claim_time_curse>
- #
- # This note-tag will simply multiply the final total value of the claiming time
- # with 0, effectively disabling the success time completely.
- # This is good for making cursed items. Players, beware, mwhahaha! :D
- #
- #------------------------------------------------------------------------------
- # Instructions:
- #------------------------------------------------------------------------------
- # Place this add on below Venka's Multiple Crafting Script.
- # This addon is plug-and-play. Configure the settings below if needed.
- #------------------------------------------------------------------------------
- # Terms of use:
- #------------------------------------------------------------------------------
- # You can do whatever you want with this addon as long as you give credit to me.
- #------------------------------------------------------------------------------
- $imported = {} if $imported.nil?
- $imported["ClaimTimeAddon"] = true
- ###############################################################################
- #
- # The "Big" Setup part - edit until you drop!
- #
- ###############################################################################
- module Venka
- module Crafting
- #----------------------------------------------------------------------------
- # Claim Time Settings
- #----------------------------------------------------------------------------
- # You can set up how the new :claim_time option for the recipes functions here.
- #----------------------------------------------------------------------------
- Lvl_Bonus = true # Setting this to 'true' will enable the 'Lvl_Modifier'
- # option below, while 'false' will disable it.
- Lvl_Modifier = 1.5 # The modifier of the claim time bonus for the recipes.
- # If 'Lvl_Bonus' is set to true, a bonus will be added
- # to the base claiming time. This bonus depends on the
- # level of your craft type multiplied with the amount
- # set up here.
- Max_Claim_Time = 99 # This setting will limit the maximum amount of claiming
- # time the player can accumulate. If you set this to
- # 'nil', this option will be disabled and the player
- # can get unlimited amount of claiming time by stacking
- # bonuses. Else, set it to an integer number. This number
- # is in frames (60 = 1 sec).
- #----------------------------------------------------------------------------
- # Examples:
- #----------------------------------------------------------------------------
- # If you craft a Battle Axe (which is a "Smith" recipe by default), and the
- # recipe for it is set up with a :claiming_time of 30, and the 'Lvl_Bonus' is
- # enabled with a 'LvL_Modifier' set to 1.5 the final claiming time formula will
- # be the following:
- #
- # 30 + (1.5 * 'smith_craft_level')
- #
- # So, if your "Smith" level is 12, the final claim time would be:
- #
- # 30 + (1.5 * 12) = 48
- # Final result = 48
- #
- # And with a "Smith" level of 30:
- #
- # 30 + (1.5 * 30) = 75
- # Final result = 75
- #
- # Now, if by any chance the player got an accessory equipped with a note-tag of
- # <claim_time_bonus +60>, the last example formula would look like this:
- #
- # 30 + (1.5 * 30) + 60 = 135
- # Final result = 135
- #
- # And when the player equips an equipment with a note-tag of
- # <claim_time_bonus_perc -20>, the last example formula would turn to:
- #
- # (30 + (1.5 * 30) + 60) = 135
- # 135 - (135 * 20%) = 108
- # Final result = 108
- #
- # And if the player was unfortunate enough to equip a cursed accessory with the
- # note-tag of <claim_time_curse>, the formula will look like this:
- #
- # (30 + (1.5 * 30) + 60) = 135
- # 135 - (135 * 20%) = 108
- # 108 * 0 = 0
- # Final result = 0
- #
- # Yes, this means that it is possible to completely remove the success time
- # window with some quality cursed equips. :P
- #
- # So, the real formula with variables instead of example numbers:
- #
- # :claiming_time + (Lvl_Modifier * craft_type.level) = base_claim_time
- # base_claim_time + <claim_time_bonus [+/-]X> = base_time_bonus
- # base_time_bonus + (base_time_bonus * <claim_time_bonus_perc [+/-]X%>) = claim_time_total
- #
- # If the 'Max_Claim_Time' option is enabled, the formula goes on with this:
- #
- # claim_time_total = Max_Claim_Time if claim_time_total > Max_Claim_Time
- #
- # Or if the total value ended up being negative, the following happens:
- #
- # claim_time_total = 0
- #
- # And finally, if the <claim_time_curse> note-tag is present, the
- # claim_time_total is simply multiplied with 0 to disable the success claiming
- # time entirely, so the player won't be able to get the success item.
- #----------------------------------------------------------------------------
- end
- end
- ###############################################################################
- #
- # End of the "Big" Setup part - editing below may lead to flying dragons!
- #
- ###############################################################################
- class RPG::BaseItem
- def claim_time_bonus
- @note =~ /<claim_time_bonus ([\+\-]\d+)>/i ? $1.to_i : 0
- end
- def claim_time_bonus_p
- @note =~ /<claim_time_bonus_perc ([\+\-]\d+)>/i ? $1.to_i : 0
- end
- def claim_time_curse
- @note =~ /<claim_time_curse>/i ? true : false
- end
- end
- #==============================================================================
- # ■ Game_Party
- #==============================================================================
- class Game_Party
- #----------------------------------------------------------------------------
- # ♦ Public Instance Variables
- #----------------------------------------------------------------------------
- attr_accessor :claim_time_equip_bonus, :claim_time_equip_bonus_perc
- attr_accessor :claim_time_curse
- #----------------------------------------------------------------------------
- # ● new method: claim_time_equip_bonus
- #----------------------------------------------------------------------------
- def claim_time_equip_bonus
- @claim_time_equip_bonus = 0
- members.each do |actor|
- actor.equips.each do |equip|
- if equip != nil
- # equip.note =~ /<claim_time_bonus ([\+\-]\d+)>/
- # @claim_time_equip_bonus += ($~[1].to_i) if $~
- @claim_time_equip_bonus += equip.claim_time_bonus
- end
- end
- end
- return @claim_time_equip_bonus
- end
- #----------------------------------------------------------------------------
- # ● new method: claim_time_equip_bonus_perc
- #----------------------------------------------------------------------------
- def claim_time_equip_bonus_perc
- @claim_time_equip_bonus_perc = 0
- members.each do |actor|
- actor.equips.each do |equip|
- if equip != nil
- # equip.note =~ /<claim_time_bonus_perc ([\+\-]\d+)>/
- # @claim_time_equip_bonus_perc += ($~[1].to_i) if $~
- @claim_time_equip_bonus_perc += equip.claim_time_bonus_p
- end
- end
- end
- return @claim_time_equip_bonus_perc
- end
- #----------------------------------------------------------------------------
- # ● new method: claim_time_curse
- #----------------------------------------------------------------------------
- def claim_time_curse
- @claim_time_curse = false
- members.each do |actor|
- actor.equips.each do |equip|
- if equip != nil
- if equip.note.include?("<claim_time_curse>")
- @claim_time_curse = true
- #@claim_time_curse = equip.claim_time_curse
- end
- end
- end
- end
- return @claim_time_curse
- end
- end
- #==============================================================================
- # ■ Game_Recipe
- #==============================================================================
- class Game_Recipe
- #----------------------------------------------------------------------------
- # ♦ Public Instance Variables
- #----------------------------------------------------------------------------
- attr_reader :claiming_time
- #----------------------------------------------------------------------------
- # ● alias method: initialize
- #----------------------------------------------------------------------------
- alias sixth_initialize_claim1232 initialize
- def initialize(recipe_id)
- sixth_initialize_claim1232(recipe_id)
- @claiming_time = @recipe[:claiming_time] ? @recipe[:claiming_time] : Venka::Crafting::Crafting_Buffer
- end
- end
- #==============================================================================
- # ■ Crafting_Details_Window
- #==============================================================================
- class Crafting_Details_Window < Window_Command
- #----------------------------------------------------------------------------
- # ○ alias method: start_crafting
- #----------------------------------------------------------------------------
- alias sixth_start_crafting_claim1232 start_crafting
- def start_crafting
- sixth_start_crafting_claim1232
- @bonus_eq = $game_party.claim_time_equip_bonus
- @bonus_eq_perc = $game_party.claim_time_equip_bonus_perc
- @bonus_mod = Venka::Crafting::Lvl_Bonus ? ($craft[@recipe.recipe_type].level * Venka::Crafting::Lvl_Modifier) : 0
- @bonus_curse = $game_party.claim_time_curse
- @claiming_time = @recipe.claiming_time + @bonus_mod.to_i
- @claiming_time += @bonus_eq
- @claiming_time += (@claiming_time * @bonus_eq_perc) * 0.01
- @claiming_time *= 0 if @bonus_curse == true
- @claiming_time = 0 if @claiming_time < 0
- if Venka::Crafting::Max_Claim_Time != nil && @claiming_time > Venka::Crafting::Max_Claim_Time
- @claiming_time = Venka::Crafting::Max_Claim_Time
- end
- @buffer = Venka::Crafting::Timer_Type == :timer ? 0 : @claiming_time
- print "Claim Time Final: "; p @buffer # for debugging... why didn't I think about this sooner? -.-
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement