Jump to content

Question

Posted
Καλησπερα.. Πως μπορω να το κανω να το παιρνει ο καθενας μονος του και να μην θελει 18 ακομη ατομα??


package quests;
 
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
 
import org.apache.commons.lang3.ArrayUtils;
 
import wp.commons.util.Rnd;
import wp.gameserver.model.Player;
import wp.gameserver.model.instances.NpcInstance;
import wp.gameserver.model.quest.Quest;
import wp.gameserver.model.quest.QuestState;
import wp.gameserver.scripts.ScriptFile;
 
 
public class _456_DontKnowDontCare extends Quest implements ScriptFile
{
private static final int[] SeparatedSoul =
{
32864,
32865,
32866,
32867,
32868,
32869,
32870
};
private static final int DrakeLordsEssence = 17251;
private static final int BehemothLeadersEssence = 17252;
private static final int DragonBeastsEssence = 17253;
private static final int DrakeLord = 25725;
private static final int BehemothLeader = 25726;
private static final int DragonBeast = 25727;
 
private static final int DrakeLordCorpse = 32884;
private static final int BehemothLeaderCorpse = 32885;
private static final int DragonBeastCorpse = 32886;
 
// Reward set
private static final int[] weapons =
{
15558,
15559,
15560,
15561,
15562,
15563,
15564,
15565,
15566,
15567,
15568,
15569,
15570,
15571
};
private static final int[] armors =
{
15743,
15744,
15745,
15746,
15747,
15748,
15749,
15750,
15751,
15752,
15753,
15754,
15755,
15756,
15757,
15759,
15758
};
private static final int[] accessory =
{
15763,
15764,
15765
};
private static final int[] scrolls =
{
6577,
6578,
959
};
private static final int[] reward_attr_crystal =
{
4342,
4343,
4344,
4345,
4346,
4347
};
private static final int gemstone_s = 2134;
 
private static Map<String, Long> _hwidsCompleted = new HashMap<>();
 
public _456_DontKnowDontCare()
{
super(PARTY_ALL);
addStartNpc(SeparatedSoul);
addTalkId(DrakeLordCorpse, BehemothLeaderCorpse, DragonBeastCorpse);
addQuestItem(DrakeLordsEssence, BehemothLeadersEssence, DragonBeastsEssence);
addKillId(DrakeLord);
addKillId(BehemothLeader);
addKillId(DragonBeast);
}
 
@Override
public String onEvent(String event, QuestState st, NpcInstance npc)
{
String htmltext = event;
if (event.equalsIgnoreCase("sepsoul_q456_05.htm"))
{
st.setState(STARTED);
st.setCond(1);
st.playSound(SOUND_ACCEPT);
}
else if (event.equalsIgnoreCase("take_essense"))
{
if ((st.getCond() == 1) && (st.getInt(String.valueOf(npc.getNpcId())) == 1))
{
switch (npc.getNpcId())
{
case DrakeLordCorpse:
if (st.getQuestItemsCount(DrakeLordsEssence) < 1)
{
st.giveItems(DrakeLordsEssence, 1);
}
break;
case BehemothLeaderCorpse:
if (st.getQuestItemsCount(BehemothLeadersEssence) < 1)
{
st.giveItems(BehemothLeadersEssence, 1);
}
break;
case DragonBeastCorpse:
if (st.getQuestItemsCount(DragonBeastsEssence) < 1)
{
st.giveItems(DragonBeastsEssence, 1);
}
break;
default:
break;
}
if ((st.getQuestItemsCount(DrakeLordsEssence) > 0) && (st.getQuestItemsCount(BehemothLeadersEssence) > 0) && (st.getQuestItemsCount(DragonBeastsEssence) > 0))
{
st.setCond(2);
}
}
else
{
return "You cannot talk to me, you have to kill the boss with a command channel of at least 18 players.";
}
 
return null;
}
else if (event.equalsIgnoreCase("sepsoul_q456_08.htm"))
{
if (_hwidsCompleted.containsKey(st.getPlayer().getHWID()))
{
long resetTime = _hwidsCompleted.get(st.getPlayer().getHWID());
if (resetTime > System.currentTimeMillis())
{
return "You have already completed this quest for today.";
}
}
 
st.takeAllItems(DrakeLordsEssence);
st.takeAllItems(BehemothLeadersEssence);
st.takeAllItems(DragonBeastsEssence);
 
if (Rnd.chance(7))
{
st.giveItems(weapons[Rnd.get(weapons.length)], 1);
}
else if (Rnd.chance(20))
{
st.giveItems(armors[Rnd.get(armors.length)], 1);
}
else
{
st.giveItems(accessory[Rnd.get(accessory.length)], 1);
}
 
if (Rnd.chance(30))
{
st.giveItems(scrolls[Rnd.get(scrolls.length)], 1);
}
if (Rnd.chance(70))
{
st.giveItems(reward_attr_crystal[Rnd.get(reward_attr_crystal.length)], 1);
}
st.giveItems(gemstone_s, 3);
 
st.setState(COMPLETED);
st.playSound(SOUND_FINISH);
 
st.exitCurrentQuest(this);
 
Calendar cal = Calendar.getInstance();
if (cal.get(Calendar.HOUR_OF_DAY) >= 6)
{
cal.add(Calendar.DATE, 1);
}
cal.set(Calendar.HOUR_OF_DAY, 6);
cal.set(Calendar.MINUTE, 30);
_hwidsCompleted.put(st.getPlayer().getHWID(), cal.getTimeInMillis());
}
 
return htmltext;
}
 
@Override
public String onTalk(NpcInstance npc, QuestState st)
{
String htmltext = "noquest";
 
int cond = st.getCond();
if (ArrayUtils.contains(SeparatedSoul, npc.getNpcId()))
{
if (_hwidsCompleted.containsKey(st.getPlayer().getHWID()))
{
long resetTime = _hwidsCompleted.get(st.getPlayer().getHWID());
if (resetTime > System.currentTimeMillis())
{
return "You have already completed this quest for today.";
}
}
 
switch (st.getState())
{
case CREATED:
if (st.isNowAvailable())
{
if (st.getPlayer().getLevel() >= 80)
{
htmltext = "sepsoul_q456_01.htm";
}
else
{
htmltext = "sepsoul_q456_00.htm";
st.exitCurrentQuest(true);
}
}
else
{
htmltext = "sepsoul_q456_00a.htm";
}
break;
case STARTED:
if (cond == 1)
{
htmltext = "sepsoul_q456_06.htm";
}
else if (cond == 2)
{
htmltext = "sepsoul_q456_07.htm";
}
break;
}
}
 
return htmltext;
}
 
@Override
public String onKill(NpcInstance npc, QuestState st)
{
if ((st.getPlayer().getParty() != null) && (st.getPlayer().getParty().getCommandChannel() != null) && (st.getPlayer().getParty().getCommandChannel().size() >= 18))
{
for (Player plr : st.getPlayer().getParty().getCommandChannel())
{
st = plr.getQuestState(getName());
if (st != null)
{
switch (npc.getNpcId())
{
case DrakeLord:
st.set(String.valueOf(DrakeLordCorpse), 1);
break;
case BehemothLeader:
st.set(String.valueOf(BehemothLeaderCorpse), 1);
break;
case DragonBeast:
st.set(String.valueOf(DragonBeastCorpse), 1);
break;
}
}
}
}
return "You must kill the boss with a command channel of at least 18 players to complete the quest.";
}
 
@Override
public void onLoad()
{
}
 
@Override
public void onReload()
{
}
 
@Override
public void onShutdown()
{
}
}

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

