Jump to content

Question

Posted (edited)

Good evening. I downloaded the script for "olympiad rank" by "RedHot" . I want to be visible or accessable only from vip players, i tried several things but without success .
well here is the _init_

Spoiler

import sys
from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
from java.util import Iterator
from com.l2jfrozen.gameserver.datatables import SkillTable
from com.l2jfrozen.util.database import L2DatabaseFactory
from com.l2jfrozen.gameserver.model.actor.appearance import PcAppearance
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.actor.appearance import PcAppearance
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest

qn          = "20012_OlyRank"
NPC         = [47]
QuestId     = 20012
QuestName   = "OlyRank"
QuestDesc   = "custom"
InitialHtml = "1.htm"

class Quest (JQuest) :

    def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

    def onTalk (self,npc,player):
            return InitialHtml

    def onEvent(self,event,st):
        htmltext = event

        # Duelist
        if event == "88" :

            INITIAL_HTML = "<html><head><title>Grand Olympiad Ranking</title></head><body><center><font color=66cc00>Olympiad Ranking Online System</font></center><br><center><img src=\"L2UI.SquareWhite\" width=300 height=1><img src=\"L2UI.SquareBlank\" width=1 height=3></center><table width=300 border=0 bgcolor=\"000000\"><tr><td>Position</td><center><td>|</td></center><td><center>Name</center></td><center><td>|</td></center><td><center>Points</center></td><center><td>|</td></center><td><center>Matches</center></td></tr>"
            HTML_INFO =""            
            POSITION_VALUE_INITIAL = 0
            CONNECTION = L2DatabaseFactory.getInstance().getConnection()
            pts = CONNECTION.prepareStatement("SELECT char_name, olympiad_points, competitions_done from olympiad_nobles where class_id=88 and competitions_done>=9 order by olympiad_points desc, competitions_done desc");
            rs = pts.executeQuery()
            while (rs.next()) :
                CHAR_NAME = rs.getString("char_name")
                POINTS = rs.getString("olympiad_points")
                COMP_DONE = rs.getString("competitions_done")
                POSITION_VALUE_INITIAL = POSITION_VALUE_INITIAL + 1
                STRING_POSITION = str(POSITION_VALUE_INITIAL)
                HTML_INFO = HTML_INFO + "<tr><td><center>" + STRING_POSITION + "</td><center><td></td></center><td><center>" + CHAR_NAME +"</center></td><center><td></td></center><td><center>" + POINTS + "</center></td><center><td></td></center><td><center>" + COMP_DONE + "</center></td></tr>"
            HTML_END = "</table></body></html>


in l2jfrozen vip  member in java is ~> .isDonator()

2.html= an html i created which contains to non vip members.

i tried to add:

====================

    def onTalk (self,npc,player):
+  st = player.getQuestState(qn)
 return InitialHtml

 

    def onEvent(self,event,st):
        htmltext = event

+ if st.getPlayer().isVip() < 1 :        <~Also tried with "isDonator()"

+ htmltext ="2.htm"

+ else:
+ st.getPlayer().setTarget(st.getPlayer())


any help ?

 

 

EDIT:  I managed to do that only for vip with just add:

    def onTalk (self,npc,player):
+  if player.isDonator()==1:
 return InitialHtml


But i feel isn't right that way :/ 

Edited by Irrelevant

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.


×
×
  • Create New...