zoukankan      html  css  js  c++  java
  • Firefly《暗黑世界》碎片合成部分代码

    这里讲的是Firefly《暗黑世界》碎片合成的流程部分的代码,这个主要是消息解析的部分,好吧上代码,代码路径app/game/gatenodeapp/compound.py。

    1. #coding:utf8

    2. '''

    3. Created on 2013-3-21

    4. 物品合成

    5. @author: lan (www.9miao.com)

    6. '''

    7. from app.game.gatenodeservice import remoteserviceHandle

    8. import json

    9. #导入功能逻辑处理模块

    10. from app.game.appinterface import compound

    11. @remoteserviceHandle#将处理方法,添加到service中,供gateserver进程调用。

    12. def GetCompoundPackage_2109(dynamicId,request_proto):

    13.     '''获取合成包裹的信息

    14.     '''

    15.         #解析json字符串

    16.     argument = json.loads(request_proto)

    17.         #获取角色的ID

    18.     characterId = argument.get('characterId')

    19.         #获取合成包裹的信息

    20.     response = compound.GetCompoundPackage_2109(dynamicId, characterId)

    21.         #将信息序列化,生成json字符串,返回给客户端

    22.     return json.dumps(response)

    23. @remoteserviceHandle#将处理方法,添加到service中,供gateserver进程调用。

    24. def GetOneItemInfo_211(dynamicId,request_proto):

    25.     '''获取单个物品的信息

    26.     '''

    27.         #解析json字符串

    28.     argument = json.loads(request_proto)

    29.         #获取角色的ID

    30.     characterId = argument.get('characterId')
    31.         #获取物品的实例id
    32.     itemid = argument.get('itemid')
    33.         #获取物品的信息
    34.     response = compound.GetOneItemInfo(dynamicId, characterId,itemid)
    35.         #将信息序列化,生成json字符串,返回给客户端
    36.     return json.dumps(response)
    37.     
    38. @remoteserviceHandle#将处理方法,添加到service中,供gateserver进程调用。
    39. def GetCompoundItem_205(dynamicId,request_proto):
    40.     """获取当前碎片能合成的物品的信息
    41.     """
    42.         #解析json字符串
    43.     argument = json.loads(request_proto)
    44.         #获取角色的ID
    45.     characterId = argument.get('characterId')
    46.         #获取将要合成的物品的模型id
    47.     tempid = argument.get('tempid')
    48.         #获取当前碎片能合成的物品的信息
    49.     response = compound.GetCompoundItem(dynamicId, characterId, tempid)
    50.         #将信息序列化,生成json字符串,返回给客户端
    51.     return json.dumps(response)
    52.  
    53. @remoteserviceHandle#将处理方法,添加到service中,供gateserver进程调用。
    54. def CompoundItem_2116(dynamicId,request_proto):
    55.     '''合成物品
    56.     '''
    57.         #解析json字符串
    58.     argument = json.loads(request_proto)
    59.         #获取角色的ID
    60.     characterId = argument.get('characterId')
    61.         #获取将要合成的物品的模型id
    62.     tempid = argument.get('tempid')
    63.         #进行物品合成并返回合成后的结果
    64.     response = compound.CompoundItem(dynamicId, charac这terId, tempid)
    65.         #将信息序列化,生成json字符串,返回给客户端
    66.     return json.dumps(response)
    67.     
    68.  
    复制代码
    里并没有做实际的逻辑处理,只是做了解析客户端发过来的参数,当要替换通信消息格式时,不会影响逻辑处理部分的代码。消息会通过netserver传递到gateserver,由gateserver分发给指定的gameserver,gameserver通过对于的指令号进入到对应的处理方法中处理。
  • 相关阅读:
    Mysql5.7中子查询时order by与group by合用无效的解决办法
    vue $ref的基本用法
    vue渲染列表时报错Avoid using nonprimitive value as key, use string/number value instead.
    uniapp的微信小程序错误警告(uview项目)Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors。
    如何在 Linux 中找出最近或今天被修改的文件
    微信小程序uniapp编译后vendor.js文件过大
    随笔目录
    cesium加载百度地图_四大Webgis地图框架的对比选择[转]
    Python import Statement
    WordPress中安装插件需要ftp怎么办?
  • 原文地址:https://www.cnblogs.com/9miaoshetuan/p/3851270.html
Copyright © 2011-2022 走看看