CPQ tidyup patch + Guild Creation matcher + Solution to Login Accid=0

Adjusted AP gains, to get it to work following the AP Reset check method.
Fixed usage of inexistent itemids on CPQ and fishing.
Fixed one-of-a-kind items being lost in player trades due to missing inventory checks.
Implemented matching system for the guild creation phase. All players intending to join the new guild must be on the Guild Headquartes and accept the creation of the guild.
Fixed changing jobs not properly updating info on the party tab.
Fixed double tooltip information on CPQ actions UI.
Fixed CPQ not disbanding after a player leaves the party/instance.
Fixed checks for "in-progress" CPQ instances.
Fixed changing maps on CPQ not leading players back to the starting battlefield.
Reviewed login system, now preventing non-local IP connecting on local server and local IP on non-local server.
Reviewed login system, now cherrypicking sessions in transition state when trying to disconnect them due to a failed login (avoiding possible mishaps due to duplicate sessions of a same account).
Adjusted PiratePQ stage 2, now mobs respawn rather than making party leader request for new waves.
Adjusted Prime Minister, its spawn is no longer related to starting the quest. It should also allow party fights.
Fixed "forcevac" command not properly applying, rather sending to inventory, "consume-on-pickup" items.
Fixed (probably) accId = 0 issue on login, that was occurring due to client accountid's being set to 0 a while before being checked once again on finishLogin().
Fixed an issue with extended time on CPQ not properly showing the end-match's visual effect.
This commit is contained in:
ronancpl
2019-03-26 16:28:41 -03:00
parent 3bdf8cb2be
commit 83266508af
95 changed files with 2980 additions and 1420 deletions

View File

