Fix event system (#382)
This commit is contained in:
@@ -6605,6 +6605,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
//ret.events = new MapleEvents(new RescueGaga(rs.getInt("rescuegaga")), new ArtifactHunt(rs.getInt("artifacthunt")));
|
||||
}
|
||||
if (!ret.events.containsKey("rescueGaga")) {
|
||||
ret.events.put("rescueGaga", new RescueGaga(0));
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
ret.cashshop = new CashShop(ret.accountid, ret.id, ret.getJobType());
|
||||
@@ -7945,6 +7948,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
ps.close();
|
||||
|
||||
deleteWhereCharacterId(con, "DELETE FROM eventstats WHERE characterid = ?");
|
||||
ps = con.prepareStatement("INSERT INTO eventstats (characterid, name, info) VALUES (?, ?, ?)");
|
||||
ps.setInt(1, id);
|
||||
|
||||
for (Map.Entry<String, MapleEvents> entry : events.entrySet()) {
|
||||
ps.setString(2, entry.getKey());
|
||||
ps.setInt(3, entry.getValue().getInfo());
|
||||
ps.addBatch();
|
||||
}
|
||||
|
||||
ps.executeBatch();
|
||||
ps.close();
|
||||
|
||||
deleteQuestProgressWhereCharacterId(con, id);
|
||||
|
||||
|
||||
@@ -699,31 +699,6 @@ public class EventInstanceManager {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void saveWinner(MapleCharacter chr) {
|
||||
String emName;
|
||||
sL.lock();
|
||||
try {
|
||||
emName = em.getName();
|
||||
} finally {
|
||||
sL.unlock();
|
||||
}
|
||||
|
||||
try {
|
||||
Connection con = DatabaseConnection.getConnection();
|
||||
try (PreparedStatement ps = con.prepareStatement("INSERT INTO eventstats (event, instance, characterid, channel) VALUES (?, ?, ?, ?)")) {
|
||||
ps.setString(1, emName);
|
||||
ps.setString(2, getName());
|
||||
ps.setInt(3, chr.getId());
|
||||
ps.setInt(4, chr.getClient().getChannel());
|
||||
ps.executeUpdate();
|
||||
}
|
||||
|
||||
con.close();
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public MapleMap getMapInstance(int mapId) {
|
||||
MapleMap map = mapFactory.getMap(mapId);
|
||||
map.setEventInstance(this);
|
||||
|
||||
@@ -25,8 +25,10 @@ package server.events;
|
||||
/**
|
||||
* @author kevintjuh93
|
||||
*/
|
||||
public class MapleEvents {
|
||||
public abstract class MapleEvents {
|
||||
public MapleEvents() {
|
||||
|
||||
}
|
||||
|
||||
public abstract int getInfo();
|
||||
}
|
||||
@@ -42,6 +42,10 @@ public class RescueGaga extends MapleEvents {
|
||||
public void complete() {
|
||||
completed++;
|
||||
}
|
||||
|
||||
public int getInfo() {
|
||||
return getCompleted();
|
||||
}
|
||||
|
||||
public void giveSkill(MapleCharacter chr) {
|
||||
int skillid = 0;
|
||||
|
||||
Reference in New Issue
Block a user