#!/usr/bin/python # -*- coding: GBK -*- # ##@package # # @todo: ¸öÍÆÂß¼­ # # @author: Alee # @date 2018-5-20 ÏÂÎç02:10:00 # @version 1.0 # # @note: # #--------------------------------------------------------------------- import PlayerControl import GameWorld import ChConfig import ReadChConfig import datetime import IpyGameDataPY import IPY_GameWorld import ChPyNetSendPack import NetPackCommon import PlayerTJG import PlayerViewCacheTube import urllib import PlayerVip import json #=============================================================================== # //B2 05 ÍÆËÍÌáÐÑÉèÖà tagCMPushNotificationsSetting # # struct tagCMPushNotificationsSetting # { # tagHead Head; # DWORD OnoffBit; // °´Î»Ô¼¶¨¿ª¹Ø # BYTE TimeLen; # char TimeStr[TimeLen]; // ʱ¼ä×Ö·û´® 01:02-05:00 # }; #=============================================================================== # VIPȨÏÞ Def_Onoff_VIPCount = 5 ( Def_Onoff_Time, #Ãâ´òÈÅʱ¼ä¿ª¹Ø Def_Onoff_Boss, #¹Ø×¢BOSS Def_Onoff_Chat, #˽ÁÄ Def_Onoff_TJGDead, #ÍÑ»úËÀÍö Def_Onoff_TJGTimeLess, #ÍÑ»úʱ¼ä²»×ã1Сʱ ) = range(Def_Onoff_VIPCount) #·ÇVIPȨÏÞ Def_GeTui_FMT = -2 # ·âħ̳ # ÍÆËÍÌáÐÑÉèÖà def GeTuiSetting(index, pack, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) if not PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_5): #Çå¿ÕÇ°4λ VIPȨÏÞ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GeTuiSet, pack.OnoffBit>>Def_Onoff_VIPCount< 24: return if num2 < 0 or num2 > 60: return numList2 = timeList[1].split(":") if len(numList2) != 2: return num3 = GameWorld.ToIntDef(numList2[0], 0) num4 = GameWorld.ToIntDef(numList2[1], 0) if num3 < 0 or num3 > 24: return if num4 < 0 or num4 > 60: return return num1*1000000 + num2*10000 + num3*100 + num4 # ±ãÓÚ²âÊÔ def GetGeTuiClientID(curPlayer): #return "13165ffa4e5a8fbf6d0" return curPlayer.GetAccountData().GetGeTuiClientID() # ¼ì²éÊÇ·ñ¿ÉÒÔ¸öÍÆ£¬geTuiTypeСÓÚ0µÄ´ú±íĬÈÏ¿ÉÍÆ£¬ÎÞVIPÏÞÖÆ def CheckCanGeTui(curPlayer, geTuiType=-1): if not GetGeTuiClientID(curPlayer): return False if not PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_5): if geTuiType < 0: return True return False if geTuiType == Def_GeTui_FMT: # ·âħ̳ÊÜVIPµÄ¹Ø×¢BOSS¿ª¹ØÓ°Ïì geTuiType = Def_Onoff_Boss # ¼ì²éʱ¼äºÍ¿ª¹Ø if geTuiType >= 0 and curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GeTuiSet)&pow(2, geTuiType) == 0: return False # ûÓпªÆôÃâ´òÈÅ if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GeTuiSet)&pow(2, Def_Onoff_Time) == 0: return True limitTimt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NoGeTuiTime) curTime = GameWorld.GetCurrentTime() dateStr = str(curTime).split()[0] #ʱ¼ä¸ñʽ '%Y-%m-%d %H:%M' try: startTimeStr = '%s %s:%s'%(dateStr, limitTimt/1000000, limitTimt/10000%100) startTime = datetime.datetime.strptime(startTimeStr, "%Y-%m-%d %H:%M") endTimeStr = '%s %s:%s'%(dateStr, limitTimt/100%100, limitTimt%100) endTime = datetime.datetime.strptime(endTimeStr, "%Y-%m-%d %H:%M") except: return False if startTime == endTime: # ʱ¼äÒ»Ö´ú±í²»ÏÞÖÆ return True # Èç 13:00-23:00 elif startTime < endTime: if startTime <= curTime and curTime <= endTime: return False # Èç 23:00 - 8:00 else: if endTime < curTime < startTime: return True else: return False return True #=============================================================================== # //B2 02 ÍÆËÍÌáÐÑÉèÖÃ֪ͨ #tagMCPushNotificationsSetting # # struct tagMCPushNotificationsSetting # { # tagHead Head; # DWORD OnoffBit; // °´Î»Ô¼¶¨¿ª¹Ø # BYTE TimeLen; # char TimeStr[TimeLen]; // ʱ¼ä×Ö·û´® 01:02-05:00 # }; #=============================================================================== def LoginNotifySetting(curPlayer): sendPack = ChPyNetSendPack.tagMCPushNotificationsSetting() sendPack.OnoffBit = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GeTuiSet) limitTimt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NoGeTuiTime) timeStr = "%s:%s-%s:%s"%(limitTimt/1000000, limitTimt/10000%100, limitTimt/100%100, limitTimt%100) sendPack.TimeStr = timeStr sendPack.TimeLen = len(timeStr) NetPackCommon.SendFakePack(curPlayer, sendPack) return #=============================================================================== # import urllib # getUrl = "http://127.0.0.1:53000/getui/index.php" # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(0) # postInfo = urllib.urlencode({"PlayerName": curPlayer.GetName(), "NotifyMsg":"BOSS---", "RegID":"101d8559091575fb3da", "OSName":"ios"}) # GameWorld.GetGameWorld().EventReport_EventReport(postInfo, "", "", "", 1, getUrl) #=============================================================================== # ȺÍÆÀඨʱ»î¶¯ÓÉ¿Í»§¶Ë×Ô¼º´¦Àí # ·þÎñ¶ËȺÍÆÔݲ»ÓÉÓÎÏ··þÎñÆ÷ÍÆËÍ£¬¿É´ÓµÚÈý·½¸öÍÆÍøÕ¾ÍÆËÍ # ÓÎÏ··þÎñÆ÷Ö»ÍÆË;ßÓб仯ÐÔµÄÄÚÈÝ # Ö§³Öµ¥ÍƺͶàÈËÍÆËÍ # appIDDict »ì·þʹÓöÔÓ¦²»Í¬key {ƽ̨ID£º[[Íæ¼Ò¸öÍÆID£¬ Íæ¼ÒÃû],[Íæ¼Ò¸öÍÆID2£¬ Íæ¼ÒÃû2]¡£¡£¡£]} # Èç¹ûÍæ¼ÒÃû´æÔÚÔò±ØÐëÓë¸öÍÆIDÒ»Ò»¶ÔÓ¦£¬Èô²»´æÔÚÔòÊǶàÍÆ£¬Èô´æÔÚÔò»áÒ»Ò»µ¥ÍÆ # ´øÃû×ֻᱻ×éºÏ³É ¸ñʽÈ硾Íæ¼ÒÃû¡¿Äú¹Ø×¢µÄBOSSxxÒѸ´»î # EventReport_EventReport ÏòÓÎÏ··þÎñÆ÷µÄ¸öÍÆС³ÌÐò·¢ËÍ webbottle def GeTuiNotify(appIDDict, notifyMsg): if not appIDDict: return #osName = ReadChConfig.GetPyMongoConfig("GeTui", "OSName") »ì·þÎÞ·¨ÅäÖÃϵͳ geTuiUrl = ReadChConfig.GetPyMongoConfig("GeTui", "GeTuiUrl") playerInfo = json.dumps(appIDDict, ensure_ascii=False) #º¬ÖÐÎIJ¿·ÖÒªurlencode postInfo = urllib.urlencode({"PlayerInfo": playerInfo, "NotifyMsg":notifyMsg}) GameWorld.GetGameWorld().EventReport_EventReport(postInfo, "", "", "", 1, geTuiUrl) return # ʱ¼ä²»×ã def TJGTimeLess(curPlayer): # ֪ͨÍÑ»ú¹Ò£¬Ö»´¦ÀíÒ»´Î if curPlayer.GetDictByKey("TJGTimeLess"): return tjgTime = PlayerTJG.GetTJGTime(curPlayer) if tjgTime > 3600: return curPlayer.SetDict("TJGTimeLess", 1) if not CheckCanGeTui(curPlayer, Def_Onoff_TJGTimeLess): return showStr = GameWorld.GbkToCode(IpyGameDataPY.GetFuncCfg("GeTuiTJG", 4)) # ÎÄ×ÖÐÅÏ¢ GeTuiNotify({GameWorld.GetPlayerPlatform(curPlayer) :[[GetGeTuiClientID(curPlayer), curPlayer.GetName()]]}, showStr) return #[Íæ¼ÒÃû]ÍÑ»úÍâ¹ÒÒÑ¿ªÊ¼ÍйܽÇÉ«¹Ò»ú£¬½ÇÉ«µ±Ç°¾­ÑéЧÂÊ£º9999ÒÚ9999Íò¾­Ñé/·Ö£¬Ê£ÓàÍÑ»úÍâ¹Òʱ¼ä£º**Сʱ**·ÖÖÓ def TJGEfficiency(curPlayer, times, exp): # ֪ͨÍÑ»ú¹ÒЧÒ棬ֻ´¦ÀíÒ»´Î if curPlayer.GetDictByKey("TJGEfficiency"): return curPlayer.SetDict("TJGEfficiency", 1) if not CheckCanGeTui(curPlayer): return showStr = IpyGameDataPY.GetFuncCfg("GeTuiTJG") # ÎÄ×ÖÐÅÏ¢ wanStr = IpyGameDataPY.GetFuncCfg("Coins1", 1) # Íò yiStr = IpyGameDataPY.GetFuncCfg("Coins1", 2) # ÒÚ # ´ËΪÖÐʽÏÔʾ·¨£¬·­Òë³ÉÓ¢ÎÄÒò¿¼ÂÇÏÔʾÂß¼­²»Í¬¶ø±ä Hundred_Million = 100000000 Ten_Thousand = 10000 exp = exp/max(times, 1)*60 if exp >= Hundred_Million: expStr = "%s%s"%(exp/Hundred_Million, yiStr) if exp/Ten_Thousand%Ten_Thousand != 0: expStr += "%s%s"%(exp/Ten_Thousand%Ten_Thousand, wanStr) elif exp >= Ten_Thousand: if exp < Ten_Thousand*100: expStr = "%.1f%s"%(exp*1.0/Ten_Thousand, wanStr) else: expStr = "%s%s"%(exp/Ten_Thousand, wanStr) else: expStr = exp tjgTime = PlayerTJG.GetTJGTime(curPlayer) GeTuiNotify({GameWorld.GetPlayerPlatform(curPlayer) : [[GetGeTuiClientID(curPlayer), curPlayer.GetName()]]}, GameWorld.GbkToCode(showStr%(expStr, tjgTime/60/60, tjgTime/60%60))) return #Äú±»[ÆäËûÍæ¼ÒÃû]ɱËÀ£¬Ê£ÓàÍÑ»úÍâ¹Òʱ¼ä£º**Сʱ**·ÖÖÓ def TJGDead(curPlayer, tagName): if curPlayer.GetGameObjType() != IPY_GameWorld.gotPlayer: return if not PlayerTJG.GetIsTJG(curPlayer): return if not CheckCanGeTui(curPlayer): return showStr = GameWorld.GbkToCode(IpyGameDataPY.GetFuncCfg("GeTuiTJG", 2)) # ÎÄ×ÖÐÅÏ¢ tjgTime = PlayerTJG.GetTJGTime(curPlayer) GeTuiNotify({GameWorld.GetPlayerPlatform(curPlayer) : [[GetGeTuiClientID(curPlayer), curPlayer.GetName()]]}, showStr%(tagName, tjgTime/60/60, tjgTime/60%60)) return # [Íæ¼ÒÃû]µ±Ç°±³°üÒÑÂú£¬¸Ï¿ìÉÏÏß²éÊÕÕ½ÀûÆ·°É def FullPack(curPlayer): # ±³°üÂúÖ»´¦ÀíÒ»´Î,Íâ²ãÒÑÀ¹½Ø #=========================================================================== # if curPlayer.GetDictByKey("GTFullPack"): # return # curPlayer.SetDict("GTFullPack", 1) #=========================================================================== if not CheckCanGeTui(curPlayer): return showStr = GameWorld.GbkToCode(IpyGameDataPY.GetFuncCfg("GeTuiTJG", 3)) # ÎÄ×ÖÐÅÏ¢ GeTuiNotify({GameWorld.GetPlayerPlatform(curPlayer) : [[GetGeTuiClientID(curPlayer), curPlayer.GetName()]]}, showStr)