1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-11 09:42:54 +00:00

Implemented XML templates

This commit is contained in:
2011-05-24 22:55:31 -03:00
parent 6497016e14
commit cc44946831
10377 changed files with 309163 additions and 6171 deletions

View File

@@ -25,9 +25,7 @@ import com.l2jserver.model.id.object.ClanID;
import com.l2jserver.model.id.object.PetID;
import com.l2jserver.model.id.template.CharacterTemplateID;
import com.l2jserver.model.template.CharacterTemplate;
import com.l2jserver.model.world.actor.ActorAttributes;
import com.l2jserver.model.world.character.CharacterAppearance;
import com.l2jserver.model.world.character.CharacterCalculatedAttributes;
import com.l2jserver.model.world.character.CharacterClass;
import com.l2jserver.model.world.character.CharacterFriendList;
import com.l2jserver.model.world.character.CharacterInventory;
@@ -62,14 +60,6 @@ public class L2Character extends Player {
* The appearance of this character
*/
private final CharacterAppearance appearance = new CharacterAppearance(this);
/**
* The base attributes of this character
*/
private final CharacterTemplate.ActorBaseAttributes baseAttributes;
/**
* The attributes of this character
*/
private final ActorAttributes attributes;
/**
* The list of friend of this character
*/
@@ -200,8 +190,6 @@ public class L2Character extends Player {
*/
public L2Character(CharacterTemplateID templateID) {
super(templateID);
this.baseAttributes = templateID.getTemplate().getBaseAttributes();
this.attributes = new CharacterCalculatedAttributes(this);
}
/**
@@ -463,6 +451,13 @@ public class L2Character extends Player {
this.state = state;
}
/**
* @return true if character is doing nothing
*/
public boolean isIdle() {
return state == null;
}
/**
* @return true if character is being teleported
*/
@@ -534,20 +529,6 @@ public class L2Character extends Player {
return appearance;
}
/**
* @return the base attributes
*/
public CharacterTemplate.ActorBaseAttributes getBaseAttributes() {
return baseAttributes;
}
/**
* @return the attributes
*/
public ActorAttributes getAttributes() {
return attributes;
}
/**
* @return the friendList
*/

View File

@@ -23,9 +23,8 @@ import com.l2jserver.model.template.NPCTemplate;
import com.l2jserver.service.game.ai.AIScript;
/**
* NPC stand for "Not Playable Character" and is an character that not player
* has control over it. In most cases they are controlled by an {@link AIScript}
* .
* NPC stand for "Not Playable Character" and is an character that no player has
* control over it. In most cases they are controlled by an {@link AIScript} .
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
@@ -61,7 +60,7 @@ public class NPC extends Actor {
}
public double getMaxHP() {
return this.getTemplate().getMaxHP();
return this.getTemplate().getMaximumHP();
}
public void setMaxHP(double maxHP) {
@@ -69,13 +68,13 @@ public class NPC extends Actor {
}
public double getMaxMP() {
return this.getTemplate().getMaxHP();
return this.getTemplate().getMaximumMP();
}
public void setMaxMP(double maxMP) {
throw new UnsupportedOperationException();
}
@Override
public long getExperience() {
return this.getTemplate().getExperience();
@@ -88,7 +87,7 @@ public class NPC extends Actor {
@Override
public int getSP() {
return this.getTemplate().getSp();
return this.getTemplate().getSP();
}
@Override

View File

@@ -1,124 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver 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.
*
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.actor;
import com.l2jserver.model.template.ActorTemplate;
/**
* Defines attributes of the character. Implementations can use an static value
* (i.e. from {@link ActorTemplate}) or can use an calculator to define values,
* composed from many attributes objects.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public interface ActorAttributes {
/**
* @return the intelligence
*/
public int getIntelligence();
/**
* @return the strength
*/
public int getStrength();
/**
* @return the concentration
*/
public int getConcentration();
/**
* @return the mentality
*/
public int getMentality();
/**
* @return the dexterity
*/
public int getDexterity();
/**
* @return the witness
*/
public int getWitness();
/**
* @return the physicalAttack
*/
public double getPhysicalAttack();
/**
* @return the magicalAttack
*/
public double getMagicalAttack();
/**
* @return the physicalDefense
*/
public double getPhysicalDefense();
/**
* @return the magicalDefense
*/
public double getMagicalDefense();
/**
* @return the attackSpeed
*/
public int getAttackSpeed();
/**
* @return the castSpeed
*/
public int getCastSpeed();
/**
* @return the accuracy
*/
public int getAccuracy();
/**
* @return the criticalChance
*/
public int getCriticalChance();
/**
* @return the evasionChance
*/
public int getEvasionChance();
/**
* @return the run speed
*/
public double getRunSpeed();
/**
* @return the walking speed
*/
public double getWalkSpeed();
/**
* @return the maxWeigth
*/
public int getMaxWeigth();
/**
* @return the craft
*/
public boolean canCraft();
}

View File

@@ -1,142 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver 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.
*
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.character;
import com.l2jserver.model.template.CharacterTemplate;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.actor.ActorAttributes;
/**
* This {@link ActorAttributes} implementation calculates the <b>real</b>
* character attributes based on it's {@link CharacterTemplate} and active
* buffs.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterCalculatedAttributes implements ActorAttributes {
/**
* The character
*/
private final L2Character character;
/**
* The base attributes (from {@link CharacterTemplate})
*/
private final ActorAttributes baseAttributes;
public CharacterCalculatedAttributes(L2Character character) {
this.character = character;
this.baseAttributes = this.character.getBaseAttributes();
}
@Override
public int getIntelligence() {
return baseAttributes.getIntelligence();
}
@Override
public int getStrength() {
return baseAttributes.getStrength();
}
@Override
public int getConcentration() {
return baseAttributes.getConcentration();
}
@Override
public int getMentality() {
return baseAttributes.getMentality();
}
@Override
public int getDexterity() {
return baseAttributes.getDexterity();
}
@Override
public int getWitness() {
return baseAttributes.getWitness();
}
@Override
public double getPhysicalAttack() {
return baseAttributes.getPhysicalAttack();
}
@Override
public double getMagicalAttack() {
return baseAttributes.getMagicalAttack();
}
@Override
public double getPhysicalDefense() {
return baseAttributes.getPhysicalDefense();
}
@Override
public double getMagicalDefense() {
return baseAttributes.getMagicalDefense();
}
@Override
public int getAttackSpeed() {
return baseAttributes.getAttackSpeed();
}
@Override
public int getCastSpeed() {
return baseAttributes.getCastSpeed();
}
@Override
public int getAccuracy() {
return baseAttributes.getAccuracy();
}
@Override
public int getCriticalChance() {
return baseAttributes.getCriticalChance();
}
@Override
public int getEvasionChance() {
return baseAttributes.getEvasionChance();
}
@Override
public double getRunSpeed() {
return baseAttributes.getRunSpeed();
}
@Override
public double getWalkSpeed() {
//FIXME this is a temporary work arround
return getRunSpeed();
//return baseAttributes.getWalkSpeed();
}
@Override
public int getMaxWeigth() {
return baseAttributes.getMaxWeigth();
}
@Override
public boolean canCraft() {
return baseAttributes.canCraft();
}
}

