Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final boolean pollAge(int maxAge)
- {
- boolean rebornPoll = false;
- if ((this.reborn) && (this.mother == -10L)) {
- if (WurmCalendar.currentTime - this.lastPolledAge > 604800L) {
- rebornPoll = true;
- }
- }
- if ((WurmCalendar.currentTime - this.lastPolledAge > ((Servers.localServer.PVPSERVER) && (this.age < 8) && (this.statusHolder.getTemplate().getTemplateId() == 65) ? 259200L : 2419200L)) || (rebornPoll))
- {
- if (((this.statusHolder.isGhost()) || (this.statusHolder.isKingdomGuard()) || (this.statusHolder.isUnique())) && ((!this.reborn) || (this.mother == -10L))) {
- this.age = Math.max(this.age, 11);
- }
- int newAge = this.age + 1;
- boolean updated = false;
- if ((!this.statusHolder.isCaredFor()) && ((newAge >= maxAge) || (
- (isTraitBitSet(13)) && (newAge >= Math.max(1, maxAge - Server.rand
- .nextInt(maxAge / 2)))))) {
- return true;
- }
- if (!rebornPoll)
- {
- if (newAge > (isTraitBitSet(21) ? 75 : 50)) {
- if ((!this.statusHolder.isGhost()) && (!this.statusHolder.isHuman()) && (!this.statusHolder.isUnique()) &&
- (!this.statusHolder.isCaredFor())) {
- return true;
- }
- }
- if ((newAge - 1 >= 5) && (!this.reborn)) {
- if ((getTemplate().getAdultMaleTemplateId() > -1) ||
- (getTemplate().getAdultFemaleTemplateId() > -1))
- {
- int newtemplateId = getTemplate().getAdultMaleTemplateId();
- if ((this.sex == 1) && (getTemplate().getAdultFemaleTemplateId() > -1)) {
- newtemplateId = getTemplate().getAdultFemaleTemplateId();
- }
- if (newtemplateId != getTemplate().getTemplateId())
- {
- newAge = 1;
- try
- {
- updateAge(newAge);
- updated = true;
- }
- catch (IOException iox)
- {
- logger.log(Level.WARNING, iox.getMessage(), iox);
- }
- try
- {
- setChanged(true);
- CreatureTemplate newTemplate = CreatureTemplateFactory.getInstance().getTemplate(newtemplateId);
- this.template = newTemplate;
- this.statusHolder.template = this.template;
- if (!this.statusHolder.isNpc())
- {
- if ((this.statusHolder.getMother() == -10L) || ((!this.statusHolder.isHorse()) && (!this.reborn))) {
- try
- {
- if (this.statusHolder.getName().endsWith("traitor")) {
- this.statusHolder.setName(this.template.getName() + " traitor");
- } else {
- this.statusHolder.setName(this.template.getName());
- }
- }
- catch (Exception ex)
- {
- logger.log(Level.WARNING, ex.getMessage(), ex);
- }
- }
- if ((!this.reborn) || (this.mother == -10L)) {
- try
- {
- this.statusHolder.skills.delete();
- this.statusHolder.skills.clone(newTemplate.getSkills().getSkills());
- this.statusHolder.skills.save();
- }
- catch (Exception ex)
- {
- logger.log(Level.WARNING, ex.getMessage(), ex);
- }
- }
- }
- save();
- this.statusHolder.setVisible(false);
- this.statusHolder.setVisible(true);
- }
- catch (NoSuchCreatureTemplateException nsc)
- {
- logger.log(Level.WARNING, this.statusHolder
- .getName() + ", " + this.statusHolder.getWurmId() + ": " + nsc.getMessage(), nsc);
- }
- catch (IOException iox)
- {
- logger.log(Level.WARNING, this.statusHolder
- .getName() + ", " + this.statusHolder.getWurmId() + ": " + iox.getMessage(), iox);
- }
- }
- }
- }
- }
- if (!updated) {
- try
- {
- updateAge(newAge);
- if ((this.statusHolder.getHitched() != null) && (!this.statusHolder.getHitched().isAnySeatOccupied(false))) {
- if ((!this.statusHolder.isDomestic()) && (getBattleRatingTypeModifier() > 1.2F))
- {
- Server.getInstance().broadCastMessage(this.statusHolder.getName() + " stops dragging a " +
- Vehicle.getVehicleName(this.statusHolder.getHitched()) + ".", this.statusHolder
- .getTileX(), this.statusHolder.getTileY(), this.statusHolder.isOnSurface(), 5);
- if (this.statusHolder.getHitched().removeDragger(this.statusHolder)) {
- this.statusHolder.setHitched(null, false);
- }
- }
- }
- }
- catch (IOException iox)
- {
- logger.log(Level.WARNING, iox.getMessage(), iox);
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement