xdh
2018-12-19 57a7f963e83329c191e135c8102b0614dea6d5b4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
@@ -52,6 +52,7 @@
import ChEquip
import QuestCommon
import random
import GameObj
# 可吞噬的装备位
Def_EatItem_EquipPlace = [
@@ -67,6 +68,15 @@
]
Def_EatSpace = 5    # 低于X格自动吞噬
def DoTJGOpen(curPlayer):
    ##脱机挂功能开启 赠送脱机时间
    addTime = IpyGameDataPY.GetFuncCfg('TJGGiftTime')
    AddTJGTime(curPlayer, addTime)
    GameWorld.DebugLog('脱机挂功能开启 赠送脱机时间 %s'%addTime, curPlayer.GetID())
    return
#===============================================================================
# //B2 01 脱机挂状态 # tagCMLoginState
# struct    tagCMLoginState
@@ -176,6 +186,7 @@
        return
    curPlayer.SetSight(min(ChConfig.Def_PlayerSight_Default, clientData.Sight))
    GameWorld.DebugLog("OnSightZoom:%s"%clientData.Sight)
    return
# 需要处理的点,防沉迷
@@ -316,7 +327,7 @@
    aSkillAtkRate = curPlayer.GetSkillAtkRate()    # 技能攻击力加成
    petMinAtk = PlayerControl.GetPetMinAtk(curPlayer)   #灵宠最小攻击
    petMaxAtk = PlayerControl.GetPetMaxAtk(curPlayer)   #灵宠最大攻击
    petDamPer = PlayerControl.GetPetDamPer(curPlayer)   #灵宠增加伤害
    petDamPer = GameObj.GetPetDamPer(curPlayer)   #灵宠增加伤害
    atkSpeed = PlayerControl.GetAtkSpeed(curPlayer) # 攻击速度
    aIgnoreDefRate = curPlayer.GetIgnoreDefRate()  # 无视防御比率
    aLuckyHit = curPlayer.GetLuckyHitVal()  # 会心一击
@@ -450,7 +461,10 @@
    
    # 击杀特定NPC成就
    PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillSpecificNPC, killCnt, [npcID])
    # 日常活动
    if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGOnDayEx):
        if npcData.GetLV()>=curPlayer.GetLV() - IpyGameDataPY.GetFuncCfg('DailyQuestKillMonster'):
            PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_KillNPC, killCnt)
    # 击杀任务怪, 杀怪日常已经没有了,暂时屏蔽
    #for _ in xrange(killCnt):
    #    EventShell.Event_OnKillByID(curPlayer, npcID)
@@ -531,6 +545,7 @@
    #GameWorld.DebugLog("equipScores----%s"%equipScores)
    
    eatIndexList = []
    eatItemIDList = []
    itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
    for i in range(0, itemPack.GetCount()):
        curItem = itemPack.GetAt(i)
@@ -553,9 +568,9 @@
                continue
        
        eatIndexList.append(i)
        eatItemIDList.append(curItem.GetItemTypeID())
    #GameWorld.DebugLog("eatIndexList-----------%s"%len(eatIndexList))
    eatCount, giveCnt = PlayerEquipDecompose.EatItems(curPlayer, eatIndexList)
    eatCount, giveCnt = PlayerEquipDecompose.EatItems(curPlayer, eatIndexList, eatItemIDList)
    NoteEatEquip(curPlayer, eatCount, giveCnt)
    CheckPackFull(curPlayer)
    
@@ -654,7 +669,8 @@
    if curPlayer.GetIP() == "127.0.0.1":
        LoginFixTJG(curPlayer, True)
        return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGOnDayEx, 0)
    # 脱机挂没有运作情况下 弥补收益
    LoginFixTJG(curPlayer)
    
@@ -776,12 +792,16 @@
 
# 过天清理
def TJGOnDay(curPlayer):
    times = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGDeadPayTime)
    if times == 0:
        return
    ResetTJGDeadInfo(curPlayer)
def TJGOnDay(curPlayer, onEventType):
    if onEventType == ShareDefine.Def_OnEventType:
        times = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TJGDeadPayTime)
        if times == 0:
            return
        ResetTJGDeadInfo(curPlayer)
    elif onEventType == ShareDefine.Def_OnEventTypeEx:
        if GetIsTJG(curPlayer):
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGOnDayEx, 1)
    return
def ResetTJGDeadInfo(curPlayer):
@@ -826,6 +846,58 @@
    return
def TJGGM(curPlayer, times):
    # 真实上线
    npcID = FindTJGNPC(curPlayer)
    if not npcID:
        return
    # 此时由服务端重新找一次挂机NPC
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, npcID)
    GameWorld.DebugAnswer(curPlayer, "GM模拟脱机产出,npcid:%s, 时间秒:%s, 经验倍率:%s"%(
                    curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_TJGNPC), times,
                    curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate)))
    # 设置脱机登录时的等级, 上线通知清空, 没清空说明多次脱机挂登录 使用旧等级
    notifyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_LV, 0, ChConfig.Def_PDictType_TJGNotify)
    if not notifyLV:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDictType_TJGNotify_LV, curPlayer.GetLV(), ChConfig.Def_PDictType_TJGNotify)
    # 记录秒单位
    NoteTJGTime(curPlayer, times)
    OnTJGKillNPCByTimes(curPlayer, times)
    sendPack = ChPyNetSendPack.tagMCTJGInfo()
    sendPack.Clear()
    sendPack.Exp1 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Exp1, 0, ChConfig.Def_PDictType_TJGNotify)
    sendPack.Exp2 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Exp2, 0, ChConfig.Def_PDictType_TJGNotify)
    sendPack.Times = times
    sendPack.PurpleEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Purple, 0, ChConfig.Def_PDictType_TJGNotify)
    sendPack.OrangeEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_Orange, 0, ChConfig.Def_PDictType_TJGNotify)
    sendPack.EatPurpleEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_EatPurple, 0, ChConfig.Def_PDictType_TJGNotify)
    sendPack.GiveCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_GiveCnt, 0, ChConfig.Def_PDictType_TJGNotify)
    sendPack.BeforeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_LV, 0, ChConfig.Def_PDictType_TJGNotify)
    sendPack.Items = []
    itemIDList = IpyGameDataPY.GetFuncEvalCfg('OfflinePostItem', 1)
    for itemID in itemIDList:
        count = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_ItemID%itemID, 0, ChConfig.Def_PDictType_TJGNotify)
        if count == 0:
            continue
        itemInfo = ChPyNetSendPack.tagMCTJGItems()
        itemInfo.ItemID = itemID
        itemInfo.Count = count
        sendPack.Items.append(itemInfo)
    sendPack.Cnt = len(sendPack.Items)
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    curPlayer.ClearNomalDict(ChConfig.Def_PDictType_TJGNotify)
# 上线检查脱机时间是否正常运行, 弥补对应缺失时间,如维护2小时缺失的脱机挂收益
# 1. 非脱机死亡,2.存在脱机时间,3.离线时间超过5分钟;则一次补齐 离线时间-5分钟的收益并减少脱机时间
# 按当前经验倍率计算,且不会减buff时间
@@ -857,7 +929,7 @@
        # 此时由服务端重新找一次挂机NPC
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, npcID)
    
    GameWorld.DebugLog("弥补脱机----npcid  %s-%s-%s"%(
    GameWorld.DebugLog("弥补脱机----playerID:%s ,npcid  %s-%s-%s"%(curPlayer.GetID(),
                    curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_TJGNPC), times,
                    curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate)))