/** * 储存聊天 * * @param pc * @param target * @param text * @param type */ public void storeChat( final L1PcInstance pc, final L1PcInstance target, final String text, final int type) { if (!this.isLoggingTarget(type)) { return; } // type // 0:一般频道 // 1:Whisper(密语频道) // 2:大喊频道 // 3:广播频道 // 4:血盟频道 // 11:组队频道 // 13:联盟频道 // 14:聊天队伍频道 Connection con = null; PreparedStatement pstm = null; try { con = L1DatabaseFactory.getInstance().getConnection(); if (target != null) { pstm = con.prepareStatement( "INSERT INTO log_chat (account_name, char_id, name, clan_id, clan_name, locx, locy, mapid, type, target_account_name, target_id, target_name, target_clan_id, target_clan_name, target_locx, target_locy, target_mapid, content, datetime) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SYSDATE())"); pstm.setString(1, pc.getAccountName()); pstm.setInt(2, pc.getId()); pstm.setString(3, pc.isGm() ? "******" : pc.getName()); pstm.setInt(4, pc.getClanid()); pstm.setString(5, pc.getClanname()); pstm.setInt(6, pc.getX()); pstm.setInt(7, pc.getY()); pstm.setInt(8, pc.getMapId()); pstm.setInt(9, type); pstm.setString(10, target.getAccountName()); pstm.setInt(11, target.getId()); pstm.setString(12, target.getName()); pstm.setInt(13, target.getClanid()); pstm.setString(14, target.getClanname()); pstm.setInt(15, target.getX()); pstm.setInt(16, target.getY()); pstm.setInt(17, target.getMapId()); pstm.setString(18, text); } else { pstm = con.prepareStatement( "INSERT INTO log_chat (account_name, char_id, name, clan_id, clan_name, locx, locy, mapid, type, content, datetime) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SYSDATE())"); pstm.setString(1, pc.getAccountName()); pstm.setInt(2, pc.getId()); pstm.setString(3, pc.isGm() ? "******" : pc.getName()); pstm.setInt(4, pc.getClanid()); pstm.setString(5, pc.getClanname()); pstm.setInt(6, pc.getX()); pstm.setInt(7, pc.getY()); pstm.setInt(8, pc.getMapId()); pstm.setInt(9, type); pstm.setString(10, text); } pstm.execute(); } catch (final SQLException e) { _log.log(Level.SEVERE, e.getLocalizedMessage(), e); } finally { SQLUtil.close(pstm); SQLUtil.close(con); } }
/** * 道具执行 * * @param data 参数 * @param pc 对象 * @param item 道具 */ @Override public void execute(final int[] data, final L1PcInstance pc, final L1ItemInstance item) { final int itemId = item.getItemId(); boolean isTeleport = false; final int x = pc.getX(); final int y = pc.getY(); final short map = pc.getMapId(); switch (itemId) { case 40289: // 傲慢之塔传送符(11F),傲慢之塔传送符(51F) case 40293: // 傲慢之塔1层上方魔法阵 if ((x >= 32816) && (x <= 32821) && (y >= 32778) && (y <= 32783) && (map == 101)) { isTeleport = true; } break; case 40290: // 傲慢之塔传送符(21F),傲慢之塔传送符(61F) case 40294: // 傲慢之塔1层右方魔法阵 if ((x >= 32815) && (x <= 32820) && (y >= 32815) && (y <= 32820) && (map == 101)) { isTeleport = true; } break; case 40291: // 傲慢之塔传送符(31F),傲慢之塔传送符(71F) case 40295: // 傲慢之塔1层左方魔法阵 if ((x >= 32779) && (x <= 32784) && (y >= 32778) && (y <= 32783) && (map == 101)) { isTeleport = true; } break; case 40292: // 傲慢之塔传送符(41F),傲慢之塔传送符(81F) case 40296: // 傲慢之塔1层下方魔法阵 if ((x >= 32779) && (x <= 32784) && (y >= 32815) && (y <= 32820) && (map == 101)) { isTeleport = true; } break; case 40297: // 傲慢之塔传送符(91F) // 傲慢之塔90层右方魔法阵 if ((x >= 32706) && (x <= 32710) && (y >= 32909) && (y <= 32913) && (map == 190)) { isTeleport = true; } break; } if (isTeleport) { L1Teleport.teleport( pc, item.getItem().get_locx(), item.getItem().get_locy(), item.getItem().get_mapid(), 5, true); } else { pc.sendPackets(new S_ServerMessage(79)); // \f1没有任何事情发生。 } }