Jump to content

Recommended Posts

Posted

Coded: L2j clean interlude project

 

I decided to share with you my faction system(i created from 0), I had planned to open a server but it never happens because of my work.

 

In the Faction.java class it got in some actions-checks that you can do(setpoints in teams,tele the teams,sethero the teams,remove hero from the teams,clear the points,get the points size,check points and reward the teams,setTeamsColors anyway you will see the code :P)

 

it got random places to avoid stuck characters(the most shity think in factions when the chars tp all together in a place and get stucked!)

 

now about the checks: i didn't add any check i think this is easy part you can add it by your self. what i mean? for example teams can't hit teams can't trade etc.

 

here is the code: http://pastebin.com/ahf9wb04

 

i forgot to add the method  updateNameTitleColor()  you can delete it and add this Faction.setTeamsColors(this);  and change the public  void setTeamsColors(L2PcInstance a) to public static void setTeamsColors(L2PcInstance a) sorry for that i forgot it :P 

second: add this in L2World.java 	
        private final Map<Integer, L2PcInstance> _allPlayers;
+private final Map<Integer, L2PcInstance> _allEvils;
+private final Map<Integer, L2PcInstance> _allGoods;

private L2World()
{
	_allPlayers = new FastMap<Integer, L2PcInstance>().shared();
	+_allEvils = new FastMap<Integer, L2PcInstance>().shared();
	+_allGoods = new FastMap<Integer, L2PcInstance>().shared();

and now add the methods 
/**
 * @return a collection containing all evils in game.
 */
public Map<Integer, L2PcInstance> getAllEvils()
{
	return _allEvils;
}

/**
 * @return a collection containing all goods in game.
 */
public Map<Integer, L2PcInstance> getAllGoods()
{
	return _allGoods;
}

/**
 * Return how many players are online.<BR>
 * <BR>
 * @return number of online players.
 */
public int getAllEvilsCount()
{
	return _allEvils.size();
}

/**
 * Return how many players are online.<BR>
 * <BR>
 * @return number of online players.
 */
public int getAllGoodsCount()
{
	return _allGoods.size();
}
and now go to public void addVisibleObject find this: _allPlayers.put(player.getObjectId(), player); and make it:
if(player.isEvil())
				_allEvils.put(player.getObjectId(), player);
			else if(player.isGood())
				_allGoods.put(player.getObjectId(), player);
			else
				_allPlayers.put(player.getObjectId(), player);

 

Credits Me(Mr.Anonymous)

Posted

Coded: L2j clean interlude project

 

I decided to share with you my faction system(i created from 0), I had planned to open a server but it never happens because of my work.

 

In the Faction.java class it got in some actions-checks that you can do(setpoints in teams,tele the teams,sethero the teams,remove hero from the teams,clear the points,get the points size,check points and reward the teams,setTeamsColors anyway you will see the code :P)

 

it got random places to avoid stuck characters(the most shity think in factions when the chars tp all together in a place and get stucked!)

 

now about the checks: i didn't add any check i think this is easy part you can add it by your self. what i mean? for example teams can't hit teams can't trade etc.

 

here is the code: http://pastebin.com/ahf9wb04

 

i forgot to add the method  updateNameTitleColor()  you can delete it and add this Faction.setTeamsColors(this);  and change the public  void setTeamsColors(L2PcInstance a) to public static void setTeamsColors(L2PcInstance a) sorry for that i forgot it :P 

second: add this in L2World.java 	
        private final Map<Integer, L2PcInstance> _allPlayers;
+private final Map<Integer, L2PcInstance> _allEvils;
+private final Map<Integer, L2PcInstance> _allGoods;

private L2World()
{
	_allPlayers = new FastMap<Integer, L2PcInstance>().shared();
	+_allEvils = new FastMap<Integer, L2PcInstance>().shared();
	+_allGoods = new FastMap<Integer, L2PcInstance>().shared();

and now add the methods 
/**
 * @return a collection containing all evils in game.
 */
public Map<Integer, L2PcInstance> getAllEvils()
{
	return _allEvils;
}

/**
 * @return a collection containing all goods in game.
 */
public Map<Integer, L2PcInstance> getAllGoods()
{
	return _allGoods;
}

/**
 * Return how many players are online.<BR>
 * <BR>
 * @return number of online players.
 */
public int getAllEvilsCount()
{
	return _allEvils.size();
}

/**
 * Return how many players are online.<BR>
 * <BR>
 * @return number of online players.
 */
public int getAllGoodsCount()
{
	return _allGoods.size();
}
and now go to public void addVisibleObject find this: _allPlayers.put(player.getObjectId(), player); and make it:
if(player.isEvil())
				_allEvils.put(player.getObjectId(), player);
			else if(player.isGood())
				_allGoods.put(player.getObjectId(), player);
			else
				_allPlayers.put(player.getObjectId(), player);

 

Credits Me(Mr.Anonymous)

Posted

2-3 files only? Haha, go check other systems.

lol,so? :s

 

One engine/code can be done through many different ways.

 

(didn't checked this one,but the fact that got 2-3 files as you say it doesn't make it bugged or not working code and such)

Posted

2-3 files only? Haha, go check other systems.

lol,so? :s

 

One engine/code can be done through many different ways.

 

(didn't checked this one,but the fact that got 2-3 files as you say it doesn't make it bugged or not working code and such)

Posted

Are you sure that is what u posted complete?

I see some methods without calling them. Like checkHit(L2Character attacker, L2Character target)

Edit: reading your post... it should be done by every who takes your patch? :p sorry I'm blind

Posted

Are you sure that is what u posted complete?

I see some methods without calling them. Like checkHit(L2Character attacker, L2Character target)

Edit: reading your post... it should be done by every who takes your patch? :p sorry I'm blind

Posted

Are you sure that is what u posted complete?

I see some methods without calling them. Like checkHit(L2Character attacker, L2Character target)

yep as i said: now about the checks: i didn't add any check i think this is easy part you can add it by your self. what i mean? for example teams can't hit teams can't trade etc.

 

 

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.

×
×
  • Create New...