Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
L2j Server Datapack
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
L2j
L2j Server Datapack
Commits
79111cd4
Commit
79111cd4
authored
7 years ago
by
Zoey76
Browse files
Options
Downloads
Patches
Plain Diff
Unstuck command update
parent
d3dd2606
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java
+55
-67
55 additions, 67 deletions
...me/data/scripts/handlers/usercommandhandlers/Unstuck.java
with
55 additions
and
67 deletions
dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java
+
55
−
67
View file @
79111cd4
/*
* Copyright (C) 2004-201
6
L2J DataPack
* Copyright (C) 2004-201
7
L2J DataPack
*
* This file is part of L2J DataPack.
*
...
...
@@ -18,27 +18,40 @@
*/
package
handlers.usercommandhandlers
;
import
static
com
.
l2jserver
.
gameserver
.
GameTimeController
.
MILLIS_IN_TICK
;
import
static
com
.
l2jserver
.
gameserver
.
ai
.
CtrlIntention
.
AI_INTENTION_IDLE
;
import
static
com
.
l2jserver
.
gameserver
.
model
.
TeleportWhereType
.
TOWN
;
import
static
com
.
l2jserver
.
gameserver
.
network
.
SystemMessageId
.
THIS_SKILL_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT
;
import
static
com
.
l2jserver
.
gameserver
.
network
.
serverpackets
.
ActionFailed
.
STATIC_PACKET
;
import
static
java
.
util
.
concurrent
.
TimeUnit
.
MINUTES
;
import
static
java
.
util
.
concurrent
.
TimeUnit
.
SECONDS
;
import
com.l2jserver.Config
;
import
com.l2jserver.gameserver.GameTimeController
;
import
com.l2jserver.gameserver.ThreadPoolManager
;
import
com.l2jserver.gameserver.ai.CtrlIntention
;
import
com.l2jserver.gameserver.datatables.SkillData
;
import
com.l2jserver.gameserver.handler.IUserCommandHandler
;
import
com.l2jserver.gameserver.model.TeleportWhereType
;
import
com.l2jserver.gameserver.model.actor.instance.L2PcInstance
;
import
com.l2jserver.gameserver.model.entity.TvTEvent
;
import
com.l2jserver.gameserver.model.skills.Skill
;
import
com.l2jserver.gameserver.network.SystemMessageId
;
import
com.l2jserver.gameserver.network.serverpackets.ActionFailed
;
import
com.l2jserver.gameserver.model.holders.SkillHolder
;
import
com.l2jserver.gameserver.network.serverpackets.MagicSkillUse
;
import
com.l2jserver.gameserver.network.serverpackets.SetupGauge
;
import
com.l2jserver.gameserver.util.Broadcast
;
/**
* Unstuck user command.
* @author Zoey76
* @since 2.6.0.0
*/
public
class
Unstuck
implements
IUserCommandHandler
{
private
static
final
long
FIVE_MINUTES
=
MINUTES
.
toSeconds
(
5
);
private
static
final
SkillHolder
ESCAPE_5_MINUTES
=
new
SkillHolder
(
2099
);
private
static
final
SkillHolder
ESCAPE_1_SECOND
=
new
SkillHolder
(
2100
);
private
static
final
int
RETURN
=
1050
;
private
static
final
int
[]
COMMAND_IDS
=
{
52
...
...
@@ -47,100 +60,75 @@ public class Unstuck implements IUserCommandHandler
@Override
public
boolean
useUserCommand
(
int
id
,
L2PcInstance
activeChar
)
{
// Thanks nbd
if
(!
TvTEvent
.
onEscapeUse
(
activeChar
.
getObjectId
()))
{
activeChar
.
sendPacket
(
ActionFailed
.
STATIC_PACKET
);
activeChar
.
sendPacket
(
STATIC_PACKET
);
return
false
;
}
else
if
(
activeChar
.
isJailed
())
if
(
activeChar
.
isJailed
())
{
activeChar
.
sendMessage
(
"You cannot use
this function
while you are jail
ed
."
);
activeChar
.
sendMessage
(
"You cannot use
unstuck
while you are
in
jail."
);
return
false
;
}
int
unstuckTimer
=
(
activeChar
.
getAccessLevel
().
isGm
()
?
1000
:
Config
.
UNSTUCK_INTERVAL
*
1000
);
if
(
activeChar
.
isInOlympiadMode
())
{
activeChar
.
sendPacket
(
SystemMessageId
.
THIS_SKILL_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT
);
activeChar
.
sendPacket
(
THIS_SKILL_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT
);
return
false
;
}
if
(
activeChar
.
isCastingNow
()
||
activeChar
.
isMovementDisabled
()
||
activeChar
.
isMuted
()
||
activeChar
.
isAlikeDead
()
||
activeChar
.
inObserverMode
()
||
activeChar
.
isCombatFlagEquipped
())
if
(
activeChar
.
isCastingNow
()
||
activeChar
.
isMovementDisabled
()
||
activeChar
.
isMuted
()
||
//
activeChar
.
isAlikeDead
()
||
activeChar
.
inObserverMode
()
||
activeChar
.
isCombatFlagEquipped
())
{
return
false
;
}
activeChar
.
forceIsCasting
(
GameTimeController
.
getInstance
().
getGameTicks
()
+
(
unstuckTimer
/
GameTimeController
.
MILLIS_IN_TICK
));
final
int
unstuckTimer
=
(
activeChar
.
isGM
()
?
1000
:
Config
.
UNSTUCK_INTERVAL
*
1000
);
activeChar
.
forceIsCasting
(
GameTimeController
.
getInstance
().
getGameTicks
()
+
(
unstuckTimer
/
MILLIS_IN_TICK
));
Skill
escape
=
SkillData
.
getInstance
().
getSkill
(
2099
,
1
);
// 5 minutes escape
Skill
GM_escape
=
SkillData
.
getInstance
().
getSkill
(
2100
,
1
);
// 1 second escape
if
(
activeChar
.
getAccessLevel
().
isGm
())
if
(
activeChar
.
isGM
())
{
if
(
GM_escape
!=
null
)
{
activeChar
.
doCast
(
GM_escape
);
return
true
;
}
activeChar
.
sendMessage
(
"You use Escape: 1 second."
);
activeChar
.
doCast
(
ESCAPE_1_SECOND
);
return
true
;
}
else
if
((
Config
.
UNSTUCK_INTERVAL
==
300
)
&&
(
escape
!=
null
))
if
(
Config
.
UNSTUCK_INTERVAL
==
FIVE_MINUTES
)
{
activeChar
.
doCast
(
escape
);
activeChar
.
doCast
(
ESCAPE_5_MINUTES
);
return
true
;
}
if
(
Config
.
UNSTUCK_INTERVAL
>
100
)
{
activeChar
.
sendMessage
(
"You use Escape: "
+
SECONDS
.
toMinutes
(
Config
.
UNSTUCK_INTERVAL
)
+
" minutes."
);
}
else
{
if
(
Config
.
UNSTUCK_INTERVAL
>
100
)
{
activeChar
.
sendMessage
(
"You use Escape: "
+
(
unstuckTimer
/
60000
)
+
" minutes."
);
}
else
{
activeChar
.
sendMessage
(
"You use Escape: "
+
(
unstuckTimer
/
1000
)
+
" seconds."
);
}
activeChar
.
sendMessage
(
"You use Escape: "
+
Config
.
UNSTUCK_INTERVAL
+
" seconds."
);
}
activeChar
.
getAI
().
setIntention
(
CtrlIntention
.
AI_INTENTION_IDLE
);
activeChar
.
getAI
().
setIntention
(
AI_INTENTION_IDLE
);
// SoE Animation section
activeChar
.
setTarget
(
activeChar
);
activeChar
.
disableAllSkills
();
MagicSkillUse
msk
=
new
MagicSkillUse
(
activeChar
,
1050
,
1
,
unstuckTimer
,
0
);
Broadcast
.
toSelfAndKnownPlayersInRadius
(
activeChar
,
msk
,
900
);
SetupGauge
sg
=
new
SetupGauge
(
0
,
unstuckTimer
);
activeChar
.
sendPacket
(
sg
);
Broadcast
.
toSelfAndKnownPlayersInRadius
(
activeChar
,
new
MagicSkillUse
(
activeChar
,
RETURN
,
1
,
unstuckTimer
,
0
),
900
);
activeChar
.
sendPacket
(
new
SetupGauge
(
0
,
unstuckTimer
));
// End SoE Animation section
// continue execution later
activeChar
.
setSkillCast
(
ThreadPoolManager
.
getInstance
().
scheduleGeneral
(
new
EscapeFinalizer
(
activeChar
),
unstuckTimer
));
return
true
;
}
private
static
class
EscapeFinalizer
implements
Runnable
{
private
final
L2PcInstance
_activeChar
;
protected
EscapeFinalizer
(
L2PcInstance
activeChar
)
// Continue execution later
activeChar
.
setSkillCast
(
ThreadPoolManager
.
getInstance
().
scheduleGeneral
(()
->
{
_activeChar
=
activeChar
;
}
@Override
public
void
run
()
{
if
(
_activeChar
.
isDead
())
if
(!
activeChar
.
isDead
())
{
return
;
activeChar
.
setIsIn7sDungeon
(
false
);
activeChar
.
enableAllSkills
();
activeChar
.
setIsCastingNow
(
false
);
activeChar
.
setInstanceId
(
0
);
activeChar
.
teleToLocation
(
TOWN
);
}
_activeChar
.
setIsIn7sDungeon
(
false
);
_activeChar
.
enableAllSkills
();
_activeChar
.
setIsCastingNow
(
false
);
_activeChar
.
setInstanceId
(
0
);
_activeChar
.
teleToLocation
(
TeleportWhereType
.
TOWN
);
}
},
unstuckTimer
));
return
true
;
}
@Override
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment