mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-10 09:22:49 +00:00
NPC skills added, updated item template
Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
49
src/main/java/com/l2jserver/service/game/LotteryService.java
Normal file
49
src/main/java/com/l2jserver/service/game/LotteryService.java
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.service.game;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.service.Service;
|
||||
|
||||
/**
|
||||
* This service handles lottery. Bets and results are done trough this service.
|
||||
* Please note that implementations can be complete random or they can use an
|
||||
* algorithm that manipulate results so that an character is more likely to win.
|
||||
* Even if the algorithm is manipulating results, it should not try to
|
||||
* discriminate players and chances of winning must be equal per ticket.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface LotteryService extends Service {
|
||||
/**
|
||||
* Bets an certain number sequence.
|
||||
*
|
||||
* @param character
|
||||
* the character betting
|
||||
* @param n1
|
||||
* the first number
|
||||
* @param n2
|
||||
* the second number
|
||||
* @param n3
|
||||
* the third number
|
||||
* @param n4
|
||||
* the fourth number
|
||||
* @param n5
|
||||
* the fifth number
|
||||
*/
|
||||
void bet(L2Character character, int n1, int n2, int n3, int n4, int n5);
|
||||
}
|
||||
@@ -87,17 +87,23 @@ public class SpawnServiceImpl extends AbstractService implements SpawnService {
|
||||
throws SpawnPointNotFoundServiceException,
|
||||
AlreadySpawnedServiceException {
|
||||
Preconditions.checkNotNull(object, "object");
|
||||
// only set the new position if needed, this could cause a lot of
|
||||
// database updates if update is done unnecessarily
|
||||
boolean updatePoint = true;
|
||||
// sanitize
|
||||
if (point == null)
|
||||
if (point == null) {
|
||||
// retrieving stored point
|
||||
point = object.getPoint();
|
||||
updatePoint = false;
|
||||
}
|
||||
if (point == null) {
|
||||
// not point send and no point stored, aborting
|
||||
// not point in argument and no point stored, aborting
|
||||
throw new SpawnPointNotFoundServiceException();
|
||||
}
|
||||
|
||||
// set the spawning point
|
||||
object.setPoint(point);
|
||||
if (updatePoint)
|
||||
object.setPoint(point);
|
||||
// reset actor state
|
||||
if (object instanceof Actor) {
|
||||
((Actor) object).setState(null);
|
||||
|
||||
@@ -53,6 +53,7 @@ import com.l2jserver.service.core.vfs.VFSService;
|
||||
import com.l2jserver.util.jaxb.CharacterTemplateIDAdapter;
|
||||
import com.l2jserver.util.jaxb.ItemTemplateIDAdapter;
|
||||
import com.l2jserver.util.jaxb.NPCTemplateIDAdapter;
|
||||
import com.l2jserver.util.jaxb.SkillTemplateIDAdapter;
|
||||
import com.l2jserver.util.jaxb.TeleportationTemplateIDAdapter;
|
||||
import com.l2jserver.util.vfs.ExtensionFileSelector;
|
||||
|
||||
@@ -68,6 +69,7 @@ public class XMLTemplateService extends AbstractService implements
|
||||
private final XMLTemplateServiceConfiguration config;
|
||||
private final NPCTemplateIDAdapter npcTemplateIdAdapter;
|
||||
private final ItemTemplateIDAdapter itemTemplateIdAdapter;
|
||||
private final SkillTemplateIDAdapter skillTemplateIdAdapter;
|
||||
private final CharacterTemplateIDAdapter charIdTemplateAdapter;
|
||||
private final TeleportationTemplateIDAdapter teleportationIdTemplateAdapter;
|
||||
|
||||
@@ -82,6 +84,7 @@ public class XMLTemplateService extends AbstractService implements
|
||||
CacheService cacheService, ConfigurationService configService,
|
||||
NPCTemplateIDAdapter npcTemplateIdAdapter,
|
||||
ItemTemplateIDAdapter itemTemplateIdAdapter,
|
||||
SkillTemplateIDAdapter skillTemplateIdAdapter,
|
||||
CharacterTemplateIDAdapter charIdTemplateAdapter,
|
||||
TeleportationTemplateIDAdapter teleportationIdTemplateAdapter) {
|
||||
this.vfsService = vfsService;
|
||||
@@ -89,6 +92,7 @@ public class XMLTemplateService extends AbstractService implements
|
||||
this.config = configService.get(XMLTemplateServiceConfiguration.class);
|
||||
this.npcTemplateIdAdapter = npcTemplateIdAdapter;
|
||||
this.itemTemplateIdAdapter = itemTemplateIdAdapter;
|
||||
this.skillTemplateIdAdapter = skillTemplateIdAdapter;
|
||||
this.charIdTemplateAdapter = charIdTemplateAdapter;
|
||||
this.teleportationIdTemplateAdapter = teleportationIdTemplateAdapter;
|
||||
}
|
||||
@@ -109,6 +113,8 @@ public class XMLTemplateService extends AbstractService implements
|
||||
npcTemplateIdAdapter);
|
||||
unmarshaller.setAdapter(ItemTemplateIDAdapter.class,
|
||||
itemTemplateIdAdapter);
|
||||
unmarshaller.setAdapter(SkillTemplateIDAdapter.class,
|
||||
skillTemplateIdAdapter);
|
||||
unmarshaller.setAdapter(CharacterTemplateIDAdapter.class,
|
||||
charIdTemplateAdapter);
|
||||
unmarshaller.setAdapter(TeleportationTemplateIDAdapter.class,
|
||||
|
||||
Reference in New Issue
Block a user