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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • And Discord: https://discord.gg/3aYqWNqb
    • Ofc: https://discord.gg/3aYqWNqb
    • You can find some H5 skins shared in old L2 modding Discords, but most of the higher‑quality ones are either paid or come bundled with full client edits. I usually mix in commissioned work and whatever I can patch myself. On a side note, I fund a lot of these commissions by selling off game items through instant sell cs2 skins, which has been a quick way for me to get some cash for projects.
    • There is no need for gRPC in this case, even tho originally it was gRPC based but since we don't need it to be bi-directional, we switched to simple http requests for the web calls and SSEs for the data streamed from the server. There are distributed locks in place to precent race conditions between actions that can happen between multiple web instances and the server.   Local models can also be slow depending on the model, and most external models can actually be faster than local ones if you use Flash 2.5 or something along those lines. I am running on 512GB of Unified Memory on my Mac Studio M3 Ultra so the speed of the local model for a small model is pretty good but I tested it with Gemini too and it works equally as fast and in some cases faster. The way it works is that I'm using pgvector (one of the benefits of moving to Postgres) to search the data and see what the player can see etc and there is some batching of the next few actions for 2-4 seconds for the user until the next LLM request fires. The batching also includes branching on logic so if they for example fall under some HP they will move to kiting instead of attacking or maybe they heal etc.   Everything is authed and permission-based. The server and the backend of the frontend have secure communication between them, either with a symmetric key (not recommended for production) or a certificate (the recommended way), so there is no worry. It's all tied to the account's access level, etc., so nobody can make an action that they normally wouldn't be allowed to do. Even the MCP is token-based, and there are prompt injection protections in place. The MCP is audited, and every mutation needs confirmation. The admin area is only accessible to the admin account anyway so normal users can't access it.  
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..