GS-Zone

labels de armadura, casco, escudo y arma Ir al Indice

Moderadores: Moderadores de Argentum, Especialistas de Argentum, Especialistas de Programación

6

Nota » 17 Ene 2012 21:20

Ea ¬¬ me lo pidio pkdor ^^

Comenzamos na mejor no tengo sueñito no duermo hace 2 dias :S
ta bien comenzamos


Bueno en el cliente buscamos
  1. Private Sub HandleChangeInventorySlot()


y Remplazamos hasta el end sub

Por esto

  1.  
  2. ''
  3. ' Handles the ChangeInventorySlot message.
  4.  
  5. Private Sub HandleChangeInventorySlot()
  6. '***************************************************
  7. 'Author: Juan Martín Sotuyo Dodero (Maraxus)
  8. 'Last Modification: 05/17/06
  9. '
  10. '***************************************************
  11.     If incomingData.length < 22 Then
  12.         Err.Raise incomingData.NotEnoughDataErrCode
  13.         Exit Sub
  14.     End If
  15.    
  16. On Error GoTo ErrHandler
  17.     'This packet contains strings, make a copy of the data to prevent losses if it's not complete yet...
  18.     Dim Buffer As New clsByteQueue
  19.     Call Buffer.CopyBuffer(incomingData)
  20.    
  21.     'Remove packet ID
  22.     Call Buffer.ReadByte
  23.    
  24.     Dim slot As Byte
  25.     Dim OBJIndex As Integer
  26.     Dim Name As String
  27.     Dim Amount As Integer
  28.     Dim Equipped As Boolean
  29.     Dim grhindex As Integer
  30.     Dim OBJType As Byte
  31.     Dim MaxHit As Integer
  32.     Dim MinHit As Integer
  33.     Dim defense As Integer
  34.     Dim MaxDef As Integer
  35.     Dim MinDef As Integer
  36.     Dim value As Single
  37.    
  38.     slot = Buffer.ReadByte()
  39.     OBJIndex = Buffer.ReadInteger()
  40.     Name = Buffer.ReadASCIIString()
  41.     Amount = Buffer.ReadInteger()
  42.     Equipped = Buffer.ReadBoolean()
  43.     grhindex = Buffer.ReadInteger()
  44.     OBJType = Buffer.ReadByte()
  45.     MaxHit = Buffer.ReadInteger()
  46.     MinHit = Buffer.ReadInteger()
  47.     defense = Buffer.ReadInteger()
  48.     MaxDef = Buffer.ReadInteger()
  49.     MinDef = Buffer.ReadInteger
  50.     value = Buffer.ReadSingle()
  51.    
  52.     If Equipped Then
  53.           Select Case OBJType
  54.             Case eObjType.otWeapon
  55.                 frmMain.lblWeapon = MinHit & "/" & MaxHit
  56.                 UserWeaponEqpSlot = slot
  57.             Case eObjType.otArmadura
  58.                 frmMain.lblArmor = MinDef & "/" & MaxDef
  59.                 UserArmourEqpSlot = slot
  60.             Case eObjType.otescudo
  61.                 frmMain.lblShielder = MinDef & "/" & MaxDef
  62.                 UserHelmEqpSlot = slot
  63.             Case eObjType.otcasco
  64.                 frmMain.lblHelm = MinDef & "/" & MaxDef
  65.                 UserShieldEqpSlot = slot
  66.         End Select
  67.     Else
  68.         Select Case slot
  69.             Case UserWeaponEqpSlot
  70.                 frmMain.lblWeapon = "0/0"
  71.                 UserWeaponEqpSlot = 0
  72.             Case UserArmourEqpSlot
  73.                 frmMain.lblArmor = "0/0"
  74.                 UserArmourEqpSlot = 0
  75.             Case UserHelmEqpSlot
  76.                 frmMain.lblShielder = "0/0"
  77.                 UserHelmEqpSlot = 0
  78.             Case UserShieldEqpSlot
  79.                 frmMain.lblHelm = "0/0"
  80.                 UserShieldEqpSlot = 0
  81.         End Select
  82.     End If
  83.        
  84.     Call Inventario.SetItem(slot, OBJIndex, Amount, Equipped, grhindex, OBJType, MaxHit, MinHit, defense, MaxDef, MinDef, value, Name)
  85.    
  86.     'If we got here then packet is complete, copy data back to original queue
  87.     Call incomingData.CopyBuffer(Buffer)
  88.    
  89. ErrHandler:
  90.     Dim error As Long
  91.     error = Err.number
  92. On Error GoTo 0
  93.    
  94.     'Destroy auxiliar buffer
  95.     Set Buffer = Nothing
  96.  
  97.     If error <> 0 Then Err.Raise error
  98. End Sub


Declaramos

  1. Public UserWeaponEqpSlot As Byte
  2. Public UserArmourEqpSlot As Byte
  3. Public UserHelmEqpSlot As Byte
  4. Public UserShieldEqpSlot As Byte


Buscamos



y remplazamos todo el type por

  1. 'Inventario
  2. Type Inventory
  3.     OBJIndex As Integer
  4.     Name As String
  5.     grhindex As Integer
  6.     '[Alejo]: tipo de datos ahora es Long
  7.     Amount As Long
  8.     '[/Alejo]
  9.     Equipped As Byte
  10.     Valor As Single
  11.     OBJType As Integer
  12.     Def As Integer
  13.     MaxHit As Integer
  14.     MinHit As Integer
  15.     MaxDef As Integer
  16.     MinDef As Integer 'Budi
  17. End Type


Buscamos
  1. Public Property Get OBJIndex(ByVal slot As Byte) As Integer


y arriba agregamos
  1. Public Property Get MaxDef(ByVal slot As Byte) As Integer
  2. '***************************************************
  3. 'Author: Juan Martín Sotuyo Dodero (Maraxus)
  4. 'Last Modify Date: 27/07/04
  5. 'Retrieves the defense of the selected item
  6. '***************************************************
  7.     MaxDef = UserInventory(slot).MaxDef
  8. End Property
  9.  
  10. Public Property Get MinDef(ByVal slot As Byte) As Integer
  11. '***************************************************
  12. 'Author: Budi
  13. 'Last Modify Date: 02/1209
  14. 'Retrieves the defense of the selected item
  15. '***************************************************
  16.     MinDef = UserInventory(slot).MinDef
  17. End Property


Ahora buscamos y remplazamos hasta el end sub


por

  1. Public Sub SetItem(ByVal slot As Byte, ByVal eOBJIndex As Integer, ByVal _
  2.     eAmount As Integer, ByVal eEquipped As Byte, ByVal eGrhIndex As Integer, ByVal _
  3.     eObjType As Integer, ByVal eMaxHit As Integer, ByVal eMinHit As Integer, ByVal _
  4.     eDef As Integer, ByVal MaxDef As Integer, ByVal MinDef As Integer, ByVal eValor As Single, ByVal eName As String)
  5. '***************************************************
  6. 'Author: Juan Martín Sotuyo Dodero (Maraxus)
  7. 'Last Modify Date: 12/04/06
  8. 'Sets all data for a given inventory slot
  9. '***************************************************
  10.     If slot < 1 Or slot > MAX_INVENTORY_SLOTS Then Exit Sub
  11.    
  12.     With UserInventory(slot)
  13.         .Amount = eAmount
  14.         .Def = eDef
  15.         .MaxDef = MaxDef
  16.         .MinDef = MinDef
  17.         .Equipped = eEquipped
  18.         .grhindex = eGrhIndex
  19.         .MaxHit = eMaxHit
  20.         .MinHit = eMinHit
  21.         .Name = eName
  22.         .OBJIndex = eOBJIndex
  23.         .OBJType = eObjType
  24.         .Valor = eValor
  25.     End With
  26.  
  27. End Sub


Ahora vamos al frmmain
y creamos

4 labels

con los nombres de


Y lesto el cliente

Ahora vamos al servidor

Buscamos y remplazamos el
  1. Public Sub WriteChangeInventorySlot(ByVal UserIndex As Integer, ByVal Slot As Byte)


