use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaLivingEntity method getWisdom.
@Override
public int getWisdom() {
if (getNpcid() < 1 && !isPlayer())
return 1;
try {
if (getNpcid() > 0) {
ISoliniaNPC npc = StateManager.getInstance().getConfigurationManager().getNPC(getNpcid());
if (npc == null)
return 1;
int stat = npc.getLevel() * 5;
stat += Utils.getTotalEffectStat(this.getBukkitLivingEntity(), "WISDOM");
if (stat > getMaxStat("WISDOM"))
stat = getMaxStat("WISDOM");
return stat;
}
if (isPlayer()) {
ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt((Player) getBukkitLivingEntity());
if (solplayer == null)
return 1;
int stat = 1;
if (solplayer.getRace() != null)
stat += solplayer.getRace().getWisdom();
stat += solplayer.getTotalItemStat("WISDOM");
stat += Utils.getTotalEffectStat(this.getBukkitLivingEntity(), "WISDOM");
stat += Utils.getTotalAAEffectStat(this.getBukkitLivingEntity(), "WISDOM");
if (stat > getMaxStat("WISDOM"))
stat = getMaxStat("WISDOM");
return stat;
}
} catch (CoreStateInitException e) {
return 1;
}
return 1;
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaLivingEntity method getStamina.
@Override
public int getStamina() {
if (getNpcid() < 1 && !isPlayer())
return 1;
try {
if (getNpcid() > 0) {
ISoliniaNPC npc = StateManager.getInstance().getConfigurationManager().getNPC(getNpcid());
if (npc == null)
return 1;
int stat = npc.getLevel() * 5;
stat += Utils.getTotalEffectStat(this.getBukkitLivingEntity(), "STAMINA");
if (stat > getMaxStat("STAMINA"))
stat = getMaxStat("STAMINA");
return stat;
}
if (isPlayer()) {
ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt((Player) getBukkitLivingEntity());
if (solplayer == null)
return 1;
int stat = 1;
if (solplayer.getRace() != null)
stat += solplayer.getRace().getStamina();
stat += solplayer.getTotalItemStat("STAMINA");
stat += Utils.getTotalEffectStat(this.getBukkitLivingEntity(), "STAMINA");
stat += Utils.getTotalAAEffectStat(this.getBukkitLivingEntity(), "STAMINA");
if (stat > getMaxStat("STAMINA"))
stat = getMaxStat("STAMINA");
return stat;
}
} catch (CoreStateInitException e) {
return 1;
}
return 1;
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class SoliniaLivingEntity method getCharisma.
@Override
public int getCharisma() {
if (getNpcid() < 1 && !isPlayer())
return 1;
try {
if (getNpcid() > 0) {
ISoliniaNPC npc = StateManager.getInstance().getConfigurationManager().getNPC(getNpcid());
if (npc == null)
return 1;
int stat = npc.getLevel() * 5;
stat += Utils.getTotalEffectStat(this.getBukkitLivingEntity(), "CHARISMA");
if (stat > getMaxStat("CHARISMA"))
stat = getMaxStat("CHARISMA");
return stat;
}
if (isPlayer()) {
ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt((Player) getBukkitLivingEntity());
if (solplayer == null)
return 1;
int stat = 1;
if (solplayer.getRace() != null)
stat += solplayer.getRace().getCharisma();
stat += solplayer.getTotalItemStat("CHARISMA");
stat += Utils.getTotalEffectStat(this.getBukkitLivingEntity(), "CHARISMA");
stat += Utils.getTotalAAEffectStat(this.getBukkitLivingEntity(), "CHARISMA");
if (stat > getMaxStat("CHARISMA"))
stat = getMaxStat("CHARISMA");
return stat;
}
} catch (CoreStateInitException e) {
return 1;
}
return 1;
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class PlayerRegenTickTimer method grantPlayerRegenBonuses.
private void grantPlayerRegenBonuses(Player player) {
if (player.isDead())
return;
// Apply Crouch Mana Regen Bonus
int manaregen = 1;
ISoliniaPlayer solplayer = null;
try {
solplayer = SoliniaPlayerAdapter.Adapt(player);
} catch (CoreStateInitException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (solplayer == null)
return;
// a players mana regen based on if they are meditating (sneaking)
manaregen += getPlayerMeditatingManaBonus(solplayer);
ISoliniaAAAbility aa = null;
try {
if (solplayer.getAARanks().size() > 0)
aa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("MENTALCLARITY");
} catch (CoreStateInitException e) {
}
int aamanaregenrank = 0;
if (aa != null) {
if (solplayer.getAARanks().size() > 0)
aamanaregenrank = Utils.getRankOfAAAbility(player, aa);
manaregen += aamanaregenrank;
}
ISoliniaAAAbility emaa = null;
try {
if (solplayer.getAARanks().size() > 0)
emaa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("MENTALCLARITY");
} catch (CoreStateInitException e) {
}
int emaamanaregenrank = 0;
if (emaa != null) {
if (solplayer.getAARanks().size() > 0)
emaamanaregenrank = Utils.getRankOfAAAbility(player, emaa);
manaregen += emaamanaregenrank;
}
manaregen += solplayer.getItemMpRegenBonuses();
// Hp and Mana Regen from Items
int hpregen = 0;
ISoliniaAAAbility hpaa = null;
try {
hpaa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("INNATEREGENERATION");
} catch (CoreStateInitException e) {
}
int aahpregenrank = 0;
if (hpaa != null) {
aahpregenrank = Utils.getRankOfAAAbility(player, hpaa);
hpregen += aahpregenrank;
}
hpregen += solplayer.getItemHpRegenBonuses();
// Process HP Regeneration
if (hpregen > 0) {
int amount = (int) Math.round(player.getHealth()) + hpregen;
if (amount > player.getMaxHealth()) {
amount = (int) Math.round(player.getMaxHealth());
}
if (amount < 0)
amount = 0;
player.setHealth(amount);
}
// Process Mana Regeneration
// System.out.println(player.getName() + " was found to have " + manaregen + " mana regen");
solplayer.increasePlayerMana(manaregen);
}
use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.
the class ScoreboardUtils method UpdateGroupScoreboard.
public static void UpdateGroupScoreboard(UUID uuid, ISoliniaGroup group) {
if (StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).getObjective("playercard") != null)
StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).getObjective("playercard").unregister();
Objective objective = StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).registerNewObjective("playercard", "dummy");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName("Party");
if (StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).getObjective("health") != null)
StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).getObjective("health").unregister();
Objective health = StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).registerNewObjective("health", "health");
health.setDisplayName(ChatColor.RED + "❤");
health.setDisplaySlot(DisplaySlot.BELOW_NAME);
if (group != null)
for (UUID groupmemberuuid : group.getMembers()) {
try {
ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt(Bukkit.getPlayer(groupmemberuuid));
if (groupmemberuuid.equals(group.getOwner())) {
Score score = objective.getScore(ChatColor.GOLD + solplayer.getFullName() + "");
score.setScore(solplayer.getLevel());
} else {
Score score = objective.getScore(ChatColor.WHITE + solplayer.getFullName() + "");
score.setScore(solplayer.getLevel());
}
} catch (CoreStateInitException e) {
e.printStackTrace();
}
}
}
Aggregations