Package lineage2.gameserver.model.pledge

Examples of lineage2.gameserver.model.pledge.UnitMember


      leader.sendMessage(new CustomMessage("scripts.services.Rename.SiegeNow", leader));
      return;
    }
    Clan clan = leader.getClan();
    SubUnit mainUnit = clan.getSubUnit(Clan.SUBUNIT_MAIN_CLAN);
    UnitMember member = mainUnit.getUnitMember(newLeader);
    if (member == null)
    {
      showChatWindow(leader, "villagemaster/clan-20.htm");
      return;
    }
    if (member.getLeaderOf() != Clan.SUBUNIT_NONE)
    {
      leader.sendMessage(new CustomMessage("lineage2.gameserver.model.instances.L2VillageMasterInstance.CannotAssignUnitLeader", leader));
      return;
    }
    setLeader(leader, clan, mainUnit, member);
View Full Code Here


   * @param minClanLvl int
   * @param leaderName String
   */
  public void createSubPledge(Player player, String clanName, int pledgeType, int minClanLvl, String leaderName)
  {
    UnitMember subLeader = null;
    Clan clan = player.getClan();
    if ((clan == null) || !player.isClanLeader())
    {
      player.sendPacket(Msg.YOU_HAVE_FAILED_TO_CREATE_A_CLAN);
      return;
    }
    if (!Util.isMatchingRegexp(clanName, Config.CLAN_NAME_TEMPLATE))
    {
      player.sendPacket(Msg.CLAN_NAME_IS_INCORRECT);
      return;
    }
    Collection<SubUnit> subPledge = clan.getAllSubUnits();
    for (SubUnit element : subPledge)
    {
      if (element.getName().equals(clanName))
      {
        player.sendPacket(Msg.ANOTHER_MILITARY_UNIT_IS_ALREADY_USING_THAT_NAME_PLEASE_ENTER_A_DIFFERENT_NAME);
        return;
      }
    }
    if (ClanTable.getInstance().getClanByName(clanName) != null)
    {
      player.sendPacket(Msg.ANOTHER_MILITARY_UNIT_IS_ALREADY_USING_THAT_NAME_PLEASE_ENTER_A_DIFFERENT_NAME);
      return;
    }
    if (clan.getLevel() < minClanLvl)
    {
      player.sendPacket(Msg.THE_CONDITIONS_NECESSARY_TO_CREATE_A_MILITARY_UNIT_HAVE_NOT_BEEN_MET);
      return;
    }
    SubUnit unit = clan.getSubUnit(Clan.SUBUNIT_MAIN_CLAN);
    if (pledgeType != Clan.SUBUNIT_ACADEMY)
    {
      subLeader = unit.getUnitMember(leaderName);
      if (subLeader == null)
      {
        player.sendMessage(new CustomMessage("lineage2.gameserver.model.instances.L2VillageMasterInstance.PlayerCantBeAssignedAsSubUnitLeader", player));
        return;
      }
      else if (subLeader.getLeaderOf() != Clan.SUBUNIT_NONE)
      {
        player.sendMessage(new CustomMessage("lineage2.gameserver.model.instances.L2VillageMasterInstance.ItCantBeSubUnitLeader", player));
        return;
      }
    }
    pledgeType = clan.createSubPledge(player, pledgeType, subLeader, clanName);
    if (pledgeType == Clan.SUBUNIT_NONE)
    {
      return;
    }
    clan.broadcastToOnlineMembers(new PledgeReceiveSubPledgeCreated(clan.getSubUnit(pledgeType)));
    SystemMessage sm;
    if (pledgeType == Clan.SUBUNIT_ACADEMY)
    {
      sm = new SystemMessage(SystemMessage.CONGRATULATIONS_THE_S1S_CLAN_ACADEMY_HAS_BEEN_CREATED);
      sm.addString(player.getClan().getName());
    }
    else if (pledgeType >= Clan.SUBUNIT_KNIGHT1)
    {
      sm = new SystemMessage(SystemMessage.THE_KNIGHTS_OF_S1_HAVE_BEEN_CREATED);
      sm.addString(player.getClan().getName());
    }
    else if (pledgeType >= Clan.SUBUNIT_ROYAL1)
    {
      sm = new SystemMessage(SystemMessage.THE_ROYAL_GUARD_OF_S1_HAVE_BEEN_CREATED);
      sm.addString(player.getClan().getName());
    }
    else
    {
      sm = Msg.CLAN_HAS_BEEN_CREATED;
    }
    player.sendPacket(sm);
    if (subLeader != null)
    {
      clan.broadcastToOnlineMembers(new PledgeShowMemberListUpdate(subLeader));
      if (subLeader.isOnline())
      {
        subLeader.getPlayer().updatePledgeClass();
        subLeader.getPlayer().broadcastCharInfo();
      }
    }
  }
View Full Code Here

    {
      player.sendMessage(new CustomMessage("lineage2.gameserver.model.instances.L2VillageMasterInstance.SubUnitNotFound", player));
      return;
    }
    SubUnit mainUnit = clan.getSubUnit(Clan.SUBUNIT_MAIN_CLAN);
    UnitMember subLeader = mainUnit.getUnitMember(leaderName);
    if (subLeader == null)
    {
      player.sendMessage(new CustomMessage("lineage2.gameserver.model.instances.L2VillageMasterInstance.PlayerCantBeAssignedAsSubUnitLeader", player));
      return;
    }
    if (subLeader.getLeaderOf() != Clan.SUBUNIT_NONE)
    {
      player.sendMessage(new CustomMessage("lineage2.gameserver.model.instances.L2VillageMasterInstance.ItCantBeSubUnitLeader", player));
      return;
    }
    targetUnit.setLeader(subLeader, true);
    clan.broadcastToOnlineMembers(new PledgeReceiveSubPledgeCreated(targetUnit));
    clan.broadcastToOnlineMembers(new PledgeShowMemberListUpdate(subLeader));
    if (subLeader.isOnline())
    {
      subLeader.getPlayer().updatePledgeClass();
      subLeader.getPlayer().broadcastCharInfo();
    }
    player.sendMessage(new CustomMessage("lineage2.gameserver.model.instances.L2VillageMasterInstance.NewSubUnitLeaderHasBeenAssigned", player));
  }
