Jump to content

eMommy

Members
  • Posts

    97
  • Credits

  • Joined

  • Last visited

  • Days Won

    8
  • Feedback

    0%

Everything posted by eMommy

  1. you can do it with like a html window too instead of the packet
  2. its in ui9 but it doesnt actually work because i dont think the new clients support this
  3. https://valhalla-essence.org/en/index.html more players than official
  4. i did it through ugx but it's missing support from dll or maybe the new clients dont support this in general o__o
  5. package l2s.gameserver.model.entity; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import l2s.commons.util.Rnd; import l2s.gameserver.data.xml.holder.CouponHolder; import l2s.gameserver.database.DatabaseFactory; import l2s.gameserver.model.Player; import l2s.gameserver.network.l2.s2c.SocialActionPacket; import l2s.gameserver.templates.item.data.ItemData; import l2s.gameserver.utils.ItemFunctions; public class CouponManager { private static final Logger LOG = LoggerFactory.getLogger(CouponManager.class); private static final CouponManager INSTANCE = new CouponManager(); private static final String DEFAULT_OWNER = "NO_OWNER"; private static final Map<String, String> COUPONS = new HashMap<>(); public static CouponManager getInstance() { return INSTANCE; } public void load() { try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT * FROM coupons")) { try (ResultSet rset = statement.executeQuery()) { while (rset.next()) COUPONS.put(rset.getString("coupon_id").replace("-", "").toUpperCase(), rset.getString("coupon_owner")); } } catch (SQLException e) { LOG.error("Coupon issues: ", e); } finally { LOG.info("Coupons: loaded size: " + COUPONS.size()); } } public synchronized final boolean tryUseCoupon(Player player, String id) { final String owner = COUPONS.get(id.toUpperCase()); if (owner == null) { player.sendMessage("Invalid coupon code."); return false; } if (!owner.equals(DEFAULT_OWNER)) { player.sendMessage("This coupon code has expired or was already used."); return false; } final String acc = player.getAccountName().toLowerCase(); final Collection<String> accounts = COUPONS.values(); for (String account : accounts) { if (account.equals(acc)) { player.sendMessage("You may only claim 1 coupon per account."); return false; } } COUPONS.put(id, player.getAccountName()); try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE coupons SET coupon_owner = ? WHERE coupon_id like ?")) { statement.setString(1, acc); statement.setString(2, id); statement.execute(); } catch (SQLException e) { LOG.warn("Coupons: update failure: " + e); return false; } player.sendGfxMessage("Coupon accepted! Enjoy!"); player.broadcastPacket(new SocialActionPacket(player.getObjectId(), SocialActionPacket.BOASTING)); for (ItemData it : CouponHolder.getInstance().getRewards()) { if (it.getMinEnchant() <= 0) ItemFunctions.addItem(player, it.getId(), it.getCount(), true, "Coupon Reward"); else ItemFunctions.addItem(player, it.getId(), it.getCount(), Rnd.get(it.getMinEnchant(), it.getMaxEnchant()), true, "Coupon Reward"); } return true; } } package l2s.gameserver.data.xml.parser; import java.io.File; import org.dom4j.Element; import l2s.commons.data.xml.AbstractParser; import l2s.gameserver.Config; import l2s.gameserver.ConfigSelector; import l2s.gameserver.data.xml.holder.CouponHolder; import l2s.gameserver.model.entity.CouponManager; import l2s.gameserver.templates.item.data.ItemData; public final class CouponParser extends AbstractParser<CouponHolder> { private static final CouponParser INSTANCE = new CouponParser(); protected CouponParser() { super(CouponHolder.getInstance()); } public static CouponParser getInstance() { return INSTANCE; } public void reload() { info("reload start..."); getHolder().clear(); load(); } @Override protected void onParsed() { CouponManager.getInstance().load(); } @Override public File getXMLPath() { return new File(Config.DATAPACK_ROOT, ConfigSelector.getDataFolder() + "/Coupons.xml"); } @Override public String getDTDFileName() { return "Coupons.dtd"; } @Override protected void readData(Element rootElement) { for (Element listSet : rootElement.elements("config")) getHolder().setLength(parseInt(listSet, "code_length")); for (Element listSet : rootElement.elements("rewards")) { for (Element paramsSet : listSet.elements("item")) { final String p = paramsSet.toString(); if (p.contains("minEnchant") && !p.contains("maxEnchant")) getHolder().addItem(new ItemData(parseInt(paramsSet, "id"), parseInt(paramsSet, "count"), parseInt(paramsSet, "minEnchant"))); else if (p.contains("minEnchant") && p.contains("maxEnchant")) getHolder().addItem(new ItemData(parseInt(paramsSet, "id"), parseInt(paramsSet, "count"), parseInt(paramsSet, "minEnchant", 0), parseInt(paramsSet, "maxEnchant"))); else getHolder().addItem(new ItemData(parseInt(paramsSet, "id"), parseInt(paramsSet, "count"))); } } } } package l2s.gameserver.data.xml.holder; import java.util.ArrayList; import java.util.List; import l2s.commons.data.xml.AbstractHolder; import l2s.gameserver.templates.item.data.ItemData; public final class CouponHolder extends AbstractHolder { private static final CouponHolder INSTANCE = new CouponHolder(); private static int COUPON_LENGTH; private static final List<ItemData> REWARDS = new ArrayList<>(); public static CouponHolder getInstance() { return INSTANCE; } public void addItem(ItemData item) { REWARDS.add(item); } public final List<ItemData> getRewards(){ return REWARDS; } public void setLength(int i) { COUPON_LENGTH = i; } public final int getLength() { return COUPON_LENGTH; } @Override public int size() { return REWARDS.size(); } @Override public void clear() { REWARDS.clear(); } } Load on Gameserver or Parsers CouponParser.getInstance().load(); Reload Parser (like with //reload) CouponParser.getInstance().reload(); Coupons.dtd (for xml) <!ELEMENT list (config|rewards)*> <!ELEMENT config (config)*> <!ATTLIST config code_length CDATA #REQUIRED> <!ELEMENT rewards (item)*> <!ELEMENT item (#PCDATA)> <!ATTLIST item id CDATA #REQUIRED count CDATA #REQUIRED minEnchant CDATA #IMPLIED maxEnchant CDATA #IMPLIED> Coupons.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE list SYSTEM "Coupons.dtd"> <!-- minEnchant for min enchant value, maxEnchant for max enchant value --> <list> <config code_length="20"/> <rewards> <item id="3031" count="2000" /> <!--2000 Spirit Ore --> <item id="90907" count="500" /> <!--500 Soulshot Ticket --> <item id="91641" count="100" /> <!--100 Sayha's Blessing --> <item id="91767" count="2" /> <!--2 x Enchant Kit: Talisman of Aden --> <item id="91864" count="2" /> <!--2 x Dragon Belt Pack --> <item id="91912" count="5000" /> <!--5000 Hp Potion (Exchangeable) --> <item id="92387" count="1" /> <!--+4 Black Ore Set --> <item id="93499" count="1" /> <!--Enchanted B-grade Weapon Coupon --> <item id="93500" count="5" /> <!--5 x Enchanted B-Grade Armor Coupon --> <item id="94269" count="50" /> <!--50 x Scroll: Boost Attack --> <item id="94271" count="50" /> <!--50 x Scroll: Boost Defense --> </rewards> </list> ItemData (if you dont have it) package l2s.gameserver.templates.item.data; /** * @author Bonux */ public class ItemData { private final int _id; private final long _count; private final int _minEnchant; private int _maxEnchant; private long _price; public ItemData(int id, long count) { _id = id; _count = count; _minEnchant = -1; _maxEnchant = 0; _price = 0; } public ItemData(int id, long count, int enchant) { _id = id; _count = count; _minEnchant = enchant; _maxEnchant = enchant; _price = 0; } public ItemData(int id, long count, int enchant, int enchantMax) { _id = id; _count = count; _minEnchant = enchant; _maxEnchant = enchantMax; _price = 0; } public ItemData(int id, long count, int enchant, int enchantMax, long price) { _id = id; _count = count; _minEnchant = enchant; _maxEnchant = enchantMax; _price = price; } public ItemData(int id, long count, long price) { _id = id; _count = count; _minEnchant = 0; _maxEnchant = 0; _price = price; } public int getId() { return _id; } public long getCount() { return _count; } public int getMinEnchant() { return _minEnchant; } public int getMaxEnchant() { return _maxEnchant; } public long getPrice() { return _price; } } ClientPacket (RequestPCCafeCouponUse) package l2s.gameserver.network.l2.c2s; import l2s.gameserver.data.xml.holder.CouponHolder; import l2s.gameserver.model.Player; import l2s.gameserver.model.entity.CouponManager; /** * format: chS */ public class RequestPCCafeCouponUse extends L2GameClientPacket { // format: (ch)S private String _code; @Override protected boolean readImpl() { _code = readS(); return true; } @Override protected void runImpl() { final Player activeChar = getClient().getActiveChar(); if (activeChar == null) return; if (_code == null || _code.length() != CouponHolder.getInstance().getLength()) { activeChar.sendGfxMessage("Your code cannot be empty or less than " + CouponHolder.getInstance().getLength() + " letters/digits"); activeChar.sendActionFailed(); return; } if (CouponManager.getInstance().tryUseCoupon(activeChar, _code)) activeChar.sendGfxMessage("Your coupon was activated, thank you for playing!"); } } ServerPacket (ShowPCCafeCouponShowUI) package l2s.gameserver.network.l2.s2c; import l2s.gameserver.network.l2.ServerPacketOpcodes; /** * Даный пакет показывает менюшку для ввода серийника. Можно что-то придумать :) * Format: (ch) */ public class ShowPCCafeCouponShowUI extends L2GameServerPacket { public static final ShowPCCafeCouponShowUI STATIC = new ShowPCCafeCouponShowUI(); @Override protected final void writeImpl() { writeOpcode(ServerPacketOpcodes.ShowPCCafeCouponShowUI); // } } Open Coupon Window (from bypass) player.sendPacket(ShowPCCafeCouponShowUI.STATIC); This system is old and no longer useful (at least for me), maybe someone else can make use of it Done on l2scripts and tested with protocol 311 (should work starting from h5 but i'm not sure) SQL: https://pastebin.com/FTYqSAWx Generator: https://www.voucherify.io/generator Character Set: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
  6. final Map<String, Integer> map = new HashMap<>(); final String[] input = "Cardinal-1000;Arcana Lord-1300".split(";"); for (String s : input) { final String[] split2 = s.split("-"); map.put(split2[0], Integer.parseInt(split2[1])); } // to test for (Entry<String, Integer> ent : map.entrySet()) { Announcements.announceToAll("k " + ent.getKey()); Announcements.announceToAll("v " + ent.getValue()); } // to use int val = activeChar.getMAtkSpd(); if (map.containsKey(activeChar.getClassId().getName())) val = Math.min(map.getOrDefault(activeChar.getClassId().getName(), activeChar.getMAtkSpd()), activeChar.getMAtkSpd()); this?
  7. double rate = Config.RATE_XP_BY_LVL[getLevel()] * (isInParty() ? _party.getRateExp(this) : 1.) * ((getStat().calc(Stats.EXP_RATE_MULTIPLIER, 1) + (getPremiumAccount().getRates().getExp() - 1.)));
  8. package l2s.gameserver.baylee; import java.awt.Color; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import l2s.gameserver.geometry.Location; import l2s.gameserver.model.Player; import l2s.gameserver.network.l2.s2c.ExServerPrimitivePacket; /** * @author Belly <3 * @date July 7, 2022 */ public class ZoneBuilder { private static final Map<Player, LinkedList<Location>> map = new HashMap<>(); private static final ZoneBuilder instance = new ZoneBuilder(); public static ZoneBuilder getInstance() { return instance; } public void addPoint(Player player, Location loc) { LinkedList<Location> locs = map.get(player); if (locs == null) { locs = new LinkedList<>(); map.put(player, locs); } locs.add(loc); } public LinkedList<Location> getLocations(Player player) { return map.get(player); } public void clearZone(Player player) { map.remove(player); } public void buildZone(Player player) { try { final String fileName = player.getName() + "-" + System.currentTimeMillis() / 1000; final File spawnFile = new File(fileName + ".txt"); final BufferedWriter writer = new BufferedWriter(new FileWriter(spawnFile)); String out = ""; final LinkedList<Location> locs = map.get(player); if (locs != null && !locs.isEmpty()) { out += "\t<zone name=\"[" + player.getName() + "_Zone" + System.currentTimeMillis() / 36_000 + "]\" type=\"dummy\">\n"; out += "\t\t<polygon>\n"; for (Location loc : locs) out += "\t\t\t<coords loc=\"" + loc.getX() + " " + loc.getY() + " " + (loc.getZ() - 1000) + " " + (loc.getZ() + 1000) + "\"/>\n"; out += "\t\t</polygon>\n"; out += "\t</zone>"; } writer.write(out); writer.close(); player.unsetVar("@admin_drawzone"); player.sendGfxMessage("Zone saved under " + fileName + ".txt"); clearZone(player); final ExServerPrimitivePacket packet = new ExServerPrimitivePacket("ZoneBuilder", player.getX(), player.getY(), 65535 + player.getZ()); packet.addPoint(Color.GREEN, 0, 0, Short.MIN_VALUE); player.sendPacket(packet); } catch (Exception e) { e.printStackTrace(); } } } c2s -> MoveBackwardToLocation /** Belly - new draw zone by click **/ if (activeChar.isGM() && activeChar.getVarBoolean("@admin_drawzone", false)) { ZoneBuilder.getInstance().addPoint(activeChar, _targetLoc); final LinkedList<Location> locs = ZoneBuilder.getInstance().getLocations(activeChar); if (locs.size() > 1) { final ExServerPrimitivePacket packet = new ExServerPrimitivePacket("ZoneBuilder", locs.get(0).getX(), locs.get(0).getY(), 65535 + locs.get(0).getZ()); for (int i = 1; i < locs.size(); i++) { packet.addPoint("" + i, Color.RED, true, locs.get(i).getX(), locs.get(i).getY(), locs.get(i).getZ()); packet.addLine(Color.GREEN, locs.get(i - 1).getX(), locs.get(i - 1).getY(), locs.get(i - 1).getZ(), locs.get(i).getX(), locs.get(i).getY(), locs.get(i).getZ()); } activeChar.sendPacket(packet); } activeChar.sendGfxMessage("Point saved " + _targetLoc); activeChar.sendActionFailed(); return; } AdminCommandHandler case admin_drawzone: { if (!activeChar.getVarBoolean("@admin_drawzone", false)) { activeChar.setVar("@admin_drawzone", true); activeChar.sendGfxMessage("Draw zone active -> click on point to record"); activeChar.sendGfxMessage("//drawzone to unset and save"); } else { activeChar.ask(new ConfirmDlgPacket(SystemMsg.S1, 0).addString("Save zone and export to text file?"), new OnAnswerListener() { @Override public void sayYes() { ZoneBuilder.getInstance().buildZone(activeChar); } @Override public void sayNo() { ZoneBuilder.getInstance().clearZone(activeChar); activeChar.sendGfxMessage("Zone drawing cleared."); } }); } break; } simple tool to draw zones faster if it works it works..
  9. you can use l2clientdat (like on l2jmobius) but most servers have ip hardcoded from their anticheat
  10. im guessing its a sysString id
  11. tooltip uc -> AddTooltipColorText("ID: "$Item.ID.ClassID$"", getColor(178,190,207,255), true, false); above ReturnTooltipInfo(m_Tooltip); in function ReturnTooltip_NTT_ITEM(string param, string TooltipType, ETooltipSourceType eSourceType)
  12. Not true. New versions are full of new and unknown content and arguably Essence/Live/Legacy are not even the same game as Interlude or High Five. Official has no database or wiki other than l2central. I also notice that there is an influx of new and returning players who are willing to play the game again because of Essence
  13. Hello, my server name is "L2Classic" , and "I want you to redesign my server". Server Web: "www.L2Classic.eu"
  14. https://ivory-tower.de/
  15. depending on your pack there should already be a config for random mob movement or to disable individually via "noRandomWalk" param in the npc xml
  16. @Override protected void writeImpl() { writeOpcode(ServerPacketOpcodes.ExWorldChatCnt); writeD(_count); } writeD(_count); -> you have (x) messages left on mine the packet is sent on EnterWorld (ex. activeChar.sendPacket(new ExWorldChatCnt(activeChar))) and when daily variables are reset at 6:30 immobile as in they dont run at all? or like no random walking
  17. everything about your post? what client? what did you want to do? what protocol? sysstring is for static messages. If you are talking about player name (the one above your head) it is in uipacket in server. if you are talking about names added to messages (ex. CharName has obtained ItemName like 911reg's post then it would be in systemmsg with $s1 $s2 variables which you can control on server).
  18. ?_?
  19. ExWorldChatCnt (0xFE:0x175)
  20. did armor glows ever work in the first place? which protocol are you using? You can modify armor glow manually in uipacket(userInfo) if (containsMask(UserInfoType.ENCHANTLEVEL)) { writeH(UserInfoType.ENCHANTLEVEL.getBlockLength()); writeC(_weaponEnchant); writeC(_armorSetEnchant); }
  21. FullArmorEnchantEffectData controls the color and depending on your editor the item must have full_armor_enchant_effect_type=1
×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock