TA的每日心情 | 开心 2024-11-6 23:36 |
---|
签到天数: 319 天 [LV.8]以坛为家I
管理员
- 积分
- 85363
|
在使用这脚本前,请先在源码"NPCConversationManager" JAVA
下方新增
- public Connection getConnection() {
- return DatabaseConnection.getConnection();
- }
复制代码
这边给各位脚本内容~~
- /* global cm */
- var status, str, select, list;
- var ttext = "";
- var j = "";
- var i = "";
- var k = "";
- function start() {
- status = -1;
- str = "";
- select = -1;
- str += "=============#e欢迎使用怪物掉宝查询工具#n=============";
- str += "\r\n\r\n#b#L14#查询物品掉落怪物#l";
- cm.sendSimple(str);
- }
- function action(mode, type, selection) {
- var name = cm.getPlayer().getName();
- if (mode == 1) {
- status++;
- } else {
- status--;
- cm.dispose();
- return;
- }
- switch (status) {
- case 0:
- str = selection;
- if (str == 15) {
- cm.dispose();
- cm.openNpc(9010000, "物品查询");
- } else
- cm.sendGetText("请输入要查询的道具名称");
- break;
- case 1:
- switch (str) {
- case 14:
- cm.sendOk(cm.searchData(1, cm.getText()));
- break;
- default:
- cm.sendOk(cm.searchData(str, cm.getText()));
- }
- break;
- case 2:
- if (select == -1) {
- select = selection;
- }
- if (str == 13) {
- cm.sendNext(cm.ShowGMItemRank(select));
- cm.dispose();
- }
- if (!cm.foundData(str, cm.getText())&&str!=14) {
- cm.dispose();
- return;
- }
- switch (str) {
- case 14:
- //cm.sendNext(cm.checkItemDrop(cm.getPlayer(), select));
- cm.sendSimple("您好,请问您是要查询这个道具:\r\n\r\n"+
- "#i"+select+"# - #z"+select+"# 吗?");
- break;
- default:
- cm.dispose();
- }
- break;
- case 3:
- switch (str) {
- case 14:
- //必要条件
- /**
- * 在端口内需要有类似以下支援连线sql的语法
- * public Connection getConnection() {
- * return DatabaseConnection.getConnection();
- * }
- */
- var conn = cm.getConnection();
- //sql语法
- var ps = conn.prepareStatement("SELECT * FROM drop_data WHERE itemid = ?");
-
- ps.setInt(1, select);
- var RankDataBase = ps.executeQuery();
- ttext += "玩家您好,您要查询的掉落物\r\n\r\n"
- ttext += "#i"+select+"# - #z"+select+"#\r\n\r\n"
- ttext += "会由以下怪物掉落:\r\n\r\n"
- while (RankDataBase.next()) {
- //取得需要的栏位
- i = RankDataBase.getString("dropperid");
- ttext += "#b#o" + i + "#\r\n"
- j++;
- }
- cm.sendSimple(ttext);
- RankDataBase.close();
- ps.close();
- cm.dispose();
- break;
- default:
- cm.dispose();
- }
- break;
-
- default:
- cm.dispose();
- }
- }
复制代码
|
|