 |
|

07.08.2015, 19:51
|
|
Флудер
Регистрация: 20.01.2015
Сообщений: 7,201
С нами:
5952720
Репутация:
6527
|
|
Смотрим чудо спавн:
-->
Вот это да, какая реализация и не сделаны banned территории, но всё согласно же официальному контенту. Но это осталось с оверов, а мозгов реализовать не хватило притом, что оверы парсили с офф скриптов, но как говорит гринд это придумали масоны. Про миньенов и точечный спавн молчу это нужно переписывать и да супер менеджер работающий с бд конечно же:
Сообщение от Спойлер
package core.gameserver.instancemanager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import core.commons.dbutils.DbUtils;
import core.commons.threading.RunnableImpl;
import core.commons.util.Rnd;
import core.gameserver.Announcements;
import core.gameserver.Config;
import core.gameserver.ThreadPoolManager;
import core.gameserver.data.xml.holder.NpcHolder;
import core.gameserver.data.xml.holder.ResidenceHolder;
import core.gameserver.database.DatabaseFactory;
import core.gameserver.idfactory.IdFactory;
import core.gameserver.model.base.Race;
import core.gameserver.model.Creature;
import core.gameserver.model.Player;
import core.gameserver.model.SimpleSpawner;
import core.gameserver.model.Spawner;
import core.gameserver.model.entity.residence.Castle;
import core.gameserver.model.instances.NpcInstance;
import core.gameserver.templates.mapregion.RestartArea;
import core.gameserver.templates.mapregion.RestartPoint;
import core.gameserver.templates.npc.NpcTemplate;
import core.gameserver.utils.HtmlUtils;
import core.gameserver.utils.Location;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AutoSpawnManager
{
private static final Logger _log = LoggerFactory.getLogger(AutoSpawnManager.class);
private static AutoSpawnManager _instance;
private static final int DEFAULT_INITIAL_SPAWN = 30000; // 30 seconds after registration
private static final int DEFAULT_RESPAWN = 3600000; //1 hour in millisecs
private static final int DEFAULT_DESPAWN = 3600000; //1 hour in millisecs
protected Map _registeredSpawns;
protected Map> _runningSpawns;
public AutoSpawnManager()
{
_registeredSpawns = new ConcurrentHashMap();
_runningSpawns = new ConcurrentHashMap>();
restoreSpawnData();
_log.info("AutoSpawnHandler: Loaded " + size() + " handlers in total.");
}
public static AutoSpawnManager getInstance()
{
if(_instance == null)
_instance = new AutoSpawnManager();
return _instance;
}
public final int size()
{
return _registeredSpawns.size();
}
private void restoreSpawnData()
{
int numLoaded = 0;
Connection con = null;
PreparedStatement statement = null;
PreparedStatement statement2 = null;
ResultSet rset = null, rset2 = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
// Restore spawn group data, then the location data.
statement = con.prepareStatement("SELECT * FROM random_spawn ORDER BY groupId ASC");
statement2 = con.prepareStatement("SELECT * FROM random_spawn_loc WHERE groupId=?");
rset = statement.executeQuery();
while(rset.next())
{
// Register random spawn group, set various options on the created spawn instance.
AutoSpawnInstance spawnInst = registerSpawn(rset.getInt("npcId"), rset.getInt("initialDelay"), rset.getInt("respawnDelay"), rset.getInt("despawnDelay"));
spawnInst.setSpawnCount(rset.getInt("count"));
spawnInst.setBroadcast(rset.getBoolean("broadcastS pawn"));
spawnInst.setRandomSpawn(rset.getBoolean("randomSp awn"));
numLoaded++;
// Restore the spawn locations for this spawn group/instance.
statement2.setInt(1, rset.getInt("groupId"));
rset2 = statement2.executeQuery();
while(rset2.next())
// Add each location to the spawn group/instance.
spawnInst.addSpawnLocation(rset2.getInt("x"), rset2.getInt("y"), rset2.getInt("z"), rset2.getInt("heading"));
DbUtils.close(rset2);
}
}
catch(Exception e)
{
_log.warn("AutoSpawnHandler: Could not restore spawn data: " + e);
}
finally
{
DbUtils.closeQuietly(statement2, rset2);
DbUtils.closeQuietly(con, statement, rset);
}
}
/**
* Registers a spawn with the given parameters with the spawner, and marks it as
* active. Returns a AutoSpawnInstance containing info about the spawn.
*
* @param int npcId
* @param int[][] spawnPoints
* @param int initialDelay (If Warning: Spawn locations must be specified separately using addSpawnLocation().
*
* @param int npcId
* @param int initialDelay (If respawnTask = _runningSpawns.remove(spawnInst._objectId);
respawnTask.cancel(false);
}
catch(Exception e)
{
_log.warn("AutoSpawnHandler: Could not auto spawn for NPC ID " + spawnInst._npcId + " (Object ID = " + spawnInst._objectId + "): " + e);
return false;
}
return true;
}
/**
* Remove a registered spawn from the list, specified by the given spawn object ID.
*
* @param int objectId
* @Return boolean removedSuccessfully
*/
public void removeSpawn(int objectId)
{
removeSpawn(_registeredSpawns.get(objectId));
}
/**
* Sets the active state of the specified spawn.
*
* @param AutoSpawnInstance spawnInst
* @param boolean isActive
*/
public void setSpawnActive(AutoSpawnInstance spawnInst, boolean isActive)
{
int objectId = spawnInst._objectId;
if(isSpawnRegistered(objectId))
{
ScheduledFuture spawnTask = null;
if(isActive)
{
AutoSpawner rset = new AutoSpawner(objectId);
if(spawnInst._desDelay > 0)
spawnTask = ThreadPoolManager.getInstance().scheduleAtFixedRat e(rset, spawnInst._initDelay, spawnInst._resDelay);
else
spawnTask = ThreadPoolManager.getInstance().schedule(rset, spawnInst._initDelay);
//spawnTask = ThreadPoolManager.getInstance().scheduleGeneralAtF ixedRate(rset, spawnInst._initDelay, spawnInst._resDelay);
_runningSpawns.put(objectId, spawnTask);
}
else
{
spawnTask = _runningSpawns.remove(objectId);
if(spawnTask != null)
spawnTask.cancel(false);
}
spawnInst.setSpawnActive(isActive);
}
}
/**
* Returns the number of milliseconds until the next occurrance of
* the given spawn.
*
* @param AutoSpawnInstance spawnInst
* @param long milliRemaining
*/
public final long getTimeToNextSpawn(AutoSpawnInstance spawnInst)
{
int objectId = spawnInst._objectId;
if(!isSpawnRegistered(objectId))
return -1;
return _runningSpawns.get(objectId).getDelay(TimeUnit.MIL LISECONDS);
}
/**
* Attempts to return the AutoSpawnInstance associated with the given NPC or Object ID type.
*
* Note: If isObjectId == false, returns first instance for the specified NPC ID.
*
* @param int id
* @param boolean isObjectId
* @Return AutoSpawnInstance spawnInst
*/
public final AutoSpawnInstance getAutoSpawnInstance(int id, boolean isObjectId)
{
if(isObjectId)
{
if(isSpawnRegistered(id))
return _registeredSpawns.get(id);
}
else
for(AutoSpawnInstance spawnInst : _registeredSpawns.values())
if(spawnInst._npcId == id)
return spawnInst;
return null;
}
public Map getAllAutoSpawnInstance(int id)
{
Map spawnInstList = new ConcurrentHashMap();
for(AutoSpawnInstance spawnInst : _registeredSpawns.values())
if(spawnInst._npcId == id)
spawnInstList.put(spawnInst._objectId, spawnInst);
return spawnInstList;
}
/**
* Tests if the specified object ID is assigned to an auto spawn.
*
* @param int objectId
* @Return boolean isAssigned
*/
public final boolean isSpawnRegistered(int objectId)
{
return _registeredSpawns.containsKey(objectId);
}
/**
* Tests if the specified spawn instance is assigned to an auto spawn.
*
* @param AutoSpawnInstance spawnInst
* @Return boolean isAssigned
*/
public final boolean isSpawnRegistered(AutoSpawnInstance spawnInst)
{
return _registeredSpawns.containsValue(spawnInst);
}
/**
* AutoSpawner Class
*
* This handles the main spawn task for an auto spawn instance, and initializes
* a despawner if required.
*
* @author Tempy
*/
private class AutoSpawner extends RunnableImpl
{
private int _objectId;
AutoSpawner(int objectId)
{
_objectId = objectId;
}
@Override
public void runImpl() throws Exception
{
try
{
// Retrieve the required spawn instance for this spawn task.
AutoSpawnInstance spawnInst = _registeredSpawns.get(_objectId);
// If the spawn is not scheduled to be active, cancel the spawn task.
if(!spawnInst.isSpawnActive() || Config.DONTLOADSPAWN)
return;
Location[] locationList = spawnInst.getLocationList();
// If there are no set co-ordinates, cancel the spawn task.
if(locationList.length == 0)
{
_log.info("AutoSpawnHandler: No location co-ords specified for spawn instance (Object ID = " + _objectId + ").");
return;
}
int locationCount = locationList.length;
int locationIndex = Rnd.get(locationCount);
/*
* If random spawning is disabled, the spawn at the next set of
* co-ordinates after the last. If the index is greater than the number
* of possible spawns, reset the counter to zero.
*/
if(!spawnInst.isRandomSpawn())
{
locationIndex = spawnInst._lastLocIndex;
locationIndex++;
if(locationIndex == locationCount)
locationIndex = 0;
spawnInst._lastLocIndex = locationIndex;
}
// Set the X, Y and Z co-ordinates, where this spawn will take place.
final int x = locationList[locationIndex].x;
final int y = locationList[locationIndex].y;
final int z = locationList[locationIndex].z;
final int heading = locationList[locationIndex].h;
// Fetch the template for this NPC ID and create a new spawn.
NpcTemplate npcTemp = NpcHolder.getInstance().getTemplate(spawnInst.getN pcId());
SimpleSpawner newSpawn = new SimpleSpawner(npcTemp);
newSpawn.setLocx(x);
newSpawn.setLocy;
newSpawn.setLocz(z);
if(heading != -1)
newSpawn.setHeading(heading);
newSpawn.setAmount(spawnInst.getSpawnCount());
if(spawnInst._desDelay == 0)
newSpawn.setRespawnDelay(spawnInst._resDelay);
// Add the new spawn information to the spawn table, but do not store it.
NpcInstance npcInst = null;
for(int i = 0; i 0)
{
AutoDespawner rd = new AutoDespawner(_objectId);
ThreadPoolManager.getInstance().schedule(rd, spawnInst.getDespawnDelay() - 1000);
}
}
catch(Exception e)
{
_log.warn("AutoSpawnHandler: An error occurred while initializing spawn instance (Object ID = " + _objectId + "): " + e);
_log.error("", e);
}
}
}
/**
* AutoDespawner Class
*
* Simply used as a secondary class for despawning an auto spawn instance.
*
* @author Tempy
*/
private class AutoDespawner extends RunnableImpl
{
private int _objectId;
AutoDespawner(int objectId)
{
_objectId = objectId;
}
@Override
public void runImpl() throws Exception
{
try
{
AutoSpawnInstance spawnInst = _registeredSpawns.get(_objectId);
for(NpcInstance npcInst : spawnInst.getAttackableList())
{
npcInst.deleteMe();
spawnInst.removeAttackable(npcInst);
}
}
catch(Exception e)
{
_log.warn("AutoSpawnHandler: An error occurred while despawning spawn (Object ID = " + _objectId + "): " + e);
}
}
}
/**
* AutoSpawnInstance Class
*
* Stores information about a registered auto spawn.
*
* @author Tempy
*/
public class AutoSpawnInstance
{
protected int _objectId;
protected int _spawnIndex;
protected int _npcId;
protected int _initDelay;
protected int _resDelay;
protected int _desDelay;
protected int _spawnCount = 1;
protected int _lastLocIndex = -1;
private List _npcList = new ArrayList();
private List _locList = new ArrayList();
private boolean _spawnActive;
private boolean _randomSpawn = false;
private boolean _broadcastAnnouncement = false;
protected AutoSpawnInstance(int npcId, int initDelay, int respawnDelay, int despawnDelay)
{
_npcId = npcId;
_initDelay = initDelay;
_resDelay = respawnDelay;
_desDelay = despawnDelay;
}
void setSpawnActive(boolean activeValue)
{
_spawnActive = activeValue;
}
boolean addAttackable(NpcInstance npcInst)
{
return _npcList.add(npcInst);
}
boolean removeAttackable(NpcInstance npcInst)
{
return _npcList.remove(npcInst);
}
public int getObjectId()
{
return _objectId;
}
public int getInitialDelay()
{
return _initDelay;
}
public int getRespawnDelay()
{
return _resDelay;
}
public int getDespawnDelay()
{
return _desDelay;
}
public int getNpcId()
{
return _npcId;
}
public int getSpawnCount()
{
return _spawnCount;
}
public Location[] getLocationList()
{
return _locList.toArray(new Location[_locList.size()]);
}
public NpcInstance[] getAttackableList()
{
return _npcList.toArray(new NpcInstance[_npcList.size()]);
}
public Spawner[] getSpawns()
{
List npcSpawns = new ArrayList();
for(NpcInstance npcInst : _npcList)
npcSpawns.add(npcInst.getSpawn());
return npcSpawns.toArray(new Spawner[npcSpawns.size()]);
}
public void setSpawnCount(int spawnCount)
{
_spawnCount = spawnCount;
}
public void setRandomSpawn(boolean randValue)
{
_randomSpawn = randValue;
}
public void setBroadcast(boolean broadcastValue)
{
_broadcastAnnouncement = broadcastValue;
}
public boolean isSpawnActive()
{
return _spawnActive;
}
public boolean isRandomSpawn()
{
return _randomSpawn;
}
public boolean isBroadcasting()
{
return _broadcastAnnouncement;
}
public boolean addSpawnLocation(int x, int y, int z, int heading)
{
return _locList.add(new Location(x, y, z, heading));
}
public boolean addSpawnLocation(int[] spawnLoc)
{
if(spawnLoc.length != 3)
return false;
return addSpawnLocation(spawnLoc[0], spawnLoc[1], spawnLoc[2], -1);
}
public Location removeSpawnLocation(int locIndex)
{
try
{
return _locList.remove(locIndex);
}
catch(IndexOutOfBoundsException e)
{
return null;
}
}
}
}
Сообщение от Спойлер
DROP TABLE IF EXISTS random_spawn;
CREATE TABLE random_spawn (
groupId INT NOT NULL default 0,
npcId INT NOT NULL default 0,
count INT NOT NULL default 0,
initialDelay BIGINT NOT NULL default -1,
respawnDelay BIGINT NOT NULL default -1,
despawnDelay BIGINT NOT NULL default -1,
broadcastSpawn enum('false','true') NOT NULL default 'false',
randomSpawn enum('false','true') NOT NULL default 'true',
PRIMARY KEY (groupId)
) ENGINE=MyISAM;
INSERT INTO `random_spawn` VALUES
(2,31111,1,-1,60,0,'false','false'),
(3,31112,1,-1,60,0,'false','false'),
(4,31113,1,-1,-1,-1,'true','true'),
(5,31126,1,-1,-1,-1,'true','true'),
(6,31094,1,-1,300000,300000,'false','true'),
(7,31094,1,-1,300000,300000,'false','true'),
(8,31094,1,-1,300000,300000,'false','true'),
(9,31094,1,-1,300000,300000,'false','true'),
(10,31094,1,-1,300000,300000,'false','true'),
(11,31094,1,-1,300000,300000,'false','true'),
(12,31094,1,-1,300000,300000,'false','true'),
(13,31094,1,-1,300000,300000,'false','true'),
(14,31093,1,-1,300000,300000,'false','true'),
(15,31093,1,-1,300000,300000,'false','true'),
(16,31093,1,-1,300000,300000,'false','true'),
(17,31093,1,-1,300000,300000,'false','true'),
(18,31093,1,-1,300000,300000,'false','true'),
(19,31093,1,-1,300000,300000,'false','true'),
(20,31093,1,-1,300000,300000,'false','true'),
(21,31093,1,-1,300000,300000,'false','true'),
(22,25283,1,-1,86400,0,'false','false'),
(23,25286,1,-1,86400,0,'false','false');
-- sevensigns emblem_of_dawn,emblem_of_dusk
insert into random_spawn values
(103, 31170, 1, -1, 60, 0, 'false', 'false'),
(104, 31171, 1, -1, 60, 0, 'false', 'false'),
(105, 31170, 1, -1, 60, 0, 'false', 'false'),
(106, 31171, 1, -1, 60, 0, 'false', 'false'),
(107, 31170, 1, -1, 60, 0, 'false', 'false'),
(108, 31171, 1, -1, 60, 0, 'false', 'false'),
(109, 31170, 1, -1, 60, 0, 'false', 'false'),
(110, 31171, 1, -1, 60, 0, 'false', 'false'),
(111, 31170, 1, -1, 60, 0, 'false', 'false'),
(112, 31171, 1, -1, 60, 0, 'false', 'false'),
(113, 31170, 1, -1, 60, 0, 'false', 'false'),
(114, 31171, 1, -1, 60, 0, 'false', 'false'),
(115, 31170, 1, -1, 60, 0, 'false', 'false'),
(116, 31171, 1, -1, 60, 0, 'false', 'false'),
(117, 31170, 1, -1, 60, 0, 'false', 'false'),
(118, 31171, 1, -1, 60, 0, 'false', 'false'),
(119, 31170, 1, -1, 60, 0, 'false', 'false'),
(120, 31171, 1, -1, 60, 0, 'false', 'false'),
(121, 31170, 1, -1, 60, 0, 'false', 'false'),
(122, 31171, 1, -1, 60, 0, 'false', 'false'),
(123, 31170, 1, -1, 60, 0, 'false', 'false'),
(124, 31171, 1, -1, 60, 0, 'false', 'false'),
(125, 31170, 1, -1, 60, 0, 'false', 'false'),
(126, 31171, 1, -1, 60, 0, 'false', 'false'),
(127, 31170, 1, -1, 60, 0, 'false', 'false'),
(128, 31171, 1, -1, 60, 0, 'false', 'false'),
(129, 31170, 1, -1, 60, 0, 'false', 'false'),
(130, 31171, 1, -1, 60, 0, 'false', 'false');
|
|
|

