コード例 #1
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 0) {
        if (dialog == DialogAction.QUEST_ACCEPT_1) {
          removeQuestItem(env, 182206844, 1);
          QuestService.startQuest(env);
          return closeDialogWindow(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799049) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else if (dialog == DialogAction.SELECT_ACTION_2034) {
          return sendQuestDialog(env, 2034);
        } else if (dialog == DialogAction.SELECT_QUEST_REWARD) {
          if (player.getInventory().getKinah() >= 20000000) {
            player.getInventory().decreaseKinah(20000000);
            return sendQuestDialog(env, 5);
          } else return sendQuestDialog(env, 3739);
        } else return sendQuestEndDialog(env);
      }
    }
    return false;
  }
コード例 #2
0
  @Override
  public void act(Player player, Item parentItem, Item targetItem) {
    if (!player.getInventory().decreaseByObjectId(parentItem.getObjectId(), 1)) {
      return;
    }
    if (targetItem.getItemSkinTemplate().isItemDyePermitted()) {
      if (getColorBGRA() == 0) {
        targetItem.setItemColor(0);
        targetItem.setColorExpireTime(0);
      } else {
        targetItem.setItemColor(parentItem.getItemTemplate().getTemplateId());
        if (minutes != null) {
          targetItem.setColorExpireTime((int) (System.currentTimeMillis() / 1000 + minutes * 60));
        }
      }

      // item is equipped, so need broadcast packet
      if (player.getEquipment().getEquippedItemByObjId(targetItem.getObjectId()) != null) {
        PacketSendUtility.broadcastPacket(
            player,
            new SM_UPDATE_PLAYER_APPEARANCE(
                player.getObjectId(), player.getEquipment().getEquippedForApparence()),
            true);
        player.getEquipment().setPersistentState(PersistentState.UPDATE_REQUIRED);
      } // item is not equipped
      else {
        player.getInventory().setPersistentState(PersistentState.UPDATE_REQUIRED);
      }

      ItemPacketService.updateItemAfterInfoChange(player, targetItem);
    }
  }
コード例 #3
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 799336) { // Tataka
        if (player.getInventory().getItemCountByItemId(102000690)
            >= 1) { // Noble Siel's Supreme Mace
          if (dialog == DialogAction.QUEST_SELECT) {
            return sendQuestDialog(env, 4762);
          } else {
            return sendQuestStartDialog(env);
          }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799336) { // Tataka
        if (dialog == DialogAction.USE_OBJECT) {
          if (player.getInventory().getItemCountByItemId(182213290) > 0) {
            return sendQuestDialog(env, 10002);
          }
        } else {
          removeQuestItem(env, 182213290, 1);
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
コード例 #4
0
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVars().getQuestVars();
     if (var == 12) {
       if (player.getWorldId() == 300160000) {
         qs.setQuestVar(13);
         updateQuestStatus(env);
         return true;
       } else {
         if (player.getInventory().getItemCountByItemId(182206613) == 0) {
           return giveQuestItem(env, 182206613, 1);
         }
       }
     } else if (var >= 13 && var < 16) {
       if (player.getWorldId() != 300160000) {
         changeQuestStep(env, var, 12, false);
         if (player.getInventory().getItemCountByItemId(182206613) == 0) {
           giveQuestItem(env, 182206613, 1);
         }
         return true;
       }
     }
   }
   return false;
 }
コード例 #5
0
 @Override
 public void act(Player player, Item parentItem, HouseObject<?> targetHouseObject) {
   if (!player.getInventory().decreaseByObjectId(parentItem.getObjectId(), 1)) {
     return;
   }
   if (color.equals("no")) {
     targetHouseObject.setColor(null);
   } else {
     targetHouseObject.setColor(Integer.parseInt(color, 16));
   }
   float x = targetHouseObject.getX();
   float y = targetHouseObject.getY();
   float z = targetHouseObject.getZ();
   int rotation = targetHouseObject.getRotation();
   PacketSendUtility.sendPacket(player, new SM_HOUSE_EDIT(7, 0, targetHouseObject.getObjectId()));
   PacketSendUtility.sendPacket(
       player, new SM_HOUSE_EDIT(5, targetHouseObject.getObjectId(), x, y, z, rotation));
   targetHouseObject.spawn();
   int objectName = targetHouseObject.getObjectTemplate().getNameId();
   if (color.equals("no")) {
     PacketSendUtility.sendPacket(
         player, SM_SYSTEM_MESSAGE.STR_MSG_ITEM_PAINT_REMOVE_SUCCEED(objectName));
   } else {
     int paintName = parentItem.getItemTemplate().getNameId();
     PacketSendUtility.sendPacket(
         player, SM_SYSTEM_MESSAGE.STR_MSG_ITEM_PAINT_SUCCEED(objectName, paintName));
   }
 }
コード例 #6
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    if (targetId == 0) {
      if (env.getDialogId() == 1002) {
        QuestService.startQuest(env, QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 203075) {
      if (qs != null) {
        if (env.getDialogId() == 25 && qs.getStatus() == QuestStatus.START) {
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        } else if (env.getDialogId() == 1009) {
          player.getInventory().removeFromBagByItemId(182200501, 1);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(player, qs);
          return defaultQuestEndDialog(env);
        } else return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
コード例 #7
0
 @Override
 protected void handleDialogStart(Player player) {
   if (player.getInventory().getItemCountByItemId(186000236) > 0) {
     super.handleDialogStart(player);
   } else {
     PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(getObjectId(), 27));
     PacketSendUtility.sendMessage(
         player, "You need item [item: 186000236] to ask reinforcements");
   }
 }
コード例 #8
0
  /**
   * This method is used for creating new players
   *
   * @param playerCommonData
   * @param playerAppearance
   * @return Player
   */
  public static Player newPlayer(
      PlayerCommonData playerCommonData, PlayerAppearance playerAppearance) {
    PlayerInitialData playerInitialData = DataManager.PLAYER_INITIAL_DATA;
    LocationData ld = playerInitialData.getSpawnLocation(playerCommonData.getRace());

    WorldPosition position =
        World.getInstance()
            .createPosition(ld.getMapId(), ld.getX(), ld.getY(), ld.getZ(), ld.getHeading());
    playerCommonData.setPosition(position);

    Player newPlayer = new Player(new PlayerController(), playerCommonData, playerAppearance);

    // Starting skills
    SkillLearnService.addNewSkills(newPlayer, true);

    // Starting items
    PlayerCreationData playerCreationData =
        playerInitialData.getPlayerCreationData(playerCommonData.getPlayerClass());

    List<ItemType> items = playerCreationData.getItems();

    Storage playerInventory = new Storage(StorageType.CUBE);
    Storage regularWarehouse = new Storage(StorageType.REGULAR_WAREHOUSE);
    Storage accountWarehouse = new Storage(StorageType.ACCOUNT_WAREHOUSE);

    Equipment equipment = new Equipment(newPlayer);
    newPlayer.setStorage(playerInventory, StorageType.CUBE);
    newPlayer.setStorage(regularWarehouse, StorageType.REGULAR_WAREHOUSE);
    newPlayer.setStorage(accountWarehouse, StorageType.ACCOUNT_WAREHOUSE);
    newPlayer.setEquipment(equipment);
    newPlayer.setMailbox(new Mailbox());

    for (ItemType itemType : items) {
      int itemId = itemType.getTemplate().getTemplateId();
      Item item = ItemService.newItem(itemId, itemType.getCount());
      if (item == null) continue;

      // When creating new player - all equipment that has slot values will be equipped
      // Make sure you will not put into xml file more items than possible to equip.
      ItemTemplate itemTemplate = item.getItemTemplate();
      item.setOwnerId(newPlayer.getObjectId());
      if (itemTemplate.isArmor() || itemTemplate.isWeapon()) {
        item.setEquipped(true);
        List<ItemSlot> itemSlots = ItemSlot.getSlotsFor(itemTemplate.getItemSlot());
        item.setEquipmentSlot(itemSlots.get(0).getSlotIdMask());
        equipment.onLoadHandler(item);
      } else ItemService.onLoadHandler(newPlayer, newPlayer.getInventory(), item);
    }
    equipment.onLoadApplyEquipmentStats();
    /** Mark inventory and equipment as UPDATE_REQUIRED to be saved during character creation */
    playerInventory.setPersistentState(PersistentState.UPDATE_REQUIRED);
    equipment.setPersistentState(PersistentState.UPDATE_REQUIRED);
    return newPlayer;
  }
コード例 #9
0
ファイル: ItemService.java プロジェクト: shanecode/aion-dev
  /**
   * Adds item count to player inventory I moved this method to service cause right implementation
   * of it is critical to server operation and could cause starvation of object ids.
   *
   * <p>This packet will send necessary packets to client (initialize used only from quest engine
   *
   * @param player
   * @param itemId
   * @param count - amount of item that were not added to player's inventory
   */
  public int addItem(Player player, int itemId, int count, boolean isQuestItem) {
    Storage inventory = player.getInventory();

    ItemTemplate itemTemplate = DataManager.ITEM_DATA.getItemTemplate(itemId);
    if (itemTemplate == null) return count;

    int maxStackCount = itemTemplate.getMaxStackCount();

    if (itemId == ItemId.KINAH.value()) {
      inventory.increaseKinah(count);
      return 0;
    } else {
      /** Increase count of existing items */
      List<Item> existingItems =
          inventory.getAllItemsByItemId(
              itemId); // look for existing in equipment. need for power shards.
      for (Item existingItem : existingItems) {
        if (count == 0) break;

        int freeCount = maxStackCount - existingItem.getItemCount();
        if (count <= freeCount) {
          existingItem.increaseItemCount(count);
          count = 0;
        } else {
          existingItem.increaseItemCount(freeCount);
          count -= freeCount;
        }

        updateItem(player, existingItem, false);
      }

      /** Create new stacks */
      while (!inventory.isFull() && count > 0) {
        // item count still more than maxStack value
        if (count > maxStackCount) {
          Item item = newItem(itemId, maxStackCount);
          item.setQuest(isQuestItem);
          count -= maxStackCount;
          inventory.putToBag(item);
          updateItem(player, item, true);
        } else {
          Item item = newItem(itemId, count);
          item.setQuest(isQuestItem);
          inventory.putToBag(item);
          updateItem(player, item, true);
          count = 0;
        }
      }

      return count;
    }
  }
コード例 #10
0
ファイル: ItemUseAction.java プロジェクト: soulxj/aion-cn
 @Override
 public boolean act(Skill skill) {
   if (skill.getEffector() instanceof Player) {
     ItemTemplate item = DataManager.ITEM_DATA.getItemTemplate(itemid);
     Player player = (Player) skill.getEffector();
     Storage inventory = player.getInventory();
     if (!inventory.decreaseByItemId(itemid, count)) {
       PacketSendUtility.sendPacket(
           player,
           SM_SYSTEM_MESSAGE.STR_SKILL_NOT_ENOUGH_ITEM(new DescriptionId(item.getNameId())));
       return false;
     }
   }
   return true;
 }
コード例 #11
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    int targetId = env.getTargetId();
    DialogAction dialog = env.getDialog();
    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 203837) {
        if (dialog == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 4762);
        else return sendQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs != null && qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      if (targetId == 203837) {
        if (dialog == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
        else if (dialog == DialogAction.CHECK_USER_HAS_QUEST_ITEM) {
          if (var == 0 && player.getInventory().getItemCountByItemId(182209613) >= 30) {
            removeQuestItem(env, 182209613, 30);
            changeQuestStep(env, 0, 0, true, 0);
            return sendQuestDialog(env, 10000);
          } else return sendQuestDialog(env, 10001);
        }
        return false;
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798941) {
        switch (dialog) {
          case USE_OBJECT:
            return sendQuestDialog(env, 10002);
          case SELECT_QUEST_REWARD:
            return sendQuestDialog(env, 5);
          default:
            return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
コード例 #12
0
  @Override
  public void act(Player player, Item parentItem, Item targetItem) {
    if (!player.getInventory().decreaseByObjectId(parentItem.getObjectId(), 1)) {
      return;
    }
    ItemTemplate itemTemplate = parentItem.getItemTemplate();
    PacketSendUtility.broadcastPacket(
        player,
        new SM_ITEM_USAGE_ANIMATION(
            player.getObjectId(), parentItem.getObjectId(), itemTemplate.getTemplateId()),
        true);

    switch (storage) {
      case CUBE:
        CubeExpandService.expand(player, false);
        break;
      case WAREHOUSE:
        WarehouseService.expand(player);
        break;
    }
  }
コード例 #13
0
 /* (non-Javadoc)
  * @see com.aionemu.gameserver.questEngine.handlers.template.xmlQuest.condition.QuestCondition#doCheck(com.aionemu.gameserver.questEngine.model.QuestEnv)
  */
 @Override
 public boolean doCheck(QuestEnv env) {
   Player player = env.getPlayer();
   long itemCount = player.getInventory().getItemCountByItemId(itemId);
   switch (getOp()) {
     case EQUAL:
       return itemCount == count;
     case GREATER:
       return itemCount > count;
     case GREATER_EQUAL:
       return itemCount >= count;
     case LESSER:
       return itemCount < count;
     case LESSER_EQUAL:
       return itemCount <= count;
     case NOT_EQUAL:
       return itemCount != count;
     default:
       return false;
   }
 }
コード例 #14
0
 @Override
 public boolean onDialogEvent(QuestEnv env) {
   final Player player = env.getPlayer();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) {
     targetId = ((Npc) env.getVisibleObject()).getNpcId();
   }
   if (targetId == 798926) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) {
         return sendQuestDialog(env, 1011);
       } else {
         return sendQuestStartDialog(env);
       }
     } else if (qs.getStatus() == QuestStatus.START) {
       long itemCount;
       if (env.getDialog() == DialogAction.QUEST_SELECT && qs.getQuestVarById(0) == 0) {
         return sendQuestDialog(env, 2375);
       } else if (env.getDialogId() == DialogAction.CHECK_USER_HAS_QUEST_ITEM.id()
           && qs.getQuestVarById(0) == 0) {
         itemCount = player.getInventory().getItemCountByItemId(182209601);
         if (itemCount > 0) {
           removeQuestItem(env, 182209601, 1);
           qs.setStatus(QuestStatus.REWARD);
           updateQuestStatus(env);
           return sendQuestDialog(env, 5);
         } else {
           return sendQuestDialog(env, 2716);
         }
       } else {
         return sendQuestEndDialog(env);
       }
     } else {
       return sendQuestEndDialog(env);
     }
   }
   return false;
 }
コード例 #15
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (targetId == 0) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 1002) {
          questService.startQuest(env, QuestStatus.START);
          if (!itemService.addItems(
              player, Collections.singletonList(new QuestItems(182200226, 1)))) ;
          player.getInventory().removeFromBagByItemId(182200214, 1);
          PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
          return true;
        } else PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
      }
    }

    if (qs == null) return false;

    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203075 && var == 4) {
        if (env.getDialogId() == -1)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        else if (env.getDialogId() == 1009)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 6);
        else return defaultQuestEndDialog(env);
      } else if (targetId == 203058 && var == 3) return defaultQuestEndDialog(env);
    } else if (qs.getStatus() != QuestStatus.START) return false;

    if (targetId == 203075) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 0) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
          else if (var == 2)
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
          else if (var == 3)
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);

        case 1009:
          if (var == 2) {
            qs.setQuestVarById(0, var + 2);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            player.getInventory().removeFromBagByItemId(182200217, 1);
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 6);
          }
          if (var == 3) {
            qs.setQuestVarById(0, var + 1);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            player.getInventory().removeFromBagByItemId(182200217, 1);
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 6);
          }
        case 10000:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            player.getInventory().removeFromBagByItemId(182200226, 1);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10001:
          if (var == 2) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 700008) {
      switch (env.getDialogId()) {
        case -1:
          if (var == 1) {
            // final Npc npc = (Npc)env.getVisibleObject();
            final int targetObjectId = env.getVisibleObject().getObjectId();
            PacketSendUtility.sendPacket(
                player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 1));
            PacketSendUtility.broadcastPacket(
                player, new SM_EMOTION(player, 37, 0, targetObjectId), true);
            ThreadPoolManager.getInstance()
                .schedule(
                    new Runnable() {
                      @Override
                      public void run() {
                        PacketSendUtility.sendPacket(
                            player,
                            new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                        PacketSendUtility.broadcastPacket(
                            player, new SM_EMOTION(player, 38, 0, targetObjectId), true);
                        for (VisibleObject obj : player.getKnownList()) {
                          if (!(obj instanceof Npc)) continue;
                          if (((Npc) obj).getNpcId() != 203175) continue;
                          if (((Npc) obj).getNpcId() != 203175) return;
                          ((Npc) obj).getAggroList().addDamage(player, 50);
                        }
                        if (!itemService.addItems(
                            player, Collections.singletonList(new QuestItems(182200217, 1)))) ;
                        qs.setQuestVarById(0, 2);
                        updateQuestStatus(player, qs);
                      }
                    },
                    3000);
          }
          return true;
      }
    }
    if (targetId == 203058) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 3) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034);
        case 10002:
          if (var == 3) {
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            player.getInventory().removeFromBagByItemId(182200217, 1);
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
          }
        case 10001:
          if (var == 3) {
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    }
    return false;
  }
