Exemple #1
0
 def useVoicedCommand(self, command, player, params):
     world = InstanceManager.getInstance().getWorld(player.getInstanceId())
     if world and world.templateId >= 0:
         sm = SystemMessage.getSystemMessage(
             SystemMessageId.INSTANT_ZONE_CURRENTLY_INUSE_S1)
         sm.addInstanceName(world.templateId)
         player.sendPacket(sm)
     instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(
         player.getObjectId())
     hasMessage = False
     if instanceTimes:
         for instanceId in instanceTimes.keySet():
             remainingTime = (instanceTimes.get(instanceId) -
                              System.currentTimeMillis()) / 1000
             if remainingTime > 60:
                 if not hasMessage:
                     hasMessage = True
                     player.sendPacket(
                         SystemMessageId.INSTANCE_ZONE_TIME_LIMIT)
                 hours = (int)(remainingTime / 3600)
                 minutes = (int)((remainingTime % 3600) / 60)
                 sm = SystemMessage.getSystemMessage(
                     SystemMessageId.AVAILABLE_AFTER_S1_S2_HOURS_S3_MINUTES)
                 sm.addInstanceName(instanceId)
                 sm.addNumber(hours)
                 sm.addNumber(minutes)
                 player.sendPacket(sm)
             else:
                 InstanceManager.getInstance().deleteInstanceTime(
                     player.getObjectId(), instanceId)
     if not hasMessage:
         player.sendPacket(SystemMessageId.NO_INSTANCEZONE_TIME_LIMIT)
     return
Exemple #2
0
	def useVoicedCommand(self, command, player, params):
		world = InstanceManager.getInstance().getWorld(player.getInstanceId())
		if world and world.templateId >= 0:
			sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_CURRENTLY_INUSE_S1)
			sm.addInstanceName(world.templateId)
			player.sendPacket(sm)
		instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player.getObjectId())
		hasMessage = False
		if instanceTimes:
			for instanceId in instanceTimes.keySet():
				remainingTime = (instanceTimes.get(instanceId) - System.currentTimeMillis()) / 1000
				if remainingTime > 60:
					if not hasMessage:
						hasMessage = True
						player.sendPacket(SystemMessageId.INSTANCE_ZONE_TIME_LIMIT)
					hours = (int) (remainingTime / 3600)
					minutes = (int) ((remainingTime%3600) / 60)
					sm = SystemMessage.getSystemMessage(SystemMessageId.AVAILABLE_AFTER_S1_S2_HOURS_S3_MINUTES)
					sm.addInstanceName(instanceId)
					sm.addNumber(hours)
					sm.addNumber(minutes)
					player.sendPacket(sm)
				else:
					InstanceManager.getInstance().deleteInstanceTime(player.getObjectId(), instanceId)
		if not hasMessage:
			player.sendPacket(SystemMessageId.NO_INSTANCEZONE_TIME_LIMIT)
		return
Exemple #3
0
	def canMeJoin(self, player, clanid, pledgeType):
		clan = ClanTable.getInstance().getClan(clanid)
		if not clan: return False
		if clan.getCharPenaltyExpiryTime() > System.currentTimeMillis():
			player.sendPacket(SystemMessageId.YOU_MUST_WAIT_BEFORE_ACCEPTING_A_NEW_MEMBER)
			return False
		if player.getClanId() != 0:
			sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WORKING_WITH_ANOTHER_CLAN)
			sm.addString(player.getName())
			player.sendPacket(sm)
			return False
		if player.getClanJoinExpiryTime() > System.currentTimeMillis():
			sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MUST_WAIT_BEFORE_JOINING_ANOTHER_CLAN)
			sm.addString(player.getName())
			player.sendPacket(sm)
			return False
		if player.getLevel() > 40 or player.getClassId().level() >= 2:
			if pledgeType == -1:
				sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DOESNOT_MEET_REQUIREMENTS_TO_JOIN_ACADEMY)
				sm.addString(player.getName())
				player.sendPacket(sm)
				player.sendPacket(SystemMessageId.ACADEMY_REQUIREMENTS)
				return False
		if clan.getSubPledgeMembersCount(pledgeType) >= clan.getMaxNrOfMembers(pledgeType):
			if pledgeType == 0:
				sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CLAN_IS_FULL)
				sm.addString(clan.getName())
				player.sendPacket(sm)
			else:
				player.sendPacket(SystemMessageId.SUBCLAN_IS_FULL)
			return False
		return True
