Advertisement
Sarada-L2

SellBuff L2jFrozen Adpt Yo: Sarada

Feb 19th, 2021
524
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.57 KB | None | 0 0
  1. diff --git a/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java b/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
  2. index e1c4275..e2cf06b 100644
  3. --- a/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
  4. +++ b/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
  5. @@ -35,6 +35,7 @@
  6. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.FarmPvpCmd;
  7. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.OfflineShop;
  8. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Online;
  9. +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.SellBuff;
  10. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.StatsCmd;
  11. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.TvTCmd;
  12. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Voting;
  13. @@ -65,7 +66,7 @@
  14. private VoicedCommandHandler()
  15. {
  16. _datatable = new FastMap<>();
  17. -
  18. + registerVoicedCommandHandler(new SellBuff());
  19. registerVoicedCommandHandler(new Voting());
  20.  
  21. if (Config.BANKING_SYSTEM_ENABLED)
  22. diff --git a/head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/SellBuff.java b/head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/SellBuff.java
  23. new file mode 100644
  24. index 0000000..41516d2
  25. --- /dev/null
  26. +++ b/head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/SellBuff.java
  27. @@ -0,0 +1,71 @@
  28. +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
  29. +
  30. +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
  31. +import com.l2jfrozen.gameserver.model.L2Character;
  32. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  33. +import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
  34. +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
  35. +
  36. +import javolution.text.TextBuilder;
  37. +
  38. +public class SellBuff implements IVoicedCommandHandler
  39. +{
  40. +
  41. + private static final String[] VOICED_COMMANDS = {"sellbuffs"};
  42. +
  43. + @Override
  44. + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  45. + {
  46. + if(activeChar == null)
  47. + return false;
  48. +
  49. +
  50. + if(activeChar.isDead() || activeChar.isAlikeDead()){
  51. + activeChar.sendMessage("You are dead , you can't sell at the moment");
  52. + return false;
  53. + }
  54. + else if(activeChar.isInOlympiadMode() || Olympiad.getInstance().isRegistered(activeChar)){
  55. + activeChar.sendMessage("You are in olympiad , you can't sell at the moment");
  56. + return false;
  57. + }
  58. + else if(activeChar.atEvent){
  59. + activeChar.sendMessage("You are in event , you can't sell at the moment");
  60. + return false;
  61. + }
  62. + else if(!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
  63. + activeChar.sendMessage("You are not in peacefull zone , you can sell only in peacefull zones");
  64. + return false;
  65. + }
  66. + else if(activeChar.getPvpFlag() > 0 || activeChar.isInCombat() || activeChar.getKarma() > 0){
  67. + activeChar.sendMessage("You are in combat mode , you can't sell at the moment");
  68. + return false;
  69. + }
  70. + else if(activeChar.getClassId().getId() != 98){
  71. + activeChar.sendMessage("You must be a buffer class to sell buffs");
  72. + return false;
  73. + }
  74. +
  75. + TextBuilder tb = new TextBuilder(0);
  76. + tb.append("<html><body>");
  77. + tb.append("Hello , by completing this form you will be able to sell buffs.");
  78. + tb.append("<br>Players will be able , targeting you to take your buff services<br>");
  79. + tb.append("<br>You will be rewarded with adenas for each buff a player takes.");
  80. + tb.append("<br><center>Now choose the prize:</center><br>");
  81. + tb.append("<edit var=\"pri\" width=120 height=15>");
  82. + tb.append("<center><button value=\"Confirm\" action=\"bypass -h actr $pri\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\">");
  83. + tb.append("</body></html>");
  84. + NpcHtmlMessage n = new NpcHtmlMessage(0);
  85. + n.setHtml(tb.toString());
  86. + activeChar.sendPacket(n);
  87. +
  88. + return true;
  89. + }
  90. +
  91. +
  92. + @Override
  93. + public String[] getVoicedCommandList()
  94. + {
  95. + return VOICED_COMMANDS;
  96. + }
  97. +
  98. +}
  99. \ No newline at end of file
  100. diff --git a/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java b/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  101. index a281692..bf3cab7 100644
  102. --- a/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  103. +++ b/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  104. @@ -301,7 +301,8 @@
  105.  
  106. /** The _last teleport action. */
  107. private long _lastTeleportAction = 0;
  108. -
  109. + private boolean _sellbuff = false;
  110. + private int _buffprize = 0;
  111. /** The TOGGLE_USE time. */
  112. protected long TOGGLE_USE = 0;
  113.  
  114. @@ -4427,6 +4428,8 @@
  115. */
  116. public void standUp()
  117. {
  118. + if(isSellBuff())
  119. + return;
  120. if (isFakeDeath())
  121. {
  122. broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_STANDING));
  123. @@ -6982,6 +6985,42 @@
  124.  
  125. // Target the new L2Object (add the target to the L2PcInstance _target, _knownObject and L2PcInstance to _KnownObject of the L2Object)
  126. super.setTarget(newTarget);
  127. +
  128. + L2PcInstance t = null;
  129. + if(newTarget instanceof L2PcInstance)
  130. + t = (L2PcInstance) newTarget;
  131. +
  132. + if(t != null){
  133. + if(t.isSellBuff() && t != this){
  134. + TextBuilder tb = new TextBuilder();
  135. + NpcHtmlMessage n = new NpcHtmlMessage(0);
  136. +
  137. + tb.append("<html><body>");
  138. + tb.append("<br><br>");
  139. + tb.append("<center>Hi, I am "+t.getName()+" and i sell my buffs</center>");
  140. + tb.append("<br><center>Buffs Prize:"+t.getBuffPrize()+"</center>");
  141. +
  142. + L2Skill[] skills = t.getAllSkills();
  143. + FastList<L2Skill> ba = new FastList<L2Skill>();
  144. +
  145. + for(L2Skill s : skills){
  146. + if(s == null)
  147. + continue;
  148. +
  149. + if(s.getSkillType() == SkillType.BUFF && s.isActive())
  150. + ba.add(s);
  151. + }
  152. +
  153. + for(L2Skill p : ba){
  154. + tb.append("<center><button value=\""+p.getName()+"\" action=\"bypass -h buff"+p.getId()+"\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\"></center>");
  155. + }
  156. +
  157. + tb.append("</body></html>");
  158. +
  159. + n.setHtml(tb.toString());
  160. + sendPacket(n);
  161. + }
  162. + }
  163. }
  164.  
  165. /**
  166. @@ -19625,6 +19664,21 @@
  167. {
  168. _lastAction = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(Config.AFK_TIMER);
  169. }
  170. + public boolean isSellBuff(){
  171. + return _sellbuff;
  172. + }
  173. +
  174. + public void setSellBuff(boolean j){
  175. + _sellbuff = j;
  176. + }
  177. +
  178. + public int getBuffPrize(){
  179. + return _buffprize;
  180. + }
  181. +
  182. + public void setBuffPrize(int x){
  183. + _buffprize = x;
  184. + }
  185. /**
  186. * Create a new SkillDat object and set the player _currentPetSkill.<br>
  187. * <br>
  188. diff --git a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
  189. index 921c087..fd4f816 100644
  190. --- a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
  191. +++ b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
  192. @@ -25,11 +25,13 @@
  193. import com.l2jfrozen.Config;
  194. import com.l2jfrozen.gameserver.ai.CtrlIntention;
  195. import com.l2jfrozen.gameserver.communitybbs.CommunityBoard;
  196. +import com.l2jfrozen.gameserver.datatables.SkillTable;
  197. import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights;
  198. import com.l2jfrozen.gameserver.handler.AdminCommandHandler;
  199. import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
  200. import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler;
  201. import com.l2jfrozen.gameserver.model.L2Object;
  202. +import com.l2jfrozen.gameserver.model.L2Skill;
  203. import com.l2jfrozen.gameserver.model.L2World;
  204. import com.l2jfrozen.gameserver.model.actor.instance.L2ClassMasterInstance;
  205. import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
  206. @@ -314,6 +316,57 @@
  207. final L2PcInstance player = getClient().getActiveChar();
  208. CustomBypassHandler.getInstance().handleBypass(player, _command);
  209. }
  210. + else if(_command.startsWith("buff")){
  211. + String x = _command.substring(4);
  212. + int id = Integer.parseInt(x);
  213. + L2PcInstance target = null;
  214. +
  215. + if(activeChar.getTarget() instanceof L2PcInstance)
  216. + target = (L2PcInstance) activeChar.getTarget();
  217. +
  218. + if(target == null)
  219. + return;
  220. +
  221. + if(activeChar.getInventory().getItemByItemId(57).getCount() < ((L2PcInstance) activeChar.getTarget()).getBuffPrize()){
  222. + activeChar.sendMessage("not enought adena");
  223. + }
  224. +
  225. +
  226. + try{
  227. + L2Skill s = SkillTable.getInstance().getInfo(id, 3);
  228. + s.getEffects(activeChar, activeChar);
  229. + activeChar.sendMessage("You buyed: "+s.getName());
  230. + activeChar.getInventory().destroyItemByItemId("", 57, target.getBuffPrize(), activeChar, null);
  231. + target.getInventory().addItem("", 57, target.getBuffPrize(), target, null);
  232. + }
  233. + catch(Exception e){
  234. + e.printStackTrace();
  235. + }
  236. + }
  237. + else if(_command.startsWith("actr")){
  238. + String l = _command.substring(5);
  239. +
  240. + int p = 0;
  241. +
  242. + p = Integer.parseInt(l);
  243. +
  244. +
  245. + if(p == 0)
  246. + return;
  247. +
  248. + if(p > 2000000000){
  249. + activeChar.sendMessage("Too big prize");
  250. + return;
  251. + }
  252. +
  253. + activeChar.setBuffPrize(p);
  254. + activeChar.sitDown();
  255. + activeChar.setSellBuff(true);
  256. + activeChar.getAppearance().setNameColor(0x1111);
  257. + activeChar.setTitle("=SELL BUFFS=");
  258. + activeChar.broadcastUserInfo();
  259. + activeChar.broadcastTitleInfo();
  260. + }
  261. else if (_command.startsWith("OlympiadArenaChange"))
  262. {
  263. Olympiad.bypassChangeArena(_command, activeChar);
  264.  
Advertisement
Comments
  • Reanimation06
    248 days
    # text 0.35 KB | 0 0
    1. tem um problema con o mod, que os buffs que sao menor a lv3 nao da, da error na console, e os buffs que sao malhores a lv3, ese so da la no lvl3, estaria bom poder corregir isso o fazer que mediante a config.java e un archivo .ini la config seleccionar a lista de buffs e os lvl que estarian permitidos, agradeceria muito esa ajuda e actualizacao do mod
    2.  
Add Comment
Please, Sign In to add comment
Advertisement