Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- # SHOPSUEY 1.0
- # By: Ixfuru
- ################################################################################
- # This script creates an entirely new Shop System. It bypasses nearly every
- # aspect and method of the old shop processing, which means that you can still
- # have some shops working in the old way if you so choose. To access a new
- # shop, you need only to create an event, go to the third page of the event
- # commands and add a script call, by selecting Script and entering this line
- # of code in the box which is then provided:
- #
- # $scene = Scene_Shopsuey.new(shop_id, shop_keeper_id)
- #
- # The values you give to replace shop_id and shop_keeper_id are found in the
- # settings, where you will set up each shop and shopkeeper.
- #
- # The script offers a number of features. These features are all properties of
- # the two new classes the script creates. $game_shops and $game_shopkeepers.
- #
- # Features linked to the shops are:
- #
- # changeable item selection
- # item selection based on barter types
- # item selection based on item type
- # no sell items
- # customizable shop background music
- # customizable shop names
- # banking
- # introduction of new shop items through selling
- # ...and several more
- #
- # Features linked to the shopkeepers are:
- #
- # customizable shopkeeper names
- # shopkeeper graphics
- # limited shopkeeper gold
- # pricing adjustments based on actor parameters
- # customizable dialogue
- #
- # Other Features are:
- #
- # new item pricing system
- # skill which allows selling at 100% of value
- # skill to always get the best deal
- # numerous script calls to use for accessing shops and keepers
- #
- #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- # CONTENTS:
- #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- #
- # SECTION 1: ShopKeepers
- # SECTION 2: Dialogue
- # SECTION 3: Shops
- # SECTION 4: BarterTypes
- # SECTION 5: ShopInventories
- # SECTION 6: ScriptCalls
- # SECTION 7: NoteTags
- # SECTION 8: MiscellaneousSettings
- # SECTION 9: Pricing
- # SECTION 10: Banking
- #
- #&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- # This script is free to use in NON-COMMERCIAL projects. If you are going
- # commercial with your project, you must contact me via RpgmakerVX.net and
- # gain authorization. Upon use either way, credit MUST be provided to Ixfuru.
- #&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- #
- # CONTROLS:
- #
- # Input in the shop scenes varies dependent upon what shopping phase you are in.
- # However, the main controls are "C" to select the item from list or commands,
- # and "B" to go back a phase. During the "Input" phases, you can use the
- # arrow keys to change the value of how many items, or how much money is
- # involved in a transaction from the bank. UP and RIGHT will increase the value,
- # while DOWN and LEFT will decrease the value.
- #
- # In the banking phase, you can use the "L" and "R" (which is Q and W on the
- # keyboard), to toggle the multplier when taking loans and paying them back.
- # This will enable you to increase or decrease the value by more than one
- # number at a time. You can use 1s, 10s, 50s and 100s.
- ################################################################################
- module Ixfuru
- module ShopKeep
- SHOPKEEPERS = {#<<<Don't delete this!
- #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- # START CONFIGURING
- #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- #===========================================================================
- # SECTION 1:
- # ShopKeepers
- # The ShopKeepers hash contains arrays of shopkeepers found in the game.
- # Here, you will give them an id, and set up their appearances, both
- # character graphic and face graphic. You will also give them a name.
- # You will give them a dialogue by referencing which dialogue_id
- # they use when communicating with the player. Set up the dialogues in the
- # constant provided below in Section 2. Ther are also a number of options
- # to set up in the array which involve pricing and shopkeeper gold. Use
- # the following formula to set the shopkeepers up.
- #
- # keeper_id => [name, char_set, char_index, face_set, face_index, gold,
- # gold_growth_increase, stat_price, price_stat_base,
- # price_modifier, dialogue]
- #
- # keeper_id: an integer 0 or greater
- # char_set: the character sheet from which the shopkeeper is shown. File must
- # be in the Graphics\Characters folder of the project.
- # char_index: the character index on the given char_set sheet to use.
- # face_set: the face sheet from which the shopkeeper is shown. File must be
- # in the Graphics\Faces folder of the project.
- # face_index: the face index of the face sheet to use
- # gold: amount of spendable gold the keeper has at onset of game. In order
- # for this to be applicable, you have to have the USE_KEEPER_GOLD
- # constant in Section 3 set to true.
- # gold_growth_increase: the amount of gold which is added to the keeper's gold supply
- # when a gold growth method call is made. See section 6, to
- # learn more. This makes it so the keeper will regain any gold
- # they may have lost in bartering with the player over a period
- # of time.
- # stat_price: true or false; does the keeper modify his prices due to the
- # stats of the party members.(figured by averaging the stat of
- # each member.
- # price_stat_base: if stat_price is true, this is the index of which parameter
- # to base the price modification on. Set this as a string.
- # it will be converted to a symbol during processing. This
- # makes it possible to use a parameter other than the default
- # parameters. For example, to base the pricing on the ATK
- # stat, place "atk" in the array. So if you are using a
- # script which has a new parameter called LUK, you would use
- # "luk" in this position.
- # price_modifier: if stat_price is true, this will be used to modify price for
- # each point of the average stat. Take a look at the
- # following example:
- #
- # price_stat_base: "spi"
- # if the average spi of party members is 65, you would then
- # be able to modify it by placing one of the following
- # integers into the array for 'price_modifier'.
- #
- # 0 = adds the average to the price.
- # 1 = subtracts the average from the price.
- # 2 = multiplies the price by that much.
- # 3 = divides the price by that much.
- # 4 = modulus the price. Takes the price, divides it
- # by the stat, and whatever is left becomes the
- # new price.
- # 5 = percentage the price. This is very effective,
- # as it takes the stat, multiplies it by the
- # default price, and then divides it by 100.
- #
- # Be careful when using the multiply and divide, as they
- # can end up making items very cheap, or unreasonably high.
- # By default, if this number is out of range, (less than 0
- # or greater than 6, it will use option 5.
- #===========================================================================
- 0 => ["Antonio", "People1", 4, "People1", 4, 500, 100, true, "def", 5, 0],
- 1 => ["Felicia", "People2", 7, "People2", 7, 1000, 200, false, nil, nil, 1],
- }#<<<Don't delete this!
- DIALOGUES = {#<<<Don't delete this!
- #===========================================================================
- # SECTION 2
- # Dialogue
- # This hash contains the applicable text displayed as shopkeeper dialogue.
- # You will use a hash to set up the id, and the displayable text displayed
- # in the array. Use the following formula to set it up:
- # dialogue_id => [greeting,
- # services,
- # start_buy,
- # cant_afford,
- # buy_thanks,
- # start_sell,
- # shop_dont_buy,
- # sell_thanks,
- # farewell,
- # new_stock_item
- # bank_start1,
- # bank_start2,
- # bank_take_loan,
- # bank_cant_loan,
- # bank_pay_loan,
- # bank_loan_too_much,
- # bank_overpay,
- # bank_loan_taken,
- # bank_paid_back,
- # bank_paid_in_full,
- # how_many_buy,
- # how_many_sell,
- # too_many_items
- # no_loan_out],
- #
- # dialogue_id: Must be an integer 0 or greater, used to link the shop with
- # specific dialogue.
- # greeting: Text first displayed when entering shop scene.
- # services: A word from the shopkeeper about services they offer
- # start_buy: invokes the shopper to take a look at products
- # cant_afford: tells shopper they can't afford a specific item
- # buy_thanks: tells the shopper thank you for buying
- # start_sell: invokes the shopper to show their wares
- # shop_dont_buy: tells shopper the shop doesn't buy a particulare item
- # shop_low_funds: tells shopper shop doesn't have the money to buy.
- # sell_thanks: thanks the shopper for allowing the shop to buy from them
- # farewell: says goodbye to shopper
- # new_stock_item: comments about a seller selling an unlisted item to the
- # shop.
- # bank_start1: comments when banking starts, with loan out
- # bank_start2: comments when banking starts, no loan out
- # bank_take_loan: asks how much to loan
- # bank_cant_loan: tells shopper they cant have a loan
- # bank_pay_loan: asks how much to pay back
- # bank_loan_too_much: tells shopper the loan is too high
- # bank_overpay: tells shopper they've paid back more than what was owed
- # bank_loan_taken: explains results of loan
- # bank_paid_back: thanks for the payback
- # bank_paid_in_full: thanks, remarks on payback
- # how_many_buy: asks how many you will buy
- # how_many_sell: asks how many you will sell
- # too_many_items: informs party they don't have that many of the sell item
- # has_no_loan: tells party they have no current loan to pay back.
- #===========================================================================
- 0 => ["Hello Traveller. Welcome to my shop.", # greetings
- "I offer rations. What'll it be?", #services
- "Take a look then.", # start buy
- "You can't afford that!", #can't afford
- "I appreciate your business.", #buy thanks
- "Well let me see what you have there.", # start sell
- "Sorry, I can't buy that from you.",# shop don't buy
- "I seem to be a bit strapped for cash.", #shop low funds
- "I'm sure I can resell this at a reasonable price.", #sell thanks
- "Safe travels, then.", #farewell
- "Ah. A new item to add to my supply!", #new stock item
- "Come to pay back your debt?", #bank start 1
- "Are you here for a loan?", #bank start 2
- "Be sure to pay this back as quickly as you can.", # takes loan
- "Sorry, I can't loan you anything right now.", #No loan
- "How much will you been needing?", # Ask value of loan
- "That's too much.", # too much loan
- "You overpaid. Here's what's leftover!", #pay back too much
- "Be sure to pay this back.", #loan taken
- "Thanks for the reimbursement.", # paid back
- "Looks like you've paid all the loan back. Thanks.", #paid back in full
- "How many will you buy?", #how many to buy
- "How many will you sell?",#how many sell
- "But you don't have that many!",#more items than party has
- "You have no current loan."], #nothing to pay back
- 1 => ["Greetings!",
- "I have a small selection of weapons and armor.",
- "Check 'em out.",
- "That's too much for you.",
- "Great, let me get that for you.",
- "Hope you have what I'm looking for.",
- "No. I don't typically buy those.",
- "I don't have enough to buy it.",
- "This should look good on my shelves.",
- "Very well. See you soon I hope.",# See you later
- "Great! I'm sure my shoppers will appreciate this!",#new stock item
- "Come to pay back your debt?", #bank start 1
- "Are you here for a loan?", #bank start 2
- "Be sure to pay this back as quickly as you can.", # takes loan
- "Sorry, I can't loan you anything right now.", #No loan
- "How much will you been needing?", # Ask value of loan
- "That's too much.", # too much loan
- "You overpaid. Here's what's leftover!", #pay back too much
- "Be sure to pay this back.", #loan taken
- "Thanks for the reimbursement.", # paid back
- "Looks like you've paid all the loan back. Thanks.", #paid back in full
- "How many will you buy?", #how many to buy
- "How many will you sell?",#how many sell
- "But you don't have that many!",#more items than party has
- "You have no current loan."], #nothing to pay back],
- }#<<<Don't delete this!
- NO_DIALOGUE = 0 # if no dialogue exists for the keeper, this dialogue from
- # the hash will be used in its place.
- SHOPS = {#<<<Don't delete this!
- #===========================================================================
- # SECTION 3:
- # Shops
- # The Shops are set up with an id for referencing. Then, an array is linked
- # to the shop_id which contains information pertaining to that particular
- # shop. Information includes shop name and services offered. Use the
- # following formula:
- #
- # shop_id => [shop_name, [services], [barter_types], iventory_list, [bgm]]
- #
- # shop_id: Must be an integer 0 or greater
- # shop_name: Any string you wish to use for the displayable name of the shop
- # shop_services: contains the ids of services offered. This inner array
- # lists service ids which don't have to be in a specific order.
- # The service ids are listed below.
- #
- # 0 => buy
- # 1 => sell
- # 2 => bank
- #
- # If you use the shop as ONLY a bank, you should place the
- # placeholder of nil into the barter_types and inventory_list
- # positions.
- #
- # barter_types: in this inner array, store the ids of the item types you
- # wish for the shop to carry. You can set up the barter types
- # in the BARTER_TYPES hash in Section 5, and use notetags to
- # reference the ids from there to denote each individual item.
- # You can place "equipment" instead of using the array if you
- # want the shop to buy all equipment types. You can also use
- # "weapons", "armors" and "items" to bypass the use of filling
- # in the array or using notetags, and the shop will sell
- # those respective items without searching notes. If you want
- # the shop to buy anything, just place "all" instead of the
- # array. But using the array gives
- # you great command over individual items you want the shop
- # to be willing to buy. If the shop is a bank and doesn't
- # have a real selectable inventory, just place "all" to hold
- # the place of the array.
- #
- # inventory_list: place the id of the SHOP_INVENTORIES you wish to provide
- # to the player at this shop. You can set the inventories up
- # in Section 4. Also, just use '0' in order to use a bank,
- # with no inventory.
- #
- # bgm: This array requires three values. A string corresponding to the
- # filename of the background music you wish to play while in the shop,
- # a volume and a pitch. So for example:
- # ["Scene1", 80, 60]
- # This would play the music in the Audio\BGM folder called "Scene1".
- # It would play it at volume 80 and pitch 60.
- #===========================================================================
- 0 => ["The Hobbyist", [0, 1], [0, 1], 0, ["Scene7", 80, 100]],
- 1 => ["Felecia's Fine Crafts", [0, 1], [3, 4], 1, ["Dungeon6", 80, 100]],
- 2 => ["Bank of Ixfuru", [2], "all", 1, ["Dungeon5", 80, 100]],
- }#<<<Don't delete this!
- BARTER_TYPES = {#<<<Don't delete this!
- #===========================================================================
- # SECTION 4:
- # BarterTypes
- # This hash will hold the ids of given barter types. That is, the kind of
- # items which are sellable to a shop if the SHOPs hash contains these ids
- # in specific shops. The ids here are also used in notetags of
- # items/weapons/armors in the database. See Section 7 for details on this.
- # The following is the formula to set up barter types:
- #
- # barter_type_id => barter_type_name
- #
- # barter_type_id: an integer 0 or greater
- # barter_type_name: the name used to describe the barter type.
- #
- #===========================================================================
- 0 => "Rations",
- 1 => "Tools",
- 2 => "Books",
- }#Don't delete this!
- SHOP_INVENTORIES = {#<<<Don't delete this!
- #===========================================================================
- # SECTION 5:
- # ShopIventories
- # This hash holds the items which are for sale by default in the specific
- # shops, if the SHOPS hash at their id, holds this specific inventory_id.
- # Each inventory_id links to another inner hash which holds the items
- # which the store sells. Use this formula to use this part of the script.
- #
- # inventory_id => {item_type => [item_ids]},
- #
- # inventory_id: Must be an integer 0 or greater. This value is referenced
- # by the SHOPS constant, and is used to call specific
- # inventory lists into use.
- # item_type: These are the keys used for the inner hash. They determine
- # exactly what kind of items are found in the inventory. Not
- # all item_types have to be accounted for. And keys must be either
- # 0, 1 or 2. 0 for items, 1 for weapons, 2 for armors.
- # item_ids: These values are stored inside an array and are linked to the
- # specific hash key (item_type) of the inner hash. So if the
- # inner key is 1, then it would point to weapons, and then these
- # values would be the actual database ids of weapons.
- #
- # EXAMPLE>
- # 13 => {0 => [54, 23, 8],
- # 1 => [12, 13, 17],
- # 2 => [10]},
- #
- # This example inventory would be used whenever a shop's
- # inventory list was set to '13'. By default, it would offer
- # items number 54, 23 and 8. Weapons number 12, 13 and 17.
- # It would only offer a single armor, which is number 10 in the
- # database.
- #===========================================================================
- 0 => {0 => [1, 2, 3, 4, 5, 6, 7, 8]}, #only sells items
- 1 => {1 => [1, 2, 3, 4, 5, 6], #sells these weapons
- 2 => [1, 2, 3, 4, 5, 6, 7, 8]}, # sells these armors
- }#<<<Don't delete this!
- #===========================================================================
- # SECTION 6:
- # ScriptCalls
- # There are several script calls which can be used to get the most out of the
- # script. They are listed below.
- #
- # 1) Calls the Shop Scene:
- # $scene = Scene_Shopkeep.new(keeper_id, shop_id)
- #
- # Pass the arguments with the ids given in the SHOPKEEPERS and
- # SHOPS constants, respectively.
- #
- # 2) Increases Gold at sellers gold growth rate:
- #
- # $game_shopkeepers[keeper_id].gold_growth
- #
- # 3) Increases Gold of ALL shopkeepers by their respective growth rates:
- #
- # $game_shops.gold_growth
- #
- # 4) Resets gold of a specific shopkeeper
- #
- # $game_shopkeepers[keeper_id].reset_gold
- #
- # 5) Resets gold of all shopkeepers to default
- #
- # $game_shopkeepers.reset_gold
- #
- # 6) Checks to determine if a shop will buy a specific item; use in
- # a conditional branch.
- #
- # $game_shops[shop_id].barters_item?(item_id)
- #
- # 7) Resets inventory of a specific shop
- #
- # $game_shops[shops_id].reset_inventory
- #
- # 8) Resets all shopkeeper inventories
- #
- # $game_shopkeepers.reset_inventories
- #
- # 9) Checks to see if there is a loan out
- # $game_bank.loan_out
- #
- #===========================================================================
- #===========================================================================
- # Section 7:
- # NoteTags
- # The following can be placed in the notes of items, weapons and armors to
- # utilize shop features.
- #
- # Use:
- #
- # <barter x>
- #
- # Where x equals the barter_type the item will be listed as. It is possible
- # to use multiple barter_types on the same item. For instance, if you create
- # a book, you can place it under books and tools. Simply by using the id of
- # these barter_types as the 'x'.
- #
- # Use:
- #
- # <unsellable>
- #
- # When this is in the notebox of an item, weapon or armor, the item will not
- # be available for selling, regardless of the price value in the database.
- # This enables you to list the value of rare treasures, without fear of them
- # being sold.
- #
- # Use:
- #
- # <keep_price>
- #
- # When this is in the notebox of an item, weapon or armor, the item will
- # maintain it's default price and bypass the new pricing methods when the
- # USE_RENEWED_PRICING constant of Section 8 is true.
- #
- # Use:
- #
- # <dont_stock>
- #
- # When this is in the notebox of an item, the seller will not stock the item
- # sold, even if it's a new item.
- #===========================================================================
- #===========================================================================
- # Section 8:
- # MiscellaneousSettings
- #===========================================================================
- USE_KEEPER_GOLD = true # makes shopkeepers have limited gold
- # for which to buy items from the player.
- SELL_100_SKILL = 83 # if the LEADER of the party has the skill
- #with this id, the party will get 100% of
- # value when selling an item to a shop.
- BUY_FAIR_SKILL = 84 # if the LEADER of the party has the skill
- # with this id, they will always get the
- # best deal possible when buying from shops.
- # this will avoid being ripped off by
- # greedy shopkeepers.
- USE_RENEWED_PRICING = true # if this is true, a new formula will be
- # used to determine the price of items in
- # shops. This bypasses the price in the
- # database completely, and figures a price
- # based on what the item actually does.
- # Even if this is true, you can bypass the
- # method on certain items by placing notes
- # which do so in their given notefields. More
- # on this in Section 7.
- # Also, Items which are priced at zero will
- # still be unsellable if this is true.
- SHOPKEEPER_STYLE = 0 # When 0, will use face; when 1, use character
- # The following three constants hold the text which will be displayed in the
- # commands for the shop scene.
- BUY_COMMAND = "Buy"
- SELL_COMMAND = "Sell"
- BANK_COMMAND = "Banking"
- SHOP_NAME_COLOR = 26
- SHOPKEEPER_NAME_DISPLAY = 0 #if 0, show shopkeeper's name above graphic,
- #if 1, show shopkeeper's name below graphic
- # The following array holds the icon_index of each element in the database.
- # If you have a custom IconSet, or are using custom elements, you will need
- # to adjust the icons to match your specific requirements. Just place the
- # id of the element as the hash key and link it to the icon_index of the
- # element like this:
- #
- # element_id => icon_index
- ELEMENT_ICON_IDS = {#<<<Don't delete this!
- 1 => 110,
- 2 => 9,
- 3 => 4,
- 4 => 14,
- 5 => 16,
- 6 => 12,
- 7 => 129,
- 8 => 128,
- 9 => 104,
- 10 => 105,
- 11 => 106,
- 12 => 107,
- 13 => 108,
- 14 => 109,
- 15 => 189,
- 16 => 111,
- }#<<<Don't delete this!
- STATE_ICON_IDS = {#<<<Don't delete this!
- 1 => 112,
- 2 => 113,
- 3 => 114,
- 4 => 115,
- 5 => 116,
- 6 => 117,
- 7 => 118,
- 8 => 119,
- 9 => 120,
- 10 => 121,
- 11 => 122,
- 12 => 123,
- 13 => 124,
- 14 => 125,
- 15 => 126,
- 16 => 127,
- }#<<<Don't delete this!
- SHOP_GOLD_ICON = 205
- KEEPER_NAME_COLOR = 25
- BUY_SE = "Shop"
- SELL_SE = "Item1"
- BANK_SE = "Chime2"
- #===========================================================================
- # SECTION 9:
- # PricingSystem
- #
- # The following group of constants are used in the new pricing system. If
- # you have bypassed this feature, you won't have to set any of this up.
- # This gives you complete control at how expensive things are in your
- # project, without you having to mess with a single price in the database.
- # Just remember, however, that certain aspects of the script, like the
- # <keep_price> note tag may require you to set the price on that particular
- # item. And also keep in mind that even though the script changes 'prices',
- # it does NOT affect the prices of items which are bought or sold
- # through the default system. Therefor, for anything which will be sold
- # via the old shop processing, the changes you make here won't effect them.
- # So, be careful, if you plan on still calling shops the old way and make
- # sure you have a price set for each of the items you'll be selling that
- # way.
- #
- # The jist of how the system works, is that it values an item based on
- # what it actually does. That is, the items many parameters you set up in
- # the database. You will be able to set the value for each one of these
- # parameters and then when the prices are calculated, it will use the
- # settings you provided. If the parameter in question is one that
- # is displayed as a numeric value (like atk, def, spi, agi), then the
- # value you place will be multiplied by the amount of that parameter, and
- # added to the price.
- #
- # Look at this example:
- #
- # ATK_FACTOR = 10
- # DEF_FACTOR = 10
- # SPI_FACTOR = 10
- # AGI_FACTOR = 10
- #
- # This example shows that for each point of the factors shown, 10 gold is
- # added to the price of the item. So if the value of agi in the database
- # was given as 4, then 40 gold would have to be added to the price, as
- # 4 * SPI_FACTOR = 10.
- #
- # For those parameters which don't offer a numeric value, such as States,
- # Elements, Scope, etc., The system will add the factor you place directly.
- # Therefor, those values are treated like a true/false. If this parameter is
- # checked, add the factor value.
- #
- #
- #There are several item parameters (and by items
- # I mean weapons and armors, too!) that this system doesn't take into
- # account. One of the main ones is 'CommonEvent'. This is because, it
- # is unable to determine just what occurs when you call a common event.
- # So it is highly recommended that you use the <keep_price> note tag on
- # objects which will do this, and set the price of that item yourself.
- #
- # Because you can set up each and every applicable parameter, you will be
- # able to create weapons which take most of their value from their ATK.
- # Or armors which take the majority of their value from DEF. Tamper with
- # the settings a little, and then call the shop to see if you like the
- # results.
- #
- #===========================================================================
- # Values that effect ITEMS #
- NO_VALUE = 20 # this will be the value of any item, which returns 0 when calculated
- # SCOPE FACTORS:
- # The scope factors array holds the values for specific scope selection.
- # Scope determines who is effected by use of the item. Whether it be
- # targets in combat, or heal targets from the menu. So, you will need to
- # pass the values inside the array, one for each possible scope parameter.
- # There are 11 scope parameters in all. When calculating the price, the
- # system will return the value in the array in the position of the item's
- # scope. So it is important, that the values are set to this specific
- # order.
- #
- # [None, OneEnemy, AllEnemies, OneEnemyDual, OneRandomEnemy, 2 RandomEnemies,
- # 3 Random Enemies, OneAlly, AllAllies, OneAlly(dead), AllAllies(dead),
- # The User]
- #
- # Calculated as TRUTH VALUE.
- SCOPE_FACTOR = [0, 50, 250, 100, 50, 100, 150, 50, 250, 50, 250, 25]
- # In battle, the Speed parameter is used to determine how long a specific
- # item takes to use.
- #
- # Calculated as PER POINT VALUE
- SPEED_FACTOR = 1
- # The base damage value is used to determine initial damage done by an item.
- # Calculated as PER POINT VALUE
- BASE_DAMAGE_FACTOR = 1
- # Variance is used in determining base damage, as it gives the actual
- # damage done a range within X amount of the Base Damage parameter.
- # Calculated as PER POINT VALUE
- VARIANCE = 1
- # The atk_f and spi_f parameters of an item are used to add to the damage
- # once base_damage and variance are tallied.
- # Calculated as PER POINT VALUE
- ATK_F_FACTOR = 1
- SPI_F_FACTOR = 1
- # Physical Attack parameters tell the system that the item is used much like
- # a weapon or melee attack would be.
- # Calculated as TRUTH VALUE
- PHYS_ATT_FACTOR = 0
- # Damage to Mp parameter says take the calculated damage and take it from
- # the target's MP instead of HP.
- # Calculated as TRUTH VALUE
- DAM_TO_MP_FACTOR = 30
- # Absorb Damage parameter says take damage dealt to target and add it back
- # in the form of heal to attacker
- # Calculated as TRUTH VALUE
- ABSORB_DAM_FACTOR = 100
- #Ignore Defense parameter says bypass any defense factor of the target
- # when attacking with this item
- # Calculated as TRUTH VALUE
- IGNORE_DEF_FACTOR = 250
- # Hp Recovery is the value of healing to target's hp is done with item
- # Calculated as POINT PER EVERY VALUE. This means for every second value
- # placed into the array, the price is increased by the first value
- # in the array. By default, it's 1 gold for every 20 HP.
- HP_RECOVERY_FACTOR = [1, 20]
- # Mp Recovery is the value of healing to target's mp is done with item.
- # Calculated as POINT PER EVERY VALUE, the same as HP.
- MP_RECOVERY_FACTOR = [1, 20]
- #Parameter Type and Parameter Points parameters work in coalition. This
- # factor is figured as POINTS PER TRUTH VALUE, which means that a different
- # POINTS PER VALUE calculation is made dependent upon which parameter type
- # is adjusted by the item. This item parameter basically adds
- # PERMANENTLY to a given parameter:
- #
- # [None, MaxHP, MaxMP, Attack, Defense, Spirit, Agility]
- #
- PARAMETER_POINTS_FACTOR = [0, 100, 100, 500, 500, 500, 500]
- # Element effects are the effects that the element is charged with. This
- # factor is figured as POINTS PER SIZE VALUE. Therefor, each element is
- # worth a specific value. The total value of the Item Element Factor is
- # figured by adding this value once per every element the item is charged
- # with.
- ITEM_ELEMENT_FACTOR = 5
- # State values are different for each state. This value is calculated
- # through a POINTS PER TRUTH VALUE, therefor for each of the states found
- # in the item's effects (both effects which add the state AND subtract the
- # state), the item will receive the value which corresponds with that
- # particular state. It is important then, that the values in the array are
- # set up in the exact order as they are found in the database.
- # Leave the first value at 'nil' to account for the fact that there is no
- # state with the ID of '0' in the database.
- ITEM_STATE_FACTOR = [nil, 100, 50, 50, 50, 50, 25, 50, 10, 5, 5, 5, 5,
- 5, 5, 5, 5]
- # FOR WEAPONS ONLY:
- # Hit parameter is used to determine the accuracy of the weapon
- # Calculated as POINT PER VALUE
- HIT_FACTOR = 1
- # Fast Attack is the parameter which is used to say, this weapon gets an
- # early turn during the attacking phase.
- # Calculated as TRUTH VALUE
- FAST_ATTACK_FACTOR = 250
- # Dual attack says take the damage dealt by weapon and do it twice to the
- # target.
- # Calculated as TRUTH VALUE
- DUAL_ATTACK_FACTOR = 500
- #Critical Bonus, means this weapon is capable of having a perfect strike
- # which can yield a major bonus to damage dealt.
- # Calculated as TRUTH VALUE
- CRITICAL_BONUS_FACTOR = 100
- # FOR ARMORS ONLY:
- # Evade is the parameter of an armor which making the target who is wearing
- # it harder to hit. Calculated as POINT PER VALUE
- EVADE_FACTOR = 25
- # Prevent Critical makes a critical attack on the wearer of the armor impossible
- # Calculated as TRUTH VALUE
- PREVENT_CRITICAL_FACTOR = 100
- # Half MP Cost makes MP drain from skill usage slower by halfing it's
- # specific cost when using it.
- # Calculated as TRUTH VALUE
- HALF_MP_COST_FACTOR = 250
- # Double Exp parameter means the wearer of the armor is given twice the
- # experience on battle victories than they would normally get.
- # Calculated as TRUTH VALUE
- DOUBLE_EXP_FACTOR = 1000
- # Auto HP Recover parameter means out of battle, the wearer's HP will
- # slowly regenerate on their own.
- # Calculated as TRUTH VALUE
- AUTO_HP_RECOVER_FACTOR = 500
- # FOR ALL EQUIPMENTS
- # Parameter parameters changet the equipped actor's base parameters when
- # the given equipment is equipped. Since specific
- # parameters are more crucial whether or not the item is a weapon or an
- # armor, (i.e. You want a weapon with a bigger atk and armor with a better
- # def), the system lists all parameter factors as two-element arrays:
- #
- # [weapon_factor, armor_factor]
- #
- # Calculated as POINT PER VALUE
- ATK_FACTOR = [25, 10]
- DEF_FACTOR = [10, 25]
- SPI_FACTOR = [10, 10]
- AGI_FACTOR = [10, 10]
- # Element Set parameter is an array of elements which the item doing the attacking
- # or defending is charged with. This value is calculated on a POINTS PER
- # SIZE VALUE, which means for every element, add this amount.
- ELEMENT_SET_FACTOR = 1000
- # State Set parameter is much like the Element Set factor, except when
- # calculated, it's figured more like the SCOPE_FACTOR, where each
- # specific state is given an individual value. Calculated as a TRUTH
- # VALUE for each state involved. Therefor, it will be important to
- # make sure you account for each of the states in the database and
- # set the values in the array to match the order of the states therein.
- #
- # By Default, the states are as follows, if you changed them, you'll have
- # to adjust to match the states in your project.
- #
- # [nil, incapacitated(dead), poison, darkness, silence, confusion, sleep, paralysis,
- # stun, atkup, defup, spiup, agiup, atkdown, defdown, spidown, agidown]
- #
- # Leave the 1st element of the array at 'nil' to account for the fact that
- # there is no State ID 0.
- #
- STATE_SET_FACTOR = [nil, 1000, 500, 500, 500, 500, 250, 500, 100, 50, 50, 50, 50,
- 50, 50, 50, 50]
- #===========================================================================
- # SECTION 10:
- # Banking
- #
- # Bank Interest is figured as a percentage. When payback amount is figured,
- # the formula is as follows:
- #
- # loan_amount + loan_amount * (interest_percentage / bank_rating)
- #
- # This constant will hold the starting interest percentage. It should be a
- # number greater than zero and less than 100. I advise never making this
- # value less than 10
- BANK_INTEREST = 50
- # The next value sets the Max Loan multipliler. This value is multiplied
- # by the party's bank rating to adjust how much gold is available for loan
- # at any point in the game.
- MAX_LOAN_MULTIPLIER = 1000
- # This value stores the highest possible bank rating. I would advise never
- # making this value more than ten.
- MAX_BANK_RATING = 10
- # This final bank constant is used to determine at what point, bank rating
- # increases. It will increase automatically based on the number of
- # loans which have been paid back. So this value is used to determine
- # how many loans need paid back before the rating increases by 1. By default,
- # the bank rating will grow by one after every 3 loans are paid back in full.
- BANK_RATING_ADJUSTMENT = 3
- # Qualifying Loan Amount is the amount of gold one must borrow before it
- # registers against bank paybacks and counts toward the bank rating
- # adjustment.
- QUALIFYING_LOAN_AMOUNT = 500
- #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- # STOP CONFIGURING
- #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- end
- module Regexp
- BARTER_TYPE = /<(barter)[\s]*(\d+)/i
- UNSELLABLE = /<(unsellable)>/i
- KEEP_PRICE = /<(keep_price)>/i
- DONT_STOCK = /<(dont_stock)>/i
- end
- end
- ################################################################################
- #*******************************************************************************
- # RPG::Item
- ################################################################################
- class RPG::Item
- def barter_type
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::BARTER_TYPE
- barter = $2.to_i
- return barter
- end
- }
- return nil
- end
- def unsellable
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::UNSELLABLE
- return true
- end
- }
- return false
- end
- def keep_price
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::KEEP_PRICE
- return true
- end
- }
- return false
- end
- def dont_stock
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::DONT_STOCK
- return true
- end
- }
- return false
- end
- def suey_price(action, shopkeeper) #buying or selling
- return @price if keep_price
- return @price unless Ixfuru::ShopKeep::USE_RENEWED_PRICING
- result = Ixfuru::ShopKeep::NO_VALUE
- result += Ixfuru::ShopKeep::SCOPE_FACTOR[@scope]
- result += Ixfuru::ShopKeep::SPEED_FACTOR * @speed
- unless @base_damage < 0
- result += Ixfuru::ShopKeep::BASE_DAMAGE_FACTOR * @base_damage
- end
- result += Ixfuru::ShopKeep::VARIANCE * @variance
- result += Ixfuru::ShopKeep::ATK_F_FACTOR * @atk_f
- result += Ixfuru::ShopKeep::SPI_F_FACTOR * @spi_f
- if @physical_attack
- result += Ixfuru::ShopKeep::PHYS_ATT_FACTOR
- end
- if @damage_to_mp
- result += Ixfuru::ShopKeep::DAM_TO_MP_FACTOR
- end
- if @absorb_damage
- result += Ixfuru::ShopKeep::ABSORB_DAM_FACTOR
- end
- if @ignore_defense
- result += Ixfuru::ShopKeep::IGNORE_DEF_FACTOR
- end
- for i in 1..@element_set.size
- if @element_set.include?($data_system.elements[i])
- result += Ixfuru::ShopKeep::ITEM_ELEMENT_FACTOR
- end
- end
- for i in 1..@plus_state_set.size
- if @plus_state_set.include?($data_states[i])
- result += Ixfuru::ShopKeep::ITEM_STATE_FACTOR[i]
- end
- end
- for i in 1..@minus_state_set.size
- if @minus_state_set.include?($data_states[i])
- result += Ixfuru::ShopKeep::STATE_SET_FACTOR[i]
- end
- end
- result += (@hp_recovery / Ixfuru::ShopKeep::HP_RECOVERY_FACTOR[1]) * Ixfuru::ShopKeep::HP_RECOVERY_FACTOR[0]
- result += (@mp_recovery / Ixfuru::ShopKeep::MP_RECOVERY_FACTOR[1]) * Ixfuru::ShopKeep::MP_RECOVERY_FACTOR[0]
- result += Ixfuru::ShopKeep::PARAMETER_POINTS_FACTOR[@parameter_type]
- case action
- when 0
- if $game_party.members[0].skills.include?(Ixfuru::ShopKeep::BUY_FAIR_SKILL)
- if result < 1
- result = 1
- end
- return result
- else
- if shopkeeper.stat_price
- result = shopkeeper.stat_price_adjustment
- if result < 1
- result = 1
- end
- return result
- else
- if result < 1
- result = 1
- end
- return result
- end
- end
- when 1
- if $game_party.members[0].skills.include?(Ixfuru::ShopKeep::SELL_100_SKILL)
- if result < 1
- result = 1
- end
- return result
- else
- result / 2
- if result < 1
- result = 1
- end
- return result
- end
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # RPG::Weapon
- ################################################################################
- class RPG::Weapon
- def barter_type
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::BARTER_TYPE
- barter = $2.to_i
- return barter
- end
- }
- return nil
- end
- def unsellable
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::UNSELLABLE
- return true
- end
- }
- return false
- end
- def keep_price
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::KEEP_PRICE
- return true
- end
- }
- return false
- end
- def dont_stock
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::DONT_STOCK
- return true
- end
- }
- return false
- end
- def suey_price(action, shopkeeper)
- return @price if keep_price
- return @price unless Ixfuru::ShopKeep::USE_RENEWED_PRICING
- result = Ixfuru::ShopKeep::NO_VALUE
- for i in 1..@element_set.size
- if @element_set.include?($data_system.elements[i])
- result += Ixfuru::ShopKeep::ELEMENT_SET_FACTOR
- end
- end
- for i in 1..@state_set.size
- if @state_set.include?($data_states[i])
- result += Ixfuru::ShopKeep::STATE_SET_FACTOR[i]
- end
- end
- result += Ixfuru::ShopKeep::ATK_FACTOR[0] * @atk
- result += Ixfuru::ShopKeep::DEF_FACTOR[0] * @def
- result += Ixfuru::ShopKeep::SPI_FACTOR[0] * @spi
- result += Ixfuru::ShopKeep::AGI_FACTOR[0] * @agi
- result += Ixfuru::ShopKeep::HIT_FACTOR * @hit
- if @fast_attack
- result += Ixfuru::ShopKeep::FAST_ATTACK_FACTOR
- end
- if @dual_attack
- result += Ixfuru::ShopKeep::DUAL_ATTACK_FACTOR
- end
- if @critical_bonus
- result += Ixfuru::ShopKeep::CRITICAL_BONUS_FACTOR
- end
- case action
- when 0
- if $game_party.members[0].skills.include?(Ixfuru::ShopKeep::BUY_FAIR_SKILL)
- if result < 1
- result = 1
- end
- return result
- else
- if shopkeeper.stat_price
- result = shopkeeper.stat_price_adjustment
- if result < 1
- result = 1
- end
- return result
- else
- if result < 1
- result = 1
- end
- return result
- end
- end
- when 1
- if $game_party.members[0].skills.include?(Ixfuru::ShopKeep::SELL_100_SKILL)
- if result < 1
- result = 1
- end
- return result
- else
- result / 2
- if result < 1
- result = 1
- end
- return result
- end
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # RPG::Armor
- ################################################################################
- class RPG::Armor
- def barter_type
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::BARTER_TYPE
- barter = $2.to_i
- return barter
- end
- }
- return nil
- end
- def unsellable
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::UNSELLABLE
- return true
- end
- }
- return false
- end
- def keep_price
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::KEEP_PRICE
- return true
- end
- }
- return false
- end
- def dont_stock
- self.note.split(/[\r\n]/).each { |line|
- case line
- when Ixfuru::Regexp::DONT_STOCK
- return true
- end
- }
- return false
- end
- def suey_price(action, shopkeeper)
- return @price if keep_price
- return @price unless Ixfuru::ShopKeep::USE_RENEWED_PRICING
- result = Ixfuru::ShopKeep::NO_VALUE
- for i in 1..@element_set.size
- if @element_set.include?($data_system.elements[i])
- result += Ixfuru::ShopKeep::ELEMENT_SET_FACTOR
- end
- end
- for i in 1..@state_set.size
- if @state_set.include?($data_states[i])
- result += Ixfuru::ShopKeep::STATE_SET_FACTOR[i]
- end
- end
- result += Ixfuru::ShopKeep::ATK_FACTOR[0] * @atk
- result += Ixfuru::ShopKeep::DEF_FACTOR[0] * @def
- result += Ixfuru::ShopKeep::SPI_FACTOR[0] * @spi
- result += Ixfuru::ShopKeep::AGI_FACTOR[0] * @agi
- result += Ixfuru::ShopKeep::EVADE_FACTOR * @eva
- if @prevent_critical
- result += Ixfuru::ShopKeep::PREVENT_CRITICAL_FACTOR
- end
- if @half_mp_cost
- result += Ixfuru::ShopKeep::HALF_MP_COST_FACTOR
- end
- if @double_exp_gain
- result += Ixfuru::ShopKeep::DOUBLE_EXP_FACTOR
- end
- if @auto_hp_recover
- result += Ixfuru::ShopKeep::AUTO_HP_RECOVER
- end
- case action
- when 0
- if $game_party.members[0].skills.include?(Ixfuru::ShopKeep::BUY_FAIR_SKILL)
- if result < 1
- result = 1
- end
- return result
- else
- if shopkeeper.stat_price
- result = shopkeeper.stat_price_adjustment
- if result < 1
- result = 1
- end
- return result
- else
- if result < 1
- result = 1
- end
- return result
- end
- end
- when 1
- if $game_party.members[0].skills.include?(Ixfuru::ShopKeep::SELL_100_SKILL)
- if result < 1
- result = 1
- end
- return result
- else
- result / 2
- if result < 1
- result = 1
- end
- return result
- end
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # SCENE TITLE
- ################################################################################
- class Scene_Title < Scene_Base
- #--------------------------------------------------------------------------
- # * Create Game Objects (Aliased)
- #--------------------------------------------------------------------------
- alias ix_shops_sctitle_create_game_objects create_game_objects unless $@
- def create_game_objects
- ix_shops_sctitle_create_game_objects
- $game_shops = Game_Shops.new
- $game_shopkeepers = Game_Shopkeepers.new
- $game_bank = Game_Bank.new
- end
- end
- ################################################################################
- #*******************************************************************************
- # SCENE FILE
- ################################################################################
- class Scene_File < Scene_Base
- #-----------------------------------------------------------------------------
- # Read Save Data (Aliased)
- #-----------------------------------------------------------------------------
- alias ix_shops_scfile_read_save_data read_save_data unless $@
- def read_save_data(file)
- $game_shops = Marshal.load(file)
- $game_shopkeepers = Marshal.load(file)
- $game_bank = Marshal.load(file)
- ix_shops_scfile_read_save_data(file)
- end
- #-----------------------------------------------------------------------------
- # Write Save Data (Aliased)
- #-----------------------------------------------------------------------------
- alias ix_shops_scfile_write_save_data write_save_data unless $@
- def write_save_data(file)
- ix_shops_scfile_write_save_data(file)
- Marshal.dump($game_shops, file)
- Marshal.dump($game_shopkeepers, file)
- Marshal.dump($game_bank, file)
- end
- end
- ################################################################################
- #*******************************************************************************
- # GAME SHOP
- ################################################################################
- class Game_Shop
- attr_reader :shop_id
- attr_reader :name
- attr_reader :services
- attr_reader :barter_types
- attr_reader :inventory_list
- attr_reader :bgm
- attr_accessor :inventory
- #--------------------------------------------------------------------------
- # * Object Initialization
- # shop_id : shop ID
- #--------------------------------------------------------------------------
- def initialize(shop_id)
- super()
- unless @shop_set
- @iventory_set = false
- setup(shop_id)
- end
- end
- #--------------------------------------------------------------------------
- # * Setup
- # shop_id : shop ID
- #--------------------------------------------------------------------------
- def setup(shop_id)
- shop = Ixfuru::ShopKeep::SHOPS[shop_id]
- @shop_id = shop_id
- @name = shop[0]
- @services = shop[1]
- @barter_types = shop[2]
- @inventory_list = shop[3]
- @bgm = shop[4]
- @inventory = inventory
- @shop_set = true
- end
- #-----------------------------------------------------------------------------
- # Get Inventory
- #-----------------------------------------------------------------------------
- def inventory
- unless @inventory_set
- result = []
- for key in Ixfuru::ShopKeep::SHOP_INVENTORIES[@inventory_list].keys
- case key
- when 0 # items
- for item in Ixfuru::ShopKeep::SHOP_INVENTORIES[@inventory_list][key]
- result.push($data_items[item])
- end
- when 1 # weapons
- for weapon in Ixfuru::ShopKeep::SHOP_INVENTORIES[@inventory_list][key]
- result.push($data_weapons[weapon])
- end
- when 2 # armors
- for armor in Ixfuru::ShopKeep::SHOP_INVENTORIES[@inventory_list][key]
- result.push($data_armors[armor])
- end
- end
- end
- @inventory = result
- @inventory_set = true
- return @inventory
- end
- return @inventory
- end
- #-----------------------------------------------------------------------------
- # Barters Item:
- # By passing this method the argument of an item, you can see if the given shop
- # will purchase the item from the player. This can be set up in a conditional
- # branch.
- #-----------------------------------------------------------------------------
- def barters_item?(item)
- return false if item.unsellable
- if @services.include?(1)
- return false if @barter_types == nil
- if @barter_types.is_a?(Array)
- if @barter_types.include?(item.barter_type)
- return true
- else
- return false
- end
- else
- if @barter_types == "all"
- return true
- elsif @barter_types == "items" && item.is_a?(RPG::Item)
- return true
- elsif @barter_types == "equipment"
- if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
- return true
- else
- return false
- end
- elsif @barter_types == "weapons" && item.is_a?(RPG::Weapon)
- return true
- elsif @barter_types == "armors" && item.is_a?(RPG::Armor)
- return true
- end
- end
- else
- return false
- end
- end
- #-----------------------------------------------------------------------------
- # Reset Inventory
- #-----------------------------------------------------------------------------
- def reset_inventory
- @inventory_set = false
- end
- #-----------------------------------------------------------------------------
- # Services
- #-----------------------------------------------------------------------------
- def services
- result = []
- if !@services.empty?
- for i in 0...@services.size
- case @services[i]
- when 0 # buys
- result.push(Ixfuru::ShopKeep::BUY_COMMAND)
- when 1 # allows sell
- result.push(Ixfuru::ShopKeep::SELL_COMMAND)
- when 2 # banking permitted
- result.push(Ixfuru::ShopKeep::BANK_COMMAND)
- end
- end
- return result
- end
- end
- #-----------------------------------------------------------------------------
- # Add to Inventory
- #-----------------------------------------------------------------------------
- def add_to_inventory(item)
- unless @inventory.include?(item)
- @inventory.push(item)
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # GAME SHOPKEEPER
- ################################################################################
- class Game_Shopkeeper
- attr_reader :name
- attr_reader :char_set
- attr_reader :char_index
- attr_reader :face_set
- attr_reader :face_index
- attr_accessor :gold
- attr_reader :gold_growth_increase
- attr_reader :stat_price
- attr_reader :price_stat_base
- attr_reader :price_modifier
- def initialize(keeper_id)
- super()
- unless @keeper_set
- @gold_set = false
- setup(keeper_id)
- end
- end
- #-----------------------------------------------------------------------------
- # Setup:
- #
- # keeper_id => [name, char_set, char_index, face_set, face_index, gold,
- # gold_growth_increase, stat_price, price_stat_base,
- # price_modifier, dialogue]
- #
- #-----------------------------------------------------------------------------
- def setup(keeper_id)
- keeper = Ixfuru::ShopKeep::SHOPKEEPERS[keeper_id]
- @keeper_id = keeper_id
- @name = keeper[0]
- @char_set = keeper[1]
- @char_index = keeper[2]
- @face_set = keeper[3]
- @face_index = keeper[4]
- @gold_growth_increase = keeper[6]
- @state_price = keeper[7]
- @stat_price_base = keeper[8]
- @price_modifier = keeper[9]
- @gold = gold
- @keeper_set = true
- end
- #-----------------------------------------------------------------------------
- # Get Gold
- #-----------------------------------------------------------------------------
- def gold
- result = []
- unless @gold_set
- result = Ixfuru::ShopKeep::SHOPKEEPERS[@keeper_id][5]
- @gold_set = true
- return result
- end
- return @gold
- end
- #-----------------------------------------------------------------------------
- # Gold Growth
- #-----------------------------------------------------------------------------
- def gold_growth
- @gold += @gold_growth_increase
- end
- #-----------------------------------------------------------------------------
- # Reset Gold
- #-----------------------------------------------------------------------------
- def reset_gold
- @gold_set = false
- end
- #-----------------------------------------------------------------------------
- # Make Stat Price Adjustment:
- # This method receives the price as currently totalled, then adjusts it if
- # applicable with the shopkeepers adjustment settings, and then returns the
- # new value.
- #-----------------------------------------------------------------------------
- def stat_price_adjustment(price)
- return price unless @stat_price
- if @price_modifier >= 0 && @price_modifier < 6
- mod = @price_modifier
- else
- mod = 5
- end
- result = price
- parameter = @price_stat_base.to_sym
- tally = 0
- for member in $game_party.members.size
- tally += member.parameter
- end
- tally = tally / $game_party.members.size
- case mod
- when 0 # add
- result += tally
- when 1 #subtract
- result -= tally
- if result <= 0
- result = 1
- end
- when 2 #multiplies
- result *= tally
- when 3 #divides
- unless tally < 1
- result /= tally
- end
- when 4 # modulus
- unless tally < 1
- result %= tally
- end
- if result <= 0
- result = 1
- end
- when 5
- result = result * tally / 100
- if result <= 0
- result = 1
- end
- end
- return result
- end
- #-----------------------------------------------------------------------------
- # Get Dialogue:
- # This method takes the argument of shop phase and determines which dialogue
- # should be used and displayed.
- #-----------------------------------------------------------------------------
- def dialogue(shop_phase)
- if Ixfuru::ShopKeep::DIALOGUES[@keeper_id] != nil
- text = Ixfuru::ShopKeep::DIALOGUES[@keeper_id]
- return text[shop_phase]
- else
- text = Ixfuru::ShopKeep::DIALOGUES[NO_DIALOGUE]
- return text
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # GAME SHOPS
- #
- # The new class responsible for containing all the properties of each new shop,
- # as contained in the ShopKeep module. Scripters can access this class by
- # using $game_shops.
- ################################################################################
- class Game_Shops
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- @data = []
- end
- #--------------------------------------------------------------------------
- # * Get Shop
- # shop_id : Shop ID
- #--------------------------------------------------------------------------
- def [](shop_id)
- if @data[shop_id] == nil #and $game_shops[shop_id] != nil
- @data[shop_id] = Game_Shop.new(shop_id)
- end
- return @data[shop_id]
- end
- #-----------------------------------------------------------------------------
- # Shops:
- # Used to get the collective group of shops. Used in order to perform tasks
- # on every shop in the game
- #-----------------------------------------------------------------------------
- def shops
- result = []
- for i in 0...Ixfuru::ShopKeep::SHOPS.keys.size
- result.push(Ixfuru::ShopKeep::SHOPS.keys[i])
- end
- return result
- end
- #-----------------------------------------------------------------------------
- # Reset Inventories
- #-----------------------------------------------------------------------------
- def reset_inventories
- for shop in shops
- $game_shops[shop].reset_inventory
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # GAME SHOPKEEPERS
- #
- # The new class responsible for containing all the information for shopkeepers
- # in the ShopKeep module. Scripters can access the class by using
- # $game_shopkeepers.
- ################################################################################
- class Game_Shopkeepers
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- @data = []
- end
- #--------------------------------------------------------------------------
- # * Get ShopKeeper
- # keeper_id : ShopKeeper ID
- #--------------------------------------------------------------------------
- def [](keeper_id)
- if @data[keeper_id] == nil #and $game_shopkeepers[keeper_id] != nil
- @data[keeper_id] = Game_Shopkeeper.new(keeper_id)
- end
- return @data[keeper_id]
- end
- #-----------------------------------------------------------------------------
- # Keepers:
- # Allows access to perform tasks on ALL the shopkeepers in the game.
- #-----------------------------------------------------------------------------
- def keepers
- result = []
- for i in 0...Ixfuru::ShopKeep::SHOPKEEPERS.keys.size
- result.push(Ixfuru::ShopKeep::SHOPKEEPERS.keys[i])
- end
- return result
- end
- #-----------------------------------------------------------------------------
- # Reset Gold
- #-----------------------------------------------------------------------------
- def reset_gold
- for keeper in keepers
- $game_shopkeepers[keeper].reset_gold
- end
- end
- #-----------------------------------------------------------------------------
- # Gold Growth
- #-----------------------------------------------------------------------------
- def gold_growth
- for keeper in keepers
- $game_shopkeepers[keeper].gold_growth
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # GAME BANK:
- # This class is accessed by the call of global variable "$game_bank".
- ################################################################################
- class Game_Bank
- attr_accessor :current_loan
- attr_reader :max_loan_modifier
- attr_accessor :loan_out
- attr_accessor :bank_rating_adjuster
- attr_accessor :qualifying_loan
- attr_accessor :qualifying_loan_amount
- attr_accessor :loan_balance
- def initialize
- @max_loan_modifier = Ixfuru::ShopKeep::MAX_LOAN_MULTIPLIER
- @bank_rating_adjuster = [0]
- quick_adjust = Ixfuru::ShopKeep::BANK_RATING_ADJUSTMENT
- for i in 1...Ixfuru::ShopKeep::MAX_BANK_RATING
- @bank_rating_adjuster[i] = quick_adjust
- quick_adjust += quick_adjust
- end
- @bank_paybacks = 0
- @current_loan = 0
- @loan_balance = 0
- @loan_out = false
- @qualifying_loan = false
- @qualifying_loan_amount = Ixfuru::ShopKeep::QUALIFYING_LOAN_AMOUNT
- end
- #-----------------------------------------------------------------------------
- # Get Interest
- #-----------------------------------------------------------------------------
- def interest(loan_amount)
- return loan_amount * interest_rate / 100
- end
- #-----------------------------------------------------------------------------
- # Get Interest Rate
- #-----------------------------------------------------------------------------
- def interest_rate
- return Ixfuru::ShopKeep::BANK_INTEREST / bank_rating
- end
- #-----------------------------------------------------------------------------
- # Bank Rating
- #-----------------------------------------------------------------------------
- def bank_rating
- for i in 0...@bank_rating_adjuster.size
- if @bank_paybacks > @bank_rating_adjuster[i] && @bank_rating_adjuster[i + 1]
- rating = i
- return rating
- end
- end
- return 1
- end
- #-----------------------------------------------------------------------------
- # Get Max Loan
- #-----------------------------------------------------------------------------
- def max_loan
- if bank_rating > 0
- max = @max_loan_modifier * bank_rating
- return max
- else
- return Ixfuru::ShopKeep::QUALIFYING_LOAN_AMOUNT
- end
- end
- #-----------------------------------------------------------------------------
- # Can Loan
- #-----------------------------------------------------------------------------
- def can_loan?
- return false if @loan_out
- return true
- end
- #-----------------------------------------------------------------------------
- # Finish Payback
- #-----------------------------------------------------------------------------
- def finish_payback
- if @qualifying_loan
- @bank_paybacks += 1
- @qualifying_loan = false
- end
- @loan_out = false
- end
- #-----------------------------------------------------------------------------
- # Finish Loan
- #-----------------------------------------------------------------------------
- def finish_loan(amount_loaning)
- @current_loan = amount_loaning
- @loan_balance = amount_loaning
- @loan_out = true
- if amount_loaning >= @qualifying_loan_amount
- @qualifying_loan = true
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW SHOP COMMANDS
- ################################################################################
- class Window_ShopCommands < Window_Selectable
- def initialize(shop_id)
- @shop = $game_shops[shop_id]
- @commands = []
- for service in @shop.services
- case service
- when Ixfuru::ShopKeep::BUY_COMMAND
- @commands.push(Ixfuru::ShopKeep::BUY_COMMAND)
- when Ixfuru::ShopKeep::SELL_COMMAND
- @commands.push(Ixfuru::ShopKeep::SELL_COMMAND)
- when Ixfuru::ShopKeep::BANK_COMMAND
- @commands.push(Ixfuru::ShopKeep::BANK_COMMAND)
- end
- end
- @commands.push("Exit")
- super(0, 0, 180, 32 + (@commands.size * WLH))
- @item_max = @commands.size
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_items(i)
- end
- end
- def draw_items(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.draw_text(rect, @commands[index], 1)
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW SHOP NAME
- ################################################################################
- class Window_ShopName < Window_Base
- def initialize(shop_id)
- super(181, 0, 236, 64)
- @shop = $game_shops[shop_id]
- @name = @shop.name
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.size = 24
- self.contents.font.color = text_color(Ixfuru::ShopKeep::SHOP_NAME_COLOR)
- self.contents.draw_text(-16, 0, self.width, WLH, @name, 1)
- self.contents.font.size = 20
- self.contents.font.color = normal_color
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW SHOP KIND
- ################################################################################
- class Window_ShopKind < Window_Base
- attr_accessor :shop_kind
- def initialize(shop_id)
- super(417, 0, 128, 80)
- @shop = $game_shops[shop_id]
- @shop_kind = 3
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.size = 14
- self.contents.font.color = system_color
- @line_size = 18
- case @shop_kind
- when 0
- self.contents.draw_text(-16, 0, self.width, @line_size, "Buying", 1)
- when 1
- self.contents.draw_text(-16, 0, self.width, @line_size, "Selling", 1)
- when 2
- self.contents.draw_text(-16, 0, self.width, @line_size, "Banking", 1)
- when 3
- self.contents.draw_text(-16, 0, self.width, @line_size, "", 1)
- end
- self.contents.font.size = 20
- self.contents.font.color = normal_color
- draw_icon(Ixfuru::ShopKeep::SHOP_GOLD_ICON, 0, @line_size)
- self.contents.draw_text(30, @line_size, self.width, @line_size, $game_party.gold.to_i)
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW SHOPKEEPER
- ################################################################################
- class Window_ShopKeeper < Window_Base
- def initialize(keeper_id)
- super(417, 224, 128, 192)
- @shopkeeper = $game_shopkeepers[keeper_id]
- @keeper_style = Ixfuru::ShopKeep::SHOPKEEPER_STYLE
- @name_display = Ixfuru::ShopKeep::SHOPKEEPER_NAME_DISPLAY
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.size = 14
- self.contents.font.color = text_color(Ixfuru::ShopKeep::KEEPER_NAME_COLOR)
- @line_size = 18
- case @name_display
- when 0
- case @keeper_style
- when 0
- draw_face(@shopkeeper.face_set, @shopkeeper.face_index, 0, 0)
- when 1
- draw_character(@shopkeeper.char_set, @shopkeeper.char_index, 0, 0)
- end
- self.contents.draw_text(-16, 97, self.width, @line_size, @shopkeeper.name, 1)
- when 1
- self.contents.draw_text(-16, 0, self.width, @line_size, @shopkeeper.name, 1)
- case @keeper_style
- when 0
- draw_face(@shopkeeper.face_set, @shopkeeper.face_index, 0, 25)
- when 1
- draw_character(@shopkeeper.char_set, @shopkeeper.char_index, 0, 25)
- end
- end
- self.contents.font.color = system_color
- if Ixfuru::ShopKeep::USE_KEEPER_GOLD
- self.contents.draw_text(0, 97 + @line_size, self.width, @line_size, Vocab::gold + ": ")
- self.contents.font.color = normal_color
- self.contents.draw_text(60, 97 + @line_size, self.width, @line_size, @shopkeeper.gold.to_s)
- end
- self.contents.font.size = 20
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW DIALOGUE
- ################################################################################
- class Window_ShopDialogue < Window_Base
- attr_accessor :shop_phase
- def initialize(keeper_id)
- super(0, 352, 416, 64)
- @shopkeeper = $game_shopkeepers[keeper_id]
- @shop_phase = 0
- refresh
- end
- def refresh
- self.contents.clear
- self.contents.font.size = 16
- @dialogue = @shopkeeper.dialogue(@shop_phase)
- self.contents.draw_text(-16, 0, self.width, WLH, @dialogue, 1)
- self.contents.font.size = 20
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW AMOUNT ADJUSTMENT
- ################################################################################
- class Window_AmountAdjustment < Window_Selectable
- attr_accessor :amount
- attr_accessor :item
- def initialize(item)
- super(0, 288, 259, 64)
- @item = item
- @item_max = 1
- @amount = 1
- refresh
- self.active = false
- self.visible = false
- self.index = 0
- self.z = 120
- end
- def refresh
- self.contents.clear
- if @amount < 1
- @amount = 1
- elsif @amount > 99
- @amount = 99
- end
- draw_item_name(@item, 0, 0)
- self.contents.draw_text(180, 0, self.width, WLH, " x " + @amount.to_s)
- end
- end
- ################################################################################
- #*******************************************************************************
- # SELL POSSESSION WINDOW
- ################################################################################
- class Window_SellPossession < Window_Base
- attr_accessor :item
- def initialize(item)
- super(0, 0, 180, 64)
- @item = item
- refresh
- self.visible = false
- end
- def refresh
- self.contents.clear
- @line_size = 20
- self.contents.font.size = 16
- self.contents.font.color = system_color
- self.contents.draw_text(0, 0, self.width, @line_size, "In Possession: ")
- self.contents.font.color = normal_color
- self.contents.draw_text(120, 0, self.width, @line_size, $game_party.item_number(@item).to_s)
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW BUY PRODUCTS
- ################################################################################
- class Window_BuyProducts < Window_Selectable
- attr_accessor :products
- def initialize(shop_id, keeper_id)
- super(0, 65, 259, 224)
- @shop = $game_shops[shop_id]
- @shopkeeper = $game_shopkeepers[keeper_id]
- refresh
- self.visible = false
- self.active = false
- self.index = 0
- end
- def refresh
- @products = @shop.inventory
- @item_max = @products.size
- create_contents
- for i in 0...@item_max
- draw_items(i)
- end
- end
- def draw_items(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- if is_buyable?(@products[index])
- draw_item_name(@products[index], rect.x, rect.y)
- else
- draw_item_name(@products[index], rect.x, rect.y, false)
- end
- self.contents.font.color.alpha = is_buyable?(@products[index]) ? 255 : 128
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- self.contents.draw_text(rect.x + 180, rect.y, self.width, WLH, (@products[index]).suey_price(0, @shopkeeper).to_s)
- else
- self.contents.draw_text(rect.x + 180, rect.y, self.width, WLH, (@products[index]).price.to_s)
- end
- self.contents.font.color.alpha = 255
- end
- def is_buyable?(item)
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- return true if $game_party.gold >= item.suey_price(0, @shopkeeper)
- else
- return true if $game_party.gold >= item.price
- end
- return false
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW SELL PRODUCTS
- ################################################################################
- class Window_SellProducts < Window_Selectable
- attr_accessor :sellables
- def initialize(shop_id, keeper_id)
- super(0, 65, 259, 224)
- @shop = $game_shops[shop_id]
- @shopkeeper = $game_shopkeepers[keeper_id]
- refresh
- self.visible = false
- self.active = false
- self.index = 0
- end
- def refresh
- @sellables = $game_party.items
- @item_max = @sellables.size
- create_contents
- for i in 0...@item_max
- draw_items(i)
- end
- end
- def draw_items(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -=8
- if is_sellable?(@sellables[index])
- draw_item_name(@sellables[index], rect.x, rect.y)
- else
- draw_item_name(@sellables[index], rect.x, rect.y, false)
- end
- self.contents.font.color.alpha = is_sellable?(@sellables[index]) ? 255 : 128
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- self.contents.draw_text(rect.x + 180, rect.y, self.width, WLH, (@sellables[index]).suey_price(1, @shopkeeper).to_s)
- else
- self.contents.draw_text(rect.x + 180, rect.y, self.width, WLH, ((@sellables[index]).price / 2).to_s)
- end
- self.contents.font.color.alpha = 255
- end
- def is_sellable?(item)
- return false if item.unsellable
- return false unless @shop.barters_item?(item)
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- if Ixfuru::ShopKeep::USE_KEEPER_GOLD
- return true if @shopkeeper.gold >= item.suey_price(1, @shopkeeper)
- return false
- end
- else
- if Ixfuru::ShopKeep::USE_KEEPER_GOLD
- return true if @shopkeeper.gold >= item.suey_price(1, @shopkeeper)
- return false
- else
- return false if item.price == 0
- return true if @shopkeeper.gold >= item.price / 2
- return false
- end
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW PRODUCT DESCRIPTION
- ################################################################################
- class Window_ProductDescription < Window_Base
- attr_accessor :item
- def initialize(item)
- super(262, 65, 154, 288)
- @item = item
- refresh
- self.visible = false
- end
- def refresh
- self.contents.clear
- draw_icon(@item.icon_index, 0, 0)
- self.contents.font.color = normal_color
- self.contents.draw_text(30, 0, self.width, WLH, @item.name)
- self.contents.font.size = 12
- @line_size = 16
- base_y = @line_size * 2
- if @item.is_a?(RPG::Item)
- draw_item_scope(@item, 0, base_y)
- draw_item_effect(@item, 0, base_y + @line_size)
- draw_item_properties(@item, 0, base_y + (@line_size * 2))
- draw_item_elements(@item, 0, base_y + (@line_size * 11))
- draw_item_states(@item, 0, base_y + (@line_size * 7), "minus")
- draw_item_states(@item, 0, base_y + (@line_size * 9), "add")
- elsif @item.is_a?(RPG::Weapon)
- draw_equip_parameters(@item, 0, base_y)
- draw_equip_properties(@item, 0, base_y + @line_size * 5)
- draw_item_elements(@item, 0, base_y + @line_size * 10)
- draw_equip_states(@item, 0, base_y + @line_size * 12)
- elsif @item.is_a?(RPG::Armor)
- draw_equip_parameters(@item, 0, base_y)
- draw_equip_properties(@item, 0, base_y + @line_size * 5)
- draw_item_elements(@item, 0, base_y + @line_size * 10)
- draw_equip_states(@item, 0, base_y + @line_size * 12)
- end
- end
- #-----------------------------------------------------------------------------
- # Draw Equip Properties
- #-----------------------------------------------------------------------------
- def draw_equip_properties(equip, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(-16, y, self.width, @line_size, "PROPERTIES", 1)
- self.contents.font.color = normal_color
- spacey = 0
- if equip.is_a?(RPG::Weapon)
- props = [equip.fast_attack, equip.dual_attack, equip.critical_bonus]
- for i in 0...props.size
- case i
- when 0
- if props[i]
- self.contents.draw_text(-16, @line_size + @line_size * spacey, self.width, @line_size, "FastAttack", 1)
- spacey += 1
- end
- when 1
- if props[i]
- self.contents.draw_text(-16, @line_size + @line_size * spacey, self.width, @line_size, "DualAttack", 1)
- spacey += 1
- end
- when 2
- if props[i]
- self.contents.draw_text(-16, @line_size + @line_size * spacey, self.width, @line_size, "CriticalBonus", 1)
- spacey += 1
- end
- end
- end
- elsif equip.is_a?(RPG::Armor)
- props = [equip.prevent_critical, equip.half_mp_cost, equip.double_exp_gain, equip.auto_hp_recover]
- for i in 0...props.size
- case i
- when 0
- if props[i]
- self.contents.draw_text(-16, @line_size + @line_size * spacey, self.width, @line_size, "PreventCritical", 1)
- spacey += 1
- end
- when 1
- if props[i]
- self.contents.draw_text(-16, @line_size + @line_size * spacey, self.width, @line_size, "Half" + Vocab::mp + "Cost", 1)
- spacey += 1
- end
- when 2
- if props[i]
- self.contents.draw_text(-16, @line_size + @line_size * spacey, self.width, @line_size, "DoubleExpGain", 1)
- spacey += 1
- end
- when 3
- if props[i]
- self.contents.draw_text(-16, @line_size + @line_size * spacey, self.width, @line_size, "Auto" + Vocab::hp + "Recover", 1)
- spacey += 1
- end
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Draw Equip Parameters
- #-----------------------------------------------------------------------------
- def draw_equip_parameters(equip, x, y)
- self.contents.font.color = system_color
- spacex = 30
- self.contents.draw_text(x, y, self.width, @line_size, Vocab::atk)
- self.contents.draw_text(x, y + @line_size, self.width, @line_size, Vocab::def)
- self.contents.draw_text(x, y + @line_size * 2, self.width, @line_size, Vocab::spi)
- self.contents.draw_text(x, y + @line_size * 3, self.width, @line_size, Vocab::agi)
- self.contents.font.color = normal_color
- self.contents.draw_text(spacex, y, self.width, @line_size, equip.atk)
- self.contents.draw_text(spacex, y + @line_size, self.width, @line_size, equip.def)
- self.contents.draw_text(spacex, y + @line_size * 2, self.width, @line_size, equip.spi)
- self.contents.draw_text(spacex, y + @line_size * 3, self.width, @line_size, equip.agi)
- end
- #-----------------------------------------------------------------------------
- # Draw Item States
- #-----------------------------------------------------------------------------
- def draw_item_states(item, x, y, modifier)
- case modifier
- when "minus"
- self.contents.font.color = system_color
- self.contents.draw_text(-16, y, self.width, @line_size, "CURE STATES", 1)
- xspace = 0
- for state in item.minus_state_set
- draw_icon(Ixfuru::ShopKeep::STATE_ICON_IDS[state], x + xspace, y + @line_size)
- xspace += 24
- end
- when "add"
- self.contents.font.color = system_color
- self.contents.draw_text(-16, y, self.width, @line_size, "ADD STATES", 1)
- xspace = 0
- for state in item.plus_state_set
- draw_icon(Ixfuru::ShopKeep::STATE_ICON_IDS[state], x + xspace, y + @line_size)
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Draw Item Elements
- #-----------------------------------------------------------------------------
- def draw_item_elements(item, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(-16, y, self.width, @line_size, "ELEMENTS", 1)
- xspace = 0
- for element in item.element_set
- draw_icon(Ixfuru::ShopKeep::ELEMENT_ICON_IDS[element], x + xspace, y + @line_size)
- xspace += 24
- end
- self.contents.font.color = normal_color
- end
- #-----------------------------------------------------------------------------
- # Draw Equip States
- #-----------------------------------------------------------------------------
- def draw_equip_states(equip, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(-16, y, self.width, @line_size, "STATES", 1)
- xspace = 0
- for state in equip.state_set
- draw_icon(Ixfuru::ShopKeep::STATE_ICON_IDS[state], x + xspace, y + @line_size)
- xspace += 24
- end
- self.contents.font.color = normal_color
- end
- #-----------------------------------------------------------------------------
- # Draw Item Properties
- #-----------------------------------------------------------------------------
- def draw_item_properties(item, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(-16, y, self.width, @line_size, "PROPERTIES", 1)
- self.contents.font.color = normal_color
- props = [item.physical_attack, item.absorb_damage, item.ignore_defense]
- curline = 1
- for i in 0...props.size
- case i
- when 0
- if props[i]
- self.contents.draw_text(-16, y + (@line_size * curline), self.width, @line_size, "PhysicalAttack", 1)
- cur_line += 1
- end
- when 1
- if props[i]
- self.contents.draw_text(-16, y + (@line_size * curline), self.width, @line_size, "AbsorbDamage", 1)
- cur_line += 1
- end
- when 2
- if props[i]
- self.contents.draw_text(-16, y + (@line_size * curline), self.width, @line_size, "IgnoreDefense", 1)
- cur_lin += 1
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Draw Item Effect
- #-----------------------------------------------------------------------------
- def draw_item_effect(item, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, self.width, @line_size, "EFFECT")
- self.contents.font.color = normal_color
- if item.hp_recovery > 0 && item.mp_recovery > 0
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Heals" + Vocab::hp + "&" + Vocab::mp)
- elsif item.hp_recovery > 0
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Heals" + Vocab::hp)
- elsif item.mp_recovery > 0
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Heals" + Vocab::mp)
- elsif item.parameter_type > 0 && item.parameter_points > 0
- case item.parameter_type
- when 1
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Adds" + Vocab::hp)
- when 2
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Adds" + Vocab::mp)
- when 3
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Adds" + Vocab::atk)
- when 4
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Adds" + Vocab::def)
- when 5
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Adds" + Vocab::spi)
- when 6
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Adds" + Vocab::agi)
- end
- elsif item.base_damage > 0 && item.damage_to_mp
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Attacks" + Vocab::mp)
- elsif item.base_damage > 0 && !item.damage_to_mp
- self.contents.draw_text(x + 55, y, self.width, @line_size, "Attacks" + Vocab::hp)
- end
- end
- #---------------------------------------------------------------------------
- # Draw Item Scope
- #---------------------------------------------------------------------------
- def draw_item_scope(item, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, self.width, @line_size, "SCOPE")
- self.contents.font.color = normal_color
- case item.scope
- when 0
- self.contents.draw_text(x + 55, y, self.width, @line_size, "None")
- when 1
- self.contents.draw_text(x + 55, y, self.width, @line_size, "OneEnemy")
- when 2
- self.contents.draw_text(x + 55, y, self.width, @line_size, "AllEnemies")
- when 3
- self.contents.draw_text(x + 55, y, self.width, @line_size, "EnemyDual")
- when 4
- self.contents.draw_text(x + 55, y, self.width, @line_size, "OneEnemy")
- when 5
- self.contents.draw_text(x + 55, y, self.width, @line_size, "2Enemies")
- when 6
- self.contents.draw_text(x + 55, y, self.width, @line_size, "3Enemies")
- when 7
- self.contents.draw_text(x + 55, y, self.width, @line_size, "OneAlly")
- when 8
- self.contents.draw_text(x + 55, y, self.width, @line_size, "AllAllies")
- when 9
- self.contents.draw_text(x + 55, y, self.width, @line_size, "DeadAlly")
- when 10
- self.contents.draw_text(x + 55, y, self.width, @line_size, "DeadAllies")
- when 11
- self.contents.draw_text(x + 55, y, self.width, @line_size, "UserOnly")
- end
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW BANK INFO
- ################################################################################
- class Window_BankInfo < Window_Base
- attr_accessor :current_loan
- attr_accessor :loan_balance
- def initialize
- super(0, 65, 416, 140)
- refresh
- self.visible = false
- end
- def refresh
- self.contents.clear
- @rating = $game_bank.bank_rating
- @max_loan = $game_bank.max_loan
- @current_loan = $game_bank.current_loan
- @loan_balance = $game_bank.loan_balance
- self.contents.font.color = system_color
- self.contents.draw_text(0, 0, self.width, WLH, "RATING:")
- self.contents.draw_text(0, WLH, self.width, WLH, "MAX LOAN:")
- self.contents.draw_text(0, WLH * 2, self.width, WLH, "CURRENT LOAN:")
- self.contents.draw_text(0, WLH * 3, self.width, WLH, "LOAN BALANCE:")
- self.contents.font.color = normal_color
- self.contents.draw_text(200, 0, self.width, WLH, @rating.to_s)
- self.contents.draw_text(200, WLH, self.width, WLH, @max_loan.to_s)
- self.contents.draw_text(200, WLH * 2, self.width, WLH, @current_loan.to_s)
- self.contents.draw_text(200, WLH * 3, self.width, WLH, @loan_balance.to_s)
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW BANK ACTION
- ################################################################################
- class Window_BankAction < Window_Selectable
- def initialize
- super(0, 205, 416, 80)
- @commands = ["TAKE LOAN", "PAYBACK LOAN"]
- @item_max = @commands.size
- refresh
- self.index = 0
- self.active = false
- self.visible = false
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_items(i)
- end
- end
- def draw_items(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.draw_text(rect.x - 16, rect.y, self.width, WLH, @commands[index], 1)
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW BANK INPUT
- ################################################################################
- class Window_BankInput < Window_Selectable
- attr_accessor :action
- attr_accessor :amount
- attr_accessor :multiplier
- def initialize
- super(0, 286, 416, 64)
- @action = 0
- @amount = 0
- @multiplier = 1
- @item_max = 1
- refresh
- self.index = 0
- self.visible = false
- self.active = false
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_items(i)
- end
- end
- def draw_items(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- case @action
- when 0
- self.contents.draw_text(rect.x, rect.y, self.width, WLH, "LOAN AMOUNT: " + @amount.to_s)
- when 1
- self.contents.draw_text(rect.x, rect.y, self.width, WLH, "PAYBACK AMOUNT: " + @amount.to_s)
- end
- self.contents.font.color = text_color(24)
- self.contents.draw_text(rect.x + 260, rect.y, self.width, WLH, "x " + @multiplier.to_s)
- self.contents.font.color = normal_color
- end
- end
- ################################################################################
- #*******************************************************************************
- # WINDOW BANK CONFIRM
- ################################################################################
- class Window_BankConfirm < Window_Selectable
- def initialize
- super(162, 164, 140, 80)
- @commands = ["Confirm", "Cancel"]
- @item_max = @commands.size
- refresh
- self.index = 0
- self.visible = false
- self.active = false
- self.z = 120
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_items(i)
- end
- end
- def draw_items(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.draw_text(rect, @commands[index])
- end
- end
- ################################################################################
- #*******************************************************************************
- # SCENE SHOPSUEY
- ################################################################################
- class Scene_Shopsuey < Scene_Base
- def initialize(shop_id, keeper_id)
- @shop = $game_shops[shop_id]
- @shopkeeper = $game_shopkeepers[keeper_id]
- @shop_id = shop_id
- @shopkeeper_id = keeper_id
- @introduced = false
- @buying = false
- @selling = false
- @loaning = false
- @paying = false
- end
- def start
- super
- @win_commands = Window_ShopCommands.new(@shop_id)
- @win_name = Window_ShopName.new(@shop_id)
- @win_kind = Window_ShopKind.new(@shop_id)
- @win_shopkeeper = Window_ShopKeeper.new(@shopkeeper_id)
- @win_dialogue = Window_ShopDialogue.new(@shopkeeper_id)
- @win_item_amount = Window_AmountAdjustment.new(@shop.inventory[0])
- @win_buy = Window_BuyProducts.new(@shop_id, @shopkeeper_id)
- @win_sell = Window_SellProducts.new(@shop_id, @shopkeeper_id)
- @win_description = Window_ProductDescription.new($data_items[1])
- @win_possession = Window_SellPossession.new($data_items[1])
- @win_bankinfo = Window_BankInfo.new
- @win_bankaction = Window_BankAction.new
- @win_bankinput = Window_BankInput.new
- @win_bankconfirm = Window_BankConfirm.new
- RPG::BGM.new(@shop.bgm[0], @shop.bgm[1], @shop.bgm[2]).play
- end
- #-----------------------------------------------------------------------------
- # Dialogue Introduction
- #-----------------------------------------------------------------------------
- def dialogue_introduction
- @win_dialogue.shop_phase = 0
- Graphics.wait(90)
- @win_dialogue.shop_phase = 1
- @win_dialogue.refresh
- @introduced = true
- end
- #-----------------------------------------------------------------------------
- # Frame Update
- #-----------------------------------------------------------------------------
- def update
- super
- if @win_commands.active
- update_commands
- elsif @win_item_amount.active
- update_item_amount
- elsif @win_buy.active
- update_buy
- elsif @win_sell.active
- update_sell
- elsif @win_bankaction.active
- update_bank_action
- elsif @win_bankinput.active
- update_bank_input
- elsif @win_bankconfirm.active
- update_bank_confirm
- end
- end
- #-----------------------------------------------------------------------------
- # Update Commands
- #-----------------------------------------------------------------------------
- def update_commands
- @win_commands.update
- unless @introduced
- dialogue_introduction
- end
- if Input.trigger?(Input::B)
- Sound.play_cancel
- alter_dialogue(9)
- Graphics.wait(90)
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- determine_service(@win_commands.index)
- end
- end
- #-----------------------------------------------------------------------------
- # Determine Service
- #-----------------------------------------------------------------------------
- def determine_service(index)
- service = @shop.services[index]
- if service == Ixfuru::ShopKeep::BUY_COMMAND
- activate_buy
- elsif service == Ixfuru::ShopKeep::SELL_COMMAND
- if @win_sell.sellables.size > 0
- activate_sell
- else
- Sound.play_buzzer
- end
- elsif service == Ixfuru::ShopKeep::BANK_COMMAND
- activate_bank
- else
- leave_scene
- end
- end
- #-----------------------------------------------------------------------------
- # Leave Scene
- #-----------------------------------------------------------------------------
- def leave_scene
- Sound.play_cancel
- alter_dialogue(9)
- Graphics.wait(90)
- $scene = Scene_Map.new
- end
- #-----------------------------------------------------------------------------
- # Activate Buy
- #-----------------------------------------------------------------------------
- def activate_buy
- @win_commands.active = false
- @win_commands.visible = false
- @win_buy.visible = true
- @win_description.visible = true
- alter_dialogue(2)
- alter_kind(0)
- @win_buy.active = true
- end
- #-----------------------------------------------------------------------------
- # Activate Sell
- #-----------------------------------------------------------------------------
- def activate_sell
- @win_commands.active = false
- @win_commands.visible = false
- @win_sell.visible = true
- @win_description.visible = true
- @win_possession.item = @win_sell.sellables[@win_sell.index]
- @win_possession.refresh
- @win_possession.visible = true
- alter_dialogue(5)
- alter_kind(1)
- @win_sell.active = true
- end
- #-----------------------------------------------------------------------------
- # Update Buy
- #-----------------------------------------------------------------------------
- def update_buy
- @win_buy.update
- item = @win_buy.products[@win_buy.index]
- @win_description.item = item
- @win_description.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- back_to_commands(0)
- elsif Input.trigger?(Input::C)
- if @win_buy.is_buyable?(item)
- Sound.play_decision
- activate_item_amount(0)
- else
- Sound.play_buzzer
- alter_dialogue(3, true)
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Activate Item Amount:
- # accepts argument (shop_phase) = 0 for buy; 1 for sell
- #-----------------------------------------------------------------------------
- def activate_item_amount(shop_phase)
- case shop_phase
- when 0 # when buying
- @win_buy.active = false
- @win_item_amount.item = @win_buy.products[@win_buy.index]
- @buying = true
- alter_dialogue(21)
- when 1 # when selling
- @win_sell.active = false
- @win_item_amount.item = @win_sell.sellables[@win_sell.index]
- alter_dialogue(22)
- @selling = true
- end
- @win_item_amount.amount = 1
- @win_item_amount.refresh
- @win_item_amount.visible = true
- @win_item_amount.active = true
- end
- #-----------------------------------------------------------------------------
- # Update Item Amount
- #-----------------------------------------------------------------------------
- def update_item_amount
- @win_item_amount.update
- gold_max = max_item_amount
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if @buying
- back_to_buy
- elsif @selling
- back_to_sell
- end
- elsif Input.trigger?(Input::RIGHT) || Input.trigger?(Input::UP)
- Sound.play_cursor
- @win_item_amount.amount += 1
- @win_item_amount.refresh
- elsif Input.trigger?(Input::LEFT) || Input.trigger?(Input::DOWN)
- Sound.play_cursor
- @win_item_amount.amount -= 1
- @win_item_amount.refresh
- elsif Input.trigger?(Input::C)
- if @buying && @win_item_amount.amount <= gold_max
- RPG::SE.new(Ixfuru::ShopKeep::BUY_SE, 80, 100).play
- make_purchase
- elsif @buying && @win_item_amount.amount > gold_max
- Sound.play_buzzer
- alter_dialogue(3, true)
- elsif @selling
- if @win_item_amount.amount <= gold_max
- if $game_party.item_number(@win_item_amount.item) >= @win_item_amount.amount
- RPG::SE.new(Ixfuru::ShopKeep::SELL_SE, 80, 100).play
- make_sell
- else
- Sound.play_buzzer
- alter_dialogue(23, true)
- end
- else
- Sound.play_buzzer
- alter_dialogue(7, true)
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Make Sell
- #-----------------------------------------------------------------------------
- def make_sell
- item = @win_item_amount.item
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- $game_party.gain_gold(item.suey_price(1, @shopkeeper) * @win_item_amount.amount)
- else
- $game_party.gain_gold(item.price * @win_item_amount.amount / 2)
- end
- if Ixfuru::ShopKeep::USE_KEEPER_GOLD
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- @shopkeeper.gold -= item.suey_price(1, @shopkeeper) * @win_item_amount.amount
- else
- @shopkeeper.gold -= item.price * @win_item_amount.amount / 2
- end
- end
- alter_dialogue(8)
- if !@shop.inventory.include?(item) && !item.dont_stock
- @shop.add_to_inventory(item)
- alter_dialogue(10, true)
- @win_buy.refresh
- end
- $game_party.lose_item(item, @win_item_amount.amount, true)
- @win_item_amount.amount = 1
- @win_item_amount.refresh
- @win_kind.refresh
- @win_shopkeeper.refresh
- @win_sell.index = 0
- @win_sell.refresh
- back_to_sell
- end
- #-----------------------------------------------------------------------------
- # Make Purchase
- #-----------------------------------------------------------------------------
- def make_purchase
- item = @win_item_amount.item
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- $game_party.lose_gold(item.suey_price(0, @shopkeeper) * @win_item_amount.amount)
- else
- $game_party.lose_gold(item.price * @win_item_amount.amount)
- end
- if Ixfuru::ShopKeep::USE_KEEPER_GOLD
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- @shopkeeper.gold += item.suey_price(0, @shopkeeper) * @win_item_amount.amount
- else
- @shopkeeper.gold += item.price * @win_item_amount.amount
- end
- end
- alter_dialogue(4)
- $game_party.gain_item(item, @win_item_amount.amount, true)
- @win_item_amount.amount = 1
- @win_item_amount.refresh
- @win_kind.refresh
- @win_shopkeeper.refresh
- @win_buy.refresh
- back_to_buy
- end
- #-----------------------------------------------------------------------------
- # Get Max Item Amount
- #-----------------------------------------------------------------------------
- def max_item_amount
- if @buying
- gold = $game_party.gold
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- max = gold / @win_item_amount.item.suey_price(0, @shopkeeper)
- else
- max = gold / @win_item_amount.item.price
- end
- elsif @selling
- if Ixfuru::ShopKeep::USE_KEEPER_GOLD
- gold = @shopkeeper.gold
- if Ixfuru::ShopKeep::USE_RENEWED_PRICING
- max = gold / @win_item_amount.item.suey_price(1, @shopkeeper)
- else
- max = gold / @win_item_amount.item.price
- end
- else
- max = 99
- end
- end
- return max
- end
- #-----------------------------------------------------------------------------
- # Back To Buy
- #-----------------------------------------------------------------------------
- def back_to_buy
- @win_item_amount.active = false
- @win_item_amount.visible = false
- alter_dialogue(2)
- @buying = false
- @win_buy.active = true
- end
- #-----------------------------------------------------------------------------
- # Update Sell
- #-----------------------------------------------------------------------------
- def update_sell
- @win_sell.update
- item = @win_sell.sellables[@win_sell.index]
- @win_description.item = item
- @win_description.refresh
- @win_possession.item = item
- @win_possession.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- back_to_commands(1)
- elsif Input.trigger?(Input::C)
- if @win_sell.is_sellable?(item)
- Sound.play_decision
- activate_item_amount(1)
- else
- Sound.play_buzzer
- alter_dialogue(6, true)
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Back To Sell
- #-----------------------------------------------------------------------------
- def back_to_sell
- @win_item_amount.active = false
- @win_item_amount.visible = false
- alter_dialogue(5)
- @selling = false
- @win_sell.active = true
- end
- #-----------------------------------------------------------------------------
- # Activate Bank
- #-----------------------------------------------------------------------------
- def activate_bank
- @win_commands.active = false
- @win_commands.visible = false
- @win_bankinfo.visible = true
- @win_bankaction.visible = true
- @win_bankinput.visible = true
- alter_kind(2)
- if $game_bank.loan_out
- alter_dialogue(12)
- else
- alter_dialogue(11)
- end
- @win_bankaction.active = true
- end
- #-----------------------------------------------------------------------------
- # Update Bank Action
- #-----------------------------------------------------------------------------
- def update_bank_action
- @win_bankaction.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- back_to_commands(2)
- elsif Input.trigger?(Input::C)
- case @win_bankaction.index
- when 0
- if $game_bank.can_loan?
- Sound.play_decision
- alter_dialogue(13)
- activate_bank_input(0)
- else
- Sound.play_buzzer
- alter_dialogue(14, true)
- end
- when 1
- if $game_bank.loan_out == false
- Sound.play_buzzer
- alter_dialogue(24, true)
- else
- Sound.play_decision
- alter_dialogue(15)
- activate_bank_input(1)
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Activate Bank Input
- #-----------------------------------------------------------------------------
- def activate_bank_input(from)
- @win_bankaction.active = false
- @win_bankinput.action = from
- @win_bankinput.active = true
- end
- #-----------------------------------------------------------------------------
- # Update Bank Input
- #-----------------------------------------------------------------------------
- def update_bank_input
- @win_bankinput.update
- @win_bankinput.refresh
- max_loan = $game_bank.max_loan
- pay_max = $game_bank.loan_balance
- if Input.trigger?(Input::B)
- Sound.play_cancel
- back_to_bank_action(0)
- elsif Input.press?(Input::RIGHT) || Input.press?(Input::UP)
- Sound.play_cursor
- @win_bankinput.amount += @win_bankinput.multiplier
- case @win_bankinput.action
- when 0
- if @win_bankinput.amount > max_loan
- @win_bankinput.amount = max_loan
- end
- when 1
- if @win_bankinput.amount > pay_max
- @win_bankinput.amount = pay_max
- end
- end
- elsif Input.press?(Input::LEFT) || Input.press?(Input::DOWN)
- Sound.play_cursor
- @win_bankinput.amount -= @win_bankinput.multiplier
- if @win_bankinput.amount < 0
- @win_bankinput.amount = 0
- end
- elsif Input.trigger?(Input::R)
- Sound.play_load
- if @win_bankinput.multiplier == 100
- @win_bankinput.multiplier = 1
- elsif @win_bankinput.multiplier == 50
- @win_bankinput.multiplier = 100
- elsif @win_bankinput.multiplier == 10
- @win_bankinput.multiplier = 50
- elsif @win_bankinput.multiplier == 1
- @win_bankinput.multiplier = 10
- end
- elsif Input.trigger?(Input::L)
- Sound.play_load
- if @win_bankinput.multiplier == 100
- @win_bankinput.multiplier = 50
- elsif @win_bankinput.multiplier == 50
- @win_bankinput.multiplier = 10
- elsif @win_bankinput.multiplier == 10
- @win_bankinput.multiplier = 1
- elsif @win_bankinput.multiplier == 1
- @win_bankinput.multiplier = 100
- end
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- activate_bank_confirm
- end
- end
- #-----------------------------------------------------------------------------
- # Activate Bank Confirm
- #-----------------------------------------------------------------------------
- def activate_bank_confirm
- @win_bankinput.active = false
- @win_bankconfirm.visible = true
- @win_bankconfirm.active =true
- end
- #-----------------------------------------------------------------------------
- # Update Bank Confirm
- #-----------------------------------------------------------------------------
- def update_bank_confirm
- @win_bankconfirm.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- back_to_bank_input
- elsif Input.trigger?(Input::C)
- case @win_bankconfirm.index
- when 0
- RPG::SE.new(Ixfuru::ShopKeep::BANK_SE, 80, 100).play
- case @win_bankinput.action
- when 0
- alter_dialogue(18)
- make_loan
- when 1
- alter_dialogue(19)
- make_payback
- end
- when 1
- Sound.play_cancel
- back_to_bank_input
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Make Loan
- #-----------------------------------------------------------------------------
- def make_loan
- loan = @win_bankinput.amount
- $game_party.gain_gold(loan)
- loan += $game_bank.interest(loan)
- $game_bank.finish_loan(loan)
- @win_bankinfo.refresh
- alter_kind(2)
- back_to_bank_action(1)
- end
- #-----------------------------------------------------------------------------
- # Make Payback
- #-----------------------------------------------------------------------------
- def make_payback
- pay = @win_bankinput.amount
- $game_party.lose_gold(pay)
- if pay >= $game_bank.loan_balance
- $game_bank.finish_payback
- else
- $game_bank.loan_balance = @win_bankinfo.current_loan -= pay
- end
- @win_bankinfo.refresh
- alter_kind(2)
- back_to_bank_action(1)
- end
- #-----------------------------------------------------------------------------
- # Back To Commands
- #-----------------------------------------------------------------------------
- def back_to_commands(from)
- case from
- when 0 # from buying
- @win_buy.active = false
- @win_buy.visible = false
- when 1 # from selling
- @win_possession.visible = false
- @win_sell.active = false
- @win_sell.visible = false
- when 2 # from banking
- @win_bankaction.active = false
- @win_bankaction.visible = false
- @win_bankinfo.visible = false
- @win_bankinput.visible = false
- end
- @win_description.visible = false
- @win_item_amount.visible = false
- alter_dialogue(0)
- alter_kind(3)
- @win_commands.visible= true
- @win_commands.active = true
- end
- #-----------------------------------------------------------------------------
- # Alter Dialogue
- #-----------------------------------------------------------------------------
- def alter_dialogue(index, quick = false)
- back_text = @win_dialogue.shop_phase
- @win_dialogue.shop_phase = index
- @win_dialogue.refresh
- if quick
- Graphics.wait(90)
- @win_dialogue.shop_phase = back_text
- @win_dialogue.refresh
- end
- end
- #-----------------------------------------------------------------------------
- # Alter Kind
- #-----------------------------------------------------------------------------
- def alter_kind(action)
- @win_kind.shop_kind = action
- @win_kind.refresh
- end
- #-----------------------------------------------------------------------------
- # Back to Bank Action
- #-----------------------------------------------------------------------------
- def back_to_bank_action(from)
- case from
- when 0
- @win_bankinput.active = false
- when 1
- @win_bankconfirm.visible = false
- @win_bankconfirm.active = false
- end
- if $game_bank.loan_out
- alter_dialogue(12)
- else
- alter_dialogue(11)
- end
- @win_bankinput.amount = 0
- @win_bankinput.refresh
- @win_bankaction.active = true
- end
- #-----------------------------------------------------------------------------
- # Back to Bank Input
- #-----------------------------------------------------------------------------
- def back_to_bank_input
- @win_bankconfirm.active = false
- @win_bankconfirm.visible = false
- @win_bank_input.active = true
- end
- #-----------------------------------------------------------------------------
- # Terminate
- #-----------------------------------------------------------------------------
- def terminate
- @win_commands.dispose
- @win_name.dispose
- @win_kind.dispose
- @win_shopkeeper.dispose
- @win_description.dispose
- @win_item_amount.dispose
- @win_bankinfo.dispose
- @win_bankaction.dispose
- @win_bankinput.dispose
- @win_bankconfirm.dispose
- @win_dialogue.dispose
- @win_possession.dispose
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment