本文整理汇总了C++中idb_get函数的典型用法代码示例。如果您正苦于以下问题:C++ idb_get函数的具体用法?C++ idb_get怎么用?C++ idb_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了idb_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: itemdb_search
/*==========================================
* Loads an item from the db. If not found, it will return the dummy item.
*------------------------------------------*/
struct item_data* itemdb_search(int nameid)
{
struct item_data* id;
if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) )
id = itemdb_array[nameid];
else
id = (struct item_data*)idb_get(itemdb_other, nameid);
if( id == NULL )
{
ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", nameid);
id = &dummy_item;
dummy_item.nameid = nameid;
}
return id;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:19,代码来源:itemdb.c
示例2: account_db_txt_load_num
/// retrieve data from db and store it in the provided data structure
static bool account_db_txt_load_num(AccountDB* self, struct mmo_account* acc, const int account_id)
{
AccountDB_TXT* db = (AccountDB_TXT*)self;
DBMap* accounts = db->accounts;
// retrieve data
struct mmo_account* tmp = idb_get(accounts, account_id);
if( tmp == NULL )
{// entry not found
return false;
}
// store it
memcpy(acc, tmp, sizeof(struct mmo_account));
return true;
}
开发者ID:KimKyung-wook,项目名称:ilathena-project,代码行数:18,代码来源:account_txt.c
示例3: mapif_parse_BreakGuild
// ギルド解散要求
int mapif_parse_BreakGuild(int fd, int guild_id) {
struct guild *g;
g = idb_get(guild_db, guild_id);
if(g == NULL)
return 0;
guild_db->foreach(guild_db, guild_break_sub, guild_id);
inter_guild_storage_delete(guild_id);
mapif_guild_broken(guild_id, 0);
if(log_inter)
inter_log("guild %s (id=%d) broken" RETCODE, g->name, guild_id);
idb_remove(guild_db, guild_id);
return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:18,代码来源:int_guild.c
示例4: mapif_parse_PartyChangeOption
// パ?ティ?設定?更要求
int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) {
struct party_data *p;
int flag = 0;
p = idb_get(party_db, party_id);
if (p == NULL)
return 0;
p->party.exp = exp;
if (exp>0 && !party_check_exp_share(p)) {
flag |= 0x01;
p->party.exp = 0;
}
p->party.item = item&0x3;
mapif_party_optionchanged(fd, &p->party, account_id, flag);
return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:18,代码来源:int_party.c
示例5: mapif_parse_GuildSkillUp
// ギルドスキルアップ要求
int mapif_parse_GuildSkillUp(int fd, int guild_id, int skill_num, int account_id) {
struct guild *g = idb_get(guild_db, guild_id);
int idx = skill_num - GD_SKILLBASE;
if (g == NULL || idx < 0 || idx >= MAX_GUILDSKILL)
return 0;
if (g->skill_point > 0 && g->skill[idx].id > 0 && g->skill[idx].lv < 10) {
g->skill[idx].lv++;
g->skill_point--;
if (guild_calcinfo(g) == 0)
mapif_guild_info(-1, g);
mapif_guild_skillupack(guild_id, skill_num, account_id);
}
return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:18,代码来源:int_guild.c
示例6: chlogif_parse_ackchangesex
int chlogif_parse_ackchangesex(int fd, struct char_session_data* sd)
{
if (RFIFOREST(fd) < 7)
return 0;
else {
unsigned char buf[7];
int acc = RFIFOL(fd,2);
int sex = RFIFOB(fd,6);
RFIFOSKIP(fd,7);
if (acc > 0) { // TODO: Is this even possible?
unsigned char i;
int char_id = 0, class_ = 0, guild_id = 0;
DBMap* auth_db = char_get_authdb();
struct auth_node* node = (struct auth_node*)idb_get(auth_db, acc);
SqlStmt *stmt;
if (node != NULL)
node->sex = sex;
// get characters
stmt = SqlStmt_Malloc(sql_handle);
if (SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `char_id`, `class`, `guild_id` FROM `%s` WHERE `account_id` = '%d'", schema_config.char_db, acc) || SqlStmt_Execute(stmt)) {
SqlStmt_ShowDebug(stmt);
SqlStmt_Free(stmt);
}
SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &char_id, 0, NULL, NULL);
SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &class_, 0, NULL, NULL);
SqlStmt_BindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, NULL, NULL);
for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i) {
chlogif_parse_change_sex_sub(sex, acc, char_id, class_, guild_id);
}
SqlStmt_Free(stmt);
}
// notify all mapservers about this change
WBUFW(buf,0) = 0x2b0d;
WBUFL(buf,2) = acc;
WBUFB(buf,6) = sex;
chmapif_sendall(buf, 7);
}
return 1;
}
开发者ID:Atemo,项目名称:rathena,代码行数:45,代码来源:char_logif.cpp
示例7: mapif_parse_WisReply
// Wisp/page transmission result
int mapif_parse_WisReply(int fd)
{
int id, flag;
struct WisData *wd;
id = RFIFOL(fd,2);
flag = RFIFOB(fd,6);
wd = (struct WisData*)idb_get(wis_db, id);
if (wd == NULL)
return 0; // This wisp was probably suppress before, because it was timeout of because of target was found on another map-server
if ((--wd->count) <= 0 || flag != 1) {
mapif_wis_end(wd, flag); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
idb_remove(wis_db, id);
}
return 0;
}
开发者ID:BlazingSpear,项目名称:Hercules,代码行数:19,代码来源:inter.c
示例8: check_ttl_wisdata
int check_ttl_wisdata(void) {
unsigned long tick = gettick();
int i;
do {
wis_delnum = 0;
wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick);
for(i = 0; i < wis_delnum; i++) {
struct WisData *wd = idb_get(wis_db, wis_dellist[i]);
ShowWarning("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst);
// removed. not send information after a timeout. Just no answer for the player
//mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
idb_remove(wis_db, wd->id);
}
} while(wis_delnum >= WISDELLIST_MAX);
return 0;
}
开发者ID:mleo1,项目名称:Ragnarok-OldTimes,代码行数:18,代码来源:inter.c
示例9: itemdb_load
/*==========================================
* Loads (and creates if not found) an item from the db.
*------------------------------------------*/
struct item_data* itemdb_load(int nameid)
{
struct item_data *id;
if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) ) {
id = itemdb_array[nameid];
if( id == NULL || id == &dummy_item )
id = itemdb_array[nameid] = create_item_data(nameid);
return id;
}
id = (struct item_data*)idb_get(itemdb_other, nameid);
if( id == NULL || id == &dummy_item ) {
id = create_item_data(nameid);
idb_put(itemdb_other, nameid, id);
}
return id;
}
开发者ID:icxbb-xx,项目名称:trunk,代码行数:21,代码来源:itemdb.c
示例10: party_booking_update
void party_booking_update (struct map_session_data *sd, short *job)
{
int i;
struct party_booking_ad_info *pb_ad;
pb_ad = (struct party_booking_ad_info *) idb_get (party_booking_db, sd->status.char_id);
if (pb_ad == NULL)
return;
pb_ad->starttime = (int) time (NULL); // Update time.
for (i = 0; i < PARTY_BOOKING_JOBS; i++)
if (job[i] != 0xFF)
pb_ad->p_detail.job[i] = job[i];
else pb_ad->p_detail.job[i] = -1;
clif_PartyBookingUpdateNotify (sd, pb_ad);
}
开发者ID:Celso1415,项目名称:Fusion,代码行数:18,代码来源:party.c
示例11: chmapif_parse_authok
/**
* Player Requesting char-select from map_serv
* @param fd: wich fd to parse from
* @return : 0 not enough data received, 1 success
*/
int chmapif_parse_authok(int fd){
if( RFIFOREST(fd) < 19 )
return 0;
else{
uint32 account_id = RFIFOL(fd,2);
uint32 login_id1 = RFIFOL(fd,6);
uint32 login_id2 = RFIFOL(fd,10);
uint32 ip = RFIFOL(fd,14);
int version = RFIFOB(fd,18);
RFIFOSKIP(fd,19);
if( runflag != CHARSERVER_ST_RUNNING ){
chmapif_charselres(fd,account_id,0);
}else{
struct auth_node* node;
DBMap* auth_db = char_get_authdb();
DBMap* online_char_db = char_get_onlinedb();
// create temporary auth entry
CREATE(node, struct auth_node, 1);
node->account_id = account_id;
node->char_id = 0;
node->login_id1 = login_id1;
node->login_id2 = login_id2;
//node->sex = 0;
node->ip = ntohl(ip);
node->version = version; //upd version for mapserv
//node->expiration_time = 0; // unlimited/unknown time by default (not display in map-server)
//node->gmlevel = 0;
idb_put(auth_db, account_id, node);
//Set char to "@ char select" in online db [Kevin]
char_set_charselect(account_id);
{
struct online_char_data* character = (struct online_char_data*)idb_get(online_char_db, account_id);
if( character != NULL ){
character->pincode_success = true;
}
}
chmapif_charselres(fd,account_id,1);
}
}
return 1;
}
开发者ID:Insswer,项目名称:rathena,代码行数:49,代码来源:char_mapif.c
示例12: check_ttl_wisdata
int check_ttl_wisdata(void)
{
int64 tick = gettick();
int i;
do {
wis_delnum = 0;
wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick);
for(i = 0; i < wis_delnum; i++) {
struct WisData *wd = (struct WisData *)idb_get(wis_db, wis_dellist[i]);
ShowWarning(read_message("Source.char.inter_checkttlwisdata"), wd->id, wd->src, wd->dst);
// removed. not send information after a timeout. Just no answer for the player
//mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
idb_remove(wis_db, wd->id);
}
} while(wis_delnum >= WISDELLIST_MAX);
return 0;
}
开发者ID:TidusBR,项目名称:brAthena-Old,代码行数:19,代码来源:inter.c
示例13: mapif_parse_PartyLeaderChange
int mapif_parse_PartyLeaderChange(int fd,int party_id,int account_id,int char_id)
{
struct party_data *p;
int i;
p = idb_get(party_db, party_id);
if (p == NULL)
return 0;
for (i = 0; i < MAX_PARTY; i++)
{
if(p->party.member[i].leader)
p->party.member[i].leader = 0;
if(p->party.member[i].account_id == account_id &&
p->party.member[i].char_id == char_id)
p->party.member[i].leader = 1;
}
return 1;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:19,代码来源:int_party.c
示例14: mapif_parse_GuildLeave
// Delete member from guild
int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes)
{
int i, j;
struct guild* g = (struct guild*)idb_get(guild_db, guild_id);
if( g == NULL )
{
//TODO
return 0;
}
// Find the member
ARR_FIND( 0, g->max_member, i, g->member[i].account_id == account_id && g->member[i].char_id == char_id );
if( i == g->max_member )
{
//TODO
return 0;
}
if( flag )
{ // 追放の場合追放リストに入れる
ARR_FIND( 0, MAX_GUILDEXPULSION, j, g->expulsion[j].account_id == 0 );
if (j == MAX_GUILDEXPULSION)
{ // 一杯なので古いのを消す
for(j = 0; j < MAX_GUILDEXPULSION - 1; j++)
g->expulsion[j] = g->expulsion[j+1];
j = MAX_GUILDEXPULSION - 1;
}
// Save the expulsion entry
g->expulsion[j].account_id = account_id;
safestrncpy(g->expulsion[j].name, g->member[i].name, NAME_LENGTH);
safestrncpy(g->expulsion[j].mes, mes, 40);
}
mapif_guild_withdraw(guild_id, account_id, char_id, flag, g->member[i].name, mes);
memset(&g->member[i], 0, sizeof(struct guild_member));
if (guild_check_empty(g) == 0)
mapif_guild_info(-1,g);// まだ人がいるのでデ??送信
return 0;
}
开发者ID:KimKyung-wook,项目名称:ilathena-project,代码行数:44,代码来源:int_guild.c
示例15: mapif_load_pet
int mapif_load_pet(int fd,int account_id,int char_id,int pet_id)
{
struct s_pet *p;
p = (struct s_pet*)idb_get(pet_db,pet_id);
if(p!=NULL) {
if(p->incuvate == 1) {
p->account_id = p->char_id = 0;
mapif_pet_info(fd,account_id,p);
}
else if(account_id == p->account_id && char_id == p->char_id)
mapif_pet_info(fd,account_id,p);
else
mapif_pet_noinfo(fd,account_id);
}
else
mapif_pet_noinfo(fd,account_id);
return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:19,代码来源:int_pet.c
示例16: mapif_parse_GuildCastleDataLoad
int mapif_parse_GuildCastleDataLoad(int fd, int castle_id, int index) {
struct guild_castle *gc = idb_get(castle_db, castle_id);
if (gc == NULL) {
return mapif_guild_castle_dataload(castle_id, 0, 0);
}
switch(index) {
case 1: return mapif_guild_castle_dataload(gc->castle_id, index, gc->guild_id);
case 2: return mapif_guild_castle_dataload(gc->castle_id, index, gc->economy);
case 3: return mapif_guild_castle_dataload(gc->castle_id, index, gc->defense);
case 4: return mapif_guild_castle_dataload(gc->castle_id, index, gc->triggerE);
case 5: return mapif_guild_castle_dataload(gc->castle_id, index, gc->triggerD);
case 6: return mapif_guild_castle_dataload(gc->castle_id, index, gc->nextTime);
case 7: return mapif_guild_castle_dataload(gc->castle_id, index, gc->payTime);
case 8: return mapif_guild_castle_dataload(gc->castle_id, index, gc->createTime);
case 9: return mapif_guild_castle_dataload(gc->castle_id, index, gc->visibleC);
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
return mapif_guild_castle_dataload(gc->castle_id, index, gc->guardian[index-10].visible);
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
return mapif_guild_castle_dataload(gc->castle_id, index, gc->guardian[index-18].hp); // end additions [Valaris]
default:
ShowError("mapif_parse_GuildCastleDataLoad ERROR!! (Not found index=%d)\n", index);
return 0;
}
return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:42,代码来源:int_guild.c
示例17: mapif_parse_GuildChangeMemberInfoShort
// オンライン/Lv更新
int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_)
{
struct guild *g;
int i, sum, c;
g = (struct guild*)idb_get(guild_db, guild_id);
if (g == NULL)
return 0;
ARR_FIND( 0, g->max_member, i, g->member[i].account_id == account_id && g->member[i].char_id == char_id );
if( i < g->max_member )
{
g->member[i].online = online;
g->member[i].lv = lv;
g->member[i].class_ = class_;
mapif_guild_memberinfoshort(g, i);
}
g->average_lv = 0;
g->connect_member = 0;
c = 0; // member count
sum = 0; // total sum of base levels
for(i = 0; i < g->max_member; i++)
{
if( g->member[i].account_id > 0 )
{
sum += g->member[i].lv;
c++;
}
if( g->member[i].online )
g->connect_member++;
}
if( c ) // this check should always succeed...
g->average_lv = sum / c;
//FIXME: how about sending a mapif_guild_info() update to the mapserver? [ultramage]
return 0;
}
开发者ID:KimKyung-wook,项目名称:ilathena-project,代码行数:42,代码来源:int_guild.c
示例18: mapif_parse_GuildLeave
// ギルド脱退/追放要求
int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes) {
struct guild *g = NULL;
int i, j;
g = idb_get(guild_db, guild_id);
if (g != NULL) {
for(i = 0; i < MAX_GUILD; i++) {
if (g->member[i].account_id == account_id && g->member[i].char_id == char_id) {
// printf("%d %d\n", i, (int)(&g->member[i]));
// printf("%d %s\n", i, g->member[i].name);
if (flag) { // 追放の場合追放リストに入れる
for(j = 0; j < MAX_GUILDEXPULSION; j++) {
if (g->expulsion[j].account_id == 0)
break;
}
if (j == MAX_GUILDEXPULSION) { // 一杯なので古いのを消す
for(j = 0; j < MAX_GUILDEXPULSION - 1; j++)
g->expulsion[j] = g->expulsion[j+1];
j = MAX_GUILDEXPULSION - 1;
}
g->expulsion[j].account_id = account_id;
memcpy(g->expulsion[j].acc, "dummy", NAME_LENGTH-1);
memcpy(g->expulsion[j].name, g->member[i].name, NAME_LENGTH-1);
memcpy(g->expulsion[j].mes, mes, 40);
}
mapif_guild_leaved(guild_id, account_id, char_id, flag, g->member[i].name, mes);
// printf("%d %d\n", i, (int)(&g->member[i]));
// printf("%d %s\n", i, (&g->member[i])->name);
memset(&g->member[i], 0, sizeof(struct guild_member));
if (guild_check_empty(g) == 0)
mapif_guild_info(-1,g);// まだ人がいるのでデータ送信
return 0;
}
}
}
return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:42,代码来源:int_guild.c
示例19: logchrif_parse_pincode_authfail
/**
* PIN Code was incorrectly entered too many times.
* @param fd: fd to parse from (char-serv)
* @return 0 fail (packet does not have enough data), 1 success (continue parsing)
*/
int logchrif_parse_pincode_authfail(int fd){
if( RFIFOREST(fd) < 6 )
return 0;
else{
struct mmo_account acc;
AccountDB* accounts = login_get_accounts_db();
if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ){
struct online_login_data* ld;
ld = (struct online_login_data*)idb_get(online_db,acc.account_id);
if( ld == NULL )
return 0;
login_log( host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed" );
}
login_remove_online_user(acc.account_id);
RFIFOSKIP(fd,6);
}
return 1;
}
开发者ID:RadianFord,项目名称:rAthena,代码行数:26,代码来源:loginchrif.cpp
示例20: chmapif_parse_reqsavechar
/**
* Map-serv request to save mmo_char_status in sql
* Receive character data from map-server for saving
* @param fd: wich fd to parse from
* @param id: wich map_serv id
* @return : 0 not enough data received, 1 success
*/
int chmapif_parse_reqsavechar(int fd, int id){
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
return 0;
{
int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2);
struct online_char_data* character;
DBMap* online_char_db = char_get_onlinedb();
if (size - 13 != sizeof(struct mmo_charstatus))
{
ShowError("parse_from_map (save-char): Size mismatch! %d != %d\n", size-13, sizeof(struct mmo_charstatus));
RFIFOSKIP(fd,size);
return 1;
}
//Check account only if this ain't final save. Final-save goes through because of the char-map reconnect
if (RFIFOB(fd,12) || RFIFOB(fd,13) || (
(character = (struct online_char_data*)idb_get(online_char_db, aid)) != NULL &&
character->char_id == cid))
{
struct mmo_charstatus char_dat;
memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus));
char_mmo_char_tosql(cid, &char_dat);
} else { //This may be valid on char-server reconnection, when re-sending characters that already logged off.
ShowError("parse_from_map (save-char): Received data for non-existant/offline character (%d:%d).\n", aid, cid);
char_set_char_online(id, cid, aid);
}
if (RFIFOB(fd,12))
{ //Flag, set character offline after saving. [Skotlex]
char_set_char_offline(cid, aid);
WFIFOHEAD(fd,10);
WFIFOW(fd,0) = 0x2b21; //Save ack only needed on final save.
WFIFOL(fd,2) = aid;
WFIFOL(fd,6) = cid;
WFIFOSET(fd,10);
}
RFIFOSKIP(fd,size);
}
return 1;
}
开发者ID:Oranji-Aka,项目名称:rathena,代码行数:47,代码来源:char_mapif.c
注:本文中的idb_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论