Пример #1
0
 @Override
 public void execute(MapleClient c, MessageCallback mc, String[] splitted)
     throws Exception, IllegalCommandSyntaxException {
   if (splitted[0].equals("!whosthere")) {
     MessageCallback callback = new ServernoticeMapleClientMessageCallback(c);
     StringBuilder builder = new StringBuilder("Players on Map: ");
     for (MapleCharacter chr : c.getPlayer().getMap().getCharacters()) {
       if (builder.length() > 150) { // wild guess :o
         builder.setLength(builder.length() - 2);
         callback.dropMessage(builder.toString());
         builder = new StringBuilder();
       }
       builder.append(MapleCharacter.makeMapleReadable(chr.getName()));
       builder.append(", ");
     }
     builder.setLength(builder.length() - 2);
     c.getSession().write(MaplePacketCreator.serverNotice(6, builder.toString()));
   } else if (splitted[0].equals("!cheaters")) {
     try {
       List<CheaterData> cheaters =
           c.getChannelServer().getWorldInterface().getCheaters(c.getWorld());
       for (int x = cheaters.size() - 1; x >= 0; x--) {
         CheaterData cheater = cheaters.get(x);
         mc.dropMessage(cheater.getInfo());
       }
     } catch (RemoteException e) {
       c.getChannelServer().reconnectWorld();
     }
   }
 }
Пример #2
0
  public static final void MoveSummon(final LittleEndianAccessor slea, final MapleCharacter chr) {
    if (chr == null || chr.getMap() == null) {
      return;
    }
    final MapleMapObject obj = chr.getMap().getMapObject(slea.readInt(), MapleMapObjectType.SUMMON);
    if (obj == null) {
      return;
    }
    if (obj instanceof MapleDragon) {
      MoveDragon(slea, chr);
      return;
    }
    final MapleSummon sum = (MapleSummon) obj;
    if (sum.getOwnerId() != chr.getId()
        || sum.getSkillLevel() <= 0
        || sum.getMovementType() == SummonMovementType.STATIONARY) {
      return;
    }
    slea.skip(8); // startPOS
    final List<LifeMovementFragment> res = MovementParse.parseMovement(slea, 4);

    final Point pos = sum.getPosition();
    MovementParse.updatePosition(res, sum, 0);
    if (res.size() > 0) {
      chr.getMap()
          .broadcastMessage(
              chr,
              SummonPacket.moveSummon(chr.getId(), sum.getObjectId(), pos, res),
              sum.getTruePosition());
    }
  }
Пример #3
0
 @Override
 public void onMapLoad(MapleCharacter chr) {
   super.onMapLoad(chr);
   if (chr.getMapId() == type.mapids[0] && !chr.isGM()) {
     chr.canTalk(false);
   }
 }
Пример #4
0
 public void broadcastToVisitors(MaplePacket packet) {
   for (MapleCharacter visitor : visitors) {
     if (visitor != null) {
       visitor.getClient().getSession().write(packet);
     }
   }
 }
Пример #5
0
 public void forceComplete(MapleCharacter c, int npc) {
   MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.COMPLETED, npc);
   newStatus.setForfeited(c.getQuest(this).getForfeited());
   newStatus.setCompletionTime(System.currentTimeMillis());
   c.announce(MaplePacketCreator.showSpecialEffect(9));
   c.getMap().broadcastMessage(c, MaplePacketCreator.showForeignEffect(c.getId(), 9), false);
   c.updateQuest(newStatus);
 }
Пример #6
0
 public static void cancelTrade(MapleCharacter c) {
   c.getTrade().cancel();
   if (c.getTrade().getPartner() != null) {
     c.getTrade().getPartner().cancel();
     c.getTrade().getPartner().getChr().setTrade(null);
   }
   c.setTrade(null);
 }
Пример #7
0
  public void forceStart(MapleCharacter c, int npc) {
    MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.STARTED, npc);
    newStatus.setForfeited(c.getQuest(this).getForfeited());

    if (timeLimit > 0) c.questTimeLimit(this, 30000); // timeLimit * 1000
    if (timeLimit2 > 0) { // =\
    }
    c.updateQuest(newStatus);
  }
Пример #8
0
 /**
  * 箭矢炮盘
  *
  * @param owner
  * @param side
  * @param pos
  */
 public MapleArrowsTurret(MapleCharacter owner, byte side, Point pos) {
   this.map = owner.getMap();
   this.ownerid = owner.getId();
   this.ownerLevel = owner.getLevel();
   this.skillId = 3121013;
   this.skillLevel = owner.getSkillLevel(skillId);
   this.side = side;
   setPosition(pos);
 }
