#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GM.Commands.Zhenbaoge
|
#
|
# @todo:Õ䱦¸ó
|
# @author hxp
|
# @date 2024-10-29
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: Õ䱦¸ó
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2024-10-29 17:30"""
|
#-------------------------------------------------------------------------------
|
|
import ChConfig
|
import GameWorld
|
import PlayerControl
|
import PlayerFamilyZhenbaoge
|
import PlayerFamily
|
import DBDataMgr
|
import random
|
import time
|
|
## GMÃüÁîÖ´ÐÐÈë¿Ú
|
# @param curPlayer µ±Ç°Íæ¼Ò
|
# @param msgList ²ÎÊýÁбí [addSkillID]
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def OnExec(curPlayer, msgList):
|
|
if not msgList:
|
GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÏÉÃËÕ䱦¸ó: Zhenbaoge 0")
|
GameWorld.DebugAnswer(curPlayer, "ÖØÖýñÈÕ״ֵ̬: Zhenbaoge d")
|
GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÍËÏÉÃËʱ¼ä: Zhenbaoge ft x·ÖÖÓǰ")
|
GameWorld.DebugAnswer(curPlayer, "ÐÂÔö¼Ù¿³¼ÛÊý¾Ý: Zhenbaoge ´ÎÊý [Ëæ»úAÖµ ÖÁBÖµ]")
|
GameWorld.DebugAnswer(curPlayer, "ABֵûÓÐÌîÔò°´³£¹æ¿³¼Û¼Û¸ñ¼ÆËã")
|
return
|
|
familyID = curPlayer.GetFamilyID()
|
if not familyID:
|
GameWorld.DebugAnswer(curPlayer, "ûÓÐÏÉÃË")
|
return
|
curFamily = DBDataMgr.GetFamilyMgr().FindFamily(familyID)
|
if not curFamily:
|
return
|
|
value1 = msgList[0]
|
if value1 == 0:
|
PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)
|
GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÏÉÃËÕ䱦¸óOK")
|
return
|
|
elif value1 == "d":
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy, 0)
|
PlayerFamilyZhenbaoge.Sync_ZhenbaogeInfo(curPlayer)
|
GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÕ䱦¸óÍæ¼Ò½ñÈÕ״̬OK")
|
return
|
|
elif value1 == "ft":
|
minutes = msgList[1] if len(msgList) > 1 else 0
|
leaveFamilyTimeEx = int(time.time()) - minutes * 60
|
PlayerControl.SetLeaveFamilyTimeEx(curPlayer, leaveFamilyTimeEx)
|
GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÍËÏÉÃËʱ¼ä:%s" % GameWorld.ChangeTimeNumToStr(leaveFamilyTimeEx))
|
return
|
|
#Ìí¼Ó¼Ù¿³¼Û
|
gActionData = PlayerFamilyZhenbaoge.GetZhenbaogeActionData(familyID, PlayerFamilyZhenbaoge.ActionGlobalID)
|
if not gActionData:
|
GameWorld.DebugAnswer(curPlayer, "ÇëÏÈÖØÖÃÕ䱦¸ó")
|
return
|
|
familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, PlayerFamilyZhenbaoge.ActionType)
|
actionCount = familyAction.Count()
|
|
fackCount = value1
|
randValue1 = msgList[1] if len(msgList) > 1 else 0
|
randValue2 = msgList[2] if len(msgList) > 2 else 0
|
syncActionDataList = [gActionData]
|
startFackID = 1000 + actionCount
|
FakeName = GameWorld.GbkToCode("¼ÙÃû×Ö")
|
for fackID in range(startFackID, startFackID + fackCount):
|
|
playerID = fackID
|
playerName = "%s%s" % (FakeName, fackID)
|
|
if randValue1 and randValue2 and randValue1 <= randValue2:
|
cutPrice = random.randint(randValue1, randValue2)
|
else:
|
cutPrice = PlayerFamilyZhenbaoge.CalcCutPrice(curFamily, gActionData, playerID)
|
|
if not cutPrice:
|
continue
|
|
actionData = PlayerFamilyZhenbaoge.AddCutPrice(familyID, playerID, playerName, cutPrice, gActionData, False)
|
syncActionDataList.append(actionData)
|
nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
|
GameWorld.DebugAnswer(curPlayer, "¿³¼ÛÈË´Î:%s,¿³¼Û:%s,ÏÖ¼Û:%s" % (fackID % 1000, cutPrice, nowPrice))
|
|
PlayerFamily.SendFamilyAction(syncActionDataList)
|
nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
|
GameWorld.DebugAnswer(curPlayer, "Ìí¼Ó¼Ù¿³¼ÛÊý:%s,×Ü¿³¼ÛÊý:%s,µ±Ç°¼Û¸ñ:%s" % (fackCount, familyAction.Count() - 1, nowPrice))
|
return
|