Classmasters with 4th class support.

This commit is contained in:
MobiusDev 2015-05-17 00:46:27 +00:00
parent 1a7e7554a0
commit add48c6f5b
10 changed files with 122 additions and 19 deletions

View File

@ -157,25 +157,26 @@ EffectTickRatio = 666
# Default: False
AllowClassMasters = False
# ConfigClassMaster=1;[57(100000)];[];2;[57(1000000)];[];3;[57(10000000)],[5575(1000000)];[6622(1)]
# 1st occupation change for 100.000 Adena (item id 57)
# 2nd occupation change for 1.000.0000 Adena (item id 57)
# 3rd occupation change for 10.000.0000 Adena (item id 57) and 1.000.000 Ancient Adena (item id 5575)
# on 3rd occupation change player will be rewarded with 1 Book of Giants (item id 6622)
# ConfigClassMaster=1;[];[];2;[];[];3;[];[]
# 1st, 2nd, 3rd occupation change for free, without rewards.
# ConfigClassMaster=1;[57(100000)];[];2;[57(1000000)];[];3;[57(10000000)],[5575(1000000)];[6622(1)];4;[57(100000000)];[]
# 1st occupation change for 100.000 Adena (item id 57)
# 2nd occupation change for 1.000.0000 Adena (item id 57)
# 3rd occupation change for 10.000.0000 Adena (item id 57) and 1.000.000 Ancient Adena (item id 5575)
# on 3rd occupation change player will be rewarded with 1 Book of Giants (item id 6622)
# 4th occupation change for 100.000.0000 Adena (item id 57)
# ConfigClassMaster=1;[];[];2;[];[]
# Allow only first and second change.
ConfigClassMaster = 1;[];[];2;[];[];3;[];[]
# ConfigClassMaster=1;[];[];2;[];[];3;[];[];4;[];[]
# 1st, 2nd, 3rd, 4th occupation change for free, without rewards.
ConfigClassMaster = 1;[];[];2;[];[];3;[];[];4;[];[]
# Class Masters will allow changing to any occupation on any level inside class tree
# For example, Dwarven Fighter will be able to advance to:
# Artisan, Scavenger, Warsmith, Bounty Hunter, Maestro, Fortune Seeker.
# But Warsmith will be able to change only to Maestro.
# But Warsmith will be able to change only to Maestro.
# Default = False
AllowEntireTree = False
# When character reach levels 20,40,76 he will receive tutorial page
# When character reach levels 20,40,76,85 he will receive tutorial page
# with list of the all possible variants, and can select and immediately
# change to the new occupation, or decide to choose later (on next login).
# Can be used with or without classic Class Masters.

View File

@ -2,7 +2,8 @@
How may I assist you?<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_1stClass">Complete the first class transfer.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_2ndClass">Complete the second class transfer.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_3rdClass">Transfer from the second class to the third class.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_3rdClass">Complete the third class transfer.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_4thClass">Complete the fourth class transfer.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_become_noble">Become Noblesse</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 201">Purchase wearable items</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_increase_clan_level">Raise the clan's level</Button>

View File

@ -2,7 +2,8 @@
How may I assist you?<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_1stClass">Complete the first class transfer.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_2ndClass">Complete the second class transfer.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_3rdClass">Transfer from the second class to the third class.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_3rdClass">Complete the third class transfer.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_4thClass">Complete the fourth class transfer.</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_become_noble">Become Noblesse</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 201">Purchase wearable items</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_increase_clan_level">Raise the clan's level</Button>

View File

@ -6,5 +6,5 @@ Item(s) required for class change:
%req_items%
</table>
<br><br>
<a action="link COXX">Ask me next time.</a>
<a action="bypass -h AlternateClassMaster close_window">Ask me next time.</a>
</body></html>

View File

@ -109,6 +109,7 @@ import handlers.admincommandhandlers.AdminTvTEvent;
import handlers.admincommandhandlers.AdminUnblockIp;
import handlers.admincommandhandlers.AdminVitality;
import handlers.admincommandhandlers.AdminZone;
import handlers.bypasshandlers.AlternateClassMaster;
import handlers.bypasshandlers.ArcanCityMovie;
import handlers.bypasshandlers.Augment;
import handlers.bypasshandlers.Buy;
@ -409,6 +410,7 @@ public class MasterHandler
},
{
// Bypass Handlers
AlternateClassMaster.class,
ArcanCityMovie.class,
Augment.class,
Buy.class,

View File

@ -0,0 +1,48 @@
/*
* 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 handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2ClassMasterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
/**
* @author Mobius
*/
public class AlternateClassMaster implements IBypassHandler
{
private static final String[] COMMANDS =
{
"AlternateClassMaster",
};
@Override
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
L2ClassMasterInstance.onTutorialLink(activeChar, command);
return false;
}
@Override
public String[] getBypassList()
{
return COMMANDS;
}
}

View File

