Optimized and validated operation of event functions.

This commit is contained in:
Cekis
2016-05-02 18:17:52 +01:00
parent c573230d0b
commit 20dc1b931e
12 changed files with 572 additions and 914 deletions
+12 -25
View File
@@ -1,22 +1,13 @@
package script.event;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.utils;
import java.util.StringTokenizer;
import script.obj_id;
public class shield_ring extends script.base_script
{
public shield_ring()
{
}
public static final String[] HELP_TEXT =
private static final String[] HELP_TEXT =
{
"=========================================",
"USAGE: ShieldRing [Armor Effectiveness 1-100] (default effectiveness is 20)",
@@ -38,10 +29,9 @@ public class shield_ring extends script.base_script
sendSystemMessage(self, "You must be in God Mode for this script to take hold.", null);
return SCRIPT_CONTINUE;
}
if (isGod(self))
else
{
int godLevel = getGodLevel(self);
if (godLevel < 15)
if (getGodLevel(self) < 15)
{
detachScript(self, "event.shield_ring");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
@@ -58,10 +48,9 @@ public class shield_ring extends script.base_script
detachScript(self, "event.shield_ring");
sendSystemMessage(self, "You must be in God Mode to use this script.", null);
}
if (isGod(self))
else
{
int godLevel = getGodLevel(self);
if (godLevel < 15)
if (getGodLevel(self) < 15)
{
detachScript(self, "event.shield_ring");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
@@ -78,15 +67,14 @@ public class shield_ring extends script.base_script
}
if (isGod(self))
{
int godLevel = getGodLevel(self);
if (godLevel < 15)
if (getGodLevel(self) < 15)
{
detachScript(self, "event.shield_ring");
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
return SCRIPT_CONTINUE;
}
}
if (!isGod(self))
else
{
detachScript(self, "event.shield_ring");
sendSystemMessage(self, "You must be in God Mode to use this script.", null);
@@ -96,16 +84,15 @@ public class shield_ring extends script.base_script
{
sendSystemMessage(self, "This command has been temporarily disabled. See S. Jakab or T. Blair", null);
}
if ((toLower(strText)).equals("detach"))
else if ((toLower(strText)).equals("detach"))
{
detachScript(self, "event.shield_ring");
return SCRIPT_CONTINUE;
}
if ((toLower(strText)).equals("help"))
else if ((toLower(strText)).equals("help"))
{
for (int i = 0; i < HELP_TEXT.length; i++)
{
sendSystemMessage(self, HELP_TEXT[i], null);
for (String helpText : HELP_TEXT) {
sendSystemMessage(self, helpText, null);
}
return SCRIPT_CONTINUE;
}