setClassId - Форум администраторов игровых серверов
Форум администраторов игровых серверов StormWall - Защита от DDos атак
Регистрация Мнения Справка Пользователи Календарь Все разделы прочитаны
Вернуться   Форум администраторов игровых серверов > MMO > Lineage II > Работа со скриптами

Работа со скриптами Помощь в редактировании и написании квестов к Java серверам, а так же эвентов.

Ответ
Опции темы
Непрочитано 05.02.2014, 21:51   #1
Аватар для L2J
Пользователь

Автор темы (Топик Стартер) setClassId

Сделал "квест" который выдает профу, все работает как надо, но при релоге профа возвращается на старую, как решить эту проблему?
/*
* 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

Последний раз редактировалось Ashe; 01.03.2014 в 03:25.
L2J вне форума Ответить с цитированием
Непрочитано 05.02.2014, 22:29   #2
Пользователь

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

Запись в БД делайте (если в функцие setClassId этого нету)
Main вне форума Ответить с цитированием
Непрочитано 06.02.2014, 01:38   #3
Аватар для WoWan-SM
Герой

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

В классе Player смотрим методы
Код:
public static Player restore(final int objectId)
//Восстановление персонажа входе

Сохранять в базу должно по идее сразу при смене профы.
Смотрим метод
Код:
public synchronized void setClassId(final int id, boolean noban, boolean fromQuest)
Там ищем переход на метод
Код:
public void storeCharSubClasses()
В нем переход на
Код:
CharacterSubclassDAO.getInstance().store(this);
Вот в общем все места перечислил где искать надо.
WoWan-SM вне форума Отправить сообщение для WoWan-SM с помощью ICQ Отправить сообщение для WoWan-SM с помощью Skype™ Ответить с цитированием
Непрочитано 06.02.2014, 10:48   #4
Заинтересовавшийся

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

Цитата:
Сообщение от WoWan-SM Посмотреть сообщение
В классе Player смотрим методы
Вот в общем все места перечислил где искать надо.
У него исходник l2j,а не l2p
добавь строку setBaseClass
_LION_ вне форума Ответить с цитированием
Сказали спасибо:
Непрочитано 06.02.2014, 18:41   #5
Аватар для L2J
Пользователь

Автор темы (Топик Стартер) Re: setClassId

с setBaseClass работает, но не совсем так как мне надо, возможно ли сделать без смены модельки чара? у меня чар был маг, стал воин.


Добавлено через 1 час 0 минут
Как сделать запись в бд?

Последний раз редактировалось L2J; 06.02.2014 в 19:42. Причина: Добавлено сообщение
L2J вне форума Ответить с цитированием
Непрочитано 03.03.2014, 12:39   #6
Аватар для SmokiMo
Заинтересовавшийся

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

Советую тебе сделать
Код:
			player.addSubClass(ид класса, 1);
			player.setActiveClass(activeChar.getTotalSubClasses());
SmokiMo вне форума Отправить сообщение для SmokiMo с помощью ICQ Отправить сообщение для SmokiMo с помощью Skype™ Ответить с цитированием
Непрочитано 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 Ответить с цитированием
Ответ


Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 
Опции темы

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход


© 2007–2024 «Форум администраторов игровых серверов»
Защита сайта от DDoS атак — StormWall
Работает на Булке неизвестной версии с переводом от zCarot
Текущее время: 18:20. Часовой пояс GMT +3.

Вверх