微信扫一扫 分享朋友圈

已有 2059 人浏览分享

[服務器教學] 《Java技術》物品掉落位址 記錄

[複製鏈接]

集團新軍

Rank: 1

96

威望

125

金錢

15

A幣
主題
64
帖子
114
精華
1
綜合社群主題發文量
0
電玩社群主題發文量
0
娛樂社群主題發文量
0
技術社群主題發文量
0
閱讀權限
10
註冊時間
2016-11-17
  • TA的每日心情

    2017-2-1 17:20
  • 簽到天數: 63 天

    連續簽到: 0 天

    [LV.6]常住居民II

    雪楓月舞 發表於  2016-12-13 17:44:46 | 顯示全部樓層 | 閱讀模式
    以下是我從 MapleMap.Class 提取出的全地圖物品掉落
    以下兩個代碼 分別是 黃金楓葉和 黃色甚麼蛋的
    但是我還是沒有找到 楓葉的掉落 到底存在哪裏
    希望有可以分享一下 ^^
    這些代碼 之後我會找機會大概講解一下

    1.   private void dropFromMonster(MapleCharacter dropOwner, MapleMonster monster)
    2.   {
    3.     if ((this.dropsDisabled) || (monster.dropsDisabled())) {
    4.       return;
    5.     }
    6.     final boolean explosive = monster.isExplosive();
    7.     MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    8.     boolean isBoss = monster.isBoss();
    9.     ChannelServer cserv = dropOwner.getClient().getChannelServer();
    10.     int maxDrops;
    11.     int maxDrops;
    12.     if (explosive) {
    13.       maxDrops = 10 * cserv.getBossDropRate();
    14.     } else {
    15.       maxDrops = 4 * cserv.getDropRate();
    16.     }
    17.     List<Integer> toDrop = new ArrayList();
    18.     for (int i = 0; i < maxDrops; i++) {
    19.       toDrop.add(Integer.valueOf(monster.getDrop()));
    20.     }
    21.     if (dropOwner.getEventInstance() == null)
    22.     {
    23.       Random randomInt = new Random();
    24.       int chance = randomInt.nextInt(100);
    25.       if (chance <= 10) {
    26.         toDrop.add(Integer.valueOf(4000313));
    27.       }
    28.     }
    29.     if (dropOwner.getEventInstance() == null)
    30.     {
    31.       Random randomInt = new Random();
    32.       int chance = randomInt.nextInt(100);
    33.       if (chance <= 10) {
    34.         toDrop.add(Integer.valueOf(2022065));
    35.       }
    36.     }
    37.     Set<Integer> alreadyDropped = new HashSet();
    38.     byte htpendants = 0;byte htstones = 0;byte mesos = 0;
    39.     for (int i = 0; i < toDrop.size(); i++) {
    40.       if (((Integer)toDrop.get(i)).intValue() == -1)
    41.       {
    42.         if (!isPQMap()) {
    43.           if (alreadyDropped.contains(Integer.valueOf(-1)))
    44.           {
    45.             if (!explosive)
    46.             {
    47.               toDrop.remove(i);
    48.               i--;
    49.             }
    50.             else if (mesos < 9)
    51.             {
    52.               mesos = (byte)(mesos + 1);
    53.             }
    54.             else
    55.             {
    56.               toDrop.remove(i);
    57.               i--;
    58.             }
    59.           }
    60.           else {
    61.             alreadyDropped.add(Integer.valueOf(-1));
    62.           }
    63.         }
    64.       }
    65.       else if ((alreadyDropped.contains(toDrop.get(i))) && (!explosive))
    66.       {
    67.         toDrop.remove(i);
    68.         i--;
    69.       }
    70.       else
    71.       {
    72.         if (((Integer)toDrop.get(i)).intValue() == 2041200)
    73.         {
    74.           if (htstones > 2)
    75.           {
    76.             toDrop.remove(i);
    77.             i--;
    78.             continue;
    79.           }
    80.           htstones = (byte)(htstones + 1);
    81.         }
    82.         else if (((Integer)toDrop.get(i)).intValue() == 1122000)
    83.         {
    84.           if (htstones > 2)
    85.           {
    86.             toDrop.remove(i);
    87.             i--;
    88.             continue;
    89.           }
    90.           htpendants = (byte)(htpendants + 1);
    91.         }
    92.         alreadyDropped.add(toDrop.get(i));
    93.       }
    94.     }
    95.     if (toDrop.size() > maxDrops) {
    96.       toDrop = toDrop.subList(0, maxDrops);
    97.     }
    98.     if ((mesos < 7) && (explosive)) {
    99.       for (int i = mesos; i < 7; i++) {
    100.         toDrop.add(Integer.valueOf(-1));
    101.       }
    102.     }
    103.     int shiftDirection = 0;
    104.     int shiftCount = 0;
    105.     int curX = Math.min(Math.max(monster.getPosition().x - 25 * (toDrop.size() / 2), this.footholds.getMinDropX() + 25), this.footholds.getMaxDropX() - toDrop.size() * 25);
    106.     int curY = Math.max(monster.getPosition().y, this.footholds.getY1());
    107.     while ((shiftDirection < 3) && (shiftCount < 1000))
    108.     {
    109.       if (shiftDirection == 1) {
    110.         curX += 25;
    111.       } else if (shiftDirection == 2) {
    112.         curX -= 25;
    113.       }
    114.       for (int i = 0; i < toDrop.size(); i++)
    115.       {
    116.         MapleFoothold wall = this.footholds.findWall(new Point(curX, curY), new Point(curX + toDrop.size() * 25, curY));
    117.         if (wall != null)
    118.         {
    119.           if (wall.getX1() < curX)
    120.           {
    121.             shiftDirection = 1;
    122.             shiftCount++;
    123.             break;
    124.           }
    125.           if (wall.getX1() == curX)
    126.           {
    127.             if (shiftDirection == 0) {
    128.               shiftDirection = 1;
    129.             }
    130.             shiftCount++;
    131.             break;
    132.           }
    133.           shiftDirection = 2;
    134.           shiftCount++;
    135.           break;
    136.         }
    137.         if (i == toDrop.size() - 1) {
    138.           shiftDirection = 3;
    139.         }
    140.         final Point dropPos = calcDropPos(new Point(curX + i * 25, curY), new Point(monster.getPosition()));
    141.         final int drop = ((Integer)toDrop.get(i)).intValue();
    142.         if (drop == -1)
    143.         {
    144.           if (monster.isBoss())
    145.           {
    146.             final int cc = ChannelServer.getInstance(dropOwner.getClient().getChannel()).getMesoRate() + 25;
    147.             final MapleMonster dropMonster = monster;
    148.             Random r = new Random();
    149.             double mesoDecrease = Math.pow(0.9300000000000001D, monster.getExp() / 300.0D);
    150.             if (mesoDecrease > 1.0D) {
    151.               mesoDecrease = 1.0D;
    152.             } else if (mesoDecrease < 0.001D) {
    153.               mesoDecrease = 0.005D;
    154.             }
    155.             int tempmeso = Math.min(30000, (int)(mesoDecrease * monster.getExp() * (1.0D + r.nextInt(20)) / 10.0D));
    156.             if (dropOwner.getBuffedValue(MapleBuffStat.MESOUP) != null) {
    157.               tempmeso = (int)(tempmeso * dropOwner.getBuffedValue(MapleBuffStat.MESOUP).doubleValue() / 100.0D);
    158.             }
    159.             final int dmesos = tempmeso;
    160.             if (dmesos > 0)
    161.             {
    162.               final MapleCharacter dropChar = dropOwner;
    163.               final boolean publicLoott = isPQMap();
    164.               TimerManager.getInstance().schedule(new Runnable()
    165.               {
    166.                 public void run()
    167.                 {
    168.                   MapleMap.this.spawnMesoDrop(dmesos * cc, dmesos, dropPos, dropMonster, dropChar, (explosive) || (publicLoott));
    169.                 }
    170.               }, monster.getAnimationTime("die1"));
    171.             }
    172.           }
    173.           else
    174.           {
    175.             final int mesoRate = ChannelServer.getInstance(dropOwner.getClient().getChannel()).getMesoRate();
    176.             Random r = new Random();
    177.             double mesoDecrease = Math.pow(0.9300000000000001D, monster.getExp() / 300.0D);
    178.             if (mesoDecrease > 1.0D) {
    179.               mesoDecrease = 1.0D;
    180.             }
    181.             int tempmeso = Math.min(30000, (int)(mesoDecrease * monster.getExp() * (1.0D + r.nextInt(20)) / 10.0D));
    182.             if (dropOwner.getBuffedValue(MapleBuffStat.MESOUP) != null) {
    183.               tempmeso = (int)(tempmeso * dropOwner.getBuffedValue(MapleBuffStat.MESOUP).doubleValue() / 100.0D);
    184.             }
    185.             final int meso = tempmeso;
    186.             if (meso > 0)
    187.             {
    188.               MapleMonster dropMonster = monster;
    189.               final MapleCharacter dropChar = dropOwner;
    190.               boolean publicLoott = isPQMap();
    191.               TimerManager.getInstance().schedule(new Runnable()
    192.               {
    193.                 public void run()
    194.                 {
    195.                   dropChar.gainMeso(meso * mesoRate, true, true);
    196.                 }
    197.               }, monster.getAnimationTime("die1"));
    198.             }
    199.           }
    200.         }
    201.         else
    202.         {
    203.           MapleInventoryType type = ii.getInventoryType(drop);
    204.           IItem idrop;
    205.           IItem idrop;
    206.           if (type.equals(MapleInventoryType.EQUIP))
    207.           {
    208.             Equip nEquip = ii.randomizeStats(dropOwner.getClient(), (Equip)ii.getEquipById(drop));
    209.             idrop = nEquip;
    210.           }
    211.           else
    212.           {
    213.             idrop = new Item(drop, (byte)0, (short)1);
    214.             if ((ii.isArrowForBow(drop)) || (ii.isArrowForCrossBow(drop)))
    215.             {
    216.               if (dropOwner.getJob().getId() / 100 == 3) {
    217.                 idrop.setQuantity((short)(int)(1.0D + 100.0D * Math.random()));
    218.               }
    219.             }
    220.             else if ((ii.isThrowingStar(drop)) || (ii.isBullet(drop))) {
    221.               idrop.setQuantity((short)1);
    222.             }
    223.           }
    224.           final MapleMapItem mdrop = new MapleMapItem(idrop, dropPos, monster, dropOwner);
    225.           final MapleMapObject dropMonster = monster;
    226.           final MapleCharacter dropChar = dropOwner;
    227.           final TimerManager tMan = TimerManager.getInstance();
    228.           tMan.schedule(new Runnable()
    229.           {
    230.             public void run()
    231.             {
    232.               MapleMap.this.spawnAndAddRangedMapObject(mdrop, new MapleMap.DelayedPacketCreation()
    233.               {
    234.                 public void sendPackets(MapleClient c)
    235.                 {
    236.                   c.getSession().write(MaplePacketCreator.dropItemFromMapObject(MapleMap.3.this.val$drop, MapleMap.3.this.val$mdrop.getObjectId(), MapleMap.3.this.val$dropMonster.getObjectId(), MapleMap.3.this.val$explosive ? 0 : MapleMap.3.this.val$dropChar.getId(), MapleMap.3.this.val$dropMonster.getPosition(), MapleMap.3.this.val$dropPos, (byte)1));
    237.                 }
    238.               }, null);
    239.               

    240.               tMan.schedule(new MapleMap.ExpireMapItemJob(MapleMap.this, mdrop), MapleMap.this.dropLife);
    241.             }
    242.           }, monster.getAnimationTime("die1"));
    243.         }
    244.       }
    245.     }
    246.   }
    複製代碼
    共收到 0 A幣
    打賞榜
    暫無
    暫無
    暫無
    暫無
    ----
    暫無
    ----
    暫無
    ----
    暫無
    ----

    集團新軍

    Rank: 1

    74

    威望

    360

    金錢

    39

    A幣
    主題
    6
    帖子
    72
    精華
    1
    綜合社群主題發文量
    16
    電玩社群主題發文量
    0
    娛樂社群主題發文量
    0
    技術社群主題發文量
    1
    閱讀權限
    10
    註冊時間
    2019-7-14
  • TA的每日心情

    2021-8-26 04:55
  • 簽到天數: 26 天

    連續簽到: 1 天

    [LV.4]偶爾看看III

    卡歐悉 發表於 2020-7-12 21:38:39 | 顯示全部樓層
    換個思路 直接用楓葉的ID回去找整個SRC內的內容
    您需要登錄後才可以回帖 登錄 | 註冊會員

    本版積分規則

    114

    發文

    125

    金錢

    15

    A幣

    ----------榮譽勳章----------

    熱門推薦
    圖文推薦
    • 聯繫我們

    小黑屋|AICL社群娛樂集團

    GMT+8, 2024-5-5 02:19 , 網路刷新 0.104653 秒 .

    歡迎來到 AICL網路社群

    版權AICL社群所有 2011-2021.

    Total:123 Today:213 Online:322