- Joined
- Apr 29, 2008
- Messages
- 1,297
- Reaction score
- 509
This is probably a different guild hangout compared to others.
Here was the initial plan of it :
Requirements :
500,000,000 mesos per map. Increase of 300,000,000 everytime bought
****000,000 mesos to make private or public.
300,000,000 mesos per NPC.
50,000,000 mesos for every monster below level 50. No bosses
250,000,000 for monsters level 100 and below. No bosses
How It Works :
- Players must be in a guild and must be the Guild Leader.
- Players can then buy maps via NPC and make them public / private.
*- Private maps will only allow your guildmates or GM's to enter.
*- Public maps would allow anyone to enter the map.
- Players can also put NPC's in their guild map.
- The spawns are strictly normal monsters. The spawn time will be 2 minute each.
- When someone buys the map, all the monster and NPC in the map will be kept in storage.
- When entered the map, it'll send a notice on who it belongs if it has an owner.
Oh, and i think the monster part where it loads from storage is somehow bugged i think. Not sure. I made this cause i had nothing else to do. This was made some time back and I think its not properly coded
. At least this will give you ideas anyway.
GuildHangoutHandler.java
GuildHangoutCommands
MapleMapFactory
getMap
MapleMap
MapleCharacter
changeMapInternal
I'm not sure if i left something out.
But the important things are there
EDIT : Left out SQL
Here was the initial plan of it :
Requirements :
500,000,000 mesos per map. Increase of 300,000,000 everytime bought
****000,000 mesos to make private or public.
300,000,000 mesos per NPC.
50,000,000 mesos for every monster below level 50. No bosses
250,000,000 for monsters level 100 and below. No bosses
How It Works :
- Players must be in a guild and must be the Guild Leader.
- Players can then buy maps via NPC and make them public / private.
*- Private maps will only allow your guildmates or GM's to enter.
*- Public maps would allow anyone to enter the map.
- Players can also put NPC's in their guild map.
- The spawns are strictly normal monsters. The spawn time will be 2 minute each.
- When someone buys the map, all the monster and NPC in the map will be kept in storage.
- When entered the map, it'll send a notice on who it belongs if it has an owner.
Oh, and i think the monster part where it loads from storage is somehow bugged i think. Not sure. I made this cause i had nothing else to do. This was made some time back and I think its not properly coded

