hitsplats: add missing multihitsplat varients

This commit is contained in:
Trevor
2020-04-11 18:57:27 -04:00
committed by Adam
parent 03511a4e00
commit 188a9414ff
3 changed files with 103 additions and 30 deletions

View File

@@ -52,6 +52,38 @@ public class Hitsplat
* Taking damage by others (red).
*/
DAMAGE_OTHER,
/**
* Taking damage by me (cyan).
*/
DAMAGE_ME_CYAN,
/**
* Taking damage by others (cyan).
*/
DAMAGE_OTHER_CYAN,
/**
* Taking damage by me (orange).
*/
DAMAGE_ME_ORANGE,
/**
* Taking damage by others (orange).
*/
DAMAGE_OTHER_ORANGE,
/**
* Taking damage by me (yellow).
*/
DAMAGE_ME_YELLOW,
/**
* Taking damage by others (yellow).
*/
DAMAGE_OTHER_YELLOW,
/**
* Taking damage by me (white).
*/
DAMAGE_ME_WHITE,
/**
* Taking damage by others (white/black).
*/
DAMAGE_OTHER_WHITE,
/**
* Damage from poison (green).
*/
@@ -88,6 +120,14 @@ public class Hitsplat
case 4: return DISEASE;
case 5: return VENOM;
case 6: return HEAL;
case 18: return DAMAGE_ME_CYAN;
case 19: return DAMAGE_OTHER_CYAN;
case 20: return DAMAGE_ME_ORANGE;
case 21: return DAMAGE_OTHER_ORANGE;
case 22: return DAMAGE_ME_YELLOW;
case 23: return DAMAGE_OTHER_YELLOW;
case 24: return DAMAGE_ME_WHITE;
case 25: return DAMAGE_OTHER_WHITE;
}
return null;
}
@@ -117,4 +157,36 @@ public class Hitsplat
this.amount = amount;
this.disappearsOnGameCycle = disappearsOnGameCycle;
}
public boolean isMine()
{
switch (this.getHitsplatType())
{
case BLOCK_ME:
case DAMAGE_ME:
case DAMAGE_ME_CYAN:
case DAMAGE_ME_YELLOW:
case DAMAGE_ME_ORANGE:
case DAMAGE_ME_WHITE:
return true;
default:
return false;
}
}
public boolean isOthers()
{
switch (this.getHitsplatType())
{
case BLOCK_OTHER:
case DAMAGE_OTHER:
case DAMAGE_OTHER_CYAN:
case DAMAGE_OTHER_YELLOW:
case DAMAGE_OTHER_ORANGE:
case DAMAGE_OTHER_WHITE:
return true;
default:
return false;
}
}
}

View File

@@ -163,38 +163,39 @@ public class DpsCounterPlugin extends Plugin
Hitsplat hitsplat = hitsplatApplied.getHitsplat();
switch (hitsplat.getHitsplatType())
if (hitsplat.isMine())
{
case DAMAGE_ME:
int hit = hitsplat.getAmount();
// Update local member
PartyMember localMember = partyService.getLocalMember();
// If not in a party, user local player name
final String name = localMember == null ? player.getName() : localMember.getName();
DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new);
dpsMember.addDamage(hit);
int hit = hitsplat.getAmount();
// Update local member
PartyMember localMember = partyService.getLocalMember();
// If not in a party, user local player name
final String name = localMember == null ? player.getName() : localMember.getName();
DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new);
dpsMember.addDamage(hit);
// broadcast damage
if (localMember != null)
{
final DpsUpdate specialCounterUpdate = new DpsUpdate(hit);
specialCounterUpdate.setMemberId(localMember.getMemberId());
wsClient.send(specialCounterUpdate);
}
// apply to total
break;
case DAMAGE_OTHER:
final int npcId = ((NPC) actor).getId();
boolean isBoss = BOSSES.contains(npcId);
if (actor != player.getInteracting() && !isBoss)
{
// only track damage to npcs we are attacking, or is a nearby common boss
return;
}
// apply to total
break;
default:
// broadcast damage
if (localMember != null)
{
final DpsUpdate specialCounterUpdate = new DpsUpdate(hit);
specialCounterUpdate.setMemberId(localMember.getMemberId());
wsClient.send(specialCounterUpdate);
}
// apply to total
}
else if (hitsplat.isOthers())
{
final int npcId = ((NPC) actor).getId();
boolean isBoss = BOSSES.contains(npcId);
if (actor != player.getInteracting() && !isBoss)
{
// only track damage to npcs we are attacking, or is a nearby common boss
return;
}
// apply to total
}
else
{
return;
}
unpause();

View File

@@ -168,7 +168,7 @@ public class SpecialCounterPlugin extends Plugin
Hitsplat hitsplat = hitsplatApplied.getHitsplat();
Hitsplat.HitsplatType hitsplatType = hitsplat.getHitsplatType();
// Ignore all hitsplats other than mine
if ((hitsplatType != Hitsplat.HitsplatType.DAMAGE_ME && hitsplatType != Hitsplat.HitsplatType.BLOCK_ME) || target == client.getLocalPlayer())
if (!hitsplat.isMine() || target == client.getLocalPlayer())
{
return;
}