Ejemplo n.º 1
0
void SytProgress::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (leftsize == 0)
        throw EncodeError();
    *p = level;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = pve_index;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = ev_index;
    ++buffersize;
    ++p;
    --leftsize;
}
Ejemplo n.º 2
0
void SytJAL_SKILL::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, skill_id);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, con_idx);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, count);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
}
Ejemplo n.º 3
0
void SytJAL_GENERAL_AWARD::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, index);
    buffersize += 2;
    p += 2;
    leftsize -= 2;
  
    arraysize = leftsize;
    levelup_info.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
  
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, assist_index);
    buffersize += 2;
    p += 2;
    leftsize -= 2;
  
    arraysize = leftsize;
    assist_levelup_info.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
}
Ejemplo n.º 4
0
void stArtifice::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, general_id);
    buffersize += 2;
    p += 2;
    leftsize -= 2;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = is_soul;
    ++buffersize;
    ++p;
    --leftsize;

	if (is_soul == 1) {  
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, soul_num);
    buffersize += 2;
    p += 2;
    leftsize -= 2;
	}
}
Ejemplo n.º 5
0
/* body */
void XJCMD_CSC_USERINFO_SYNCS::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (leftsize == 0)
        throw EncodeError();
    *p = user_version;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, user_db_res_version);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, user_res_version);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
}
Ejemplo n.º 6
0
void ProtoBattleFightInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
       
    if (1 > leftsize) 
        throw EncodeError();
    *p = battle_array_id.size();
    ++buffersize;
    ++p;
    --leftsize;
  
    if (4 * battle_array_id.size() > leftsize)
        throw EncodeError();
    for (unsigned int i=0; i< battle_array_id.size(); ++i) {
        CProto::h2n_32(p, battle_array_id[i]);
        buffersize += 4;
        p += 4;
        leftsize -= 4;
    }
  
    if (leftsize == 0)
        throw EncodeError();
    *p = super_element;
    ++buffersize;
    ++p;
    --leftsize;
}
Ejemplo n.º 7
0
void XJCMD_LEVEL_NEXTSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, retcode);
    buffersize += 2;
    p += 2;
    leftsize -= 2;

	if (retcode == SYT_GOOD) {  
    arraysize = leftsize;
    ev_seq.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
	}

	if (retcode == SYT_GOOD) {  
    if (leftsize == 0)
        throw EncodeError();
    *p = firsttime;
    ++buffersize;
    ++p;
    --leftsize;
	}
}
Ejemplo n.º 8
0
void SytEvSeq::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (leftsize == 0)
        throw EncodeError();
    *p = level;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (1 > leftsize)
        throw EncodeError();
    *p = seq_arraylen;
    ++buffersize;
    ++p;
    --leftsize;
  
    for (unsigned int i=0; i<seq_arraylen; ++i) {
        arraysize = leftsize;
        seq[i].Encode(p, arraysize);
        buffersize += arraysize;
        p += arraysize;
        leftsize -= arraysize;
    }
}
Ejemplo n.º 9
0
void XJCMD_QUERY_PROGRESSSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (leftsize == 0)
        throw EncodeError();
    *p = firsttime;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = levels_can_jump;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = play_times;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = max_play_times;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = have_progress;
    ++buffersize;
    ++p;
    --leftsize;

	if (have_progress == 1) {  
    arraysize = leftsize;
    progress.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
	}
}
Ejemplo n.º 10
0
void XJCMD_LEVEL_STARTSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, retcode);
    buffersize += 2;
    p += 2;
    leftsize -= 2;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = jump_levels;
    ++buffersize;
    ++p;
    --leftsize;

	if (retcode == SYT_GOOD) {  
    arraysize = leftsize;
    ev_seq.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
	}

	if (jump_levels > 0 && (retcode == SYT_GOOD || retcode == SYT_ALL_LEVEL_FINISHED)) {  
    arraysize = leftsize;
    jump_award_list.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
	}

	if (retcode == SYT_GOOD) {  
    if (leftsize == 0)
        throw EncodeError();
    *p = firsttime;
    ++buffersize;
    ++p;
    --leftsize;
	}
}
Ejemplo n.º 11
0
void ProtoBattleImpacter::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (leftsize == 0)
        throw EncodeError();
    *p = op_type;
    ++buffersize;
    ++p;
    --leftsize;
   
    if (1 > leftsize) 
        throw EncodeError();
    *p = impact_id.size();
    ++buffersize;
    ++p;
    --leftsize;
  
    if (4 * impact_id.size() > leftsize)
        throw EncodeError();
    for (unsigned int i=0; i< impact_id.size(); ++i) {
        CProto::h2n_32(p, impact_id[i]);
        buffersize += 4;
        p += 4;
        leftsize -= 4;
    }
  
    if (leftsize == 0)
        throw EncodeError();
    *p = pos;
    ++buffersize;
    ++p;
    --leftsize;
  
    arraysize = leftsize;
    obj_data.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
}
Ejemplo n.º 12
0
void ProtoBattleImpactObj::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, max_hp);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, diff_hp);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
   
    if (1 > leftsize) 
        throw EncodeError();
    *p = fight_state.size();
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize < fight_state.size()) 
        throw EncodeError();
    memcpy(p,&fight_state[0], fight_state.size());
    buffersize += fight_state.size();
    p += fight_state.size();
    leftsize-= fight_state.size();
  
    if (leftsize == 0)
        throw EncodeError();
    *p = assist_value;
    ++buffersize;
    ++p;
    --leftsize;
}
Ejemplo n.º 13
0
void SytEvent::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, tag);
    buffersize += 2;
    p += 2;
    leftsize -= 2;

	if (tag == SytEvPveBoss || tag == SytEvPve) {  
    arraysize = leftsize;
    pve.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
	}

	if (tag == SytEvPvp) {  
    arraysize = leftsize;
    pvp.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
	}

	if (tag == SytEvTreasureChest) {  
    arraysize = leftsize;
    treasure_chest.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
	}

	if (tag == SytEvAdvanture) {  
    arraysize = leftsize;
    adv_data.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
	}

	if (tag == SytEvRandAward) {  
    arraysize = leftsize;
    rand_award_data.Encode(p, arraysize);
    buffersize += arraysize;
    p += arraysize;
    leftsize -= arraysize;
	}
}
Ejemplo n.º 14
0
void ProtoBattleJointAttackData::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
       
    if (1 > leftsize) 
        throw EncodeError();
    *p = joint_pos.size();
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize < joint_pos.size()) 
        throw EncodeError();
    memcpy(p,&joint_pos[0], joint_pos.size());
    buffersize += joint_pos.size();
    p += joint_pos.size();
    leftsize-= joint_pos.size();
   
    if (1 > leftsize) 
        throw EncodeError();
    *p = fly_pos.size();
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize < fly_pos.size()) 
        throw EncodeError();
    memcpy(p,&fly_pos[0], fly_pos.size());
    buffersize += fly_pos.size();
    p += fly_pos.size();
    leftsize-= fly_pos.size();
   
    if (1 > leftsize) 
        throw EncodeError();
    *p = joint_rate.size();
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize < joint_rate.size()) 
        throw EncodeError();
    memcpy(p,&joint_rate[0], joint_rate.size());
    buffersize += joint_rate.size();
    p += joint_rate.size();
    leftsize-= joint_rate.size();
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, score);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
}
Ejemplo n.º 15
0
void ProtoBattleFightNode::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (leftsize == 0)
        throw EncodeError();
    *p = type;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, index);
    buffersize += 2;
    p += 2;
    leftsize -= 2;
}
Ejemplo n.º 16
0
void ProtoBattleAttackOrderInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
       
    if (1 > leftsize) 
        throw EncodeError();
    *p = attack_order.size();
    ++buffersize;
    ++p;
    --leftsize;
  
    if (leftsize < attack_order.size()) 
        throw EncodeError();
    memcpy(p,&attack_order[0], attack_order.size());
    buffersize += attack_order.size();
    p += attack_order.size();
    leftsize-= attack_order.size();
}
Ejemplo n.º 17
0
void SytEvPveData::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, stage_id);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, dialog_id);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
}
Ejemplo n.º 18
0
void SytEvRandAwardData::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, money);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, exp);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
}
Ejemplo n.º 19
0
void SytEvTCAwardItem::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, item_id);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = count;
    ++buffersize;
    ++p;
    --leftsize;
}
Ejemplo n.º 20
0
void ProtoBattleCampInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
       
    if (1 > leftsize) 
        throw EncodeError();
    *p = user_guid.size();
    ++buffersize;
    ++p;
    --leftsize;
    if (8 * user_guid.size() > leftsize)
        throw EncodeError();
    for (unsigned int i=0; i< user_guid.size(); ++i) {
        CProto::h2n_64(p, user_guid[i]);
        buffersize += 8;
        p += 8;
        leftsize -= 8;
    }
}
Ejemplo n.º 21
0
 inline Bytes
 encode(const Unicode& object) const
 {
   int state;
   size_t offset = 0;
   size_t enclen = 0;
   bytechar* encptr = NULL;
   size_t declen = object.length();
   const unicode* decptr = static_cast<const unicode*>(object);
   state = u8_encode(decptr, declen, encptr, enclen, offset);
   if (state != UNICODE_STATE_SUCCESS)
     throw EncodeError(state, offset, "UTF-8");
   return Bytes(encptr, enclen);
 }
