查看: 2339|回复: 4

[已经过期] 请问这个网络脚本怎么用?

[复制链接]
梦石
0
星屑
50
在线时间
66 小时
注册时间
2014-4-15
回帖
16
发表于 2015-7-9 18:37:32 | 显示全部楼层 |阅读模式

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

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

×
[pre lang="ruby"]#==============================================================================
# Window Chat
#==============================================================================
class Window_Chat < Window_Base
  
  def initialize
    super(285, (Graphics.height-(WLH*4+32)-WLH), 250, (WLH*4+32))
    @scroll_bar = ScrollBar.new(self)
    $windows << self
    @size = 0
    create_buttons
  end
  
  def create_buttons
    @guild_button = Button.new(self, 2, -WLH+4, "公会") { talk(0); @textbox.text = ""; @textbox.text += "@"; @textbox.active = true ;$聊天[$聊天宽度,0]="@";$聊天宽度 += 1;}
    @guild_button.tip_text = ["公会聊天(绿色)"]
    @friends_button = Button.new(self, @guild_button.x+@guild_button.width+2, -WLH+4, "好友") { talk(1); @textbox.text = ""; @textbox.text += "#"; @textbox.active = true ;$聊天[$聊天宽度,0]="#";$聊天宽度 += 1;}
    @friends_button.tip_text = ["好友聊天(蓝色)"]
    @whisper_button = Button.new(self, @friends_button.x+@friends_button.width+2, -WLH+4, "私聊") { talk(2); @textbox.text = ""; @textbox.text += "/#{$game_temp.last_whisper} "; @textbox.active = true;$聊天[$聊天宽度,0]="/";$聊天宽度 += 1; }
    @whisper_button.tip_text = ["私聊聊天(蓝色)"]
    @all_button = Button.new(self, @whisper_button.x+@whisper_button.width+2, -WLH+4, "世界") { talk(3); @textbox.text = ""; @textbox.text += "!"; @textbox.active = true ;$聊天[$聊天宽度,0]="!";$聊天宽度 += 1;}
    @all_button.tip_text = ["世界聊天(粉红色)"]
    @normal_button = Button.new(self, @all_button.x+@all_button.width+2, -WLH+4, "正常") { talk(4); @textbox.text = ""; @textbox.active = true}
    @normal_button.tip_text = ["正常聊天"]
    @textbox = TextBox.new(self, 2, self.height, self.width-55, 25) { write }
    Button.new(self, @textbox.width+4, self.height, "发送") { write }
  end
  
  def update
    super
    #--------------------------------------------------------------------------
    $Ltf.active = self.active
    @textbox.text = $聊天
    # 输入窗口刷新
    $Ltf.update
    #--------------------------------------------------------------------------
   
    refresh if @size != $game_temp.chat_text.size
  end
  
  def refresh
    @textbox.active = self.active
    self.contents.clear
    scroll_down
    y = 0
    for text in $game_temp.chat_text
      if text[0] =~ /<Admin>/
        self.contents.font.color = Color.admin
      elsif text[0] =~ /<GM>/
        self.contents.font.color = Color.gm
      elsif text[0] =~ /@(.*)/
        next if @friend_talk or @whisper_talk or @all_talk
        next unless $1.to_i == $actor.guild
        self.contents.font.color = Color.guild
      elsif text[0] =~ /#(.*)/
        next if @guild_talk or @whisper_talk or @all_talk
        next unless Network.friends.include?($1) or $actor.name == $1
        self.contents.font.color = Color.friend
      elsif text[0] =~ /\/(.*) (.*)/
        next if @guild_talk or @friend_talk or @all_talk
        next unless $1 == $actor.name or $2 == $actor.name
        $game_temp.last_whisper = $1
        self.contents.font.color = Color.whisper
      elsif text[0] =~ /!/
        next if @guild_talk or @friend_talk or @whisper_talk
        self.contents.font.color = Color.all
      else
        self.contents.font.color = normal_color
      end
      self.contents.draw_text(0, y, contents.width, WLH, text[1])
      y += WLH
    end
    @size = $game_temp.chat_text.size
  end
  
  def talk(x)
    @guild_talk = (x == 0)
    @friend_talk = (x == 1)
    @whisper_talk = (x == 2)
    @all_talk = (x == 3)
    refresh
  end
  
  def write
    return if @textbox.text.to_s.nil? or @textbox.text.to_s == ""
    for i in Network.chat_filter
      loop do
        @textbox.text.gsub!(/#{i}/i, "")
        break if @textbox.text.casecmp(i) != 0
      end
    end
    mesage_commands
    message_balloon
    return if @textbox.text.nil? or @textbox.text == ""
    text = @textbox.text.delete(@textbox.text[0,1]).to_s
    if @textbox.text[0,1] == "@" and $actor.guild > 0
      Network.send_chat("@#{$actor.guild}", "#{$actor.name}: #{text}", 1)
    elsif @textbox.text[0,1] == "#"
      Network.send_chat("##{$actor.name}", "#{$actor.name}: #{text}", 1)
    elsif @textbox.text[0,1] == "/"
      t = @textbox.text.split(" ")
      Network.send_chat("#{t[0]} #{$actor.name}", "#{$actor.name}: #{t[1]}", 1)
    elsif @textbox.text[0,1] == "!"
      Network.send_chat("!", "#{$actor.name}: #{text}", 1)
    elsif Network.hierarchy == 2
      Network.send_chat("<Admin>", "#{$actor.name}: #{@textbox.text.to_s}")
    elsif Network.hierarchy == 1
      Network.send_chat("<GM>", "#{$actor.name}: #{@textbox.text.to_s}")
    else
      Network.send_chat("", "#{$actor.name}: #{@textbox.text.to_s}")
    end
    @textbox.text = ""
    $聊天= ""
  end
  
  def mesage_commands
    return if Network.hierarchy <= 0
    if @textbox.text.include?("/kick")
      data = @textbox.text.split(' ')
      unless data[1].nil? or data[1] == ""
        Network.gm_commands(0, data[1].to_s)
      end
      @textbox.text = ""
      $聊天= ""
    end
    if @textbox.text.include?("/suspend")
      data = @textbox.text.split(' ')
      unless data[1].nil? or data[1] == ""
        Network.gm_commands(1, data[1].to_s)
      end
      @textbox.text = ""
      $聊天= ""
    end
    if @textbox.text.include?("/ban")
      data = @textbox.text.split(' ')
      unless data[1].nil? or data[1] == ""
        Network.gm_commands(2, data[1].to_s)
      end
      @textbox.text = ""
      $聊天= ""
    end
  end
  
  def message_balloon
    return if @textbox.text[0,1] == "@"
    return if @textbox.text[0,1] == "!"
    return if @textbox.text[0,1] == "#"
    return if @textbox.text[0,1] == "/"
    $game_player.message1 = @textbox.text[0, 13].to_s
    $game_player.message2 = @textbox.text[13, 99].to_s
    $game_player.message_duration = 240
    Network.socket.send("<update>@message1 = '#{$game_player.message1}';@message2 = '#{$game_player.message2}'</update>\n")
  end
  
  def scroll_down
    if $game_temp.chat_text.size >= 15
      $game_temp.chat_text -= $game_temp.chat_text.values_at(0...14)
      self.oy = 0
      create_contents
    end
    if self.contents.height < ($game_temp.chat_text.size*WLH)
      self.oy += (($game_temp.chat_text.size*WLH) - self.contents.height)
      self.contents.dispose
      self.contents = Bitmap.new(self.width-32, ($game_temp.chat_text.size*WLH))
    end
  end
  
end[/pre]
头像被屏蔽
梦石
0
星屑
88
在线时间
631 小时
注册时间
2014-8-4
回帖
3243
发表于 2015-7-10 16:14:30 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

梦石
0
星屑
50
在线时间
66 小时
注册时间
2014-4-15
回帖
16
 楼主| 发表于 2015-7-12 16:15:54 | 显示全部楼层
只是想问一下这里的管理命令怎么用,准备搭个服务器和朋友玩。是有一整套脚本的,但还是谢谢啦。

点评

有一整套脚本而没有说明吗…… 如果是购买的应该有后续服务支持才对。  发表于 2015-7-13 18:01
回复

使用道具 举报

梦石
0
星屑
50
在线时间
66 小时
注册时间
2014-4-15
回帖
16
 楼主| 发表于 2015-7-14 12:29:42 | 显示全部楼层
1760206308 发表于 2015-7-12 16:15
只是想问一下这里的管理命令怎么用,准备搭个服务器和朋友玩。是有一整套脚本的,但还是谢谢啦。 ...

只是在网上下的,并没有什么后续服务,也没有花钱。

点评

为何不贴上来网站?  发表于 2015-7-14 12:54
回复

使用道具 举报

梦石
0
星屑
50
在线时间
66 小时
注册时间
2014-4-15
回帖
16
 楼主| 发表于 2016-3-17 19:02:47 | 显示全部楼层
很久之前下的,后来忘了。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部