コード例 #16
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    // Instanceof
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    // ------------------------------------------------------------
    // NPC Quest :
    // Start to Tragi
    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204050) {
        // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
        if (env.getDialogId() == 25)
          // Send select_none to eddit-HtmlPages.xml
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 4762);
        else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.START) {

      switch (targetId) {
          // 1 - Collect the Deathmark in Brusthonin for Tragi
        case 204050:
          switch (env.getDialogId()) {
              // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
            case 25:
              // Send select1 to eddit-HtmlPages.xml
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
              // Get HACTION_SETPRO1 in the eddit-HyperLinks.xml
            case 10000:
              // Send select2 to eddit-HtmlPages.xml
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
              // Get HACTION_CHECK_USER_HAS_QUEST_ITEM in the eddit-HyperLinks.xml
            case 33:
              // Collect Crown Ksellid's Sting (10)
              // Collect Rocky Back Ksellid's Shell (10)
              // Collect Refugee's Old Clothes (10)
              // Collect Lobnite's Stalk (10)
              if (player.getInventory().getItemCountByItemId(182207117) >= 10
                  && player.getInventory().getItemCountByItemId(182207118) >= 10
                  && player.getInventory().getItemCountByItemId(182207119) >= 10
                  && player.getInventory().getItemCountByItemId(182207120) >= 10) {
                player.getInventory().removeFromBagByItemId(182207117, 10);
                player.getInventory().removeFromBagByItemId(182207118, 10);
                player.getInventory().removeFromBagByItemId(182207119, 10);
                player.getInventory().removeFromBagByItemId(182207120, 10);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(player, qs);
                // Send select_quest_reward1 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
              } else {
                // Send check_user_item_fail to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 10001);
              }
          }
          break;
          // No match
        default:
          return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203710) return defaultQuestEndDialog(env);
    }
    return false;
  }
コード例 #17
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204547) {
        if (env.getDialogId() == 25) {
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 4762);
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 204547:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  long itemCount1 = player.getInventory().getItemCountByItemId(182201760);
                  if (qs.getQuestVarById(0) == 0 && itemCount1 >= 3) {
                    return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
                  }
                }
              case 4763:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  updateQuestStatus(player, qs);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                }
            }
          }
        case 204540:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
                }
              case 1694:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  player.getInventory().removeFromBagByItemId(182201760, 1);
                  updateQuestStatus(player, qs);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                }
            }
          }
        case 790018:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034);
                }
              case 2035:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  player.getInventory().removeFromBagByItemId(182201760, 1);
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(player, qs);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204541) {
        switch (env.getDialogId()) {
          case 25:
            {
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
            }
          case 1009:
            {
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
            }
          case 17:
            {
              player.getInventory().removeFromBagByItemId(182201760, 1);
            }
          default:
            return defaultQuestEndDialog(env);
        }
      }
    }
    return false;
  }
コード例 #18
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) {
      targetId = ((Npc) env.getVisibleObject()).getNpcId();
    }

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 798132) {
        switch (env.getDialog()) {
          case QUEST_SELECT:
            {
              return sendQuestDialog(env, 4762);
            }
          default:
            return sendQuestStartDialog(env);
        }
      }
    }

    if (qs == null) {
      return false;
    }

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798132:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  if (qs.getQuestVarById(0) == 0) {
                    long itemCount = player.getInventory().getItemCountByItemId(182208008);
                    if (itemCount >= 1) {
                      return sendQuestDialog(env, 1011);
                    } else {
                      return sendQuestDialog(env, 10001);
                    }
                  }
                }
              case CHECK_USER_HAS_QUEST_ITEM:
                {
                  removeQuestItem(env, 182208008, 1);
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                }
            }
          }
        case 798146:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  if (qs.getQuestVarById(0) == 1) {
                    return sendQuestDialog(env, 1352);
                  }
                }
              case SET_SUCCEED:
                {
                  updateQuestStatus(env);
                  qs.setStatus(QuestStatus.REWARD);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798146) {
        switch (env.getDialog()) {
          case QUEST_SELECT:
            {
              return sendQuestDialog(env, 10002);
            }
          case SELECT_QUEST_REWARD:
            {
              return sendQuestDialog(env, 5);
            }
          default:
            return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
コード例 #19
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 203792) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 4762);
        else return sendQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs != null && qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798013:
          switch (env.getDialog()) {
            case QUEST_SELECT:
              return sendQuestDialog(env, 1011);
            case SETPRO10:
              if (!giveQuestItem(env, 152202049, 1)) return true;
              if (!giveQuestItem(env, 152020249, 1)) return true;
              qs.setQuestVarById(0, 1);
              updateQuestStatus(env);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            case SETPRO20:
              if (!giveQuestItem(env, 152202050, 1)) return true;
              if (!giveQuestItem(env, 152020249, 1)) return true;
              qs.setQuestVarById(0, 1);
              updateQuestStatus(env);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
          }
        case 203792:
          switch (env.getDialog()) {
            case QUEST_SELECT:
              long itemCount1 = player.getInventory().getItemCountByItemId(182206767);
              if (itemCount1 > 0) {
                removeQuestItem(env, 182206767, 1);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                return sendQuestDialog(env, 1352);
              } else return sendQuestDialog(env, 10001);
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203792) {
        if (env.getDialogId() == DialogAction.CHECK_USER_HAS_QUEST_ITEM.id())
          return sendQuestDialog(env, 5);
        else return sendQuestEndDialog(env);
      }
    }
    return false;
  }
