/** * 道具执行 * * @param data 参数 * @param pc 对象 * @param item 道具 */ @Override public void execute(final int[] data, final L1PcInstance pc, final L1ItemInstance item) { final int itemId = item.getItemId(); final int itemobj = data[0]; final L1ItemInstance l1iteminstance1 = pc.getInventory().getItem(itemobj); final int logbookId = l1iteminstance1.getItem().getItemId(); if (logbookId == (itemId + 8034)) { pc.createNewItem(pc, 41058, 1); pc.getInventory().removeItem(l1iteminstance1, 1); pc.getInventory().removeItem(item, 1); } else { pc.sendPackets(new S_ServerMessage(79)); // \f1没有任何事情发生。 } }
@Override public void execute(final L1PcInstance pc, final String cmdName, final String arg) { try { final Collection<L1PcInstance> players = L1World.getInstance().getAllPlayers(); final String amount = String.valueOf(players.size()); final S_WhoAmount s_whoamount = new S_WhoAmount(amount); pc.sendPackets(s_whoamount); // オンラインのプレイヤーリストを表示 if (arg.equalsIgnoreCase("all")) { pc.sendPackets(new S_SystemMessage("-- 线上玩家 --")); final StringBuffer buf = new StringBuffer(); for (final L1PcInstance each : players) { buf.append(each.getName()); buf.append(" / "); if (buf.length() > 50) { pc.sendPackets(new S_SystemMessage(buf.toString())); buf.delete(0, buf.length() - 1); } } if (buf.length() > 0) { pc.sendPackets(new S_SystemMessage(buf.toString())); } } } catch (final Exception e) { pc.sendPackets(new S_SystemMessage("请输入: .who [all] 。")); } }
/** * 道具执行 * * @param data 参数 * @param pc 对象 * @param item 道具 */ @Override public void execute(final int[] data, final L1PcInstance pc, final L1ItemInstance item) { final int itemobj = data[0]; final L1ItemInstance l1iteminstance1 = pc.getInventory().getItem(itemobj); final int historybookId = l1iteminstance1.getItem().getItemId(); // 封印的历史书1~8页 if ((historybookId >= 41011) && (41018 >= historybookId)) { if ((Random.nextInt(99) + 1) <= Config.CREATE_CHANCE_HISTORY_BOOK) { pc.createNewItem(pc, historybookId + 8, 1); } else { pc.sendPackets(new S_ServerMessage(158, l1iteminstance1.getName())); // \f1%0%s 消失。 } pc.getInventory().removeItem(l1iteminstance1, 1); pc.getInventory().removeItem(item, 1); } else { pc.sendPackets(new S_ServerMessage(79)); // \f1没有任何事情发生。 } }
/** * 道具物件执行 * * @param data 参数 * @param pc 执行者 * @param item 物件 */ @Override public void execute(final int[] data, final L1PcInstance pc, final L1ItemInstance item) { // 不能变身的状态 // 取回觉醒技能ID final int awakeSkillId = pc.getAwakeSkillId(); if ((awakeSkillId == AWAKEN_ANTHARAS) || (awakeSkillId == AWAKEN_FAFURION) || (awakeSkillId == AWAKEN_VALAKAS)) { pc.sendPackets(new S_ServerMessage(1384)); // 目前状态中无法变身。 return; } // 变身时间 (秒)与变身编号 final short time = 900; final short polyId = 3888; // 小巴 (巴风特) L1PolyMorph.doPoly(pc, polyId, time, L1PolyMorph.MORPH_BY_ITEMMAGIC); // 删除道具 pc.getInventory().removeItem(item, 1); }
@Override public void useItem( final L1PcInstance pc, final L1ItemInstance item, final int itemId, final int effect, int time, final int gfxid) { // 持续时间可累加 if (pc.hasSkillEffect(STATUS_UNDERWATER_BREATH)) { final int timeSec = pc.getSkillEffectTimeSec(STATUS_UNDERWATER_BREATH); time += timeSec; if (time > 7200) { time = 7200; } pc.killSkillEffectTimer(STATUS_UNDERWATER_BREATH); } pc.sendPackets(new S_SkillIconBlessOfEva(pc.getId(), time)); // 状态图示 pc.sendPackets(new S_SkillSound(pc.getId(), gfxid)); // 效果动画 (自己看得到) pc.broadcastPacket(new S_SkillSound(pc.getId(), gfxid)); // 效果动画 // (同画面的其他人看得到) pc.setSkillEffect(STATUS_UNDERWATER_BREATH, time * 1000); // 给予时间 (秒) }
public void monthlyProc() { _log.info("城镇系统:开始处理每月事项"); L1World.getInstance().setProcessingContributionTotal(true); final Collection<L1PcInstance> players = L1World.getInstance().getAllPlayers(); for (final L1PcInstance pc : players) { try { // 储存所有线上玩家的资讯 pc.save(); } catch (final Exception e) { _log.log(Level.SEVERE, e.getLocalizedMessage(), e); } } for (int townId = 1; townId <= 10; townId++) { final String leaderName = totalContribution(townId); if (leaderName != null) { final S_PacketBox packet = new S_PacketBox(S_PacketBox.MSG_TOWN_LEADER, leaderName); for (final L1PcInstance pc : players) { if (pc.getHomeTownId() == townId) { pc.setContribution(0); pc.sendPackets(packet); } } } } TownTable.getInstance().load(); for (final L1PcInstance pc : players) { if (pc.getHomeTownId() == -1) { pc.setHomeTownId(0); } pc.setContribution(0); try { // 储存所有线上玩家的资讯 pc.save(); } catch (final Exception e) { _log.log(Level.SEVERE, e.getLocalizedMessage(), e); } } clearHomeTownID(); L1World.getInstance().setProcessingContributionTotal(false); }
@Override public void useItem( final L1PcInstance pc, final L1ItemInstance item, final int itemId, final int effect, final int time, final int gfxid) { pc.delRepeatSkillEffect(STATUS_THIRD_SPEED); // 删除重复的三段加速效果 pc.sendPackets(new S_SkillSound(pc.getId(), gfxid)); // 效果动画 (自己看得到) pc.broadcastPacket(new S_SkillSound(pc.getId(), gfxid)); // 效果动画 // (同画面的其他人看得到) pc.sendPackets(new S_Liquor(pc.getId(), 8)); // 人物 * 1.15 pc.broadcastPacket(new S_Liquor(pc.getId(), 8)); // 人物 * 1.15 pc.sendPackets(new S_ServerMessage(1065)); // 将发生神秘的奇迹力量。 pc.setSkillEffect(STATUS_THIRD_SPEED, time * 1000); // 给予三段加速时间 (秒) }
/** * 储存聊天 * * @param pc * @param target * @param text * @param type */ public void storeChat( final L1PcInstance pc, final L1PcInstance target, final String text, final int type) { if (!this.isLoggingTarget(type)) { return; } // type // 0:一般频道 // 1:Whisper(密语频道) // 2:大喊频道 // 3:广播频道 // 4:血盟频道 // 11:组队频道 // 13:联盟频道 // 14:聊天队伍频道 Connection con = null; PreparedStatement pstm = null; try { con = L1DatabaseFactory.getInstance().getConnection(); if (target != null) { pstm = con.prepareStatement( "INSERT INTO log_chat (account_name, char_id, name, clan_id, clan_name, locx, locy, mapid, type, target_account_name, target_id, target_name, target_clan_id, target_clan_name, target_locx, target_locy, target_mapid, content, datetime) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SYSDATE())"); pstm.setString(1, pc.getAccountName()); pstm.setInt(2, pc.getId()); pstm.setString(3, pc.isGm() ? "******" : pc.getName()); pstm.setInt(4, pc.getClanid()); pstm.setString(5, pc.getClanname()); pstm.setInt(6, pc.getX()); pstm.setInt(7, pc.getY()); pstm.setInt(8, pc.getMapId()); pstm.setInt(9, type); pstm.setString(10, target.getAccountName()); pstm.setInt(11, target.getId()); pstm.setString(12, target.getName()); pstm.setInt(13, target.getClanid()); pstm.setString(14, target.getClanname()); pstm.setInt(15, target.getX()); pstm.setInt(16, target.getY()); pstm.setInt(17, target.getMapId()); pstm.setString(18, text); } else { pstm = con.prepareStatement( "INSERT INTO log_chat (account_name, char_id, name, clan_id, clan_name, locx, locy, mapid, type, content, datetime) VALUE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SYSDATE())"); pstm.setString(1, pc.getAccountName()); pstm.setInt(2, pc.getId()); pstm.setString(3, pc.isGm() ? "******" : pc.getName()); pstm.setInt(4, pc.getClanid()); pstm.setString(5, pc.getClanname()); pstm.setInt(6, pc.getX()); pstm.setInt(7, pc.getY()); pstm.setInt(8, pc.getMapId()); pstm.setInt(9, type); pstm.setString(10, text); } pstm.execute(); } catch (final SQLException e) { _log.log(Level.SEVERE, e.getLocalizedMessage(), e); } finally { SQLUtil.close(pstm); SQLUtil.close(con); } }
/** * 道具执行 * * @param data 参数 * @param pc 对象 * @param item 道具 */ @Override public void execute(final int[] data, final L1PcInstance pc, final L1ItemInstance item) { final int itemId = item.getItemId(); boolean isTeleport = false; final int x = pc.getX(); final int y = pc.getY(); final short map = pc.getMapId(); switch (itemId) { case 40289: // 傲慢之塔传送符(11F),傲慢之塔传送符(51F) case 40293: // 傲慢之塔1层上方魔法阵 if ((x >= 32816) && (x <= 32821) && (y >= 32778) && (y <= 32783) && (map == 101)) { isTeleport = true; } break; case 40290: // 傲慢之塔传送符(21F),傲慢之塔传送符(61F) case 40294: // 傲慢之塔1层右方魔法阵 if ((x >= 32815) && (x <= 32820) && (y >= 32815) && (y <= 32820) && (map == 101)) { isTeleport = true; } break; case 40291: // 傲慢之塔传送符(31F),傲慢之塔传送符(71F) case 40295: // 傲慢之塔1层左方魔法阵 if ((x >= 32779) && (x <= 32784) && (y >= 32778) && (y <= 32783) && (map == 101)) { isTeleport = true; } break; case 40292: // 傲慢之塔传送符(41F),傲慢之塔传送符(81F) case 40296: // 傲慢之塔1层下方魔法阵 if ((x >= 32779) && (x <= 32784) && (y >= 32815) && (y <= 32820) && (map == 101)) { isTeleport = true; } break; case 40297: // 傲慢之塔传送符(91F) // 傲慢之塔90层右方魔法阵 if ((x >= 32706) && (x <= 32710) && (y >= 32909) && (y <= 32913) && (map == 190)) { isTeleport = true; } break; } if (isTeleport) { L1Teleport.teleport( pc, item.getItem().get_locx(), item.getItem().get_locy(), item.getItem().get_mapid(), 5, true); } else { pc.sendPackets(new S_ServerMessage(79)); // \f1没有任何事情发生。 } }
public C_Shop(final byte abyte0[], final ClientThread clientthread) { super(abyte0); final L1PcInstance pc = clientthread.getActiveChar(); if (pc.isGhost()) { return; } final int mapId = pc.getMapId(); // 可以开设个人商店的地图 if ((mapId != 340 // 古鲁丁商店村 ) && (mapId != 350 // 奇岩商店村 ) && (mapId != 360 // 欧瑞商店村 ) && (mapId != 370 // 银骑士商店村 )) { pc.sendPackets(new S_ServerMessage(876)); // 无法在此开设个人商店。 return; } final List<L1PrivateShopSellList> sellList = pc.getSellList(); final List<L1PrivateShopBuyList> buyList = pc.getBuyList(); L1ItemInstance checkItem; boolean tradable = true; final int type = this.readC(); if (type == 0) { // 开始 final int sellTotalCount = this.readH(); int sellObjectId; int sellPrice; int sellCount; for (int i = 0; i < sellTotalCount; i++) { sellObjectId = this.readD(); sellPrice = this.readD(); sellCount = this.readD(); // 检查交易项目 checkItem = pc.getInventory().getItem(sellObjectId); if (!checkItem.getItem().isTradable()) { tradable = false; pc.sendPackets( new S_ServerMessage( 166, // \f1%0%s %4%1%3 // %2。 checkItem.getItem().getName(), "这是不可能处理。")); } for (final L1NpcInstance petNpc : pc.getPetList().values()) { if (petNpc instanceof L1PetInstance) { final L1PetInstance pet = (L1PetInstance) petNpc; if (checkItem.getId() == pet.getItemObjId()) { tradable = false; pc.sendPackets( new S_ServerMessage( 166, // \f1%0%s // %4%1%3 // %2。 checkItem.getItem().getName(), "这是不可能处理。")); break; } } } final L1PrivateShopSellList pssl = new L1PrivateShopSellList(); pssl.setItemObjectId(sellObjectId); pssl.setSellPrice(sellPrice); pssl.setSellTotalCount(sellCount); sellList.add(pssl); } final int buyTotalCount = this.readH(); int buyObjectId; int buyPrice; int buyCount; for (int i = 0; i < buyTotalCount; i++) { buyObjectId = this.readD(); buyPrice = this.readD(); buyCount = this.readD(); // 检查交易项目 checkItem = pc.getInventory().getItem(buyObjectId); if (!checkItem.getItem().isTradable()) { tradable = false; pc.sendPackets( new S_ServerMessage( 166, // \f1%0%s %4%1%3 // %2。 checkItem.getItem().getName(), "这是不可能处理。")); } // 封印的装备 if (checkItem.getBless() >= 128) { // 封印的装备 // \f1%0%d是不可转移的… pc.sendPackets(new S_ServerMessage(210, checkItem.getItem().getName())); return; } // 防止异常堆叠交易 if ((checkItem.getCount() > 1) && (!checkItem.getItem().isStackable())) { pc.sendPackets(new S_SystemMessage("此物品非堆叠,但异常堆叠无法交易。")); return; } // 使用中的宠物项链 - 无法贩卖 for (final L1NpcInstance petNpc : pc.getPetList().values()) { if (petNpc instanceof L1PetInstance) { final L1PetInstance pet = (L1PetInstance) petNpc; if (checkItem.getId() == pet.getItemObjId()) { tradable = false; pc.sendPackets(new S_ServerMessage(1187)); // 宠物项链正在使用中。 break; } } } // 使用中的魔法娃娃 - 无法贩卖 for (final L1DollInstance doll : pc.getDollList().values()) { if (doll.getItemObjId() == checkItem.getId()) { tradable = false; pc.sendPackets(new S_ServerMessage(1181)); // 这个魔法娃娃目前正在使用中。 break; } } final L1PrivateShopBuyList psbl = new L1PrivateShopBuyList(); psbl.setItemObjectId(buyObjectId); psbl.setBuyPrice(buyPrice); psbl.setBuyTotalCount(buyCount); buyList.add(psbl); } if (!tradable) { // 如果项目不包括在交易结束零售商 sellList.clear(); buyList.clear(); pc.setPrivateShop(false); pc.sendPackets(new S_DoActionGFX(pc.getId(), ActionCodes.ACTION_Idle)); pc.broadcastPacket(new S_DoActionGFX(pc.getId(), ActionCodes.ACTION_Idle)); return; } final byte[] chat = this.readByte(); pc.setShopChat(chat); pc.setPrivateShop(true); pc.sendPackets(new S_DoActionShop(pc.getId(), ActionCodes.ACTION_Shop, chat)); pc.broadcastPacket(new S_DoActionShop(pc.getId(), ActionCodes.ACTION_Shop, chat)); } else if (type == 1) { // 终了 sellList.clear(); buyList.clear(); pc.setPrivateShop(false); pc.sendPackets(new S_DoActionGFX(pc.getId(), ActionCodes.ACTION_Idle)); pc.broadcastPacket(new S_DoActionGFX(pc.getId(), ActionCodes.ACTION_Idle)); } }
/** * 道具执行 * * @param data 参数 * @param pc 对象 * @param item 道具 */ @Override public void execute(final int[] data, final L1PcInstance pc, final L1ItemInstance item) { // 伊娃圣水 if (pc.hasSkillEffect(STATUS_HOLY_WATER_OF_EVA)) { pc.sendPackets(new S_ServerMessage(79)); // \f1没有任何事情发生。 return; } // 删除圣水状态 if (pc.hasSkillEffect(STATUS_HOLY_WATER)) { pc.removeSkillEffect(STATUS_HOLY_WATER); } pc.setSkillEffect(STATUS_HOLY_MITHRIL_POWDER, 900 * 1000); pc.sendPackets(new S_SkillSound(pc.getId(), 190)); pc.broadcastPacket(new S_SkillSound(pc.getId(), 190)); pc.sendPackets(new S_ServerMessage(1142)); // 你得到可以攻击哈蒙将军的力量。 pc.getInventory().removeItem(item, 1); }
@Override public void stopSkill(final L1Character cha, final int skillId) { switch (skillId) { case LIGHT: // 法师魔法 (日光术) if (cha instanceof L1PcInstance) { if (!cha.isInvisble()) { final L1PcInstance pc = (L1PcInstance) cha; pc.turnOnOffLight(); } } break; case SHIELD: // 法师魔法 (防护罩) cha.addAc(2); if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_SkillIconShield(5, 0)); } break; case ENCHANT_WEAPON: // 法师魔法 (拟似魔法武器) cha.addDmgup(-2); break; case CURSE_BLIND: // 法师魔法 (暗盲咒术) case DARKNESS: // 法师魔法 (黑暗之影) if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_CurseBlind(0)); } break; case BLESSED_ARMOR: // 法师魔法 (铠甲护持) cha.addAc(3); break; case PHYSICAL_ENCHANT_DEX: // 法师魔法 (通畅气脉术):DEX cha.addDex((byte) -5); if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_Dexup(pc, 5, 0)); } break; case SLOW: // 法师魔法 (缓速) case MASS_SLOW: // 法师魔法 (集体缓速术) if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_SkillHaste(pc.getId(), 0, 0)); pc.broadcastPacket(new S_SkillHaste(pc.getId(), 0, 0)); } cha.setMoveSpeed(0); break; case MEDITATION: // 法师魔法 (冥想术) if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.addMpr(-5); } break; case CURSE_PARALYZE: // 法师魔法 (木乃伊的诅咒 if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_Poison(pc.getId(), 0)); pc.broadcastPacket(new S_Poison(pc.getId(), 0)); pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_PARALYSIS, false)); } break; case PHYSICAL_ENCHANT_STR: // 法师魔法 (体魄强健术):STR cha.addStr((byte) -5); if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_Strup(pc, 5, 0)); } break; case HASTE: // 法师魔法 (加速术)(强力加速术) case GREATER_HASTE: cha.setMoveSpeed(0); if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_SkillHaste(pc.getId(), 0, 0)); pc.broadcastPacket(new S_SkillHaste(pc.getId(), 0, 0)); } break; case WEAKNESS: // 法师魔法 (弱化术) cha.addDmgup(5); cha.addHitup(1); break; case BLESS_WEAPON: // 法师魔法 (祝福魔法武器) cha.addDmgup(-2); cha.addHitup(-2); cha.addBowHitup(-2); break; case ICE_LANCE: // 法师魔法 (冰矛围篱) case FREEZING_BLIZZARD: // 法师魔法 (冰雪飓风) if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_Poison(pc.getId(), 0)); pc.broadcastPacket(new S_Poison(pc.getId(), 0)); pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_FREEZE, false)); } else if ((cha instanceof L1MonsterInstance) || (cha instanceof L1SummonInstance) || (cha instanceof L1PetInstance)) { final L1NpcInstance npc = (L1NpcInstance) cha; npc.broadcastPacket(new S_Poison(npc.getId(), 0)); npc.setParalyzed(false); } break; case HOLY_WALK: // 神圣疾走 cha.setBraveSpeed(0); if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_SkillBrave(pc.getId(), 0, 0)); pc.broadcastPacket(new S_SkillBrave(pc.getId(), 0, 0)); } break; case BERSERKERS: // 法师魔法 (狂暴术) cha.addAc(-10); cha.addDmgup(-5); cha.addHitup(-2); break; case DISEASE: // 法师魔法 (疾病术) cha.addDmgup(6); cha.addAc(-12); break; case FOG_OF_SLEEPING: // 法师魔法 (沉睡之雾) cha.setSleeped(false); if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_SLEEP, false)); pc.sendPackets(new S_OwnCharStatus(pc)); } break; case SHAPE_CHANGE: // 法师魔法 (变形术) L1PolyMorph.undoPoly(cha); break; case ABSOLUTE_BARRIER: // 法师魔法 (绝对屏障) if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.startHpRegeneration(); pc.startMpRegeneration(); pc.startHpRegenerationByDoll(); pc.startMpRegenerationByDoll(); } break; case ADVANCE_SPIRIT: // 法师魔法 (灵魂升华) if (cha instanceof L1PcInstance) { final L1PcInstance pc = (L1PcInstance) cha; pc.addMaxHp(-pc.getAdvenHp()); pc.addMaxMp(-pc.getAdvenMp()); pc.setAdvenHp(0); pc.setAdvenMp(0); pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc.getMaxHp())); if (pc.isInParty()) { // 组队中 pc.getParty().updateMiniHP(pc); } pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc.getMaxMp())); } break; } }