Jump to content

PartyZone For Lucera


Recommended Posts

Make a zone required party with minimum members for lucera.

 


package zones;

import java.util.Collection;
import java.util.Iterator;
import l2.gameserver.instancemanager.ReflectionManager;
import l2.gameserver.listener.zone.OnZoneEnterLeaveListener;
import l2.gameserver.model.Creature;
import l2.gameserver.model.Party;
import l2.gameserver.model.Player;
import l2.gameserver.model.Zone;
import l2.gameserver.network.l2.components.CustomMessage;
import l2.gameserver.network.l2.s2c.ExShowScreenMessage;
import l2.gameserver.scripts.ScriptFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PartyZone implements OnZoneEnterLeaveListener, ScriptFile {
	private static final Logger bEb = LoggerFactory.getLogger(PartyZone.class);
	private static final PartyZone bHe = new PartyZone();
	private static final String bHf = "PartyZone";
	private Object PartyInfo;

	public PartyZone() {
	}

	public void onLoad() {
		byte var1 = 0;
		Collection var2 = ReflectionManager.DEFAULT.getZones();
		Iterator var3 = var2.iterator();

		while(var3.hasNext()) {
			Zone var4 = (Zone)var3.next();
			if (var4.getParams().getBool("PartyZone", false)) {
				var4.addListener(bHe);
			}
		}

		if (var1 > 0) {
			bEb.info("PartyZone: added {} party zone(s).", Integer.valueOf(var1));
		}

	}

	public void onReload() {
		this.onShutdown();
		this.onLoad();
	}

	public void onShutdown() {
		Collection var1 = ReflectionManager.DEFAULT.getZones();
		Iterator var2 = var1.iterator();

		while(var2.hasNext()) {
			Zone var3 = (Zone)var2.next();
			if (var3.getParams().getBool("PartyZone", false)) {
				var3.removeListener(bHe);
			}
		}

	}

	public void onZoneEnter(Zone var1, Creature var2) {
		if (var2.isPlayer()) {
			Player var3 = var2.getPlayer();
			Party var4 = var3.getParty();
			if (var4 == null) {
				String var10 = (new CustomMessage("zone.services.PartyZone", var3, new Object[0])).toString();
				var3.sendPacket(new ExShowScreenMessage(var10, 10000, ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER, false));
				var3.teleToClosestTown();
			}

			if (var3.getParty().getMemberCount() <= 4) {
				String var10 = (new CustomMessage("zone.services.PartyZone", var3, new Object[0])).toString();
				var3.sendPacket(new ExShowScreenMessage(var10, 10000, ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER, false));
				var3.teleToClosestTown();
			}
		}

	}

	public void onZoneLeave(Zone var1, Creature var2) {
	}
}

 

Next you have to add this parameter in zone:         <set name="PartyZone" val="true" />

 

For example:

 

    <zone name="[primeval_peace1]" type="fun" >
            <coords loc="10408 -27395 -4290 -1290" />
            <coords loc="12065 -25334 -4290 -1290" />
            <coords loc="12223 -23159 -4290 -1290" />
            <coords loc="10424 -22340 -4290 -1290" />
            <coords loc="9566 -23131 -4290 -1290" />
            <coords loc="9290 -24261 -4290 -1290" />
        </polygon>
    </zone>

 

Make it like this:

 

    <zone name="[primeval_peace1]" type="fun" >

    <set name="PartyZone" val="true" />
            <coords loc="10408 -27395 -4290 -1290" />
            <coords loc="12065 -25334 -4290 -1290" />
            <coords loc="12223 -23159 -4290 -1290" />
            <coords loc="10424 -22340 -4290 -1290" />
            <coords loc="9566 -23131 -4290 -1290" />
            <coords loc="9290 -24261 -4290 -1290" />
        </polygon>
    </zone>

 

Then go to en string gameserver\data\string and add this line:

zone.services.PartyZone=You Are Not Currently In A Party With Minimum 5 Party Members So You Cannot Enter.

And this line to ru string gameserver\data\string:

zone.services.PartyZone=Вы не находитесь в партии с минимум 5 членами партии Так что вы не можете войти.

If you want to change the value of minimum players then you have to change the number 4 in this line in ext:

