Тема: setClassId
Показать сообщение отдельно
Непрочитано 03.03.2014, 12:45   #7
Аватар для Bacek

По умолчанию Re: setClassId

Цитата:
Сообщение от L2J Посмотреть сообщение
Сделал "квест" который выдает профу, все работает как надо, но при релоге профа возвращается на старую, как решить эту проблему?
/*
* This program 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.
* 
* This program 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 village_master.getProf;
 
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2Pc Instance;
import com.l2jserver.gameserver.model.base.ClassId;
import com.l2jserver.gameserver.model.itemcontainer.Inven tory;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;
import com.l2jserver.gameserver.network.serverpackets.Soc ialAction;
 
/**
* Path of the Warrior (401)
* @author jython script by ElgarL, Mr.
* @version 2010-12-29 (Freya)
*/
public class getProf extends Quest
{
 
private static final String qn = "getProf";	
// Npc
private static final int Auron = 30010;
 
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
QuestState st = player.getQuestState(qn);
 
if (st == null)
{
return htmltext;
}
 
if (event.equalsIgnoreCase("1"))
{
if (player.getClassId().getId() == 0x00)
{
if (player.getLevel() >= 20)
{
htmltext = "30010-01.htm";
st.set("cond", "1");
}
else
{
htmltext = "30010_level.htm";
}
}
else
{
htmltext = "30010_sbros.htm";
}
}
else if ((event.equalsIgnoreCase("2") && st.getInt("cond") == 1))
{
st.addExpAndSp(0, 1000000000);
st.giveItems(57, 15000000);
player.setClassId(1);
st.playSound("ItemSound.quest_finish");
player.sendPacket(new SocialAction(player.getObjectId(), 3));
htmltext = "30010.htm";
}
return htmltext;
}
 
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
String htmltext = getNoQuestMsg(player);
QuestState st = player.getQuestState(qn);
if (st == null)
{
return htmltext;
}
 
if (npc.getNpcId() == Auron)
{
if (st.getInt("cond") == 0)
{
htmltext = "30010.htm";
st.set("cond", "1");
}
else if (st.getInt("cond") == 1)
{
htmltext = "30010-01.html";
st.set("cond", "2");
}
else if (st.getInt("cond") == 2)
{
st.giveItems(57, 15000000);
st.addExpAndSp(0, 1000000000);
player.setClassId(1);
st.playSound("ItemSound.quest_finish");
player.sendPacket(new SocialAction(player.getObjectId(), 3));
st.exitQuest(false);
htmltext = "30010.html";
}
}
return htmltext;
}
 
public getProf(int questId, String name, String descr)
{
super(questId, name, descr);
addStartNpc(Auron);
addTalkId(Auron);
}
 
public static void main(String[] args)
{
new getProf(30010, qn, "getProf");
}
}
 
Code: Java
<td background="L2UI_CT1.Windows_DF_Drawer_Bg"><button value="Профа 1" action="bypass -h Quest getProf 2" width=202 height=34 back="L2UI_CT1.OlympiadWnd_DF_Fight1None_Down" fore="L2UI_CT1.OlympiadWnd_DF_Fight1None"/></td>
 
Code: HTML

"else if ((event.equalsIgnoreCase("2") && st.getInt("cond") == 1))"

возможен дюп.
без форматирования код ад =(
__________________
Человек просто обязан ошибаться, раз другие учатся на его ошибках .......
Bacek вне форума Отправить сообщение для Bacek с помощью ICQ Ответить с цитированием