V5洛 发表于 2018-3-6 20:06 是的,直接替换掉Main就行了。 |
qq420134293 发表于 2018-3-6 17:26 你这个直接插入就行拉吧 大佬 |
我做的是游戏id是可见的,写在游戏一个目录里,然后存档发给别人了别人玩会把东西和金币清空。 我还添加了一个功能就是A的存档发给B,B可以拿他的游戏id去一个网站生成验证ID, 当前整时有效比如17点10份生成的到18点就无效了,B玩A发的存档东西正常存在不会清空的 |
本帖最后由 qq420134293 于 2018-3-6 17:36 编辑 #encoding:utf-8 #============================================================================== # ■ Main #------------------------------------------------------------------------------ # 各种定义结束后,从这里开始实际运行。 #============================================================================== module DataManager def self.save_game_without_rescue(index) File.open(make_filename(index), "wb") do |file| $game_system.on_before_save Marshal.dump(make_save_header, file) data = Zlib::Deflate.deflate(Marshal.dump(make_save_contents)); Marshal.dump(data, file) end file = File.open(make_filename(index), "ab") Marshal.dump($GameId, file) file.close return true end def self.load_game_without_rescue(index) File.open(make_filename(index), "rb") do |file| Marshal.load(file) data = Zlib::Inflate.inflate(Marshal.load(file)); extract_save_contents(Marshal.load(data)) code = Marshal.load(file); if code != $GameId return false; end reload_map_if_updated @last_savefile_index = index end return true end end $GameId = 1234567895201314; def GetGameId() File.delete("SanGuo.ini") if File::exists?("SanGuo.ini"); %x{getmac >> SanGuo.ini} s = "";i = 0;idstring = ""; while(s != nil&& i < 5) i += 1; s = IO.readlines("SanGuo.ini"); idstring += s if s != nil end len = idstring.length; out = 0; while(len > 0) len -= 1; temp = idstring[len].to_s.hex + 1 out += temp; out *= temp if out.to_s.length < 16 end out *= 123456789 out += $GameId; out = out.to_s[0,16].reverse $GameId = out.to_s; rgss_main { SceneManager.run } end GetGameId(); 直接用这个吧,很简单的那种,至少95%的电脑都是适用的。稍微会一点的就知道原理。 那乘以的123456789你可以换成其他的,小一点就是了。 数字很方便的,主要是数字再乘以个数字加减一下就可以拿来做验证id比如付费购买某个东西。 |
喵呜喵5 发表于 2018-3-6 14:13 调试一直nil |
喵呜喵5 发表于 2018-3-6 14:13 那个太麻烦了。 简单点比如 %x{getmac >> System/mac.ini} 直接获取mac生成在一个文本然后读取转成10进制等之类的,反转之类的加上一些数字之类的简单处理就行了。 |
qq420134293 发表于 2018-3-6 13:35 还以为附了 $GameId 的生成算法咧…… 附带一个机器码的生成代码:https://rpg.blue/thread-341893-1-1.html 另外,虽然理论上能锁存档,但除非真的是核心的东西,否则玩家分享存档就睁一只眼闭一只眼算了,要想作弊方式多了去了锁不住的 |
本帖最后由 qq420134293 于 2018-3-6 13:36 编辑 那就需要根据硬盘信息根据一定算法生成个id,就如下面的$GameId这个是开始游戏就根据硬盘生成的一个游戏id,这个是id不一样就清空道具和清空金币,或者你直接return false就进入不了游戏。 module DataManager def self.save_game_without_rescue(index) File.open(make_filename(index), "wb") do |file| $game_party.addnogai(); $game_system.on_before_save Marshal.dump(make_save_header, file) data = Zlib::Deflate.deflate(Marshal.dump(make_save_contents)); Marshal.dump(data, file) end file = File.open(make_filename(index), "ab") Marshal.dump($GameId, file) file.close return true end def self.load_game_without_rescue(index) File.open(make_filename(index), "rb") do |file| Marshal.load(file) data = Zlib::Inflate.inflate(Marshal.load(file)); extract_save_contents(Marshal.load(data)) code = Marshal.load(file); if code != $GameId $game_party.init_all_items(); $game_party.gain_gold(0); end reload_map_if_updated @last_savefile_index = index end return true end end |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-5-18 04:19
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.