arm4729 Posted May 20, 2021 Share Posted May 20, 2021 (edited) Hello guys , i need to know how you get value of how much dmg a player did to a raidboss/monster , or if i can get a list of players that dmg a monster/rb and how much they did , any hint please ? Edited May 20, 2021 by arm4729 Link to comment Share on other sites More sharing options...
0 Tryskell Posted May 22, 2021 Share Posted May 22, 2021 Everything already exists, than's the whole point of AggroList, storing both damage and hate for each hitting instance. It's notably used to calculate which got loot priority. 1 Link to comment Share on other sites More sharing options...
0 nikpappa Posted May 20, 2021 Share Posted May 20, 2021 You need to keep players that hit the monster in a collection, then you just broadcast it when you want with a html message Link to comment Share on other sites More sharing options...
0 arm4729 Posted May 21, 2021 Author Share Posted May 21, 2021 public class Antharas extends CustomBoss { @Override public void onDie(Monster boss, Player killer) { Map<Player, Integer> damageMap = boss.getDamageMap(); List<Player> canGiveTo = new ArrayList<>(); for (Player p : damageMap.keySet()) { if (p.isOnline() && !p.isDead() && p.isInsideRadius(boss, 1200, false, false)) canGiveTo.add(p); } if (canGiveTo.isEmpty()) return; if (canGiveTo.size() < Config.SN_DROP.getValue()) { String names = ""; int avail = Config.SN_DROP.getValue(); for (Player p : canGiveTo) { p.addItem("drop", Config.SN_DROP.getId(), 1, null, true); avail--; names += p.getName()+", "; } for (int i = 0; i < avail; i++) canGiveTo.get(Rnd.get(canGiveTo.size())).addItem("drop", Config.SN_DROP.getId(), 1, null, true); Broadcast.announceToOnlinePlayers("[REBIRTH CHEST]Congratulations to the player "+names.substring(0, names.length()-2)+(" he obtained the Rebirth Chest from slaying grand boss "+boss.getName()+" !!")); } else { List<Player> given = new ArrayList<>(); for (int i = 0; i < Config.SN_DROP.getValue(); i++) { Player p = null; do { p = canGiveTo.get(Rnd.get(canGiveTo.size())); } while (given.contains(p)); if (p == null) return; p.addItem("drop", Config.SN_DROP.getId(), 1, null, true); given.add(p); } String names = ""; for (Player p : given) names += p.getName()+", "; Broadcast.announceToOnlinePlayers("[REBIRTH CHEST]Congratulations to the player "+names.substring(0, names.length()-2)+(" he obtained the Rebirth Chest from slaying grand boss "+boss.getName()+" !!")); } } hey , thanks for reply I think already i have an list of players that did dmg do boss , if im wrong correct me .. i need to know how to get like for each player the total dmg that dealt to boss Link to comment Share on other sites More sharing options...
0 Irrelevant Posted May 21, 2021 Share Posted May 21, 2021 (edited) @arm4729 Example: Broadcast.announceToOnlinePlayers("[REBIRTH CHEST]Congratulations to the player "+names.substring(0, names.length()-2)+(" he obtained the Rebirth Chest from slaying grand boss "+boss.getName()+" !!")); + p.sendMesssage("Your Damage:" + p.getDamage()); } } + public final L2PcInstance getDamageDealer() + { + int dmg = 0; + L2PcInstance DamageDealer = null; + for (L2PcInstance p : Attacker) + { + if (p.getDamage() > dmg) + { + dmg = p.getDamage(); + DamageDealer = p; + } + } + return DamageDealer; + } need add attacker method .. something like public List<L2PcInstance> Attacker = new ArrayList<>(); edit: you need to change L2PcInstance with "Player" if you use acis Edited May 21, 2021 by Irrelevant Link to comment Share on other sites More sharing options...
0 arm4729 Posted May 21, 2021 Author Share Posted May 21, 2021 (edited) I dont have a .getDamage() method in Player instance i get this error where do i have to add this ? in player.java ? +public List<Player > Attacker = new ArrayList<>(); + public final Player getDamageDealer() + { + int dmg = 0; + Player DamageDealer = null; + for (Player p : Attacker) + { + if (p.getDamage() > dmg) + { + dmg = p.getDamage(); + DamageDealer = p; + } + } + return DamageDealer; + } Edited May 21, 2021 by arm4729 Link to comment Share on other sites More sharing options...
0 nikpappa Posted May 22, 2021 Share Posted May 22, 2021 You need to store players who hit the rb in a collection, then on death you will broadcast to every player that did damage the rb the html message if (attacker instanceof L2PcInstance) { L2PcInstance player = (L2PcInstance) attacker; if (!_damageMap.containsKey(player.getObjectId())) _damageMap.put(player.getObjectId(), damage); else _damageMap.put(player.getObjectId(), _damageMap.get(player.getObjectId()) + damage); } should be something like this Link to comment Share on other sites More sharing options...
0 arm4729 Posted May 23, 2021 Author Share Posted May 23, 2021 (edited) Thank you all for help but Tryskell give me best hint / fact :D after a few hours (2 or 3) of looking to RewardInfo/Attackable/Aggro .. found that answer to my question , wich was how i can get the total amount of damage killer or other instance did to a monster was "damageMap.get(killer)" Edited May 23, 2021 by arm4729 Link to comment Share on other sites More sharing options...
0 Vision Posted May 23, 2021 Share Posted May 23, 2021 11 hours ago, arm4729 said: Thank you all for help but Tryskell give me best hint / fact after a few hours (2 or 3) of looking to RewardInfo/Attackable/Aggro .. found that answer to my question , wich was how i can get the total amount of damage killer or other instance did to a monster was "damageMap.get(killer)" So I guess thanks to @Tryskell You are all good. I lock this one if you need anything else hit me a PM to unlock it. Also, thanks for pointing out what was your problem and how you managed to fix it in case, someone else is facing something similar. Link to comment Share on other sites More sharing options...
Question
arm4729
Hello guys , i need to know how you get value of how much dmg a player did to a raidboss/monster , or if i can get a list of players that dmg a monster/rb and how much they did , any hint please ?
Edited by arm4729Link to comment
Share on other sites
8 answers to this question
Recommended Posts