View File

@@ -212,6 +212,10 @@ public class CharacterStats {
public int getEvasionRate() {
return (int) calc(StatType.EVASION_RATE);
}
public int getMaximumLoad() {
return (int) calc(StatType.MAX_LOAD);
}
// public void add(StatType type, Calculator<?> calculator) {
// getCalculator(type).importFunctions(calculator);

View File

@@ -32,7 +32,7 @@ public class BaseAttackAccuracyCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getAccuracy();
ctx.result = c.getTemplate().getBaseAccuracy();
}
}, new AbstractFunction<L2Character>(0x100) {
@Override

View File

@@ -32,7 +32,7 @@ public class BaseAttackEvasionCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getEvasionChance();
ctx.result = c.getTemplate().getBaseEvasion();
}
}, new AbstractFunction<L2Character>(0x100) {
@Override

View File

@@ -32,7 +32,7 @@ public class BaseCPCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getCpBase();
ctx.result = c.getTemplate().getBaseCP();
}
}, new AbstractFunction<L2Character>(0x100) {
@Override
@@ -40,9 +40,9 @@ public class BaseCPCalculator extends CharacterCalculator {
final CharacterTemplate template = c.getTemplate();
int lvl = c.getLevel() - template.getMinimumLevel();
double mod = template.getCpMultiplier() * lvl;
double max = (template.getCpAdd() + mod) * lvl;
double min = (template.getCpAdd() * lvl) + mod;
double mod = template.getBaseCPModifier() * lvl;
double max = (template.getBaseCPAdd() + mod) * lvl;
double min = (template.getBaseCPAdd() * lvl) + mod;
ctx.result += (max + min) / 2;
}

View File

@@ -29,7 +29,7 @@ public class BaseConcentrationCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getConcentration();
ctx.result = c.getTemplate().getBaseConcentration();
}
});
}

