模拟城市中文网

 找回密码
 入住
搜索
查看: 1917|回复: 0

问个插件修改的问题,希望有能力的大大,不吝赐教

[复制链接]
发表于 2011-7-12 23:38 | 显示全部楼层 |阅读模式
tmxkn1 大大的Omnicrop价格作弊MOD为例:

小弟使用CitiesXLPakUnpak_v1.3.将offlineomnicorpprices.data 这个文件解出来后,修改了一下  

TradingHouse:SetOfflineOmnicorp("water", 100, 70)
                    
TradingHouse:SetOfflineOmnicorp("electricity", 70, 50)

保存之后,使用cxlPackager.exe将其替换mod_tmxkn1_trade_price.patch源文件,保存放入paks文件夹。可进入游戏后,所有交易价格都按照默认的35,90了。这个是哪里出错了呢?

offlineomnicorpprices.data 内容如下:

  1. TradingHouse.OfflinePrices = TradingHouse.OfflinePrices or {}

  2. -- these are the default prices that are used when there is not a specific price specified for this ressource
  3. TradingHouse.DefaultOmniBuyUnitPrice = 35
  4. TradingHouse.DefaultOmniBuySellPrice = 90

  5. function TradingHouse:SetOfflineOmnicorp(_Name, _UnitSellPrice, _UnitBuyPrice)
  6. local ID = TradingLogic:GetTokenID(_Name)
  7. if (ID == -1) then
  8.   LOG_ERROR("Trying to set Unknown token : "..(_Name or "nil"))
  9.   return
  10. end
  11. if (math.floor(_UnitSellPrice) ~= _UnitSellPrice) then
  12.   LOG_ERROR("Trying to set a non integer sell price for token : "..(_Name or "nil"))
  13.   return
  14. end

  15. TradingHouse.OfflinePrices[_Name] = TradingHouse.OfflinePrices[_Name] or {}
  16. TradingHouse.OfflinePrices[_Name].SellPrice = _UnitSellPrice
  17. TradingHouse.OfflinePrices[_Name].BuyPrice = _UnitBuyPrice

  18. end
  19. --TradingHouse:SetOfflineOmnicorp(_Name, _UnitSellPrice, _UnitBuyPrice)
  20. -- these are specific prices per token type : the first should be greater than the second
  21. -- the first is how much it costs to buy the token from Omnicorp
  22. -- the second is how much you can get
  23. TradingHouse:SetOfflineOmnicorp("worker1", 70, 25)
  24. TradingHouse:SetOfflineOmnicorp("worker2", 90, 30)
  25. TradingHouse:SetOfflineOmnicorp("worker3", 115, 40)
  26. TradingHouse:SetOfflineOmnicorp("worker4", 145, 45)
  27. TradingHouse:SetOfflineOmnicorp("water", 100, 70)
  28. TradingHouse:SetOfflineOmnicorp("fuel", 50, 30)
  29. TradingHouse:SetOfflineOmnicorp("office", 10, 5)
  30. TradingHouse:SetOfflineOmnicorp("manufacturing", 30, 10)
  31. TradingHouse:SetOfflineOmnicorp("high tech", 40, 40)
  32. TradingHouse:SetOfflineOmnicorp("food industry", 30, 20)
  33. TradingHouse:SetOfflineOmnicorp("holidays", 25, 30)
  34. TradingHouse:SetOfflineOmnicorp("heavy industry", 20, 5)
  35. TradingHouse:SetOfflineOmnicorp("waste", 80, 50)
  36. TradingHouse:SetOfflineOmnicorp("electricity", 70, 50)

  37. -- TradingHouse:SetOfflineOmnicorp("electricity", 30, 20)
  38. -- TradingHouse:SetOfflineOmnicorp("fuel", 30, 1)

复制代码

[ 本帖最后由 111245 于 2011-7-12 23:58 编辑 ]
您需要登录后才可以回帖 登录 | 入住

本版积分规则

小黑屋|手机版|模拟城市中文网

GMT+8, 2024-5-4 16:29 , Processed in 0.022638 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表