L2JMobius

C6 Removing custom Events

Mobius · 7 · 2519

Online Mobius

  • Distinguished King
  • *****
    • Posts: 16135
We inherited some custom events from L2jFrozen.
TVT, CTF, DM, TW, VIP...

In my opinion, if someone should have these custom events,
that should be made with datapack scripts and not be so much hardcoded in core.

Same goes for L2jServer TvT for HighFive.

So I think to remove all those events to cleanup code.
Again, if someone wants these, he should figure a more datapack oriented way to add them.
Their removal is most likely to happen.


Offline nasseka

  • Distinguished King
  • *****
    • Posts: 1729
    • L2Unknown

Online Mobius

  • Distinguished King
  • *****
    • Posts: 16135
We already have TvT i think as datapack

On Interlude and HighFive they are hardcoded on server core.


Online Reanimation

  • Knight
  • ***
    • Posts: 62
We already have TvT i think as datapack

On Interlude and HighFive they are hardcoded on server core.

this is the best way, adding them and using them through scripts causes more errors


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16135
On Interlude and HighFive they are hardcoded on server core.

this is the best way, adding them and using them through scripts causes more errors

What you say is incorrect.
FYI the datapack TvT is better than any hardcoded event.
Datapack scripts are more than enough to make anything.

If the following code, copy pasted in main classes like Creature and PlayerInstance seems fine to you, I have no words... ::)
Code: [Select]
if ((TvT.isStarted() && _inEventTvT && targetPlayer._inEventTvT) || (DM.hasStarted() && _inEventDM && targetPlayer._inEventDM) || (CTF.isStarted() && _inEventCTF && targetPlayer._inEventCTF) || (VIP._started && _inEventVIP && targetPlayer._inEventVIP))
There should be only two booleans stated in PlayerInstance.
If player has registered for an event, or if player is in an active event, with whatever checks is needed for them.
The above code is junk. There is no debate to it.

Variables needed for events should be saved in the events themselves.
The following junk is stored in PlayerInstance, with various methods checking for them.
Code: [Select]
public boolean _isVIP = false;
public boolean _inEventVIP = false;
public boolean _isNotVIP = false;
public boolean _isTheVIP = false;
public int _originalNameColourVIP;
public int _originalKarmaVIP;
public int eventX;
public int eventY;
public int eventZ;
public int eventKarma;
public int eventPvpKills;
public int eventPkKills;
public String eventTitle;
public List<String> kills = new LinkedList<>();
public boolean eventSitForced = false;
public boolean atEvent = false;
public String _teamNameTvT;
public String _originalTitleTvT;
public int _originalNameColorTvT = 0;
public int _countTvTkills;
public int _countTvTdies;
public int _originalKarmaTvT;
public boolean _inEventTvT = false;
public String _teamNameCTF;
public String _teamNameHaveFlagCTF;
public String _originalTitleCTF;
public int _originalNameColorCTF = 0;
public int _originalKarmaCTF;
public int _countCTFflags;
public boolean _inEventCTF = false;
public boolean _haveFlagCTF = false;
public Future<?> _posCheckerCTF = null;
public String _originalTitleDM;
public int _originalNameColorDM = 0;
public int _countDMkills;
public int _originalKarmaDM;
public boolean _inEventDM = false;
public int _originalNameColor;
public int _countKills;
public int _originalKarma;
public int _eventKills;
public boolean _inEvent = false;
private int quakeSystem = 0;


Offline Trance

  • Elder
  • ****
    • Posts: 126
Custom Auto-Events were coded inside the core because they didn't have events/listeners back then.


Offline nasseka

  • Distinguished King
  • *****
    • Posts: 1729
    • L2Unknown