Re: services
Posted: Mon Sep 14, 2015 7:59 pm
Yes i put the script at game/data/scripts/custom/ai/EvilSantaClausAvanael92 wrote:You clearly didn't read the guide
The package declaration tells you where the script should be stored. In this case:
Code: Select all
game/data/scripts/custom/ai/EvilSantaClaus
Code: Select all
/*
* Copyright (C) 2004-2015 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J DataPack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package custom.ai.EvilSantaClaus;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
/**
* Evil Santa Claus AI.
* @author Zoey76
*/
public class EvilSantaClaus extends AbstractNpcAI
{
// NPC
private static final int NPC_ID = 1004307;
// Rewarded players
private static final Set<Integer> REWARDED_PLAYERS_IDS = ConcurrentHashMap.newKeySet();
// Reward
private static final long ADENA_COUNT = 100;
public EvilSantaClaus()
{
super(EvilSantaClaus.class.getSimpleName(), "custom/ai");
addFirstTalkId(NPC_ID);
addTalkId(NPC_ID);
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
String html = getHtm(player.getHtmlPrefix(), "1004307.html");
html = html.replace("%gender%", player.getAppearance().getSex() ? "girl" : "boy");
return html;
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "reward":
{
if (npc.isInsideRadius(player, 300, false, true))
{
if (REWARDED_PLAYERS_IDS.contains(player.getObjectId()))
{
player.sendMessage("You have already been rewarded!");
}
else
{
REWARDED_PLAYERS_IDS.add(player.getObjectId());
player.sendMessage("Here is your reward!");
giveAdena(player, ADENA_COUNT, false);
}
}
else
{
player.sendMessage("You are too far to get a reward!");
}
break;
}
}
return super.onAdvEvent(event, npc, player);
}
public static void main(String[] args)
{
new EvilSantaClaus();
}
}
Code: Select all
<html><body>Evil Santa Claus:<br>
You have been a naughty %gender%!<br>
<a action="bypass -h Quest EvilSantaClasus reward">Rewards</a><br>
</body></html>
Code: Select all
<npc id="1004307" displayId="4307" level="80" type="L2Npc" name="Evil Santa Claus"
usingServerSideName="true" title="My First Custom NPC" usingServerSideTitle="true">
<sex>MALE</sex>
<collision>
<radius normal="25" />
<height normal="35" />
</collision>
</npc>
I get to see the code in chat options look picture below here