if (var3.getParty().getMemberCount() <= 4) {

 

DOWNLOAD EXT

 

This is a simple code i make it for my needs you can remake it as you want don't spam this topic.

Edited by • Punisher •
  • Thanks 2
Link to comment
Share on other sites

I don't think deleting my reply is by any means the right thing to do here. I am not spamming, I am expressing my opinion and helping/warning admins that might want to use a party zone in their own server.

Your code works, I am just saying how to improve it, I did not force you to do it but someone might want my opinion.

 

Reposted:

 

 

Variable naming is terrible.

byte var1 = 0;

This will always be 0,

 

since you don't check if the players leave the party while within the zone, a simple check in the teleporter would be enough. This whole code can be replaced by 1 line of code.

 

In addition to that, the method onZoneEnter, can be made like so:

 

    public void onZoneEnter(Zone zone, Creature creature)
    {
        if (creature.isPlayer() && (creature.getPlayer().getParty() == null || creature.getParty().getMembers().size() < 5))
        {
            creature.getPlayer().sendMessage("You are not in a party that consists of 5 or more members, you cannot enter the party zone.");
            creature.getPlayer().teleToClosestTown();
        }
    }

 

 

Generally, the idea to teleport players back, the moment they teleport in the zone is very very bad and will result in a laggy, long teleport or even some critical errors.

Edited by An4rchy
Link to comment
Share on other sites

First of all your code is not working and as i say in description i make it for my needs if you can make it better you can reshare it this maybe helps more than to judge my code when you dont give any solution here, a simple teleport is not better since you can walk into the zone!

Edited by • Punisher •
Link to comment
Share on other sites

Why would someone walk all the way to the Party zone? :D

 

But even if he did, a party zone that needs 3 people to enter should have difficult to kill mobs, therefore someone going there solo (by walking) would achieve nothing for him other than wasting his time.

 

Anyway, I just pointed out how to improve your code, perhaps you should implement my improvements in your other codes too. The logic ‘if it works, it’s ok’ is not quite right and you should consider all possibilities when you code something.

Edited by An4rchy
Link to comment
Share on other sites

16 hours ago, An4rchy said:

I don't think deleting my reply by any means the right thing to do here. I am not spamming, I am expressing my opinion and helping/warning admins that might want to use a party zone in their own server.

Your code works, I am just saying how to improve it, I did not force you to do it but someone might want my opinion.

 

Reposted:

Variable naming is terrible,.


byte var1 = 0;

This will always be 0,

 

You really point out var name to an amateur person who have no idea what java is? We are in 2020 and sharing 10 lines of code which is against rules while deleting other's comment or chat ban them if the post does not contain "Thanks ! Very useful code". 

 

So again don't bother.

Link to comment
Share on other sites

10 minutes ago, Elfocrash said:

Tbh the code looks like it's been decompiled, there is no way he wrote this. Not because he is bad but because there is no way a human being actually writes code like this.

 

  • The static final field names look obfuscated
  • The Object PartyInfo makes it seem like there was a class named PartyInfo that he didn't have access to
  • This collection var and iterator is what the IL code will be converted to in a stream().foreach if I'm not wrong
  • var1, var2, var3, var4 are decompiling names
  • The empty public constructor 

Lucera doesnt give you source the only you can do is to create extensions with intelij or the IDEA program you are using in my subject (im not professional java coder) i just take some examples and i make it thats all nothing special ! 

Edited by Dragic
Link to comment
Share on other sites

4 minutes ago, Elfocrash said:

I know it doesn't give you source but it doesn't force you to name the fields or write the implementations in some special way. I've written code for Lucera's plugin engine before and they look like normal code with some listeners

I would say the same thing if I were you but we are not all on the same level :laughing:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt  
    • Server Rates: » Xp 500x. » Sp 500x. » Aden 500x. » Drop 1x. » PartyXp 2x. » PartySp 2x. » Starting character level -61. Enchant rates: » Safe enchant +4. » Blessed and simple scrolls max enchant (+16). » Crystal scrolls max enchant (+20). » Simple enchant scrolls chance – 65%. » Blessed enchant scrolls chance – 100%. » Crystal enchant scrolls chance – 50% Augmentations: » Mid life stone skill chance – 5%. » High life stone skill chance – 10%. » Top life stone skill chance – 20%. » Augments 1+1 Unique features: » Main town – Giran » Automatic-Manual Potions. » Working 2 castle sieges. (Giran-Aden) » SPS cancel lasts 10 seconds and than buffs come back. » Stackable scrolls, lifestones, book of giants. » Unique pvp zone » More then 11 active raid bosses. » Wedding system. » Unique farming areas. » Npc skill enchanter. » Full npc buffer with auto buff. » Max count of buffs – 55. » Max subclasses – 4. » Free and no quest class change. » Free and no quest sub class. » Raid boss drop nobless item. » No weight limit. » Unique protection anti-hwy armor for archers/daggers etc. » Ingame password change. » Top pvp/pk/online ranks NPC. » Unique monsters & NPC. » Interlude retail skills. » Server up-time [24/7] [99]%. » Perfect class balance (all class can kill all class depending on players skill and setup knowledge,gear,augmentations). » Announcements on double kills triple kills etc. » Announcements on Grand Boss death , with the name of the killer as well as clan name of the player. » Information Npc in game with all servers infromations. Custom server gear : 1). Titanium Armor Lv.1 2). Epic Armor Lv.2 3). Epic Weapons-Kamikaze-Black S grade (Same Stats) 4). Demonic-Angelic Wings-Baium Hair-Custom Accessories (SameStats) 5). Custom Fighter/Mage tattoo Lv1-Lv2-Lv3 6). Shirt (STR,CON,INT +1) 7). Custom Shields Server Commands: .tvtjoin .tvtleave – Join or leave tvt event. .ctfjoin .ctfleave – Join or leave ctf event. .dmjoin .dmleave – Join of leave dm event. .online – current online players count. .repair – repairs stuck character in world. .menu – opens online menu panel. .exit – PVP zone exit in case you are bullied. .changepassword - Opens online menu then u can change ur password in game. .farm - Enable/disable autofarm Event system: » TVT event » CTF event » DM event » Tournament Event » Party Zone » Unique event shop. Olympiad game: » Retail olympiad game. » Competition period [1] week. » Olympiad start time [18:00] end [00:00] GMT+2. » New Heroes every Sunday.
    • Tomorrow grand opening lests go 🙂 
    • New season of Warfire X150 has been postponed to September 28th.
  • Topics

×
×
  • Create New...