blabberv5 py->java

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
class DiBlabberV5(DiSkillV2):
    def __init__(self, memory_size: int = 15, reply_chance: int = 90):
        super().__init__()
        self.npc: AXNPC2 = AXNPC2(memory_size, reply_chance)
        self.npc.cmdBreaker = AXCmdBreaker("tell me")
        self._temp_str: str = ""
        self._autoTalk: OnOffSwitch = OnOffSwitch()
        self._autoTalk.setOn(Responder("filth on"))
        self._funnel: str = ""

    def addResponses(self, *responses: str) -> DiBlabberV5:
        for str1 in responses:
            self.npc.responder.queue.insert(str1)
        return self

    def setResponses(self, *responses: str) -> DiBlabberV5:
        self.npc.responder.queue = []
        for str1 in responses:
            self.npc.responder.queue.insert(str1)
        return self

    def input(self, ear: str, skin: str, eye: str):
        # auto talk mode
        if self._autoTalk.getMode(ear):
            t = self.npc.respond()
            if len(t) > 0:
                self.setSimpleAlg(Eliza.PhraseMatcher.reflect(t))
                return
        if len(ear) == 0:
            return
        # funnel
        self._funnel = ear.replace("tell me how", "tell me")
        self._funnel = self._funnel.replace("tell me to", "tell me")
        # blabber
        self._temp_str = self.npc.strRespond(self._funnel)
        if len(self._temp_str) > 0:
            self.setSimpleAlg(Eliza.PhraseMatcher.reflect(self.npc.forceRespond()))
        self.npc.learn(self._funnel)
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class DiBlabberV5 extends DiSkillV2 {
    private AXNPC2 npc;
    private String tempStr = "";
    private OnOffSwitch autoTalk = new OnOffSwitch();
    private String funnel = "";

    public DiBlabberV5(int memorySize, int replyChance) {
        super();
        this.npc = new AXNPC2(memorySize, replyChance);
        this.npc.setCmdBreaker(new AXCmdBreaker("tell me"));
        this.autoTalk.setOn(new Responder("filth on"));
    }

    public DiBlabberV5 addResponses(String... responses) {
        for (String str1 : responses) {
            this.npc.getResponder().getQueue().insert(str1);
        }
        return this;
    }

    public DiBlabberV5 setResponses(String... responses) {
        this.npc.getResponder().setQueue(new ArrayList<>());
        for (String str1 : responses) {
            this.npc.getResponder().getQueue().insert(str1);
        }
        return this;
    }

    public void input(String ear, String skin, String eye) {
        // auto talk mode
        if (this.autoTalk.getMode(ear)) {
            String t = this.npc.respond();
            if (t.length() > 0) {
                this.setSimpleAlg(Eliza.PhraseMatcher.reflect(t));
                return;
            }
        }
        if (ear.isEmpty()) {
            return;
        }
        // funnel
        this.funnel = ear.replace("tell me how", "tell me");
        this.funnel = this.funnel.replace("tell me to", "tell me");
        // blabber
        this.tempStr = this.npc.strRespond(this.funnel);
        if (this.tempStr.length() > 0) {
            this.setSimpleAlg(Eliza.PhraseMatcher.reflect(this.npc.forceRespond()));
        }
        this.npc.learn(this.funnel);
    }
}
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
package skills;
import AXJava.*;
import LivinGrimoire.DiSkillV2;

import java.util.ArrayList;

public class DiBlabberV5 extends DiSkillV2 {
    private AXNPC2 npc;
    private String tempStr = "";
    private OnOffSwitch autoTalk = new OnOffSwitch();
    private String funnel = "";

    public DiBlabberV5(int memorySize, int replyChance) {
        super();
        this.npc = new AXNPC2(memorySize, replyChance);
        this.npc.cmdBreaker = new AXCmdBreaker("tell me");
        this.autoTalk.setOn(new Responder("filth on"));
    }
    public DiBlabberV5() {
        super();
        this.npc = new AXNPC2(9, 90);
        this.npc.cmdBreaker = new AXCmdBreaker("tell me");
        this.autoTalk.setOn(new Responder("filth on"));
    }

    public DiBlabberV5 addResponses(String... responses) {
        for (String str1 : responses) {
            this.npc.responder.getElements().add(str1);
        }
        return this;
    }

    public DiBlabberV5 setResponses(String... responses) {
        this.npc.responder.setElements(new ArrayList<String>());
        for (String str1 : responses) {
            this.npc.responder.getElements().add(str1);
        }
        return this;
    }

    public void input(String ear, String skin, String eye) {
        // auto talk mode
        if (this.autoTalk.getMode(ear)) {
            String t = this.npc.respond();
            if (t.length() > 0) {
                this.setSimpleAlg(Eliza.PhraseMatcher.reflect(t));
                return;
            }
        }
        if (ear.isEmpty()) {
            return;
        }
        // funnel
        this.funnel = ear.replace("tell me how", "tell me");
        this.funnel = this.funnel.replace("tell me to", "tell me");
        // blabber
        this.tempStr = this.npc.strRespond(this.funnel);
        if (this.tempStr.length() > 0) {
            this.setSimpleAlg(Eliza.PhraseMatcher.reflect(this.npc.forceRespond()));
        }
        this.npc.learn(this.funnel);
    }
}
 
Top