package clarity.parser.handler;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import clarity.match.Match;
import clarity.model.StringTable;
import clarity.parser.Handler;
import clarity.parser.HandlerHelper;

import com.dota2.proto.Demo.CDemoStringTables;
import com.dota2.proto.Demo.CDemoStringTables.items_t;
import com.dota2.proto.Demo.CDemoStringTables.table_t;

public class DemStringTablesHandler implements Handler<CDemoStringTables> {

    private final Logger log = LoggerFactory.getLogger(getClass());
    
    @Override
    public void apply(int peekTick, CDemoStringTables message, Match match) {
        HandlerHelper.traceMessage(log, peekTick, message);
        for (table_t t : message.getTablesList()) {
            StringTable st = match.getStringTables().forName(t.getTableName());
            List<items_t> l = t.getItemsList();
            for (int i = 0; i < l.size(); i++) {
                st.set(i, l.get(i).getStr(), l.get(i).getData());
            }
        }
    }

}

@@ -134,19 +134,34 @@
 ity.
-match.Match
+decoder.StringTableApplier
 ;%0D%0Ai
@@ -179,24 +179,18 @@
 ty.m
-odel.StringTable
+atch.Match
 ;%0D%0Ai
@@ -788,89 +788,8 @@
  %7B%0D%0A
-            StringTable st = match.getStringTables().forName(t.getTableName());%0D%0A
     
@@ -903,15 +903,84 @@
     
-st.set(
+StringTableApplier.forName(t.getTableName()).apply(match, t.getTableName(), 
 i, l

fix bug if CDemoStringTables had modifiers, they were not applied