#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package Player.PlayerSuperDiscount # # @todo:ÖÁ×ð¿¨ÕÛ¿Û # @author hxp # @date 2024-10-18 # @version 1.0 # # ÏêϸÃèÊö: ÖÁ×ð¿¨ÕÛ¿Û£¬½«³äÖµÔ­¼Û¹ºÂò±ä³É1ÕÛ£¬Ó¢Îİæ×¨Óà # #------------------------------------------------------------------------------- #"""Version = 2024-10-18 15:00""" #------------------------------------------------------------------------------- import GameWorld import IpyGameDataPY import PlayerControl import ShareDefine import ChConfig def GetSuperDiscountState(curPlayer): ## ÖÁ×ðÕÛ¿Û¿¨¼¤»î״̬ return curPlayer.GetLV2() == 1 def ActSuperDiscountByCTG(curPlayer, ctgID): ## ³äÖµ¼¤»î ctgList = IpyGameDataPY.GetFuncEvalCfg("EnSuperDiscount", 1) if ctgID in ctgList: __DoActiveSuperDiscount(curPlayer, ctgID) return def __DoActiveSuperDiscount(curPlayer, ctgID=0): ## ¼¤»îÖÁ×𿨠if GetSuperDiscountState(curPlayer): GameWorld.DebugLog("ÖÁ×ð¿¨ÒѼ¤»î!") return if not ctgID: needCreateRoleDays = IpyGameDataPY.GetFuncCfg("EnSuperDiscount", 2) createRoleDays = GameWorld.GetCreateRoleDays(curPlayer) if createRoleDays < needCreateRoleDays: GameWorld.ErrLog("´´½ÇÌìÊý²»×㣬ÎÞ·¨Ãâ·Ñ¼¤»îÖÁ×ð¿¨! createRoleDays=%s < %s" % (createRoleDays, needCreateRoleDays), curPlayer.GetPlayerID()) return GameWorld.DebugLog("¼¤»îÖÁ×ð¿¨: ctgID=%s" % (ctgID), curPlayer.GetPlayerID()) curPlayer.SetLV2(1) return #// AA 02 ÍÆ½ð±Ò #tagCMTuijinbi # #struct tagCMTuijinbi #{ # tagHead Head; # BYTE OpType; // ²Ù×÷ÀàÐÍ: 0-³é½±£»1-»ñµÃ½ð±Ò£»2-¼¤»îÖÁ×𿨠# DWORD Value1; // ÀàÐÍ1ʱΪ»õ±ÒÀàÐÍ # DWORD Value2; // ÀàÐÍ1ʱΪ»õ±ÒÊýÖµ #}; def OnTuijinbi(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) playerID = curPlayer.GetPlayerID() opType = clientData.OpType value1 = clientData.Value1 value2 = clientData.Value2 if opType == 0: # Ö±½Ó¿Û³ý´ÎÊý£¬½ö×÷Ϊ¼Ç¼Ó㬳齱Âß¼­Ç°¶Ë×Ô¼º¿ØÖÆ PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_Tuijinbi, 1, isNotify=False) elif opType == 1: moneyType = value1 moneyValue = value2 moneyUpperLimitDict = IpyGameDataPY.GetFuncEvalCfg("EnSuperDiscount", 3, {}) if moneyType not in moneyUpperLimitDict: GameWorld.DebugLog("ÍÆ½ð±ÒûÓÐÅäÖûñµÃ¸Ã»õ±Ò½±ÀøÉÏÏÞ! moneyType=%s" % moneyType, playerID) return moneyUpperLimit = moneyUpperLimitDict[moneyType] moneyTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TuiJinbiMoney % moneyType) updMoneyTotal = min(moneyTotal + moneyValue, moneyUpperLimit, ChConfig.Def_UpperLimit_DWord) giveMoney = updMoneyTotal - moneyTotal if giveMoney <= 0: GameWorld.ErrLog("ÍÆ½ð±ÒÒÑ´ï½±ÀøÉÏÏÞ! moneyType=%s,moneyTotal=%s" % (moneyType, moneyTotal), playerID) return PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TuiJinbiMoney % moneyType, updMoneyTotal) GameWorld.DebugLog("¸üÐÂÍÆ½ð±Ò½±Àø: moneyType=%s,moneyValue=%s,giveMoney=%s,updMoneyTotal=%s" % (moneyType, moneyValue, giveMoney, updMoneyTotal), playerID) PlayerControl.GiveMoney(curPlayer, moneyType, giveMoney, "Tuijinbi") elif opType == 2: __DoActiveSuperDiscount(curPlayer) return