#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#---------------------------------------------------------------------  
 | 
#  
 | 
#---------------------------------------------------------------------  
 | 
##@package QuestRunnerValue  
 | 
# @todo: ÈÎÎñÖµÌæ»»,¶¨Òå  
 | 
#  
 | 
# @author: eggxp  
 | 
# @date 2010-4-26  
 | 
# @version 1.4  
 | 
#  
 | 
# @note: ÌṩÈÎÎñ¹«Ê½Ìæ»»  
 | 
#---------------------------------------------------------------------  
 | 
# @change: "2013-04-17 20:35" Alee É¾³ýÈÎÎñ1×Öµä  
 | 
# @change: "2013-05-03 17:30" Alee É¾³ýÎÞÓÃ×ÖµäºÍÈÎÎñ1×Öµä  
 | 
# @change: "2014-08-26 11:00" hxp ÈÎÎñ״̬±ä¸üÐÞ¸ÄΪ²»Í¬²½¸ÃÈÎÎñÈ«²¿×ÖµäÐÅÏ¢  
 | 
# @change: "2016-07-18 19:00" hxp ÉèÖÃÈÎÎñ״̬ͳһº¯ÊýÈë¿Ú  
 | 
#---------------------------------------------------------------------  
 | 
#"""Version = 2016-07-18 19:00"""  
 | 
#---------------------------------------------------------------------  
 | 
import IPY_GameWorld  
 | 
import ItemControler  
 | 
import random  
 | 
import EventShell  
 | 
import ChConfig  
 | 
import GameWorld  
 | 
import PlayerControl  
 | 
import QuestCommon  
 | 
import GameObj  
 | 
#---------------------------------------------------------------------  
 | 
##»ñÈ¡·þÎñÆ÷ÈÎÎñ״̬, State  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @return ·µ»ØÖµ, ÈÎÎñ״̬  
 | 
# @remarks »ñÈ¡·þÎñÆ÷ÈÎÎñ״̬, State  
 | 
def GetState(curPlayer, curMission):  
 | 
    return curMission.GetState()  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##»ñÈ¡ÈÎÎñÊýÖµ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param conditionName ½ÚµãÃû  
 | 
# @return ·µ»ØÖµ, ÈÎÎñÊýÖµ  
 | 
# @remarks »ñÈ¡ÈÎÎñÊýÖµ  
 | 
def GetValue(curPlayer, curMission, conditionName):  
 | 
    if conditionName == "state":  
 | 
        conditionName = "Get%s"%conditionName.title()  
 | 
        if globals().has_key(conditionName):  
 | 
            return globals()[conditionName](curPlayer, curMission)  
 | 
    else:  
 | 
        return curMission.GetProperty(conditionName)  
 | 
      
 | 
    return  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¶ÔÁ½¸öÖµ½øÐбȽÏ, ÊÇ·ñ²»ÏàµÈ  
 | 
# @param leftValue AÖµ  
 | 
# @param rightValue BÖµ  
 | 
# @param diff ÈÝ´íÖµ  
 | 
# @return ·µ»ØÖµÕæ, abs(leftValue - rightValue) >= diff  
 | 
# @remarks ¶ÔÁ½¸öÖµ½øÐбȽÏ, ·µ»Ø½á¹û  
 | 
def __EvalDiffer(leftValue, rightValue, diff):  
 | 
    if leftValue != rightValue:  
 | 
        if diff == "":  
 | 
            return True  
 | 
           
 | 
        if diff != "" and abs(leftValue - rightValue) >= diff:  
 | 
            return True  
 | 
       
 | 
    return False  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¶ÔÁ½¸öÖµ½øÐбȽÏ, ×óÖµ´óÓÚÓÒÖµ  
 | 
# @param leftValue AÖµ  
 | 
# @param rightValue BÖµ  
 | 
# @param diff ÈÝ´íÖµ  
 | 
# @return ·µ»ØÖµÕæ, leftValue - rightValue >= diff  
 | 
# @remarks ¶ÔÁ½¸öÖµ½øÐбȽÏ, ·µ»Ø½á¹û  
 | 
def __EvalGreat(leftValue, rightValue, diff):  
 | 
    if leftValue > rightValue:  
 | 
        if diff == "":  
 | 
            return True  
 | 
          
 | 
        if diff != "" and leftValue - rightValue >= diff:  
 | 
            return True  
 | 
          
 | 
    return False  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¶ÔÁ½¸öÖµ½øÐбȽÏ, ×óֵСÓÚÓÒÖµ  
 | 
# @param leftValue AÖµ  
 | 
# @param rightValue BÖµ  
 | 
# @param diff ÈÝ´íÖµ  
 | 
# @return ·µ»ØÖµ, rightValue - leftValue >= diff  
 | 
# @remarks ¶ÔÁ½¸öÖµ½øÐбȽÏ, ·µ»Ø½á¹û  
 | 
def __EvalLess(leftValue, rightValue, diff):  
 | 
    if leftValue < rightValue:  
 | 
        #GameWorld.Log("%s - %s - %s"%(leftValue, rightValue, diff))  
 | 
        if diff == "":  
 | 
            return True  
 | 
          
 | 
        if diff != "" and rightValue - leftValue >= diff:  
 | 
            return True  
 | 
          
 | 
    return False  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¶ÔÁ½¸öÖµ½øÐбȽÏ, ×óÖµµÈÓÚÓÒÖµ  
 | 
# @param leftValue AÖµ  
 | 
# @param rightValue BÖµ  
 | 
# @param diff ÈÝ´íÖµ  
 | 
# @return ·µ»ØÖµ, leftValue == rightValue  
 | 
# @remarks ¶ÔÁ½¸öÖµ½øÐбȽÏ, ·µ»Ø½á¹û  
 | 
def __EvalEqual(leftValue, rightValue, diff):  
 | 
    if leftValue == rightValue:  
 | 
        return True  
 | 
      
 | 
    return False  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¶ÔÁ½¸öÖµ½øÐбȽÏ, ×óÖµ´óÓÚµÈÓÚÓÒÖµ  
 | 
# @param leftValue AÖµ  
 | 
# @param rightValue BÖµ  
 | 
# @param diff ÈÝ´íÖµ  
 | 
# @return ·µ»ØÖµ, leftValue - rightValue >= diff:  
 | 
# @remarks ¶ÔÁ½¸öÖµ½øÐбȽÏ, ·µ»Ø½á¹û  
 | 
def __EvalGreat_Equal(leftValue, rightValue, diff):  
 | 
    if leftValue >= rightValue:  
 | 
        if diff == "":  
 | 
            return True  
 | 
          
 | 
        if diff != "" and leftValue - rightValue >= diff:  
 | 
            return True  
 | 
          
 | 
    return False  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¶ÔÁ½¸öÖµ½øÐбȽÏ, ×óֵСÓÚµÈÓÚÓÒÖµ  
 | 
# @param leftValue AÖµ  
 | 
# @param rightValue BÖµ  
 | 
# @param diff ÈÝ´íÖµ  
 | 
# @return ·µ»ØÖµ, rightValue - leftValue >= diff  
 | 
# @remarks ¶ÔÁ½¸öÖµ½øÐбȽÏ, ·µ»Ø½á¹û  
 | 
def __EvalLess_Equal(leftValue, rightValue, diff):  
 | 
    if leftValue <= rightValue:  
 | 
        if diff == "":  
 | 
            return True  
 | 
          
 | 
        if diff != "" and rightValue - leftValue >= diff:  
 | 
            return True  
 | 
          
 | 
    return False  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
## Ö´ÐÐ__Eval·µ»Ø½á¹û  
 | 
# @param evalName Ê¼þÃû  
 | 
# @param leftValue ×óÖµ  
 | 
# @param rightValue ÓÒÖµ  
 | 
# @param diff ÈÝ´íÖµ  
 | 
# @return ·µ»ØÖµ, __EvalÖ´ÐÐÂß¼  
 | 
# @remarks Ö´ÐÐ__Eval·µ»Ø½á¹û  
 | 
def GetEval(evalName, leftValue, rightValue, diff = ""):  
 | 
    #GameWorld.Log("%s, %s, %s, diff = %s"%(str(leftValue), evalName, str(rightValue), diff))  
 | 
    evalName = "__Eval" + evalName.title()  
 | 
    if globals().has_key(evalName):  
 | 
        return globals()[evalName](leftValue, rightValue, diff)  
 | 
      
 | 
    GameWorld.Log("Can't Find Eval Name = %s leftValue = %s rightValue = %s"%(evalName,  
 | 
                                    leftValue, rightValue))  
 | 
    return  
 | 
#---------------------------------------------------------------------  
 | 
##ÉèÖÃÈÎÎñÖµ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param conditionName ½ÚµãÃû  
 | 
# @param value Öµ  
 | 
# @return ·µ»ØÖµÎÞÒâÒå  
 | 
# @remarks ÉèÖÃÈÎÎñÖµ  
 | 
def Var_Set(curPlayer, curMission, conditionName, value):  
 | 
    value = GameWorld.ToIntDef(value, 0)  
 | 
  
 | 
    if conditionName == "state":  
 | 
        QuestCommon.SetPlayerMissionState(curPlayer, curMission, value)  
 | 
        EventShell.NotifyOneMission(curPlayer, curMission, isNotifyAll = False)  
 | 
        curMission.SetProperty(conditionName,value)  
 | 
#    elif conditionName == "mission":  
 | 
#        curMission.SetMissionState(value)  
 | 
#        EventShell.NotifyOneMission(curPlayer, curMission)  
 | 
    else:  
 | 
        #GameWorld.Log(str(value))  
 | 
        #GameWorld.Log(str(conditionName))  
 | 
        curMission.SetProperty(conditionName,value)  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##Ìí¼ÓÈÎÎñÖµ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param conditionName ½ÚµãÃû  
 | 
# @param value Öµ  
 | 
# @return ·µ»ØÖµÎÞÒâÒå  
 | 
# @remarks Ìí¼ÓÈÎÎñÖµ  
 | 
def Var_Add(curPlayer, curMission, conditionName, value):  
 | 
    value = max(GameWorld.ToIntDef(value, 0), 1)  
 | 
          
 | 
    curMission.AddProperty(conditionName,value)  
 | 
#---------------------------------------------------------------------  
 | 
##ɾ³ýÈÎÎñÖµ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param conditionName ½ÚµãÃû  
 | 
# @param value Öµ  
 | 
# @return ·µ»ØÖµÎÞÒâÒå  
 | 
# @remarks Ìí¼ÓÈÎÎñÖµ  
 | 
def Var_Del(curPlayer, curMission, conditionName, value):  
 | 
    curMission.DelProperty(conditionName)  
 | 
#---------------------------------------------------------------------  
 | 
##¼õÉÙÈÎÎñÖµ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param conditionName ½ÚµãÃû  
 | 
# @param value Öµ  
 | 
# @return ·µ»ØÖµÎÞÒâÒå  
 | 
# @remarks Ìí¼ÓÈÎÎñÖµ  
 | 
def Var_Sub(curPlayer, curMission, conditionName, value):  
 | 
    value = max(GameWorld.ToIntDef(value, 0), 1)  
 | 
    curMission.SubProperty(conditionName, value)  
 | 
#---------------------------------------------------------------------  
 | 
##Ëæ»úÉèÖÃÈÎÎñÖµ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param conditionName ½ÚµãÃû  
 | 
# @param value Öµ  
 | 
# @return ·µ»ØÖµÎÞÒâÒå  
 | 
# @remarks Ëæ»úÉèÖÃÈÎÎñÖµ  
 | 
def Var_Rand_Set(curPlayer, curMission, conditionName, value):  
 | 
    valueList = value.split(",")  
 | 
    getValueIndex = random.randint(0, len(valueList)-1)  
 | 
    getValue = int(valueList[getValueIndex])  
 | 
    if conditionName == "state":  
 | 
        QuestCommon.SetPlayerMissionState(curPlayer, curMission, getValue)  
 | 
    else:  
 | 
        #GameWorld.Log(str(getValue))  
 | 
        #GameWorld.Log(str(valueList))  
 | 
        curMission.SetProperty(conditionName,getValue)  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##ÈÎÎñÊý¾Ýµ÷¶ÈÆ÷  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param conditionType ½ÚµãÀàÐÍ  
 | 
# @param conditionName ½ÚµãÃû  
 | 
# @param value Öµ  
 | 
# @return ·µ»ØÖµÎÞÒâÒå  
 | 
# @remarks ÈÎÎñÊý¾Ýµ÷¶ÈÆ÷  
 | 
def SetValue(curPlayer, curMission, conditionType, conditionName, value):  
 | 
    conditionType = conditionType.title()  
 | 
    callName = "Var_" + conditionType.title()  
 | 
    if globals().has_key(callName):  
 | 
        return globals()[callName](curPlayer, curMission, conditionName, value)  
 | 
    return  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##²éÕÒÍæ¼ÒÎïÆ·±³°üÊÇ·ñÓµÓÐÖ¸¶¨IDµÄÎïÆ·  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param id ÎïÆ·ID  
 | 
# @return ·µ»ØÖµ, ÊÇ·ñÓµÓÐ  
 | 
# @remarks ²éÕÒÍæ¼ÒÎïÆ·±³°üÊÇ·ñÓµÓÐÖ¸¶¨IDµÄÎïÆ·  
 | 
def Find_Item(curPlayer, id):  
 | 
    #²éÑ¯Íæ¼ÒÊÇ·ñÓÐidÎïÆ·  
 | 
    curItem = ItemControler.FindPlayerItemByItemID(curPlayer, IPY_GameWorld.rptItem, id)  
 | 
    if curItem == None:  
 | 
        return False  
 | 
      
 | 
    return True  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##²éѯÊÇ·ñ°üº¬(ÎïÆ·,¼¼ÄÜ...)  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param conditionName ½ÚµãÃû×Ö  
 | 
# @param id ²éÕÒID  
 | 
# @return ·µ»ØÖµ, ²éÕÒ½á¹û  
 | 
# @remarks ²éѯÊÇ·ñ°üº¬(ÎïÆ·,¼¼ÄÜ...)  
 | 
def GetFind(curPlayer, conditionName, id):  
 | 
    conditionName = "Find_%s"%conditionName.title()  
 | 
    if globals().has_key(conditionName):  
 | 
        return globals()[conditionName](curPlayer, id)  
 | 
      
 | 
    return  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##ÿÖܹ¤×ÊÔÚÏßʱ¼äÌæ»»  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks Ã¿Öܹ¤×ÊÔÚÏßʱ¼äÌæ»»  
 | 
def __GetTalkReplace_Last_Week_Time(curPlayer, curMission, type, parList):  
 | 
    return curPlayer.GetLastWeekOnlineTime()  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##Çý³ý¸´»îÐéÈõBUFF½ðÇ®  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks Çý³ý¸´»îÐéÈõBUFF½ðÇ®  
 | 
def __GetTalkReplace_Clear_Born_Buff_Money(curPlayer, curMission, type, parList):  
 | 
    return 0  
 | 
  
 | 
##ŵØÒ½ÉúÏÔʾ½ðÇ®  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks Ä¹µØÒ½ÉúÏÔʾ½ðÇ®  
 | 
def __GetTalkReplace_Health_Money(curPlayer, curMission, type, parList):  
 | 
    return GetHealthLostMoney(curPlayer)  
 | 
  
 | 
##£¨1-½ÇÉ«µ±Ç°ÑªÁ¿°Ù·Ö±È£©*3*½ÇÉ«µÈ¼¶^1.2+£¨1-½ÇÉ«µ±Ç°À¶Á¿°Ù·Ö±È£©*3*½ÇÉ«µÈ¼¶^1.2  
 | 
##»ñµÃŵØÒ½Éú»Ö¸´ËùºÄ½ð¶î  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @return ½ð¶î  
 | 
# @remarks »ñµÃŵØÒ½Éú»Ö¸´ËùºÄ½ðÇ®  
 | 
def GetHealthLostMoney(curPlayer):  
 | 
    curHP = GameObj.GetHP(curPlayer)  
 | 
    maxHP = GameObj.GetMaxHP(curPlayer)  
 | 
    curMP = curPlayer.GetMP()  
 | 
    maxMP = curPlayer.GetMaxMP()  
 | 
    lv = curPlayer.GetLV()  
 | 
    return int(eval(ChConfig.Def_Helth_Money_Formula))  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##ÈÎÎñ½±Àø  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks ÈÎÎñ½±Àø  
 | 
def __GetTalkReplace_Mission_Reward(curPlayer, curMission, type, parList):  
 | 
    curNode = QuestCommon.GetRewardNode(curPlayer, curMission)  
 | 
    if curNode == None or curNode.IsEmpty():  
 | 
        return ""  
 | 
    msgNode = curNode.FindChildNode("msg")  
 | 
    return ReplaceNPCTalkText(curPlayer, curMission, msgNode.GetXML())  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##ÓéÀÖÈÎÎñÊ£Óàʱ¼ä  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks ÓéÀÖÈÎÎñÊ£Óàʱ¼ä  
 | 
def __GetTalkReplace_Game_Time(curPlayer, curMission, type, parList):  
 | 
    #ÓéÀÖ×Üʱ¼ä720ÐÞ¸ÄΪ480·ÖÖÓ  
 | 
    sumTime = 8*60  
 | 
    curTime = curMission.GetProperty("count")*30  
 | 
      
 | 
    time = (sumTime - curTime)*60  
 | 
    return time  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##²îÖµ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks ²îÖµ  
 | 
def __GetTalkReplace_Sub(curPlayer, curMission, type, parList):  
 | 
    valueA = int(parList[0])  
 | 
    valueB = curMission.GetProperty(parList[1])  
 | 
    return  valueA - valueB   
 | 
#---------------------------------------------------------------------  
 | 
##ÈÙÓþ×é¶ÓµÄÈÙÓþÏÔÊ¾Ìæ»»  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks ÈÙÓþ×é¶ÓµÄÈÙÓþÏÔÊ¾Ìæ»»  
 | 
def __GetTalkReplace_Team_Hornor(curPlayer, curMission, type, parList):  
 | 
    return curPlayer.GetTeamHornor()  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##ÈÙÓþ×é¶ÓµÄ½ðÇ®»»È¡ÏÔÊ¾Ìæ»»  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks ÈÙÓþ×é¶ÓµÄ½ðÇ®»»È¡ÏÔÊ¾Ìæ»»  
 | 
def __GetTalkReplace_Th_Exchange_Money(curPlayer, curMission, type, parList):  
 | 
    return curPlayer.GetTeamHornor() / ChConfig.Def_TeamHornor_Money  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¹¦Ñ«Ìæ»»  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks ¹¦Ñ«Ìæ»»  
 | 
def __GetTalkReplace_Country_Hornor(curPlayer, curMission, type, parList):  
 | 
    return curPlayer.GetCountryLastWeekHornor()    
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¼Ò×幤×Ê£ºÉÏÖÜÀÛ»ý¼Ò×å»îÔ¾¶ÈÏÔʾ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks ¼Ò×幤×Ê£ºÉÏÖÜÀÛ»ý¼Ò×å»îÔ¾¶ÈÏÔʾ  
 | 
def __GetTalkReplace_Family_Active_Value(curPlayer, curMission, type, parList):  
 | 
    return curPlayer.GetLastWeekFamilyActiveValue()  
 | 
#---------------------------------------------------------------------  
 | 
##µã¾íÖµÏÔʾ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type »õ±ÒÀàÐÍ  
 | 
# @param parList ÁÐ±í  
 | 
# @return ·µ»ØÖµ, Ìæ»»µÄÖµ  
 | 
# @remarks µã¾íÖµÏÔʾ  
 | 
def __GetTalkReplace_Coin_Value(curPlayer, curMission, type, parList):  
 | 
    missionID = curMission.GetMissionID()  
 | 
    return curMission.GetProperty(str(missionID))  
 | 
#==================================================================  
 | 
#ÔËÐÐFunction_NPCµÄMenu Check, ¼ì²éͨ¹ý²ÅÏÔʾ  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##ÊÇ·ñÓвֿ⠼ì²éͨ¹ý²ÅÏÔʾ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @return ·µ»ØÖµÕ棬¿ÉÒÔÏÔʾ  
 | 
# @remarks ÊÇ·ñÓÐ²Ö¿â  
 | 
def Menu_Check_Have_Ware_House(curPlayer, checkArgs):  
 | 
    #¼ì²éÊÇ·ñÓÐ²Ö¿â  
 | 
    if curPlayer.GetWarehouseLV() == 0:  
 | 
        return False  
 | 
      
 | 
    return True  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##ÊÇ·ñÓÐÖ°Òµ ¼ì²éͨ¹ý²ÅÏÔʾ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @return ·µ»ØÖµÕ棬¿ÉÒÔÏÔʾ  
 | 
# @remarks ÊÇ·ñÓÐÖ°Òµ  
 | 
def Menu_Check_Have_Job(curPlayer, checkArgs):  
 | 
    return True  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¼ì²éÊÇ·ñÓйú¼Ò ¼ì²éͨ¹ý²ÅÏÔʾ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @return ·µ»ØÖµÕ棬¿ÉÒÔÏÔʾ  
 | 
# @remarks ¼ì²éÊÇ·ñÓйú¼Ò  
 | 
def Menu_Check_Have_Country(curPlayer, checkArgs):  
 | 
    #¼ì²éÊÇ·ñÓйú¼Ò  
 | 
    if curPlayer.GetCountry() == 1:  
 | 
        return False  
 | 
      
 | 
    return True  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##¼ì²éÊÇ·ñÓмÒ×å ¼ì²éͨ¹ý²ÅÏÔʾ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @return ·µ»ØÖµÕ棬¿ÉÒÔÏÔʾ  
 | 
# @remarks ¼ì²éÊÇ·ñÓмÒ×å  
 | 
def Menu_Check_Have_Family(curPlayer, checkArgs):  
 | 
    if curPlayer.GetFamilyID() == 0:  
 | 
        return False  
 | 
      
 | 
    return True  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##ÅжÏÍæ¼ÒÏß·  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param curConditionNode ½ÚµãÐÅÏ¢  
 | 
# @return ·µ»ØÖµ, ÊÇ·ñÅжϳɹ¦  
 | 
def Menu_Check_Player_Game_Line(curPlayer, checkArgs):  
 | 
    argsList = checkArgs.split("|")  
 | 
    if len(argsList) != 2:  
 | 
        GameWorld.Log("Menu_Check_Player_Game_Line²ÎÊý´íÎó %s"%checkArgs)  
 | 
        return False  
 | 
      
 | 
    #¿ÉÄÜ»áÓм¸ÌõÏß  
 | 
    lineMsg = argsList[0]    # ÏµÍ³Ìáʾ  
 | 
    lineStr = argsList[1]    # Ïß·²ÎÊý  
 | 
      
 | 
    #ÑéÖ¤ÊÇ·ñÔÚÆÚÍûÏß·  
 | 
    if str(PlayerControl.GetPlayerLineID(curPlayer)) not in lineStr:  
 | 
        PlayerControl.NotifyCode(curPlayer, lineMsg, [lineStr])  
 | 
        return False  
 | 
      
 | 
    return True  
 | 
  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
## ÅжÏÍæ¼ÒµÈ¼¶  
 | 
#  @param curPlayer Íæ¼ÒʵÀý  
 | 
#  @param curConditionNode ½ÚµãÐÅÏ¢  
 | 
#  @return ÊÇ·ñÅжϳɹ¦  
 | 
def Menu_Check_Player_Lv(curPlayer, checkArgs):  
 | 
    argsList = checkArgs.split("|")  
 | 
    if len(argsList) != 2:  
 | 
        GameWorld.Log("Menu_Check_Player_Lv ²ÎÊý´íÎó %s"%checkArgs)  
 | 
        return False  
 | 
      
 | 
    notifyMsg = argsList[0]    # ÏµÍ³Ìáʾ  
 | 
    tagLv = argsList[1]    # ÆÚÍûµÈ¼¶  
 | 
      
 | 
    #ÑéÖ¤ÊÇ·ñΪÆÚÍûµÈ¼¶ÒÔÉÏ  
 | 
    if curPlayer.GetLV() < int(tagLv):  
 | 
        PlayerControl.NotifyCode(curPlayer, notifyMsg, [tagLv])  
 | 
        return False  
 | 
      
 | 
    return True  
 | 
  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##²Ëµ¥Ñ¡ÏîÑéÖ¤µ÷¶ÈÆ÷  ¼ì²éͨ¹ý²ÅÏÔʾ  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param menuStr Ñ¡Ïî  
 | 