Пример #9
0
 private boolean isCorrectAnswer(MapleCharacter chr, int answer) {
   double x = chr.getTruePosition().getX();
   double y = chr.getTruePosition().getY();
   if ((x > -234 && y > -26 && answer == 0) || (x < -234 && y > -26 && answer == 1)) {
     chr.dropMessage(6, "[Ox Quiz] Correct!"); // I think this is its own packet
     return true;
   }
   chr.dropMessage(6, "[Ox Quiz] Incorrect!");
   return false;
 }
Пример #10
0
 public void reloadGuildCharacters(int world) {
   World worlda = getWorld(world);
   for (MapleCharacter mc : worlda.getPlayerStorage().getAllCharacters()) {
     if (mc.getGuildId() > 0) {
       setGuildMemberOnline(mc.getMGC(), true, worlda.getId());
       memberLevelJobUpdate(mc.getMGC());
     }
   }
   worlda.reloadGuildSummary();
 }
Пример #11
0
 @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);
   }
 }
Пример #12
0
 public void forfeit(MapleCharacter c) {
   if (!c.getQuest(this).getStatus().equals(Status.STARTED)) {
     return;
   }
   if (timeLimit > 0) {
     c.announce(MaplePacketCreator.removeQuestTimeLimit(id));
   }
   MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.NOT_STARTED);
   newStatus.setForfeited(c.getQuest(this).getForfeited() + 1);
   c.updateQuest(newStatus);
 }
 public static boolean addRing(final MapleCharacter chr, final int Id, final int ringId) {
   MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
   MapleInventoryType type = ii.getInventoryType(Id);
   IItem nEquip = ii.getEquipById(Id, ringId);
   short newSlot = chr.getInventory(type).addItem(nEquip);
   if (newSlot == -1) {
     return false;
   }
   chr.getClient().announce(InventoryFactory.addInventorySlot(type, nEquip));
   return true;
 }
Пример #14
0
 private boolean canStart(MapleCharacter c, int npcid) {
   if (c.getQuest(this).getStatus() != Status.NOT_STARTED
       && !(c.getQuest(this).getStatus() == Status.COMPLETED && repeatable)) {
     return false;
   }
   for (MapleQuestRequirement r : startReqs) {
     if (!r.check(c, npcid)) {
       return false;
     }
   }
   return true;
 }
Пример #15
0
 public void copy() {
   while (type.queue.get(ch).size() > 0
       && ChannelServer.getInstance(ch).getMapleSquad(type) == null) {
     int index = 0;
     long lowest = 0;
     for (int i = 0; i < type.queue.get(ch).size(); i++) {
       if (lowest == 0 || type.queue.get(ch).get(i).right < lowest) {
         index = i;
         lowest = type.queue.get(ch).get(i).right;
       }
     }
     final String nextPlayerId = type.queue.get(ch).remove(index).left;
     final int theirCh = World.Find.findChannel(nextPlayerId);
     if (theirCh > 0) {
       final MapleCharacter lead =
           ChannelServer.getInstance(theirCh).getPlayerStorage().getCharacterByName(nextPlayerId);
       if (lead != null && lead.getMapId() == beginMapId && lead.getClient().getChannel() == ch) {
         final MapleSquad squad = new MapleSquad(ch, type.name(), lead, expiration, toSay);
         if (ChannelServer.getInstance(ch).addMapleSquad(squad, type.name())) {
           getBeginMap().broadcastMessage(CField.getClock(expiration / 1000));
           getBeginMap().broadcastMessage(CWvsContext.serverNotice(6, nextPlayerId + toSay));
           type.queuedPlayers.get(ch).add(new Pair<String, String>(nextPlayerId, "Success"));
         } else {
           squad.clear();
           type.queuedPlayers.get(ch).add(new Pair<String, String>(nextPlayerId, "Skipped"));
         }
         break;
       } else {
         if (lead != null) {
           lead.dropMessage(
               6,
               "Your squad has been skipped due to you not being in the right channel and map.");
         }
         getBeginMap()
             .broadcastMessage(
                 CWvsContext.serverNotice(
                     6,
                     nextPlayerId
                         + "'s squad has been skipped due to the player not being in the right channel and map."));
         type.queuedPlayers.get(ch).add(new Pair<String, String>(nextPlayerId, "Not in map"));
       }
     } else {
       getBeginMap()
           .broadcastMessage(
               CWvsContext.serverNotice(
                   6,
                   nextPlayerId
                       + "'s squad has been skipped due to the player not being online."));
       type.queuedPlayers.get(ch).add(new Pair<String, String>(nextPlayerId, "Not online"));
     }
   }
 }
