Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. Public Con As ADODB.Connection
  3. Public RS As ADODB.Recordset
  4.  
  5. Public Sub CargarDB()
  6. On Error GoTo Errhandler
  7.  
  8. Set Con = New ADODB.Connection
  9.  
  10. Con.ConnectionString = "DRIVER={MySQL ODBC 5.1 Driver};" & "SERVER=localhost;" & " DATABASE=;" & "UID=root;PWD=; OPTION=3"
  11. Con.CursorLocation = adUseClient
  12. Con.Open
  13. Exit Sub
  14.  
  15. Errhandler:
  16.    MsgBox "Error en CargarDB: " & Err.description & " String: " & Con.ConnectionString
  17.    End
  18. End Sub
  19.  
  20. Public Sub CerrarDB()
  21. On Error GoTo ErrHandle
  22.  
  23. Con.Close
  24. Set Con = Nothing
  25.  
  26. Exit Sub
  27.  
  28. ErrHandle:
  29.     MsgBox "Ha surgido un error al cerrar la base de datos MySQL"
  30.     End
  31.    
  32. End Sub
  33.  
  34. Public Sub SaveUserSQL(UserIndex As Integer)
  35. On Local Error GoTo ErrHandle
  36. Dim RS As ADODB.Recordset
  37. Dim mUser As User
  38. Dim i As Byte
  39. Dim str As String
  40.  
  41. If UserList(UserIndex).flags.Mimetizado = 1 Then
  42.     UserList(UserIndex).Char.body = UserList(UserIndex).CharMimetizado.body
  43.     UserList(UserIndex).Char.Head = UserList(UserIndex).CharMimetizado.Head
  44.     UserList(UserIndex).Char.CascoAnim = UserList(UserIndex).CharMimetizado.CascoAnim
  45.     UserList(UserIndex).Char.ShieldAnim = UserList(UserIndex).CharMimetizado.ShieldAnim
  46.     UserList(UserIndex).Char.WeaponAnim = UserList(UserIndex).CharMimetizado.WeaponAnim
  47.     UserList(UserIndex).Counters.Mimetismo = 0
  48.     UserList(UserIndex).flags.Mimetizado = 0
  49.     UserList(UserIndex).flags.Ignorado = False
  50. End If
  51.  
  52. Dim LoopC As Integer
  53.  
  54. mUser = UserList(UserIndex)
  55.  
  56. If Len(mUser.name) = 0 Then Exit Sub
  57.  
  58. Set RS = New ADODB.Recordset
  59.  
  60. Set RS = Con.Execute("SELECT * FROM `Flags` WHERE Nombre='" & UCase$(mUser.name) & "'")
  61. If RS.BOF Or RS.EOF Then
  62.     Con.Execute ("INSERT INTO `Flags` (NOMBRE) VALUES ('" & UCase$(mUser.name) & "')")
  63.     Set RS = Nothing
  64.     Set RS = Con.Execute("SELECT * FROM `Flags` WHERE Nombre='" & UCase$(mUser.name) & "'")
  65.     UserList(UserIndex).IndexPJ = RS!IndexPJ
  66. Else
  67.     Set RS = Con.Execute("SELECT * FROM `Flags` WHERE IndexPJ=" & mUser.IndexPJ)
  68.     UserList(UserIndex).IndexPJ = RS!IndexPJ
  69. End If
  70.  
  71. Set RS = Nothing
  72. Dim Pena As Integer
  73.  
  74. Set RS = Con.Execute("SELECT * FROM `Flags` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  75. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Flags` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  76. Set RS = Nothing
  77.  
  78. str = "UPDATE `Flags` SET"
  79.  
  80. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  81. str = str & ",Nombre='" & UCase$(mUser.name) & "'" 'j
  82. str = str & ",Muerto=" & mUser.flags.Muerto
  83. str = str & ",Escondido=" & mUser.flags.Escondido
  84. str = str & ",Ban=" & mUser.flags.Ban '
  85. str = str & ",Desnudo=" & mUser.flags.Desnudo
  86. str = str & ",Hambre=" & mUser.flags.Hambre
  87. str = str & ",Sed=" & mUser.flags.Sed
  88. str = str & ",Envenenado=" & mUser.flags.Envenenado '
  89. str = str & ",Navegando=" & mUser.flags.Navegando '
  90. str = str & ",Paralizado=" & mUser.flags.Paralizado
  91. str = str & ",LastMap=" & mUser.flags.lastMap
  92.  
  93. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  94.  
  95. Call Con.Execute(str)
  96.  
  97. Set RS = Con.Execute("SELECT * FROM `CONSEJO` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  98. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `CONSEJO` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  99. Set RS = Nothing
  100.  
  101. str = "UPDATE `CONSEJO` SET"
  102. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  103. str = str & ",PERTENECE=" & IIf(mUser.flags.Privilegios And PlayerType.RoyalCouncil, "1", "0")
  104. str = str & ",PERTENECECAOS=" & IIf(mUser.flags.Privilegios And PlayerType.ChaosCouncil, "1", "0")
  105.  
  106. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  107.  
  108. Call Con.Execute(str)
  109.  
  110. Set RS = Con.Execute("SELECT * FROM `Counters` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  111. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Counters` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  112. Set RS = Nothing
  113.  
  114. str = "UPDATE `Counters` SET"
  115. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  116. str = str & ",Pena=" & CStr(mUser.Counters.Pena)
  117. str = str & ",SkillsAsignados=" & CStr(mUser.Counters.AsignedSkills)
  118.  
  119. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  120.  
  121. Call Con.Execute(str)
  122.  
  123. Set RS = Con.Execute("SELECT * FROM `Faccion` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  124. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Faccion` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  125. Set RS = Nothing
  126.  
  127. str = "UPDATE `Faccion` SET"
  128.    
  129. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  130. str = str & ",EjercitoReal=" & mUser.Faccion.ArmadaReal
  131. str = str & ",EjercitoCaos=" & mUser.Faccion.FuerzasCaos
  132. str = str & ",CiudMatados=" & mUser.Faccion.CiudadanosMatados
  133. str = str & ",CrimMatados=" & mUser.Faccion.CriminalesMatados
  134. str = str & ",rArCaos=" & mUser.Faccion.RecibioArmaduraCaos
  135. str = str & ",rArReal=" & mUser.Faccion.RecibioArmaduraReal
  136. str = str & ",rExCaos=" & mUser.Faccion.RecibioExpInicialCaos
  137. str = str & ",rExReal=" & mUser.Faccion.RecibioExpInicialReal
  138. str = str & ",recCaos=" & mUser.Faccion.RecompensasCaos
  139. str = str & ",recReal=" & mUser.Faccion.RecompensasReal
  140. str = str & ",Reenlistadas=" & mUser.Faccion.Reenlistadas
  141. str = str & ",NivelIngreso=" & mUser.Faccion.NivelIngreso
  142. str = str & ",FechaIngreso='" & mUser.Faccion.FechaIngreso & "'"
  143. str = str & ",MatadosIngreso=" & mUser.Faccion.MatadosIngreso
  144. str = str & ",NextRecompensa=" & mUser.Faccion.NextRecompensa
  145.  
  146. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  147. Call Con.Execute(str)
  148.  
  149.  
  150. Set RS = Con.Execute("SELECT * FROM `Atributos` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  151. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Atributos` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  152. Set RS = Nothing
  153.  
  154. str = "UPDATE `Atributos` SET"
  155. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  156.  
  157. For i = 1 To UBound(mUser.Stats.UserAtributos)
  158.     str = str & ",AT" & i & "=" & mUser.Stats.UserAtributos(i)
  159. Next i
  160. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  161. Call Con.Execute(str)
  162.  
  163.  
  164. Set RS = Con.Execute("SELECT * FROM `Skills` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  165. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Skills` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  166. Set RS = Nothing
  167.  
  168. str = "UPDATE `Skills` SET"
  169. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  170.  
  171. For i = 1 To UBound(mUser.Stats.UserSkills)
  172.     str = str & ",SK" & i & "=" & mUser.Stats.UserSkills(i)
  173.     str = str & ",ELUSK" & i & "=" & mUser.Stats.EluSkills(i)
  174.     str = str & ",EXPSK" & i & "=" & mUser.Stats.ExpSkills(i)
  175. Next i
  176.  
  177. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  178. Call Con.Execute(str)
  179.  
  180.  
  181. Set RS = Con.Execute("SELECT * FROM `Clanes` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  182. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Clanes` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  183. Set RS = Nothing
  184.  
  185. str = "UPDATE `Clanes` SET"
  186.  
  187. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  188. str = str & ",GuildIndex=" & mUser.GuildIndex
  189. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  190. Call Con.Execute(str)
  191.  
  192.  
  193. Set RS = Con.Execute("SELECT * FROM `Contacto` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  194. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Contacto` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  195. Set RS = Nothing
  196.  
  197. str = "UPDATE `Contacto` SET"
  198. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  199. str = str & ",Email='" & UserList(UserIndex).email & "'"
  200. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  201. Call Con.Execute(str)
  202.  
  203.  
  204. Set RS = Con.Execute("SELECT * FROM `Init` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  205. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Init` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  206. Set RS = Nothing
  207.  
  208. str = "UPDATE `Init` SET"
  209. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  210.  
  211. str = str & ",Genero='" & mUser.Genero & "'"
  212. str = str & ",Password='" & mUser.Password & "'"
  213. str = str & ",Hogar='" & mUser.Hogar & "'"
  214. str = str & ",Clase='" & mUser.clase & "'"
  215. str = str & ",Raza='" & mUser.raza & "'"
  216. If mUser.desc <> "" Then
  217. str = str & ",Descripcion='" & mUser.desc & "'"
  218. End If
  219. str = str & ",Heading=" & mUser.Char.heading
  220. str = str & ",Head=" & mUser.Char.Head
  221. str = str & ",Body=" & mUser.Char.body
  222. str = str & ",Arma=" & mUser.Char.WeaponAnim
  223. str = str & ",Escudo=" & mUser.Char.ShieldAnim
  224. str = str & ",Casco=" & mUser.Char.CascoAnim
  225. str = str & ",LastIP='" & mUser.ip & "'"
  226. str = str & ",Position='" & mUser.Pos.Map & "-" & mUser.Pos.X & "-" & mUser.Pos.Y & "'"
  227. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  228. Call Con.Execute(str)
  229.  
  230. Set RS = Con.Execute("SELECT * FROM `Stats` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  231. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Stats` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  232. Set RS = Nothing
  233.  
  234. str = "UPDATE `Stats` SET"
  235. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  236. str = str & ",BANCO=" & mUser.Stats.Banco
  237. str = str & ",MaxHP=" & mUser.Stats.MaxHp
  238. str = str & ",MinHP=" & mUser.Stats.MinHp
  239. str = str & ",MaxMAN=" & mUser.Stats.MaxMAN
  240. str = str & ",MinMAN=" & mUser.Stats.MinMAN
  241. str = str & ",MaxSTA=" & mUser.Stats.MaxSta
  242. str = str & ",MinSTA=" & mUser.Stats.MinSta
  243. str = str & ",MaxHIT=" & mUser.Stats.MaxHIT
  244. str = str & ",MinHIT=" & mUser.Stats.MinHIT
  245. str = str & ",MinAGU=" & mUser.Stats.MinAGU
  246. str = str & ",MaxAGU=" & mUser.Stats.MaxAGU
  247. str = str & ",MaxHAM=" & mUser.Stats.MaxHam
  248. str = str & ",MinHAM=" & mUser.Stats.MinHam
  249. str = str & ",SkillPtsLibres=" & mUser.Stats.SkillPts
  250. str = str & ",EXP=" & mUser.Stats.Exp
  251. str = str & ",ELV=" & mUser.Stats.ELV
  252. str = str & ",ELU=" & mUser.Stats.ELU
  253. str = str & ",GLD=" & mUser.Stats.GLD
  254. str = str & ",NpcsMuertes=" & mUser.Stats.NPCsMuertos
  255. str = str & ",UserMuertes=" & mUser.Stats.UsuariosMatados
  256. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  257. Call Con.Execute(str)
  258.  
  259. Set RS = Con.Execute("SELECT * FROM `MASCOTAS` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  260. If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `MASCOTAS` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  261. Set RS = Nothing
  262.  
  263. str = "UPDATE `MASCOTAS` SET"
  264.  
  265. Dim NroMascotas As Long
  266. NroMascotas = mUser.NroMascotas
  267.  
  268. Dim cad As String
  269.  
  270. str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  271. For LoopC = 1 To MAXMASCOTAS
  272.     ' Mascota valida?
  273.    If UserList(UserIndex).MascotasIndex(LoopC) > 0 Then
  274.         ' Nos aseguramos que la criatura no fue invocada
  275.        If Npclist(UserList(UserIndex).MascotasIndex(LoopC)).Contadores.TiempoExistencia = 0 Then
  276.             cad = UserList(UserIndex).MascotasType(LoopC)
  277.         Else 'Si fue invocada no la guardamos
  278.            cad = "0"
  279.             NroMascotas = NroMascotas - 1
  280.         End If
  281.        str = str & ",MAS" & LoopC & "=" & cad
  282.     Else
  283.     cad = UserList(UserIndex).MascotasType(LoopC)
  284.     str = str & ",MAS" & LoopC & "=" & cad
  285.     End If
  286.  
  287. Next
  288. str = str & ",NroMascota=" & NroMascotas
  289.  
  290. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  291.  Call Con.Execute(str)
  292.  
  293.  
  294. Set RS = Con.Execute("SELECT * FROM `Banco` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  295.  If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Banco` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  296.  
  297.  str = "UPDATE `Banco` SET"
  298.  str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  299.  str = str & ",CantidadItems=" & mUser.BancoInvent.NroItems
  300.  
  301.  For i = 1 To MAX_BANCOINVENTORY_SLOTS
  302.      str = str & ",OBJ" & i & "=" & mUser.BancoInvent.Object(i).ObjIndex
  303.      str = str & ",CANT" & i & "=" & mUser.BancoInvent.Object(i).Amount
  304.  Next i
  305.  str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  306.  Call Con.Execute(str)
  307.  
  308.  
  309. Set RS = Con.Execute("SELECT * FROM `Hechizos` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  310.  If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `Hechizos` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  311.  Set RS = Nothing
  312.  
  313.  str = "UPDATE `Hechizos` SET"
  314.  str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  315.  For i = 1 To MAXUSERHECHIZOS
  316.      str = str & ",H" & i & "=" & mUser.Stats.UserHechizos(i)
  317.  Next i
  318.  str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  319.  Call Con.Execute(str)
  320.  
  321.  
  322. Set RS = Con.Execute("SELECT * FROM `inventario` WHERE IndexPJ=" & UserList(UserIndex).IndexPJ)
  323.  If RS.BOF Or RS.EOF Then Call Con.Execute("INSERT INTO `inventario` (IndexPJ) VALUES (" & UserList(UserIndex).IndexPJ & ")")
  324.  Set RS = Nothing
  325.  
  326.  str = "UPDATE `inventario` SET"
  327.  str = str & " IndexPJ=" & UserList(UserIndex).IndexPJ
  328.  str = str & ",CantidadItems=" & val(mUser.Invent.NroItems)
  329.  For i = 1 To MAX_INVENTORY_SLOTS
  330.     str = str & ",OBJ" & i & "=" & mUser.Invent.Object(i).ObjIndex
  331.     str = str & ",CANT" & i & "=" & mUser.Invent.Object(i).Amount
  332.     str = str & ",EQUIP" & i & "=" & mUser.Invent.Object(i).Equipped
  333.  Next i
  334.  
  335. str = str & ",CascoEqpSlot=" & mUser.Invent.CascoEqpSlot
  336. str = str & ",ArmourEqpSlot=" & mUser.Invent.ArmourEqpSlot
  337. str = str & ",EscudoEqpSlot=" & mUser.Invent.EscudoEqpSlot
  338. str = str & ",WeaponEqpSlot=" & mUser.Invent.WeaponEqpSlot
  339. str = str & ",MunicionSlot=" & mUser.Invent.MunicionEqpSlot
  340. str = str & ",BarcoSlot=" & mUser.Invent.BarcoSlot
  341. str = str & ",MochilaSlot=" & mUser.Invent.MochilaEqpSlot
  342.  
  343. str = str & " WHERE IndexPJ=" & UserList(UserIndex).IndexPJ
  344.  
  345.  Call Con.Execute(str)
  346.  
  347. Exit Sub
  348.  
  349. ErrHandle:
  350.     Call MsgBox("Error en el SAVEDB: " & Err.description & " String: " & str)
  351.     'End
  352. End Sub
  353.  
  354. Public Function LoadUserSQL(UserIndex As Integer, ByVal name As String) As Boolean
  355. On Error GoTo Errhandler
  356. Dim i As Integer
  357.  
  358. With UserList(UserIndex)
  359.  
  360.     Set RS = Con.Execute("SELECT * FROM `Flags` WHERE Nombre='" & UCase$(name) & "'")
  361.     If RS.BOF Or RS.EOF Then
  362.         LoadUserSQL = False
  363.         Exit Function
  364.     End If
  365.  
  366.     .IndexPJ = RS!IndexPJ
  367.     Set RS = Nothing
  368.    
  369.     Set RS = Con.Execute("SELECT * FROM `Flags` WHERE IndexPJ=" & .IndexPJ)
  370.     If RS.BOF Or RS.EOF Then
  371.         LoadUserSQL = False
  372.         Exit Function
  373.     End If
  374.     .name = RS!Nombre
  375.     .flags.Muerto = RS!Muerto
  376.     .flags.Escondido = RS!Escondido
  377.     .flags.Ban = RS!Ban
  378.     .flags.Desnudo = RS!Desnudo
  379.     .flags.Envenenado = RS!Envenenado
  380.     .flags.Navegando = RS!Navegando
  381.     .flags.Paralizado = RS!Paralizado
  382.     If UserList(UserIndex).flags.Paralizado = 1 Then
  383.         UserList(UserIndex).Counters.Paralisis = IntervaloParalizado
  384.     End If
  385.     .flags.lastMap = RS!lastMap
  386.  
  387.     Set RS = Nothing
  388.    
  389.     Set RS = Con.Execute("SELECT * FROM `Counters` WHERE IndexPJ=" & .IndexPJ)
  390.    
  391.     If RS.BOF Or RS.EOF Then
  392.         LoadUserSQL = False
  393.         Exit Function
  394.     End If
  395.    
  396.     .Counters.Pena = RS!Pena
  397.     .Counters.AsignedSkills = RS!SkillsAsignados
  398.    
  399.     Set RS = Nothing
  400.    
  401.    
  402.     Set RS = Con.Execute("SELECT * FROM `Faccion` WHERE IndexPJ=" & .IndexPJ)
  403.    
  404.     If RS.BOF Or RS.EOF Then
  405.         LoadUserSQL = False
  406.         Exit Function
  407.     End If
  408.     .Faccion.ArmadaReal = RS!EjercitoReal
  409.     .Faccion.FuerzasCaos = RS!EjercitoCaos
  410.     .Faccion.CiudadanosMatados = RS!CiudMatados
  411.     .Faccion.CriminalesMatados = RS!CrimMatados
  412.     .Faccion.RecibioArmaduraCaos = RS!rArCaos
  413.     .Faccion.RecibioArmaduraReal = RS!rArReal
  414.     .Faccion.RecibioExpInicialCaos = RS!rExCaos
  415.     .Faccion.RecibioExpInicialReal = RS!rExReal
  416.     .Faccion.RecompensasCaos = RS!recCaos
  417.     .Faccion.RecompensasReal = RS!recReal
  418.     .Faccion.Reenlistadas = RS!Reenlistadas
  419.     .Faccion.NivelIngreso = RS!NivelIngreso
  420.     .Faccion.FechaIngreso = RS!FechaIngreso
  421.     .Faccion.MatadosIngreso = RS!MatadosIngreso
  422.     .Faccion.NextRecompensa = RS!NextRecompensa
  423.     Set RS = Nothing
  424.  
  425.     Set RS = Con.Execute("SELECT * FROM `CONTACTO` WHERE IndexPJ=" & .IndexPJ)
  426.     If RS.BOF Or RS.EOF Then
  427.         LoadUserSQL = False
  428.         Exit Function
  429.     End If
  430.    
  431.     .email = RS!email
  432.     Set RS = Nothing
  433.    
  434.     Set RS = Con.Execute("SELECT * FROM `Atributos` WHERE IndexPJ=" & .IndexPJ)
  435.     If RS.BOF Or RS.EOF Then
  436.         LoadUserSQL = False
  437.         Exit Function
  438.     End If
  439.    
  440.     For i = 1 To NUMATRIBUTOS
  441.         .Stats.UserAtributos(i) = RS.Fields("AT" & i)
  442.         .Stats.UserAtributosBackUP(i) = .Stats.UserAtributos(i)
  443.     Next i
  444.    
  445.     Set RS = Nothing
  446.    
  447.    
  448.     Set RS = Con.Execute("SELECT * FROM `Skills` WHERE IndexPJ=" & .IndexPJ)
  449.     If RS.BOF Or RS.EOF Then
  450.         LoadUserSQL = False
  451.         Exit Function
  452.     End If
  453.     For i = 1 To NUMSKILLS
  454.         .Stats.UserSkills(i) = RS.Fields("SK" & i)
  455.         .Stats.EluSkills(i) = RS.Fields("ELUSK" & i)
  456.         .Stats.ExpSkills(i) = RS.Fields("EXPSK" & i)
  457.     Next i
  458.     Set RS = Nothing
  459.    
  460.    
  461.     Set RS = Con.Execute("SELECT * FROM `Banco` WHERE IndexPJ=" & .IndexPJ)
  462.     If RS.BOF Or RS.EOF Then
  463.         LoadUserSQL = False
  464.         Exit Function
  465.     End If
  466.    
  467.     .BancoInvent.NroItems = RS!CantidadItems
  468.     For i = 1 To MAX_BANCOINVENTORY_SLOTS
  469.         .BancoInvent.Object(i).ObjIndex = RS.Fields("OBJ" & i)
  470.         .BancoInvent.Object(i).Amount = RS.Fields("CANT" & i)
  471.     Next i
  472.     Set RS = Nothing
  473.    
  474.    
  475.     Set RS = Con.Execute("SELECT * FROM `inventario` WHERE IndexPJ=" & .IndexPJ)
  476.     If RS.BOF Or RS.EOF Then
  477.         LoadUserSQL = False
  478.         Exit Function
  479.     End If
  480.     .Invent.NroItems = RS!CantidadItems
  481.     For i = 1 To MAX_INVENTORY_SLOTS
  482.         .Invent.Object(i).ObjIndex = RS.Fields("OBJ" & i)
  483.         .Invent.Object(i).Amount = RS.Fields("CANT" & i)
  484.         .Invent.Object(i).Equipped = RS.Fields("EQUIP" & i)
  485.     Next i
  486.     .Invent.CascoEqpSlot = RS!CascoEqpSlot
  487.    
  488.     If .Invent.CascoEqpSlot > 0 Then
  489.        .Invent.CascoEqpObjIndex = .Invent.Object(.Invent.CascoEqpSlot).ObjIndex
  490.     End If
  491.  
  492.     .Invent.ArmourEqpSlot = RS!ArmourEqpSlot
  493.    
  494.     If .Invent.ArmourEqpSlot > 0 Then
  495.         .Invent.ArmourEqpObjIndex = .Invent.Object(.Invent.ArmourEqpSlot).ObjIndex
  496.         .flags.Desnudo = 0
  497.     Else
  498.         .flags.Desnudo = 1
  499.     End If
  500.  
  501.     .Invent.EscudoEqpSlot = RS!EscudoEqpSlot
  502.    
  503.     If .Invent.EscudoEqpSlot > 0 Then
  504.         .Invent.EscudoEqpObjIndex = .Invent.Object(.Invent.EscudoEqpSlot).ObjIndex
  505.     End If
  506.  
  507.     .Invent.WeaponEqpSlot = RS!WeaponEqpSlot
  508.    
  509.     If .Invent.WeaponEqpSlot > 0 Then
  510.         .Invent.WeaponEqpObjIndex = .Invent.Object(.Invent.WeaponEqpSlot).ObjIndex
  511.     End If
  512.  
  513.     .Invent.MunicionEqpSlot = RS!MunicionSlot
  514.    
  515.     If .Invent.MunicionEqpSlot > 0 Then
  516.         .Invent.MunicionEqpObjIndex = .Invent.Object(.Invent.MunicionEqpSlot).ObjIndex
  517.     End If
  518.  
  519.     .Invent.BarcoSlot = RS!BarcoSlot
  520.        
  521.     If .Invent.BarcoSlot > 0 Then
  522.         .Invent.BarcoObjIndex = .Invent.Object(.Invent.BarcoSlot).ObjIndex
  523.     End If
  524.    
  525.     .Invent.MochilaEqpSlot = RS!mochilaSlot
  526.    
  527.     If .Invent.MochilaEqpSlot > 0 Then
  528.         .Invent.MochilaEqpObjIndex = .Invent.Object(.Invent.MochilaEqpSlot).ObjIndex
  529.     End If
  530.    
  531.     Set RS = Nothing
  532.    
  533.     Set RS = Con.Execute("SELECT * FROM `Clanes` WHERE IndexPJ=" & .IndexPJ)
  534.    
  535.     If RS.BOF Or RS.EOF Then
  536.         LoadUserSQL = False
  537.         Exit Function
  538.     End If
  539.    
  540.     Dim ln As String
  541.  
  542.     ln = RS!GuildIndex
  543.     If IsNumeric(ln) Then
  544.         .GuildIndex = CInt(ln)
  545.     Else
  546.         .GuildIndex = 0
  547.     End If
  548.    
  549.     Set RS = Nothing
  550.  
  551.    
  552.     Set RS = Con.Execute("SELECT * FROM `Hechizos` WHERE IndexPJ=" & .IndexPJ)
  553.     If RS.BOF Or RS.EOF Then
  554.         LoadUserSQL = False
  555.         Exit Function
  556.     End If
  557.     For i = 1 To MAXUSERHECHIZOS
  558.         .Stats.UserHechizos(i) = RS.Fields("H" & i)
  559.     Next i
  560.     Set RS = Nothing
  561.    
  562.     Set RS = Con.Execute("SELECT * FROM `Stats` WHERE IndexPJ=" & .IndexPJ)
  563.     If RS.BOF Or RS.EOF Then
  564.         LoadUserSQL = False
  565.         Exit Function
  566.     End If
  567.  
  568.     .Stats.Banco = RS!Banco
  569.     .Stats.MaxHp = RS!MaxHp
  570.     .Stats.MinHp = RS!MinHp
  571.     .Stats.MinSta = RS!MinSta
  572.     .Stats.MaxSta = RS!MaxSta
  573.     .Stats.MaxMAN = RS!MaxMAN
  574.     .Stats.MinMAN = RS!MinMAN
  575.     .Stats.MaxHIT = RS!MaxHIT
  576.     .Stats.MinHIT = RS!MinHIT
  577.     .Stats.SkillPts = RS!SkillPtsLibres
  578.     .Stats.Exp = RS!Exp
  579.     .Stats.ELU = RS!ELU
  580.     .Stats.ELV = RS!ELV
  581.     .Stats.UsuariosMatados = RS!UserMuertes
  582.     .Stats.NPCsMuertos = RS!NpcsMuertes
  583.     Set RS = Nothing
  584.  
  585.     Set RS = Con.Execute("SELECT * FROM `CONSEJO` WHERE IndexPJ=" & .IndexPJ)
  586.     If RS.BOF Or RS.EOF Then
  587.         LoadUserSQL = False
  588.         Exit Function
  589.     End If
  590.     If RS!pertenece Then _
  591.    .flags.Privilegios = .flags.Privilegios Or PlayerType.RoyalCouncil
  592.    
  593.     If RS!PERTENECECAOS Then _
  594.      .flags.Privilegios = .flags.Privilegios Or PlayerType.ChaosCouncil
  595.      
  596.     Set RS = Nothing
  597.    
  598.    
  599.     Set RS = Con.Execute("SELECT * FROM `Init` WHERE IndexPJ=" & .IndexPJ)
  600.     If RS.BOF Or RS.EOF Then
  601.         LoadUserSQL = False
  602.         Exit Function
  603.     End If
  604.  
  605.     .Password = RS!Password
  606.     .Genero = RS!Genero
  607.     .clase = RS!clase
  608.     .raza = RS!raza
  609.     .Hogar = RS!Hogar
  610.     .Char.heading = RS!heading
  611.     If .desc <> "" Then
  612.     .desc = RS!Descripcion
  613.     End If
  614.     .OrigChar.Head = RS!Head
  615.     .OrigChar.body = RS!body
  616.     .OrigChar.WeaponAnim = RS!Arma
  617.     .OrigChar.ShieldAnim = RS!Escudo
  618.     .OrigChar.CascoAnim = RS!casco
  619.     .OrigChar.heading = eHeading.SOUTH
  620.  
  621.     If .flags.Muerto = 0 Then
  622.         .Char = .OrigChar
  623.     Else
  624.             .Char.body = iCuerpoMuerto
  625.             .Char.Head = iCabezaMuerto
  626.             .Char.WeaponAnim = NingunArma
  627.             .Char.ShieldAnim = NingunEscudo
  628.             .Char.CascoAnim = NingunCasco
  629.     End If
  630.  
  631.  
  632.     .Pos.Map = ReadField(1, RS!Position, 45)
  633.     .Pos.X = ReadField(2, RS!Position, 45)
  634.     .Pos.Y = ReadField(3, RS!Position, 45)
  635.    
  636.     Set RS = Nothing
  637.  
  638.     LoadUserSQL = True
  639. End With
  640.  
  641. Exit Function
  642.  
  643. Errhandler:
  644.         Call MsgBox("Error en el loadDB: " & Err.description)
  645.     Set RS = Nothing
  646.    
  647. End Function
  648.  
  649. Public Function ComprobarPassword(ByVal name As String, Password As String) As Boolean
  650. Dim Pass As String
  651. Dim index As String
  652.  
  653. Set RS = Con.Execute("SELECT * FROM `Flags` WHERE Nombre='" & UCase$(name) & "'")
  654. If RS.BOF Or RS.EOF Then Exit Function
  655.  
  656. index = RS!IndexPJ
  657. Set RS = Nothing
  658.  
  659. Set RS = Con.Execute("SELECT * FROM `Init` WHERE IndexPj=" & index)
  660. If RS.BOF Or RS.EOF Then Exit Function
  661. Pass = RS!Password
  662. If Len(Pass) = 0 Then Exit Function
  663. Set RS = Nothing
  664. If Password = Pass Then ComprobarPassword = True
  665.  
  666. End Function
  667.  
  668. Public Function BANCheck(ByVal name As String) As Boolean
  669. Dim Baneado As Byte
  670.  
  671. Set RS = Con.Execute("SELECT * FROM `Flags` WHERE Nombre='" & UCase$(name) & "'")
  672.  
  673. If RS.BOF Or RS.EOF Then Exit Function
  674.  
  675. Baneado = RS!Ban
  676. BANCheck = (Baneado = 1)
  677.  
  678. Set RS = Nothing
  679.  
  680. End Function
  681.  
  682. Public Function IndexPJ(ByVal name As String) As Integer
  683.  
  684. Set RS = Con.Execute("SELECT * FROM `Flags` WHERE Nombre='" & UCase$(name) & "'")
  685.  
  686. If RS.BOF Or RS.EOF Then Exit Function
  687.  
  688. IndexPJ = RS!IndexPJ
  689.  
  690. Set RS = Nothing
  691.  
  692. End Function
  693.  
  694. Function ExistePersonaje(name As String) As Boolean
  695.  
  696. Set RS = Con.Execute("SELECT * FROM `Flags` WHERE Nombre='" & UCase$(name) & "'")
  697.  
  698. If RS.BOF Or RS.EOF Then Exit Function
  699.  
  700. Set RS = Nothing
  701.  
  702. ExistePersonaje = True
  703.  
  704. End Function
  705.  
  706. Y ahora nos descargamos el .sql para poderlo subir a nuestro host
  707. http://www.mediafire.com/?4ac300ddk7s8mjy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement