Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Idea]Bots that play with you.

Newbie Spellweaver
Joined
Apr 11, 2008
Messages
18
Reaction score
1
yeah just got this wierd idea for Maple.
This is like a recommendation for low people server
There shuld be like 3 bots in a party.
And they help you kill stuff.
But the only bad stuffs are
-They don't kill if your afk
-They will only be there for a limited time
-They cost alot but not tooooo much.
 
Junior Spellweaver
Joined
Apr 24, 2008
Messages
153
Reaction score
0
is that even possible? i remember someone tried making something like this but a clone of a player and it never was started or finished lmao
 
Junior Spellweaver
Joined
Jul 8, 2008
Messages
164
Reaction score
0
I just looked at MovePlayerHandler.java and found this:

Code:
	protected List<LifeMovementFragment> parseMovement(LittleEndianAccessor lea) {
		List<LifeMovementFragment> res = new ArrayList<LifeMovementFragment>();
		int numCommands = lea.readByte();
		for (int i = 0; i < numCommands; i++) {
			int command = lea.readByte();
			switch (command) {
				case 0: // normal move
				case 5:
				case 17: // Float
				{
					int xpos = lea.readShort();
					int ypos = lea.readShort();
					int xwobble = lea.readShort();
					int ywobble = lea.readShort();
					int unk = lea.readShort();
					int newstate = lea.readByte();
					int duration = lea.readShort();
					AbsoluteLifeMovement alm = new AbsoluteLifeMovement(command, new Point(xpos, ypos), duration, newstate);
					alm.setUnk(unk);
					alm.setPixelsPerSecond(new Point(xwobble, ywobble));
					// log.trace("Move to {},{} command {} wobble {},{} ? {} state {} duration {}", new Object[] { xpos,
					// xpos, command, xwobble, ywobble, newstate, duration });
					res.add(alm);
					break;
				}
				case 1:
				case 2:
				case 6: // fj
                                case 12: //Monster KB
				case 13: // Shot-jump-back thing
				case 16: // Float
				{
					int xmod = lea.readShort();
					int ymod = lea.readShort();
					int newstate = lea.readByte();
					int duration = lea.readShort();
					RelativeLifeMovement rlm = new RelativeLifeMovement(command, new Point(xmod, ymod), duration, newstate);
					res.add(rlm);
					// log.trace("Relative move {},{} state {}, duration {}", new Object[] { xmod, ymod, newstate,
					// duration });
					break;
				}
				case 3:
				case 4: // tele... -.-
				case 7: // assaulter
				case 8: // assassinate
				case 9: // rush
				case 14:
				{
					int xpos = lea.readShort();
					int ypos = lea.readShort();
					int xwobble = lea.readShort();
					int ywobble = lea.readShort();
					int newstate = lea.readByte();
					TeleportMovement tm = new TeleportMovement(command, new Point(xpos, ypos), newstate);
					tm.setPixelsPerSecond(new Point(xwobble, ywobble));
					res.add(tm);
					break;
				}
				case 10: // change equip ???
				{
					res.add(new ChangeEquipSpecialAwesome(lea.readByte()));
					break;
				}
				case 11: // chair
				{
					int xpos = lea.readShort();
					int ypos = lea.readShort();
					int unk = lea.readShort();
					int newstate = lea.readByte();
					int duration = lea.readShort();
					ChairMovement cm = new ChairMovement(command, new Point(xpos, ypos), duration, newstate);
					cm.setUnk(unk);
					res.add(cm);
					break;
				}
				case 15:
				{
					int xpos = lea.readShort();
					int ypos = lea.readShort();
					int xwobble = lea.readShort();
					int ywobble = lea.readShort();
					int unk = lea.readShort();
					int fh = lea.readShort();
					int newstate = lea.readByte();
					int duration = lea.readShort();
					JumpDownMovement jdm = new JumpDownMovement(command, new Point(xpos, ypos), duration, newstate);
					jdm.setUnk(unk);
					jdm.setPixelsPerSecond(new Point(xwobble, ywobble));
					jdm.setFH(fh);
					// log.trace("Move to {},{} command {} wobble {},{} ? {} state {} duration {}", new Object[] { xpos,
					// xpos, command, xwobble, ywobble, newstate, duration });
					res.add(jdm);
					break;
				}
				default: {
					log.warn("Unhandeled movement command {} received", command);
					log.warn("Movement packet: {}", lea.toString());
					return null;
				}
			}
		}
		if (numCommands != res.size()) {
			log.warn("numCommands ({}) does not match the number of deserialized movement commands ({})", numCommands, res.size());
		}
		return res;
	}

	protected void updatePosition(List<LifeMovementFragment> movement, AnimatedMapleMapObject target, int yoffset) {
		for (LifeMovementFragment move : movement) {
			if (move instanceof LifeMovement) {
				if (move instanceof AbsoluteLifeMovement) {
					Point position = ((LifeMovement) move).getPosition();
					position.y += yoffset;
					target.setPosition(position);
				}
				target.setStance(((LifeMovement) move).getNewstate());
			}
		}
	}

^^ That is what parses your movement from a SeekableLittleEndianAccessor. We could mock that parse function to use with a fakechar.

Also, we can use MockIOSession.java for the client, null and null for the recv and send cryptos.

You just need to make some AI for them now.

Just made some code for the client lol

Code:
MapleClient fclient = new MapleClient(new MockIOSession(), null, null);
MapleCharacter fchar = MapleCharacter.createFakeCharThatLooksLikeMe(c.getPlayer());
fclient.setPlayer(fchar);
fchar.setClient(fclient);

c.getPlayer().getMap().addPlayer(fchar);

Now all we need is the AI
 
Newbie Spellweaver
Joined
Jun 23, 2008
Messages
61
Reaction score
0
Jvlaple, you mind adding me on MSN, reply me on this thread if you do or dont, then ill give you my msn...
 
Junior Spellweaver
Joined
Jul 8, 2008
Messages
164
Reaction score
0
Made this after a bit:

Code:
public class FakeChar extends AbstractAnimatedMapleMapObject {
	static Logger log = LoggerFactory.getLogger(FakeChar.class);
	protected int hp, mp, exp, ownerid;
	protected int maxhp, maxmp, level;
	protected MapleCharacter owner;

	protected FakeChar() {
		setStance(0);
		hp = -1;
		mp = -1;
		exp = -1;
		owner = null;
	}
	
	public static FakeChar loadFromDB(MapleCharacter owner) {
		try {
			FakeChar ret = new FakeChar();
			Connection con = DatabaseConnection.getConnection();
			PreparedStatement ps = con.prepareStatement("SELECT * FROM fakechar WHERE ownerid = ?");
			ps.setInt(1, owner.getId());
			ResultSet rs = ps.executeQuery();
			if (rs.next()) {
				ret.hp = rs.getInt("hp");
				ret.mp = rs.getInt("mp");
				ret.exp = rs.getInt("exp");
				ret.maxhp = rs.getInt("maxhp");
				ret.maxmp = rs.getInt("maxmp");
				ret.level = rs.getInt("level");
			} else {
				throw new RuntimeException("Loading fakechar failed (char not found!)");
			}
			return ret;
		} catch (SQLException sqle) {
			log.severe("Exception! This sucks. {}", sqle);
			return null;
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		}
	}
	
    public int getExp() {
        return exp;
    }

    public void setExp(int exp) {
        this.exp = exp;
    }

    public int getHp() {
        return hp;
    }

    public void setHp(int hp) {
        this.hp = hp;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getMaxhp() {
        return maxhp;
    }

    public void setMaxhp(int maxhp) {
        this.maxhp = maxhp;
    }

    public int getMaxmp() {
        return maxmp;
    }

    public void setMaxmp(int maxmp) {
        this.maxmp = maxmp;
    }

    public int getMp() {
        return mp;
    }

    public void setMp(int mp) {
        this.mp = mp;
    }

    public MapleCharacter getOwner() {
        return owner;
    }

    public void setOwner(MapleCharacter owner) {
        this.owner = owner;
    }

    public int getOwnerid() {
        return ownerid;
    }

    public void setOwnerid(int ownerid) {
        this.ownerid = ownerid;
    }
}

EDIT: What is your MSN?
 
Junior Spellweaver
Joined
Jul 8, 2008
Messages
164
Reaction score
0
Added you.

Update:

Code:
public class FakeChar extends AbstractAnimatedMapleMapObject {
	static Logger log = LoggerFactory.getLogger(FakeChar.class);
	protected int hp, mp, exp, ownerid;
	protected int maxhp, maxmp, level;
	protected MapleCharacter owner;
	protected int id;

	protected FakeChar() {
		setStance(0);
		hp = -1;
		mp = -1;
		exp = -1;
		owner = null;
	}
	
	public static FakeChar loadFromDB(MapleCharacter owner) {
		try {
			FakeChar ret = new FakeChar();
			Connection con = DatabaseConnection.getConnection();
			PreparedStatement ps = con.prepareStatement("SELECT * FROM fakechar WHERE ownerid = ?");
			ps.setInt(1, owner.getId());
			ResultSet rs = ps.executeQuery();
			if (rs.next()) {
				ret.id = rs.getInt("id");
				ret.hp = rs.getInt("hp");
				ret.mp = rs.getInt("mp");
				ret.exp = rs.getInt("exp");
				ret.maxhp = rs.getInt("maxhp");
				ret.maxmp = rs.getInt("maxmp");
				ret.level = rs.getInt("level");
				ret.ownerid = owner.getObjectId();
			} else {
				throw new RuntimeException("Loading fakechar failed (char not found!)");
			}
			return ret;
		} catch (SQLException sqle) {
			log.severe("Exception! This sucks. {}", sqle);
			return null;
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		}
	}
	
	public void step() {
	
	}
	
    public int getExp() {
        return exp;
    }

    public void setExp(int exp) {
        this.exp = exp;
    }

