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
fb085c86
Commit
fb085c86
authored
13 years ago
by
Rumen Nikiforov
Browse files
Options
Downloads
Patches
Plain Diff
BETA: AdminSiege handler typo fix and source format
parent
1f54dcc0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminSiege.java
+52
-54
52 additions, 54 deletions
...ata/scripts/handlers/admincommandhandlers/AdminSiege.java
with
52 additions
and
54 deletions
L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminSiege.java
+
52
−
54
View file @
fb085c86
...
...
@@ -35,12 +35,8 @@ import com.l2jserver.gameserver.network.SystemMessageId;
import
com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage
;
import
com.l2jserver.util.StringUtil
;
/**
* This class handles all siege commands:
* Todo: change the class name, and neaten it up
*
*
* This class handles all siege commands: Todo: change the class name, and neaten it up
*/
public
class
AdminSiege
implements
IAdminCommandHandler
{
...
...
@@ -76,20 +72,27 @@ public class AdminSiege implements IAdminCommandHandler
// Get castle
Castle
castle
=
null
;
ClanHall
clanhall
=
null
;
if
(
st
.
hasMoreTokens
())
{
if
(
command
.
startsWith
(
"admin_clanhall"
))
{
if
(
st
.
hasMoreTokens
())
{
if
(
command
.
startsWith
(
"admin_clanhall"
))
{
try
{
clanhall
=
ClanHallManager
.
getInstance
().
getClanHallById
(
Integer
.
parseInt
(
st
.
nextToken
()));
}
catch
(
Exception
e
)
{}
catch
(
Exception
e
)
{
// Who cares?
}
}
else
castle
=
CastleManager
.
getInstance
().
getCastle
(
st
.
nextToken
());
}
if
((
castle
==
null
||
castle
.
getCastleId
()
<
0
)
&&
clanhall
==
null
)
{
// No castle specified
showCastleSelectPage
(
activeChar
);
}
else
{
String
val
=
""
;
...
...
@@ -98,8 +101,8 @@ public class AdminSiege implements IAdminCommandHandler
L2Object
target
=
activeChar
.
getTarget
();
L2PcInstance
player
=
null
;
if
(
target
instanceof
L2PcInstance
)
player
=
(
L2PcInstance
)
target
;
if
(
target
.
isPlayer
()
)
player
=
target
.
getActingPlayer
()
;
if
(
command
.
equalsIgnoreCase
(
"admin_add_attacker"
))
{
...
...
@@ -163,7 +166,9 @@ public class AdminSiege implements IAdminCommandHandler
{
if
(
st
.
hasMoreTokens
())
{
Calendar
newAdminSiegeDate
=
castle
.
getSiegeDate
();
Calendar
newAdminSiegeDate
=
Calendar
.
getInstance
();
newAdminSiegeDate
.
setTimeInMillis
(
castle
.
getSiegeDate
().
getTimeInMillis
());
if
(
val
.
equalsIgnoreCase
(
"day"
))
newAdminSiegeDate
.
set
(
Calendar
.
DAY_OF_YEAR
,
Integer
.
parseInt
(
st
.
nextToken
()));
else
if
(
val
.
equalsIgnoreCase
(
"hour"
))
...
...
@@ -179,9 +184,10 @@ public class AdminSiege implements IAdminCommandHandler
{
castle
.
getSiegeDate
().
setTimeInMillis
(
newAdminSiegeDate
.
getTimeInMillis
());
castle
.
getSiege
().
saveSiegeDate
();
activeChar
.
sendMessage
(
"Castle siege time for castle "
+
castle
.
getName
()
+
" has been changed."
);
}
}
showSiegeTimePage
(
activeChar
,
castle
);
showSiegeTimePage
(
activeChar
,
castle
);
return
true
;
}
else
if
(
command
.
equalsIgnoreCase
(
"admin_clanhallset"
))
...
...
@@ -192,13 +198,13 @@ public class AdminSiege implements IAdminCommandHandler
activeChar
.
sendMessage
(
"This ClanHall isn't free!"
);
else
if
(
player
.
getClan
().
getHasHideout
()
==
0
)
{
if
(!
clanhall
.
isSiegableHall
())
if
(!
clanhall
.
isSiegableHall
())
{
ClanHallManager
.
getInstance
().
setOwner
(
clanhall
.
getId
(),
player
.
getClan
());
if
(
AuctionManager
.
getInstance
().
getAuction
(
clanhall
.
getId
())
!=
null
)
AuctionManager
.
getInstance
().
getAuction
(
clanhall
.
getId
()).
deleteAuctionFromDB
();
}
else
if
(
player
.
getClan
()
!=
null
)
else
if
(
player
.
getClan
()
!=
null
)
{
clanhall
.
setOwner
(
player
.
getClan
());
player
.
getClan
().
setHasHideout
(
clanhall
.
getId
());
...
...
@@ -210,7 +216,7 @@ public class AdminSiege implements IAdminCommandHandler
else
if
(
command
.
equalsIgnoreCase
(
"admin_clanhalldel"
))
{
int
oldOwner
=
0
;
if
(!
clanhall
.
isSiegableHall
())
if
(!
clanhall
.
isSiegableHall
())
{
if
(!
ClanHallManager
.
getInstance
().
isFree
(
clanhall
.
getId
()))
{
...
...
@@ -220,11 +226,11 @@ public class AdminSiege implements IAdminCommandHandler
else
activeChar
.
sendMessage
(
"This ClanHall is already Free!"
);
}
else
if
((
oldOwner
=
clanhall
.
getOwnerId
())
>
0
)
else
if
((
oldOwner
=
clanhall
.
getOwnerId
())
>
0
)
{
clanhall
.
free
();
L2Clan
clan
=
ClanTable
.
getInstance
().
getClan
(
oldOwner
);
if
(
clan
!=
null
)
if
(
clan
!=
null
)
{
clan
.
setHasHideout
(
0
);
clan
.
broadcastClanStatus
();
...
...
@@ -255,10 +261,10 @@ public class AdminSiege implements IAdminCommandHandler
}
if
(
clanhall
!=
null
)
{
if
(!
clanhall
.
isSiegableHall
())
if
(!
clanhall
.
isSiegableHall
())
showClanHallPage
(
activeChar
,
clanhall
);
else
showSiegableHallPage
(
activeChar
,
(
SiegableHall
)
clanhall
);
showSiegableHallPage
(
activeChar
,
(
SiegableHall
)
clanhall
);
}
else
showSiegePage
(
activeChar
,
castle
.
getName
());
...
...
@@ -272,18 +278,16 @@ public class AdminSiege implements IAdminCommandHandler
NpcHtmlMessage
adminReply
=
new
NpcHtmlMessage
(
5
);
adminReply
.
setFile
(
activeChar
.
getHtmlPrefix
(),
"data/html/admin/castles.htm"
);
final
StringBuilder
cList
=
new
StringBuilder
(
500
);
for
(
Castle
castle
:
CastleManager
.
getInstance
().
getCastles
())
{
if
(
castle
!=
null
)
{
for
(
Castle
castle
:
CastleManager
.
getInstance
().
getCastles
())
{
if
(
castle
!=
null
)
{
String
name
=
castle
.
getName
();
StringUtil
.
append
(
cList
,
"<td fixwidth=90><a action=\"bypass -h admin_siege "
,
name
,
"\">"
,
name
,
"</a></td>"
);
StringUtil
.
append
(
cList
,
"<td fixwidth=90><a action=\"bypass -h admin_siege "
,
name
,
"\">"
,
name
,
"</a></td>"
);
i
++;
}
if
(
i
>
2
)
{
if
(
i
>
2
)
{
cList
.
append
(
"</tr><tr>"
);
i
=
0
;
}
...
...
@@ -291,16 +295,14 @@ public class AdminSiege implements IAdminCommandHandler
adminReply
.
replace
(
"%castles%"
,
cList
.
toString
());
cList
.
setLength
(
0
);
i
=
0
;
for
(
SiegableHall
hall
:
CHSiegeManager
.
getInstance
().
getConquerableHalls
().
values
())
for
(
SiegableHall
hall
:
CHSiegeManager
.
getInstance
().
getConquerableHalls
().
values
())
{
if
(
hall
!=
null
)
if
(
hall
!=
null
)
{
StringUtil
.
append
(
cList
,
"<td fixwidth=90><a action=\"bypass -h admin_chsiege_siegablehall "
,
String
.
valueOf
(
hall
.
getId
()),
"\">"
,
hall
.
getName
(),
"</a></td>"
);
StringUtil
.
append
(
cList
,
"<td fixwidth=90><a action=\"bypass -h admin_chsiege_siegablehall "
,
String
.
valueOf
(
hall
.
getId
()),
"\">"
,
hall
.
getName
(),
"</a></td>"
);
i
++;
}
if
(
i
>
1
)
if
(
i
>
1
)
{
cList
.
append
(
"</tr><tr>"
);
i
=
0
;
...
...
@@ -309,17 +311,15 @@ public class AdminSiege implements IAdminCommandHandler
adminReply
.
replace
(
"%siegableHalls%"
,
cList
.
toString
());
cList
.
setLength
(
0
);
i
=
0
;
for
(
ClanHall
clanhall
:
ClanHallManager
.
getInstance
().
getClanHalls
().
values
())
{
if
(
clanhall
!=
null
)
{
StringUtil
.
append
(
cList
,
"<td fixwidth=134><a action=\"bypass -h admin_clanhall "
,
String
.
valueOf
(
clanhall
.
getId
()),
"\">"
,
clanhall
.
getName
(),
"</a></td>"
);
for
(
ClanHall
clanhall
:
ClanHallManager
.
getInstance
().
getClanHalls
().
values
())
{
if
(
clanhall
!=
null
)
{
StringUtil
.
append
(
cList
,
"<td fixwidth=134><a action=\"bypass -h admin_clanhall "
,
String
.
valueOf
(
clanhall
.
getId
()),
"\">"
,
clanhall
.
getName
(),
"</a></td>"
);
i
++;
}
if
(
i
>
1
)
{
if
(
i
>
1
)
{
cList
.
append
(
"</tr><tr>"
);
i
=
0
;
}
...
...
@@ -327,17 +327,15 @@ public class AdminSiege implements IAdminCommandHandler
adminReply
.
replace
(
"%clanhalls%"
,
cList
.
toString
());
cList
.
setLength
(
0
);
i
=
0
;
for
(
ClanHall
clanhall
:
ClanHallManager
.
getInstance
().
getFreeClanHalls
().
values
())
{
if
(
clanhall
!=
null
)
{
StringUtil
.
append
(
cList
,
"<td fixwidth=134><a action=\"bypass -h admin_clanhall "
,
String
.
valueOf
(
clanhall
.
getId
()),
"\">"
,
clanhall
.
getName
(),
"</a></td>"
);
for
(
ClanHall
clanhall
:
ClanHallManager
.
getInstance
().
getFreeClanHalls
().
values
())
{
if
(
clanhall
!=
null
)
{
StringUtil
.
append
(
cList
,
"<td fixwidth=134><a action=\"bypass -h admin_clanhall "
,
String
.
valueOf
(
clanhall
.
getId
()),
"\">"
,
clanhall
.
getName
(),
"</a></td>"
);
i
++;
}
if
(
i
>
1
)
{
if
(
i
>
1
)
{
cList
.
append
(
"</tr><tr>"
);
i
=
0
;
}
...
...
@@ -408,10 +406,10 @@ public class AdminSiege implements IAdminCommandHandler
msg
.
setFile
(
null
,
"data/html/admin/siegablehall.htm"
);
msg
.
replace
(
"%clanhallId%"
,
String
.
valueOf
(
hall
.
getId
()));
msg
.
replace
(
"%clanhallName%"
,
hall
.
getName
());
if
(
hall
.
getOwnerId
()
>
0
)
if
(
hall
.
getOwnerId
()
>
0
)
{
L2Clan
owner
=
ClanTable
.
getInstance
().
getClan
(
hall
.
getOwnerId
());
if
(
owner
!=
null
)
if
(
owner
!=
null
)
msg
.
replace
(
"%clanhallOwner%"
,
owner
.
getName
());
else
msg
.
replace
(
"%clanhallOwner%"
,
"No Owner"
);
...
...
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