08-10-2011, 11:45 PM
Может кто сказать есть ли тут разрешение на продажу в Community Board не только гму?
Фаил этот MultiSellChoose
вот он сам =>
Не могу найти Java код на разшение продажи в Community Board Shop ,чтоб продавало не только гму.
Нашёл этот код в сборке Legacy[xCore]Server Rev.5 ,там в комунке можно покупать обычным игроком .Вот хочу выдрать етот код чтоб можно было покупать не только Гмом .Только незнаю где он тут имено ,так как не знаю Java( .
Кто хорошо знает Java помогите плиз.
Или скажите де вопше надо копать чтоб можно было покупать в комунке не только гмом.
Фаил этот MultiSellChoose
вот он сам =>
Открыть
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.Config;
import com.l2jserver.gameserver.datatables.MultiSell;
import com.l2jserver.gameserver.model.*;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Castle;
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
import com.l2jserver.gameserver.model.multisell.*;
import com.l2jserver.gameserver.network.L2GameClient;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.*;
import com.l2jserver.gameserver.util.FloodProtectorAction;
import com.l2jserver.gameserver.util.FloodProtectors;
import java.util.*;
import java.util.logging.Logger;
import javolution.util.FastList;
// Referenced classes of package com.l2jserver.gameserver.network.clientpackets:
// L2GameClientPacket
public class MultiSellChoose extends L2GameClientPacket
{
public MultiSellChoose()
{
}
protected void readImpl()
{
_listId = readD();
_entryId = readD();
_amount = readQ();
}
public void runImpl()
{
L2PcInstance player;
PreparedListContainer list;
L2Npc target;
Entry entry;
PcInventory inv;
FastList augmentation;
Elementals elemental[];
player = ((L2GameClient)getClient()).getActiveChar();
if(player == null)
return;
if(!((L2GameClient)getClient()).getFloodProtectors().getMultiSell().tryPerformAction("multisell choose"))
{
player.setMultiSell(null);
return;
}
if(_amount < 1L || _amount > 5000L)
{
player.setMultiSell(null);
return;
}
list = player.getMultiSell();
if(list == null || list.getListId() != _listId)
{
player.setMultiSell(null);
return;
}
target = player.getLastFolkNPC();
Iterator i$ = list.getEntries().iterator();
do
{
if(!i$.hasNext())
break MISSING_BLOCK_LABEL_1821;
entry = (Entry)i$.next();
} while(entry.getEntryId() != _entryId);
if(!entry.isStackable() && _amount > 1L)
{
_log.severe((new StringBuilder()).append("Character: ").append(player.getName()).append(" is trying to set amount > 1 on non-stackable multisell, id:").append(_listId).append(":").append(_entryId).toString());
player.setMultiSell(null);
return;
}
inv = player.getInventory();
int slots = 0;
int weight = 0;
Iterator i$ = entry.getProducts().iterator();
do
{
if(!i$.hasNext())
break;
Ingredient e = (Ingredient)i$.next();
if(e.getItemId() >= 0)
{
if(!e.isStackable())
slots = (int)((long)slots + e.getItemCount() * _amount);
else
if(player.getInventory().getItemByItemId(e.getItemId()) == null)
slots++;
weight = (int)((long)weight + e.getItemCount() * _amount * (long)e.getWeight());
}
} while(true);
if(!inv.validateWeight(weight))
{
player.sendPacket(new SystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED));
return;
}
if(!inv.validateCapacity(slots))
{
player.sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
return;
}
ArrayList ingredientsList = new ArrayList(entry.getIngredients().size());
Iterator i$ = entry.getIngredients().iterator();
do
{
if(!i$.hasNext())
break;
Ingredient e = (Ingredient)i$.next();
boolean newIng = true;
int i = ingredientsList.size();
do
{
if(--i < 0)
break;
Ingredient ex = (Ingredient)ingredientsList.get(i);
if(ex.getItemId() != e.getItemId() || ex.getEnchantLevel() != e.getEnchantLevel())
continue;
if(ex.getItemCount() + e.getItemCount() > 0x7fffffffL)
{
player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
return;
}
Ingredient ing = ex.clone();
ing.setItemCount(ex.getItemCount() + e.getItemCount());
ingredientsList.set(i, ing);
newIng = false;
break;
} while(true);
if(newIng)
ingredientsList.add(e);
} while(true);
for(i$ = ingredientsList.iterator(); i$.hasNext()
{
Ingredient e = (Ingredient)i$.next();
if(e.getItemCount() * _amount > 0x7fffffffL)
{
player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
return;
}
if(e.getItemId() < 0)
{
if(!MultiSell.checkSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
return;
} else
{
long required = !Config.ALT_BLACKSMITH_USE_RECIPES && e.getMaintainIngredient() ? e.getItemCount() : e.getItemCount() * _amount;
if(inv.getInventoryItemCount(e.getItemId(), list.getMaintainEnchantment() ? e.getEnchantLevel() : -1, false) < required)
{
SystemMessage sm = new SystemMessage(SystemMessageId.S2_UNIT_OF_THE_ITEM_S1_REQUIRED);
sm.addItemName(e.getTemplate());
sm.addNumber((int)required);
player.sendPacket(sm);
return;
}
}
}
augmentation = FastList.newInstance();
elemental = null;
Iterator i$ = entry.getIngredients().iterator();
_L2:
Ingredient e;
if(!i$.hasNext())
break; /* Loop/switch isn't completed */
e = (Ingredient)i$.next();
if(e.getItemId() < 0)
{
if(!MultiSell.getSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
{
FastList.recycle(augmentation);
return;
}
continue; /* Loop/switch isn't completed */
}
L2ItemInstance itemToTake;
itemToTake = inv.getItemByItemId(e.getItemId());
if(itemToTake != null)
continue; /* Loop/switch isn't completed */
_log.severe((new StringBuilder()).append("Character: ").append(player.getName()).append(" is trying to cheat in multisell, id:").append(_listId).append(":").append(_entryId).toString());
player.setMultiSell(null);
FastList.recycle(augmentation);
return;
if(!Config.ALT_BLACKSMITH_USE_RECIPES && e.getMaintainIngredient()) goto _L2; else goto _L1
_L1:
if(!itemToTake.isStackable())
break MISSING_BLOCK_LABEL_1021;
if(player.destroyItem("Multisell", itemToTake.getObjectId(), e.getItemCount() * _amount, player.getTarget(), true))
continue; /* Loop/switch isn't completed */
player.setMultiSell(null);
FastList.recycle(augmentation);
return;
L2ItemInstance inventoryContents[];
int i;
if(!list.getMaintainEnchantment())
break MISSING_BLOCK_LABEL_1155;
inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
i = 0;
_L3:
if((long)i >= e.getItemCount() * _amount)
continue; /* Loop/switch isn't completed */
if(inventoryContents[i].isAugmented())
augmentation.add(inventoryContents[i].getAugmentation());
if(inventoryContents[i].getElementals() != null)
elemental = inventoryContents[i].getElementals();
if(player.destroyItem("Multisell", inventoryContents[i].getObjectId(), 1L, player.getTarget(), true))
break MISSING_BLOCK_LABEL_1146;
player.setMultiSell(null);
FastList.recycle(augmentation);
return;
i++;
goto _L3
int i = 1;
_L4:
if((long)i > e.getItemCount() * _amount)
continue; /* Loop/switch isn't completed */
L2ItemInstance inventoryContents[] = inv.getAllItemsByItemId(e.getItemId(), false);
itemToTake = inventoryContents[0];
if(itemToTake.getEnchantLevel() > 0)
{
L2ItemInstance arr$[] = inventoryContents;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; i$++)
{
L2ItemInstance item = arr$[i$];
if(item.getEnchantLevel() >= itemToTake.getEnchantLevel())
continue;
itemToTake = item;
if(itemToTake.getEnchantLevel() == 0)
break;
}
}
if(player.destroyItem("Multisell", itemToTake.getObjectId(), 1L, player.getTarget(), true))
break MISSING_BLOCK_LABEL_1293;
player.setMultiSell(null);
FastList.recycle(augmentation);
return;
i++;
goto _L4
if(true) goto _L2; else goto _L5
_L5:
for(i$ = entry.getProducts().iterator(); i$.hasNext()
{
e = (Ingredient)i$.next();
if(e.getItemId() < 0)
{
MultiSell.addSpecialProduct(e.getItemId(), e.getItemCount() * _amount, player);
} else
{
if(e.isStackable())
{
inv.addItem("Multisell", e.getItemId(), e.getItemCount() * _amount, player, player.getTarget());
} else
{
L2ItemInstance product = null;
for(i = 0; (long)i < e.getItemCount() * _amount; i++)
{
product = inv.addItem("Multisell", e.getItemId(), 1L, player, player.getTarget());
if(!list.getMaintainEnchantment())
continue;
if(i < augmentation.size())
product.setAugmentation(new L2Augmentation(((L2Augmentation)augmentation.get(i)).getAugmentationId(), ((L2Augmentation)augmentation.get(i)).getSkill()));
if(elemental != null)
{
Elementals arr$[] = elemental;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; i$++)
{
Elementals elm = arr$[i$];
product.setElementAttr(elm.getElement(), elm.getValue());
}
}
product.setEnchantLevel(e.getEnchantLevel());
product.updateDatabase();
}
}
if(e.getItemCount() * _amount > 1L)
{
SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
sm.addItemName(e.getItemId());
sm.addItemNumber(e.getItemCount() * _amount);
player.sendPacket(sm);
sm = null;
} else
{
SystemMessage sm;
if(list.getMaintainEnchantment() && e.getEnchantLevel() > 0)
{
sm = new SystemMessage(SystemMessageId.ACQUIRED_S1_S2);
sm.addItemNumber(e.getEnchantLevel());
sm.addItemName(e.getItemId());
} else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
sm.addItemName(e.getItemId());
}
player.sendPacket(sm);
sm = null;
}
}
}
player.sendPacket(new ItemList(player, false));
StatusUpdate su = new StatusUpdate(player);
su.addAttribute(14, player.getCurrentLoad());
player.sendPacket(su);
su = null;
FastList.recycle(augmentation);
break MISSING_BLOCK_LABEL_1788;
Exception exception;
exception;
FastList.recycle(augmentation);
throw exception;
if(entry.getTaxAmount() > 0L)
target.getCastle().addToTreasury(entry.getTaxAmount() * _amount);
}
public String getType()
{
return "[C] A7 MultiSellChoose";
}
private static final String _C__A7_MULTISELLCHOOSE = "[C] A7 MultiSellChoose";
private static Logger _log = Logger.getLogger(com/l2jserver/gameserver/network/clientpackets/MultiSellChoose.getName());
private int _listId;
private int _entryId;
private long _amount;
}
import com.l2jserver.Config;
import com.l2jserver.gameserver.datatables.MultiSell;
import com.l2jserver.gameserver.model.*;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Castle;
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
import com.l2jserver.gameserver.model.multisell.*;
import com.l2jserver.gameserver.network.L2GameClient;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.*;
import com.l2jserver.gameserver.util.FloodProtectorAction;
import com.l2jserver.gameserver.util.FloodProtectors;
import java.util.*;
import java.util.logging.Logger;
import javolution.util.FastList;
// Referenced classes of package com.l2jserver.gameserver.network.clientpackets:
// L2GameClientPacket
public class MultiSellChoose extends L2GameClientPacket
{
public MultiSellChoose()
{
}
protected void readImpl()
{
_listId = readD();
_entryId = readD();
_amount = readQ();
}
public void runImpl()
{
L2PcInstance player;
PreparedListContainer list;
L2Npc target;
Entry entry;
PcInventory inv;
FastList augmentation;
Elementals elemental[];
player = ((L2GameClient)getClient()).getActiveChar();
if(player == null)
return;
if(!((L2GameClient)getClient()).getFloodProtectors().getMultiSell().tryPerformAction("multisell choose"))
{
player.setMultiSell(null);
return;
}
if(_amount < 1L || _amount > 5000L)
{
player.setMultiSell(null);
return;
}
list = player.getMultiSell();
if(list == null || list.getListId() != _listId)
{
player.setMultiSell(null);
return;
}
target = player.getLastFolkNPC();
Iterator i$ = list.getEntries().iterator();
do
{
if(!i$.hasNext())
break MISSING_BLOCK_LABEL_1821;
entry = (Entry)i$.next();
} while(entry.getEntryId() != _entryId);
if(!entry.isStackable() && _amount > 1L)
{
_log.severe((new StringBuilder()).append("Character: ").append(player.getName()).append(" is trying to set amount > 1 on non-stackable multisell, id:").append(_listId).append(":").append(_entryId).toString());
player.setMultiSell(null);
return;
}
inv = player.getInventory();
int slots = 0;
int weight = 0;
Iterator i$ = entry.getProducts().iterator();
do
{
if(!i$.hasNext())
break;
Ingredient e = (Ingredient)i$.next();
if(e.getItemId() >= 0)
{
if(!e.isStackable())
slots = (int)((long)slots + e.getItemCount() * _amount);
else
if(player.getInventory().getItemByItemId(e.getItemId()) == null)
slots++;
weight = (int)((long)weight + e.getItemCount() * _amount * (long)e.getWeight());
}
} while(true);
if(!inv.validateWeight(weight))
{
player.sendPacket(new SystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED));
return;
}
if(!inv.validateCapacity(slots))
{
player.sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
return;
}
ArrayList ingredientsList = new ArrayList(entry.getIngredients().size());
Iterator i$ = entry.getIngredients().iterator();
do
{
if(!i$.hasNext())
break;
Ingredient e = (Ingredient)i$.next();
boolean newIng = true;
int i = ingredientsList.size();
do
{
if(--i < 0)
break;
Ingredient ex = (Ingredient)ingredientsList.get(i);
if(ex.getItemId() != e.getItemId() || ex.getEnchantLevel() != e.getEnchantLevel())
continue;
if(ex.getItemCount() + e.getItemCount() > 0x7fffffffL)
{
player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
return;
}
Ingredient ing = ex.clone();
ing.setItemCount(ex.getItemCount() + e.getItemCount());
ingredientsList.set(i, ing);
newIng = false;
break;
} while(true);
if(newIng)
ingredientsList.add(e);
} while(true);
for(i$ = ingredientsList.iterator(); i$.hasNext()
{
Ingredient e = (Ingredient)i$.next();
if(e.getItemCount() * _amount > 0x7fffffffL)
{
player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
return;
}
if(e.getItemId() < 0)
{
if(!MultiSell.checkSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
return;
} else
{
long required = !Config.ALT_BLACKSMITH_USE_RECIPES && e.getMaintainIngredient() ? e.getItemCount() : e.getItemCount() * _amount;
if(inv.getInventoryItemCount(e.getItemId(), list.getMaintainEnchantment() ? e.getEnchantLevel() : -1, false) < required)
{
SystemMessage sm = new SystemMessage(SystemMessageId.S2_UNIT_OF_THE_ITEM_S1_REQUIRED);
sm.addItemName(e.getTemplate());
sm.addNumber((int)required);
player.sendPacket(sm);
return;
}
}
}
augmentation = FastList.newInstance();
elemental = null;
Iterator i$ = entry.getIngredients().iterator();
_L2:
Ingredient e;
if(!i$.hasNext())
break; /* Loop/switch isn't completed */
e = (Ingredient)i$.next();
if(e.getItemId() < 0)
{
if(!MultiSell.getSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
{
FastList.recycle(augmentation);
return;
}
continue; /* Loop/switch isn't completed */
}
L2ItemInstance itemToTake;
itemToTake = inv.getItemByItemId(e.getItemId());
if(itemToTake != null)
continue; /* Loop/switch isn't completed */
_log.severe((new StringBuilder()).append("Character: ").append(player.getName()).append(" is trying to cheat in multisell, id:").append(_listId).append(":").append(_entryId).toString());
player.setMultiSell(null);
FastList.recycle(augmentation);
return;
if(!Config.ALT_BLACKSMITH_USE_RECIPES && e.getMaintainIngredient()) goto _L2; else goto _L1
_L1:
if(!itemToTake.isStackable())
break MISSING_BLOCK_LABEL_1021;
if(player.destroyItem("Multisell", itemToTake.getObjectId(), e.getItemCount() * _amount, player.getTarget(), true))
continue; /* Loop/switch isn't completed */
player.setMultiSell(null);
FastList.recycle(augmentation);
return;
L2ItemInstance inventoryContents[];
int i;
if(!list.getMaintainEnchantment())
break MISSING_BLOCK_LABEL_1155;
inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
i = 0;
_L3:
if((long)i >= e.getItemCount() * _amount)
continue; /* Loop/switch isn't completed */
if(inventoryContents[i].isAugmented())
augmentation.add(inventoryContents[i].getAugmentation());
if(inventoryContents[i].getElementals() != null)
elemental = inventoryContents[i].getElementals();
if(player.destroyItem("Multisell", inventoryContents[i].getObjectId(), 1L, player.getTarget(), true))
break MISSING_BLOCK_LABEL_1146;
player.setMultiSell(null);
FastList.recycle(augmentation);
return;
i++;
goto _L3
int i = 1;
_L4:
if((long)i > e.getItemCount() * _amount)
continue; /* Loop/switch isn't completed */
L2ItemInstance inventoryContents[] = inv.getAllItemsByItemId(e.getItemId(), false);
itemToTake = inventoryContents[0];
if(itemToTake.getEnchantLevel() > 0)
{
L2ItemInstance arr$[] = inventoryContents;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; i$++)
{
L2ItemInstance item = arr$[i$];
if(item.getEnchantLevel() >= itemToTake.getEnchantLevel())
continue;
itemToTake = item;
if(itemToTake.getEnchantLevel() == 0)
break;
}
}
if(player.destroyItem("Multisell", itemToTake.getObjectId(), 1L, player.getTarget(), true))
break MISSING_BLOCK_LABEL_1293;
player.setMultiSell(null);
FastList.recycle(augmentation);
return;
i++;
goto _L4
if(true) goto _L2; else goto _L5
_L5:
for(i$ = entry.getProducts().iterator(); i$.hasNext()
{
e = (Ingredient)i$.next();
if(e.getItemId() < 0)
{
MultiSell.addSpecialProduct(e.getItemId(), e.getItemCount() * _amount, player);
} else
{
if(e.isStackable())
{
inv.addItem("Multisell", e.getItemId(), e.getItemCount() * _amount, player, player.getTarget());
} else
{
L2ItemInstance product = null;
for(i = 0; (long)i < e.getItemCount() * _amount; i++)
{
product = inv.addItem("Multisell", e.getItemId(), 1L, player, player.getTarget());
if(!list.getMaintainEnchantment())
continue;
if(i < augmentation.size())
product.setAugmentation(new L2Augmentation(((L2Augmentation)augmentation.get(i)).getAugmentationId(), ((L2Augmentation)augmentation.get(i)).getSkill()));
if(elemental != null)
{
Elementals arr$[] = elemental;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; i$++)
{
Elementals elm = arr$[i$];
product.setElementAttr(elm.getElement(), elm.getValue());
}
}
product.setEnchantLevel(e.getEnchantLevel());
product.updateDatabase();
}
}
if(e.getItemCount() * _amount > 1L)
{
SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
sm.addItemName(e.getItemId());
sm.addItemNumber(e.getItemCount() * _amount);
player.sendPacket(sm);
sm = null;
} else
{
SystemMessage sm;
if(list.getMaintainEnchantment() && e.getEnchantLevel() > 0)
{
sm = new SystemMessage(SystemMessageId.ACQUIRED_S1_S2);
sm.addItemNumber(e.getEnchantLevel());
sm.addItemName(e.getItemId());
} else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
sm.addItemName(e.getItemId());
}
player.sendPacket(sm);
sm = null;
}
}
}
player.sendPacket(new ItemList(player, false));
StatusUpdate su = new StatusUpdate(player);
su.addAttribute(14, player.getCurrentLoad());
player.sendPacket(su);
su = null;
FastList.recycle(augmentation);
break MISSING_BLOCK_LABEL_1788;
Exception exception;
exception;
FastList.recycle(augmentation);
throw exception;
if(entry.getTaxAmount() > 0L)
target.getCastle().addToTreasury(entry.getTaxAmount() * _amount);
}
public String getType()
{
return "[C] A7 MultiSellChoose";
}
private static final String _C__A7_MULTISELLCHOOSE = "[C] A7 MultiSellChoose";
private static Logger _log = Logger.getLogger(com/l2jserver/gameserver/network/clientpackets/MultiSellChoose.getName());
private int _listId;
private int _entryId;
private long _amount;
}
Нашёл этот код в сборке Legacy[xCore]Server Rev.5 ,там в комунке можно покупать обычным игроком .Вот хочу выдрать етот код чтоб можно было покупать не только Гмом .Только незнаю где он тут имено ,так как не знаю Java( .
Кто хорошо знает Java помогите плиз.
Или скажите де вопше надо копать чтоб можно было покупать в комунке не только гмом.