por

  1. ''
  2. ' Writes the "ChangeInventorySlot" message to the given user's outgoing data buffer.
  3. '
  4. ' @param    UserIndex User to which the message is intended.
  5. ' @param    slot Inventory slot which needs to be updated.
  6. ' @remarks  The data is not actually sent until the buffer is properly flushed.
  7.  
  8. Public Sub WriteChangeInventorySlot(ByVal UserIndex As Integer, ByVal Slot As Byte)
  9. '***************************************************
  10. 'Author: Juan Martín Sotuyo Dodero (Maraxus)
  11. 'Last Modification: 3/12/09
  12. 'Writes the "ChangeInventorySlot" message to the given user's outgoing data buffer
  13. '3/12/09: Budi - Ahora se envia MaxDef y MinDef en lugar de Def
  14. '***************************************************
  15. On Error GoTo Errhandler
  16.     With UserList(UserIndex).outgoingData
  17.         Call .WriteByte(ServerPacketID.ChangeInventorySlot)
  18.         Call .WriteByte(Slot)
  19.        
  20.         Dim ObjIndex As Integer
  21.         Dim obData As ObjData
  22.        
  23.         ObjIndex = UserList(UserIndex).Invent.Object(Slot).ObjIndex
  24.        
  25.         If ObjIndex > 0 Then
  26.             obData = ObjData(ObjIndex)
  27.         End If
  28.        
  29.         Call .WriteInteger(ObjIndex)
  30.         Call .WriteASCIIString(obData.name)
  31.         Call .WriteInteger(UserList(UserIndex).Invent.Object(Slot).amount)
  32.         Call .WriteBoolean(UserList(UserIndex).Invent.Object(Slot).Equipped)
  33.         Call .WriteInteger(obData.GrhIndex)
  34.         Call .WriteByte(obData.OBJType)
  35.         Call .WriteInteger(obData.MaxHIT)
  36.         Call .WriteInteger(obData.MinHIT)
  37.         Call .WriteInteger(obData.def)
  38.         Call .WriteInteger(obData.MaxDef)
  39.         Call .WriteInteger(obData.MinDef)
  40.         Call .WriteSingle(SalePrice(ObjIndex))
  41.     End With
  42. Exit Sub
  43.  
  44. Errhandler:
  45.     If Err.Number = UserList(UserIndex).outgoingData.NotEnoughSpaceErrCode Then
  46.         Call FlushBuffer(UserIndex)
  47.         Resume
  48.     End If
  49. End Sub


Buenos eso es todo suerte y feliz año 2009 (?
Última edición por miqueas150 el 17 Ene 2012 23:50, editado 1 vez en total
Este mensaje ha obtenido 10 Monedas de Oro.


Imagen
Ninja en progreso
924
Dragon Ancestral [5]
Registrado: Años de membresía
Ubicación: • olivos •
Mensajes: 4103
Aportes: 13

Nota » 17 Ene 2012 23:20

Tengo un bug ya te lo dije esta es la linea


  1. Call Inventario.SetItem(slot, OBJIndex, Amount, Equipped, GrhIndex, OBJType, MaxHit, MinHit, defense, value, Name)
  2.    
  3.     'If we got here then packet is complete, copy data back to original queue
  4.     Call incomingData.CopyBuffer(Buffer)
  5.    
  6. ErrHandler:
  7.     Dim error As Long
  8.     error = Err.number
  9. On Error GoTo 0
  10.    
  11.     'Destroy auxiliar buffer
  12.     Set Buffer = Nothing
  13.  
  14.     If error <> 0 Then _
  15.         Err.Raise error
  16. End Sub

Imagen
Director de Reinos Olvidados
125
Newbie [4]
Registrado: Años de membresía
Ubicación: Villa adelina
Mensajes: 103

Nota » 18 Ene 2012 03:58

la verdad no entiendo por que no te actualiza el inventario ya que esto solo actualiza los caption de los labels

Imagen
Ninja en progreso
924
Dragon Ancestral [5]
Registrado: Años de membresía
Ubicación: • olivos •
Mensajes: 4103
Aportes: 13

Nota » 18 Ene 2012 13:14

muy bueno miqueas :P



Santty.- escribió:Si, soy hincha de tu padre, el que te gana cada vez que te cruza, el dueño del barrio, el orgullo nacional, rey de copas y el máximo ganador de copa libertadores

PROBLEM?





La gente que cuando camina mueve un poco los labios está practicando respuestas originales para discusiones que ya perdieron hace dos horas.
YPF etatizada: -Hola q carga? -Deme Néstor Súper
686
Dragon Ancestral [4]
Registrado: Años de membresíaAños de membresía
Ubicación: Mendoza
Mensajes: 3545
Aportes: 40

Nota » 18 Ene 2012 18:45

Muy lindo, buen aporte.

Saludos ^^

Imagen
Imagen
Staff Zeiked-Games
641
Dragon Ancestral [3]
Registrado: Años de membresíaAños de membresía
Ubicación: Castelar
Mensajes: 3416
Aportes: 66
Premios: 3
Usuario omnipresente (1) Embajador (2)

Nota » 03 Feb 2012 01:23

Es re quemado este código pero esta bueno :) buen aporte.
Luchas como un granjero!
206
Aprendiz [1]
Registrado: Diciembre 2011
Ubicación: Monkey Island
Mensajes: 223
Aportes: 2


Volver a AO 0.12.x

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 0 invitados