@ -29,7 +29,6 @@ import com.l2jserver.gameserver.model.holders.ItemHolder;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.TutorialCloseHtml;
import com.l2jserver.gameserver.network.serverpackets.TutorialShowHtml;
import com.l2jserver.gameserver.network.serverpackets.TutorialShowQuestionMark;
import com.l2jserver.gameserver.network.serverpackets.UserInfo;
import com.l2jserver.util.StringUtil;
@ -82,6 +81,10 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
{
showHtmlMenu(player, getObjectId(), 3);
}
else if (command.startsWith("4thClass"))
{
showHtmlMenu(player, getObjectId(), 4);
}
else if (command.startsWith("change_class"))
{
int val = Integer.parseInt(command.substring(13));
@ -136,7 +139,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
public static final void onTutorialLink(L2PcInstance player, String request)
{
if (!Config.ALTERNATE_CLASS_MASTER || (request == null) || !request.startsWith("CO"))
if (!Config.ALTERNATE_CLASS_MASTER || (request == null) || !request.startsWith("AlternateClassMaster"))
{
return;
}
@ -148,7 +151,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
try
{
int val = Integer.parseInt(request.substring(2));
int val = Integer.parseInt(request.substring(21));
checkAndChangeClass(player, val);
}
catch (NumberFormatException e)
@ -216,6 +219,10 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
{
sb.append("Come back after your second occupation change.<br>");
}
else if (Config.CLASS_MASTER_SETTINGS.isAllowed(4))
{
sb.append("Come back after your third occupation change.<br>");
}
else
{
sb.append("I can't change your occupation.<br>");
@ -230,6 +237,10 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
{
sb.append("Come back after your second occupation change.<br>");
}
else if (Config.CLASS_MASTER_SETTINGS.isAllowed(4))
{
sb.append("Come back after your third occupation change.<br>");
}
else
{
sb.append("I can't change your occupation.<br>");
@ -240,12 +251,26 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
{
sb.append("Come back here when you reached level 76 to change your class.<br>");
}
else if (Config.CLASS_MASTER_SETTINGS.isAllowed(4))
{
sb.append("Come back here when you reached level 85 to change your class.<br>");
}
else
{
sb.append("I can't change your occupation.<br>");
}
break;
case 3:
if (Config.CLASS_MASTER_SETTINGS.isAllowed(4))
{
sb.append("Come back here when you reached level 85 to change your class.<br>");
}
else
{
sb.append("I can't change your occupation.<br>");
}
break;
case 4:
sb.append("There is no class change available for you anymore.<br>");
break;
}
@ -329,13 +354,13 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
}
if (validateClassId(currentClassId, cid))
{
StringUtil.append(menu, "<a action=\"link CO", String.valueOf(cid.getId()), "\">", ClassListData.getInstance().getClass(cid).getEscapedClientCode(), "</a><br>");
StringUtil.append(menu, "<a action=\"bypass -h AlternateClassMaster ", String.valueOf(cid.getId()), "\">", ClassListData.getInstance().getClass(cid).getEscapedClientCode(), "</a><br>");
}
}
msg = msg.replaceAll("%menu%", menu.toString());
msg = msg.replace("%req_items%", getRequiredItems(currentClassId.level() + 1));
player.sendPacket(new TutorialShowHtml(msg));
player.sendPacket(new NpcHtmlMessage(msg));
}
private static final boolean checkAndChangeClass(L2PcInstance player, int val)
@ -398,7 +423,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
player.broadcastUserInfo();
if (Config.CLASS_MASTER_SETTINGS.isAllowed(player.getClassId().level() + 1) && Config.ALTERNATE_CLASS_MASTER && (((player.getClassId().level() == 1) && (player.getLevel() >= 40)) || ((player.getClassId().level() == 2) && (player.getLevel() >= 76))))
if (Config.CLASS_MASTER_SETTINGS.isAllowed(player.getClassId().level() + 1) && Config.ALTERNATE_CLASS_MASTER && (((player.getClassId().level() == 1) && (player.getLevel() >= 40)) || ((player.getClassId().level() == 2) && (player.getLevel() >= 76)) || ((player.getClassId().level() == 3) && (player.getLevel() >= 85))))
{
showQuestionMark(player);
}
@ -420,6 +445,8 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
return 40;
case 2:
return 76;
case 3:
return 85;
default:
return Integer.MAX_VALUE;
}

View File

@ -22,6 +22,7 @@ import com.l2jserver.gameserver.handler.BypassHandler;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.instance.L2ClassMasterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.QuestState;
public class RequestTutorialLinkHtml extends L2GameClientPacket
{
@ -52,6 +53,12 @@ public class RequestTutorialLinkHtml extends L2GameClientPacket
else
{
L2ClassMasterInstance.onTutorialLink(player, _bypass);
final QuestState qs = player.getQuestState("Q00255_Tutorial");
if (qs != null)
{
qs.getQuest().notifyEvent(_bypass, null, player);
}
}
}

View File

@ -21,6 +21,7 @@ package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.handler.BypassHandler;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.QuestState;
public class RequestTutorialPassCmdToServer extends L2GameClientPacket
{
@ -47,6 +48,14 @@ public class RequestTutorialPassCmdToServer extends L2GameClientPacket
{
handler.useBypass(_bypass, player, null);
}
else
{
final QuestState qs = player.getQuestState("Q00255_Tutorial");
if (qs != null)
{
qs.getQuest().notifyEvent(_bypass, null, player);
}
}
}
@Override

View File

@ -20,6 +20,7 @@ package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.model.actor.instance.L2ClassMasterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.QuestState;
public class RequestTutorialQuestionMark extends L2GameClientPacket
{
@ -44,6 +45,12 @@ public class RequestTutorialQuestionMark extends L2GameClientPacket
}
L2ClassMasterInstance.onTutorialQuestionMark(player, _number);
final QuestState qs = player.getQuestState("Q00255_Tutorial");
if (qs != null)
{
qs.getQuest().notifyEvent("QM" + _number + "", null, player);
}
}
@Override