Перейти к содержанию

Closer

Пользователи
  • Публикаций

    26
  • Зарегистрирован

  • Посещение

  • Отзывы

    0%

Репутация

0

1 Подписчик

Информация о Closer

  • Звание
    Только пришел

Информация

  • Пол
    Мужчина

Контакты

  • ICQ
    670-749-526
  1. Closer

    Сундук С Дропом 100%

    Demoncool вообщем я создал NewItem в itemhandler, прописал свои айдишки, скомпилил, юзаю итем и ничего не происходит =(
  2. Closer

    Сундук С Дропом 100%

    можешь подсказать как это сделать?) /* * 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.datatables.csv; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.model.L2ExtractableItem; import com.l2jfrozen.gameserver.model.L2ExtractableProductItem; /** * @author FBIagent */ public class ExtractableItemsData { //Map<itemid, L2ExtractableItem> private Map<Integer, L2ExtractableItem> _items; private static ExtractableItemsData _instance = null; public static ExtractableItemsData getInstance() { if(_instance == null) { _instance = new ExtractableItemsData(); } return _instance; } public ExtractableItemsData() { _items = new HashMap<Integer, L2ExtractableItem>(); Scanner s = null; try { s = new Scanner(new File(Config.DATAPACK_ROOT+"/data/extractable_items.csv")); int lineCount = 0; while(s.hasNextLine()) { lineCount++; String line = s.nextLine(); if(line.startsWith("#")) { continue; } else if(line.equals("")) { continue; } String[] lineSplit = line.split(";"); int itemID = 0; try { itemID = Integer.parseInt(lineSplit[0]); } catch(Exception e) { if(Config.ENABLE_ALL_EXCEPTIONS) e.printStackTrace(); System.out.println("Extractable items data: Error in line " + lineCount + " -> invalid item id or wrong seperator after item id!"); System.out.println(" " + line); return; } List<L2ExtractableProductItem> product_temp = new ArrayList<L2ExtractableProductItem>(lineSplit.length); for(int i = 0; i < lineSplit.length - 1; i++) { String[] lineSplit2 = lineSplit[i + 1].split(","); if(lineSplit2.length != 3) { System.out.println("Extractable items data: Error in line " + lineCount + " -> wrong seperator!"); System.out.println(" " + line); continue; } int production = 0, amount = 0, chance = 0; try { production = Integer.parseInt(lineSplit2[0]); amount = Integer.parseInt(lineSplit2[1]); chance = Integer.parseInt(lineSplit2[2]); lineSplit2 = null; } catch(Exception e) { if(Config.ENABLE_ALL_EXCEPTIONS) e.printStackTrace(); System.out.println("Extractable items data: Error in line " + lineCount + " -> incomplete/invalid production data or wrong seperator!"); System.out.println(" " + line); continue; } product_temp.add(new L2ExtractableProductItem(production, amount, chance)); } int fullChances = 0; for(L2ExtractableProductItem Pi : product_temp) { fullChances += Pi.getChance(); } if(fullChances > 100) { System.out.println("Extractable items data: Error in line " + lineCount + " -> all chances together are more then 100!"); System.out.println(" " + line); continue; } _items.put(itemID, new L2ExtractableItem(itemID, product_temp)); } System.out.println("Extractable items data: Loaded " + _items.size() + " extractable items!"); } catch(Exception e) { //if(Config.ENABLE_ALL_EXCEPTIONS) e.printStackTrace(); System.out.println("Extractable items data: Can not find './data/extractable_items.csv'"); }finally{ if(s != null) try { s.close(); } catch(Exception e1) { e1.printStackTrace(); } } } public L2ExtractableItem getExtractableItem(int itemID) { return _items.get(itemID); } public int[] itemIDs() { int size = _items.size(); int[] result = new int; int i = 0; for(L2ExtractableItem ei : _items.values()) { result = ei.getItemId(); i++; } return result; } } Вот тут прописано как несколько добавлять, только на все итемы вместе шанс дается 100%, а мне нужно чтоб раздельно по 100% тоесть чтоб из 1 итема 5 штук падало со 100% шансом
  3. Closer

    Сундук С Дропом 100%

    нужно несколько))) один я курсе как делать
  4. Closer

    Сундук С Дропом 100%

    Кто подскажет как реализовать сундук чтоб когда его открываешь с него выпадали несколько итемов со 100% шансом?
  5. /* * 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.powerpak.Buffer; import java.util.ArrayList; import java.util.Map; import java.util.StringTokenizer; import javolution.text.TextBuilder; import javolution.util.FastList; import javolution.util.FastMap; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.cache.HtmCache; import com.l2jfrozen.gameserver.communitybbs.Manager.BaseBBSManager; import com.l2jfrozen.gameserver.datatables.BufferSkillsTable; import com.l2jfrozen.gameserver.datatables.CharSchemesTable; import com.l2jfrozen.gameserver.datatables.SkillTable; import com.l2jfrozen.gameserver.handler.IBBSHandler; import com.l2jfrozen.gameserver.handler.ICustomByPassHandler; import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler; import com.l2jfrozen.gameserver.model.L2Character; import com.l2jfrozen.gameserver.model.L2Effect; import com.l2jfrozen.gameserver.model.L2Skill; import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.gameserver.model.entity.event.CTF; import com.l2jfrozen.gameserver.model.entity.event.DM; import com.l2jfrozen.gameserver.model.entity.event.TvT; import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad; import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jfrozen.gameserver.powerpak.PowerPakConfig; import com.l2jfrozen.gameserver.powerpak.Buffer.BuffTable.Buff; import com.l2jfrozen.gameserver.taskmanager.AttackStanceTaskManager; /** * @author Nick */ public class BuffHandler implements IVoicedCommandHandler, ICustomByPassHandler, IBBSHandler { private static final String PARENT_DIR = "data/html/buffer/"; private Map<Integer,ArrayList<Buff>> _buffs; private Map<Integer, String> _visitedPages; private ArrayList<Buff> getOwnBuffs(int objectId) { if(_buffs.get(objectId)==null) synchronized(_buffs) { _buffs.put(objectId,new ArrayList<Buff>()); } return _buffs.get(objectId); } public BuffHandler() { _buffs = new FastMap<Integer,ArrayList<Buff>>(); _visitedPages = new FastMap<Integer,String>(); } @Override public String[] getVoicedCommandList() { return new String[] {PowerPakConfig.BUFFER_COMMAND}; } private boolean checkAllowed(L2PcInstance activeChar) { String msg = null; if(activeChar.isSitting()) msg = "Вы не можете использователь бафер во время отдыха."; else if(activeChar.isCastingNow() || activeChar.isCastingPotionNow()) msg = "Вы не можете использователь бафер ,когда заняты."; else if(activeChar.isAlikeDead()) msg = "Вы не можете использователь бафер,когда мертвы."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("ALL")) msg = "Бафер невозможно использовать на данной территории."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("CURSED") && activeChar.isCursedWeaponEquiped()) msg = "Вы не можете использовать бафер с проклятым оружием."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("ATTACK") && AttackStanceTaskManager.getInstance().getAttackStanceTask(activeChar)) msg = "Вы не можете использовать бафер во время битвы."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("DUNGEON") && activeChar.isIn7sDungeon()) msg = "Бафер не работает в катакомбах и некрополисах."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("RB") && activeChar.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND)) msg = "Бафер невозможно использовать на данной территории. "; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("PVP") && activeChar.isInsideZone(L2Character.ZONE_PVP)) msg = "Бафер не возможно использовать на данной территории."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("PEACE") && activeChar.isInsideZone(L2Character.ZONE_PEACE)) msg = "Бафер не возможно использовать на данной территории."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("SIEGE") && activeChar.isInsideZone(L2Character.ZONE_SIEGE)) msg = "Бафер не возможно использовать на данной территории."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("OLYMPIAD") && (activeChar.isInOlympiadMode() || activeChar.isInsideZone(L2Character.ZONE_OLY) || Olympiad.getInstance().isRegistered(activeChar) || Olympiad.getInstance().isRegisteredInComp(activeChar))) msg = "Бафер не возможно использовать во время олимпиады."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("EVENT") && (activeChar.isInFunEvent())) msg = "Бафер не возможно использовать на этом эвенте."; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("TVT") && activeChar._inEventTvT && TvT.is_started() ) msg = "Бафер не возможно использовать на эвенте TVT"; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("CTF") && activeChar._inEventCTF && CTF.is_started() ) msg = "Бафер не возможно использовать на эвенте CTF"; else if(PowerPakConfig.BUFFER_EXCLUDE_ON.contains("DM") && activeChar._inEventDM && DM.is_started() ) msg = "Бафер не возможно использовать на эвенте DM"; if(msg!=null) activeChar.sendMessage(msg); return msg==null; } @Override public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { if(activeChar == null) return false; if(!checkAllowed(activeChar)) return false; if(command.compareTo(PowerPakConfig.BUFFER_COMMAND)==0) { NpcHtmlMessage htm = new NpcHtmlMessage(activeChar.getLastQuestNpcObject()); String text = HtmCache.getInstance().getHtm("data/html/default/"+PowerPakConfig.BUFFER_NPC+".htm"); htm.setHtml(text); activeChar.sendPacket(htm); } return false; } private static final String [] _BYPASSCMD = {"dobuff"}; @Override public String[] getByPassCommands() { return _BYPASSCMD; } @Override public void handleCommand(String command, L2PcInstance player, String parameters) { if(player==null) return; if(!checkAllowed(player)) return; L2NpcInstance buffer = null; if(!PowerPakConfig.BUFFER_USEBBS && !PowerPakConfig.BUFFER_USECOMMAND){ if(player.getTarget()!=null) if(player.getTarget() instanceof L2NpcInstance) { buffer = (L2NpcInstance)player.getTarget(); if(buffer.getTemplate().getNpcId()!=PowerPakConfig.BUFFER_NPC) buffer=null; } //Possible fix to Buffer - 1 if (buffer == null) return; //Possible fix to Buffer - 2 if (!player.isInsideRadius(buffer, L2NpcInstance.INTERACTION_DISTANCE, false, false)) return; }//if buffer is null means that buffer will be applied directly (voice and bbs) if(parameters.contains("Pet")){ if(player.getPet()==null){ return; } } StringTokenizer st = new StringTokenizer(parameters, " "); String currentCommand = st.nextToken(); if(parameters.compareTo("ClearBuffs")==0) { getOwnBuffs(player.getObjectId()).clear(); player.sendMessage("Buff set cleared"); } else if(parameters.compareTo("ClearPetBuffs")==0) { getOwnBuffs(player.getPet().getObjectId()).clear(); player.sendMessage("Pet Buff set cleared"); } else if(parameters.compareTo("RemoveAll")==0) { for(L2Effect e : player.getAllEffects()) { if(e.getEffectType()==L2Effect.EffectType.BUFF) player.removeEffect(e); } } else if(parameters.compareTo("RemovePetAll")==0) { for(L2Effect e : player.getPet().getAllEffects()) { if(e.getEffectType()==L2Effect.EffectType.BUFF) player.getPet().removeEffect(e); } } else if(parameters.startsWith("Chat")) { String chatIndex = parameters.substring(4).trim(); synchronized(_visitedPages) { _visitedPages.put(player.getObjectId(), chatIndex); } chatIndex = "-" + chatIndex; String text = HtmCache.getInstance().getHtm("data/html/buffer/buffer" + chatIndex + ".htm"); if(command.startsWith("bbsbuff")) { text = text.replace("-h custom_do", "bbs_bbs"); BaseBBSManager.separateAndSend(text, player); } else { NpcHtmlMessage htm = new NpcHtmlMessage(player.getLastQuestNpcObject()); htm.setHtml(text); player.sendPacket(htm); } } else if(parameters.startsWith("RestoreAll")) { if(player.getAdena()<PowerPakConfig.BUFFER_PRICE*3) { player.sendMessage("У вас не хватает адены."); return; } player.getStatus().setCurrentCp(player.getMaxCp()); player.getStatus().setCurrentMp(player.getMaxMp()); player.getStatus().setCurrentHp(player.getMaxHp()); player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE*3, null, true); } else if(parameters.startsWith("RestorePetAll")) { if(player.getAdena()<PowerPakConfig.BUFFER_PRICE*3) { player.sendMessage("У вас не хватает адены."); return; } player.getPet().getStatus().setCurrentMp(player.getPet().getMaxMp()); player.getPet().getStatus().setCurrentHp(player.getPet().getMaxHp()); player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE*3, null, true); } else if(parameters.startsWith("RestoreCP")) { if(player.getAdena()<PowerPakConfig.BUFFER_PRICE) { player.sendMessage("У вас не хватает адены."); return; } player.getStatus().setCurrentCp(player.getMaxCp()); player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true); } else if(parameters.startsWith("RestoreMP")) { if(player.getAdena()<PowerPakConfig.BUFFER_PRICE) { player.sendMessage("У вас не хватает адены."); return; } player.getStatus().setCurrentMp(player.getMaxMp()); player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true); } else if(parameters.startsWith("RestorePetMP")) { if(player.getAdena()<PowerPakConfig.BUFFER_PRICE) { player.sendMessage("У вас не хватает адены."); return; } player.getPet().getStatus().setCurrentMp(player.getPet().getMaxMp()); player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true); } else if(parameters.startsWith("RestoreHP")) { if(player.getAdena()<PowerPakConfig.BUFFER_PRICE) { player.sendMessage("У вас не хватает адены."); return; } player.getStatus().setCurrentHp(player.getMaxHp()); player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true); } else if(parameters.startsWith("RestorePetHP")) { if(player.getAdena()<PowerPakConfig.BUFFER_PRICE) { player.sendMessage("У вас не хватает адены."); return; } player.getPet().getStatus().setCurrentHp(player.getPet().getMaxHp()); player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true); } else if(parameters.startsWith("MakeBuffs") || parameters.startsWith("RestoreBuffs")) { String buffName = parameters.substring(9).trim(); int totaladena = 0; ArrayList<Buff> buffs = null; if(parameters.startsWith("RestoreBuffs")) buffs = getOwnBuffs(player.getObjectId()); else buffs = BuffTable.getInstance().getBuffsForName(buffName); if(buffs!=null && buffs.size()==1) { if(!getOwnBuffs(player.getObjectId()).contains(buffs.get(0))) getOwnBuffs(player.getObjectId()).add(buffs.get(0)); } if(buffs==null || buffs.size()==0){ player.sendMessage("Ваш профиль бафов отсутствует."); return; } for(Buff buff: buffs) { L2Skill skill = SkillTable.getInstance().getInfo(buff._skillId, buff._skillLevel); if(skill!=null) { if(player.getLevel()>= buff._minLevel && player.getLevel()<=buff._maxLevel) { if(buff._price>0) { totaladena+=buff._price; if(player.getAdena()<totaladena) { player.sendMessage("У вас не хватает адены."); break; } } if(!buff._force && buffer!=null) { buffer.setBusy(true); buffer.setCurrentMp(buffer.getMaxMp()); buffer.setTarget(player); //buffer.doCast(skill); skill.getEffects(buffer, player,false,false,false); buffer.setBusy(false); } else skill.getEffects(player, player,false,false,false); } try { Thread.sleep(100); // Delay for the packet... } catch(InterruptedException e) { if(Config.ENABLE_ALL_EXCEPTIONS) e.printStackTrace(); } } } if(totaladena>0) player.reduceAdena("Buff", totaladena, null, true); if(_visitedPages.get(player.getObjectId())!=null) handleCommand(command,player,"Chat "+_visitedPages.get(player.getObjectId())); else useVoicedCommand(PowerPakConfig.BUFFER_COMMAND, player, ""); }else if(parameters.startsWith("MakePetBuffs") || parameters.startsWith("RestorePetBuffs")) { if(player.getPet()==null){ player.sendMessage("Не найден ваш слуга."); return; } String buffName = parameters.substring(12).trim(); int totaladena = 0; ArrayList<Buff> buffs = null; if(parameters.startsWith("RestorePetBuffs")) buffs = getOwnBuffs(player.getPet().getObjectId()); else buffs = BuffTable.getInstance().getBuffsForName(buffName); if(buffs!=null && buffs.size()==1) { if(!getOwnBuffs(player.getPet().getObjectId()).contains(buffs.get(0))){ getOwnBuffs(player.getPet().getObjectId()).add(buffs.get(0)); } } if(buffs==null || buffs.size()==0){ player.sendMessage("Профиль бафов вашего слуги отсутствует."); return; } for(Buff buff: buffs) { L2Skill skill = SkillTable.getInstance().getInfo(buff._skillId, buff._skillLevel); if(skill!=null) { if(player.getLevel()>= buff._minLevel && player.getLevel()<=buff._maxLevel) { if(buff._price>0) { totaladena+=buff._price; if(player.getAdena()<totaladena) { player.sendMessage("У вас не хватает адены."); break; } } if(!buff._force && buffer!=null) { buffer.setBusy(true); buffer.setCurrentMp(buffer.getMaxMp()); buffer.setTarget(player.getPet()); skill.getEffects(buffer, player.getPet(),false,false,false); //buffer.doCast(skill); buffer.setBusy(false); } else skill.getEffects(player, player.getPet(),false,false,false); } try { Thread.sleep(100); // Delay for the packet... } catch(InterruptedException e) { if(Config.ENABLE_ALL_EXCEPTIONS) e.printStackTrace(); } } } if(totaladena>0) player.reduceAdena("Buff", totaladena, null, true); if(_visitedPages.get(player.getObjectId())!=null) handleCommand(command,player,"Chat "+_visitedPages.get(player.getObjectId())); else useVoicedCommand(PowerPakConfig.BUFFER_COMMAND, player, ""); //SCHEMAS }else if (currentCommand.startsWith("menu")) { NpcHtmlMessage html = new NpcHtmlMessage(1); html.setFile(PARENT_DIR + "menu.htm"); sendHtmlMessage(player, html); } // handles giving effects {support player, support pet, givebuffs} else if (currentCommand.startsWith("support")) { String targettype = st.nextToken(); showGiveBuffsWindow(player, targettype); } else if (currentCommand.startsWith("givebuffs")) { String targettype = st.nextToken(); String scheme_key = st.nextToken(); int cost = Integer.parseInt(st.nextToken()); if (cost == 0 || cost <= player.getInventory().getAdena()) { L2Character target = player; if (targettype.equalsIgnoreCase("pet")) target = player.getPet(); if (target != null) { for (L2Skill sk : CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key)) if(buffer!=null) { buffer.setBusy(true); buffer.setCurrentMp(buffer.getMaxMp()); buffer.setTarget(target); //buffer.doCast(skill); sk.getEffects(buffer, target,false,false,false); buffer.setBusy(false); } else sk.getEffects(target, target,false,false,false); //sk.getEffects(buffer, target); player.reduceAdena("NPC Buffer", cost, null, true); }else { player.sendMessage("Неправильная цель."); // go to main menu NpcHtmlMessage html = new NpcHtmlMessage(1); html.setFile(PARENT_DIR + "menu.htm"); sendHtmlMessage(player, html); } } else { player.sendMessage("У вас не хватает адены."); showGiveBuffsWindow(player, targettype); } } // handles edit schemes {skillselect, skillunselect} else if (currentCommand.startsWith("editscheme")) { String skill_group = st.nextToken(); String scheme_key = null; try { scheme_key = st.nextToken(); } catch (Exception e) { if(Config.ENABLE_ALL_EXCEPTIONS) e.printStackTrace(); } showEditSchemeWindow(player, skill_group, scheme_key); } else if (currentCommand.startsWith("skill")) { String skill_group = st.nextToken(); String scheme_key = st.nextToken(); int skill_id = Integer.parseInt(st.nextToken()); int level = BufferSkillsTable.getInstance().getSkillLevelById(skill_id); if (currentCommand.startsWith("skillselect") && !scheme_key.equalsIgnoreCase("unselected")) { if (CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).size() < PowerPakConfig.NPCBUFFER_MAX_SKILLS) CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).add(SkillTable.getInstance().getInfo(skill_id, level)); else player.sendMessage("This scheme has reached maximun amount of buffs"); } else if (currentCommand.startsWith("skillunselect")) CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).remove(SkillTable.getInstance().getInfo(skill_id, level)); showEditSchemeWindow(player, skill_group, scheme_key); } // manage schemes {create, delete, clear} else if (currentCommand.startsWith("manageschemes")) showManageSchemeWindow(player); else if (currentCommand.startsWith("createscheme")) { if(!st.hasMoreTokens()){ player.sendMessage("Ошибка,неверное имя профиля."); showManageSchemeWindow(player); return; } String name = st.nextToken();; if (name.length() > 14) { player.sendMessage("Ошибка, название профиля должно содержать не более 14-ти символов."); showManageSchemeWindow(player); } else if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).size() == PowerPakConfig.NPCBUFFER_MAX_SCHEMES) { player.sendMessage("Ошибка, превышено число профилей."); showManageSchemeWindow(player); } else if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).containsKey(name)) { player.sendMessage("Ошибка, такой профиль уже создан."); showManageSchemeWindow(player); } else { if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) == null) CharSchemesTable.getInstance().getSchemesTable().put(player.getObjectId(), new FastMap<String, FastList<L2Skill>>(PowerPakConfig.NPCBUFFER_MAX_SCHEMES + 1)); CharSchemesTable.getInstance().setScheme(player.getObjectId(), name.trim(), new FastList<L2Skill>(PowerPakConfig.NPCBUFFER_MAX_SKILLS + 1)); showManageSchemeWindow(player); } } // handles deletion else if (currentCommand.startsWith("deletescheme")) { if(!st.hasMoreTokens()){ player.sendMessage("Ошибка,неверное имя профиля."); showManageSchemeWindow(player); return; } String name = st.nextToken(); if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).containsKey(name)) { CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).remove(name); showManageSchemeWindow(player); } } // handles cleanning else if (currentCommand.startsWith("clearscheme")) { if(!st.hasMoreTokens()){ player.sendMessage("Ошибка,неверное имя профиля."); showManageSchemeWindow(player); return; } String name = st.nextToken(); if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).containsKey(name)) { CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).get(name).clear(); showManageSchemeWindow(player); } } //predefined buffs else if (currentCommand.startsWith("fighterbuff") || currentCommand.startsWith("magebuff")) { ArrayList<L2Skill> skills_to_buff = new ArrayList<L2Skill>(); if(currentCommand.startsWith("magebuff")){ for(int skillId:PowerPakConfig.MAGE_SKILL_LIST.keySet()){ L2Skill skill = SkillTable.getInstance().getInfo(skillId, PowerPakConfig.MAGE_SKILL_LIST.get(skillId)); if(skill!=null) { skills_to_buff.add(skill); } } }else{ for(int skillId:PowerPakConfig.FIGHTER_SKILL_LIST.keySet()){ L2Skill skill = SkillTable.getInstance().getInfo(skillId, PowerPakConfig.FIGHTER_SKILL_LIST.get(skillId)); if(skill!=null) { skills_to_buff.add(skill); } } } String targettype = ""; if(st.hasMoreTokens()) targettype = st.nextToken(); int cost = 0; if(PowerPakConfig.BUFFER_PRICE>0) cost = PowerPakConfig.BUFFER_PRICE*skills_to_buff.size(); if (cost == 0 || cost <= player.getInventory().getAdena()) { L2Character target = player; if (targettype.equalsIgnoreCase("pet")) target = player.getPet(); if (target != null) { for (L2Skill sk : skills_to_buff) sk.getEffects(target, target,false,false,false); player.reduceAdena("NPC Buffer", cost, null, true); } else { player.sendMessage("Ошибка, не найден ваш слуга."); } } else { player.sendMessage("Не хватает адены."); } } } private static String [] _BBSCommand = {"bbsbuff"}; @Override public String[] getBBSCommands() { return _BBSCommand; } private void sendHtmlMessage(L2PcInstance player, NpcHtmlMessage html) { //html.replace("%objectId%", String.valueOf(getObjectId())); //html.replace("%npcId%", String.valueOf(getNpcId())); player.sendPacket(html); } /** * Sends an html packet to player with Give Buffs menu info for player and pet, depending on targettype parameter {player, pet} * * @param player * @param targettype */ private void showGiveBuffsWindow(L2PcInstance player, String targettype) { TextBuilder tb = new TextBuilder(); tb.append("<html><title>Профиль " + targettype + "</title>"); tb.append("<body><br>"); FastMap<String, FastList<L2Skill>> map = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()); if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) == null || CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).isEmpty()) tb.append("У вас отсутствует профиль бафов, пожалуйста перейдите в раздел управления профилями и создайте свой профиль бафов."); else { int cost; tb.append("<table>"); for (FastMap.Entry<String, FastList<L2Skill>> e = map.head(), end = map.tail(); (e = e.getNext()) != end;) { cost = getFee(e.getValue()); tb.append("<tr><td width=\"90\"><a action=\"bypass -h custom_dobuff givebuffs " + targettype + " " + e.getKey() + " " + String.valueOf(cost) + "\">" + e.getKey() + "</a></td><td> Гонорар: " + String.valueOf(cost) + "</td></tr>"); } tb.append("</table>"); } tb.append("</body></html>"); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(tb.toString()); sendHtmlMessage(player, html); } /** * Sends an html packet to player with Manage scheme menu info. This allows player to create/delete/clear schemes * * @param player */ private void showManageSchemeWindow(L2PcInstance player) { TextBuilder tb = new TextBuilder(); tb.append("<html><title>Управление профилями.</title>"); tb.append("<body><br>"); if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) == null || CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).isEmpty()) tb.append("<font color=\"LEVEL\">У вас отсутствуют профили бафов.</font><br>"); else { tb.append("<br><br><br><br>"); tb.append("<table>"); for (FastMap.Entry<String, FastList<L2Skill>> e = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).head(), end = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).tail(); (e = e.getNext()) != end;) { tb.append("<tr><td width=\"140\">" + e.getKey() + " (" + String.valueOf(CharSchemesTable.getInstance().getScheme(player.getObjectId(), e.getKey()).size()) + " skill(s))</td>"); tb.append("<td width=\"60\"><button value=\"Очистить\" action=\"bypass -h custom_dobuff clearscheme " + e.getKey() + "\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"); tb.append("<td width=\"60\"><button value=\"Удалить\" action=\"bypass -h custom_dobuff deletescheme " + e.getKey() + "\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); } } tb.append("<br><table width=240>"); tb.append("<tr><td><edit var=\"name\" width=120 height=15></td><td><button value=\"Создать\" action=\"bypass -h custom_dobuff createscheme $name\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"); tb.append("</table>"); tb.append("<br><font color=\"LEVEL\">Максимальное количество профилей - " + String.valueOf(PowerPakConfig.NPCBUFFER_MAX_SCHEMES) + "</font>"); tb.append("<br><br>"); tb.append("<a action=\"bypass -h custom_dobuff Chat 0\">Назад.</a>"); tb.append("</body></html>"); NpcHtmlMessage html = new NpcHtmlMessage(1); html.setHtml(tb.toString()); sendHtmlMessage(player, html); } /** * This sends an html packet to player with Edit Scheme Menu info. This allows player to edit each created scheme (add/delete skills) * * @param player * @param skill_group * @param scheme_key */ private void showEditSchemeWindow(L2PcInstance player, String skill_group, String scheme_key) { NpcHtmlMessage html = new NpcHtmlMessage(1); html.setFile(PARENT_DIR + "schememenu.htm"); html.replace("%typesframe%", getTypesFrame(scheme_key)); if (skill_group.equalsIgnoreCase("unselected")) { html.replace("%schemelistframe%", getPlayerSchemeListFrame(player, skill_group, scheme_key)); html.replace("%skilllistframe%", getGroupSkillListFrame(player, null, null)); html.replace("%myschemeframe%", getPlayerSkillListFrame(player, null, null)); } else { html.replace("%schemelistframe%", getPlayerSchemeListFrame(player, skill_group, scheme_key)); html.replace("%skilllistframe%", getGroupSkillListFrame(player, skill_group, scheme_key)); html.replace("%myschemeframe%", getPlayerSkillListFrame(player, skill_group, scheme_key)); } sendHtmlMessage(player, html); } /** * Returns a table with info about player's scheme list.<br> * If player scheme list is null, it returns a warning message */ private String getPlayerSchemeListFrame(L2PcInstance player, String skill_group, String scheme_key) { if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) == null || CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).isEmpty()) return "<br> Пожалуйста создайте хотя бы один профиль бафов."; else { if (skill_group == null) skill_group = "def"; if (scheme_key == null) scheme_key = "def"; TextBuilder tb = new TextBuilder(); tb.append("<table>"); int count = 0; for (FastMap.Entry<String, FastList<L2Skill>> e = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).head(), end = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).tail(); (e = e.getNext()) != end;) { if (count == 0) tb.append("<tr>"); tb.append("<td width=\"90\"><a action=\"bypass -h custom_dobuff editschemes " + skill_group + " " + e.getKey() + "\">" + e.getKey() + "</a></td>"); if (count == 3) { tb.append("</tr>"); count = 0; } count++; } if (!tb.toString().endsWith("</tr>")) tb.append("</tr>"); tb.append("</table>"); return tb.toString(); } } /** * @param player * @param skill_group * @param scheme_key * @return a table with info about skills stored in each skill_group */ private String getGroupSkillListFrame(L2PcInstance player, String skill_group, String scheme_key) { if (skill_group == null || skill_group == "unselected") return "Пожалуйста укажите группу бафов."; else if (scheme_key == null || scheme_key == "unselected") return "Пожалуйста укажите профиль бафов."; TextBuilder tb = new TextBuilder(); tb.append("<table>"); int count = 0; for (L2Skill sk : BufferSkillsTable.getInstance().getSkillsByType(skill_group)) { if (CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key) != null && !CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).isEmpty() && CharSchemesTable.getInstance().getSchemeContainsSkill(player.getObjectId(), scheme_key, sk.getId())) continue; if (count == 0) tb.append("<tr>"); tb.append("<td width=\"100\"><a action=\"bypass -h custom_dobuff skillselect " + skill_group + " " + scheme_key + " " + String.valueOf(sk.getId()) + "\">" + sk.getName() + " (" + String.valueOf(sk.getLevel()) + ")</a></td>"); if (count == 3) { tb.append("</tr>"); count = -1; } count++; } if (!tb.toString().endsWith("</tr>")) tb.append("</tr>"); tb.append("</table>"); return tb.toString(); } /** * @param player * @param skill_group * @param scheme_key * @return a table with info about selected skills */ private String getPlayerSkillListFrame(L2PcInstance player, String skill_group, String scheme_key) { if (skill_group == null || skill_group == "unselected") return "<br>Пожалуйста выберите группу бафов."; else if (scheme_key == null || scheme_key == "unselected") return "<br>Пожалуйста укажите группу бафов."; if (CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key) == null) return "Пожалуйста укажите профиль бафов."; if (CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).isEmpty()) return "Профиль пустой."; TextBuilder tb = new TextBuilder(); tb.append("Профиль: " + scheme_key + "<br>"); tb.append("<table>"); int count = 0; for (L2Skill sk : CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key)) { if (count == 0) tb.append("<tr>"); tb.append("<td><a action=\"bypass -h custom_dobuff skillunselect " + skill_group + " " + scheme_key + " " + String.valueOf(sk.getId()) + "\">" + sk.getName() + "</a></td>"); count++; if (count == 3) { tb.append("</tr>"); count = 0; } } if (!tb.toString().endsWith("<tr>")) tb.append("<tr>"); tb.append("</table>"); return tb.toString(); } /** * @param scheme_key * @return an string with skill_groups table. */ private String getTypesFrame(String scheme_key) { TextBuilder tb = new TextBuilder(); tb.append("<table>"); int count = 0; if (scheme_key == null) scheme_key = "unselected"; for (String s : BufferSkillsTable.getInstance().getSkillsTypeList()) { if (count == 0) tb.append("<tr>"); tb.append("<td width=\"90\"><a action=\"bypass -h custom_dobuff editscheme " + s + " " + scheme_key + "\">" + s + "</a></td>"); if (count == 2) { tb.append("</tr>"); count = -1; } count++; } if (!tb.toString().endsWith("</tr>")) tb.append("</tr>"); tb.append("</table>"); return tb.toString(); } /** * @param list * @return fee for all skills contained in list. */ private int getFee(FastList<L2Skill> list) { int fee = 0; if (PowerPakConfig.NPCBUFFER_STATIC_BUFF_COST >= 0) return list.size() * PowerPakConfig.NPCBUFFER_STATIC_BUFF_COST; else { for (L2Skill sk : list) fee += BufferSkillsTable.getInstance().getSkillFee(sk.getId()); return fee; } } } Вот скрипт, где тут строка которая скидывает мне профиль сохраненных бафоф при входе в игру?)
  6. ошибок нету, у тебя аська есть? я бы показал через ТВ скрипты)
  7. Вообщем столкнулся с проблемой, есть баффер с профилями, создаю профиль всё кул(Профиль сохраняется в БД character_skill_save), выхожу из игры захожу в игру тоже всё нормально, делаю рестарт сервера захожу в БД профиль всё еще остался, и как только чар оказывается в игре профиль пропадает, как сделать чтоб он не пропадал?
  8. Closer

    Не Видно Пухи

    ты айдишники походу перепутал))
  9. Closer

    Не Видно Пухи

    да, пишет неизвестный итем у персонажа 268478291
  10. Closer

    Не Видно Пухи

    в гейм сервере ошибок нету? при запуске? айдишники правильно вписал?
  11. Closer

    Не Видно Пухи

    а с чего ты взял что дело в статах?
  12. Closer

    Не Видно Пухи

    Статы вроде никак не влияют на это) <item id="10001" name="Anthares Fighter"> <for> <set val='562' order='0x08' stat='pAtk'/> <set val='132' order='0x08' stat='mAtk'/> <set val='8' order='0x08' stat='rCrit'/> <add val='0' order='0x10' stat='accCombat'/> <set val='379' order='0x08' stat='pAtkSpd'/> <mul order="0x30" stat="pAtk" val="1.05"/> <enchant val='0' order='0x0C' stat='pAtk'/> <enchant val='0' order='0x0C' stat='mAtk'/> </for> </item> Попробуй так написать
  13. в бд в таблите etcitem (consume_type) поставь stackable
  14. компилированые файлы с расширением "класс" и лежат в ядре сборки
×
×
  • Создать...