package yasp;
import skadistats.clarity.model.GameEvent;

public class CombatLogEntry {

private final CombatLogContext ctx;
private final GameEvent event;

    public CombatLogEntry(CombatLogContext ctx, GameEvent event) {
    	this.ctx = ctx;
        this.event = event;
    }

    private String translate(String in) {
        if (in!=null){
            if (in.startsWith("item_")){
                in=in.substring("item_".length());
            }
        }
        return in;
    }
    
    private String readCombatLogName(int idx) {
        return idx == 0 ? null : ctx.combatLogNames.getNameByIndex(idx);
    }
    
    public int getType() {
        return event.getProperty(ctx.typeIdx);
    }
    
    public String getSourceName() {
        return translate(readCombatLogName((int)event.getProperty(ctx.sourceNameIdx)));
    }
    
    public String getTargetName() {
        return translate(readCombatLogName((int)event.getProperty(ctx.targetNameIdx)));
    }
    
    public String getTargetNameCompiled() {
        return (isTargetIllusion() ? "illusion_" : "") + getTargetName();
    }

    public String getAttackerName() {
        return translate(readCombatLogName((int)event.getProperty(ctx.attackerNameIdx)));
    }
    
    public String getAttackerNameCompiled() {
        return (isAttackerIllusion() ? "illusion_" : "") + getAttackerName();
    }

    public String getInflictorName() {
        return translate(readCombatLogName((int)event.getProperty(ctx.inflictorNameIdx)));
    }
    
    public boolean isAttackerIllusion() {
        return event.getProperty(ctx.attackerIllusionIdx);
    }
    
    public boolean isTargetIllusion() {
        return event.getProperty(ctx.targetIllusionIdx);
    }
    
    public int getValue() {
        return event.getProperty(ctx.valueIdx);
    }
    
    public int getHealth() {
        return event.getProperty(ctx.healthIdx);
    }
    
    public float getTimestamp() {
        return event.getProperty(ctx.timestampIdx);
    }
    
    public String getTargetSourceName() {
        return translate(readCombatLogName((int)event.getProperty(ctx.targetSourceNameIdx)));
    }
    
    public float getTimestampRaw() {
        return event.getProperty(ctx.timestampRawIdx);
    }
    
    public boolean isAttackerHero() {
        return event.getProperty(ctx.attackerHeroIdx);
    }

    public boolean isTargetHero() {
        return event.getProperty(ctx.targetHeroIdx);
    }
    
    public boolean isAbilityToggleOn() {
        return event.getProperty(ctx.abilityToggleOnIdx);
    }

    public boolean isAbilityToggleOff() {
        return event.getProperty(ctx.abilityToggleOffIdx);
    }

    public int getAbilityLevel() {
        return event.getProperty(ctx.abilityLevelIdx);
    }

    public int getGoldReason() {
        return event.getProperty(ctx.goldReasonIdx);
    }
    
    //new functions
    public int getXpReason() {
        return event.getProperty(ctx.xpReasonIdx);
    }
    public int getStunDuration() {
        return event.getProperty(ctx.stunDurationIdx);
    }
    public int getLocationX() {
        return event.getProperty(ctx.locationXIdx);
    }
    public int getLocationY() {
        return event.getProperty(ctx.locationYIdx);
    }
    public String getValueName(){
        return translate(readCombatLogName(getValue()));
    }
}
@@ -277,219 +277,8 @@
  %7D%0A%0A
-    private String translate(String in) %7B%0A        if (in!=null)%7B%0A            if (in.startsWith(%22item_%22))%7B%0A                in=in.substring(%22item_%22.length());%0A            %7D%0A        %7D%0A        return in;%0A    %7D%0A    %0A
     
@@ -759,398 +759,134 @@
   %7D%0A
-    %0A    public String getTargetNameCompiled() %7B%0A        return (isTargetIllusion() ? %22illusion_%22 : %22%22) + getTargetName();%0A    %7D%0A%0A    public String getAttackerName() %7B%0A        return translate(readCombatLogName((int)event.getProperty(ctx.attackerNameIdx)));%0A    %7D%0A    %0A    public String getAttackerNameCompiled() %7B%0A        return (isAttackerIllusion() ? %22illusion_%22 : %22%22) + getAttackerName(
+%0A    public String getAttackerName() %7B%0A        return translate(readCombatLogName((int)event.getProperty(ctx.attackerNameIdx))
 );%0A 
@@ -2289,41 +2289,341 @@
   %7D%0A
-%0A    public int getGoldReason() %7B
+    %0A    //new functions%0A    private String translate(String in) %7B%0A        if (in!=null)%7B%0A            if (in.startsWith(%22item_%22))%7B%0A                in=in.substring(%22item_%22.length());%0A            %7D%0A        %7D%0A        return in;%0A    %7D%0A    public int getGoldReason() %7B%0A        if (ctx.goldReasonIdx==null)%7B%0A            return 0;%0A        %7D
 %0A   
@@ -2682,33 +2682,8 @@
   %7D%0A
-    %0A    //new functions%0A
     
@@ -2701,32 +2701,100 @@
 getXpReason() %7B%0A
+        if (ctx.xpReasonIdx==null)%7B%0A            return 0;%0A        %7D%0A
         return e
@@ -3102,32 +3102,117 @@
 ionYIdx);%0A    %7D%0A
+    public String getValueString()%7B%0A        return String.valueOf(getValue());%0A    %7D%0A
     public Strin
@@ -3292,9 +3292,264 @@
 ;%0A    %7D%0A
-%7D
+    public String getTargetNameCompiled() %7B%0A        return (isTargetIllusion() ? %22illusion_%22 : %22%22) + getTargetName();%0A    %7D%0A    public String getAttackerNameCompiled() %7B%0A        return (isAttackerIllusion() ? %22illusion_%22 : %22%22) + getAttackerName();%0A    %7D%0A%7D%0A

Update CombatLogEntry.java