What map is that? If its a noname map, post a screenshot maybe?
Wait, thats Dis City isnt it? Thats in the TQ DB!
Here you go:
Implementation example: (DB is in the attachment
PHP Code:
static public void Load()
{
Ini rdr = new Ini("");
foreach (string filename in Directory.GetFiles(@"C:\Dropbox\CSDB\cq_generator\"))
{
rdr.FileName = filename;
Quite helpful though, it has the 2nd rb spawns, adv zone spawns etc
What does the bound cx and bound cy values mean? They aren't co ordinates.
Does it mean the entity can't move beyond that value away from the spawn center?
Implementation is slightly off too, there is no instance field, and spawn amount should be max_per_gen.
Just for anyone who wishes to copy and paste.
Great stuff tho yuki
Actually I stand corrected, they do contain the dis city spawns.
Except they are listed as mapid 4021
[...] What does the bound cx and bound cy values mean? They aren't co ordinates.
Does it mean the entity can't move beyond that value away from the spawn center?
Implementation is slightly off too, there is no instance field, and spawn amount should be max_per_gen. [...]
Code:
/*
* ****** COPS v7 Emulator - Open Source ******
* Copyright (C) 2012 - 2014 Jean-Philippe Boivin
*
* Please read the WARNING, DISCLAIMER and PATENTS
* sections in the LICENSE file.
*/
#include "log.h"
#include "generator.h"
#include "basefunc.h"
#include "mapmanager.h"
#include "gamemap.h"
#include "world.h"
#include "monster.h"
#include <QSqlQuery>
#include <QVariant>
/* static */
err_t
Generator :: makeGenerator(Generator** aOutGenerator, const QSqlQuery& aQuery)
{
ASSERT_ERR(aOutGenerator != nullptr && *aOutGenerator == nullptr, ERROR_INVALID_POINTER);
ASSERT_ERR(&aQuery != nullptr, ERROR_INVALID_REFERENCE);
static MapManager& mgr = MapManager::getInstance(); // singleton...
err_t err = ERROR_SUCCESS;
uint32_t id = (uint32_t)aQuery.value(SQLDATA_ID).toInt();
uint32_t mapId = (uint32_t)aQuery.value(SQLDATA_MAPID).toInt();
GameMap* map = mgr.getMap(mapId);
if (map != nullptr)
{
Generator* generator = new Generator(id, *map,
(uint16_t)aQuery.value(SQLDATA_BOUND_X).toUInt(),
(uint16_t)aQuery.value(SQLDATA_BOUND_Y).toUInt(),
(uint16_t)aQuery.value(SQLDATA_BOUND_CX).toUInt(),
(uint16_t)aQuery.value(SQLDATA_BOUND_CY).toUInt(),
(uint16_t)aQuery.value(SQLDATA_MAXNPC).toUInt(),
(uint16_t)aQuery.value(SQLDATA_REST_SECS).toUInt(),
(uint16_t)aQuery.value(SQLDATA_MAX_PER_GEN).toUInt(),
(uint32_t)aQuery.value(SQLDATA_MONSTER_TYPE).toUInt());
*aOutGenerator = generator;
generator = nullptr;
SAFE_DELETE(generator);
}
else
{
LOG(WARN, "Could not find the map %u for the generator %u.",
mapId, id);
err = ERROR_NOT_FOUND;
}
return err;
}
Generator :: Generator(uint32_t aId,
GameMap& aMap,
uint16_t aBoundX, uint16_t aBoundY, uint16_t aBoundCX, uint16_t aBoundCY,
uint16_t aMaxNPC, uint16_t aRestSecs, uint16_t aMaxPerGen,
uint32_t aMonsterType)
: mId(aId), mMonsterType(aMonsterType),
mMap(aMap),
mBoundX(aBoundX), mBoundY(aBoundY), mBoundCX(aBoundCX), mBoundCY(aBoundCY),
mGrid(aMaxNPC), mRestSecs(aRestSecs), mMaxPerGen(aMaxPerGen),
mAmount(0), mGenAmount(0), mCurGen(0),
mMaxNPC(0), mIdxLastGen(0)
{
mTimer.setInterval(mRestSecs + random(0, mRestSecs));
if (mGrid < 1)
mMaxNPC = 1;
else
mMaxNPC = (mBoundCX / mGrid) * (mBoundCY / mGrid);
if (mMaxNPC < 1)
mMaxNPC = 1;
mIdxLastGen = random(0, mMaxNPC);
}
void
Generator :: findGenPos(uint16_t& aOutPosX, uint16_t& aOutPosY)
{
ASSERT(&aOutPosX != nullptr && &aOutPosY != nullptr);
aOutPosX = mBoundX;
aOutPosY = mBoundY;
if (mMaxNPC <= 1)
{
aOutPosX += random(0, mBoundCX);
aOutPosY += random(0, mBoundCY);
}
else
{
++mIdxLastGen;
if (mIdxLastGen >= mMaxNPC)
mIdxLastGen = 0;
int32_t gridX = mBoundCX / mGrid;
if (gridX < 0)
gridX = 1;
aOutPosX += mGrid * (mIdxLastGen % gridX) + random(0, mGrid);
aOutPosY += mGrid * (mIdxLastGen / gridX) + random(0, mGrid);
}
}
uint32_t
Generator :: generate(uint32_t aAmount)
{
static World& world = World::getInstance(); // singleton...
const uint32_t RANDOM_GENERATOR_SECS = 600;
if (mGenAmount >= mMaxNPC)
return 0;
if (mTimer.toNextTime())
{
if (mRestSecs >= RANDOM_GENERATOR_SECS)
mTimer.start(mRestSecs + random(0, mRestSecs));
mCurGen = mMaxPerGen;
}
if (mCurGen <= 0)
return 0;
// must access map data... will do a lot of I/O if no player is on the map
// but acceptable as it will only happens at startup
mMap.mData.unpack(this);
uint32_t generated = 0;
for (uint32_t i = 0; i < aAmount; ++i)
{
uint16_t posX = 0, posY = 0;
findGenPos(posX, posY);
if (!mMap.isStandEnable(posX, posY))
{
posX = mBoundX + random(0, mBoundCX);
posY = mBoundY + random(0, mBoundCY);
if (!mMap.isStandEnable(posX, posY))
continue;
}
Monster* monster = world.generateMonster(mMonsterType, this);
if (monster != nullptr)
{
monster->setMapId(mMap.getUID());
monster->setPosition(posX, posY);
// add the monster to the map
mMap.enterRoom(*monster);
// TODO broadcast spawn ?
}
--mCurGen;
++mGenAmount;
++generated;
if (mCurGen <= 0)
break;
}
// release the resources
mMap.mData.pack(this);
return generated;
}
Quite helpful though, it has the 2nd rb spawns, adv zone spawns etc
What does the bound cx and bound cy values mean? They aren't co ordinates.
Does it mean the entity can't move beyond that value away from the spawn center?
Implementation is slightly off too, there is no instance field, and spawn amount should be max_per_gen.
Just for anyone who wishes to copy and paste.
Great stuff tho yuki
Actually I stand corrected, they do contain the dis city spawns.
Except they are listed as mapid 4021
Oh well, the instance thingy if needed for our server, but you are right, thats not in the DB I provided. Simply comment that out :3
About the "max_per_gen", well.. its just a variable name afterall. I used hybrids SQL to INI dumper so yeah.
[VERKAUFE] Honorbuddy-Lizenz bis 7/22/2021 01/23/2013 - World of Warcraft Trading - 19 Replies Hallo,
Ich verkaufe eine Honorbuddy-Lizenz, welche noch bis zum 22.7.2021 läuft...
1 Session - auf Wunsch gibts noch eine Buddywing Lizenz bis zum 11/19/2013 dazu
Zahlung nur via PayPal...
Ihr erhaltet die Logindaten und den Key
other plvl spawns than main spawns 01/15/2009 - Conquer Online 2 - 3 Replies hi there,
im on epvp since 3 years now but this is my first thread so dont kill me for sharing only :)
well what i wanted to know is, since gms work alot by hunting down botters, if someone can give me spawns (in coords) or maybe in the map(s) of serps, alienserps and basi which are not the mains. so noone else would find me afk on bot for plvl :o
thnx for your replies :)
Liberty 2021 (English N-Age) 04/24/2007 - General Gaming Discussion - 5 Replies -=LIberty-2021=-
(International N-Age Server)
www.L2021.com
I.About Liberty-2021
Need a new map for spawns in MZ 03/05/2006 - Conquer Online 2 - 5 Replies i need a new map for MZ. i cant find the old taks10.jpg and file its been replace w/ task10.pul..tnx.. :D