<?php
/*
 * Perfect World Protocol Definition
 * Converted from XML protocol specification
 */

$PROTOCOL = array(
    'code' => array(
        // User Management
        'getUserRoles' => 3401,
        'getUser' => 3002,
        'putUser' => 3001,
        'queryUserid' => 8001,
        'forbidUser' => 8004,
        'disableAutolock' => 8007,
        'uid2Logicuid' => 3411,
        'roleid2Uid' => 3412,
        'userRoleCount' => 3414,
        
        // Role Data Management
        'getRole' => 8003,
        'putRole' => 8002,
        'getRoleBase' => 3013,
        'putRoleBase' => 3012,
        'getRoleStatus' => 3015,
        'putRoleStatus' => 3014,
        'getRoleInventory' => 3053,
        'putRoleInventory' => 3052,
        'getRoleEquipment' => 3017,
        'putRoleEquipment' => 3016,
        'getRoleStoreHouse' => 3027,
        'putRoleStoreHouse' => 3026,
        'getRoleTask' => 3019,
        'putRoleTask' => 3018,
        'getRoleid' => 3033,
        'getRoleFriend' => 201,
        
        // Role Creation/Deletion
        'dbCreateRole' => 3007,
        'dbDeleteRole' => 3008,
        'preCreateRole' => 3037,
        'postCreateRole' => 3038,
        'postDeleteRole' => 3039,
        'dbModifyRoleData' => 8005,
        
        // Role Name Management
        'rolenameExists' => 3413,
        'canChangeRolename' => 3403,
        'renameRole' => 3404,
        'moveRoleCreate' => 3415,
        
        // Chat & Communication
        'worldChat' => 133,
        'publicChat' => 79,
        'chatBroadCast' => 120,
        'forwardChat' => 8000,
        'privateChat' => 96,
        
        // Mail System
        'sendMail' => 4214,
        'sendMailRe' => 4215,
        'sysRecoveredObjMail' => 4219,
        'sysRecoveredObjMailRe' => 4220,
        
        // GM Commands
        'gmGetGameAttri' => 376,
        'gmSetGameAttri' => 377,
        'gmControlGame' => 380,
        'gmControlGameRe' => 381,
        'gmRestartServer' => 358,
        'gmRestartServerRe' => 359,
        'gmPrivilegeChange' => 122,
        'gmKickoutUser' => 354,
        'gmKickoutUserRe' => 355,
        'gmForbidRole' => 366,
        'gmForbidRoleRe' => 367,
        'gmShutup' => 356,
        'gmShutupRe' => 357,
        'gmShutupRole' => 362,
        'gmShutupRoleRe' => 363,
        'gmOnlineNum' => 350,
        'gmOnlineNumRe' => 351,
        'gmListOnlineUser' => 352,
        'gmListOnlineUserRe' => 353,
        'gmGetPlayerConsumeInfo' => 382,
        'gmGetPlayerConsumeInfoRe' => 383,
        'gmQueryRoleInfo' => 124,
        
        // Faction System
        'addFaction' => 4600,
        'delFaction' => 4601,
        'getFactionInfo' => 4606,
        'getUserFaction' => 4607,
        'getFactionDetail' => 4608,
        'dbVerifyMaster' => 4609,
        'factionUpgrade' => 4610,
        'gFactionFortressDetail' => 4404,
        
        // Territory War
        'getTerritory' => 863,
        'territoryWar' => 873,
        'battleMapNotice' => 870,
        
        // Reward System
        'sendRewardAddBonus' => 4951,
        'getRewardList' => 4952,
        'getRewardListRe' => 4953,
        'exchangeConsumePoints' => 4954,
        'exchangeConsumePointsRe' => 4955,
        'rewardMatureNotice' => 4956,
        'dbGetReward' => 4957,
        'dbPutConsumePoints' => 4958,
        'dbRewardMature' => 4959,
        'dbExchangeConsumePoints' => 4960,
        'dbPutRewardBonus' => 4961,
        'sendTaskReward' => 4962,
        'dbGetConsumeInfos' => 384,
        
        // Server Management
        'announceAuthdVersion' => 137,
        'announceChallengeAlgo' => 136,
        'announceServerAttribute' => 132,
        'announceLinkType' => 372,
        'setMaxOnlineNum' => 373,
        'setMaxOnlineNumRe' => 374,
        'getMaxOnlineNum' => 375,
        'disconnectPlayer' => 106,
        
        // Misc
        'queryUserPrivilegeRe' => 507,
        'gQueryPasswd' => 502,
        'report2GM' => 368,
        'complain2GM' => 370,
        'clearStorehousePasswd' => 3402,
        'accountLoginRecord' => 143,
        'collectClientMachineInfo' => 37,
        
        // Provider Client
        'queryRewardType' => 510,
        'queryRewardTypeRe' => 511,
        'queryGameServerAttr' => 512,
        'queryGameServerAttrRe' => 513,
        'syncForceGlobalData' => 4703,
        'cashMoneyExchangeNotify' => 157,
        'serverForbidNotify' => 160,
        'serverTriggerNotify' => 163,
        'waitQueueStateNotify' => 164,
        'mnDomainInfoGSNotice' => 5209,
        
        // Log Service
        'statInfoVital' => 59,
        'statInfo' => 60,
        'remoteLogVital' => 61,
        'remoteLog' => 62,
    ),
    
    'role' => array(
        'base' => array(
            'version' => 'byte',
            'id' => 'int',
            'name' => 'name',
            'race' => 'int',
            'cls' => 'int',
            'gender' => 'byte',
            'custom_data' => 'octets',
            'config_data' => 'octets',
            'custom_stamp' => 'int',
            'status' => 'byte',
            'delete_time' => 'int',
            'create_time' => 'int',
            'lastlogin_time' => 'int',
            'forbidcount' => 'cuint',
            'forbid' => array(
                'type' => 'byte',
                'time' => 'int',
                'createtime' => 'int',
                'reason' => 'name',
            ),
            'help_states' => 'octets',
            'spouse' => 'int',
            'userid' => 'int',
            'reserved1' => 'int',
            'cross_data' => 'octets',
            'highmode_custom_data' => 'octets',
            'reserved3' => 'byte',
            'reserved4' => 'byte',
        ),
        
        'status' => array(
            'version' => 'byte',
            'level' => 'int',
            'level2' => 'int',
            'exp' => 'int',
            'sp' => 'int',
            'pp' => 'int',
            'hp' => 'int',
            'mp' => 'int',
            'posx' => 'float',
            'posy' => 'float',
            'posz' => 'float',
            'worldtag' => 'int',
            'invader_state' => 'int',
            'invader_time' => 'int',
            'pariah_time' => 'int',
            'reputation' => 'int',
            'custom_status' => 'octets',
            'filter_data' => 'octets',
            'charactermode' => 'octets',
            'instancekeylist' => 'octets',
            'dbltime_expire' => 'int',
            'dbltime_mode' => 'int',
            'dbltime_begin' => 'int',
            'dbltime_used' => 'int',
            'dbltime_max' => 'int',
            'time_used' => 'int',
            'dbltime_data' => 'octets',
            'storesize' => 'short',
            'petcorral' => 'octets',
            'property' => 'octets',
            'var_data' => 'octets',
            'skills' => 'octets',
            'storehousepasswd' => 'octets',
            'waypointlist' => 'octets',
            'coolingtime' => 'octets',
            'npc_relation' => 'octets',
            'multi_exp_ctrl' => 'octets',
            'storage_task' => 'octets',
            'faction_contrib' => 'octets',
            'force_data' => 'octets',
            'online_award' => 'octets',
            'profit_time_data' => 'octets',
            'country_data' => 'octets',
            'king_data' => 'octets',
            'meridian_data' => 'octets',
            'extraprop' => 'octets',
            'title_data' => 'octets',
            'reincarnation_data' => 'octets',
            'realm_data' => 'octets',
            'reserved2' => 'byte',
            'reserved3' => 'byte',
        ),
        
        'pocket' => array(
            'capacity' => 'int',
            'timestamp' => 'int',
            'money' => 'int',
            'invcount' => 'cuint',
            'inv' => array(
                'id' => 'int',
                'pos' => 'int',
                'count' => 'int',
                'max_count' => 'int',
                'data' => 'octets',
                'proctype' => 'int',
                'expire_date' => 'int',
                'guid1' => 'int',
                'guid2' => 'int',
                'mask' => 'int'
            ),
            'reserved1' => 'int',
            'reserved2' => 'int',
            'money2' => 'long',
            'u_shizhuang' => 'byte',
            'rune1' => 'int',
            'rune2' => 'int',
            'rune_data' => 'octets',
            'wuhun1' => 'byte',
            'wuhun_data' => 'octets',
        ),
        
        'equipment' => array(
            'eqpcount' => 'cuint',
            'eqp' => array(
                'id' => 'int',
                'pos' => 'int',
                'count' => 'int',
                'max_count' => 'int',
                'data' => 'octets',
                'proctype' => 'int',
                'expire_date' => 'int',
                'guid1' => 'int',
                'guid2' => 'int',
                'mask' => 'int'
            ),
        ),
        
        'storehouse' => array(
            'capacity' => 'int',
            'money' => 'int',
            'storecount' => 'cuint',
            'store' => array(
                'id' => 'int',
                'pos' => 'int',
                'count' => 'int',
                'max_count' => 'int',
                'data' => 'octets',
                'proctype' => 'int',
                'expire_date' => 'int',
                'guid1' => 'int',
                'guid2' => 'int',
                'mask' => 'int'
            ),
            'size1' => 'byte',
            'size2' => 'byte',
            'dresscount' => 'cuint',
            'dress' => array(
                'id' => 'int',
                'pos' => 'int',
                'count' => 'int',
                'max_count' => 'int',
                'data' => 'octets',
                'proctype' => 'int',
                'expire_date' => 'int',
                'guid1' => 'int',
                'guid2' => 'int',
                'mask' => 'int'
            ),
            'materialcount' => 'cuint',
            'material' => array(
                'id' => 'int',
                'pos' => 'int',
                'count' => 'int',
                'max_count' => 'int',
                'data' => 'octets',
                'proctype' => 'int',
                'expire_date' => 'int',
                'guid1' => 'int',
                'guid2' => 'int',
                'mask' => 'int'
            ),
            'size3' => 'byte',
            'generalcardcount' => 'cuint',
            'generalcard' => array(
                'id' => 'int',
                'pos' => 'int',
                'count' => 'int',
                'max_count' => 'int',
                'data' => 'octets',
                'proctype' => 'int',
                'expire_date' => 'int',
                'guid1' => 'int',
                'guid2' => 'int',
                'mask' => 'int'
            ),
            'reserved' => 'short',
            'runeitemscount' => 'cuint',
            'runeitems' => array(
                'id' => 'int',
                'pos' => 'int',
                'count' => 'int',
                'max_count' => 'int',
                'data' => 'octets',
                'proctype' => 'int',
                'expire_date' => 'int',
                'guid1' => 'int',
                'guid2' => 'int',
                'mask' => 'int'
            ),
        ),
        
        'task' => array(
            'task_data' => 'octets',
            'task_complete' => 'octets',
            'task_finishtime' => 'octets',
            'task_inventorycount' => 'cuint',
            'task_inventory' => array(
                'id' => 'int',
                'pos' => 'int',
                'count' => 'int',
                'max_count' => 'int',
                'data' => 'octets',
                'proctype' => 'int',
                'expire_date' => 'int',
                'guid1' => 'int',
                'guid2' => 'int',
                'mask' => 'int'
            ),
            'task_data2' => 'octets',
            'task_complete2' => 'octets',
        ),
    ),
    
    'user' => array(
        'roles' => array(
            'count' => 'cuint',
            'roles' => array(
                'id' => 'int',
                'name' => 'name',
            )
        ),
        
        'info' => array(
            'logicuid' => 'int',
            'rolelist' => 'int',
            'cash' => 'int',
            'money' => 'int',
            'cash_add' => 'int',
            'cash_buy' => 'int',
            'cash_sell' => 'int',
            'cash_used' => 'int',
            'add_serial' => 'int',
            'use_serial' => 'int',
            'exg_logcount' => 'cuint',
            'exg_log' => array(
                'tid' => 'int',
                'time' => 'int',
                'result' => 'short',
                'volume' => 'short',
                'cost' => 'int',
            ),
            'addiction' => 'octets',
            'cash_password' => 'octets',
            'autolockcount' => 'cuint',
            'autolock' => array(
                'key' => 'int',
                'value' => 'int',
            ),
            'status' => 'byte',
            'forbidcount' => 'cuint',
            'forbid' => array(
                'type' => 'byte',
                'time' => 'int',
                'createtime' => 'int',
                'reason' => 'name',
            ),
            'reference' => 'octets',
            'consume_reward' => 'octets',
            'taskcounter' => 'octets',
            'cash_sysauction' => 'octets',
            'login_record' => 'octets',
            'mall_consumption' => 'octets',
            'reserved32' => 'short',
        ),
    ),
    
    'octet' => array(
        'var_data' => array(
            'version' => 'lint',
            'pk_count' => 'lint',
            'pvp_cooldown' => 'lint',
            'pvp_flag' => 'byte',
            'dead_flag' => 'byte',
            'is_drop' => 'byte',
            'resurrect_state' => 'byte',
            'resurrect_exp_reduce' => 'float',
            'instance_hash_key1' => 'lint',
            'instance_hash_key2' => 'lint',
            'trashbox_size' => 'lint',
            'last_instance_timestamp' => 'lint',
            'last_instance_tag' => 'lint',
            'last_instance_pos' => array(
                'x' => 'float',
                'y' => 'float',
                'z' => 'float',
            ),
            'dir' => 'lint',
            'resurrect_hp_factor' => 'float',
            'resurrect_mp_factor' => 'float',
        ),
        
        'property' => array(
            'id' => 'lint',
            'hp' => 'lint',
            'mp' => 'lint',
            'damage_low' => 'lint',
            'damage_high' => 'lint',
            'damage_magic_low' => 'lint',
            'damage_magic_high' => 'lint',
            'defense' => 'lint',
            'resistance' => array(
                1 => 'int',
                2 => 'int',
                3 => 'int',
                4 => 'int',
                5 => 'int'
            ),
            'attack' => 'lint',
            'armor' => 'lint',
            'attack_speed' => 'lint',
            'run_speed' => 'lint',
            'attack_degree' => 'lint',
            'defend_degree' => 'lint',
            'damage_reduce' => 'lint',
            'prayspeed' => 'lint',
            'crit_damage_bonus' => 'lint',
            'invisible_degree' => 'lint',
            'anti_invisible_degree' => 'lint',
        ),
        
        'force_data' => array(
            'cur_force_id' => 'int',
            'forcecount' => 'cuint',
            'force' => array(
                'force_id' => 'int',
                'reputation' => 'int',
                'contribution' => 'int',
            ),
        ),
        
        'faction_contrib' => array(
            'consume_contrib' => 'lint',
            'exp_contrib' => 'lint',
            'cumulate_contrib' => 'lint',
        ),
        
        'title_data' => array(
            'cur_title_id' => 'lshort',
        ),
    ),
    
    'RoleList' => array(
        'localsid' => 'int',
        'handler' => 'int',
        'userscount' => 'cuint',
        'users' => array(
            'userid' => 'int',
            'roleid' => 'int',
            'linkid' => 'int',
            'localsid' => 'int',
            'gsid' => 'int',
            'status' => 'byte',
            'name' => 'name',
        ),
    ),
    
    'RoleInfo' => array(
        'roleid' => 'int',
        'gender' => 'byte',
        'race' => 'byte',
        'occupation' => 'byte',
        'level' => 'int',
        'level2' => 'int',
        'name' => 'name',
        'custom_data' => 'octets',
        'equipment' => 'cuint',
        'eqp' => array(
            'id' => 'int',
            'pos' => 'int',
            'count' => 'int',
            'max_count' => 'int',
            'data' => 'octets',
            'proctype' => 'int',
            'expire_date' => 'int',
            'guid1' => 'int',
            'guid2' => 'int',
            'mask' => 'int'
        ),
        'status' => 'byte',
        'delete_time' => 'int',
        'create_time' => 'int',
        'lastlogin_time' => 'int',
        'posx' => 'float',
        'posy' => 'float',
        'posz' => 'float',
        'worldtag' => 'int',
        'custom_status' => 'octets',
        'charactermode' => 'octets',
        'referrer_role' => 'int',
        'cash_add' => 'int',
    ),
    
    'FriendList' => array(
        'groupinfocount' => 'cuint',
        'groupinfo' => array(
            'gid' => 'byte',
            'name' => 'name',
        ),
        'friendinfocount' => 'cuint',
        'friendinfo' => array(
            'rid' => 'int',
            'cls' => 'byte',
            'gender' => 'byte',
            'name' => 'name'
        ),
    ),
    
    'FactionInfo' => array(
        'fid' => 'int',
        'name' => 'name',
        'level' => 'byte',
        'master' => array(
            'roleid' => 'int',
            'role' => 'byte',
        ),
        'membercount' => 'cuint',
        'member' => array(
            'roleid' => 'int',
            'role' => 'byte',
        ),
        'announce' => 'name',
        'sysinfo' => 'octets',
    ),
    
    'FactionDetail' => array(
        'fid' => 'int',
        'name' => 'name',
        'level' => 'byte',
        'master' => 'int',
        'announce' => 'name',
        'sysinfo' => 'octets',
        'membercount' => 'cuint',
        'member' => array(
            'roleid' => 'int',
            'level' => 'byte',
            'occupation' => 'byte',
            'froleid' => 'byte',
            'login_day' => 'short',
            'online_status' => 'byte',
            'name' => 'name',
            'nickname' => 'name',
            'contrib' => 'int',
            'delayexpel' => 'byte',
            'expeltime' => 'int',
        ),
        'last_op_time' => 'int',
        'alliancecount' => 'cuint',
        'alliance' => array(
            'fid' => 'int',
            'end_time' => 'int',
        ),
        'hostilecount' => 'cuint',
        'hostile' => array(
            'fid' => 'int',
            'end_time' => 'int',
        ),
        'applycount' => 'cuint',
        'apply' => array(
            'type' => 'int',
            'fid' => 'int',
            'end_time' => 'int',
        ),
    ),
    
    'FactionFortressDetail' => array(
        'factionid' => 'int',
        'info' => array(
            'level' => 'int',
            'exp' => 'int',
            'exp_today' => 'int',
            'exp_today_time' => 'int',
            'tech_point' => 'int',
            'technology' => 'octets',
            'material' => 'octets',
            'building' => 'octets',
            'common_value' => 'octets',
            'actived_spawner' => 'octets',
            'reserved11' => 'byte',
            'reserved12' => 'short',
            'reserved2' => 'int',
            'reserved3' => 'int',
        ),
        'info2' => array(
            'health' => 'int',
            'offense_faction' => 'int',
            'offense_starttime' => 'int',
            'offense_endtime' => 'int',
            'challenge_listcount' => 'cuint',
            'challenge_list' => array(
                'item' => 'int'
            ),
            'reserved1' => 'int',
            'reserved2' => 'int',
            'reserved3' => 'int',
        ),
        'reserved1' => 'int',
        'reserved2' => 'int',
        'reserved3' => 'int',
        'reserved4' => 'int',
        'reserved5' => 'int',
    ),
    
    'GTerritoryDetail' => array(
        'territorycount' => 'cuint',
        'territory' => array(
            'id' => 'short',
            'level' => 'short',
            'owner' => 'int',
            'occupy_time' => 'int',
            'challenger' => 'int',
            'deposit' => 'int',
            'cutoff_time' => 'int',
            'battle_time' => 'int',
            'bonus_time' => 'int',
            'color' => 'int',
            'status' => 'int',
            'timeout' => 'int',
            'maxbonus' => 'int',
            'challenge_time' => 'int',
            'challengerdetails' => 'octets',
            'reserved1' => 'byte',
            'reserved2' => 'byte',
            'reserved3' => 'byte',
        ),
    ),
    
    'getUserFaction' => array(
        'rid' => 'int',
        'name' => 'name',
        'fid' => 'int',
        'cls' => 'byte',
        'role' => 'byte',
        'delayexpel' => 'octets',
        'extend' => 'octets',
        'nickname' => 'name',
    ),
    
    'RewardStore' => array(
        'consume_points' => 'int',
        'bonus_reward' => 'int',
        'rewardlistcount' => 'cuint',
        'rewardlist' => array(
            'reward_time' => 'int',
            'reward_bonus' => 'int',
            'reserved1' => 'int',
            'reserved2' => 'int',
            'reserved3' => 'int',
            'reserved4' => 'int',
        ),
        'cash_vip_info' => 'octets',
        'reserved2' => 'int',
        'reserved3' => 'int',
        'reserved4' => 'int',
    ),
    
    'PlayerConsumeInfo' => array(
        'roleid' => 'int',
        'level' => 'int',
        'login_ip' => 'int',
        'cash_add' => 'int',
        'mall_consumption' => 'int',
        'avg_online_time' => 'int',
    ),
    
    'ForceGlobalDataBrief' => array(
        'force_id' => 'int',
        'player_count' => 'int',
        'development' => 'int',
        'construction' => 'int',
        'activity' => 'int',
        'activity_level' => 'int',
    ),
    
    'MNDomainInfo' => array(
        'domain_id' => 'int',
        'domain_type' => 'byte',
        'owner_unifid' => 'long',
        'attacker_unifid' => 'long',
        'defender_unifid' => 'long',
    ),
    
    'GameAttr' => array(
        'attrcount' => 'cuint',
        'attr' => array(
            'attr' => 'byte',
            'value' => 'octets',
        ),
    ),
);