# @return ·µ»ØÖµÕ棬¿ÉÒÔÏÔʾ  
 | 
# @remarks ²Ëµ¥Ñ¡ÏîÑéÖ¤µ÷¶ÈÆ÷   
 | 
def RunMenuCheck(curPlayer, menuStr, checkArgs):  
 | 
    if menuStr == "":  
 | 
        return True  
 | 
      
 | 
    callName = "Menu_Check_" + menuStr.title()  
 | 
      
 | 
    if globals().has_key(callName):  
 | 
        return globals()[callName](curPlayer, checkArgs)  
 | 
      
 | 
    GameWorld.Log("Error : %s UnCalled"%callName , curPlayer.GetPlayerID())  
 | 
    return False  
 | 
  
 | 
#=====================================================================  
 | 
##ÁúÃÅÆå¾ÖÈÎÎñ¸±±¾£©µÄ½±Àø  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @return ·µ»ØÖµÎÞÒâÒå  
 | 
# @remarks ÁúÃÅÆå¾ÖÈÎÎñ¸±±¾£©µÄ½±Àø  
 | 
def GiveSpecialMissionReward_13002(curPlayer, curMission):  
 | 
    return  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##ÌØÊâÈÎÎñ½±Àø  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param curActionNode ¼¤»î½Úµã  
 | 
# @return ·µ»ØÖµ, ÔÊÐí½á¹û  
 | 
# @remarks ÌØÊâÈÎÎñ½±Àø  
 | 
def GiveSpecialMissionReward(curPlayer, curMission, curActionNode):  
 | 
    callName = "GiveSpecialMissionReward_%d"%curMission.GetMissionID()  
 | 
    if globals().has_key(callName):  
 | 
        return globals()[callName](curPlayer,curMission)  
 | 
      
 | 
    GameWorld.Log("can't find call %s"%callName , curPlayer.GetPlayerID())  
 | 
    return False  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##NPC¶Ô»°ÖеÄÌæ»»  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param type ÀàÐÍ  
 | 
# @return ·µ»ØÖµÌæ»»½á¹û  
 | 
# @remarks NPC¶Ô»°ÖеÄÌæ»»  
 | 
def GetNPCTalkReplaceValue(curPlayer, curMission, type):  
 | 
    pars = type.split()  
 | 
    type = pars[0]  
 | 
    pars.pop(0)   
 | 
    conditionType = type.title()  
 | 
    callName = "__GetTalkReplace_" + conditionType.title()  
 | 
  
 | 
    #GameWorld.Log('Func Call : %s'%str(callName))  
 | 
  
 | 
    if globals().has_key(callName):  
 | 
        result = str(globals()[callName](curPlayer, curMission, type, pars))  
 | 
        #GameWorld.Log('Func Call Result: %s'%str(result))  
 | 
        return result  
 | 
  
 | 
    if curMission == None:  
 | 
        GameWorld.Log('###GetNPCTalkReplaceValue ÕÒ²»µ½Ìæ»», type = %s'%type)  
 | 
        return ''  
 | 
  
 | 
    return str(curMission.GetProperty(type))        
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
##NPC¶Ô»°ÖÐÎÄ×ÖÌæ»»       
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param curMission ÈÎÎñʵÀý  
 | 
# @param text ÎÄ×Ö  
 | 
# @return ·µ»ØÖµÌæ»»½á¹û  
 | 
# @remarks NPC¶Ô»°ÖÐÎÄ×ÖÌæ»»       
 | 
def ReplaceNPCTalkText(curPlayer, curMission, text):  
 | 
    parseList = QuestCommon.DealWithInPut(text)  
 | 
    if len(parseList) == 0:  
 | 
        return text  
 | 
  
 | 
    #GameWorld.Log('%s--------------------'%text)  
 | 
  
 | 
    for i in range(0,len(parseList)):  
 | 
        parseList[i] = GetNPCTalkReplaceValue(curPlayer, curMission, parseList[i])  
 | 
        #GameWorld.Log('%s---------------'%parseList[i])  
 | 
  
 | 
    content = QuestCommon.DealWithReverse(text, parseList)  
 | 
    #GameWorld.Log('%s---------------'%content)  
 | 
  
 | 
    return content  
 | 
  
 | 
#---------------------------------------------------------------------  
 |