-
Posts
518 -
Credits
0 -
Joined
-
Last visited
-
Days Won
31 -
Feedback
0%
Content Type
Articles
Profiles
Forums
Store
Everything posted by protoftw
-
Donation Npc / Item Market For L2Jfrozen
protoftw replied to claww's topic in Server Shares & Files [L2J]
so instead of inserting a new IF check should i change the URL name? im not capable of writing a new IF statement ...if u could do it it would be great if not thank you again for the time u've spent answering my questions :P i just deleted this whole part <img src=\"Icon."+str(icon)+"\" width=32 height=32> and now it's just without icons -
Donation Npc / Item Market For L2Jfrozen
protoftw replied to claww's topic in Server Shares & Files [L2J]
still not working...here's the result: https://postimg.org/image/grnshxnn1/ https://postimg.org/image/m014kei93/ url is not wrong bcs it works for the other options of the npc...the problem is in the code -
Donation Npc / Item Market For L2Jfrozen
protoftw replied to claww's topic in Server Shares & Files [L2J]
is that what u need?? https://postimg.org/image/4rh8bsm2h/ -
Donation Npc / Item Market For L2Jfrozen
protoftw replied to claww's topic in Server Shares & Files [L2J]
i have added all icons to that sql table but still..(also the first code uses that table in order to take icons) the first code: https://postimg.org/image/ypqfrgymr/ the second one: https://postimg.org/image/kz2vavu7z/ is it maybe that the first code is using inventory to get icons? and if yes how can i addapt the second code? -
Donation Npc / Item Market For L2Jfrozen
protoftw replied to claww's topic in Server Shares & Files [L2J]
1.My weapons and armors id's are between 9400 and 9900 2.The duration of the custom weapons and custom armors i've added is -1 3.The grade of armors/weapons is S GRADE. 4.Types of my weapons belong to the current one your code is asking. 5.The enchant of the weapons is more than 0. but still icons are black ..as i told u ..i can see the icons at (enchanter : where u add +1 enchant) but i cant see them when i try to transfer enchant or augmentation. -
hey guys i have a quick question for this npc: http://www.maxcheaters.com/topic/144148-donation-npc-item-market-for-l2jfrozen/.. The Donate Shop Npc...Npc works great but there's one problem ..Icons from customs items do not show to all the services from the npc .. For example npc has , enchanter ( add enchants to your equipment) , transfer enchant ( u know what this is..) When using enchanter ( to add +1 enchant for example ) icons are shown properly But, when using transfer enchant, icons are black!? can anyone help me with that? I can post u here both _init_py files. here's the right one where i can see all icons. import sys from java.lang import String from java.lang import Integer from com.l2jfrozen.util.random import Rnd from com.l2jfrozen.util.database import L2DatabaseFactory from com.l2jfrozen.gameserver.model.quest import State from com.l2jfrozen.gameserver.model.actor.instance import L2ItemInstance from com.l2jfrozen.gameserver.network.serverpackets import ItemList from com.l2jfrozen.gameserver.network.serverpackets import UserInfo from com.l2jfrozen.gameserver.network.serverpackets import CharInfo from com.l2jfrozen.gameserver.network.serverpackets import InventoryUpdate from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest Qn = "919_Enchanter" Npc = 300300 MaxEnchantWeapon = 25 MaxEnchantArmor = 25 MaxEnchantJewel = 25 Adena = 3488 # Donate coin (adena) ItemName = "Donate Coins" JPrice = [1,1,1,1,1,1] # Price for +1 Jewels (depends Jewels grade, ex. Wprice[0] = No Grade) APrice = [1,1,1,1,1,1] # Price for +1 Armors (depends Armors grade, ex. Wprice[0] = No Grade) WPrice = [2,2,2,2,2,2] # Price for +1 Weapons (depends Weapons grade, ex. Wprice[0] = No Grade) Jewel = ["None"] Armor = ["Light","Heavy","Magic"] Weapon = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt","Shield"] SlotForEnchant = [7,8,6,10,11,9,12,3,1,2,4,5] # editable [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] NoEnchantItem = [] print "Donate Manager: Loaded 40%" def getItemIcon(ItemId): con=L2DatabaseFactory.getInstance().getConnection() II=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") II.setInt(1, ItemId) rs=II.executeQuery() ItemIcon = "" if rs.next() : ItemIcon = rs.getString("itemIcon") else : ItemIcon = "icon.etc_adena_i00" try : con.close() except : pass return ItemIcon def validateItem(ItemId) : for itm in NoEnchantItem : if itm == ItemId : return False return True def getHexSlot(Slot) : if Slot == 0 : return 0x01 elif Slot == 1 : # Left Earring return 0x04 elif Slot == 2 : # Right Earring return 0x02 elif Slot == 3 : # Neck return 0x08 elif Slot == 4 : # Left Ring return 0x20 elif Slot == 5 : # Right Ring return 0x10 elif Slot == 6 : # Helmet return 0x40 elif Slot == 7 : # Left Hand return 0x80 elif Slot == 8 : # Right Hand return 0x0100 elif Slot == 9 : # Gloves return 0x0200 elif Slot == 10 : # Breastplate return 0x0400 elif Slot == 11 : # Gaiters return 0x0800 elif Slot == 12 : # Boots return 0x1000 elif Slot == 13 : # return 0x2000 elif Slot == 14 : # R/L Finger return 0x4000 elif Slot == 15 : # return 0x040000 elif Slot == 16 : # return 0x010000 elif Slot == 17 : # return 0x080000 return 0x00 class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onTalk (Self,npc,player) : st = player.getQuestState(Qn) npcId = npc.getNpcId() htmltext = u"<html><title>Donate Shop</title><body><center>Error!</center></body></html>" if not st : return htmltext htmltext = "<html><body><font color=LEVEL>Add +1 Enchant to your equipment</font><br1>Cost: 1 Donate Coin [Armor,Jewels]<br1> Cost: 2 Donate Coins [Weapon]" for Slot in SlotForEnchant : Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(Slot)) if Item1 != None : if validateItem(Item1.getItemId()) : Grade = Item1.getItem().getCrystalType() if Grade not in [0] : if Grade == 1: pgrade = str("[D]") elif Grade == 2: pgrade = str("[C]") elif Grade == 3: pgrade = str("[B]") elif Grade == 4: pgrade = str("[A]") elif Grade == 5: pgrade = str("[S]") else: pgrade = str("") htmltext = htmltext + "<img src=\"" + getItemIcon(Item1.getItemId()) + "\" width=32 height=32><a action=\"bypass -h Quest 919_Enchanter slot_" + str(Slot) + "\">" + Item1.getItemName() + " " + str(pgrade) + " +" + str(Item1.getEnchantLevel()) + "</a><br>" htmltext = htmltext + "</body></html>" return htmltext def onAdvEvent (self,event,npc,player) : st = player.getQuestState(Qn) htmltext = u"<html><title>Donate Shop</title><body><center>Error!</center></body></html>" if not st : return htmltext strEvent = String(event) if strEvent.startsWith("slot") : intEvent = Integer.parseInt(strEvent.substring(5)) htmltext = "<html><title>Donate Shop</title><body><br>" Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(intEvent)) if Item1 != None : if validateItem(Item1.getItemId()) : ItemEnchant = Item1.getEnchantLevel() htmltext = htmltext + "<img src=\"" + getItemIcon(Item1.getItemId()) + "\" width=32 height=32><br>" htmltext = htmltext + u"" + Item1.getItemName() + " +" + str(ItemEnchant) + "<br>" Grade = Item1.getItem().getCrystalType() Itype = str(Item1.getItemType()) if Itype in Jewel and ItemEnchant < MaxEnchantJewel : if ItemEnchant < MaxEnchantJewel : htmltext = htmltext + u"Add 1 enchant = " + str(JPrice[Grade]) + " " + ItemName + "<br>" if ItemEnchant < MaxEnchantJewel : htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusone_" + str(intEvent) + u"\">Add +1 enchant!</a><br>" elif Itype in Armor and ItemEnchant < MaxEnchantArmor : if ItemEnchant < MaxEnchantArmor : htmltext = htmltext + u"Add 1 enchant = " + str(APrice[Grade]) + " " + ItemName + "<br>" if ItemEnchant < MaxEnchantArmor : htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusone_" + str(intEvent) + u"\">Add +1 enchant!</a><br>" elif Itype in Weapon and ItemEnchant < MaxEnchantWeapon : if ItemEnchant < MaxEnchantWeapon : htmltext = htmltext + u"Add 1 enchant = " + str(WPrice[Grade]) + " " + ItemName + "<br>" if ItemEnchant < MaxEnchantWeapon : htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusone_" + str(intEvent) + u"\">Add +1 enchant!</a><br>" elif Itype in Weapon and ItemEnchant >= MaxEnchantWeapon : if ItemEnchant >= MaxEnchantWeapon : htmltext = htmltext + "<br><br><br><br><br> You can't enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" else : htmltext = htmltext + "<br><br><br><br><br> You can't enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" else : htmltext = htmltext + u"Your item is not equiped! Check it!<br><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br></center><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=256 height=32>" elif strEvent.startsWith("plusone") : intEvent = Integer.parseInt(strEvent.substring(8)) htmltext = "<html><title>Donate Shop</title><body><br>" Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(intEvent)) if Item1 != None : if validateItem(Item1.getItemId()) : Grade = Item1.getItem().getCrystalType() if Grade not in [0] : ItemEnchant = Item1.getEnchantLevel() Itype = str(Item1.getItemType()) if Itype in Jewel : if ItemEnchant < MaxEnchantJewel : iu = InventoryUpdate() player.sendPacket(iu) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) if st.getQuestItemsCount(Adena) >= JPrice[Grade]: st.takeItems(Adena,JPrice[Grade]) Item1.setEnchantLevel(ItemEnchant+1) ItemEnchant = Item1.getEnchantLevel() st.playSound("ItemSound.quest_itemget") player.sendPacket(ItemList(player,False)) htmltext = htmltext + u"<br>Your jewel was successfully enchanted to + " + str(ItemEnchant) + "</font>!<br>" else : htmltext = htmltext + u"You need <font color=LEVEL>" + str(JPrice[Grade]) + "</font> " + ItemName + " to do that!" # player donate items < to be enchanted else : htmltext = htmltext + u"<br> You cant enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" # in case before add enchant the player is enchant manualy his weap from 19 to 20 and then trying to click enchant elif Itype in Armor : if ItemEnchant < MaxEnchantArmor : iu = InventoryUpdate() player.sendPacket(iu) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) if st.getQuestItemsCount(Adena) >= APrice[Grade]: st.takeItems(Adena,APrice[Grade]) Item1.setEnchantLevel(ItemEnchant+1) ItemEnchant = Item1.getEnchantLevel() st.playSound("ItemSound.quest_itemget") player.sendPacket(ItemList(player,False)) htmltext = htmltext + u"<br>Your armor was successfully enchanted to + " + str(ItemEnchant) + "</font>!<br><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br></center><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=256 height=32>" else : htmltext = htmltext + u"You need <font color=LEVEL>" + str(JPrice[Grade]) + "</font> " + ItemName + " to do that!" # player donate items < to be enchanted else : htmltext = htmltext + u"<br> You cant enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" # in case before add enchant the player is enchant manualy his weap from 19 to 20 and then trying to click enchant elif Itype in Weapon : if ItemEnchant < MaxEnchantWeapon : iu = InventoryUpdate() player.sendPacket(iu) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) if st.getQuestItemsCount(Adena) >= WPrice[Grade]: st.takeItems(Adena,WPrice[Grade]) Item1.setEnchantLevel(ItemEnchant+1) ItemEnchant = Item1.getEnchantLevel() st.playSound("ItemSound.quest_itemget") player.sendPacket(ItemList(player,False)) htmltext = htmltext + u"<br>Your weapon was successfully enchanted to + " + str(ItemEnchant) + "</font>!<br>" else : htmltext = htmltext + u"You need <font color=LEVEL>" + str(WPrice[Grade]) + "</font> " + ItemName + " to do that!<br>" # player donate items < to be enchanted else : htmltext = htmltext + u"<br> You cant enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" # in case before add enchant the player is enchant manualy his weap from 19 to 20 and then trying to click enchant else : htmltext = htmltext + u"Error, i accept only 3 types : Weapon,Armor,Jewel!<br>" #unknown else : htmltext = htmltext + u"Your current weapon's grade is different!<br>" #in case that the player before add enchant, change weapon to no-weapon type else : htmltext = htmltext + u"Error, Your weapon not found!<br>" #unknown else : htmltext = htmltext + u"" htmltext = htmltext + "Your item not found! try again!</body></html>" return htmltext QUEST = Quest(919,Qn,"custom") CREATED = State('Start', QUEST) STARTING = State('Starting', QUEST) STARTED = State('Started', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(300300) QUEST.addTalkId(300300) and here's the one where icons appear black import sys from java.lang import System from com.l2jfrozen.util.database import L2DatabaseFactory from com.l2jfrozen.gameserver.model.quest import State from com.l2jfrozen.gameserver.model.quest import QuestState from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest from com.l2jfrozen.gameserver.network.serverpackets import CharInfo from com.l2jfrozen.gameserver.network.serverpackets import InventoryUpdate from com.l2jfrozen.gameserver.network.serverpackets import ItemList from com.l2jfrozen.gameserver.network.serverpackets import UserInfo from com.l2jfrozen.gameserver.templates import L2Item qn = "q8015_Enchex" #id νοφ NPC = 300300 #id θςεμΰ δλ ηΰςξχκθ ITEM = 3488 #ρςξθμξρςό ηΰςξχκθ ηΰ κΰζδϋι + COST =100 #νΰηβΰνθε θςεμΰ INAME = "Donate Coins" #ροθρξκ ηΰοπεωεννϋυ θςεμξβ FORBIDDEN = [12,132,6611,6612,6620,6617,6619,6618,6621,6614,6616] print "Donate Manager: Loaded 100%" print "Lineage 2: Donate Manager NPC LOADED" class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onAdvEvent (self,event,npc,player): st = player.getQuestState(qn) if event == "spisok": htmltext = "<html><body><center><br1>" htmltext += u"<table width=260><tr><td align=center><font color=LEVEL>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438</font></td></tr></table>" htmltext += u"<button value=\"Weapon [S]\" action=\"bypass -h Quest q8015_Enchex step1_0\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"><br>" htmltext += u"<button value=\"Armor [S]\" action=\"bypass -h Quest q8015_Enchex step1_1\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"><br>" htmltext += u"<button value=\"Jewels [S]\" action=\"bypass -h Quest q8015_Enchex jewerly\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"><br>" htmltext += "<center><br></center></body></html>" elif event.startswith("step1_"): itemType = int(event.replace("step1_", "")) htmltext = u"<html><center><body><br>Select the item you wish to remove the enchant!<br><br></center><table width=300>" if itemType == 0: TYPES = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"] elif itemType == 1: TYPES = ["Light","Heavy","Magic"] else: htmltext = u"<html><body></body></html>" return htmltext st.set("type",str(itemType)) for Item in st.getPlayer().getInventory().getItems(): itemTemplate = Item.getItem() idtest = Item.getItemId() itype = str(Item.getItemType()) grade = itemTemplate.getCrystalType() if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itype in TYPES and Item.getEnchantLevel() > 0: con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "D", 2: "C", 3: "B", 4: "A", 5: "S"} pgrade = grades.get(grade, str("")) if Item.getEnchantLevel() == 0: enchant = str("") else: enchant = " +"+str(Item.getEnchantLevel())+"" htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step1next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + " ["+str(pgrade)+"] " + enchant + "</a></td></tr>" except : try : listitems.close() except : pass try : con.close() except : pass htmltext += u"</table><center></center><br></body></html>" elif event == "jewerly": htmltext = u"<html><center><body><br>Select the item you wish to remove the enchant!<br><br></center><table width=300>" st.set("type","3") for Item in st.getPlayer().getInventory().getItems(): itemTemplate = Item.getItem() idtest = Item.getItemId() itemType = Item.getItem().getType2() grade = itemTemplate.getCrystalType() if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itemType == L2Item.TYPE2_ACCESSORY and Item.getEnchantLevel() > 0: con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "D", 2: "C", 3: "B", 4: "A", 5: "S"} pgrade = grades.get(grade, str("")) if Item.getEnchantLevel() == 0: enchant = str("") else: enchant = " +"+str(Item.getEnchantLevel())+"" htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step1next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + " ["+str(pgrade)+"] " + enchant + "</a></td></tr>" except : try : listitems.close() except : pass try : con.close() except : pass htmltext += u"</table><center></center><br></body></html>" elif event.startswith("step1next_"): itemObjId = int(event.replace("step1next_", "")) Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId) itemTemplate = Item.getItem() if Item and itemTemplate.getDuration() == -1 and Item.getEnchantLevel() > 0: grade = itemTemplate.getCrystalType() idtest = Item.getItemId() con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : st.set("enchant",str(Item.getEnchantLevel())) st.set("oneitem",str(itemObjId)) grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"} pgrade = grades.get(grade, str("")) enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("") htmltext = u"<html><body><center><br>This item after the transfer<br1>will <font color=LEVEL>NOT</font> gain the enchantment value of the next item.<br>Will be <font color=LEVEL>+0</font>!</center><br>" htmltext += "<table width=300><tr><td><center><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></center></td></tr></table><br><br>" payment = int(Item.getEnchantLevel()*COST) if st.getQuestItemsCount(ITEM) < payment: htmltext += u"<center>You need <font color=ff2400>"+str(payment)+"</font> "+INAME+" for this tranfer!<br>" else: htmltext += u"<center>The cost will be : <font color=adff2f>"+str(payment)+"</font> "+INAME+"</center><br>" htmltext += u"<center><button value=\"Select the next item\" action=\"bypass -h Quest q8015_Enchex step2\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></center><br>" htmltext += u"<br><a action=\"bypass -h Quest q8015_Enchex spisok\"><center>Back<br><center></center></a></body></html>" except : try : listitems.close() except : pass try : con.close() except : pass else : htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>" elif event == "step2": htmltext = u"<html><body><center><br><br>Choose the item you want to transfer the enchant!<br><font color=LEVEL>Attention!</font<br><font color=FF0000>The enchantment value of this item<br1>will not transfer to the other item!</font></center><br><table width=300><center>" itemType = st.getInt("type") if itemType == 0: TYPES = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"] elif itemType == 1: TYPES = ["Light","Heavy","Magic"] weapon1 = st.getInt("oneitem") for Item in st.getPlayer().getInventory().getItems(): itemTemplate = Item.getItem() idtest = Item.getItemId() itype = str(Item.getItemType()) grade = itemTemplate.getCrystalType() if itemType == 0 or itemType == 1: if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itype in TYPES and Item.getObjectId() != weapon1: con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "[D]", 2: "[C]", 3: "[B]", 4: "[A]", 5: "[S]"} pgrade = grades.get(grade, str("")) if Item.getEnchantLevel() == 0: enchant = str("") else: enchant = " +"+str(Item.getEnchantLevel())+"" htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step2next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + " " + str(pgrade) + " " + enchant + "</a></td></tr>" except : try : listitems.close() except : pass try : con.close() except : pass elif itemType == 3: itemType2 = Item.getItem().getType2() if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itemType2 == L2Item.TYPE2_ACCESSORY and Item.getObjectId() != weapon1: con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "[D]", 2: "[C]", 3: "[B]", 4: "[A]", 5: "[S]"} pgrade = grades.get(grade, str("")) if Item.getEnchantLevel() == 0: enchant = str("") else: enchant = " +"+str(Item.getEnchantLevel())+"" htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step2next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + " "+str(pgrade)+" " + enchant + "</a></td></tr>" except : try : listitems.close() except : pass try : con.close() except : pass htmltext += u"</table><br><center><a action=\"bypass -h Quest q8015_Enchex spisok\">Back</a><br></center></body></html>" elif event.startswith("step2next_"): itemObjId = int(event.replace("step2next_", "")) obj = str(itemObjId) Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId) itemTemplate = Item.getItem() if Item and itemTemplate.getDuration() == -1: grade = itemTemplate.getCrystalType() idtest = Item.getItemId() con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : st.set("twoitem",obj) grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"} pgrade = grades.get(grade, str("")) enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("") htmltext = u"<html><body><center><br><br>The next item will get the enchantment you want!</center><br>" htmltext += "<table width=300><tr><td><center><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></center></td></tr></table><br><br>" htmltext += u"<center><button value=\"Continue\" action=\"bypass -h Quest q8015_Enchex step3\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></center><br>" htmltext += u"<br><a action=\"bypass -h Quest q8015_Enchex spisok\"><center>Back<br><br></center></a></body></html>" except : try : listitems.close() except : pass try : con.close() except : pass else : htmltext = u"<html><body><br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>" elif event.startswith("step3"): weapon1 = st.getInt("oneitem") weapon2 = st.getInt("twoitem") htmltext = u"<html><body><center><br><br>Transfer almost completed!<br>" htmltext += u"<font color=339900>The next item will be +0</font>" Item = st.getPlayer().getInventory().getItemByObjectId(weapon1) itemTemplate = Item.getItem() if Item: grade = itemTemplate.getCrystalType() idtest = Item.getItemId() con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"} pgrade = grades.get(grade, str("")) enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("") htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>" payment = int(Item.getEnchantLevel()*COST) if st.getQuestItemsCount(ITEM) < payment: htmltext += u"Transfer cost : <font color=ff2400>"+str(payment)+"</font> "+INAME+"<br>" else: htmltext += u"Transfer cost : <font color=adff2f>"+str(payment)+"</font> "+INAME+"<br>" except : try : listitems.close() except : pass try : con.close() except : pass htmltext += "<font color=339900>The next item will be " + enchant + "</font>" Item = st.getPlayer().getInventory().getItemByObjectId(weapon2) itemTemplate = Item.getItem() if Item: grade = itemTemplate.getCrystalType() idtest = Item.getItemId() cons=L2DatabaseFactory.getInstance().getConnection() listitemss=cons.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitemss.setInt(1, idtest) rs=listitemss.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"} pgrade = grades.get(grade, str("")) enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("") htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>" except : try : listitemss.close() except : pass try : cons.close() except : pass htmltext += u"<button value=\"Transfer\" action=\"bypass -h Quest q8015_Enchex step4\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"><br>" else : htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>" elif event.startswith("step4"): htmltext = u"<html><body><center><br><br><font color=ff2400>Enchant transfer successfully transfered!</font></center><br><br><br>" ench = st.getInt("enchant") payment = int(ench*COST) if st.getQuestItemsCount(ITEM) < payment: htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>You need <font color=ff2400>"+str(payment)+"</font> "+INAME+" for this transfer!</center><br>" return htmltext #< weapon1 = st.getInt("oneitem") weapon2 = st.getInt("twoitem") item1 = st.getPlayer().getInventory().getItemByObjectId(weapon1) item2 = st.getPlayer().getInventory().getItemByObjectId(weapon2) if item1 == None or item2 == None: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>One of the selected weapons are missing!<br1>Try again!<br><br></center><br>" return htmltext itemType = st.getInt("type") itype1 = str(item1.getItemType()) itype2 = str(item2.getItemType()) grade1 = item1.getItem().getCrystalType() grade2 = item2.getItem().getCrystalType() #< if item1.getEnchantLevel() != ench: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>One of the selected items enchantment has changed!<br1>Try again!<br><br></center><br>" return htmltext #< if grade1 != 5 or grade2 != 5: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext #< if itemType == 0: TYPES = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"] if itype1 not in TYPES or itype2 not in TYPES: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext elif itemType == 1: TYPES = ["Light","Heavy","Magic"] if itype1 not in TYPES or itype2 not in TYPES: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext elif itemType == 3: jew1 = item1.getItem().getType2() jew2 = item2.getItem().getType2() if jew1 != L2Item.TYPE2_ACCESSORY or jew2 != L2Item.TYPE2_ACCESSORY: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext else: htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext #< st.takeItems(ITEM,payment) #< slott = item1.getEquipSlot() if slott > 0: testt = player.getInventory().getPaperdollItem(slott) player.getInventory().unEquipItemInSlotAndRecord(slott) item1.setEnchantLevel(0) player.getInventory().equipItemAndRecord(testt) iut = InventoryUpdate() iut.addModifiedItem(testt) player.sendPacket(iut) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) else: item1.setEnchantLevel(0) player.sendPacket(ItemList(player, False)) #< slot = item2.getEquipSlot() if slot > 0: test = player.getInventory().getPaperdollItem(slot) player.getInventory().unEquipItemInSlotAndRecord(slot) item2.setEnchantLevel(ench) player.getInventory().equipItemAndRecord(test) iu = InventoryUpdate() iu.addModifiedItem(test) player.sendPacket(iu) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) else: item2.setEnchantLevel(ench) player.sendPacket(ItemList(player, False)) htmltext += u"<center><font color=bef574>The transfer has been successfully completed!</font><br><br></center><br>" else: htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext def onTalk (self,npc,player): st = player.getQuestState(qn) npcId = npc.getNpcId() if npcId == NPC: htmltext = "privetstvie.htm" return htmltext QUEST = Quest(8015,qn,"custom") CREATED = State('Start', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(NPC) QUEST.addTalkId(NPC)
- 1 reply
-
- donate shop
- claww
-
(and 1 more)
Tagged with:
-
Donation Npc / Item Market For L2Jfrozen
protoftw replied to claww's topic in Server Shares & Files [L2J]
hey guys i have a quick question ..Npc works great but there's one problem ..Icons from customs items do not show to all the services from the npc .. For example npc has , enchanter ( add enchants to your equipment) , transfer enchant ( u know what this is..) When using enchanter ( to add +1 enchant for example ) icons are shown properly But, when using transfer enchant icons are black? can anyone help me with that? I can post u here both _init_py files. here's the right one where i can see all icons. import sys from java.lang import String from java.lang import Integer from com.l2jfrozen.util.random import Rnd from com.l2jfrozen.util.database import L2DatabaseFactory from com.l2jfrozen.gameserver.model.quest import State from com.l2jfrozen.gameserver.model.actor.instance import L2ItemInstance from com.l2jfrozen.gameserver.network.serverpackets import ItemList from com.l2jfrozen.gameserver.network.serverpackets import UserInfo from com.l2jfrozen.gameserver.network.serverpackets import CharInfo from com.l2jfrozen.gameserver.network.serverpackets import InventoryUpdate from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest Qn = "919_Enchanter" Npc = 300300 MaxEnchantWeapon = 25 MaxEnchantArmor = 25 MaxEnchantJewel = 25 Adena = 3488 # Donate coin (adena) ItemName = "Donate Coins" JPrice = [1,1,1,1,1,1] # Price for +1 Jewels (depends Jewels grade, ex. Wprice[0] = No Grade) APrice = [1,1,1,1,1,1] # Price for +1 Armors (depends Armors grade, ex. Wprice[0] = No Grade) WPrice = [2,2,2,2,2,2] # Price for +1 Weapons (depends Weapons grade, ex. Wprice[0] = No Grade) Jewel = ["None"] Armor = ["Light","Heavy","Magic"] Weapon = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt","Shield"] SlotForEnchant = [7,8,6,10,11,9,12,3,1,2,4,5] # editable [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] NoEnchantItem = [] print "Donate Manager: Loaded 40%" def getItemIcon(ItemId): con=L2DatabaseFactory.getInstance().getConnection() II=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") II.setInt(1, ItemId) rs=II.executeQuery() ItemIcon = "" if rs.next() : ItemIcon = rs.getString("itemIcon") else : ItemIcon = "icon.etc_adena_i00" try : con.close() except : pass return ItemIcon def validateItem(ItemId) : for itm in NoEnchantItem : if itm == ItemId : return False return True def getHexSlot(Slot) : if Slot == 0 : return 0x01 elif Slot == 1 : # Left Earring return 0x04 elif Slot == 2 : # Right Earring return 0x02 elif Slot == 3 : # Neck return 0x08 elif Slot == 4 : # Left Ring return 0x20 elif Slot == 5 : # Right Ring return 0x10 elif Slot == 6 : # Helmet return 0x40 elif Slot == 7 : # Left Hand return 0x80 elif Slot == 8 : # Right Hand return 0x0100 elif Slot == 9 : # Gloves return 0x0200 elif Slot == 10 : # Breastplate return 0x0400 elif Slot == 11 : # Gaiters return 0x0800 elif Slot == 12 : # Boots return 0x1000 elif Slot == 13 : # return 0x2000 elif Slot == 14 : # R/L Finger return 0x4000 elif Slot == 15 : # return 0x040000 elif Slot == 16 : # return 0x010000 elif Slot == 17 : # return 0x080000 return 0x00 class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onTalk (Self,npc,player) : st = player.getQuestState(Qn) npcId = npc.getNpcId() htmltext = u"<html><title>Donate Shop</title><body><center>Error!</center></body></html>" if not st : return htmltext htmltext = "<html><body><font color=LEVEL>Add +1 Enchant to your equipment</font><br1>Cost: 1 Donate Coin [Armor,Jewels]<br1> Cost: 2 Donate Coins [Weapon]" for Slot in SlotForEnchant : Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(Slot)) if Item1 != None : if validateItem(Item1.getItemId()) : Grade = Item1.getItem().getCrystalType() if Grade not in [0] : if Grade == 1: pgrade = str("[D]") elif Grade == 2: pgrade = str("[C]") elif Grade == 3: pgrade = str("[B]") elif Grade == 4: pgrade = str("[A]") elif Grade == 5: pgrade = str("[S]") else: pgrade = str("") htmltext = htmltext + "<img src=\"" + getItemIcon(Item1.getItemId()) + "\" width=32 height=32><a action=\"bypass -h Quest 919_Enchanter slot_" + str(Slot) + "\">" + Item1.getItemName() + " " + str(pgrade) + " +" + str(Item1.getEnchantLevel()) + "</a><br>" htmltext = htmltext + "</body></html>" return htmltext def onAdvEvent (self,event,npc,player) : st = player.getQuestState(Qn) htmltext = u"<html><title>Donate Shop</title><body><center>Error!</center></body></html>" if not st : return htmltext strEvent = String(event) if strEvent.startsWith("slot") : intEvent = Integer.parseInt(strEvent.substring(5)) htmltext = "<html><title>Donate Shop</title><body><br>" Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(intEvent)) if Item1 != None : if validateItem(Item1.getItemId()) : ItemEnchant = Item1.getEnchantLevel() htmltext = htmltext + "<img src=\"" + getItemIcon(Item1.getItemId()) + "\" width=32 height=32><br>" htmltext = htmltext + u"" + Item1.getItemName() + " +" + str(ItemEnchant) + "<br>" Grade = Item1.getItem().getCrystalType() Itype = str(Item1.getItemType()) if Itype in Jewel and ItemEnchant < MaxEnchantJewel : if ItemEnchant < MaxEnchantJewel : htmltext = htmltext + u"Add 1 enchant = " + str(JPrice[Grade]) + " " + ItemName + "<br>" if ItemEnchant < MaxEnchantJewel : htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusone_" + str(intEvent) + u"\">Add +1 enchant!</a><br>" elif Itype in Armor and ItemEnchant < MaxEnchantArmor : if ItemEnchant < MaxEnchantArmor : htmltext = htmltext + u"Add 1 enchant = " + str(APrice[Grade]) + " " + ItemName + "<br>" if ItemEnchant < MaxEnchantArmor : htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusone_" + str(intEvent) + u"\">Add +1 enchant!</a><br>" elif Itype in Weapon and ItemEnchant < MaxEnchantWeapon : if ItemEnchant < MaxEnchantWeapon : htmltext = htmltext + u"Add 1 enchant = " + str(WPrice[Grade]) + " " + ItemName + "<br>" if ItemEnchant < MaxEnchantWeapon : htmltext = htmltext + "<a action=\"bypass -h Quest 919_Enchanter plusone_" + str(intEvent) + u"\">Add +1 enchant!</a><br>" elif Itype in Weapon and ItemEnchant >= MaxEnchantWeapon : if ItemEnchant >= MaxEnchantWeapon : htmltext = htmltext + "<br><br><br><br><br> You can't enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" else : htmltext = htmltext + "<br><br><br><br><br> You can't enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" else : htmltext = htmltext + u"Your item is not equiped! Check it!<br><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br></center><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=256 height=32>" elif strEvent.startsWith("plusone") : intEvent = Integer.parseInt(strEvent.substring(8)) htmltext = "<html><title>Donate Shop</title><body><br>" Item1 = player.getInventory().getPaperdollItemByL2ItemId(getHexSlot(intEvent)) if Item1 != None : if validateItem(Item1.getItemId()) : Grade = Item1.getItem().getCrystalType() if Grade not in [0] : ItemEnchant = Item1.getEnchantLevel() Itype = str(Item1.getItemType()) if Itype in Jewel : if ItemEnchant < MaxEnchantJewel : iu = InventoryUpdate() player.sendPacket(iu) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) if st.getQuestItemsCount(Adena) >= JPrice[Grade]: st.takeItems(Adena,JPrice[Grade]) Item1.setEnchantLevel(ItemEnchant+1) ItemEnchant = Item1.getEnchantLevel() st.playSound("ItemSound.quest_itemget") player.sendPacket(ItemList(player,False)) htmltext = htmltext + u"<br>Your jewel was successfully enchanted to + " + str(ItemEnchant) + "</font>!<br>" else : htmltext = htmltext + u"You need <font color=LEVEL>" + str(JPrice[Grade]) + "</font> " + ItemName + " to do that!" # player donate items < to be enchanted else : htmltext = htmltext + u"<br> You cant enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" # in case before add enchant the player is enchant manualy his weap from 19 to 20 and then trying to click enchant elif Itype in Armor : if ItemEnchant < MaxEnchantArmor : iu = InventoryUpdate() player.sendPacket(iu) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) if st.getQuestItemsCount(Adena) >= APrice[Grade]: st.takeItems(Adena,APrice[Grade]) Item1.setEnchantLevel(ItemEnchant+1) ItemEnchant = Item1.getEnchantLevel() st.playSound("ItemSound.quest_itemget") player.sendPacket(ItemList(player,False)) htmltext = htmltext + u"<br>Your armor was successfully enchanted to + " + str(ItemEnchant) + "</font>!<br><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br></center><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=256 height=32>" else : htmltext = htmltext + u"You need <font color=LEVEL>" + str(JPrice[Grade]) + "</font> " + ItemName + " to do that!" # player donate items < to be enchanted else : htmltext = htmltext + u"<br> You cant enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" # in case before add enchant the player is enchant manualy his weap from 19 to 20 and then trying to click enchant elif Itype in Weapon : if ItemEnchant < MaxEnchantWeapon : iu = InventoryUpdate() player.sendPacket(iu) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) if st.getQuestItemsCount(Adena) >= WPrice[Grade]: st.takeItems(Adena,WPrice[Grade]) Item1.setEnchantLevel(ItemEnchant+1) ItemEnchant = Item1.getEnchantLevel() st.playSound("ItemSound.quest_itemget") player.sendPacket(ItemList(player,False)) htmltext = htmltext + u"<br>Your weapon was successfully enchanted to + " + str(ItemEnchant) + "</font>!<br>" else : htmltext = htmltext + u"You need <font color=LEVEL>" + str(WPrice[Grade]) + "</font> " + ItemName + " to do that!<br>" # player donate items < to be enchanted else : htmltext = htmltext + u"<br> You cant enchant more than <font color=FF0000>+" + str(ItemEnchant) + "</font><br>" # in case before add enchant the player is enchant manualy his weap from 19 to 20 and then trying to click enchant else : htmltext = htmltext + u"Error, i accept only 3 types : Weapon,Armor,Jewel!<br>" #unknown else : htmltext = htmltext + u"Your current weapon's grade is different!<br>" #in case that the player before add enchant, change weapon to no-weapon type else : htmltext = htmltext + u"Error, Your weapon not found!<br>" #unknown else : htmltext = htmltext + u"" htmltext = htmltext + "Your item not found! try again!</body></html>" return htmltext QUEST = Quest(919,Qn,"custom") CREATED = State('Start', QUEST) STARTING = State('Starting', QUEST) STARTED = State('Started', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(300300) QUEST.addTalkId(300300) and here's the other one where i cannot see all icons. import sys from java.lang import System from com.l2jfrozen.util.database import L2DatabaseFactory from com.l2jfrozen.gameserver.model.quest import State from com.l2jfrozen.gameserver.model.quest import QuestState from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest from com.l2jfrozen.gameserver.network.serverpackets import CharInfo from com.l2jfrozen.gameserver.network.serverpackets import InventoryUpdate from com.l2jfrozen.gameserver.network.serverpackets import ItemList from com.l2jfrozen.gameserver.network.serverpackets import UserInfo from com.l2jfrozen.gameserver.templates import L2Item qn = "q8015_Enchex" #id νοφ NPC = 300300 #id θςεμΰ δλ ηΰςξχκθ ITEM = 3488 #ρςξθμξρςό ηΰςξχκθ ηΰ κΰζδϋι + COST =100 #νΰηβΰνθε θςεμΰ INAME = "Donate Coins" #ροθρξκ ηΰοπεωεννϋυ θςεμξβ FORBIDDEN = [12,132,6611,6612,6620,6617,6619,6618,6621,6614,6616] print "Donate Manager: Loaded 100%" print "Lineage 2: Donate Manager NPC LOADED" class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onAdvEvent (self,event,npc,player): st = player.getQuestState(qn) if event == "spisok": htmltext = "<html><body><center><br1>" htmltext += u"<table width=260><tr><td align=center><font color=LEVEL>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438</font></td></tr></table>" htmltext += u"<button value=\"Weapon [S]\" action=\"bypass -h Quest q8015_Enchex step1_0\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"><br>" htmltext += u"<button value=\"Armor [S]\" action=\"bypass -h Quest q8015_Enchex step1_1\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"><br>" htmltext += u"<button value=\"Jewels [S]\" action=\"bypass -h Quest q8015_Enchex jewerly\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"><br>" htmltext += "<center><br></center></body></html>" elif event.startswith("step1_"): itemType = int(event.replace("step1_", "")) htmltext = u"<html><center><body><br>Select the item you wish to remove the enchant!<br><br></center><table width=300>" if itemType == 0: TYPES = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"] elif itemType == 1: TYPES = ["Light","Heavy","Magic"] else: htmltext = u"<html><body></body></html>" return htmltext st.set("type",str(itemType)) for Item in st.getPlayer().getInventory().getItems(): itemTemplate = Item.getItem() idtest = Item.getItemId() itype = str(Item.getItemType()) grade = itemTemplate.getCrystalType() if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itype in TYPES and Item.getEnchantLevel() > 0: con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "D", 2: "C", 3: "B", 4: "A", 5: "S"} pgrade = grades.get(grade, str("")) if Item.getEnchantLevel() == 0: enchant = str("") else: enchant = " +"+str(Item.getEnchantLevel())+"" htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step1next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + " ["+str(pgrade)+"] " + enchant + "</a></td></tr>" except : try : listitems.close() except : pass try : con.close() except : pass htmltext += u"</table><center></center><br></body></html>" elif event == "jewerly": htmltext = u"<html><center><body><br>Select the item you wish to remove the enchant!<br><br></center><table width=300>" st.set("type","3") for Item in st.getPlayer().getInventory().getItems(): itemTemplate = Item.getItem() idtest = Item.getItemId() itemType = Item.getItem().getType2() grade = itemTemplate.getCrystalType() if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itemType == L2Item.TYPE2_ACCESSORY and Item.getEnchantLevel() > 0: con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "D", 2: "C", 3: "B", 4: "A", 5: "S"} pgrade = grades.get(grade, str("")) if Item.getEnchantLevel() == 0: enchant = str("") else: enchant = " +"+str(Item.getEnchantLevel())+"" htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step1next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + " ["+str(pgrade)+"] " + enchant + "</a></td></tr>" except : try : listitems.close() except : pass try : con.close() except : pass htmltext += u"</table><center></center><br></body></html>" elif event.startswith("step1next_"): itemObjId = int(event.replace("step1next_", "")) Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId) itemTemplate = Item.getItem() if Item and itemTemplate.getDuration() == -1 and Item.getEnchantLevel() > 0: grade = itemTemplate.getCrystalType() idtest = Item.getItemId() con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : st.set("enchant",str(Item.getEnchantLevel())) st.set("oneitem",str(itemObjId)) grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"} pgrade = grades.get(grade, str("")) enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("") htmltext = u"<html><body><center><br>This item after the transfer<br1>will <font color=LEVEL>NOT</font> gain the enchantment value of the next item.<br>Will be <font color=LEVEL>+0</font>!</center><br>" htmltext += "<table width=300><tr><td><center><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></center></td></tr></table><br><br>" payment = int(Item.getEnchantLevel()*COST) if st.getQuestItemsCount(ITEM) < payment: htmltext += u"<center>You need <font color=ff2400>"+str(payment)+"</font> "+INAME+" for this tranfer!<br>" else: htmltext += u"<center>The cost will be : <font color=adff2f>"+str(payment)+"</font> "+INAME+"</center><br>" htmltext += u"<center><button value=\"Select the next item\" action=\"bypass -h Quest q8015_Enchex step2\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></center><br>" htmltext += u"<br><a action=\"bypass -h Quest q8015_Enchex spisok\"><center>Back<br><center></center></a></body></html>" except : try : listitems.close() except : pass try : con.close() except : pass else : htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>" elif event == "step2": htmltext = u"<html><body><center><br><br>Choose the item you want to transfer the enchant!<br><font color=LEVEL>Attention!</font<br><font color=FF0000>The enchantment value of this item<br1>will not transfer to the other item!</font></center><br><table width=300><center>" itemType = st.getInt("type") if itemType == 0: TYPES = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"] elif itemType == 1: TYPES = ["Light","Heavy","Magic"] weapon1 = st.getInt("oneitem") for Item in st.getPlayer().getInventory().getItems(): itemTemplate = Item.getItem() idtest = Item.getItemId() itype = str(Item.getItemType()) grade = itemTemplate.getCrystalType() if itemType == 0 or itemType == 1: if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itype in TYPES and Item.getObjectId() != weapon1: con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "[D]", 2: "[C]", 3: "[B]", 4: "[A]", 5: "[S]"} pgrade = grades.get(grade, str("")) if Item.getEnchantLevel() == 0: enchant = str("") else: enchant = " +"+str(Item.getEnchantLevel())+"" htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step2next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + " " + str(pgrade) + " " + enchant + "</a></td></tr>" except : try : listitems.close() except : pass try : con.close() except : pass elif itemType == 3: itemType2 = Item.getItem().getType2() if idtest not in FORBIDDEN and itemTemplate.getDuration() == -1 and grade == 5 and itemType2 == L2Item.TYPE2_ACCESSORY and Item.getObjectId() != weapon1: con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "[D]", 2: "[C]", 3: "[B]", 4: "[A]", 5: "[S]"} pgrade = grades.get(grade, str("")) if Item.getEnchantLevel() == 0: enchant = str("") else: enchant = " +"+str(Item.getEnchantLevel())+"" htmltext += "<tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><a action=\"bypass -h Quest q8015_Enchex step2next_" + str(Item.getObjectId()) +"\">" + itemTemplate.getName() + " "+str(pgrade)+" " + enchant + "</a></td></tr>" except : try : listitems.close() except : pass try : con.close() except : pass htmltext += u"</table><br><center><a action=\"bypass -h Quest q8015_Enchex spisok\">Back</a><br></center></body></html>" elif event.startswith("step2next_"): itemObjId = int(event.replace("step2next_", "")) obj = str(itemObjId) Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId) itemTemplate = Item.getItem() if Item and itemTemplate.getDuration() == -1: grade = itemTemplate.getCrystalType() idtest = Item.getItemId() con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : st.set("twoitem",obj) grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"} pgrade = grades.get(grade, str("")) enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("") htmltext = u"<html><body><center><br><br>The next item will get the enchantment you want!</center><br>" htmltext += "<table width=300><tr><td><center><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></center></td></tr></table><br><br>" htmltext += u"<center><button value=\"Continue\" action=\"bypass -h Quest q8015_Enchex step3\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></center><br>" htmltext += u"<br><a action=\"bypass -h Quest q8015_Enchex spisok\"><center>Back<br><br></center></a></body></html>" except : try : listitems.close() except : pass try : con.close() except : pass else : htmltext = u"<html><body><br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>" elif event.startswith("step3"): weapon1 = st.getInt("oneitem") weapon2 = st.getInt("twoitem") htmltext = u"<html><body><center><br><br>Transfer almost completed!<br>" htmltext += u"<font color=339900>The next item will be +0</font>" Item = st.getPlayer().getInventory().getItemByObjectId(weapon1) itemTemplate = Item.getItem() if Item: grade = itemTemplate.getCrystalType() idtest = Item.getItemId() con=L2DatabaseFactory.getInstance().getConnection() listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitems.setInt(1, idtest) rs=listitems.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"} pgrade = grades.get(grade, str("")) enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("") htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>" payment = int(Item.getEnchantLevel()*COST) if st.getQuestItemsCount(ITEM) < payment: htmltext += u"Transfer cost : <font color=ff2400>"+str(payment)+"</font> "+INAME+"<br>" else: htmltext += u"Transfer cost : <font color=adff2f>"+str(payment)+"</font> "+INAME+"<br>" except : try : listitems.close() except : pass try : con.close() except : pass htmltext += "<font color=339900>The next item will be " + enchant + "</font>" Item = st.getPlayer().getInventory().getItemByObjectId(weapon2) itemTemplate = Item.getItem() if Item: grade = itemTemplate.getCrystalType() idtest = Item.getItemId() cons=L2DatabaseFactory.getInstance().getConnection() listitemss=cons.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?") listitemss.setInt(1, idtest) rs=listitemss.executeQuery() while (rs.next()) : icon=rs.getString("itemIcon") try : grades = {1: "d", 2: "c", 3: "b", 4: "a", 5: "s"} pgrade = grades.get(grade, str("")) enchant = (Item.getEnchantLevel() > 0 and " +"+str(Item.getEnchantLevel())+"") or str("") htmltext += "<table width=300><tr><td><img src=\"Icon."+str(icon)+"\" width=32 height=32></td><td><font color=LEVEL>" + itemTemplate.getName() + " " + enchant + "</font><img src=\"symbol.grade_"+str(pgrade)+"\" width=16 height=16><br></td></tr></table><br><br>" except : try : listitemss.close() except : pass try : cons.close() except : pass htmltext += u"<button value=\"Transfer\" action=\"bypass -h Quest q8015_Enchex step4\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"><br>" else : htmltext = u"<html><body>\u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0437\u0430\u0442\u043e\u0447\u043a\u0438:<br>\u041e\u0448\u0438\u0431\u043a\u0430!<br><a action=\"bypass -h Quest q8015_Enchex spisok\">\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f.</a></body></html>" elif event.startswith("step4"): htmltext = u"<html><body><center><br><br><font color=ff2400>Enchant transfer successfully transfered!</font></center><br><br><br>" ench = st.getInt("enchant") payment = int(ench*COST) if st.getQuestItemsCount(ITEM) < payment: htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>You need <font color=ff2400>"+str(payment)+"</font> "+INAME+" for this transfer!</center><br>" return htmltext #< weapon1 = st.getInt("oneitem") weapon2 = st.getInt("twoitem") item1 = st.getPlayer().getInventory().getItemByObjectId(weapon1) item2 = st.getPlayer().getInventory().getItemByObjectId(weapon2) if item1 == None or item2 == None: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>One of the selected weapons are missing!<br1>Try again!<br><br></center><br>" return htmltext itemType = st.getInt("type") itype1 = str(item1.getItemType()) itype2 = str(item2.getItemType()) grade1 = item1.getItem().getCrystalType() grade2 = item2.getItem().getCrystalType() #< if item1.getEnchantLevel() != ench: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>One of the selected items enchantment has changed!<br1>Try again!<br><br></center><br>" return htmltext #< if grade1 != 5 or grade2 != 5: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext #< if itemType == 0: TYPES = ["Sword","Blunt","Dagger","Bow","Etc","Pole","Fist","Dual Sword","Dual Fist","Big Sword","Big Blunt"] if itype1 not in TYPES or itype2 not in TYPES: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext elif itemType == 1: TYPES = ["Light","Heavy","Magic"] if itype1 not in TYPES or itype2 not in TYPES: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext elif itemType == 3: jew1 = item1.getItem().getType2() jew2 = item2.getItem().getType2() if jew1 != L2Item.TYPE2_ACCESSORY or jew2 != L2Item.TYPE2_ACCESSORY: st.set("enchant","0") htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext else: htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext #< st.takeItems(ITEM,payment) #< slott = item1.getEquipSlot() if slott > 0: testt = player.getInventory().getPaperdollItem(slott) player.getInventory().unEquipItemInSlotAndRecord(slott) item1.setEnchantLevel(0) player.getInventory().equipItemAndRecord(testt) iut = InventoryUpdate() iut.addModifiedItem(testt) player.sendPacket(iut) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) else: item1.setEnchantLevel(0) player.sendPacket(ItemList(player, False)) #< slot = item2.getEquipSlot() if slot > 0: test = player.getInventory().getPaperdollItem(slot) player.getInventory().unEquipItemInSlotAndRecord(slot) item2.setEnchantLevel(ench) player.getInventory().equipItemAndRecord(test) iu = InventoryUpdate() iu.addModifiedItem(test) player.sendPacket(iu) player.broadcastPacket(CharInfo(player)) player.sendPacket(UserInfo(player)) else: item2.setEnchantLevel(ench) player.sendPacket(ItemList(player, False)) htmltext += u"<center><font color=bef574>The transfer has been successfully completed!</font><br><br></center><br>" else: htmltext = "<html><body><center><br><br><font color=ff2400>Enchant transfer canceled.</font><br><br><br>Do not try to scam!<br1>Try again!<br><br></center><br>" return htmltext def onTalk (self,npc,player): st = player.getQuestState(qn) npcId = npc.getNpcId() if npcId == NPC: htmltext = "privetstvie.htm" return htmltext QUEST = Quest(8015,qn,"custom") CREATED = State('Start', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(NPC) QUEST.addTalkId(NPC) -
Kalhmera Sas Parakalo Help!
protoftw replied to Palikari's topic in Server Development Discussion [Greek]
φιλε μου αν χρησιμοποιεις l2jfrozen υπαρχει επιλογη την οποια ενεργοποιεις και απενεργοποιεις ετσι ωστε το καθε class να μην εχει PENALTY ..οσο για τα αλλα pack δεν ξερω αν υπαρχει επιλογη αλλα ειμαι σιγουρος πως θα εχει ..εχεις ψαξει στα configs ?? π.χ στο l2jfrozen ειναι ετσι # MasteryPenality, to disable Heavy expertise. # True: Players like dagger or archer can't use Heavy armor. MasteryPenality= True # MasteryPenality starting level. # Default from 20 LevelToGetPenalty= 20 # MasteryWeaponPenality, to disable weapons expertise. # True: Players that have not weapon mastery cannot use that weapon type. MasteryWeaponPenality= True # MasteryWeaponPenality starting level. # Default from 20 LevelToGetWeaponPenalty= 20 -
I LOVE YOU SO MUCH
-
Help Obtain Noblesse By Killing Barakiel
protoftw replied to protoftw's question in Request Server Development Help [L2J]
oh c'mon guys ..let's keep it together and help us find the solution.. just post a fully working code (yayy) :P -
Help Obtain Noblesse By Killing Barakiel
protoftw replied to protoftw's question in Request Server Development Help [L2J]
i may not know how to read a code but i have to say thank you .. but still doesnt work :P -
Help Obtain Noblesse By Killing Barakiel
protoftw replied to protoftw's question in Request Server Development Help [L2J]
i removed it ...but it seems like this code is useless?? It doesnt work at all -
Help Obtain Noblesse By Killing Barakiel
protoftw replied to protoftw's question in Request Server Development Help [L2J]
so i just delete this part? Hero.getInstance().setRBkilled(member.getObjectId(), getNpcId()); -
Help Obtain Noblesse By Killing Barakiel
protoftw posted a question in Request Server Development Help [L2J]
this is a code to get noble if u kill barakiel ..and i get 1 error ...i'm using l2jfrozen ther error is on Hero. There is an auto-fix to import --> import com.l2jfrozen.gameserver.model.entity.Hero; the problem gets fixed.... but then there is 1 more problem at setRBkilled it says: create method setRBkilled ( int , int)' in type 'Hero' . Could u help me fix it? if (player.isInParty()) { for (L2PcInstance member : player.getParty().getPartyMembers()) { RaidBossPointsManager.addPoints(member, getNpcId(), (getLevel() / 2) + Rnd.get(-5, 5)); if (member.isNoble()) Hero.getInstance().setRBkilled(member.getObjectId(), getNpcId()); if (getNpcId() == 25325 && !member.isNoble() && member.isSubClassActive() && member.getLevel() >= 75 && member.isInsideRadius(getX(), getY(), getZ(), 1000, false, false)) { member.setNoble(true); member.addItem("Quest", 7694, 1, member, true); NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); html.setHtml("<html><body>Congratulations, you're now a noble!<br1>Open the Skills & Magic (ALT+K) to see your acquired abilities.</body></html>"); member.sendPacket(html); } } } else { RaidBossPointsManager.addPoints(player, getNpcId(), (getLevel() / 2) + Rnd.get(-5, 5)); if (player.isNoble()) Hero.getInstance().setRBkilled(player.getObjectId(), getNpcId()); if (getNpcId() == 25325 && !player.isNoble() && player.isSubClassActive() && player.getLevel() >= 75) { player.setNoble(true); player.addItem("Quest", 7694, 1, player, true); NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); html.setHtml("<html><body>Congratulations, you're now a noble!<br1>Open the Skills & Magic (ALT+K) to see your acquired abilities.</body></html>"); player.sendPacket(html); } } Reply Report -
Code Ls/bogs/scrolls Stackable [L2Jfrozen] Fully Working
protoftw replied to DrenepiaWorld's topic in Server Shares & Files [L2J]
i did everything without errors and still not working.. EDIT : it's working great... p.s DONT FORGET TO CHANGE SCROLLS/BOGS/LIFESTONES TO --> STACKABLE...FROM YOUR DATABASE ( NAVICAT ) -
{Interlude} Custom Merchant / Item Market
protoftw replied to melron's topic in Server Shares & Files [L2J]
they look pretty good mate ..thanks for sharing them :) -
Code L2Jfrozen Survey System 2016
protoftw replied to protoftw's topic in Server Shares & Files [L2J]
I can only adapt codes for l2jfrozen ..that's all I know :P ...And if it doesnt work then ..... "oh sh!t" . You may find that stupid but...yeap..it's true -
at first i was getting critical error cause buttons.utx was corrupted or sth like that... then the npc wasn't translated and I was like OH MA GAD! I fixed the "critical error" thing ..and I also found her buffer online translated in english but it was for a H5 version...so I "searched-copied-pasted" everything and now the buffer is working great.. if anyone needs the __init__.py file...HERE IT IS! import sys from java.lang import System; from java.util import Iterator; import com.l2jfrozen.Config; from com.l2jfrozen.gameserver.model.quest import State; from com.l2jfrozen.gameserver.model.quest import QuestState; from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest; from com.l2jfrozen.util.database import L2DatabaseFactory; from com.l2jfrozen.gameserver.datatables import SkillTable; import com.l2jfrozen.gameserver.datatables.sql.ItemTable; from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance; from com.l2jfrozen.gameserver.model.actor.instance import L2PetInstance; from com.l2jfrozen.gameserver.model.actor.instance import L2SummonInstance; from com.l2jfrozen.gameserver.network.serverpackets import SetSummonRemainTime; from com.l2jfrozen.gameserver.network.serverpackets import SetupGauge; QUEST_ID = 555 QUEST_NAME = "NPCBuffer" QUEST_DESCRIPTION = "custom" QUEST_LOADING_INFO = str(QUEST_ID)+"_"+QUEST_NAME NPC_ID = 555 TITLE_NAME = "NPC Buffer" SCRIPT_RELOAD = True ENABLE_VIP_BUFFER = False VIP_ACCESS_LEVEL = 1 ENABLE_BUFF_SECTION = True ENABLE_SCHEME_SYSTEM = True ENABLE_HEAL = True ENABLE_BUFFS = True ENABLE_RESIST = True ENABLE_SONGS = True ENABLE_DANCES = True ENABLE_CHANTS = True ENABLE_OTHERS = False ENABLE_SPECIAL = True ENABLE_CUBIC = True ENABLE_BUFF_REMOVE = True ENABLE_BUFF_SET = True BUFF_WITH_KARMA = False FREE_BUFFS = False TIME_OUT = False TIME_OUT_TIME = 1 MIN_LEVEL = 20 BUFF_REMOVE_PRICE = 100000 HEAL_PRICE = 1000000 BUFF_PRICE = 100000 RESIST_PRICE = 100000 SONG_PRICE = 100000 DANCE_PRICE = 100000 CHANT_PRICE = 100000 OTHERS_PRICE = 1000000 SPECIAL_PRICE = 1000000 CUBIC_PRICE = 1000000 BUFF_SET_PRICE = 10000000 SCHEME_BUFF_PRICE = 10000000 SCHEMES_PER_PLAYER = 4 CONSUMABLE_ID = 57 MAX_SCHEME_BUFFS = 16 MAX_SCHEME_DANCES = 8 def rebuildMainHtml(st) : MAIN_HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src= \"L2UI_CH3.herotower_deco\" width=256 height=32><br>"; MESSAGE = "" bottonA="Auto Buff";bottonB="Heal Me";bottonC="Rem. Buffs";i=0;j=0;Temp="<tr><td> </td> <td> </td></tr>";TRS = Temp.split(" ") if st.getInt("Pet-On-Off") == 1: bottonA="Auto Buff Pet";bottonB="Heal My Pet";bottonC="Rem. Pet Buffs" MAIN_HTML_MESSAGE += "<button value=\"Pet Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 0 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" else: MAIN_HTML_MESSAGE += "<button value=\"Char Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 1 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if ENABLE_BUFF_SECTION == True : if ENABLE_BUFFS == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_buffs 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_RESIST == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Resist\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_resists 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_SONGS == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_songs 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_DANCES == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_dances 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_CHANTS == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_chants 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_SPECIAL == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Special\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_special 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_OTHERS == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Others\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_others 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_CUBIC == True: if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_cubic 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_BUFF_SET == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\""+bottonA+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " castBuffSet 0 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_HEAL == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\""+bottonB+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " heal 0 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_BUFF_REMOVE == True: if i>2:i=0 MESSAGE += TRS[i]+"<button value=\""+bottonC+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " removeBuffs 0 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if j == 1: MAIN_HTML_MESSAGE+= MESSAGE + "<br>" else: MAIN_HTML_MESSAGE+= "<table>" + MESSAGE + "</table><br>" if ENABLE_SCHEME_SYSTEM == True : MAIN_HTML_MESSAGE += generateScheme(st) if st.getPlayer().isGM() : MAIN_HTML_MESSAGE += "<br><button value=\"Manage Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" MAIN_HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font>" MAIN_HTML_MESSAGE += "</center></body></html>" return MAIN_HTML_MESSAGE def generateScheme(st) : schemeName = [] schemeId = [] HTML = "" conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer().getObjectId())) action=rss.executeQuery() while (action.next()) : try : schemeName += [action.getString("scheme_name")] schemeId += [action.getString("id")] except : print "Query error!" try : conn.close() except : pass if len(schemeName) > 0: MESSAGE = "" i=0;j=0;Temp="<tr><td> </td> <td> </td></tr>";TRS = Temp.split(" ") while i <= len(schemeName) - 1: if j>2:j=0 MESSAGE += TRS[j]+"<button value=\""+schemeName[i]+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" cast "+schemeId[i]+" x x\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore= \"L2UI_ct1.button_df\">"+TRS[j+1] i+=1;j+=2 if i == 1: HTML+= MESSAGE + "<br>" else: HTML+= "<table>" + MESSAGE + "</table><br>" if len(schemeName) < SCHEMES_PER_PLAYER : HTML += "<table><tr><td><button value=\"Create\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" create_1 x x x\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" else : HTML += "<table width=100><tr>" if len(schemeName) > 0 : HTML += "<td><button value=\"Edit\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" edit_1 x x x\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" HTML += "<td><button value=\"Delete\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_1 x x x\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>" else : HTML += "</tr></table>" return HTML def reloadPanel(st) : HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" HTML_MESSAGE += "<font color=\"303030\">"+TITLE_NAME+"</font><br>" HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>" HTML_MESSAGE += "<table width=260 border=0 bgcolor=000000>" HTML_MESSAGE += "<tr><td><br></td></tr>" HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"00FFFF\">This option can be seen by GMs only and it<br1>allows you to update any changes made in the<br1>script. You can disable this option in<br1>the settings section within the Script.<br><font color=\"LEVEL\">Do you want to update the SCRIPT?</font></font></td></tr>" HTML_MESSAGE += "<tr><td></td></tr></table><br>" HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>" HTML_MESSAGE += "<button value=\"Yes\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" reloadscript 1 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "<button value=\"No\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" reloadscript 0 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "</center></body></html>" return HTML_MESSAGE def getitemname(st,itemval): conn=L2DatabaseFactory.getInstance().getConnection() itemidList = conn.prepareStatement("SELECT * FROM etcitem WHERE item_id="+str(itemval)) il=itemidList.executeQuery() val = "No Name" if il : il.next() try : val = il.getString("name") except : pass try : conn.close() except: pass return val def getBuffCount(scheme) : count = 0 conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\"") action=rss.executeQuery() while (action.next()) : try : count += 1 except : count = 0 try : conn.close() except : pass return count def getBuffType(id) : conn=L2DatabaseFactory.getInstance().getConnection() act = conn.prepareStatement("SELECT buffType FROM buffer_buff_list WHERE buffId=? LIMIT 1") act.setInt(1, int(id)) rs=act.executeQuery() val = "none" if rs : rs.next() try : val = rs.getString("buffType") except : val = "none" try : conn.close() except: pass return val def isEnabled(id,level) : conn=L2DatabaseFactory.getInstance().getConnection() act = conn.prepareStatement("SELECT canUse FROM buffer_buff_list WHERE buffId=? AND buffLevel=? LIMIT 1") act.setInt(1, int(id)) act.setInt(2, int(level)) rs=act.executeQuery() val = "False" if rs : rs.next() try : num = rs.getString("canUse") except : pass try : conn.close() except: pass if num == "1" : val = "True" return val def isUsed(scheme,id,level) : count = 0; used = False conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\" AND skill_id=\""+str(id)+"\" AND skill_level=\""+str(level)+"\"") action=rss.executeQuery() used = False while (action.next()) : try : count += 1 except : count = 0 try : conn.close() except : pass if count > 0 : used = True return used def getclassbuff(id): conn=L2DatabaseFactory.getInstance().getConnection() getTipo = conn.prepareStatement("SELECT * FROM buffer_buff_list WHERE buffId=\""+id+"\"") gt=getTipo.executeQuery() val = 0 if gt : gt.next() try : val = gt.getInt("buff_class") except : pass try : conn.close() except : pass return val def showText(st,type,text,buttonEnabled,buttonName,location) : MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" MESSAGE += "<font color=\"LEVEL\">"+type+"</font><br>"+text+"<br>" if buttonEnabled == "True" : MESSAGE += "<button value=\""+buttonName+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect "+location+" 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" MESSAGE += "<font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" st.playSound("ItemSound3.sys_shortage") return MESSAGE def ReloadConfig(st) : try: if QuestManager.getInstance().reload(QUEST_ID): st.player.sendMessage("The script and settings have been reloaded successfully.") else: st.player.sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server") except: st.player.sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server") return rebuildMainHtml(st) class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onAdvEvent (self,event,npc,player) : st = player.getQuestState(QUEST_LOADING_INFO) getpetbuff = 0 if st.getInt("Pet-On-Off") == 1: getpetbuff = 1 def createScheme() : HTML = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src= \"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>You MUST sepererate new words with a dot (.)<br><br>Scheme name: <edit var=\"name\" width=100><br><br>" HTML += "<button value=\"Create Scheme\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" create $name no_name x x\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" return HTML def deleteScheme() : HTML = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src= \"L2UI_CH3.herotower_deco\" width=256 height=32><br>Available schemes:<br><br>" conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer ().getObjectId())) action=rss.executeQuery() while (action.next()) : try : HTML += "<button value=\""+action.getString("scheme_name")+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_c "+action.getString("id")+" "+action.getString("scheme_name")+" x\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" except : print "Query error!" try : conn.close() except : pass HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" return HTML def editScheme() : name = ""; id = "" HTML = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src= \"L2UI_CH3.herotower_deco\" width=256 height=32><br>Select a scheme that you would like to manage:<br><br>" conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer ().getObjectId())) action=rss.executeQuery() while (action.next()) : try : name = action.getString("scheme_name") id = action.getString("id") HTML += "<button value=\""+name+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_select "+id+" x x\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" except : print "Query error!" try : conn.close() except : pass HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" return HTML def getOptionList(scheme) : Bcount = getBuffCount(scheme) HTML = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src= \"L2UI_CH3.herotower_deco\" width=256 height=32><br>tem <font color=\"LEVEL\">"+str(Bcount)+"</font> lustres em corrente scheme!<br><br>" if Bcount < MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES: HTML += "<button value=\"Add buffs\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_1 "+str(scheme)+" 1 x\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if Bcount > 0 : HTML += "<button value=\"Remove buffs\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_2 "+str(scheme)+" 1 x\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_1 0 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML += "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" return HTML def buildHtml(buffType): HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><br>" if FREE_BUFFS == True : HTML_MESSAGE += "All buffs are for <font color=\"LEVEL\">free</font>!" else : price = 0 if buffType == "buff" : price = BUFF_PRICE if buffType == "resist" : price = RESIST_PRICE if buffType == "song" : price = SONG_PRICE if buffType == "dance" : price = DANCE_PRICE if buffType == "chant" : price = CHANT_PRICE if buffType == "others" : price = OTHERS_PRICE if buffType == "special" : price = SPECIAL_PRICE if buffType == "cubic" : price = CUBIC_PRICE HTML_MESSAGE += "All special buffs cost <font color=\"LEVEL\">"+str(price)+"</font> adena!" HTML_MESSAGE += "<table>" conn=L2DatabaseFactory.getInstance().getConnection() buffCount = 0; i = 0 getList = conn.prepareStatement("SELECT * FROM buffer_buff_list WHERE buffType=\""+buffType+"\" AND canUse=1") rs=getList.executeQuery() while (rs.next()) : try : buffCount += 1 except : buffCount = 0 if buffCount == 0 : HTML_MESSAGE += "No buffs are available at this moment!<br>" else : availableBuffs = [] getList = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE buffType=\""+buffType+"\" AND canUse=1 ORDER BY Buff_Class ASC, id") rs=getList.executeQuery() while (rs.next()) : try : bId = rs.getInt("buffId") bLevel = rs.getInt("buffLevel") bName = SkillTable.getInstance().getInfo(bId,bLevel).getName() bName = bName.replace(" ","+") availableBuffs += [bName+"_"+str(bId)+"_"+str(bLevel)] except: HTML_MESSAGE += "Error loading buff list...<br>" try : conn.close() except : pass avBuffs = len(availableBuffs) format = "0000" for avBuffs in availableBuffs : buff = avBuffs buff = buff.replace("_"," ") buffSplit = buff.split(" ") name = buffSplit[0] id = int(buffSplit[1]) level = buffSplit[2] name = name.replace("+"," ") if id < 100 : format = "00"+str(id) elif id > 99 and id < 1000 : format = "0"+str(id) else : if id > 4698 and id < 4701 : format = "1331" elif id > 4701 and id < 4704 : format = "1332" else: format = str(id) i += 1 HTML_MESSAGE += "<tr><td><img src=\"Icon.skill"+format+"\" width=32 height=32></td><td><button value=\""+name+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs "+str(id)+" "+str(level)+" "+buffType+"\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>" HTML_MESSAGE += "</table><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" return HTML_MESSAGE def generateQuery(case,case2) : aa = 1; count = 0; qry = ""; buffTypes = [] if ENABLE_BUFFS == True and case < MAX_SCHEME_BUFFS: count += 1 buffTypes += ["\"buff\""] if ENABLE_RESIST == True and case < MAX_SCHEME_BUFFS: count += 1 buffTypes += ["\"resist\""] if ENABLE_SONGS == True and case2 < MAX_SCHEME_DANCES: count += 1 buffTypes += ["\"song\""] if ENABLE_DANCES == True and case2 < MAX_SCHEME_DANCES: count += 1 buffTypes += ["\"dance\""] if ENABLE_CHANTS == True and case < MAX_SCHEME_BUFFS: count += 1 buffTypes += ["\"chant\""] if ENABLE_OTHERS == True and case < MAX_SCHEME_BUFFS: count += 1 buffTypes += ["\"others\""] if ENABLE_SPECIAL == True and case < MAX_SCHEME_BUFFS: count += 1 buffTypes += ["\"special\""] while aa <= count : if aa == count : qry += buffTypes[aa-1] else : qry += buffTypes[aa-1]+"," aa += 1 return qry def viewAllSchemeBuffs(scheme,page,action) : def getBuffCount(scheme) : count = 0; D_S_Count = 0; B_Count = 0 conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str (scheme)+"\"") action=rss.executeQuery() while (action.next()) : try : val = action.getInt("buff_class") count += 1 if val == 1 or val == 2: D_S_Count += 1 else: B_Count += 1 except : count = 0; D_S_Count = 0 ; B_Count = 0 res = str(count) + " " + str(B_Count) + " " + str(D_S_Count) try : conn.close() except : pass return res buffList = [] conn=L2DatabaseFactory.getInstance().getConnection() count = 0; pc = 0; bll = 0; i = 0; buffsPerPage = 0; incPageCount = True; listOrder="" HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><br>" eventSplit = getBuffCount(scheme).split(" ") TOTAL_BUFF = int(eventSplit[0]); BUFF_COUNT = int(eventSplit[1]); DANCE_SONG = int(eventSplit[2]) if action == "add" : HTML_MESSAGE += "You can add <font color=\"LEVEL\">"+str(MAX_SCHEME_BUFFS - BUFF_COUNT)+"</font> Buffs and <font color=\"LEVEL\">"+str(MAX_SCHEME_DANCES - DANCE_SONG)+"</font> Dances more!" QUERY = "SELECT * FROM buffer_buff_list WHERE buffType IN ("+ generateQuery (BUFF_COUNT,DANCE_SONG) + ") AND canUse=1 ORDER BY Buff_Class ASC, id" if action == "remove" : HTML_MESSAGE += "You have <font color=\"LEVEL\">"+str(BUFF_COUNT)+"</font> Buffs and <font color=\"LEVEL\">"+str(DANCE_SONG)+"</font> Dances" QUERY = "SELECT * FROM buffer_scheme_contents WHERE scheme_id="+str(scheme)+" ORDER BY Buff_Class ASC, id" getBuffCount = conn.prepareStatement(QUERY) rss = getBuffCount.executeQuery() while (rss.next()) : try : if action == "add" : name = SkillTable.getInstance().getInfo(rss.getInt("buffId"),rss.getInt ("buffLevel")).getName() name = name.replace(" ","+") buffList += [name+"_"+str(rss.getInt("buffId"))+"_"+str(rss.getInt ("buffLevel"))+"_"+str(page)] if action == "remove" : name = SkillTable.getInstance().getInfo(rss.getInt("skill_id"),rss.getInt ("skill_level")).getName() name = name.replace(" ","+") buffList += [name+"_"+str(rss.getInt("skill_id"))+"_"+str(rss.getInt ("skill_level"))+"_"+str(page)] count = count + 1 except : buffList = [] count = 0 try : conn.close() except : pass HTML_MESSAGE += "<table border=\"0\"><tr>" buffsPerPage = 20 while incPageCount == True: # generating page count if count < buffsPerPage : incPageCount = False else : count = count - buffsPerPage pc += 1 ii = 1 while ii <= pc : if pc > 5 : width = "25" pageName = "P" else : width = "50" pageName = "Page " if action == "add" : HTML_MESSAGE += "<td width=\""+width+"\"><button value=\""+pageName +""+str(ii)+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_1 "+str(scheme)+" "+str(ii)+" x\" width=51 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" if action == "remove" : HTML_MESSAGE += "<td width=\""+width+"\"><button value= \""+pageName+""+str(ii)+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_2 "+str(scheme)+" "+str(ii)+" x\" width=51 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" ii += 1 HTML_MESSAGE += "</tr></table>" value = ""; bll = len(buffList); j = 0; k=0 if buffsPerPage*int(page) > bll : j = bll else : j = buffsPerPage*int(page) i = buffsPerPage*int(page)-buffsPerPage while i < j : value = buffList[i] value = value.replace("_"," ") extr = value.split(" ") name = extr[0] name = name.replace("+"," ") id = int(extr[1]) level = extr[2] page = int(extr[3]) if id < 100 : format = "00"+str(id) elif id > 99 and id < 1000 : format = "0"+str(id) else : if id > 4698 and id < 4701 : format = "1331" elif id > 4701 and id < 4704 : format = "1332" else: format = str(id) if action == "add": if isUsed(scheme,id,level) == False: if k % 2 != 0 : HTML_MESSAGE += "<table border=\"0\" bgcolor=FFF500>" else : HTML_MESSAGE += "<table border=\"0\" bgcolor=000000>" HTML_MESSAGE += "<tr><td width=\"35\"><img src=\"Icon.skill"+format+"\" width=32 height=32></td><td width=\"170\">"+name+"</td><td><button value=\"Add\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" add_buff "+str(scheme)+"_"+str(id)+"_"+str(level)+" "+str(page)+" "+str(TOTAL_BUFF)+"\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" HTML_MESSAGE += "</tr></table>"; k+=1 if action == "remove": if k % 2 != 0 : HTML_MESSAGE += "<table border=\"0\" bgcolor=FFF500>" else : HTML_MESSAGE += "<table border=\"0\" bgcolor=000000>" HTML_MESSAGE += "<tr><td width=\"35\"><img src=\"Icon.skill"+format+"\" width=32 height=32></td><td width=\"170\">"+name+"</td><td><button value=\"Remove\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" remove_buff "+str(scheme)+"_"+str(id)+"_"+str(level)+" "+str(page)+" "+str(TOTAL_BUFF)+"\" width=60 height=21 back= \"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" HTML_MESSAGE += "</table>"; k+=1 i += 1 HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_select "+str(scheme)+" x x\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" return HTML_MESSAGE def viewAllBuffTypes() : HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src= \"L2UI_CH3.herotower_deco\" width=256 height=32><br>" HTML_MESSAGE += "<font color=\"LEVEL\">[Buff management]</font><br>" if ENABLE_BUFFS == True : HTML_MESSAGE += "<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list buff Buffs 1\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if ENABLE_RESIST == True : HTML_MESSAGE += "<button value=\"Resist Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list resist Resists 1\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore= \"L2UI_ct1.button_df\">" if ENABLE_SONGS == True : HTML_MESSAGE += "<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list song Songs 1\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if ENABLE_DANCES == True : HTML_MESSAGE += "<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list dance Dances 1\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if ENABLE_CHANTS == True : HTML_MESSAGE += "<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list chant Chants 1\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if ENABLE_SPECIAL == True : HTML_MESSAGE += "<button value=\"Special Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list special Special_Buffs 1\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore= \"L2UI_ct1.button_df\">" if ENABLE_OTHERS == True : HTML_MESSAGE += "<button value=\"Others Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list others Others_Buffs 1\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore= \"L2UI_ct1.button_df\">" if ENABLE_CUBIC == True : HTML_MESSAGE += "<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list cubic cubic_Buffs 1\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if ENABLE_BUFF_SET == True : HTML_MESSAGE += "<button value=\"Buff Sets\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list set Buff_Sets 1\" width=203 height=21 back=\"L2UI_ct1.button_df\" fore= \"L2UI_ct1.button_df\"><br>" HTML_MESSAGE += "<button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" return HTML_MESSAGE def viewAllBuffs(type,typeName,page) : buffList = [] conn=L2DatabaseFactory.getInstance().getConnection() count = 0; pc = 0; bll = 0; i = 0; buffsPerPage = 0; formula = 0 ; incPageCount = True ; listOrder="" HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src= \"L2UI_CH3.herotower_deco\" width=256 height=32><br>" typeName = typeName.replace("_"," ") if type == "set" : QUERY = "SELECT * FROM buffer_buff_list WHERE buffType IN ("+generateQuery (0,0)+") AND canUse=1" else : QUERY = "SELECT * FROM buffer_buff_list WHERE buffType=\""+type+"\"" getBuffCount = conn.prepareStatement(QUERY) rss = getBuffCount.executeQuery() while (rss.next()) : try : name = SkillTable.getInstance().getInfo(rss.getInt("buffId"),rss.getInt ("buffLevel")).getName() name = name.replace(" ","+") usable = rss.getString("canUse") forClass = rss.getString("forClass") skill_id = rss.getString("buffId") skill_level = rss.getString("buffLevel") buffList += [name+"_"+forClass+"_"+str(page)+"_"+usable+"_"+skill_id +"_"+skill_level] count = count + 1 except : buffList = [] count = 0 try : conn.close() except : pass buffList.sort() HTML_MESSAGE += "<font color=\"LEVEL\">[Buff management - "+typeName+" - Page "+str (page)+"]</font><br><table border=\"0\"><tr>" if type == "set" : buffsPerPage = 12 else : buffsPerPage = 20 while incPageCount == True: if count < buffsPerPage : incPageCount = False else : count -= buffsPerPage pc += 1 ii = 1 typeName = typeName.replace(" ","_") while ii <= pc : if pc > 5 : width = "25" pageName = "P" else : width = "50" pageName = "Page " HTML_MESSAGE += "<td width=\""+width+"\"><button value=\""+pageName+""+str(ii)+"\" action= \"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list "+type+" "+typeName+" "+str(ii)+"\" width="+width+" height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" ii += 1 HTML_MESSAGE += "</tr></table><br>" value = ""; bll = len(buffList); j = 0 if buffsPerPage*int(page) > bll : j = bll else : j = buffsPerPage*int(page) i = buffsPerPage*int(page)-buffsPerPage while i < j : value = buffList[i] value = value.replace("_"," ") extr = value.split(" ") name = extr[0] name = name.replace("+"," ") forClass = int(extr[1]) page = extr[2] usable = int(extr[3]) skillPos = extr[4]+"_"+extr[5] if i % 2 != 0 : HTML_MESSAGE += "<table border=\"0\" bgcolor=FFF500>" else : HTML_MESSAGE += "<table border=\"0\" bgcolor=000000>" if type == "set" : if forClass == 0 : listOrder="List=\"Fighter;Mage;All;None;\"" if forClass == 1 : listOrder="List=\"Mage;Fighter;All;None;\"" if forClass == 2 : listOrder="List=\"All;Fighter;Mage;None;\"" if forClass == 3 : listOrder="List=\"None;Fighter;Mage;All;\"" HTML_MESSAGE += "<tr><td width=\"145\">"+name+"</td><td width=\"70\"><combobox var=\"newSet"+str(i)+"\" width=70 "+listOrder+"></td>" HTML_MESSAGE += "<td width=\"50\"><button value=\"Update\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " changeBuffSet "+str(skillPos)+" $newSet"+str(i)+" "+page+"\" width=60 height=21 back= \"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>" else : HTML_MESSAGE += "<tr><td width=\"170\">"+name+"</td><td width=\"80\">" if usable == 1 : HTML_MESSAGE += "<button value=\"Disable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff "+skillPos+" 0-"+page+" "+type+"\" width=120 height=21 back= \"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>" elif usable == 0 : HTML_MESSAGE += "<button value=\"Enable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff "+skillPos+" 1-"+page+" "+type+"\" width=120 height=21 back= \"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>" HTML_MESSAGE += "</table>" i += 1 HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" return HTML_MESSAGE def manageSelectedBuff(buffPosId,canUseBuff) : bpid = buffPosId.split("_") bId= bpid[0] bLvl= bpid[1] conn=L2DatabaseFactory.getInstance().getConnection() upd=conn.prepareStatement("UPDATE buffer_buff_list SET canUse=\""+canUseBuff+"\" WHERE buffId= \""+str(bId)+"\" AND buffLevel=\""+str(bLvl)+"\" LIMIT 1") try : upd.executeUpdate() upd.close() conn.close() except : try : conn.close() except : pass def manageSelectedSet(id,newVal,opt3) : bpid = id.split("_") bId= bpid[0] bLvl= bpid[1] conn=L2DatabaseFactory.getInstance().getConnection() upd=conn.prepareStatement("UPDATE buffer_buff_list SET forClass=? WHERE buffId=? AND bufflevel=?") upd.setString(1, newVal) upd.setString(2, str(bId)) upd.setString(3, str(bLvl)) try : upd.executeUpdate() upd.close() conn.close() except : try : conn.close() except : pass return viewAllBuffs("set","Buff Sets",str(opt3)) def addTimeout(gaugeColor,amount,offset) : endtime = int((System.currentTimeMillis() + (amount * 1000))/1000) st.set("blockUntilTime",str(endtime)) st.getPlayer().sendPacket(SetupGauge(gaugeColor, amount * 1000 + offset)) def heal(case) : if case == 0: st.getPlayer().getStatus().setCurrentHp(st.getPlayer().getStat().getMaxHp()) st.getPlayer().getStatus().setCurrentMp(st.getPlayer().getStat().getMaxMp()) st.getPlayer().getStatus().setCurrentCp(st.getPlayer().getStat().getMaxCp()) if case == 1 and st.player.getPet() != None : st.player.getPet().getStatus().setCurrentHp(st.player.getPet().getStat().getMaxHp()) st.player.getPet().getStatus().setCurrentMp(st.player.getPet().getStat().getMaxMp()) try: st.player.getPet().setCurrentFed(st.player.getPet().getMaxFed()) st.player.sendPacket(SetSummonRemainTime(st.player.getPet().getMaxFed(), st.player.getPet().getCurrentFed())) except: try: st.player.getPet().decTimeRemaining(st.player.getPet().getTimeRemaining() - st.player.getPet().getTotalLifeTime()) st.player.sendPacket(SetSummonRemainTime(st.player.getPet ().getTotalLifeTime(), st.player.getPet().getTimeRemaining())) except: pass eventSplit = event.split(" ") event = eventSplit[0] eventParam1 = eventSplit[1] eventParam2 = eventSplit[2] eventParam3 = eventSplit[3] if event == "reloadscript": if eventParam1 == "1": return ReloadConfig(st) if eventParam1 == "0": return rebuildMainHtml(st) if event == "redirect" : if eventParam1 == "main" : return rebuildMainHtml(st) if eventParam1 == "manage_buffs" : return viewAllBuffTypes() if event == "buffpet" : if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") : st.set("Pet-On-Off",eventParam1) if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME/2,600) return rebuildMainHtml(st) if event == "create" : con=L2DatabaseFactory.getInstance().getConnection() param = eventParam1.replace("."," ") if param == "no_name" : return showText(st,"Info","Please, enter the scheme name!","True","Return","main") else : ins = con.prepareStatement("INSERT INTO buffer_scheme_list (player_id,scheme_name) VALUES (?,?)") ins.setString(1, str(st.player.getObjectId())) ins.setString(2, param) try : ins.executeUpdate() ins.close() con.close() except : pass return rebuildMainHtml(st) if event == "delete" : conn=L2DatabaseFactory.getInstance().getConnection() rem=conn.prepareStatement("DELETE FROM buffer_scheme_list WHERE id=? LIMIT 1") rem.setString(1, eventParam1) try : rem.executeUpdate() except : pass rem=conn.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=?") rem.setString(1, eventParam1) try : rem.executeUpdate() rem.close() conn.close() except : try : conn.close() except : pass return rebuildMainHtml(st) if event == "delete_c" : HTML = HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src= \"L2UI_CH3.herotower_deco\" width=256 height=32><br>Do you really want to delete '"+eventParam2+"' scheme?<br><br>" HTML += "<button value=\"Yes\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete "+eventParam1+" x x\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML += "<button value=\"No\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_1 x x x\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>" return HTML if event == "create_1" : return createScheme() if event == "edit_1" : return editScheme() if event == "delete_1" : return deleteScheme() if event == "manage_scheme_1" : return viewAllSchemeBuffs(eventParam1,eventParam2,"add") if event == "manage_scheme_2" : return viewAllSchemeBuffs(eventParam1,eventParam2,"remove") if event == "manage_scheme_select" : return getOptionList(eventParam1) if event == "remove_buff" : event = eventParam1.split("_") scheme = event[0] skill = event[1] level = event[2] con=L2DatabaseFactory.getInstance().getConnection() rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1") rem.setString(1, scheme) rem.setString(2, skill) rem.setString(3, level) try : rem.executeUpdate() except : pass temp=int(eventParam3) - 1 if temp <= 0 : HTML = getOptionList(scheme) else : HTML = viewAllSchemeBuffs(scheme,eventParam2,"remove") return HTML if event == "add_buff" : event = eventParam1.split("_") scheme = event[0] skill = event[1] level = event[2] idbuffclass = getclassbuff(skill) con=L2DatabaseFactory.getInstance().getConnection() ins = con.prepareStatement("INSERT INTO buffer_scheme_contents (scheme_id,skill_id,skill_level,buff_class) VALUES (?,?,?,?)") ins.setString(1, str(scheme)) ins.setString(2, str(skill)) ins.setString(3, str(level)) ins.setString(4, str(idbuffclass)) try : ins.executeUpdate() ins.close() con.close() except : pass temp = int(eventParam3) + 1 if temp >= MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES : HTML = getOptionList(scheme) else : HTML = viewAllSchemeBuffs(scheme,eventParam2,"add") return HTML if event == "edit_buff_list" : return viewAllBuffs(eventParam1,eventParam2,eventParam3) if event == "changeBuffSet" : eventParam2 = eventParam2.replace("Fighter","0") eventParam2 = eventParam2.replace("Mage","1") eventParam2 = eventParam2.replace("All","2") eventParam2 = eventParam2.replace("None","3") return manageSelectedSet(eventParam1,eventParam2,eventParam3) if event == "editSelectedBuff" : eventParam2 = eventParam2.replace("-"," ") split = eventParam2.split(" ") action = split[0] page = split[1] manageSelectedBuff(eventParam1,action) if eventParam3 == "buff" : typeName = "Buffs" if eventParam3 == "resist" : typeName = "Resists" if eventParam3 == "song" : typeName = "Songs" if eventParam3 == "dance" : typeName = "Dances" if eventParam3 == "chant" : typeName = "Chants" if eventParam3 == "others" : typeName = "Others_Buffs" if eventParam3 == "special" : typeName = "Special_Buffs" if eventParam3 == "cubic" : typeName = "Cubics" return viewAllBuffs(eventParam3,typeName,page) if event == "viewSelectedConfig" : return viewSelectedConfig(eventParam1,eventParam2) if event == "changeConfig" : return updateConfigValue(eventParam1,eventParam2,eventParam3) if event == "redirect" : if eventParam1 == "view_buffs" : return buildHtml("buff") if eventParam1 == "view_resists" : return buildHtml("resist") if eventParam1 == "view_songs" : return buildHtml("song") if eventParam1 == "view_dances" : return buildHtml("dance") if eventParam1 == "view_chants" : return buildHtml("chant") if eventParam1 == "view_others" : return buildHtml("others") if eventParam1 == "view_special" : return buildHtml("special") if eventParam1 == "view_cubic" : return buildHtml("cubic") if event == "heal" : if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"): if st.getQuestItemsCount(CONSUMABLE_ID) < HEAL_PRICE : return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(HEAL_PRICE)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0) else : if getpetbuff == 1 : if st.player.getPet() != None : heal(getpetbuff) else: return showText(st,"Info","You can't use Pet options.<br>Summon your pet first!","False","Return","main") else : heal(getpetbuff) st.takeItems(CONSUMABLE_ID,HEAL_PRICE) if TIME_OUT == True: addTimeout(1,TIME_OUT_TIME/2,600) return rebuildMainHtml(st) return rebuildMainHtml(st) if event == "removeBuffs" : if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"): if st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_REMOVE_PRICE : return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(BUFF_REMOVE_PRICE)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0) else : if getpetbuff == 1 : if st.player.getPet() != None : st.player.getPet().stopAllEffects() else: return showText(st,"Info","You can't use Pet options.<br>Summon your pet first!","False","Return","main") else : st.getPlayer().stopAllEffects() if st.player.getCubics() != None: for cubic in st.player.getCubics().values(): cubic.stopAction() st.player.delCubic(cubic.getId()) st.takeItems(CONSUMABLE_ID,BUFF_REMOVE_PRICE) if TIME_OUT == True: addTimeout(2,TIME_OUT_TIME/2,600) return rebuildMainHtml(st) return rebuildMainHtml(st) if event == "cast" : if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") : buffs = []; levels = []; id = 0; level = 0 conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id="+eventParam1+" ORDER BY id") action=rss.executeQuery() while (action.next()) : try : enabled = 1 id = int(action.getString("skill_id")) level = int(action.getString("skill_level")) skillType = getBuffType(id) if skillType == "buff" : if ENABLE_BUFFS == True : if isEnabled(id,level) == "True" : buffs += [id] levels += [level] if skillType == "resist" : if ENABLE_RESIST == True : if isEnabled(id,level) == "True" : buffs += [id] levels += [level] if skillType == "song" : if ENABLE_SONGS == True : if isEnabled(id,level) == "True" : buffs += [id] levels += [level] if skillType == "dance" : if ENABLE_DANCES == True : if isEnabled(id,level) == "True" : buffs += [id] levels += [level] if skillType == "chant" : if ENABLE_CHANTS == True : if isEnabled(id,level) == "True" : buffs += [id] levels += [level] if skillType == "others" : if ENABLE_OTHERS == True : if isEnabled(id,level) == "True" : buffs += [id] levels += [level] if skillType == "special" : if ENABLE_SPECIAL == True : if isEnabled(id,level) == "True" : buffs += [id] levels += [level] except : print "Query error!" try : conn.close() except : pass if len(buffs) == 0 : return viewAllSchemeBuffs(eventParam1,1,"add") else : if FREE_BUFFS == False : if st.getQuestItemsCount(CONSUMABLE_ID) < SCHEME_BUFF_PRICE : return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(SCHEME_BUFF_PRICE)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0) i = 0 while i <= len(buffs) - 1 : if getpetbuff == 0 : SkillTable.getInstance().getInfo(buffs[i],levels [i]).getEffects(st.player,st.player) else: if st.player.getPet() != None : SkillTable.getInstance().getInfo (buffs[i],levels[i]).getEffects(st.getPlayer().getPet(),st.getPlayer().getPet()) else: return showText(st,"Info","You can't use Pet options.<br>Summon your pet first!","False","Return","main") i += 1 heal(getpetbuff) st.takeItems(CONSUMABLE_ID,SCHEME_BUFF_PRICE) if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME,600) return rebuildMainHtml(st) else : return rebuildMainHtml(st) if event == "giveBuffs" : if eventParam3 == "buff" : cost = BUFF_PRICE if eventParam3 == "resist" : cost = RESIST_PRICE if eventParam3 == "song" : cost = SONG_PRICE if eventParam3 == "dance" : cost = DANCE_PRICE if eventParam3 == "chant" : cost = CHANT_PRICE if eventParam3 == "others" : cost = OTHERS_PRICE if eventParam3 == "special" : cost = SPECIAL_PRICE if eventParam3 == "cubic" : cost = CUBIC_PRICE if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") : if FREE_BUFFS == False : if st.getQuestItemsCount(CONSUMABLE_ID) < cost : return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(skill.getItemConsume())+" "+str(getitemname(st,skill.getItemConsumeId()))+"!","False",0,0) skill=SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)) if str(skill.getSkillType()) == "SUMMON": if st.getQuestItemsCount(skill.getItemConsumeId()) < skill.getItemConsume(): return showText(st,"desculpe","Voce nao tem os elementos suficientes:<br>que voce precisa: <font color =\"LEVEL\">"+str(skill.getItemConsume())+" "+str(getitemname (st,skill.getItemConsumeId()))+"!","False",0,0) if getpetbuff == 0 : if eventParam3 == "cubic" : if st.player.getCubics() != None: for cubic in st.player.getCubics().values(): cubic.stopAction() st.player.delCubic(cubic.getId()) st.getPlayer().useMagic(SkillTable.getInstance().getInfo(int (eventParam1),int(eventParam2)),False,False) else: SkillTable.getInstance().getInfo(int(eventParam1),int (eventParam2)).getEffects(st.getPlayer(),st.getPlayer()) else: if eventParam3 == "cubic": if st.player.getCubics() != None: for cubic in st.player.getCubics().values(): cubic.stopAction() st.player.delCubic(cubic.getId()) st.getPlayer().useMagic(SkillTable.getInstance().getInfo(int (eventParam1),int(eventParam2)),False,False) else: if st.player.getPet() != None : SkillTable.getInstance().getInfo(int (eventParam1),int(eventParam2)).getEffects(st.getPlayer().getPet(),st.getPlayer().getPet()) else: return showText(st,"Info","You can't use Pet options.<br>Summon your pet first!","False","Return","main") st.takeItems(CONSUMABLE_ID,cost) if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME/10,600) return buildHtml(eventParam3) else : return buildHtml(eventParam3) if event == "castBuffSet" : if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") : if FREE_BUFFS == False : if st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_SET_PRICE : return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(BUFF_SET_PRICE)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0) buff_sets=[]; i = 0; player_class = 3 if st.getPlayer().isMageClass() : player_class = 1 else : player_class = 0 if getpetbuff == 0 : conn=L2DatabaseFactory.getInstance().getConnection() getSimilarNameCount = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC") getSimilarNameCount.setString(1, str(player_class)) getSimilarNameCount.setString(2, "2") rss = getSimilarNameCount.executeQuery() while (rss.next()) : try : id = rss.getInt("buffId") lvl = rss.getInt("buffLevel") buff_sets += [id,lvl] except : buff_sets = [] try: conn.close() except: pass while i <= len(buff_sets)-2 : SkillTable.getInstance().getInfo(buff_sets[i],buff_sets[i+1]).getEffects (st.getPlayer(),st.getPlayer()) i += 2 else: if st.player.getPet() != None : i = 0 conn=L2DatabaseFactory.getInstance().getConnection() getSimilarNameCount = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC") getSimilarNameCount.setString(1, "0") getSimilarNameCount.setString(2, "2") rss = getSimilarNameCount.executeQuery() while (rss.next()) : try : id = rss.getInt("buffId") lvl = rss.getInt("buffLevel") buff_sets += [id,lvl] except : buff_sets = [] try: conn.close() except: pass while i <= len(buff_sets)-2 : SkillTable.getInstance().getInfo(buff_sets[i],buff_sets[i +1]).getEffects(st.getPlayer().getPet(),st.getPlayer().getPet()) i += 2 else: return showText(st,"Info","You can't use Pet options.<br>Summon your pet first!","False","Return","main") heal(getpetbuff) st.takeItems(CONSUMABLE_ID,BUFF_SET_PRICE) if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME,600) return rebuildMainHtml(st) else : return rebuildMainHtml(st) return rebuildMainHtml(st) def onFirstTalk (self,npc,player): st = player.getQuestState(QUEST_LOADING_INFO) if not st : st = self.newQuestState(player) if player.isGM(): if SCRIPT_RELOAD == True: return reloadPanel(st) else: return rebuildMainHtml(st) elif int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"): if ENABLE_VIP_BUFFER == False or player.getAccessLevel().getLevel() == VIP_ACCESS_LEVEL and ENABLE_VIP_BUFFER == True: if BUFF_WITH_KARMA == False and player.getKarma() > 0 : return showText(st,"Info","You have too much <font color=\"FF0000\">karma! </font><br>Come back,<br>when you don't have any karma!","False","Return","main") elif st.player.getLevel() < MIN_LEVEL : return showText(st,"Info","Your level is too low!<br>You have to be at least level <font color\"LEVEL\">"+str(MIN_LEVEL)+"</font>,<br>to use my services!","False","Return","main") elif st.player.getPvpFlag() > 0 : return showText(st,"Info","You can't buff while you are <font color= \"800080\">flagged!</font><br>Wait some time and try again!","False","Return","main") elif st.player.isInCombat() : return showText(st,"Info","You can't buff while you are attacking!<br>Stop your fight and try again!","False","Return","main") else: return rebuildMainHtml(st) else: return showText(st,"Sorry","This buffer is only for VIP's!<br>Contact the administrator for more info!","False","Return","main") else: return showText(st,"Sorry","You have to wait a while!<br>if you wish to use my services!","False","Return","main") QUEST = Quest(QUEST_ID,QUEST_LOADING_INFO,QUEST_DESCRIPTION) QUEST.addStartNpc(NPC_ID) QUEST.addFirstTalkId(NPC_ID) QUEST.addTalkId(NPC_ID)
-
Help Poker Game Npc
protoftw replied to protoftw's question in Request Server Development Help [L2J]
Thanks for your advices I really appreciate that ..keep on staying positive and helping people..But before posting I had already tried it on eclipse and that's why i thought i should come here and post it to get some help..I did everything I could possibly do :P But anyway..Thanks again for your time and your help :) *Don't forget to be nice to ppl y'all. -
Help Poker Game Npc
protoftw replied to protoftw's question in Request Server Development Help [L2J]
Sweets, I can't learn how to use java or anything else that has to do with it..I don't have the knowledge to adapt it...All i know is simple things...like changing the imports and some other staff that you've told me or you've posted here on maxcheaters..All I can do is ask for some help ..if someone can help me then ..great! I'd be very thankful...if anyone can't help me then I can't do sth about that...i'll just have to move on and simply skip those codes..thanks for ur time! -
Hey guys i found that code which is supposed to be at data/scripts/custom and not inserted via eclipse. There is 1 file named poker.java ..i tried to adapt it for L2JFrozen but I still got problems that I don't know how to fix..If anyone has the knowledge and the skills to do that it would be pretty nice...Here's the code: http://pastebin.com/3YDFAdhW (it was too long to post it here) Here you can see the ERRORS I get : 1. https://postimg.org/image/d9qog45bd/ 2. https://postimg.org/image/3yx7773a7/ 3. https://postimg.org/image/vfc9r2vnl/ 4. https://postimg.org/image/us7fv7td1/ 5. https://postimg.org/image/77gr6jg85/ and here is the original code posted on maxcheaters: http://www.maxcheaters.com/topic/115260-poker-game/
-
i have rev 1132 and this code is not implemented...also l2jfrozen's website is down and i can't use their codes
-
i get 1 error guys..can anyone help me? here's the image --> https://postimg.org/image/nxbnci0fv/
-
L2jFrozen Survey System Originally made for l2j I adapted it for l2jfrozen and I also changed some typing mistakes Survey System is a system where you can ask all online players a question.You can have up to 5 possible answers.Your question will be announced after you start the survey and players can have the opportunity to vote with a "yes" or a "no" , or whatever your answers will be. After installation you can use these commands: //survey_start //survey_results //survey_end And for players: use .survey to vote Preview: //survey_start: https://postimg.org/image/f73j8byt5/ //survey_results: https://postimg.org/image/cgwcuwbgz/ credits: Elfocrash ### Eclipse Workspace Patch 1.0 #P l2jelfo Index: java/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java =================================================================== --- java/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 26) +++ java/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy) @@ -22,6 +22,7 @@ import com.l2jfrozen.gameserver.datatables.AdminCommandAccessRights; import com.l2jfrozen.gameserver.handler.AdminCommandHandler; import com.l2jfrozen.gameserver.handler.IAdminCommandHandler; +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSurvey; import com.l2jfrozen.gameserver.handler.usercommandhandlers.Menu; import com.l2jfrozen.gameserver.model.L2Object; import com.l2jfrozen.gameserver.model.L2World; @@ -96,6 +97,86 @@ { playerHelp(activeChar, _command.substring(12)); } + else if (_command.equals("survey_vote1")) + { + if(AdminSurvey.running == false) + { + activeChar.sendMessage("There is no survey running now"); + return; + } + + if(activeChar.hasVotedSurvey()) + { + activeChar.sendMessage("You already voted for that survey."); + return; + } + + AdminSurvey.ans1_vote_count++; + activeChar.sendMessage("You voted : " + AdminSurvey.ans1 + ". Thanks for voting"); + } + + else if (_command.equals("survey_vote2")) + { + if(AdminSurvey.running == false) + { + activeChar.sendMessage("There is no survey running now"); + return; + } + if(activeChar.hasVotedSurvey()) + { + activeChar.sendMessage("You already voted for that survey."); + return; + } + + AdminSurvey.ans2_vote_count++; + activeChar.sendMessage("You voted : " + AdminSurvey.ans2 + ". Thanks for voting"); + } + else if (_command.equals("survey_vote3")) + { + if(AdminSurvey.running == false) + { + activeChar.sendMessage("There is no survey running now"); + return; + } + if(activeChar.hasVotedSurvey()) + { + activeChar.sendMessage("You already voted for that survey."); + return; + } + AdminSurvey.ans3_vote_count++; + activeChar.sendMessage("You voted : " + AdminSurvey.ans3 + ". Thanks for voting"); + } + else if (_command.equals("survey_vote4")) + { + if(AdminSurvey.running == false) + { + activeChar.sendMessage("There is no survey running now"); + return; + } + if(activeChar.hasVotedSurvey()) + { + activeChar.sendMessage("You already voted for that survey."); + return; + } + AdminSurvey.ans4_vote_count++; + activeChar.sendMessage("You voted : " + AdminSurvey.ans4 + ". Thanks for voting"); + } + + else if (_command.equals("survey_vote5")) + { + if(AdminSurvey.running == false) + { + activeChar.sendMessage("There is no survey running now"); + return; + } + if(activeChar.hasVotedSurvey()) + { + activeChar.sendMessage("You already voted for that survey."); + return; + } + AdminSurvey.ans5_vote_count++; + activeChar.sendMessage("You voted : " + AdminSurvey.ans5 + ". Thanks for voting"); + } else if (_command.startsWith("npc_")) { if (!activeChar.validateBypass(_command)) Index: java/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java =================================================================== --- java/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (revision 26) +++ java/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (working copy) @@ -66,6 +66,7 @@ import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSiege; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSkill; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSpawn; +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSurvey; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminTarget; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminTeleport; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminUnblockIp; @@ -135,6 +136,7 @@ registerAdminCommandHandler(new AdminUnblockIp()); registerAdminCommandHandler(new AdminZone()); + registerAdminCommandHandler(new AdminSurvey()); } public void registerAdminCommandHandler(IAdminCommandHandler handler) Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java =================================================================== --- java/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 26) +++ java/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy) @@ -25,6 +25,7 @@ import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Heal; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Online; +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Survey; public class VoicedCommandHandler { @@ -45,6 +46,9 @@ { _datatable = new FastMap<>(); + registerVoicedCommandHandler(new Survey()); + + if (Config.ALLOW_ONLINE_VIEW) { registerVoicedCommandHandler(new Online()); Index: java/net/sf/l2j/gameserver/GameServer.java =================================================================== --- java/com/l2jfrozen/gameserver/GameServer.java (revision 26) +++ java/com/l2jfrozen/gameserver/GameServer.java (working copy) @@ -231,7 +231,7 @@ OlympiadGameManager.getInstance(); Olympiad.getInstance(); Hero.getInstance(); + //Hide.getInstance(); Util.printSection("Four Sepulchers"); FourSepulchersManager.getInstance().init(); Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSurvey.java =================================================================== --- java/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminSurvey.java (revision 0) +++ java/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminSurvey.java (working copy) @@ -0,0 +1,739 @@ +/* + * 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.handler.admincommandhandlers; + +import java.util.Collection; +import java.util.StringTokenizer; + +import javolution.text.TextBuilder; + +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler; +import com.l2jfrozen.gameserver.model.L2World; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; +import com.l2jfrozen.gameserver.network.clientpackets.Say2; +import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay; +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; +import com.l2jfrozen.gameserver.util.Broadcast; + +/** + * + * @author Elfocrash + * + */ +public class AdminSurvey implements IAdminCommandHandler +{ + public static int options = 2; + public static int mode = 0; + public static boolean running = false; + private static boolean qset = false; + private static boolean ans1set = false; + private static boolean ans2set = false; + private static boolean ans3set = false; + private static boolean ans4set = false; + private static boolean ans5set = false; + public static String quest = ""; + public static String ans1 = ""; + public static String ans2 = ""; + public static String ans3 = ""; + public static String ans4 = ""; + public static String ans5 = ""; + public static int ans1_vote_count = 0; + public static int ans2_vote_count = 0; + public static int ans3_vote_count = 0; + public static int ans4_vote_count = 0; + public static int ans5_vote_count = 0; + + private static final String[] ADMIN_COMMANDS = + { + "admin_survey_start" , "admin_survey_results" , "admin_opmore" , "admin_opless" , "admin_survey_run1","admin_survey_run2","admin_survey_run3","admin_survey_run4", "admin_survey_qset", + "admin_survey_ans1set", "admin_survey_ans2set","admin_survey_ans3set","admin_survey_ans4set","admin_survey_ans5set", "admin_survey_end" ,"admin_survey_results" + }; + + @Override + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + if (command.equals("admin_survey_start")) + startHtml(activeChar); + + if (command.equals("admin_survey_results")) + resultsHtml(activeChar); + + + if (command.equals("admin_survey_end")) + { + running = false; + resultsHtml(activeChar); + quest = ""; + ans1 = ""; + ans2 = ""; + ans3 = ""; + ans4 = ""; + ans5 = ""; + mode = 0; + ans1_vote_count = 0; + ans2_vote_count = 0; + ans3_vote_count = 0; + ans4_vote_count = 0; + ans5_vote_count = 0; + setQset(false); + setAns1set(false); + setAns2set(false); + setAns3set(false); + setAns4set(false); + setAns5set(false); + + Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers(); + for (L2PcInstance onlinePlayers : pls) + { + onlinePlayers.setHasVotedSurvey(false); + } + + + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The survey session is over.Thanks everyone for voting.")); + + } + + if(command.equals("admin_opmore")) + if(options <= 4) + { + options++; + startHtml(activeChar); + } + else + { + return false; + } + + if(command.equals("admin_opless")) + if(options >= 3) + { + options--; + startHtml(activeChar); + } + else + { + return false; + } + + if(command.startsWith("admin_survey_qset")) + { + if(isQset()) + { + quest = ""; + setQset(false); + startHtml(activeChar); + } + else if(!isQset()) + { + StringTokenizer s = new StringTokenizer(command); + s.nextToken(); + + try{ + + while(s.hasMoreTokens()) + quest = quest + s.nextToken() + " "; + setQset(true); + startHtml(activeChar); + + } + catch(Exception e) + { + e.printStackTrace(); + } + } + } + + if(command.startsWith("admin_survey_ans1set")) + { + if(isAns1set()) + { + ans1 = ""; + setAns1set(false); + startHtml(activeChar); + } + else if(!isAns1set()) + { + StringTokenizer s = new StringTokenizer(command); + s.nextToken(); + + try{ + + while(s.hasMoreTokens()) + ans1 = ans1 + s.nextToken() + " "; + setAns1set(true); + startHtml(activeChar); + + } + catch(Exception e) + { + e.printStackTrace(); + } + } + } + + if(command.startsWith("admin_survey_ans2set")) + { + if(isAns2set()) + { + ans2 = ""; + setAns2set(false); + startHtml(activeChar); + } + else if(!isAns2set()) + { + StringTokenizer s = new StringTokenizer(command); + s.nextToken(); + + try{ + + while(s.hasMoreTokens()) + ans2 = ans2 + s.nextToken() + " "; + setAns2set(true); + startHtml(activeChar); + + } + catch(Exception e) + { + e.printStackTrace(); + } + } + } + + if(command.startsWith("admin_survey_ans3set")) + { + if(isAns3set()) + { + ans3 = ""; + setAns3set(false); + startHtml(activeChar); + } + else if(!isAns3set()) + { + StringTokenizer s = new StringTokenizer(command); + s.nextToken(); + + try{ + + while(s.hasMoreTokens()) + ans3 = ans3 + s.nextToken() + " "; + setAns3set(true); + startHtml(activeChar); + + } + catch(Exception e) + { + e.printStackTrace(); + } + } + } + if(command.startsWith("admin_survey_ans4set")) + { + if(isAns4set()) + { + ans4 = ""; + setAns4set(false); + startHtml(activeChar); + } + else if(!isAns4set()) + { + StringTokenizer s = new StringTokenizer(command); + s.nextToken(); + + try{ + + while(s.hasMoreTokens()) + ans4 = ans4 + s.nextToken() + " "; + setAns4set(true); + startHtml(activeChar); + + } + catch(Exception e) + { + e.printStackTrace(); + } + } + } + + if(command.startsWith("admin_survey_ans5set")) + { + if(isAns5set()) + { + ans5 = ""; + setAns5set(false); + startHtml(activeChar); + } + else if(!isAns5set()) + { + StringTokenizer s = new StringTokenizer(command); + s.nextToken(); + + try{ + + while(s.hasMoreTokens()) + ans5 = ans5 + s.nextToken() + " "; + setAns5set(true); + startHtml(activeChar); + + } + catch(Exception e) + { + e.printStackTrace(); + } + } + } + + + + if(command.startsWith("admin_survey_run1")) + { + if(running == true) + { + activeChar.sendMessage("A survey is already in progress."); + return false; + } + if(!isQset() || !isAns1set() || !isAns2set()) + { + activeChar.sendMessage("You have to set all the fields before you start the survey"); + return false; + } + mode = 1; + running = true; + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","Admin started a new survey with main Question: "+ quest+". Use .survey to vote.")); + + + } + + if(command.startsWith("admin_survey_run2")) + { + if(running == true) + { + activeChar.sendMessage("A survey is already in progress"); + return false; + + } + if(!isQset() || !isAns1set() || !isAns2set() || !isAns3set()) + { + activeChar.sendMessage("You have to set all the fields before you start the survey"); + return false; + } + mode = 2; + running = true; + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","Admin started a new survey with main Question: "+ quest+". Use .survey to vote.")); + + + } + + if(command.startsWith("admin_survey_run3")) + { + if(running == true) + { + activeChar.sendMessage("A survey is already in progress"); + return false; + + } + + if(!isQset() || !isAns1set() || !isAns2set() || !isAns3set() || !isAns4set()) + { + activeChar.sendMessage("You have to set all the fields before you start the survey"); + return false; + } + mode = 3; + running = true; + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","Admin started a new survey with main Question: "+ quest+". Use .survey to vote.")); + + + } + + if(command.startsWith("admin_survey_run4")) + { + if(running == true) + { + activeChar.sendMessage("A survey is already in progress"); + return false; + + } + + if(!isQset() || !isAns1set() || !isAns2set() || !isAns3set() || !isAns4set() || !isAns5set()) + { + activeChar.sendMessage("You have to set all the fields before you start the survey"); + return false; + } + mode = 4; + running = true; + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","Admin started a new survey with main Question: "+ quest+". Use .survey to vote.")); + + + } + + return true; + } + + @Override + public String[] getAdminCommandList() + { + return ADMIN_COMMANDS; + } + + private static void startHtml(L2PcInstance activeChar) + { + NpcHtmlMessage nhm = new NpcHtmlMessage(5); + TextBuilder tb = new TextBuilder(""); + + tb.append("<html><head><title>Start Survey form</title></head><body>"); + tb.append("<center>"); + tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">"); + tb.append("<tr>"); + tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>"); + tb.append("<td valign=\"top\"><font color=\"FF6600\">Start a Survey</font>"); + tb.append("<br1><font color=\"FF6600\">"+activeChar.getName()+"</font>, use this form in order to start a survey.<br1></td>"); + tb.append("</tr>"); + tb.append("</table>"); + tb.append("</center>"); + tb.append("<center>"); + if(!isQset()) + { + tb.append("<font color=\"FF6600\">Type in the main question of the survey.</font><br>"); + tb.append("<table border=\"0\" width=\"250\" height=\"16\" bgcolor=\"000000\">"); + tb.append("<tr><td><multiedit var=\"quest\" width=170 height=20></td><td><a action=\"bypass -h admin_survey_qset $quest\">Save</a></td></tr></table>"); + } + if(isQset()) + { + tb.append("<font color=\"FF6600\">The question set is:<br>"); + tb.append("<table border=\"0\" width=\"250\" height=\"16\" bgcolor=\"000000\">"); + tb.append("<tr><td><font color=\"FF0000\">" + quest+"</font></td><td><a action=\"bypass -h admin_survey_qset\">Edit</a></td></tr></table>"); + } + tb.append("<br><font color=\"FF6600\">Possible answers."); + tb.append("<table border=\"0\" width=\"70\" height=\"16\" bgcolor=\"000000\">"); + tb.append("<tr>"); + tb.append("<td width=\"52\">More</td>"); + tb.append("<td width=\"16\"><button action=\"bypass -h admin_opmore\" width=16 height=16 back=\"L2UI_CH3.upbutton_down\" fore=\"L2UI_CH3.upbutton\"></td>"); + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td width=\"52\">Less</td>"); + tb.append("<td width=\"16\"><button action=\"bypass -h admin_opless\" width=16 height=16 back=\"L2UI_CH3.downbutton_down\" fore=\"L2UI_CH3.downbutton_down\"></td>"); + tb.append("</tr>"); + tb.append("</table>"); + tb.append("<table width=\"300\" height=\"20\">"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 1:</td>"); + if(!isAns1set()) + { + tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans1\" width=150 height=16></td>"); + tb.append("<td><a action=\"bypass -h admin_survey_ans1set $ans1\">Save</a></td>"); + } + else if(isAns1set()) + { + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans1 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans1set\">Edit</a></td>"); + } + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 2:</td>"); + if(!isAns2set()) + { + tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans2\" width=150 height=16></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans2set $ans2\">Save</a></td>"); + } + else if(isAns2set()) + { + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans2 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans2set\">Edit</a></td>"); + } + tb.append("</tr>"); + if(options == 3) + { + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>"); + if(!isAns3set()) + { + tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans3\" width=150 height=16></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set $ans3\">Save</a></td>"); + } + else if(isAns3set()) + { + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans3 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set\">Edit</a></td>"); + } + tb.append("</tr>"); + } + if(options == 4) + { + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>"); + if(!isAns3set()) + { + tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans3\" width=150 height=16></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set $ans3\">Save</a></td>"); + } + else if(isAns3set()) + { + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans3 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set\">Edit</a></td>"); + } + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 4:</td>"); + if(!isAns4set()) + { + tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans4\" width=150 height=16></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans4set $ans4\">Save</a></td>"); + } + else if(isAns4set()) + { + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans4 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans4set\">Edit</a></td>"); + } + tb.append("</tr>"); + } + if(options == 5) + { + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>"); + if(!isAns3set()) + { + tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans3\" width=150 height=16></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set $ans3\">Save</a></td>"); + } + else if(isAns3set()) + { + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans3 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans3set\">Edit</a></td>"); + } + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 4:</td>"); + if(!isAns4set()) + { + tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans4\" width=150 height=16></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans4set $ans4\">Save</a></td>"); + } + else if(isAns4set()) + { + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans4 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans4set\">Edit</a></td>"); + } + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 5:</td>"); + if(!isAns5set()) + { + tb.append("<td align=\"center\" width=\"150\"><multiedit var=\"ans5\" width=150 height=16></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans5set $ans5\">Save</a></td>"); + } + else if(isAns5set()) + { + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + ans5 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h admin_survey_ans5set\">Edit</a></td>"); + } + tb.append("</tr>"); + } + tb.append("</table><br>"); + if(options == 2) + tb.append("<button value=\"Start the survey\" action=\"bypass -h admin_survey_run1\" width=150 height=22 back=\"L2UI_Ch3.bigbutton3_over\" fore=\"L2UI_Ch3.bigbutton3\">"); + if(options == 3) + tb.append("<button value=\"Start the survey\" action=\"bypass -h admin_survey_run2\" width=150 height=22 back=\"L2UI_Ch3.bigbutton3_over\" fore=\"L2UI_Ch3.bigbutton3\">"); + if(options == 4) + tb.append("<button value=\"Start the survey\" action=\"bypass -h admin_survey_run3\" width=150 height=22 back=\"L2UI_Ch3.bigbutton3_over\" fore=\"L2UI_Ch3.bigbutton3\">"); + if(options == 5) + tb.append("<button value=\"Start the survey\" action=\"bypass -h admin_survey_run4\" width=150 height=22 back=\"L2UI_Ch3.bigbutton3_over\" fore=\"L2UI_Ch3.bigbutton3\">"); + tb.append("</center>"); + tb.append("</body></html>"); + + nhm.setHtml(tb.toString()); + activeChar.sendPacket(nhm); + } + + private static void resultsHtml(L2PcInstance activeChar) + { + NpcHtmlMessage nhm = new NpcHtmlMessage(5); + TextBuilder tb = new TextBuilder(""); + + tb.append("<html><head><title>Survey form</title></head><body>"); + tb.append("<center>"); + tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">"); + tb.append("<tr>"); + tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>"); + tb.append("<td valign=\"top\"><font color=\"FF6600\">Survey</font>"); + tb.append("<br1><font color=\"FF6600\">"+activeChar.getName()+"</font>, here are the survey's results.<br1></td>"); + tb.append("</tr>"); + tb.append("</table>"); + tb.append("</center>"); + tb.append("<center>"); + tb.append("<font color=\"FF6600\">The question set is:<br>"); + tb.append("<font color=\"FF0000\">" + AdminSurvey.quest+"</font></center>"); + tb.append("<br><font color=\"FF6600\">Choose an answer."); + tb.append("<table width=\"300\" height=\"20\">"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 1:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans1 + "</font></td>"); + tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans1_vote_count+ "</font></td>"); + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 2:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans2 + "</font></td>"); + tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans2_vote_count+ "</font></td>"); + tb.append("</tr>"); + if(mode == 2) + { + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans3 + "</font></td>"); + tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans3_vote_count+ "</font></td>"); + + tb.append("</tr>"); + } + if(mode == 3) + { + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans3 + "</font></td>"); + tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans3_vote_count+ "</font></td>"); + + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 4:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans4 + "</font></td>"); + tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans4_vote_count+ "</font></td>"); + + tb.append("</tr>"); + } + if(mode == 4) + { + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>"); + + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans3 + "</font></td>"); + tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans3_vote_count+ "</font></td>"); + + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 4:</td>"); + + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans4 + "</font></td>"); + tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans4_vote_count+ "</font></td>"); + + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 5:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans5 + "</font></td>"); + tb.append("<td align=\"center\"><font color=\"FF0000\">" + AdminSurvey.ans5_vote_count+ "</font></td>"); + + tb.append("</tr>"); + } + tb.append("</table><br>"); + if(running == true) + tb.append("<center><button value=\"End the survey\" action=\"bypass -h admin_survey_end\" width=150 height=22 back=\"L2UI_Ch3.bigbutton3_over\" fore=\"L2UI_Ch3.bigbutton3\"></center>"); + tb.append("</body></html>"); + + nhm.setHtml(tb.toString()); + activeChar.sendPacket(nhm); + } + + /** + * @return the qset + */ + public static boolean isQset() + { + return qset; + } + + /** + * @param qset the qset to set + */ + public static void setQset(boolean qset) + { + AdminSurvey.qset = qset; + } + + /** + * @return the ans1set + */ + public static boolean isAns1set() + { + return ans1set; + } + + /** + * @param ans1set the ans1set to set + */ + public static void setAns1set(boolean ans1set) + { + AdminSurvey.ans1set = ans1set; + } + + /** + * @return the ans2set + */ + public static boolean isAns2set() + { + return ans2set; + } + + /** + * @param ans2set the ans2set to set + */ + public static void setAns2set(boolean ans2set) + { + AdminSurvey.ans2set = ans2set; + } + + /** + * @return the ans3set + */ + public static boolean isAns3set() + { + return ans3set; + } + + /** + * @param ans3set the ans3set to set + */ + public static void setAns3set(boolean ans3set) + { + AdminSurvey.ans3set = ans3set; + } + + /** + * @return the ans4set + */ + public static boolean isAns4set() + { + return ans4set; + } + + /** + * @param ans4set the ans4set to set + */ + public static void setAns4set(boolean ans4set) + { + AdminSurvey.ans4set = ans4set; + } + + /** + * @return the ans5set + */ + public static boolean isAns5set() + { + return ans5set; + } + + /** + * @param ans5set the ans5set to set + */ + public static void setAns5set(boolean ans5set) + { + AdminSurvey.ans5set = ans5set; + } +} \ No newline at end of file Index: java/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Survey.java =================================================================== --- java/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Survey.java (revision 0) +++ java/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Survey.java (working copy) @@ -0,0 +1,155 @@ +/* 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 javolution.text.TextBuilder; + +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler; +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSurvey; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; + +/** + * + * @author Elfocrash + * + */ +public class Survey implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = { "survey" }; + + @Override + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) + { + if (command.equals("survey")) + { + if(AdminSurvey.running == false) + { + activeChar.sendMessage("There is no survey running now"); + return false; + } + + if(activeChar.hasVotedSurvey()) + { + activeChar.sendMessage("You already voted for that survey."); + return false; + } + + if(AdminSurvey.running == true) + mainHtml(activeChar); + } + + + + return true; + } + + private static void mainHtml(L2PcInstance activeChar) + { + NpcHtmlMessage nhm = new NpcHtmlMessage(5); + TextBuilder tb = new TextBuilder(""); + + tb.append("<html><head><title>Survey form</title></head><body>"); + tb.append("<center>"); + tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">"); + tb.append("<tr>"); + tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>"); + tb.append("<td valign=\"top\"><font color=\"FF6600\">Survey</font>"); + tb.append("<br1><font color=\"FF6600\">"+activeChar.getName()+"</font>, use this form in order to give us feedback.<br1></td>"); + tb.append("</tr>"); + tb.append("</table>"); + tb.append("</center>"); + tb.append("<center>"); + + tb.append("<font color=\"FF6600\">The question set is:<br>"); + tb.append("<font color=\"FF0000\">" + AdminSurvey.quest+"</font>"); + tb.append("<br><font color=\"FF6600\">Choose an answer."); + tb.append("<table width=\"300\" height=\"20\">"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 1:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans1 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h survey_vote1\">Vote</a></td>"); + + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 2:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans2 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h survey_vote2\">Vote</a></td>"); + + tb.append("</tr>"); + if(AdminSurvey.mode == 2) + { + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans3 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h survey_vote3\">Vote</a></td>"); + + tb.append("</tr>"); + } + if(AdminSurvey.mode == 3) + { + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans3 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h survey_vote3\">Vote</a></td>"); + + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 4:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans4 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h survey_vote4\">Vote</a></td>"); + + tb.append("</tr>"); + } + if(AdminSurvey.mode == 4) + { + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 3:</td>"); + + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans3 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h survey_vote3\">Vote</a></td>"); + + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 4:</td>"); + + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans4 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h survey_vote4\">Vote</a></td>"); + + tb.append("</tr>"); + tb.append("<tr>"); + tb.append("<td align=\"center\" width=\"40\">Answer 5:</td>"); + tb.append("<td align=\"center\" width=\"150\"><font color=\"FF0000\">" + AdminSurvey.ans5 + "</font></td>"); + tb.append("<td align=\"center\"><a action=\"bypass -h survey_vote5\">Vote</a></td>"); + + tb.append("</tr>"); + } + tb.append("</table><br>"); + tb.append("</center>"); + tb.append("</body></html>"); + + nhm.setHtml(tb.toString()); + activeChar.sendPacket(nhm); + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} \ No newline at end of file Index: java/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 26) +++ java/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -365,6 +365,7 @@ private String _accountName; private long _deleteTimer; + private boolean _hasVotedSurvey = false; private boolean _isOnline = false; private long _onlineTime; private long _onlineBeginTime; @@ -11662,4 +11663,20 @@ } } } + + /** + * @return the _hasVotedSurvey + */ + public boolean hasVotedSurvey() + { + return _hasVotedSurvey; + } + + /** + * @param _hasVotedSurvey the _hasVotedSurvey to set + */ + public void setHasVotedSurvey(boolean _hasVotedSurvey) + { + this._hasVotedSurvey = _hasVotedSurvey; + } } \ No newline at end of file ### Eclipse Workspace Patch 1.0 #P l2jelfo Index: java/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java =================================================================== --- java/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 27) +++ java/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy) @@ -112,6 +112,7 @@ } AdminSurvey.ans1_vote_count++; + activeChar.setHasVotedSurvey(true); activeChar.sendMessage("You voted : " + AdminSurvey.ans1 + ". Thanks for voting"); } @@ -129,6 +130,7 @@ } AdminSurvey.ans2_vote_count++; + activeChar.setHasVotedSurvey(true); activeChar.sendMessage("You voted : " + AdminSurvey.ans2 + ". Thanks for voting"); } else if (_command.equals("survey_vote3")) @@ -144,6 +146,7 @@ return; } AdminSurvey.ans3_vote_count++; + activeChar.setHasVotedSurvey(true); activeChar.sendMessage("You voted : " + AdminSurvey.ans3 + ". Thanks for voting"); } else if (_command.equals("survey_vote4")) @@ -159,6 +162,7 @@ return; } AdminSurvey.ans4_vote_count++; + activeChar.setHasVotedSurvey(true); activeChar.sendMessage("You voted : " + AdminSurvey.ans4 + ". Thanks for voting"); } @@ -175,6 +179,7 @@ return; } AdminSurvey.ans5_vote_count++; + activeChar.setHasVotedSurvey(true); activeChar.sendMessage("You voted : " + AdminSurvey.ans5 + ". Thanks for voting"); } else if (_command.startsWith("npc_")) Index: java/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminSurvey.java =================================================================== --- java/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminSurvey.java (revision 27) +++ java/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminSurvey.java (working copy) @@ -73,6 +73,23 @@ if (command.equals("admin_survey_end")) { + int moreVotes = ans1_vote_count; + if (moreVotes < ans2_vote_count) {moreVotes = ans2_vote_count;} + if (moreVotes < ans3_vote_count) {moreVotes = ans3_vote_count;} + if (moreVotes < ans4_vote_count) {moreVotes = ans4_vote_count;} + if (moreVotes < ans5_vote_count) {moreVotes = ans5_vote_count;} + + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The survey session is over.Thanks everyone for voting.")); + if( moreVotes == ans1_vote_count) + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans1 +" won the survey with " + ans1_vote_count +" votes on the question : "+ quest+".")); + if( moreVotes == ans2_vote_count) + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans2 +" won the survey with " + ans2_vote_count +" votes on the question : "+ quest+".")); + if( moreVotes == ans3_vote_count) + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans3 +" won the survey with " + ans3_vote_count +" votes on the question : "+ quest+".")); + if( moreVotes == ans4_vote_count) + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans4 +" won the survey with " + ans4_vote_count +" votes on the question : "+ quest+".")); + if( moreVotes == ans5_vote_count) + Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The answer "+ ans5 +" won the survey with " + ans5_vote_count +" votes on the question : "+ quest+".")); running = false; resultsHtml(activeChar); quest = ""; @@ -101,8 +118,8 @@ } - Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Survey","The survey session is over.Thanks everyone for voting.")); + } if(command.equals("admin_opmore"))
-
U mean sth like that? getActingPlayer().sendPacket(new CreatureSay(0, 17, "[AntiBot]:", instead of getActingPlayer().sendPacket(new CreatureSay(0, Say2.HERO VOICE, "[AntiBot]:", edit: thank you man ..it works perfect now ..i have just tested it :) hope u have a great night .. dont forget to be nice to ppl