GuildHangoutHandler.java
Code:
/*
* @author Xerixe.
*
*/
package net.sf.odinms.net.channel.handler;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.database.DatabaseConnection;
import net.sf.odinms.net.MaplePacket;
import net.sf.odinms.server.life.MapleLifeFactory;
import net.sf.odinms.server.life.MapleMonster;
import net.sf.odinms.server.life.MapleMonsterInformationProvider;
import net.sf.odinms.server.life.MapleNPC;
import net.sf.odinms.server.maps.MapleMap;
import net.sf.odinms.tools.MaplePacketCreator;
/**
*
* @author Xerixe
*
*/
public class GuildHangoutHandler {
public static void buyMap(MapleClient c, int map) {
if (c.getChannelServer().getMapFactory().getMap(map).isOwned()) {
int price = c.getChannelServer().getMapFactory().getMap(map).getPrice();
MapleMap targetMap = c.getChannelServer().getMapFactory().getMap(map);
if (c.getPlayer().getMeso() >= price && c.getPlayer().getGuildRank() == 1) {
targetMap.saveNPCS(targetMap.getOwner());
if (!targetMap.isPubic()) {
targetMap.setPublic(true);
}
targetMap.removeNpcs();
targetMap.removeMobs();
targetMap.setOwner(c.getPlayer().getGuild().getName());
c.getPlayer().gainMeso(-price);
targetMap.setPrice(price + 300000000);
targetMap.setPublic(true);
targetMap.saveGuildMaps(false);
MaplePacket packet = MaplePacketCreator.serverNotice(6, "[Guild Territory] " + c.getPlayer().getGuild().getName() + " has just taken over the territory of the " + targetMap.getOwner() + " in " + c.getChannelServer().getMapFactory().getMap(map).getMapName());
try {
c.getChannelServer().getWorldInterface().broadcastMessage(c.getPlayer().getName(), packet.getBytes());
} catch (RemoteException e) {
c.getChannelServer().reconnectWorld();
}
} else {
c.getPlayer().dropMessage("You must have " + price + " to buy this map and must be the Guild Master.");
}
} else {
int price = 500000000;
MapleMap targetMap = c.getChannelServer().getMapFactory().getMap(map);
if (c.getPlayer().getMeso() >= price && c.getPlayer().getGuildRank() == 1) {
targetMap.setOwner(c.getPlayer().getGuild().getName());
c.getPlayer().gainMeso(-price);
targetMap.setPrice(price + 300000000);
targetMap.setPublic(true);
targetMap.setOwned(true);
targetMap.saveGuildMaps(true);
MaplePacket packet = MaplePacketCreator.serverNotice(6, "[Guild Territory] " + c.getPlayer().getGuild().getName() + " has just owned " + c.getChannelServer().getMapFactory().getMap(map).getMapName());
try {
c.getChannelServer().getWorldInterface().broadcastMessage(c.getPlayer().getName(), packet.getBytes());
} catch (RemoteException e) {
c.getChannelServer().reconnectWorld();
}
c.getChannelServer().getMapFactory().getMap(map).saveGuildMaps(true);
} else {
c.getPlayer().dropMessage("You must have " + price + " to buy this map and must be the Guild Master.");
}
}
}
public static void setState(MapleClient c, int map) {
int price = 100000000;
MapleMap targetMap = c.getChannelServer().getMapFactory().getMap(map);
if (!targetMap.isOwned()) {
return;
}
if (c.getPlayer().getMeso() <= price) {
c.getPlayer().dropMessage("You need to have at least ****000,000 mesars to do this.");
return;
}
targetMap.setPublic(!targetMap.isPubic());
c.getPlayer().gainMeso(-price);
targetMap.saveGuildMaps(false);
}
public static void buyMonster(MapleClient c, int mobId) {
MapleMonster mob = MapleLifeFactory.getMonster(mobId);
if (mob != null && !mob.getName().equals("MISSINGNO") && !mob.isBoss() && mob.getLevel() <= 100 && c.getPlayer().getMeso() >= 50000000) {
if (mob.getLevel() <= 50) {
int price = 50000000;
addMonster(c, mobId);
c.getPlayer().gainMeso(-price);
} else {
int price = 250000000;
if (c.getPlayer().getMeso() >= price) {
addMonster(c, mobId);
c.getPlayer().gainMeso(-price);
} else {
c.getPlayer().dropMessage("You need at least 250,000,000 mesos to add a monster not more than the level 100.");
}
}
} else {
c.getPlayer().dropMessage("You need to have at least 50,000,000 mesos and the monster must be existant and not being a boss which level must not be greater than 100.");
}
}
public static void addMonster(MapleClient c, int mobId) {
int mobTime = 120000;
MapleMonster mob = MapleLifeFactory.getMonster(mobId);
if (mob != null && !mob.getName().equals("MISSINGNO")) { //Just to be sure :P
mob.setPosition(c.getPlayer().getPosition());
mob.setCy(c.getPlayer().getPosition().y);
mob.setRx0(c.getPlayer().getPosition().x + 50);
mob.setRx1(c.getPlayer().getPosition().x - 50);
mob.setFh(c.getPlayer().getMap().getFootholds().findBelow(c.getPlayer().getPosition()).getId());
Connection con = DatabaseConnection.getConnection();
try {
PreparedStatement ps = con.prepareStatement("INSERT INTO spawns ( idd, f, fh, cy, rx0, rx1, type, x, y, mid, mobtime ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )");
ps.setInt(1, mobId);
ps.setInt(2, 0);
ps.setInt(3, c.getPlayer().getMap().getFootholds().findBelow(c.getPlayer().getPosition()).getId());
ps.setInt(4, c.getPlayer().getPosition().y);
ps.setInt(5, c.getPlayer().getPosition().x + 50);
ps.setInt(6, c.getPlayer().getPosition().x - 50);
ps.setString(7, "m");
ps.setInt(8, c.getPlayer().getPosition().x);
ps.setInt(9, c.getPlayer().getPosition().y);
ps.setInt(10, c.getPlayer().getMapId());
ps.setInt(11, mobTime);
ps.executeUpdate();
c.getPlayer().getMap().addMonsterSpawn(mob, mobTime);
} catch (SQLException e) {
System.out.print("Error occured when adding monster. Error : " + e);
}
}
}
public static void buyNpc(MapleClient c, int npcId) {
MapleNPC npc = MapleLifeFactory.getNPC(npcId);
if (c.getPlayer().getMeso() <= 300000000) {
c.getPlayer().dropMessage("You need at least 300,000,000 mesos to buy an NPC");
return;
}
int xpos = c.getPlayer().getPosition().x;
int ypos = c.getPlayer().getPosition().y;
int fh = c.getPlayer().getMap().getFootholds().findBelow(c.getPlayer().getPosition()).getId();
if (npc != null && !npc.getName().equals("MISSINGNO")) {
npc.setPosition(c.getPlayer().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 guildspawns ( idd, f, fh, cy, rx0, rx1, type, x, y, mid, guild) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
ps.setInt(1, npcId);
ps.setInt(2, 0);
ps.setInt(3, fh);
ps.setInt(4, ypos);
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, c.getPlayer().getMapId());
ps.setString(11, c.getPlayer().getGuild().getName());
ps.executeUpdate();
ps.close();
} catch (SQLException e) {
c.getPlayer().dropMessage("Failed to save NPC to the database");
}
c.getPlayer().getMap().addMapObject(npc);
c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.spawnNPC(npc));
c.getPlayer().gainMeso(-300000000);
} else {
c.getPlayer().dropMessage("You have entered an invalid Npc-Id");
}
}
public static boolean hasHiddenNPC(String guild) {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM guildspawns WHERE hidden = 1 AND guild = ?");
ps.setString(1, guild);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
ps.close();
rs.close();
return true;
}
ps.close();
rs.close();
} catch (SQLException e) {
}
return false;
}
public static void replaceHiddenNPCS(MapleClient c, String guild, int newMap) {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM guildspawns WHERE hidden = 1 AND guild = ?");
ps.setString(1, guild);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int map = rs.getInt("mid");
PreparedStatement psx = con.prepareStatement("UPDATE guildspawns SET mid = ? WHERE mid = ? AND guild = ?");
psx.setInt(1, newMap);
psx.setInt(2, map);
psx.setString(3, guild);
psx.executeUpdate();
psx.close();
ps.close();
rs.close();
}
ps.close();
rs.close();
} catch (SQLException e) {
}
}
public static boolean checkAlliance(MapleClient c, String guild) {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM guilds where name = ?");
ps.setString(1, c.getPlayer().getGuild().getName());
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int eId = rs.getInt("guildid");
ps.close();
rs.close();
PreparedStatement psx = con.prepareStatement("SELECT * FROM alliance WHERE guild1 = ? OR guild2 = ? OR guild3 = ? OR guild4 = ? OR guild5 = ?");
psx.setInt(1, eId);
psx.setInt(2, eId);
psx.setInt(3, eId);
psx.setInt(4, eId);
psx.setInt(5, eId);
ResultSet rsx = psx.executeQuery();
while (rsx.next()) {
int aId = rs.getInt("id");
rsx.close();
psx.close();
PreparedStatement psa = con.prepareStatement("SELECT * FROM guilds where name = ?");
psa.setString(1, guild);
ResultSet rsa = psa.executeQuery();
while (rsa.next()) {
int id = rs.getInt("allianceId");
if (aId == id) {
rsa.close();
psa.close();
return true;
}
}
rsa.close();
psa.close();
}
rsx.close();
psx.close();
}
ps.close();
rs.close();
} catch (Exception e) {
return false;
}
return false;
}
}
GuildHangoutCommands
Code:
/*
* Made and created by Xerixe.
* MSN : [email protected] / -Removed-
* Website : -Removed-
*
*/
package net.sf.odinms.client.messages.commands;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import net.sf.odinms.client.MapleCharacter;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.client.messages.Command;
import net.sf.odinms.client.messages.CommandDefinition;
import net.sf.odinms.client.messages.MessageCallback;
import net.sf.odinms.net.channel.handler.GuildHangoutHandler;
import net.sf.odinms.provider.MapleData;
import net.sf.odinms.provider.MapleDataProvider;
import net.sf.odinms.provider.MapleDataProviderFactory;
import net.sf.odinms.provider.MapleDataTool;
import net.sf.odinms.server.maps.MapleMap;
import net.sf.odinms.tools.Pair;
import net.sf.odinms.tools.StringUtil;
/**
*
* @author Xerixe
*
*/
public class GuildHangoutCommands implements Command {
@Override
public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
splitted[0] = splitted[0].toLowerCase();
MapleCharacter player = c.getPlayer();
if (c.getPlayer().getGuildRank() != 1) {
mc.dropMessage("You need to be the Guild Master to use Guild Hangout Commands.");
return;
}
if (splitted[0].equalsIgnoreCase("@buymap")) {
if (splitted.length == 1) {
GuildHangoutHandler.buyMap(c, c.getPlayer().getMapId());
if (GuildHangoutHandler.hasHiddenNPC(c.getPlayer().getGuild().getName())) {
GuildHangoutHandler.replaceHiddenNPCS(c, c.getPlayer().getGuild().getName(), c.getPlayer().getMapId());
}
return;
}
HashMap<String, Integer> maps = new HashMap<String, Integer>();
maps.put("fm7", 910000007);
maps.put("fm8", 910000008);
maps.put("fm9", 910000009);
maps.put("fm10", 910000010);
maps.put("fm11", 910000011);
maps.put("fm12", 910000012);
maps.put("fm13", 910000013);
maps.put("fm14", 910000014);
maps.put("fm15", 910000015);
maps.put("fm16", 910000016);
maps.put("fm17", 910000017);
maps.put("fm18", 910000018);
maps.put("fm19", 910000019);
maps.put("fm20", 910000020);
maps.put("fm21", 910000021);
maps.put("fm22", 910000022);
if (!maps.containsKey(splitted[1].toLowerCase())) {
mc.dropMessage("Please use @buymap <fm7 - fm22>");
maps.clear();
return;
}
MapleMap target = c.getChannelServer().getMapFactory().getMap(maps.get(splitted[1]));
GuildHangoutHandler.buyMap(c, target.getId());
if (GuildHangoutHandler.hasHiddenNPC(c.getPlayer().getGuild().getName())) {
GuildHangoutHandler.replaceHiddenNPCS(c, c.getPlayer().getGuild().getName(), maps.get(splitted[1]));
}
maps.clear();
} else if (splitted[0].equalsIgnoreCase("@state")) {
if (!(player.getMapId() >= 910000007 && player.getMapId() <= 910000024)) {
mc.dropMessage("You must be in a Guild Hangout Map. FM Room 7 to FM Room 22.");
return;
}
if (!c.getChannelServer().getMapFactory().getMap(player.getMapId()).getOwner().matches(c.getPlayer().getGuild().getName())) {
mc.dropMessage("You must own the map to do this.");
return;
}
GuildHangoutHandler.setState(c, player.getMapId());
} else if (splitted[0].equalsIgnoreCase("@buynpc")) {
if (!(player.getMapId() >= 910000007 && player.getMapId() <= 910000024)) {
mc.dropMessage("You must be in a Guild Hangout Map. FM Room 7 to FM Room 22.");
return;
}
if (!c.getChannelServer().getMapFactory().getMap(player.getMapId()).getOwner().matches(c.getPlayer().getGuild().getName())) {
mc.dropMessage("You must own the map to do this.");
return;
}
GuildHangoutHandler.buyNpc(c, Integer.parseInt(splitted[1]));
} else if (splitted[0].equals("@buymob")) {
if (!(player.getMapId() >= 910000007 && player.getMapId() <= 910000024)) {
mc.dropMessage("You must be in a Guild Hangout Map. FM Room 7 to FM Room 22.");
return;
}
if (c.getPlayer().getMap().getOwner().equals(c.getPlayer().getGuild().getName())) {
int mobId = Integer.parseInt(splitted[1]);
GuildHangoutHandler.buyMonster(c, mobId);
} else {
mc.dropMessage("You must own the map to continue.");
}
} else if (splitted[0].equalsIgnoreCase("@npcid")) {
List<String> retNpcs = new ArrayList<String>();
MapleData data = null;
MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("net.sf.odinms.wzpath") + "/" + "String.wz"));
String search = StringUtil.joinStringFrom(splitted, 1);
if (search.length() < 4) {
mc.dropMessage("Please enter at least 3 letters.");
}
data = dataProvider.getData("Npc.img");
List<Pair<Integer, String>> npcPairList = new LinkedList<Pair<Integer, String>>();
for (MapleData npcIdData : data.getChildren()) {
int npcIdFromData = Integer.parseInt(npcIdData.getName());
String npcNameFromData = MapleDataTool.getString(npcIdData.getChildByPath("name"), "NO-NAME");
npcPairList.add(new Pair<Integer, String>(npcIdFromData, npcNameFromData));
}
for (Pair<Integer, String> npcPair : npcPairList) {
if (npcPair.getRight().toLowerCase().contains(search.toLowerCase())) {
retNpcs.add(npcPair.getLeft() + " - " + npcPair.getRight());
}
}
if (retNpcs != null && retNpcs.size() > 0) {
for (String singleRetNpc : retNpcs) {
mc.dropMessage(singleRetNpc);
}
} else {
mc.dropMessage("No NPC's Found");
}
} else if (splitted[0].equals("@mobid")) {
String search = StringUtil.joinStringFrom(splitted, 2);
MapleData data = null;
MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("net.sf.odinms.wzpath") + "/" + "String.wz"));
List<String> retMobs = new ArrayList<String>();
data = dataProvider.getData("Mob.img");
List<Pair<Integer, String>> mobPairList = new LinkedList<Pair<Integer, String>>();
for (MapleData mobIdData : data.getChildren()) {
int mobIdFromData = Integer.parseInt(mobIdData.getName());
String mobNameFromData = MapleDataTool.getString(mobIdData.getChildByPath("name"), "NO-NAME");
mobPairList.add(new Pair<Integer, String>(mobIdFromData, mobNameFromData));
}
for (Pair<Integer, String> mobPair : mobPairList) {
if (mobPair.getRight().toLowerCase().contains(search.toLowerCase())) {
retMobs.add(mobPair.getLeft() + " - " + mobPair.getRight());
}
}
if (retMobs != null && retMobs.size() > 0) {
for (String singleRetMob : retMobs) {
mc.dropMessage(singleRetMob);
}
} else {
mc.dropMessage("No Mob's Found");
}
} else if (splitted[0].equalsIgnoreCase("@gcommands")) {
mc.dropMessage("@buymap ~ Buys the current map.");
mc.dropMessage("@state ~ Change it from public to private.");
mc.dropMessage("@npcid <Npc Name> ~ Searchs the npc id of the NPC.");
mc.dropMessage("@mobid <Mob Name> ~ Searchs the mob id of the monster.");
mc.dropMessage("@buynpc <npc id> ~ Buys a specified NPC.");
}
}
@Override
public CommandDefinition[] getDefinition() {
return new CommandDefinition[]{
new CommandDefinition("buymap", "", "Buys your current map.", 0),
new CommandDefinition("state", "", "Changes from public to private or vise versa", 0),
new CommandDefinition("buynpc", "", "Buys a NPC.", 0),
new CommandDefinition("buymob", "", "Buys a Monster", 0),
new CommandDefinition("npcid", "", "Searchs for NPC id", 0),
new CommandDefinition("npcid", "", "Searchs for monster id", 0),
new CommandDefinition("gcommands", "", "Lists out the list of commands for Guild Hangouts", 0)
};
}
}
MapleMapFactory
getMap
Code:
try { //Start of Guild Hangouts Spawns
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM guildspawns WHERE mid = ? AND hidden = 0;");
ps.setInt(1, omapid);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int id = rs.getInt("idd");
int f = rs.getInt("f");
boolean hide = false;
String type = rs.getString("type");
int fh = rs.getInt("fh");
int cy = rs.getInt("cy");
int rx0 = rs.getInt("rx0");
int rx1 = rs.getInt("rx1");
int x = rs.getInt("x");
int y = rs.getInt("y");
int mobTime = rs.getInt("mobtime");
AbstractLoadedMapleLife myLife = loadLife(id, f, hide, fh, cy, rx0, rx1, x, y, type);
if (type.equals("n")) {
map.addMapObject(myLife);
} else if (type.equals("m")) {
MapleMonster monster = (MapleMonster) myLife;
map.addMonsterSpawn(monster, mobTime);
}
}
ps.close();
rs.close();
} catch (SQLException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
try { //Guild Hangouts Info
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM guildmaps WHERE map = ?");
ps.setInt(1, omapid);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
String owner = rs.getString("owner");
int price = rs.getInt("price");
boolean pubic = rs.getInt("public") == 0 ? false : true;
map.setPrice(price);
map.setOwner(owner);
map.setOwned(true);
map.setPublic(!pubic);
}
ps.close();
rs.close();
} catch (SQLException e) {
log.error("Error occured in " + e, e);
}
MapleMap
Code:
private boolean hasOwner = false;
private boolean Public = true;
Code:
public boolean isOwned() {
return this.hasOwner;
}
public void setOwned(boolean owner) {
this.hasOwner = owner;
}
public void setOwnerByName(MapleCharacter gm) {
this.owner = gm.getGuild().getName();
}
public void setOwner(String name) {
this.owner = name;
}
public String getOwner() {
return this.owner;
}
public boolean isPubic() {
return this.Public;
}
public void setPublic(boolean pubic) {
this.Public = pubic;
}
public void setPrice(int price) {
this.mapPrice = price;
}
public int getPrice() {
return this.mapPrice;
}
public void saveGuildMaps(boolean full) {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps;
if (full) {
ps = con.prepareStatement("INSERT INTO guildmaps (map, owner, price, `public`, owned) VALUES (?, ?, ?, ?, ? );");
ps.setInt(1, this.mapid);
ps.setString(2, this.owner);
ps.setInt(3, this.mapPrice);
ps.setInt(4, Public ? 1: 0);
ps.setInt(5, hasOwner ? 1: 0);
ps.execute();
} else {
ps = con.prepareStatement("UPDATE guildmaps SET owner = ? WHERE map = ?");
ps.setString(1, this.owner);
ps.setInt(2, this.mapid);
ps.execute();
ps.close();
ps = con.prepareStatement("UPDATE guildmaps SET price = ? where map = ?");
ps.setInt(1, this.mapPrice);
ps.setInt(2, this.mapid);
ps.close();
ps = con.prepareStatement("UPDATE guildmaps SET `public` where map = ?");
ps.setInt(1, this.Public ? 1 : 0);
ps.setInt(2, this.mapid);
ps.close();
}
} catch (SQLException e) {
}
}
public void saveNPCS(String owner) {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps;
ps = con.prepareStatement("UPDATE guildspawns SET hidden = 1 WHERE guild = ?");
ps.setString(1, this.owner);
} catch (SQLException e) {
}
}
MapleCharacter
changeMapInternal
Code:
if (to.isOwned()) {
if (to.isOwned() && !to.isPubic() && !(this.getGMLevel() > 2)) {
if (this.getGuild() != null) {
if (!GuildHangoutHandler.checkAlliance(this.getClient(), to.getOwner())) {
if (!this.getGuild().getName().matches(to.getOwner())) {
this.dropMessage("You step into the portal, but it swiftly kicks you out.");
this.dropMessage("There was a sign saying Keep Out! Property Of : " + to.getOwner());
return;
}
}
} else {
this.dropMessage("You step into the portal, but it swiftly kicks you out.");
this.dropMessage("There was a sign saying Keep Out! Property Of : " + to.getOwner());
return;
}
} else if (to.isOwned() && !this.getGuild().getName().matches(to.getOwner())) {
this.dropMessage("You have entered the territory of the " + to.getOwner());
} else {
this.dropMessage("Welcome to your guild's territory!");
}
}
if (to.isClosed() && !(this.getGMLevel() > 1)) {
this.dropMessage(5, "You cannot enter the event now. Please try again later.");
return;
}
I'm not sure if i left something out.
But the important things are there
EDIT : Left out SQL
Code:
CREATE TABLE `GuildSpawns` (
`id` int(11) NOT NULL auto_increment,
`idd` int(11) NOT NULL,
`f` int(11) NOT NULL,
`fh` int(11) NOT NULL,
`type` varchar(1) NOT NULL,
`cy` int(11) NOT NULL,
`rx0` int(11) NOT NULL,
`rx1` int(11) NOT NULL,
`x` int(11) NOT NULL,
`y` int(11) NOT NULL,
`mobtime` int(11) default '1000',
`mid` int(11) NOT NULL,
`hidden` tinyint(1) NOT Null default 0,
`guild` varchar(15) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `guildmaps` (
`id` INTEGER UNSIGNED AUTO_INCREMENT,
`map` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`owner` VARCHAR(15) DEFAULT NULL,
`price` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`public` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`owned` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`npcs` INTEGER UNSIGNED NOT NULL DEFAULT 0,
`mobs` INTEGER UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
)
ENGINE = InnoDB;
Last edited: