Skip to content

Instantly share code, notes, and snippets.

@hastinbe
Last active March 10, 2016 19:04
Show Gist options
  • Select an option

  • Save hastinbe/7a8934162d7b84ceff9c to your computer and use it in GitHub Desktop.

Select an option

Save hastinbe/7a8934162d7b84ceff9c to your computer and use it in GitHub Desktop.
public class Vocation
{
private long xp;
public readonly string PlayerName;
public int Level;
public long XP
{
get
{
return xp;
}
private set
{
long nextLevelExp = getLevelXp(Level + 1);
if (value >= nextLevelExp)
{
Level++;
XP = 0;
player.SendInfoMessage(cClass.Resources.INFO_LEVELUP, Level);
}
else
{
int change = Main.rand.Next(0, 100);
if (change <= 5)
{
long percent = value * 100 / nextLevelExp;
NetMessage.SendData(Convert.ToInt32(PacketTypes.CreateCombatText), -1, -1,
string.Format(cClass.Resources.INFO_LEVELHINT, 100 - percent),
Convert.ToInt32(Color.Gold.PackedValue),
player.X, player.Y);
}
xp = value;
}
}
}
protected TSPlayer player;
protected virtual float MELEE_VOCATION_CONSTANT { get { return 2f; } }
protected virtual float RANGED_VOCATION_CONSTANT { get { return 2f; } }
protected virtual float MAGIC_VOCATION_CONSTANT { get { return 3f; } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment