Jump to content

Recommended Posts

Posted

Well, i just synchronized all the function so it will be executed all before we could delete any player.

 

It works fine, couldnt get any exceptions, or create extra task, so no problems with a lot of times trying 150 mils, 6000 players and removing random players one by one

 

If any expert of concurrence want to help, or just comment, it is welcome

 

Shouldn't it be a FastList ?

FastList will improve the speed of adding and removing (FastMap has synchronizatio implemented, but FastList doesnt), so with FastList it will be faster but eith the same behavor

 

well the code:

package test;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledFuture;

public class TakeBreakManager {

private final static long TIME_EACH_BREAK = 150; //2h by default

private static volatile List<Object> queue;

private static TakeBreakManager instance;

private static ScheduledFuture<?> task;

private WarnUserTakeBreak warn;


private TakeBreakManager(){
queue = new ArrayList<Object>();
warn = new WarnUserTakeBreak();
}

public static TakeBreakManager getInstance(){
if (instance == null)
	instance = new TakeBreakManager();
return instance;
}

public void addPlayer(L2PcInstance player){
synchronized(this){
	queue.add(System.currentTimeMillis());
	queue.add(player);
	if (task == null)
		start();
}
}

private void start(){

task = ThreadPoolManager.getInstance().scheduleGeneral(warn ,TIME_EACH_BREAK - (System.currentTimeMillis() - (Long)queue.remove(0)) );
}


public void removePlayer(L2PcInstance player){
if (player == queue.get(0)){
	synchronized(this){
	queue.remove(0);
	task.cancel(false);
	if (!queue.isEmpty())
		start();
	}
	return;
}
int index = 2;
while (index < queue.size()-1){
	if (queue.get(index) == player){
		synchronized(this){
		queue.remove(index);
		queue.remove(index-1);
		}
		return;
	}
	index = 2;
}
}

protected class WarnUserTakeBreak implements Runnable
{
@Override
public void run()
{
	synchronized(TakeBreakManager.this){
	L2PcInstance player;
	long time = 0;
	do{

//			synchronized(TakeBreakManager.this){
			if (queue.size() > 1){
					player = (L2PcInstance) queue.remove(0);
					time = (Long) queue.remove(0);
			}
			else if (queue.size() == 1)
					player = (L2PcInstance) queue.remove(0);
			else{
				task = null;
				return;
			}
//			}
		if (player.isOnline())
		{
			//SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.PLAYING_FOR_LONG_TIME);
			//player.sendPacket(msg);
//			System.out.println("time: " System.currentTimeMillis()  " player: " player);
			if (queue.isEmpty()){
//					synchronized(TakeBreakManager.this){
					queue.add(player);
//					}
				time = System.currentTimeMillis();
				break;
			}
			else
//					synchronized(TakeBreakManager.this){
					queue.add(System.currentTimeMillis());
					queue.add(player);
//					}
		}
	}
	while (System.currentTimeMillis() <= time);
	if (!queue.isEmpty())
		task = ThreadPoolManager.getInstance().scheduleGeneral(this , TIME_EACH_BREAK - (System.currentTimeMillis() - time) );
	else
		task = null;
	}
	}
}
}

Posted

Don't you melt L2FastList with FastList ? FastList/FastMap are part of javolution, until L2J reworked javolution JAR, which is possible, they should be synchro by default.

 

Or I missed a point.

 

.shared() ?

Posted

you are right, i just looked at the doc of fastlist, it implements FastCollection, that is thread-safe, anyway my problem was that when i remove player that is the next player to be warned:

 

- I need to remove him from the queue: no problem here

- cancel the programed task

- create new task for the next player to be warned

 

and the problem was that if i was warning that player in the moment that i wanted to remove him, the old task will create the new task for the next player and the remove will create another new task.

Posted

task.cancel(true) would interrupt it. Did you try it ?

i thought about it but, if i:

[playerA][timeB][playerB]...

-task remove playerA and next time (timeB), but didnt warned him yet

-now i try to remove the next player to be warned (playerB), so i cancel the task and interupt it

 

i dont warn player A, nor add it to the queue to be warned next time

Posted

true story

 

Tryskell 1 question. To contribute on the pack, we pay 1€ for the last rev and then 1€ for each commit?

 

The price is as following : 1 euro / rev, 9 euros minimum (for 9 revs) and no maximum
Posted

true story

 

Tryskell 1 question. To contribute on the pack, we pay 1€ for the last rev and then 1€ for each commit?

 

You can either :

  • wait for free rev (happens every 10 revs, will begin at rev 260 then at 270, 280...) : you will have sources but got all issues coming from old rev.
  • donate to get a range of revs (261-269 let's say), I accept as minimum a range of 9 revs, so only multiple of 9 : you get latest source and patch following what you bought, your forum account will be downgraded once period is down. No access to SVN.
  • share things as before, become a Inner Circle and get access to sources directly from SVN.

 

There are no precompiled pack anymore, ppl who want to take a look have to use old sources. You can make shares based on old sources and then become part of Inner Circle and get updates for free. As before, I ask some shares before you can enter, or a lot of bugs reports.

 

If you still didn't understand :

 

rev 260 - free

rev 261 to 269 - accessible by donors and inner circle members.

rev 270 - free

rev 271 to 279 - accessible by donors and inner circle members.

...etc, etc...

 

As donator, if you buy for 18€ when that service will be launched (rev 260), you get 18 rev +2 free = 280.

 

If you ask "why should I donate" :

  • it's first a mean to thank me for the work I make since dec 2010. I made 0€ until now.
  • it's a mean to pay codes you can eventually ninja for your own pack / server. I improved my skills and my codes are unique (to name some: Baium AI, Valakas AI with retail like cinematics, //bk command, corrected quests py -> java, and in future retail events and missing features such as retail castle doors HP upgrade && traps system).
  • relying on free revisions isn't enough if you want to launch a live server, as you will miss a lot of fixes, and won't have any help from me or my community to fix them. And as project got a forum, I will close any "fix that bug" thread on MxC forum if you use aCis. You use free revs knowing the fact you won't have any assistance.
  • that money would be reinvested in the project to pay ppl/features. Which mean contributing money would enhance features in future. I mostly think about an event engine, or simply pay ppl who make an amazing help in order they correct missing features.

Posted

Ty for the 40k views guys ^^.

 

Yep yep yep yep yep.

 

 

Changeset 258

 

Siege/castles rework, misc

 

Siege/castles rework

- Fix possible targets on siege summons skills (one siege summon can only aim L2PcInstance, others can only aim L2DoorInstance).

- Fix doors issue (doors not respawning at siege end). At siege end, they revive, fully HPregen and close if opened.

- Doors don't respawn if destroyed during a midVictory, but they will respawn at siege end.

- castle chamberlain instance is fully rewritten, HTMs names have been shortened and content is harmonized. Many privileges checks have been added.

- when a castle wall is destroyed, the correct message is displayed.

- skill cast on Artifacts is fixed (changing target before the end of "Seal Of Ruler" won't stop the skill)

- Addition of retail-like castle gate upgrade system via castle chamberlain.

- It uses 2 "cursors" to calculate the price :

- type of door (basic doors, additional doors or walls)

- power of the reinforcement (x2, x3 or x5 HPs).

- the cost of doors updates, as their pdef/mdef, are infuenced by Seal of Strife owner.

- the upgrade is instant, and is loaded/saved through server restarts aswell (as I need _doorUpdates being fed for the hp ratio check on chamberlain).

- all retails HTMs have been added, and checks are ok (not enough money in CWH, door already updated with a similar or better level, etc).

 

Misc

- GMs non-aggro state has been moved from //invul to //hide command. Ty Pleasure for the good idea.

- drop some GMs "privileges" which could lead to "false alarms" reports from users (like GMs not being ported when a siege begins).

- all variables are (and will be from now, no matter how sad Java-Man will be) initialized in the shorter possible scope. Fix an ugly issue where DoorTable was adding all left doors to latest castle _doors (so Schuttgart had 50+ gates). Castle gates aren't verified anymore for CH purposes.

- drop String.valueOf() on getNodeValue() - as the result is a String, it doesn't need further operation...

 

NOTE : TRAPS SYSTEM ISN'T MADE AT ALL. DON'T COMPLAIN ABOUT IT.

 

 

Posted
Changeset 259

 

Fishes rework (ty Java-man), misc (ty xblx for random fixes and sahar for reports)

 

Fishes rework

- handles differently load and get fish process (regroup data in 1 array instead of 3, avoid to create multiple arrays and new FishData objects)

- fix fishTable skills levels, ty 100500.

 

Misc

- if identical jewel is currently worn, then replace the other slot if different (explanation is messy, but just test ingame and gtfo).

- fix an exploit using clan warehouse when you left your clan (active warehouse could be clan, and wasn't cleaned).

- fix previous knownlists update (int cast was affecting only 1.5 value). It is rounded aswell.

- fix pets pickup, which are now affected by party distribution modes.

- fix Goblets NPC.

- fix double click on dead monsters (avoid to be stucked), cleanup those methods aswell. Drop of canTarget() method.

- onActionShift() use L2PcInstance rather than GameClient as parameter.

- add skillId on callSkill exception log for easier debug purposes.

- fix 2 issues on Valakas AI and 1 on Baium AI, related to skills priority and offline target. Rework Baium getRandomTarget() method to be faster.

- fix a ClassCastException on RequestRecipeShopManagePrev packet.

- fix a NullPointerException on RequestPledgeSetAcademyMaster packet.

- fix an NumberFormatException with CrestCache system ("Crest_Large_" were cutted as "Crest_", and so the id was containing "Large_".

- getCharactersInside() has been changed for a FastList instead of FastMap, as there is no interest to keep Map format. Use of _characterList rather than the getter.

- sendPacket() implementation for L2Summon, which refer directly to owner.

- L2GoldenRamInstance cleanup, the FastMap has been changed for an int[][]. Updates the related HTM.

Posted
Changeset 260

 

Skills rework (elemental, cancel, negate), misc

 

Skills rework

- implementation of following methods: ssUncharge(), spsUncharge(), isSoulshotCharged(), isSpiritshotCharged() && isBlessedSpiritshotCharged(). Move ss/bss checks out of targets loops.

- fix Cancel/Banes skillhandler :

- formula rework : addition of level diff, baseRate (80% for single target, 40% for aoe), and vuln is now applied on the good section of formula.

- toggles aren't counted anymore as possible effects to cancel.

- failed attempts are now counted (before effects were looped until 5 effects were dropped).

- all (L2Character[]) casts have been dropped in order to avoid ClassCastException using skills.

- cleanup BalanceLife skillhandler ; store valid targets in another list rather than using old list and make twice same checks (...).

- CombatPointHeal doesn't heal dead targets anymore.

- addition of suicide stuff on PDAM skillhandler (potential use for antharas minions).

- NEGATE L2SkillType (part of Disabler skillhandler) is heavily cleaned, and not affected anymore by calcSkillSuccess().

- fix "SKILLS" elemental vuln/pro (revert to IL, was using postIL formula).

- addition of "WEAPONS" elemental system (fix skills such as Holy Blade toggle, Holy weapon PP buff). Vuln/pro affect damages TOO !

 

Misc

- cleanup && addition of missing PaganKeys, ty sahar. No clue if it's retail-like, they're added here for the moment.

- NPCs social animations are divided by 2.

- L2Npc : drop of _isBusy / _busyMessage and associated getters/setters + drop of the HTM.

- fix issue from previous commit about hpRatio impacting earned XP/SP (I HATE DOUBLE).

 


 

With that changeset finally comes the opening of freemium system.

[*]All informations regarding the system can be already found on forum.

[*]Any PM, either on that forum or on aCis forum concerning such infos will be ignored. If my explanations don't cover your questions, I will answer you and add an addendum on the Announcements section aswell.

[*]You have 1 rev (3-4 next days) to order your subscription , after that time you have to wait the next 10th step to be able to subscribe.

[*]Latest free revision (actual rev - 10) will be shared on aCis forum (and only the latest). You probably could find it on others websites, but I invite you to download it directly from aCis forum in order to avoid viruses, addition of malware code, etc.

[*]The complete system will take some times to put in shape.

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...