View File

@@ -29,7 +29,7 @@ public class BaseDexterityCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getDextry();
ctx.result = c.getTemplate().getBaseDexterity();
}
});
}

View File

@@ -32,7 +32,7 @@ public class BaseHPCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getHpBase();
ctx.result = c.getTemplate().getBaseHP();
}
}, new AbstractFunction<L2Character>(0x100) {
@Override
@@ -40,9 +40,9 @@ public class BaseHPCalculator extends CharacterCalculator {
final CharacterTemplate template = c.getTemplate();
int lvl = c.getLevel() - template.getMinimumLevel();
double mod = template.getHpMultiplier() * lvl;
double max = (template.getHpAdd() + mod) * lvl;
double min = (template.getHpAdd() * lvl) + mod;
double mod = template.getBaseHP() * lvl;
double max = (template.getBaseHPAdd() + mod) * lvl;
double min = (template.getBaseHPAdd() * lvl) + mod;
ctx.result += (max + min) / 2;
}

View File

@@ -0,0 +1,150 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver 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.
*
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.character.calculator;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.L2Character.CharacterMoveType;
import com.l2jserver.model.world.actor.stat.BaseStats;
import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public class BaseHPRegenerationCalculator extends CharacterCalculator {
/**
* Retail value is 100
*/
public static final double HP_REGEN_MULTIPLIER = 100;
@SuppressWarnings("unchecked")
public BaseHPRegenerationCalculator() {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
// TODO set base hp regen
ctx.result = 0;
// initial value is changed here
ctx.result += (c.getLevel() > 10) ? ((c.getLevel() - 1) / 10.0)
: 0.5;
// Add CON bonus
ctx.result *= ((100.0 - 11 + c.getLevel()) / 100.0)
* BaseStats.CON.calculateBonus(c.getStats()
.getConcentration());
if (ctx.result < 0)
ctx.result = 0;
}
}, new AbstractFunction<L2Character>(Integer.MAX_VALUE) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
double hpRegenMultiplier = HP_REGEN_MULTIPLIER;
double hpRegenBonus = 0;
// TODO SevenSigns Festival modifier
// if (SevenSignsFestival.getInstance().isFestivalInProgress()
// && player.isFestivalParticipant())
// hpRegenMultiplier *= calcFestivalRegenModifier(player);
// else {
// double siegeModifier = calcSiegeRegenModifer(player);
// if (siegeModifier > 0)
// hpRegenMultiplier *= siegeModifier;
// }
// TODO clan hall regen
// if (player.isInsideZone(L2Character.ZONE_CLANHALL)
// && player.getClan() != null
// && player.getClan().getHasHideout() > 0) {
// L2ClanHallZone zone = ZoneManager.getInstance().getZone(
// player, L2ClanHallZone.class);
// int posChIndex = zone == null ? -1 : zone.getClanHallId();
// int clanHallIndex = player.getClan().getHasHideout();
// if (clanHallIndex > 0 && clanHallIndex == posChIndex) {
// ClanHall clansHall = ClanHallManager.getInstance()
// .getClanHallById(clanHallIndex);
// if (clansHall != null)
// if (clansHall.getFunction(ClanHall.FUNC_RESTORE_HP) != null)
// hpRegenMultiplier *= 1 + (double) clansHall
// .getFunction(ClanHall.FUNC_RESTORE_HP)
// .getLvl() / 100;
// }
// }
// TODO castle regen
// if (player.isInsideZone(L2Character.ZONE_CASTLE)
// && player.getClan() != null
// && player.getClan().getHasCastle() > 0) {
// L2CastleZone zone = ZoneManager.getInstance().getZone(
// player, L2CastleZone.class);
// int posCastleIndex = zone == null ? -1 : zone.getCastleId();
// int castleIndex = player.getClan().getHasCastle();
// if (castleIndex > 0 && castleIndex == posCastleIndex) {
// Castle castle = CastleManager.getInstance()
// .getCastleById(castleIndex);
// if (castle != null)
// if (castle.getFunction(Castle.FUNC_RESTORE_HP) != null)
// hpRegenMultiplier *= 1 + (double) castle
// .getFunction(Castle.FUNC_RESTORE_HP)
// .getLvl() / 100;
// }
// }
// TODO fort regen
// if (player.isInsideZone(L2Character.ZONE_FORT)
// && player.getClan() != null
// && player.getClan().getHasFort() > 0) {
// L2FortZone zone = ZoneManager.getInstance().getZone(player,
// L2FortZone.class);
// int posFortIndex = zone == null ? -1 : zone.getFortId();
// int fortIndex = player.getClan().getHasFort();
// if (fortIndex > 0 && fortIndex == posFortIndex) {
// Fort fort = FortManager.getInstance().getFortById(
// fortIndex);
// if (fort != null)
// if (fort.getFunction(Fort.FUNC_RESTORE_HP) != null)
// hpRegenMultiplier *= 1 + (double) fort
// .getFunction(Fort.FUNC_RESTORE_HP)
// .getLvl() / 100;
// }
// }
// TODO Mother Tree effect is calculated at last
// if (player.isInsideZone(L2Character.ZONE_MOTHERTREE)) {
// L2MotherTreeZone zone = ZoneManager.getInstance().getZone(
// player, L2MotherTreeZone.class);
// int hpBonus = zone == null ? 0 : zone.getHpRegenBonus();
// hpRegenBonus += hpBonus;
// }
// Calculate Movement bonus
// if (player.isSitting())
// hpRegenMultiplier *= 1.5; // Sitting
// else
if (c.isIdle())
hpRegenMultiplier *= 1.1; // Staying
else if (c.getMoveType() == CharacterMoveType.RUN)
hpRegenMultiplier *= 0.7; // Running
ctx.result = ctx.result * hpRegenMultiplier + hpRegenBonus;
}
});
}
}

