Перейти к содержанию
Авторизация  
ChrizyS

Sell Buff System

Рекомендуемые сообщения

 Good to acquire this system I wanted to know how to make the character stand up and buff instead of being static like no video.

 

VIDEO 

 

 

I'm trying to get the character to give the buff if you understand me that way in the video

 

 

Спойлер

### Eclipse Workspace Patch 1.0
#P L2jFrozen_GameServer
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestGiveNickName.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestGiveNickName.java	(revision 991)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestGiveNickName.java	(working copy)
@@ -46,54 +46,59 @@
 		L2PcInstance activeChar = getClient().getActiveChar();
 		if(activeChar == null)
 			return;
-
-		// Noblesse can bestow a title to themselves
-		if(activeChar.isNoble() && _target.matches(activeChar.getName()))
-		{
-			activeChar.setTitle(_title);
-			SystemMessage sm = new SystemMessage(SystemMessageId.TITLE_CHANGED);
-			activeChar.sendPacket(sm);
-			activeChar.broadcastTitleInfo();
-		}
-		//Can the player change/give a title?
-		else if((activeChar.getClanPrivileges() & L2Clan.CP_CL_GIVE_TITLE) == L2Clan.CP_CL_GIVE_TITLE)
-		{
-			if(activeChar.getClan().getLevel() < 3)
+		
+		// If activeChar is not selling buffs
+		if(!activeChar.isSellBuff()){
+			// Noblesse can bestow a title to themselves
+			if(activeChar.isNoble() && _target.matches(activeChar.getName()))
 			{
-				SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_LVL_3_NEEDED_TO_ENDOWE_TITLE);
+				activeChar.setTitle(_title);
+				SystemMessage sm = new SystemMessage(SystemMessageId.TITLE_CHANGED);
 				activeChar.sendPacket(sm);
-				sm = null;
-				return;
+				activeChar.broadcastTitleInfo();
 			}
-
-			L2ClanMember member1 = activeChar.getClan().getClanMember(_target);
-			if(member1 != null)
+			//Can the player change/give a title?
+			else if((activeChar.getClanPrivileges() & L2Clan.CP_CL_GIVE_TITLE) == L2Clan.CP_CL_GIVE_TITLE)
 			{
-				L2PcInstance member = member1.getPlayerInstance();
-				if(member != null)
+				if(activeChar.getClan().getLevel() < 3)
 				{
-					//is target from the same clan?
-					member.setTitle(_title);
-					SystemMessage sm = new SystemMessage(SystemMessageId.TITLE_CHANGED);
-					member.sendPacket(sm);
-					member.broadcastTitleInfo();
+					SystemMessage sm = new SystemMessage(SystemMessageId.CLAN_LVL_3_NEEDED_TO_ENDOWE_TITLE);
+					activeChar.sendPacket(sm);
 					sm = null;
+					return;
 				}
+	
+				L2ClanMember member1 = activeChar.getClan().getClanMember(_target);
+				if(member1 != null)
+				{
+					L2PcInstance member = member1.getPlayerInstance();
+					if(member != null)
+					{
+						//is target from the same clan?
+						member.setTitle(_title);
+						SystemMessage sm = new SystemMessage(SystemMessageId.TITLE_CHANGED);
+						member.sendPacket(sm);
+						member.broadcastTitleInfo();
+						sm = null;
+					}
+					else
+					{
+						SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
+						sm.addString("Target needs to be online to get a title");
+						activeChar.sendPacket(sm);
+						sm = null;
+					}
+				}
 				else
 				{
 					SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
-					sm.addString("Target needs to be online to get a title");
+					sm.addString("Target does not belong to your clan");
 					activeChar.sendPacket(sm);
 					sm = null;
 				}
 			}
-			else
-			{
-				SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
-				sm.addString("Target does not belong to your clan");
-				activeChar.sendPacket(sm);
-				sm = null;
-			}
+		}else{
+			activeChar.sendMessage("You can't change title when sell buffs");
 		}
 	}
 	
Index: head-src/com/l2jfrozen/gameserver/custom/SellBuffMsg.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/custom/SellBuffMsg.java	(revision 0)
+++ head-src/com/l2jfrozen/gameserver/custom/SellBuffMsg.java	(working copy)
@@ -0,0 +1,1007 @@
+/*
+ * This program 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.
+ * 
+ * This program 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 com.l2jfrozen.gameserver.custom;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.logging.Logger;
+
+import javolution.text.TextBuilder;
+import javolution.util.FastList;
+
+import com.l2jfrozen.Config;
+import com.l2jfrozen.gameserver.datatables.SkillTable;
+import com.l2jfrozen.gameserver.model.L2Skill;
+import com.l2jfrozen.gameserver.model.L2Skill.SkillType;
+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jfrozen.util.CloseUtil;
+import com.l2jfrozen.util.database.L2DatabaseFactory;
+
+
+/**
+ * @author Matthew Mazan
+ *
+ */
+public class SellBuffMsg
+{	
+	
+	@SuppressWarnings("unused")
+	private static Logger _log = Logger.getLogger(SellBuffMsg.class.getName());
+	
+	private int _lastPage = 0;
+	private int _subPage = 0;
+
+	public void setLastPage(int page){
+		_lastPage = page;
+	}
+	
+	public int getLastPage(){
+		return _lastPage;
+	}
+	
+	public void setSubPage(int subPage){
+		_subPage = subPage;
+	}
+	
+	public int getSubPage(){
+		return _subPage;
+	}
+	
+	/**
+	 * Construct response to buff buyer.
+	 * @param seller
+	 * @param buyer
+	 * @return
+	 */
+	private TextBuilder buyerResponse(L2PcInstance seller, L2PcInstance buyer){
+		TextBuilder tb = new TextBuilder();
+		int buffsPerPage = 8; //8 is maximum
+		int buffsCount = 0; //count all player buffs
+		int sellBuffsCount = 0; // count buffs on actual page
+		String buffFor = " player";
+		
+		if(_lastPage == 1 || _lastPage == 2){
+			if(_lastPage == 2){buffFor = " pet"; }
+			tb.append("<html><title>"+seller.getName()+"("+seller.getLevel()+") buff price for"+buffFor+": "+seller.getBuffPrice()+" adena</title><body><br>");
+			
+			FastList<L2Skill> ba = this.getBuffList(seller);
+			
+			for(L2Skill p : ba){	
+				if(Config.SELL_BUFF_SKILL_LIST.containsKey(p.getId())){
+					buffsCount++;
+					if(buffsCount > buffsPerPage * _subPage && buffsCount <= buffsPerPage * (_subPage + 1)){// show subpage with buffs.
+						//_log.info("party skill entered:"+p.getTargetType().name());
+						if(!Config.ALLOW_PARTY_BUFFS && p.getTargetType() == L2Skill.SkillTargetType.TARGET_PARTY){
+							if(buyer.getParty() != null && seller.getParty() != null && buyer.getParty().equals(seller.getParty())){ //check is in party.
+								sellBuffsCount++;
+								createHtmlSkillField(tb, _lastPage, p.getName()+" ("+p.getLevel()+")", p.getId(), buffsCount);
+							}
+						}else if(!Config.ALLOW_CLAN_BUFFS && (p.getTargetType() == L2Skill.SkillTargetType.TARGET_CLAN || p.getTargetType() == L2Skill.SkillTargetType.TARGET_ALLY)){
+							if((buyer.getClan() != null && seller.getClan() != null && buyer.getClanId() == seller.getClanId())||(buyer.getClan() != null && seller.getClan() != null && buyer.getClan().getAllyName() != null && seller.getClan().getAllyName() != null && buyer.getClan().getAllyName().equals(seller.getClan().getAllyName()))){  //check is in clan or ally.
+								sellBuffsCount++;
+								createHtmlSkillField(tb, _lastPage, p.getName()+" ("+p.getLevel()+")", p.getId(), buffsCount);
+							}
+						}else{
+							sellBuffsCount++;
+							createHtmlSkillField(tb, _lastPage, p.getName()+" ("+p.getLevel()+")", p.getId(), buffsCount);
+						}
+					}
+				}
+			}
+			
+			
+			if(sellBuffsCount > 0){
+				for(int x=(buffsCount-(_subPage*buffsPerPage)) ; x<buffsPerPage; x++){ 
+					this.createHtmlEmptySkillField(tb); 
+				}
+			}else{
+				tb.append("<center><table><tr><td width=270 align=center height="+36*buffsPerPage+"><font color=FF0000>I am sorry. I have no buffs for you now.</font></td></tr></table></center>");
+			}
+			
+			tb.append("<br>");
+			tb.append("<center><table><tr>");
+			
+			if(sellBuffsCount > 0){
+				if(buffsCount > 1*buffsPerPage){
+					this.subPageButton(tb, 0);
+					this.subPageButton(tb, 1);
+				}
+				if(buffsCount > 2*buffsPerPage){
+					this.subPageButton(tb, 2);
+				}
+				if(buffsCount > 3*buffsPerPage){
+					this.subPageButton(tb, 3);
+				}
+				if(buffsCount > 4*buffsPerPage){
+					this.subPageButton(tb, 4);
+				}
+			}
+			
+			tb.append("<td width=102>");
+			tb.append("<button value=\"Back\" action=\"bypass -h sellbuffpage0\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\">");
+			tb.append("</td></tr></table></center>");
+			
+			tb.append("</body></html>");
+		
+		}else{
+			tb.append("<html><title>"+seller.getName()+"("+seller.getLevel()+") price for 1 buff: "+seller.getBuffPrice()+" adena</title><body>");
+			
+			tb.append("<br><center>Choose buffs for:<br>");
+			tb.append("<table><tr>");
+			tb.append("<td><center><button value=\"Player\" action=\"bypass -h sellbuffpage1\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+			tb.append("<td><center><button value=\"Pet\" action=\"bypass -h sellbuffpage2\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+			tb.append("</tr></table>");
+			
+			tb.append("<br>");
+			
+			if(seller.getClassId().getId() != 96 && seller.getClassId().getId() != 14 && seller.getClassId().getId() != 104 && seller.getClassId().getId() != 28){
+				if(Config.SELL_BUFFSET_ENABLED && Config.SELL_BUFF_MIN_LVL <= seller.getLevel() && Config.SELL_BUFFSET_MIN_LVL <= seller.getLevel() && (Config.SELL_BUFFSET_WARRIOR.size() > 0 || Config.SELL_BUFFSET_MAGE.size() > 0 || Config.SELL_BUFFSET_RECHARGER.size() > 0 || Config.SELL_BUFFSET_TANKER.size() > 0)){
+					tb.append("<br><br><center>Schemes</center><br>");
+					tb.append("<table><tr>");
+					tb.append("<td><center>Player</center></td><td><center>Pet</center></td>");
+					tb.append("</tr><tr>");
+					tb.append("<td><center><button value=\"Fighter\" action=\"bypass -h zbuffset1\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+					tb.append("<td><center><button value=\"Fighter\" action=\"bypass -h zpetbuff1\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+					tb.append("</tr><tr>");
+					tb.append("<td><center><button value=\"Mage\" action=\"bypass -h zbuffset2\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+					tb.append("<td><center><button value=\"Mage\" action=\"bypass -h zpetbuff2\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+					tb.append("</tr><tr>");
+					tb.append("<td><center><button value=\"Recharger\" action=\"bypass -h zbuffset3\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+					tb.append("<td><center><button value=\"Recharger\" action=\"bypass -h zpetbuff3\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+					tb.append("</tr><tr>");
+					tb.append("<td><center><button value=\"Tank\" action=\"bypass -h zbuffset4\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+					tb.append("<td><center><button value=\"Tank\" action=\"bypass -h zpetbuff4\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\"></center></td>");
+					tb.append("</tr></table>");
+				}
+			}
+			if(seller.getBuffPrice() >= Config.SELL_BUFF_PUNISHED_PRICE){
+				tb.append("<br><br><font color=FF0000>Be careful! <br>Buff price is very high!</font>");
+			}
+			tb.append("</center></body></html>");
+		}
+		
+		
+		return tb;
+		
+	}
+	
+	/**
+	 * Send html response to buyer.
+	 * @param seller
+	 * @param buyer
+	 * @param error - if set true, return first page and send msg to buyer with error type.
+	 */
+	public void sendBuyerResponse(L2PcInstance seller, L2PcInstance buyer, boolean error){
+		
+		if(seller != null){
+			if(seller.isSellBuff() && seller != buyer){
+				TextBuilder tb = null;
+				if(!error){
+					tb = buyer.getSellBuffMsg().buyerResponse(seller, buyer); //buyer == this from l2pcinstance
+				}else{
+					this.setLastPage(0);
+					this.setSubPage(0);
+					tb = buyer.getSellBuffMsg().buyerResponse(seller, buyer);
+				}
+				NpcHtmlMessage n = new NpcHtmlMessage(0);
+				n.setHtml(tb.toString());
+				buyer.sendPacket(n);
+			}
+		}
+	}
+	
+	public void sendSellerResponse(L2PcInstance seller){
+		 TextBuilder tb = new TextBuilder(0);
+		 //create sell
+		 if(!seller.isSellBuff()){
+			 tb.append("<html><body><center>");
+			 tb.append("Hello , by completing this form<br>you will be able to sell buffs.");
+			 tb.append("<br>Players will be able,<br>targeting you to take your buff services<br>");
+			 tb.append("<br>You will be rewarded with adenas<br>for each buff a player takes.");
+			 tb.append("<br><center>Now choose the price:</center><br>");
+			 tb.append("<center><edit var=\"pri\" width=120 height=15></center><br><br>");
+			 tb.append("<center><button value=\"Confirm\" action=\"bypass -h actr $pri\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\">");
+			 tb.append("</center></body></html>");
+		 //abort sell
+		 }else{
+			 tb.append("<html><body><center>");
+			 tb.append("<br>Actual buff price: "+seller.getBuffPrice()+"<br>");
+			 tb.append("Would you abort selling buffs?<br><br>");
+			 tb.append("<center><button value=\"Abort\" action=\"bypass -h pctra\" width=100 height=23 back=\"L2UI_ch3.bigbutton_down\" fore=\"L2UI_ch3.bigbutton\">");
+			 tb.append("</center></body></html>");
+		 }
+		 NpcHtmlMessage n = new NpcHtmlMessage(0);
+		 n.setHtml(tb.toString());
+		 seller.sendPacket(n);
+		   
+	}
+	
+	private void createHtmlSkillField(TextBuilder tb, int buffPage, String skillName, int skillId, int buffRowNumber){
+		//buffPage mean buff for player = 1, or buff for pet = 2.
+		String buffType = "";
+		if(buffPage == 2){
+			buffType = "pet";
+		}
+		
+		String col1 = "";
+		String col2 = "LEVEL";
+		
+		if(buffRowNumber % 2 == 0){
+			col1 =  " bgcolor=000000";
+			col2 = "FFFFFF";
+		}
+		
+		int desc_skillId = skillId;
+		
+		// if summoners skills (exception)
+		if(skillId == 4699 || skillId == 4700){
+			skillId = 1331;
+		}
+		if(skillId == 4702 || skillId == 4703){
+			skillId = 1332;
+		}
+		
+		String tmp_skillId = ""+skillId;
+		if(skillId < 1000){
+			tmp_skillId = "0"+skillId;
+		}
+
+		
+		
+		tb.append("<table"+col1+">");
+		tb.append("<tr>");
+		tb.append("<td width=40><button action=\"bypass -h "+buffType+"buff"+ desc_skillId+"\" width=32 height=32 back=\"icon.skill"+tmp_skillId+"\" fore=\"icon.skill"+tmp_skillId+"\"></td>");
+		tb.append("<td width=240>");
+		tb.append("<table>");
+		tb.append("<tr><td width=240 align=left><font color=\""+col2+"\">"+skillName+"</td></tr>");
+		tb.append("<tr><td width=240 align=left><font color=\"ae9977\">"+this.getSkillDescription(desc_skillId)+"</font></td></tr>");
+		tb.append("</table>");
+		tb.append("</td>");
+		tb.append("</tr>");
+		tb.append("</table>");
+	}
+	
+	private void subPageButton(TextBuilder tb, int page){
+		int btnValue = page+1;
+		tb.append("<td width=34>");
+		if(_subPage == page){
+			tb.append("<button value=\""+btnValue+"\" action=\"bypass -h sellbuffpage"+_lastPage+"sub"+page+"\" width=32 height=23 back=\"L2UI_ch3.bigbutton_dow\" fore=\"L2UI_ch3.bigbutto\">"); //wrong button bg for black bg.
+		}else{
+			tb.append("<button value=\""+btnValue+"\" action=\"bypass -h sellbuffpage"+_lastPage+"sub"+page+"\" width=32 height=23 back=\"\" fore=\"\">");
+		}
+		tb.append("</td>");
+	}
+	
+	private void createHtmlEmptySkillField(TextBuilder tb){			
+		tb.append("<table>");
+		tb.append("<tr>");
+		tb.append("<td height=36></td>");
+		tb.append("</tr>");
+		tb.append("</table>");
+	}
+	
+	private String getSkillDescription(int skillId){
+		String desc = " ";
+			
+		Connection con = null;
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection(false);
+			PreparedStatement statement = con.prepareStatement("Select buffId, description from sellbuff_describe where buffId = ?");
+			statement.setInt(1, skillId);
+			ResultSet rs = statement.executeQuery();
+
+			while(rs.next())
+			{
+				desc = rs.getString("description");
+			}
+
+			rs.close();
+			statement.close();
+			statement = null;
+			rs = null;
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
+		finally
+		{
+			CloseUtil.close(con);
+			con = null;
+		}
+		return desc;
+	}
+	
+	public FastList<L2Skill> getBuffList(L2PcInstance seller){
+		L2Skill[] skills = seller.getAllSkills();
+		FastList<L2Skill> ba = new FastList<L2Skill>();
+		
+		for(L2Skill s : skills){
+			if(s == null)
+				continue;
+			// if not summoner classes and skill type == buff
+			if((seller.getClassId().getId() != 96 && seller.getClassId().getId() != 14 && seller.getClassId().getId() != 104 && seller.getClassId().getId() != 28)&&((s.getSkillType() == SkillType.BUFF || s.getSkillType() == SkillType.HEAL_PERCENT || s.getSkillType() == SkillType.COMBATPOINTHEAL) && s.isActive())){
+				if(Config.SELL_BUFF_FILTER_ENABLED){
+					if(seller.getClassId().getId() == 115 || seller.getClassId().getId() == 51){ //manual useless buffs check for dominator and overlord class 
+						if(s.getId() != 1002 && s.getId() != 1006 && s.getId() != 1007 && s.getId() != 1009){
+							ba.add(s);
+						}
+					}else if(seller.getClassId().getId() == 116 || seller.getClassId().getId() == 52){ //doomcryer and warcryer
+						if(s.getId() != 1003 && s.getId() != 1005){
+							ba.add(s);
+						}
+					}else if(seller.getClassId().getId() == 97 || seller.getClassId().getId() == 16){ //cardinal and bishop
+						if(s.getId() == 1353 || s.getId() == 1307 || s.getId() == 1311){
+							ba.add(s);
+						}
+					}else{
+						ba.add(s);
+					}
+				}else{
+					ba.add(s);
+				}
+			}else{
+				L2Skill skill = null;
+				if(s.getId() == 1332){
+					skill = SkillTable.getInstance().getInfo(4702, getSkillLevel(seller, 1332));
+					ba.add(skill);
+					skill = SkillTable.getInstance().getInfo(4703, getSkillLevel(seller, 1332));
+					ba.add(skill);
+				}
+				if(s.getId() == 1331){
+					skill = SkillTable.getInstance().getInfo(4699, getSkillLevel(seller, 1331));
+					ba.add(skill);
+					skill = SkillTable.getInstance().getInfo(4700, getSkillLevel(seller, 1331));
+					ba.add(skill);				
+				}
+			}
+		}
+		return ba;
+	}
+	
+	public FastList<L2Skill> getBuffsetList(L2PcInstance seller, FastList<String> buffset){
+		
+		L2Skill[] skills = seller.getAllSkills();
+		FastList<L2Skill> ba = new FastList<L2Skill>();
+		
+		for(L2Skill s : skills){
+			if(s == null)
+				continue;
+			
+			if(buffset.contains(Integer.toString(s.getId()))){
+				// if not summoner classes and skill type == buff
+				if((seller.getClassId().getId() != 96 && seller.getClassId().getId() != 14 && seller.getClassId().getId() != 104 && seller.getClassId().getId() != 28)&&((s.getSkillType() == SkillType.BUFF || s.getSkillType() == SkillType.HEAL_PERCENT || s.getSkillType() == SkillType.COMBATPOINTHEAL) && s.isActive())){
+					if(Config.SELL_BUFF_FILTER_ENABLED){
+						if(seller.getClassId().getId() == 115 || seller.getClassId().getId() == 51){ //manual useless buffs check for dominator and overlord class 
+							if(s.getId() != 1002 && s.getId() != 1006 && s.getId() != 1007 && s.getId() != 1009){
+								ba.add(s);
+							}
+						}else if(seller.getClassId().getId() == 116 || seller.getClassId().getId() == 52){ //doomcryer and warcryer
+							if(s.getId() != 1003 && s.getId() != 1005){
+								ba.add(s);
+							}
+						}else if(seller.getClassId().getId() == 97 || seller.getClassId().getId() == 16){ //cardinal and bishop
+							if(s.getId() == 1353 || s.getId() == 1307 || s.getId() == 1311){
+								ba.add(s);
+							}
+						}else{
+							ba.add(s);
+						}
+					}else{
+						ba.add(s);
+					}
+				}else{
+					if(s.getId() == 4699){
+						ba.add(s);
+					}
+					if(s.getId() == 4700){
+						ba.add(s);				
+					}
+					if(s.getId() == 4702){
+						ba.add(s);
+					}
+					if(s.getId() == 4703){
+						ba.add(s);
+					}
+				}
+			}
+		}
+		return ba;
+	}
+	
+	public void setPage(L2PcInstance seller, L2PcInstance buyer, int page, int subPage){
+		if(page == 1){
+			buyer.getSellBuffMsg().setLastPage(1);
+			buyer.getSellBuffMsg().setSubPage(subPage);
+		}else if(page == 2){
+			buyer.getSellBuffMsg().setLastPage(2);
+			buyer.getSellBuffMsg().setSubPage(subPage);
+		}else{
+			buyer.getSellBuffMsg().setLastPage(0);
+			buyer.getSellBuffMsg().setSubPage(0);
+		}
+		buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, false);	
+	}
+	
+	public void buffBuyer(L2PcInstance seller, L2PcInstance buyer, int buffId){
+		if(buyer.getDistanceSq(seller) > 5000){
+			buyer.sendMessage("You must be closer the buffer!");
+			//buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+			buyer.setTarget(null);
+		}else if(!seller.isSellBuff()){
+			buyer.sendMessage("You cant buy buffs now!");
+			return;
+		}else if(!this.enoughSpiritOreForBuff(seller, buffId)){
+			if(!seller.isOffline()){
+				seller.sendMessage("You can't sell buff, you haven't Spirit Ore for use skill!");
+			}
+			buyer.sendMessage("You can't buff now. Buff seller has no item for use skill!");
+			buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, false); 
+		}else{
+			int buffprice = seller.getBuffPrice();
+			
+			if(buyer.getInventory().getItemByItemId(57) == null || buyer.getInventory().getItemByItemId(57).getCount() < buffprice){
+				buyer.sendMessage("Not enought adena!");
+			}else{
+				try{
+					//get buff data
+					L2Skill skill = SkillTable.getInstance().getInfo(buffId, getSkillLevel(seller, buffId));
+					
+					//single skill mp consume
+					if(Config.SELL_BUFF_SKILL_MP_ENABLED){
+						if(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER >= (skill.getMpConsume()+1)){
+							seller.setCurrentMp(Math.round(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER - skill.getMpConsume())/Config.SELL_BUFF_SKILL_MP_MULTIPLIER);
+						}else{
+							buyer.sendMessage("Buffer has no Mana Points ("+Math.round(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER)+" / "+Math.round(seller.getMaxMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER)+")");
+							buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, false);
+							return;
+						}
+					}
+					//add adena for seller
+					seller.addItem("buff sell", 57, buffprice, seller, true);
+					
+					//remove adena from buyer
+					buyer.destroyItemByItemId("buff sell", 57, buffprice, buyer, false);
+					
+					//destroy Spirit Ore:
+					destroySpiritOre(seller, buffId);
+					
+					//give buffs for buyer
+					skill.getEffects(buyer, buyer);
+
+					buyer.sendMessage("You buyed: "+skill.getName()+" for "+seller.getBuffPrice()+" adena.");	
+					buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, false);
+
+				}catch(Exception e){
+						e.printStackTrace();
+						buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+				}
+			}
+		}
+	}
+
+	public void buffBuyerPet(L2PcInstance seller, L2PcInstance buyer, int buffId){
+		//checking pet/summon if error return to first page;
+		if(buyer.getPet() == null || buyer.getPet().isDead()){
+			//buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+			buyer.sendMessage("You must summon your pet first!");
+			buyer.setTarget(null);
+		}else if(buyer.getDistanceSq(seller) > 10000){
+			//buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+			buyer.sendMessage("Your pet must be closer the buffer!");	
+			buyer.setTarget(null);
+		}else if(!seller.isSellBuff()){
+			buyer.sendMessage("You cant buy buffs now!");
+			return;
+		}else if(!this.enoughSpiritOreForBuff(seller, buffId)){
+			if(!seller.isOffline()){
+				seller.sendMessage("You can't sell buff, you haven't Spirit Ore for use skill!");
+			}
+			buyer.sendMessage("You can't buff now. Buff seller has no item for use skill!");
+			buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, false); 
+		}else{
+			int buffprice = seller.getBuffPrice();
+			
+			if(buyer.getInventory().getItemByItemId(57) == null || buyer.getInventory().getItemByItemId(57).getCount() < buffprice){
+				buyer.sendMessage("Not enought adena!");
+			}else{
+				
+				try{
+					//get buff data
+					L2Skill skill = SkillTable.getInstance().getInfo(buffId, getSkillLevel(seller, buffId));
+					
+					// single skill mp consume
+					if(Config.SELL_BUFF_SKILL_MP_ENABLED){
+						if(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER >= (skill.getMpConsume()+1)){
+							seller.setCurrentMp(Math.round(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER - skill.getMpConsume())/Config.SELL_BUFF_SKILL_MP_MULTIPLIER);
+						}else{
+							buyer.sendMessage("Buffer has no Mana Points ("+Math.round(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER)+" / "+Math.round(seller.getMaxMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER)+")");
+							buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+							return;
+						}
+					}
+					
+					//buff seller
+					seller.addItem("buff sell", 57, buffprice, seller, true);
+					
+					//buff buyer
+					buyer.destroyItemByItemId("buff sell", 57, buffprice, buyer, false);
+	
+					//destroy Spirit Ore:
+					destroySpiritOre(seller, buffId);
+	
+					//give buffs for pet
+					skill.getEffects(buyer.getPet(), buyer.getPet());
+						
+						
+					buyer.sendMessage("You buyed: "+skill.getName()+" for "+seller.getBuffPrice()+" adena, for your pet.");	
+					buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, false);
+	
+				
+					
+				}catch(Exception e){
+						e.printStackTrace();
+						buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+				}
+			}
+		}
+	}
+	
+	public void buffsetBuyer(L2PcInstance seller, L2PcInstance buyer, int setId){	
+		String buffSetName = " ";
+		FastList<L2Skill> ba = new FastList<L2Skill>();
+		//----------------------------------------------------------------------------------------------
+		if(setId == 1){
+			ba = seller.getSellBuffMsg().getBuffsetList(seller, Config.SELL_BUFFSET_WARRIOR);
+			buffSetName = " Warrior ";
+		}else if(setId == 2){
+			ba = seller.getSellBuffMsg().getBuffsetList(seller, Config.SELL_BUFFSET_MAGE);
+			buffSetName = " Mage ";
+		}else if(setId == 3){
+			ba = seller.getSellBuffMsg().getBuffsetList(seller, Config.SELL_BUFFSET_RECHARGER);
+			buffSetName = " Recharger ";
+		}else if(setId == 4){
+			ba = seller.getSellBuffMsg().getBuffsetList(seller, Config.SELL_BUFFSET_TANKER);
+			buffSetName = " Tanker ";
+		}
+	
+		int buffsetSize = ba.size();
+	
+		if(buyer.getDistanceSq(seller) > 5000){
+			buyer.sendMessage("You must be closer the buffer!");
+			//buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+			buyer.setTarget(null);
+		}else if(!seller.isSellBuff()){
+			buyer.sendMessage("You cant buy buffs now!");
+			return;
+		}else{
+			int buffprice = seller.getBuffPrice();
+			if(seller.getBuffPrice() == 0){
+				buyer.sendMessage("This buffset is empty!");
+				buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+			}else if(buyer.getInventory().getItemByItemId(57) == null || buyer.getInventory().getItemByItemId(57).getCount() < buffprice*buffsetSize){
+				buyer.sendMessage("Not enought adena!");
+			}else{
+				try{
+					boolean mpOK = true;
+					boolean soOK = true;
+					int mpConsumeSum = 0;
+					int soConsumeSum = 0; //Spirit Ore sum.
+					
+					if(Config.SELL_BUFF_SKILL_MP_ENABLED || Config.SELL_BUFF_SKILL_ITEM_CONSUME_ENABLED){
+						// calculate all skills set mana use:
+						for(L2Skill p : ba){
+							L2Skill skill = SkillTable.getInstance().getInfo(p.getId(), getSkillLevel(seller, p.getId()));
+							if(Config.SELL_BUFF_SKILL_MP_ENABLED){
+								mpConsumeSum += skill.getMpConsume();
+							}
+							if(Config.SELL_BUFF_SKILL_ITEM_CONSUME_ENABLED){
+								soConsumeSum += getSkillConsumeSOCount(p.getId(), p.getLevel());
+							}
+						}
+						// set ok == false if buffset mp cost greater than seller current mp.
+						if(mpConsumeSum > 0 && (mpConsumeSum + 1) > seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER){
+							mpOK = false;
+						}	
+						// set ok == false if buffset require more SO count than count SO in inventory.
+						if(soConsumeSum > 0 && (seller.getInventory().getItemByItemId(3031) == null || soConsumeSum > seller.getInventory().getItemByItemId(3031).getCount())){
+							soOK = false;
+						}	
+					}
+
+					if(mpOK && soOK){
+						for(L2Skill p : ba){
+							L2Skill skill = SkillTable.getInstance().getInfo(p.getId(), getSkillLevel(seller, p.getId()));
+							
+							//give buffs
+							skill.getEffects(buyer, buyer);
+		
+							//destroy Spirit Ore:
+							destroySpiritOre(seller, skill.getId());
+							
+							buyer.sendMessage("You buyed: "+skill.getName());	
+							buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, false);
+							if(Config.SELL_BUFF_SKILL_MP_ENABLED){
+								seller.setCurrentMp(Math.round(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER - skill.getMpConsume())/Config.SELL_BUFF_SKILL_MP_MULTIPLIER);
+							}
+						}
+					
+						//buff seller
+						seller.addItem("buff sell", 57, buffprice*buffsetSize, seller, true);
+						
+						//buff buyer
+						buyer.destroyItemByItemId("buff sell", 57, buffprice*buffsetSize, buyer, false);
+						
+						buyer.sendMessage("You bought"+buffSetName+"buffs for: "+buffprice*buffsetSize+" adena.");
+					}else{
+						if(!mpOK){
+							buyer.sendMessage("Buffer has no Mana Points for this set ("+Math.round(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER)+" / "+Math.round(seller.getMaxMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER)+")");
+						}
+						if(!soOK){
+							buyer.sendMessage("You can't buff now. Buff seller has no item for use skill!");
+							seller.sendMessage("You can't sell buff, you haven't Spirit Ore for use skill!");
+						}
+						buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+					}
+				}catch(Exception e){
+						e.printStackTrace();
+						buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+				}
+			}
+		}
+	}
+	
+	public void buffsetBuyerPet(L2PcInstance seller, L2PcInstance buyer, int setId){			
+		String buffSetName = " ";
+		FastList<L2Skill> ba = new FastList<L2Skill>();
+		//----------------------------------------------------------------------------------------------
+		if(setId == 1){
+			ba = seller.getSellBuffMsg().getBuffsetList(seller, Config.SELL_BUFFSET_WARRIOR);
+			buffSetName = " Warrior ";
+		}else if(setId == 2){
+			ba = seller.getSellBuffMsg().getBuffsetList(seller, Config.SELL_BUFFSET_MAGE);
+			buffSetName = " Mage ";
+		}else if(setId == 3){
+			ba = seller.getSellBuffMsg().getBuffsetList(seller, Config.SELL_BUFFSET_RECHARGER);
+			buffSetName = " Recharger ";
+		}else if(setId == 4){
+			ba = seller.getSellBuffMsg().getBuffsetList(seller, Config.SELL_BUFFSET_TANKER);
+			buffSetName = " Tanker ";
+		}
+	
+		int buffsetSize = ba.size();
+	
+		//checking pet/summon if error return to first page;
+		if(buyer.getPet() == null || buyer.getPet().isDead()){
+			buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+			buyer.sendMessage("You must summon your pet first!");
+		}else if(buyer.getDistanceSq(seller) > 10000){
+			//buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+			buyer.sendMessage("Your pet must be closer the buffer!");	
+			buyer.setTarget(null);
+		}else if(!seller.isSellBuff()){
+			buyer.sendMessage("You cant buy buffs now!");
+			return;
+		}else{
+			int buffprice = seller.getBuffPrice();
+			if(seller.getBuffPrice() == 0){
+				buyer.sendMessage("This buffset is empty!");
+				buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+			}else if(buyer.getInventory().getItemByItemId(57) == null || buyer.getInventory().getItemByItemId(57).getCount() < buffprice){
+				buyer.sendMessage("Not enought adena!");
+			}else{
+				
+				try{
+					boolean mpOK = true;
+					boolean soOK = true;
+					int mpConsumeSum = 0;
+					int soConsumeSum = 0; //Spirit Ore sum.
+					
+					if(Config.SELL_BUFF_SKILL_MP_ENABLED || Config.SELL_BUFF_SKILL_ITEM_CONSUME_ENABLED){
+						// calculate all skills set mana use:
+						for(L2Skill p : ba){
+							L2Skill skill = SkillTable.getInstance().getInfo(p.getId(), getSkillLevel(seller, p.getId()));
+							if(Config.SELL_BUFF_SKILL_MP_ENABLED){
+								mpConsumeSum += skill.getMpConsume();
+							}
+							if(Config.SELL_BUFF_SKILL_ITEM_CONSUME_ENABLED){
+								soConsumeSum += getSkillConsumeSOCount(p.getId(), p.getLevel());
+							}
+						}
+						// set ok == false if buffset mp cost greater than seller current mp.
+						if(mpConsumeSum > 0 && (mpConsumeSum + 1) > seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER){
+							mpOK = false;
+						}	
+						// set ok == false if buffset require more SO count than count SO in inventory.
+						if(soConsumeSum > 0 && (seller.getInventory().getItemByItemId(3031) == null || soConsumeSum > seller.getInventory().getItemByItemId(3031).getCount())){
+							soOK = false;
+						}	
+					}
+
+					if(mpOK && soOK){
+						for(L2Skill p : ba){
+							L2Skill skill = SkillTable.getInstance().getInfo(p.getId(), getSkillLevel(seller, p.getId()));
+							
+							//give buffs
+							skill.getEffects(buyer.getPet(), buyer.getPet());
+		
+							//destroy Spirit Ore:
+							destroySpiritOre(seller, skill.getId());
+							
+							buyer.sendMessage("You buyed: "+skill.getName());	
+							buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, false);
+							if(Config.SELL_BUFF_SKILL_MP_ENABLED){
+								seller.setCurrentMp(Math.round(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER - skill.getMpConsume())/Config.SELL_BUFF_SKILL_MP_MULTIPLIER);
+							}
+						}
+					
+						//buff seller
+						seller.addItem("buff sell", 57, buffprice*buffsetSize, seller, true);
+						
+						//buff buyer
+						buyer.destroyItemByItemId("buff sell", 57, buffprice*buffsetSize, buyer, false);
+						
+						buyer.sendMessage("You bought"+buffSetName+"buffs for: "+buffprice*buffsetSize+" adena.");
+					}else{
+						if(!mpOK){
+							buyer.sendMessage("Buffer has no Mana Points for this set ("+Math.round(seller.getCurrentMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER)+" / "+Math.round(seller.getMaxMp()*Config.SELL_BUFF_SKILL_MP_MULTIPLIER)+")");
+						}
+						if(!soOK){
+							buyer.sendMessage("You can't buff now. Buff seller has no item for use skill!");
+							seller.sendMessage("You can't sell buff, you haven't Spirit Ore for use skill!");
+						}
+						buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+					}
+				}catch(Exception e){
+						e.printStackTrace();
+						buyer.getSellBuffMsg().sendBuyerResponse(seller, buyer, true);
+				}
+			}
+		}
+	}
+	
+	public void startBuffStore(L2PcInstance seller, int price, boolean saveSellerData){
+		if(price <= 0){
+			seller.sendMessage("Too low price. Min is 1 adena.");
+			return;
+		}
+						
+		if(price > 2000000000){
+			seller.sendMessage("Too big price. Max is 2 000 000 000 adena.");
+			return;
+		}
+		
+		if(saveSellerData){
+			saveSellerData(seller);
+		}
+		
+		seller.setBuffPrice(price);
+		seller.sitDown();
+		seller.setSellBuff(true);
+		
+		if(seller.getClassId().getId() < 90){ //if 2nd profession or lower.
+			seller.getAppearance().setTitleColor(0xFFDD); //dark green (yellow now)
+		}else{
+			seller.getAppearance().setTitleColor(0xFF00); //light green
+		}
+		seller.setTitle(getClassName(seller.getClassId().getId())); //set title like class name
+		seller.getAppearance().setNameColor(0x1111);				   
+		seller.broadcastUserInfo();
+		seller.broadcastTitleInfo();
+	    
+	}
+	
+	public void stopBuffStore(L2PcInstance seller){
+
+		restoreSellerData(seller);
+		
+		seller.broadcastUserInfo();
+		seller.broadcastTitleInfo();
+		
+		seller.setSellBuff(false);
+		seller.standUp();
+		
+	}
+	
+	private void saveSellerData(L2PcInstance seller){
+		Connection con = null;	
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection(false);
+			PreparedStatement statement;
+			statement = con.prepareStatement("CALL sellbuff_saveSellerData(?,?,?,?)");
+			statement.setInt(1, seller.getObjectId());
+			statement.setString(2, seller.getTitle());
+			statement.setInt(3, seller.getAppearance().getTitleColor());
+			statement.setInt(4, seller.getAppearance().getNameColor());
+			statement.execute();
+			statement.close();
+			statement = null;
+		}
+		catch(Exception e)
+		{
+			if(Config.ENABLE_ALL_EXCEPTIONS)
+				e.printStackTrace();
+		}
+		finally
+		{
+			CloseUtil.close(con);
+			con = null;
+		}
+	}
+	
+	public void restoreSellerData(L2PcInstance seller){
+		//int defaultNickColor = 16777215; // white
+		//int defaultTitleColor = 16777079; // light blue
+		
+		Connection con = null;	
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection(false);
+			PreparedStatement statement;
+			statement = con.prepareStatement("CALL sellbuff_restoreSellerData(?)");
+			statement.setInt(1, seller.getObjectId());
+			
+			ResultSet res = statement.executeQuery();
+
+			while(res.next())
+			{
+				seller.setTitle(res.getString("lastTitle"));
+				seller.getAppearance().setTitleColor(Integer.parseInt(res.getString("lastTitleColor")));
+				seller.getAppearance().setNameColor(Integer.parseInt(res.getString("lastNameColor")));
+			}
+			res.close();
+			res = null;
+			statement.close();
+			statement = null;
+		}
+		catch(Exception e)
+		{
+			if(Config.ENABLE_ALL_EXCEPTIONS)
+				e.printStackTrace();
+		}
+		finally
+		{
+			CloseUtil.close(con);
+			con = null;
+		}
+	}
+
+	/**
+	 * Returns skill consume count (Spirit Ore count).
+	 * @param skillId
+	 * @param skillLvl
+	 * @return
+	 */
+	private int getSkillConsumeSOCount(int skillId, int skillLvl){
+		// Buffs what consume items like Spirit Ore
+		// {skillId, skillLvl, itemConsumeId, itemConsumeCount}
+		int[][] skillsData = {
+			{1388,1,3031,1},
+			{1388,2,3031,2},
+			{1388,3,3031,3},
+			{1389,1,3031,1},
+			{1389,2,3031,2},
+			{1389,3,3031,3},
+			{1356,1,3031,10},
+			{1397,1,3031,1},
+			{1397,2,3031,2},
+			{1397,3,3031,3},
+			{1355,1,3031,10},
+			{1357,1,3031,10},
+			{1416,1,3031,20},
+			{1414,1,3031,40},
+			{1391,1,3031,4},
+			{1391,2,3031,8},
+			{1391,3,3031,12},
+			{1390,1,3031,4},
+			{1390,2,3031,8},
+			{1390,3,3031,12},
+			{1363,1,3031,40},
+			{1413,1,3031,40},
+			{1323,1,3031,5}
+		};
+		
+		for(int i=0 ; i<skillsData.length ; i++){
+			if(skillsData[i][0] == skillId && skillsData[i][1] == skillLvl){
+				return skillsData[i][3];
+			}
+		}
+		return 0;
+	}
+	
+	private boolean enoughSpiritOreForBuff(L2PcInstance seller, int skillId){
+		if(Config.SELL_BUFF_SKILL_ITEM_CONSUME_ENABLED){
+			if(getSkillConsumeSOCount(skillId, seller.getSkillLevel(skillId)) > 0){
+				// 3031 == Spirit Ore ID
+				if(seller.getInventory().getItemByItemId(3031) == null || seller.getInventory().getItemByItemId(3031).getCount() < getSkillConsumeSOCount(skillId, seller.getSkillLevel(skillId))){
+					return false;
+				}
+			}
+		}
+		return true;
+	}
+	
+	private void destroySpiritOre(L2PcInstance seller, int skillId){	
+		if(Config.SELL_BUFF_SKILL_ITEM_CONSUME_ENABLED){
+			if(seller.getInventory().getItemByItemId(3031) != null && seller.getInventory().getItemByItemId(3031).getCount() >= getSkillConsumeSOCount(skillId, seller.getSkillLevel(skillId))){
+				seller.destroyItemByItemId("buff sell", 3031, getSkillConsumeSOCount(skillId, seller.getSkillLevel(skillId)), seller, false);
+			}
+		}
+	}
+	
+	private String getClassName(int classId){
+		switch (classId) { 
+			case 14:  return "Warlock";
+			case 96:  return "ArcanaLord";
+			case 16:  return "Bishop";
+			case 97:  return "Cardinal";
+			case 17:  return "Prophet";
+			case 98:  return "Hierophant";
+			case 21:  return "SwordSinger";
+			case 100: return "SwordMuse";
+			case 28:  return "Elem.Summoner";
+			case 104: return "Elem.Master";
+			case 29:  return "Oracle";
+			case 30:  return "Elder";
+			case 105: return "EvaSaint";
+			case 34:  return "BladeDancer";
+			case 107: return "SpectralDancer";
+			case 42:  return "ShilenOracle";
+			case 43:  return "ShilenElder";
+			case 112: return "ShilenSaint";
+			case 50:  return "Shaman";
+			case 51:  return "Overlord";
+			case 115: return "Dominator";
+			case 52:  return "Warcryer";
+			case 116: return "Doomcryer";
+
+			default:  return "Buff Sell";
+		 }
+	}
+	
+	/**
+	 * Special summoners skill level or normal skill level.
+	 * @param seller
+	 * @param skillId
+	 * @return
+	 */
+	private int getSkillLevel(L2PcInstance seller, int skillId){
+	
+		if(seller.getClassId().getId() != 96 && seller.getClassId().getId() != 14 && seller.getClassId().getId() != 104 && seller.getClassId().getId() != 28){
+			return seller.getSkillLevel(skillId);
+		}
+		
+		// summon lvl != summon buff lvl, example: feline queen skill lvl != feline queen buff lvl.
+		// skill levels by current db: min: 5, max: 8.
+		if(seller.getLevel() >= 56 && seller.getLevel() <= 57){
+			return 5;
+		}
+		if(seller.getLevel() >= 58 && seller.getLevel() <= 67){
+			return 6;
+		}
+		if(seller.getLevel() >= 68 && seller.getLevel() <= 73){
+			return 7;
+		}
+		if(seller.getLevel() >= 74){
+			return 8;
+		}
+		return 1; 
+	}
+	
+}
Index: head-src/com/l2jfrozen/Config.java
===================================================================
--- head-src/com/l2jfrozen/Config.java	(revision 991)
+++ head-src/com/l2jfrozen/Config.java	(working copy)
@@ -616,7 +616,28 @@
 	public static int FS_PARTY_MEMBER_COUNT;
 	public static boolean ALLOW_QUAKE_SYSTEM;
 	public static boolean ENABLE_ANTI_PVP_FARM_MSG;
-	
+	public static boolean SELL_BUFF_ENABLED;
+	public static FastList<String> SELL_BUFF_CLASS_LIST = new FastList<String>();
+	public static FastMap<Integer, Integer> SELL_BUFF_SKILL_LIST;
+	public static boolean ALLOW_PARTY_BUFFS;
+	public static boolean ALLOW_CLAN_BUFFS;
+	public static int SELL_BUFF_PUNISHED_PRICE;
+	public static boolean SELL_BUFF_FILTER_ENABLED;
+	 	
+	public static int SELL_BUFF_MIN_LVL;
+		
+	public static boolean SELL_BUFFSET_ENABLED;
+	public static int SELL_BUFFSET_MIN_LVL;
+	public static FastList<String> SELL_BUFFSET_WARRIOR = new FastList<String>();
+	public static FastList<String> SELL_BUFFSET_MAGE = new FastList<String>();
+	public static FastList<String> SELL_BUFFSET_RECHARGER = new FastList<String>();
+	public static FastList<String> SELL_BUFFSET_TANKER = new FastList<String>();
+		
+	public static boolean OFFLINE_SELLBUFF_ENABLED;
+	public static boolean SELL_BUFF_SKILL_MP_ENABLED;
+	public static double SELL_BUFF_SKILL_MP_MULTIPLIER;
+	public static boolean SELL_BUFF_SKILL_ITEM_CONSUME_ENABLED;
+	public static FastList<String> SELL_BUFF_RESTRICTED_ZONES_IDS = new FastList<String>();
 	public static long CLICK_TASK;
 	
 	//============================================================