Exemple #4
0
def checkCondition(player):
	if not player.getLevel() >= 78:
		sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT)
		sm.addCharName(player)
		player.sendPacket(sm)
		return False
	return True
Exemple #5
0
	def merge(self, player, item1OID, item2OID):
		inv = player.getInventory()
		item1 = inv.getItemByObjectId(int(item1OID))
		item2 = inv.getItemByObjectId(int(item2OID))
		if not self.check(player, item1, item2):
			return self.htm_header + "指定的道具出問題<BR>請確定道具能強化" + self.htm_footer
		if not self.removeRequirement(player):
			return self.htm_header + "需要金幣1個" + self.htm_footer
		item1enclvl = item1.getEnchantLevel()
		item2enclvl = item2.getEnchantLevel()
		enchant2 = item2.getEnchantLevel()
		inv.destroyItem(self.qn, item2, player, item2)
		if Rnd.get(100) > self.chance:
			self.updatePlayerInfo(player)
			return self.htm_header + "<font color=FF0000>合拼強化機率性失敗</font><BR>" + self.htm_select_part + self.htm_footer
		item1.setEnchantLevel(item1.getEnchantLevel()+Rnd.get(enchant2+1))
		item1.updateDatabase()
		player.sendPacket(EnchantResult(0, 0, 0))
		sm = SystemMessage.getSystemMessage(SystemMessageId.C1_SUCCESSFULY_ENCHANTED_A_S2_S3);
		sm.addCharName(player)
		sm.addNumber(item1.getEnchantLevel())
		sm.addItemName(item1)
		player.sendPacket(sm)
		self.updatePlayerInfo(player)
		return self.htm_header + "<font color=FFFF00>恭喜! 合拼強化成功 強化度由 +%d 變為 +%d</font><BR>" % (item1enclvl, item1.getEnchantLevel()) + self.htm_select_part + self.htm_footer
Exemple #6
0
 def onTalk (self,npc,player) :
  htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>"
  st = player.getQuestState(qn)
  if not st : return htmltext
  clan = player.getClan()
  npcId = npc.getNpcId()
  if player.getClan() == None or player.isClanLeader() == 0 :
     st.exitQuest(1)
     htmltext = "30868-0a.htm"
  elif player.getClan().getLevel() < 5 :
     st.exitQuest(1)
     htmltext =  "30868-0b.htm"
  else :
     cond = st.getInt("cond")
     raid = st.getInt("raid")
     id = st.getState()
     if id == State.CREATED and cond == 0 :
        htmltext =  "30868-0c.htm"
     elif id == State.STARTED and cond == 1 and raid in REWARDS_LIST.keys() :
        npc,item,min,max=REWARDS_LIST[raid]
        count = st.getQuestItemsCount(item)
        CLAN_POINTS_REWARD = Rnd.get(min, max)
        if not count :
           htmltext = "30868-"+str(raid)+"a.htm"
        elif count == 1 :
           htmltext = "30868-"+str(raid)+"b.htm"
           st.takeItems(item,1)
           clan.addReputationScore(CLAN_POINTS_REWARD,True)
           player.sendPacket(SystemMessage.getSystemMessage(1777).addNumber(CLAN_POINTS_REWARD))
           clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
  return htmltext
Exemple #7
0
 def merge(self, player, item1OID, item2OID):
     inv = player.getInventory()
     item1 = inv.getItemByObjectId(int(item1OID))
     item2 = inv.getItemByObjectId(int(item2OID))
     if not self.check(player, item1, item2):
         return self.htm_header + "指定的道具出問題<BR>請確定道具能強化" + self.htm_footer
     if not self.removeRequirement(player):
         return self.htm_header + "需要金幣1個" + self.htm_footer
     item1enclvl = item1.getEnchantLevel()
     item2enclvl = item2.getEnchantLevel()
     enchant2 = item2.getEnchantLevel()
     inv.destroyItem(self.qn, item2, player, item2)
     if Rnd.get(100) > self.chance:
         self.updatePlayerInfo(player)
         return self.htm_header + "<font color=FF0000>合拼強化機率性失敗</font><BR>" + self.htm_select_part + self.htm_footer
     item1.setEnchantLevel(item1.getEnchantLevel() + Rnd.get(enchant2 + 1))
     item1.updateDatabase()
     player.sendPacket(EnchantResult(0, 0, 0))
     sm = SystemMessage.getSystemMessage(
         SystemMessageId.C1_SUCCESSFULY_ENCHANTED_A_S2_S3)
     sm.addCharName(player)
     sm.addNumber(item1.getEnchantLevel())
     sm.addItemName(item1)
     player.sendPacket(sm)
     self.updatePlayerInfo(player)
     return self.htm_header + "<font color=FFFF00>恭喜! 合拼強化成功 強化度由 +%d 變為 +%d</font><BR>" % (
         item1enclvl,
         item1.getEnchantLevel()) + self.htm_select_part + self.htm_footer
Exemple #8
0
 def onTalk(self, npc, player):
     htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>"
     st = player.getQuestState(qn)
     if not st: return htmltext
     clan = player.getClan()
     npcId = npc.getNpcId()
     if player.getClan() == None or player.isClanLeader() == 0:
         st.exitQuest(1)
         htmltext = "31331-0.htm"
     elif player.getClan().getLevel() < 5:
         st.exitQuest(1)
         htmltext = "31331-0.htm"
     else:
         cond = st.getInt("cond")
         id = st.getState()
         if id == State.CREATED and cond == 0:
             htmltext = "31331-1.htm"
         elif id == State.STARTED and cond == 1:
             count = st.getQuestItemsCount(Claw)
             if not count:
                 htmltext = "31331-4.htm"
             elif count >= 1:
                 htmltext = "31331-7.htm"  # custom html
                 st.takeItems(Claw, -1)
                 reward = int(CLAN_POINTS_REWARD * count)
                 clan.addReputationScore(reward, True)
                 player.sendPacket(
                     SystemMessage.getSystemMessage(1777).addNumber(reward))
                 clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
     return htmltext
 def onTalk (self,npc,player) :
  htmltext = Quest.getNoQuestMsg(player)
  st = player.getQuestState(qn)
  if not st : return htmltext
  clan = player.getClan()
  npcId = npc.getNpcId()
  if player.getClan() == None or player.isClanLeader() == 0 :
     st.exitQuest(1)
     htmltext = "31331-0.htm"
  elif player.getClan().getLevel() < 5 :
     st.exitQuest(1)
     htmltext =  "31331-0.htm"
  else :
     cond = st.getInt("cond")
     id = st.getState()
     if id == State.CREATED and cond == 0 :
        htmltext =  "31331-1.htm"
     elif id == State.STARTED and cond == 1 :
        count = st.getQuestItemsCount(Claw)
        if not count :
           htmltext = "31331-4.htm"
        elif count >= 1 :
           htmltext = "31331-7.htm" # custom html
           st.takeItems(Claw,-1)
           reward = int(CLAN_POINTS_REWARD * count)
           clan.addReputationScore(reward,True)
           player.sendPacket(SystemMessage.getSystemMessage(1777).addNumber(reward))
           clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
  return htmltext
Exemple #10
0
 def onTalk (self,npc,player) :
  htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>"
  st = player.getQuestState(qn)
  if not st : return htmltext
  clan = player.getClan()
  npcId = npc.getNpcId()
  if player.getClan() == None or player.isClanLeader() == 0 :
     st.exitQuest(1)
     htmltext = "31331-0a.htm"
  elif player.getClan().getLevel() < 6 :
     st.exitQuest(1)
     htmltext =  "31331-0b.htm"
  else :
     cond = st.getInt("cond")
     raid = st.getInt("raid")
     id = st.getState()
     if id == State.CREATED and cond == 0 :
        htmltext =  "31331-0c.htm"
     elif id == State.STARTED and cond == 1 and raid in REWARDS_LIST.keys() :
        npc,item,min,max=REWARDS_LIST[raid]
        count = st.getQuestItemsCount(item)
        CLAN_POINTS_REWARD = Rnd.get(min, max)
        if not count :
           htmltext = "31331-"+str(raid)+"a.htm"
        elif count == 1 :
           htmltext = "31331-"+str(raid)+"b.htm"
           st.takeItems(item,1)
           clan.addReputationScore(CLAN_POINTS_REWARD,True)
           player.sendPacket(SystemMessage.getSystemMessage(1777).addNumber(CLAN_POINTS_REWARD))
           clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
  return htmltext
Exemple #11
0
	def myJoinClan(self, player, clanid, pledgeType):
		clan = ClanTable.getInstance().getClan(clanid)
		if clan:
			player.sendPacket(JoinPledge(clanid))
			# player.setPledgeType(L2Clan.SUBUNIT_ROYAL1)
			player.setPledgeType(pledgeType)
			if pledgeType == L2Clan.SUBUNIT_ACADEMY:
				player.setPowerGrade(9)
				player.setLvlJoinedAcademy(player.getLevel())
			else:
				player.setPowerGrade(5)
			clan.addClanMember(player)
			player.setClanPrivileges(clan.getRankPrivs(5))
			player.sendPacket(SystemMessageId.ENTERED_THE_CLAN)
			sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_JOINED_CLAN)
			sm.addString(player.getName())
			clan.broadcastToOnlineMembers(sm)
			try:
				#GS 879 以後
				if player.getClan().getCastleId() > 0:
					CastleManager.getInstance().getCastleByOwner(player.getClan()).giveResidentialSkills(player)
				if player.getClan().getFortId() > 0:				
					FortManager.getInstance().getFortByOwner(player.getClan()).giveResidentialSkills(player)
			except:
				#GS 879 之前
				if player.getClan().getHasCastle() > 0:
					CastleManager.getInstance().getCastleByOwner(player.getClan()).giveResidentialSkills(player)
				if player.getClan().getHasFort() > 0:				
					FortManager.getInstance().getFortByOwner(player.getClan()).giveResidentialSkills(player)
			player.sendSkillList()
			clan.broadcastToOtherOnlineMembers(PledgeShowMemberListAdd(player), player)
			clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
			player.sendPacket(PledgeShowMemberListAll(clan, player))
			player.setClanJoinExpiryTime(0)
			player.broadcastUserInfo()
Exemple #12
0
 def onAcquireSkill(self, npc, player, skill):
     if player.isSubClassActive():
         player.sendMessage("You are trying to learn skill that u can't..")
         Util.handleIllegalPlayerAction(
             player, "Player " + player.getName() +
             " tried to learn skill that he can't!!!",
             Config.DEFAULT_PUNISH)
         return "false"
     st = player.getQuestState(qn)
     for i in SKILLITEMS:
         if skill.getId() in SUBSKILLS[i]:
             for var in QUESTVARSITEMS:
                 if i in QUESTVARSITEMS[var]:
                     for j in range(Config.MAX_SUBCLASS):
                         qvar = st.getGlobalQuestVar(var + str(j + 1))
                         if qvar != "" and qvar != "0" and not qvar.endswith(
                                 ";"):
                             Item = player.getInventory().getItemByObjectId(
                                 int(qvar))
                             if Item and Item.getItemId() == i:
                                 player.destroyItem(qn, int(qvar), 1,
                                                    player, 0)
                                 st.saveGlobalQuestVar(
                                     var + str(j + 1),
                                     str(skill.getId()) + ";")
                                 return "true"
     player.sendPacket(
         SystemMessage.getSystemMessage(
             SystemMessageId.ITEM_MISSING_TO_LEARN_SKILL))
     return "false"
Exemple #13
0
def EvolvePet(player, item, striderControlItem):
    con = L2DatabaseFactory.getInstance().getConnection()
    statement = con.prepareStatement("UPDATE items SET item_id =? WHERE object_id=? AND owner_id=?")
    statement.setInt(1, striderControlItem)
    statement.setInt(2, item.getObjectId())
    statement.setInt(3, player.getObjectId())
    statement.execute()
    statement.close()
    con.close()
    sm1 = SystemMessage.getSystemMessage(SystemMessageId.S2_S1_DISAPPEARED)
    sm1.addItemName(item.getItemId())
    sm1.addNumber(1)
    sm2 = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_A_S1_S2)
    sm2.addNumber(item.getEnchantLevel())
    sm2.addItemName(striderControlItem)
    player.sendPacket(sm1)
    player.sendPacket(sm2)
    player.sendPacket(ItemList(player, False))
    return
Exemple #14
0
def EvolvePet(player,item,striderControlItem) :
   con = L2DatabaseFactory.getInstance().getConnection()
   statement = con.prepareStatement("UPDATE items SET item_id =? WHERE object_id=? AND owner_id=?")
   statement.setInt(1, striderControlItem)
   statement.setInt(2, item.getObjectId())
   statement.setInt(3, player.getObjectId())
   statement.execute()
   statement.close()
   con.close()
   sm1 = SystemMessage.getSystemMessage(SystemMessageId.S2_S1_DISAPPEARED)
   sm1.addItemName(item.getItemId())
   sm1.addNumber(1)
   sm2 = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_A_S1_S2)
   sm2.addNumber(item.getEnchantLevel())
   sm2.addItemName(striderControlItem)
   player.sendPacket(sm1)
   player.sendPacket(sm2)
   player.sendPacket(ItemList(player, False))
   return
Exemple #15
0
def getCertified(player, itemId, var):
  st = player.getQuestState(qn)
  qvar = st.getGlobalQuestVar(var)
  if qvar != "" and qvar != "0" :
    return ""
  item = player.getInventory().addItem("Quest", itemId, 1, player, player.getTarget())
  st.saveGlobalQuestVar(var,str(item.getObjectId()))
  smsg = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1)
  smsg.addItemName(item)
  player.sendPacket(smsg)
  return
Exemple #16
0
def getCertified(player, itemId, var):
  st = player.getQuestState(qn)
  qvar = st.getGlobalQuestVar(var)
  if qvar != "" and qvar != "0" :
    return ""
  item = player.getInventory().addItem("Quest", itemId, 1, player, player.getTarget())
  st.saveGlobalQuestVar(var,str(item.getObjectId()))
  smsg = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1)
  smsg.addItemName(item)
  player.sendPacket(smsg)
  return
Exemple #17
0
 def onAcquireSkillList (self, npc, player) :
   asl = AcquireSkillList(AcquireSkillList.SkillType.unk4)
   st = player.getQuestState(qn)
   oldSkills = player.getAllSkills()
   count = 0
   for i in SKILLITEMS:
     for j in SUBSKILLS[i]:
       minLevel = 0
       maxLevel = SkillTable.getInstance().getMaxLevel(j)
       for oldsk in oldSkills:
         if oldsk.getId() == j:
           minLevel = oldsk.getLevel()
       if minLevel < maxLevel:
         count+=1
         asl.addSkill(j, minLevel+1, maxLevel, 0, 0)
   player.sendPacket(asl)
   if count == 0:
     player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_MORE_SKILLS_TO_LEARN))
   return ""
Exemple #18
0
 def onAcquireSkill (self, npc, player, skill) :
   if player.isSubClassActive():
     player.sendMessage("You are trying to learn skill that u can't..");
     Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to learn skill that he can't!!!", Config.DEFAULT_PUNISH);
     return "false"
   st = player.getQuestState(qn)
   for i in SKILLITEMS:
     if skill.getId() in SUBSKILLS[i]:
       for var in QUESTVARSITEMS:
         if i in QUESTVARSITEMS[var]:
           for j in range(Config.MAX_SUBCLASS):
             qvar = st.getGlobalQuestVar(var+str(j+1))
             if qvar != "" and qvar != "0" and not qvar.endswith(";") :
               Item = player.getInventory().getItemByObjectId(int(qvar))
               if Item and Item.getItemId() == i:
                 player.destroyItem(qn,int(qvar), 1, player, 0)
                 st.saveGlobalQuestVar(var+str(j+1),str(skill.getId())+";")
                 return "true"
   player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ITEM_MISSING_TO_LEARN_SKILL))
   return "false"
Exemple #19
0
 def onAcquireSkillList(self, npc, player):
     asl = AcquireSkillList(AcquireSkillList.SkillType.unk4)
     st = player.getQuestState(qn)
     oldSkills = player.getAllSkills()
     count = 0
     for i in SKILLITEMS:
         for j in SUBSKILLS[i]:
             minLevel = 0
             maxLevel = SkillTable.getInstance().getMaxLevel(j)
             for oldsk in oldSkills:
                 if oldsk.getId() == j:
                     minLevel = oldsk.getLevel()
             if minLevel < maxLevel:
                 count += 1
                 asl.addSkill(j, minLevel + 1, maxLevel, 0, 0)
     player.sendPacket(asl)
     if count == 0:
         player.sendPacket(
             SystemMessage.getSystemMessage(
                 SystemMessageId.NO_MORE_SKILLS_TO_LEARN))
     return ""
