Release of 1.1.06

This commit is contained in:
nossr50 2011-08-20 18:23:38 -07:00
parent 6f6d065820
commit 78f79213cd
13 changed files with 247 additions and 60 deletions

View File

@ -1,25 +1,18 @@
Changelog: Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code #Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Version 1.1.06 Version 1.1.06
mcMMO menu implemented! Default is 'M', change this in config
Retro HUD implemented! Retro HUD implemented!
Retro XP fill color is completely customizable on a per skill basis
New levelup sound thanks to @Rustydaggers !
With the help of Randomage the XP Formulas have been vastly changed for flexibility With the help of Randomage the XP Formulas have been vastly changed for flexibility
Global modifiers and skill modifiers now support decimals Global modifiers and skill modifiers now support decimals
Global formula modifier dropped from config Global formula modifier dropped from config
GigaDrillBreaker/Berserk doesn't drop clay blocks anymore GigaDrillBreaker/Berserk doesn't drop clay blocks anymore
Fixed bug where Herbalism didn't heal more for bread/stew when right clicking a block Fixed bug where Herbalism didn't heal more for bread/stew when right clicking a block
Fixed bug where Wheat did not use the values form the config file Fixed bug where Wheat did not use the values form the config file
Fixed bug where Archery gave xp for inflicting self injury
TODO: Watch added to clay loot tables and maps remove from clay loot tables
Add full customization of the colors
Fix Archery exploit
Fix the NPE with theType
Permission nodes for Spout elements
Small HUD style
HUD persistence
Maybe incorporate mmoParty
In order to streamline the configuration of how XP/Levels are gained, we rewrote the formulas, it is paramount to understand that from a game perspective that does NOT change how fast you level up, it just changes how easy it is to configure the system, current configuration files will be automatically updated maintaining your selected leveling speed
Version 1.1.05 Version 1.1.05
Maps dropped from excavation are created correctly, and represent the area they are found in Maps dropped from excavation are created correctly, and represent the area they are found in

View File

@ -372,7 +372,7 @@ public class Combat
* PVP XP * PVP XP
*/ */
if(LoadProperties.pvpxp && !Party.getInstance().inSameParty(attacker, defender) if(LoadProperties.pvpxp && !Party.getInstance().inSameParty(attacker, defender)
&& ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis()) && ((PPd.getLastLogin()+5)*1000) < System.currentTimeMillis() && !attacker.getName().equals(defender.getName()))
{ {
int xp = (int) ((event.getDamage() * 2) * 10); int xp = (int) ((event.getDamage() * 2) * 10);
PPa.addXP(SkillType.ARCHERY, xp); PPa.addXP(SkillType.ARCHERY, xp);

View File

@ -42,6 +42,9 @@ public class Database {
} }
//Create the DB structure //Create the DB structure
public void createStructure(){ public void createStructure(){
Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"huds` (`user_id` int(10) unsigned NOT NULL," +
"`hudtype` varchar(50) NOT NULL DEFAULT 'STANDARD'," +
"PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT," + Write("CREATE TABLE IF NOT EXISTS `"+LoadProperties.MySQLtablePrefix+"users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT," +
"`user` varchar(40) NOT NULL," + "`user` varchar(40) NOT NULL," +
"`lastlogin` int(32) unsigned NOT NULL," + "`lastlogin` int(32) unsigned NOT NULL," +

View File

@ -2,10 +2,11 @@ package com.gmail.nossr50.config;
import java.io.File; import java.io.File;
import org.bukkit.util.config.Configuration; import org.bukkit.util.config.Configuration;
import org.getspout.spoutapi.keyboard.Keyboard;
public class LoadProperties public class LoadProperties
{ {
public static Boolean xplockEnable, xpbar, xpicon, partybar, map, string, bucket, web, xprateEnable, slimeballs, spoutEnabled, public static Boolean watch, xplockEnable, xpbar, xpicon, partybar, string, bucket, web, xprateEnable, slimeballs, spoutEnabled,
donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable, donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable,
whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable, whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable,
mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms, mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms,
@ -16,7 +17,7 @@ public class LoadProperties
xprate, mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood, xprate, mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood,
nStone, nIron, nGold, nDiamond, locale; nStone, nIron, nGold, nDiamond, locale;
public static int xpbar_x, xpbar_y, xpicon_x, xpicon_y, partybar_x, partybar_y, partybar_spacing, mmap, mstring, mbucket, mweb, public static int mwatch, xpbar_x, xpbar_y, xpicon_x, xpicon_y, partybar_x, partybar_y, partybar_spacing, mstring, mbucket, mweb,
archeryLimit, chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, mslimeballs, mbones, msulphur, mslowsand, archeryLimit, chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, mslimeballs, mbones, msulphur, mslowsand,
mmushroom2, mglowstone2, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower, mmushroom2, mglowstone2, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower,
msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport, msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport,
@ -24,11 +25,17 @@ public class LoadProperties
berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss,
feathersConsumedByChimaeraWing, repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond; feathersConsumedByChimaeraWing, repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond;
public static double pvpxprewardmodifier, tamingxpmodifier, miningxpmodifier, public static double xpbackground_r, xpbackground_g, xpbackground_b, xpborder_r, xpborder_g, xpborder_b, acrobatics_r, acrobatics_g, acrobatics_b, archery_r, archery_g, archery_b, axes_r, axes_g, axes_b,
excavation_r, excavation_g, excavation_b, herbalism_r, herbalism_g, herbalism_b, mining_r, mining_g, mining_b,
repair_r, repair_g, repair_b, swords_r, swords_g, swords_b, taming_r, taming_g, taming_b, unarmed_r, unarmed_g, unarmed_b,
woodcutting_r, woodcutting_g, woodcutting_b, pvpxprewardmodifier, tamingxpmodifier, miningxpmodifier,
repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier,
archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
public String directory = "plugins/mcMMO/"; public String directory = "plugins/mcMMO/";
public static Keyboard keypress;
File file = new File(directory + File.separator + "config.yml"); File file = new File(directory + File.separator + "config.yml");
Configuration config = null; Configuration config = null;
@ -115,6 +122,46 @@ public class LoadProperties
write("Spout.Party.HP.X_POS", -11); write("Spout.Party.HP.X_POS", -11);
write("Spout.Party.HP.Y_POS", 0); write("Spout.Party.HP.Y_POS", 0);
write("Spout.Party.HP.SPACING", 16); write("Spout.Party.HP.SPACING", 16);
write("Spout.Menu.Key", "KEY_M");
write("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
write("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Archery.RED", 0.3);
write("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Axes.RED", 0.3);
write("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Excavation.RED", 0.3);
write("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3);
write("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Mining.RED", 0.3);
write("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Repair.RED", 0.3);
write("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Swords.RED", 0.3);
write("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Taming.RED", 0.3);
write("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3);
write("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3);
write("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3);
write("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75);
write("Spout.HUD.Retro.Colors.Border.RED", 0.0);
write("Spout.HUD.Retro.Colors.Border.GREEN", 0.0);
write("Spout.HUD.Retro.Colors.Border.BLUE", 0.0);
write("Spout.HUD.Retro.Colors.Background.RED", 0.75);
write("Spout.HUD.Retro.Colors.Background.GREEN", 0.75);
write("Spout.HUD.Retro.Colors.Background.BLUE", 0.75);
write("MySQL.Enabled", false); write("MySQL.Enabled", false);
write("MySQL.Server.Address", "localhost"); write("MySQL.Server.Address", "localhost");
@ -282,6 +329,21 @@ public class LoadProperties
{ {
System.out.println("Loading Config File..."); System.out.println("Loading Config File...");
String temp = readString("Spout.Menu.Key", "KEY_M");
for(Keyboard x : Keyboard.values())
{
if(x.toString().equalsIgnoreCase(temp))
{
keypress = x;
}
}
if(keypress == null)
{
System.out.println("Invalid KEY for Spout.Menu.Key, using KEY_M");
keypress = Keyboard.KEY_M;
}
donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true); donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true);
xpGainsMobSpawners = readBoolean("XP.Gains.Mobspawners.Enabled", false); xpGainsMobSpawners = readBoolean("XP.Gains.Mobspawners.Enabled", false);
@ -297,6 +359,47 @@ public class LoadProperties
partybar_y = readInteger("Spout.Party.HP.Y_POS", 0); partybar_y = readInteger("Spout.Party.HP.Y_POS", 0);
partybar_spacing = readInteger("Spout.Party.HP.SPACING", 16); partybar_spacing = readInteger("Spout.Party.HP.SPACING", 16);
acrobatics_r = readDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
acrobatics_g = readDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
acrobatics_b = readDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75);
archery_r = readDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3);
archery_g = readDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3);
archery_b = readDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75);
axes_r = readDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3);
axes_g = readDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3);
axes_b = readDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75);
excavation_r = readDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3);
excavation_g = readDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3);
excavation_b = readDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75);
herbalism_r = readDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3);
herbalism_g = readDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3);
herbalism_b = readDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75);
mining_r = readDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3);
mining_g = readDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3);
mining_b = readDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75);
repair_r = readDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3);
repair_g = readDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3);
repair_b = readDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75);
swords_r = readDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3);
swords_g = readDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3);
swords_b = readDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75);
taming_r = readDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3);
taming_g = readDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3);
taming_b = readDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75);
unarmed_r = readDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3);
unarmed_g = readDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3);
unarmed_b = readDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75);
woodcutting_r = readDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3);
woodcutting_g = readDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3);
woodcutting_b = readDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75);
xpborder_r = readDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0);
xpborder_g = readDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0);
xpborder_b = readDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0);
xpbackground_r = readDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75);
xpbackground_g = readDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75);
xpbackground_b = readDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75);
msulphur = readInteger("Experience.Excavation.Sulphur", 30); msulphur = readInteger("Experience.Excavation.Sulphur", 30);
mbones = readInteger("Experience.Excavation.Bones", 30); mbones = readInteger("Experience.Excavation.Bones", 30);
mbase = readInteger("Experience.Excavation.Base", 40); mbase = readInteger("Experience.Excavation.Base", 40);
@ -313,7 +416,7 @@ public class LoadProperties
mstring = readInteger("Experience.Excavation.String", 200); mstring = readInteger("Experience.Excavation.String", 200);
mbucket = readInteger("Experience.Excavation.Bucket", 100); mbucket = readInteger("Experience.Excavation.Bucket", 100);
mweb = readInteger("Experience.Excavation.Web", 150); mweb = readInteger("Experience.Excavation.Web", 150);
mmap = readInteger("Experience.Excavation.Map", 200); mwatch = readInteger("Experience.Excavation.Watch", 200);
msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30); msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30);
mwheat = readInteger("Experience.Herbalism.Wheat", 50); mwheat = readInteger("Experience.Herbalism.Wheat", 50);
@ -420,7 +523,7 @@ public class LoadProperties
netherrack = readBoolean("Excavation.Drops.Netherrack", true); netherrack = readBoolean("Excavation.Drops.Netherrack", true);
bones = readBoolean("Excavation.Drops.Bones", true); bones = readBoolean("Excavation.Drops.Bones", true);
slimeballs = readBoolean("Excavation.Drops.Slimeballs", true); slimeballs = readBoolean("Excavation.Drops.Slimeballs", true);
map = readBoolean("Excavation.Drops.Map", true); watch = readBoolean("Excavation.Drops.Watch", true);
string = readBoolean("Excavation.Drops.String", true); string = readBoolean("Excavation.Drops.String", true);
bucket = readBoolean("Excavation.Drops.Bucket", true); bucket = readBoolean("Excavation.Drops.Bucket", true);
web = readBoolean("Excavation.Drops.Web", true); web = readBoolean("Excavation.Drops.Web", true);

View File

@ -18,10 +18,15 @@ import com.gmail.nossr50.spout.SpoutStuff;
public class HUDmmo public class HUDmmo
{ {
int center_x = 427/2;
int center_y = 240/2;
String playerName = null; String playerName = null;
Widget xpbar = null; Widget xpbar = null;
GenericGradient xpfill = null; GenericGradient xpfill = null;
GenericGradient xpbg = null; GenericGradient xpbg = null;
GenericGradient xpicon_bg = null;
GenericGradient xpicon_border = null;
GenericTexture xpicon = null; GenericTexture xpicon = null;
mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO"); mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
@ -30,6 +35,7 @@ public class HUDmmo
playerName = player.getName(); playerName = player.getName();
initializeHUD(player); initializeHUD(player);
} }
public void initializeHUD(Player player) public void initializeHUD(Player player)
{ {
HUDType type = Users.getProfile(player).getHUDType(); HUDType type = Users.getProfile(player).getHUDType();
@ -69,6 +75,7 @@ public class HUDmmo
} }
case SMALL: case SMALL:
{ {
updateXpBarStandard(player, Users.getProfile(player));
break; break;
} }
} }
@ -87,37 +94,52 @@ public class HUDmmo
xpbg = null; xpbg = null;
xpicon = null; xpicon = null;
if(SpoutStuff.partyHealthBars.containsKey(sPlayer))
{
SpoutStuff.partyHealthBars.remove(sPlayer);
if(LoadProperties.partybar && Users.getProfile(sPlayer).inParty())
SpoutStuff.initializePartyTracking(sPlayer);
}
sPlayer.getMainScreen().setDirty(true); sPlayer.getMainScreen().setDirty(true);
} }
} }
private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer) private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer)
{ {
Color black = new Color(0, 0, 0, 1f); Color border = new Color((float)LoadProperties.xpborder_r, (float)LoadProperties.xpborder_g, (float)LoadProperties.xpborder_b, 1f);
Color green = new Color(0, 1f, 0, 1f); Color green = new Color(0, 1f, 0, 1f);
Color gray = new Color(0.75f, 0.75f, 0.75f, 1f); Color background = new Color((float)LoadProperties.xpbackground_r, (float)LoadProperties.xpbackground_g, (float)LoadProperties.xpbackground_b, 1f);
Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f);
xpicon = new GenericTexture(); xpicon = new GenericTexture();
xpbar = new GenericGradient(); xpbar = new GenericGradient();
xpfill = new GenericGradient(); xpfill = new GenericGradient();
xpbg = new GenericGradient(); xpbg = new GenericGradient();
xpicon.setWidth(6).setHeight(6).setX(149-6).setY(9).setDirty(true); xpicon_bg = new GenericGradient();
xpicon_border = new GenericGradient();
xpicon_bg.setBottomColor(darkbg).setTopColor(darkbg).setWidth(4).setHeight(4).setPriority(RenderPriority.High).setX(142).setY(10).setDirty(true);
xpicon_border.setBottomColor(border).setTopColor(border).setWidth(6).setHeight(6).setPriority(RenderPriority.Highest).setX(141).setY(9).setDirty(true);
xpicon.setWidth(6).setHeight(6).setX(141).setY(9).setPriority(RenderPriority.Normal).setDirty(true);
xpicon.setUrl(LoadProperties.web_url+"HUD/Retro/Icon_r.png"); xpicon.setUrl(LoadProperties.web_url+"HUD/Retro/Icon_r.png");
xpbar.setWidth(128).setHeight(4).setX(149).setY(10); xpbar.setWidth(128).setHeight(4).setX(149).setY(10);
((GenericGradient) xpbar).setBottomColor(black).setTopColor(black).setPriority(RenderPriority.Highest).setDirty(true); ((GenericGradient) xpbar).setBottomColor(border).setTopColor(border).setPriority(RenderPriority.Highest).setDirty(true);
xpfill.setWidth(0).setHeight(2).setX(150).setY(11); xpfill.setWidth(0).setHeight(2).setX(150).setY(11);
xpfill.setBottomColor(green).setTopColor(green).setPriority(RenderPriority.Lowest).setDirty(true); xpfill.setBottomColor(green).setTopColor(green).setPriority(RenderPriority.Lowest).setDirty(true);
xpbg.setWidth(126).setHeight(2).setX(150).setY(11); xpbg.setWidth(126).setHeight(2).setX(150).setY(11);
xpbg.setBottomColor(gray).setTopColor(gray).setPriority(RenderPriority.Low).setDirty(true); xpbg.setBottomColor(background).setTopColor(background).setPriority(RenderPriority.Low).setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbar); sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbar);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpfill); sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpfill);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbg); sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpbg);
sPlayer.getMainScreen().attachWidget(plugin, (GenericTexture)xpicon); sPlayer.getMainScreen().attachWidget(plugin, (GenericTexture)xpicon);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpicon_bg);
sPlayer.getMainScreen().attachWidget(plugin, (GenericGradient)xpicon_border);
sPlayer.getMainScreen().setDirty(true); sPlayer.getMainScreen().setDirty(true);
} }
@ -150,18 +172,26 @@ public class HUDmmo
private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer) private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer)
{ {
//Coordinates 240, 427 are the bottom right. //Setup xp bar
GenericTexture xpbar = new GenericTexture(); xpbar = new GenericTexture();
GenericTexture xpbar_fill = new GenericTexture();
xpbar.setUrl("http://dl.dropbox.com/u/18212134/xpbar/mini/bar.png"); if(LoadProperties.xpicon)
xpbar_fill.setUrl("http://dl.dropbox.com/u/18212134/xpbar/mini/bar_fill.png"); {
xpicon = new GenericTexture();
xpicon.setUrl(LoadProperties.web_url+"HUD/Standard/Icon.png");
xpicon.setHeight(8).setWidth(16).setX(center_x-(8+64)).setY(LoadProperties.xpicon_y+2);
xpicon.setDirty(true);
sPlayer.getMainScreen().attachWidget(plugin, xpicon);
}
xpbar.setWidth(128).setHeight(4).setX(149).setY(10).setDirty(true); ((GenericTexture)xpbar).setUrl(LoadProperties.web_url+"HUD/Standard/xpbar_inc000.png");
xpbar_fill.setWidth(2).setHeight(2).setX(150).setY(11).setPriority(RenderPriority.High).setDirty(true); xpbar.setX(center_x-64).setY(LoadProperties.xpbar_y).setHeight(4).setWidth(128);
sPlayer.getMainScreen().attachWidget(plugin, xpbar); sPlayer.getMainScreen().attachWidget(plugin, xpbar);
sPlayer.getMainScreen().attachWidget(plugin, xpbar_fill);
sPlayer.getMainScreen().setDirty(true); sPlayer.getMainScreen().setDirty(true);
} }
@ -175,6 +205,9 @@ public class HUDmmo
else else
theType=PP.getLastGained(); theType=PP.getLastGained();
if(theType == null)
return;
((GenericTexture) xpicon).setUrl(LoadProperties.web_url+"HUD/Standard/"+m.getCapitalized(theType.toString())+".png"); ((GenericTexture) xpicon).setUrl(LoadProperties.web_url+"HUD/Standard/"+m.getCapitalized(theType.toString())+".png");
xpicon.setDirty(true); xpicon.setDirty(true);
@ -183,6 +216,7 @@ public class HUDmmo
SpoutManager.getPlayer(player).getMainScreen().setDirty(true); SpoutManager.getPlayer(player).getMainScreen().setDirty(true);
} }
private void updateXpBarRetro(Player player, PlayerProfile PP) private void updateXpBarRetro(Player player, PlayerProfile PP)
{ {
SkillType theType = null; SkillType theType = null;
@ -192,17 +226,13 @@ public class HUDmmo
else else
theType=PP.getLastGained(); theType=PP.getLastGained();
Color color = new Color(0.3f, 0.3f, 0.75f, 1f); if(theType == null)
return;
Color color = SpoutStuff.getRetroColor(theType);
if(xpicon != null && theType != null) if(xpicon != null && theType != null)
xpicon.setUrl(LoadProperties.web_url+"HUD/Retro/"+m.getCapitalized(theType.toString())+"_r.png"); xpicon.setUrl(LoadProperties.web_url+"HUD/Retro/"+m.getCapitalized(theType.toString())+"_r.png");
else
{
if(xpicon == null)
System.out.println("xpicon was null!");
if(theType == null)
System.out.println("theType was null!");
}
if(theType != null) if(theType != null)
xpfill.setBottomColor(color).setTopColor(color).setWidth(SpoutStuff.getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO)).setDirty(true); xpfill.setBottomColor(color).setTopColor(color).setWidth(SpoutStuff.getXpInc(PP.getSkillXpLevel(theType), PP.getXpToLevel(theType), HUDType.RETRO)).setDirty(true);

View File

@ -103,6 +103,19 @@ public class PlayerProfile
return false; return false;
this.userid = id; this.userid = id;
if (id > 0) { if (id > 0) {
HashMap<Integer, ArrayList<String>> huds = mcMMO.database.Read("SELECT hudtype FROM "+LoadProperties.MySQLtablePrefix+"huds WHERE user_id = " + id);
if(huds.get(1) == null)
{
mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"huds (user_id) VALUES ("+id+")");
} else {
for(HUDType x : HUDType.values())
{
if(x.toString().equals(huds.get(1).get(0)))
{
hud = x;
}
}
}
HashMap<Integer, ArrayList<String>> users = mcMMO.database.Read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id); HashMap<Integer, ArrayList<String>> users = mcMMO.database.Read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id);
//lastlogin = Integer.parseInt(users.get(1).get(0)); //lastlogin = Integer.parseInt(users.get(1).get(0));
party = users.get(1).get(1); party = users.get(1).get(1);
@ -251,6 +264,16 @@ public class PlayerProfile
skullSplitterDATS = Integer.valueOf(character[31]); skullSplitterDATS = Integer.valueOf(character[31]);
if(character.length > 32) if(character.length > 32)
superBreakerDATS = Integer.valueOf(character[32]); superBreakerDATS = Integer.valueOf(character[32]);
if(character.length > 33)
{
for(HUDType x : HUDType.values())
{
if(x.toString().equals(character[33]))
{
hud = x;
}
}
}
in.close(); in.close();
return true; return true;
} }
@ -268,6 +291,8 @@ public class PlayerProfile
// if we are using mysql save to database // if we are using mysql save to database
if (LoadProperties.useMySQL) if (LoadProperties.useMySQL)
{ {
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"huds SET "
+" hudtype = '"+hud.toString()+"' WHERE user_id = "+this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid);
mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"spawn SET world = '" + this.myspawnworld + "', x = " +getX()+", y = "+getY()+", z = "+getZ()+" WHERE user_id = "+this.userid);
@ -363,6 +388,7 @@ public class PlayerProfile
writer.append(String.valueOf(serratedStrikesDATS)+":"); writer.append(String.valueOf(serratedStrikesDATS)+":");
writer.append(String.valueOf(skullSplitterDATS)+":"); writer.append(String.valueOf(skullSplitterDATS)+":");
writer.append(String.valueOf(superBreakerDATS)+":"); writer.append(String.valueOf(superBreakerDATS)+":");
writer.append(hud.toString()+":");
writer.append("\r\n"); writer.append("\r\n");
} }
} }
@ -417,6 +443,7 @@ public class PlayerProfile
out.append(0+":"); //DATS out.append(0+":"); //DATS
out.append(0+":"); //DATS out.append(0+":"); //DATS
out.append(0+":"); //DATS out.append(0+":"); //DATS
out.append("STANDARD"+":");//HUD
//Add more in the same format as the line above //Add more in the same format as the line above

View File

@ -0,0 +1,13 @@
package com.gmail.nossr50.datatypes.buttons;
import org.getspout.spoutapi.gui.GenericButton;
public class ButtonEscape extends GenericButton
{
public ButtonEscape()
{
this.setText("EXIT");
this.setWidth(60).setHeight(20);
this.setDirty(true);
}
}

View File

@ -18,4 +18,4 @@ public class ButtonHUDStyle extends GenericButton
this.setText("HUD Type: "+PP.getHUDType().toString()); this.setText("HUD Type: "+PP.getHUDType().toString());
this.setDirty(true); this.setDirty(true);
} }
} }

View File

@ -6,11 +6,13 @@ import org.getspout.spoutapi.gui.GenericLabel;
import org.getspout.spoutapi.gui.GenericPopup; import org.getspout.spoutapi.gui.GenericPopup;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle; import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
public class PopupMMO extends GenericPopup public class PopupMMO extends GenericPopup
{ {
ButtonHUDStyle HUDButton = null; ButtonHUDStyle HUDButton = null;
ButtonEscape EscapeButton = null;
GenericLabel mcMMO_label = new GenericLabel(); GenericLabel mcMMO_label = new GenericLabel();
GenericLabel tip_escape = new GenericLabel(); GenericLabel tip_escape = new GenericLabel();
int center_x = 427/2; int center_x = 427/2;
@ -28,9 +30,13 @@ public class PopupMMO extends GenericPopup
HUDButton = new ButtonHUDStyle(PP); HUDButton = new ButtonHUDStyle(PP);
HUDButton.setX(center_x-(HUDButton.getWidth()/2)).setY(center_y/2).setDirty(true); HUDButton.setX(center_x-(HUDButton.getWidth()/2)).setY(center_y/2).setDirty(true);
EscapeButton = new ButtonEscape();
EscapeButton.setX(center_x-(EscapeButton.getWidth()/2)).setY((center_y/2)+HUDButton.getHeight()+5).setDirty(true);
this.attachWidget(plugin, HUDButton); this.attachWidget(plugin, HUDButton);
this.attachWidget(plugin, mcMMO_label); this.attachWidget(plugin, mcMMO_label);
this.attachWidget(plugin, tip_escape); this.attachWidget(plugin, tip_escape);
this.attachWidget(plugin, EscapeButton);
this.setDirty(true); this.setDirty(true);
} }

View File

@ -3,11 +3,11 @@ package com.gmail.nossr50.listeners;
import org.getspout.spoutapi.event.input.InputListener; import org.getspout.spoutapi.event.input.InputListener;
import org.getspout.spoutapi.event.input.KeyPressedEvent; import org.getspout.spoutapi.event.input.KeyPressedEvent;
import org.getspout.spoutapi.gui.ScreenType; import org.getspout.spoutapi.gui.ScreenType;
import org.getspout.spoutapi.keyboard.Keyboard;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.datatypes.popups.PopupMMO; import com.gmail.nossr50.datatypes.popups.PopupMMO;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
@ -29,7 +29,7 @@ public class mcSpoutInputListener extends InputListener
SpoutPlayer sPlayer = event.getPlayer(); SpoutPlayer sPlayer = event.getPlayer();
if(event.getKey() == Keyboard.KEY_M) if(event.getKey() == LoadProperties.keypress)
{ {
if(!SpoutStuff.playerScreens.containsKey(sPlayer)) if(!SpoutStuff.playerScreens.containsKey(sPlayer))
{ {

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import org.getspout.spoutapi.event.screen.ButtonClickEvent; import org.getspout.spoutapi.event.screen.ButtonClickEvent;
import org.getspout.spoutapi.event.screen.ScreenCloseEvent;
import org.getspout.spoutapi.event.screen.ScreenListener; import org.getspout.spoutapi.event.screen.ScreenListener;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
@ -9,7 +10,9 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.HUDType; import com.gmail.nossr50.datatypes.HUDType;
import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.HUDmmo;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle; import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
import com.gmail.nossr50.datatypes.popups.PopupMMO;
import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.SpoutStuff;
public class mcSpoutScreenListener extends ScreenListener public class mcSpoutScreenListener extends ScreenListener
@ -37,6 +40,9 @@ public class mcSpoutScreenListener extends ScreenListener
PP.setHUDType(HUDType.STANDARD); PP.setHUDType(HUDType.STANDARD);
break; break;
case STANDARD: case STANDARD:
PP.setHUDType(HUDType.SMALL);
break;
case SMALL:
PP.setHUDType(HUDType.RETRO); PP.setHUDType(HUDType.RETRO);
break; break;
} }
@ -45,6 +51,17 @@ public class mcSpoutScreenListener extends ScreenListener
SpoutStuff.playerScreens.get(sPlayer).updateButtons(PP); SpoutStuff.playerScreens.get(sPlayer).updateButtons(PP);
} }
} else if (event.getButton() instanceof ButtonEscape)
{
sPlayer.getMainScreen().closePopup();
}
}
public void onScreenClose(ScreenCloseEvent event)
{
if(event.getScreen() instanceof PopupMMO)
{
SpoutStuff.playerScreens.remove(event.getPlayer());
} }
} }
} }

