Untitled

 avatar
unknown
java
a month ago
3.5 kB
3
Indexable
//addition char.java
public int Time2H = 0;
    public boolean isGift2H = false;
    public boolean isGiftLv30 = false;
    public int timeOnline = 0;
    
public void updateEverySecond(){
    Calendar time = Calendar.getInstance();
        int hour = time.get(11);
        int min = time.get(12);
        int sec = time.get(13);
        if (sec % 60 == 0) {
            this.Time2H++;
            this.timeOnline++;
        }
}
menus.add(new Menu(CMDMenu.EXECUTE, "Nhận quà", () -> {
            if (!isHuman) {
                warningClone();
                return;
            }
            menus.clear();
            menus.add(new Menu(CMDMenu.EXECUTE, "Quà 2h", () -> {
                if (this.Time2H >= 120) {
                    if (this.isGift2H == false) {
                        this.isGift2H = true;
                        this.addGold(500);
                        serverMessage("Nhận quà 2h thành công");
                    } else {
                        getService().npcChat(NpcName.KAMAKURA, "Ngươi đã nhận quà hôm nay rồi");
                    }
                } else {
                    getService().npcChat(NpcName.KAMAKURA, "Ngươi chưa đủ điều kiện để nhận quà.");
                }
            }));
            menus.add(new Menu(CMDMenu.EXECUTE, "Quà cấp 30", () -> {
                if (this.level >= 30 && this.isGiftLv30 == false) {
                    this.addYen(50000000);
                    this.addGold(500);
                    this.isGiftLv30 = true;
                } else {
                    getService().npcChat(NpcName.KAMAKURA, "Ngươi chưa đủ điều kiện để nhận quà.");
                }
            }));
            getService().openUIMenu();
            // teleportVDMQ();
        }));
public synchronized boolean load() {
    JSONArray nhanqua = (JSONArray) JSONValue.parse(rs.getString("nhanqua"));
                this.timeOnline = Integer.parseInt(nhanqua.get(0).toString());
                this.Time2H = Integer.parseInt(nhanqua.get(1).toString());
                this.isGift2H = Boolean.parseBoolean(nhanqua.get(2).toString());
                this.isGiftLv30 = Boolean.parseBoolean(nhanqua.get(3).toString());
}
if (isNewDay) {
                    this.countGlory = 20;
                    this.countUseItemGlory = 6;
                    this.countUseItemDungeo = 1;
                    this.countFinishDay = 20;
                    this.countLoopBoss = 2;
                    this.countUseItemBeast = 2;
                    this.warPoint = 0;
                    this.time = -1;
                    this.faction = -1;
                    this.updateHPMount(-200);
                    this.updateHPBijuu(-150);
                    this.countArenaT = 1;
                    this.sevenBeastsID = -1;
                    this.typeSevenBeasts = -1;
                    this.countEnterFujukaSanctuary = 1;
                    this.Time2H = 0;
                    this.isGift2H = false;
                    TaskOrder.clearTaskBiAn(this, isNewDay);
                    
public synchronized void saveData() {
    JSONArray nhanqua = new JSONArray();//nhận quà by time
                nhanqua.add(this.timeOnline);
                nhanqua.add(this.Time2H);
                nhanqua.add(this.isGift2H);
                nhanqua.add(this.isGiftLv30);
                String jnhanqua = nhanqua.toJSONString();
                stmt.setString(39,jnhanqua);
}
Leave a Comment