| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| # @copyright: Copyright (c) 2004, 2010 Xiamen Wangyou Network Technology Co.,Ltd., All rights reserved.  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
|   | 
| ERROR_NO_1 = 1  | 
| ERROR_NO_2 = 2  | 
| ERROR_NO_3 = 3  | 
| ERROR_NO_4 = 4  | 
| ERROR_NO_5 = 5  | 
| ERROR_NO_6 = 6  | 
| ERROR_NO_7 = 7  | 
| ERROR_NO_8 = 8  | 
| ERROR_NO_9 = 9  | 
| ERROR_NO_10 = 10  | 
| ERROR_NO_11 = 11  | 
| ERROR_NO_12 = 12  | 
| ERROR_NO_13 = 13  | 
| ERROR_NO_14 = 14  | 
| ERROR_NO_15 = 15  | 
| ERROR_NO_16 = 16  | 
| ERROR_NO_17 = 17  | 
| ERROR_NO_18 = 18  | 
| ERROR_NO_19 = 19  | 
| ERROR_NO_20 = 20  | 
| ERROR_NO_21 = 21  | 
| ERROR_NO_22 = 22  | 
| ERROR_NO_23 = 23  | 
| ERROR_NO_24 = 24  | 
| ERROR_NO_25 = 25  | 
| ERROR_NO_26 = 26  | 
| ERROR_NO_27 = 27  | 
| ERROR_NO_28 = 28  | 
| ERROR_NO_29 = 29  | 
| ERROR_NO_30 = 30  | 
| ERROR_NO_31 = 31  | 
| ERROR_NO_32 = 32  | 
| ERROR_NO_33 = 33  | 
| ERROR_NO_34 = 34  | 
| ERROR_NO_35 = 35  | 
| ERROR_NO_36 = 36  | 
| ERROR_NO_37 = 37  | 
| ERROR_NO_38 = 38  | 
| ERROR_NO_39 = 39  | 
| ERROR_NO_40 = 40  | 
| ERROR_NO_41 = 41  | 
| ERROR_NO_42 = 42  | 
| ERROR_NO_43 = 43  | 
| ERROR_NO_44 = 44  | 
| ERROR_NO_45 = 45  | 
| ERROR_NO_46 = 46  | 
| ERROR_NO_47 = 47  | 
| ERROR_NO_48 = 48  | 
| ERROR_NO_49 = 49  | 
| ERROR_NO_50 = 50  | 
| ERROR_NO_51 = 51  | 
| ERROR_NO_52 = 52  | 
| ERROR_NO_53 = 53  | 
| ERROR_NO_54 = 54  | 
| ERROR_NO_55 = 55  | 
| ERROR_NO_56 = 56  | 
| ERROR_NO_57 = 57  | 
| ERROR_NO_58 = 58  | 
| ERROR_NO_59 = 59  | 
| ERROR_NO_60 = 60  | 
| ERROR_NO_61 = 61  | 
| ERROR_NO_62 = 62  | 
| ERROR_NO_63 = 63  | 
| ERROR_NO_64 = 64  | 
| ERROR_NO_65 = 65  | 
| ERROR_NO_66 = 66  | 
| ERROR_NO_67 = 67  | 
| ERROR_NO_68 = 68  | 
| ERROR_NO_69 = 69  | 
| ERROR_NO_70 = 70  | 
| ERROR_NO_71 = 71  | 
| ERROR_NO_72 = 72  | 
| ERROR_NO_73 = 73  | 
| ERROR_NO_74 = 74  | 
| ERROR_NO_75 = 75  | 
| ERROR_NO_76 = 76  | 
| ERROR_NO_77 = 77  | 
| ERROR_NO_78 = 78  | 
| ERROR_NO_79 = 79  | 
| ERROR_NO_80 = 80  | 
| ERROR_NO_81 = 81  | 
| ERROR_NO_82 = 82  | 
| ERROR_NO_83 = 83  | 
| ERROR_NO_84 = 84  | 
| ERROR_NO_85 = 85  | 
| ERROR_NO_86 = 86  | 
| ERROR_NO_87 = 87  | 
| ERROR_NO_88 = 88  | 
| ERROR_NO_89 = 89  | 
| ERROR_NO_90 = 90  | 
| ERROR_NO_91 = 91  | 
| ERROR_NO_92 = 92  | 
| ERROR_NO_93 = 93  | 
| ERROR_NO_94 = 94  | 
| ERROR_NO_95 = 95  | 
| ERROR_NO_96 = 96  | 
| ERROR_NO_97 = 97  | 
| ERROR_NO_98 = 98  | 
| ERROR_NO_99 = 99  | 
| ERROR_NO_100 = 100  | 
| ERROR_NO_101 = 101  | 
| ERROR_NO_102 = 102  | 
| ERROR_NO_103 = 103  | 
| ERROR_NO_104 = 104  | 
| ERROR_NO_105 = 105  | 
| ERROR_NO_106 = 106  | 
| ERROR_NO_107 = 107  | 
| ERROR_NO_108 = 108  | 
| ERROR_NO_109 = 109  | 
| ERROR_NO_110 = 110  | 
| ERROR_NO_111 = 111  | 
| ERROR_NO_112 = 112  | 
| ERROR_NO_113 = 113  | 
| ERROR_NO_114 = 114  | 
| ERROR_NO_115 = 115  | 
| ERROR_NO_116 = 116  | 
| ERROR_NO_117 = 117  | 
| ERROR_NO_118 = 118  | 
| ERROR_NO_119 = 119  | 
| ERROR_NO_120 = 120  | 
| ERROR_NO_121 = 121  | 
| ERROR_NO_122 = 122  | 
| ERROR_NO_123 = 123  | 
| ERROR_NO_124 = 124  | 
| ERROR_NO_125 = 125  | 
| ERROR_NO_126 = 126  | 
| ERROR_NO_127 = 127  | 
| ERROR_NO_128 = 128  | 
| ERROR_NO_129 = 129  | 
| ERROR_NO_130 = 130  | 
| ERROR_NO_131 = 131  | 
| ERROR_NO_132 = 132  | 
| ERROR_NO_133 = 133  | 
| ERROR_NO_134 = 134  | 
| ERROR_NO_135 = 135  | 
| ERROR_NO_136 = 136  | 
| ERROR_NO_137 = 137  | 
| ERROR_NO_138 = 138  | 
| ERROR_NO_139 = 139  | 
| ERROR_NO_140 = 140  | 
| ERROR_NO_141 = 141  | 
| ERROR_NO_142 = 142  | 
| ERROR_NO_143 = 143  | 
| ERROR_NO_144 = 144  | 
| ERROR_NO_145 = 145  | 
| ERROR_NO_146 = 146  | 
| ERROR_NO_147 = 147  | 
| ERROR_NO_148 = 148  | 
| ERROR_NO_149 = 149  | 
| ERROR_NO_150 = 150  | 
| ERROR_NO_151 = 151  | 
| ERROR_NO_152 = 152  | 
| ERROR_NO_153 = 153  | 
| ERROR_NO_154 = 154  | 
| ERROR_NO_155 = 155  | 
| ERROR_NO_156 = 156  | 
| ERROR_NO_157 = 157  | 
| ERROR_NO_158 = 158  | 
| ERROR_NO_159 = 159  | 
| ERROR_NO_160 = 160  | 
| ERROR_NO_161 = 161  | 
| ERROR_NO_162 = 162  | 
| ERROR_NO_163 = 163  | 
| ERROR_NO_164 = 164  | 
| ERROR_NO_165 = 165  | 
|   | 
| __errorDict =    \  | 
| {  | 
|     "fatal_1":(ERROR_NO_1, 'python version error!'),  | 
|     "fatal_2":(ERROR_NO_2, 'pymongo version error!'),  | 
|     "fatal_3":(ERROR_NO_3, 'mongodb version error!'),  | 
|     "fatal_4":(ERROR_NO_4, 'mongodb version error!'),    | 
|     "error_5":(ERROR_NO_5, 'encode error'),  | 
|     "error_6":(ERROR_NO_6, 'encode error'),      | 
|     "error_7":(ERROR_NO_7, 'python coding error'),  | 
|     "error_8":(ERROR_NO_8, 'python coding error'),  | 
|     "error_9":(ERROR_NO_9, 'python coding error'),  | 
|     "error_10":(ERROR_NO_10, 'invalid pos'),        | 
|     "error_11":(ERROR_NO_11, 'lack of data'),    | 
|     "fatal_12":(ERROR_NO_12, 'invalid resource version no'),       | 
|     "DeployError_13":(ERROR_NO_13, 'user db password is not correct!'),    | 
|     "DeployError_14":(ERROR_NO_14, 'sys db password is not correct!'),    | 
|     "DeployError_15":(ERROR_NO_15, 'log db password is not correct!'),    | 
|     "fatal_16":(ERROR_NO_16, 'socket error'),   | 
|     "fatal_17":(ERROR_NO_17, 'unknown error'),     | 
|     "error_18":(ERROR_NO_18, 'read config error'),   | 
|     "DeployError_19":(ERROR_NO_19, 'user db mongodb longin user name is empty'),   | 
|     "DeployError_20":(ERROR_NO_20, 'decrypt userdb password error'),       | 
|     "DeployError_21":(ERROR_NO_21, 'user db mongodb longin pwd is empty'),    | 
|     "DeployError_22":(ERROR_NO_22, 'sys db mongodb longin user name is empty'),  | 
|     "DeployError_23":(ERROR_NO_23, 'Decrypt sysdb_pwd faied'),    | 
|     "DeployError_24":(ERROR_NO_24, 'sys db mongodb longin pwd is empty'),        | 
|     "DeployError_25":(ERROR_NO_25, 'log db mongodb longin user name is empty'),  | 
|     "DeployError_26":(ERROR_NO_26, 'Decrypt logdb_pwd faied'),    | 
|     "DeployError_27":(ERROR_NO_27, 'log db mongodb longin pwd is empty'),   | 
|     "error_28":(ERROR_NO_28, 'unknown error'),      | 
|     "fatal_29":(ERROR_NO_29, 'Init config failed'),  | 
|     "DesignError_30":(ERROR_NO_30, 'read sysdb table failed'),   | 
|     "fatal_31":(ERROR_NO_31, 'read sysdb table failed'),   | 
|     "DesignError_32":(ERROR_NO_32, 'open sysdb table file failed'),    | 
|     "DesignError_33":(ERROR_NO_33, 'read sysdb table failed'),   | 
|     "DesignError_34":(ERROR_NO_34, 'open sysdb table file failed'),   | 
|     "error_35":(ERROR_NO_35, 'seq fail'),   | 
|     "error_36":(ERROR_NO_36, 'unknown error'),   | 
|     "error_37":(ERROR_NO_37, 'DumpData:write data to file fail'),     | 
|     "error_38":(ERROR_NO_38, 'DumpData:unknown error'),    | 
|     "fatal_39":(ERROR_NO_39, 'unexpceted param error'),     | 
|     "error_40":(ERROR_NO_40, 'GetEncodePsw£¡unknown error'),    | 
|     "error_41":(ERROR_NO_41, 'LoginMongoDB£¡unknown error'),  | 
|     "error_42":(ERROR_NO_42, 'requestType error'),      | 
|     "error_43":(ERROR_NO_43, 'pack not processed'),      | 
|     "fatal_44":(ERROR_NO_44, 'fail to reconnect mongod'),                                                                                                                        | 
|     "fatal_45":(ERROR_NO_45, '__requestProcess£¡unknown error'),    | 
|     "error_46":(ERROR_NO_46, 'pack is none, program logic error'),   | 
|     "error_47":(ERROR_NO_47, 'pack is too short'),      | 
|     "error_48":(ERROR_NO_48, 'pack is not processed'),                 | 
|     "error_49":(ERROR_NO_49, 'insert SvrStatus failed'),      | 
|     "error_50":(ERROR_NO_50, 'onCoinChangeLog!unknown error'),     | 
|     "fatal_51":(ERROR_NO_51, 'unexpceted param error'),   | 
|     "DesignError_52":(ERROR_NO_52, 'resource version file not found'),    | 
|     "fatal_53":(ERROR_NO_53, 'OnGetGameData!unknown error'),        | 
|     "DesignError_54":(ERROR_NO_54, 'load PyReadData.dll failed, may be not exist'),        | 
|     "DesignError_55":(ERROR_NO_55, 'load py sysdb data, may be not exist'),   | 
|     "DeployError_56":(ERROR_NO_56, 'mapServer SaveServer switch may be not open'),       | 
|     "error_57":(ERROR_NO_57, 'load tagDSAccount failed'),   | 
|     "error_58":(ERROR_NO_58, 'OnSavePlayerInfo handle the dismatch type'),       | 
|     "error_59":(ERROR_NO_59, 'Player save data failed!'),     | 
|     "error_60":(ERROR_NO_60, 'Player data crc error'),         | 
|     "error_61":(ERROR_NO_61, 'updatePlayerAccState!pymongo.errors.OperationFailure'),  | 
|     "error_62":(ERROR_NO_62, 'onCreateRoleServerCheckIsHaveRole!unexpetcted exception'),  | 
|     "error_63":(ERROR_NO_63, 'onCreateRoleServerCheckPlayerExist!unexpetcted exception'),       | 
|     "error_64":(ERROR_NO_64, 'onCreateRoleServerRequestCreateRole!unexpetcted exception'),  | 
|     "error_65":(ERROR_NO_65, 'insert tagDBPlayer failed'),    | 
|     "error_66":(ERROR_NO_66, 'insert player failed'),        | 
|     "error_67":(ERROR_NO_67, 'onGetPlayerDetail:unknown error'),        | 
|     "error_68":(ERROR_NO_68, 'onGetPlayerDetail:unknown error'),         | 
|     "error_69":(ERROR_NO_69, 'Player should not be leader of two familys'),    | 
|     "error_70":(ERROR_NO_70, 'onGetPlayerDetail:KeyError'),    | 
|     "fatal_71":(ERROR_NO_71, 'SERVER_DATA_VERSION_NO mismatch'),    | 
|     "error_72":(ERROR_NO_72, 'crash data crc mismatch'),     | 
|     "error_73":(ERROR_NO_73, 'crash data crc mismatch'),  | 
|     "error_74":(ERROR_NO_74, 'lack of gmcmd data'),  | 
|     "fatal_75":(ERROR_NO_75, 'Compress gameserver player data error'),    | 
|     "fatal_76":(ERROR_NO_76, 'GAMESERVER_DATA_VERSION_NO mismatch'),   | 
|     "error_77":(ERROR_NO_77, 'discompress gameserver data fail'),    | 
|     "error_78":(ERROR_NO_78, 'short of gameServerWorldData'),    | 
|     "error_79":(ERROR_NO_79, 'short of GameServerPlayerData'),   | 
|     "error_80":(ERROR_NO_80, 'discompress gameserver data fail'),    | 
|     "error_81":(ERROR_NO_81, 'short of gameServerWorldData'),        | 
|     "error_82":(ERROR_NO_82, 'invalid player mail data'),   | 
|     "error_83":(ERROR_NO_83, 'OnInsertAcc!unknown error'),       | 
|     "error_84":(ERROR_NO_84, 'OnPlayerIDMarkDeleted!unknown error'),    | 
|     "error_85":(ERROR_NO_85, 'OnGetCoin!unknown error'),     | 
|     "error_86":(ERROR_NO_86, 'CheckUpdateC tagDSAccount failed!'),  | 
|     "error_87":(ERROR_NO_87, 'insert tagAccCoins failed'),   | 
|     "error_88":(ERROR_NO_88, 'OnCoinChange!unknown error'),     | 
|     "error_89":(ERROR_NO_89, 'OnCheckPlayerExist!unknown error'),  | 
|     "error_90":(ERROR_NO_90, 'save tagGMOper failed'),   | 
|     "error_91":(ERROR_NO_91, 'lack of pack data'),   | 
|     "error_92":(ERROR_NO_92, 'insert tagServerDataVersionNO failed'),           | 
|     "error_93":(ERROR_NO_93, 'lack of pack data'),     | 
|     "error_94":(ERROR_NO_94, 'tagDBMapServerInfo adoCheckUpdateEx failed'),   | 
|     "error_95":(ERROR_NO_95, 'tagDBPlayerSaveCoinLog:lack of pack data'),  | 
|     "fatal_96":(ERROR_NO_96, 'OnUpdateTotalSavePoint!unknown error'),   | 
|     "error_97":(ERROR_NO_97, 'OnGetPlayerMailState!unknown error'),   | 
|     "error_98":(ERROR_NO_98, 'OnGetMailDetail!unknown error'),       | 
|     "error_99":(ERROR_NO_99, 'OnGetPlayerMail!unknown error'),  | 
|     "error_100":(ERROR_NO_100, 'tagDBMailList_SaveSysMail lack of pack data'),   | 
|     "error_101":(ERROR_NO_101, "OnAddPlayerMailByAccID: exist a same mailid"),   | 
|     "error_102":(ERROR_NO_102, "OnAddPlayerMailByAccID!unknown error"),    | 
|     "error_103":(ERROR_NO_103, "DeleteMail fail"),      | 
|     "error_104":(ERROR_NO_104, "Delete Mail Item fail"),   | 
|     "error_105":(ERROR_NO_105, "OnDeleteMail!unknown error"),      | 
|     "error_106":(ERROR_NO_106, "load mail fail"),   | 
|     "error_107":(ERROR_NO_107, "update mail fail"),      | 
|     "error_108":(ERROR_NO_108, "OnUpdateMail!adoDeleteByIndex failed"),     | 
|     "error_109":(ERROR_NO_109, "OnUpdateMail!unknown error"),   | 
|     "error_110":(ERROR_NO_110, "OnQueryCanSendMail!unknown error"),                         | 
|     "error_111":(ERROR_NO_111, "update tagAccIDSendPrize failed"),  | 
|     "error_112":(ERROR_NO_112, "update tagAccIDSendPrize failed"),     | 
|     "error_113":(ERROR_NO_113, "OnAccIDSendPrize!unknown error"),              | 
|     "error_114":(ERROR_NO_114, "OnCheckItemPrize!unknown error"),     | 
|     "error_115":(ERROR_NO_115, "OnCheckLoadAcc!unknown error"),    | 
|     "error_116":(ERROR_NO_116, "OnAddAccItem!unknown error"),    | 
|     "error_117":(ERROR_NO_117, "UpdateTelLockState failed"),  | 
|     "error_118":(ERROR_NO_118, "OnUpdateTelLockState!unknown error"),  | 
|     "error_119":(ERROR_NO_119, "OnUpdateMTTUID failed"),               | 
|     "error_120":(ERROR_NO_120, "OnUpdateMTTUID!unknown error"),    | 
|     "error_121":(ERROR_NO_121, "OnUpdateAccAdult failed"),  | 
|     "error_122":(ERROR_NO_122, "OnUpdateAccAdult!unknown error"),      | 
|     "error_123":(ERROR_NO_123, "OnAddExpiation!unknown error"),    | 
|     "error_124":(ERROR_NO_124, "OnAddPetExpiation!unknown error"),    | 
|     "error_125":(ERROR_NO_125, "lack of pack data"),  | 
|     "error_125":(ERROR_NO_126, "ServerMergeDeleteRole failed"),  | 
|     "error_127":(ERROR_NO_127, "OnServerMergeDeleteRole failed"),    | 
|     "error_128":(ERROR_NO_128, "OnServerMergeUpdateAccState failed"),  | 
|     "error_129":(ERROR_NO_129, "OnServerMergeUpdateAccState!unknown error"),      | 
|     "error_130":(ERROR_NO_130, "insert tagDBPlayerChangeNameLog failed"),     | 
|     "error_131":(ERROR_NO_131, "OnServerMergeChangeName update failed"),   | 
|     "error_132":(ERROR_NO_132, "OnServerMergeChangeName!unknown error"),   | 
|     "error_133":(ERROR_NO_133, "Insert tagDBImpeach failed"),   | 
|     "error_134":(ERROR_NO_134, "OnServerMergeChangeName!unknown error"),   | 
|     "error_135":(ERROR_NO_135, "Invalid pack data"),  | 
|     "error_136":(ERROR_NO_136, "PackSign Error"),      | 
|     "error_137":(ERROR_NO_137, "Pack too big"),  | 
|     "error_138":(ERROR_NO_138, "getVersionByIndex!IndexError"),  | 
|     "error_139":(ERROR_NO_139, "getMinorVersionByIndex!IndexError"),     | 
|     "error_140":(ERROR_NO_140, "getLanguageVersionByIndex!IndexError"),         | 
|     "DesignError_141":(ERROR_NO_141, "LoadVersionFile!IOError.Version file may be not exist"),      | 
|     "fatal_142":(ERROR_NO_142, "LoadVersionFile!unknown error."),      | 
|     "DesignError_143":(ERROR_NO_143, "not version in Version.chver file"),     | 
|     "DesignError_144":(ERROR_NO_144, "version format error!"),  | 
|     "fatal_145":(ERROR_NO_145, "LoadVersions!unknown error"),  | 
|     "error_146":(ERROR_NO_146, "Insert failed"),  | 
|     "error_147":(ERROR_NO_147, "Lack of data"),           | 
|     "error_148":(ERROR_NO_148, "ReadData!invalid data pos"),       | 
|     "error_149":(ERROR_NO_149, "lack of data"),     | 
|     "error_150":(ERROR_NO_150, "ReadData!invalid data pos"),   | 
|     "error_151":(ERROR_NO_151, "lack of data"),  | 
|     "error_152":(ERROR_NO_152, "Insert failed"),           | 
|     "error_153":(ERROR_NO_153, "Update failed"),    | 
|     "error_154":(ERROR_NO_154, "UpdateEx failed"),   | 
|     "error_155":(ERROR_NO_155, "adoDeleteByIndex failed"),     | 
|     "DeployError_156":(ERROR_NO_156, 'Log4Me.dll not found!'),    | 
|     "warning_157":(ERROR_NO_157, "PyReadData.dll not found!"),     | 
|     "error_158":(ERROR_NO_158, "CEventShellProxy InitDll Fail!"),   | 
|     "warning_159":(ERROR_NO_159, "CEventShellProxy SendEvent Fail!"),  | 
|     "error_160":(ERROR_NO_160, "CEventShellProxy DeInitDll Fail!"),   | 
|     "error_161":(ERROR_NO_161, "#PythonError#Call EventProcess.OnDayProcess() Fail!!"),    | 
| }  | 
|   | 
| SHOW_ERROR_IF_DEBUG = 1  | 
| SHOW_ERROR_IF_RELEASE = 2  | 
| SHOW_ERROR_ALL = 3  | 
|   | 
| def formatMsg(type, ID, info):  | 
|     global __errorDict  | 
|     error = __errorDict.get('%s_%s'%(type, ID))  | 
|     if len(error) < 2:  | 
|         return 'Unknown Error'  | 
|     return 'ID    :#%s\r\nMsg   :%s\r\nDetail:%s'%(error[0], error[1], info)  |