Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d307eff71f | ||
|
|
b935725096 | ||
|
|
12248acd7b | ||
|
|
07eb0f5e8e | ||
|
|
cfb5fc25c3 | ||
|
|
3816e1c5bd |
@@ -92,14 +92,15 @@ public class DueyProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Pair<Integer, Integer> getAccountCharacterIdFromCNAME(String name) {
|
private static Pair<Integer, Integer> getAccountCharacterIdFromCNAME(String name) {
|
||||||
Pair<Integer, Integer> ids = null;
|
Pair<Integer, Integer> ids = new Pair<>(-1, -1);
|
||||||
try (Connection con = DatabaseConnection.getConnection();
|
try (Connection con = DatabaseConnection.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("SELECT id,accountid FROM characters WHERE name = ?")) {
|
PreparedStatement ps = con.prepareStatement("SELECT id,accountid FROM characters WHERE name = ?")) {
|
||||||
ps.setString(1, name);
|
ps.setString(1, name);
|
||||||
|
|
||||||
try (ResultSet rs = ps.executeQuery()) {
|
try (ResultSet rs = ps.executeQuery()) {
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
ids = new Pair<>(rs.getInt("accountid"), rs.getInt("id"));
|
ids.left = rs.getInt("accountid");
|
||||||
|
ids.right = rs.getInt("id");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@@ -315,30 +316,25 @@ public class DueyProcessor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair<Integer, Integer> accIdCid;
|
if(c.getPlayer().getMeso() < finalcost) {
|
||||||
if (c.getPlayer().getMeso() >= finalcost) {
|
|
||||||
accIdCid = getAccountCharacterIdFromCNAME(recipient);
|
|
||||||
int recipientAccId = accIdCid.getLeft();
|
|
||||||
if (recipientAccId != -1) {
|
|
||||||
if (recipientAccId == c.getAccID()) {
|
|
||||||
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_SAMEACC_ERROR.getCode()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NAME_DOES_NOT_EXIST.getCode()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NOT_ENOUGH_MESOS.getCode()));
|
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NOT_ENOUGH_MESOS.getCode()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int recipientCid = accIdCid.getRight();
|
var accIdCid = getAccountCharacterIdFromCNAME(recipient);
|
||||||
if (recipientCid == -1) {
|
var recipientAccId = accIdCid.getLeft();
|
||||||
|
var recipientCid = accIdCid.getRight();
|
||||||
|
|
||||||
|
if (recipientAccId == -1 || recipientCid == -1) {
|
||||||
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NAME_DOES_NOT_EXIST.getCode()));
|
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NAME_DOES_NOT_EXIST.getCode()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (recipientAccId == c.getAccID()) {
|
||||||
|
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_SAMEACC_ERROR.getCode()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (quick) {
|
if (quick) {
|
||||||
InventoryManipulator.removeById(c, InventoryType.CASH, ItemId.QUICK_DELIVERY_TICKET, (short) 1, false, false);
|
InventoryManipulator.removeById(c, InventoryType.CASH, ItemId.QUICK_DELIVERY_TICKET, (short) 1, false, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,23 @@ public class AbstractPlayerInteraction {
|
|||||||
warpParty(id, portalId, mapid, mapid);
|
warpParty(id, portalId, mapid, mapid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void warpParty(int map, String portalName) {
|
||||||
|
|
||||||
|
int mapid = getMapId();
|
||||||
|
var warpMap = c.getChannelServer().getMapFactory().getMap(map);
|
||||||
|
|
||||||
|
var portal = warpMap.getPortal(portalName);
|
||||||
|
|
||||||
|
if (portal == null) {
|
||||||
|
portal = warpMap.getPortal(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var portalId = portal.getId();
|
||||||
|
|
||||||
|
warpParty(map, portalId, mapid, mapid);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void warpParty(int id, int fromMinId, int fromMaxId) {
|
public void warpParty(int id, int fromMinId, int fromMaxId) {
|
||||||
warpParty(id, 0, fromMinId, fromMaxId);
|
warpParty(id, 0, fromMinId, fromMaxId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user