コード例 #20
0
  @Override
  public boolean onDialogEvent(final QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;
    DialogAction dialog = env.getDialog();
    int var = qs.getQuestVarById(0);
    int targetId = env.getTargetId();

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798928:
          { // Yulia
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1011);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1); // 1
                }
            }
            break;
          }
        case 798975:
          { // Sulla
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 1) {
                    return sendQuestDialog(env, 1352);
                  } else if (var == 6) {
                    return sendQuestDialog(env, 3057);
                  } else if (var == 9) {
                    return sendQuestDialog(env, 4080);
                  }
                }
              case SETPRO2:
                {
                  return defaultCloseDialog(env, 1, 2); // 2
                }
              case SETPRO7:
                {
                  return defaultCloseDialog(env, 6, 7); // 7
                }
              case SETPRO10:
                {
                  return defaultCloseDialog(env, 9, 10); // 10
                }
            }
            break;
          }
        case 798981:
          { // Philon
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 2) {
                    return sendQuestDialog(env, 1693);
                  }
                }
              case SETPRO3:
                {
                  return defaultCloseDialog(env, 2, 3); // 3
                }
            }
            break;
          }
        case 798513:
          { // Machiah
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 7) {
                    return sendQuestDialog(env, 3398);
                  }
                }
              case SETPRO8:
                {
                  return defaultCloseDialog(env, 7, 8); // 8
                }
            }
            break;
          }
        case 798225:
          { // Pyrrha
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 8) {
                    return sendQuestDialog(env, 3739);
                  }
                }
              case SETPRO9:
                {
                  return defaultCloseDialog(env, 8, 9); // 9
                }
            }
            break;
          }
        case 798979:
          { // Gelon
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 10) {
                    return sendQuestDialog(env, 1608);
                  }
                }
              case SETPRO11:
                {
                  return defaultCloseDialog(env, 10, 11); // 11
                }
            }
            break;
          }
        case 798990:
          { // Titus
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 11) {
                    return sendQuestDialog(env, 1949);
                  }
                }
              case SETPRO12:
                {
                  return defaultCloseDialog(env, 11, 12, 182206613, 1, 0, 0); // 12
                }
            }
            break;
          }
        case 730295:
          { // Drakan Stone Statue
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 12) {
                    return sendQuestDialog(env, 3995);
                  }
                }
              case SETPRO13:
                {
                  if (var == 12) {
                    if (player.getInventory().getItemCountByItemId(182206613) > 0) {
                      removeQuestItem(env, 182206613, 1);
                      WorldMapInstance newInstance =
                          InstanceService.getNextAvailableInstance(300160000);
                      InstanceService.registerPlayerWithInstance(newInstance, player);
                      TeleportService2.teleportTo(
                          player,
                          300160000,
                          newInstance.getInstanceId(),
                          744.761f,
                          940.3738f,
                          149.28333f,
                          (byte) 91);
                      return true;
                    } else return sendQuestDialog(env, 10001);
                  }
                }
            }
            break;
          }
        case 730229:
          { // Traveller's Bag
            if (dialog == DialogAction.USE_OBJECT) {
              if (var == 15) {
                return true; // loot
              }
            }
            break;
          }
        case 730226:
          { // Western Petrified Mass
            if (var == 3 && dialog == DialogAction.USE_OBJECT) {
              return useQuestObject(env, 3, 4, false, 0); // 4
            }
            break;
          }
        case 730227:
          { // Eastern Petrified Mass
            if (var == 4 && dialog == DialogAction.USE_OBJECT) {
              return useQuestObject(env, 4, 5, false, 0); // 5
            }
            break;
          }
        case 730228:
          { // Southern Petrified Mass
            if (var == 5 && dialog == DialogAction.USE_OBJECT) {
              return useQuestObject(env, 5, 6, false, 0); // 6
            }
            break;
          }
        case 700604:
          { // Hidden Switch
            if (var == 13 && dialog == DialogAction.USE_OBJECT) {
              return useQuestObject(env, 13, 14, false, 0); // 14
            }
            break;
          }
        case 700603:
          { // Hidden Library Exit
            if (var == 16 && dialog == DialogAction.USE_OBJECT) {
              TeleportService2.teleportTo(
                  player, 210050000, 349.332f, 1368.0781f, 336.43332f, (byte) 100);
              return true;
            }
            break;
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798928) { // Yulia
        if (env.getDialog() == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
コード例 #21
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) {
      return false;
    }
    int var = qs.getQuestVars().getQuestVars();
    int targetId = env.getTargetId();
    DialogAction dialog = env.getDialog();

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 204182:
          { // Heimdall
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1011);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1); // 1
                }
            }
            break;
          }
        case 203550:
          { // Munin
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 1) {
                    return sendQuestDialog(env, 1352);
                  } else if (var == 10) {
                    return sendQuestDialog(env, 4080);
                  }
                }
              case SETPRO2:
                {
                  return defaultCloseDialog(env, 1, 2); // 2
                }
              case SETPRO10:
                {
                  return defaultCloseDialog(env, 10, 10, true, false); // reward
                }
            }
            break;
          }
        case 790003:
          { // Urd
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 2) {
                    return sendQuestDialog(env, 1693);
                  }
                }
              case SETPRO3:
                {
                  return defaultCloseDialog(env, 2, 3); // 3
                }
            }
            break;
          }
        case 790002:
          { // Verdandi
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 3) {
                    return sendQuestDialog(env, 2034);
                  }
                }
              case SETPRO4:
                {
                  return defaultCloseDialog(env, 3, 4); // 4
                }
            }
            break;
          }
        case 203546:
          { // Skuld
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 4) {
                    return sendQuestDialog(env, 2375);
                  } else if (var == 9) {
                    return sendQuestDialog(env, 3739);
                  }
                }
              case SETPRO5:
                {
                  if (var == 4) {
                    changeQuestStep(env, 4, 95, false); // 95
                    WorldMapInstance newInstance =
                        InstanceService.getNextAvailableInstance(320070000);
                    InstanceService.registerPlayerWithInstance(newInstance, player);
                    TeleportService2.teleportTo(
                        player,
                        320070000,
                        newInstance.getInstanceId(),
                        268.47397f,
                        251.80275f,
                        125.8369f);
                    return closeDialogWindow(env);
                  }
                }
              case SETPRO9:
                {
                  changeQuestStep(env, 9, 10, false); // 10
                  TeleportService2.teleportTo(player, 220010000, 1, 383.0f, 1896.0f, 327.625f);
                  return closeDialogWindow(env);
                }
            }
            break;
          }
        case 204264:
          { // Skuld 2
            switch (dialog) {
              case USE_OBJECT:
                {
                  if (var == 99 && !isStigmaEquipped(env)) {
                    return sendQuestDialog(env, 3057);
                  }
                }
              case QUEST_SELECT:
                {
                  if (var == 95) {
                    return sendQuestDialog(env, 2716);
                  } else if (var == 96) {
                    return sendQuestDialog(env, 3057);
                  } else if (var == 97) {
                    return sendQuestDialog(env, 3398);
                  }
                }
              case SETPRO6:
                {
                  if (var == 95) {
                    playQuestMovie(env, 156);
                    return closeDialogWindow(env);
                  }
                }
              case SELECT_ACTION_3058:
                {
                  if (var == 96) {
                    if (giveQuestItem(env, getStoneId(player), 1) && !isStigmaEquipped(env)) {
                      long existendStigmaShards =
                          player.getInventory().getItemCountByItemId(141000001);
                      if (existendStigmaShards < 60) {
                        if (!player.getInventory().isFull()) {
                          ItemService.addItem(player, 141000001, 60 - existendStigmaShards);
                          changeQuestStep(env, 96, 99, false); // 99
                          return sendQuestDialog(env, 3058);
                        } else {
                          return closeDialogWindow(env);
                        }
                      } else {
                        changeQuestStep(env, 96, 99, false); // 99
                        return sendQuestDialog(env, 3058);
                      }
                    } else {
                      return closeDialogWindow(env);
                    }
                  } else if (var == 99) {
                    return sendQuestDialog(env, 3058);
                  }
                }
              case SETPRO7:
                {
                  if (var == 99) {
                    PacketSendUtility.sendPacket(
                        player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 1));
                    return true;
                  }
                }
              case SETPRO8:
                {
                  if (var == 97) {
                    changeQuestStep(env, 97, 98, false); // 98
                    QuestService.addNewSpawn(
                        320070000, player.getInstanceId(), 204263, 257.5f, 245f, 125f, (byte) 0);
                    return closeDialogWindow(env);
                  }
                }
            }
            break;
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204061) { // Aud
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
コード例 #22
0
ファイル: _1006Ascension.java プロジェクト: xj2479564/AU-AD
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final int instanceId = player.getInstanceId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int var = qs.getQuestVars().getQuestVars();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 790001) {
        switch (env.getDialogId()) {
          case 25:
            if (var == 0)
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
            else if (var == 3)
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
            else if (var == 5)
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034);
          case 10000:
            if (var == 0) {
              if (player.getInventory().getItemCountByItemId(182200007) == 0)
                if (!itemService.addItems(
                    player, Collections.singletonList(new QuestItems(182200007, 1)))) return true;
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
          case 10002:
            if (var == 3) {
              player.getInventory().removeFromBagByItemId(182200009, 1);
              qs.setQuestVar(99);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
              WorldMapInstance newInstance = instanceService.getNextAvailableInstance(310010000);
              instanceService.registerPlayerWithInstance(newInstance, player);
              teleportService.teleportTo(
                  player, 310010000, newInstance.getInstanceId(), 52, 174, 229, 0);
              return true;
            }
          case 10003:
            if (var == 5) {
              PlayerClass playerClass = player.getCommonData().getPlayerClass();
              if (playerClass == PlayerClass.WARRIOR)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
              else if (playerClass == PlayerClass.SCOUT)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2716);
              else if (playerClass == PlayerClass.MAGE)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3057);
              else if (playerClass == PlayerClass.PRIEST)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3398);
            }
          case 10004:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.GLADIATOR);
          case 10005:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.TEMPLAR);
          case 10006:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.ASSASSIN);
          case 10007:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.RANGER);
          case 10008:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.SORCERER);
          case 10009:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.SPIRIT_MASTER);
          case 10010:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.CLERIC);
          case 10011:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.CHANTER);
        }
      } else if (targetId == 730008) {
        switch (env.getDialogId()) {
          case 25:
            if (var == 2) {
              if (player.getInventory().getItemCountByItemId(182200008) != 0)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
              else return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1354);
            }
          case 1353:
            if (var == 2) {
              PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 14));
              player.getInventory().removeFromBagByItemId(182200008, 1);
              itemService.addItems(player, Collections.singletonList(new QuestItems(182200009, 1)));
            }
            return false;
          case 10001:
            if (var == 2) {
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
        }
      } else if (targetId == 205000) {
        switch (env.getDialogId()) {
          case 25:
            if (var == 99) {
              PacketSendUtility.sendPacket(player, new SM_EMOTION(player, 6, 1001, 0));
              qs.setQuestVar(50);
              updateQuestStatus(player, qs);
              ThreadPoolManager.getInstance()
                  .schedule(
                      new Runnable() {
                        @Override
                        public void run() {
                          qs.setQuestVar(51);
                          updateQuestStatus(player, qs);
                          List<Npc> mobs = new ArrayList<Npc>();
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 224.073,
                                      (float) 239.1,
                                      (float) 206.7,
                                      (byte) 0,
                                      true));
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 233.5,
                                      (float) 241.04,
                                      (float) 206.365,
                                      (byte) 0,
                                      true));
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 229.6,
                                      (float) 265.7,
                                      (float) 205.7,
                                      (byte) 0,
                                      true));
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 222.8,
                                      (float) 262.5,
                                      (float) 205.7,
                                      (byte) 0,
                                      true));
                          for (Npc mob : mobs) {
                            // TODO: Tempt decrease P attack.
                            mob.getGameStats()
                                .setStat(
                                    StatEnum.MAIN_HAND_POWER,
                                    mob.getGameStats().getCurrentStat(StatEnum.MAIN_HAND_POWER)
                                        / 3);
                            mob.getGameStats().setStat(StatEnum.PHYSICAL_DEFENSE, 0);
                            mob.getAggroList().addDamage(player, 1000);
                          }
                        }
                      },
                      43000);
              return true;
            }
            return false;
          default:
            return false;
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 790001) {
        return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
コード例 #23
0
  /**
   * Start gathering process
   *
   * @param player
   */
  public void onStartUse(final Player player) {
    // basic actions, need to improve here
    final GatherableTemplate template = this.getObjectTemplate();

    if (!checkPlayerSkill(player, template)) return;

    List<Material> materials = template.getMaterials().getMaterial();

    int index = 0;
    Material material = materials.get(index); // default is 0
    int count = materials.size();

    if (count < 1) {
      // error - theoretically if XML data is correct, this should never happen.
      return;
    } else if (count == 1) {
      // default is 0
    } else {
      if (player.getInventory().isFull()) {
        PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.EXTRACT_GATHER_INVENTORY_IS_FULL());
        return;
      }

      int gatherRate =
          1; // 1x rates (probably make config later, if fixed to non-linear statistic probability)
      float maxrate = 0;
      int rate = 0;
      int i = 0; // index counter

      // sort materials to ascending order
      SortedMap<Integer, Integer> hasMat = new TreeMap<Integer, Integer>();
      for (Material mat : materials) {
        maxrate += mat.getRate(); // get maxrate
        hasMat.put(
            mat.getRate(),
            i); // sort and save index of materials (key is rate and rate is unique on each
                // gatherId)
        i++;
      }

      Iterator<Integer> it = hasMat.keySet().iterator();
      while (it.hasNext()) {
        rate = it.next();
        float percent = Rnd.get() * 100f;
        float chance = ((rate / maxrate) * 100f * gatherRate);

        // default index is to 0, look to up little bit on 'material'
        if (percent < chance) {
          index = hasMat.get(rate); // return index				
          material = materials.get(index);
          break;
        }
      }
    }

    final Material finalMaterial = material;

    if (state != GatherState.GATHERING) {
      state = GatherState.GATHERING;
      currentGatherer = player.getObjectId();
      player
          .getObserveController()
          .attach(
              new StartMovingListener() {

                @Override
                public void moved() {
                  finishGathering(player);
                }
              });
      int skillLvlDiff =
          player.getSkillList().getSkillLevel(template.getHarvestSkill())
              - template.getSkillLevel();
      task = new GatheringTask(player, this, finalMaterial, skillLvlDiff);
      task.start();
    }
  }
コード例 #24
0
  @Override
  public void execute(Player player, String... params) {
    if (params.length != 2) {
      PacketSendUtility.sendMessage(player, "syntax .reskin <Old Item> <New Item>");
      return;
    }

    @SuppressWarnings("unused")
    Player target = player;
    VisibleObject creature = player.getTarget();
    if (player.getTarget() instanceof Player) {
      target = (Player) creature;
    }

    int oldItemId = 0;
    int newItemId = 0;

    try {
      String item = params[0];

      if (item.startsWith("[item:")) {
        Pattern id = Pattern.compile("\\[item:(\\d{9})");
        Matcher result = id.matcher(item);

        if (result.find()) {
          oldItemId = Integer.parseInt(result.group(1));
        } else {
          oldItemId = Integer.parseInt(params[0]);
        }
        item = params[1];
        if (item.startsWith("[item:")) {
          id = Pattern.compile("\\[item:(\\d{9})");
          result = id.matcher(item);

          if (result.find()) {
            newItemId = Integer.parseInt(result.group(1));
          } else {
            newItemId = Integer.parseInt(params[0]);
          }
        } else {
          PacketSendUtility.sendMessage(player, "syntax .reskin <Old Item> <New Item>");
          return;
        }
      } else {
        PacketSendUtility.sendMessage(player, "syntax .reskin <Old Item> <New Item>");
        return;
      }
    } catch (NumberFormatException e) {
      PacketSendUtility.sendMessage(player, "syntax .reskin <Old Item> <New Item>");
      return;
    }

    Storage storage = player.getInventory();
    List<Item> oldItems = player.getInventory().getItemsByItemId(oldItemId);
    List<Item> newItems = player.getInventory().getItemsByItemId(newItemId);
    // Iterator Ancien Item
    Iterator<Item> oldIter = oldItems.iterator();
    Item oldItem = oldIter.next();
    // Iterator Nouveau Item
    Iterator<Item> newIter = newItems.iterator();
    Item newItem = newIter.next();
    // verification que l'ancien item est dans l'inventaire
    if (oldItems.isEmpty()) {
      PacketSendUtility.sendMessage(player, "You do not have this item in your inventory.");
      return;
    }
    // verification que les items sont du même type.
    if (newItem.getItemTemplate().isWeapon() && oldItem.getItemTemplate().isWeapon()) {
      if (newItem.getItemTemplate().getWeaponType() != oldItem.getItemTemplate().getWeaponType()) {
        PacketSendUtility.sendMessage(player, "You can not remodel different types of item.");
        return;
      }
    } else if (newItem.getItemTemplate().isArmor() && oldItem.getItemTemplate().isArmor()) {
      if (newItem.getItemTemplate().getItemSlot() == oldItem.getItemTemplate().getItemSlot()) {
        if (newItem.getItemTemplate().getArmorType() != oldItem.getItemTemplate().getArmorType()) {
          PacketSendUtility.sendMessage(player, "You can not remodel different types of item.");
          return;
        }
      } else {
        PacketSendUtility.sendMessage(player, "You can not remodel different types of item.");
        return;
      }
    }

    final int tollPrice = 750;
    final long tolls = player.getClientConnection().getAccount().getToll();
    RequestResponseHandler responseHandler =
        new RequestResponseHandler(player) {
          @Override
          public void acceptRequest(Creature p2, Player p) {
            if (tolls < tollPrice) {
              PacketSendUtility.sendMessage(
                  p,
                  "You don't have enought Vote Points ("
                      + tolls
                      + "). You need : "
                      + tollPrice
                      + " Vote Points.");
              return;
            }
            p.getClientConnection().getAccount().setToll(tolls - tollPrice);
          }

          @Override
          public void denyRequest(Creature p2, Player p) {}
        };

    boolean requested = player.getResponseRequester().putRequest(902247, responseHandler);
    if (requested) {
      oldItem.setItemSkinTemplate(DataManager.ITEM_DATA.getItemTemplate(newItemId));
      storage.decreaseByItemId(newItemId, storage.getItemCountByItemId(newItemId));
      PacketSendUtility.sendBrightYellowMessage(
          player,
          "Your item " + params[0] + " just take the appearance of the item " + params[1] + ".");
      PacketSendUtility.sendMessage(
          player, "For changing the skin, you have use " + tollPrice + " Vote Points!");
    }
  }