View Full Code Here

        String[] param = args.split(" ");
        if (param.length > 0)
        {
          if (param[0].equalsIgnoreCase("allowwh") && (param.length > 1))
          {
            UnitMember cm = activeChar.getClan().getAnyMember(param[1]);
            if ((cm != null) && (cm.getPlayer() != null))
            {
              if (cm.getPlayer().getVarB("canWhWithdraw"))
              {
                cm.getPlayer().unsetVar("canWhWithdraw");
                activeChar.sendMessage("Privilege removed successfully");
              }
              else
              {
                cm.getPlayer().setVar("canWhWithdraw", "1", -1);
                activeChar.sendMessage("Privilege given successfully");
              }
            }
            else if (cm != null)
            {
              int state = mysql.simple_get_int("value", "character_variables", "obj_id=" + cm.getObjectId() + " AND name LIKE 'canWhWithdraw'");
              if (state > 0)
              {
                mysql.set("DELETE FROM `character_variables` WHERE obj_id=" + cm.getObjectId() + " AND name LIKE 'canWhWithdraw' LIMIT 1");
                activeChar.sendMessage("Privilege removed successfully");
              }
              else
              {
                mysql.set("INSERT INTO character_variables  (obj_id, type, name, value, expire_time) VALUES (" + cm.getObjectId() + ",'user-var','canWhWithdraw','1',-1)");
                activeChar.sendMessage("Privilege given successfully");
              }
            }
            else
            {
View Full Code Here

      SubUnit subUnit = clan.getSubUnit(pledgeType);
      if (subUnit == null)
      {
        return;
      }
      UnitMember member = new UnitMember(clan, player.getName(), player.getTitle(), player.getLevel(), player.getClassId().getId(), player.getObjectId(), pledgeType, player.getPowerGrade(), player.getApprentice(), player.getSex(), Clan.SUBUNIT_NONE);
      subUnit.addUnitMember(member);
      player.setPledgeType(pledgeType);
      player.setClan(clan);
      member.setPlayerInstance(player, false);
      if (pledgeType == Clan.SUBUNIT_ACADEMY)
      {
        player.setLvlJoinedAcademy(player.getLevel());
      }
      member.setPowerGrade(clan.getAffiliationRank(player.getPledgeType()));
      clan.broadcastToOtherOnlineMembers(new PledgeShowMemberListAdd(member), player);
      clan.broadcastToOnlineMembers(new SystemMessage2(SystemMsg.S1_HAS_JOINED_THE_CLAN).addString(player.getName()), new PledgeShowInfoUpdate(clan));
      player.sendPacket(SystemMsg.ENTERED_THE_CLAN);
      player.sendPacket(player.getClan().listAll());
      player.setLeaveClanTime(0);
View Full Code Here

        else
        {
          newLeaderName = target.getName();
        }
        SubUnit mainUnit = clan.getSubUnit(Clan.SUBUNIT_MAIN_CLAN);
        UnitMember newLeader = mainUnit.getUnitMember(newLeaderName);
        if (newLeader == null)
        {
          activeChar.sendPacket(Msg.INVALID_TARGET);
          return false;
        }
View Full Code Here

    if ((activeChar == null) || !((activeChar.getClanPrivileges() & Clan.CP_CL_DISMISS) == Clan.CP_CL_DISMISS))
    {
      return;
    }
    Clan clan = activeChar.getClan();
    UnitMember member = clan.getAnyMember(_target);
    if (member == null)
    {
      activeChar.sendPacket(SystemMsg.THE_TARGET_MUST_BE_A_CLAN_MEMBER);
      return;
    }
    Player memberPlayer = member.getPlayer();
    if (member.isOnline() && member.getPlayer().isInCombat())
    {
      activeChar.sendPacket(SystemMsg.A_CLAN_MEMBER_MAY_NOT_BE_DISMISSED_DURING_COMBAT);
      return;
    }
    if (member.isClanLeader())
    {
      activeChar.sendPacket(SystemMsg.THIS_CLAN_MEMBER_CANNOT_WITHDRAW_OR_BE_EXPELLED_WHILE_PARTICIPATING_IN_A_TERRITORY_WAR);
      return;
    }
    int subUnitType = member.getPledgeType();
    clan.removeClanMember(subUnitType, member.getObjectId());
    clan.broadcastToOnlineMembers(new SystemMessage(SystemMessage.CLAN_MEMBER_S1_HAS_BEEN_EXPELLED).addString(_target), new PledgeShowMemberListDelete(_target));
    clan.setExpelledMember();
    if (memberPlayer == null)
    {
      return;
View Full Code Here

      return;
    }
    Clan clan = activeChar.getClan();
    if (clan != null)
    {
      UnitMember cm = clan.getAnyMember(_target);
      if (cm != null)
      {
        activeChar.sendPacket(new PledgeReceivePowerInfo(cm));
      }
    }
View Full Code Here

    if (isInBoat())
    {
      getBoat().removePlayer(this);
    }
    SubUnit unit = getSubUnit();
    UnitMember member = unit == null ? null : unit.getUnitMember(getObjectId());
    if (member != null)
    {
      int sponsor = member.getSponsor();
      int apprentice = getApprentice();
      PledgeShowMemberListUpdate memberUpdate = new PledgeShowMemberListUpdate(this);
      for (Player clanMember : _clan.getOnlineMembers(getObjectId()))
      {
        clanMember.sendPacket(memberUpdate);
        if (clanMember.getObjectId() == sponsor)
        {
          clanMember.sendPacket(new SystemMessage(SystemMessage.S1_YOUR_CLAN_ACADEMYS_APPRENTICE_HAS_LOGGED_OUT).addString(_name));
        }
        else if (clanMember.getObjectId() == apprentice)
        {
          clanMember.sendPacket(new SystemMessage(SystemMessage.S1_YOUR_CLAN_ACADEMYS_SPONSOR_HAS_LOGGED_OUT).addString(_name));
        }
      }
      member.setPlayerInstance(this, true);
    }
    FlagItemAttachment attachment = getActiveWeaponFlagAttachment();
    if (attachment != null)
    {
      attachment.onLogout(this);
View Full Code Here

    boolean IS_KNIGHT = (_clan != null) && Clan.isOrderOfKnights(_pledgeType);
    boolean IS_GUARD_CAPTAIN = false, IS_KNIGHT_COMMANDER = false, IS_LEADER = false;
    SubUnit unit = getSubUnit();
    if (unit != null)
    {
      UnitMember unitMember = unit.getUnitMember(getObjectId());
      if (unitMember == null)
      {
        _log.warn("Player: unitMember null, clan: " + _clan.getClanId() + "; pledgeType: " + unit.getType());
        return;
      }
      IS_GUARD_CAPTAIN = Clan.isRoyalGuard(unitMember.getLeaderOf());
      IS_KNIGHT_COMMANDER = Clan.isOrderOfKnights(unitMember.getLeaderOf());
      IS_LEADER = unitMember.getLeaderOf() == Clan.SUBUNIT_MAIN_CLAN;
    }
    switch (CLAN_LEVEL)
    {
      case -1:
        _pledgeClass = RANK_VAGABOND;
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.pledge.UnitMember

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.