Βασικα θελει αλλαγη σε πολλα σημεια. 

 

Οπως εδω:

if ((st.getPlayer().getParty() != null) && (st.getPlayer().getParty().getCommandChannel() != null) && (st.getPlayer().getParty().getCommandChannel().size() >= 18))
{
	for (Player plr : st.getPlayer().getParty().getCommandChannel())
	{
		st = plr.getQuestState(getName());
		if (st != null)
		{
			switch (npc.getNpcId())
			{
				case DrakeLord:
				st.set(String.valueOf(DrakeLordCorpse), 1);
				break;
				case BehemothLeader:
				st.set(String.valueOf(BehemothLeaderCorpse), 1);
				break;
				case DragonBeast:
				st.set(String.valueOf(DragonBeastCorpse), 1);
				break;
			}
		}
	}
}

δοκιμασε το ετσι

st = plr.getQuestState(getName());
if (st != null)
{
	switch (npc.getNpcId())
	{
		case DrakeLord:
		st.set(String.valueOf(DrakeLordCorpse), 1);
		break;
		case BehemothLeader:
		st.set(String.valueOf(BehemothLeaderCorpse), 1);
		break;
		case DragonBeast:
		st.set(String.valueOf(DragonBeastCorpse), 1);
		break;
	}
}
Edited by melron

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...