<commit_before>package org.xtx.ut4converter.t3d;

import org.xtx.ut4converter.MapConverter;
import org.xtx.ut4converter.export.UTPackageExtractor;
import org.xtx.ut4converter.ucore.UPackageRessource;

/**
 * Special event trigger in Unreal Engine 1 (Unreal 1)
 */
public class T3DSpecialEvent extends T3DActor {

    /**
     * Means will be broadcast to all other players
     */
    private Boolean bBroadcast;

    private Boolean bPlayerViewRot;

    private Float damage;

    private String damageString;

    private String damageType;

    private String message;

    private UPackageRessource sound;

    public T3DSpecialEvent(final MapConverter mc, final String t3dClass) {
        super(mc, t3dClass);
    }

    @Override
    public boolean analyseT3DData(String line) {
        if (line.startsWith("bBroadcast=")) {
            this.bBroadcast = T3DUtils.getBoolean(line);
        }
        else if (line.startsWith("bPlayerViewRot=")) {
            this.bBroadcast = T3DUtils.getBoolean(line);
        }
        else if (line.startsWith("Damage=")) {
            this.damage = T3DUtils.getFloat(line);
        }
        else if (line.startsWith("DamageString=")) {
            this.damageString = T3DUtils.getString(line);
        }
        else if (line.startsWith("DamageType=")) {
            this.damageType = T3DUtils.getString(line);
        }
        else if (line.startsWith("Message=")) {
            this.message = T3DUtils.getString(line);
        }
        else if (line.startsWith("Sound=")) {
            this.sound = mapConverter.getUPackageRessource(line.split("\'")[1], T3DRessource.Type.SOUND);
        }

        else {
            return super.analyseT3DData(line);
        }

        return true;
    }

    @Override
    public void convert() {
        if (mapConverter.convertSounds() && sound != null) {
            sound.export(UTPackageExtractor.getExtractor(mapConverter, sound));
        }

        super.convert();
    }

    @Override
    public String toString() {

        sbf.append(IDT).append("Begin Actor Class=Dispatcher_C \n");

        sbf.append(IDT).append("\tBegin Object Class=SceneComponent Name=\"DefaultSceneRoot\"\n");
        sbf.append(IDT).append("\tEnd Object\n");

        sbf.append(IDT).append("\tBegin Object Name=\"DefaultSceneRoot\"\n");
        writeLocRotAndScale();
        sbf.append(IDT).append("\tEnd Object\n");

        sbf.append(IDT).append("\tDefaultSceneRoot=DefaultSceneRoot\n");


        if(bBroadcast != null){
            sbf.append(IDT).append("\tbBroadcast=").append(bBroadcast).append("\n");
        }

        if(bPlayerViewRot != null){
            sbf.append(IDT).append("\tbPlayerViewRot=").append(bPlayerViewRot).append("\n");
        }

        if(damage != null){
            sbf.append(IDT).append("\tDamage=").append(damage).append("\n");
        }

        if(damageString != null){
            sbf.append(IDT).append("\tDamageString=").append(damageString).append("\n");
        }

        if(message != null){
            sbf.append(IDT).append("\tMessage=").append(message).append("\n");
        }

        if(sound != null){
            sbf.append(IDT).append("\tSound=SoundCue'").append(sound.getConvertedName(mapConverter)).append("'\n");
        }

        sbf.append(IDT).append("\tRootComponent=DefaultSceneRoot\n");

        writeEndActor();

        return super.toString();
    }
}
<commit_msg>Refactor specialevent<commit_after>package org.xtx.ut4converter.t3d;

import org.xtx.ut4converter.MapConverter;

/**
 * Special event trigger in Unreal Engine 1 (Unreal 1)
 */
public class T3DSpecialEvent extends T3DActor {

    public T3DSpecialEvent(final MapConverter mc, final String t3dClass) {
        super(mc, t3dClass);

        registerSimpleProperty("bBroadcast", Boolean.class, Boolean.FALSE);
        registerSimpleProperty("bPlayerViewRot", Boolean.class, Boolean.FALSE);
        registerSimpleProperty("Damage", Float.class, 0f);
        registerSimpleProperty("DamageString", String.class);
        registerSimpleProperty("DamageType", String.class);
        registerSimpleProperty("Message", String.class);
        registerSimplePropertyRessource("Sound", T3DRessource.Type.SOUND);
    }

    @Override
    public String toString() {

        sbf.append(IDT).append("Begin Actor Class=Dispatcher_C \n");

        sbf.append(IDT).append("\tBegin Object Class=SceneComponent Name=\"DefaultSceneRoot\"\n");
        sbf.append(IDT).append("\tEnd Object\n");

        sbf.append(IDT).append("\tBegin Object Name=\"DefaultSceneRoot\"\n");
        writeLocRotAndScale();
        sbf.append(IDT).append("\tEnd Object\n");

        sbf.append(IDT).append("\tDefaultSceneRoot=DefaultSceneRoot\n");

        writeSimpleProperties();

        sbf.append(IDT).append("\tRootComponent=DefaultSceneRoot\n");

        writeEndActor();

        return super.toString();
    }
}

{'fraction_non_alphanumeric': 0.13832617147534274, 'fraction_numerical': 0.006957233476570493, 'mean_word_length': 2.7862122385747483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '415222', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1470, 'n_words': 230}