Esempio n. 1
0
  public static void doFishing(client.MapleCharacter chr) {
    int mesoMultiplier = 1;
    int expMultiplier = 1;
    switch (chr.getWorld()) {
      case 0:
        mesoMultiplier = 40000;
        expMultiplier = 20000;
        break;
    }
    int mesoAward =
        (int) (1400.0 * Math.random() + 1201) * mesoMultiplier + (6 * chr.getLevel() / 5);
    int expAward =
        (int) ((645.0 * Math.random()) * expMultiplier + (15 * chr.getLevel() / 2) / 6)
            * chr.getFishingLevel();
    if (chr.getReborns() >= 5
        && chr.getMapId() == 970020001
        && chr.haveItem(3011000)
        && chr.getChair() == 3011000) {
      int rand = (int) (3.0 * Math.random());
      int fishingexp = (int) (7.0 * Math.random()) + 1;
      switch (rand) {
        case 0:
          chr.gainMeso(mesoAward, true, true, true);
          chr.gainFishingEXP(fishingexp);
          chr.getClient()
              .getSession()
              .write(MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1));
          chr.getMap()
              .broadcastMessage(
                  chr, MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1), false);
          break;
        case 1:
          chr.gainExp(expAward, true, true);
          chr.gainFishingEXP(fishingexp);
          chr.getClient()
              .getSession()
              .write(MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1));
          chr.getMap()
              .broadcastMessage(
                  chr, MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1), false);
          break;
        case 2:
          chr.gainFishingEXP(fishingexp * 2);
          chr.getClient()
              .getSession()
              .write(MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1));
          chr.getMap()
              .broadcastMessage(
                  chr, MaplePacketCreator.catchMonster(9500336, 2000017, (byte) 1), false);
          break;
      }

    } else {
      chr.dropMessage("Please sit on your fishing chair at the fishing lagoon to fish.");
    }
  }
Esempio n. 2
0
 public static void ViewChar(LittleEndianAccessor slea, MapleClient c) {
   Map<Byte, ArrayList<MapleCharacter>> worlds = new HashMap<Byte, ArrayList<MapleCharacter>>();
   List<MapleCharacter> chars = c.loadCharacters(0); // TODO multi world
   c.getSession().write(LoginPacket.showAllCharacter(chars.size()));
   for (MapleCharacter chr : chars) {
     if (chr != null) {
       ArrayList<MapleCharacter> chrr;
       if (!worlds.containsKey(chr.getWorld())) {
         chrr = new ArrayList<MapleCharacter>();
         worlds.put(chr.getWorld(), chrr);
       } else {
         chrr = worlds.get(chr.getWorld());
       }
       chrr.add(chr);
     }
   }
   for (Entry<Byte, ArrayList<MapleCharacter>> w : worlds.entrySet()) {
     c.getSession()
         .write(LoginPacket.showAllCharacterInfo(w.getKey(), w.getValue(), c.getSecondPassword()));
   }
 }
Esempio n. 3
0
  public HiredMerchant(final MapleCharacter owner, int itemId, String desc) {
    this.setPosition(owner.getPosition());
    this.start = System.currentTimeMillis();
    this.ownerId = owner.getId();
    this.channel = owner.getClient().getChannel();
    this.world = owner.getWorld();
    this.itemId = itemId;
    this.ownerName = owner.getName();
    this.description = desc;
    this.map = owner.getMap();
    this.schedule =
        TimerManager.getInstance()
            .schedule(
                new Runnable() {

                  @Override
                  public void run() {
                    HiredMerchant.this.closeShop(owner.getClient(), true);
                  }
                },
                1000 * 60 * 60 * 24);
  }
  /**
   * 角色快照数据
   *
   * @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();
  }