Part of the code of Firefly's dark world fragment Merging

Source: Internet
Author: User

Here we will talk about the code of the Process part of Firefly's "Dark World" fragment merging. This is mainly the part of message parsing. Let's get the code and the code path is APP/GAME/gatenodeapp/compound. py.

  1. # Coding: utf8
  2. '''
  3. Created on 2013-3-21
  4. Product Merging
  5. @ Author: Lan (www.9miao.com)
  6. '''
  7. From app. Game. gatenodeservice import remoteservicehandle
  8. Import JSON
  9. # Import function logic processing module
  10. From app. Game. appinterface import Compound
  11.  
  12. @ Remoteservicehandle # Add the processing method to the service for the gateserver process to call.
  13. Def getcompoundpackage_2109 (dynamicid, request_proto ):
  14. ''' Get the merged package information
  15. '''
  16. # Parsing JSON strings
  17. Argument = JSON. Loads (request_proto)
  18. # Obtain the role ID
  19. Characterid = argument. Get ('characterid ')
  20. # Obtain the merged package information
  21. Response = compound. getcompoundpackage_2109 (dynamicid, characterid)
  22. # Serialize information, generate a JSON string, and return it to the client
  23. Return JSON. dumps (response)
  24.  
  25. @ Remoteservicehandle # Add the processing method to the service for the gateserver process to call.
  26. Def getoneiteminfo_211 (dynamicid, request_proto ):
  27. '''Get the information of a single item
  28. '''
  29. # Parsing JSON strings
  30. Argument = JSON. Loads (request_proto)
  31. # Obtain the role ID
  32. Characterid = argument. Get ('characterid ')
  33. # Obtain the instance id of an item
  34. Itemid = argument. Get ('itemid ')
  35. # Retrieving item information
  36. Response = compound. getoneiteminfo (dynamicid, characterid, Itemid)
  37. # Serialize information, generate a JSON string, and return it to the client
  38. Return JSON. dumps (response)
  39. @ Remoteservicehandle # Add the processing method to the service for the gateserver process to call.
  40. Def getcompounditem_205 (dynamicid, request_proto ):
  41. "Gets information about the items that can be merged by the current Fragment
  42. """
  43. # Parsing JSON strings
  44. Argument = JSON. Loads (request_proto)
  45. # Obtain the role ID
  46. Characterid = argument. Get ('characterid ')
  47. # Obtain the model ID of the item to be merged
  48. Tempid = argument. Get ('tempid ')
  49. # Obtain information about the items that can be merged by the current Fragment
  50. Response = compound. getcompounditem (dynamicid, characterid, tempid)
  51. # Serialize information, generate a JSON string, and return it to the client
  52. Return JSON. dumps (response)
  53.  
  54. @ Remoteservicehandle # Add the processing method to the service for the gateserver process to call.
  55. Def compounditem_2116 (dynamicid, request_proto ):
  56. ''' Composite item
  57. '''
  58. # Parsing JSON strings
  59. Argument = JSON. Loads (request_proto)
  60. # Obtain the role ID
  61. Characterid = argument. Get ('characterid ')
  62. # Obtain the model ID of the item to be merged
  63. Tempid = argument. Get ('tempid ')
  64. # Merging an item and returning the merged result
  65. Response = compound. compounditem (dynamicid, charac terid, tempid)
  66. # Serialize information, generate a JSON string, and return it to the client
  67. Return JSON. dumps (response)
  68.  
Copy code

Does not perform actual logic processing, but does parse the parameters sent from the client. To replace the communication message format, the logic processing part of the code is not affected. Messages are transmitted to the gateserver through NETServer, which is distributed to the specified gameserver. The gameserver enters the corresponding processing method through the command number.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.