    public int getHp() {
        return hp;
    }

    public void setHp(int hp) {
        this.hp = hp;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getMaxhp() {
        return maxhp;
    }

    public void setMaxhp(int maxhp) {
        this.maxhp = maxhp;
    }

    public int getMaxmp() {
        return maxmp;
    }

    public void setMaxmp(int maxmp) {
        this.maxmp = maxmp;
    }

    public int getMp() {
        return mp;
    }

    public void setMp(int mp) {
        this.mp = mp;
    }

    public MapleCharacter getOwner() {
        return owner;
    }

    public void setOwner(MapleCharacter owner) {
        this.owner = owner;
    }

    public int getOwnerid() {
        return ownerid;
    }

    public void setOwnerid(int ownerid) {
        this.ownerid = ownerid;
    }
	
	@Override public int getObjectId() {
		return id;
	}
	
	@Override
	public void sendDestroyData(MapleClient client) {
		client.getSession().write(MaplePacketCreator.removePlayerFromMap(this.getObjectId()));
	}

	@Override
	public void sendSpawnData(MapleClient client) {
		client.getSession().write(MaplePacketCreator.spawnPlayerMapobject(this));
	}
}

Made it so others can see you =D
 
Newbie Spellweaver
Joined
Dec 11, 2008
Messages
38
Reaction score
0
Start dev this gogogo~! need any help?
btw good luck on this, this should be in the dev sction...
 
Junior Spellweaver
Joined
Jul 8, 2008
Messages
164
Reaction score
0
Added poop AI

Code:
public class FakeChar extends AbstractAnimatedMapleMapObject {
	static Logger log = LoggerFactory.getLogger(FakeChar.class);
	protected int hp, mp, exp, ownerid;
	protected int maxhp, maxmp, level;
	protected MapleCharacter owner;
	protected int id;

	protected FakeChar() {
		setStance(0);
		hp = -1;
		mp = -1;
		exp = -1;
		owner = null;
	}
	
	public static FakeChar loadFromDB(MapleCharacter owner) {
		try {
			FakeChar ret = new FakeChar();
			Connection con = DatabaseConnection.getConnection();
			PreparedStatement ps = con.prepareStatement("SELECT * FROM fakechar WHERE ownerid = ?");
			ps.setInt(1, owner.getId());
			ResultSet rs = ps.executeQuery();
			if (rs.next()) {
				ret.id = rs.getInt("id");
				ret.hp = rs.getInt("hp");
				ret.mp = rs.getInt("mp");
				ret.exp = rs.getInt("exp");
				ret.maxhp = rs.getInt("maxhp");
				ret.maxmp = rs.getInt("maxmp");
				ret.level = rs.getInt("level");
				ret.ownerid = owner.getObjectId();
			} else {
				throw new RuntimeException("Loading fakechar failed (char not found!)");
			}
			return ret;
		} catch (SQLException sqle) {
			log.severe("Exception! This sucks. {}", sqle);
			return null;
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		}
	}
	
	public void step() {
		try {
			Point ownerPos = owner.getPosition();
			if (this.getPosition().x < ownerPos) {
				setPosition(new Point(getPosition().x - 2,
										getPosition().y));
				} else {
				setPosition(new Point(getPosition().x - 2,
										getPosition().y));
				}
		} catch (Exception ex) {
			log.severe("duck this poop {}", ex);
		}
	}
	
	public SeekableLittleEndianAccessor createSleaFromMovement() { //dont know how to impl atm
		return null;
	}
	
    public int getExp() {
        return exp;
    }

    public void setExp(int exp) {
        this.exp = exp;
    }

    public int getHp() {
        return hp;
    }

    public void setHp(int hp) {
        this.hp = hp;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getMaxhp() {
        return maxhp;
    }

    public void setMaxhp(int maxhp) {
        this.maxhp = maxhp;
    }

    public int getMaxmp() {
        return maxmp;
    }

    public void setMaxmp(int maxmp) {
        this.maxmp = maxmp;
    }

    public int getMp() {
        return mp;
    }

    public void setMp(int mp) {
        this.mp = mp;
    }

    public MapleCharacter getOwner() {
        return owner;
    }

    public void setOwner(MapleCharacter owner) {
        this.owner = owner;
    }

    public int getOwnerid() {
        return ownerid;
    }

    public void setOwnerid(int ownerid) {
        this.ownerid = ownerid;
    }
	
	@Override public int getObjectId() {
		return id;
	}
	
	@Override
	public void sendDestroyData(MapleClient client) {
		client.getSession().write(MaplePacketCreator.removePlayerFromMap(this.getObjectId()));
	}

	@Override
	public void sendSpawnData(MapleClient client) {
		client.getSession().write(MaplePacketCreator.spawnPlayerMapobject(this));
	}
}

Tried to make a parse function, but didn't work.
 
Newbie Spellweaver
Joined
Apr 29, 2008
Messages
59
Reaction score
0
Good luck on this..
If this really works,its gonna be a epic release~
 
Back
Top