Guild & Alliances Patches
As reported by J0k3r613, patched guild system not recognizing properly the guild leader just after creation. Patched many more issues related to guilds and alliances.
This commit is contained in:
@@ -80,8 +80,8 @@ public class MapleExpedition {
|
||||
private MapleMap startMap;
|
||||
private ArrayList<String> bossLogs;
|
||||
private ScheduledFuture<?> schedule;
|
||||
private List<MapleCharacter> members = new ArrayList<MapleCharacter>();
|
||||
private List<MapleCharacter> banned = new ArrayList<MapleCharacter>();
|
||||
private List<MapleCharacter> members = new ArrayList<>();
|
||||
private List<Integer> banned = new ArrayList<>();
|
||||
private long startTime;
|
||||
|
||||
public MapleExpedition(MapleCharacter player, MapleExpeditionType met) {
|
||||
@@ -126,7 +126,7 @@ public class MapleExpedition {
|
||||
public void start(){
|
||||
registering = false;
|
||||
startMap.broadcastMessage(MaplePacketCreator.removeClock());
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, "The expedition has started! The expedition leader is waiting inside!"));
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, "The expedition has started! Good luck, brave heroes!"));
|
||||
startTime = System.currentTimeMillis();
|
||||
Server.getInstance().broadcastGMMessage(MaplePacketCreator.serverNotice(6, type.toString() + " Expedition started with leader: " + leader.getName()));
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class MapleExpedition {
|
||||
if (!registering){
|
||||
return "Sorry, this expedition is already underway. Registration is closed!";
|
||||
}
|
||||
if (banned.contains(player)){
|
||||
if (banned.contains(player.getId())){
|
||||
return "Sorry, you've been banned from this expedition by #b" + leader.getName() + "#k.";
|
||||
}
|
||||
if (members.size() >= type.getMaxSize()){ //Would be a miracle if anybody ever saw this
|
||||
@@ -155,7 +155,13 @@ public class MapleExpedition {
|
||||
}
|
||||
|
||||
public boolean removeMember(MapleCharacter chr) {
|
||||
return members.remove(chr);
|
||||
if(members.remove(chr)) {
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, chr.getName() + " has left the expedition."));
|
||||
chr.dropMessage(6, "You have left this expedition.");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public MapleExpeditionType getType() {
|
||||
@@ -192,9 +198,14 @@ public class MapleExpedition {
|
||||
}
|
||||
|
||||
public void ban(MapleCharacter player) {
|
||||
if (!banned.contains(player)) {
|
||||
banned.add(player);
|
||||
if (!banned.contains(player.getId())) {
|
||||
banned.add(player.getId());
|
||||
members.remove(player);
|
||||
|
||||
broadcastExped(MaplePacketCreator.serverNotice(6, player.getName() + " has been banned from the expedition."));
|
||||
|
||||
player.announce(MaplePacketCreator.removeClock());
|
||||
player.dropMessage(6, "You have been banned from this expedition.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ public class MapleMap {
|
||||
private Collection<MapleCharacter> characters = new LinkedHashSet<>();
|
||||
private Map<Integer, MaplePortal> portals = new HashMap<>();
|
||||
private Map<Integer, Integer> backgroundTypes = new HashMap<>();
|
||||
private Map<String, Integer> environment = new LinkedHashMap<String, Integer>();
|
||||
private List<Rectangle> areas = new ArrayList<>();
|
||||
private MapleFootholdTree footholds = null;
|
||||
private int mapid;
|
||||
@@ -252,6 +253,28 @@ public class MapleMap {
|
||||
objectRLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public final void limitReactor(final int rid, final int num) {
|
||||
List<MapleReactor> toDestroy = new ArrayList<>();
|
||||
Map<Integer, Integer> contained = new LinkedHashMap<>();
|
||||
|
||||
for (MapleMapObject obj : getReactors()) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
if (contained.containsKey(mr.getId())) {
|
||||
if (contained.get(mr.getId()) >= num) {
|
||||
toDestroy.add(mr);
|
||||
} else {
|
||||
contained.put(mr.getId(), contained.get(mr.getId()) + 1);
|
||||
}
|
||||
} else {
|
||||
contained.put(mr.getId(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (MapleReactor mr : toDestroy) {
|
||||
destroyReactor(mr.getObjectId());
|
||||
}
|
||||
}
|
||||
|
||||
public int getForcedReturnId() {
|
||||
return forcedReturnMap;
|
||||
@@ -837,6 +860,22 @@ public class MapleMap {
|
||||
killMonster(monster, null, false, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public final void destroyReactors(final int first, final int last) {
|
||||
List<MapleReactor> toDestroy = new ArrayList<>();
|
||||
List<MapleMapObject> reactors = getReactors();
|
||||
|
||||
for (MapleMapObject obj : reactors) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
if (mr.getId() >= first && mr.getId() <= last) {
|
||||
toDestroy.add(mr);
|
||||
}
|
||||
}
|
||||
|
||||
for (MapleReactor mr : toDestroy) {
|
||||
destroyReactor(mr.getObjectId());
|
||||
}
|
||||
}
|
||||
|
||||
public void destroyReactor(int oid) {
|
||||
final MapleReactor reactor = getReactorByOid(oid);
|
||||
@@ -897,6 +936,25 @@ public class MapleMap {
|
||||
objectRLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public final void shuffleReactors(int first, int last) {
|
||||
List<Point> points = new ArrayList<>();
|
||||
List<MapleMapObject> reactors = getReactors();
|
||||
List<MapleMapObject> targets = new LinkedList<>();
|
||||
|
||||
for (MapleMapObject obj : reactors) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
if (mr.getId() >= first && mr.getId() <= last) {
|
||||
points.add(mr.getPosition());
|
||||
targets.add(obj);
|
||||
}
|
||||
}
|
||||
Collections.shuffle(points);
|
||||
for (MapleMapObject obj : targets) {
|
||||
MapleReactor mr = (MapleReactor) obj;
|
||||
mr.setPosition(points.remove(points.size() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Automagically finds a new controller for the given monster from the chars
|
||||
@@ -2035,6 +2093,27 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// \/\/\/\/\/\/ CWKPQ things \/\/\/\/\/\/
|
||||
|
||||
public final void toggleEnvironment(final String ms) {
|
||||
if (environment.containsKey(ms)) {
|
||||
moveEnvironment(ms, environment.get(ms) == 1 ? 2 : 1);
|
||||
} else {
|
||||
moveEnvironment(ms, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public final void moveEnvironment(final String ms, final int type) {
|
||||
broadcastMessage(MaplePacketCreator.environmentChange(ms, type));
|
||||
environment.put(ms, type);
|
||||
}
|
||||
|
||||
public final Map<String, Integer> getEnvironment() {
|
||||
return environment;
|
||||
}
|
||||
|
||||
// /\/\/\/\/\/\/\ CWKPQ things /\/\/\/\/\/\
|
||||
|
||||
public String getMapName() {
|
||||
return mapName;
|
||||
|
||||
Reference in New Issue
Block a user