L2JMobius

High Five Npc NoblessMaster[1003000] reworked

kinghanker · 1 · 2307

Offline kinghanker

  • Knight
  • ***
    • Posts: 64
I redid the Npc Nobles Master and I believe it got a lot more flashy. I added one more option in it to be able to "charge" for the service. Hope it can be deployed!

Code: [Select]
diff --git a/dist/game/config/Custom/NoblessMaster.ini b/dist/game/config/Custom/NoblessMaster.ini
--- a/dist/game/config/Custom/NoblessMaster.ini
+++ b/dist/game/config/Custom/NoblessMaster.ini
@@ -18,3 +18,8 @@ LevelRequirement = 80
 # Reward nobless tiara item.
 # Default: True
 RewardTiara = True
+
+# Currency used to pay
+# Default: 57(Adena)
+NoblessCoin = 57
+NoblessCoinCount = 1000000000
diff --git a/dist/game/data/scripts/custom/NoblessMaster/1003000-1.htm b/dist/game/data/scripts/custom/NoblessMaster/1003000-1.htm
--- a/dist/game/data/scripts/custom/NoblessMaster/1003000-1.htm
+++ b/dist/game/data/scripts/custom/NoblessMaster/1003000-1.htm
@@ -1,5 +1,18 @@
-<html><body>
-Noblesse Master:<br>
-Congratulations!<br1>
-You are now a Noblesse.<br>
-</body></html>
\ No newline at end of file
+<html noscrollbar imgsrc="L2UI_CH3.refinewnd_back_Pattern">
+ <body>
+ <title>Noblesse Master</title>
+ <center>
+ <table width=180 >
+ <tr>
+ <td></td>
+ <td  align=center><img src=L2UI_CT1.OlympiadWnd_DF_GrandTexture width=256 height=185></td>
+ </tr>
+ </table>
+ <table width=180 >
+ <tr>
+ <td></td>
+ <td align=center>You are already noble</td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/dist/game/data/scripts/custom/NoblessMaster/1003000-2.htm b/dist/game/data/scripts/custom/NoblessMaster/1003000-2.htm
--- a/dist/game/data/scripts/custom/NoblessMaster/1003000-2.htm
+++ b/dist/game/data/scripts/custom/NoblessMaster/1003000-2.htm
@@ -1,4 +1,16 @@
-<html><body>
-Noblesse Master:<br>
-You must be at least level 80!
-</body></html>
\ No newline at end of file
+<html noscrollbar imgsrc="L2UI_CH3.refinewnd_back_Pattern">
+ <body>
+ <title>Noblesse Master</title>
+ <center>
+ <table>
+ <tr>
+ <td> </td>
+ <td  align=center><img src=L2UI_CT1.OlympiadWnd_DF_GrandTexture width=256 height=185></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td align=center>You don't have the necessary items</td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/dist/game/data/scripts/custom/NoblessMaster/1003000-3.htm b/dist/game/data/scripts/custom/NoblessMaster/1003000-3.htm
--- a/dist/game/data/scripts/custom/NoblessMaster/1003000-3.htm
+++ b/dist/game/data/scripts/custom/NoblessMaster/1003000-3.htm
@@ -1,4 +1,16 @@
-<html><body>
-Noblesse Master:<br>
-You already are a noble.
-</body></html>
\ No newline at end of file
+<html noscrollbar imgsrc="L2UI_CH3.refinewnd_back_Pattern">
+ <body>
+ <title>Noblesse Master</title>
+ <center>
+ <table>
+ <tr>
+ <td> </td>
+ <td  align=center><img src=L2UI_CT1.OlympiadWnd_DF_GrandTexture width=256 height=185></td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td align=center>Your level is still low, come back another time</td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/dist/game/data/scripts/custom/NoblessMaster/1003000-4.htm b/dist/game/data/scripts/custom/NoblessMaster/1003000-4.htm
--- /dev/null
+++ b/dist/game/data/scripts/custom/NoblessMaster/1003000-4.htm
@@ -0,0 +1,29 @@
+<html noscrollbar imgsrc="L2UI_CH3.refinewnd_back_Pattern">
+ <body>
+ <title>Noblesse Master</title>
+ <center>
+ <table>
+ <tr>
+ <td> </td>
+ <td align=center><img src=L2UI_CT1.OlympiadWnd_DF_GrandTexture width=256 height=185></td>
+ </tr>
+ </table>
+ <br1>
+ <center>
+ Congratulations, now you are noble!<br1>
+ These are your new skills.<br1>
+ </center>
+ <table width=280>
+ <tr>
+ <td align=center></td>
+ <td align=center><img src=icon.skill0326 width=32 height=32></td>
+ <td align=center><img src=icon.skill0327 width=32 height=32></td>
+ <td align=center><img src=icon.skill1323 width=32 height=32></td>
+ <td align=center><img src=icon.skill1324 width=32 height=32></td>
+ <td align=center><img src=icon.skill1325 width=32 height=32></td>
+ <td align=center><img src=icon.skill1326 width=32 height=32></td>
+ <td align=center><img src=icon.skill1327 width=32 height=32></td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/dist/game/data/scripts/custom/NoblessMaster/1003000.htm b/dist/game/data/scripts/custom/NoblessMaster/1003000.htm
--- a/dist/game/data/scripts/custom/NoblessMaster/1003000.htm
+++ b/dist/game/data/scripts/custom/NoblessMaster/1003000.htm
@@ -1,15 +1,19 @@
-<html><body>
-Noblesse Master:<br>
-<br>
-If you are at least level 80,<br>
-I can promote you to Noblesse.<br>
-<br>
-<br>
-<br>
-<br>
-<br>
-<center>
-<a action="bypass -h Quest NoblessMaster noblesse">Noblesse me!</a><br>
-<br>
-</center>
-</body></html>
\ No newline at end of file
+<html noscrollbar>
+ <body>
+ <title>Noblesse Master</title>
+ <table width=292 height=358 background="L2UI_CH3.refinewnd_back_Pattern">
+ <tr><td valign="top" align="center">
+ <table>
+ <tr><td width=256 height=185 background="L2UI_CT1.OlympiadWnd_DF_GrandTexture"></td></tr>
+ </table>
+ <table>
+ <tr><td></td></tr>
+ <tr><td align=center><img src=icon.skill1323 width=32 height=32><br></td></tr>
+ <tr><td align=center>Hello adventurer<br></td></tr>
+ <tr><td align=center>The time has come!</td></tr>
+ <tr><td align=center>Can I promote you to nobless?</td></tr>
+ <tr><td></td></tr>
+ <tr><td align=center><button value="Noblesse me" action="bypass -h Quest NoblessMaster noblesse" width=160 height=27 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td></tr>
+ </table>
+ </body>
+</html>
diff --git a/dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java b/dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java
--- a/dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java
+++ b/dist/game/data/scripts/custom/NoblessMaster/NoblessMaster.java
@@ -20,6 +20,8 @@ import org.l2jmobius.Config;
 import org.l2jmobius.gameserver.enums.QuestSound;
 import org.l2jmobius.gameserver.model.actor.Npc;
 import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
 
 import ai.AbstractNpcAI;
 