Exemple #20
0
	def process_enchant(self, event, npc, player):
		itemoid, scrolloid = event
		itemoid, scrolloid = int(itemoid), int(scrolloid)
		inv = player.getInventory()
		item = inv.getItemByObjectId(itemoid)
		scroll = inv.getItemByObjectId(scrolloid)
		if item == None or scroll == None: return
		escroll = EnchantItemTable.getInstance().getEnchantScroll(scroll)
		if escroll == None: return
		dscroll = inv.destroyItem(self.qn, scrolloid, 1, player, item)
		if not dscroll: return
		if not item.getOwnerId() == player.getObjectId(): return
		if not item.isEnchantable(): return
		chance = self.getChance(scroll, item)
		if Rnd.get(100) < chance:
			item.setEnchantLevel(item.getEnchantLevel() + 1)
			item.updateDatabase()
			player.sendPacket(EnchantResult(0, 0, 0))
			sm = SystemMessage.getSystemMessage(SystemMessageId.C1_SUCCESSFULY_ENCHANTED_A_S2_S3);
			sm.addCharName(player)
			sm.addNumber(item.getEnchantLevel())
			sm.addItemName(item)
			if item.getEnchantLevel() in self.enchant_lv_notify:
				player.broadcastPacket(sm)
				if self.canFireWorks:
					skill = SkillTable.FrequentSkill.FIREWORK.getSkill()
					if skill:
						player.broadcastPacket(MagicSkillUse(player, player, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay()))
			else:
				player.sendPacket(sm)
			if self.isEnchantToSafe:
				if item.getEnchantLevel() < self.getSafeEnchantLevel(item):
					self.process_enchant(event, npc, player)
					# self.startQuestTimer(" ".join(["enchant"] + event), 250, npc, player, False)
		else:
			if escroll.isSafe():
				player.sendPacket(SystemMessage.sendString("強化失敗 物品強化值不變"))
				# player.sendPacket(SystemMessageId.SAFE_ENCHANT_FAILED)
				player.sendPacket(EnchantResult(5, 0, 0))
			else:
				if item.isEquipped():
					if item.getEnchantLevel() > 0:
						sm = SystemMessage.getSystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED)
						sm.addNumber(item.getEnchantLevel())
						sm.addItemName(item)
						player.sendPacket(sm)
					else:
						sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISARMED)
						sm.addItemName(item)
						player.sendPacket(sm)
					unequiped = inv.unEquipItemInSlotAndRecord(item.getLocationSlot())
					iu = InventoryUpdate()
					for itm in unequiped:
						iu.addModifiedItem(itm)
					player.sendPacket(iu)
					player.broadcastUserInfo()
				if escroll.isBlessed():
					player.sendPacket(SystemMessageId.BLESSED_ENCHANT_FAILED)
					if self.canEnchantZero:
						item.setEnchantLevel(0)
					item.updateDatabase()
					player.sendPacket(EnchantResult(3, 0, 0))
				else:
					if self.canDestory:
						crystalId = item.getItem().getCrystalItemId()
						count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2)
						if count < 1:
							count = 1
						destroyItem = inv.destroyItem(self.qn, item, player, None)
						if not destroyItem:
							Util.handleIllegalPlayerAction(player, "Unable to delete item on enchant failure from player " + player.getName() + ", possible cheater !", Config.DEFAULT_PUNISH);
							player.sendPacket(EnchantResult(2, 0, 0))
						crystals = None
						if crystalId:
							crystals = inv.addItem(self.qn, crystalId, count, player, destroyItem)
							sm = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S)
							sm.addItemName(crystals)
							sm.addItemNumber(count)
							player.sendPacket(sm)
						iu = InventoryUpdate()
						if destroyItem.getCount():
							iu.addModifiedItem(destroyItem)
						else:
							iu.addRemovedItem(destroyItem)
						if crystalId and crystals:
							iu.addItem(crystals)
						player.sendPacket(iu)
						L2World.getInstance().removeObject(destroyItem)
						if crystalId:
							player.sendPacket(EnchantResult(1, crystalId, count))
						else:
							player.sendPacket(EnchantResult(4, 0, 0))
					elif self.canEnchantZero:
						player.sendPacket(SystemMessage.sendString("強化失敗 物品強化值變為0"))
						item.setEnchantLevel(0)
						item.updateDatabase()
						player.sendPacket(EnchantResult(3, 0, 0))
					else:
						player.sendPacket(SystemMessage.sendString("強化失敗 物品強化值不變"))
						# player.sendPacket(SystemMessageId.SAFE_ENCHANT_FAILED)
						player.sendPacket(EnchantResult(5, 0, 0))
		su = StatusUpdate(player)
		su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad())
		player.sendPacket(su)
		
		player.sendPacket(ItemList(player, False));
		player.broadcastUserInfo()
		player.setActiveEnchantItem(None)