@@ -161,7 +161,6 @@ import constants.skills.Shadower;
import constants.skills.Sniper;
import constants.skills.Swordsman;
import constants.skills.ThunderBreaker;
import net.server.channel.handlers.PartyOperationHandler;
import scripting.item.ItemScriptManager;
import server.life.MobSkillFactory;
import server.maps.MapleMapItem;
@@ -1063,12 +1062,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
gainSp(spGain, GameConstants.getSkillBook(newJob.getId()), true);
}
// thanks xinyifly for finding out job advancements awarding APs
/*
if (newJob.getId() % 10 >= 1) {
gainAp(5, true);
// thanks xinyifly for finding out missing AP awards (AP Reset can be used as a compass)
if (newJob.getId() % 100 >= 1) {
if (this.isCygnus()) {
gainAp(7, true);
} else {
gainAp(5, true);
}
}
*/
if (!isGM()) {
for (byte i = 1; i < 5; i++) {
@@ -1128,6 +1129,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
effLock.unlock();
}
setMPC(new MaplePartyCharacter(this));
silentPartyUpdate();
if (dragon != null) {
@@ -1152,7 +1154,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
if (ServerConstants.USE_ANNOUNCE_CHANGEJOB) {
if (!this.isGM()) {
broadcastAcquaintances(6, "[" + GameConstants.ordinal(GameConstants.getJobBranch(newJob)) + " Job] " + name + " has just become a " + newJob.name() + ".");
broadcastAcquaintances(6, "[" + GameConstants.ordinal(GameConstants.getJobBranch(newJob)) + " Job] " + name + " has just become a " + GameConstants.getJobName(this.job.getId()) + "."); // thanks Vcoc for noticing job name appearing in uppercase here
}
}
}
@@ -1199,14 +1201,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
}
public MapleMap getWarpMap(int map) {
MapleMap target;
MapleMap warpMap;
EventInstanceManager eim = getEventInstance();
if (eim == null) {
target = client.getChannelServer().getMapFactory().getMap(map);
if (eim != null) {
warpMap = eim.getMapInstance(map);
} else if (this.getMonsterCarnival() != null && this.getMonsterCarnival().getEventMap().getId() == map) {
warpMap = this.getMonsterCarnival().getEventMap();
} else {
target = eim.getMapInstance(map);
warpMap = client.getChannelServer().getMapFactory().getMap(map);
}
return target;
return warpMap;
}
// for use ONLY inside OnUserEnter map scripts that requires a player to change map while still moving between maps.
@@ -1812,14 +1816,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
}
}
private boolean useItem(final int id) {
if (id / 1000000 == 2) {
if (ii.isConsumeOnPickup(id)) {
if (ItemConstants.isPartyItem(id)) {
public boolean applyConsumeOnPickup(final int itemid) {
if (itemid / 1000000 == 2) {
if (ii.isConsumeOnPickup(itemid)) {
if (ItemConstants.isPartyItem(itemid)) {
List<MapleCharacter> pchr = this.getPartyMembersOnSameMap();
if(!ItemConstants.isPartyAllcure(id)) {
MapleStatEffect mse = ii.getItemEffect(id);
if(!ItemConstants.isPartyAllcure(itemid)) {
MapleStatEffect mse = ii.getItemEffect(itemid);
if(!pchr.isEmpty()) {
for (MapleCharacter mc : pchr) {
@@ -1838,7 +1842,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
}
}
} else {
ii.getItemEffect(id).applyTo(this);
ii.getItemEffect(itemid).applyTo(this);
}
if (itemid / 10000 == 238) {
this.getMonsterBook().addCard(client, itemid);
}
return true;
}
@@ -1955,10 +1963,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
this.getCashShop().gainCash(1, nxGain);
showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300);
} else if (useItem(mItem.getItemId())) {
if (mItem.getItemId() / 10000 == 238) {
this.getMonsterBook().addCard(client, mItem.getItemId());
}
} else if (applyConsumeOnPickup(mItem.getItemId())) {
} else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) {
} else if (mItem.getItemId() == 4031868) {
this.getMap().broadcastMessage(MaplePacketCreator.updateAriantPQRanking(this.getName(), this.getItemQuantity(4031868, false), false));
@@ -5647,11 +5652,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
}
public boolean haveItem(int itemid) {
return getItemQuantity(itemid, false) > 0;
return getItemQuantity(itemid, ItemConstants.isEquipment(itemid)) > 0;
}
public boolean haveCleanItem(int itemid) {
return getCleanItemQuantity(itemid, false) > 0;
return getCleanItemQuantity(itemid, ItemConstants.isEquipment(itemid)) > 0;
}
public boolean hasEmptySlot(int itemId) {
@@ -5847,7 +5852,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
}
public boolean attemptCatchFish(int baitLevel) {
return GameConstants.isFishingArea(mapid) && this.getPosition().getY() > 0 && ItemConstants.isFishingChair(chair.get()) && this.getWorldServer().registerFisherPlayer(this, baitLevel);
return ServerConstants.USE_FISHING_SYSTEM && GameConstants.isFishingArea(mapid) && this.getPosition().getY() > 0 && ItemConstants.isFishingChair(chair.get()) && this.getWorldServer().registerFisherPlayer(this, baitLevel);
}
public void leaveMap() {
@@ -5969,8 +5974,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
}
} else {
int remainingAp = 5;
if (isCygnus() && level > 10 && level < 70) {
remainingAp++;
if (isCygnus()) {
if (level > 10) {
if (level <= 17) {
remainingAp += 2;
} else if (level < 77) {
remainingAp++;
}
}
}
gainAp(remainingAp, true);
@@ -6119,23 +6131,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
Runnable r = new Runnable() {
@Override
public void run() {
MapleParty party;
boolean partyLeader;
prtLock.lock();
try {
party = getParty();
partyLeader = party != null && isPartyLeader();
} finally {
prtLock.unlock();
}
if (party != null) {
if(partyLeader) {
party.assignNewLeader(client);
}
PartyOperationHandler.leaveParty(party, mpc, client);
if (leaveParty()) {
showHint("You have reached #blevel 10#k, therefore you must leave your #rstarter party#k.");
}
}
@@ -6147,6 +6143,28 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
levelUpMessages();
guildUpdate();
}
public boolean leaveParty() {
MapleParty party;
boolean partyLeader;
prtLock.lock();
try {
party = getParty();
partyLeader = party != null && isPartyLeader();
} finally {
prtLock.unlock();
}
if (party != null) {
if(partyLeader) party.assignNewLeader(client);
MapleParty.leaveParty(party, client);
return true;
} else {
return false;
}
}
private void levelUpMessages() {
if (level % 5 != 0) { //Performance FTW?
@@ -10288,11 +10306,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
this.challenged = challenged;
}
public void setLingua(int num) {
getClient().setLingua(num);
public void setLanguage(int num) {
getClient().setLanguage(num);
try {
Connection con = DatabaseConnection.getConnection();
try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET lingua = ? WHERE id = ?")) {
try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET language = ? WHERE id = ?")) {
ps.setInt(1, num);
ps.setInt(2, getClient().getAccID());
ps.executeUpdate();
@@ -10304,8 +10322,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
}
}
public int getLingua() {
return getClient().getLingua();
public int getLanguage() {
return getClient().getLanguage();
}
}