Jump to content

Question

Posted (edited)

Hello community, i never write anything here, i just wonder, how can i set some code to check if the members of a clan are dualboxing, because i adapted reborn12 Clan reward from acis, and the rewards are working good, this is the code i can manage to make it work:
(Also i don't know how to make a list to add all clan lvl 6 skills.)

Once is finished i want to share it with the htmls.

Dont know why do not add the skills to the clan

 



 

package com.l2jserver.gameserver.model.actor.instance;

import java.util.Map;
import java.util.StringTokenizer;

import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.clientpackets.Say2;
import com.l2jserver.gameserver.network.serverpackets.AcquireSkillDone;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.network.serverpackets.EtcStatusUpdate;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;

/**
 * @author Reborn12
 */
public class L2ClanManagerInstance extends L2Npc
{
	
	public static Map<Integer, Integer> CLAN_SKILLS;
	
	public L2ClanManagerInstance(L2NpcTemplate template)
	{
		super(template);
		setInstanceType(InstanceType.L2ClanManagerInstance);
	}
	
	public int[] clanSkills =
		 {
			391, 370, 371, 373, 374, 376, 377, 379, 383	 
		 };

	public void onBypassFeedback(L2PcInstance player, String command)
	{
		StringTokenizer st = new StringTokenizer(command, " ");
		String actualCommand = st.nextToken();
		
		if (actualCommand.startsWith("mainHtml"))
		{
			showMainHtml(player, "data/html/mods/ClanManager/main.htm");
		}
		else if (actualCommand.startsWith("clanreward"))
		{
			showMainHtml(player, "data/html/mods/ClanManager/clanreward.htm");
		}
		else if (actualCommand.startsWith("getclanreward"))
		{
			
		if (player.getClan() == null)
		{
			player.sendPacket(new CreatureSay(0, Say2.BATTLEFIELD, "Clan Manager", "You don't have a clan."));
			return;
		}
		else if ((player.getClan() == null) || (!player.isClanLeader()))
		{
			player.sendPacket(new CreatureSay(0, Say2.BATTLEFIELD, "Clan Manager", "You need to be a Clan leader to take this reward."));
			return;
		}
		else if (player.getClan().getLevel() <= 4)
		{
			player.sendPacket(new CreatureSay(0, Say2.BATTLEFIELD, "Clan Manager", "Your clan need to be at least Lvl 5!"));
			return;
		}
		else if (player.getClan().getLevel() >= 6)
		{
			player.sendPacket(new CreatureSay(0, Say2.BATTLEFIELD, "Clan Manager", "Your clan is already Lv 6 or more!"));
			return;	
		}
		
		else if (player.getClan().getMembersCount() <= 14)
		{
			player.sendPacket(new CreatureSay(0, Say2.BATTLEFIELD, "Clan Manager", "You need minimum 15 members."));
			player.sendPacket(new CreatureSay(0, Say2.BATTLEFIELD, "Clan Manager", "Members amount: " + (player.getClan().getMembersCount()) + "."));
			return ;	
		}
		else if (player.getClan().getOnlineMembersCount() <= 9)
		{
			player.sendPacket(new CreatureSay(0, Say2.BATTLEFIELD, "Clan Manager", "You need minimum 10 members online."));
			player.sendPacket(new CreatureSay(0, Say2.BATTLEFIELD, "Clan Manager", "Members online: " + (player.getClan().getMembersCount()) + "."));
			return;	
		}
		else if (player.isClanLeader() && player.getClan().getMembersCount() >= 15 && player.getClan().getOnlineMembersCount() >= 10)
			{
				player.getClan().changeLevel(6);
                
				//Ids> 391, 370, 371, 373, 374, 376, 377, 379, 383
				for (int s : clanSkills)
				{
					Skill clanSkill = SkillData.getInstance().getInfo(s, SkillData.getInstance().getMaxLevel(s));
					player.getClan().addNewSkill(clanSkill);
					player.getClan().broadcastClanStatus();
				}
				player.getClan().addReputationScore(15000, true);
				player.sendPacket(new EtcStatusUpdate(player));
			    player.sendPacket(new AcquireSkillDone());
				player.sendPacket(new CreatureSay(0, Say2.BATTLEFIELD, "Clan Manager", "Congratulations, Your clan has been rewarded!."));
			}

				
		}
		else
			super.onBypassFeedback(player, command);
	}
	@Override
	public void onAction(L2PcInstance player)
	{
		if (this != player.getTarget())
		{
			player.setTarget(this);
			player.sendPacket(new ValidateLocation(player));
		}
		else if (isInsideRadius(player, 100, false, false))
		{
			player.setLastFolkNPC(this);
			showMainHtml(player, "data/html/mods/ClanManager/main.htm");
			player.sendPacket(ActionFailed.STATIC_PACKET);
		}
		else
		{
			player.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, this);
			player.sendPacket(ActionFailed.STATIC_PACKET);
		}
	}
	
	private void showMainHtml(L2PcInstance player, String file)
	{
		String filename = HtmCache.getInstance().getHtm(file);
		if (filename != null)
		{
			NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
			html.setHtml(filename);
			html.replace("%objectId%", String.valueOf(getObjectId()));
			html.replace("%charname%", player.getName());
			player.sendPacket(html);
			filename = null;
			html = null;
		}
	}
}

 

Clan 6 or more.jpg

Clan leader.jpg

Clan lvl 5 required.jpg

clanreward1.jpg

Edited by JackCerutti

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Guest
This topic is now closed to further replies.


×
×
  • Create New...