Exemple #1
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 #2
0
 def onSkillSee(self, npc, player, skill, targets, isPet):
     st = player.getQuestState(qn)
     if not st: return
     if Util.contains(targets, npc) and st.getInt("cond") == 1 and skill.getId() == 2630:
         st.playSound("ItemSound.quest_itemget")
         npcId = npc.getNpcId()
         if npcId in range(18684, 18687):
             st.giveItems(red, 1)
         elif npcId in range(18687, 18690):
             st.giveItems(blue, 1)
         elif npcId in range(18690, 18693):
             st.giveItems(green, 1)
         npc.doDie(player)
     return
Exemple #3
0
 def onKill(self, npc, player, isPet):
     partyMember = self.getRandomPartyMemberState(player, State.STARTED)
     if not partyMember: return
     st = partyMember.getQuestState(qn)
     if st:
         if st.getState() == State.STARTED:
             npcId = npc.getNpcId()
             cond = st.getInt("cond")
             id = st.getInt("id")
             st2 = partyMember.getQuestState("612_WarWithKetraOrcs")
             if not partyMember.isAlliedWithKetra():
                 if (npcId in Ketra_One) or (npcId in Ketra_Two) or (
                         npcId in Ketra_Three):
                     item = 0
                     if cond <= 5:
                         if npcId in Ketra_One:
                             item, MAX, drop = One[cond]
                         elif npcId in Ketra_Two and cond > 1:
                             item, MAX, drop = Two[cond]
                         elif npcId in Ketra_Three and cond > 2:
                             item, MAX, drop = Three[cond]
                     if item != 0:
                         if st.getQuestItemsCount(drop) == MAX:
                             item = 0
                     chance = Chance[npcId]
                     # This is support for quest 612: War With Ketra Orcs. Basically, if the person has both this quest and 612, then they only get one quest item, 50% chance for 612 quest item and 50% chance for this quest's item
                     if st2:
                         if (st.getRandom(2) == 1 or item
                                 == 0) and npcId in Chance_molar.keys():
                             item = 57
                             MAX = 100
                             drop = Molar
                             chance = Chance_molar[npcId]
                             giveReward(st, item, chance, MAX, drop)
                         elif id == 2 and item != 0:
                             giveReward(st, item, chance, MAX, drop)
                     elif id == 2 and item != 0:
                         giveReward(st, item, chance, MAX, drop)
                 elif npcId in Varka_Silenos:
                     party = partyMember.getParty()
                     if party:
                         for member in party.getPartyMembers().toArray():
                             if Util.checkIfInRange(5000, player, member,
                                                    True):
                                 pst = member.getQuestState(qn)
                                 if pst:
                                     decreaseAlliance(pst)
                     else:
                         decreaseAlliance(st)
     return