本文整理汇总了Python中hall.entity.todotask.TodoTaskHelper.sendTodoTask方法的典型用法代码示例。如果您正苦于以下问题:Python TodoTaskHelper.sendTodoTask方法的具体用法?Python TodoTaskHelper.sendTodoTask怎么用?Python TodoTaskHelper.sendTodoTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hall.entity.todotask.TodoTaskHelper
的用法示例。
在下文中一共展示了TodoTaskHelper.sendTodoTask方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doGetTaskReward
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def doGetTaskReward(self, gameId, userId, taskId):
'''
获取活动奖励
'''
try:
timestamp = pktimestamp.getCurrentTimestamp()
taskModel = neituiguangtask.newUserTaskSystem.loadTaskModel(userId, timestamp)
task = taskModel.userTaskUnit.findTask(taskId)
if not task:
raise TYBizException(-1, '未知的任务:%s' % (taskId))
expiresTime = self.calcTaskExpires(userId)
if timestamp >= expiresTime:
raise TYBizException(-1, '任务已经过期')
if not userdata.getAttr(userId, 'bindMobile'):
conf = neituiguang.getConf()
TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskBindPhone(conf.pleaseBindPhone, ''))
return
assetList = neituiguangtask.newUserTaskSystem.getTaskReward(task, timestamp, 'PROMOTE_TASK', taskId)
router.sendToUser(self.buildTaskInfoResponse(userId), userId)
rewardStr = TYAssetUtils.buildContentsString(assetList)
mo = MsgPack()
mo.setCmd('promote_info')
mo.setResult('action', 'get_task_reward')
mo.setResult('code', 0)
mo.setResult('info', '恭喜您获得了%s' % rewardStr)
router.sendToUser(mo, userId)
except TYBizException, e:
router.sendToUser(self.makeErrorResponse('get_task_reward', e.errorCode, e.message), userId)
示例2: enterFriendTable
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def enterFriendTable(userId, gameId, clientId, ftId):
"""进入自建桌"""
if ftlog.is_debug():
ftlog.debug('hall_friend_table.enterFriendTable userId:', userId, ' pluginId:', gameId, ' clientId:', clientId,
' ftId:', ftId)
pluginId = queryFriendTable(ftId)
if not pluginId:
TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip('该房间不存在'))
return
if TYPlayer.isRobot(userId):
isValidPluginId = True
else:
isValidPluginId = False
from hall.entity import hallgamelist2
template = hallgamelist2.getUITemplate(gameId, userId, clientId)
for version in template.versionList:
if pluginId == version.game.gameId:
isValidPluginId = True
break
if not isValidPluginId:
TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip('该安装包不支持此房间号所对应的玩法'))
return
ftlog.info('hall_friend_table.enterFriendTable userId:', userId, ' lead to pluginId:', pluginId)
pluginId = int(pluginId)
TYGame(pluginId).enterFriendTable(userId, gameId, clientId, ftId)
示例3: _doChangeNameTry
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def _doChangeNameTry(self, userId, clientId, newName):
# renameConf = hallconf.getClientRenameConf(clientId)
# if (renameConf
# and not renameConf.get('containsSensitive', 1)
# and keywords.isContains(newName)):
# info = TodoTaskShowInfo(hallrename.stringRenameContainsSensitive)
# return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, info)
code, info = hallrename.tryRename(HALL_GAMEID, userId, newName)
if ftlog.is_debug():
ftlog.debug('hallrename._doChangeNameTry->', code, info)
if code == -3:
# name not changed !!
pass
elif code == -2:
# 没有改名卡
info = TodoTaskShowInfo(hallrename.stringRenameCardRequired, True)
if hallrename.payOrder:
product, _ = hallstore.findProductByPayOrder(HALL_GAMEID, userId, clientId, hallrename.payOrder)
if product:
info.setSubCmd(TodoTaskPayOrder(product))
return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, info)
elif code == 0:
# 改名成功
return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip(hallrename.stringRenameSuccessed))
else:
# SDK改名失败
return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip(info))
示例4: processInvitees
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def processInvitees(self, enterParam, note, invitees, userId, gameId):
'''
邀请好友牌桌游戏
invitees - 被邀请者
'''
if not invitees:
return
uds = userdata.getAttrs(userId, ['name'])
# 检查是否在线
for invitee in invitees:
# invitee - 被邀请者
state = onlinedata.getOnlineState(invitee)
if state:
# 在线,则进行下一步操作
ids = userdata.getAttrs(invitee, ['name'])
_, clientVer, _, _ = sessiondata.getClientIdInfo(invitee)
if clientVer < 3.77:
# 版本号小于3.77,则提示升级
TodoTaskHelper.sendTodoTask(gameId, invitee,
TodoTaskPopTip(note + ' 请升级至新版本与好友 ' + uds[0] + ' 一起玩耍!'))
TodoTaskHelper.sendTodoTask(gameId, userId,
TodoTaskPopTip('您的好友 ' + ids[0] + ' 版本较低,提醒他升级到最新版本一起玩耍吧!'))
else:
# 判断是否在同一牌桌上
if self.isInSameTable(userId, invitee):
TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskPopTip('您的好友 ' + ids[0] + ' 正在跟您一起游戏呢'))
else:
# 版本号大于3.77,则发送邀请
TodoTaskHelper.sendTodoTask(gameId, invitee, TodoTaskInviteToGame(userId, note, enterParam))
else:
TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskPopTip('您的好友当前不在线'))
ftlog.debug('您的好友当前不在线')
示例5: sendBenefits
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def sendBenefits(self, gameId, userId, timestamp=None):
'''
发放救济金
@return: isSend(True/False), TYUserBenefits
'''
if timestamp is None:
timestamp = pktimestamp.getCurrentTimestamp()
chip = pkuserchip.getUserChipAll(userId)
if chip < self._minChip:
# 用户金币低于指定数目时,发放救济金
userBenefits = self.loadUserBenefits(gameId, userId, timestamp)
if not userBenefits.hasLeftTimes(): # 没有剩余次数,弹分享引导
oldtime = gamedata.getGameAttr(userId, HALL_GAMEID, 'relief_share_date')
if not oldtime or datetime.fromtimestamp(oldtime).date() < datetime.fromtimestamp(timestamp).date():
# 每天最多弹一次
gamedata.setGameAttr(userId, HALL_GAMEID, 'relief_share_date', timestamp)
shareId = hallshare.getShareId('Relieffund', userId, gameId)
share = hallshare.findShare(shareId)
if share:
task = share.buildTodotask(gameId, userId, 'Relieffund')
TodoTaskHelper.sendTodoTask(gameId, userId, task)
return False, userBenefits
# 发放救济金
userBenefits.times += 1
self._benefitsDao.saveUserBenefitsData(userId, TYUserBenefitsData(userBenefits.times, timestamp))
self._sendBenefits(gameId, userBenefits)
# 通知用户金币刷新
datachangenotify.sendDataChangeNotify(gameId, userId, ['udata'])
return True, userBenefits
return False, self.loadUserBenefits(gameId, userId, timestamp)
示例6: on_praise_friend
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def on_praise_friend(cls, gameId, uid, clientId, mo):
code = mo.getResult('code', 0)
# vip = mo.getResult('vip')
if code == 0:
friend_uid = int(mo.getResult('friend_uid'))
nick_name = mo.getResult('nick_name')
friend_nick_name = mo.getResult('friend_nick_name')
my_add_charm = mo.getResult('my_add_charm')
friend_add_charm = mo.getResult('friend_add_charm')
my_charm = mo.getResult('my_charm')
friend_charm = mo.getResult('friend_charm')
msg1 = '给"' + friend_nick_name + '"点赞获得' + str(my_add_charm) + '个魅力值'
msg2 = '"' + nick_name + '"给您点赞获得' + str(friend_add_charm) + '个魅力值'
from poker.entity.biz.message import message
message.send(gameId, message.MESSAGE_TYPE_SYSTEM, int(uid), msg1)
message.send(gameId, message.MESSAGE_TYPE_SYSTEM, int(friend_uid), msg2)
ftlog.debug('on praise friend.... ' + msg1)
ftlog.debug('on praise friend.... ' + msg2)
datachangenotify.sendDataChangeNotify(gameId, uid, 'charm')
from hall.entity.hallranking import rankingSystem, TYRankingInputTypes
timestamp = pktimestamp.getCurrentTimestamp()
rankingSystem.setUserByInputType(gameId, TYRankingInputTypes.CHARM,
uid, my_charm, timestamp)
rankingSystem.setUserByInputType(gameId, TYRankingInputTypes.CHARM,
friend_uid, friend_charm, timestamp)
# 历史获赞次数
history_praised_num = gamedata.incrGameAttr(friend_uid, gameId, 'history_praised_num', 1)
mo.setResult('friend_history_praised_num', history_praised_num)
if code != 2:
return
from hall.entity.todotask import TodoTaskPayOrder, TodoTaskShowInfo
from hall.entity.todotask import TodoTaskHelper
from hall.entity import hallvip, hallitem
user_vip = hallvip.userVipSystem.getUserVip(uid)
delta_exp = user_vip.deltaExpToNextLevel()
product, _ = hallstore.findProductByContains(gameId, uid, clientId,
['coin'], None,
hallitem.ASSET_CHIP_KIND_ID,
delta_exp * 1000)
pay_order = TodoTaskPayOrder(product)
if user_vip == 0:
msg = '点赞次数已达今日上限,开通VIP可提高点赞次数上限获得更多福利哦~'
btnTxt = '开通VIP'
else:
msg = '点赞次数已达今日上限,升级VIP等级可提高点赞次数上限获得更多福利哦~'
btnTxt = '升级VIP'
dialog_task = TodoTaskShowInfo(msg, True)
dialog_task.setSubCmd(pay_order)
dialog_task.setSubText(btnTxt)
TodoTaskHelper.sendTodoTask(gameId, uid, [dialog_task])
示例7: doAssistanceGet
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def doAssistanceGet(self, gameId, userId):
try:
_consumeCount, finalCount, sendChip = hallvip.userVipSystem.gainAssistance(gameId, userId)
if sendChip > 0:
datachangenotify.sendDataChangeNotify(gameId, userId, 'udata')
todotask = TodoTaskGoldRain(VipHelper.buildGotAssistanceDesc(finalCount, sendChip))
TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
except TYAssistanceChipTooMuchException, e:
ftlog.warn('ERROR, doAssistanceGet', gameId, userId, e.chip, e.upperChipLimit, e.errorCode, e.message)
示例8: onUserVipLevelUp
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def onUserVipLevelUp(self, event):
if ftlog.is_debug():
ftlog.debug('VipHandlerImpl.onUserVipLevelUp userId=', event.userId,
'gameId=', event.gameId,
'oldLevel=', event.oldVipLevel.level,
'newLevel=', event.userVip.vipLevel.level)
todotask = TodoTaskVipLevelUp(VipHelper.buildVipInfo(event.userVip),
self.buildVipLevelUpDesc(event.userId, event.oldVipLevel, event.userVip))
TodoTaskHelper.sendTodoTask(event.gameId, event.userId, todotask)
示例9: doBuyProduct
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def doBuyProduct(self, gameId, userId, prodId):
try:
clientId = sessiondata.getClientId(userId)
orderId = self._makeOrderId(gameId, userId, prodId)
orderDeliveryResult = hallstore.exchangeProduct(gameId, userId, clientId, orderId, prodId, 1)
mo = StoreHelper.makeProductDeliveryResponse(userId, orderDeliveryResult)
router.sendToUser(mo, userId)
except TYBizException, e:
TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(e.message))
示例10: onRoomCreateCustomTable
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def onRoomCreateCustomTable(self, gameId, msg):
'''在GR处理自建桌逻辑
'''
if ftlog.is_debug():
ftlog.debug("<< |msg", msg, caller=self)
userId = msg.getParam("userId")
selectedRoomOptions = msg.getParam("selectedRoomOptions")
if not selectedRoomOptions:
return
customConfVer = msg.getParam("customConfVer")
if customConfVer != difangConf.getCustomRoomConf(gameId, 'ver'):
ftlog.warn("onRoomCreateCustomTable confVer error! |msg:", msg, caller=self)
return
gameRoundN = selectedRoomOptions.get("gameRoundN")
if not gameRoundN:
return
roomId = msg.getParam("roomId")
room = gdata.rooms()[roomId]
clientId = msg.getParam("clientId")
needRoomCardN = difangConf.getCustomRoomConf(gameId, 'roomCardNCost').get(str(gameRoundN), -1)
if needRoomCardN == -1:
tips = difangConf.getCustomRoomConf(difangConf.GAME_ID, 'err_tips')
tip = tips[self.CREATE_CUSTOM_TABLE_ERR_NO_NOT_ALLOW]
TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(tip, True))
ftlog.warn("onRoomCreateCustomTable get needRoomCardN error! |msg:", msg, caller=self)
self.sendGameCreateCustomTableRes(0, userId)
return
if ftlog.is_debug():
ftlog.debug("|userId, gameId, customConfVer, gameRoundN, needRoomCardN:",
userId, gameId, customConfVer, gameRoundN, needRoomCardN, caller=self)
if needRoomCardN > 0 and not self.isCardEnough(gameId, userId, needRoomCardN, clientId):
tips = difangConf.getCustomRoomConf(difangConf.GAME_ID, 'err_tips')
tip = tips[self.CREATE_CUSTOM_TABLE_ERR_NO_NOT_ENOUGH]
TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(tip, True))
self.sendGameCreateCustomTableRes(0, userId)
return
tableId = room.getIdleTableId()
if not tableId:
ftlog.error("there are no idle tables!", "|userId, roomId:", userId, room.roomId)
return
ftId = self.assignFriendTableId(gameId, tableId)
ftlog.info("onRoomCreateCustomTable |userId, tableId, ftId:", userId, tableId, ftId, caller=self)
self.sendGameCreateCustomTableRes(ftId, userId)
gamedata.setGameAttr(userId, gameId, "selectedRoomOptions", json.dumps(selectedRoomOptions))
gamedata.setGameAttr(userId, gameId, "customConfVer", customConfVer)
shadowRoomId = tableId / 10000
room.querySitReq(userId, shadowRoomId, tableId, clientId,
extParams={"selectedRoomOptions": selectedRoomOptions, "ftId": ftId})
示例11: on_ready_invite_friend
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def on_ready_invite_friend(cls, gameId, uid, clientId, mo):
from hall.entity.todotask import TodoTaskHelper
code = mo.getResult('code', 0)
if code != 1:
return
from hall.entity.todotask import TodoTaskBindPhoneFriend
info_ = '请绑定手机,成为正式账号即可与朋友一起玩!'
task = TodoTaskBindPhoneFriend(info_, 0)
task.setSubText('绑定手机')
TodoTaskHelper.sendTodoTask(gameId, uid, [task])
示例12: doGameGetMemberReward
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def doGameGetMemberReward(self, userId, gameId, clientId):
userAssets = hallitem.itemSystem.loadUserAssets(userId)
userBag = userAssets.getUserBag()
memberCardItem = userBag.getItemByKindId(hallitem.ITEM_MEMBER_NEW_KIND_ID)
timestamp = pktimestamp.getCurrentTimestamp()
if memberCardItem and memberCardItem.canCheckin(timestamp):
checkinAction = memberCardItem.itemKind.findActionByName('checkin')
checkinAction.doAction(gameId, userAssets, memberCardItem, timestamp, {})
datachangenotify.sendDataChangeNotify(gameId, userId, 'free')
TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskGoldRain('恭喜您领取了今天的会员福利'))
示例13: sendTodoTaskResponse
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def sendTodoTaskResponse(self, userId, gameId, clientId, isdayfirst):
'''
发送当前用户的TODOtask列表消息
'''
ftlog.debug('UtilHelper.sendTodoTaskResponse userId=', userId,
'gameId=', gameId,
'clientId=', clientId,
'isdayfirst=', isdayfirst)
todotasks = TYGame(gameId).getTodoTasksAfterLogin(userId, gameId, clientId, isdayfirst)
if todotasks:
TodoTaskHelper.sendTodoTask(gameId, userId, todotasks)
示例14: _doChangeNameCheck
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def _doChangeNameCheck(self, userId, clientId):
canRename, desc = hallrename.checkRename(HALL_GAMEID, userId)
if canRename:
return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskRename(desc))
else:
info = TodoTaskShowInfo(desc, True)
if hallrename.payOrder:
product, _ = hallstore.findProductByPayOrder(HALL_GAMEID, userId, clientId, hallrename.payOrder)
if product:
info.setSubCmd(TodoTaskPayOrder(product))
return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, info)
示例15: handleException
# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import sendTodoTask [as 别名]
def handleException(self, itemId, gameId, userId, clientId, e):
if ftlog.is_debug():
ftlog.debug('ItemTcpHandler.handleException itemId=', itemId,
'gameId=', gameId,
'userId=', userId,
'clientId=', clientId,
'e=', e)
if isinstance(e, TYItemActionConditionNotEnoughException):
self.handleItemActionConditionException(itemId, gameId, userId, clientId, e)
elif isinstance(e, TYItemBindingsException):
self.handleItemBindingsException(itemId, gameId, userId, clientId, e)
else:
TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(e.message))