@@ -41,34 +43,46 @@ public class NoblessMaster extends AbstractNpcAI
  @Override
  public String onAdvEvent(String event, Npc npc, Player player)
  {
+ String htmltext = event;
  if (!Config.NOBLESS_MASTER_ENABLED)
  {
- return null;
+ return htmltext;
  }
 
- switch (event)
+ if (event.equals("noblesse"))
  {
- case "noblesse":
+ if (player.isNoble())
  {
- if (player.isNoble())
- {
- return "1003000-3.htm";
- }
- if (player.getLevel() >= Config.NOBLESS_MASTER_LEVEL_REQUIREMENT)
- {
- if (Config.NOBLESS_MASTER_REWARD_TIARA)
- {
- giveItems(player, NOBLESS_TIARA, 1);
- }
- player.setNoble(true);
- player.sendPacket(QuestSound.ITEMSOUND_QUEST_FINISH.getPacket());
- return "1003000-1.htm";
- }
+ return "1003000-1.htm";
+ }
+
+ if (!(getQuestItemsCount(player, Config.NOBLESS_COIN) >= Config.NOBLESS_COIN_COUNT))
+ {
+ final SystemMessage sm = new SystemMessage(SystemMessageId.S2_UNIT_S_OF_THE_ITEM_S1_IS_ARE_REQUIRED);
+ sm.addItemName(Config.NOBLESS_COIN);
+ sm.addLong(Config.NOBLESS_COIN_COUNT);
+ player.sendPacket(sm);
  return "1003000-2.htm";
  }
+
+ if (!(player.getLevel() >= Config.NOBLESS_MASTER_LEVEL_REQUIREMENT))
+ {
+ player.sendMessage("You are not yet at the level: " + Config.NOBLESS_MASTER_LEVEL_REQUIREMENT);
+ return "1003000-3.htm";
+ }
+
+ if (Config.NOBLESS_MASTER_REWARD_TIARA)
+ {
+ giveItems(player, NOBLESS_TIARA, 1);
+ }
+
+ takeItems(player, Config.NOBLESS_COIN, Config.NOBLESS_COIN_COUNT);
+ player.setNoble(true);
+ player.sendPacket(QuestSound.ITEMSOUND_QUEST_FINISH.getPacket());
+ return "1003000-4.htm";
  }
 
- return null;
+ return htmltext;
  }
 
  @Override
diff --git a/java/org/l2jmobius/Config.java b/java/org/l2jmobius/Config.java
--- a/java/org/l2jmobius/Config.java
+++ b/java/org/l2jmobius/Config.java
@@ -1227,6 +1227,8 @@ public class Config
  public static boolean NOBLESS_MASTER_ENABLED;
  public static int NOBLESS_MASTER_NPCID;
  public static int NOBLESS_MASTER_LEVEL_REQUIREMENT;
+ public static int NOBLESS_COIN;
+ public static long NOBLESS_COIN_COUNT;
  public static boolean NOBLESS_MASTER_REWARD_TIARA;
  public static boolean L2WALKER_PROTECTION;
  public static boolean ENABLE_USER_PANEL;
@@ -2970,6 +2972,8 @@ public class Config
  NOBLESS_MASTER_NPCID = noblessMasterConfig.getInt("NpcId", 1003000);
  NOBLESS_MASTER_LEVEL_REQUIREMENT = noblessMasterConfig.getInt("LevelRequirement", 80);
  NOBLESS_MASTER_REWARD_TIARA = noblessMasterConfig.getBoolean("RewardTiara", false);
+ NOBLESS_COIN = noblessMasterConfig.getInt("NoblessCoin", 57);
+ NOBLESS_COIN_COUNT = noblessMasterConfig.getLong("NoblessCoinCount", 1000000000L);
 
  // Load OfflineTrade config file (if exists)
  final PropertiesParser offlineTradeConfig = new PropertiesParser(CUSTOM_OFFLINE_TRADE_CONFIG_FILE);