public static ExperiencePacket UpdateExperienceLevel(ExperiencePacket packet) { ExperiencePacket returnValue = packet; if (packet.Level < 16) { if (packet.Experience >= (2 * packet.Level) + 7) { returnValue.Level++; returnValue.Experience = 0; LeveledUpEvent(packet.UserID, returnValue.Level); } } else if (packet.Level < 32) { if (packet.Experience >= (5 * packet.Level) - 39) { returnValue.Level++; returnValue.Experience = 0; LeveledUpEvent(packet.UserID, returnValue.Level); } } else { if (packet.Experience >= (7 * packet.Level) - 159) { returnValue.Level++; returnValue.Experience = 0; LeveledUpEvent(packet.UserID, returnValue.Level); } } return(returnValue); }
public static ExperiencePacket operator +(ExperiencePacket basePacket, ExperiencePacket addition) { ExperiencePacket returnValue = basePacket; returnValue.Level += addition.Level; returnValue.Experience += addition.Experience; return(UpdateExperienceLevel(returnValue)); }