Ir para conteúdo
  • Cadastre-se

yokitosmt

Membro
  • Total de itens

    21
  • Registro em

  • Última visita

1 Seguidor

Sobre yokitosmt

  • Data de Nascimento 03/24/1996

Informação do Perfil

  • Gênero
    Masculino
  • Localização
    Cuiaba
  • Interesses
    L2J

Últimos Visitantes

O bloco dos últimos visitantes está desativado e não está sendo visualizado por outros usuários.

yokitosmt's Achievements

Novato

Novato (2/14)

  • Primeiro Post Rare
  • Dedicado Rare
  • Puxador de assunto Rare
  • Uma Semana Completa Rare
  • Um Mês Completo Rare

Selos Recentes

3

Reputação

  1. Bom dia ! Uma duvida, qual o valor gasto em media para se abrir um servidor hoje ?
  2. yokitosmt

    Mod L2JLisvus

    Olá, alguém poderia adaptar este Mod de SellBuffs para l2jlisvus 749? ### Eclipse Workspace Patch 1.0 #P aCis_gameserver diff --git java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java index e77f468..131c6d5 100644 --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java @@ -1,44 +1,46 @@ package net.sf.l2j.gameserver.handler; import java.util.HashMap; import java.util.Map; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.EventCommand; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Menu; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.OfflinePlayer; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Online; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.PremiumStatus; +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.SellBuff; public class VoicedCommandHandler { private final Map<Integer, IVoicedCommandHandler> _entries = new HashMap<>(); protected VoicedCommandHandler() { registerHandler(new Online()); registerHandler(new Menu()); registerHandler(new OfflinePlayer()); registerHandler(new PremiumStatus()); registerHandler(new EventCommand()); + registerHandler(new SellBuff()); } public void registerHandler(IVoicedCommandHandler handler) { String[] ids = handler.getVoicedCommandList(); for (int i = 0; i < ids.length; i++) _entries.put(ids[i].hashCode(), handler); } public IVoicedCommandHandler getHandler(String voicedCommand) { String command = voicedCommand; if (voicedCommand.indexOf(" ") != -1) command = voicedCommand.substring(0, voicedCommand.indexOf(" ")); return _entries.get(command.hashCode()); } public int size() { diff --git java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/SellBuff.java new file mode 100644 index 0000000..36af6d8 --- /dev/null +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/SellBuff.java @@ -0,0 +1,74 @@ +package net.sf.l2j.gameserver.handler.voicedcommandhandlers; + +import net.sf.l2j.gameserver.enums.ZoneId; +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; +import net.sf.l2j.gameserver.model.actor.Player; +import net.sf.l2j.gameserver.model.entity.events.capturetheflag.CTFEvent; +import net.sf.l2j.gameserver.model.entity.events.deathmatch.DMEvent; +import net.sf.l2j.gameserver.model.entity.events.lastman.LMEvent; +import net.sf.l2j.gameserver.model.entity.events.teamvsteam.TvTEvent; +import net.sf.l2j.gameserver.model.olympiad.OlympiadManager; +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; + +/** + * + * @author Iratus + */ +public class SellBuff implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = {"sellbuffs"}; + + @Override + public boolean useVoicedCommand(String command, Player activeChar, String target) + { + if(activeChar == null) + return false; + + if(activeChar.isDead() || activeChar.isAlikeDead()) + { + activeChar.sendMessage("You are dead , you can't sell at the moment"); + return false; + } + else if(activeChar.isInOlympiadMode() || OlympiadManager.getInstance().isRegistered(activeChar)) + { + activeChar.sendMessage("You are in olympiad , you can't sell at the moment"); + return false; + } + final int charId = activeChar.getObjectId(); + if (CTFEvent.isPlayerParticipant(charId) || DMEvent.isPlayerParticipant(charId) || LMEvent.isPlayerParticipant(charId) || TvTEvent.isPlayerParticipant(charId)) + { + activeChar.sendMessage("You can't join Start Buffs while participating on Event."); + return false; + } + else if(!activeChar.isInsideZone(ZoneId.PEACE)) + { + activeChar.sendMessage("You are not in peacefull zone , you can sell only in peacefull zones"); + return false; + } + else if(activeChar.getClassId().getId() != 98) + { + activeChar.sendMessage("You must be a buffer class to sell buffs"); + return false; + } + + StringBuilder tb = new StringBuilder(0); + tb.append("<html><body>"); + tb.append("Hello , by completing this form you will be able to sell buffs."); + tb.append("<br>Players will be able , targeting you to take your buff services<br>"); + tb.append("<br>You will be rewarded with adenas for each buff a player takes."); + tb.append("<br><center>Now choose the prize:</center><br>"); + tb.append("<edit var=\"pri\" width=120 height=15>"); + tb.append("<center><button value=\"Confirm\" action=\"bypass -h actr $pri\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\">"); + tb.append("</body></html>"); + NpcHtmlMessage n = new NpcHtmlMessage(0); + n.setHtml(tb.toString()); + activeChar.sendPacket(n); + return true; + } + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } + +} \ No newline at end of file diff --git java/net/sf/l2j/gameserver/model/actor/Player.java index 588d728..9fa12d3 100644 --- java/net/sf/l2j/gameserver/model/actor/Player.java +++ java/net/sf/l2j/gameserver/model/actor/Player.java @@ -68,44 +68,45 @@ import net.sf.l2j.gameserver.enums.SpawnType; import net.sf.l2j.gameserver.enums.StatusType; import net.sf.l2j.gameserver.enums.TeamType; import net.sf.l2j.gameserver.enums.TeleportMode; import net.sf.l2j.gameserver.enums.ZoneId; import net.sf.l2j.gameserver.enums.actors.ClassId; import net.sf.l2j.gameserver.enums.actors.ClassRace; import net.sf.l2j.gameserver.enums.actors.ClassType; import net.sf.l2j.gameserver.enums.actors.MoveType; import net.sf.l2j.gameserver.enums.actors.OperateType; import net.sf.l2j.gameserver.enums.actors.Sex; import net.sf.l2j.gameserver.enums.actors.WeightPenalty; import net.sf.l2j.gameserver.enums.bbs.ForumAccess; import net.sf.l2j.gameserver.enums.bbs.ForumType; import net.sf.l2j.gameserver.enums.items.ActionType; import net.sf.l2j.gameserver.enums.items.EtcItemType; import net.sf.l2j.gameserver.enums.items.ItemLocation; import net.sf.l2j.gameserver.enums.items.ItemState; import net.sf.l2j.gameserver.enums.items.ShotType; import net.sf.l2j.gameserver.enums.items.WeaponType; import net.sf.l2j.gameserver.enums.skills.EffectFlag; import net.sf.l2j.gameserver.enums.skills.EffectType; +import net.sf.l2j.gameserver.enums.skills.SkillType; import net.sf.l2j.gameserver.enums.skills.Stats; import net.sf.l2j.gameserver.geoengine.GeoEngine; import net.sf.l2j.gameserver.handler.IItemHandler; import net.sf.l2j.gameserver.handler.ItemHandler; import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEditChar; import net.sf.l2j.gameserver.handler.skillhandlers.SummonFriend; import net.sf.l2j.gameserver.model.AccessLevel; import net.sf.l2j.gameserver.model.PetDataEntry; import net.sf.l2j.gameserver.model.World; import net.sf.l2j.gameserver.model.WorldObject; import net.sf.l2j.gameserver.model.actor.ai.type.PlayerAI; import net.sf.l2j.gameserver.model.actor.attack.PlayerAttack; import net.sf.l2j.gameserver.model.actor.cast.PlayerCast; import net.sf.l2j.gameserver.model.actor.container.npc.RewardInfo; import net.sf.l2j.gameserver.model.actor.container.player.Appearance; import net.sf.l2j.gameserver.model.actor.container.player.BlockList; import net.sf.l2j.gameserver.model.actor.container.player.CubicList; import net.sf.l2j.gameserver.model.actor.container.player.FishingStance; import net.sf.l2j.gameserver.model.actor.container.player.HennaList; import net.sf.l2j.gameserver.model.actor.container.player.MacroList; import net.sf.l2j.gameserver.model.actor.container.player.Punishment; import net.sf.l2j.gameserver.model.actor.container.player.QuestList; @@ -282,44 +283,46 @@ public static final int REQUEST_TIMEOUT = 15; private static final Comparator<GeneralSkillNode> COMPARE_SKILLS_BY_MIN_LVL = Comparator.comparing(GeneralSkillNode::getMinLvl); private static final Comparator<GeneralSkillNode> COMPARE_SKILLS_BY_LVL = Comparator.comparing(GeneralSkillNode::getValue); private long _offlineShopStart; private GameClient _client; private final Map<Integer, String> _chars = new HashMap<>(); private final String _accountName; private long _deleteTimer; private boolean _isOnline; private long _onlineTime; private long _onlineBeginTime; private long _lastAccess; private long _uptime; protected int _baseClass; protected int _activeClass; protected int _classIndex; + private boolean _sellbuff = false; + private int _buffprize = 0; private final Map<Integer, SubClass> _subClasses = new ConcurrentSkipListMap<>(); private final ReentrantLock _subclassLock = new ReentrantLock(); private final Appearance _appearance; private long _expBeforeDeath; private int _karma; private int _pvpKills; private int _pkKills; private byte _pvpFlag; private int _siegeState; private WeightPenalty _weightPenalty = WeightPenalty.NONE; private int _lastCompassZone; // the last compass zone update send to the client private boolean _isIn7sDungeon; private final Punishment _punishment = new Punishment(this); private final RecipeBook _recipeBook = new RecipeBook(this); private boolean _isInOlympiadMode; @@ -1552,44 +1555,47 @@ }, 2500); // Broadcast the packet. broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_SITTING)); // Tutorial final QuestState qs = _questList.getQuestState("Tutorial"); if (qs != null) qs.getQuest().notifyEvent("CE8388608", null, this); return true; } /** * Stand the {@link Player} up. The player retrieves control after a 2.5s delay. * <ul> * <li>Schedules the STOOD_UP event</li> * <li>Broadcast {@link ChangeWaitType} packet</li> * </ul> */ public void standUp() { + if(isSellBuff()) + return; _isStandingNow = true; _isSitting = false; // Schedule a stand up task to wait for the animation to finish ThreadPool.schedule(() -> { _isStandingNow = false; _isStanding = true; getAI().notifyEvent(AiEventType.STOOD_UP, null, null); }, 2500); // Broadcast the packet. broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_STANDING)); } /** * @return The PcWarehouse object of the Player. */ public PcWarehouse getWarehouse() { @@ -2657,44 +2663,84 @@ su.addAttribute(StatusType.MAX_HP, target.getStatus().getMaxHp()); su.addAttribute(StatusType.CUR_HP, (int) target.getStatus().getHp()); sendPacket(su); broadcastPacket(new TargetSelected(getObjectId(), newTarget.getObjectId(), getX(), getY(), getZ()), false); } if (newTarget instanceof Folk) setCurrentFolk((Folk) newTarget); else if (newTarget == null) { sendPacket(ActionFailed.STATIC_PACKET); if (getTarget() != null) { broadcastPacket(new TargetUnselected(this)); setCurrentFolk(null); } } // Target the new WorldObject super.setTarget(newTarget); + Player t = null; + if(newTarget instanceof Player) + t = (Player) newTarget; + + if(t != null) + { + if(t.isSellBuff() && t != this) + { + StringBuilder tb = new StringBuilder(); + NpcHtmlMessage n = new NpcHtmlMessage(0); + + tb.append("<html><body>"); + tb.append("<br><br>"); + tb.append("<center>Hi, I am "+t.getName()+" and i sell my buffs</center>"); + tb.append("<br><center>Buffs Prize:"+t.getBuffPrize()+"</center>"); + + Collection<L2Skill> skills = t.getSkills().values(); + ArrayList<L2Skill> ba = new ArrayList<L2Skill>(); + + for(L2Skill s : skills) + { + if(s == null) + continue; + + if(s.getSkillType() == SkillType.BUFF && s.isActive()) + ba.add(s); + } + + for(L2Skill p : ba) + { + tb.append("<center><button value=\""+p.getName()+"\" action=\"bypass -h buff"+p.getId()+"\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\"></center>"); + } + + tb.append("</body></html>"); + + n.setHtml(tb.toString()); + sendPacket(n); + } + } } @Override public ItemInstance getActiveWeaponInstance() { return getInventory().getItemFrom(Paperdoll.RHAND); } @Override public Weapon getActiveWeaponItem() { final ItemInstance item = getActiveWeaponInstance(); return (item == null) ? getTemplate().getFists() : (Weapon) item.getItem(); } @Override public WeaponType getAttackType() { return getActiveWeaponItem().getItemType(); } @Override @@ -7969,36 +8015,54 @@ } var = _manufactureStoreList.get(); if (var != null) { String[] items = var.split(";"); for (String item : items) { if (item.equals("")) continue; String[] values = item.split(","); if (values.length < 2) continue; int recId = Integer.parseInt(values[0]); int price = Integer.parseInt(values[1]); _manufactureList.add(new ManufactureItem(recId, price)); } } } + public boolean isSellBuff() + { + return _sellbuff; + } + + public void setSellBuff(boolean j) + { + _sellbuff = j; + } + + public int getBuffPrize() + { + return _buffprize; + } + + public void setBuffPrize(int x) + { + _buffprize = x; + } /** * Added to other GMs, test also this {@link Player} instance. If GM, set it. */ @Override public List<Player> getSurroundingGMs() { final List<Player> gms = super.getSurroundingGMs(); if (isGM()) gms.add(this); return gms; } } \ No newline at end of file diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java index ccab125..b558d5b 100644 --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java @@ -1,39 +1,40 @@ package net.sf.l2j.gameserver.network.clientpackets; import java.text.DecimalFormat; import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.logging.Logger; import java.util.stream.Collectors; import net.sf.l2j.commons.data.Pagination; import net.sf.l2j.commons.lang.StringUtil; import net.sf.l2j.Config; import net.sf.l2j.gameserver.communitybbs.CommunityBoard; import net.sf.l2j.gameserver.data.DropCalc; +import net.sf.l2j.gameserver.data.SkillTable; import net.sf.l2j.gameserver.data.manager.BotsPreventionManager; import net.sf.l2j.gameserver.data.manager.HeroManager; import net.sf.l2j.gameserver.data.manager.SpawnManager; import net.sf.l2j.gameserver.data.xml.AdminData; import net.sf.l2j.gameserver.data.xml.ItemData; import net.sf.l2j.gameserver.enums.DropType; import net.sf.l2j.gameserver.enums.FloodProtector; import net.sf.l2j.gameserver.enums.actors.NpcSkillType; import net.sf.l2j.gameserver.enums.skills.ElementType; import net.sf.l2j.gameserver.enums.skills.SkillType; import net.sf.l2j.gameserver.handler.AdminCommandHandler; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; import net.sf.l2j.gameserver.handler.VoicedCommandHandler; import net.sf.l2j.gameserver.model.World; import net.sf.l2j.gameserver.model.WorldObject; import net.sf.l2j.gameserver.model.actor.Attackable; import net.sf.l2j.gameserver.model.actor.Npc; import net.sf.l2j.gameserver.model.actor.Player; import net.sf.l2j.gameserver.model.actor.container.attackable.AggroList; import net.sf.l2j.gameserver.model.actor.container.npc.AggroInfo; import net.sf.l2j.gameserver.model.actor.instance.GrandBoss; @@ -168,44 +169,102 @@ } else if (_command.startsWith("Quest ")) { if (!player.validateBypass(_command)) return; String[] str = _command.substring(6).trim().split(" ", 2); if (str.length == 1) player.getQuestList().processQuestEvent(str[0], ""); else player.getQuestList().processQuestEvent(str[0], str[1]); } else if (_command.startsWith("_match")) { String params = _command.substring(_command.indexOf("?") + 1); StringTokenizer st = new StringTokenizer(params, "&"); int heroclass = Integer.parseInt(st.nextToken().split("=")[1]); int heropage = Integer.parseInt(st.nextToken().split("=")[1]); int heroid = HeroManager.getInstance().getHeroByClass(heroclass); if (heroid > 0) HeroManager.getInstance().showHeroFights(player, heroclass, heroid, heropage); } + else if(_command.startsWith("buff")) + { + String x = _command.substring(4); + int id = Integer.parseInt(x); + Player target = null; + + if(player.getTarget() instanceof Player) + target = (Player) player.getTarget(); + + if(target == null) + { + return; + } + + if(player.getInventory().getItemByItemId(57).getCount() < ((Player) player.getTarget()).getBuffPrize()) + { + player.sendMessage("not enought adena"); + } + + try + { + L2Skill s = SkillTable.getInstance().getInfo(id, 2); + s.getEffects(player, player); + player.sendMessage("You buyed: "+s.getName()); + player.getInventory().destroyItemByItemId("", 57, target.getBuffPrize(), target, null); + target.getInventory().addItem("", 57, target.getBuffPrize(), target, null); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + else if(_command.startsWith("actr")) + { + String l = _command.substring(5); + + int p = 0; + + p = Integer.parseInt(l); + + + if(p == 0) + return; + + if(p > 2000000000) + { + player.sendMessage("Too big prize"); + return; + } + + player.setBuffPrize(p); + player.sitDown(); + player.setSellBuff(true); + player.getAppearance().setNameColor(0x1111); + player.setTitle("=SELL BUFFS="); + player.broadcastUserInfo(); + player.broadcastTitleInfo(); + } else if (_command.startsWith("_diary")) { String params = _command.substring(_command.indexOf("?") + 1); StringTokenizer st = new StringTokenizer(params, "&"); int heroclass = Integer.parseInt(st.nextToken().split("=")[1]); int heropage = Integer.parseInt(st.nextToken().split("=")[1]); int heroid = HeroManager.getInstance().getHeroByClass(heroclass); if (heroid > 0) HeroManager.getInstance().showHeroDiary(player, heroclass, heroid, heropage); } else if (_command.startsWith("arenachange")) // change { final boolean isManager = player.getCurrentFolk() instanceof OlympiadManagerNpc; if (!isManager) { // Without npc, command can be used only in observer mode on arena if (!player.isInObserverMode() || player.isInOlympiadMode() || player.getOlympiadGameId() < 0) return; } // Olympiad registration check. if (OlympiadManager.getInstance().isRegisteredInComp(player)) @@ -303,44 +362,53 @@ catch (Exception e) { showNpcInfoEffects(player, (Npc) wo, html, 1); } break; } } player.sendPacket(html); } } catch (Exception e) { LOGGER.error("bypass user_npc_info error", e); }
  3. adicionei este MOD, e no final deu esse erro, poderia me ajudar ?
  4. ALGUEM PODE COMPARTILHAR UM MOD PARA OS PERSONAGENS VENDER BUFFS, E ADICIONAR UMA MOEDA "COIN" PARA TRANSFORMAR O PERSONAGEM EM AIO ADAPTADO PARA L2JLISVUS ? DESDE JÁ, OBRIGADO.
  5. ALGUEM PODE ADAPTAR ESTE MOD DE VENDER BUFFS E ADICIONAR UMA MOEDA "COIN" P VIRAR AIOX NO L2JLISVUS ?
  6. Boa tarde ! estou tentando adicionar um mod no projeto lisvus C4, Rev 749, estou com esse problema, alguém poderia ajudar ?
  7. Alguem poderia compartilhar um RaidInfo C4 para l2jlisvus ?
  8. Alguem pode ajudar corrigir esse erro no raid info? Index:java/net/sf/l2j/Config.java public static final String TELNET_FILE = "./config/Telnet.properties"; +public static final String CUSTOM_NPCS_FILE = "./config/CustomMods/RaidInfo.properties"; public static int INVENTORY_MAXIMUM_PET; + public static int RAID_BOSS_INFO_PAGE_LIMIT; + public static int RAID_BOSS_DROP_PAGE_LIMIT; + public static String RAID_BOSS_DATE_FORMAT; + public static String RAID_BOSS_IDS; + public static List<Integer> LIST_RAID_BOSS_IDS; + Properties SpecialNpcs = new Properties(); + try (InputStream is = new FileInputStream(new File(CUSTOM_NPCS_FILE))) + { + SpecialNpcs.load(is); + } + catch (Exception e) + { + e.printStackTrace(); + throw new Error("Failed to Load " + CUSTOM_NPCS_FILE + " File."); + } + + RAID_BOSS_INFO_PAGE_LIMIT = Integer.parseInt(SpecialNpcs.getProperty("RaidBossInfoPageLimit", "15")); + RAID_BOSS_DROP_PAGE_LIMIT = Integer.parseInt(SpecialNpcs.getProperty("RaidBossDropPageLimit", "15")); + RAID_BOSS_DATE_FORMAT = SpecialNpcs.getProperty("RaidBossDateFormat", "MMM dd, HH:mm"); + RAID_BOSS_IDS = SpecialNpcs.getProperty("RaidBossIds", "0,0"); + LIST_RAID_BOSS_IDS = new ArrayList<>(); + for (String val : RAID_BOSS_IDS.split(",")) + { + int npcId = Integer.parseInt(val); + LIST_RAID_BOSS_IDS.add(npcId); + } // Τelnet Properties telnetSettings = new Properties(); try (InputStream is = new FileInputStream(new File(TELNET_FILE))) { telnetSettings.load(is); } catch (Exception e) { e.printStackTrace(); throw new Error("Failed to Load " + TELNET_FILE + " File."); } Index:java/net/sf/l2j/gameserver/GameServer.java +import net.sf.l2j.gameserver.instancemanager.RaidBossInfoManager; import net.sf.l2j.gameserver.instancemanager.RaidBossSpawnManager; BufferTable.getInstance(); +RaidBossInfoManager.getInstance(); Index:java/net/sf/l2j/gameserver/instancemanager/GrandBossManager.java +import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; public void setStatsSet(int bossId, StatsSet info) { _storedInfo.put(bossId, info); storeToDb(); + if (Config.LIST_RAID_BOSS_IDS.contains(bossId)) + { + RaidBossInfoManager.getInstance().updateRaidBossInfo(bossId, info.getLong("respawn_time")); + } } Index:java/net/sf/l2j/gameserver/instancemanager/RaidBossInfoManager.java +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <[Hidden Content];. + */ +package net.sf.l2j.gameserver.instancemanager; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Logger; + +import net.sf.l2j.Config; +import net.sf.l2j.L2DatabaseFactory; + +public class RaidBossInfoManager +{ + private static final Logger _log = Logger.getLogger(RaidBossInfoManager.class.getName()); + + private final Map<Integer, Long> _raidBosses; + + public static RaidBossInfoManager getInstance() + { + return SingletonHolder._instance; + } + + protected RaidBossInfoManager() + { + _raidBosses = new ConcurrentHashMap<>(); + load(); + } + + public void load() + { + try (Connection con = L2DatabaseFactory.getInstance().getConnection()) + { + PreparedStatement statement; + ResultSet rs; + + statement = con.prepareStatement("SELECT boss_id, respawn_time FROM grandboss_data UNION SELECT boss_id, respawn_time FROM raidboss_spawnlist ORDER BY boss_id"); + rs = statement.executeQuery(); + while (rs.next()) + { + int bossId = rs.getInt("boss_id"); + if (Config.LIST_RAID_BOSS_IDS.contains(bossId)) + _raidBosses.put(bossId, rs.getLong("respawn_time")); + } + rs.close(); + statement.close(); + } + catch (Exception e) + { + _log.warning("Exception: RaidBossInfoManager load: " + e); + } + + _log.info("RaidBossInfoManager: Loaded " + _raidBosses.size() + " instances."); + } + + public void updateRaidBossInfo(int bossId, long respawnTime) + { + _raidBosses.put(bossId, respawnTime); + } + + public long getRaidBossRespawnTime(int bossId) + { + return _raidBosses.get(bossId); + } + + private static class SingletonHolder + { + protected static final RaidBossInfoManager _instance = new RaidBossInfoManager(); + } +} Index:java/net/sf/l2j/gameserver/instancemanager/RaidBossSpawnManager.java if (_bosses.containsKey(bossId)) _bosses.remove(bossId); if (_schedules.containsKey(bossId)) { ScheduledFuture<?> f = _schedules.get(bossId); f.cancel(true); _schedules.remove(bossId); + if (Config.LIST_RAID_BOSS_IDS.contains(bossId)) + RaidBossInfoManager.getInstance().updateRaidBossInfo(bossId, 0); } if (_storedInfo.containsKey(bossId)) _storedInfo.remove(bossId); if (!_schedules.containsKey(boss.getNpcId())) { ScheduledFuture<?> futureSpawn; futureSpawn = ThreadPoolManager.getInstance().scheduleGeneral(new spawnSchedule(boss.getNpcId()), respawn_delay); _schedules.put(boss.getNpcId(), futureSpawn); // To update immediately Database uncomment on the following line, to post the hour of respawn raid boss on your site for example or to envisage a crash landing of the waiter. updateDb(); } + if (Config.LIST_RAID_BOSS_IDS.contains(boss.getNpcId())) + RaidBossInfoManager.getInstance().updateRaidBossInfo(boss.getNpcId(), respawnTime); } else { boss.setRaidStatus(StatusEnum.ALIVE); info.set("currentHP", boss.getCurrentHp()); info.set("currentMP", boss.getCurrentMp()); info.set("respawnTime", 0L); } _storedInfo.put(boss.getNpcId(), info); } public void addNewSpawn(L2Spawn spawnDat, long respawnTime, double currentHP, double currentMP, boolean storeInDb) Index:java/net/sf/l2j/gameserver/templates/L2NpcTemplate.java public void setRace(int newrace) { race = newrace; } +public String getName() + { + return name; + } +} Index:java/net/sf/l2j/gameserver/model/actor/instance/L2RaidBossInfoInstance.java +/* + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <[Hidden Content];. + */ +package net.sf.l2j.gameserver.model.actor.instance; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.concurrent.ConcurrentHashMap; + +import net.sf.l2j.Config; + +import net.sf.l2j.gameserver.datatables.ItemTable; +import net.sf.l2j.gameserver.datatables.NpcTable; +import net.sf.l2j.gameserver.instancemanager.RaidBossInfoManager; +import net.sf.l2j.gameserver.model.L2DropData; +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; +import net.sf.l2j.gameserver.templates.L2NpcTemplate; +import net.sf.l2j.util.Rnd; + +public class L2RaidBossInfoInstance extends L2NpcInstance +{ + private final Map<Integer, Integer> _lastPage = new ConcurrentHashMap<>(); + + private final String[][] _messages = + { + { + "<font color=\"LEVEL\">%player%</font>, are you not afraid?", + "Be careful <font color=\"LEVEL\">%player%</font>!" + }, + { + "Here is the drop list of <font color=\"LEVEL\">%boss%</font>!", + "Seems that <font color=\"LEVEL\">%boss%</font> has good drops." + }, + }; + + public L2RaidBossInfoInstance(int objectId, L2NpcTemplate template) + { + super(objectId, template); + } + + @Override + public void showChatWindow(L2PcInstance player, int val) + { + String name = "data/html/mods/raidbossinfo/" + getNpcId() + ".htm"; + if (val != 0) + name = "data/html/mods/raidbossinfo/" + getNpcId() + "-" + val + ".htm"; + + NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); + html.setFile(name); + html.replace("%objectId%", String.valueOf(getObjectId())); + player.sendPacket(html); + player.sendPacket(new ActionFailed()); + } + + @Override + public void onBypassFeedback(L2PcInstance player, String command) + { + StringTokenizer st = new StringTokenizer(command, " "); + String currentCommand = st.nextToken(); + + if (currentCommand.startsWith("RaidBossInfo")) + { + int pageId = Integer.parseInt(st.nextToken()); + _lastPage.put(player.getObjectId(), pageId); + showRaidBossInfo(player, pageId); + } + else if (currentCommand.startsWith("RaidBossDrop")) + { + int bossId = Integer.parseInt(st.nextToken()); + int pageId = st.hasMoreTokens() ? Integer.parseInt(st.nextToken()) : 1; + showRaidBossDrop(player, bossId, pageId); + } + + super.onBypassFeedback(player, command); + } + + private void showRaidBossInfo(L2PcInstance player, int pageId) + { + List<Integer> infos = new ArrayList<>(); + infos.addAll(Config.LIST_RAID_BOSS_IDS); + + final int limit = Config.RAID_BOSS_INFO_PAGE_LIMIT; + final int max = infos.size() / limit + (infos.size() % limit == 0 ? 0 : 1); + infos = infos.subList((pageId - 1) * limit, Math.min(pageId * limit, infos.size())); + + final StringBuilder sb = new StringBuilder(); + sb.append("<html>"); + sb.append("<center>"); + sb.append("<body>"); + sb.append("<table width=\"256\">"); + sb.append("<tr><td width=\"256\" align=\"center\">%name%</td></tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"256\">"); + sb.append("<tr><td width=\"256\" align=\"left\">" + _messages[0][Rnd.get(_messages.length)].replace("%player%", player.getName()) + "</td></tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"224\" bgcolor=\"000000\">"); + sb.append("<tr><td width=\"224\" align=\"center\">Raid Boss Infos</td></tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"256\">"); + + for (int bossId : infos) + { + final L2NpcTemplate template = NpcTable.getInstance().getTemplate(bossId); + if (template == null) + continue; + + String bossName = template.getName(); + + if (bossName.length() > 23) + bossName = bossName.substring(0, 23) + "..."; + + final long respawnTime = RaidBossInfoManager.getInstance().getRaidBossRespawnTime(bossId); + if (respawnTime <= System.currentTimeMillis()) + { + sb.append("<tr>"); + sb.append("<td width=\"146\" align=\"left\"><a action=\"bypass -h npc_%objectId%_RaidBossDrop " + bossId + "\">" + bossName + "</a></td>"); + sb.append("<td width=\"110\" align=\"right\"><font color=\"9CC300\">Alive</font></td>"); + sb.append("</tr>"); + } + else + { + sb.append("<tr>"); + sb.append("<td width=\"146\" align=\"left\"><a action=\"bypass -h npc_%objectId%_RaidBossDrop " + bossId + "\">" + bossName + "</a></td>"); + sb.append("<td width=\"110\" align=\"right\"><font color=\"FB5858\">Dead</font> " + new SimpleDateFormat(Config.RAID_BOSS_DATE_FORMAT).format(new Date(respawnTime)) + "</td>"); + sb.append("</tr>"); + } + } + + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"224\" cellspacing=\"2\">"); + sb.append("<tr>"); + + for (int x = 0; x < max; x++) + { + final int pageNr = x + 1; + if (pageId == pageNr) + sb.append("<td align=\"center\">" + pageNr + "</td>"); + else + sb.append("<td align=\"center\"><a action=\"bypass -h npc_%objectId%_RaidBossInfo " + pageNr + "\">" + pageNr + "</a></td>"); + } + + sb.append("</tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"160\" cellspacing=\"2\">"); + sb.append("<tr>"); + sb.append("<td width=\"160\" align=\"center\"><a action=\"bypass -h npc_%objectId%_Chat 0\">Return</a></td>"); + sb.append("</tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"256\">"); + sb.append("<tr><td width=\"256\" align=\"center\">Lineage II</td></tr>"); + sb.append("</table>"); + sb.append("</center>"); + sb.append("</body>"); + sb.append("</html>"); + + final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); + html.setHtml(sb.toString()); + html.replace("%name%", getName()); + html.replace("%objectId%", String.valueOf(getObjectId())); + player.sendPacket(html); + } + + private void showRaidBossDrop(L2PcInstance player, int bossId, int pageId) + { + final L2NpcTemplate template = NpcTable.getInstance().getTemplate(bossId); + if (template == null) + return; + + List<Integer> drops = new ArrayList<>(); + for (L2DropData drop : template.getAllDropData()) + drops.add(drop.getItemId()); + + final int limit = Config.RAID_BOSS_DROP_PAGE_LIMIT; + final int max = drops.size() / limit + (drops.size() % limit == 0 ? 0 : 1); + drops = drops.subList((pageId - 1) * limit, Math.min(pageId * limit, drops.size())); + + final StringBuilder sb = new StringBuilder(); + sb.append("<html>"); + sb.append("<center>"); + sb.append("<body>"); + sb.append("<table width=\"256\">"); + sb.append("<tr><td width=\"256\" align=\"center\">%name%</td></tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"256\">"); + sb.append("<tr><td width=\"256\" align=\"left\">" + _messages[1][Rnd.get(_messages.length)].replace("%boss%", template.getName()) + "</td></tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"224\" bgcolor=\"000000\">"); + sb.append("<tr><td width=\"224\" align=\"center\">Raid Boss Drops</td></tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"256\">"); + + for (int itemId : drops) + { + String itemName = ItemTable.getInstance().getTemplate(itemId).getName(); + if (itemName.length() > 47) + itemName = itemName.substring(0, 47) + "..."; + + sb.append("<tr><td width=\"256\" align=\"center\">" + itemName + "</td></tr>"); + } + + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"64\" cellspacing=\"2\">"); + sb.append("<tr>"); + + for (int x = 0; x < max; x++) + { + final int pageNr = x + 1; + if (pageId == pageNr) + sb.append("<td align=\"center\">" + pageNr + "</td>"); + else + sb.append("<td align=\"center\"><a action=\"bypass -h npc_%objectId%_RaidBossDrop " + bossId + " " + pageNr + "\">" + pageNr + "</a></td>"); + } + + sb.append("</tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"160\" cellspacing=\"2\">"); + sb.append("<tr>"); + sb.append("<td width=\"160\" align=\"center\"><a action=\"bypass -h npc_%objectId%_RaidBossInfo " + _lastPage.get(player.getObjectId()) + "\">Return</a></td>"); + sb.append("</tr>"); + sb.append("</table>"); + sb.append("<br>"); + sb.append("<table width=\"256\">"); + sb.append("<tr><td width=\"256\" align=\"center\">Lineage II</td></tr>"); + sb.append("</table>"); + sb.append("</center>"); + sb.append("</body>"); + sb.append("</html>"); + + final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); + html.setHtml(sb.toString()); + html.replace("%name%", getName()); + html.replace("%objectId%", String.valueOf(getObjectId())); + player.sendPacket(html); + } +} Index:\gameserver\config\CustomMods\RaidInfo.properties +#============================================================= +# RaidInfo C4 +#============================================================= +# Limit of displayed raid boss per page +# Default: 15 +RaidBossInfoPageLimit = 15 + +# Limit of displayed drop per page +# Default: 15 +RaidBossDropPageLimit = 15 + +# Displayed date format for dead raid boss +# Default: (MMM dd, HH:mm) +RaidBossDateFormat = (MMM dd, HH:mm) + +# Displayed raid boss +# Syntax: bossId,bossId, ... +RaidBossIds =12001,12052,12169,12211,12372,12374,12899 HTML NPC - LOCAL DA PASTA \gameserver\data\html\mods\raidbossinfo +<html> +<body> +<center> +<img src="l2ui.bbs_lineage2" width=78 height=13><br> +<td><img src="L2UI.SquareBlank" width=40 height=2></td> +<center><img src="L2UI.SquareGray" width=300 height=1></center> +<table bgcolor="000000" width=300> +<table> +<tr> +<td width=40><td width=40><img src=icon.skill4416_human width=32 height=32></td> +<td width=200> +<table> +<tr><td>Select your destination, I will make the</td></tr> +<tr><td>connection with the others <font color="FFFF00">All Raid Bosses!</font></td></tr><tr><td></td></tr> +</table> +</td> +</tr> +</table><br> +<button value="Clique to List" action="bypass -h npc_%objectId%_RaidBossInfo 1" width=135 height=22 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3" > +<br> +<img src="L2UI.SquareGray" width=300 height=1> +<table border=0 bgcolor=000000 width=300 height=1> +<img src="Sek.cbui371" width=276 height=1><br> +<center><a action="bypass -h npc_%objectId%_multisell 002"><font color="0066CC">Exchange with the Dimensional Diamond</font></a></center> +<img src="Sek.cbui371" width=300 height=1> +<table width=300 bgcolor="000000"> +<tr> +<tr><td><center>We <font color="FFFF00">Grand Bosses</font> use the Will of the Gods to open the</td></tr></center> +<tr><td><center>doors to time and space and Reneward Items.</td></tr></center> +<tr><td><center>Which door would you Life to Dead?</td></tr></center> +</table> +<img src="Sek.cbui371" width=300 height=1> +</body> +</html>
  9. Alguem teria um Raidinfo ou alguns outros mods adaptados para disponibilizar ?
×
×
  • Criar Novo...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.