コード例 #25
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 203919) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 4762);
        } else return sendQuestStartDialog(env);
      }
    }
    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 203337:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  switch (qs.getQuestVarById(0)) {
                    case 0:
                      {
                        return sendQuestDialog(env, 1011);
                      }
                    case 1:
                      {
                        long itemCount1 = player.getInventory().getItemCountByItemId(182201399);
                        if (itemCount1 >= 3) {
                          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                          updateQuestStatus(env);
                          return sendQuestDialog(env, 1352);
                        } else return sendQuestDialog(env, 10001);
                      }
                    case 2:
                      {
                        return sendQuestDialog(env, 1693);
                      }
                    case 3:
                      {
                        return sendQuestDialog(env, 10002);
                      }
                  }
                }
              case SETPRO1:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                }
              case SETPRO3:
                {
                  qs.setQuestVar(3);
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                  TeleportService2.teleportTo(player, 220020000, 1, 638, 2337, 425, (byte) 20);
                  return true;
                }
              default:
                return sendQuestStartDialog(env);
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203337) {
        if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id())
          return sendQuestDialog(env, 5);
        else return sendQuestEndDialog(env);
      }
    }
    return false;
  }
コード例 #26
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (env.getVisibleObject() instanceof Npc) {
      targetId = ((Npc) env.getVisibleObject()).getNpcId();
    }
    if (targetId == 0) {
      if (env.getDialogId() == DialogAction.QUEST_ACCEPT_1.id()) {
        QuestService.startQuest(env);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 700513) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        switch (env.getDialog()) {
          case USE_OBJECT:
            {
              if (player.getInventory().getItemCountByItemId(182201823) == 0) {
                return giveQuestItem(env, 182201823, 1);
              }
            }
        }
      }
    }
    if (qs == null) {
      return false;
    }

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798072) {
        if (env.getDialog() == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 2375);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
          return sendQuestDialog(env, 5);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 798072) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 0) {
            return sendQuestDialog(env, 1352);
          }
        case SETPRO1:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 204571) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 1) {
            return sendQuestDialog(env, 1693);
          }
        case SETPRO2:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 798013) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 2) {
            return sendQuestDialog(env, 2034);
          }
        case SETPRO3:
          if (var == 2) {
            {
              qs.setQuestVarById(0, var + 1);
              qs.setStatus(QuestStatus.REWARD);
              updateQuestStatus(env);
              if (giveQuestItem(env, 182201824, 1)) ;
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
          }
          return false;
      }
    }
    return false;
  }
