@Override public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { MapleCharacter player = c.getPlayer(); if (player.getJob().equals(MapleJob.LEGEND) || player.getJob().equals(MapleJob.ARAN1) || player.getJob().equals(MapleJob.ARAN2) || player.getJob().equals(MapleJob.ARAN3) || player.getJob().equals(MapleJob.ARAN4)) { final long currentTime = System.currentTimeMillis(); short combo = player.getCombo(); if ((currentTime - player.getLastCombo()) > 3000 && combo > 0) { combo = 0; player.cancelEffectFromBuffStat(MapleBuffStat.ARAN_COMBO); } combo++; switch (combo) { case 10: case 20: case 30: case 40: case 50: case 60: case 70: case 80: case 90: case 100: SkillFactory.getSkill(21000000).getEffect(combo / 10).applyComboBuff(player, combo); break; } player.setLastCombo(currentTime); player.setCombo(combo); } }
public int addMember(MapleCharacter member, boolean join) { if (getLeader() == null) { return -1; } final String job = MapleCarnivalChallenge.getJobBasicNameById(member.getJob()); if (join) { if (!containsMember(member) && !getAllNextPlayer().contains(member.getName())) { if (members.size() <= 30) { members.put(member.getName(), job); getLeader().dropMessage(5, member.getName() + " (" + job + ") has joined the fight!"); return 1; } return 2; } return -1; } else { if (containsMember(member)) { members.remove(member.getName()); getLeader() .dropMessage(5, member.getName() + " (" + job + ") have withdrawed from the fight."); return 1; } return -1; } }
public MapleSquad( final int ch, final String type, final MapleCharacter leader, final int expiration, final String toSay) { this.leader = new WeakReference<MapleCharacter>(leader); this.members.put(leader.getName(), MapleCarnivalChallenge.getJobBasicNameById(leader.getJob())); this.leaderName = leader.getName(); this.ch = ch; this.toSay = toSay; this.type = MapleSquadType.valueOf(type.toLowerCase()); this.status = 1; this.beginMapId = leader.getMapId(); leader.getMap().setSquad(this.type); if (this.type.queue.get(ch) == null) { this.type.queue.put(ch, new ArrayList<Pair<String, Long>>()); this.type.queuedPlayers.put(ch, new ArrayList<Pair<String, String>>()); } this.startTime = System.currentTimeMillis(); this.expiration = expiration; }
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { int min = slea.readInt(); int max = slea.readInt(); slea.readInt(); // members int jobs = slea.readInt(); MapleCharacter chr = c.getPlayer(); MapleMap map = chr.getMap(); Collection<MapleMapObject> mapobjs = map.getAllPlayer(); for (MapleMapObject mapobj : mapobjs) { if (chr.getParty().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(); party = c.getPlayer().getParty(); // .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)); } } } } } } }
/** * 角色快照数据 * * @param chr */ public CharacterTransfer(MapleCharacter chr) { this.characterid = chr.getId(); this.accountid = chr.getAccountID(); this.accountname = chr.getClient().getAccountName(); this.channel = (byte) chr.getClient().getChannel(); this.ACash = chr.getCSPoints(1); this.MaplePoints = chr.getCSPoints(2); this.vpoints = chr.getVPoints(); this.name = chr.getName(); this.fame = chr.getFame(); this.love = chr.getLove(); this.gender = chr.getClient().getGender(); this.level = chr.getLevel(); this.str = chr.getStat().getStr(); this.dex = chr.getStat().getDex(); this.int_ = chr.getStat().getInt(); this.luk = chr.getStat().getLuk(); this.hp = chr.getStat().getHp(); this.mp = chr.getStat().getMp(); this.maxhp = chr.getStat().getMaxHp(); this.maxmp = chr.getStat().getMaxMp(); this.exp = chr.getExp(); this.hpApUsed = chr.getHpApUsed(); this.remainingAp = chr.getRemainingAp(); this.remainingSp = chr.getRemainingSp(); this.meso = chr.getMeso(); this.pvpExp = chr.getTotalBattleExp(); this.pvpPoints = chr.getBattlePoints(); this.skinColor = chr.getSkinColor(); this.job = chr.getJob(); this.hair = chr.getHair(); this.face = chr.getFace(); this.mapid = chr.getMapId(); this.initialSpawnPoint = chr.getInitialSpawnpoint(); this.marriageId = chr.getMarriageId(); this.world = chr.getWorld(); this.guildid = chr.getGuildId(); this.guildrank = chr.getGuildRank(); this.guildContribution = chr.getGuildContribution(); this.alliancerank = chr.getAllianceRank(); this.gmLevel = (byte) chr.getGMLevel(); this.points = chr.getPoints(); this.fairyExp = chr.getFairyExp(); this.petStore = chr.getPetStores(); this.subcategory = chr.getSubcategory(); this.imps = chr.getImps(); this.fatigue = chr.getFatigue(); this.currentrep = chr.getCurrentRep(); this.totalrep = chr.getTotalRep(); this.totalWins = chr.getTotalWins(); this.totalLosses = chr.getTotalLosses(); this.gachexp = chr.getGachExp(); this.boxed = chr.getBoxed(); this.familiars = chr.getFamiliars(); this.tempIP = chr.getClient().getTempIP(); this.decorate = chr.getDecorate(); this.dollars = chr.getDollars(); this.shareLots = chr.getShareLots(); this.apstorage = chr.getAPS(); this.cardStack = chr.getCardStack(); this.morphCount = chr.getMorphCount(); this.powerCount = chr.getPowerCount(); this.playerPoints = chr.getPlayerPoints(); this.playerEnergy = chr.getPlayerEnergy(); this.runningDark = chr.getDarkType(); this.runningDarkSlot = chr.getDarkTotal(); this.runningLight = chr.getLightType(); this.runningLightSlot = chr.getLightTotal(); boolean uneq = false; MaplePet pet = chr.getSpawnPet(); if (this.petStore == 0) { this.petStore = -1; } if (pet != null) { uneq = true; this.petStore = (byte) Math.max(this.petStore, pet.getInventoryPosition()); } if (uneq) { chr.unequipAllSpawnPets(); } if (chr.getSidekick() != null) { this.sidekick = chr.getSidekick().getId(); } else { this.sidekick = 0; } for (BuddylistEntry qs : chr.getBuddylist().getBuddies()) { this.buddies.put( new CharacterNameAndId(qs.getCharacterId(), qs.getName(), qs.getGroup()), qs.isVisible()); } this.buddysize = chr.getBuddyCapacity(); this.partyid = (chr.getParty() == null ? -1 : chr.getParty().getId()); if (chr.getMessenger() != null) { this.messengerid = chr.getMessenger().getId(); } else { this.messengerid = 0; } this.finishedAchievements = chr.getFinishedAchievements(); this.KeyValue = chr.getKeyValue_Map(); this.InfoQuest = chr.getInfoQuest_Map(); for (Map.Entry qs : chr.getQuest_Map().entrySet()) { this.Quest.put(((MapleQuest) qs.getKey()).getId(), qs.getValue()); } this.inventorys = chr.getInventorys(); for (Entry<Skill, SkillEntry> qs : chr.getSkills().entrySet()) { this.Skills.put(((Skill) qs.getKey()).getId(), qs.getValue()); } this.BlessOfFairy = chr.getBlessOfFairyOrigin(); this.BlessOfEmpress = chr.getBlessOfEmpressOrigin(); this.chalkboard = chr.getChalkboard(); this.keymap = chr.getKeyLayout().Layout(); this.quickslot = chr.getQuickSlot().Layout(); this.savedlocation = chr.getSavedLocations(); this.wishlist = chr.getWishlist(); this.regrocks = chr.getRegRocks(); this.famedcharacters = chr.getFamedCharacters(); this.lastfametime = chr.getLastFameTime(); this.storage = chr.getStorage(); this.cs = chr.getCashInventory(); MapleMount mount = chr.getMount(); this.mount_itemid = mount.getItemId(); this.mount_Fatigue = mount.getFatigue(); this.mount_level = mount.getLevel(); this.mount_exp = mount.getExp(); this.battlers = chr.getBattlers(); this.lastLoveTime = chr.getLastLoveTime(); this.loveCharacters = chr.getLoveCharacters(); this.TranferTime = System.currentTimeMillis(); }
public void reAddMember(MapleCharacter chr) { removeMember(chr); members.put(chr.getName(), MapleCarnivalChallenge.getJobBasicNameById(chr.getJob())); }
/** * 可以创建定时技能 * * @param chr * @param numTimes * @param hurt * @param now */ public static void handleCooldowns(MapleCharacter chr, int numTimes, boolean hurt, long now) { if (chr == null) { return; } if (chr.getCooldownSize() > 0) { for (MapleCoolDownValueHolder m : chr.getCooldowns()) { if (m.startTime + m.length < now) { int skillId = m.skillId; chr.removeCooldown(skillId); chr.getClient().getSession().write(MaplePacketCreator.skillCooldown(skillId, 0)); } } } if (chr.isAlive()) { if (((chr.getJob() == 131) || (chr.getJob() == 132)) && (chr.canBlood(now))) { chr.doDragonBlood(); } if (chr.canRecover(now)) { chr.doRecovery(); } if (chr.canHPRecover(now)) { chr.addHP((int) chr.getStat().getHealHP()); } if (chr.canMPRecover(now)) { chr.addMP((int) chr.getStat().getHealMP()); if ((chr.getJob() == 3111) || (chr.getJob() == 3112)) { chr.addDemonMp((int) chr.getStat().getHealMP()); } } if (chr.canFairy(now)) { chr.doFairy(); } if (chr.canFish(now)) { chr.doFish(now); } if (chr.canDOT(now)) { chr.doDOT(); } if (chr.canExpiration(now)) { chr.expirationTask(); } } if (chr.getDiseaseSize() > 0) { for (MapleDiseaseValueHolder m : chr.getAllDiseases()) { if ((m != null) && (m.startTime + m.length < now)) { chr.dispelDebuff(m.disease); } } } if ((numTimes % 7 == 0) && (chr.getMount() != null) && (chr.getMount().canTire(now))) { chr.getMount().increaseFatigue(); } if (numTimes % 13 == 0) { chr.doFamiliarSchedule(now); for (MaplePet pet : chr.getSummonedPets()) { if ((pet.getPetItemId() == 5000054) && (pet.getSecondsLeft() > 0)) { pet.setSecondsLeft(pet.getSecondsLeft() - 1); if (pet.getSecondsLeft() <= 0) { chr.unequipSpawnPet(pet, true, true); return; } } int newFullness = pet.getFullness() - PetDataFactory.getHunger(pet.getPetItemId()); if (newFullness <= 5) { pet.setFullness(15); chr.unequipSpawnPet(pet, true, true); } else { pet.setFullness(newFullness); chr.getClient() .getSession() .write( PetPacket.updatePet( pet, chr.getInventory(MapleInventoryType.CASH).getItem(pet.getInventoryPosition()), false)); } } } if ((hurt) && (chr.isAlive())) { if (chr.getInventory(MapleInventoryType.EQUIPPED).findById(chr.getMap().getHPDecProtect()) == null) { if ((chr.getMapId() == 749040100) && (chr.getInventory(MapleInventoryType.CASH).findById(5451000) == null)) { chr.addHP(-chr.getMap().getHPDec()); } else if (chr.getMapId() != 749040100) { chr.addHP(-(chr.getMap().getHPDec())); } } } }
private static void monsterBomb( MapleCharacter player, MapleCharacter attackedPlayers, MapleMap map, AbstractDealDamageHandler.AttackInfo attack) { // level balances if (attackedPlayers.getLevel() > player.getLevel() + 25) { pvpDamage *= 1.35; } else if (attackedPlayers.getLevel() < player.getLevel() - 25) { pvpDamage /= 1.35; } else if (attackedPlayers.getLevel() > player.getLevel() + 100) { pvpDamage *= 1.50; } else if (attackedPlayers.getLevel() < player.getLevel() - 100) { pvpDamage /= 1.50; } // class balances if (player.getJob().equals(MapleJob.MAGICIAN)) { pvpDamage *= 1.20; } // buff modifiers Integer mguard = attackedPlayers.getBuffedValue(MapleBuffStat.MAGIC_GUARD); Integer mesoguard = attackedPlayers.getBuffedValue(MapleBuffStat.MESOGUARD); if (mguard != null) { int mploss = (int) (pvpDamage / .5); pvpDamage *= .70; if (mploss > attackedPlayers.getMp()) { pvpDamage /= .70; attackedPlayers.cancelBuffStats(MapleBuffStat.MAGIC_GUARD); } else { attackedPlayers.setMp(attackedPlayers.getMp() - mploss); attackedPlayers.updateSingleStat(MapleStat.MP, attackedPlayers.getMp()); } } else if (mesoguard != null) { int mesoloss = (int) (pvpDamage * .75); pvpDamage *= .75; if (mesoloss > attackedPlayers.getMeso()) { pvpDamage /= .75; attackedPlayers.cancelBuffStats(MapleBuffStat.MESOGUARD); } else { attackedPlayers.gainMeso(-mesoloss, false); } } // set up us teh bonmb // training thingy = 9409000 MapleMonster pvpMob = MapleLifeFactory.getMonster(9400711); map.spawnMonsterOnGroundBelow(pvpMob, attackedPlayers.getPosition()); for (int attacks = 0; attacks < attack.numDamage; attacks++) { map.broadcastMessage( MaplePacketCreator.damagePlayer( attack.numDamage, pvpMob.getId(), attackedPlayers.getId(), pvpDamage)); attackedPlayers.addHP(-pvpDamage); } int attackedDamage = pvpDamage * attack.numDamage; attackedPlayers .getClient() .getSession() .write( MaplePacketCreator.serverNotice( 5, player.getName() + " has hit you for " + attackedDamage + " damage!")); map.killMonster(pvpMob, player, false); // rewards if (attackedPlayers.getHp() <= 0 && !attackedPlayers.isAlive()) { int expReward = attackedPlayers.getLevel() * 100; if (player.getPvpKills() * .25 >= player.getPvpDeaths()) { expReward *= 20; } player.gainExp(expReward, true, false); player.gainPvpKill(); player .getClient() .getSession() .write( MaplePacketCreator.serverNotice( 6, "You've killed " + attackedPlayers.getName() + "!! You've gained a pvp kill!")); attackedPlayers.gainPvpDeath(); attackedPlayers .getClient() .getSession() .write(MaplePacketCreator.serverNotice(6, player.getName() + " has killed you!")); attackedPlayers.setHp(0); attackedPlayers.updateSingleStat(MapleStat.HP, 0); } }
public static final void SummonPVP(final LittleEndianAccessor slea, final MapleClient c) { final MapleCharacter chr = c.getPlayer(); if (chr == null || chr.isHidden() || !chr.isAlive() || chr.hasBlockedInventory() || chr.getMap() == null || !chr.inPVP() || !chr.getEventInstance().getProperty("started").equals("1")) { return; } final MapleMap map = chr.getMap(); final MapleMapObject obj = map.getMapObject(slea.readInt(), MapleMapObjectType.SUMMON); if (obj == null || !(obj instanceof MapleSummon)) { chr.dropMessage(5, "The summon has disappeared."); return; } int tick = -1; if (slea.available() == 27) { slea.skip(23); tick = slea.readInt(); } final MapleSummon summon = (MapleSummon) obj; if (summon.getOwnerId() != chr.getId() || summon.getSkillLevel() <= 0) { chr.dropMessage(5, "Error."); return; } final Skill skil = SkillFactory.getSkill(summon.getSkill()); final MapleStatEffect effect = skil.getEffect(summon.getSkillLevel()); final int lvl = Integer.parseInt(chr.getEventInstance().getProperty("lvl")); final int type = Integer.parseInt(chr.getEventInstance().getProperty("type")); final int ourScore = Integer.parseInt(chr.getEventInstance().getProperty(String.valueOf(chr.getId()))); int addedScore = 0; final boolean magic = skil.isMagic(); boolean killed = false, didAttack = false; double maxdamage = lvl == 3 ? chr.getStat().getCurrentMaxBasePVPDamageL() : chr.getStat().getCurrentMaxBasePVPDamage(); maxdamage *= (effect.getDamage() + chr.getStat().getDamageIncrease(summon.getSkill())) / 100.0; int mobCount = 1, attackCount = 1, ignoreDEF = chr.getStat().ignoreTargetDEF; final SummonSkillEntry sse = SkillFactory.getSummonData(summon.getSkill()); if (summon.getSkill() / 1000000 != 35 && summon.getSkill() != 33101008 && sse == null) { chr.dropMessage(5, "Error in processing attack."); return; } Point lt, rb; if (sse != null) { if (sse.delay > 0) { if (tick != -1) { summon.CheckSummonAttackFrequency(chr, tick); chr.updateTick(tick); } else { summon.CheckPVPSummonAttackFrequency(chr); } chr.getCheatTracker().checkSummonAttack(); } mobCount = sse.mobCount; attackCount = sse.attackCount; lt = sse.lt; rb = sse.rb; } else { lt = new Point(-100, -100); rb = new Point(100, 100); } final Rectangle box = MapleStatEffect.calculateBoundingBox(chr.getTruePosition(), chr.isFacingLeft(), lt, rb, 0); List<AttackPair> ourAttacks = new ArrayList<AttackPair>(); List<Pair<Integer, Boolean>> attacks; maxdamage *= chr.getStat().dam_r / 100.0; for (MapleMapObject mo : chr.getMap().getCharactersIntersect(box)) { final MapleCharacter attacked = (MapleCharacter) mo; if (attacked.getId() != chr.getId() && attacked.isAlive() && !attacked.isHidden() && (type == 0 || attacked.getTeam() != chr.getTeam())) { double rawDamage = maxdamage / Math.max( 0, ((magic ? attacked.getStat().mdef : attacked.getStat().wdef) * Math.max(1.0, 100.0 - ignoreDEF) / 100.0) * (type == 3 ? 0.1 : 0.25)); if (attacked.getBuffedValue(MapleBuffStat.INVINCIBILITY) != null || PlayersHandler.inArea(attacked)) { rawDamage = 0; } rawDamage += (rawDamage * chr.getDamageIncrease(attacked.getId()) / 100.0); rawDamage *= attacked.getStat().mesoGuard / 100.0; rawDamage = attacked.modifyDamageTaken(rawDamage, attacked).left; final double min = (rawDamage * chr.getStat().trueMastery / 100); attacks = new ArrayList<Pair<Integer, Boolean>>(attackCount); int totalMPLoss = 0, totalHPLoss = 0; for (int i = 0; i < attackCount; i++) { int mploss = 0; double ourDamage = Randomizer.nextInt((int) Math.abs(Math.round(rawDamage - min)) + 1) + min; if (attacked.getStat().dodgeChance > 0 && Randomizer.nextInt(100) < attacked.getStat().dodgeChance) { ourDamage = 0; // i dont think level actually matters or it'd be too op // } else if (attacked.getLevel() > chr.getLevel() && Randomizer.nextInt(100) < // (attacked.getLevel() - chr.getLevel())) { // ourDamage = 0; } if (attacked.getBuffedValue(MapleBuffStat.MAGIC_GUARD) != null) { mploss = (int) Math.min( attacked.getStat().getMp(), (ourDamage * attacked.getBuffedValue(MapleBuffStat.MAGIC_GUARD).doubleValue() / 100.0)); } ourDamage -= mploss; if (attacked.getBuffedValue(MapleBuffStat.INFINITY) != null) { mploss = 0; } attacks.add(new Pair<Integer, Boolean>((int) Math.floor(ourDamage), false)); totalHPLoss += Math.floor(ourDamage); totalMPLoss += mploss; } attacked.addMPHP(-totalHPLoss, -totalMPLoss); ourAttacks.add(new AttackPair(attacked.getId(), attacked.getPosition(), attacks)); attacked.getCheatTracker().setAttacksWithoutHit(false); if (totalHPLoss > 0) { didAttack = true; } if (attacked.getStat().getHPPercent() <= 20) { SkillFactory.getSkill(attacked.getStat().getSkillByJob(93, attacked.getJob())) .getEffect(1) .applyTo(attacked); } if (effect != null) { if (effect.getMonsterStati().size() > 0 && effect.makeChanceResult()) { for (Map.Entry<MonsterStatus, Integer> z : effect.getMonsterStati().entrySet()) { MapleDisease d = MonsterStatus.getLinkedDisease(z.getKey()); if (d != null) { attacked.giveDebuff(d, z.getValue(), effect.getDuration(), d.getDisease(), 1); } } } effect.handleExtraPVP(chr, attacked); } chr.getClient() .getSession() .write( CField.getPVPHPBar( attacked.getId(), attacked.getStat().getHp(), attacked.getStat().getCurrentMaxHp())); addedScore += (totalHPLoss / 100) + (totalMPLoss / 100); // ive NO idea if (!attacked.isAlive()) { killed = true; } if (ourAttacks.size() >= mobCount) { break; } } } if (killed || addedScore > 0) { chr.getEventInstance().addPVPScore(chr, addedScore); chr.getClient().getSession().write(CField.getPVPScore(ourScore + addedScore, killed)); } if (didAttack) { chr.getMap() .broadcastMessage( SummonPacket.pvpSummonAttack( chr.getId(), chr.getLevel(), summon.getObjectId(), summon.isFacingLeft() ? 4 : 0x84, summon.getTruePosition(), ourAttacks)); if (!summon.isMultiAttack()) { chr.getMap().broadcastMessage(SummonPacket.removeSummon(summon, true)); chr.getMap().removeMapObject(summon); chr.removeVisibleMapObject(summon); chr.removeSummon(summon); if (summon.getSkill() != 35121011) { chr.cancelEffectFromBuffStat(MapleBuffStat.SUMMON); } } } }