/** 목록에 아이템을 복수개 정리해 추가한다. */ public S_InvList(L1PcInstance pc) { List<L1ItemInstance> items = pc.getInventory().getItems(); for (L1ItemInstance item : items) { if (item.getItemId() == L1ItemId.DRAGON_KEY) { if (System.currentTimeMillis() > item.getEndTime().getTime()) { pc.getInventory().deleteItem(item); } } } writeC(Opcodes.S_OPCODE_INVLIST); writeC(items.size()); byte[] status = null; for (L1ItemInstance item : items) { writeD(item.getId()); writeC(item.getItem().getUseType()); writeC(0); writeH(item.get_gfxid()); writeC(item.getBless()); writeD(item.getCount()); writeC((item.isIdentified()) ? 1 : 0); writeS(item.getViewName()); if (!item.isIdentified()) { // 미감정의 경우 스테이터스를 보낼 필요는 없다 writeC(0); } else { status = item.getStatusBytes(); writeC(status.length); for (byte b : status) { writeC(b); } } } }
private void DragonkeyTimeCheck(L1PcInstance pc, int count) { long nowtime = System.currentTimeMillis(); if (count == 1) { L1ItemInstance item = pc.getInventory().findItemId(L1ItemId.DRAGON_KEY); if (nowtime > item.getEndTime().getTime()) pc.getInventory().removeItem(item); } else { L1ItemInstance[] itemList = pc.getInventory().findItemsId(L1ItemId.DRAGON_KEY); for (int i = 0; i < itemList.length; i++) { if (nowtime > itemList[i].getEndTime().getTime()) pc.getInventory().removeItem(itemList[i]); } } }
private boolean isOverWeight(L1PcInstance pc) { if (pc.getSkillEffectTimerSet().hasSkillEffect(L1SkillId.EXOTIC_VITALIZE) || pc.getSkillEffectTimerSet().hasSkillEffect(L1SkillId.ADDITIONAL_FIRE)) { return false; } if (isInn(pc)) { return false; } return (120 <= pc.getInventory().getWeight240()) ? true : false; }
@Override public void clickItem(L1Character cha, ClientBasePacket packet) { if (cha instanceof L1PcInstance) { L1PcInstance pc = (L1PcInstance) cha; L1ItemInstance useItem = pc.getInventory().getItem(this.getId()); int itemId = this.getItemId(); L1ItemInstance l1iteminstance1 = pc.getInventory().getItem(packet.readD()); if (itemId == 50020) { // 봉인줌서 if (l1iteminstance1.getBless() >= 0 && l1iteminstance1.getBless() <= 3) { int Bless = 0; switch (l1iteminstance1.getBless()) { case 0: Bless = 128; break; // 축 case 1: Bless = 129; break; // 보통 case 2: Bless = 130; break; // 저주 case 3: Bless = 131; break; // 미확인 } l1iteminstance1.setBless(Bless); pc.getInventory().updateItem(l1iteminstance1, L1PcInventory.COL_BLESS); pc.getInventory().saveItem(l1iteminstance1, L1PcInventory.COL_BLESS); pc.getInventory().removeItem(useItem, 1); } else pc.sendPackets(new S_ServerMessage(79)); // \f1 아무것도 일어나지 않았습니다. } else if (itemId == 50021) { // 봉인해제줌서 if (l1iteminstance1.getBless() >= 128 && l1iteminstance1.getBless() <= 131) { int Bless = 0; switch (l1iteminstance1.getBless()) { case 128: Bless = 0; break; case 129: Bless = 1; break; case 130: Bless = 2; break; case 131: Bless = 3; break; } l1iteminstance1.setBless(Bless); pc.getInventory().updateItem(l1iteminstance1, L1PcInventory.COL_BLESS); pc.getInventory().saveItem(l1iteminstance1, L1PcInventory.COL_BLESS); pc.getInventory().removeItem(useItem, 1); } else pc.sendPackets(new S_ServerMessage(79)); // \f1 아무것도 일어나지 않았습니다. } } }
private boolean isInn(L1PcInstance pc) { int mapId = pc.getMapId(); return (mapId == 16384 || mapId == 16896 || mapId == 17408 || mapId == 17492 || mapId == 17820 || mapId == 17920 || mapId == 18432 || mapId == 18944 || mapId == 19456 || mapId == 19968 || mapId == 20480 || mapId == 20992 || mapId == 21504 || mapId == 22016 || mapId == 22528 || mapId == 23040 || mapId == 23552 || mapId == 24064 || mapId == 24576 || mapId == 25088) ? true : false; }
@Override public void execute(L1PcInstance pc, String cmdName, String arg) { try { StringTokenizer st = new StringTokenizer(arg); int gfxid = Integer.parseInt(st.nextToken(), 10); int count = Integer.parseInt(st.nextToken(), 10); L1ItemInstance item = null; for (int i = 0; i < count; i++) { item = ItemTable.getInstance().createItem(40005); item.getItem().setGfxId(gfxid + i); item.getItem().setName(String.valueOf(gfxid + i)); item.getItem().setNameId(String.valueOf(gfxid + i)); pc.getInventory().storeItem(item); } } catch (Exception exception) { pc.sendPackets(new S_SystemMessage(cmdName + " [id] [출현시키는 수]로 입력해 주세요. ")); } }
private void giveFeather(L1PcInstance pc) { pc.setTimeCount(0); int featherCount = 0; if (Config.GAME_SERVER_TYPE == 1) { featherCount = 600; } else { if (pc.isPrivateShop()) { featherCount = 1; } else { featherCount = 18; } } featherCount *= pc.getadFeature(); pc.getInventory().storeItem(41159, featherCount); // 신비한 날개깃털 지급 pc.sendPackets(new S_ServerMessage(403, "$5116 (" + featherCount + ")")); }
public static void runSkill(L1Character user, L1PcInstance player, int skillBuffDuration) { L1EffectInstance effect = L1EffectSpawn.getInstance() .spawnEffect( 4500501, skillBuffDuration * 1000, user.getX(), user.getY(), user.getMapId()); player.getSkillEffectTimerSet().setSkillEffect(CUBE_IGNITION, skillBuffDuration * 1000); effect.setCubeTime(4); effect.setCubePc(player); L1Cube.getInstance().add(0, effect); }
private void buildPacket(L1PcInstance pc) { writeC(Opcodes.S_OPCODE_SPMR); // 위즈 댐 일부의 SP는 S_SkillBrave 송신시에 갱신되기 (위해)때문에 공제해 둔다 if (pc.getSkillEffectTimerSet().hasSkillEffect(L1SkillId.STATUS_WISDOM_POTION)) { writeC(pc.getAbility().getSp() - pc.getAbility().getTrueSp() - 2); // 장비 증가한 SP } else { writeC(pc.getAbility().getSp() - pc.getAbility().getTrueSp()); // 장비 증가한 SP } writeC(pc.getResistance().getMr() - pc.getResistance().getBaseMr()); // 장비나 마법으로 증가한 MR }
@Override public void run() { try { if (_pc.isDead()) { return; } _regenPoint += _curPoint; _curPoint = 4; if (64 <= _regenPoint) { _regenPoint = 0; regenMp(); } } catch (Throwable e) { _log.log(Level.WARNING, e.getLocalizedMessage(), e); } }
private void buttonPolyClicked(MouseEvent evt) { String kname1 = 닉네임.getText(); for (L1PcInstance pc : L1World.getInstance().getAllPlayers()) { if (pc.getName().equalsIgnoreCase(kname1)) { int Polyid = Integer.parseInt(변신번호.getText()); pc.setTempCharGfxAtDead(Polyid); pc.sendPackets(new S_ChangeShape(pc.getId(), Polyid)); // pc.broadcastPacket(this, new S_ChangeShape(pc.getId(), 0)); pc.getInventory().takeoffEquip(Polyid); bone.LogServerAppend("변신 시켜 주었습니다..", "확인바람"); } else if (!pc.getName().equalsIgnoreCase(kname1)) { bone.LogServerAppend("변신실패 했습니다...", "확인바람"); } } }
public static void runSkill(L1Character cha) { L1PcInstance pc = (L1PcInstance) cha; int attr = pc.getElfAttr(); if (attr != 0) { if (pc.getMap().isRecallPets() || pc.isGm()) { int petcost = 0; Object[] petlist = pc.getPetList().values().toArray(); for (Object pet : petlist) { petcost += ((L1NpcInstance) pet).getPetcost(); } if (petcost == 0) { int summonid = 0; int summons[]; summons = new int[] {45306, 45303, 45304, 45305}; int npcattr = 1; for (int i = 0; i < summons.length; i++) { if (npcattr == attr) { summonid = summons[i]; i = summons.length; } npcattr *= 2; } if (summonid == 0) { Random random = new Random(); int k3 = random.nextInt(4); summonid = summons[k3]; } L1Npc npcTemp = NpcTable.getInstance().getTemplate(summonid); L1SummonInstance summon = new L1SummonInstance(npcTemp, pc); summon.setPetcost(pc.getAbility().getTotalCha() + 7); } } else { pc.sendPackets(new S_ServerMessage(79)); } } }
private void GungeonTimeCheck(L1PcInstance pc) { RealTime time = RealTimeClock.getInstance().getRealTime(); int entertime = pc.getGdungeonTime() % 1000; int enterday = pc.getGdungeonTime() / 1000; int dayofyear = time.get(Calendar.DAY_OF_YEAR); if (dayofyear == 365) dayofyear += 1; if (entertime > 180) { // 메세지를 주고 L1Teleport.teleport(pc, 33419, 32810, (short) 4, 5, true); } else if (enterday < dayofyear) { pc.setGdungeonTime(time.get(Calendar.DAY_OF_YEAR) * 1000); } else { if (entertime > 169) { int a = 180 - entertime; pc.sendPackets(new S_ServerMessage(1527, "" + a + "")); // 체류시간이 %분 남았다. } pc.setGdungeonTime(pc.getGdungeonTime() + 1); } }
public void run() { System.out.println(PremiumAinThread.class.getName() + " 시작"); while (true) { try { for (L1PcInstance _client : L1World.getInstance().getAllPlayers()) { if (_client == null || _client.getNetConnection() == null) { continue; } else { try { int tc = _client.getTimeCount(); if (tc >= 11) giveFeather(_client); else _client.setTimeCount(tc + 1); if (_client.getLevel() >= 49) { int sc = _client.getSafeCount(); if (CharPosUtil.getZoneType(_client) == 1 && !_client.isPrivateShop()) { if (sc >= 14) { if (_client.getAinHasad() <= 1999999) _client.calAinHasad(10000 * 2); _client.setSafeCount(0); } else { _client.setSafeCount(sc + 1); } } else { if (sc > 0) _client.setSafeCount(0); } } if (_client.getMapId() >= 53 && _client.getMapId() <= 56) // 기란던전 GungeonTimeCheck(_client); int keycount = _client.getInventory().countItems(L1ItemId.DRAGON_KEY); if (keycount > 0) DragonkeyTimeCheck(_client, keycount); } catch (Exception e) { _log.warning("Primeum give failure."); _log.log(Level.SEVERE, e.getLocalizedMessage(), e); throw e; } } } Thread.sleep(60000); } catch (Exception e) { _log.log(Level.SEVERE, e.getLocalizedMessage(), e); // cancel(); } } }
public static void runSkill(L1Character cha, int buffIconDuration) { L1PcInstance pc = (L1PcInstance) cha; pc.addDmgup(5); pc.sendPackets(new S_SkillIconAura(116, buffIconDuration)); }
public void regenMp() { int baseMpr = 1; int wis = _pc.getAbility().getTotalWis(); if (wis == 15 || wis == 16) { baseMpr = 2; } else if (wis >= 17) { baseMpr = 3; } // 베이스 WIS 회복 보너스 int baseStatMpr = CalcStat.calcBaseMpr(_pc.getType(), _pc.getAbility().getBaseWis()); if (_pc.getSkillEffectTimerSet().hasSkillEffect(L1SkillId.STATUS_BLUE_POTION) == true) { if (wis < 11) { wis = 11; } baseMpr += wis - 10; } if (_pc.getSkillEffectTimerSet().hasSkillEffect(L1SkillId.STATUS_BLUE_POTION2) == true) { if (wis < 11) { wis = 11; } baseMpr += wis - 8; } if (_pc.getSkillEffectTimerSet().hasSkillEffect(L1SkillId.STATUS_BLUE_POTION3) == true) { baseMpr += 3; } if (_pc.getSkillEffectTimerSet().hasSkillEffect(L1SkillId.MEDITATION) == true) { baseMpr += 5; } if (_pc.getSkillEffectTimerSet().hasSkillEffect(L1SkillId.CONCENTRATION) == true) { baseMpr += 2; } if (L1HouseLocation.isInHouse(_pc.getX(), _pc.getY(), _pc.getMapId())) { baseMpr += 3; } if (isInn(_pc)) { baseMpr += 3; } if (L1HouseLocation.isRegenLoc(_pc, _pc.getX(), _pc.getY(), _pc.getMapId())) { baseMpr += 3; } int itemMpr = _pc.getInventory().mpRegenPerTick(); itemMpr += _pc.getMpr(); if (_pc.get_food() < 24 || isOverWeight(_pc)) { baseMpr = 0; baseStatMpr = 0; if (itemMpr > 0) { itemMpr = 0; } } int mpr = baseMpr + itemMpr + baseStatMpr; int newMp = _pc.getCurrentMp() + mpr; _pc.setCurrentMp(newMp); }
public S_HPUpdate(L1PcInstance pc) { buildPacket(pc.getCurrentHp(), pc.getMaxHp()); }