EnchantSkillLearn code format and cleanup.

This commit is contained in:
MobiusDevelopment
2022-08-06 09:21:45 +00:00
parent cafc3ab36b
commit 3cd44daa90
4 changed files with 117 additions and 272 deletions

View File

@@ -20,88 +20,70 @@ import org.l2jmobius.gameserver.model.actor.Player;
public class EnchantSkillLearn public class EnchantSkillLearn
{ {
// these two build the primary key // These two build the primary key.
private final int id; private final int _id;
private final int level; private final int _level;
// not needed, just for easier debug // Not needed, just for easier debugging.
private final String name; private final String _name;
private final int spCost; private final int _spCost;
private final int baseLevel; private final int _baseLevel;
private final int minSkillLevel; private final int _minSkillLevel;
private final int exp; private final int _exp;
private final byte rate76; private final byte _rate76;
private final byte rate77; private final byte _rate77;
private final byte rate78; private final byte _rate78;
private final byte rate79; private final byte _rate79;
private final byte rate80; private final byte _rate80;
public EnchantSkillLearn(int id, int level, int minSkillLevel, int baseLevel, String name, int spCost, int exp, byte rate76, byte rate77, byte rate78, byte rate79, byte rate80) public EnchantSkillLearn(int id, int level, int minSkillLevel, int baseLevel, String name, int spCost, int exp, byte rate76, byte rate77, byte rate78, byte rate79, byte rate80)
{ {
this.id = id; _id = id;
this.level = level; _level = level;
this.baseLevel = baseLevel; _baseLevel = baseLevel;
this.minSkillLevel = minSkillLevel; _minSkillLevel = minSkillLevel;
this.name = name.intern(); _name = name.intern();
this.spCost = spCost; _spCost = spCost;
this.exp = exp; _exp = exp;
this.rate76 = rate76; _rate76 = rate76;
this.rate77 = rate77; _rate77 = rate77;
this.rate78 = rate78; _rate78 = rate78;
this.rate79 = rate79; _rate79 = rate79;
this.rate80 = rate80; _rate80 = rate80;
} }
/**
* @return Returns the id.
*/
public int getId() public int getId()
{ {
return id; return _id;
} }
/**
* @return Returns the level.
*/
public int getLevel() public int getLevel()
{ {
return level; return _level;
} }
/**
* @return Returns the minLevel.
*/
public int getBaseLevel() public int getBaseLevel()
{ {
return baseLevel; return _baseLevel;
} }
/**
* @return Returns the minSkillLevel.
*/
public int getMinSkillLevel() public int getMinSkillLevel()
{ {
return minSkillLevel; return _minSkillLevel;
} }
/**
* @return Returns the name.
*/
public String getName() public String getName()
{ {
return name; return _name;
} }
/**
* @return Returns the spCost.
*/
public int getSpCost() public int getSpCost()
{ {
return spCost; return _spCost;
} }
public int getExp() public int getExp()
{ {
return exp; return _exp;
} }
public byte getRate(Player ply) public byte getRate(Player ply)
@@ -111,32 +93,32 @@ public class EnchantSkillLearn
{ {
case 76: case 76:
{ {
result = rate76; result = _rate76;
break; break;
} }
case 77: case 77:
{ {
result = rate77; result = _rate77;
break; break;
} }
case 78: case 78:
{ {
result = rate78; result = _rate78;
break; break;
} }
case 79: case 79:
{ {
result = rate79; result = _rate79;
break; break;
} }
case 80: case 80:
{ {
result = rate80; result = _rate80;
break; break;
} }
default: default:
{ {
result = rate80; result = _rate80;
break; break;
} }
} }

View File

@@ -20,88 +20,70 @@ import org.l2jmobius.gameserver.model.actor.Player;
public class EnchantSkillLearn public class EnchantSkillLearn
{ {
// these two build the primary key // These two build the primary key.
private final int id; private final int _id;
private final int level; private final int _level;
// not needed, just for easier debug // Not needed, just for easier debugging.
private final String name; private final String _name;
private final int spCost; private final int _spCost;
private final int baseLevel; private final int _baseLevel;
private final int minSkillLevel; private final int _minSkillLevel;
private final int exp; private final int _exp;
private final byte rate76; private final byte _rate76;
private final byte rate77; private final byte _rate77;
private final byte rate78; private final byte _rate78;
private final byte rate79; private final byte _rate79;
private final byte rate80; private final byte _rate80;
public EnchantSkillLearn(int id, int level, int minSkillLevel, int baseLevel, String name, int spCost, int exp, byte rate76, byte rate77, byte rate78, byte rate79, byte rate80) public EnchantSkillLearn(int id, int level, int minSkillLevel, int baseLevel, String name, int spCost, int exp, byte rate76, byte rate77, byte rate78, byte rate79, byte rate80)
{ {
this.id = id; _id = id;
this.level = level; _level = level;
this.baseLevel = baseLevel; _baseLevel = baseLevel;
this.minSkillLevel = minSkillLevel; _minSkillLevel = minSkillLevel;
this.name = name.intern(); _name = name.intern();
this.spCost = spCost; _spCost = spCost;
this.exp = exp; _exp = exp;
this.rate76 = rate76; _rate76 = rate76;
this.rate77 = rate77; _rate77 = rate77;
this.rate78 = rate78; _rate78 = rate78;
this.rate79 = rate79; _rate79 = rate79;
this.rate80 = rate80; _rate80 = rate80;
} }
/**
* @return Returns the id.
*/
public int getId() public int getId()
{ {
return id; return _id;
} }
/**
* @return Returns the level.
*/
public int getLevel() public int getLevel()
{ {
return level; return _level;
} }
/**
* @return Returns the minLevel.
*/
public int getBaseLevel() public int getBaseLevel()
{ {
return baseLevel; return _baseLevel;
} }
/**
* @return Returns the minSkillLevel.
*/
public int getMinSkillLevel() public int getMinSkillLevel()
{ {
return minSkillLevel; return _minSkillLevel;
} }
/**
* @return Returns the name.
*/
public String getName() public String getName()
{ {
return name; return _name;
} }
/**
* @return Returns the spCost.
*/
public int getSpCost() public int getSpCost()
{ {
return spCost; return _spCost;
} }
public int getExp() public int getExp()
{ {
return exp; return _exp;
} }
public byte getRate(Player ply) public byte getRate(Player ply)
@@ -111,32 +93,32 @@ public class EnchantSkillLearn
{ {
case 76: case 76:
{ {
result = rate76; result = _rate76;
break; break;
} }
case 77: case 77:
{ {
result = rate77; result = _rate77;
break; break;
} }
case 78: case 78:
{ {
result = rate78; result = _rate78;
break; break;
} }
case 79: case 79:
{ {
result = rate79; result = _rate79;
break; break;
} }
case 80: case 80:
{ {
result = rate80; result = _rate80;
break; break;
} }
default: default:
{ {
result = rate80; result = _rate80;
break; break;
} }
} }

View File

@@ -1,101 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.gameserver.model.actor.Player;
public class EnchantSkillGroup
{
private final int _id;
private final List<EnchantSkillHolder> _enchantDetails = new ArrayList<>();
public EnchantSkillGroup(int id)
{
_id = id;
}
public void addEnchantDetail(EnchantSkillHolder detail)
{
_enchantDetails.add(detail);
}
public int getId()
{
return _id;
}
public List<EnchantSkillHolder> getEnchantGroupDetails()
{
return _enchantDetails;
}
public static class EnchantSkillHolder
{
private final int _level;
private final int _adenaCost;
private final int _expCost;
private final int _spCost;
private final byte[] _rate;
public EnchantSkillHolder(StatSet set)
{
_level = set.getInt("level");
_adenaCost = set.getInt("adena", 0);
_expCost = set.getInt("exp", 0);
_spCost = set.getInt("sp", 0);
_rate = new byte[24];
for (int i = 0; i < 24; i++)
{
_rate[i] = set.getByte("chance" + (76 + i), (byte) 0);
}
}
/**
* @return Returns the level.
*/
public int getLevel()
{
return _level;
}
/**
* @return Returns the spCost.
*/
public int getSpCost()
{
return _spCost;
}
public int getExpCost()
{
return _expCost;
}
public int getAdenaCost()
{
return _adenaCost;
}
public byte getRate(Player ply)
{
return ply.getLevel() < 76 ? 0 : _rate[ply.getLevel() - 76];
}
}
}

View File

@@ -20,88 +20,70 @@ import org.l2jmobius.gameserver.model.actor.Player;
public class EnchantSkillLearn public class EnchantSkillLearn
{ {
// these two build the primary key // These two build the primary key.
private final int id; private final int _id;
private final int level; private final int _level;
// not needed, just for easier debug // Not needed, just for easier debugging.
private final String name; private final String _name;
private final int spCost; private final int _spCost;
private final int baseLevel; private final int _baseLevel;
private final int minSkillLevel; private final int _minSkillLevel;
private final int exp; private final int _exp;
private final byte rate76; private final byte _rate76;
private final byte rate77; private final byte _rate77;
private final byte rate78; private final byte _rate78;
private final byte rate79; private final byte _rate79;
private final byte rate80; private final byte _rate80;
public EnchantSkillLearn(int id, int level, int minSkillLevel, int baseLevel, String name, int spCost, int exp, byte rate76, byte rate77, byte rate78, byte rate79, byte rate80) public EnchantSkillLearn(int id, int level, int minSkillLevel, int baseLevel, String name, int spCost, int exp, byte rate76, byte rate77, byte rate78, byte rate79, byte rate80)
{ {
this.id = id; _id = id;
this.level = level; _level = level;
this.baseLevel = baseLevel; _baseLevel = baseLevel;
this.minSkillLevel = minSkillLevel; _minSkillLevel = minSkillLevel;
this.name = name.intern(); _name = name.intern();
this.spCost = spCost; _spCost = spCost;
this.exp = exp; _exp = exp;
this.rate76 = rate76; _rate76 = rate76;
this.rate77 = rate77; _rate77 = rate77;
this.rate78 = rate78; _rate78 = rate78;
this.rate79 = rate79; _rate79 = rate79;
this.rate80 = rate80; _rate80 = rate80;
} }
/**
* @return Returns the id.
*/
public int getId() public int getId()
{ {
return id; return _id;
} }
/**
* @return Returns the level.
*/
public int getLevel() public int getLevel()
{ {
return level; return _level;
} }
/**
* @return Returns the minLevel.
*/
public int getBaseLevel() public int getBaseLevel()
{ {
return baseLevel; return _baseLevel;
} }
/**
* @return Returns the minSkillLevel.
*/
public int getMinSkillLevel() public int getMinSkillLevel()
{ {
return minSkillLevel; return _minSkillLevel;
} }
/**
* @return Returns the name.
*/
public String getName() public String getName()
{ {
return name; return _name;
} }
/**
* @return Returns the spCost.
*/
public int getSpCost() public int getSpCost()
{ {
return spCost; return _spCost;
} }
public int getExp() public int getExp()
{ {
return exp; return _exp;
} }
public byte getRate(Player ply) public byte getRate(Player ply)
@@ -111,32 +93,32 @@ public class EnchantSkillLearn
{ {
case 76: case 76:
{ {
result = rate76; result = _rate76;
break; break;
} }
case 77: case 77:
{ {
result = rate77; result = _rate77;
break; break;
} }
case 78: case 78:
{ {
result = rate78; result = _rate78;
break; break;
} }
case 79: case 79:
{ {
result = rate79; result = _rate79;
break; break;
} }
case 80: case 80:
{ {
result = rate80; result = _rate80;
break; break;
} }
default: default:
{ {
result = rate80; result = _rate80;
break; break;
} }
} }