Aldeia RPG

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte ao desenvolvimento de jogos


5 participantes

    Nome do personagem + classe no netplay master

    gladistony
    gladistony
    Membro Ativo
    Membro Ativo


    Mensagens : 336
    Créditos : 217

    Nome do personagem + classe no netplay master Empty Nome do personagem + classe no netplay master

    Mensagem por gladistony Sex maio 25, 2012 10:08 am

    Esse tutorial serve para fazer com que na tela apareça o nome do seu personagem + a sua classe.
    Esse sistema foi pedido pelo Wuudzin Santos, mais postei aqui pq ficou muito grande.

    Se vc ainda não edito os scripts [NET] Network e [EXT] Event Text Display que vem original do netplay, faça o tutorial 1 se vc ja edito alguma coisa neles use o tutorial 2

    Tutorial 1
    Substitua o script [EXT] Event Text Display por esse:
    Código:
    #==============================================================================
    # ** Event Text Display
    #==============================================================================
    # Created By: Áص¹
    # Modified By: SephirothSpawn
    # Modified By: Me™
    # Modified By: Valentine
    # Version 2.1
    # 2006-03-04
    #==============================================================================
    # * Instructions :
    #
    #  ~ Creating Event With Test Display
    #  - Put a Comment on the Page With
    #  [Name____]
    #  - Place Text to Be Displayed in the Blank
    #------------------------------------------------------------------------------
    # * Customization :
    #
    #  ~ NPC Event Colors
    #  - Event_Color = Color
    #
    #  ~ Player Event Color
    #  - Player_Color = Color
    #
    #  ~ Player Text
    #  - Player_Text = text_display *
    #
    #  ~ text_display
    #  - 'Name', 'Class', 'Level', 'Hp', 'Sp'
    #==============================================================================

    #------------------------------------------------------------------------------
    # * SDK Log Script
    #------------------------------------------------------------------------------
    SDK.log('Event Text Display', 'SephirothSpawn', 2, '2006-03-04')
    #------------------------------------------------------------------------------
    # * Begin SDK Enable Test
    #------------------------------------------------------------------------------
    if SDK.state('Event Text Display') == true
    #==============================================================================
    # ** Game_Character
    #==============================================================================
    class Game_Character
      #--------------------------------------------------------------------------
      # * Dispaly Text Color (Event & Player)
      #--------------------------------------------------------------------------
      Event_Color = User_Edit::EVENT_COLOR#Color.new(0, 200, 0)
      ADM_Color = User_Edit::ADM_COLOR#Color.new(250, 250, 0)
      Player_Color = User_Edit::PLAYER_COLOR#Color.new(255, 255, 255)
      #--------------------------------------------------------------------------
      # * Display Choices
      # ~ 'Name', 'Class', 'Level', 'Hp', 'Sp'
      #--------------------------------------------------------------------------
      Player_Text = 'Name'
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :text_display
    end
    #==============================================================================
    # ** Game_Event
    #==============================================================================

    class Game_Event < Game_Character
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias seph_characterdisplay_gevent_refresh refresh
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        # Original Refresh Method
        seph_characterdisplay_gevent_refresh
        # Checks to see if display text
        # If the name contains CD, it takes the rest of the name as the text
        unless @list.nil?
          for i in 0...@list.size
            if @list[i].code == 108
              @list[i].parameters[0].dup.gsub!(/Name (.*)/) do
                @text_display = [$1, Event_Color]
              end
            end
          end
        end
        @text_display = nil if @erased
      end
    end
    #==============================================================================
    # ** Game_Player
    #==============================================================================
    class Game_Player < Game_Character
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias seph_characterdisplay_gplayer_refresh refresh
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        # Original Refresh Method
        seph_characterdisplay_gplayer_refresh
        # Gets First Actor
        name = $game_party.actors[0]
        # Determines Text
        case Player_Text
        when 'Name'
          txt = $game_party.actors[0].name + " -  #{$data_classes[$game_party.actors[0].class_id].name}"
        when 'Class'
          txt = actor.class_name
        when 'Level'
          txt = "Level: #{actor.level}"
        when 'Hp'
          txt = "HP: #{actor.hp} / #{actor.maxhp}"
        when 'Sp'
          txt = "SP: #{actor.sp} / #{actor.maxsp}"
        else
          txt = ''
        end
        # Creates Text Display
        if Network::Main.group == 'admin' and User_Edit::COLOR_ADMIN == true
        @text_display = [txt, ADM_Color]
      else
        @text_display = [txt, Player_Color]
        end
      end
    end
    #==============================================================================
    # ** Sprite_Character
    #==============================================================================
    class Sprite_Character < RPG::Sprite
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias seph_characterdisplay_scharacter_update update
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        # Original update Method
        seph_characterdisplay_scharacter_update
        # Character Display Update Method
        update_display_text
      end
      #--------------------------------------------------------------------------
      # * Create Display Sprite
      #--------------------------------------------------------------------------
      def create_display_sprite(args)
        # Creates Display Bitmap
        bitmap = Bitmap.new(160, 24)
        bitmap.font.size = 15
       
        #bitmap.width = args[0].size+32
       
        # Draws Text Shadow
        bitmap.font.draw_shadow = false  if bitmap.font.respond_to?(:draw_shadow)
       
        bitmap.font.color = Color.new(0, 0, 0)
        bitmap.draw_text(1, 1, 160, 24, args[0], 1)
        bitmap.font.color = args[1]
        # Draws Text
        bitmap.draw_text(0, 0, 160, 24, args[0], 1)
       
        # Creates Display Text Sprite
        @_text_display = Sprite.new(self.viewport)
        @_text_display.bitmap = bitmap
        #@_text_display.opacity = 180
        @_text_display.ox = 80
        @_text_display.oy = 20
        @_text_display.x = self.x
        @_text_display.y = self.y - self.oy / 2 - 24
        @_text_display.z = 30001
        @_text_display.visible = self.visible #true
      end
     
      def create_display_guild(args)
        # Creates Display Bitmap
        bitmap = Bitmap.new(160, 24)
        bitmap.font.name = "Comic Sans MS"
        bitmap.font.size = 15
        actor = $game_party.actors[0]
        # Draws Text Shadow
       
        if bitmap.font.respond_to?(:draw_shadow)
          bitmap.font.draw_shadow = false
        end
        bitmap.font.color = Color.new(0, 0, 0)
        bitmap.draw_text(6, 1, 160, 24, actor.guild, 1)
       
        #bitmap.fill_rect(actor.guild.size*8+3,5,actor.guild.getw,13, Color.new(40, 40, 40))
        # Changes Font Color
        #bitmap.font.color = Color.new(0,0,0)
        #bitmap.draw_text(-1, 2-1, 160, 20, actor.guild, 1)
        #bitmap.draw_text(+1, 2-1, 160, 20, actor.guild, 1)
        #bitmap.draw_text(-1, 2+1, 160, 20, actor.guild, 1)
        #bitmap.draw_text(+1, 2+1, 160, 20, actor.guild, 1)
       
        bitmap.font.color = args[0]
        # Draws Text
       
        if $flag == "cinco"
        icon = RPG::Cache.icon("Mini-Flag5")
        elsif $flag == "quatro"
        icon = RPG::Cache.icon("Mini-Flag4")
        elsif $flag == "treis"
        icon = RPG::Cache.icon("Mini-Flag3")
        elsif $flag == "dois"
        icon = RPG::Cache.icon("Mini-Flag2")
        elsif $flag == "um"
        icon = RPG::Cache.icon("Mini-Flag1")
        else
        icon = RPG::Cache.icon("Mini-Flag1")
        end
        bitmap.blt(55-actor.guild.size,8,icon,icon.rect)
       
        bitmap.draw_text(5, 0, 160, 24, actor.guild, 1)
        $old_guild = args[0]
        # Creates Display Text Sprite
        @_g_display = Sprite.new(self.viewport)
        @_g_display.bitmap = bitmap
        #@_g_display.opacity = 180
        @_g_display.ox = 80
        @_g_display.oy = 22
        @_g_display.x = self.x
        @_g_display.y = self.y - self.oy / 2 - 24
        @_g_display.z = 30001
        @_g_display.visible = self.visible #true
      end
      #--------------------------------------------------------------------------
      # * Dispose Display Sprite
      #--------------------------------------------------------------------------
      def dispose_display_text
        @_text_display.dispose unless @_text_display.nil?
      end
      #--------------------------------------------------------------------------
      # * Update Display Sprite
      #--------------------------------------------------------------------------
      def update_display_text
        unless @character.text_display.nil?
          create_display_sprite(@character.text_display) if @_text_display.nil?
          @_text_display.x = self.x
          @_text_display.y = self.y - self.oy / 2 - 24
        else
          dispose_display_text unless @_text_display.nil?
        end
       
       
      unless !@character.is_a?(Game_Player)
        if $guild_name != ""
          if @_g_display.nil? and User_Edit::GUILD_NAME == true
            create_display_guild([User_Edit::GUILD_COLOR])#Color.new(0,0,200)])
          end
          if User_Edit::GUILD_NAME == true
          @_g_display.x = self.x
          @_g_display.y = self.y - self.oy / 2 - 35
          end
        end
          #unless @_g_display.nil?
          #@_g_display.dispose
          #end
        end
       
      end
    end
    #--------------------------------------------------------------------------
    # * End SDK Enable Test
    #--------------------------------------------------------------------------
    end


    Última edição por gladistony em Sex maio 25, 2012 10:22 am, editado 2 vez(es)
    gladistony
    gladistony
    Membro Ativo
    Membro Ativo


    Mensagens : 336
    Créditos : 217

    Nome do personagem + classe no netplay master Empty Re: Nome do personagem + classe no netplay master

    Mensagem por gladistony Sex maio 25, 2012 10:11 am

    Depois substitua o script [NET] Network por esse:
    Código:

    #===============================================================================
    # ** Network - Manages network data.
    #-------------------------------------------------------------------------------
    # Author    Me™ and Mr.Mo
    # Modified  Valentine
    # Version  2.0
    # Date      11-04-06
    #===============================================================================
    SDK.log("Network", "Mr.Mo and Me™", "1.0", " 11-04-06")

    p "TCPSocket script not found (class Network)" if not SDK.state('TCPSocket')
    #-------------------------------------------------------------------------------
    # Begin SDK Enabled Check
    #-------------------------------------------------------------------------------
    if SDK.state('TCPSocket') == true and SDK.state('Network')

    module Network
     
    class Main
     
      #--------------------------------------------------------------------------
      # * Attributes
      #--------------------------------------------------------------------------
      attr_accessor :socket
      attr_accessor :pm
      # getpm, pmname, writepm
     
      # AUTHENFICATION  = 0    => Authenficates
      # ID_REQUEST      = 1    => Returns ID
      # NAME_REQUEST    = 2    => Returns UserName
      # GROUP_REQUEST  = 3    => Returns Group
      # CLOSE          = 4    => Close, Stop Connection
      # NET_PLAYER      = 5    => Netplayers Data
      # MAP_PLAYER      = 6    => Mapplayers Data
      # KICK            = 7    => Kick a Player
      # KICK ALL        = 8    => Kick all Players
      # REMOVE          = 9    => Remove Player (CLOSE SYNONYM)
      # SYSTEM          = 10    => System (Var's and Switches)
      # MOD_CHANGE      = 11    => Message ot Day Change
      # TRADE          = 12    => Trade
      # PRIVATE_CHAT    = 13    => Private Chat
      #                = 14
      # POKE            = 15    => Poke Player
      # SLAP            = 16    => Decrease HP or SP PLayer
      # SLAP ALL        = 17    => Decrease Hp or SP ALL
      # ADM - MOD      = 18    => Admin/Mod Command Returns
      #                = 19
      # TEST STOP      = 20    => Connection Test End
     
      #--------------------------------------------------------------------------
      # * Initialiation
      #--------------------------------------------------------------------------
      def self.initialize
        @players    = {}
        @mapplayers = {}
        @netactors  = {}
        @pm = {}
        @pm_lines = []
        @user_test  = false
        @user_exist = false
        @socket    = nil
        @nooprec    = 0
        @id        = -1
        @name      = ""
        @group      = ""
        @status    = ""
        @oldx      = -1
        @oldy      = -1
        @oldd      = -1
        @oldp      = -1
        @oldid      = -1
        @login      = false
        @pchat_conf = false
        @send_conf  = false
        @trade_conf = false
        @servername = ""
        @pm_getting = false
        @self_key1 = nil
        @self_key2 = nil
        @self_key3 = nil
        @self_value = nil
        @trade_compelete = false
        @trading = false
        @trade_id = -1
        $party = Net_Party.new
      end
      #--------------------------------------------------------------------------
      # * Returns Servername
      #--------------------------------------------------------------------------
      def self.servername
        return @servername.to_s
      end
      #--------------------------------------------------------------------------
      # * Returns Socket
      #--------------------------------------------------------------------------
      def self.socket
        return @socket
      end
      #--------------------------------------------------------------------------
      # * Returns UserID
      #--------------------------------------------------------------------------
      def self.id
        return @id
      end
      #--------------------------------------------------------------------------
      # * Returns UserName
      #--------------------------------------------------------------------------
      def self.name
        return @name
      end 
      #--------------------------------------------------------------------------
      # * Returns current Status
      #--------------------------------------------------------------------------
      def self.status
        return "" if @status == nil or @status == []
        return @status
      end
      #--------------------------------------------------------------------------
      # * Returns Group
      #--------------------------------------------------------------------------
      def self.group
        if @group.downcase.include?("adm")
          group = "admin"
        elsif @group.downcase.include?("mod")
          group = "mod"
        else
          group = "standard"
        end
        return group
      end
      #--------------------------------------------------------------------------
      # * Returns Mapplayers
      #--------------------------------------------------------------------------
      def self.mapplayers
        return {} if @mapplayers == nil
        return @mapplayers
      end
      #--------------------------------------------------------------------------
      # * Returns NetActors
      #--------------------------------------------------------------------------
      def self.netactors
        return {} if @netactors == nil
        return @netactors
      end
      #--------------------------------------------------------------------------
      # * Returns Players
      #--------------------------------------------------------------------------
      def self.players
        return {} if @players == nil
        return @players
      end
      def self.map_empty?(map_id)
        for p in @players.values
          next if p.nil?
          if p.map_id == map_id || $game_map.map_id == map_id
            return false
          end
        end
        return true
      end
      def self.map_number(map_id)
        n = 0
        for p in @players.values
          next if p.nil?
          if p.map_id == map_id
            n += 1
          end
        end
        if $game_map.map_id == map_id
          n += 1
        end
        return n
      end
      def self.stone_team(team)
        a = []
        b = []
        for p in @players.values
          next if p.nil?
          if p.map_id == 399
            if p.x < 9
              a.push(p)
            else
              b.push(p)
            end
          end
        end
        if $game_player.x < 9
          a.push(p)
        else
          b.push(p)
        end
        if team == 1
          return a
        else
          return b
        end
      end
      #--------------------------------------------------------------------------
      # * Destroys player
      #--------------------------------------------------------------------------
      def self.destroy(id)
        !if $party.empty?
          for i in 0..$party.members.size
            if $party.members[i] != nil
              name = $game_party.actors[0].name
              Network::Main.pchat($party.members[i].netid,"[COM] [ET] #{name}")
              Network::Main.pchat($party.members[i].netid,"#{name} saiu da party!")
              #$Hud_Party.visible = false
              #$Hud_Party.active = false
            end
          end
        end
        $party.party_exit
        @players[id.to_s] = nil rescue nil
        @mapplayers[id.to_s] = "" rescue nil
        for player in @mapplayers
          @mapplayers.delete(id.to_s) if player[0].to_i == id.to_i
        end
        for player in @players
          @players.delete(id.to_s) if player[0].to_i == id.to_i
        end
        if $scene.is_a?(Scene_Map)
          begin
            $scene.spriteset[id].dispose unless $scene.spriteset[id].disposed?
          rescue
            nil
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Create A socket
      #--------------------------------------------------------------------------
      def self.start_connection(host, port)
        @socket = TCPSocket.new(host, port)
      end
      #--------------------------------------------------------------------------
      # * Asks for Id
      #--------------------------------------------------------------------------
      def self.get_id
        @socket.send("<1>'req'</1>\n")
      end
      #--------------------------------------------------------------------------
      # * Asks for name
      #--------------------------------------------------------------------------
      def self.get_name
        @socket.send("<2>'req'</2>\n")
      end
      #--------------------------------------------------------------------------
      # * Asks for Group
      #--------------------------------------------------------------------------
      def self.get_group
        #@socket.send("<3>'req'</3>\n")
        @socket.send("<check>#{self.name}</check>\n")
      end
      #--------------------------------------------------------------------------
      # * Registers (Attempt to)
      #--------------------------------------------------------------------------
      def self.send_register(user,pass)
        # Register with User as name, and Pass as password
        @socket.send("<reges #{user}>#{pass}</reges>\n")
        # Start Loop for Retrival
        loop = 0
          loop do
          loop += 1
          self.update
          # Break If Registration Succeeded
          break if @registered
          # Break if Loop reached 10000
          break if loop == 10000
        end
      end
      #--------------------------------------------------------------------------
      # * Asks for Network Version Number
      #--------------------------------------------------------------------------
      def self.retrieve_version
        @socket.send("<ver>#{User_Edit::VERSION}</ver>\n")
      end
      #--------------------------------------------------------------------------
      # * Asks for Message of the day
      #--------------------------------------------------------------------------
      def self.retrieve_mod
        @socket.send("<mod>'request'</mod>\n")
      end
      #--------------------------------------------------------------------------
      # * Asks for Login (and confirmation)
      #--------------------------------------------------------------------------
      def self.send_login(user,pass)
        @socket.send("<login #{user}>#{pass}</login>\n")
      end
      #--------------------------------------------------------------------------
      # * Send Errors
      #--------------------------------------------------------------------------
      def self.send_error(lines)
        if lines.is_a?(Array)
          for line in lines
            @socket.send("<err>#{line}</err>\n")
          end
        elsif lines.is_a?(String)
          @socket.send("<err>#{lines}</err>\n")
        end
      end 
      #--------------------------------------------------------------------------
      # * Authenfication
      #--------------------------------------------------------------------------
      def self.amnet_auth
        # Send Authenfication
        @socket.send("<0>'e'</0>\n")
        @auth = false
        # Set Try to 0, then start Loop
        try = 0
        loop do
          # Add 1 to Try
          try += 1
          loop = 0
          # Start Loop for Retrieval
          loop do
            loop += 1
            self.update
            # Break if Authenficated
            break if @auth
            # Break if loop reaches 20000
            break if loop == 20000
          end
          # If the loop was breaked because it reached 10000, display message
          p "#{User_Edit::NOTAUTH}, Tentativa #{try} de #{User_Edit::CONNFAILTRY}" if loop == 20000
          # Stop everything if try mets the maximum try's
          break if try == User_Edit::CONNFAILTRY
          # Break loop if Authenficated
          break if @auth
        end
        # Go to Scene Login if Authenficated
        $scene = Scene_Login.new if @auth
      end
      #--------------------------------------------------------------------------
      # * Send Start Data
      #--------------------------------------------------------------------------
      def self.send_start
        send = ""
        # Send Username And character's Graphic Name
        send += "@username = '#{self.name}'; @character_name = '#{$game_player.character_name}';"
        # Send guild of the player
        send += "@guild = '#{$guild_name.to_s}';"
        # Send gold
        send += "@gold = '#{$game_party.item_number(Item_Ouro::Item_Id.to_i).to_s}';"
        # Send guild position of the player
        send += "@position = '#{$guild_position.to_s}';"
        # Send bandeira of the guild player
        send += "@flag = '#{$flag.to_s}';"
        # Send grupo of the player
        send += "@grupo = '#{$game_party.actors[0].grupo}';"
        # Send status ban of the player
        send += "@ban = '#{$game_party.actors[0].ban}';"
        # Send map mensage
        send += "@chat_text = '#{$chat_text.to_s}';"
        # Send level info
        send += "@level_info = '#{$level_info.to_s}';"
        # Send Exp
        send += "@now_exp = '#{$game_party.actors[0].now_exp}';"
        send += "@next_exp = '#{$game_party.actors[0].next_exp}';"
        # Send genero
        send += "@sexo = '#{$game_party.actors[0].sexo}';"
        # Sends Map ID, X and Y positions
        send += "@map_id = #{$game_map.map_id}; @x = #{$game_player.x}; @y = #{$game_player.y};"
        # Sends Name
        segundo = $game_party.actors[0].name + "  -  #{$data_classes[$game_party.actors[0].class_id].name}"
        send += "@nome = '#{segundo}';" if User_Edit::Bandwith >= 1
        # Sends Direction
        send += "@direction = #{$game_player.direction};" if User_Edit::Bandwith >= 2
        # Sends Move Speed
        send += "@move_speed = #{$game_player.move_speed};" if User_Edit::Bandwith >= 3
        # Sends Requesting start
        send += "@weapon_id = #{$game_party.actors[0].weapon_id};"
        send += "@armor1_id = #{$game_party.actors[0].armor1_id};"
        send += "@armor2_id = #{$game_party.actors[0].armor2_id};"
        send += "@armor3_id = #{$game_party.actors[0].armor3_id};"
        send += "@armor4_id = #{$game_party.actors[0].armor4_id};"
        send += "@str = #{$game_party.actors[0].str};"
        send += "@agi = #{$game_party.actors[0].agi};"
        send += "@dex = #{$game_party.actors[0].dex};"
        send += "@int = #{$game_party.actors[0].int};"
        send += "@arma_n = '#{$arma_n.to_s}';"
        send += "@escudo_n = '#{$escudo_n.to_s}';"
        #if $data_weapons[$game_party.actors[0].weapon_id] != nil
        #send += "@arma_atk = #{$data_weapons[$game_party.actors[0].weapon_id].name};"
        #end
        #if $data_armors[$game_party.actors[0].armor1_id] != nil
        #send += "@escudo_def = #{$data_armors[$game_party.actors[0].armor1_id].name};"
        #end
        send += "start(#{self.id});"
        @socket.send("<5>#{send}</5>\n")
        self.send_newstats
        #send_actor_start
      end
      #--------------------------------------------------------------------------
      # * Return PMs
      #-------------------------------------------------------------------------
      def self.pm
        return @pm
      end
      #--------------------------------------------------------------------------
      # * Get PMs
      #--------------------------------------------------------------------------
      def self.get_pms
        @pm_getting = true
        @socket.send("<22a>'Get';</22a>\n")
      end
      #--------------------------------------------------------------------------
      # * Update PMs
      #--------------------------------------------------------------------------
      def self.update_pms(message)
      #Starts all the variables
      @pm = {}
      @current_Pm = nil
      @index = -1
      @message = false
      #Makes a loop to look thru the message
      for line in message
        #If the line is a new PM
        if line == "$NEWPM"
          @index+=1
          @pm[@index] = Game_PM.new(@index)
          @message = false
          #if the word has $to_from
        elsif line == "$to_from" and @message == false
          to_from = true
          #if the word has $subject
        elsif line == "$Subject" and @message == false
          subject = true
          #if the word has $message
        elsif line == "$Message" and @message == false
          @message = true
        elsif @message
          @pm[@index].message += line+"\n"
        elsif to_from
          @pm[@index].to_from = line
          to_from = false
        elsif subject
          @pm[@index].subject = line
          subject = false
        end
      end
      @pm_getting = false
     end
      #--------------------------------------------------------------------------
      # * Checks if the PM is still not get.
      #--------------------------------------------------------------------------
      def self.pm_getting
        return @pm_getting
      end
      #--------------------------------------------------------------------------
      # * Write PMs
      #--------------------------------------------------------------------------
      def self.write_pms(message)
        send = message
        @socket.send("<22d>#{send}</22d>\n")
      end
      #--------------------------------------------------------------------------
      # * Delete All PMs
      #--------------------------------------------------------------------------
      def self.delete_all_pms
        @socket.send("<22e>'delete'</22e>\n")
        @pm = {}
      end
      #--------------------------------------------------------------------------
      # * Delete pm(id)
      #--------------------------------------------------------------------------
      def self.delete_pm(id)
        @pm.delete(id)
      end
      #--------------------------------------------------------------------------
      # * Delete MapPlayers
      #--------------------------------------------------------------------------
      def self.mapplayers_delete
        @mapplayers = {}
      end
      #--------------------------------------------------------------------------
      # * Update Guild
      #--------------------------------------------------------------------------
      def self.update_guild
        contents = "@guild = '#{$guild_name.to_s}';"
        @socket.send("<5>#{contents}</5>\n")
      end
      #--------------------------------------------------------------------------
      # * Send Requested Data
      #--------------------------------------------------------------------------
      def self.send_start_request(id)
        send = ""
        # Send Username And character's Graphic Name
        send += "@username = '#{self.name}'; @character_name = '#{$game_player.character_name}'; "
        # Sends Map ID, X and Y positions
        send += "@map_id = #{$game_map.map_id}; @x = #{$game_player.x}; @y = #{$game_player.y}; "
        # Sends Name
        send += "@nome = '#{$game_party.actors[0].name}'; " if User_Edit::Bandwith >= 1
        # Sends Direction
        send += "@direction = #{$game_player.direction}; " if User_Edit::Bandwith >= 2
        # Sends Move Speed
        send += "@move_speed = #{$game_player.move_speed};" if User_Edit::Bandwith >= 3
        send += "@weapon_id = #{$game_party.actors[0].weapon_id};"
        send += "@armor1_id = #{$game_party.actors[0].armor1_id};"
        send += "@armor2_id = #{$game_party.actors[0].armor2_id};"
        send += "@armor3_id = #{$game_party.actors[0].armor3_id};"
        send += "@armor4_id = #{$game_party.actors[0].armor4_id};"
        send += "@guild = '#{$guild_name.to_s}';"
        send += "@position = '#{$guild_position.to_s}';"
        send += "@flag = '#{$flag.to_s}';"
        send += "@grupo = '#{$game_party.actors[0].grupo}';"
        send += "@ban = '#{$game_party.actors[0].ban}';"
        send += "@chat_text = '#{$chat_text.to_s}';"
        send += "@sexo = '#{$game_party.actors[0].sexo}';"
        send += "@now_exp = '#{$game_party.actors[0].now_exp}';"
        send += "@next_exp = '#{$game_party.actors[0].next_exp}';"
        send += "@gold = '#{$game_party.item_number(Item_Ouro::Item_Id.to_i).to_s}';"
        send += "@str = #{$game_party.actors[0].str};"
        send += "@agi = #{$game_party.actors[0].agi};"
        send += "@dex = #{$game_party.actors[0].dex};"
        send += "@int = #{$game_party.actors[0].int};"
        send += "@level_info = '#{$level_info.to_s}';"
        send += "@arma_n = '#{$arma_n.to_s}';"
        send += "@escudo_n = '#{$escudo_n.to_s}';"
        #if $data_weapons[$game_party.actors[0].weapon_id] != nil
        #send += "@arma_atk = #{$data_weapons[$game_party.actors[0].weapon_id].name};"
        #end
        #if $data_armors[$game_party.actors[0].armor1_id] != nil
        #send += "@escudo_def = #{$data_armors[$game_party.actors[0].armor1_id].name};"
        #end
        #@socket.send("<6a>#{id.to_i}</6a>\n")
        @socket.send("<5>#{send}</5>\n")
        #self.send_map
        #self.send_actor_start
      end
      #--------------------------------------------------------------------------
      # * Send Map Id data
      #--------------------------------------------------------------------------
      def self.send_map
        send = ""
        # Send Username And character's Graphic Name
        send += "@username = '#{self.name}'; @character_name = '#{$game_player.character_name}'; "
        # Sends Map ID, X and Y positions
        send += "@map_id = #{$game_map.map_id}; @x = #{$game_player.x}; @y = #{$game_player.y}; "
        # Sends Direction
        send += "@direction = #{$game_player.direction};" if User_Edit::Bandwith >= 2
        send += "@weapon_id = #{$game_party.actors[0].weapon_id};"
        send += "@armor1_id = #{$game_party.actors[0].armor1_id};"
        send += "@armor2_id = #{$game_party.actors[0].armor2_id};"
        send += "@armor3_id = #{$game_party.actors[0].armor3_id};"
        send += "@armor4_id = #{$game_party.actors[0].armor4_id};"
        @socket.send("<5>#{send}</5>\n")
        for player in @players.values
          next if player.netid == -1
          # If the Player is on the same map...
          if player.map_id == $game_map.map_id and self.in_range?(player)
            # Update Map Players
            self.update_map_player(player.netid, nil)
          elsif @mapplayers[player.netid.to_s] != nil
            # Remove from Map Players
            self.update_map_player(player.netid, nil, true)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Calls a player to trade
      #--------------------------------------------------------------------------
      def self.trade_call(id)
        @trade_compelete = false
        @trading = true
        @socket.send("<24>#{id}\n")
        ids = self.id
        @socket.send("<24c>@trade_id = #{ids}</24c>\n")
      end
      #--------------------------------------------------------------------------
      # * Exit trade.
      #--------------------------------------------------------------------------
      def self.trade_exit(id)
        @socket.send("<24>#{id}\n")
        ids = self.id
        @socket.send("<24d>trade_exit = #{ids}</24d>\n")
      end
      #--------------------------------------------------------------------------
      # * Checks if the trade is compelete
      #--------------------------------------------------------------------------
      def self.trade_compelete
        return @trade_compelete
      end
      #--------------------------------------------------------------------------
      # * Checks the trade result
      #--------------------------------------------------------------------------
      def self.trading
        return @trading
      end
      #--------------------------------------------------------------------------
      # * Send Move Update
      #--------------------------------------------------------------------------
      def self.trade_add(kind,item_id,netid)
        @socket.send("<25>#{netid}\n")
        me = self.id
        @socket.send("<25a>i_kind = #{kind}; i_id = #{item_id}; id = #{me};</25a>\n")
      end
      #--------------------------------------------------------------------------
      # * Send Move Update
      #--------------------------------------------------------------------------
      def self.trade_remove(kind,item_id,netid)
        @socket.send("<25>#{netid}\n")
        me = self.id
        @socket.send("<25b>i_kind = #{kind}; i_id = #{item_id}; id = #{me};</25b>\n")
      end
      #--------------------------------------------------------------------------
      # * Send Trade REquest
      #--------------------------------------------------------------------------
      def self.trade_request(netid)
        @socket.send("<25>#{netid}\n")
        me = self.id
        @socket.send("<25d>id = #{me};</25d>\n")
      end
      #--------------------------------------------------------------------------
      # * Send accept trade
      #--------------------------------------------------------------------------
      def self.trade_accept(netid)
        @socket.send("<25>#{netid}\n")
        me = self.id
        @socket.send("<25e>id = #{me};</25e>\n")
      end
      #--------------------------------------------------------------------------
      # * Send cancel trade
      #--------------------------------------------------------------------------
      def self.trade_cancel(netid)
        @socket.send("<25>#{netid}\n")
        me = self.id
        @socket.send("<25f>id = #{me};</25f>\n")
      end
      #--------------------------------------------------------------------------
      # * Send Move Update
      #--------------------------------------------------------------------------
      def self.send_move_change
        return if @oldx == $game_player.x and @oldy == $game_player.y
        return if @mapplayers == {}
        send = ""
        # Increase Steps if the oldx or the oldy do not match the new ones
        if User_Edit::Bandwith >= 1
          send += "ic;"  if @oldx != $game_player.x or @oldy != $game_player.y
        end
        # New x if x does not mathc the old one
        if @oldx != $game_player.x
          send += "@x = #{$game_player.x}; @tile_id = #{$game_player.tile_id};"
          @oldx = $game_player.x
        end
        # New y if y does not match the old one
        if @oldy != $game_player.y
          send += "@y = #{$game_player.y}; @tile_id = #{$game_player.tile_id};"
          @oldy = $game_player.y
        end
        # Send the Direction if it is different then before
        if User_Edit::Bandwith >= 2
          if @oldd != $game_player.direction
            send += "@direction = #{$game_player.direction};" 
            @oldd = $game_player.direction
          end
        end
        # Send everything that needs to be sended
        @socket.send("<5>#{send}</5>\n") if send != ""
      end
      #--------------------------------------------------------------------------
      # * Send Stats
      #--------------------------------------------------------------------------
      def self.send_newstats
        hp = $game_party.actors[0].hp
        maxhp = $game_party.actors[0].maxhp
        sp = $game_party.actors[0].sp
        maxsp = $game_party.actors[0].maxsp
        agi = $game_party.actors[0].agi
        eva = $game_party.actors[0].eva
        pdef = $game_party.actors[0].pdef
        mdef = $game_party.actors[0].mdef
        level = $game_party.actors[0].level
        a = $game_party.actors[0]
        c = "["
        m = 1
        for i in a.states
          next if $data_states[i] == nil
          c += i.to_s
          c += ", " if m != a.states.size
          m += 1
        end
        c += "]"
        stats = "@hp = #{hp}; @maxhp = #{maxhp}; @sp = #{sp};  @maxsp = #{maxsp}; @agi = #{agi}; @eva = #{eva}; @pdef = #{pdef}; @mdef = #{mdef}; @states = #{c}; @level = #{level}"
        @socket.send("<5>#{stats}</5>\n")
      end
      #--------------------------------------------------------------------------
      # * Send Gold
      #--------------------------------------------------------------------------
      def self.send_gold
        gold = $game_party.gold
        @socket.send("<5>@gold = #{gold}</5>\n")
      end
      #--------------------------------------------------------------------------
      # * Close Socket
      #--------------------------------------------------------------------------
      def self.close_socket
        return if @socket == nil
        @socket.send("<9>#{self.id}</9>\n")
        #@socket.send("<4>'Close'</4>\n")
    #Se você fechar o jogo quando uma mensagem tiver aberta, quando retornar, ele não está travado
      if $game_temp.message_window_showing
        @message_window = Window_Message.new
        @message_window.terminate_message
      end
        if $scene.is_a?(Scene_Connect)
        end
        if $scene.is_a?(Scene_Login)
        end
        #if $scene.is_a?(Scene_Register)
        #end
        if $scene.is_a?(Scene_Title)
        end
        #No jogo
        if $scene.is_a?(Scene_Trade)
        salvar
        end
        if $scene.is_a?(Scene_PChat)
        salvar
        end
        if $scene.is_a?(Scene_Map)
        salvar
        if not $party.empty?
          for i in 0..$party.members.size
            if $party.members[i] != nil
              if $parte_s == true
              name = $game_party.actors[0].name
              Network::Main.pchat($charzinho_id,"[COM] [ET] #{name}")
              Network::Main.pchat($charzinho_id,"[COM] [EXIT] #{name}")
              Network::Main.pchat($charzinho_id,"#{name} saiu da party!")
              #$Hud_Party.visible = false
              #$Hud_Party.active = false
              else
              name = $game_party.actors[0].name
              Network::Main.pchat($party.members[i].netid,"[COM] [ET] #{name}")
              Network::Main.pchat($party.members[i].netid,"[COM] [EXIT] #{name}")
              Network::Main.pchat($party.members[i].netid,"#{name} saiu da party!")
              #$Hud_Party.visible = false
              #$Hud_Party.active = false
              end
            end
          end
        end
        end
        @socket.close
        @socket = nil
      end
      #--------------------------------------------------------------------------
      # * Change Messgae of the Day
      #--------------------------------------------------------------------------
      def self.change_mod(newmsg)
        @socket.send("<11>#{newmsg}</11>\n")
      end
      #--------------------------------------------------------------------------
      # * Private Chat Send
      #--------------------------------------------------------------------------
      def self.pchat(id,mesg)
        @pchat_conf = false
        # Send the Private Chat Id (without close!!! \<13a>)
        @socket.send("<13a>#{id}\n")
        # Send Priavte Chat Message
        @socket.send("<13>#{mesg}</13>\n") #if @pchat_conf
        #p "could not send #{mesg} to #{id}..." if not @pchat_conf
      end
      #--------------------------------------------------------------------------
      # * Private Chat Send
      #--------------------------------------------------------------------------
      def self.mchat(id,mesg)
        @mchat_conf = false
        # Send the Chat Id (without close!!! \<21a>)
        @socket.send("<21a>#{id}\n")
        # Send Chat Message
        @socket.send("<21>#{mesg}</21>\n")
      end
      #--------------------------------------------------------------------------
      # * Check if the user exists on the network..
      #--------------------------------------------------------------------------
      def self.user_exist?(username)
        # Enable the test
        @user_test  = true
        @user_exist = false
        # Send the data for the test
        self.send_login(username.to_s,"*test*")
        # Check for how to long to wait for data (Dependent on username size)
        if username.size <= 8
          # Wait 1.5 seconds if username is less then 8
          for frame in 0..(1.5*40)
            self.update
          end
        elsif username.size > 8 and username.size <= 15
          # Wait 2.3 seconds if username is less then 15
          for frame in 0..(2.3*40)
            self.update
          end
        elsif username.size > 15
          # Wait 3 seconds if username is more then 15
          for frame in 0..(3*40)
            self.update
          end
        end
        # Start Retreival Loop
        loop = 0
        loop do
          loop += 1
          self.update
          # Break if User Test was Finished
          break if @user_test == false
          # Break if loop meets 10000
          break if loop == 10000
        end
        # If it failed, display message
        p User_Edit::USERTFAIL if loop == 10000
        # Return User exists if failed, or if it exists
        return true if @user_exist or loop == 10000
        return false
      end
      #--------------------------------------------------------------------------
      # * Trade
      #--------------------------------------------------------------------------
      def self.trade(id,type,item,num=1,todo='gain')
        # Gain is used for normal trade,
        # Lose is used as Admin Command
        # Check if you got item
        case type
        when 0
          got = $game_party.item_number(item)
        when 1
          got = $game_party.weapon_number(item)
        when 2
          got = $game_party.armor_number(item)
        end
        # Print if not, return
        p "#{User_Edit::DONTGOTTRADE} (trade: kind = #{type} id = #{item})" if got == 0 and todo == 'gain'
        return if got == 0 and todo == 'gain'
        p "#{User_Edit::NOTENOUGHTRADE} (trade: kind = #{type} id = #{item})" if got < num and todo == 'gain'
        return if got < num and todo == 'gain'
        @pchat_conf = false
        # Send the Trade Id (without close!!! \<12a>)
        @socket.send("<12a>#{id}\n")
        @socket.send("<12>type=#{type} item=#{item} num=#{num} todo=#{todo}</12>\n")
          case type
          when 0
            $game_party.lose_item(item,num) if todo == 'gain'
          when 1
            $game_party.lose_weapon(item, num)  if todo == 'gain'
          when 2
            $game_party.lose_armor(item, num)  if todo == 'gain'
          end
      end
      #--------------------------------------------------------------------------
      # * Send Result
      #--------------------------------------------------------------------------
      def self.send_result(id)
        @socket.send("<result_id>#{id}</result_id>\n")
        @socket.send("<result_effect>#{self.id}</result_effect>\n")
      end
      #--------------------------------------------------------------------------
      # * Send Dead
      #--------------------------------------------------------------------------
      def self.send_dead
        @socket.send("<9>#{self.id}</9>\n")
      end
      #--------------------------------------------------------------------------
      # * Update Net Players
      #--------------------------------------------------------------------------
      def self.update_net_player(id, data)
        # Turn Id in Hash into Netplayer (if not yet)
        @players[id] ||= Game_NetPlayer.new
        # Set the Global NetId if it is not Set yet
        @players[id].do_id(id) if @players[id].netid == -1
        # Refresh -> Change data to new data
        @players[id].refresh(data)     
        # Return if the Id is Yourself
        return if id.to_i == self.id.to_i
        # Return if you are not yet on a Map
        return if $game_map == nil
        # If the Player is on the same map...
        if @players[id].map_id == $game_map.map_id
          # Update Map Players
          self.update_map_player(id, data)
        elsif @mapplayers[id] != nil
          # Remove from Map Players
          self.update_map_player(id, data, true)
        end
      end
      #--------------------------------------------------------------------------
      # * Update Map Players
      #--------------------------------------------------------------------------
      def self.update_map_player(id, data, kill=false)
        # Return if the Id is Yourself
        return if id.to_i == self.id.to_i
        # If Kill (remove) is true...
        if kill and @mapplayers[id] != nil
          # Delete Map Player
          @mapplayers.delete(id.to_i) rescue nil
          if $scene.is_a?(Scene_Map)
            $scene.spriteset.delete(id.to_i) rescue nil
          end
          $game_temp.spriteset_refresh = true
          return
        end
        g = @mapplayers[id]
        @mapplayers[id] ||= @players[id] if @players[id] != nil
        # Turn Id in Hash into Netplayer (if not yet)
        @mapplayers[id] ||= Game_NetPlayer.new
        # Set the Global NetId if it is not Set yet
        @mapplayers[id].netid = id if @mapplayers[id].netid == -1
        # Refresh -> Change data to new data
        @mapplayers[id].refresh(data)
        #Send the player's new stats
        self.send_newstats if g == nil
      end
      #--------------------------------------------------------------------------
      # * Update Net Actors
      #--------------------------------------------------------------------------
      def self.update_net_actor(id,data,actor_id)
        return
        return if id.to_i == self.id.to_i
        # Turn Id in Hash into Netplayer (if not yet)
        @netactors[id] ||= Game_NetActor.new(actor_id)
        # Set the Global NetId if it is not Set yet
        @netactors[id].netid = id if @netactors[id].netid == -1
        # Refresh -> Change data to new data
        @netactors[id].refresh(data)
      end
      #--------------------------------------------------------------------------
      # * Update
      #--------------------------------------------------------------------------
      def self.update
        # If Socket got lines, continue
        return unless @socket.ready?
        for line in @socket.recv(0xfff).split("\n")
          @nooprec += 1 if line.include?("\000\000\000\000")
          return if line.include?("\000\000\000\000")
          p "#{line}" unless line.include?("<5>") or line.include?("<6>")or not $DEBUG or not User_Edit::PRINTLINES
          # Set Used line to false
          updatebool = false
          #Update Walking
          updatebool = self.update_walking(line) if @login and $game_map != nil
          # Update Ingame Protocol, if LogedIn and Map loaded
          updatebool = self.update_ingame(line)  if updatebool == false and @login and $game_map != nil
          # Update System Protocol, if command is not Ingame
          updatebool = self.update_system(line)  if updatebool == false
          # Update Admin/Mod Protocol, if command is not System
          updatebool = self.update_admmod(line)  if updatebool == false
          # Update Outgame Protocol, if command is not Admin/Mod
          updatebool = self.update_outgame(line) if updatebool == false
        end
      end
      #--------------------------------------------------------------------------
      # * Update Admin and Mod Command Recievals -> 18
      #--------------------------------------------------------------------------
      def self.update_admmod(line)
        case line
        # Admin Command Recieval
        when /<18>(.*)<\/18>/
          # Kick All Command
          if $1.to_s == "kick_all"
            p User_Edit::ADMKICKALL
            self.close_socket
            $scene = nil
            return true
          # Kick Command
          elsif $1.to_s == "kicked"
            p User_Edit::ADMKICK
            self.close_socket
            $scene = nil
            return true
          end
        return false
        end
        return false
      end
    gladistony
    gladistony
    Membro Ativo
    Membro Ativo


    Mensagens : 336
    Créditos : 217

    Nome do personagem + classe no netplay master Empty Re: Nome do personagem + classe no netplay master

    Mensagem por gladistony Sex maio 25, 2012 10:12 am

    Continuação do [NET] Network, cole logo abaixo do outro
    Código:

      #--------------------------------------------------------------------------
      # * Update all Not-Ingame Protocol Parts -> 0, login, reges
      #--------------------------------------------------------------------------
      def self.update_outgame(line)
        case line
        # Server Authenfication
        when /<0 (.*)>(.*) n=(.*)<\/0>/
          a = self.authenficate($1,$2)
          @servername = $3.to_s
          return true if a
        # Registration Conformation
        when /<reges>(.*)<\/reges>/
          @user_test = false
          return true
        # Login, With User Test
        when /<login>(.*)<\/login>/
          if not @user_test
            # When Log in Succeeded, and not User Test...
            if $1 == "allow" and not @user_test
              # Login and Status to Logged-in
              @login = true
              @status = User_Edit::LOGIN_STATUS
              text = [@status]
              $scene.set_status(@status) if $scene.is_a?(Scene_Login)
              # Get Name (By Server)
              self.get_name
              # Start Loop for Retrieval
              loop = 0
              loop do
                self.update
                loop += 1
                # Break if loop reaches 10000
                break if loop == 10000
                # Break if Name and ID are recieved
                break if self.name != "" and self.name != nil and self.id != -1
              end
              self.get_group
              # Goto Scene Title
              $scene = Scene_Title.new
              return true
            # When Wrong Username and not User Test
            elsif $1 == "wu" and not @user_test
              # Set status to Incorrect Username
              @status = User_Edit::LOGIN_USERERROR
              $scene.set_status(@status) if $scene.is_a?(Scene_Login)
              return true
            # When Wrong Password and not User Test
            elsif $1 == "wp" and not @user_test
              # Set status to Incorrect Passowrd
              @status = User_Edit::LOGIN_PASSERROR
              $scene.set_status(@status) if $scene.is_a?(Scene_Login)
              return true
            # When Other Command, and Not User test
            elsif not @user_test
              # ERROR!
              @status = User_Edit::UNEXPECTLOGERR
              p @status
              return true
            end
          # If it IS a user test...
          else
            @user_exist = false
            #...and wrong user -> does not exist
            if $1 == "wu"
              # User does not Exist
              @user_exist = false
              @user_test = false
            #...and wrong pass -> does exist
            elsif $1 == "wp"
              # User Does Exist
              @user_exist = true
              @user_test = false
            end
            return true
          end
          return false
        end
        return false
      end
      #--------------------------------------------------------------------------
      # * Update System Protocol Parts -> ver, mod, 1, 2, 3, 10
      #--------------------------------------------------------------------------
      def self.update_system(line)
        case line
        # Version Recieval
        when /<ver>(.*)<\/ver>/
          $game_temp.msg = User_Edits::VER_ERROR if $1.to_s == nil
          @version = $1.to_s if $1.to_s != nil
          return true
        # Message Of the Day Recieval
        when /<mod>(.*)<\/mod>/
          $game_temp.motd = $1.to_s
          return true
        # User ID Recieval (Session Based)
        when /<1>(.*)<\/1>/
          @id = $1.to_s
          return true
        # User Name Recieval
        when /<2>(.*)<\/2>/
          @name = $1.to_s
          return true
        # Group Recieval
        when /<3>(.*)<\/3>/
          @group = $1.to_s
          return true
        when /<check>(.*)<\/check>/
          @group = $1.to_s
          return true
        # System Update
        when /<10>(.*)<\/10>/
          return true if $1.match(/File|system|`/)
          return true if $1.nil?
          eval($1)
          $game_map.need_refresh = true
          return true
        when /<23>(.*)<\/23>/
          eval($1)
          key = []
          key.push(@self_key1)
          key.push(@self_key2)
          key.push(@self_key3)
          $game_self_switches[key] = @self_value
          @self_key1 = nil
          @self_key2 = nil
          @self_key3 = nil
          @self_value = nil
          $game_map.need_refresh = true
          key = []
          return true
        end
        return false
      end
      #--------------------------------------------------------------------------
      # * Update Walking
      #--------------------------------------------------------------------------
      def self.update_walking(line)
        case line
        # Player information Processing
        when /<player id=(.*)>(.*)<\/player>/
          self.update_net_player($1, $2)
          return true
        # Player Processing
        when /<5 (.*)>(.*)<\/5>/
          # Update Player
          self.update_net_player($1, $2)
          # If it is first time connected...
          return true if !$2.include?("start")
          # ... and it is not yourself ...
          return true if $1.to_i == self.id.to_i
          # ... and it is on the same map...
          return true if @players[$1].map_id != $game_map.map_id
          # ...  Return the Requested Information
          return true if !self.in_range?(@players[$1])
          self.send_start_request($1.to_i)
          $game_temp.spriteset_refresh = true
        return true
        # Map PLayer Processing
        when /<6 (.*)>(.*)<\/6>/
          # Return if it is yourself
          return true if $1.to_i == self.id.to_i
          # Update Map Player
          #self.update_map_player($1, $2)
          self.update_net_player($1, $2)
          # If it is first time connected...
          if $2.include?("start") or $2.include?("map")
            # ... and it is not yourself ...
            return true if $1.to_i != self.id.to_i
            # ... and it is on the same map...
            return true if @players[$1].map_id != $game_map.map_id
            # ...  Return the Requested Information
            return true if !self.in_range?(@players[$1])
            self.send_start_request($1.to_i)
            $game_temp.spriteset_refresh = true
          end
          return true
        # Map PLayer Processing
        when /<netact (.*)>data=(.*) id=(.*)<\/netact>/
          # Return if it is yourself
          return true if $1.to_i == self.id.to_i
          # Update Map Player
          self.update_net_actor($1, $2, $3)
          return true
        when /<state>(.*)<\/state>/
          $game_party.actors[0].refresh_states($1)
        # Attacked!
        when /<attack_effect>dam=(.*) ani=(.*) id=(.*) map=(.*)<\/attack_effect>/
          return if $4.to_i != $game_map.map_id
          $game_party.actors[0].hp -= $1.to_i if $1.to_i > 0 and $1 != "Miss"
          #$game_player.jump(0, 0) if $1.to_i > 0 and $1 != "Miss"
          $game_player.animation_id = $2.to_i if $1.to_i > 0 and $1 != "Miss"
          if User_Edit::VISUAL_EQUIP_ACTIVE == true
          actor = $game_party.actors[0]
          actor.damage = $1.to_i if $1.to_i > 0 and $1 != "Miss"
          else
          $game_player.show_demage($1.to_i,false) if $1.to_i > 0 and $1 != "Miss"
          end
          self.send_newstats
          if $game_party.actors[0].hp <= 0 or $game_party.actors[0].dead?
            self.send_result($3.to_i)
            self.send_dead
           
            #$assassinato = true
    =begin
          if !$party.empty?
          for i in 0..$party.members.size
            if $party.members[i] != nil
              if $parte_s == true
              name = $game_party.actors[0].name
              Network::Main.pchat($charzinho_id,"[COM] [ET] #{name}")
              Network::Main.pchat($charzinho_id,"[COM] [EXIT] #{name}")
              #Network::Main.pchat($charzinho_id,"#{name} foi assassinado e saiu da party!")
              #$Hud_Party.visible = false
              #$Hud_Party.active = false
              else
              name = $game_party.actors[0].name
              Network::Main.pchat($party.members[i].netid,"[COM] [ET] #{name}")
              Network::Main.pchat($party.members[i].netid,"[COM] [EXIT] #{name}")
              #Network::Main.pchat($party.members[i].netid,"#{name} foi assassinado e saiu da party!")
              #$Hud_Party.visible = false
              #$Hud_Party.active = false
              end
            end
          end
    =end
           
            $scene = Scene_Gameover.new
          end
          return true
          # Killed
        when /<result_effect>(.*)<\/result_effect>/
          $ABS.netplayer_killed
          return true
        end
        return false
      end
      #--------------------------------------------------------------------------
      # * Update Ingame Parts -> player, 5, 6, 9, 12, 13
      #--------------------------------------------------------------------------
      def self.update_ingame(line)
        case line
        when /<6a>(.*)<\/6a>/
          @send_conf = true
          return true if $1.to_s ==  "'Confirmed'"
        # Chat Recieval
        when /<chat>(.*)<\/chat>/   
          $game_temp.chat_log.push($1.to_s)
          $game_temp.chat_refresh = true
          return true
        # Remove Player ( Disconnected )
        when /<9>(.*)<\/9>/
          # Destroy Netplayer and MapPlayer things
          self.destroy($1.to_i)
          # Redraw Mapplayer Sprites
          $game_temp.spriteset_refresh = true
          $game_temp.spriteset_renew = true
        when /<12>type=(.*) item=(.*) num=(.*) todo=(.*)<\/12>/
          case $1.to_i
          when 0
            $game_party.gain_item($2.to_i, $3.to_i)    if $4 == 'gain'
            $game_party.lose_item($2.to_i, $3.to_i)    if $4 == 'lose'
          when 1
            $game_party.gain_weapon($2.to_i, $3.to_i)  if $4 == 'gain'
            $game_party.lose_weapon($2.to_i, $3.to_i)  if $4 == 'lose'
          when 2
            $game_party.gain_armor($2.to_i, $3.to_i)  if $4 == 'gain'
            $game_party.lose_weapon($2.to_i, $3.to_i)  if $4 == 'lose'
          end
          $game_temp.refresh_itemtrade = true
          return true
        when /<12a>(.*)<\/12a>/
          @trade_conf = true
          return true if $1.to_s == "'Confirmed'"
        # Private Chat Incomming Message
        when /<13 (.*)>(.*)<\/13>/
          got = false
          id = false
          for chat in 0..$game_temp.pchat_log.size
            if $game_temp.lastpchatid[chat].to_i == $1.to_i
              got = true
              id = chat
            end
          end
          if got
            #$game_temp.pchat_log[id].push($2)
            #$game_temp.lastpchatid[id] = $1.to_i
            #$game_temp.pchat_refresh[id] = true
          else
            #id = $game_temp.pchat_log.size
            #$game_temp.pchat_log[id] = []
            #$game_temp.pchat_log[id].push($2)
            #$game_temp.lastpchatid[id] = -1
            #$game_temp.lastpchatid[id] = $1.to_i
            #$game_temp.pchat_refresh[id] = false
            #$game_temp.pchat_refresh[id] = true
          end
          text = $2.to_s.split
          if text[0] == "[COM]"
            if text[1] == "[PT]"
              for p in Network::Main.mapplayers.values
                if p.nome == text[2] and p != nil
                  if $divide_exp != true
                  $convite_party = true
                  $convite.visible = true
                  $convite.active = true
                  $lider_party_nominho = p.nome
                  $lider_party = p
                  $char_idzinho = text[3]
                  $convite.set_text("#{$lider_party_nominho} convidou você para entrar na party, aceitar?",0, -3)
                  end
                end
              end
            elsif text[1] == "[TRADE]"
              if $trade_a != true
            if $item_w.visible != true
            $equip_w.visible = true
            $equip_w.active = true
            $item_w.visible = true
            $item_w.active = true
            $janela_gold_w.visible = true
            end
            #Trade
            for p in Network::Main.mapplayers.values
            if p.nome == text[2]
            $trade_w = Trade_List2.new(p.netid)
            $trade_w_2 = Trade_List3.new(p.netid)
            @trade_w_2_button = Button2.new($trade_w_2,110-50+10-3,85,"Trocar") {Network::Main.pchat($trade_lider_id,"[COM] [TRADE_ACEITAR_TROCA]")}#{$trade_w.trocando_items}
            @trade_w_2_button_2 = Button2.new($trade_w_2,120-3,85,"  Sair  ") {trocando_sair; $convite_trade = false; $fechando_ativar = true}
            $trade_lider_id = p.netid
            $trade_a = true
            $trade_w.closable = true
            $trade_w.dragable = true
            #$trade_w_2.closable = true
            #$trade_w_2.dragable = true
            end
          end
          end
          elsif text[1] == "[TRADE_ACEITAR_TROCA]"
            $convite_trade = true
            $convite.visible = true
            $convite.active = true
             $convite.set_text("Jogador está confirmando a troca, aceitar?",0, -3)
            $convite.refresh
          elsif text[1] == "[TRADE_ADD_ITEM]"
            @item = text[2]
            $trade_w.add(0,@item.to_i)
            $trade_w.refresh
           
            $trade_w_2.refresh
            $janela_gold_w.refresh
            #$item_w.refresh
          elsif text[1] == "[TRADE_ADD_WEAPON]"
            @item = text[2]
            $trade_w.add(1,@item.to_i)
            $trade_w.refresh
           
            $trade_w_2.refresh
          elsif text[1] == "[TRADE_ADD_ARMOR]"
            @item = text[2]
            $trade_w.add(2,@item.to_i)
            $trade_w.refresh
           
            $trade_w_2.refresh
          elsif text[1] == "[TRADE_REM_ITEM]"
            @item = text[2]
            $trade_w.remove2(0,@item.to_i)
           
            $trade_w_2.refresh
            $trade_w.refresh
            $janela_gold_w.refresh
            #$item_w.refresh
          elsif text[1] == "[TRADE_REM_WEAPON]"
            @item = text[2]
            $trade_w.remove2(1,@item.to_i)
           
            $trade_w_2.refresh
            $trade_w.refresh
          elsif text[1] == "[TRADE_REM_ARMOR]"
            @item = text[2]
            $trade_w.remove2(2,@item.to_i)
           
            $trade_w_2.refresh
            $trade_w.refresh
           
           
          elsif text[1] == "[TRADE_REMO_ITEM]"
            @item = text[2]
            @quantidade = text[3]
            $trade_w_2.removeall(3)
            $trade_w_2.index = 0
            $trade_w_2.refresh
            $trade_w.trocando_items
            $trade_w.refresh
          elsif text[1] == "[TRADE_REMO_WEAPON]"
            @item = text[2]
            @quantidade = text[3]
            $trade_w_2.removeall(3)
            $trade_w_2.index = 0
            $trade_w_2.refresh
            $trade_w.trocando_items
            $trade_w.refresh
          elsif text[1] == "[TRADE_REMO_ARMOR]"
            @item = text[2]
            @quantidade = text[3]
            $trade_w_2.removeall(3)
            $trade_w_2.index = 0
            $trade_w_2.refresh
            $trade_w.trocando_items
            $trade_w.refresh
           
           
            elsif text[1] == "[GDD]"
              Guild_Commands.verificar_guild(text[2], text[3], text[4], text[5])
            elsif text[1] == "[GDS]"
              $guild_name = ""
              $game_party.actors[0].guild = ""
              $game_player.refresh
              if User_Edit::GUILD_NAME == true
              $scene = Scene_Map.new
              Network::Main.send_start
              end
              $guild_position = "Membro"
              $guild_lider_name = ""
              $guild_points = 0
              $game_temp.chat_log.push("Você foi expulso da guild!")
            elsif text[1] == "[PNEL]"
              Admin.verificar_comando(text[2], text[3], text[4], text[5])
            elsif text[1] == "[PUXAR]"
              return if text[2] =! $game_party.actors[0].name
              $game_temp.player_new_map_id = text[3].to_i
              $game_temp.player_new_x = text[4].to_i
              $game_temp.player_new_y = text[5].to_i
              $game_temp.player_transferring = true
              #$game_map.setup($game_temp.player_new_map_id)
              #$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
              $game_map.update
              #$scene = Scene_Map.new
              Network::Main.send_start
            elsif text[1] == "[PNEL2]"
              $adm_w_text = text[2..28]
              $adm_w.refresh
              $adm_w.visible = true
            elsif text[1] == "[OK]" 
              $parte_s = true
              $charzinho_id = text[3]
              $party.party_start($charzinho_id)
              $divide_exp = true
            elsif text[1] == "[EXIT]"
              if $parte_s == true
                $party.party_remove($charzinho_id)
              else
                for i in 0..$party.members.size
                $party.party_remove($party.members[i])
                end
              end
              if User_Edit::HUD_PARTY == true
              $Hud_Party.visible = false
              $Hud_Party.active = false
              end
              $divide_exp = false
            elsif text[1] == "[ET]"
              if $parte_s == true
              p = $lider_hud
              if p.nome == text[2] and p != nil
                $party.party_remove(p)
              end
              else
              for i in 0..$party.members.size
                if $party.members[i] != nil
                  p = $party.members[i]
                  if p.nome == text[2] and p != nil
                    $party.party_remove(p)
                    #$divide_exp = false
                  end
                end
              end
              end
            elsif text[1] == "[EX]"
              if $game_map.map_id == text[3].to_i
              @level_actor_agr = $game_party.actors[0].level
              $game_party.actors[0].exp += text[2].to_i
              if $game_party.actors[0].level > @level_actor_agr
              if User_Edit::DISTRIBUIR_ACTIVE == true
              if $game_party.actors[0].level == 99
                else
                  $distribuir_pontos += 5
              end
              end
              if User_Edit::DISTRIBUIR_ACTIVE == true
              if $distribuir_pontos > 0
              if $distribuir_pontos != 0
                  $status.refresh
                  $status.visible = true
              end
              end
              end
              end
              #$ABS.add_to_display('Obtido ' + (text[2].to_i).to_s + ' exp')
              party_exp = (text[2].to_i).to_s
              actor = $game_party.actors[0]
              if User_Edit::VISUAL_EQUIP_ACTIVE == true
              actor = $game_party.actors[0]
              actor.damage = "#{party_exp} Exp"
              else
              $game_player.show_demage("#{party_exp} Exp",false)
              end
              #actor.damage = "#{party_exp} Exp"
              $game_player.animation_id = 101
              #$divide_exp = true
              end
            elsif text[1] == "[GD]"
              if $game_map.map_id == text[3].to_i
              $game_party.gain_gold(text[2].to_i)
              end
            elsif text[1] == "[IN]"
              if $game_party.actors[0].guild == ""
              $convite_guild1 = true
              $convite.visible = true
              $convite.active = true
              $lider_nominho = text[4]
              $guild_nominho = text[2]
              $flag_nominho = text[3]
              $convite.set_text("#{$lider_nominho} convidou você para entrar na guild #{$guild_nominho}",0, -3)
              end
            elsif text[1] == $game_party.actors[0].guild
              $game_party.gain_item(23,1)
            elsif text[1] == "[HF]"
              $game_temp.player_transferring = true
              $game_temp.player_new_map_id = 345
              $game_temp.player_new_x = 7
              $game_temp.player_new_y = 29
              #transfer_player
            elsif text[1] == "[GT]"
              $game_temp.player_transferring = true
              $game_temp.player_new_map_id = 351
              $game_temp.player_new_x = 13
              $game_temp.player_new_y = 27
              #transfer_player
            end
          else
            $ABS.add_to_display($2.to_s)
            $game_temp.chat_log.push($2.to_s)
            $game_temp.chat_refresh = true
          end
          return true
        # Private Chat ID confirmation
        when /<13a>(.*)<\/13a>/
          @pchat_conf = true
          return true if $1.to_s == "'Confirmed'"
        # Private Chat ID confirmation
        when /<21a>(.*)<\/21a>/
          @mchat_conf = true
          return true if $1.to_s == "'Confirmed'"
        #Map Chat Recieval
        when /<21>(.*)<\/21>/     
          $game_temp.chat_log.push($1.to_s)
          $game_temp.chat_refresh = true
          return true
        when /<22a>(.*)<\/22a>/
          if $1 != "Compelete"
            @pm_lines.push("#{$1}")
          elsif $1 == "Compelete"
            update_pms(@pm_lines)
            @pm_lines = []
          end
          return true
        when /<24a>(.*)<\/24a>/
          @trading = true
          return true
        when /<24c>(.*)<\/24c>/
          eval($1)
          $scene = Scene_Trade.new(@trade_id)
          self.trade_add(-1,-1,@trade_id)
          @trade_id = -1
          return true
        when /<24d>(.*)<\/24d>/
          trade_exit = -1
          eval($1)
          #$game_temp.trade_window.dispose
          $game_temp.trade_window = nil
          trade_exit = -1
          return true
        when /<25a>(.*)<\/25a>/
          i_kind = -1
          i_id = -1
          id = -1
          eval($1)
        # p id#$game_temp.items2[id], $game_temp.weapons2[id], $game_temp.armors2[id]
          if i_id < 0 and i_kind < 0
            $game_temp.trade_window.dispose if $game_temp.trade_window != nil
            $game_temp.trade_window = nil
            $game_temp.trade_window = Trade_List.new(id)
            $game_temp.trade_window.refresh
            @trade_compelete = true
            @trading = false
          end
          $game_temp.items2[id] = {} if $game_temp.items2[id] == nil
          $game_temp.weapons2[id] = {} if $game_temp.weapons2[id] == nil
          $game_temp.armors2[id] = {} if $game_temp.armors2[id] == nil
          return if i_id < 0
          case i_kind
          when 0
            if $game_temp.items2[id][i_id] == nil
              $game_temp.items2[id][i_id] = 1
            else
              $game_temp.items2[id][i_id] += 1
            end
          when 1
            if $game_temp.weapons2[id][i_id] == nil
              $game_temp.weapons2[id][i_id] = 1
            else
              $game_temp.weapons2[id][i_id] += 1
            end
          when 2
            if $game_temp.armors2[id][i_id] == nil
              $game_temp.armors2[id][i_id] = 1
            else
              $game_temp.armors2[id][i_id] += 1
            end
          end
          $game_temp.trade_refresh = true
          return true
        when /<25b>(.*)<\/25b>/
          i_kind = -1
          i_id = -1
          id = -1
          eval($1)
          $game_temp.items2[id] = {} if $game_temp.items2[id] == nil
          $game_temp.weapons2[id] = {} if $game_temp.weapons2[id] == nil
          $game_temp.armors2[id] = {} if $game_temp.armors2[id] == nil
          case i_kind
          when 0
            if  $game_temp.items2[id][i_id] > 1
                $game_temp.items2[id][i_id] -= 1
            else
                $game_temp.items2[id].delete(i_id)
            end
          when 1
            if $game_temp.weapons2[id][i_id] > 1
              $game_temp.weapons2[id][i_id] -= 1
            else
              $game_temp.weapons2[id].delete(i_id)
            end
          when 2
            if $game_temp.armors2[id][i_id] > 1
              $game_temp.armors2[id][i_id] -= 1
            else
              $game_temp.armors2[id].delete(i_id)
            end
          end
          $game_temp.trade_refresh = true
          return true
        when /<25d>(.*)<\/25d>/
          $game_temp.trade_accepting = true
          return true
        when /<25e>(.*)<\/25e>/ #Accept
          $game_temp.trade_accepting = false
          $game_temp.start_trade = false
          $game_temp.trade_now = true
          return true
        when /<25f>(.*)<\/25f>/ #Decline
          $game_temp.trade_accepting = false
          $game_temp.start_trade = false
          return true
        end
        return false
      end
      #--------------------------------------------------------------------------
      # * Authenficate <0>
      #--------------------------------------------------------------------------
      def self.authenficate(id,echo)
        if echo == "'e'"
          # If Echo was returned, Authenficated
          @auth = true
          @id = id
          return true
        end 
        return false
      end
      #--------------------------------------------------------------------------
      # * Checks the object range
      #--------------------------------------------------------------------------
      def self.in_range?(object)
        screne_x = $game_map.display_x
        screne_x -= 256
        screne_y = $game_map.display_y
        screne_y -= 256
        screne_width = $game_map.display_x
        screne_width += 2816
        screne_height = $game_map.display_y
        screne_height += 2176
        return false if object.real_x <= screne_x
        return false if object.real_x >= screne_width
        return false if object.real_y <= screne_y
        return false if object.real_y >= screne_height
        return true
      end
    end
    #-------------------------------------------------------------------------------
    # End Class
    #-------------------------------------------------------------------------------
    class Base
      #--------------------------------------------------------------------------
      # * Updates Default Classes
      #--------------------------------------------------------------------------
      def self.update
        # Update Input
        Input.update
        # Update Graphics
        Graphics.update
        # Update Mouse
        $mouse.update
        # Update Main (if Connected)
        Main.update if Main.socket != nil
      end
    end
    #-------------------------------------------------------------------------------
    # End Class
    #-------------------------------------------------------------------------------
    class Test
      attr_accessor :socket
      #--------------------------------------------------------------------------
      # * Returns Testing Status
      #--------------------------------------------------------------------------
      def self.testing
        return true if @testing
        return false
      end
      #--------------------------------------------------------------------------
      # * Tests Connection
      #--------------------------------------------------------------------------
      def self.test_connection(host, port)
        # We are Testing, not Complted the Test
        @testing = true
        @complete = false
        # Start Connection
        @socket = TCPSocket.new(host, port)
        if not @complete
          # If the Test Succeeded (did not encounter errors...)
          self.test_result(false)
          @socket.send("<20>'Test Completed'</20>")
          begin
            # Close Connection
            @socket.close rescue @socket = nil
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Set Test Result
      #--------------------------------------------------------------------------
      def self.test_result(value)
        # Set Result to value, and Complete Test
        @result = value
        @complete = true
      end
      #--------------------------------------------------------------------------
      # * Returns Test Completed Status
      #--------------------------------------------------------------------------
      def self.testcompleted
        return @complete
      end
      #--------------------------------------------------------------------------
      # * Resets Test
      #--------------------------------------------------------------------------
      def self.testreset
        # Reset all Values
        @complete = false
        @socket = nil
        @result = nil
        @testing = false
      end
      #--------------------------------------------------------------------------
      # * Returns Result
      #--------------------------------------------------------------------------
      def self.result
        return @result
      end
    end
    #-------------------------------------------------------------------------------
    # End Class
    #-------------------------------------------------------------------------------
      #--------------------------------------------------------------------------
      # * Module Update
      #--------------------------------------------------------------------------
      def self.update
      end
    end
    #-------------------------------------------------------------------------------
    # End Module
    #-------------------------------------------------------------------------------
    end
    #-------------------------------------------------------------------------------
    # End SDK Enabled Test
    #-------------------------------------------------------------------------------

    Agora as configuração acabaram, so lembrando que se vc fez o tutorial 1, não precisa fazer o tutorial 2.


    Última edição por gladistony em Sex maio 25, 2012 10:24 am, editado 1 vez(es)
    gladistony
    gladistony
    Membro Ativo
    Membro Ativo


    Mensagens : 336
    Créditos : 217

    Nome do personagem + classe no netplay master Empty Re: Nome do personagem + classe no netplay master

    Mensagem por gladistony Sex maio 25, 2012 10:13 am

    Tutorial 2
    1° Vamos configura para mostra o nome na sua tela
    >Va no script [EXT] Event Text Display
    >Procure por:
    Código:
    when 'Name'
    txt = $game_party.actors[0].name
    > Coloque depois do $game_party.actors[0].name isso:
    + " - #{$data_classes[$game_party.actors[0].class_id].name}"
    No final ficara assim:
    Código:
    when 'Name'
    txt = $game_party.actors[0].name + " -  #{$data_classes[$game_party.actors[0].class_id].name}"
    2° Agora vamos fazer para mostra o nome na janela dos outros jogadores
    >Va no script [NET] Network
    >Procure por # Sends Name
    [esta na linha 364]
    >Pouco abaixo esta assim send += "@nome = '#
    >Apague essa parte e deixe so
    # Sends Name
    # Sends Direction
    >Depois cole isso abaixo do # Sends Name
    Código:
        segundo = $game_party.actors[0].name + "  -  #{$data_classes[$game_party.actors[0].class_id].name}"
        send += "@nome = '#{segundo}';" if User_Edit::Bandwith >= 1

    Depois dessas duas mudanças esta pronto.

    No final ficara assim:
    Nome do personagem + classe no netplay master Resutadp

    Off: Moderadores, desculpa pelos 4 post seguidos, mais não deu para por tudo em um post so.
    Daniel Carvalho
    Daniel Carvalho
    Ocasional
    Ocasional


    Mensagens : 231
    Créditos : 19

    Ficha do personagem
    Nível: 1
    Experiência:
    Nome do personagem + classe no netplay master Left_bar_bleue0/50Nome do personagem + classe no netplay master Empty_bar_bleue  (0/50)
    Vida:
    Nome do personagem + classe no netplay master Left_bar_bleue30/30Nome do personagem + classe no netplay master Empty_bar_bleue  (30/30)

    Nome do personagem + classe no netplay master Empty Re: Nome do personagem + classe no netplay master

    Mensagem por Daniel Carvalho Sex maio 25, 2012 11:46 am

    Gostei Very Happy
    Vo tentar diminuir o tamanho da letra da classe, e colocar com uma cor
    diferente em baixo, pra ver como fica (:

    +1cred
    Valentine
    Valentine
    Administrador
    Administrador


    Medalhas : Nome do personagem + classe no netplay master ZgLkiRU
    Mensagens : 5336
    Créditos : 1163

    Nome do personagem + classe no netplay master Empty Re: Nome do personagem + classe no netplay master

    Mensagem por Valentine Sex maio 25, 2012 12:04 pm

    @gladistony
    Não precisa postar todo o network, você poderia ter mostrado apenas o que foi mudado.
    Canjoo
    Canjoo
    Experiente
    Experiente


    Mensagens : 505
    Créditos : 52

    Nome do personagem + classe no netplay master Empty Re: Nome do personagem + classe no netplay master

    Mensagem por Canjoo Sex maio 25, 2012 1:28 pm

    gostei
    +1 cred
    Monns
    Monns
    Semi-Experiente
    Semi-Experiente


    Mensagens : 113
    Créditos : 3

    Nome do personagem + classe no netplay master Empty Re: Nome do personagem + classe no netplay master

    Mensagem por Monns Sex maio 25, 2012 6:13 pm

    +1 Creeed , muuuuuito obrigaaaado !

    Conteúdo patrocinado


    Nome do personagem + classe no netplay master Empty Re: Nome do personagem + classe no netplay master

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Ter maio 07, 2024 11:54 pm