Alliances & Pet autopot improvement + Crafters patch

Improved Alliance invitations now using "invite popups" just like buddy, party and guild invites.
Pet autopot now properly uses up pots from the inventory, fetching from other inventory slots when one place has been completely used up but the "stop criteria" hasn't been fulfilled yet.
Pet autopot now properly detects pots with healing factor defined by the character's pool.
Fixed old exploit with mineral/jewel crafters.
Patched Doorway's questlines.
This commit is contained in:
ronancpl
2018-01-16 15:34:52 -02:00
parent 346d39c03a
commit f74dfbb46a
40 changed files with 619 additions and 207 deletions
+9
View File
@@ -758,3 +758,12 @@ Incrementado portal de MK Castle agora permitindo uso dos 2 itens poss
Resolvido alguns logs de erros disparados por mapas nulos no código-fonte. Resolvido alguns logs de erros disparados por mapas nulos no código-fonte.
Resolvido pequenos problemas de volatidade (nulos) nas referencias ao jogador em alguns handlers. Resolvido pequenos problemas de volatidade (nulos) nas referencias ao jogador em alguns handlers.
Corrigido alguns problemas com copyright em alguns arquivos. Corrigido alguns problemas com copyright em alguns arquivos.
Corrigido exploit com refinadores de minerais permitindo números iguais ou menores que zero como entrada.
14 - 15 Janeiro 2018,
Melhorado pet autopot, agora utilizando os outros slots do mesmo item caso o slot alvo tenha sido completamente usado.
Pet autopot agora considera o reuso de pots que fornecem ganho de porcentagem de HP ou MP.
Diminuídas levemente as chances de dropar os itens Moon Rock e Star Rock.
Função de listagem de itens no inventário agora ordena os itens de acordo com posição dos mesmos.
Incrementado diversos aspectos das questlines das doorways em Victoria Island.
Melhorado mecânica de convite para Alliances agora utilizando o balão apropriado, similar aos utilizados para Party e Guild.
+3 -1
View File
@@ -2,6 +2,8 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> <project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="2"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="2"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/> <group>
<file>file:/C:/Nexon/MapleSolaxia/HeavenMS/scripts/portal/obstacle.js</file>
</group>
</open-files> </open-files>
</project-private> </project-private>
+5 -3
View File
@@ -1,8 +1,10 @@
importPackage(Packages.server.life); importPackage(Packages.server.life);
function start(ms) { function start(ms) {
var pos = new java.awt.Point(461, 61);
var mobId = 9400612; var mobId = 9400612;
var mobName = "Marbas";
var player = ms.getPlayer(); var player = ms.getPlayer();
var map = player.getMap(); var map = player.getMap();
@@ -10,6 +12,6 @@ function start(ms) {
return; return;
} }
map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), new java.awt.Point(461, 61)); map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos);
player.message("Marbas has appeared!"); player.message(mobName + " has appeared!");
} }
+17
View File
@@ -0,0 +1,17 @@
importPackage(Packages.server.life);
function start(ms) {
var pos = new java.awt.Point(467, 0);
var mobId = 9400610;
var mobName = "Amdusias";
var player = ms.getPlayer();
var map = player.getMap();
if(map.getMonsterById(mobId) != null){
return;
}
map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos);
player.message(mobName + " has appeared!");
}
+17
View File
@@ -0,0 +1,17 @@
importPackage(Packages.server.life);
function start(ms) {
var pos = new java.awt.Point(201, 80);
var mobId = 9400609;
var mobName = "Andras";
var player = ms.getPlayer();
var map = player.getMap();
if(map.getMonsterById(mobId) != null){
return;
}
map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos);
player.message(mobName + " has appeared!");
}
+17
View File
@@ -0,0 +1,17 @@
importPackage(Packages.server.life);
function start(ms) {
var pos = new java.awt.Point(171, 50);
var mobId = 9400611;
var mobName = "Crocell";
var player = ms.getPlayer();
var map = player.getMap();
if(map.getMonsterById(mobId) != null){
return;
}
map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos);
player.message(mobName + " has appeared!");
}
+10 -6
View File
@@ -1,13 +1,17 @@
importPackage(Packages.server.life); importPackage(Packages.server.life);
function start(ms) { function start(ms) {
spawnMob(251, -841, 9400613, ms.getPlayer().getMap()); var pos = new java.awt.Point(251, -841);
} var mobId = 9400613;
var mobName = "Valefor";
function spawnMob(x, y, id, map) { var player = ms.getPlayer();
if(map.getMonsterById(id) != null) var map = player.getMap();
if(map.getMonsterById(mobId) != null){
return; return;
}
var mob = MapleLifeFactory.getMonster(id); map.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), pos);
map.spawnMonsterOnGroundBelow(mob, new java.awt.Point(x, y)); player.message(mobName + " has appeared!");
} }
+1 -1
View File
@@ -106,7 +106,7 @@ function action(mode, type, selection) {
if (selectedType != 4) if (selectedType != 4)
selectedItem = selection; selectedItem = selection;
else else
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
if (selectedType == 0) { //bow refine if (selectedType == 0) { //bow refine
var matSet = [[4003001,4000000],[4011001,4003000],[4003001,4000016],[4011001,4021006,4003000],[4011001,4011006,4021003,4021006,4003000],[4011004,4021000,4021004,4003000],[4021008,4011001,4011006,4003000,4000014]]; var matSet = [[4003001,4000000],[4011001,4003000],[4003001,4000016],[4011001,4021006,4003000],[4011001,4011006,4021003,4021006,4003000],[4011004,4021000,4021004,4003000],[4021008,4011001,4011006,4003000,4000014]];
var matQtySet = [[5,30],[1,3],[30,50],[2,2,8],[5,5,3,3,30],[7,6,3,35],[1,10,3,40,50]]; var matQtySet = [[5,30],[1,3],[30,50],[2,2,8],[5,5,3,3,30],[7,6,3,35],[1,10,3,40,50]];
+1 -1
View File
@@ -136,7 +136,7 @@ function action(mode, type, selection) {
qty = 1; qty = 1;
} }
else else
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
if (selectedType == 2){ //helmet refine if (selectedType == 2){ //helmet refine
var itemSet = new Array(1002042,1002041,1002002,1002044,1002003,1002040,1002007,1002052,1002011,1002058,1002009,1002056,1002087,1002088,1002050,1002049,1002047,1002048,1002099,1002098,1002085,1002028,1002022,1002101); var itemSet = new Array(1002042,1002041,1002002,1002044,1002003,1002040,1002007,1002052,1002011,1002058,1002009,1002056,1002087,1002088,1002050,1002049,1002047,1002048,1002099,1002098,1002085,1002028,1002022,1002101);
+1 -1
View File
@@ -116,7 +116,7 @@ function action(mode, type, selection) {
qty = 1; qty = 1;
} }
else else
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
if (selectedType == 0){ //glove refine if (selectedType == 0){ //glove refine
var itemSet = new Array(1082003,1082000,1082004,1082001,1082007,1082008,1082023,1082009,1082059); var itemSet = new Array(1082003,1082000,1082004,1082001,1082007,1082008,1082023,1082009,1082059);
+56
View File
@@ -0,0 +1,56 @@
/*
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
Copyleft (L) 2017 RonanLana
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/>.
*/
var status;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && type > 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if(status == 0) {
if(cm.isQuestStarted(28177) && !cm.haveItem(4032479)) {
if(cm.canHold(4032479)) {
cm.gainItem(4032479, 1);
cm.sendOk("Huh, are you looking for me? Chief Stan sent you here, right? But hey, I am not the suspect you seek. If I have some proof? Here, take this and return it to #b#p1012003##k.");
} else {
cm.sendOk("Hey, make a slot available before talking to me.");
}
} else {
cm.sendOk("Zzzzzz...");
}
cm.dispose();
}
}
}
+1 -1
View File
@@ -138,7 +138,7 @@ function action(mode, type, selection) {
qty = 1; qty = 1;
} }
else else
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
if (selectedType == 0){ //glove refine if (selectedType == 0){ //glove refine
var itemSet = new Array(1082002,1082029,1082030,1082031,1082032,1082037,1082042,1082046,1082075,1082065,1082092); var itemSet = new Array(1082002,1082029,1082030,1082031,1082032,1082037,1082042,1082046,1082075,1082065,1082092);
+1 -1
View File
@@ -129,7 +129,7 @@ function action(mode, type, selection) {
qty = 1; qty = 1;
} }
else else
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
last_use = false; last_use = false;
+1 -1
View File
@@ -66,7 +66,7 @@ function action(mode, type, selection) {
qty = 1; qty = 1;
} }
else else
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
if (selectedType == 0){ //Making a Knuckler if (selectedType == 0){ //Making a Knuckler
var itemSet = new Array(1482001, 1482002, 1482003, 1482004, 1482005, 1482006, 1482007); var itemSet = new Array(1482001, 1482002, 1482003, 1482004, 1482005, 1482006, 1482007);
+29 -2
View File
@@ -30,6 +30,33 @@ No specific function, useless text.
*/ */
function start() { function start() {
cm.sendOk("(Scratch scratch...)"); status = -1;
cm.dispose(); action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && type > 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if(status == 0) {
if(!cm.haveItem(4220153)) {
cm.sendOk("(Scratch scratch...)");
cm.dispose();
} else {
cm.sendYesNo("Hey, nice #bTreasure Map#k you have there? #rCan I keep it#k for the Nautilus crew, if you don't need it any longer?");
}
} else if(status == 1) {
cm.gainItem(4220153, -1);
cm.dispose();
}
}
} }
+1 -1
View File
@@ -182,7 +182,7 @@ function action(mode, type, selection) {
qty = 1; qty = 1;
} }
else else
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
if (selectedType == 5){ //arrow refine if (selectedType == 5){ //arrow refine
var itemSet = new Array(2060000,2061000,2060001,2061001,2060002,2061002); var itemSet = new Array(2060000,2061000,2060001,2061001,2060002,2061002);
+1 -1
View File
@@ -196,7 +196,7 @@ function action(mode, type, selection) {
qty = 1; qty = 1;
} }
else else
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
var prompt = "You want me to make "; var prompt = "You want me to make ";
if (qty == 1) if (qty == 1)
+1 -1
View File
@@ -120,7 +120,7 @@ function action(mode, type, selection) {
qty = 1; qty = 1;
} }
else else
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
var prompt = "You want me to make "; var prompt = "You want me to make ";
if (qty == 1) if (qty == 1)
+1 -1
View File
@@ -43,7 +43,7 @@ function action(mode, type, selection) {
cm.warp(270050000); cm.warp(270050000);
} }
else { else {
cm.sendOk("You cannot receive an event prize without having an empty room in your EQUIP, USE, SET-UP or ETC inventory."); cm.sendOk("You cannot receive an event prize without having an empty room in your EQUIP, USE, SET-UP and ETC inventory.");
} }
cm.dispose(); cm.dispose();
+1 -1
View File
@@ -58,7 +58,7 @@ function action(mode, type, selection) {
} }
else if (status == 3) { else if (status == 3) {
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
last_use = false; last_use = false;
var prompt = "You want us to make "; var prompt = "You want us to make ";
+1 -1
View File
@@ -58,7 +58,7 @@ function action(mode, type, selection) {
} }
else if (status == 3) { else if (status == 3) {
qty = selection; qty = (selection > 0) ? selection : (-selection <= 0 ? 1 : -selection);
last_use = false; last_use = false;
var prompt = "So, you want me to make "; var prompt = "So, you want me to make ";
+30
View File
@@ -0,0 +1,30 @@
var map = 677000004;
var quest = 28179;
var status = -1;
function start(mode, type, selection) {
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1) {
status++;
} else {
cm.dispose();
return;
}
if (status == 0) {
if (cm.isQuestStarted(quest)) {
cm.sendYesNo("Would you like to move to #b#m" + map + "##k?");
} else {
cm.sendOk("The entrance is blocked by a strange force.");
cm.dispose();
}
} else {
if(cm.haveItem(4001341, 1)) cm.gainItem(4001341, -1);
if(cm.haveItem(4032478, 1)) cm.gainItem(4032478, -1);
cm.warp(map, 0);
cm.dispose();
}
}
+22 -56
View File
@@ -1,61 +1,27 @@
/* var map = 677000000;
Demon's Doorway var quest = 28198;
Marbas the Demon! Quest var status = -1;
Victoria Road: The Tree That Grew III
*/
var status; function start(mode, type, selection) {
function start(){
status = -1;
action(1, 0, 0); action(1, 0, 0);
} }
function action(mode, type, selection){ function action(mode, type, selection) {
if (mode == -1){ if (mode == 1) {
cm.dispose(); status++;
} } else {
else{ cm.dispose();
if (mode == 0 && status ==0){ return;
cm.dispose(); }
return; if (status == 0) {
} if (cm.isQuestStarted(quest)) {
cm.sendYesNo("Would you like to move to #b#m" + map + "##k?");
if (mode == 1) } else {
status++; cm.sendOk("The entrance is blocked by a strange force.");
else cm.dispose();
status--; }
} else {
if (status == 0){ cm.warp(map, 0);
cm.sendNext("#r\t[Requirements to Enter]\r\n\r\n\t\t1.#k Job must be Magician or Blaze Wizard.\r\n\t\t#r2.#k Must be under level 40.\r\n\t\t#r3.#k Must have #b#t4032495##k."); cm.dispose();
} }
else if (status == 1){
var jobId = cm.getJobId();
if ((jobId >= 200 && jobId <= 232) || (jobId >= 1100 && jobId <= 1112)){
if (cm.getLevel() < 40){
if (cm.hasItem(4032495)){
cm.sendYesNo("#kAll conditions have been satisfied. Do you wish to enter?");
}
else{
cm.sendOk("\t\tYou do not have #b#t4032495# #i4032495#");
cm.dispose();
}
}
else{
cm.sendOk("\tYour #blevel#k is too high.");
cm.dispose();
}
}
else{
cm.sendOk("\tThis is not for you! #rBegone#k you fool!");
cm.dispose();
}
}
else if (status == 2){
cm.warp(677000000, 2);
cm.dispose();
}
}
} }
+10 -7
View File
@@ -1,3 +1,5 @@
var map = 677000008;
var quest = 28219;
var status = -1; var status = -1;
function start(mode, type, selection) { function start(mode, type, selection) {
@@ -12,16 +14,17 @@ function action(mode, type, selection) {
return; return;
} }
if (status == 0) { if (status == 0) {
if (cm.isQuestStarted(28219)) { if (cm.isQuestStarted(quest)) {
cm.sendYesNo("Would you like to move to Valefor's Strolling Place?"); cm.sendYesNo("Would you like to move to #b#m" + map + "##k?");
} else { } else {
cm.sendOk("The entrance is blocked by a strange force."); cm.sendOk("The entrance is blocked by a strange force.");
cm.dispose(); cm.dispose();
} }
} else { } else {
if(cm.haveItem(4032485, 1)) cm.gainItem(4032485, -1); if(cm.haveItem(4032485, 1)) cm.gainItem(4032485, -1);
if(cm.haveItem(4001355, 1)) cm.gainItem(4001355, -1); if(cm.haveItem(4001355, 1)) cm.gainItem(4001355, -1);
cm.warp(677000008,0);
cm.warp(map, 0);
cm.dispose(); cm.dispose();
} }
} }
+31
View File
@@ -0,0 +1,31 @@
var map = 677000002;
var quest = 28238;
var status = -1;
function start(mode, type, selection) {
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1) {
status++;
} else {
cm.dispose();
return;
}
if (status == 0) {
if (cm.isQuestStarted(quest)) {
cm.sendYesNo("Would you like to move to #b#m" + map + "##k?");
} else {
cm.sendOk("The entrance is blocked by a strange force.");
cm.dispose();
}
} else {
if(cm.haveItem(4032481, 1)) cm.gainItem(4032481, -1);
if(cm.haveItem(4032482, 1)) cm.gainItem(4032482, -1);
if(cm.haveItem(4032483, 1)) cm.gainItem(4032483, -1);
cm.warp(map, 0);
cm.dispose();
}
}
+34
View File
@@ -0,0 +1,34 @@
var map = 677000006;
var quest = 28256;
var status = -1;
function start(mode, type, selection) {
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1) {
status++;
} else {
cm.dispose();
return;
}
if (status == 0) {
if (cm.isQuestStarted(quest)) {
cm.sendYesNo("Would you like to move to #b#m" + map + "##k?");
} else {
cm.sendOk("The entrance is blocked by a strange force.");
cm.dispose();
}
} else {
if(cm.haveItem(4001362, 1)) cm.gainItem(4001362, -cm.getItemQuantity(4001362));
if(cm.haveItem(4001363, 1)) cm.gainItem(4001363, -cm.getItemQuantity(4001363));
if(cm.haveItem(4032486, 1)) cm.gainItem(4032486, -1);
if(cm.haveItem(4032488, 1)) cm.gainItem(4032488, -1);
if(cm.haveItem(4032489, 1)) cm.gainItem(4032489, -1);
if(cm.haveItem(4220153, 1)) cm.gainItem(4220153, -1);
cm.warp(map, 0);
cm.dispose();
}
}
+2 -2
View File
@@ -32,12 +32,12 @@ function enter(pi) {
return false; return false;
} }
if(pi.getPlayer().getEventInstance().giveEventReward(pi.getPlayer(), evLevel)) { if(!pi.getPlayer().getEventInstance().giveEventReward(pi.getPlayer(), evLevel)) {
pi.warp(970030000); pi.warp(970030000);
return true; return true;
} }
else { else {
pi.message("You cannot receive an event prize without having an empty room in your EQUIP, USE, SET-UP or ETC inventory."); pi.message("Make a room available on all EQUIP, USE, SET-UP and ETC inventory to claim an event prize.");
return false; return false;
} }
} }
+3
View File
@@ -0,0 +1,3 @@
function act() {
rm.dropItems();
}
+3
View File
@@ -0,0 +1,3 @@
function act() {
rm.dropItems();
}
+4 -4
View File
@@ -3748,7 +3748,7 @@ INSERT IGNORE INTO `temp_data` (`id`, `dropperid`, `itemid`, `minimum_quantity`,
(3530, 4240000, 4004003, 1, 1, 0, 10000), (3530, 4240000, 4004003, 1, 1, 0, 10000),
(3531, 4240000, 2043801, 1, 1, 0, 300), (3531, 4240000, 2043801, 1, 1, 0, 300),
(3532, 4240000, 4006001, 1, 1, 0, 10000), (3532, 4240000, 4006001, 1, 1, 0, 10000),
(3533, 4240000, 4021009, 1, 1, 0, 9000), (3533, 4240000, 4021009, 1, 1, 0, 7000),
(3534, 4240000, 1322016, 1, 1, 0, 700), (3534, 4240000, 1322016, 1, 1, 0, 700),
(3535, 4240000, 1041074, 1, 1, 0, 800), (3535, 4240000, 1041074, 1, 1, 0, 800),
(3536, 4240000, 1061069, 1, 1, 0, 800), (3536, 4240000, 1061069, 1, 1, 0, 800),
@@ -4123,7 +4123,7 @@ INSERT IGNORE INTO `temp_data` (`id`, `dropperid`, `itemid`, `minimum_quantity`,
(3904, 5120100, 4020001, 1, 1, 0, 90000), (3904, 5120100, 4020001, 1, 1, 0, 90000),
(3905, 5120100, 4010006, 1, 1, 0, 90000), (3905, 5120100, 4010006, 1, 1, 0, 90000),
(3906, 5120100, 4020007, 1, 1, 0, 90000), (3906, 5120100, 4020007, 1, 1, 0, 90000),
(3907, 5120100, 4011007, 1, 1, 0, 30000), (3907, 5120100, 4011007, 1, 1, 0, 7000),
(3908, 5120100, 2044602, 1, 1, 0, 3000), (3908, 5120100, 2044602, 1, 1, 0, 3000),
(3909, 5120100, 1041082, 1, 1, 0, 8000), (3909, 5120100, 1041082, 1, 1, 0, 8000),
(3910, 5120100, 1061081, 1, 1, 0, 8000), (3910, 5120100, 1061081, 1, 1, 0, 8000),
@@ -16675,8 +16675,8 @@ INSERT INTO `reactordrops` (`reactordropid`, `reactorid`, `itemid`, `chance`, `q
(125, 1022001, 4032319, 7, -1), (125, 1022001, 4032319, 7, -1),
(126, 1022002, 4001340, 1, 28167), (126, 1022002, 4001340, 1, 28167),
(127, 1202000, 4001366, 1, 28194), (127, 1202000, 4001366, 1, 28194),
(128, 1202003, 4001346, 1, 28225), (128, 1202003, 4001346, 3, 28225),
(129, 1202004, 4001346, 1, 28225), (129, 1202004, 4001346, 3, 28225),
(130, 1032000, 4032362, 1, 28252), (130, 1032000, 4032362, 1, 28252),
(131, 1032000, 4032363, 1, 28252), (131, 1032000, 4032363, 1, 28252),
(132, 1202004, 4032494, 1, 28255), (132, 1202004, 4032494, 1, 28255),
+80 -32
View File
@@ -96,8 +96,8 @@ USE `heavenms`;
(9300219, 4000003, 1, 1, 0, 200000), (9300219, 4000003, 1, 1, 0, 200000),
(130100, 4030009, 1, 1, 0, 10000), (130100, 4030009, 1, 1, 0, 10000),
(9300219, 4030009, 1, 1, 0, 10000), (9300219, 4030009, 1, 1, 0, 10000),
(130100, 4001358, 1, 1, 0, 7000), (130100, 4001358, 1, 1, 0, 20000),
(9300219, 4001358, 1, 1, 0, 7000), (9300219, 4001358, 1, 1, 0, 20000),
(130100, 2000000, 1, 1, 0, 40000), (130100, 2000000, 1, 1, 0, 40000),
(9300219, 2000000, 1, 1, 0, 40000), (9300219, 2000000, 1, 1, 0, 40000),
(130100, 2040402, 1, 1, 0, 750), (130100, 2040402, 1, 1, 0, 750),
@@ -130,8 +130,8 @@ USE `heavenms`;
(9300219, 1482001, 1, 1, 0, 700), (9300219, 1482001, 1, 1, 0, 700),
(130101, 4000016, 1, 1, 0, 200000), (130101, 4000016, 1, 1, 0, 200000),
(9300218, 4000016, 1, 1, 0, 200000), (9300218, 4000016, 1, 1, 0, 200000),
(130101, 4001359, 1, 1, 0, 7000), (130101, 4001359, 1, 1, 0, 24000),
(9300218, 4001359, 1, 1, 0, 7000), (9300218, 4001359, 1, 1, 0, 24000),
(130101, 2000000, 1, 1, 0, 40000), (130101, 2000000, 1, 1, 0, 40000),
(9300218, 2000000, 1, 1, 0, 40000), (9300218, 2000000, 1, 1, 0, 40000),
(130101, 2040502, 1, 1, 0, 750), (130101, 2040502, 1, 1, 0, 750),
@@ -568,7 +568,7 @@ USE `heavenms`;
(1110101, 4030009, 1, 1, 0, 10000), (1110101, 4030009, 1, 1, 0, 10000),
(1110101, 4001344, 1, 1, 0, 7000), (1110101, 4001344, 1, 1, 0, 7000),
(1110101, 4001356, 1, 1, 0, 7000), (1110101, 4001356, 1, 1, 0, 7000),
(1110101, 4001360, 1, 1, 0, 7000), (1110101, 4001360, 1, 1, 0, 12000),
(1110101, 2000000, 1, 1, 0, 40000), (1110101, 2000000, 1, 1, 0, 40000),
(1110101, 2040802, 1, 1, 0, 750), (1110101, 2040802, 1, 1, 0, 750),
(1110101, 2380008, 1, 1, 0, 0), (1110101, 2380008, 1, 1, 0, 0),
@@ -2064,26 +2064,8 @@ USE `heavenms`;
(9300221, 1061054, 1, 1, 0, 700), (9300221, 1061054, 1, 1, 0, 700),
(2100103, 1072291, 1, 1, 0, 700), (2100103, 1072291, 1, 1, 0, 700),
(9300221, 1072291, 1, 1, 0, 700), (9300221, 1072291, 1, 1, 0, 700),
(9400609, 2000003, 1, 4, 0, 40000),
(9400609, 2000002, 1, 4, 0, 40000),
(9400609, 2002004, 1, 4, 0, 10000),
(9400609, 4010000, 1, 1, 0, 7000),
(9400609, 4010004, 1, 1, 0, 7000),
(9400609, 4010002, 1, 1, 0, 7000),
(9400609, 4010001, 1, 1, 0, 7000),
(9400610, 2000002, 1, 4, 0, 40000),
(9400623, 2000002, 1, 4, 0, 40000), (9400623, 2000002, 1, 4, 0, 40000),
(9400610, 4010002, 1, 1, 0, 7000),
(9400623, 4010002, 1, 1, 0, 7000), (9400623, 4010002, 1, 1, 0, 7000),
(9400612, 4020000, 1, 1, 0, 7000),
(9400612, 4010001, 1, 1, 0, 7000),
(9400612, 4010002, 1, 1, 0, 7000),
(9400612, 2000003, 1, 4, 0, 40000),
(9400612, 2000002, 1, 4, 0, 40000),
(9400612, 4010000, 1, 1, 0, 7000),
(9400612, 1082257, 1, 1, 0, 40000),
(9400612, 1003032, 1, 1, 0, 40000),
(9400612, 1072420, 1, 1, 0, 40000),
(2230112, 4000020, 1, 1, 0, 200000), (2230112, 4000020, 1, 1, 0, 200000),
(2230112, 4003004, 1, 1, 0, 7000), (2230112, 4003004, 1, 1, 0, 7000),
(2230112, 4000021, 1, 1, 0, 200000), (2230112, 4000021, 1, 1, 0, 200000),
@@ -7679,10 +7661,10 @@ USE `heavenms`;
(9400502, 1072303, 1, 1, 0, 40000), (9400502, 1072303, 1, 1, 0, 40000),
(9500121, 1072303, 1, 1, 0, 700), (9500121, 1072303, 1, 1, 0, 700),
(9500156, 1072303, 1, 1, 0, 700), (9500156, 1072303, 1, 1, 0, 700),
(4240000, 4021009, 1, 1, 0, 7000), (4240000, 4021009, 1, 1, 0, 5000),
(9300334, 4021009, 1, 1, 0, 7000), (9300334, 4021009, 1, 1, 0, 5000),
(9500122, 4021009, 1, 1, 0, 7000), (9500122, 4021009, 1, 1, 0, 5000),
(9500369, 4021009, 1, 1, 0, 7000), (9500369, 4021009, 1, 1, 0, 5000),
(4240000, 4130015, 1, 1, 0, 3000), (4240000, 4130015, 1, 1, 0, 3000),
(9300334, 4130015, 1, 1, 0, 3000), (9300334, 4130015, 1, 1, 0, 3000),
(9500122, 4130015, 1, 1, 0, 3000), (9500122, 4130015, 1, 1, 0, 3000),
@@ -8453,7 +8435,7 @@ USE `heavenms`;
(9420505, 1041014, 1, 1, 0, 700), (9420505, 1041014, 1, 1, 0, 700),
(9420505, 1041065, 1, 1, 0, 700), (9420505, 1041065, 1, 1, 0, 700),
(9420505, 1061070, 1, 1, 0, 700), (9420505, 1061070, 1, 1, 0, 700),
(5120100, 4011007, 1, 1, 0, 7000), (5120100, 4011007, 1, 1, 0, 5000),
(5120100, 2000002, 1, 4, 0, 40000), (5120100, 2000002, 1, 4, 0, 40000),
(5120100, 2000004, 1, 4, 0, 40000), (5120100, 2000004, 1, 4, 0, 40000),
(5120100, 2002010, 1, 4, 0, 10000), (5120100, 2002010, 1, 4, 0, 10000),
@@ -19962,7 +19944,71 @@ USE `heavenms`;
(1110100, 4032317, 1, 1, 21717, 20000), (1110100, 4032317, 1, 1, 21717, 20000),
(1110130, 4032317, 1, 1, 21717, 20000), (1110130, 4032317, 1, 1, 21717, 20000),
(1110100, 4032318, 1, 1, 21718, 20000), (1110100, 4032318, 1, 1, 21718, 20000),
(1110130, 4032318, 1, 1, 21718, 20000); (1110130, 4032318, 1, 1, 21718, 20000),
(9400204, 4130020, 1, 1, 0, 3000),
(9400614, 4001341, 1, 1, 28172, 15000),
(9400615, 4001341, 1, 1, 28172, 15000),
(9400616, 4001341, 1, 1, 28172, 15000),
(1110101, 4001347, 1, 1, 28229, 80000),
(1110100, 4001348, 1, 1, 28231, 400000),
(1120100, 4001349, 1, 1, 28235, 100000),
(1210101, 4001350, 1, 1, 28235, 100000),
(2220100, 4001351, 1, 1, 28237, 100000),
(9400614, 4001352, 1, 1, 28205, 40000),
(9400615, 4001352, 1, 1, 28205, 40000),
(9400616, 4001352, 1, 1, 28205, 40000),
(9400617, 4001352, 1, 1, 28205, 40000),
(9400617, 4001362, 1, 1, 28252, 40000),
(9400655, 4001362, 1, 1, 28252, 40000),
(9400656, 4001362, 1, 1, 28252, 40000),
(9400617, 4001363, 1, 1, 28252, 40000),
(9400655, 4001363, 1, 1, 28252, 40000),
(9400656, 4001363, 1, 1, 28252, 40000),
(9400609, 2000002, 1, 1, 0, 40000),
(9400609, 2000003, 1, 1, 0, 40000),
(9400609, 2000004, 1, 1, 0, 10000),
(9400609, 4010000, 1, 1, 0, 7000),
(9400609, 4010001, 1, 1, 0, 7000),
(9400609, 4010004, 1, 1, 0, 7000),
(9400609, 4020006, 1, 1, 0, 7000),
(9400609, 1082256, 1, 1, 0, 5000),
(9400609, 1072419, 1, 1, 0, 5000),
(9400610, 2000002, 1, 1, 0, 40000),
(9400610, 2000003, 1, 1, 0, 40000),
(9400610, 2000004, 1, 1, 0, 10000),
(9400610, 4010000, 1, 1, 0, 7000),
(9400610, 4010006, 1, 1, 0, 7000),
(9400610, 4020004, 1, 1, 0, 7000),
(9400610, 4020008, 1, 1, 0, 7000),
(9400610, 1082259, 1, 1, 0, 5000),
(9400610, 1072422, 1, 1, 0, 5000),
(9400611, 2000002, 1, 1, 0, 40000),
(9400611, 2000003, 1, 1, 0, 40000),
(9400611, 2000004, 1, 1, 0, 10000),
(9400611, 4010003, 1, 1, 0, 7000),
(9400611, 4020003, 1, 1, 0, 7000),
(9400611, 4020005, 1, 1, 0, 7000),
(9400611, 4020007, 1, 1, 0, 7000),
(9400611, 1082260, 1, 1, 0, 5000),
(9400611, 1072423, 1, 1, 0, 5000),
(9400612, 2000002, 1, 1, 0, 40000),
(9400612, 2000003, 1, 1, 0, 40000),
(9400612, 2000004, 1, 1, 0, 10000),
(9400612, 4010001, 1, 1, 0, 7000),
(9400612, 4010003, 1, 1, 0, 7000),
(9400612, 4020000, 1, 1, 0, 7000),
(9400612, 4020001, 1, 1, 0, 7000),
(9400612, 1082257, 1, 1, 0, 5000),
(9400612, 1072420, 1, 1, 0, 5000),
(9400613, 2000002, 1, 1, 0, 40000),
(9400613, 2000003, 1, 1, 0, 40000),
(9400613, 2000004, 1, 1, 0, 10000),
(9400613, 4010000, 1, 1, 0, 7000),
(9400613, 4010002, 1, 1, 0, 7000),
(9400613, 4010006, 1, 1, 0, 7000),
(9400613, 4020002, 1, 1, 0, 7000),
(9400613, 1082258, 1, 1, 0, 5000),
(9400613, 1072421, 1, 1, 0, 5000);
# (dropperid, itemid, minqty, maxqty, questid, chance) # (dropperid, itemid, minqty, maxqty, questid, chance)
@@ -20101,8 +20147,8 @@ USE `heavenms`;
UPDATE drop_data SET questid=28248 WHERE itemid=4001358; UPDATE drop_data SET questid=28248 WHERE itemid=4001358;
UPDATE drop_data SET questid=28248 WHERE itemid=4001359; UPDATE drop_data SET questid=28248 WHERE itemid=4001359;
UPDATE drop_data SET questid=7777 WHERE itemid=4001342; #id 7777 for ALL "quest items" with no v83 quest. UPDATE drop_data SET questid=28175 WHERE itemid=4001342;
UPDATE drop_data SET questid=7777 WHERE itemid=4031906; UPDATE drop_data SET questid=7777 WHERE itemid=4031906; #id 7777 for ALL "quest items" with no v83 quest.
UPDATE drop_data SET chance=0 WHERE itemid=2050099; UPDATE drop_data SET chance=0 WHERE itemid=2050099;
UPDATE drop_data SET chance=40000 WHERE itemid=4031991; UPDATE drop_data SET chance=40000 WHERE itemid=4031991;
UPDATE drop_data SET questid=6191 WHERE itemid=4031477; UPDATE drop_data SET questid=6191 WHERE itemid=4031477;
@@ -21359,7 +21405,6 @@ USE `heavenms`;
(9102001, 2020002, 2, -1), (9102001, 2020002, 2, -1),
(2002018, 4161014, 1, 3099), (2002018, 4161014, 1, 3099),
(1012000, 4032143, 6, 20717), (1012000, 4032143, 6, 20717),
(1202000, 4001366, 1, 28194),
(2402008, 4032512, 5, 3720), (2402008, 4032512, 5, 3720),
(2602000, 4031574, 1, 3935), (2602000, 4031574, 1, 3935),
(2619000, 4031709, 1, 3310), (2619000, 4031709, 1, 3310),
@@ -21826,7 +21871,10 @@ USE `heavenms`;
(9400581, 0, 418, 617, 0, 400000), (9400581, 0, 418, 617, 0, 400000),
(9400582, 0, 1127, 1583, 0, 400000), (9400582, 0, 1127, 1583, 0, 400000),
(9400609, 0, 204, 1010, 0, 400000), (9400609, 0, 204, 1010, 0, 400000),
(9400610, 0, 204, 1010, 0, 400000),
(9400611, 0, 204, 1010, 0, 400000),
(9400612, 0, 204, 1010, 0, 400000), (9400612, 0, 204, 1010, 0, 400000),
(9400613, 0, 204, 1010, 0, 400000),
(9400633, 0, 258, 1270, 0, 400000), (9400633, 0, 258, 1270, 0, 400000),
(9400644, 0, 42, 61, 0, 400000), (9400644, 0, 42, 61, 0, 400000),
(9410014, 0, 493, 728, 0, 400000), (9410014, 0, 493, 728, 0, 400000),
+2 -1
View File
@@ -121,13 +121,14 @@ public class Item implements Comparable<Item> {
this.petid = id; this.petid = id;
} }
@Override
public int compareTo(Item other) { public int compareTo(Item other) {
if (this.id < other.getItemId()) { if (this.id < other.getItemId()) {
return -1; return -1;
} else if (this.id > other.getItemId()) { } else if (this.id > other.getItemId()) {
return 1; return 1;
} }
return 0; return 0;
} }
@Override @Override
+30 -1
View File
@@ -24,8 +24,10 @@ package client.inventory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Map; import java.util.Map;
@@ -178,9 +180,36 @@ public class MapleInventory implements Iterable<Item> {
ret.add(item); ret.add(item);
} }
} }
if (ret.size() > 1) { if (ret.size() > 1) {
Collections.sort(ret); Collections.sort(ret, new Comparator<Item>() {
@Override
public int compare(Item i1, Item i2) {
return i1.getPosition() - i2.getPosition();
}
});
} }
return ret;
}
public List<Item> linkedListById(int itemId) {
List<Item> ret = new LinkedList<>();
for (Item item : list()) {
if (item.getItemId() == itemId) {
ret.add(item);
}
}
if (ret.size() > 1) {
Collections.sort(ret, new Comparator<Item>() {
@Override
public int compare(Item i1, Item i2) {
return i1.getPosition() - i2.getPosition();
}
});
}
return ret; return ret;
} }
@@ -35,89 +35,111 @@ import tools.data.output.MaplePacketLittleEndianWriter;
/** /**
* *
* @author XoticStory * @author XoticStory, Ronan
*/ */
public final class AllianceOperationHandler extends AbstractMaplePacketHandler { public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
@Override @Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
MapleAlliance alliance = null; MapleAlliance alliance = null;
if (c.getPlayer().getGuild() != null && c.getPlayer().getGuild().getAllianceId() > 0) { MapleCharacter chr = c.getPlayer();
alliance = c.getPlayer().getAlliance();
if (chr.getGuild() == null) {
c.announce(MaplePacketCreator.enableActions());
return;
} }
if (alliance == null) {
c.announce(MaplePacketCreator.enableActions()); if (chr.getGuild().getAllianceId() > 0) {
return; alliance = chr.getAlliance();
} else if (c.getPlayer().getMGC().getAllianceRank() > 2 || !alliance.getGuilds().contains(c.getPlayer().getGuildId())) {
c.announce(MaplePacketCreator.enableActions());
return;
} }
byte b = slea.readByte(); byte b = slea.readByte();
if (alliance == null) {
if (b != 4) {
c.announce(MaplePacketCreator.enableActions());
return;
}
} else {
if (b == 4) {
chr.dropMessage("Your guild is already registered on a Guild Alliance.");
c.announce(MaplePacketCreator.enableActions());
return;
}
if (chr.getMGC().getAllianceRank() > 2 || !alliance.getGuilds().contains(chr.getGuildId())) {
c.announce(MaplePacketCreator.enableActions());
return;
}
}
// "alliance" is only null at case 0x04
switch (b) { switch (b) {
case 0x01: case 0x01:
Server.getInstance().allianceMessage(alliance.getId(), sendShowInfo(c.getPlayer().getGuild().getAllianceId(), c.getPlayer().getId()), -1, -1); Server.getInstance().allianceMessage(alliance.getId(), sendShowInfo(chr.getGuild().getAllianceId(), chr.getId()), -1, -1);
break; break;
case 0x02: { // Leave Alliance case 0x02: { // Leave Alliance
if (c.getPlayer().getGuild().getAllianceId() == 0 || c.getPlayer().getGuildId() < 1 || c.getPlayer().getGuildRank() != 1) { if (chr.getGuild().getAllianceId() == 0 || chr.getGuildId() < 1 || chr.getGuildRank() != 1) {
return; return;
} }
MapleAlliance.removeGuildFromAlliance(c.getPlayer().getGuild().getAllianceId(), c.getPlayer().getGuildId(), c.getPlayer().getWorld()); MapleAlliance.removeGuildFromAlliance(chr.getGuild().getAllianceId(), chr.getGuildId(), chr.getWorld());
break; break;
} }
case 0x03: // send alliance invite... or at least it would be this way if i could find the right way to call it! case 0x03: // Send Invite
String guildName = slea.readMapleAsciiString(); String guildName = slea.readMapleAsciiString();
if(alliance.getGuilds().size() == alliance.getCapacity()) { if(alliance.getGuilds().size() == alliance.getCapacity()) {
c.getPlayer().dropMessage("Your alliance can not comport any more guild at the moment."); chr.dropMessage("Your alliance cannot comport any more guilds at the moment.");
} else { } else {
MapleGuild mg = Server.getInstance().getGuildByName(guildName); MapleGuild mg = Server.getInstance().getGuildByName(guildName);
if(mg == null) { if(mg == null) {
c.getPlayer().dropMessage("The entered guild does not exist."); chr.dropMessage("The entered guild does not exist.");
} }
else { else {
MapleCharacter victim = mg.getMGC(mg.getLeaderId()).getCharacter(); MapleCharacter victim = mg.getMGC(mg.getLeaderId()).getCharacter();
if (victim == null) { if (victim == null) {
c.getPlayer().dropMessage("The master of the guild that you offered an invitation is currently not online."); chr.dropMessage("The master of the guild that you offered an invitation is currently not online.");
} else { } else {
// this doesn't seem to work... victim.getClient().announce(MaplePacketCreator.sendAllianceInvitation(alliance.getId(), chr));
//Server.getInstance().allianceMessage(alliance.getId(), sendInvitation(c.getPlayer().getGuild().getAllianceId(), victim.getId(), guildName), -1, -1);
//victim.getClient().announce(sendInvitation(c.getPlayer().getGuild().getAllianceId(), c.getPlayer().getId(), guildName));
if(!c.getPlayer().isPartyMember(victim)) {
c.getPlayer().dropMessage("The master of the guild that you offered a invitation must be in the same party as yours.");
}
else {
int guildid = victim.getGuildId();
Server.getInstance().addGuildtoAlliance(alliance.getId(), guildid);
Server.getInstance().resetAllianceGuildPlayersRank(guildid);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.addGuildToAlliance(alliance, guildid, c), -1, -1);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.updateAllianceInfo(alliance, c), -1, -1);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.allianceNotice(alliance.getId(), alliance.getNotice()), -1, -1);
victim.getGuild().dropMessage("Your guild has joined the [" + alliance.getName() + "] union.");
}
} }
} }
} }
break; break;
case 0x04: { case 0x04: { // Accept Invite
int guildid = slea.readInt(); if (chr.getGuild().getAllianceId() != 0 || chr.getGuildRank() != 1 || chr.getGuildId() < 1) {
// slea.readMapleAsciiString();//guild name
if (c.getPlayer().getGuild().getAllianceId() != 0 || c.getPlayer().getGuildRank() != 1 || c.getPlayer().getGuildId() < 1) {
return; return;
} }
Server.getInstance().allianceMessage(alliance.getId(), sendChangeGuild(guildid, c.getPlayer().getId(), c.getPlayer().getGuildId(), 0), -1, -1);
int allianceid = slea.readInt();
//slea.readMapleAsciiString(); //recruiter's guild name
alliance = Server.getInstance().getAlliance(allianceid);
if (alliance == null) {
return;
}
int guildid = chr.getGuildId();
Server.getInstance().addGuildtoAlliance(alliance.getId(), guildid);
Server.getInstance().resetAllianceGuildPlayersRank(guildid);
chr.getMGC().setAllianceRank(2);
Server.getInstance().getGuild(chr.getGuildId()).getMGC(chr.getId()).setAllianceRank(2);
chr.saveGuildStatus();
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.addGuildToAlliance(alliance, guildid, c), -1, -1);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.updateAllianceInfo(alliance, c), -1, -1);
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.allianceNotice(alliance.getId(), alliance.getNotice()), -1, -1);
chr.getGuild().dropMessage("Your guild has joined the [" + alliance.getName() + "] union.");
break; break;
} }
case 0x06: { // Expel Guild case 0x06: { // Expel Guild
int guildid = slea.readInt(); int guildid = slea.readInt();
int allianceid = slea.readInt(); int allianceid = slea.readInt();
if (c.getPlayer().getGuild().getAllianceId() == 0 || c.getPlayer().getGuild().getAllianceId() != allianceid) { if (chr.getGuild().getAllianceId() == 0 || chr.getGuild().getAllianceId() != allianceid) {
return; return;
} }
@@ -132,13 +154,16 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
break; break;
} }
case 0x07: { // Change Alliance Leader case 0x07: { // Change Alliance Leader
if (c.getPlayer().getGuild().getAllianceId() == 0 || c.getPlayer().getGuildId() < 1) { if (chr.getGuild().getAllianceId() == 0 || chr.getGuildId() < 1) {
return; return;
} }
int victimid = slea.readInt(); int victimid = slea.readInt();
MapleCharacter player = Server.getInstance().getWorld(c.getWorld()).getPlayerStorage().getCharacterById(victimid); MapleCharacter player = Server.getInstance().getWorld(c.getWorld()).getPlayerStorage().getCharacterById(victimid);
if (player.getAllianceRank() != 2) {
return;
}
//Server.getInstance().allianceMessage(alliance.getId(), sendChangeLeader(c.getPlayer().getGuild().getAllianceId(), c.getPlayer().getId(), slea.readInt()), -1, -1); //Server.getInstance().allianceMessage(alliance.getId(), sendChangeLeader(chr.getGuild().getAllianceId(), chr.getId(), slea.readInt()), -1, -1);
changeLeaderAllianceRank(alliance, player); changeLeaderAllianceRank(alliance, player);
break; break;
} }
@@ -154,7 +179,7 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
int int1 = slea.readInt(); int int1 = slea.readInt();
byte byte1 = slea.readByte(); byte byte1 = slea.readByte();
//Server.getInstance().allianceMessage(alliance.getId(), sendChangeRank(c.getPlayer().getGuild().getAllianceId(), c.getPlayer().getId(), int1, byte1), -1, -1); //Server.getInstance().allianceMessage(alliance.getId(), sendChangeRank(chr.getGuild().getAllianceId(), chr.getId(), int1, byte1), -1, -1);
MapleCharacter player = Server.getInstance().getWorld(c.getWorld()).getPlayerStorage().getCharacterById(int1); MapleCharacter player = Server.getInstance().getWorld(c.getWorld()).getPlayerStorage().getCharacterById(int1);
changePlayerAllianceRank(alliance, player, (byte1 > 0)); changePlayerAllianceRank(alliance, player, (byte1 > 0));
@@ -168,7 +193,7 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
alliance.dropMessage(5, "* Alliance Notice : " + notice); alliance.dropMessage(5, "* Alliance Notice : " + notice);
break; break;
default: default:
c.getPlayer().dropMessage("Feature not available"); chr.dropMessage("Feature not available");
} }
alliance.saveToDB(); alliance.saveToDB();
@@ -195,7 +220,7 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
chr.saveGuildStatus(); chr.saveGuildStatus();
Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, chr.getWorld()), -1, -1); Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, chr.getWorld()), -1, -1);
alliance.dropMessage("'" + chr.getName() + "' has been reassigned as '" + alliance.getRankTitle(newRank) + "' in this Alliance."); alliance.dropMessage("'" + chr.getName() + "' has been reassigned to '" + alliance.getRankTitle(newRank) + "' in this Alliance.");
} }
private static byte[] sendShowInfo(int allianceid, int playerid) { private static byte[] sendShowInfo(int allianceid, int playerid) {
@@ -29,15 +29,27 @@ import net.AbstractMaplePacketHandler;
import server.MapleInventoryManipulator; import server.MapleInventoryManipulator;
import server.MapleItemInformationProvider; import server.MapleItemInformationProvider;
import server.MapleStatEffect; import server.MapleStatEffect;
import tools.Pair;
import tools.MaplePacketCreator; import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor; import tools.data.input.SeekableLittleEndianAccessor;
import constants.ServerConstants; import constants.ServerConstants;
import java.util.List;
/** /**
* *
* @author Ronan (multi-pot consumption feature) * @author Ronan (multi-pot consumption feature)
*/ */
public final class PetAutoPotHandler extends AbstractMaplePacketHandler { public final class PetAutoPotHandler extends AbstractMaplePacketHandler {
short slot;
int itemId;
Item toUse;
List<Item> toUseList;
boolean hasHpGain;
boolean hasMpGain;
short maxHp;
short maxMp;
@Override @Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
if (!c.getPlayer().isAlive()) { if (!c.getPlayer().isAlive()) {
@@ -45,45 +57,103 @@ public final class PetAutoPotHandler extends AbstractMaplePacketHandler {
return; return;
} }
MapleCharacter chr = c.getPlayer();
short maxHp = 0, maxMp = 0;
if(ServerConstants.USE_EQUIPS_ON_AUTOPOT) {
for(Item i : c.getPlayer().getInventory(MapleInventoryType.EQUIPPED).list()) {
Equip e = (Equip) i;
maxHp += e.getHp();
maxMp += e.getMp();
}
}
maxHp = (short) Math.min(chr.getMaxHp() + maxHp, 30000);
maxMp = (short) Math.min(chr.getMaxMp() + maxMp, 30000);
slea.readByte(); slea.readByte();
slea.readLong(); slea.readLong();
slea.readInt(); slea.readInt();
short slot = slea.readShort(); slot = slea.readShort();
int itemId = slea.readInt(); itemId = slea.readInt();
Item toUse = chr.getInventory(MapleInventoryType.USE).getItem(slot);
MapleCharacter chr = c.getPlayer();
toUse = chr.getInventory(MapleInventoryType.USE).getItem(slot);
if(toUse != null) { if(toUse != null) {
MapleStatEffect stat = MapleItemInformationProvider.getInstance().getItemEffect(toUse.getItemId()); if (toUse.getItemId() != itemId) {
if (toUse.getQuantity() <= 0 || toUse.getItemId() != itemId) {
c.announce(MaplePacketCreator.enableActions()); c.announce(MaplePacketCreator.enableActions());
return; return;
} }
do { toUseList = null;
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
stat.applyTo(chr);
//System.out.println(); // from now on, toUse becomes the "cursor" for the current pot being used
//System.out.println("hp: " + stat.getHp() + " player hp " + c.getPlayer().getHp() + " maxhp " + maxHp); if(toUse.getQuantity() <= 0) {
//System.out.println("mp: " + stat.getMp() + " player mp " + c.getPlayer().getMp() + " maxmp " + maxMp); if(!cursorOnNextAvailablePot(chr)) {
//System.out.println("redo? " + (((stat.getHp() > 0 && c.getPlayer().getHp() < ServerConstants.PET_AUTOHP_RATIO * maxHp) || (stat.getMp() > 0 && c.getPlayer().getMp() < ServerConstants.PET_AUTOMP_RATIO * maxMp)) && toUse.getQuantity() > 0)); c.announce(MaplePacketCreator.enableActions());
} while(((stat.getHp() > 0 && chr.getHp() < ServerConstants.PET_AUTOHP_RATIO * maxHp) || (stat.getMp() > 0 && chr.getMp() < ServerConstants.PET_AUTOMP_RATIO * maxMp)) && toUse.getQuantity() > 0); return;
}
}
MapleStatEffect stat = MapleItemInformationProvider.getInstance().getItemEffect(toUse.getItemId());
hasHpGain = stat.getHp() > 0 || stat.getHpRate() > 0.0;
hasMpGain = stat.getMp() > 0 || stat.getMpRate() > 0.0;
// contabilize the HP and MP gains from equipments on one's effective MaxHP/MaxMP
Pair<Short, Short> maxHpMp = calcEffectivePool(chr);
maxHp = maxHpMp.left;
maxMp = maxHpMp.right;
while(true) {
do {
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
stat.applyTo(chr);
//System.out.println();
//System.out.println("hp: " + hasHpGain + " player hp " + chr.getHp() + " maxhp " + maxHp);
//System.out.println("mp: " + hasMpGain + " player mp " + chr.getMp() + " maxmp " + maxMp);
//System.out.println("redo? " + (shouldReusePot(chr) && toUse.getQuantity() > 0));
} while(shouldReusePot(chr) && toUse.getQuantity() > 0);
if(toUse.getQuantity() == 0 && shouldReusePot(chr)) {
// depleted out the current slot, fetch for more
if(!cursorOnNextAvailablePot(chr)) {
break; // no more pots available
}
} else {
break; // gracefully finished it's job, quit the loop
}
}
} }
} }
private boolean cursorOnNextAvailablePot(MapleCharacter chr) {
if(toUseList == null) {
toUseList = chr.getInventory(MapleInventoryType.USE).linkedListById(itemId);
}
toUse = null;
while(!toUseList.isEmpty()) {
Item it = toUseList.remove(0);
if(it.getQuantity() > 0) {
toUse = it;
slot = it.getPosition();
return true;
}
}
return false;
}
private Pair<Short, Short> calcEffectivePool(MapleCharacter chr) {
short hp = 0, mp = 0;
if(ServerConstants.USE_EQUIPS_ON_AUTOPOT) {
for(Item i : chr.getInventory(MapleInventoryType.EQUIPPED).list()) {
Equip e = (Equip) i;
hp += e.getHp();
mp += e.getMp();
}
}
hp = (short) Math.min(chr.getMaxHp() + hp, 30000);
mp = (short) Math.min(chr.getMaxMp() + mp, 30000);
return new Pair<>(hp, mp);
}
private boolean shouldReusePot(MapleCharacter chr) {
return (hasHpGain && chr.getHp() < ServerConstants.PET_AUTOHP_RATIO * maxHp) || (hasMpGain && chr.getMp() < ServerConstants.PET_AUTOMP_RATIO * maxMp);
}
} }
-1
View File
@@ -130,7 +130,6 @@ public class MapleAlliance {
Server.getInstance().addAlliance(id, alliance); Server.getInstance().addAlliance(id, alliance);
System.out.println("\n\n\n\n----");
Server.getInstance().allianceMessage(id, MaplePacketCreator.updateAllianceInfo(alliance, guildMasters.get(0).getClient()), -1, -1); Server.getInstance().allianceMessage(id, MaplePacketCreator.updateAllianceInfo(alliance, guildMasters.get(0).getClient()), -1, -1);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
+8
View File
@@ -1593,6 +1593,14 @@ public class MapleStatEffect {
return mp; return mp;
} }
public double getHpRate() {
return hpR;
}
public double getMpRate() {
return mpR;
}
public byte getHpR() { public byte getHpR() {
return mhpR; return mhpR;
} }
+1
View File
@@ -69,6 +69,7 @@ public class MapleFoothold implements Comparable<MapleFoothold> {
return (slope * x) + intercept; return (slope * x) + intercept;
} }
@Override
public int compareTo(MapleFoothold o) { public int compareTo(MapleFoothold o) {
MapleFoothold other = o; MapleFoothold other = o;
if (p2.y < other.getY1()) { if (p2.y < other.getY1()) {
+10
View File
@@ -6344,6 +6344,16 @@ public class MaplePacketCreator {
return mplew.getPacket(); return mplew.getPacket();
} }
public static byte[] sendAllianceInvitation(int allianceid, MapleCharacter chr) {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.ALLIANCE_OPERATION.getValue());
mplew.write(0x03);
mplew.writeInt(allianceid);
mplew.writeMapleAsciiString(chr.getName());
mplew.writeShort(0);
return mplew.getPacket();
}
public static byte[] sendMesoLimit() { public static byte[] sendMesoLimit() {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.TRADE_MONEY_LIMIT.getValue()); //Players under level 15 can only trade 1m per day mplew.writeShort(SendOpcode.TRADE_MONEY_LIMIT.getValue()); //Players under level 15 can only trade 1m per day