Fixed chair exploit & beholder issue + Mini-dungeon revamp
Fixed an (quite amusing) exploit with map chairs stacking "extra healing" schedules on certain conditions. Fixed mini-dungeon not disposing players properly in some cases. Refactored the mini-dungeon structure. Fixed an issue on CASH inventory merging same items when trying to swap them. Fixed Beholder crash issue when trying to enter Cash Shop.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#Fri, 13 Oct 2017 03:24:23 -0300
|
||||
#Mon, 16 Oct 2017 14:34:51 -0200
|
||||
|
||||
|
||||
C\:\\Nexon\\MapleSolaxia\\MapleSolaxiaV2=
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
dist/MapleSolaxia.jar
vendored
BIN
dist/MapleSolaxia.jar
vendored
Binary file not shown.
@@ -580,4 +580,9 @@ Alterado tempo-limite em mapas da PiratePQ para seguir o determinado para cada m
|
||||
|
||||
12 Outubro 2017,
|
||||
Corrigido alguns bugs com a PPQ.
|
||||
Se houve sucesso usando white scroll, slot ainda é usado.
|
||||
Se houve sucesso usando white scroll, slot ainda é usado.
|
||||
|
||||
15 Outubro 2017,
|
||||
Corrigido Mini-dungeons não liberando os jogadores corretamente. Se player entra em outra sessão de MD antes de dar o timeout da primeira, o timeout leva efeito mesmo fora da sessão.
|
||||
Corrigido um bug/exploit que permitia stackar map chair recovery.
|
||||
Corrigido um bug no inventário de CASH mesclando itens de mesmo id.
|
||||
@@ -2,20 +2,6 @@
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="1"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next0.js</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/client/command/Commands.java</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next3.js</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next1.js</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next4.js</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleReactorStats.java</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleDoor.java</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/npc/2094002.js</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/CathedralWedding.js</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/portal/davy_next2.js</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/src/server/maps/MapleMap.java</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/event/PiratePQ.js</file>
|
||||
<file>file:/C:/Nexon/MapleSolaxia/MapleSolaxiaV2/scripts/reactor/2512000.js</file>
|
||||
</group>
|
||||
<group/>
|
||||
</open-files>
|
||||
</project-private>
|
||||
|
||||
@@ -51,4 +51,12 @@ function action(mode, type, selection) {
|
||||
cm.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateSelectionMenu(array) { // nice tool for generating a string for the sendSimple functionality
|
||||
var menu = "";
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
menu += "#L" + i + "#" + array[i] + "l\r\n";
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
@@ -27,28 +27,28 @@ var dungeons = 30;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -29,28 +29,28 @@ var dungeons = 30;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -29,35 +29,31 @@ var dungeons = 19;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getPlayer().getFame() < 10) {
|
||||
pi.playerMessage(5, "You need 10 Fame to enter.");
|
||||
return;
|
||||
}
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
return true;
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -29,28 +29,28 @@ var dungeons = 30;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -29,28 +29,28 @@ var dungeons = 30;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -27,28 +27,28 @@ var dungeons = 19;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -27,28 +27,28 @@ var dungeons = 30;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -27,28 +27,28 @@ var dungeons = 19;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
MiniDungeon - Rabbit
|
||||
MiniDungeon - Round Table
|
||||
*/
|
||||
var baseid = 240020500;
|
||||
var dungeonid = 240020512;
|
||||
@@ -27,28 +27,28 @@ var dungeons = 30;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -27,28 +27,28 @@ var dungeons = 34;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -27,28 +27,28 @@ var dungeons = 30;
|
||||
|
||||
function enter(pi) {
|
||||
if (pi.getMapId() == baseid) {
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if (pi.getPlayerCount(dungeonid + i) == 0) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
if (pi.getParty() != null) {
|
||||
if (pi.isLeader()) {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warpParty(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pi.playerMessage(5, "Only solo or party leaders are supposed to enter the Mini-Dungeon.");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < dungeons; i++) {
|
||||
if(pi.startDungeonInstance(dungeonid + i)) {
|
||||
pi.warp(dungeonid + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
pi.playerMessage(5, "All of the Mini-Dungeons are in use right now, please try again later.");
|
||||
return false;
|
||||
} else {
|
||||
pi.playPortalSound();
|
||||
pi.warp(baseid, "MD00");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
function enter(pi) {
|
||||
if (pi.isQuestStarted(2301) || pi.isQuestCompleted(2301)
|
||||
if (pi.isQuestStarted(2300) || pi.isQuestCompleted(2300)
|
||||
|| pi.isQuestStarted(2301) || pi.isQuestCompleted(2301)
|
||||
|| pi.isQuestStarted(2302) || pi.isQuestCompleted(2302)
|
||||
|| pi.isQuestStarted(2303) || pi.isQuestCompleted(2303)
|
||||
|| pi.isQuestStarted(2304) || pi.isQuestCompleted(2304)
|
||||
@@ -13,6 +14,6 @@ function enter(pi) {
|
||||
pi.warp(106020000, 0);
|
||||
return true;
|
||||
}
|
||||
pi.playerMessage(5, "A strange force is blocking you from enetering");
|
||||
pi.playerMessage(5, "A strange force is blocking you from entering.");
|
||||
return false;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public enum MapleBuffStat {
|
||||
COMBO_BARRIER(0x4000000000L, true),
|
||||
BODY_PRESSURE(0x8000000000L, true),
|
||||
SMART_KNOCKBACK(0x10000000000L, true),
|
||||
PYRAMID_PQ(0x20000000000L, true),
|
||||
BERSERK(0x20000000000L, true),
|
||||
ENERGY_CHARGE(0x4000000000000L, true),
|
||||
DASH2(0x8000000000000L, true), // correct (speed)
|
||||
DASH(0x10000000000000L, true), // correct (jump)
|
||||
|
||||
@@ -49,6 +49,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.server.PlayerBuffValueHolder;
|
||||
@@ -196,7 +197,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
private int married;
|
||||
private long lastfametime, lastUsedCashItem, lastHealed, lastMesoDrop = -1, jailExpiration = -1;
|
||||
private transient int localmaxhp, localmaxmp, localstr, localdex, localluk, localint_, magic, watk;
|
||||
private boolean hidden, canDoor = true, Berserk, hasMerchant, whiteChat = false;
|
||||
private boolean hidden, canDoor = true, berserk, hasMerchant, whiteChat = false;
|
||||
private int linkedLevel = 0;
|
||||
private String linkedName = null;
|
||||
private boolean finishedDojoTutorial;
|
||||
@@ -204,6 +205,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
private String chalktext;
|
||||
private String dataString;
|
||||
private String search = null;
|
||||
private AtomicBoolean awayFromWorld = new AtomicBoolean(true); // player is online, but on cash shop or mts
|
||||
private AtomicInteger exp = new AtomicInteger();
|
||||
private AtomicInteger gachaexp = new AtomicInteger();
|
||||
private AtomicInteger meso = new AtomicInteger();
|
||||
@@ -253,7 +255,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
private Map<Integer, MapleDoor> doors = new LinkedHashMap<>();
|
||||
private ScheduledFuture<?> dragonBloodSchedule;
|
||||
private ScheduledFuture<?> hpDecreaseTask;
|
||||
private ScheduledFuture<?> beholderHealingSchedule, beholderBuffSchedule, BerserkSchedule;
|
||||
private ScheduledFuture<?> beholderHealingSchedule, beholderBuffSchedule, berserkSchedule;
|
||||
private ScheduledFuture<?> skillCooldownTask = null;
|
||||
private ScheduledFuture<?> buffExpireTask = null;
|
||||
private ScheduledFuture<?> itemExpireTask = null;
|
||||
@@ -411,6 +413,14 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public boolean getAwayFromWorld() {
|
||||
return awayFromWorld.get();
|
||||
}
|
||||
|
||||
public void setAwayFromWorld(boolean away) {
|
||||
awayFromWorld.set(away);
|
||||
}
|
||||
|
||||
public long getPetLootCd() {
|
||||
return petLootCd;
|
||||
}
|
||||
@@ -1238,6 +1248,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
private void changeMapInternal(final MapleMap to, final Point pos, final byte[] warpPacket) {
|
||||
if(!canWarpMap) return;
|
||||
|
||||
this.stopChairTask();
|
||||
this.clearBanishPlayerData();
|
||||
this.closePlayerInteractions();
|
||||
this.resetPlayerAggro();
|
||||
@@ -1325,21 +1336,23 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
|
||||
public void checkBerserk(final boolean isHidden) {
|
||||
if (BerserkSchedule != null) {
|
||||
BerserkSchedule.cancel(false);
|
||||
if (berserkSchedule != null) {
|
||||
berserkSchedule.cancel(false);
|
||||
}
|
||||
final MapleCharacter chr = this;
|
||||
if (job.equals(MapleJob.DARKKNIGHT)) {
|
||||
Skill BerserkX = SkillFactory.getSkill(DarkKnight.BERSERK);
|
||||
final int skilllevel = getSkillLevel(BerserkX);
|
||||
if (skilllevel > 0) {
|
||||
Berserk = chr.getHp() * 100 / chr.getMaxHp() < BerserkX.getEffect(skilllevel).getX();
|
||||
BerserkSchedule = TimerManager.getInstance().register(new Runnable() {
|
||||
berserk = chr.getHp() * 100 / chr.getMaxHp() < BerserkX.getEffect(skilllevel).getX();
|
||||
berserkSchedule = TimerManager.getInstance().register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
client.announce(MaplePacketCreator.showOwnBerserk(skilllevel, Berserk));
|
||||
if(!isHidden) getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showBerserk(getId(), skilllevel, Berserk), false);
|
||||
else getMap().broadcastGMMessage(MapleCharacter.this, MaplePacketCreator.showBerserk(getId(), skilllevel, Berserk), false);
|
||||
if(awayFromWorld.get()) return;
|
||||
|
||||
client.announce(MaplePacketCreator.showOwnBerserk(skilllevel, berserk));
|
||||
if(!isHidden) getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showBerserk(getId(), skilllevel, berserk), false);
|
||||
else getMap().broadcastGMMessage(MapleCharacter.this, MaplePacketCreator.showBerserk(getId(), skilllevel, berserk), false);
|
||||
}
|
||||
}, 5000, 3000);
|
||||
}
|
||||
@@ -2747,8 +2760,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelAllBuffs(boolean disconnect) {
|
||||
if (disconnect) {
|
||||
public void cancelAllBuffs(boolean softcancel) {
|
||||
if (softcancel) {
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
try {
|
||||
@@ -2762,33 +2775,23 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
effLock.unlock();
|
||||
}
|
||||
} else {
|
||||
List<MapleBuffStatValueHolder> mbsvhList;
|
||||
|
||||
Map<MapleStatEffect, Long> mseBuffs = new LinkedHashMap<>();
|
||||
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
try {
|
||||
List<Pair<Integer, MapleBuffStat>> mbls = new LinkedList<>();
|
||||
|
||||
for(Entry<Integer, Map<MapleBuffStat, MapleBuffStatValueHolder>> bpl : buffEffects.entrySet()) {
|
||||
for(Entry<MapleBuffStat, MapleBuffStatValueHolder> mbse : bpl.getValue().entrySet()) {
|
||||
if(effects.get(mbse.getKey()) != mbse.getValue()) {
|
||||
mbls.add(new Pair<>(bpl.getKey(), mbse.getKey()));
|
||||
}
|
||||
mseBuffs.put(mbse.getValue().effect, mbse.getValue().startTime);
|
||||
}
|
||||
}
|
||||
|
||||
for(Pair<Integer, MapleBuffStat> pmbs : mbls) {
|
||||
removeEffectFromItemEffectHolder(pmbs.getLeft(), pmbs.getRight());
|
||||
}
|
||||
|
||||
mbsvhList = new ArrayList<>(effects.values());
|
||||
} finally {
|
||||
chrLock.unlock();
|
||||
effLock.unlock();
|
||||
}
|
||||
|
||||
for (MapleBuffStatValueHolder mbsvh : mbsvhList) {
|
||||
cancelEffect(mbsvh.effect, false, mbsvh.startTime);
|
||||
|
||||
for (Entry<MapleStatEffect, Long> mse : mseBuffs.entrySet()) {
|
||||
cancelEffect(mse.getKey(), false, mse.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3182,6 +3185,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
beholderHealingSchedule = TimerManager.getInstance().register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(awayFromWorld.get()) return;
|
||||
|
||||
addHP(healEffect.getHp());
|
||||
client.announce(MaplePacketCreator.showOwnBuffEffect(beholder, 2));
|
||||
getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.summonSkill(getId(), beholder, 5), true);
|
||||
@@ -3196,6 +3201,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
beholderBuffSchedule = TimerManager.getInstance().register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(awayFromWorld.get()) return;
|
||||
|
||||
buffEffect.applyTo(MapleCharacter.this);
|
||||
client.announce(MaplePacketCreator.showOwnBuffEffect(beholder, 2));
|
||||
getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.summonSkill(getId(), beholder, (int) (Math.random() * 3) + 6), true);
|
||||
@@ -5713,6 +5720,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
dragonBloodSchedule = TimerManager.getInstance().register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(awayFromWorld.get()) return;
|
||||
|
||||
addHP(-bloodEffect.getX());
|
||||
client.announce(MaplePacketCreator.showOwnBuffEffect(bloodEffect.getSourceId(), 5));
|
||||
getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showBuffeffect(getId(), bloodEffect.getSourceId(), 5), false);
|
||||
@@ -7771,8 +7780,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
if (beholderBuffSchedule != null) {
|
||||
beholderBuffSchedule.cancel(false);
|
||||
}
|
||||
if (BerserkSchedule != null) {
|
||||
BerserkSchedule.cancel(false);
|
||||
if (berserkSchedule != null) {
|
||||
berserkSchedule.cancel(false);
|
||||
}
|
||||
if (recoveryTask != null) {
|
||||
recoveryTask.cancel(false);
|
||||
@@ -7785,6 +7794,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
cancelDiseaseExpireTask();
|
||||
cancelSkillCooldownTask();
|
||||
cancelExpirationTask();
|
||||
stopChairTask();
|
||||
|
||||
for (ScheduledFuture<?> sf : timers) {
|
||||
sf.cancel(false);
|
||||
|
||||
@@ -787,6 +787,7 @@ public class MapleClient {
|
||||
|
||||
private void removePlayer() {
|
||||
try {
|
||||
player.setAwayFromWorld(true);
|
||||
player.cancelAllBuffs(true);
|
||||
player.cancelAllDebuffs();
|
||||
|
||||
@@ -1290,7 +1291,12 @@ public class MapleClient {
|
||||
if (!player.isAlive() || FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) {
|
||||
announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
} else if(MapleMiniDungeonInfo.isDungeonMap(player.getMapId())) {
|
||||
announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon."));
|
||||
announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
String[] socket = Server.getInstance().getIP(getWorld(), channel).split(":");
|
||||
if (player.getTrade() != null) {
|
||||
MapleTrade.cancelTrade(getPlayer());
|
||||
@@ -1305,10 +1311,12 @@ public class MapleClient {
|
||||
}
|
||||
}
|
||||
server.getPlayerBuffStorage().addBuffsToStorage(player.getId(), player.getAllBuffs());
|
||||
player.setAwayFromWorld(true);
|
||||
player.cancelAllBuffs(true);
|
||||
player.cancelBuffExpireTask();
|
||||
player.cancelDiseaseExpireTask();
|
||||
player.cancelSkillCooldownTask();
|
||||
player.stopChairTask();
|
||||
//Cancelling magicdoor? Nope
|
||||
//Cancelling mounts? Noty
|
||||
if (player.getBuffedValue(MapleBuffStat.PUPPET) != null) {
|
||||
|
||||
@@ -93,8 +93,8 @@ public class AutobanManager {
|
||||
* <code>type</code>:<br>
|
||||
* 0: HealOverTime<br>
|
||||
* 1: Pet Food<br>
|
||||
* 2: ItemSort<br>
|
||||
* 3: ItemIdSort<br>
|
||||
* 2: ItemMerge<br>
|
||||
* 3: ItemSort<br>
|
||||
* 4: SpecialMove<br>
|
||||
* 5: UseCatchItem<br>
|
||||
* 6: Item Drop<br>
|
||||
|
||||
@@ -212,10 +212,9 @@ public class MapleInventory implements Iterable<Item> {
|
||||
inventory.put(dSlot, source);
|
||||
inventory.remove(sSlot);
|
||||
} else if (target.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId())) {
|
||||
if (type.getType() == MapleInventoryType.EQUIP.getType()) {
|
||||
if (type.getType() == MapleInventoryType.EQUIP.getType() || type.getType() == MapleInventoryType.CASH.getType()) {
|
||||
swap(target, source);
|
||||
}
|
||||
if (source.getQuantity() + target.getQuantity() > slotMax) {
|
||||
} else if (source.getQuantity() + target.getQuantity() > slotMax) {
|
||||
short rest = (short) ((source.getQuantity() + target.getQuantity()) - slotMax);
|
||||
source.setQuantity(rest);
|
||||
target.setQuantity(slotMax);
|
||||
|
||||
@@ -132,7 +132,7 @@ public final class PacketProcessor {
|
||||
registerHandler(RecvOpcode.NPC_TALK_MORE, new NPCMoreTalkHandler());
|
||||
registerHandler(RecvOpcode.QUEST_ACTION, new QuestActionHandler());
|
||||
registerHandler(RecvOpcode.NPC_SHOP, new NPCShopHandler());
|
||||
registerHandler(RecvOpcode.ITEM_SORT, new ItemSortHandler());
|
||||
registerHandler(RecvOpcode.ITEM_SORT, new InventoryMergeHandler());
|
||||
registerHandler(RecvOpcode.ITEM_MOVE, new ItemMoveHandler());
|
||||
registerHandler(RecvOpcode.MESO_DROP, new MesoDropHandler());
|
||||
registerHandler(RecvOpcode.PLAYER_LOGGEDIN, new PlayerLoggedinHandler());
|
||||
@@ -237,7 +237,7 @@ public final class PacketProcessor {
|
||||
registerHandler(RecvOpcode.MOB_DAMAGE_MOB_FRIENDLY, new MobDamageMobFriendlyHandler());
|
||||
registerHandler(RecvOpcode.PARTY_SEARCH_REGISTER, new PartySearchRegisterHandler());
|
||||
registerHandler(RecvOpcode.PARTY_SEARCH_START, new PartySearchStartHandler());
|
||||
registerHandler(RecvOpcode.ITEM_SORT2, new ItemIdSortHandler());
|
||||
registerHandler(RecvOpcode.ITEM_SORT2, new InventorySortHandler());
|
||||
registerHandler(RecvOpcode.LEFT_KNOCKBACK, new LeftKnockbackHandler());
|
||||
registerHandler(RecvOpcode.SNOWBALL, new SnowballHandler());
|
||||
registerHandler(RecvOpcode.COCONUT, new CoconutHandler());
|
||||
|
||||
@@ -32,6 +32,8 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
@@ -60,9 +62,11 @@ import server.expeditions.MapleExpeditionType;
|
||||
import server.maps.MapleHiredMerchant;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapFactory;
|
||||
import server.maps.MapleMiniDungeon;
|
||||
import tools.MaplePacketCreator;
|
||||
import client.MapleCharacter;
|
||||
import constants.ServerConstants;
|
||||
import server.maps.MapleMiniDungeonInfo;
|
||||
|
||||
public final class Channel {
|
||||
|
||||
@@ -75,9 +79,6 @@ public final class Channel {
|
||||
private EventScriptManager eventSM;
|
||||
private Map<Integer, MapleHiredMerchant> hiredMerchants = new HashMap<>();
|
||||
private final Map<Integer, Integer> storedVars = new HashMap<>();
|
||||
private ReentrantReadWriteLock merchant_lock = new ReentrantReadWriteLock(true);
|
||||
private ReadLock merchRlock = merchant_lock.readLock();
|
||||
private WriteLock merchWlock = merchant_lock.writeLock();
|
||||
private List<MapleExpedition> expeditions = new ArrayList<>();
|
||||
private List<MapleExpeditionType> expedType = new ArrayList<>();
|
||||
private MapleEvent event;
|
||||
@@ -87,6 +88,13 @@ public final class Channel {
|
||||
private long[] dojoFinishTime;
|
||||
private ScheduledFuture<?>[] dojoTask;
|
||||
private Map<Integer, Integer> dojoParty = new HashMap<>();
|
||||
private Map<Integer, MapleMiniDungeon> dungeons = new HashMap<>();
|
||||
|
||||
private ReentrantReadWriteLock merchant_lock = new ReentrantReadWriteLock(true);
|
||||
private ReadLock merchRlock = merchant_lock.readLock();
|
||||
private WriteLock merchWlock = merchant_lock.writeLock();
|
||||
|
||||
private Lock lock = new ReentrantLock();
|
||||
|
||||
public Channel(final int world, final int channel) {
|
||||
this.world = world;
|
||||
@@ -485,4 +493,37 @@ public final class Channel {
|
||||
public long getDojoFinishTime(int dojoMapId) {
|
||||
return dojoFinishTime[getDojoSlot(dojoMapId)];
|
||||
}
|
||||
|
||||
public boolean addMiniDungeon(int dungeonid) {
|
||||
lock.lock();
|
||||
try {
|
||||
if(dungeons.containsKey(dungeonid)) return false;
|
||||
|
||||
MapleMiniDungeonInfo mmdi = MapleMiniDungeonInfo.getDungeon(dungeonid);
|
||||
MapleMiniDungeon mmd = new MapleMiniDungeon(mmdi.getBase(), 30); // all minidungeons timeouts on 30 mins
|
||||
|
||||
dungeons.put(dungeonid, mmd);
|
||||
return true;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public MapleMiniDungeon getMiniDungeon(int dungeonid) {
|
||||
lock.lock();
|
||||
try {
|
||||
return dungeons.get(dungeonid);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeMiniDungeon(int dungeonid) {
|
||||
lock.lock();
|
||||
try {
|
||||
dungeons.remove(dungeonid);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import tools.data.input.SeekableLittleEndianAccessor;
|
||||
/**
|
||||
*
|
||||
* @author Matze
|
||||
* @author Ronan
|
||||
*/
|
||||
public final class DoorHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,7 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import server.maps.MapleMiniDungeonInfo;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
@@ -41,6 +42,13 @@ public class EnterCashShopHandler extends AbstractMaplePacketHandler {
|
||||
if (mc.cannotEnterCashShop()) {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(MapleMiniDungeonInfo.isDungeonMap(c.getPlayer().getMapId())) {
|
||||
c.announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
if (mc.getCashShop().isOpened()) {
|
||||
@@ -50,11 +58,13 @@ public class EnterCashShopHandler extends AbstractMaplePacketHandler {
|
||||
mc.closePlayerInteractions();
|
||||
|
||||
Server.getInstance().getPlayerBuffStorage().addBuffsToStorage(mc.getId(), mc.getAllBuffs());
|
||||
mc.setAwayFromWorld(true);
|
||||
mc.cancelAllBuffs(true);
|
||||
mc.cancelBuffExpireTask();
|
||||
mc.cancelDiseaseExpireTask();
|
||||
mc.cancelSkillCooldownTask();
|
||||
mc.cancelExpirationTask();
|
||||
mc.stopChairTask();
|
||||
|
||||
c.announce(MaplePacketCreator.openCashShop(c, false));
|
||||
c.announce(MaplePacketCreator.showCashInventory(c));
|
||||
|
||||
@@ -36,6 +36,7 @@ import constants.ServerConstants;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import server.MTSItemInfo;
|
||||
import server.maps.MapleMiniDungeonInfo;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
@@ -47,6 +48,13 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
if(MapleMiniDungeonInfo.isDungeonMap(c.getPlayer().getMapId())) {
|
||||
c.announce(MaplePacketCreator.serverNotice(5, "Changing channels or entering Cash Shop or MTS are disabled when inside a Mini-Dungeon."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
if (!chr.isAlive()) {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
@@ -59,11 +67,14 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
|
||||
Server.getInstance().getPlayerBuffStorage().addBuffsToStorage(chr.getId(), chr.getAllBuffs());
|
||||
chr.setAwayFromWorld(true);
|
||||
chr.cancelAllBuffs(true);
|
||||
chr.cancelBuffExpireTask();
|
||||
chr.cancelDiseaseExpireTask();
|
||||
chr.cancelSkillCooldownTask();
|
||||
chr.cancelExpirationTask();
|
||||
chr.stopChairTask();
|
||||
|
||||
chr.saveToDB();
|
||||
chr.getMap().removePlayer(c.getPlayer());
|
||||
try {
|
||||
|
||||
@@ -33,7 +33,7 @@ import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
public final class ItemSortHandler extends AbstractMaplePacketHandler {
|
||||
public final class InventoryMergeHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
@@ -67,7 +67,7 @@ public final class ItemSortHandler extends AbstractMaplePacketHandler {
|
||||
MapleInventoryManipulator.move(c, inventoryType, src, dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
inventory = c.getPlayer().getInventory(inventoryType);
|
||||
@@ -183,7 +183,7 @@ class PairedQuicksort {
|
||||
}
|
||||
}
|
||||
|
||||
public final class ItemIdSortHandler extends AbstractMaplePacketHandler {
|
||||
public final class InventorySortHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
@@ -33,6 +33,9 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleJob;
|
||||
import constants.ServerConstants;
|
||||
import net.server.world.MaplePartyCharacter;
|
||||
import net.server.world.PartyOperation;
|
||||
import net.server.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -40,40 +43,41 @@ import constants.ServerConstants;
|
||||
* @author BubblesDev
|
||||
*/
|
||||
public class PartySearchStartHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
if(!ServerConstants.USE_PARTY_SEARCH){
|
||||
return;
|
||||
}
|
||||
|
||||
int min = slea.readInt();
|
||||
int max = slea.readInt();
|
||||
slea.readInt(); // members
|
||||
int jobs = slea.readInt();
|
||||
|
||||
MapleParty party = c.getPlayer().getParty();
|
||||
if(party == null) return;
|
||||
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
MapleMap map = chr.getMap();
|
||||
World world = c.getWorldServer();
|
||||
|
||||
Collection<MapleMapObject> mapobjs = map.getPlayers();
|
||||
|
||||
for (MapleMapObject mapobj : mapobjs) {
|
||||
if (chr.getParty().getMembers().size() > 5) {
|
||||
if (party.getMembers().size() > 5) {
|
||||
break;
|
||||
}
|
||||
if (mapobj instanceof MapleCharacter) {
|
||||
MapleCharacter tchar = (MapleCharacter) mapobj;
|
||||
int charlvl = tchar.getLevel();
|
||||
if (charlvl >= min && charlvl <= max && isValidJob(tchar.getJob(), jobs)) {
|
||||
if (c.getPlayer().getParty() == null) {
|
||||
//WorldChannelInterface wci = c.getChannelServer().getWorldInterface();
|
||||
MapleParty party = c.getPlayer().getParty();
|
||||
//int partyid = party.getId();
|
||||
//party = null;//.getParty(partyid);
|
||||
if (party != null) {
|
||||
if (party.getMembers().size() < 6) {
|
||||
//MaplePartyCharacter partyplayer = tchar.getMPC();
|
||||
//wci.updateParty(party.getId(), PartyOperation.JOIN, partyplayer);
|
||||
c.getPlayer().receivePartyMemberHP();
|
||||
c.getPlayer().updatePartyMemberHP();
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.partyStatusMessage(17));
|
||||
}
|
||||
}
|
||||
if (tchar.getParty() == null) {
|
||||
MaplePartyCharacter partyplayer = new MaplePartyCharacter(tchar);
|
||||
tchar.getMap().addPartyMember(tchar);
|
||||
|
||||
world.updateParty(party.getId(), PartyOperation.JOIN, partyplayer);
|
||||
tchar.receivePartyMemberHP();
|
||||
tchar.updatePartyMemberHP();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,6 +172,8 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
|
||||
player.getMap().addPlayer(player);
|
||||
World world = server.getWorld(c.getWorld());
|
||||
world.getPlayerStorage().addPlayer(player);
|
||||
|
||||
player.setAwayFromWorld(false);
|
||||
|
||||
int buddyIds[] = player.getBuddylist().getBuddyIds();
|
||||
world.loggedOn(player.getName(), player.getId(), c.getChannel(), buddyIds);
|
||||
|
||||
@@ -46,6 +46,7 @@ import server.life.MobSkillFactory;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapleMiniDungeon;
|
||||
import server.partyquest.PartyQuest;
|
||||
import server.partyquest.Pyramid;
|
||||
import server.quest.MapleQuest;
|
||||
@@ -922,4 +923,7 @@ public class AbstractPlayerInteraction {
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean startDungeonInstance(int dungeonid) {
|
||||
return c.getChannelServer().addMiniDungeon(dungeonid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,6 +282,7 @@ public class EventInstanceManager {
|
||||
}
|
||||
|
||||
event_schedule = TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
dismissEventTimer();
|
||||
|
||||
@@ -355,15 +355,18 @@ public class MapleInventoryManipulator {
|
||||
|
||||
public static void move(MapleClient c, MapleInventoryType type, short src, short dst) {
|
||||
if (src < 0 || dst < 0) {
|
||||
System.out.println("src " + src + " dst " + dst);
|
||||
return;
|
||||
}
|
||||
if(dst > c.getPlayer().getInventory(type).getSlotLimit()) {
|
||||
System.out.println("slim " + c.getPlayer().getInventory(type).getSlotLimit() + " dst " + dst);
|
||||
return;
|
||||
}
|
||||
if(dst > c.getPlayer().getInventory(type).getSlotLimit()) {
|
||||
return;
|
||||
}
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
Item source = c.getPlayer().getInventory(type).getItem(src);
|
||||
Item initialTarget = c.getPlayer().getInventory(type).getItem(dst);
|
||||
if (source == null) {
|
||||
System.out.println("null");
|
||||
return;
|
||||
}
|
||||
short olddstQ = -1;
|
||||
@@ -374,7 +377,7 @@ public class MapleInventoryManipulator {
|
||||
short slotMax = ii.getSlotMax(c, source.getItemId());
|
||||
c.getPlayer().getInventory(type).move(src, dst, slotMax);
|
||||
final List<ModifyInventory> mods = new ArrayList<>();
|
||||
if (!type.equals(MapleInventoryType.EQUIP) && initialTarget != null && initialTarget.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId())) {
|
||||
if (!(type.equals(MapleInventoryType.EQUIP) || type.equals(MapleInventoryType.CASH)) && initialTarget != null && initialTarget.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId())) {
|
||||
if ((olddstQ + oldsrcQ) > slotMax) {
|
||||
mods.add(new ModifyInventory(1, source));
|
||||
mods.add(new ModifyInventory(1, initialTarget));
|
||||
|
||||
@@ -202,14 +202,6 @@ public class MapleStatEffect {
|
||||
ret.speed = (short) MapleDataTool.getInt("speed", source, 0);
|
||||
ret.jump = (short) MapleDataTool.getInt("jump", source, 0);
|
||||
|
||||
if((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) {
|
||||
ret.jump = (short)(ret.speed * 4);
|
||||
ret.speed *= 15;
|
||||
}
|
||||
|
||||
ret.berserk = MapleDataTool.getInt("berserk", source, 0);
|
||||
ret.booster = MapleDataTool.getInt("booster", source, 0);
|
||||
|
||||
ret.mapProtection = mapProtection(sourceid);
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, Integer.valueOf(ret.mapProtection));
|
||||
|
||||
@@ -222,11 +214,16 @@ public class MapleStatEffect {
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.AVOID, Integer.valueOf(ret.avoid));
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.SPEED, Integer.valueOf(ret.speed));
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.JUMP, Integer.valueOf(ret.jump));
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.PYRAMID_PQ, Integer.valueOf(ret.berserk));
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BOOSTER, Integer.valueOf(ret.booster));
|
||||
|
||||
if(!skill) {
|
||||
if(isDojoBuff(sourceid) || sourceid == 2022337) {
|
||||
if(isPyramidBuff(sourceid)) {
|
||||
ret.berserk = MapleDataTool.getInt("berserk", source, 0);
|
||||
ret.booster = MapleDataTool.getInt("booster", source, 0);
|
||||
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BERSERK, Integer.valueOf(ret.berserk));
|
||||
addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BOOSTER, Integer.valueOf(ret.booster));
|
||||
|
||||
} else if(isDojoBuff(sourceid) || sourceid == 2022337) {
|
||||
ret.mhpR = (byte) MapleDataTool.getInt("mhpR", source, 0);
|
||||
ret.mhpRRate = (short) (MapleDataTool.getInt("mhpRRate", source, 0) * 100);
|
||||
ret.mmpR = (byte) MapleDataTool.getInt("mmpR", source, 0);
|
||||
@@ -268,6 +265,11 @@ public class MapleStatEffect {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) {
|
||||
ret.jump = (short)(ret.speed * 4);
|
||||
ret.speed *= 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
MapleData ltd = source.getChildByPath("lt");
|
||||
@@ -1328,11 +1330,15 @@ public class MapleStatEffect {
|
||||
return sourceid >= 2022359 && sourceid <= 2022421;
|
||||
}
|
||||
|
||||
public static boolean isPyramidBuff(int sourceid) {
|
||||
return sourceid >= 2022585 && sourceid <= 2022617;
|
||||
}
|
||||
|
||||
public static boolean isRateCoupon(int sourceid) {
|
||||
int itemType = sourceid / 1000;
|
||||
return itemType == 5211 || itemType == 5360;
|
||||
}
|
||||
|
||||
|
||||
private boolean isDs() {
|
||||
return skill && (sourceid == Rogue.DARK_SIGHT || sourceid == WindArcher.WIND_WALK || sourceid == NightWalker.DARK_SIGHT);
|
||||
}
|
||||
|
||||
@@ -1979,19 +1979,11 @@ public class MapleMap {
|
||||
if (chr.getEventInstance() != null) {
|
||||
chr.getEventInstance().movePlayer(chr);
|
||||
}
|
||||
} else if (MapleMiniDungeon.isDungeonMap(mapid)) {
|
||||
final MapleMiniDungeon dungeon = MapleMiniDungeon.getDungeon(mapid);
|
||||
chr.getClient().announce(MaplePacketCreator.getClock(30 * 60));
|
||||
TimerManager.getInstance().schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (MapleMiniDungeon.isDungeonMap(chr.getMapId())) {
|
||||
chr.changeMap(dungeon.getBase());
|
||||
}
|
||||
}
|
||||
}, 30 * 60 * 1000);
|
||||
} else if (MapleMiniDungeonInfo.isDungeonMap(mapid)) {
|
||||
MapleMiniDungeon mmd = chr.getClient().getChannelServer().getMiniDungeon(mapid);
|
||||
if(mmd != null) mmd.registerPlayer(chr);
|
||||
}
|
||||
|
||||
MaplePet[] pets = chr.getPets();
|
||||
for (int i = 0; i < pets.length; i++) {
|
||||
if (pets[i] != null) {
|
||||
@@ -2152,6 +2144,16 @@ public class MapleMap {
|
||||
} finally {
|
||||
chrWLock.unlock();
|
||||
}
|
||||
|
||||
if (MapleMiniDungeonInfo.isDungeonMap(mapid)) {
|
||||
MapleMiniDungeon mmd = chr.getClient().getChannelServer().getMiniDungeon(mapid);
|
||||
if(mmd != null) {
|
||||
if(!mmd.unregisterPlayer(chr)) {
|
||||
chr.getClient().getChannelServer().removeMiniDungeon(mapid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removeMapObject(chr.getObjectId());
|
||||
if (!chr.isHidden()) {
|
||||
broadcastMessage(MaplePacketCreator.removePlayerFromMap(chr.getId()));
|
||||
|
||||
@@ -1,86 +1,102 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package server.maps;
|
||||
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import server.TimerManager;
|
||||
import client.MapleCharacter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author SharpAceX(Alan)
|
||||
* @author Ronan
|
||||
*/
|
||||
|
||||
public enum MapleMiniDungeon {
|
||||
|
||||
//http://bbb.hidden-street.net/search_finder/mini%20dungeon
|
||||
|
||||
CAVE_OF_MUSHROOMS(105050100, 105050101, 30),
|
||||
GOLEM_CASTLE_RUINS(105040304, 105040320, 34),
|
||||
HILL_OF_SANDSTORMS(260020600, 260020630, 30),
|
||||
HENESYS_PIG_FARM(100020000, 100020100, 30),
|
||||
DRAKES_BLUE_CAVE(105090311, 105090320, 30),
|
||||
DRUMMER_BUNNYS_LAIR(221023400, 221023401, 30),
|
||||
THE_ROUND_TABLE_OF_KENTARUS(240020500, 240020512, 30),
|
||||
THE_RESTORING_MEMORY(240040511, 240040800, 19),
|
||||
NEWT_SECURED_ZONE(240040520, 240040900, 19),
|
||||
PILLAGE_OF_TREASURE_ISLAND(251010402, 251010410, 30),
|
||||
LONGEST_RIDE_ON_BYEBYE_STATION(551030000, 551030001, 19);
|
||||
|
||||
private int baseId;
|
||||
private int dungeonId;
|
||||
private int dungeons;
|
||||
|
||||
private MapleMiniDungeon(int baseId, int dungeonId, int dungeons) {
|
||||
this.baseId = baseId;
|
||||
this.dungeonId = dungeonId;
|
||||
this.dungeons = dungeons;
|
||||
}
|
||||
|
||||
public int getBase() {
|
||||
return baseId;
|
||||
}
|
||||
|
||||
public int getDungeonId() {
|
||||
return dungeonId;
|
||||
}
|
||||
|
||||
public int getDungeons() {
|
||||
return dungeons;
|
||||
}
|
||||
|
||||
public static boolean isDungeonMap(int map){
|
||||
for (MapleMiniDungeon dungeon : MapleMiniDungeon.values()){
|
||||
if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static MapleMiniDungeon getDungeon(int map){
|
||||
for (MapleMiniDungeon dungeon : MapleMiniDungeon.values()){
|
||||
if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()){
|
||||
return dungeon;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public class MapleMiniDungeon {
|
||||
List<MapleCharacter> players = new ArrayList<>();
|
||||
ScheduledFuture<?> timeoutTask = null;
|
||||
Lock lock = new ReentrantLock();
|
||||
|
||||
int baseMap;
|
||||
long expireTime;
|
||||
|
||||
public MapleMiniDungeon(int base, int durationMin) {
|
||||
baseMap = base;
|
||||
expireTime = durationMin * 60 * 1000;
|
||||
|
||||
timeoutTask = TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
lock.lock();
|
||||
try {
|
||||
List<MapleCharacter> lchr = new ArrayList<>(players);
|
||||
|
||||
for(MapleCharacter chr : lchr) {
|
||||
chr.changeMap(baseMap);
|
||||
}
|
||||
|
||||
dispose();
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}, expireTime);
|
||||
|
||||
expireTime += System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean registerPlayer(MapleCharacter chr) {
|
||||
int time = (int)((expireTime - System.currentTimeMillis()) / 1000);
|
||||
if(time > 0) chr.getClient().announce(MaplePacketCreator.getClock(time));
|
||||
|
||||
lock.lock();
|
||||
try {
|
||||
if(timeoutTask == null) return false;
|
||||
|
||||
players.add(chr);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean unregisterPlayer(MapleCharacter chr) {
|
||||
chr.getClient().announce(MaplePacketCreator.removeClock());
|
||||
|
||||
lock.lock();
|
||||
try {
|
||||
players.remove(chr);
|
||||
|
||||
if(players.isEmpty()) {
|
||||
dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
lock.lock();
|
||||
try {
|
||||
players.clear();
|
||||
|
||||
if(timeoutTask != null) {
|
||||
timeoutTask.cancel(false);
|
||||
timeoutTask = null;
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
86
src/server/maps/MapleMiniDungeonInfo.java
Normal file
86
src/server/maps/MapleMiniDungeonInfo.java
Normal file
@@ -0,0 +1,86 @@
|
||||
package server.maps;
|
||||
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author SharpAceX(Alan)
|
||||
*/
|
||||
|
||||
public enum MapleMiniDungeonInfo {
|
||||
|
||||
//http://bbb.hidden-street.net/search_finder/mini%20dungeon
|
||||
|
||||
CAVE_OF_MUSHROOMS(105050100, 105050101, 30),
|
||||
GOLEM_CASTLE_RUINS(105040304, 105040320, 34),
|
||||
HILL_OF_SANDSTORMS(260020600, 260020630, 30),
|
||||
HENESYS_PIG_FARM(100020000, 100020100, 30),
|
||||
DRAKES_BLUE_CAVE(105090311, 105090320, 30),
|
||||
DRUMMER_BUNNYS_LAIR(221023400, 221023401, 30),
|
||||
THE_ROUND_TABLE_OF_KENTARUS(240020500, 240020512, 30),
|
||||
THE_RESTORING_MEMORY(240040511, 240040800, 19),
|
||||
NEWT_SECURED_ZONE(240040520, 240040900, 19),
|
||||
PILLAGE_OF_TREASURE_ISLAND(251010402, 251010410, 30),
|
||||
LONGEST_RIDE_ON_BYEBYE_STATION(551030000, 551030001, 19);
|
||||
|
||||
private int baseId;
|
||||
private int dungeonId;
|
||||
private int dungeons;
|
||||
|
||||
private MapleMiniDungeonInfo(int baseId, int dungeonId, int dungeons) {
|
||||
this.baseId = baseId;
|
||||
this.dungeonId = dungeonId;
|
||||
this.dungeons = dungeons;
|
||||
}
|
||||
|
||||
public int getBase() {
|
||||
return baseId;
|
||||
}
|
||||
|
||||
public int getDungeonId() {
|
||||
return dungeonId;
|
||||
}
|
||||
|
||||
public int getDungeons() {
|
||||
return dungeons;
|
||||
}
|
||||
|
||||
public static boolean isDungeonMap(int map){
|
||||
for (MapleMiniDungeonInfo dungeon : MapleMiniDungeonInfo.values()){
|
||||
if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static MapleMiniDungeonInfo getDungeon(int map){
|
||||
for (MapleMiniDungeonInfo dungeon : MapleMiniDungeonInfo.values()){
|
||||
if (map >= dungeon.getDungeonId() && map <= dungeon.getDungeonId() + dungeon.getDungeons()){
|
||||
return dungeon;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user