FakeCharacter.java
上传用户:gwt600
上传日期:2021-06-03
资源大小:704k
文件大小:2k
源码类别:

游戏

开发平台:

Java

  1. package net.sf.odinms.server.maps;
  2. import net.sf.odinms.client.IItem;
  3. import net.sf.odinms.client.MapleCharacter;
  4. import net.sf.odinms.client.MapleClient;
  5. import net.sf.odinms.client.MapleInventoryType;
  6. import net.sf.odinms.tools.MockIOSession;
  7. /**
  8.  *
  9.  * @author Patrick/PurpleMadness
  10.  */
  11. public class FakeCharacter {
  12.     private MapleCharacter ch;
  13. private MapleCharacter owner;
  14.     private boolean follow = true;
  15.     public FakeCharacter(MapleCharacter player, int id) {
  16.         MapleCharacter clone = new MapleCharacter();
  17.         clone.setFake();
  18.         clone.setHair(player.getHair());
  19.         clone.setFace(player.getFace());
  20.         clone.setSkinColor(player.getSkinColor());
  21.         clone.setName(player.getName(), false);
  22.         clone.setID(id + 100000);
  23.         clone.setLevel(player.getLevel());
  24.         clone.setJob(player.getJob().getId());
  25.         clone.setMap(player.getMap());
  26.         clone.setPosition(player.getPosition());
  27.         clone.silentGiveBuffs(player.getAllBuffs());
  28.         for (IItem equip : player.getInventory(MapleInventoryType.EQUIPPED)) {
  29.             clone.getInventory(MapleInventoryType.EQUIPPED).addFromDB(equip);
  30.         }
  31.         for (IItem equip : player.getInventory(MapleInventoryType.EQUIP)) {
  32.             clone.getInventory(MapleInventoryType.EQUIP).addFromDB(equip);
  33.         }
  34.         player.getMap().addBotPlayer(clone);
  35.         clone.setClient(new MapleClient(null, null, new MockIOSession()));
  36.         ch = clone;
  37. owner = player;
  38.     }
  39.     public MapleCharacter getFakeChar() {
  40.         return ch;
  41.     }
  42.     public boolean follow() {
  43.         return follow;
  44.     }
  45.     public void setFollow(boolean set) {
  46.         follow = set;
  47.     }
  48. public MapleCharacter getOwner() {
  49. return owner;
  50. }
  51. }