Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.sf.l2j.gameserver.enums;
- public enum ZoneType
- {
- TOWN,
- CASTLE
- }
- package net.sf.l2j.gameserver.model.holder;
- import net.sf.l2j.commons.data.StatSet;
- import net.sf.l2j.gameserver.enums.ZoneType;
- public class GreetingHolder
- {
- private final int _castleId;
- private final ZoneType _zoneType;
- private final int _actionUse;
- private final String _mgs;
- private final int _time;
- public GreetingHolder(StatSet set)
- {
- _castleId = set.getInteger("castleId");
- _zoneType = Enum.valueOf(ZoneType.class, set.getString("zone"));
- _actionUse = set.getInteger("actionId", 7);
- _mgs = set.getString("msg", "");
- _time = set.getInteger("time", 30);
- }
- public int getCastleId()
- {
- return _castleId;
- }
- public ZoneType getZoneType()
- {
- return _zoneType;
- }
- public int getActionUse()
- {
- return _actionUse;
- }
- public String getMessage()
- {
- return _mgs;
- }
- public int getTime()
- {
- return _time;
- }
- }
- package net.sf.l2j.gameserver.data.xml;
- import java.nio.file.Path;
- import java.util.HashMap;
- import java.util.Map;
- import net.sf.l2j.commons.data.StatSet;
- import net.sf.l2j.commons.data.xml.IXmlReader;
- import net.sf.l2j.gameserver.model.holder.GreetingHolder;
- import net.sf.l2j.gameserver.taskmanager.GreetingManager;
- import org.w3c.dom.Document;
- public class GreetingData implements IXmlReader
- {
- private final Map<Integer, GreetingHolder> _greetings = new HashMap<>();
- public GreetingData()
- {
- load();
- }
- @Override
- public void load()
- {
- parseFile("./data/xml/greeting.xml");
- LOGGER.info(getClass().getSimpleName() + ": Loaded " + _greetings.size() + " greetings.");
- GreetingManager.start();
- }
- @Override
- public void parseDocument(Document doc, Path path)
- {
- forEach(doc, "list", listNode -> {
- forEach(listNode, "greeting", greetNode -> {
- StatSet set = new StatSet(parseAttributes(greetNode));
- GreetingHolder holder = new GreetingHolder(set);
- _greetings.put(holder.getCastleId(), holder);
- });
- });
- }
- public GreetingHolder getGreeting(int castleId)
- {
- return _greetings.get(castleId);
- }
- public static GreetingData getInstance()
- {
- return SingletonHolder._instance;
- }
- private static class SingletonHolder
- {
- protected static final GreetingData _instance = new GreetingData();
- }
- }
- GameServer.java
- StringUtil.printSection("Greeting Data");
- GreetingData.getInstance();
- StringUtil.printSection("Handlers");
- LOGGER.info("Loaded {} admin command handlers.", AdminCommandHandler.getInstance().size());
- data/xml
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Configuração do sistema de Saudação Real (Reverência ao Líder de Castelo)
- Este sistema ativa uma mecânica visual e de respeito dentro das vilas, similar ao Lineage II Classic Kamael.
- Quando o líder do clã que possui um castelo estiver presente na vila correspondente, jogadores próximos
- automaticamente fazem uma reverência (social ID definido) e recebem uma mensagem de saudação na tela.
- A saudação só ocorre novamente após o tempo configurado no atributo "time".
- /////////////////////////////////////////////
- TAGS DISPONÍVEIS:
- - <greeting> : Define uma configuração de saudação para um castelo específico.
- ////////////////////////////////////////////
- ATRIBUTOS DE <greeting>:
- • castleId (int)
- - ID do castelo.
- - Use os IDs conforme definidos no seu servidor (Ex: 1 = Gludio, 2 = Dion, etc).
- • zone (string)
- - Tipo da zona onde a saudação pode ocorrer.
- - Use: "TOWN" para dentro da vila. (Outros tipos podem ser adicionados futuramente.)
- • actionId (int)
- - ID da animação social usada.
- - Ex: 7 = /socialbow (reverência). Consulte SocialAction.java para outros IDs.
- • msg (string)
- - Mensagem exibida ao jogador no centro da tela (e também via chat).
- - Ex: "Salve o Rei de Aden!"
- • time (int)
- - Intervalo mínimo de tempo (em segundos) entre cada saudação por castelo.
- - Ex: 60 = saudação pode ocorrer a cada 60 segundos (1 minuto).
- -->
- <list>
- <greeting castleId="1" zone="TOWN" actionId="7" msg="Salve o Rei de Gludio!" time="60" />
- <greeting castleId="2" zone="TOWN" actionId="7" msg="Honrem o Senhor de Dion!" time="60" />
- </list>
Advertisement
Add Comment
Please, Sign In to add comment