View File

@@ -29,7 +29,7 @@ public class BaseIntelligenceCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getIntelligence();
ctx.result = c.getTemplate().getBaseIntelligence();
}
});
}

View File

@@ -32,7 +32,7 @@ public class BaseMPCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getMpBase();
ctx.result = c.getTemplate().getBaseBaseMP();
}
}, new AbstractFunction<L2Character>(0x100) {
@Override
@@ -40,9 +40,9 @@ public class BaseMPCalculator extends CharacterCalculator {
final CharacterTemplate template = c.getTemplate();
int lvl = c.getLevel() - template.getMinimumLevel();
double mod = template.getMpMultiplier() * lvl;
double max = (template.getMpAdd() + mod) * lvl;
double min = (template.getMpAdd() * lvl) + mod;
double mod = template.getBaseMPModifier() * lvl;
double max = (template.getBaseMPAdd() + mod) * lvl;
double min = (template.getBaseMPAdd() * lvl) + mod;
ctx.result += (max + min) / 2;
}

View File

@@ -31,7 +31,7 @@ public class BaseMagicalAttackCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getMagicalAttack();
ctx.result = c.getTemplate().getBaseMagicalAttack();
}
}, new AbstractFunction<L2Character>(0x200) {
@Override

View File

@@ -31,7 +31,7 @@ public class BaseMagicalAttackSpeedCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getCastSpeed();
ctx.result = c.getTemplate().getBaseMagicalAttackSpeed();
}
}, new AbstractFunction<L2Character>(0x200) {
@Override

View File

@@ -31,7 +31,7 @@ public class BaseMagicalCriticalRateCalculator extends CharacterCalculator {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
// XXX is the same as physical????
ctx.result = c.getTemplate().getCriticalChance();
ctx.result = c.getTemplate().getBaseCritical();
}
}, new AbstractFunction<L2Character>(0x300) {
@Override

View File

@@ -37,7 +37,7 @@ public class BaseMagicalDefenseCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getMagicalDefense();
ctx.result = c.getTemplate().getBaseMagicalDefense();
}
}, new AbstractFunction<L2Character>(0x200) {
@Override

View File

@@ -29,7 +29,7 @@ public class BaseMentalityCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getMentality();
ctx.result = c.getTemplate().getBaseMentality();
}
});
}