Пример #16
0
 public static void visitTrade(MapleCharacter c1, MapleCharacter c2) {
   if (c1.getTrade() != null
       && c1.getTrade().getPartner() == c2.getTrade()
       && c2.getTrade() != null
       && c2.getTrade().getPartner() == c1.getTrade()) {
     c2.getClient().getSession().write(MaplePacketCreator.getTradePartnerAdd(c1));
     c1.getClient()
         .getSession()
         .write(MaplePacketCreator.getTradeStart(c1.getClient(), c1.getTrade(), (byte) 1));
   } else {
     c1.message("The other player has already closed the trade.");
   }
 }
Пример #17
0
 public MapleMapItem(
     int meso,
     Point position,
     MapleMapObject dropper,
     MapleCharacter owner,
     byte type,
     boolean playerDrop) {
   setPosition(position);
   this.item = null;
   this.dropper = dropper;
   this.character_ownerid = owner.getParty() == null ? owner.getId() : owner.getPartyId();
   this.meso = meso;
   this.type = type;
   this.playerDrop = playerDrop;
 }
Пример #18
0
 public final void CheckPVPSummonAttackFrequency(final MapleCharacter chr) {
   final long tickdifference = (System.currentTimeMillis() - lastAttackTime);
   if (tickdifference < SkillFactory.getSummonData(skill).delay) {
     chr.getCheatTracker().registerOffense(CheatingOffense.FAST_SUMMON_ATTACK);
   }
   lastAttackTime = System.currentTimeMillis();
 }
Пример #19
0
 private void cancel() {
   for (IItem item : items) {
     MapleInventoryManipulator.addFromDrop(chr.getClient(), item, true);
   }
   if (meso > 0) {
     chr.gainMeso(meso, true, true, true);
   }
   meso = 0;
   if (items != null) {
     items.clear();
   }
   exchangeMeso = 0;
   if (exchangeItems != null) {
     exchangeItems.clear();
   }
   chr.getClient().getSession().write(MaplePacketCreator.getTradeCancel(number));
 }
Пример #20
0
 public MapleMapItem(
     Item item,
     Point position,
     MapleMapObject dropper,
     MapleCharacter owner,
     byte type,
     boolean playerDrop,
     int questid) {
   setPosition(position);
   this.item = item;
   this.dropper = dropper;
   this.character_ownerid = owner.getParty() == null ? owner.getId() : owner.getPartyId();
   this.meso = 0;
   this.type = type;
   this.playerDrop = playerDrop;
   this.questid = questid;
 }
Пример #21
0
 public final void CheckSummonAttackFrequency(final MapleCharacter chr, final int tickcount) {
   final int tickdifference = (tickcount - lastSummonTickCount);
   if (tickdifference < SkillFactory.getSummonData(skill).delay) {
     chr.getCheatTracker().registerOffense(CheatingOffense.FAST_SUMMON_ATTACK);
   }
   final long STime_TC = System.currentTimeMillis() - tickcount;
   final long S_C_Difference = Server_ClientSummonTickDiff - STime_TC;
   if (S_C_Difference > 500) {
     chr.getCheatTracker().registerOffense(CheatingOffense.FAST_SUMMON_ATTACK);
   }
   Summon_tickResetCount++;
   if (Summon_tickResetCount > 4) {
     Summon_tickResetCount = 0;
     Server_ClientSummonTickDiff = STime_TC;
   }
   lastSummonTickCount = tickcount;
 }
