diff --git a/Codigo/Admin.bas b/Codigo/Admin.bas index 56938854..8849d9ab 100644 --- a/Codigo/Admin.bas +++ b/Codigo/Admin.bas @@ -153,6 +153,7 @@ Public MRSkillNpcProtectionModifier As Single Public AssistDamageValidTime As Long 'valid time for damage to count as assit Public AssistHelpValidTime As Long 'valid time for helpful spell to count as assist Public HideAfterHitTime As Long 'required time to hide again after a hit remove us from this state +Public FactionReKillTime As Long 'required time between killing the same user to get factions points Public Puerto As Long diff --git a/Codigo/Declares.bas b/Codigo/Declares.bas index a40b6810..5c3be3dd 100644 --- a/Codigo/Declares.bas +++ b/Codigo/Declares.bas @@ -1659,6 +1659,7 @@ Public Type t_ObjData MagicDamageBonus As Integer MagicPenetration As Integer ResistenciaMagica As Integer + MagicAbsoluteBonus As Integer Revive As Boolean Invernal As Boolean @@ -1738,12 +1739,18 @@ End Enum Public Const MaxRecentKillToStore = 5 +Public Type t_RecentKiller + UserId As Long + KillTime As Long +End Type + Public Type t_RecentKillRecord UserId As Long - RecentKillers(MaxRecentKillToStore) As Long + RecentKillers(MaxRecentKillToStore) As t_RecentKiller RecentKillersIndex As Long End Type + 'keep record from alst 50 dc users in memory to prevent relog abuse that dont belong to the db Public Type t_RecentKillCache LastDisconnectionInfo(50) As t_RecentKillRecord 'Use a circular buffer for this @@ -1837,7 +1844,6 @@ Public Enum e_InventorySlotMask eTool = 64 End Enum - 'Flags Public Type t_UserFlags Nadando As Byte @@ -1975,7 +1981,7 @@ Public Type t_UserFlags ValCoDe As Integer - RecentKillers(MaxRecentKillToStore) As Long 'Circular buffer to store recent killers to this user + RecentKillers(MaxRecentKillToStore) As t_RecentKiller 'Circular buffer to store recent killers to this user LastKillerIndex As Integer 'Last killer index of the circular buffer OldBody As Integer diff --git a/Codigo/FileIO.bas b/Codigo/FileIO.bas index 6c599c48..8d08a97f 100644 --- a/Codigo/FileIO.bas +++ b/Codigo/FileIO.bas @@ -1083,6 +1083,7 @@ Sub LoadBalance() AssistDamageValidTime = val(BalanceIni.GetValue("EXTRA", "AssistDamageValidTime")) AssistHelpValidTime = val(BalanceIni.GetValue("EXTRA", "AssistHelpValidTime")) HideAfterHitTime = val(BalanceIni.GetValue("EXTRA", "HideAfterHitTime")) + FactionReKillTime = val(BalanceIni.GetValue("EXTRA", "FactionReKillTime")) 'stun PlayerStunTime = val(BalanceIni.GetValue("STUN", "PlayerStunTime")) NpcStunTime = val(BalanceIni.GetValue("STUN", "NpcStunTime")) @@ -1336,6 +1337,7 @@ Sub LoadOBJData() 218 .Municion = val(Leer.GetValue(ObjKey, "Municiones")) 220 .Power = val(Leer.GetValue(ObjKey, "StaffPower")) 222 .MagicDamageBonus = val(Leer.GetValue(ObjKey, "MagicDamageBonus")) +224 .MagicAbsoluteBonus = val(Leer.GetValue(ObjKey, "MagicAbsoluteBonus")) 226 .Real = val(Leer.GetValue(ObjKey, "Real")) 228 .Caos = val(Leer.GetValue(ObjKey, "Caos")) 230 .EfectoMagico = val(Leer.GetValue(ObjKey, "efectomagico")) @@ -1481,6 +1483,7 @@ Sub LoadOBJData() 422 Case e_OBJType.otDañoMagico 424 .MagicDamageBonus = val(Leer.GetValue(ObjKey, "MagicDamageBonus")) +425 .MagicAbsoluteBonus = val(Leer.GetValue(ObjKey, "MagicAbsoluteBonus")) 426 .Revive = val(Leer.GetValue(ObjKey, "Revive")) <> 0 428 Case e_OBJType.otResistencia diff --git a/Codigo/LocaleDef.bas b/Codigo/LocaleDef.bas index f2e4b398..e486e5d4 100644 --- a/Codigo/LocaleDef.bas +++ b/Codigo/LocaleDef.bas @@ -96,6 +96,7 @@ Public Const MsgCCInunity = 475 Public Const MsgRequiredSkill = 473 Public Const MsgCantUseBowTransformed = 476 Public Const MsgBindableHotkeysOnly = 477 +Public Const MsgFactionScore = 478 Public Function GetRequiredWeaponLocaleId(ByVal WeaponType As e_WeaponType) As Integer diff --git a/Codigo/Modulo_UsUaRiOs.bas b/Codigo/Modulo_UsUaRiOs.bas index bd3766b1..4ef7967e 100644 --- a/Codigo/Modulo_UsUaRiOs.bas +++ b/Codigo/Modulo_UsUaRiOs.bas @@ -1644,7 +1644,6 @@ Sub SendUserStatsTxt(ByVal sendIndex As Integer, ByVal UserIndex As Integer) 100 Call WriteConsoleMsg(sendIndex, "Estadisticas de: " & UserList(UserIndex).Name, e_FontTypeNames.FONTTYPE_INFO) 102 Call WriteConsoleMsg(sendIndex, "Nivel: " & UserList(UserIndex).Stats.ELV & " EXP: " & UserList(UserIndex).Stats.Exp & "/" & ExpLevelUp(UserList(UserIndex).Stats.ELV), e_FontTypeNames.FONTTYPE_INFO) 104 Call WriteConsoleMsg(sendIndex, "Salud: " & UserList(UserIndex).Stats.MinHp & "/" & UserList(UserIndex).Stats.MaxHp & " Mana: " & UserList(UserIndex).Stats.MinMAN & "/" & UserList(UserIndex).Stats.MaxMAN & " Vitalidad: " & UserList(UserIndex).Stats.MinSta & "/" & UserList(UserIndex).Stats.MaxSta, e_FontTypeNames.FONTTYPE_INFO) - 106 If UserList(UserIndex).Invent.WeaponEqpObjIndex > 0 Then 108 Call WriteConsoleMsg(sendIndex, "Menor Golpe/Mayor Golpe: " & UserList(UserIndex).Stats.MinHIT & "/" & UserList(UserIndex).Stats.MaxHit & " (" & ObjData(UserList(UserIndex).Invent.WeaponEqpObjIndex).MinHIT & "/" & ObjData(UserList(UserIndex).Invent.WeaponEqpObjIndex).MaxHit & ")", e_FontTypeNames.FONTTYPE_INFO) Else @@ -1703,11 +1702,11 @@ Sub SendUserStatsTxt(ByVal sendIndex As Integer, ByVal UserIndex As Integer) 148 Call WriteConsoleMsg(sendIndex, "Oro: " & UserList(UserIndex).Stats.GLD & " Posicion: " & UserList(UserIndex).Pos.X & "," & UserList(UserIndex).Pos.Y & " en mapa " & UserList(UserIndex).Pos.Map, e_FontTypeNames.FONTTYPE_INFO) 150 Call WriteConsoleMsg(sendIndex, "Dados: " & UserList(UserIndex).Stats.UserAtributos(e_Atributos.Fuerza) & ", " & UserList(UserIndex).Stats.UserAtributos(e_Atributos.Agilidad) & ", " & UserList(UserIndex).Stats.UserAtributos(e_Atributos.Inteligencia) & ", " & UserList(UserIndex).Stats.UserAtributos(e_Atributos.Constitucion) & ", " & UserList(UserIndex).Stats.UserAtributos(e_Atributos.Carisma), e_FontTypeNames.FONTTYPE_INFO) 152 Call WriteConsoleMsg(sendIndex, "Veces que Moriste: " & UserList(UserIndex).flags.VecesQueMoriste, e_FontTypeNames.FONTTYPE_INFO) - +154 Call WriteLocaleMsg(sendIndex, MsgFactionScore, e_FontTypeNames.FONTTYPE_INFO, UserList(UserIndex).Faccion.FactionScore) Exit Sub SendUserStatsTxt_Err: -154 Call TraceError(Err.Number, Err.Description, "UsUaRiOs.SendUserStatsTxt", Erl) +156 Call TraceError(Err.Number, Err.Description, "UsUaRiOs.SendUserStatsTxt", Erl) End Sub @@ -2030,19 +2029,12 @@ Sub UserDie(ByVal UserIndex As Integer) 162 If .flags.PendienteDelSacrificio = 0 Then 164 Call TirarTodosLosItems(UserIndex) Else - Dim MiObj As t_Obj - 166 MiObj.amount = 1 168 MiObj.ObjIndex = PENDIENTE 170 Call QuitarObjetos(PENDIENTE, 1, UserIndex) -172 Call MakeObj(MiObj, .Pos.Map, .Pos.X, .Pos.Y) -174 Call WriteConsoleMsg(UserIndex, "Has perdido tu pendiente del sacrificio.", e_FontTypeNames.FONTTYPE_INFO) - End If - End If - End If Call Desequipar(UserIndex, .Invent.ArmourEqpSlot) @@ -2203,7 +2195,7 @@ Public Function AlreadyKilledBy(ByVal TargetIndex As Integer, ByVal KillerIndex TargetPos = Min(.flags.LastKillerIndex, MaxRecentKillToStore) Dim i As Integer For i = 0 To TargetPos - If .flags.RecentKillers(i) = UserList(KillerIndex).id Then + If .flags.RecentKillers(i).UserId = UserList(killerIndex).id And (GlobalFrameTime - .flags.RecentKillers(i).KillTime) < FactionReKillTime Then AlreadyKilledBy = True Exit Function End If @@ -2216,7 +2208,8 @@ Public Sub RegisterRecentKiller(ByVal TargetIndex As Integer, ByVal KillerIndex Dim InsertIndex As Integer With UserList(TargetIndex) InsertIndex = .flags.LastKillerIndex Mod MaxRecentKillToStore - .flags.RecentKillers(InsertIndex) = UserList(KillerIndex).id + .flags.RecentKillers(InsertIndex).UserId = UserList(killerIndex).id + .flags.RecentKillers(InsertIndex).KillTime = GlobalFrameTime .flags.LastKillerIndex = .flags.LastKillerIndex + 1 If .flags.LastKillerIndex > MaxRecentKillToStore * 10 Then 'prevent overflow .flags.LastKillerIndex = .flags.LastKillerIndex \ 10 @@ -2268,14 +2261,12 @@ Sub HandleFactionScoreForKill(ByVal UserIndex As Integer, ByVal TargetIndex As I Score = Score - 1 Call HandleFactionScoreForAssist(.flags.LastHelpUser.ArrayIndex, TargetIndex) End If - End If If GlobalFrameTime - UserList(TargetIndex).flags.LastAttackedByUserTime < AssistDamageValidTime Then If IsValidUserRef(UserList(TargetIndex).flags.LastAttacker) And UserList(TargetIndex).flags.LastAttacker.ArrayIndex <> UserIndex Then Score = Score - 1 Call HandleFactionScoreForAssist(UserList(TargetIndex).flags.LastAttacker.ArrayIndex, TargetIndex) End If - Score = Score - 1 End If .Faccion.FactionScore = .Faccion.FactionScore + Score End With diff --git a/Codigo/modHechizos.bas b/Codigo/modHechizos.bas index 1eaa5b04..75e905d5 100644 --- a/Codigo/modHechizos.bas +++ b/Codigo/modHechizos.bas @@ -2771,10 +2771,13 @@ Sub HechizoPropNPC(ByVal hIndex As Integer, ByVal npcIndex As Integer, ByVal Use 148 If UserList(UserIndex).invent.WeaponEqpObjIndex > 0 Then 150 Damage = Damage + Porcentaje(Damage, ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicDamageBonus) MagicPenetration = ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicPenetration + Damage = Damage + ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicAbsoluteBonus End If ' Magic Damage ring 152 If UserList(UserIndex).invent.DañoMagicoEqpObjIndex > 0 Then 154 Damage = Damage + Porcentaje(Damage, ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicDamageBonus) + Damage = Damage + ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicAbsoluteBonus + MagicPenetration = MagicPenetration + ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicPenetration End If 156 b = True 158 If NpcList(NpcIndex).flags.Snd2 > 0 Then @@ -3332,9 +3335,11 @@ Sub HechizoPropUsuario(ByVal UserIndex As Integer, ByRef b As Boolean, ByRef IsA If UserList(UserIndex).invent.WeaponEqpObjIndex > 0 Then Damage = Damage + Porcentaje(Damage, ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicDamageBonus) PorcentajeRM = PorcentajeRM - ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicPenetration + Damage = Damage + ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicAbsoluteBonus End If 418 If UserList(UserIndex).invent.DañoMagicoEqpObjIndex > 0 Then 420 Damage = Damage + Porcentaje(Damage, ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicDamageBonus) + Damage = Damage + ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicAbsoluteBonus PorcentajeRM = PorcentajeRM - ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicPenetration End If @@ -3645,12 +3650,15 @@ Sub HechizoCombinados(ByVal UserIndex As Integer, ByRef b As Boolean, ByRef IsAl ' Weapon Magic bonus 280 If UserList(UserIndex).Invent.WeaponEqpObjIndex > 0 Then 282 Damage = Damage + Porcentaje(Damage, ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicDamageBonus) + Damage = Damage + ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicAbsoluteBonus MR = MR - ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicPenetration End If ' Magic ring bonus 284 If UserList(UserIndex).invent.DañoMagicoEqpObjIndex > 0 Then 286 Damage = Damage + Porcentaje(Damage, ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicDamageBonus) + Damage = Damage + ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicAbsoluteBonus + MR = MR - ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicPenetration End If ' Si el hechizo no ignora la RM 288 If Hechizos(h).AntiRm = 0 Then @@ -4546,18 +4554,31 @@ End Sub Private Sub AdjustNpcStatWithCasterLevel(ByVal UserIndex As Integer, ByVal NpcIndex As Integer) Dim BaseHit As Integer Dim BonusDamage As Single + Dim BonusFromItem As Integer 'get natural skill for user lvl and apply hit chance for a cleric of that level with agility buff to 36 BaseHit = UserList(UserIndex).Stats.ELV * 2.5 BaseHit = ((BaseHit + ((3 * BaseHit / 100) * 36))) * ModClase(e_Class.Cleric).AtaqueArmas BaseHit = (BaseHit + (2.5 * max(CInt(UserList(UserIndex).Stats.ELV) - 12, 0))) If UserList(UserIndex).invent.WeaponEqpObjIndex > 0 Then - BonusDamage = ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicDamageBonus / 100 + BonusFromItem = ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicDamageBonus + If BonusFromItem = 0 Then + BonusFromItem = ObjData(UserList(UserIndex).invent.WeaponEqpObjIndex).MagicAbsoluteBonus \ 2 + End If End If - + If BonusFromItem = 0 And UserList(UserIndex).invent.DañoMagicoEqpObjIndex Then + BonusFromItem = ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicDamageBonus + If BonusFromItem = 0 Then + BonusFromItem = ObjData(UserList(UserIndex).invent.DañoMagicoEqpObjIndex).MagicAbsoluteBonus \ 3 + End If + End If + BonusDamage = BonusFromItem / 100 With NpcList(NpcIndex) .PoderAtaque = BaseHit - .Stats.MinHIT = .Stats.MinHIT + .Stats.MinHIT * BonusDamage - .Stats.MaxHit = .Stats.MaxHit + .Stats.MaxHit * BonusDamage + Dim HitBonus As Integer + HitBonus = .Stats.MaxHit * BonusDamage + HitBonus = max(HitBonus, BonusFromItem / 2) + .Stats.MinHIT = .Stats.MinHIT + HitBonus + .Stats.MaxHit = .Stats.MaxHit + HitBonus End With End Sub