[Release] Clone system

Page 1 of 6 123456 LastLast
Results 1 to 15 of 80
  1. #1
    You've got my respect! Traitor is offline
    True MemberRank
    Apr 2008 Join Date
    Portland,OregonLocation
    959Posts

    [Release] Clone system


    RaGEZONE Recommends

    RaGEZONE Recommends

    Have fun, report all errors.

    In all files you edit add:
    Code:
    import net.sf.odinms.server.maps.FakeCharacter;
    In MapleCharacter change:
    Code:
    private MapleCharacter() {
    to
    Code:
    public MapleCharacter() {
    and add:
    Code:
    private List<FakeCharacter> fakes = new ArrayList<FakeCharacter>();
        
        public boolean isfake = false;
    and
    Code:
    public void setID(int id){
         this.id = id;
        }
        
        public void setJob(int job){
            this.job = MapleJob.getById(job);
        }
        
        public void setInventory(MapleInventoryType type, MapleInventory inv) {
            inventory[type.ordinal()] = inv;
        }
    
        public boolean hasFakeChar()
        {
            for (FakeCharacter ch : fakes) {
                if(ch != null)
                    return true;
            }
            return false;
        }
        
        public List<FakeCharacter> getFakeChars()
        {
            return fakes;
        }
        
        public void addFakeChar(FakeCharacter f)
        {
           fakes.add(f);
        }
    In net.sf.odinms.server.maps add FakeCharacter.java
    Code:
    package net.sf.odinms.server.maps;
    
    import net.sf.odinms.client.IItem;
    import net.sf.odinms.client.MapleCharacter;
    import net.sf.odinms.client.MapleInventoryType;
    
    /**
     *
     * @author Patrick/PurpleMadness
     */
    public class FakeCharacter {
        private MapleCharacter ch;
        
        public FakeCharacter(MapleCharacter player, int id)
        {
            MapleCharacter fakechr = new MapleCharacter();
            fakechr.setHair(player.getHair());
            fakechr.setFace(player.getFace());
            fakechr.setSkinColor(player.getSkinColor());
            fakechr.setName(player.getName());
            fakechr.setID(id + 100000);
            fakechr.setLevel(player.getLevel());
            fakechr.setJob(player.getJob().getId());
            fakechr.setMap(player.getMap());
            fakechr.setPosition(player.getPosition());
            fakechr.silentGiveBuffs(player.getAllBuffs());
            
            for(IItem equip : player.getInventory(MapleInventoryType.EQUIPPED)){
                fakechr.getInventory(MapleInventoryType.EQUIPPED).addFromDB(equip);
            }
            
            fakechr.isfake = true;
            
            player.getMap().addBotPlayer(fakechr);
            
            ch = fakechr;
        }
        
        public MapleCharacter getFakeChar()
        {
            return ch;
        }
    }
    In MapleMap.java add:
    Code:
    /**
         * Adds a player to this map and sends nescessary data
         *
         * @param chr
         */
        public void addBotPlayer(MapleCharacter chr) {
            //log.warn("[dc] [level2] Player {} enters map {}", new Object[] { chr.getName(), mapid });
            synchronized (characters) {
                this.characters.add(chr);
            }
            synchronized (this.mapobjects) {
                if (!chr.isHidden()) {
                    broadcastMessage(chr, (MaplePacketCreator.spawnPlayerMapobject(chr)), false);
                    /*MaplePet[] pets = chr.getPets();
                    for (int i = 0; i < 3; i++) {
                        if (pets[i] != null) {
                            broadcastMessage(chr, MaplePacketCreator.showPet(chr, pets[i], false, false), false);
                        }
                    }*/
                }
                this.mapobjects.put(Integer.valueOf(chr.getObjectId()), chr);
            }
        }
    In MapleMap.java change:
    Code:
    if (chr.getPosition().distanceSq(mapobject.getPosition()) <= MapleCharacter.MAX_VIEW_RANGE_SQ) {
    to
    Code:
    if (chr.getPosition().distanceSq(mapobject.getPosition()) <= MapleCharacter.MAX_VIEW_RANGE_SQ && !chr.isfake) {
    and
    Code:
    private void broadcastMessage(MapleCharacter source, MaplePacket packet, double rangeSq, Point rangedFrom) {
            synchronized (characters) {
                for (MapleCharacter chr : characters) {
                    if (chr != source) {
    to
    Code:
    private void broadcastMessage(MapleCharacter source, MaplePacket packet, double rangeSq, Point rangedFrom) {
            synchronized (characters) {
                for (MapleCharacter chr : characters) {
                    if (chr != source && !chr.isfake) {
    and
    Code:
    private void updateMapObjectVisibility(MapleCharacter chr, MapleMapObject mo) {
    to
    Code:
    private void updateMapObjectVisibility(MapleCharacter chr, MapleMapObject mo) {
            if(chr.isfake)
                return;
    and
    Code:
    public void movePlayer(MapleCharacter player, Point newPosition) {
            player.setPosition(newPosition);
    to
    Code:
    public void movePlayer(MapleCharacter player, Point newPosition) {
            player.setPosition(newPosition);
            if(player.isfake)
                return;
    In MovePlayerHandler.java add
    Code:
    if(c.getPlayer().hasFakeChar())
                            {
                                int i = 1;
                                for (final FakeCharacter ch : c.getPlayer().getFakeChars()) {
                                    ScheduledFuture<?> scheduleRemove = TimerManager.getInstance().schedule(new Runnable() {
                                        @Override
                                        public void run() {
                                            MaplePacket packet = MaplePacketCreator.movePlayer(ch.getFakeChar().getId(), res);
                                            ch.getFakeChar().getMap().broadcastMessage(ch.getFakeChar(), packet, false);
                                            updatePosition (res, ch.getFakeChar(), 0);
                                            ch.getFakeChar().getMap().movePlayer(ch.getFakeChar(), ch.getFakeChar().getPosition());
                                        }
                                    }, i * 300);
                                    i++;
                                }
                            }
    after
    Code:
    c.getPlayer().getMap().movePlayer(c.getPlayer(), c.getPlayer().getPosition());
    Add
    Code:
    import net.sf.odinms.server.TimerManager;
    import java.util.concurrent.ScheduledFuture;
    and change:
    Code:
    List<LifeMovementFragment> res = parseMovement(slea);
    to
    Code:
    final List<LifeMovementFragment> res = parseMovement(slea);
    In MapleClient.java add
    Code:
    if(chr.hasFakeChar())
                        {
                            for (FakeCharacter ch : chr.getFakeChars()) {
                                ch.getFakeChar().getMap().removePlayer(ch.getFakeChar());
                            }
                        }
    after
    Code:
    public void disconnect() {
            // pingTask.cancel(true);
            MapleCharacter chr = this.getPlayer();
            if (chr != null && isLoggedIn()) {
    In CloseRangeDamageHandler add
    Code:
    if(c.getPlayer().hasFakeChar())
                    {
                        for (FakeCharacter ch : c.getPlayer().getFakeChars()) {
                            MaplePacket packett = MaplePacketCreator.closeRangeAttack(ch.getFakeChar().getId(), attack.skill, attack.stance,
                attack.numAttackedAndDamage, attack.allDamage, attack.speed);
                            player.getMap().broadcastMessage(ch.getFakeChar(), packett, false, true);
                            applyAttack(attack, ch.getFakeChar(), maxdamage, attackCount);
                        }
                    }
    after
    Code:
    applyAttack(attack, player, maxdamage, attackCount);
    In FacialExpressionHandler.java add
    Code:
    for (FakeCharacter ch : c.getPlayer().getFakeChars()) {
                        c.getPlayer().getMap().broadcastMessage(ch.getFakeChar(), MaplePacketCreator.facialExpression(ch.getFakeChar(), emote), false);
                    }
    after
    Code:
    c.getPlayer().getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.facialExpression(c.getPlayer(), emote), false);
    In MapleMonster.java change:
    Code:
    @Override
    	public void sendSpawnData(MapleClient client) {
    		if (!isAlive()) {
    			return;
    		}
    to
    Code:
    @Override
    	public void sendSpawnData(MapleClient client) {
    		if (!isAlive() || client.getPlayer().isfake) {
    			return;
    		}
    in maplecharacter.java
    add:
    Code:
    if(hasFakeChar())
            {
                for (FakeCharacter ch : getFakeChars()) {
                    ch.getFakeChar().getMap().removePlayer(ch.getFakeChar());
                }
            }
    before
    Code:
    getClient().getSession().write(warpPacket);
    Here's the command:
    Code:
    else if (splitted[0].equals("!fakechar")) {
                        for(int i = 0; i < getOptionalIntArg(splitted, 1, 1); i++)
                        {
                            FakeCharacter fc = new FakeCharacter(c.getPlayer(), c.getPlayer().getId() + c.getPlayer().getFakeChars().size() + 1);
                            c.getPlayer().addFakeChar(fc);
                        }
                        mc.dropMessage("Please move around for it to take effect.");
                    }
    and that should give you a basic clone.
    if there's an error, just reply and I should be able to help.
    edit:
    forgot to say, lol flam at wil!
    edit:
    Forgot to add, thanks to PurpleMadness for his FakeCharacter.java that I edited.
    Last edited by Traitor; 22-10-08 at 12:57 AM.


  2. #2
    Account Inactive EspadaFung is offline
    InactiveRank
    Jul 2008 Join Date
    Home, don't stalk meLocation
    1,034Posts

    Re: [Release] Clone system

    LOL i love this, thanks dude :D

    is this similar to alcove's? or even better?

  3. #3
    You've got my respect! Traitor is offline
    True MemberRank
    Apr 2008 Join Date
    Portland,OregonLocation
    959Posts

    Re: [Release] Clone system

    It's similar.
    Alcove's is more complete (And better!), I just quit on this because it wasn't worth continuing it.
    edit:
    Forgot to mention, everything else is easy to add yourself.

  4. #4
    Account Inactive chuayaowei is offline
    InactiveRank
    Jul 2008 Join Date
    SingaporeLocation
    1,410Posts

    Re: [Release] Clone system

    Thanks dude.

  5. #5
    Alpha Member OmgItsParm is offline
    Alpha MaleRank
    Apr 2008 Join Date
    2,098Posts

    Re: [Release] Clone system

    looks nice

    good job on it

  6. #6
    Account Inactive kanters is offline
    InactiveRank
    May 2008 Join Date
    AmsterdamLocation
    276Posts

    Re: [Release] Clone system

    <3 all i have to say xD !

  7. #7
    Account Inactive JdeeCanada is offline
    InactiveRank
    Aug 2008 Join Date
    CanadaLocation
    57Posts

    Re: [Release] Clone system

    This is perfect. I love you.

  8. #8
    You've got my respect! Traitor is offline
    True MemberRank
    Apr 2008 Join Date
    Portland,OregonLocation
    959Posts

    Re: [Release] Clone system

    Also, I recommend to not spawn 600+, it gets really laggy,

  9. #9
    Account Inactive Darkz111 is offline
    InactiveRank
    Oct 2008 Join Date
    My Home =DLocation
    132Posts

    Re: [Release] Clone system

    O.o thx for this realease...i love it =D

  10. #10
    Account Inactive terens is offline
    InactiveRank
    Apr 2008 Join Date
    106Posts

    Re: [Release] Clone system

    i got this error : Any Fixes?

    C:\Documents and Settings\T ' ce\My Documents\RenzMs Pack\Ems Repack\Ems Repack\src\net\sf\odinms\net\channel\handler\CloseRangeDamageHandler.java:148: cannot find symbol
    symbol : variable speed
    location: class net.sf.odinms.net.channel.handler.AbstractDealDamageHandler.AttackInfo
    attack.numAttackedAndDamage, attack.allDamage, attack.speed);
    C:\Documents and Settings\T ' ce\My Documents\RenzMs Pack\Ems Repack\Ems Repack\src\net\sf\odinms\net\channel\handler\MovePlayerHandler.java:73: cannot find symbol
    symbol : class ScheduledFuture
    location: class net.sf.odinms.net.channel.handler.MovePlayerHandler
    ScheduledFuture<?> scheduleRemove = TimerManager.getInstance().schedule(new Runnable() {
    C:\Documents and Settings\T ' ce\My Documents\RenzMs Pack\Ems Repack\Ems Repack\src\net\sf\odinms\server\maps\FakeCharacter.java:16: MapleCharacter() has private access in net.sf.odinms.client.MapleCharacter
    MapleCharacter fakechr = new MapleCharacter();
    C:\Documents and Settings\T ' ce\My Documents\RenzMs Pack\Ems Repack\Ems Repack\src\net\sf\odinms\server\maps\FakeCharacter.java:21: cannot find symbol
    symbol : method setID(int)
    location: class net.sf.odinms.client.MapleCharacter
    fakechr.setID(id + 100000);
    C:\Documents and Settings\T ' ce\My Documents\RenzMs Pack\Ems Repack\Ems Repack\src\net\sf\odinms\server\maps\FakeCharacter.java:23: cannot find symbol
    symbol : method setJob(int)
    location: class net.sf.odinms.client.MapleCharacter
    fakechr.setJob(player.getJob().getId());
    C:\Documents and Settings\T ' ce\My Documents\RenzMs Pack\Ems Repack\Ems Repack\src\net\sf\odinms\server\maps\FakeCharacter.java:26: cannot find symbol
    symbol : method getAllBuffs()
    location: class net.sf.odinms.client.MapleCharacter
    fakechr.silentGiveBuffs(player.getAllBuffs());
    6 errors
    BUILD FAILED (total time: 1 second)

  11. #11
    Account Inactive lxCrAzYsEl is offline
    InactiveRank
    May 2008 Join Date
    Her heart :)Location
    281Posts

    Re: [Release] Clone system

    You nid a command to spawn it ? O.O

  12. #12
    Account Inactive terens is offline
    InactiveRank
    Apr 2008 Join Date
    106Posts

    Re: [Release] Clone system

    Yes. This command = !fakechar

  13. #13
    Account Inactive SkillzMS is offline
    InactiveRank
    Aug 2008 Join Date
    168Posts

    Re: [Release] Clone system

    should i use this one or the one already released

  14. #14
    Account Inactive JdeeCanada is offline
    InactiveRank
    Aug 2008 Join Date
    CanadaLocation
    57Posts

    Re: [Release] Clone system

    GetFakeChars?

    Code:
    init:
    deps-jar:
    Compiling 242 source files to C:\Users\Johann\Desktop\Repack\build\classes
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\provider\xmlwz\FileStoredPngMapleCanvas.java:14: warning: com.sun.imageio.plugins.png.PNGImageReaderSpi is Sun proprietary API and may be removed in a future release
    import com.sun.imageio.plugins.png.PNGImageReaderSpi;
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\client\messages\CommandProcessor.java:1219: cannot find symbol
    symbol  : method getFakeChars()
    location: class net.sf.odinms.client.MapleCharacter
                            FakeCharacter fc = new FakeCharacter(c.getPlayer(), c.getPlayer().getId() + c.getPlayer().getFakeChars().size() + 1);
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\client\messages\CommandProcessor.java:1219: operator + cannot be applied to int,net.sf.odinms.client.MapleCharacter.getFakeChars.size
                            FakeCharacter fc = new FakeCharacter(c.getPlayer(), c.getPlayer().getId() + c.getPlayer().getFakeChars().size() + 1);
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\client\messages\CommandProcessor.java:1219: operator + cannot be applied to <nulltype>,int
                            FakeCharacter fc = new FakeCharacter(c.getPlayer(), c.getPlayer().getId() + c.getPlayer().getFakeChars().size() + 1);
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\client\messages\CommandProcessor.java:1219: cannot find symbol
    symbol  : constructor FakeCharacter(net.sf.odinms.client.MapleCharacter,<nulltype>)
    location: class net.sf.odinms.server.maps.FakeCharacter
                            FakeCharacter fc = new FakeCharacter(c.getPlayer(), c.getPlayer().getId() + c.getPlayer().getFakeChars().size() + 1);
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\client\messages\CommandProcessor.java:1220: cannot find symbol
    symbol  : method addFakeChar(net.sf.odinms.server.maps.FakeCharacter)
    location: class net.sf.odinms.client.MapleCharacter
                            c.getPlayer().addFakeChar(fc);
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\client\messages\CommandProcessor.java:2330: cannot find symbol
    symbol  : method showFakeDamage(net.sf.odinms.client.MapleCharacter,java.awt.Point,int,int,int)
    location: class net.sf.odinms.server.maps.FakeCharacter
                                        FakeCharacter.showFakeDamage(c.getPlayer(), pos, 133333337, monster.getObjectId(), nummobs);
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\net\channel\handler\CloseRangeDamageHandler.java:142: cannot find symbol
    symbol  : method hasFakeChar()
    location: class net.sf.odinms.client.MapleCharacter
    if(c.getPlayer().hasFakeChar())
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\net\channel\handler\CloseRangeDamageHandler.java:144: cannot find symbol
    symbol  : method getFakeChars()
    location: class net.sf.odinms.client.MapleCharacter
                        for (FakeCharacter ch : c.getPlayer().getFakeChars()) {
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\net\channel\handler\CloseRangeDamageHandler.java:146: cannot find symbol
    symbol  : variable speed
    location: class net.sf.odinms.net.channel.handler.AbstractDealDamageHandler.AttackInfo
                attack.numAttackedAndDamage, attack.allDamage, attack.speed);
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\net\channel\handler\FaceExpressionHandler.java:54: cannot find symbol
    symbol  : method getFakeChars()
    location: class net.sf.odinms.client.MapleCharacter
    for (FakeCharacter ch : c.getPlayer().getFakeChars()) {
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\net\channel\handler\MovePlayerHandler.java:66: cannot find symbol
    symbol  : method hasFakeChar()
    location: class net.sf.odinms.client.MapleCharacter
    if(c.getPlayer().hasFakeChar())
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\net\channel\handler\MovePlayerHandler.java:69: cannot find symbol
    symbol  : method getFakeChars()
    location: class net.sf.odinms.client.MapleCharacter
                                for (final FakeCharacter ch : c.getPlayer().getFakeChars()) {
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\net\channel\handler\MovePlayerHandler.java:70: cannot find symbol
    symbol  : class ScheduledFuture
    location: class net.sf.odinms.net.channel.handler.MovePlayerHandler
                                    ScheduledFuture<?> scheduleRemove = TimerManager.getInstance().schedule(new Runnable() {
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\provider\xmlwz\FileStoredPngMapleCanvas.java:47: warning: com.sun.imageio.plugins.png.PNGImageReaderSpi is Sun proprietary API and may be removed in a future release
                            ImageReaderSpi readerSpi = iioRegistry.getServiceProviderByClass(PNGImageReaderSpi.class);
                                                                                             ^
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\server\maps\FakeCharacter.java:32: cannot find symbol
    symbol  : variable isfake
    location: class net.sf.odinms.client.MapleCharacter
            fakechr.isfake = true;
    C:\Users\Johann\Desktop\Repack\Repack\src\net\sf\odinms\server\maps\FakeCharacter.java:34: cannot find symbol
    symbol  : method addBotPlayer(net.sf.odinms.client.MapleCharacter)
    location: class net.sf.odinms.server.maps.MapleMap
            player.getMap().addBotPlayer(fakechr);
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    15 errors
    2 warnings
    BUILD FAILED (total time: 7 seconds)
    :P

    Also, is this important?
    Code:
    fakechr.silentGiveBuffs(player.getAllBuffs());
    Cause I don't have PlayerValueBuff thing, or whatever.

  15. #15
    Mother effin' clouds SaintsIan is offline
    GammaRank
    Apr 2008 Join Date
    fyrechat.netLocation
    2,840Posts

    Re: [Release] Clone system

    yea, alcove's one is more advance and uniqque but this is a good base starter to dev on for people that dont have their hands on one and its good :D nice release.




Page 1 of 6 123456 LastLast

Advertisement