07.08.2015, 19:53
|
|
Флудер
Регистрация: 20.01.2015
Сообщений: 7,201
С нами:
5952720
Репутация:
6527
|
|
Реализация автоанонсов просто нечто, уровень 2007 года.
[QUOTE="Спойлер"]
[COLOR="#363940"]
package core.gameserver.instancemanager;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilderFactory;
import core.gameserver.Announcements;
import core.gameserver.Config;
import core.gameserver.model.AutoAnnounces;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AutoAnnounce implements Runnable
{
private static final Logger _log = LoggerFactory.getLogger(AutoAnnounce.class);
private static AutoAnnounce _instance;
static HashMap _lists;
public static AutoAnnounce getInstance()
{
if(_instance == null)
_instance = new AutoAnnounce();
return _instance;
}
public static void reload()
{
_instance = new AutoAnnounce();
}
public AutoAnnounce()
{
_lists = new HashMap();
_log.info("AutoAnnounce: Initializing");
load();
_log.info("AutoAnnounce: Loaded " + _lists.size() + " announce.");
}
private void load()
{
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File("./config/autoannounce.xml");
if(!file.exists())
{
_log.warn("AutoAnnounce: NO FILE (./config/autoannounce.xml)");
return;
}
Document doc = factory.newDocumentBuilder().parse(file);
int counterAnnounce = 0;
for(Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
if("list".equalsIgnoreCase(n.getNodeName()))
{
for(Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if("announce".equalsIgnoreCase(d.getNodeName()))
{
ArrayList msg = new ArrayList();
NamedNodeMap attrs = d.getAttributes();
int delay = Integer.parseInt(attrs.getNamedItem("delay").getNo deValue());
int repeat = Integer.parseInt(attrs.getNamedItem("repeat").getN odeValue());
AutoAnnounces aa = new AutoAnnounces(counterAnnounce);
for(Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{
if("message".equalsIgnoreCase(cd.getNodeName()))
msg.add(String.valueOf(cd.getAttributes().getNamed Item("text").getNodeValue()));
}
aa.setAnnounce(delay, repeat, msg);
_lists.put(counterAnnounce, aa);
counterAnnounce++;
}
}
}
_log.info("AutoAnnounce: Load OK");
}
catch(Exception e)
{
_log.warn("AutoAnnounce: Error parsing autoannounce.xml file. " + e);
}
}
public void run()
{
if(_lists.size() msg = _lists.get(i).getMessage();
for(int c = 0; c
|
|
|

07.08.2015, 20:21
|
|
Постоянный
Регистрация: 07.07.2015
Сообщений: 486
С нами:
5710893
Репутация:
0
|
|
[QUOTE="kick"]
Реализация автоанонсов просто нечто, уровень 2007 года.
[QUOTE="Спойлер"]
[COLOR="#363940"]
package core.gameserver.instancemanager;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilderFactory;
import core.gameserver.Announcements;
import core.gameserver.Config;
import core.gameserver.model.AutoAnnounces;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AutoAnnounce implements Runnable
{
private static final Logger _log = LoggerFactory.getLogger(AutoAnnounce.class);
private static AutoAnnounce _instance;
static HashMap _lists;
public static AutoAnnounce getInstance()
{
if(_instance == null)
_instance = new AutoAnnounce();
return _instance;
}
public static void reload()
{
_instance = new AutoAnnounce();
}
public AutoAnnounce()
{
_lists = new HashMap();
_log.info("AutoAnnounce: Initializing");
load();
_log.info("AutoAnnounce: Loaded " + _lists.size() + " announce.");
}
private void load()
{
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File("./config/autoannounce.xml");
if(!file.exists())
{
_log.warn("AutoAnnounce: NO FILE (./config/autoannounce.xml)");
return;
}
Document doc = factory.newDocumentBuilder().parse(file);
int counterAnnounce = 0;
for(Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
if("list".equalsIgnoreCase(n.getNodeName()))
{
for(Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if("announce".equalsIgnoreCase(d.getNodeName()))
{
ArrayList msg = new ArrayList();
NamedNodeMap attrs = d.getAttributes();
int delay = Integer.parseInt(attrs.getNamedItem("delay").getNo deValue());
int repeat = Integer.parseInt(attrs.getNamedItem("repeat").getN odeValue());
AutoAnnounces aa = new AutoAnnounces(counterAnnounce);
for(Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{
if("message".equalsIgnoreCase(cd.getNodeName()))
msg.add(String.valueOf(cd.getAttributes().getNamed Item("text").getNodeValue()));
}
aa.setAnnounce(delay, repeat, msg);
_lists.put(counterAnnounce, aa);
counterAnnounce++;
}
}
}
_log.info("AutoAnnounce: Load OK");
}
catch(Exception e)
{
_log.warn("AutoAnnounce: Error parsing autoannounce.xml file. " + e);
}
}
public void run()
{
if(_lists.size() msg = _lists.get(i).getMessage();
for(int c = 0; c
|
|
|

07.08.2015, 20:28
|
|
Новичок
Регистрация: 21.01.2010
Сообщений: 0
С нами:
8581120
Репутация:
0
|
|
BaiumManager.java
Оо даа паофувсио.
Код:
[CODE]
// Archangels
try
{
NpcTemplate angel = NpcHolder.getInstance().getTemplate(ARCHANGEL);
SimpleSpawner spawnDat;
_angelSpawns.clear();
// 5 random numbers of 10, no duplicates
List random = new ArrayList();
for(int i = 0; i
|
|
|

07.08.2015, 20:33
|
|
Участник форума
Регистрация: 05.08.2015
Сообщений: 216
С нами:
5669089
Репутация:
0
|
|
Гринд же просто чсв-клоун
|
|
|

07.08.2015, 20:36
|
|
Новичок
Регистрация: 21.01.2010
Сообщений: 0
С нами:
8581120
Репутация:
0
|
|
Код:
i_agathion_energy;-250;diff - птс
Consumes 250 energy.
- гриндоптсэ
what??? !111 Вместо поглащения энергии агитациона поглащает МП.
|
|
|

07.08.2015, 20:48
|
|
Новичок
Регистрация: 21.01.2010
Сообщений: 0
С нами:
8581120
Репутация:
0
|
|
[OFF]
Код:
[CODE]
package quests;
import java.util.HashMap;
import java.util.Map;
import l2ft.commons.threading.RunnableImpl;
import l2ft.gameserver.ThreadPoolManager;
import l2ft.gameserver.model.Player;
import l2ft.gameserver.model.base.Race;
import l2ft.gameserver.model.instances.NpcInstance;
import l2ft.gameserver.model.quest.Quest;
import l2ft.gameserver.model.quest.QuestState;
import l2ft.gameserver.scripts.ScriptFile;
public class _999_T1Tutorial extends Quest implements ScriptFile
{
private static int RECOMMENDATION_01 = 1067;
private static int RECOMMENDATION_02 = 1068;
private static int LEAF_OF_MOTHERTREE = 1069;
private static int BLOOD_OF_JUNDIN = 1070;
private static int LICENSE_OF_MINER = 1498;
private static int VOUCHER_OF_FLAME = 1496;
private static int SOULSHOT_NOVICE = 5789;
private static int SPIRITSHOT_NOVICE = 5790;
private static int BLUE_GEM = 6353;
private static int DIPLOMA = 9881;
private static class Event
{
public String htm;
public int radarX;
public int radarY;
public int radarZ;
public int item;
public int classId1;
public int gift1;
public int count1;
public int classId2;
public int gift2;
public int count2;
public Event(String htm, int radarX, int radarY, int radarZ, int item, int classId1, int gift1, int count1, int classId2, int gift2, int count2)
{
this.htm = htm;
this.radarX = radarX;
this.radarY = radarY;
this.radarZ = radarZ;
this.item = item;
this.classId1 = classId1;
this.gift1 = gift1;
this.count1 = count1;
this.classId2 = classId2;
this.gift2 = gift2;
this.count2 = count2;
}
}
private static class Talk
{
public int raceId;
public String[] htmlfiles;
public int npcTyp;
public int item;
public Talk(int raceId, String[] htmlfiles, int npcTyp, int item)
{
this.raceId = raceId;
this.htmlfiles = htmlfiles;
this.npcTyp = npcTyp;
this.item = item;
}
}
private static Map events = new HashMap();
static
{
events.put("32133_02", new Event("32133-03.htm", -119692, 44504, 380, DIPLOMA, 0x7b, SOULSHOT_NOVICE, 200, 0x7c, SOULSHOT_NOVICE, 200));
events.put("30008_02", new Event("30008-03.htm", 0, 0, 0, RECOMMENDATION_01, 0x00, SOULSHOT_NOVICE, 200, 0x00, 0, 0));
events.put("30008_04", new Event("30008-04.htm", -84058, 243239, -3730, 0, 0x00, 0, 0, 0, 0, 0));
events.put("30017_02", new Event("30017-03.htm", 0, 0, 0, RECOMMENDATION_02, 0x0a, SPIRITSHOT_NOVICE, 100, 0x00, 0, 0));
events.put("30017_04", new Event("30017-04.htm", -84058, 243239, -3730, 0, 0x0a, 0, 0, 0x00, 0, 0));
events.put("30370_02", new Event("30370-03.htm", 0, 0, 0, LEAF_OF_MOTHERTREE, 0x19, SPIRITSHOT_NOVICE, 100, 0x12, SOULSHOT_NOVICE, 200));
events.put("30370_04", new Event("30370-04.htm", 45491, 48359, -3086, 0, 0x19, 0, 0, 0x12, 0, 0));
events.put("30129_02", new Event("30129-03.htm", 0, 0, 0, BLOOD_OF_JUNDIN, 0x26, SPIRITSHOT_NOVICE, 100, 0x1f, SOULSHOT_NOVICE, 200));
events.put("30129_04", new Event("30129-04.htm", 12116, 16666, -4610, 0, 0x26, 0, 0, 0x1f, 0, 0));
events.put("30528_02", new Event("30528-03.htm", 0, 0, 0, LICENSE_OF_MINER, 0x35, SOULSHOT_NOVICE, 200, 0x00, 0, 0));
events.put("30528_04", new Event("30528-04.htm", 115642, -178046, -941, 0, 0x35, 0, 0, 0x00, 0, 0));
events.put("30573_02", new Event("30573-03.htm", 0, 0, 0, VOUCHER_OF_FLAME, 0x31, SPIRITSHOT_NOVICE, 100, 0x2c, SOULSHOT_NOVICE, 200));
events.put("30573_04", new Event("30573-04.htm", -45067, -113549, -235, 0, 0x31, 0, 0, 0x2c, 0, 0));
}
private static Map talks = new HashMap();
static
{
talks.put(30017, new Talk(0, new String[]{
"30017-01.htm",
"30017-02.htm",
"30017-04.htm"
}, 0, 0));
talks.put(30008, new Talk(0, new String[]{
"30008-01.htm",
"30008-02.htm",
"30008-04.htm"
}, 0, 0));
talks.put(30370, new Talk(1, new String[]{
"30370-01.htm",
"30370-02.htm",
"30370-04.htm"
}, 0, 0));
talks.put(30129, new Talk(2, new String[]{
"30129-01.htm",
"30129-02.htm",
"30129-04.htm"
}, 0, 0));
talks.put(30573, new Talk(3, new String[]{
"30573-01.htm",
"30573-02.htm",
"30573-04.htm"
}, 0, 0));
talks.put(30528, new Talk(4, new String[]{
"30528-01.htm",
"30528-02.htm",
"30528-04.htm"
}, 0, 0));
talks.put(30018, new Talk(0, new String[]{
"30131-01.htm",
"",
"30019-03a.htm",
"30019-04.htm",
}, 1, RECOMMENDATION_02));
talks.put(30019, new Talk(0, new String[]{
"30131-01.htm",
"",
"30019-03a.htm",
"30019-04.htm",
}, 1, RECOMMENDATION_02));
talks.put(30020, new Talk(0, new String[]{
"30131-01.htm",
"",
"30019-03a.htm",
"30019-04.htm",
}, 1, RECOMMENDATION_02));
talks.put(30021, new Talk(0, new String[]{
"30131-01.htm",
"",
"30019-03a.htm",
"30019-04.htm",
}, 1, RECOMMENDATION_02));
talks.put(30009, new Talk(0, new String[]{
"30530-01.htm",
"30009-03.htm",
"",
"30009-04.htm",
}, 1, RECOMMENDATION_01));
talks.put(30011, new Talk(0, new String[]{
"30530-01.htm",
"30009-03.htm",
"",
"30009-04.htm",
}, 1, RECOMMENDATION_01));
talks.put(30012, new Talk(0, new String[]{
"30530-01.htm",
"30009-03.htm",
"",
"30009-04.htm",
}, 1, RECOMMENDATION_01));
talks.put(30056, new Talk(0, new String[]{
"30530-01.htm",
"30009-03.htm",
"",
"30009-04.htm",
}, 1, RECOMMENDATION_01));
talks.put(30400, new Talk(1, new String[]{
"30131-01.htm",
"30400-03.htm",
"30400-03a.htm",
"30400-04.htm",
}, 1, LEAF_OF_MOTHERTREE));
talks.put(30401, new Talk(1, new String[]{
"30131-01.htm",
"30400-03.htm",
"30400-03a.htm",
"30400-04.htm",
}, 1, LEAF_OF_MOTHERTREE));
talks.put(30402, new Talk(1, new String[]{
"30131-01.htm",
"30400-03.htm",
"30400-03a.htm",
"30400-04.htm",
}, 1, LEAF_OF_MOTHERTREE));
talks.put(30403, new Talk(1, new String[]{
"30131-01.htm",
"30400-03.htm",
"30400-03a.htm",
"30400-04.htm",
}, 1, LEAF_OF_MOTHERTREE));
talks.put(30131, new Talk(2, new String[]{
"30131-01.htm",
"30131-03.htm",
"30131-03a.htm",
"30131-04.htm",
}, 1, BLOOD_OF_JUNDIN));
talks.put(30404, new Talk(2, new String[]{
"30131-01.htm",
"30131-03.htm",
"30131-03a.htm",
"30131-04.htm",
}, 1, BLOOD_OF_JUNDIN));
talks.put(30574, new Talk(3, new String[]{
"30575-01.htm",
"30575-03.htm",
"30575-03a.htm",
"30575-04.htm",
}, 1, VOUCHER_OF_FLAME));
talks.put(30575, new Talk(3, new String[]{
"30575-01.htm",
"30575-03.htm",
"30575-03a.htm",
"30575-04.htm",
}, 1, VOUCHER_OF_FLAME));
talks.put(30530, new Talk(4, new String[]{
"30530-01.htm",
"30530-03.htm",
"",
"30530-04.htm",
}, 1, LICENSE_OF_MINER));
talks.put(32133, new Talk(5, new String[]{
"32133-01.htm",
"32133-02.htm",
"32133-04.htm"
}, 0, 0));
talks.put(32134, new Talk(5, new String[]{
"32134-01.htm",
"32134-03.htm",
"",
"32134-04.htm",
}, 1, DIPLOMA));
}
public void onLoad()
{
}
public void onReload()
{
}
public void onShutdown()
{
}
public _999_T1Tutorial()
{
super(false);
addStartNpc(30008, 30009, 30017, 30019, 30129, 30131, 30573, 30575, 30370, 30528, 30530, 30400, 30401, 30402, 30403, 30404, 32133, 32134);
addTalkId(30008, 30009, 30017, 30019, 30129, 30131, 30573, 30575, 30370, 30528, 30530, 30400, 30401, 30402, 30403, 30404, 32133, 32134);
addFirstTalkId(30008, 30009, 30017, 30019, 30129, 30131, 30573, 30575, 30370, 30528, 30530, 30400, 30401, 30402, 30403, 30404, 32133, 32134);
addKillId(18342, 20001);
}
@Override
public String onEvent(String event, QuestState st, NpcInstance npc)
{
QuestState qs = st.getPlayer().getQuestState(_255_Tutorial.class);
if(qs == null || st == null)
return null;
Player player = st.getPlayer();
if(player == null)
return null;
String htmltext = event;
int Ex = qs.getInt("Ex");
int classId = player.getClassId().getId();
boolean isMage = (player.getClassId().getRace() != Race.orc) && player.getClassId().isMage();
if(event.equalsIgnoreCase("TimerEx_NewbieHelper"))
{
if(Ex == 0)
{
if(isMage)
st.playTutorialVoice("tutorial_voice_009b");
else
st.playTutorialVoice("tutorial_voice_009a");
qs.set("Ex", "1");
}
else if(Ex == 3)
{
st.playTutorialVoice("tutorial_voice_010a");
qs.set("Ex", "4");
}
return null;
}
else if(event.equalsIgnoreCase("TimerEx_GrandMaster"))
{
if(Ex >= 4)
{
st.showQuestionMark(7);
st.playSound(SOUND_TUTORIAL);
st.playTutorialVoice("tutorial_voice_025");
}
return null;
}
else if(event.equalsIgnoreCase("isle"))
{
st.addRadar(-119692, 44504, 380);
player.teleToLocation(-120050, 44500, 360);
String title = npc == null ? "" : npc.getTitle() + " " + npc.getName();
htmltext = "" + title + "
Go to the Isle of Souls and meet the Newbie Guide there to learn a number of important tips. He will also give you an item to assist your development.
Follow the direction arrow above your head and it will lead you to the Newbie Guide. Good luck!";
}
else
{
Event e = events.get(event);
if(e.radarX != 0)
st.addRadar(e.radarX, e.radarY, e.radarZ);
htmltext = e.htm;
if(st.getQuestItemsCount(e.item) > 0 && st.getInt("onlyone") == 0)
{
st.addExpAndSp(0, 50);
st.startQuestTimer("TimerEx_GrandMaster", 60000);
st.takeItems(e.item, 1);
if(Ex = 10 || onlyone == 1) && t.npcTyp == 1)
htmltext = "30575-05.htm";
else if(onlyone == 0 && level 0)
{
st.takeItems(BLUE_GEM, st.getQuestItemsCount(BLUE_GEM));
st.giveItems(t.item, 1);
st.set("step", "2");
qs.set("Ex", "3");
st.startQuestTimer("TimerEx_NewbieHelper", 30000);
qs.set("ucMemo", "3");
if(isMage)
{
st.playTutorialVoice("tutorial_voice_027");
st.giveItems(SPIRITSHOT_NOVICE, 100);
htmltext = t.htmlfiles[2];
if(htmltext.isEmpty())
htmltext = "" + (npc.getTitle().isEmpty() ? "" : npc.getTitle() + " ") + npc.getName() + "
I am sorry. I only help warriors. Please go to another Newbie Helper who may assist you.";
}
else
{
st.playTutorialVoice("tutorial_voice_026");
st.giveItems(SOULSHOT_NOVICE, 200);
htmltext = t.htmlfiles[1];
if(htmltext.isEmpty())
htmltext = "" + (npc.getTitle().isEmpty() ? "" : npc.getTitle() + " ") + npc.getName() + "
I am sorry. I only help mystics. Please go to another Newbie Helper who may assist you.";
}
}
else
{
if(isMage)
{
htmltext = "30131-02.htm";
if(player.getRace().ordinal() == 3)
htmltext = "30575-02.htm";
}
else
htmltext = "30530-02.htm";
}
}
else if(step == 2)
htmltext = t.htmlfiles[3];
}
else if(t.npcTyp == 0)
{
if(step == 1)
htmltext = t.htmlfiles[0];
else if(step == 2)
htmltext = t.htmlfiles[1];
else if(step == 3)
htmltext = t.htmlfiles[2];
}
}
return htmltext;
}
@Override
public String onKill(NpcInstance npc, QuestState st)
{
QuestState qs = st.getPlayer().getQuestState(_255_Tutorial.class);
if(qs == null)
return null;
int Ex = qs.getInt("Ex");
if(Ex
[/OFF]
Вааай....... А как же туториал ? Блин не робит Ах да... в туториале же нужно под 500 штмлок. Не царское видимо это дело..... ЗАТО У ГРИНДА КАГНАПТСЭ.
|
|
|

07.08.2015, 20:49
|
|
Постоянный
Регистрация: 09.07.2015
Сообщений: 418
С нами:
5708248
Репутация:
0
|
|
СССР, манголы и прочии сочувствующие им леваки поддакивают в такт, отсасавшему за сборку/илиещечтото кику,
кик публикует куски кода (часть из которых мне доставалось в наследство) и прикрепляет комментарии к ним в духе "Оставляет желать лучше данная реализация" или "Код просто отличный" - ничего не значащие, без конкретики или пояснений.
очень смешно наблюдать, за людьми, у которых нет никаких достижений в этой сфере, не успешных проектов, не разработок, не клиентов с успешными проектами.
Также весело наблюдать за тем, как один клоун, который учит математики за 5 класс (как делить целые числа без остатка), поддакивает другому клоуно, который в подобных тестах ошибается xD И эти люди пытаются на своем колхозном языке объяснить мне - что не так.
особо яросто в ход идут комментарии другого ноунейма, модера с проекта emerald, хотя относительно его руководитель проекта дал мне четкие объяснения
|
|
|

07.08.2015, 20:51
|
|
Новичок
Регистрация: 21.01.2010
Сообщений: 0
С нами:
8581120
Репутация:
0
|
|
Код:
[CODE]
public void addExpAndCheckBonus(MonsterInstance mob, final double noRateExp, double noRateSp, double partyVitalityMod)
{
if(_activeClass == null)
return;
// Начисление душ камаэлям
double neededExp = calcStat(Stats.SOULS_CONSUME_EXP, 0, mob, null);
if(neededExp > 0 && noRateExp > neededExp)
{
mob.broadcastPacket(new SpawnEmitter(mob, this));
ThreadPoolManager.getInstance().schedule(new GameObjectTasks.SoulConsumeTask(this), 1000);
}
double vitalityBonus = 0.;
int npcLevel = mob.getLevel();
if(Config.ALT_VITALITY_ENABLED)
{
vitalityBonus = mob.isRaid() ? 0. : getVitalityLevel(getNevitSystem().isBlessingActive ()) / 2.;
vitalityBonus *= Config.ALT_VITALITY_RATE;
if(noRateExp > 0 && !getNevitSystem().isBlessingActive())
{
if(!isVitalityStop())
{
if(!mob.isRaid())
{
// TODO: Разобратся, нельзя предметы использовать, или предметы не будут давать эффекта?
// (Все предметы для восполнения или поддержания энергии не действуют во время действия Нисхождения Невитта)
if(!(getVarB("NoExp") && getExp() == Experience.LEVEL[getLevel() + 1] - 1))
{
double points = ((noRateExp / (npcLevel * npcLevel)) * 100) / 9;
points *= Config.ALT_VITALITY_CONSUME_RATE;
if(getEffectList().getEffectByType(EffectType.Vita lity) != null)
points *= -1;
setVitality(getVitality() - points * partyVitalityMod);
}
}
else
setVitality(getVitality() + Config.ALT_VITALITY_RAID_BONUS);
}
else
setVitality(getVitality());
}
}
//При первом вызове, активируем таймеры бонусов.
if(!isInPeaceZone())
{
setRecomTimerActive(true);
getNevitSystem().startAdventTask();
if((getLevel() - npcLevel) = 10 && razLvl = -14))//30% от 10 до 14 уровней разница
{
addExpAndSp(normalExp/100*30, normalSp/100*30, (normalExp - expWithoutBonus)/100*30, (normalSp - spWithoutBonus)/100*30, false, true);
return;
}
if(razLvl > 14 || razLvl
У парня даже формулы виталити "ПА ОФУ".
|
|
|

07.08.2015, 20:51
|
|
Постоянный
Регистрация: 09.07.2015
Сообщений: 418
С нами:
5708248
Репутация:
0
|
|
То чувство, когда папки ЗГ обсираются публчично в очередной раз, а стыдно почему-то мне
Давайте может обсудим говнокод JTS (где все по офу и жалобы только на диалоги)?
Или сборки СССРа на которых фейлились ВСЕ его клиенты и нет ниодного успешного проекта.
Или давай обсудим кика, у которого просто - ничего нет.
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|