diff --git a/Codigo/CharacterPersistence.bas b/Codigo/CharacterPersistence.bas index 2fe5a97b..4d2a3808 100644 --- a/Codigo/CharacterPersistence.bas +++ b/Codigo/CharacterPersistence.bas @@ -49,10 +49,14 @@ Private Function db_load_house_key(ByRef user As t_User) As Boolean End Function Public Function GetCharacterName(ByVal UserId As Long) As String - Dim RS As ADODB.Recordset - Set RS = Query("select name from user where id=?", UserId) - If RS Is Nothing Then Exit Function - GetCharacterName = RS!name + On Error GoTo GetCharacterName_Err + Dim RS As ADODB.Recordset +100 Set RS = Query("select name from user where id=?", UserId) +102 If RS Is Nothing Then Exit Function +104 GetCharacterName = RS!name + Exit Function +GetCharacterName_Err: + Call LogDatabaseError("Error en GetCharacterName: " & UserId & ". " & Err.Number & " - " & Err.Description & ". LĂ­nea: " & Erl) End Function Public Function LoadCharacterBank(ByVal UserIndex As Integer) As Boolean diff --git a/Codigo/Declares.bas b/Codigo/Declares.bas index 04ce1ae9..f12286f6 100644 --- a/Codigo/Declares.bas +++ b/Codigo/Declares.bas @@ -526,6 +526,7 @@ Public Const Raices As Integer = 888 'OK Public Const PieldeLobo As Integer = 414 'OK Public Const PieldeOsoPardo As Integer = 415 'OK Public Const PieldeOsoPolar As Integer = 416 'OK +Public Const PielLoboNegro As Integer = 1146 Public Const MaxNPCs As Integer = 10000 Public Const MAXCHARS As Integer = 10000 Public Const DAGA As Integer = 15 'OK @@ -1631,6 +1632,7 @@ Public Type t_ObjData PielLobo As Integer PielOsoPardo As Integer PielOsoPolaR As Integer + PielLoboNegro As Integer SkMAGOria As Byte Radio As Byte diff --git a/Codigo/FileIO.bas b/Codigo/FileIO.bas index d7f77010..55f56eca 100644 --- a/Codigo/FileIO.bas +++ b/Codigo/FileIO.bas @@ -1530,6 +1530,7 @@ Sub LoadOBJData() 470 .PielLobo = val(Leer.GetValue(ObjKey, "PielLobo")) 472 .PielOsoPardo = val(Leer.GetValue(ObjKey, "PielOsoPardo")) 474 .PielOsoPolaR = val(Leer.GetValue(ObjKey, "PielOsoPolaR")) +475 .PielLoboNegro = val(Leer.GetValue(ObjKey, "PielLoboNegro")) 476 .SkMAGOria = val(Leer.GetValue(ObjKey, "SKSastreria")) 478 .LingH = val(Leer.GetValue(ObjKey, "LingH")) diff --git a/Codigo/InvUsuario.bas b/Codigo/InvUsuario.bas index 63f3accb..729fb3b7 100644 --- a/Codigo/InvUsuario.bas +++ b/Codigo/InvUsuario.bas @@ -332,7 +332,8 @@ Sub TirarOro(ByVal Cantidad As Long, ByVal UserIndex As Integer) '23/01/2007 -> Pablo (ToxicWaste): Billetera invertida y explotar oro en el agua. '*************************************************** On Error GoTo ErrHandler - + Dim OriginalAmount As Long + OriginalAmount = Cantidad 100 With UserList(UserIndex) ' GM's (excepto Dioses y Admins) no pueden tirar oro @@ -387,17 +388,13 @@ Sub TirarOro(ByVal Cantidad As Long, ByVal UserIndex As Integer) Loop - ' Si es GM, registramos lo q hizo incluso si es Horacio + ' Si es GM, registramos lo q hizo 146 If EsGM(UserIndex) Then - 148 If MiObj.ObjIndex = iORO Then -150 Call LogGM(.Name, "Tiro: " & PonerPuntos(Cantidad) & " monedas de oro.") - +150 Call LogGM(.name, "Tiro: " & PonerPuntos(OriginalAmount) & " monedas de oro.") Else -152 Call LogGM(.Name, "Tiro cantidad:" & PonerPuntos(Cantidad) & " Objeto:" & ObjData(MiObj.ObjIndex).Name) - +152 Call LogGM(.name, "Tiro cantidad:" & PonerPuntos(OriginalAmount) & " Objeto:" & ObjData(MiObj.ObjIndex).name) End If - End If 160 Call WriteUpdateGold(UserIndex) diff --git a/Codigo/Modulo_UsUaRiOs.bas b/Codigo/Modulo_UsUaRiOs.bas index 4ef7967e..37f1a5f6 100644 --- a/Codigo/Modulo_UsUaRiOs.bas +++ b/Codigo/Modulo_UsUaRiOs.bas @@ -30,19 +30,22 @@ Option Explicit Private UserNameCache As New Dictionary Public Function GetUserName(ByVal UserId As Long) As String - If UserId <= 0 Then - GetUserName = "" - Exit Function - End If - If UserNameCache.Exists(UserId) Then - GetUserName = UserNameCache.Item(UserId) + On Error GoTo GetUserName_Err +100 If UserId <= 0 Then +102 GetUserName = "" + Exit Function + End If +104 If UserNameCache.Exists(UserId) Then +106 GetUserName = UserNameCache.Item(UserId) + Exit Function + End If + Dim username As String +108 username = GetCharacterName(UserId) +110 Call RegisterUserName(UserId, username) +112 GetUserName = username Exit Function - End If - Dim UserName As String - UserName = GetCharacterName(UserId) - Call RegisterUserName(UserId, UserName) - GetUserName = UserName - Exit Function +GetUserName_Err: +114 Call TraceError(Err.Number, Err.Description, "UserMod.GetUserName", Erl) End Function Public Sub RegisterUserName(ByVal UserId As Long, ByVal UserName As String) diff --git a/Codigo/Scenearios/NavalBoarding.cls b/Codigo/Scenearios/NavalBoarding.cls index f757a8a4..4dffd436 100644 --- a/Codigo/Scenearios/NavalBoarding.cls +++ b/Codigo/Scenearios/NavalBoarding.cls @@ -109,39 +109,39 @@ Dim UserLoot As New Dictionary Dim TeamCargo(1 To 2) As t_Cargo Private Sub Class_Initialize() -On Error GoTo NavalBoarding_Initialize_Err: - Debug.Assert FileExist(DatPath & configPath) - Dim ScenarioIni As clsIniManager - Dim WpCount As Byte - Set ScenarioIni = New clsIniManager - Call ScenarioIni.Initialize(DatPath & configPath) - MapNumbers(0) = val(ScenarioIni.GetValue("INIT", "MapNumber1")) - MapNumbers(1) = val(ScenarioIni.GetValue("INIT", "MapNumber2")) - MaxTime = val(ScenarioIni.GetValue("INIT", "MaxTime")) - Team1SpawnX = val(ScenarioIni.GetValue("INIT", "Team1SpawnX")) - Team2SpawnX = val(ScenarioIni.GetValue("INIT", "Team2SpawnX")) - RespawnWp = val(ScenarioIni.GetValue("RESPAWN", "Waypoint")) - PlayerMinRespawnTime = val(ScenarioIni.GetValue("RESPAWN", "PlayerMinRespawnTime")) - RespawnInterval = val(ScenarioIni.GetValue("RESPAWN", "RespawnInterval")) - MaxTime = MaxTime * 1000 - RespawnInterval = RespawnInterval * 1000 - PlayerMinRespawnTime = PlayerMinRespawnTime * 1000 - WpCount = val(ScenarioIni.GetValue("INIT", "WaypointCount")) - CaptianNpcId = val(ScenarioIni.GetValue("CaptainNpc", "NpcId")) - Call LoadTeamWeapoints(1, Team1Waypoints, WpCount, ScenarioIni) - Call LoadTeamWeapoints(2, Team2Waypoints, WpCount, ScenarioIni) - Call LoadForbidenItems(ScenarioIni) - Call LoadTileBlock(TileBlocks, ScenarioIni) - UpdateIndex = AddUpdateScenario(Me) - Call CustomScenarios.SetCustomScenario(MapNumbers(0), Me) - Call CustomScenarios.SetCustomScenario(MapNumbers(1), Me) - Call ConfigMapLobby - Call LoadNpcSpawnInfo(NpcSpawnList, ScenarioIni) - Call LoadTeamCargo(TeamCargo(1), 1, ScenarioIni) - Call LoadTeamCargo(TeamCargo(2), 2, ScenarioIni) - Exit Sub + On Error GoTo NavalBoarding_Initialize_Err: +100 Debug.Assert FileExist(DatPath & configPath) + Dim ScenarioIni As clsIniManager + Dim WpCount As Byte +102 Set ScenarioIni = New clsIniManager +104 Call ScenarioIni.Initialize(DatPath & configPath) +106 MapNumbers(0) = val(ScenarioIni.GetValue("INIT", "MapNumber1")) +108 MapNumbers(1) = val(ScenarioIni.GetValue("INIT", "MapNumber2")) +110 MaxTime = val(ScenarioIni.GetValue("INIT", "MaxTime")) +112 Team1SpawnX = val(ScenarioIni.GetValue("INIT", "Team1SpawnX")) +114 Team2SpawnX = val(ScenarioIni.GetValue("INIT", "Team2SpawnX")) +116 RespawnWp = val(ScenarioIni.GetValue("RESPAWN", "Waypoint")) +118 PlayerMinRespawnTime = val(ScenarioIni.GetValue("RESPAWN", "PlayerMinRespawnTime")) +120 RespawnInterval = val(ScenarioIni.GetValue("RESPAWN", "RespawnInterval")) +122 MaxTime = MaxTime * 1000 +124 RespawnInterval = RespawnInterval * 1000 +126 PlayerMinRespawnTime = PlayerMinRespawnTime * 1000 +128 WpCount = val(ScenarioIni.GetValue("INIT", "WaypointCount")) +130 CaptianNpcId = val(ScenarioIni.GetValue("CaptainNpc", "NpcId")) +132 Call LoadTeamWeapoints(1, Team1Waypoints, WpCount, ScenarioIni) +134 Call LoadTeamWeapoints(2, Team2Waypoints, WpCount, ScenarioIni) +136 Call LoadForbidenItems(ScenarioIni) +138 Call LoadTileBlock(TileBlocks, ScenarioIni) +140 UpdateIndex = AddUpdateScenario(Me) +142 Call CustomScenarios.SetCustomScenario(MapNumbers(0), Me) +144 Call CustomScenarios.SetCustomScenario(MapNumbers(1), Me) +146 Call ConfigMapLobby +148 Call LoadNpcSpawnInfo(NpcSpawnList, ScenarioIni) +150 Call LoadTeamCargo(TeamCargo(1), 1, ScenarioIni) +152 Call LoadTeamCargo(TeamCargo(2), 2, ScenarioIni) + Exit Sub NavalBoarding_Initialize_Err: - Call TraceError(Err.Number, Err.Description, "DeathMatch.Initialize ", Erl) + Call TraceError(Err.Number, Err.Description, "DeathMatch.Initialize ", Erl) End Sub Private Sub LoadTileBlock(ByRef Tiles() As t_TilePos, ScenearioIni As clsIniManager) diff --git a/Codigo/Trabajo.bas b/Codigo/Trabajo.bas index b1a9f1b3..16c43d75 100644 --- a/Codigo/Trabajo.bas +++ b/Codigo/Trabajo.bas @@ -815,14 +815,13 @@ Sub SastreQuitarMateriales(ByVal UserIndex As Integer, ByVal ItemIndex As Intege 100 If ObjData(ItemIndex).PielLobo > 0 Then Call QuitarObjetos(PieldeLobo, ObjData(ItemIndex).PielLobo, UserIndex) 102 If ObjData(ItemIndex).PielOsoPardo > 0 Then Call QuitarObjetos(PieldeOsoPardo, ObjData(ItemIndex).PielOsoPardo, UserIndex) 104 If ObjData(ItemIndex).PielOsoPolaR > 0 Then Call QuitarObjetos(PieldeOsoPolar, ObjData(ItemIndex).PielOsoPolaR, UserIndex) +106 If ObjData(ItemIndex).PielLoboNegro > 0 Then Call QuitarObjetos(PielLoboNegro, ObjData(ItemIndex).PielLoboNegro, UserIndex) Exit Sub SastreQuitarMateriales_Err: -106 Call TraceError(Err.Number, Err.Description, "Trabajo.SastreQuitarMateriales", Erl) -108 - + Call TraceError(Err.Number, Err.Description, "Trabajo.SastreQuitarMateriales", Erl) End Sub Function CarpinteroTieneMateriales(ByVal UserIndex As Integer, ByVal ItemIndex As Integer, ByVal cantidad As Long) As Boolean @@ -899,7 +898,6 @@ End Function Function SastreTieneMateriales(ByVal UserIndex As Integer, ByVal ItemIndex As Integer) As Boolean On Error GoTo SastreTieneMateriales_Err - 100 If ObjData(ItemIndex).PielLobo > 0 Then 102 If Not TieneObjetos(PieldeLobo, ObjData(ItemIndex).PielLobo, UserIndex) Then @@ -907,9 +905,7 @@ Function SastreTieneMateriales(ByVal UserIndex As Integer, ByVal ItemIndex As In 106 SastreTieneMateriales = False 108 Call WriteMacroTrabajoToggle(UserIndex, False) Exit Function - End If - End If 110 If ObjData(ItemIndex).PielOsoPardo > 0 Then @@ -918,9 +914,7 @@ Function SastreTieneMateriales(ByVal UserIndex As Integer, ByVal ItemIndex As In 116 SastreTieneMateriales = False 118 Call WriteMacroTrabajoToggle(UserIndex, False) Exit Function - End If - End If 120 If ObjData(ItemIndex).PielOsoPolaR > 0 Then @@ -929,20 +923,24 @@ Function SastreTieneMateriales(ByVal UserIndex As Integer, ByVal ItemIndex As In 126 SastreTieneMateriales = False 128 Call WriteMacroTrabajoToggle(UserIndex, False) Exit Function - End If - End If - -130 SastreTieneMateriales = True + +130 If ObjData(ItemIndex).PielLoboNegro > 0 Then +132 If Not TieneObjetos(PielLoboNegro, ObjData(ItemIndex).PielLoboNegro, UserIndex) Then +134 Call WriteConsoleMsg(UserIndex, "No tenes suficientes pieles de lobo negro.", e_FontTypeNames.FONTTYPE_INFO) +136 SastreTieneMateriales = False +138 Call WriteMacroTrabajoToggle(UserIndex, False) + Exit Function + End If + End If +140 SastreTieneMateriales = True Exit Function SastreTieneMateriales_Err: -132 Call TraceError(Err.Number, Err.Description, "Trabajo.SastreTieneMateriales", Erl) -134 - + Call TraceError(Err.Number, Err.Description, "Trabajo.SastreTieneMateriales", Erl) End Function Function HerreroTieneMateriales(ByVal UserIndex As Integer, ByVal ItemIndex As Integer) As Boolean