查看: 1447|回复: 2

求一个脚本

  [复制链接]
梦石
0
星屑
60
在线时间
1 小时
注册时间
2009-4-17
回帖
2
发表于 2009-4-18 03:54:08 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
我想实现同一个物品在不同地方售价和买价能够调节的脚本。那样我就可以做一个通过做买卖挣钱的经营养成类游戏,那位大侠肯帮我?
版务信息:本贴由楼主自主结贴~
梦石
0
星屑
50
在线时间
114 小时
注册时间
2008-10-29
回帖
459

开拓者

发表于 2009-4-18 03:59:57 | 显示全部楼层
商店价格调整
  1. class Game_Interpreter

  2.   def command_物品定价(id, percent)
  3.     $data_items[id].quotation_percent = percent
  4.   end

  5.   def command_武器定价(id, percent)
  6.     $data_weapons[id].quotation_percent = percent
  7.   end

  8.   def command_防具定价(id, percent)
  9.     $data_armors[id].quotation_percent = percent
  10.   end
  11. end

  12. module RPG
  13.   class Item
  14.     attr_accessor :quotation_percent
  15.     def price
  16.       @quotation_percent = 100 if @quotation_percent.nil?
  17.       return @price * @quotation_percent / 100
  18.     end
  19.   end
  20.   
  21.   class Weapon
  22.     attr_accessor :quotation_percent
  23.     def price
  24.       @quotation_percent = 100 if @quotation_percent.nil?
  25.       return @price * @quotation_percent / 100
  26.     end
  27.   end

  28.   class Armor
  29.     attr_accessor :quotation_percent
  30.     def price
  31.       @quotation_percent = 100 if @quotation_percent.nil?
  32.       return @price * @quotation_percent / 100
  33.     end
  34.   end
  35. end

复制代码
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2009-4-15
回帖
9
发表于 2009-4-18 04:24:06 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部