| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2012-11-18 |
| 在线时间 | 18 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 18 小时
- 注册时间
- 2009-9-17
- 回帖
- 24
|
发表于 2012-9-30 14:26:30
|
显示全部楼层
- #---------------------------------------------------------------------------
- # 豪华打造系统
- # 版本不详 原作者不详
- # 翻译汉化:浪使者
- #---------------------------------------------------------------------------
- class Window_Crafting_Message < Window_Base
-
- def initialize(x, y, width, height)
- super(x, y, width, height)
- end
-
- #-----------------------------------------------------------------------------
- # 描绘打造成功的消息
- #-----------------------------------------------------------------------------
- def drawCritical(recipe)
- self.contents.clear
- self.contents.draw_text(0, 0, 172, WLH, "打造成功!")
- self.contents.draw_text(0, 24, 96, WLH, "获得")
- critNameString = recipe.criticalName + " x " + recipe.critAmount.to_s
- draw_icon(recipe.icon_index(true), 96, 24)
- self.contents.draw_text(128, 24, 280, WLH, critNameString)
- end
-
- #-----------------------------------------------------------------------------
- # 描绘打造不成功的消息
- #-----------------------------------------------------------------------------
- def drawFailure(recipe)
- self.contents.clear
- self.contents.draw_text(0, 0, 172, WLH, "不能打造:")
- self.contents.draw_text(0, 24, 380, WLH, recipe.disabledReason)
- end
-
- end
复制代码
- #---------------------------------------------------------------------------
- # 豪华打造系统
- # 版本不详 原作者不详
- # 翻译汉化:浪使者
- #---------------------------------------------------------------------------
- class Window_Crafting_Recipes < Window_Selectable
-
- attr_reader :results_window
- attr_reader :status_window
- attr_reader :detail_window
- attr_accessor :refreshNeeded
-
- def initialize(x, y, width, height)
- super(x, y, width, height)
- self.index = 0
-
- #---------------------------------------------------------------------------
- # 显示或隐藏打造方法的icon索引(在三角形箭头下)
- #---------------------------------------------------------------------------
- @showIcon = 1807
- @hideIcon = 1806
-
- #---------------------------------------------------------------------------
- # 改变这为false ,如果你不希望游戏去记住游戏者在上一次使用过的打造界面
- # 中某个类别被显示或隐藏。
- #
- #---------------------------------------------------------------------------
- @rememberCategoryStates = true
-
- #---------------------------------------------------------------------------
- # 如果你不想记住类别的开关状态, 那么当打造菜单被运作后,一个默认的状态被
- # 选择好.改变这为 true 如果你希望使得菜单的打造类别默认为展开。
- #
- #---------------------------------------------------------------------------
- @defaultShowState = false
-
- #---------------------------------------------------------------------------
- # 改变为 false 如果你想取消类别的列表显示
- #---------------------------------------------------------------------------
- @usingCategories = true
-
- initCategories if @usingCategories
-
- if @usingCategories
- categoryRefresh
- else
- refresh
- end
- end
-
- def initCategories
- @categoryNames = $game_crafting.categoryLabels
- @categoryText = $game_crafting.categoryText
- @categoryIndices = []
- @showCategory = []
- if @rememberCategoryStates
- @showCategory = $game_crafting.categoryStates
- else
- for x in [email]0..@categoryNames.length[/email] - 1
- @showCategory.push(@defaultShowState)
- end
- end
- end
-
- def update
- super
- updateIngredients
- updateStatus
- updateDetails
- update_help
- if @refreshNeeded
- if @usingCategories
- categoryRefresh
- else
- refresh
- end
- end
- end
-
- def categoryRefresh
- self.contents.clear
- @data = []
- @categoryIndices = []
- index = 0
-
- for x in [email]0..@categoryNames.length[/email] - 1
- @categoryIndices.push(index)
- @data.push(nil)
- index += 1
- if @showCategory[x]
- for recipe in $game_crafting.recipeList
- if recipe.isDiscovered? and recipe.category == x
- @data.push(recipe)
- index += 1
- end
- end
- end
- end
-
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- if @categoryIndices.index(i) != nil
- draw_category(i)
- else
- draw_recipe(i)
- end
- end
-
- @refreshNeeded = false
- end
-
- def refresh
- self.contents.clear
- @data = []
- for recipe in $game_crafting.recipeList
- @data.push(recipe) if recipe.isDiscovered?
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_recipe(i)
- end
- @refreshNeeded = false
- end
-
- def draw_category(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- categoryIndex = @categoryIndices.index(index)
- categoryName = @categoryNames[categoryIndex]
- icon = @showCategory[categoryIndex] ? @showIcon : @hideIcon
- if categoryName != nil
- rect.width -= 4
- draw_icon(icon, rect.x, rect.y, true)
- self.contents.font.color = normal_color
- self.contents.draw_text(rect.x + 24, rect.y, 172, WLH, categoryName)
- end
- end
-
- def draw_recipe(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- recipe = @data[index]
- if recipe != nil
- enabled = recipe.isCraftable?
- rect.width -= 4
- draw_recipe_name(recipe, rect.x + 24, rect.y, enabled)
- end
- end
-
- def draw_recipe_name(recipe, x, y, enabled = true)
- if recipe != nil
- draw_icon(recipe.icon_index, x, y, enabled)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x + 24, y, 172, WLH, recipe.name)
- end
- end
-
- def recipe
- return @data[self.index]
- end
-
- def isCategory?
- return false if @categoryIndices.index(self.index) == nil
- return true
- end
-
- def toggleCategory
- if @showCategory[@categoryIndices.index(self.index)]
- @showCategory[@categoryIndices.index(self.index)] = false
- else
- @showCategory[@categoryIndices.index(self.index)] = true
- end
- end
-
- def ingredients_window=(ingredients_window)
- @ingredients_window = ingredients_window
- updateIngredients
- end
-
- def status_window=(status_window)
- @status_window = status_window
- updateStatus
- end
-
- def detail_window=(detail_window)
- @detail_window = detail_window
- updateDetails
- end
-
- def updateIngredients
- if recipe == nil
- @ingredients_window.set_tools(@categoryIndices.index(self.index))
- else
- @ingredients_window.set_ingredients(recipe)
- end
- end
-
- def updateStatus
- @status_window.set_status(recipe)
- end
-
- def updateDetails
- @detail_window.set_details(recipe)
- end
-
- #-----------------------------------------------------------------------------
- # 更新帮助视窗的文字来描述道具被制造或无法制造的原因
- #
- #-----------------------------------------------------------------------------
- def update_help
- recipe = @data[self.index]
- if @item_max < 1
- @help_window.set_text("你还没有获得任何新的打造方法!")
- else
- if recipe == nil
- categoryText = @categoryText[@categoryIndices.index(self.index)]
- @help_window.set_text(categoryText)
- else
- if recipe.isCraftable?
- descriptionText = recipe.itemCreated.description
- @help_window.set_text(recipe == nil ? "" : descriptionText)
- else
- @help_window.set_text(recipe == nil ? "" : recipe.disabledReason)
- end
- end
- end
- end
-
- def dispose
- super
- $game_crafting.categoryStates = @showCategory if @rememberCategoryStates
- end
-
- end
复制代码
- #---------------------------------------------------------------------------
- # 豪华打造系统
- # 版本不详 原作者不详
- # 翻译汉化:浪使者
- #---------------------------------------------------------------------------
- class Window_Crafting_Ingredients < Window_Base
- def initialize(x, y, width, height)
- super(x, y, width, height)
- end
-
- def set_ingredients(recipe)
- if recipe != nil
- self.contents.clear
- self.contents.font.color = normal_color
- @recipe = recipe
-
- #绘制原材料
- self.contents.draw_text(0, 0, 172, WLH, "原材料:")
- x = 0
- y = 28
- index = 0
- while index < recipe.numOfIngredients
- draw_icon(recipe.ingredients[index].icon_index, x, y)
- amount = $game_party.item_number(recipe.ingredients[index])
- availString = amount.to_s + " / " + recipe.ingAmounts[index].to_s
- self.contents.draw_text(x + 28, y, 46, WLH, availString)
- x += 92
- if x > 200
- x = 0
- y += 28
- end
- index += 1
- end
- end
- end
-
- def set_tools(categoryIndex)
- self.contents.clear
- self.contents.font.color = normal_color
- x = 0
- y = 0
- self.contents.draw_text(0, 0, 200, WLH, "打造工具:")
- y += 24
- x += 24
- for tool in $game_crafting.tools(categoryIndex)
- enabled = $game_party.has_item?($data_items[tool])
- draw_item_name($data_items[tool], x, y, enabled)
- y += 24
- end
- end
-
- end
复制代码
- #---------------------------------------------------------------------------
- # 豪华打造系统
- # 版本不详 原作者不详
- # 翻译汉化:浪使者
- #---------------------------------------------------------------------------
- class Window_Crafting_Status < Window_Base
- def initialize(x, y, width, height)
- super(x, y, width, height)
-
- #---------------------------------------------------------------------------
- # 改变这些如果你需要用不同的icon
- #---------------------------------------------------------------------------
- @atkIconUp = 1916
- @atkIconDown = 1932
- @atkIconSame = 1948
- @defIconUp = 1917
- @defIconDown = 1933
- @defIconSame = 1949
- @spiIconUp = 1918
- @spiIconDown = 1934
- @spiIconSame = 1950
- @agiIconUp = 1919
- @agiIconDown = 1935
- @agiIconSame = 1951
- end
-
- #-----------------------------------------------------------------------------
- # recipe: 一个对打造方法的检查
- #-----------------------------------------------------------------------------
- def set_status(recipe)
- if recipe != @recipe
- self.contents.clear
- self.contents.font.color = normal_color
- x = 0
- y = 0
- #如果打造了个每人能装备的道具
- if recipe == nil or recipe.makesItem?
- enabled = false;
- for z in 1..$game_actors.length
- if $game_actors[z-1] != nil and $game_actors[z-1].isDiscovered?
- draw_actor_graphic($game_actors[z-1], x, y + 12, enabled)
- x += 136
- if x > 224
- x = 0
- y += 48
- end
- end
- end
- # 打造一个武器后装备上
- elsif recipe.makesWeapon?
- for z in 1..$game_actors.length
- if $game_actors[z-1] != nil and $game_actors[z-1].isDiscovered?
- #检查是否角色可以装备该道具
- if $game_actors[z-1].equippable?(recipe.itemCreated)
- draw_actor_graphic($game_actors[z-1], x, y + 12, true)
- drawAttributeIcons($game_actors[z-1], recipe.itemCreated, x + 4, y)
- else
- draw_actor_graphic($game_actors[z-1], x, y + 12, false)
- end
- x += 136
- if x > 224
- x = 0
- y += 48
- end
- end
- end
- #如果要生产衣甲,描绘该装备
- elsif recipe.makesArmor?
- for z in 1..$game_actors.length
- if $game_actors[z-1] != nil and $game_actors[z-1].isDiscovered?
- #检查角色是否能装备上
- if $game_actors[z-1].equippable?(recipe.itemCreated)
- draw_actor_graphic($game_actors[z-1], x, y + 12, true)
- drawAttributeIcons($game_actors[z-1], recipe.itemCreated, x + 4, y)
- else
- draw_actor_graphic($game_actors[z-1], x, y + 12, false)
- end
- x += 136
- if x > 224
- x = 0
- y += 48
- end
- end
- end
- end
- @recipe = recipe
- end
- end
-
- #-----------------------------------------------------------------------------
- # This is basically identical to the method in Window_Base, with the added
- # ability to draw different opacities for enabled or disabled.
- # actor: actor being drawn
- # x: initial x-coordinate
- # y: initial y-coordinate
- # enabled: determines the opacity to draw
- #-----------------------------------------------------------------------------
- def draw_actor_graphic(actor, x, y, enabled = true)
- bitmap = Cache.character(actor.character_name)
- sign = actor.character_name[/^[\!\$]./]
- if sign != nil and sign.include?('$')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = actor.character_index
- src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
- self.contents.blt(x, y, bitmap, src_rect, enabled ? 255 : 128)
- bitmap.dispose
- end
-
- #-------------------------------------------------------------------------
- # Draws the atk/def/spi/agi up/down icons
- # actor: Actor to compare values against
- # item: item that is being compared
- # x: starting x position
- # y: starting y position
- #-------------------------------------------------------------------------
- def drawAttributeIcons(actor, item, x, y)
- return if item.is_a?(RPG::Item)
- chooseAttributeIcon(actor, item, "atk", x, y)
- chooseAttributeIcon(actor, item, "def", x, y)
- chooseAttributeIcon(actor, item, "spi", x, y)
- chooseAttributeIcon(actor, item, "agi", x, y)
- end
-
- #-----------------------------------------------------------------------------
- # Determines which icon will need to be drawn for the specific stat
- # actor: Actor to compare values against
- # item: item that is being compared
- # attrib: Attribute that is being compared
- # x: starting x position
- # y: starting y position
- #-----------------------------------------------------------------------------
- def chooseAttributeIcon(actor, item, attrib, x, y)
- #Figure out which item will be replaced
- if item.is_a?(RPG::Weapon)
- primaryWeapon = actor.weapons[0]
- secondaryWeapon = actor.weapons[1] if actor.two_swords_style
-
- #figure out which weapon we'll compare against
- pwAtk = primaryWeapon == nil ? 0 : primaryWeapon.atk
- swAtk = secondaryWeapon == nil ? 0 : secondaryWeapon.atk
- equipedItem = swAtk > pwAtk ? secondaryWeapon : primaryWeapon
- else
- equipedItem = actor.equips[item.kind + 1]
- end
-
- #switch to determine the applicable attribute
- case attrib
- when "atk"
- currentAtr = actor.base_atk
- itemAtr = item.atk
- equipAtr = equipedItem == nil ? 0 : equipedItem.atk
- atrIconUp = @atkIconUp
- atrIconDown = @atkIconDown
- atrIconSame = @atkIconSame
- x += 28
- when "def"
- currentAtr = actor.base_def
- itemAtr = item.def
- equipAtr = equipedItem == nil ? 0 : equipedItem.def
- atrIconUp = @defIconUp
- atrIconDown = @defIconDown
- atrIconSame = @defIconSame
- x += 76
- when "spi"
- currentAtr = actor.base_spi
- itemAtr = item.spi
- equipAtr = equipedItem == nil ? 0 : equipedItem.spi
- atrIconUp = @spiIconUp
- atrIconDown = @spiIconDown
- atrIconSame = @spiIconSame
- x += 28
- y += 24
- when "agi"
- currentAtr = actor.base_agi
- itemAtr = item.agi
- equipAtr = equipedItem == nil ? 0 : equipedItem.agi
- atrIconUp = @agiIconUp
- atrIconDown = @agiIconDown
- atrIconSame = @agiIconSame
- x += 76
- y += 24
- end
-
- #now find the right icon
- subAttribute = currentAtr - equipAtr + itemAtr
- newAtr = subAttribute
- if subAttribute > currentAtr
- atrIcon = atrIconUp
- elsif subAttribute < currentAtr
- atrIcon = atrIconDown
- else
- atrIcon = atrIconSame
- end
-
- #everything is calculated, pass to print function
- drawIconAndText(atrIcon, x, y, newAtr)
- end
-
- #-----------------------------------------------------------------------------
- # Draws an icon and the associated stat
- # iconNumber: The ID number of the icon being drawn
- # x: The starting x position
- # y: The starting y position
- # newAtr: The attribute value after the sending item is equiped
- #-----------------------------------------------------------------------------
- def drawIconAndText(iconNumber, x, y, newAtr)
- if iconNumber != nil
- draw_icon(iconNumber, x, y, true)
- end
- case iconNumber
- when @atkIconUp..@agiIconUp
- self.contents.font.color = text_color(3) #3 is green!
- when @atkIconDown..@agiIconDown
- self.contents.font.color = text_color(10) #10 is red!
- else
- self.contents.font.color = text_color(0) #0 is normal white!
- end
- self.contents.draw_text(x + 24, y, 24, WLH, newAtr.to_s)
- end
- end
复制代码
- #---------------------------------------------------------------------------
- # 豪华打造系统
- # 版本不详 原作者不详
- # 翻译汉化:浪使者
- #---------------------------------------------------------------------------
- class Window_Crafting_Details < Window_Base
- def initialize(x, y, width, height)
- super(x, y, width, height)
-
- #---------------------------------------------------------------------------
- # 这个变量控制细节窗口显示不同的类型区域
- # 这个方法,你能限制某些游戏者关于打造系统的制造信息
- #
- #---------------------------------------------------------------------------
- @drawResults = true
- @drawTools = true
- @drawIngredients = true
- @drawStatInfo = true
- end
-
- def set_details(recipe)
- if recipe != nil and recipe != @recipe
- @recipe = recipe
- self.contents.clear
- self.contents.font.color = normal_color
- x = 0
- y = 0
-
- #描绘道具制造
- if @drawResults
- self.contents.draw_text(0, 0, 172, WLH, "制造:")
- draw_item_name(recipe.itemCreated, 24, 24)
- self.contents.draw_text(0, 24, 248, WLH, "x " + recipe.createdAmount.to_s, 2)
- self.contents.draw_text(0, 48, 172, WLH, "生产:")
- draw_item_name(recipe.criticalItem, 24, 72)
- self.contents.draw_text(0, 72, 248, WLH, "x " + recipe.critAmount.to_s, 2)
- end
-
- #描绘工具
- if @drawTools
- self.contents.draw_text(272, 0, 200, WLH, "打造工具:")
- y = 24
- x = 296
- for tool in $game_crafting.tools(recipe.category)
- enabled = $game_party.has_item?($data_items[tool])
- draw_item_name($data_items[tool], x, y, enabled)
- y += 24
- end
- end
-
- #描绘原材料
- if @drawIngredients
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 120, 172, WLH, "原材料:")
- x = 24
- y = 144
- index = 0
- while index < recipe.numOfIngredients
- ingredient = recipe.ingredients[index]
- ingAmount = recipe.ingAmounts[index]
- enabled = $game_party.item_number(ingredient) < ingAmount ? false : true
- draw_item_name(ingredient, x, y, enabled)
- self.contents.draw_text(x - 24, y, 248, WLH, "x " + ingAmount.to_s, 2)
- x += 248
- if x > 400
- y += 24
- x = 24
- end
- index += 1
- end
- end
-
- # 描绘打造状态信息
- if @drawStatInfo
- y += 36
- self.contents.font.color = normal_color
- stat = recipe.bonusStat
- statName = $game_crafting.statName(stat)
- statAmount = $game_crafting.difficulties(stat)[recipe.difficulty]
- statString = "需要 " + statAmount.to_s + " " + statName +
- " 来打造."
- self.contents.draw_text(0, y, 544, WLH, statString)
- y += 24
- critChance = recipe.calcCriticalChance.to_s
- critString = "打造成功的几率: " + critChance + "%"
- self.contents.draw_text(0, y, 544, WLH, critString)
- end
- end
- end
-
- end
复制代码 |
|