View File

@ -1,13 +1,11 @@
package com.gmail.nossr50.skills; package com.gmail.nossr50.skills;
import java.util.ArrayList; import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.map.MapView;
import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
import com.gmail.nossr50.m; import com.gmail.nossr50.m;
@ -148,9 +146,8 @@ public class Excavation
{ {
if(Math.random() * 100 > 99) if(Math.random() * 100 > 99)
{ {
MapView mv = Bukkit.getServer().createMap(loc.getWorld());
xp+= LoadProperties.mwatch; xp+= LoadProperties.mwatch;
is.add(new ItemStack(Material.WATCH, 1, mv.getId())); is.add(new ItemStack(Material.WATCH, 1, (byte)0));
} }
} }
if(LoadProperties.bucket && PP.getSkillLevel(SkillType.EXCAVATION) >= 500) if(LoadProperties.bucket && PP.getSkillLevel(SkillType.EXCAVATION) >= 500)

View File

@ -44,8 +44,6 @@ public class SpoutStuff
public static HashMap<Player, ArrayList<HealthBarMMO>> partyHealthBars = new HashMap<Player, ArrayList<HealthBarMMO>>(); public static HashMap<Player, ArrayList<HealthBarMMO>> partyHealthBars = new HashMap<Player, ArrayList<HealthBarMMO>>();
public static HashMap<SpoutPlayer, PopupMMO> playerScreens = new HashMap<SpoutPlayer, PopupMMO>(); public static HashMap<SpoutPlayer, PopupMMO> playerScreens = new HashMap<SpoutPlayer, PopupMMO>();
public static void registerCustomEvent() public static void registerCustomEvent()
{ {
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, plugin); Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, plugin);
@ -58,29 +56,29 @@ public class SpoutStuff
switch(type) switch(type)
{ {
case ACROBATICS: case ACROBATICS:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float) LoadProperties.acrobatics_r, (float) LoadProperties.acrobatics_g, (float) LoadProperties.acrobatics_b, 1);
case ARCHERY: case ARCHERY:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float) LoadProperties.archery_r, (float)LoadProperties.archery_g, (float)LoadProperties.archery_b, 1f);
case AXES: case AXES:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float) LoadProperties.axes_r, (float)LoadProperties.axes_g, (float)LoadProperties.axes_b, 1f);
case EXCAVATION: case EXCAVATION:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float)LoadProperties.excavation_r, (float)LoadProperties.excavation_g, (float)LoadProperties.excavation_b, 1f);
case HERBALISM: case HERBALISM:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float)LoadProperties.herbalism_r, (float)LoadProperties.herbalism_g, (float)LoadProperties.herbalism_b, 1f);
case MINING: case MINING:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float)LoadProperties.mining_r, (float)LoadProperties.mining_g, (float)LoadProperties.mining_b, 1f);
case REPAIR: case REPAIR:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float)LoadProperties.repair_r, (float)LoadProperties.repair_g, (float)LoadProperties.repair_b, 1f);
case SORCERY: case SORCERY:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color(0.3f, 0.3f, 0.75f, 1f);
case SWORDS: case SWORDS:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float)LoadProperties.swords_r, (float)LoadProperties.swords_g, (float)LoadProperties.swords_b, 1f);
case TAMING: case TAMING:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float)LoadProperties.taming_r, (float)LoadProperties.taming_g, (float)LoadProperties.taming_b, 1f);
case UNARMED: case UNARMED:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float)LoadProperties.unarmed_r, (float)LoadProperties.unarmed_g, (float)LoadProperties.unarmed_b, 1f);
case WOODCUTTING: case WOODCUTTING:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color((float)LoadProperties.woodcutting_r, (float)LoadProperties.woodcutting_g, (float)LoadProperties.woodcutting_b, 1f);
default: default:
return new Color(0.3f, 0.3f, 0.75f, 1f); return new Color(0.3f, 0.3f, 0.75f, 1f);
} }