static void _xmpp_iq_gameroom_open(const char *mission_key, enum e_room_type type, int tries, f_gameroom_open_cb fun, void *args) { struct cb_args *a = calloc(1, sizeof (struct cb_args)); a->fun = fun; a->args = args; a->tries = tries; if (mission_key != NULL) a->mission_key = strdup(mission_key); a->type = type; /* Open the game room */ xmpp_send_iq_get( JID_MS(session.online.channel), xmpp_iq_gameroom_open_cb, a, "<query xmlns='urn:cryonline:k01'>" " <gameroom_open" " room_name='Room' team_id='0' status='%d'" " class_id='%d' room_type='%d' private='1'" " mission='%s' inventory_slot='0'>" " </gameroom_open>" "</query>", GAMEROOM_UNREADY, session.profile.curr_class, type, mission_key); }
void xmpp_iq_send_invitation(const char *nickname, enum e_notif_type type) { xmpp_send_iq_get( JID_MS(session.online.channel), NULL, NULL, "<query xmlns='urn:cryonline:k01'>" "<send_invitation target='%s' type='%d'/>" "</query>", nickname, type); }
void xmpp_iq_missions_get_list(f_missions_get_list_cb fun, void *args) { struct cb_args *a = calloc(1, sizeof (struct cb_args)); a->fun = fun; a->args = args; xmpp_send_iq_get( JID_MS(session.online.channel), xmpp_iq_missions_get_list_cb, a, "<query xmlns='urn:cryonline:k01'>" " <missions_get_list/>" "</query>", NULL); }
void xmpp_iq_gameroom_update_pvp(const char *mission_key, enum pvp_mode flags, int max_players, int inventory_slot, f_gameroom_update_pvp_cb cb, void *args) { if (mission_key == NULL) return; struct cb_args *a = calloc(1, sizeof (struct cb_args)); a->cb = cb; a->args = args; xmpp_send_iq_get( JID_MS(session.online.channel), xmpp_iq_gameroom_update_pvp_cb, a, "<query xmlns='urn:cryonline:k01'>" " <gameroom_update_pvp by_mission_key='1' mission_key='%s'" " private='%d'" " friendly_fire='%d'" " enemy_outlines='%d'" " auto_team_balance='%d'" " dead_can_chat='%d'" " join_in_the_process='%d'" " max_players='%d' inventory_slot='%d'>" " <class_rifleman enabled='1' class_id='0'/>" " <class_engineer enabled='1' class_id='4'/>" " <class_medic enabled='1' class_id='3'/>" " <class_sniper enabled='1' class_id='2'/>" " </gameroom_update_pvp>" "</query>", mission_key, flags & PVP_PRIVATE ? 1 : 0, flags & PVP_FRIENDLY_FIRE ? 1 : 0, flags & PVP_ENEMY_OUTLINES ? 1 : 0, flags & PVP_AUTOBALANCE ? 1 : 0, flags & PVP_DEADCHAT ? 1 : 0, flags & PVP_ALLOWJOIN ? 1 : 0, max_players, inventory_slot); }
void xmpp_iq_get_achievements(const char *profile_id, f_id_callback cb, void *args) { struct cb_args *a = calloc(1, sizeof (struct cb_args)); a->cb = cb; a->args = args; xmpp_send_iq_get( JID_MS(session.online.channel), xmpp_iq_get_achievements_cb, a, "<query xmlns='urn:cryonline:k01'>" "<get_achievements>" "<achievement profile_id='%s'/>" "</get_achievements>" "</query>", profile_id); }
static void _xmpp_iq_gameroom_quickplay(const char *uid, const char *mission_key, enum e_room_type type, const char *game_mode, int channel_switches, int tries, f_gameroom_quickplay_cb cb, void *args) { if (uid == NULL) return; char *query_mode; if (type == ROOM_PVE_QUICKPLAY) { if (mission_key == NULL) return; FORMAT(query_mode, "mission_id='%s' missions_hash='%i' content_hash='%i'", mission_key, session.wf.missions.hash, session.wf.missions.content_hash); } else if (type == ROOM_PVP_RATING) { query_mode = strdup("mission_id='' game_mode=''"); } else if (mission_key != NULL) { FORMAT(query_mode, "mission_id='%s'", mission_key); } else if (game_mode != NULL) { FORMAT(query_mode, "game_mode='%s'", game_mode); } else return; struct cb_args *a = calloc(1, sizeof (struct cb_args)); a->uid = strdup(uid); a->cb = cb; a->args = args; a->tries = tries; a->channel_switches = channel_switches; a->type = type; if (mission_key != NULL) a->mission_key = strdup(mission_key); if (game_mode != NULL) a->game_mode = strdup(game_mode); char *player_group = strdup(""); if (session.quickplay.group != NULL) { list_foreach(session.quickplay.group, (f_list_callback) _concat_players, &player_group); } /* Request a new game room */ xmpp_send_iq_get( JID_MS(session.online.channel), xmpp_iq_gameroom_quickplay_cb, a, "<query xmlns='urn:cryonline:k01'>" " <gameroom_quickplay" " team_id='0' status='%d'" " class_id='%d' room_type='%d'" " channel_switches='%d' uid='%s' timestamp='0'" " %s>" " <group>%s</group>" " </gameroom_quickplay>" "</query>", GAMEROOM_READY, session.profile.curr_class, type, channel_switches, uid, query_mode, player_group); free(query_mode); free(player_group); }
void cmd_randombox(const char *name, unsigned int count) { init_rb_items(); if (name == NULL) { xprintf("Random boxes available:\n"); unsigned int i = 0; for (; i < sizeof (random_box_items) / sizeof (random_box_items[0]); ++i) { if (random_box_items[i].shop_id != 0) { const struct shop_offer *o = list_get(session.wf.shop_offers, random_box_items[i].shop_name); if (o == NULL) continue; const char *currency = ""; unsigned int price = 0; if (o->price.cry.curr != 0) { currency = "K"; price = o->price.cry.curr; } else if (o->price.crown.curr != 0) { currency = "crown"; price = o->price.crown.curr; } else if (o->price.game.curr != 0) { currency = "wfd"; price = o->price.game.curr; } else if (o->price.key.curr != 0) { currency = " key"; price = o->price.key.curr; } xprintf(" - %11s %u %s\n", random_box_items[i].name, price, currency); } } return; } if (count <= 0 || count > 5) { eprintf("Invalid amount\n"); return; } unsigned int rid = 0; unsigned int i = 0; for (; i < sizeof (random_box_items) / sizeof (random_box_items[0]); ++i) { if (strcmp(name, random_box_items[i].name) == 0 || strcmp(name, random_box_items[i].shop_name) == 0) { rid = random_box_items[i].shop_id; break; } } if (rid == 0) { eprintf("Unknown randombox\n"); return; } { char *offers = NULL; unsigned int i = 0; for (; i < count; ++i) { char *s; FORMAT(s, "%s<offer id='%d'/>", offers ? offers : "", rid + i); free(offers); offers = s; } xmpp_send_iq_get( JID_MS(session.online.channel), _randombox_cb, NULL, "<query xmlns='urn:cryonline:k01'>" "<shop_buy_multiple_offer supplier_id='1'>" "%s" "</shop_buy_multiple_offer>" "</query>", offers); free(offers); } }