Quest & Command tweak + MapleCashDropFetcher + Cash drop tidyup
Solved a possible exploit on starting/completing non-scripted quests. Added missing drop data for Aran's puppeteer questline. Moved GM tier level of some commands. Applied proper synchronization for BuddyList modules. Issued commands now requires "@" heading for normal players and donators (GM level < 2) and "!" for Jr. GM and above (GM level >= 2). Added custom feature: a message will be sent to acquaintances of a player (friends, family, guild, spouse) when they change/upgrade jobs. Removed cash drop entries from the DB. New tool: MapleCashDropFetcher. Reports on a text file all cash-type drop data on DB.
This commit is contained in:
@@ -26,10 +26,12 @@ import java.sql.ResultSet;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import net.server.PlayerStorage;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
@@ -50,15 +52,22 @@ public class BuddyList {
|
||||
}
|
||||
|
||||
public boolean contains(int characterId) {
|
||||
return buddies.containsKey(Integer.valueOf(characterId));
|
||||
synchronized(buddies) {
|
||||
return buddies.containsKey(Integer.valueOf(characterId));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsVisible(int characterId) {
|
||||
BuddylistEntry ble = buddies.get(characterId);
|
||||
BuddylistEntry ble;
|
||||
synchronized(buddies) {
|
||||
ble = buddies.get(characterId);
|
||||
}
|
||||
|
||||
if (ble == null) {
|
||||
return false;
|
||||
}
|
||||
return ble.isVisible();
|
||||
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
@@ -70,42 +79,65 @@ public class BuddyList {
|
||||
}
|
||||
|
||||
public BuddylistEntry get(int characterId) {
|
||||
return buddies.get(Integer.valueOf(characterId));
|
||||
synchronized(buddies) {
|
||||
return buddies.get(Integer.valueOf(characterId));
|
||||
}
|
||||
}
|
||||
|
||||
public BuddylistEntry get(String characterName) {
|
||||
String lowerCaseName = characterName.toLowerCase();
|
||||
for (BuddylistEntry ble : buddies.values()) {
|
||||
for (BuddylistEntry ble : getBuddies()) {
|
||||
if (ble.getName().toLowerCase().equals(lowerCaseName)) {
|
||||
return ble;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void put(BuddylistEntry entry) {
|
||||
buddies.put(Integer.valueOf(entry.getCharacterId()), entry);
|
||||
synchronized(buddies) {
|
||||
buddies.put(Integer.valueOf(entry.getCharacterId()), entry);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(int characterId) {
|
||||
buddies.remove(Integer.valueOf(characterId));
|
||||
synchronized(buddies) {
|
||||
buddies.remove(Integer.valueOf(characterId));
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<BuddylistEntry> getBuddies() {
|
||||
return buddies.values();
|
||||
synchronized(buddies) {
|
||||
return Collections.unmodifiableCollection(buddies.values());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
return buddies.size() >= capacity;
|
||||
synchronized(buddies) {
|
||||
return buddies.size() >= capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getBuddyIds() {
|
||||
int buddyIds[] = new int[buddies.size()];
|
||||
int i = 0;
|
||||
for (BuddylistEntry ble : buddies.values()) {
|
||||
buddyIds[i++] = ble.getCharacterId();
|
||||
synchronized(buddies) {
|
||||
int buddyIds[] = new int[buddies.size()];
|
||||
int i = 0;
|
||||
for (BuddylistEntry ble : buddies.values()) {
|
||||
buddyIds[i++] = ble.getCharacterId();
|
||||
}
|
||||
return buddyIds;
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcast(byte[] packet, PlayerStorage pstorage) {
|
||||
for(int bid : getBuddyIds()) {
|
||||
MapleCharacter chr = pstorage.getCharacterById(bid);
|
||||
|
||||
if(chr != null && chr.isLoggedin() && !chr.isAwayFromWorld()) {
|
||||
chr.announce(packet);
|
||||
}
|
||||
}
|
||||
return buddyIds;
|
||||
}
|
||||
|
||||
public void loadFromDb(int characterId) {
|
||||
|
||||
Reference in New Issue
Block a user