Re: [Help]MobCount method
I guess this can work o.o
PHP Code:
public void mobCount(int mobid) {
getPlayer().getMap().getMonsterById(mobid).isAlive();
}
Re: [Help]MobCount method
Quote:
Originally Posted by
TiredGuy
I guess this can work o.o
PHP Code:
public void mobCount(int mobid) {
getPlayer().getMap().getMonsterById(mobid).isAlive();
}
How would I use this?
I'm guessing not like this:
PHP Code:
if (cm.mobCount(<monster id>)==0) {
Re: [Help]MobCount method
modify it for your needs
PHP Code:
public int countMonsterById(int id) {
mapobjectlocks.get(MapleMapObjectType.MONSTER).readLock().lock();
try {
int ret = 0;
Iterator<MapleMapObject> itr = mapobjects.get(MapleMapObjectType.MONSTER).values().iterator();
while (itr.hasNext()) {
MapleMonster n = (MapleMonster) itr.next();
if (n.getId() == id) {
ret++;
}
}
return ret;
} finally {
mapobjectlocks.get(MapleMapObjectType.MONSTER).readLock().unlock();
}
}
NPCConversationManager
PHP Code:
just make a method which call that method in a maplemap object (for example c.getPlayer().getMap() to get the player current maplemap object)
It should be what you are trying to achieve. you might want to change that lock for synchronize (assuming you don't have locks in your source)
Re: [Help]MobCount method
Quote:
Originally Posted by
oxysoft
modify it for your needs
PHP Code:
public int countMonsterById(int id) {
mapobjectlocks.get(MapleMapObjectType.MONSTER).readLock().lock();
try {
int ret = 0;
Iterator<MapleMapObject> itr = mapobjects.get(MapleMapObjectType.MONSTER).values().iterator();
while (itr.hasNext()) {
MapleMonster n = (MapleMonster) itr.next();
if (n.getId() == id) {
ret++;
}
}
return ret;
} finally {
mapobjectlocks.get(MapleMapObjectType.MONSTER).readLock().unlock();
}
}
NPCConversationManager
PHP Code:
just make a method which call that method in a maplemap object (for example c.getPlayer().getMap() to get the player current maplemap object)
It should be what you are trying to achieve. you might want to change that lock for synchronize (assuming you don't have locks in your source)
Yeah.. something is wrong with "mapobjectlocks" and "values"
Re: [Help]MobCount method
Quote:
Originally Posted by
lordpeter
Yeah.. something is wrong with "mapobjectlocks" and "values"
Show me your maplemap ...
Re: [Help]MobCount method
His MapleMap doesn't use ReentrantReadWriteLocks. I'm guessing it's MoopleDEV? It uses synchronization... o.o
Re: [Help]MobCount method
Quote:
Originally Posted by
Alienx3
His MapleMap doesn't use ReentrantReadWriteLocks. I'm guessing it's MoopleDEV? It uses synchronization... o.o
That's what i said. But he said something about values, which i'm guessing he doesn't have a mapobjects collection (or most likely renamed)
Re: [Help]MobCount method
Re: [Help]MobCount method
They use synchronization.
Re: [Help]MobCount method
Its okay, I do not need this anymore, i have found a different solution to the problem that I was having. I simply made the mob drop a unique ETC and made the NPC recognize it.
Re: [Help]MobCount method
Quote:
Originally Posted by
lordpeter
Its okay, I do not need this anymore, i have found a different solution to the problem that I was having. I simply made the mob drop a unique ETC and made the NPC recognize it.
Generic and overused stuff
Re: [Help]MobCount method
Quote:
Originally Posted by
oxysoft
Generic and overused stuff
GMS pqs have the same system or atleast they used to.