| | |
| | | import ItemControler
|
| | | import ChConfig
|
| | | import GameWorld
|
| | | import EventShell
|
| | | import PlayerControl
|
| | | import DataRecordPack
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | #---------------------------------------------------------------------
|
| | | #//仓库状态
|
| | | #enum TWarehouseState
|
| | | #{
|
| | | # wsNull = 0, //没有开始仓库
|
| | | # wsEnterPsw, //输入密码状态
|
| | | # wsWarehouse, //钱庄存取中
|
| | | # wsChangePsw, //修改密码状态
|
| | | # wsSetPsw, //设置密码状态
|
| | | #};
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ##是否可以弹出仓库密码窗口
|
| | | # @param curPlayer 玩家实例
|
| | | # @return 返回值, 是否需要输入
|
| | | # @remarks 玩家是否需要弹出需要输入仓库密码的窗口
|
| | | def NeedOpenWarehousePswWnd(curPlayer):
|
| | | if curPlayer.GetHaveWarehousePsw() == 0:
|
| | | #没有设定仓库密码
|
| | | return False
|
| | | |
| | | elif curPlayer.GetWarehouseLocked() == 0:
|
| | | #仓库有锁
|
| | | return False
|
| | | |
| | | return True
|
| | |
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | #仓库物品放入背包
|
| | | ItemControler.DragItem(curPlayer, IPY_GameWorld.rptWarehouse, warehouseIndex, IPY_GameWorld.rptItem, putIndex, putCount)
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //0C 03 仓库取出金钱#tagCGetMoneyInWarehouse
|
| | | # tagCGetMoneyInWarehouse * GettagCGetMoneyInWarehouse();
|
| | | # |
| | | # class IPY_CGetMoneyInWarehouse
|
| | | # {
|
| | | # public:
|
| | | # //金钱类型
|
| | | # int GetMoneyType();
|
| | | # //Ǯ
|
| | | # int GetMoney();
|
| | | # };
|
| | | #===============================================================================
|
| | | ##客户端封包响应 //0C 03 仓库取出金钱#tagCGetMoneyInWarehouse
|
| | | # @param index 玩家索引
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 客户端封包响应 //0C 03 仓库取出金钱#tagCGetMoneyInWarehouse
|
| | | def GetMoneyInWarehouse(curPlayer, tick):
|
| | | #玩家当前状态不是钱庄存取状态
|
| | | if curPlayer.GetWarehouseState() != IPY_GameWorld.wsWarehouse:
|
| | | return
|
| | | |
| | | #取出金钱封包
|
| | | sendPack = IPY_GameWorld.IPY_CGetMoneyInWarehouse()
|
| | | |
| | | #金钱类型
|
| | | moneyType = sendPack.GetMoneyType()
|
| | | |
| | | #金钱数量
|
| | | getMoney = sendPack.GetMoney()
|
| | | |
| | | if getMoney <= 0:
|
| | | #没输入钱,不处理
|
| | | return
|
| | | |
| | | if moneyType not in [IPY_GameWorld.TYPE_Price_Silver_Money]:
|
| | | return
|
| | | |
| | | #处理银子
|
| | | if moneyType == IPY_GameWorld.TYPE_Price_Silver_Money:
|
| | | curMoney = PlayerControl.GetSilver(curPlayer)
|
| | | curWarehouseMoney = curPlayer.GetWarehouseSilver()
|
| | | moneyCount = curMoney + getMoney
|
| | | |
| | | if moneyCount > ChConfig.Def_PlayerTotalMoney_Silver:
|
| | | #超过金钱上限
|
| | | PlayerControl.NotifyCode(curPlayer,"GeRen_chenxin_609765")
|
| | | return
|
| | | |
| | | if getMoney > curWarehouseMoney:
|
| | | PlayerControl.NotifyCode(curPlayer,"TakeMoneyLack")
|
| | | return
|
| | | |
| | | curPlayer.SetWarehouseSilver(curWarehouseMoney - getMoney) |
| | | addDataDict = {ChConfig.Def_Give_Reason_SonKey:"Get"}
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, getMoney, ChConfig.Def_GiveMoney_Warehouse, addDataDict)
|
| | | |
| | | |
| | | DataRecordPack.DR_GetMoneyInWarehouse(curPlayer, moneyType, getMoney)
|
| | | return
|
| | |
|
| | |
|
| | | #===============================================================================
|
| | | # //0C 04 仓库放入金钱#tagCPutMoneyInWarehouse
|
| | | # tagCPutMoneyInWarehouse * GettagCPutMoneyInWarehouse();
|
| | | # |
| | | # class IPY_CPutMoneyInWarehouse
|
| | | # {
|
| | | # public:
|
| | | # //金钱类型
|
| | | # int GetMoneyType();
|
| | | # //金钱
|
| | | # int GetMoney();
|
| | | # };
|
| | | #===============================================================================
|
| | | ##客户端封包响应 //0C 04 仓库放入金钱#tagCPutMoneyInWarehouse
|
| | | # @param index 玩家索引
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 客户端封包响应 //0C 04 仓库放入金钱#tagCPutMoneyInWarehouse
|
| | | def PutMoneyInWarehouse(curPlayer, tick):
|
| | | #玩家当前状态不是钱庄存取状态
|
| | | if curPlayer.GetWarehouseState() != IPY_GameWorld.wsWarehouse:
|
| | | return
|
| | | |
| | | #放入金钱封包
|
| | | sendPack = IPY_GameWorld.IPY_CPutMoneyInWarehouse()
|
| | | #金钱数量
|
| | | putMoney = sendPack.GetMoney()
|
| | | |
| | | if putMoney <= 0:
|
| | | #没输入金钱,不处理
|
| | | return
|
| | | |
| | | moneyType = sendPack.GetMoneyType()
|
| | | |
| | | if moneyType not in [IPY_GameWorld.TYPE_Price_Silver_Money]:
|
| | | return
|
| | |
|
| | | #处理银子
|
| | | if moneyType == IPY_GameWorld.TYPE_Price_Silver_Money:
|
| | | curMoney = PlayerControl.GetSilver(curPlayer)
|
| | | curWarehouseMoney = curPlayer.GetWarehouseSilver()
|
| | | moneyCount = curWarehouseMoney + putMoney
|
| | | |
| | | if moneyCount > ChConfig.Def_PlayerTotalMoney_Silver:
|
| | | #超过金钱上限
|
| | | PlayerControl.NotifyCode(curPlayer,"GeRen_chenxin_766742")
|
| | | return
|
| | | |
| | | if putMoney > curMoney:
|
| | | #SilverErr 对不起,您的银子数量不足
|
| | | PlayerControl.NotifyCode(curPlayer,"SilverErr")
|
| | | return
|
| | | |
| | | PlayerControl.PayMoney(curPlayer, moneyType, putMoney, ChConfig.Def_Cost_Warehouse, {ChConfig.Def_Cost_Reason_SonKey:"PutIn"})
|
| | | curPlayer.SetWarehouseSilver(moneyCount)
|
| | | |
| | | DataRecordPack.DR_SetMoneyInWarehouse(curPlayer, moneyType, putMoney)
|
| | | return True
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //0C 05 设置仓库密码#tagCSetWarehousePsw
|
| | | # tagCSetWarehousePsw * GettagCSetWarehousePsw();
|
| | | # |
| | | # class IPY_CSetWarehousePsw
|
| | | # {
|
| | | # public:
|
| | | # //当前密码(空表示没有密码)
|
| | | # char * GetPsw();
|
| | | # //旧密码
|
| | | # char * GetOldPsw();
|
| | | # };
|
| | | #===============================================================================
|
| | | ##客户端封包响应 //0C 05 设置仓库密码#tagCSetWarehousePsw
|
| | | # @param index 玩家索引
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 客户端封包响应 //0C 05 设置仓库密码#tagCSetWarehousePsw
|
| | | def SetWarehousePsw(curPlayer, tick):
|
| | | #玩家当前状态不是修改密码状态
|
| | | if curPlayer.GetWarehouseState() != IPY_GameWorld.wsWarehouse:
|
| | | return
|
| | |
|
| | | # 仓库有锁,先解锁
|
| | | if curPlayer.GetWarehouseLocked():
|
| | | return
|
| | | |
| | | sendPack = IPY_GameWorld.IPY_CSetWarehousePsw()
|
| | | #当前仓库密码
|
| | | currentPsw = curPlayer.GetWarehousePsw()
|
| | | #新密码
|
| | | newPsw = sendPack.GetPsw() |
| | | #这里是调用c++的过滤空格,可以过滤全角空格, python不能
|
| | | newPsw = GameWorld.GetGameWorld().GetCharTrim(newPsw)
|
| | | if newPsw == "":
|
| | | return
|
| | | |
| | | curPlayer.SetWarehousePsw(newPsw)
|
| | | DataRecordPack.DR_SetWarehousePsw(curPlayer, currentPsw, newPsw)
|
| | | |
| | | #curPlayer.Frm_WarehouseMsg(IPY_GameWorld.whmSetPswOK) |
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_pan_106532")
|
| | | |
| | | #有设置仓库密码,锁定
|
| | | curPlayer.SetHaveWarehousePsw(1)
|
| | | # 设置仓库锁定状态
|
| | | SetLockState(curPlayer, 1) |
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //0C 06 锁定仓库#tagCSetWarehouseLock
|
| | | # tagCSetWarehouseLock * GettagCSetWarehouseLock();
|
| | | # |
| | | # class IPY_CSetWarehouseLock
|
| | | # {
|
| | | # public:
|
| | | # //0: 解锁 1:锁定
|
| | | # int GetIsLock();
|
| | | # };
|
| | | #===============================================================================
|
| | | ##客户端封包响应 //0C 06 锁定仓库#tagCSetWarehouseLock
|
| | | # @param index 玩家索引
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | def SetWarehouseLock(curPlayer, tick):
|
| | | #玩家当前状态不是钱庄存取状态
|
| | | if curPlayer.GetWarehouseState() != IPY_GameWorld.wsWarehouse:
|
| | | return
|
| | | |
| | | #获得客户端锁定封包
|
| | | sendPack = IPY_GameWorld.IPY_CSetWarehouseLock()
|
| | | setLockState = sendPack.GetIsLock()
|
| | | |
| | | # 这里只用于解锁
|
| | | if setLockState != 0:
|
| | | return
|
| | | |
| | | if curPlayer.GetWarehouseLocked() == setLockState:
|
| | | return
|
| | | |
| | | # 设置仓库锁定状态
|
| | | SetLockState(curPlayer, setLockState)
|
| | | return
|
| | |
|
| | | ## 设置仓库锁定状态
|
| | | # @param curPlayer
|
| | | # @param setLockState
|
| | | # @return
|
| | | def SetLockState(curPlayer, setLockState):
|
| | | |
| | | curPlayer.SetWarehouseLocked(setLockState) |
| | | |
| | | packLockState = ChPyNetSendPack.tagMCWarehorseLock()
|
| | | packLockState.Clear()
|
| | | packLockState.LockState = setLockState
|
| | | NetPackCommon.SendFakePack(curPlayer, packLockState)
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //0C 07 客户端发送仓库密码#tagSendWarehousePsw
|
| | | # tagSendWarehousePsw * GettagSendWarehousePsw();
|
| | | # |
| | | # class IPY_SendWarehousePsw
|
| | | # {
|
| | | # public:
|
| | | # |
| | | # char * GetPsw();
|
| | | # };
|
| | | #===============================================================================
|
| | | ##客户端封包响应 //0C 07 客户端发送仓库密码#tagSendWarehousePsw
|
| | | # @param index 玩家索引
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 客户端封包响应 //0C 07 客户端发送仓库密码#tagSendWarehousePsw
|
| | | def SendWarehousePsw(curPlayer, tick):
|
| | | #===========================================================================
|
| | | # #玩家当前状态不是输入密码状态
|
| | | # if curPlayer.GetWarehouseState() != IPY_GameWorld.wsEnterPsw:
|
| | | # return
|
| | | # |
| | | # #获得客户端封包
|
| | | # sendPack = IPY_GameWorld.IPY_SendWarehousePsw()
|
| | | # curPsw = sendPack.GetPsw()
|
| | | # oldPsw = curPlayer.GetWarehousePsw()
|
| | | # |
| | | # #这里是调用c++的过滤空格,可以过滤全角空格, python不能
|
| | | # curPsw = GameWorld.GetGameWorld().GetCharTrim(curPsw)
|
| | | # |
| | | # #密码不正确
|
| | | # if curPsw != oldPsw:
|
| | | # curPlayer.Frm_WarehouseMsg(IPY_GameWorld.whmPswError)
|
| | | # EventShell.DoExitEvent(curPlayer)
|
| | | # |
| | | # PlayerControl.NotifyCode(curPlayer, "GeRen_pan_59781")
|
| | | # return
|
| | | # |
| | | # #密码正确
|
| | | # ShowWarehouse(curPlayer)
|
| | | #===========================================================================
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //0C 08 第一次打开仓库#tagCInitWarehousePsw
|
| | | # tagCInitWarehousePsw * GettagCInitWarehousePsw();
|
| | | # |
| | | # class IPY_CInitWarehousePsw
|
| | | # {
|
| | | # public:
|
| | | # //密码
|
| | | # char * GetPsw();
|
| | | # };
|
| | | #===============================================================================
|
| | | ##客户端封包响应 //0C 08 第一次打开仓库#tagCInitWarehousePsw
|
| | | # @param index 玩家索引
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 客户端封包响应 //0C 08 第一次打开仓库#tagCInitWarehousePsw
|
| | | def InitWarehousePsw(curPlayer, tick):
|
| | | # #玩家当前状态不是设置密码状态
|
| | | # if curPlayer.GetWarehouseState() != IPY_GameWorld.wsSetPsw:
|
| | | # return
|
| | | # |
| | | # sendPack = IPY_GameWorld.IPY_CInitWarehousePsw()
|
| | | # #密码
|
| | | # curPsw = sendPack.GetPsw()
|
| | | # #合理性检查, 如果密码为空, 则表示不需要输入密码(把 是否需要钱庄密码 字段设置为0)
|
| | | # curPlayer.Frm_WarehouseMsg(IPY_GameWorld.whmSetPswOK)
|
| | | # |
| | | # PlayerControl.NotifyCode(curPlayer, "GeRen_pan_106532")
|
| | | # |
| | | # #这里是调用c++的过滤空格,可以过滤全角空格, python不能
|
| | | # curPsw = GameWorld.GetGameWorld().GetCharTrim(curPsw)
|
| | | # |
| | | # if curPsw == "":
|
| | | # curPlayer.SetHaveWarehousePsw(0)
|
| | | # return
|
| | | # |
| | | # #设置仓库密码 |
| | | # curPlayer.SetWarehousePsw(curPsw)
|
| | | # DataRecordPack.DR_SetWarehousePsw(curPlayer, "", curPsw)
|
| | | # |
| | | # #把 是否需要钱庄密码 字段设置为1
|
| | | # curPlayer.SetHaveWarehousePsw(1)
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //0C 09 仓库拖动物品#tagMoveItemInWarehouse
|
| | | # tagMoveItemInWarehouse * GettagMoveItemInWarehouse();
|
| | | # |
| | | # class IPY_MoveItemInWarehouse
|
| | | # {
|
| | | # public:
|
| | | # //起始位置
|
| | | # int GetSrcIndex();
|
| | | # //目标位置
|
| | | # int GetDestIndex();
|
| | | # |
| | | # int GetCount();
|
| | | # };
|
| | | #===============================================================================
|
| | | ##客户端封包响应 //0C 09 仓库拖动物品#tagMoveItemInWarehouse
|
| | | # @param index 玩家索引
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 客户端封包响应 //0C 09 仓库拖动物品#tagMoveItemInWarehouse
|
| | | def MoveItemInWarehouse(curPlayer, tick):
|
| | | #玩家当前状态不是钱庄存取状态
|
| | | if curPlayer.GetWarehouseState() != IPY_GameWorld.wsWarehouse:
|
| | | return
|
| | | |
| | | #获得封包
|
| | | sendPack = IPY_GameWorld.IPY_MoveItemInWarehouse()
|
| | | #物品数量
|
| | | putCount = sendPack.GetCount()
|
| | | #仓库物品放入背包 |
| | | ItemControler.DragItem(curPlayer, IPY_GameWorld.rptWarehouse, sendPack.GetSrcIndex(), IPY_GameWorld.rptWarehouse, sendPack.GetDestIndex(), putCount)
|
| | | return
|
| | |
|
| | | #===============================================================================
|
| | | # 此接口废弃, 背包整理封包修改
|
| | | # #---------------------------------------------------------------------
|
| | | # ##重整仓库
|
| | | # # @param index 玩家索引
|
| | | # # @param tick 时间戳
|
| | | # # @return 返回值无意义
|
| | | # # @remarks 任务调用, 重整仓库 fc_ResetWarehouseItem
|
| | | # def ResetWarehouseItem(curPlayer, tick):
|
| | | # #玩家当前状态不是钱庄存取状态
|
| | | # if curPlayer.GetWarehouseState() != IPY_GameWorld.wsWarehouse:
|
| | | # return
|
| | | # |
| | | # ItemControler.ResetItem(curPlayer, IPY_GameWorld.rptWarehouse, tick)
|
| | | # return
|
| | | #===============================================================================
|
| | | #---------------------------------------------------------------------
|
| | | ##需要更改仓库密码
|
| | | # @param index 玩家索引
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 任务调用, 需要更改仓库密码, fc_WarehousePsw
|
| | | def WarehousePsw(curPlayer, tick):
|
| | |
|
| | | # #是否已经设置密码
|
| | | # haveWarehousePsw = curPlayer.GetHaveWarehousePsw()
|
| | | # |
| | | # #原先已经设置仓库密码的情况
|
| | | # if haveWarehousePsw:
|
| | | # #跳出更改密码窗口
|
| | | # curPlayer.Frm_ChangeWarehousePsw()
|
| | | # #设置玩家当前状态为修改密码状态
|
| | | # curPlayer.SetWarehouseState(IPY_GameWorld.wsChangePsw)
|
| | | # #原先没有设置仓库密码的情况 |
| | | # else:
|
| | | # #跳出设置密码窗口
|
| | | # curPlayer.Frm_SetWarehousePsw()
|
| | | # #设置玩家当前状态为设置密码状态
|
| | | # curPlayer.SetWarehouseState(IPY_GameWorld.wsSetPsw)
|
| | | # |
| | | # return
|
| | | |
| | | return
|
| | |
|
| | | |
| | | |
| | | |
| | |
|