コード例 #1
0
ファイル: Union.php プロジェクト: bluefan/phpsource
 public function Sync_Union_msg($union_id, $activities_type = -1, $open_way = 2, $open_level = 0, $is_del = false, $push = true)
 {
     $union_id = intval($union_id);
     $data = $this->get_data('UnionInfo')->get_union_info($union_id);
     if (!empty($data)) {
         #会长信息
         $pdata = $this->get_game('PlayerBase')->get_player_init_info($data['create_player_id']);
         if (empty($pdata)) {
             $data['err_code'] = 1;
             return $data;
         }
         #获取掩码数据
         SynPlayer::set_syn_data($pdata);
         $synData = SynPlayer::get_data();
         $temp = array();
         $temp['guild_id'] = $data['union_id'];
         $union_data = $this->getUnionMsg($data, $activities_type, $open_way, $open_level);
         SynUnion::set_syn_data($union_data);
         $uSynData = SynUnion::get_data();
         $temp['guild_masks'] = $uSynData['m'];
         #会属性掩码
         $temp['guild_values'] = $uSynData['u'];
         #会属性数据
         $temp['president_masks'] = $synData['m'];
         #会长角色属性掩码
         $temp['president_values'] = $synData['u'];
         #会长角色属性数据
         #红包信息
         $redInfo = $this->get_game('UnionPlayer')->get_red_envelopes($union_id);
         if (!empty($redInfo)) {
             $temp['red_packet_donator_role_id'] = $redInfo['red_packet_create_id'];
             $temp['red_packet_time'] = $redInfo['add_time'];
             $temp['red_packets'] = $redInfo['red_packet'];
             $temp['red_packet_duration'] = $redInfo['red_packet_duration'];
             $temp['red_packet_living_seconds'] = $redInfo['red_packet_living_seconds'];
             $temp['red_packet_donator_name'] = $redInfo['red_packet_donator_name'];
             $temp['red_packet_donator_message'] = $redInfo['red_packet_donator_message'];
             $temp['red_packet_donator_career'] = $redInfo['red_packet_donator_career'];
         } else {
             $temp['red_packet_donator_role_id'] = 0;
             $temp['red_packet_time'] = 0;
             $temp['red_packets'] = array();
             $temp['red_packet_duration'] = 0;
             $temp['red_packet_living_seconds'] = 0;
             $temp['red_packet_donator_name'] = '';
             $temp['red_packet_donator_message'] = '';
             $temp['red_packet_donator_career'] = 0;
         }
         if ($push) {
             Protocol::input(0, 7, 4, 481, array($temp));
         }
         #更新公会脏数据缓存
         if ($is_del) {
             $this->get_data('UnionInfo')->del_union_list_for_union_id($data['union_id']);
         } else {
             $this->get_data('UnionInfo')->update_union_list_info(array($data['union_id'] => $temp));
         }
     }
 }
コード例 #2
0
ファイル: SynUnion.php プロジェクト: bluefan/phpsource
 /**
  * 初始化
  */
 public static function init($_union_id = 0)
 {
     $count = ceil(self::ENUM_COUNT / 32);
     for ($i = 0; $i < $count; $i++) {
         if (IS_FRONT) {
             self::$_masks[$i] = 0;
         } else {
             self::$_masks[$_union_id][$i] = 0;
         }
     }
     if (IS_FRONT) {
         self::$_uval = array();
     }
     self::$_union_id = $_union_id;
 }