Пример #22
0
 private static boolean check(MapleCharacter chr, List<MaplePlayerShopItem> items) {
   byte eq = 0, use = 0, setup = 0, etc = 0, cash = 0;
   List<MapleInventoryType> li = new LinkedList<MapleInventoryType>();
   for (MaplePlayerShopItem item : items) {
     final MapleInventoryType invtype =
         MapleItemInformationProvider.getInstance().getInventoryType(item.getItem().getItemId());
     if (!li.contains(invtype)) {
       li.add(invtype);
     }
     if (invtype == MapleInventoryType.EQUIP) {
       eq++;
     } else if (invtype == MapleInventoryType.USE) {
       use++;
     } else if (invtype == MapleInventoryType.SETUP) {
       setup++;
     } else if (invtype == MapleInventoryType.ETC) {
       etc++;
     } else if (invtype == MapleInventoryType.CASH) {
       cash++;
     }
   }
   for (MapleInventoryType mit : li) {
     if (mit == MapleInventoryType.EQUIP) {
       if (chr.getInventory(MapleInventoryType.EQUIP).getNumFreeSlot() <= eq) {
         return false;
       }
     } else if (mit == MapleInventoryType.USE) {
       if (chr.getInventory(MapleInventoryType.USE).getNumFreeSlot() <= use) {
         return false;
       }
     } else if (mit == MapleInventoryType.SETUP) {
       if (chr.getInventory(MapleInventoryType.SETUP).getNumFreeSlot() <= setup) {
         return false;
       }
     } else if (mit == MapleInventoryType.ETC) {
       if (chr.getInventory(MapleInventoryType.ETC).getNumFreeSlot() <= etc) {
         return false;
       }
     } else if (mit == MapleInventoryType.CASH) {
       if (chr.getInventory(MapleInventoryType.CASH).getNumFreeSlot() <= cash) {
         return false;
       }
     }
   }
   return true;
 }
 private static boolean checkRush(MapleCharacter c) {
   for (MaplePartyCharacter mpc : c.getParty().getMembers()) {
     if (mpc.getJobId() % 100 != 2 || !mpc.getJob().isA(MapleJob.WARRIOR)) {
       return false;
     }
   }
   return true;
 }
Пример #24
0
 public boolean containsMember(MapleCharacter member) {
   for (String mmbr : members.keySet()) {
     if (mmbr.equalsIgnoreCase(member.getName())) {
       return true;
     }
   }
   return false;
 }
Пример #25
0
 public static final void DenyInvite(
     MapleClient c,
     final MapleGuild
         gs) { // playername that invited -> guildname that was invited but we also don't care
   final int inviteid = World.Guild.getInvitedId(c.getPlayer().getGuildId());
   if (inviteid > 0) {
     final int newAlliance = World.Alliance.getAllianceLeader(inviteid);
     if (newAlliance > 0) {
       final MapleCharacter chr =
           c.getChannelServer().getPlayerStorage().getCharacterById(newAlliance);
       if (chr != null) {
         chr.dropMessage(5, gs.getName() + " Guild has rejected the Guild Union invitation.");
       }
       World.Guild.setInvitedId(c.getPlayer().getGuildId(), 0);
     }
   }
   // c.getSession().write(CWvsContext.enableActions());
 }
Пример #26
0
 public static String getDimensionalDoorSelection(MapleCharacter chr) {
   String mapselect = "";
   for (DimensionalMirror mirror : DimensionalMirror.values()) {
     if (chr.getLevel() >= mirror.getMinLevel() && chr.getLevel() <= mirror.getMaxLevel()) {
       if ((chr.getQuestStatus(mirror.getRequieredQuest()) == mirror.getRequieredQuestState())
           || mirror.getRequieredQuest() == 0) {
         if (mirror != DimensionalMirror.DEFAULT
             && mirror.getIcon() != DimensionalMirror.DEFAULT.getIcon() /*just another check*/) {
           mapselect += "#" + mirror.getIcon() + "#" + mirror.getName();
         }
       }
     }
   }
   if (mapselect == null || "".equals(mapselect)) {
     mapselect = "#-1# There are no locations you can move to.";
   }
   return mapselect;
 }
Пример #27
0
  @Override
  public boolean check(MapleCharacter chr, Integer npcid) {
    int curCloseness = 0;
    for (MaplePet pet : chr.getPets()) {
      if (pet.getCloseness() > curCloseness) curCloseness = pet.getCloseness();
    }

    return curCloseness >= minTameness;
  }
Пример #28
0
 public static void inviteTrade(MapleCharacter c1, MapleCharacter c2) {
   if (c2.getTrade() == null) {
     c2.setTrade(new MapleTrade((byte) 1, c2));
     c2.getTrade().setPartner(c1.getTrade());
     c1.getTrade().setPartner(c2.getTrade());
     c2.getClient().getSession().write(MaplePacketCreator.getTradeInvite(c1));
   } else {
     c1.message("The other player is already trading with someone else.");
     cancelTrade(c1);
   }
 }
Пример #29
0
 public void chat(String message) {
   chr.getClient().getSession().write(MaplePacketCreator.getTradeChat(chr, message, true));
   if (partner != null) {
     partner
         .getChr()
         .getClient()
         .getSession()
         .write(MaplePacketCreator.getTradeChat(chr, message, false));
   }
 }
Пример #30
0
 public void addItem(IItem item) {
   items.add(item);
   chr.getClient().getSession().write(MaplePacketCreator.getTradeItemAdd((byte) 0, item));
   if (partner != null) {
     partner
         .getChr()
         .getClient()
         .getSession()
         .write(MaplePacketCreator.getTradeItemAdd((byte) 1, item));
   }
 }