#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
#-------------------------------------------------------------------------------
|
#
|
##@package Player.PlayerFreshmanGuide
|
#
|
# @todo:ÐÂÊÖÖ¸µ¼Ô±
|
# @author hxp
|
# @date 2014-02-28
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ÐÂÊÖÖ¸µ¼Ô±
|
#
|
#---------------------------------------------------------------------
|
#"""Version = 2014-02-28 21:10"""
|
|
import ChConfig
|
import BuffSkill
|
import GameWorld
|
import SkillCommon
|
import ReadChConfig
|
import PlayerControl
|
|
|
## ÉèÖÃÐÂÊÖÖ¸µ¼Ô±ÓÐЧÌìÊý
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param day ÌìÊý£¬Îª0ʱȡÏûÐÂÊÖÖ¸µ¼Ô±¹¦ÄÜ
|
# @param tick µ±Ç°Ê±¼ä
|
# @return
|
def SetFreshmanGuideDay(curPlayer, day):
|
GameWorld.DebugLog("SetFreshmanGuideDay day=%s" % day, curPlayer.GetPlayerID())
|
day = max(0, day)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FreshmanGuideDay, day)
|
|
tick = GameWorld.GetGameWorld().GetTick()
|
|
# buff´¦Àí
|
if day > 0:
|
SkillCommon.AddBuffBySkillType(curPlayer, ChConfig.Def_SkillID_FreshmanGuideBuff, tick)
|
else:
|
BuffSkill.DelBuffBySkillID(curPlayer, ChConfig.Def_SkillID_FreshmanGuideBuff, tick)
|
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FreshmanGuideSpeakerCntToday, 0)
|
# ֪ͨGameServer
|
__NotifyGameServer(curPlayer)
|
return
|
|
|
## »ñÈ¡ÐÂÊÖÖ¸µ¼Ô±Ê£ÓàÌìÊý
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @return Ê£ÓàÌìÊý£¬Îª0±íʾ·ÇÖ¸µ¼Ô±
|
def GetFreshmanGuiderDay(curPlayer):
|
return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FreshmanGuideDay)
|
|
|
## ֪ͨGameServer
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @return None
|
def __NotifyGameServer(curPlayer):
|
msgList = [GetFreshmanGuiderDay(curPlayer)]
|
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, 'FreshmanGuiderDay', \
|
'%s' % (msgList), len(str(msgList)))
|
return
|
|
|
## ÐÂÊÖÖ¸µ¼Ô±µÇ¼´¦Àí
|
# @param curPlayer ·¢³öÇëÇóµÄÍæ¼Ò
|
# @return None
|
def FreshmanGuiderOnLogin(curPlayer):
|
# ·ÇÐÂÊÖÖ¸µ¼Ô±
|
if GetFreshmanGuiderDay(curPlayer) <= 0:
|
return
|
|
# µÇ¼ʱÏòGameServerͬ²½Ê£ÓàÌìÊý
|
__NotifyGameServer(curPlayer)
|
return
|
|
|
## ÐÂÊÖÖ¸µ¼Ô±¹ýÌì´¦Àí
|
# @param curPlayer ·¢³öÇëÇóµÄÍæ¼Ò
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
def FreshmanGuiderOnDay(curPlayer):
|
# ·ÇÐÂÊÖÖ¸µ¼Ô±
|
if GetFreshmanGuiderDay(curPlayer) <= 0:
|
GameWorld.DebugLog("FreshmanGuiderOnDay...·ÇÐÂÊÖÖ¸µ¼Ô±!", curPlayer.GetPlayerID())
|
return
|
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FreshmanGuideSpeakerCntToday, 0)
|
nowDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FreshmanGuideDay)
|
nowDay = max(0, nowDay - 1)
|
GameWorld.DebugLog("FreshmanGuiderOnDay...¸üÐÂÐÂÊÖÖ¸µ¼Ô±ÌìÊý£º%s,Çå¿Õ´«Òô´ÎÊý£¡" % nowDay, curPlayer.GetPlayerID())
|
SetFreshmanGuideDay(curPlayer, nowDay)
|
return
|
|
|
## ÐÂÊÖÖ¸µ¼Ô±¿É·ñÃâ·ÑʹÓô«Òô
|
# @param curPlayer ·¢³öÇëÇóµÄÍæ¼Ò
|
# @return True or False
|
def CanFreeSpeak(curPlayer):
|
# ·ÇÐÂÊÖÖ¸µ¼Ô±
|
if GetFreshmanGuiderDay(curPlayer) <= 0:
|
return False
|
|
maxFreeCnt = ReadChConfig.GetEvalChConfig("FreshmanGuiderFreeSpeakCnt")
|
todayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FreshmanGuideSpeakerCntToday)
|
GameWorld.DebugLog("CanFreeSpeak maxFreeCnt=%s,todayCnt=%s" % (maxFreeCnt, todayCnt), curPlayer.GetPlayerID())
|
return todayCnt < maxFreeCnt
|
|
|
## Ôö¼ÓÐÂÊÖÖ¸µ¼Ô±Ãâ·ÑʹÓô«Òô´ÎÊý
|
# @param curPlayer ·¢³öÇëÇóµÄÍæ¼Ò
|
# @return
|
# @remarks ĬÈϼÓ1
|
def AddFreeSpeakCnt(curPlayer):
|
speakerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FreshmanGuideSpeakerCntToday)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FreshmanGuideSpeakerCntToday, speakerCnt + 1)
|
GameWorld.DebugLog("AddFreeSpeakCnt ÐÂÊÖÖ¸µ¼Ô±Ôö¼ÓÃâ·Ñ·¢´«Òô´ÎÊý£¡µ±Ç°ÒÑÃâ·Ñ´ÎÊý=%s"
|
% (speakerCnt + 1), curPlayer.GetPlayerID())
|
return
|
|