65 경매장
importPackage(Packages.database);
importPackage(java.lang);
importPackage(java.sql);
importPackage(Packages.client.items);
importPackage(Packages.server.items);
importPackage(Packages.provider);
importPackage(java.io);
var threedays = 1000 * 60 * 60 * 24 * 3; // 3일
var star = "#fUI/UIWindow2.img/ToolTip/Equip/Star/Star#";
function createAuction() {
var ins = MYSQL.getConnection().prepareStatement("INSERT INTO auctionmeso(name,meso) VALUES(?,?)");
ins.setString(1,cm.getName());
ins.setLong(2,0);
ins.executeUpdate();
}
function haveAuction() {
var isExist = false;
var ps = MYSQL.getConnection().prepareStatement("SELECT * FROM auctionmeso WHERE name = ?");
ps.setString(1,cm.getName());
var rs = ps.executeQuery();
if (rs.next()) {
isExist = true;
}
return isExist;
}
function getAuctionMeso(name) {
var ps = MYSQL.getConnection().prepareStatement("SELECT * FROM auctionmeso WHERE name = ?");
ps.setString(1,name);
var rs = ps.executeQuery();
if (rs.next()) {
return rs.getLong("meso");
} else {
return 0;
}
}
function start() {
if (!haveAuction()) {
createAuction();
}
status = -1;
cm.sendSimple("안녕하세요? 경매 시스템을 운영하고 있는 #b클라라#k입니다. 등록하신 아이템은 3일 동안 저장되며, 중간에 아이템을 회수할 수 있습니다. 무엇을 도와드릴까요?\r\n#b#L1#아이템 등록하기\r\n#L2#등록된 아이템 보기\r\n#L3#등록된 아이템 조회\r\n#L4#메소 찾기\r\n\r\n#L100##d잠재능력 옵션 검색\r\n#L200#경매 용어 살펴보기\r\n\r\n#r#L1000#아이템 회수\r\n#L1001#구매한 아이템 리스트");
}
function action(mode,type,selection) {
if (mode == -1 || mode == 0) {
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
if (status == 0) {
if (selection == 100) {
cm.sendGetText("옵션값과 아이템 레벨을 입력해주세요.\r\n#rEx) 40051, 30 (옵션값, 아이템 레벨)");
} else if (selection == 200) {
cm.sendOk("즉구 : 즉시 구매 -> 바로 구매할 수 있음\r\n\r\n날마다 업데이트 중...");
cm.dispose();
} else if (selection == 1) {
cm.sendSimple("어떤 분류의 아이템을 올리시겠습니까?\r\n#b#L1#장비#l #L2#소비#l #L4#기타#l #L3#설치#l #L5#캐시");
} else if (selection == 2) {
cm.sendSimple("어떤 종류의 아이템을 보시겠습니까?\r\n\r\n#e<장비 아이템>#n\r\n#b#L1000#모자#L1001#한벌옷#L1002#망토#L1003#장갑#L1004#상·하의\r\n#L1005#신발#L1006#악세서리#L1007#무기#L1008#방패#L1009#펫장비#l\r\n\r\n#k#e<기타 아이템>#n\r\n#b#L2000#소비#L2001#기타#L2002#설치#L2003#캐시");
} else if (selection == 3) {
cm.sendGetText("아이템의 이름을 입력해주세요.");
} else if (selection == 4) {
if (getAuctionMeso(cm.getName()) == 0) {
cm.sendOk("찾을 메소가 없습니다.");
cm.dispose();
return;
}
cm.sendYesNo("현재 #d#h ##k님에게 들어온 메소는 #b"+getAuctionMeso(cm.getName())+" 메소#k입니다. 메소를 받으시려면 예를 눌러주세요.");
} else if (selection == 1000) {
getAuctionList(null,cm.getName(),null,null);
} else if (selection == 1001) {
getAuctionList(null,null,null,cm.getName());
}
selected = selection;
} else if (status == 1) {
if (selected == 100) {
cm.sendOk("검색하신 옵션은 #b"+optionFinder(cm.getText().split(",")[0],cm.getText().split(",")[1])+"#k 입니다.");
cm.dispose();
} else if (selected == 1) {
itemType = getType(selection);
var list = "", ok = false;
for (var i = 1; i < 97; i++) {
if (getItem(itemType,i)) {
ok = true;
list += "#L"+i+"##b#i"+getItem(itemType,i).getItemId()+"# #t"+getItem(itemType,i).getItemId()+"#\r\n";
}
}
if (ok) {
cm.sendSimple("어떤 아이템을 등록하시겠습니까?\r\n"+list);
} else {
cm.sendOk("아이템을 가지고 있는 지 다시 한 번 확인해주세요.");
cm.dispose();
}
} else if (selected == 2) {
var data;
if (selection == 1000) { data = "모자";
} else if (selection == 1001) { data = "한벌옷";
} else if (selection == 1002) { data = "망토";
} else if (selection == 1003) { data = "장갑";
} else if (selection == 1004) { data = "상·하의";
} else if (selection == 1005) { data = "신발";
} else if (selection == 1006) { data = "악세서리";
} else if (selection == 1007) { data = "무기";
} else if (selection == 1008) { data = "방패";
} else if (selection == 1009) { data = "펫장비";
} else if (selection == 2000) { data = "소비";
} else if (selection == 2001) { data = "기타";
} else if (selection == 2002) { data = "설치";
} else if (selection == 2003) { data = "캐시"; }
getAuctionList(null,null,data,null);
} else if (selected == 3) {
searchItem(cm.getText());
} else if (selected == 4) {
cm.getPlayer().gainMeso(getAuctionMeso(cm.getName()), true);
var upd = MYSQL.getConnection().prepareStatement("UPDATE auctionmeso SET meso = 0 WHERE name = ?");
upd.setString(1,cm.getName()); upd.executeUpdate();
cm.sendOk("성공적으로 메소를 받았습니다.");
cm.dispose();
} else if (selected == 1000) {
myUniqueId = selection;
cm.sendYesNo("정말 선택하신 아이템을 회수하시겠습니까?");
} else if (selected == 1001) {
buyUniqueId = selection;
if ((getItemInfo(buyUniqueId,"expiration") - System.currentTimeMillis()) / 1000 > 0) {
cm.sendOk("아직 구매할 수 없는 아이템입니다.");
cm.dispose();
return;
}
cm.sendYesNo("정말 아이템을 구매하시겠습니까?\r\n최종 구매 가격은 #b"+getPrice(buyUniqueId,1)+" 메소#k입니다.");
}
} else if (status == 2) {
if (selected == 1) {
item = getItem(itemType,selection);
if (item.getItemId() >= 5000000 && item.getItemId() < 5010000) {
cm.sendOk("펫은 등록할 수 없습니다.");
cm.dispose(); return;
}
if (item.getItemId() >= 1902000 && item.getItemId() < 1983083) {
cm.sendOk("라이딩은 등록할 수 없습니다.");
cm.dispose(); return;
}
cm.sendGetText("#e등록할 아이템 : #n#b#t"+item.getItemId()+"# ("+item.getQuantity()+" 개)\r\n#k최저 낙찰가와 즉시 구매가를 입력해주세요. Ex)1000,10000\r\n\r\n#r(장비 외의 다른 분류의 아이템은 개당 가격을 입력해 주시고, 쉼표#b(,)#r를 입력 후에 수량을 입력해주세요. #kEx) 10,100,30#r)");
} else if (selected == 2) {
newUniqueId = selection;
if (time <= 0) {
if (getItemInfo(newUniqueId,"buyer") == "없음") {
if (getItemInfo(newUniqueId,"owner") == cm.getName()) {
cm.sendOk("입찰자가 없으므로 아이템을 회수해주시기 바랍니다.");
cm.dispose();
return;
}
cm.sendOk("종료된 경매 아이템입니다.");
cm.dispose();
} else {
if (getItemInfo(newUniqueId,"buyer") != cm.getName()) {
cm.sendOk("이미 입찰자가 있습니다.");
cm.dispose();
return;
}
cm.sendOk("구매 리스트를 확인해주세요.");
cm.dispose();
}
return;
}
getItemOption(newUniqueId);
} else if (selected == 3) {
newUniqueId = selection;
getItemOption(newUniqueId);
} else if (selected == 1000) {
var left = (getItemInfo(myUniqueId,"expiration") - threedays) - System.currentTimeMillis();
if (left > -600000) {
cm.sendOk("아이템은 올린지 10분 뒤에 회수할 수 있습니다.");
cm.dispose();
return;
}
setSale(myUniqueId);
if (getItemInfo(myUniqueId,"itemid") < 2000000) {
gainEquip(getInvId(myUniqueId),getItemInfo(myUniqueId,"itemid"));
} else {
cm.gainItem(getItemInfo(myUniqueId,"itemid"), getItemInfo(myUniqueId,"quantity"));
}
deleteAuction(myUniqueId);
cm.getPlayer().saveToDB(false,false);
cm.sendOk("성공적으로 아이템을 회수하였습니다.");
cm.dispose();
} else if (selected == 1001) {
if (cm.getMeso() >= getPrice(buyUniqueId,1)) {
if (cm.canHold(getItemInfo(buyUniqueId,"itemid"))) {
gainOwnerMeso(getPrice(buyUniqueId,1),getItemInfo(buyUniqueId,"owner"));
var meso = getItemInfo(buyUniqueId,"itemid") < 2000000 ? getPrice(buyUniqueId,1) : getPrice(buyUniqueId,1) * getItemInfo(buyUniqueId,"quantity");
cm.getPlayer().gainMeso(-meso,true);
setSale(buyUniqueId);
if (getItemInfo(buyUniqueId,"itemid") < 2000000) {
gainEquip(getInvId(buyUniqueId),getItemInfo(buyUniqueId,"itemid"));
} else {
cm.gainItem(getItemInfo(buyUniqueId,"itemid"),getItemInfo(buyUniqueId,"quantity"));
}
deleteAuction(buyUniqueId);
cm.getPlayer().saveToDB(false,false);
cm.sendOk("성공적으로 아이템을 구매했습니다.");
cm.dispose();
} else {
cm.sendOk("인벤토리에 충분한 공간이 남아 있는지 다시 한 번 확인해주세요.");
cm.dispose();
}
} else {
cm.sendOk("충분한 메소를 가지고 있는지 다시 한 번 확인해주세요.");
cm.dispose();
}
}
} else if (status == 3) {
if (selected == 1) {
total = cm.getText();
quantity = 0;
if (item.getItemId() < 2000000) {
quantity = 1;
} else {
quantity = total.split(",")[2];
}
if (quantity > item.getQuantity()) {
cm.sendOk("사기 칠 생각하지 마세요.");
cm.dispose();
return;
}
if ((total.split(",")[0] > 9999999999 || total.split(",")[0] <= 0) || (total.split(",")[1] > 9999999999 || total.split(",")[1] <= 0)) {
cm.sendOk("#r최소 1메소, 최대 99억 메소까지 등록할 수 있습니다.");
cm.dispose(); return;
}
if (Long.parseLong(total.split(",")[1]) < Long.parseLong(total.split(",")[0])) {
cm.sendOk("즉시 구매가가 최저 입찰가보다 낮습니다.");
cm.dispose(); return;
}
if (total.contains(",") == false) {
cm.sendOk("즉시 구매가를 입력해주세요.");
cm.dispose(); return;
}
cm.sendYesNo("#e최소 입찰가 : #n"+total.split(",")[0]+" 메소\r\n#e즉시 구매가 : #n#d"+total.split(",")[1]+" 메소\r\n\r\n#k정말 #b#i"+item.getItemId()+"# #t"+item.getItemId()+"# #d"+quantity+"개#k를 등록하시겠습니까?");
} else if (selected == 2) {
if (selection == 90) {
cm.sendYesNo("정말 #r"+getPrice(newUniqueId,2)+" 메소#k에 구매하시겠습니까?");
} else if (selection == 91) {
cm.sendGetText("얼마에 입찰하시겠습니까?");
} else if (selection == 100) {
if (getItemInfo(newUniqueId,"quantity") <= 1) {
cm.sendYesNo("정말 #r"+getPrice(newUniqueId,2)+" 메소#k에 구매하시겠습니까?");
} else {
cm.sendGetNumber("몇 개를 구매하시겠습니까? #d(개당 "+getPrice(newUniqueId,2)+" 메소)",1,1,getItemInfo(newUniqueId,"quantity"));
}
} else if (selection == 101) {
cm.sendGetText("얼마에 입찰하시겠습니까? (개당 가격으로 입찰됩니다.)");
}
sel = selection;
}
} else if (status == 4) {
if (selected == 1) {
var ps = MYSQL.getConnection().prepareStatement("UPDATE inventoryitems SET issale = 1 WHERE uniqueid = ?");
ps.setInt(1,item.getUniqueId());
ps.executeUpdate();
cm.getPlayer().saveToDB(false,false);
var save = MYSQL.getConnection().prepareStatement("INSERT INTO auction(owner,uniqueid,name,price,expiration,buyer,itemid,quantity,type) VALUES(?,?,?,?,?,?,?,?,?)");
save.setString(1,cm.getPlayer().getName());
save.setInt(2,item.getUniqueId());
save.setString(3,ItemInformation.getInstance().getName(item.getItemId()));
save.setString(4,total);
save.setLong(5,(System.currentTimeMillis() + threedays));
save.setString(6,"없음");
save.setInt(7,item.getItemId());
save.setInt(8,quantity);
var cat;
var itemId = item.getItemId();
if (itemId >= 5000000) { cat = "캐시";
} else if (itemId >= 2000000 && itemId < 3000000) { cat = "소비";
} else if ((itemId >= 1010000 && itemId <= 1012454) || (itemId >= 1020000 && itemId <= 1022228) || (itemId >= 1032000 && itemId <= 1032232) || (itemId >= 1122000 && itemId <= 1122276)
|| (itemId >= 1132000 && itemId <= 1132242) || (itemId >= 1142000 && itemId <= 1142704) || (itemId >= 1152000 && itemId <= 1152159) || (itemId >= 1162000 && itemId <= 1162018)
|| (itemId >= 1182000 && itemId <= 1182069) || (itemId >= 1190000 && itemId <= 1190400) || (itemId >= 1112000 && itemId <= 1114000)) { cat = "악세서리";
} else if (itemId >= 1000000 && itemId <= 1004200) { cat = "모자";
} else if (itemId >= 1100001 && itemId <= 1102669) { cat = "망토";
} else if ((itemId >= 1040000 && itemId <= 1043000) || (itemId >= 1060000 && itemId <= 1062815)) { cat = "상·하의";
} else if (itemId >= 1080000 && itemId <= 1082580) { cat = "장갑";
} else if (itemId >= 1050000 && itemId <= 1052712) { cat = "한벌옷";
} else if (itemId >= 1802000 && itemId <= 1802491) { cat = "펫장비";
} else if (itemId >= 1092000 && itemId <= 1099010) { cat = "방패";
} else if (itemId >= 1070000 && itemId <= 1072908) { cat = "신발";
} else if (itemId >= 1212000 && itemId <= 1702497) { cat = "무기";
} else if (itemId >= 4000000 && itemId < 5000000) { cat = "기타";
} else if (itemId >= 3000000 && itemId < 4000000) { cat = "설치"; }
save.setString(9,cat);
save.executeUpdate();
cm.getPlayer().saveToDB(false,false);
if (item.getItemId() < 2000000) {
cm.getPlayer().getInventory(itemType).removeSlot(item.getPosition());
cm.getPlayer().getClient().getSession().write(Packages.packet.creators.MainPacketCreator.dropInventoryItem(itemType,item.getPosition()));
} else {
cm.gainItem(item.getItemId(), -quantity);
}
cm.sendOk("아이템이 성공적으로 등록되었습니다.");
cm.dispose();
} else if (selected == 2) {
if (sel == 90) {
if (cm.getMeso() >= getPrice(newUniqueId,2)) {
if (cm.canHold(getItemInfo(newUniqueId,"itemid"))) {
gainOwnerMeso(getPrice(newUniqueId,2),getItemInfo(newUniqueId,"owner"));
cm.getPlayer().gainMeso(-getPrice(newUniqueId,2),true);
setSale(newUniqueId);
gainEquip(getInvId(newUniqueId),getItemInfo(newUniqueId,"itemid"));
deleteAuction(newUniqueId);
cm.getPlayer().saveToDB(false,false);
cm.sendOk("성공적으로 아이템을 구매했습니다.");
cm.dispose();
} else {
cm.sendOk("인벤토리에 충분한 공간이 남아 있는지 다시 한 번 확인해주세요.");
cm.dispose();
}
} else {
cm.sendOk("충분한 메소를 가지고 있는지 다시 한 번 확인해주세요.");
cm.dispose();
}
} else if (sel == 91) {
newPrice = cm.getText();
cm.sendYesNo("정말 #b"+newPrice+" 메소#k에 입찰하시겠습니까?");
} else if (sel == 100) {
if (getItemInfo(newUniqueId,"quantity") <= 1) {
if (cm.getMeso() >= getPrice(newUniqueId,2)) {
if (cm.canHold(getItemInfo(newUniqueId,"itemid"))) {
setSale(newUniqueId);
cm.gainItem(getItemInfo(newUniqueId,"itemid"),getItemInfo(newUniqueId,"quantity"));
gainOwnerMeso(getPrice(newUniqueId,2),getItemInfo(newUniqueId,"owner"));
cm.getPlayer().gainMeso(-getPrice(newUniqueId,2),true);
deleteAuction(newUniqueId);
cm.sendOk("성공적으로 아이템을 구매했습니다.");
cm.dispose();
} else {
cm.sendOk("인벤토리에 충분한 공간이 남아 있는지 다시 한 번 확인해주세요.");
cm.dispose();
}
} else {
cm.sendOk("충분한 메소를 가지고 있는지 다시 한 번 확인해주세요.");
cm.dispose();
}
} else {
newQuantity = selection;
cm.sendYesNo("정말 #b"+newQuantity+"개#k를 구매하시겠습니까?\r\n구매 가격은 #r"+getPrice(newUniqueId,2) * newQuantity+" 메소#k입니다.");
}
} else if (sel == 101) {
newPrice = cm.getText();
cm.sendYesNo("정말 #b"+newPrice+" 메소#k에 입찰하시겠습니까?");
}
}
} else if (status == 5) {
if (sel == 91) {
newPrice = Long.parseLong(newPrice);
var price = MYSQL.getConnection().prepareStatement("UPDATE auction SET buyer = ?, price = ? WHERE uniqueid = ?");
price.setString(1,cm.getPlayer().getName());
price.setString(2,(Long.parseLong(getPrice(newUniqueId,1)) + newPrice)+","+getPrice(newUniqueId,2));
price.setInt(3,newUniqueId);
price.executeUpdate();
cm.sendOk("성공적으로 입찰되었습니다.");
cm.dispose();
} else if (sel == 101) {
newPrice = Long.parseLong(newPrice);
var price = MYSQL.getConnection().prepareStatement("UPDATE auction SET buyer = ?, price = ? WHERE uniqueid = ?");
price.setString(1,cm.getPlayer().getName());
price.setString(2,(Long.parseLong(getPrice(newUniqueId,1)) + newPrice)+","+getPrice(newUniqueId,2));
price.setInt(3,newUniqueId);
price.executeUpdate();
cm.sendOk("성공적으로 입찰되었습니다.");
cm.dispose();
} else {
if (cm.getMeso() >= newQuantity * getPrice(newUniqueId,2)) {
if (cm.canHold(getItemInfo(newUniqueId,"itemid"))) {
cm.getPlayer().gainMeso(-newQuantity * getPrice(newUniqueId,2),true);
gainOwnerMeso(getPrice(newUniqueId,2) * newQuantity,getItemInfo(newUniqueId,"owner"));
cm.gainItem(getItemInfo(newUniqueId,"itemid"), newQuantity);
if (newQuantity == getItemInfo(newUniqueId,"quantity")) {
deleteAuction(newUniqueId);
setSale(newUniqueId);
} else {
var upd = MYSQL.getConnection().prepareStatement("UPDATE auction SET quantity = ? WHERE uniqueid = ?");
upd.setInt(1,(getItemInfo(newUniqueId,"quantity") - newQuantity));
upd.setInt(2,newUniqueId);
upd.executeUpdate();
}
cm.sendOk("성공적으로 아이템을 구매했습니다.");
cm.dispose();
} else {
cm.sendOk("인벤토리에 충분한 공간이 남아 있는지 다시 한 번 확인해주세요.");
cm.dispose();
}
} else {
cm.sendOk("충분한 메소를 가지고 있는지 다시 한 번 확인해주세요.");
cm.dispose();
}
}
}
}
function setSale(uniqueid) {
var ps = MYSQL.getConnection().prepareStatement("UPDATE inventoryitems SET issale = 0 WHERE uniqueid = ?");
ps.setInt(1,uniqueid);
ps.executeUpdate();
}
function deleteAuction(uniqueid) {
var del = MYSQL.getConnection().prepareStatement("DELETE FROM auction WHERE uniqueid = ?");
del.setInt(1,uniqueid);
del.executeUpdate();
}
function searchItem(name) {
var ps = MYSQL.getConnection().prepareStatement("SELECT * FROM auction WHERE name LIKE CONCAT('%',?,'%')");
ps.setString(1,name);
var rs = ps.executeQuery();
var i = 0;
while (rs.next()) {
i++;
name = rs.getString("name");
}
return getAuctionList(name,null,null,null);
}
function getItemOption(uniqueid) {
var ps = MYSQL.getConnection().prepareStatement("SELECT * FROM inventoryequipment WHERE inventoryitemid = ?");
ps.setInt(1,getInvId(uniqueid));
var rs = ps.executeQuery();
if (rs.next()) {
var string = new StringBuilder();
string.append("┌------------------------------------------------┐\r\n");
string.append("│ #eALL STAT : #n"+정렬(rs.getInt("str"),"#k")+" · "+정렬(rs.getInt("dex"),"#k")+" · "+정렬(rs.getInt("int"),"#k") +" · "+정렬(rs.getInt("luk"),"#k")+" │\r\n");
string.append("│ #eATTACK : #n#r(WATK)#k #d"+정렬(rs.getInt("watk"),"#d")+" · #b(MATK)#k#d "+정렬(rs.getInt("matk"),"#d")+"#k │\r\n#k");
string.append("├------------------------------------------------┤\r\n");
string.append("│ #e잠재능력 : "+잠재능력(rs.getInt("state"))+"#n#k │\r\n");
string.append("│ #e잠재옵션 1~3 : #n"+정렬(rs.getInt("potential1"),"")+" · "+정렬(rs.getInt("potential2"),"")+" · "+정렬(rs.getInt("potential3"),"")+" #k│\r\n");
string.append("│ #e에디셔널 1~3 : #n"+정렬(rs.getInt("potential4"),"")+" · "+정렬(rs.getInt("potential5"),"")+" · "+정렬(rs.getInt("potential6"),"")+" #k│\r\n");
string.append("└------------------------------------------------┘\r\n");
var reqlev = ItemInformation.getInstance().getReqLevel(getItemInfo(uniqueid,"itemid"));
string.append(" #e아이템 착용레벨 : #n").append(reqlev < 10 ? "#Cgray#00#b"+reqlev : reqlev >= 10 && reqlev < 100 ? "#Cgray#0#b"+reqlev : "#b"+reqlev).append("\r\n");
var showenhance = "";;
if (rs.getInt("enhance") <= 0) {
showenhance = "";
}
for (var e = 0; e < rs.getInt("enhance"); e++) {
showenhance += star;
}
string.append("#k #eENHANCE : #n"+showenhance+"("+rs.getInt("enhance")+" 성)\r\n");
string.append(" #eUPGRADE : #r+"+rs.getInt("level")+" #n#k("+rs.getInt("upgradeslots")+" 회 남음) ");
string.append(" #i2470000# : #n").append(rs.getInt("ViciousHammer") == 0 ? "제련 안됨" : "제련 됨").append("\r\n");
select = "#b#L90#즉시 구매#l#L91#입찰";
cm.sendSimple(string.toString()+select);
} else {
select2 = "#b#L100#즉시 구매를 하겠습니다.\r\n#L101#입찰을 하겠습니다.\r\n";
cm.sendSimple("#e아이템 : #n#d#i"+getItemInfo(uniqueid,"itemid")+"# #t"+getItemInfo(uniqueid,"itemid")+"##k ("+getItemInfo(uniqueid,"quantity")+" 개)\r\n"+select2);
}
}
function getAuctionList(name,owner,type,buyer) {
var sql = "SELECT * FROM auction";
if (name != null) { sql += " WHERE name = ?"; }
if (owner != null) { sql += " WHERE owner = ?"; }
if (type != null) { sql += " WHERE type = ?"; }
if (buyer != null) { sql += " WHERE buyer = ?"; }
var con = MYSQL.getConnection().prepareStatement(sql);
if (name != null) { con.setString(1,name);
} else if (owner != null) { con.setString(1,owner);
} else if (type != null) { con.setString(1,type);
} else if (buyer != null) { con.setString(1,buyer); }
var rs = con.executeQuery();
var i = 0, string = new StringBuilder();
while (rs.next()) {
i++;
var show = buyer != null ? "구매한 아이템 리스트입니다.\r\n\r\n" : name != null ? "검색결과에 따른 아이템 리스트입니다.\r\n\r\n" : owner != null ? "#h #님이 등록한 아이템 리스트입니다.\r\n\r\n" : "등록된 아이템 리스트입니다. ("+type+")\r\n\r\n";
uniqueid = rs.getInt("uniqueid");
time = (rs.getLong("expiration") - System.currentTimeMillis()) / 1000;
var sec = time % 60;
var total = (time - sec);
var min = (total / 60) % 60;
var hour = Math.floor((total - (sec + min)) / 3600);
hour = hour % 24;
var day = Math.floor(time / (60 * 60 * 24));
if (hour < 10) { hour = "0"+hour; }
if (min < 10) { min = "0"+min; }
var expiration = time > 0 ? "#r"+day+"日 "+hour+":"+min+" 남음" : "#Cgray#종료된 경매";
var item = MYSQL.getConnection().prepareStatement("SELECT * FROM inventoryitems WHERE uniqueid = ?");
item.setInt(1,uniqueid);
var eq = item.executeQuery();
eq.next();
itemId = eq.getInt("itemid");
string.append("#L"+uniqueid+"##b("+Integer(i)+") #i"+itemId+"# #k#t"+itemId+"# ("+expiration+"#k)\r\n\r\n");
string.append("#l └ #d즉구 : "+getPrice(uniqueid,2)+" 메소 #k| #b입찰 : "+getPrice(uniqueid,1)+" 메소\r\n");
}
if (i != 0) {
cm.sendSimple(show+string.toString());
} else {
cm.sendOk("등록된 아이템이 없습니다.");
cm.dispose();
}
}
function getPrice(uniqueid,type) {
var ps = MYSQL.getConnection().prepareStatement("SELECT * FROM auction WHERE uniqueid = ?");
ps.setInt(1,uniqueid);
var rs = ps.executeQuery(); rs.next();
price = rs.getString("price").split(",");
return type == 1 ? price[0] : price[1];
}
function getInvId(uniqueid) {
var ps = MYSQL.getConnection().prepareStatement("SELECT * FROM inventoryitems WHERE uniqueid = ?");
ps.setInt(1,uniqueid);
var rs = ps.executeQuery();
rs.next(); return rs.getInt("inventoryitemid");
}
function getItemInfo(uniqueid,type) {
var ps = MYSQL.getConnection().prepareStatement("SELECT * FROM auction WHERE uniqueid = ?");
ps.setInt(1,uniqueid);
var rs = ps.executeQuery();
rs.next();
return type == "owner" || type == "buyer" || type == "type" ? rs.getString(type) : rs.getLong(type);
}
function gainOwnerMeso(meso,owner) {
meso = Long.parseLong(meso);
var upd = MYSQL.getConnection().prepareStatement("UPDATE auctionmeso SET meso = ? WHERE name = ?");
upd.setLong(1,(getAuctionMeso(owner) + meso));
upd.setString(2,owner);
upd.executeUpdate();
}
function getItem(type,slot) {
return cm.getPlayer().getInventory(type).getItem(slot);
}
function getType(type) {
return type == 1 ? BelowInventoryType.EQUIP : type == 2 ? BelowInventoryType.USE : type == 3 ? BelowInventoryType.SETUP : type == 4 ? BelowInventoryType.ETC : BelowInventoryType.CASH;
}
function optionFinder(option,lev) {
var itemData = BelowDataProviderFactory.getDataProvider(new File("wz/Item.wz"));
var pData = itemData.getData("ItemOption.img");
var pid = "0"+option;
var root = pData.getChildByPath(pid);
if (root == null) {
cm.sendOk("존재하지 않는 옵션값입니다.");
cm.dispose();
return;
}
var string = BelowDataTool.getString("info/string",root);
var level = lev == 0 ? 1 : lev / 10;
var optionroot = root.getChildByPath("level/"+Math.round(level)+"");
var option = optionroot.getChildren().get(0).getName();
option = BelowDataTool.getString(option,optionroot);
if (string.contains("#incSpeed")) { string = string.replace("#incSpeed",option);}
if (string.contains("#incJump")) { string = string.replace("#incJump",option);}
if (string.contains("prop")) { string = string.replace("#prop",option);}
if (string.contains("time")) { string = string.replace("#time",option);}
if (string.contains("#incCr")) { string = string.replace("#incCr",option);}
if (string.contains("#incDAMr")) { string = string.replace("#incDAMr",option);}
if (string.contains("#RecoveryHP")) { string = string.replace("#RecoveryHP",option);}
if (string.contains("#RecoveryMP")) { string = string.replace("#RecoveryMP",option);}
if (string.contains("#HP")) { string = string.replace("#HP",option);}
if (string.contains("#MP")) { string = string.replace("#MP",option);}
if (string.contains("#level")) { string = string.replace("#level",option);}
if (string.contains("#ignoreTargetDEF")) { string = string.replace("#ignoreTargetDEF",option);}
if (string.contains("#ignoreDAM")) { string = string.replace("#ignoreDAM",option);}
if (string.contains("#DAMreflect")) { string = string.replace("#DAMreflect",option);}
if (string.contains("#mpconReduce")) { string = string.replace("#mpconReduce",option);}
if (string.contains("#mpRestore")) { string = string.replace("#mpRestore",option);}
if (string.contains("#incMesoProp")) { string = string.replace("#incMesoProp",option);}
if (string.contains("#incRewardProp")) { string = string.replace("#incRewardProp",option);}
if (string.contains("#incAllskill")) { string = string.replace("#incAllskill",option);}
if (string.contains("#ignoreDAMr")) { string = string.replace("#ignoreDAMr",option);}
if (string.contains("#RecoveryUP")) { string = string.replace("#RecoveryUP",option);}
if (string.contains("#incSTR")) { if (string.contains("r")) {
string = string.replace("#incSTRr",option); } string = string.replace("#incSTR",option);}
if (string.contains("#incDEX")) { if (string.contains("r")) {
string = string.replace("#incDEXr",option); } string = string.replace("#incDEX",option);}
if (string.contains("#incINT")) { if (string.contains("r")) {
string = string.replace("#incINTr",option); } string = string.replace("#incINT",option);}
if (string.contains("#incLUK")) { if (string.contains("r")) {
string = string.replace("#incLUKr",option); } string = string.replace("#incLUK",option);}
if (string.contains("#incMHP")) { if (string.contains("r")) {
string = string.replace("#incMHPr",option); } string = string.replace("#incMHP",option);}
if (string.contains("#incMMP")) { if (string.contains("r")) {
string = string.replace("#incMMPr",option); } string = string.replace("#incMMP",option);}
if (string.contains("#incACC")) { if (string.contains("r")) {
string = string.replace("#incACCr",option); } string = string.replace("#incACC",option);}
if (string.contains("#incEVA")) { if (string.contains("r")) {
string = string.replace("#incEVAr",option); } string = string.replace("#incEVA",option);}
if (string.contains("#incPAD")) { if (string.contains("r")) {
string = string.replace("#incPADr",option); } string = string.replace("#incPAD",option);}
if (string.contains("#incMAD")) { if (string.contains("r")) {
string = string.replace("#incMADr",option); } string = string.replace("#incMAD",option);}
if (string.contains("#incPDD")) { if (string.contains("r")) {
string = string.replace("#incPDDr",option); } string = string.replace("#incPDD",option);}
if (string.contains("#incMDD")) { if (string.contains("r")) {
string = string.replace("#incMDDr",option); } string = string.replace("#incMDD",option);}
return string;
}
function gainEquip(invid,itemid) {
var equip = ItemInformation.getInstance().getEquipById(itemid);
var inv = MYSQL.getConnection().prepareStatement("SELECT * FROM inventoryequipment WHERE inventoryitemid = ?");
inv.setInt(1,invid);
var rs = inv.executeQuery();
var item = "";
rs.next();
var option = new Array("upgradeslots","level","str","dex","int","luk","hp","mp","watk","matk","wdef","mdef","acc","avoid","hands","speed","jump","ringid","ViciousHammer","itemLevel","itemEXP","durability","enhance","state","lines","potential1",
"potential2","potential3","potential4","potential5","potential6","anvil","hpR","mpR","potential7","fire","kanghwa","soonsak","downlevel","bossdmg","alldmgp","allstatp","IgnoreWdef","soulenchanter","soulname","soulskill");
for (var i = 0; i < option.length; i++) {
item += rs.getInt(option[i])+",";
}
item = item.split(",");
equip.setUpgradeSlots(item[0]); equip.setLevel(item[1]);
equip.setStr(item[2]); equip.setDex(item[3]); equip.setInt(item[4]); equip.setLuk(item[5]);
equip.setHp(item[6]); equip.setMp(item[7]); equip.setWatk(item[8]); equip.setMatk(item[9]);
equip.setWdef(item[10]); equip.setMdef(item[11]); equip.setAcc(item[12]); equip.setAvoid(item[13]);
equip.setHands(item[14]); equip.setSpeed(item[15]); equip.setJump(item[16]); equip.setRingId(item[17]);
equip.setViciousHammer(item[18]); equip.setItemLevel(item[19]); equip.setItemEXP(item[20]);
equip.setDurability(item[21]); equip.setEnhance(item[22]); equip.setState(item[23]); equip.setLines(item[24])
equip.setPotential1(item[25]); equip.setPotential2(item[26]); equip.setPotential3(item[27]);
equip.setPotential4(item[28]); equip.setPotential5(item[29]); equip.setPotential6(item[30]);
equip.setanvil(item[31]); equip.setHpR(item[32]); equip.setMpR(item[33]); equip.setPotential7(item[34]);
equip.setFire(item[35]); equip.setKangHwa(item[36]); equip.setsoonsak(item[37]); equip.setDownLevel(item[38]);
equip.setBossDamage(item[39]); equip.setAllDamageP(item[40]); equip.setAllStatP(item[41]); equip.setIgnoreWdef(item[42]);
equip.setSoulEnchanter(item[43]); equip.setSoulName(item[44]); equip.setSoulSkill(item[45]);
InventoryManipulator.addFromDrop(cm.getC(), equip, false);
}
function 정렬(text,color) {
if (text < 10) {
text = "#Cgray#0000"+color+""+text;
} else if (text >= 10 && text < 100) {
text = "#Cgray#000"+color+""+text;
} else if (text >= 100 && text < 1000) {
text = "#Cgray#00"+color+text;
} else if (text >= 1000 && text < 10000) {
text = "#Cgray#0"+color+text;
}
return color+text;
}
function 잠재능력(option) {
return option == 17 ? "#b레어잠재" : option == 18 ? "#d에픽잠재" : option == 19 ? "#Cyellow#유니크해" : option == 20 ? "#g레전드리" : option == 4 ? "#r정체불명" : "#k아예없음";
}

박인성 님의 최근 댓글