コード例 #27
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    // Instanceof
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    // ------------------------------------------------------------
    // NPC Quest :
    // 0 - Start to Lavirintos
    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 203701) {
        // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
        if (env.getDialogId() == 25)
          // Send select_none to eddit-HtmlPages.xml
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 4762);
        else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.START) {

      switch (targetId) {
          // 1 - Talk with Nianalo
        case 798359:
          switch (env.getDialogId()) {
              // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
            case 25:
              // Send select1 to eddit-HtmlPages.xml
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
              // Get HACTION_SETPRO1 in the eddit-HyperLinks.xml
            case 10000:
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
          }
          break;
          // 2 - Talk with Navid
        case 798360:
          if (var == 1) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select2 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
                // Get HACTION_SETPRO2 in the eddit-HyperLinks.xml
              case 10001:
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(player, qs);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          break;
          // 3 - Talk with Pavel
        case 798361:
          if (var == 2) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select3 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
                // Get HACTION_SETPRO3 in the eddit-HyperLinks.xml
              case 10002:
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(player, qs);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          break;
          // 4 - Talk with Pendaon
        case 798362:
          if (var == 3) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select4 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034);
                // Get HACTION_SETPRO4 in the eddit-HyperLinks.xml
              case 10003:
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(player, qs);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          break;
          // 5 - Talk with Poevius
        case 798363:
          if (var == 4) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select5 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
                // Get HACTION_SETPRO5 in the eddit-HyperLinks.xml
              case 10004:
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(player, qs);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          break;
          // 6 - Talk with Belicanon
        case 798364:
          if (var == 5) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select6 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2716);
                // Get HACTION_SETPRO6 in the eddit-HyperLinks.xml
              case 10005:
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(player, qs);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          break;
          // 7 - Talk with Mahelnu
        case 798365:
          if (var == 6) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select7 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3057);
                // Get HACTION_SETPRO7 in the eddit-HyperLinks.xml
              case 10006:
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(player, qs);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          break;
          // 8 - Talk with Pater
        case 798366:
          if (var == 7) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select8 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3398);
                // Get HACTION_SETPRO8 in the eddit-HyperLinks.xml
              case 10007:
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(player, qs);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          break;
          // 9 - Report the result to Jucleas with the Oath Stone
        case 203752:
          if (var == 8) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                if (player.getInventory().getItemCountByItemId(186000080) >= 1)
                  // Send select9 to eddit-HtmlPages.xml
                  return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3739);
                else
                  // Send select9_2 to eddit-HtmlPages.xml
                  return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3825);
                // Get HACTION_SET_SUCCEED in the eddit-HyperLinks.xml
              case 10255:
                // Send select_success to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 10002);
                // Get HACTION_SELECT_QUEST_REWARD in the
                // eddit-HyperLinks.xml
              case 1009:
                ItemService.removeItemFromInventoryByItemId(player, 186000080);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(player, qs);
                // Send select_quest_reward1 to eddit-HtmlPages.xml
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
            }
          }
          break;
          // No match
        default:
          return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203701) return defaultQuestEndDialog(env);
    }
    return false;
  }
コード例 #28
0
  /** {@inheritDoc} */
  @Override
  protected void runImpl() {
    AionConnection client = getConnection();
    Account account = client.getAccount();
    PlayerAccountData playerAccData = client.getAccount().getPlayerAccountData(objectId);

    if (playerAccData == null) {
      // Somebody wanted to login on character that is not at his account
      return;
    }

    Player player = PlayerService.getPlayer(objectId, account);

    if (player != null && client.setActivePlayer(player)) {
      player.setClientConnection(client);
      /*
       * Store player into World.
       */
      World.getInstance().storeObject(player);

      sendPacket(new SM_SKILL_LIST(player));
      StigmaService.onPlayerLogin(player);

      if (player.getSkillCoolDowns() != null)
        sendPacket(new SM_SKILL_COOLDOWN(player.getSkillCoolDowns()));

      if (player.getItemCoolDowns() != null)
        sendPacket(new SM_ITEM_COOLDOWN(player.getItemCoolDowns()));

      sendPacket(new SM_QUEST_LIST(player));
      sendPacket(new SM_RECIPE_LIST(player.getRecipeList().getRecipeList()));

      /*
       * Needed
       */
      sendPacket(new SM_ENTER_WORLD_CHECK());

      byte[] uiSettings = player.getPlayerSettings().getUiSettings();
      byte[] shortcuts = player.getPlayerSettings().getShortcuts();

      if (uiSettings != null) sendPacket(new SM_UI_SETTINGS(uiSettings, 0));

      if (shortcuts != null) sendPacket(new SM_UI_SETTINGS(shortcuts, 1));

      // Cubesize limit set in inventory.
      int cubeSize = player.getCubeSize();
      player.getInventory().setLimit(27 + cubeSize * 9);

      // items
      Storage inventory = player.getInventory();
      List<Item> equipedItems = player.getEquipment().getEquippedItems();
      if (equipedItems.size() != 0) {
        sendPacket(new SM_INVENTORY_INFO(player.getEquipment().getEquippedItems(), cubeSize));
      }

      List<Item> unequipedItems = inventory.getAllItems();
      int itemsSize = unequipedItems.size();

      if (itemsSize != 0) {
        int index = 0;
        while (index + 10 < itemsSize) {
          sendPacket(new SM_INVENTORY_INFO(unequipedItems.subList(index, index + 10), cubeSize));
          index += 10;
        }
        sendPacket(new SM_INVENTORY_INFO(unequipedItems.subList(index, itemsSize), cubeSize));
      }

      sendPacket(new SM_INVENTORY_INFO());

      PlayerService.playerLoggedIn(player);

      sendPacket(new SM_STATS_INFO(player));
      sendPacket(new SM_CUBE_UPDATE(player, 6));

      KiskService.onLogin(player);
      TeleportService.sendSetBindPoint(player);

      sendPacket(new SM_MACRO_LIST(player));
      sendPacket(new SM_GAME_TIME());
      player.getController().updateNearbyQuests();

      sendPacket(new SM_TITLE_LIST(player));
      sendPacket(new SM_CHANNEL_INFO(player.getPosition()));
      sendPacket(new SM_PLAYER_SPAWN(player));
      sendPacket(new SM_EMOTION_LIST());
      sendPacket(new SM_INFLUENCE_RATIO());
      sendPacket(new SM_PRICES(player.getPrices()));
      sendPacket(new SM_PLAYER_ID(player));
      sendPacket(new SM_ABYSS_RANK(player.getAbyssRank()));

      sendPacket(
          new SM_MESSAGE(
              0,
              null,
              "Welcome to "
                  + GSConfig.SERVER_NAME
                  + " server\nPowered by aion-unique software\ndeveloped by www.aion-unique.org team.\nCopyright 2010",
              ChatType.ANNOUNCEMENTS));

      if (player.isInPrison()) PunishmentService.updatePrisonStatus(player);

      if (player.isLegionMember()) LegionService.getInstance().onLogin(player);

      if (player.isInGroup()) GroupService.getInstance().onLogin(player);

      player.setRates(Rates.getRatesFor(client.getAccount().getMembership()));

      ClassChangeService.showClassChangeDialog(player);

      /** Notify mail service to load all mails */
      MailService.getInstance().onPlayerLogin(player);
      /** Schedule periodic saving of this player */
      PeriodicSaveService.getInstance().onPlayerLogin(player);
      /** Notify player if have broker settled items */
      BrokerService.getInstance().onPlayerLogin(player);
      /** Start initializing chat connection(/1, /2, /3, /4 channels) */
      if (!GSConfig.DISABLE_CHAT_SERVER) ChatService.onPlayerLogin(player);
    } else {
      // TODO this is an client error - inform client.
    }
  }