public static final void CreateUltimate(final LittleEndianAccessor slea, final MapleClient c) { if (!c.isLoggedIn() || c.getPlayer() == null || c.getPlayer().getLevel() < 120 || c.getPlayer().getMapId() != 130000000 || c.getPlayer().getQuestStatus(20734) != 0 || c.getPlayer().getQuestStatus(20616) != 2 || !GameConstants.isKOC(c.getPlayer().getJob()) || !c.canMakeCharacter(c.getPlayer().getWorld())) { c.getPlayer().dropMessage(1, "You have no character slots."); c.getSession().write(CField.createUltimate(0)); return; } System.out.println(slea.toString()); final String name = slea.readMapleAsciiString(); final int job = slea.readInt(); // job ID final int face = slea.readInt(); final int hair = slea.readInt(); final int hat = slea.readInt(); final int top = slea.readInt(); final int glove = slea.readInt(); final int shoes = slea.readInt(); final int weapon = slea.readInt(); final byte gender = c.getPlayer().getGender(); JobType jobType = JobType.Adventurer; // if (!LoginInformationProvider.getInstance().isEligibleItem(gender, 0, jobType.type, face) || // !LoginInformationProvider.getInstance().isEligibleItem(gender, 1, jobType.type, hair)) { // c.getPlayer().dropMessage(1, "An error occurred."); // c.getSession().write(CField.createUltimate(0)); // return; // } jobType = JobType.UltimateAdventurer; MapleCharacter newchar = MapleCharacter.getDefault(c, jobType); newchar.setJob(job); newchar.setWorld((byte) c.getPlayer().getWorld()); newchar.setFace(face); newchar.setHair(hair); newchar.setGender(gender); newchar.setName(name); newchar.setSkinColor((byte) 3); // troll newchar.setLevel((short) 50); newchar.getStat().str = (short) 4; newchar.getStat().dex = (short) 4; newchar.getStat().int_ = (short) 4; newchar.getStat().luk = (short) 4; newchar.setRemainingAp((short) 254); // 49*5 + 25 - 16 newchar.setRemainingSp( job / 100 == 2 ? 128 : 122); // 2 from job advancements. 120 from leveling. (mages get +6) newchar.getStat().maxhp += 150; // Beginner 10 levels newchar.getStat().maxmp += 125; newchar.getStat().hp += 150; // Beginner 10 levels newchar.getStat().mp += 125; switch (job) { case 110: case 120: case 130: newchar.getStat().maxhp += 600; // Job Advancement newchar.getStat().maxhp += 2000; // Levelup 40 times newchar.getStat().maxmp += 200; newchar.getStat().hp += 600; // Job Advancement newchar.getStat().hp += 2000; // Levelup 40 times newchar.getStat().mp += 200; break; case 210: case 220: case 230: newchar.getStat().maxmp += 600; newchar.getStat().maxhp += 500; // Levelup 40 times newchar.getStat().maxmp += 2000; newchar.getStat().mp += 600; newchar.getStat().hp += 500; // Levelup 40 times newchar.getStat().mp += 2000; break; case 310: case 320: case 410: case 420: case 520: newchar.getStat().maxhp += 500; newchar.getStat().maxmp += 250; newchar.getStat().maxhp += 900; // Levelup 40 times newchar.getStat().maxmp += 600; newchar.getStat().maxhp += 500; newchar.getStat().mp += 250; newchar.getStat().hp += 900; // Levelup 40 times newchar.getStat().mp += 600; break; case 510: newchar.getStat().maxhp += 500; newchar.getStat().maxmp += 250; newchar.getStat().maxhp += 450; // Levelup 20 times newchar.getStat().maxmp += 300; newchar.getStat().maxhp += 800; // Levelup 20 times newchar.getStat().maxmp += 400; newchar.getStat().hp += 500; newchar.getStat().mp += 250; newchar.getStat().hp += 450; // Levelup 20 times newchar.getStat().mp += 300; newchar.getStat().hp += 800; // Levelup 20 times newchar.getStat().mp += 400; break; default: return; } for (int i = 2490; i < 2507; i++) { newchar.setQuestAdd(MapleQuest.getInstance(i), (byte) 2, null); } newchar.setQuestAdd(MapleQuest.getInstance(29947), (byte) 2, null); newchar.setQuestAdd( MapleQuest.getInstance(GameConstants.ULT_EXPLORER), (byte) 0, c.getPlayer().getName()); final Map<Skill, SkillEntry> ss = new HashMap<>(); ss.put(SkillFactory.getSkill(1074 + (job / 100)), new SkillEntry((byte) 5, (byte) 5, -1)); ss.put(SkillFactory.getSkill(1195 + (job / 100)), new SkillEntry((byte) 5, (byte) 5, -1)); ss.put(SkillFactory.getSkill(80), new SkillEntry((byte) 1, (byte) 1, -1)); newchar.changeSkillLevel_Skip(ss, false); final MapleItemInformationProvider li = MapleItemInformationProvider.getInstance(); int[] items = new int[] { 1142257, hat, top, shoes, glove, weapon, hat + 1, top + 1, shoes + 1, glove + 1, weapon + 1 }; // brilliant = fine+1 for (byte i = 0; i < items.length; i++) { Item item = li.getEquipById(items[i]); item.setPosition((byte) (i + 1)); newchar.getInventory(MapleInventoryType.EQUIP).addFromDB(item); } newchar .getInventory(MapleInventoryType.USE) .addItem(new Item(2000004, (byte) 0, (short) 100, (byte) 0)); newchar .getInventory(MapleInventoryType.USE) .addItem(new Item(2000004, (byte) 0, (short) 100, (byte) 0)); c.getPlayer().fakeRelog(); if (MapleCharacterUtil.canCreateChar(name, c.isGm()) && (!LoginInformationProvider.getInstance().isForbiddenName(name) || c.isGm())) { MapleCharacter.saveNewCharToDB(newchar, jobType, (short) 0); MapleQuest.getInstance(20734).forceComplete(c.getPlayer(), 1101000); c.getSession().write(CField.createUltimate(1)); } else { c.getSession().write(CField.createUltimate(0)); } }
public static final void HandleAlliance( final LittleEndianAccessor slea, final MapleClient c, boolean denied) { if (c.getPlayer().getGuildId() <= 0) { c.getSession().write(CWvsContext.enableActions()); return; } final MapleGuild gs = World.Guild.getGuild(c.getPlayer().getGuildId()); if (gs == null) { c.getSession().write(CWvsContext.enableActions()); return; } // System.out.println("Unhandled GuildAlliance \n" + slea.toString()); byte op = slea.readByte(); if (c.getPlayer().getGuildRank() != 1 && op != 1) { // only updating doesn't need guild leader return; } if (op == 22) { denied = true; } int leaderid = 0; if (gs.getAllianceId() > 0) { leaderid = World.Alliance.getAllianceLeader(gs.getAllianceId()); } // accept invite, and deny invite don't need allianceid. if (op != 4 && !denied) { if (gs.getAllianceId() <= 0 || leaderid <= 0) { return; } } else if (leaderid > 0 || gs.getAllianceId() > 0) { // infact, if they have allianceid it's suspicious return; } if (denied) { DenyInvite(c, gs); return; } MapleCharacter chr; int inviteid; switch (op) { case 1: // load... must be in world op for (byte[] pack : World.Alliance.getAllianceInfo(gs.getAllianceId(), false)) { if (pack != null) { c.getSession().write(pack); } } break; case 3: // invite final int newGuild = World.Guild.getGuildLeader(slea.readMapleAsciiString()); if (newGuild > 0 && c.getPlayer().getAllianceRank() == 1 && leaderid == c.getPlayer().getId()) { chr = c.getChannelServer().getPlayerStorage().getCharacterById(newGuild); if (chr != null && chr.getGuildId() > 0 && World.Alliance.canInvite(gs.getAllianceId())) { chr.getClient() .getSession() .write( AlliancePacket.sendAllianceInvite( World.Alliance.getAlliance(gs.getAllianceId()).getName(), c.getPlayer())); World.Guild.setInvitedId(chr.getGuildId(), gs.getAllianceId()); } else { c.getPlayer() .dropMessage(1, "Make sure the leader of the guild is online and in your channel."); } } else { c.getPlayer() .dropMessage( 1, "That Guild was not found. Please enter the correct Guild Name. (Not the player name)"); } break; case 4: // accept invite... guildid that invited(int, a/b check) -> guildname that was // invited? but we dont care about that inviteid = World.Guild.getInvitedId(c.getPlayer().getGuildId()); if (inviteid > 0) { if (!World.Alliance.addGuildToAlliance(inviteid, c.getPlayer().getGuildId())) { c.getPlayer().dropMessage(5, "An error occured when adding guild."); } World.Guild.setInvitedId(c.getPlayer().getGuildId(), 0); } break; case 2: // leave; nothing case 6: // expel, guildid(int) -> allianceid(don't care, a/b check) final int gid; if (op == 6 && slea.available() >= 4) { gid = slea.readInt(); if (slea.available() >= 4 && gs.getAllianceId() != slea.readInt()) { break; } } else { gid = c.getPlayer().getGuildId(); } if (c.getPlayer().getAllianceRank() <= 2 && (c.getPlayer().getAllianceRank() == 1 || c.getPlayer().getGuildId() == gid)) { if (!World.Alliance.removeGuildFromAlliance( gs.getAllianceId(), gid, c.getPlayer().getGuildId() != gid)) { c.getPlayer().dropMessage(5, "An error occured when removing guild."); } } break; case 7: // change leader if (c.getPlayer().getAllianceRank() == 1 && leaderid == c.getPlayer().getId()) { if (!World.Alliance.changeAllianceLeader(gs.getAllianceId(), slea.readInt())) { c.getPlayer().dropMessage(5, "An error occured when changing leader."); } } break; case 8: // title update if (c.getPlayer().getAllianceRank() == 1 && leaderid == c.getPlayer().getId()) { String[] ranks = new String[5]; for (int i = 0; i < 5; i++) { ranks[i] = slea.readMapleAsciiString(); } World.Alliance.updateAllianceRanks(gs.getAllianceId(), ranks); } break; case 9: if (c.getPlayer().getAllianceRank() <= 2) { if (!World.Alliance.changeAllianceRank( gs.getAllianceId(), slea.readInt(), slea.readByte())) { c.getPlayer().dropMessage(5, "An error occured when changing rank."); } } break; case 10: // notice update if (c.getPlayer().getAllianceRank() <= 2) { final String notice = slea.readMapleAsciiString(); if (notice.length() > 100) { break; } World.Alliance.updateAllianceNotice(gs.getAllianceId(), notice); } break; default: System.out.println("Unhandled GuildAlliance op: " + op + ", \n" + slea.toString()); break; } // c.getSession().write(CWvsContext.enableActions()); }