Gladicek

Untitled

Aug 25th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.43 KB | None | 0 0
  1. /*
  2.  * This program is free software: you can redistribute it and/or modify it under
  3.  * the terms of the GNU General Public License as published by the Free Software
  4.  * Foundation, either version 3 of the License, or (at your option) any later
  5.  * version.
  6.  *
  7.  * This program is distributed in the hope that it will be useful, but WITHOUT
  8.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9.  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10.  * details.
  11.  *
  12.  * You should have received a copy of the GNU General Public License along with
  13.  * this program. If not, see <http://www.gnu.org/licenses/>.
  14.  */
  15. package custom.ClanReputation;
  16.  
  17. import com.l2jserver.gameserver.model.actor.L2Npc;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.model.quest.Quest;
  20. import com.l2jserver.gameserver.model.quest.QuestState;
  21. import com.l2jserver.gameserver.instancemanager.QuestManager;
  22. import com.l2jserver.gameserver.network.SystemMessageId;
  23. import com.l2jserver.gameserver.network.serverpackets.PledgeShowInfoUpdate;
  24. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  25.  
  26. /*********************************
  27.  * @author Gladicek              *
  28.  * Custom Npc 'Clan Reputation'  *
  29.  ********************************/
  30.  
  31. public class ClanReputation extends Quest
  32. {
  33.   // Npc
  34.     private static final int NpcId = 49299; // Custom Npc
  35.   // Item
  36.   private static final int ItemId = 6673; // Festival Adena
  37.  
  38.   public ClanReputation(int questId, String name, String descr)
  39.     {
  40.         super(questId, name, descr);
  41.         addStartNpc(NpcId);
  42.     addFirstTalkId(NpcId);
  43.     }
  44.  
  45.     @Override
  46.     public String onFirstTalk(L2Npc npc, L2PcInstance player)
  47.     {
  48.         QuestState st = player.getQuestState(getName());
  49.         if (st == null)
  50.         {
  51.             Quest q = QuestManager.getInstance().getQuest(getName());
  52.             st = q.newQuestState(player);
  53.     }  
  54.         return "49299.htm";          
  55.     }
  56.  
  57.     @Override
  58.     public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  59.     {
  60.         String htmltext = event;
  61.         final QuestState st = player.getQuestState(getName());
  62.    
  63.         if (event.equalsIgnoreCase("1000"))
  64.     {
  65.       if (st.getQuestItemsCount(ItemId) >= 10 && player.getClan() != null)
  66.             {    
  67.                 player.getClan().addReputationScore(1000, true);
  68.                 player.getClan().broadcastToOnlineMembers(new PledgeShowInfoUpdate(player.getClan()));
  69.  
  70.                 SystemMessage sm =  SystemMessage.getSystemMessage(SystemMessageId.CLAN_ADDED_S1S_POINTS_TO_REPUTATION_SCORE);
  71.                 sm.addItemNumber(1000);
  72.                 player.sendPacket(sm);
  73.         return "49299.htm";            
  74.       }
  75.       else
  76.           return "49299-no.htm";
  77.      }
  78.      
  79.     else if (event.equalsIgnoreCase("5000"))
  80.     {
  81.       if (st.getQuestItemsCount(ItemId) >= 50 && player.getClan() != null)
  82.             {    
  83.                 player.getClan().addReputationScore(5000, true);
  84.                 player.getClan().broadcastToOnlineMembers(new PledgeShowInfoUpdate(player.getClan()));
  85.  
  86.                 SystemMessage sm =  SystemMessage.getSystemMessage(SystemMessageId.CLAN_ADDED_S1S_POINTS_TO_REPUTATION_SCORE);
  87.                 sm.addItemNumber(5000);
  88.                 player.sendPacket(sm);
  89.         return "49299.htm";            
  90.       }
  91.       else
  92.           return "49299-no.htm";
  93.      }  
  94.      return htmltext;
  95.    }
  96.    
  97.     public static void main(String[] args)
  98.     {
  99.         new ClanReputation(-1, "ClanReputation", "custom");
  100.     _log.info("ClanReputation: Loaded successfully.");    
  101.     }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment