Jump to content
  • 0

[help]with scrollofclanreputation


Question

Posted

hey guys i have an error in a java code

 

here is the code:

its gracia epilogue l2j

 

package handlers.itemhandlers;

 

import com.l2jserver.Config;

import com.l2jserver.gameserver.handler.IItemHandler;

import com.l2jserver.gameserver.model.L2ItemInstance;

import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;

import com.l2jserver.gameserver.model.actor.L2Playable;

import com.l2jserver.gameserver.model.L2Clan;

 

 

 

/**

* @author Goldendawn

**/

 

public class ScrollOfClanRepPoints implements IItemHandler

{

   private static final int ITEM_IDS[] =

   {

    Config.CLAN_REP_ITEM_ID

   };

 

   public void useItem(L2Playable playable, L2ItemInstance item)

   {

 

           L2PcInstance activeChar = (L2PcInstance)playable;

 

           if (activeChar.getClan() == null)

           {

               activeChar.sendMessage("You do not have any clan!");

               return;

           }

           

           else if (activeChar.getClan().getHasUsedRepItem(true))

           {

            activeChar.sendMessage("You have already used this item!");

            return;

           }

           

           else if (!activeChar.isClanLeader())

           {

        activeChar.sendMessage("You are not clan leader!");

        return;

            }

         

       activeChar.getClan().getReputationScore(Config.CLAN_REP_ITEM_REP_SCORE,true);

       activeChar.getClan().setHasUsedRepItem(true);

       activeChar.sendMessage("Your clan's reputation score is now " +activeChar.getClan().getReputationScore()+ "");

       activeChar.broadcastUserInfo();

       playable.destroyItem("Consume", item.getObjectId(), 1, null, true);

       }

   

 

 

   public int[] getItemIds()

   {

       return ITEM_IDS;

   }

}

 

 

and here is a photo of the problem

 

problems.png

 

please help me thanks

3 answers to this question

Recommended Posts

  • 0
Posted

Just open eclipse, import your datapack to eclipse as a Java project, find this file.

 

Open it, and this line should me underlined.

 

Now just roll over it and there should be little log about whats wrong.

 

+ also some possible fixes.

 

And tell me ..what this item should do...?

  • 0
Posted

i coudnt fix it so i made a clantrader with script

 

 

import sys

from com.l2jserver.gameserver.model.quest import State

from com.l2jserver.gameserver.model.quest import QuestState

from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest

from com.l2jserver.gameserver.network.serverpackets import SystemMessage

 

qn = "9995_ReputationManager"

 

#NPC

BRICE = 9995

 

#ITEMS

EUROS = 25000

 

#HTML

 

HTMLEXPLAIN = "<html><body>Brice:<br>Wow ! You have some euros for me ? You can exchange them for Clan Reputation points. But be carefull, I'll take 30k euros, 30k for 5000 Clan Reputation Points. Do you really want to continue ?<br><a action=\"bypass -h Quest 9995_ReputationManager 1\">Yes, I need Clan Reputation points</a></body></html>"

HTMLNOLEADER = "<html><body>Brice:<br>Hey, you're not a clan leader at all. Go away from me, liar !</body></html>"

HTMLCLANLVL = "<html><body>Brice:<br>Hum, it seems your clan is not strong enough to receive my benediction. Come back when your clan level is lv5.</body></html>"

HTMLNOGOLD = "<html><body>Brice:<br>What do you want to do ? Do you want to receive my benediction for free ? Bring me back some euros, and maybe, I will trade with you.</body></html>"

HTMLOK = "<html><body>Brice:<br>Thanks to you for this present, I give you Clan Reputation Points. Please, come again if you have any euros to exchange.</body></html>"

 

    class Quest (JQuest) :

   

 

    def __init__(self,id,name,descr):

        JQuest.__init__(self,id,name,descr)

   

 

    def onEvent (self,event,st) :

      htmltext = "<html><body>I have no task right for you now.</body></html>"

      if event == "1" :

        if st.getPlayer().getClan() == None or st.getPlayer().isClanLeader() == 0 :

          # player is not in clan or is not clan leader

          htmltext = HTMLNOLEADER

          st.exitQuest(1)

          return htmltext

        else :

          if st.getPlayer().getClan().getLevel() < 5 :

            # player's clan is under lv5

            htmltext = HTMLCLANLVL

            st.exitQuest(1)

            return htmltext

          else :

            if st.getQuestItemsCount(EUROS) = 30000 :

              # player have some EUROS, the script take all of them

              st.getPlayer().sendPacket(SystemMessage(1777).addNumber( st.getQuestItemsCount(EUROS)*5000 ))

              st.getPlayer().getClan().setReputationScore( st.getPlayer().getClan().getReputationScore() + st.getQuestItemsCount(EUROS)*5000 , True)

              st.takeItems(EUROS, st.getQuestItemsCount(EUROS))

              htmltext = HTMLOK

              st.exitQuest(1)

              return htmltext

            else :

              # player haven't EUROS

              htmltext = HTMLNOGOLD

              st.exitQuest(1)

              return htmltext

      return htmltext

 

 

    def onTalk(self,npc,player) :

      st = player.getQuestState(qn)

      if not st :

        return "<html><body>I have nothing to say to you.</body></html>"

      npcId = npc.getNpcId()

      if npcId == BRICE :

        # first clic, default script text after the first in /html/default/ folder

        st.set("cond","0")

        htmltext = HTMLEXPLAIN

      return htmltext

   

 

    QUEST = Quest(9995,qn,"Reputation Manager")

 

 

    QUEST.addStartNpc(BRICE)

    QUEST.addTalkId(BRICE)

 

;)

Guest
This topic is now closed to further replies.


×
×
  • Create New...