View File

@@ -31,7 +31,7 @@ public class BasePhysicalAttackCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getPhysicalAttack();
ctx.result = c.getTemplate().getBasePhysicalAttack();
}
}, new AbstractFunction<L2Character>(0x100) {
@Override

View File

@@ -31,7 +31,7 @@ public class BasePhysicalAttackSpeedCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getAttackSpeed();
ctx.result = c.getTemplate().getBasePhysicalAttackSpeed();
}
}, new AbstractFunction<L2Character>(0x200) {
@Override

View File

@@ -30,7 +30,7 @@ public class BasePhysicalCriticalRateCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getCriticalChance();
ctx.result = c.getTemplate().getBaseCritical();
}
}, new AbstractFunction<L2Character>(0x090) {
@Override

View File

@@ -39,7 +39,7 @@ public class BasePhysicalDefenseCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getPhysicalDefense();
ctx.result = c.getTemplate().getBasePhysicalDefense();
}
}, new AbstractFunction<L2Character>(0x200) {
@Override

View File

@@ -31,7 +31,7 @@ public class BaseRunSpeedCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getRunSpeed();
ctx.result = c.getTemplate().getBaseRunSpeed();
}
}, new AbstractFunction<L2Character>(0x300) {
@Override

View File

@@ -29,7 +29,7 @@ public class BaseStrengthCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getStrength();
ctx.result = c.getTemplate().getBaseStrength();
}
});
}

View File

@@ -31,7 +31,7 @@ public class BaseWalkSpeedCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getWalkSpeed();
ctx.result = c.getTemplate().getBaseWalkSpeed();
}
}, new AbstractFunction<L2Character>(0x300) {
@Override

View File

@@ -29,7 +29,7 @@ public class BaseWitnessCalculator extends CharacterCalculator {
super(new AbstractFunction<L2Character>(0x000) {
@Override
public void calculate(L2Character c, CalculatorContext ctx) {
ctx.result = c.getTemplate().getMentality();
ctx.result = c.getTemplate().getBaseWitness();
}
});
}

View File

@@ -0,0 +1,34 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver 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.
*
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.npc;
import com.l2jserver.model.id.template.NPCTemplateID;
import com.l2jserver.model.world.NPC;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public class Teleporter extends NPC {
/**
* @param templateID
* the NPC template ID
*/
public Teleporter(NPCTemplateID templateID) {
super(templateID);
}
}

View File

@@ -0,0 +1,83 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver 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.
*
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.npc.controller;
import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.model.template.NPCTemplate;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.NPC;
import com.l2jserver.util.exception.L2Exception;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public class NPCController {
/**
* The {@link NPC} instance
*/
protected final NPC npc;
/**
* The {@link NPC} template
*/
protected final NPCTemplate template;
/**
* Creates a new instance
*
* @param npc
* the {@link NPC}
*/
public NPCController(NPC npc) {
this.npc = npc;
this.template = null;
}
/**
* Performs an interaction with this template.
*
* @param character
* the interacting character
* @param args
* the action arguments
* @throws L2Exception
* any {@link L2Exception}
*/
public void action(NPC npc, L2Character character, String... args)
throws L2Exception {
}
/**
* Talks with this NPC
*
* @param npc
* the npc
* @param character
* the character
* @param conn
* the lineage 2 connection
* @param args
* the action arguments
* @throws L2Exception
*/
protected void talk(NPC npc, L2Character character,
Lineage2Connection conn, String... args) throws L2Exception {
conn.sendActionFailed();
}
}

View File

@@ -0,0 +1,38 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver 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.
*
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.npc.controller;
import com.l2jserver.model.world.NPC;
import com.l2jserver.service.game.spawn.SpawnService;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public class TeleporterController extends NPCController {
/**
* The {@link SpawnService}
*/
protected SpawnService spawnService;
/**
* @param npc
*/
public TeleporterController(NPC npc) {
super(npc);
}
}