Ejemplo n.º 22
0
void ProtoBattleGeneralInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, id);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, assist_id);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
  
    if (leftsize == 0)
        throw EncodeError();
    *p = pos;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (4 > leftsize)
        throw EncodeError();
    CProto::h2n_32(p, max_hp);
    buffersize += 4;
    p += 4;
    leftsize -= 4;
}
Ejemplo n.º 23
0
void XJCMD_CSC_ENCHANTMENT_LEVELUPCS::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (leftsize == 0)
        throw EncodeError();
    *p = enchantment_index;
    ++buffersize;
    ++p;
    --leftsize;
}
Ejemplo n.º 24
0
void XJCMD_PROCESS_EVENTSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, retcode);
    buffersize += 2;
    p += 2;
    leftsize -= 2;
}
Ejemplo n.º 25
0
void XJCMD_PROCESS_EVENTCS::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (1 > leftsize)
        throw EncodeError();
    *p = parameters_arraylen;
    ++buffersize;
    ++p;
    --leftsize;
  
    if (4 * MAX_NUM_EV_INT_PARAM > leftsize)
        throw EncodeError();
    for (unsigned int i=0; i<parameters_arraylen; ++i) {
        CProto::h2n_32(p, parameters[i]);
        buffersize += 4;
        p += 4;
        leftsize -= 4;
    }
}
Ejemplo n.º 26
0
void XJCMD_CSC_ENCHANTMENT_LEVELUPSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, retcode);
    buffersize += 2;
    p += 2;
    leftsize -= 2;
}
Ejemplo n.º 27
0
void XJCMD_CSC_CHANGEFACESC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, newfaceid);
    buffersize += 2;
    p += 2;
    leftsize -= 2;
}
Ejemplo n.º 28
0
void XJCMD_LEVEL_STARTCS::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (2 > leftsize)
        throw EncodeError();
    CProto::h2n_16(p, opt);
    buffersize += 2;
    p += 2;
    leftsize -= 2;

	if (opt == SytStartNew) {  
    if (leftsize == 0)
        throw EncodeError();
    *p = jump_levels;
    ++buffersize;
    ++p;
    --leftsize;
	}
}
Ejemplo n.º 29
0
void SytEvPvpData::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (leftsize == 0)
        throw EncodeError();
    *p = reserved;
    ++buffersize;
    ++p;
    --leftsize;
}
Ejemplo n.º 30
0
void ProtoBattleTurnInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) 
{
    unsigned int leftsize;
    leftsize = buffersize;
    unsigned char *p;
    p = buffer;
    buffersize = 0;
      
    if (leftsize == 0)
        throw EncodeError();
    *p = curr_turn;
    ++buffersize;
    ++p;
    --leftsize;
}