@@ -668,6 +689,103 @@
 			RAID_MIN_RESPAWN_MULTIPLIER = Float.parseFloat(otherSettings.getProperty("RaidMinRespawnMultiplier", "1.0"));
 			RAID_MAX_RESPAWN_MULTIPLIER = Float.parseFloat(otherSettings.getProperty("RaidMaxRespawnMultiplier", "1.0"));
         	ENABLE_AIO_SYSTEM = Boolean.parseBoolean(otherSettings.getProperty("EnableAioSystem", "True"));
+        	SELL_BUFF_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("SellBuffEnabled", "True"));
+        				if(SELL_BUFF_ENABLED) //create map if system is enabled
+        	        	{
+        	        		SELL_BUFF_SKILL_LIST = new FastMap<Integer, Integer>();
+        	
+        					String[] propertySplit;
+        					propertySplit = otherSettings.getProperty("SellBuffSkillList", "").split(";");
+        	
+        					for(String skill : propertySplit)
+        					{
+        						String[] skillSplit = skill.split(",");
+        						if(skillSplit.length != 2)
+        						{
+        							System.out.println("[SellBuffSkillList]: invalid config property -> SellBuffSkillList \"" + skill + "\"");
+        						}
+        						else
+        						{
+        							try
+        							{
+        								SELL_BUFF_SKILL_LIST.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
+        							}
+        							catch(NumberFormatException nfe)
+        							{
+        								if(Config.ENABLE_ALL_EXCEPTIONS)
+        									nfe.printStackTrace();
+        								
+        								if(!skill.equals(""))
+        								{
+        									System.out.println("[SellBuffSkillList]: invalid config property -> SellBuffSkillList \"" + skillSplit[0] + "\"" + skillSplit[1]);
+        								}
+        							}
+        						}
+        					}
+        	        	}
+        	        	if(SELL_BUFF_ENABLED) //create map if system is enabled
+        	        	{
+        	        		String SELL_BUFF_CLASS_STRING = otherSettings.getProperty("SellBuffClassList");
+        	        		int i=0;
+        	        		for(String classId : SELL_BUFF_CLASS_STRING.split(",")){
+        	        			SELL_BUFF_CLASS_LIST.add(i,classId);
+        	        			i++;
+        	        		}
+        	        	}
+        	        	ALLOW_PARTY_BUFFS = Boolean.parseBoolean(otherSettings.getProperty("AllowPartyBuffs", "True"));
+        	        	ALLOW_CLAN_BUFFS = Boolean.parseBoolean(otherSettings.getProperty("AllowClanBuffs", "True"));
+        	        	SELL_BUFF_PUNISHED_PRICE = Integer.parseInt(otherSettings.getProperty("SellBuffPunishedPrice", "10000"));
+        	        	SELL_BUFF_FILTER_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("SellBuffFilterEnabled", "True"));
+        	        	
+        	        	SELL_BUFF_MIN_LVL = Integer.parseInt(otherSettings.getProperty("SellBuffMinLvl", "20"));
+        	        	SELL_BUFFSET_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("SellBuffsetEnabled", "True"));
+        	        	
+        	        	SELL_BUFFSET_MIN_LVL = Integer.parseInt(otherSettings.getProperty("SellBuffSetMinLvl", "79"));
+        	        	
+        	        	if(SELL_BUFFSET_ENABLED) //create map if system is enabled
+        	        	{
+        	        		String tempStr = "";
+        	        		int i = 0;
+        	        		
+        	        		tempStr = otherSettings.getProperty("SellBuffsetWarrior");
+        	        		i=0;
+        	        		for(String skillId : tempStr.split(",")){
+        	        			SELL_BUFFSET_WARRIOR.add(i,skillId);
+        	        			i++;
+        	        		}
+        	        		tempStr = otherSettings.getProperty("SellBuffsetMage");
+        	        		i=0;
+        	        		for(String skillId : tempStr.split(",")){
+        	        			SELL_BUFFSET_MAGE.add(i,skillId);
+        	        			i++;
+        	        		}
+        	        		tempStr = otherSettings.getProperty("SellBuffsetRecharger");
+        	        		i=0;
+        	        		for(String skillId : tempStr.split(",")){
+        	        			SELL_BUFFSET_RECHARGER.add(i,skillId);
+        	        			i++;
+        	        		}
+        	        		tempStr = otherSettings.getProperty("SellBuffsetTanker");
+        	        		i=0;
+        	        		for(String skillId : tempStr.split(",")){
+        	        			SELL_BUFFSET_TANKER.add(i,skillId);
+        	        			i++;
+        	        		}	
+        	        	}
+        	        	OFFLINE_SELLBUFF_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("OfflineSellbuffEnabled", "True"));
+        	        	SELL_BUFF_SKILL_MP_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("SellBuffSkillMpEnabled", "False"));
+        	        	SELL_BUFF_SKILL_MP_MULTIPLIER = Double.parseDouble(otherSettings.getProperty("SellBuffSkillMpMultiplier", "1."));
+        	        	SELL_BUFF_SKILL_ITEM_CONSUME_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("SellBuffSkillItemConsumeEnabled", "True"));
+        	        	//RESTRICTED ZONES IDS:
+        	    		int i = 0;
+        	    		String tempStr = otherSettings.getProperty("SellBuffRestrictedZonesIds");
+        	    		if(tempStr != null && tempStr.length() > 0){
+        		    		for(String rZoneId : tempStr.split(",")){
+        		    			SELL_BUFF_RESTRICTED_ZONES_IDS.add(i,rZoneId);
+        		    			i++;
+        		    		}
+        	    		}
+        	        	
         	ALLOW_AIO_NCOLOR = Boolean.parseBoolean(otherSettings.getProperty("AllowAioNameColor", "True"));
         	AIO_NCOLOR = Integer.decode("0x" + otherSettings.getProperty("AioNameColor", "88AA88"));
         	ALLOW_AIO_TCOLOR = Boolean.parseBoolean(otherSettings.getProperty("AllowAioTitleColor", "True"));
Index: head-src/com/l2jfrozen/gameserver/Shutdown.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/Shutdown.java	(revision 991)
+++ head-src/com/l2jfrozen/gameserver/Shutdown.java	(working copy)
@@ -610,7 +610,7 @@
 
 		try
         {
-           if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
+           if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE || Config.OFFLINE_SELLBUFF_ENABLED) && Config.RESTORE_OFFLINERS)
               OfflineTradeTable.storeOffliners();
         }
         catch (Throwable t)
Index: config/head/other.properties
===================================================================
--- config/head/other.properties	(revision 991)
+++ config/head/other.properties	(working copy)
@@ -238,4 +238,136 @@
 ClickTask = 50
 
 # Crit announce
-GMShowCritAnnouncerName = False
\ No newline at end of file
+GMShowCritAnnouncerName = False
+
+# -----------------------------------------
+#  Sell Buff System                       -
+# -----------------------------------------
+# Describe: 
+# System allow sell buffs by players who's classes are declared in SellBuffClassList.
+# 
+
+# Enable / Disable Sell Buff System
+SellBuffEnabled = true
+
+# Allow offline buff sell.
+OfflineSellbuffEnabled = True
+
+# Enable skill mp use.
+SellBuffSkillMpEnabled = False
+
+# Multiplier skill mp consume. 
+# If character have 2000 mp, and multiplier = 100.0, sell buff mp = 200 000.
+SellBuffSkillMpMultiplier = 1.0
+
+# Enable specific skill item consume. Example: Skill Chant of Victory using Spirit Ore.
+SellBuffSkillItemConsumeEnabled = True
+
+# Choose allowed classes.
+# Format : classid,classid,classid,classid, ... classid,classid
+SellBuffClassList = 15,16,97,17,98,29,30,105,42,43,112,50,116,51,115,100,21,107,34
+
+# Allowed skillsId, and duration of this skills list:
+# Format : skillid,duration;skillid,duration; ... ;skillid,duration
+# SkillDuration is not implemented yet.
+SellBuffSkillList = 33,7200;67,7200;264,7200;265,7200;266,7200;267,7200;268,7200;\
+269,7200;270,7200;271,7200;272,7200;273,7200;274,7200;275,7200;276,7200;277,7200;\
+304,7200;305,7200;306,7200;307,7200;308,7200;309,7200;310,7200;311,7200;\
+349,7200;363,7200;364,7200;365,7200;366,7200;\
+1002,7200;1003,7200;1004,7200;1005,7200;1006,7200;1007,7200;1008,7200;1009,7200;\
+1032,7200;1033,7200;1035,7200;1036,7200;1040,7200;1043,7200;1044,7200;1045,7200;1048,7200;\
+1059,7200;1062,7200;1068,7200;1073,7200;1077,7200;1078,7200;1085,7200;1086,7200;1087,7200;\
+1182,7200;1189,7200;1191,7200;1204,7200;1240,7200;1242,7200;1243,7200;1249,7200;1250,7200;1251,7200;1252,7200;1253,7200;\
+1257,7200;1259,7200;1260,7200;1261,7200;1268,7200;1279,7200;1280,7200;1281,7200;1282,7200;1284,7200;\
+1303,7200;1307,7200;1308,7200;1309,7200;1310,7200;1311,7200;1328,7200;1352,7200;1353,7200;1354,7200;1355,7200;1356,7200;\
+1357,7200;1362,7200;1363,7200;1364,7200;1365,7200;1388,7200;1389,7200;1390,7200;1391,7200;1392,7200;\
+1393,7200;1397,7200;1413,7200;1414,7200;1415,7200;1416,7200;\
+4699,7200;4700,7200;4702,7200;4703,7200;1323,7200
+
+# Allow selling party buffs for no party members.
+AllowPartyBuffs = True
+
+# Allow selling clan buffs for no clan members.
+AllowClanBuffs = True 
+
+# Buff buyer will be informed about buff price greater than SellBuffPunishedPrice.
+# This option must be between <1, 2 000 000 000> (Default: 5000) (if it have other value, the option will be ignored).
+SellBuffPunishedPrice = 5000
+
+# If Enabled, remove useless buffs like shield lv.1 from dominator buff set.
+# This option should be enabled, for helping players to get wrong buffs.
+SellBuffFilterEnabled = True
+
+# SellBuffMinLvl default: 40 (lower level's not implemented yet)
+SellBuffMinLvl = 40
+
+# Enable/disable selling buffs sets like Warrior set, Mage set...
+SellBuffsetEnabled = True
+
+# Set minimum character level to sell buffs sets (Default: 79)
+SellBuffSetMinLvl = 79
+
+# Define Buffsets: Warrior, Mage, Recharger, Tanker:
+# Format: SellBuffsetWarrior = skillId,skillId,...,skillId
+# No skills is disable show this buffset in menu.
+SellBuffsetWarrior = 33,67,264,265,266,267,268,\
+269,270,271,272,273,274,275,276,277,\
+304,305,306,307,308,309,310,311,\
+349,363,364,365,366,\
+1002,1003,1004,1005,1006,1007,1008,1009,\
+1032,1033,1035,1036,1040,1043,1044,1045,1048,\
+1059,1062,1068,1073,1077,1078,1085,1086,1087,\
+1182,1189,1191,1204,1240,1242,1243,1249,1250,1251,1252,1253,\
+1257,1259,1260,1261,1268,1279,1280,1281,1282,1284,\
+1303,1307,1308,1309,1310,1311,1328,1352,1353,1354,1355,1356,\
+1357,1362,1363,1364,1365,1388,1389,1390,1391,1392,\
+1393,1397,1413,1414,1415,1416,\
+4699,4700,4702,4703,1323
+#---------------------------------------------------------------
+SellBuffsetMage =33,67,264,265,266,267,268,\
+269,270,271,272,273,274,275,276,277,\
+304,305,306,307,308,309,310,311,\
+349,363,364,365,366,\
+1002,1003,1004,1005,1006,1007,1008,1009,\
+1032,1033,1035,1036,1040,1043,1044,1045,1048,\
+1059,1062,1068,1073,1077,1078,1085,1086,1087,\
+1182,1189,1191,1204,1240,1242,1243,1249,1250,1251,1252,1253,\
+1257,1259,1260,1261,1268,1279,1280,1281,1282,1284,\
+1303,1307,1308,1309,1310,1311,1328,1352,1353,1354,1355,1356,\
+1357,1362,1363,1364,1365,1388,1389,1390,1391,1392,\
+1393,1397,1413,1414,1415,1416,\
+4699,4700,4702,4703,1323
+#---------------------------------------------------------------
+SellBuffsetRecharger = 33,67,264,265,266,267,268,\
+269,270,271,272,273,274,275,276,277,\
+304,305,306,307,308,309,310,311,\
+349,363,364,365,366,\
+1002,1003,1004,1005,1006,1007,1008,1009,\
+1032,1033,1035,1036,1040,1043,1044,1045,1048,\
+1059,1062,1068,1073,1077,1078,1085,1086,1087,\
+1182,1189,1191,1204,1240,1242,1243,1249,1250,1251,1252,1253,\
+1257,1259,1260,1261,1268,1279,1280,1281,1282,1284,\
+1303,1307,1308,1309,1310,1311,1328,1352,1353,1354,1355,1356,\
+1357,1362,1363,1364,1365,1388,1389,1390,1391,1392,\
+1393,1397,1413,1414,1415,1416,\
+4699,4700,4702,4703,1323
+#---------------------------------------------------------------
+SellBuffsetTanker = 33,67,264,265,266,267,268,\
+269,270,271,272,273,274,275,276,277,\
+304,305,306,307,308,309,310,311,\
+349,363,364,365,366,\
+1002,1003,1004,1005,1006,1007,1008,1009,\
+1032,1033,1035,1036,1040,1043,1044,1045,1048,\
+1059,1062,1068,1073,1077,1078,1085,1086,1087,\
+1182,1189,1191,1204,1240,1242,1243,1249,1250,1251,1252,1253,\
+1257,1259,1260,1261,1268,1279,1280,1281,1282,1284,\
+1303,1307,1308,1309,1310,1311,1328,1352,1353,1354,1355,1356,\
+1357,1362,1363,1364,1365,1388,1389,1390,1391,1392,\
+1393,1397,1413,1414,1415,1416,\
+4699,4700,4702,4703,1323
+
+# Restricted zones id's. 
+# It's mean if 'SellBuffRestrictedZonesIds = 300003' , buff sell is impossible here.
+# Format: zoneId,zoneId, ... ,zoneId,zoneId
+# Default: SellBuffRestrictedZonesIds =(no spaces)
+SellBuffRestrictedZonesIds =
Index: head-src/com/l2jfrozen/gameserver/datatables/OfflineTradeTable.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/datatables/OfflineTradeTable.java	(revision 991)
+++ head-src/com/l2jfrozen/gameserver/datatables/OfflineTradeTable.java	(working copy)
@@ -142,6 +142,18 @@
 									stm_items.clearParameters();
 								}
 								break;
+							case L2PcInstance.STORE_SELLBUFF:
+								if (!Config.OFFLINE_SELLBUFF_ENABLED)
+									continue;
+								title = "";
+
+								stm_items.setInt(1, pc.getObjectId());
+								stm_items.setInt(2, 0);
+								stm_items.setLong(3, 0);
+								stm_items.setLong(4, pc.getBuffPrice());
+								stm_items.executeUpdate();
+								stm_items.clearParameters();
+								break;
 							default:
 								//_log.info( "OfflineTradersTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
 								//no save for this kind of shop
@@ -254,6 +266,13 @@
 							player.setCreateList(createList);
 							player.getCreateList().setStoreName(rs.getString("title"));
 							break;
+						case L2PcInstance.STORE_SELLBUFF:
+							while (items.next())
+							{
+								player.getSellBuffMsg().startBuffStore(player, items.getInt(4), false);
+								break;
+							}	
+							break;
 						default:
 							_log.info("Offline trader "+player.getName()+" finished to sell his items");
 					}
@@ -385,6 +404,18 @@
 							stm_items.clearParameters();
 						}
 						break;
+					case L2PcInstance.STORE_SELLBUFF:
+						if (!Config.OFFLINE_SELLBUFF_ENABLED)
+							break;
+						title = "";
+
+						stm_items.setInt(1, pc.getObjectId());
+						stm_items.setInt(2, 0);
+						stm_items.setLong(3, 0);
+						stm_items.setLong(4, pc.getBuffPrice());
+						stm_items.executeUpdate();
+						stm_items.clearParameters();
+						break;
 					default:
 						//_log.info( "OfflineTradersTable[storeOffliner()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
 						//no save for this kind of shop
Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java	(revision 991)
+++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java	(working copy)
@@ -37,11 +37,13 @@
 import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.VersionCmd;
 import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Voting;
 import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.sellbuff;
 
 /**
  * This class ...
  * @version $Revision: 1.1.4.6 $ $Date: 2009/05/12 19:44:09 $
  */
+@SuppressWarnings("unused")
 public class VoicedCommandHandler
 {
 	private static Logger _log = Logger.getLogger(GameServer.class.getName());
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java	(revision 991)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java	(working copy)
@@ -121,6 +121,112 @@
 			{
 				comeHere(activeChar);
 			}
+			// SELL BUFF SYSTEM: ->
+			else if(_command.startsWith("sellbuffpage")){ //load page number (player or pet) //to sellbuff system. //
+				
+				int page = 0;
+				if(_command.length() == 13 || _command.length() == 17){
+					String x = _command.substring(12,13);
+					try{
+						page = Integer.parseInt(x);
+					}catch(Exception e){
+						_log.info(e.getMessage());
+					}
+				}
+				
+				int subPage = 0;
+				if(_command.length() == 17){
+					String y = _command.substring(16,17); // zmieniono nie testowano.
+					try{
+						subPage = Integer.parseInt(y);
+					}catch(Exception e){
+						_log.info(e.getMessage());
+					}
+				}
+				
+				
+				L2PcInstance target = null;
+								
+				if(activeChar.getTarget() instanceof L2PcInstance)
+				target = (L2PcInstance) activeChar.getTarget();
+								
+				if(target == null)
+					return;
+				
+				activeChar.getSellBuffMsg().setPage(target, activeChar, page, subPage);
+			}
+			else if(_command.startsWith("buff")){ //load buffId from html->bypass. //to sellbuff system. //
+				String x = _command.substring(4);
+				int id = Integer.parseInt(x);
+				L2PcInstance target = null;
+								
+				if(activeChar.getTarget() instanceof L2PcInstance)
+				target = (L2PcInstance) activeChar.getTarget();
+								
+				if(target == null)
+					return;
+				
+				activeChar.getSellBuffMsg().buffBuyer(target, activeChar, id);
+			}
+			else if(_command.startsWith("zbuffset")){ //load buffset from html->bypass. //to sellbuff system. //
+				String x = _command.substring(8);
+				int id = Integer.parseInt(x);
+				L2PcInstance target = null;
+								
+				if(activeChar.getTarget() instanceof L2PcInstance)
+				target = (L2PcInstance) activeChar.getTarget();
+								
+				if(target == null)
+					return;
+				
+				activeChar.getSellBuffMsg().buffsetBuyer(target, activeChar, id);
+			}
+			else if(_command.startsWith("petbuff")){ //load buffId from html->bypass. //to sellbuff system. //
+				String x = _command.substring(7);
+				int id = Integer.parseInt(x);
+				L2PcInstance target = null;
+								
+				if(activeChar.getTarget() instanceof L2PcInstance)
+				target = (L2PcInstance) activeChar.getTarget();
+								
+				if(target == null)
+					return;
+				
+				activeChar.getSellBuffMsg().buffBuyerPet(target, activeChar, id);
+			}
+			else if(_command.startsWith("zpetbuff")){ //load buff set from html->bypass.  //to sellbuff system. //
+				String x = _command.substring(8);
+				int id = Integer.parseInt(x);
+				L2PcInstance target = null;
+								
+				if(activeChar.getTarget() instanceof L2PcInstance)
+				target = (L2PcInstance) activeChar.getTarget();
+								
+				if(target == null)
+					return;
+				
+				activeChar.getSellBuffMsg().buffsetBuyerPet(target, activeChar, id);			
+			}
+			else if(_command.startsWith("actr")){ //to sellbuff system. //
+				try{
+					String l = _command.substring(5);
+					int p = 0;
+
+					p = Integer.parseInt(l);
+			
+					activeChar.getSellBuffMsg().startBuffStore(activeChar, p, true);
+				}catch(Exception e){
+					activeChar.sendMessage("Wrong field value!");
+				}
+			}
+			else if(_command.startsWith("pctra")){ //to sellbuff system. //
+				try{
+					activeChar.getSellBuffMsg().stopBuffStore(activeChar);
+				}catch(Exception e){
+					
+				}
+			}
+			// -> SELL BUFF SYSTEM.
 			else if(_command.startsWith("player_help "))
 			{
 				playerHelp(activeChar, _command.substring(12));
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java	(revision 991)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -618,6 +618,10 @@
 		// Color System checks - Start
 		// Check if the custom PvP and PK color systems are enabled and if so check the character's counters
 		// and apply any color changes that must be done. Thankz Kidzor
+		
+		// Sellbuff system:
+		activeChar.getSellBuffMsg().restoreSellerData(activeChar);
+
 		/** KidZor: Ammount 1 **/
 		if (activeChar.getPvpKills() >= Config.PVP_AMOUNT1 && Config.PVP_COLOR_SYSTEM_ENABLED)
 			activeChar.updatePvPColor(activeChar.getPvpKills());
Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java	(revision 991)
+++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -126,6 +126,7 @@
 import com.l2jfrozen.gameserver.model.PcWarehouse;
 import com.l2jfrozen.gameserver.model.PetInventory;
 import com.l2jfrozen.gameserver.model.PlayerStatus;
+import com.l2jfrozen.gameserver.custom.SellBuffMsg;
 import com.l2jfrozen.gameserver.model.ShortCuts;
 import com.l2jfrozen.gameserver.model.TradeList;
 import com.l2jfrozen.gameserver.model.actor.appearance.PcAppearance;
@@ -520,6 +521,9 @@
 	
 	/** The Constant STORE_PRIVATE_PACKAGE_SELL. */
 	public static final int STORE_PRIVATE_PACKAGE_SELL = 8;
+	
+	/** The Constant STORE_SELLBUFF. */
+	public static final int STORE_SELLBUFF = 12;
 
 	/** The fmt. */
 	private final SimpleDateFormat fmt = new SimpleDateFormat("H:mm.");
@@ -1040,6 +1044,11 @@
 	/** The _hero. */
 	private boolean _hero = false;
 	
+	/** If player is selling buffs value = true. */
+	private boolean _sellbuff = false;
+	private int _buffprice = 0;
+	private SellBuffMsg _sbm = new SellBuffMsg();
+	
 	/** The _donator. */
 	private boolean _donator = false;
 
@@ -4583,6 +4592,9 @@
 			return;
 		}
 		
+		if(isSellBuff())
+			return;
+
 		if(L2Event.active && eventSitForced)
 		{
 			sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ...");
@@ -7092,8 +7104,40 @@
 
 		// Target the new L2Object (add the target to the L2PcInstance _target, _knownObject and L2PcInstance to _KnownObject of the L2Object)
 		super.setTarget(newTarget);
+		
+		if(Config.SELL_BUFF_ENABLED){
+			if(newTarget instanceof L2PcInstance && ((L2PcInstance) newTarget).isSellBuff()){
+				this.getSellBuffMsg().setLastPage(0); // Back to first page when new target.
+				L2PcInstance seller = (L2PcInstance)newTarget;
+				this.getSellBuffMsg().sendBuyerResponse(seller, this, false);
+			}
+		}
+		
 	}
+	
 
+	
+	public boolean isSellBuff(){
+		return _sellbuff;
+	}
+			
+    public void setSellBuff(boolean j){
+    	_sellbuff = j;
+    	if(j){
+    		_privatestore = STORE_SELLBUFF;
+    	}else{
+    		_privatestore = STORE_PRIVATE_NONE;
+    	}
+    }
+		 
+    public int getBuffPrice(){
+    	return _buffprice;
+    }
+		    
+    public void setBuffPrice(int x){
+    	_buffprice = x;
+    }
+    
 	/**
 	 * Return the active weapon instance (always equiped in the right hand).<BR>
 	 * <BR>
@@ -9190,7 +9234,7 @@
 	 * <li>3 : STORE_PRIVATE_BUY</li><BR>
 	 * <li>4 : buymanage</li><BR>
 	 * <li>5 : STORE_PRIVATE_MANUFACTURE</li><BR>
-	 *
+	 * <li>6 : PRIVATE_SELLBUFF</li><BR>
 	 * @param type the new private store type
 	 */
 	public void setPrivateStoreType(int type)
@@ -17845,6 +17889,10 @@
 	{
 		return Config.FREIGHT_SLOTS + (int) getStat().calcStat(Stats.FREIGHT_LIM, 0, null, null);
 	}
+	
+	public SellBuffMsg getSellBuffMsg(){
+		return _sbm;
+	}
 
 	/**
 	 * Gets the dwarf recipe limit.
Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/sellbuff.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/sellbuff.java	(revision 0)
+++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/sellbuff.java	(working copy)
@@ -0,0 +1,112 @@
+/*
+ * This program 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 2, or (at your option)
+ * any later version.
+ *
+ * This program 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
+
+import com.l2jfrozen.Config;
+import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
+import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * 
+ * 
+ * @author Matthew
+ */
+public class sellbuff implements IVoicedCommandHandler
+{
+	private static final String[] VOICED_COMMANDS = {"sellbuffs"};
+		
+	@SuppressWarnings("static-access")
+	@Override
+	public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+	{
+		if(activeChar == null)
+			return false;
+		
+		if(activeChar.isDead() || activeChar.isAlikeDead()){
+			activeChar.sendMessage("You are dead , you can't sell at the moment");
+			return false;
+		}
+		else if(activeChar.isInOlympiadMode() || Olympiad.getInstance().isRegistered(activeChar)){
+			activeChar.sendMessage("You are in olympiad , you can't sell at the moment");
+			return false;
+		}
+		else if(activeChar.atEvent){
+			activeChar.sendMessage("You are in event , you can't sell at the moment");
+			return false;
+		}
+		else if(!activeChar.isInsideZone(L2PcInstance.ZONE_PEACE)){
+			activeChar.sendMessage("You are not in peacefull zone , you can sell only in peacefull zones");
+			return false;
+		}
+		else if(isInRestrictedZone(activeChar)){
+			activeChar.sendMessage("You can't sell in restricted zone");
+			return false;
+		}
+		else if(activeChar.getPvpFlag() > 0 || activeChar.isInCombat() || activeChar.getKarma() > 0){
+			activeChar.sendMessage("You are in combat mode , you can't sell at the moment");
+			return false;
+		}
+		else if(!Config.SELL_BUFF_CLASS_LIST.contains(Integer.toString(activeChar.getClassId().getId()))){
+			activeChar.sendMessage("Your class can't sell buffs");
+			return false;
+		}
+		else if(activeChar.getLevel() < Config.SELL_BUFF_MIN_LVL){
+			activeChar.sendMessage("You can sell buffs on "+Config.SELL_BUFF_MIN_LVL+" level");
+			return false;
+		}
+		// summoner classes exception, buffs allowed from 56 level.
+		else if(activeChar.getClassId().getId() == 96 || activeChar.getClassId().getId() == 14 || activeChar.getClassId().getId() == 104 || activeChar.getClassId().getId() == 28){
+			if(activeChar.getLevel() < 56){
+				activeChar.sendMessage("You can sell buffs on 56 level");
+				return false;
+			}
+		}
+		
+		activeChar.getSellBuffMsg().sendSellerResponse(activeChar);
+
+	    return true;
+	}
+
+	
+	@Override
+	public String[] getVoicedCommandList()
+	{
+		return VOICED_COMMANDS;
+	}
+	
+	private boolean isInRestrictedZone(L2PcInstance activeChar){
+		for(int i=0; i<Config.SELL_BUFF_RESTRICTED_ZONES_IDS.size(); i++){
+			try{
+				if(activeChar.isInsideZone(Integer.parseInt(Config.SELL_BUFF_RESTRICTED_ZONES_IDS.get(i)))){
+					return true;
+				}
+			}catch(Exception e){
+				return false;
+			}
+			
+		}
+		return false;
+	}
+
+}
+
+
+
+

 

 

Изменено пользователем JoeyTribbiani
add spoiler

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!

Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.

Войти
Авторизация  

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

×
×
  • Создать...