Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- } else if (sub[0].equals("!pnpc")) {
- int npcId = Integer.parseInt(sub[1]);
- MapleNPC npc = MapleLifeFactory.getNPC(npcId);
- int xpos = player.getPosition().x;
- int ypos = player.getPosition().y;
- int fh = player.getMap().getFootholds().findBelow(player.getPosition()).getId();
- if (npc != null && !npc.getName().equals("MISSINGNO")) {
- npc.setPosition(player.getPosition());
- npc.setCy(ypos);
- npc.setRx0(xpos + 50);
- npc.setRx1(xpos - 50);
- npc.setFh(fh);
- npc.setCustom(true);
- try {
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("INSERT INTO spawns ( idd, f, fh, cy, rx0, rx1, type, x, y, mid ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )");
- ps.setInt(1, npcId);
- ps.setInt(2, 0);
- ps.setInt(3, fh);
- ps.setInt(4, ypos);
- ps.setInt(5, xpos + 50);
- ps.setInt(6, xpos - 50);
- ps.setString(7, "n");
- ps.setInt(8, xpos);
- ps.setInt(9, ypos);
- ps.setInt(10, player.getMapId());
- ps.executeUpdate();
- } catch (SQLException e) {
- mc.dropMessage("Failed to save NPC to the database");
- }
- player.getMap().addMapObject(npc);
- player.getMap().broadcastMessage(MaplePacketCreator.spawnNPC(npc));
- } else {
- mc.dropMessage("You have entered an invalid Npc-Id");
- }
- } else if (sub[0].equals("!pmob")) {
- int npcId = Integer.parseInt(sub[1]);
- int mobTime = Integer.parseInt(sub[2]);
- int xpos = player.getPosition().x;
- int ypos = player.getPosition().y;
- int fh = player.getMap().getFootholds().findBelow(player.getPosition()).getId();
- if (sub[2] == null) {
- mobTime = 0;
- }
- MapleMonster mob = MapleLifeFactory.getMonster(npcId);
- if (mob != null && !mob.getName().equals("MISSINGNO")) {
- mob.setPosition(player.getPosition());
- mob.setCy(ypos);
- mob.setRx0(xpos + 50);
- mob.setRx1(xpos - 50);
- mob.setFh(fh);
- try {
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("INSERT INTO spawns ( idd, f, fh, cy, rx0, rx1, type, x, y, mid, mobtime ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )");
- ps.setInt(1, npcId);
- ps.setInt(2, 0);
- ps.setInt(3, fh);
- ps.setInt(4, ypos);
- ps.setInt(5, xpos + 50);
- ps.setInt(6, xpos - 50);
- ps.setString(7, "m");
- ps.setInt(8, xpos);
- ps.setInt(9, ypos);
- ps.setInt(10, player.getMapId());
- ps.setInt(11, mobTime);
- ps.executeUpdate();
- } catch (SQLException e) {
- mc.dropMessage("Failed to save MOB to the database");
- }
- player.getMap().addMonsterSpawn(mob, mobTime);
- } else {
- mc.dropMessage("You have entered an invalid Npc-Id");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement