Jump to content

backtea

Members
  • Posts

    56
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    indonesia
  • Interests
    Coding...

Contact Methods

Recent Profile Visitors

2364 profile views

backtea's Achievements

Poring

Poring (1/15)

  • Dedicated
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

1

Reputation

  1. charm's ?? what's that? can you descrip more?
  2. hey please help.. i got this error when try to compile the server 1>------ Build started: Project: map-server_sql, Configuration: Debug Win32 ------ 1> faction.c 1>d:\campur\coba server\rathena 16433\src\map\faction.c(439): error C2143: syntax error : missing ')' before 'constant' 1>d:\campur\coba server\rathena 16433\src\map\faction.c(439): error C2059: syntax error : ')' here's my faction.c // Ñèñòåìà ôðàêöèé (c) Lilith // Íå êîïèðîâàòü, íå èçìåíÿòü è íå îïóáëèêîâûâàòü áåç ðàçðåøåíèÿ #include "../common/db.h" #include "../common/malloc.h" #include "../common/socket.h" #include "../common/showmsg.h" #include "../common/strlib.h" #include "../common/nullpo.h" #include "faction.h" #include "elemental.h" #include "homunculus.h" #include "map.h" #include "mercenary.h" #include "mob.h" #include "npc.h" #include "pc.h" #include "pet.h" #include "skill.h" #include "script.h" #include <stdlib.h> static DBMap* faction_db; static DBMap* aura_db; int faction_get_exp(struct map_session_data *sd,struct map_session_data *tsd) { struct faction_data* db, *t_db; db = faction_search(sd->status.faction_id); t_db = faction_search(tsd->status.faction_id); if( db == NULL || t_db == NULL ) return 0; return 0; } // Àóðà ìàñòåðà ôðàêöèè ( àíàëîã àóðû ãëàâû ãèëüäèè ) void faction_factionaura(struct map_session_data *sd) { struct skill_unit_group* group = NULL; if( sd->sc.data[sC_FACTION_AURA] && (group = skill_id2group(sd->sc.data[sC_FACTION_AURA]->val4)) ) { skill_delunitgroup(group); status_change_end(&sd->bl,SC_FACTION_AURA,INVALID_TIMER); } group = skill_unitsetting(&sd->bl,FACTION_AURA,1,sd->bl.x,sd->bl.y,0); if( group ) sc_start4(&sd->bl,SC_FACTION_AURA,100,1,group->faction_id,0,group->group_id,600000); return; } // Îòîáðàæåíèå çíà÷êà áèòâû íàä ãîëîâîé void faction_sendemblem_area(struct map_session_data *sd) { struct faction_data* db = faction_search(sd->status.faction_id); unsigned char buf[33]; nullpo_retv(sd); WBUFW(buf, 0) = 0x2dd; WBUFL(buf,2) = sd->bl.id; safestrncpy((char*)WBUFP(buf,6), sd->status.name, NAME_LENGTH); WBUFW(buf,30) = ( db->alliance_id ? db->alliance_id : sd->status.faction_id ); clif_send(buf,packet_len(0x2dd), &sd->bl, AREA); } // Îòîáðàæåíèå çíà÷êà áèòâû íàä ãîëîâîé void faction_sendemblem_single(int fd, struct map_session_data *sd) { struct faction_data* db = faction_search(sd->status.faction_id); nullpo_retv(sd); WFIFOHEAD(fd,32); WFIFOW(fd,0) = 0x2dd; WFIFOL(fd,2) = sd->bl.id; safestrncpy((char*)WFIFOP(fd,6), sd->status.name, NAME_LENGTH); WFIFOW(fd,30) = ( db->alliance_id ? db->alliance_id : sd->status.faction_id ); WFIFOSET(fd,packet_len(0x2dd)); } // Îòîáðàæåíèå àóðû íîñèòåëÿ void faction_aura_load(struct map_session_data *tsd, struct map_session_data *sd) { struct faction_data* db = faction_search(tsd->status.faction_id); struct aura_data* a_db = aura_search(tsd->status.faction_id); int e1,e2,e3; if( pc_ishiding(tsd) || !map[tsd->bl.m].flag.fvf || a_db == NULL ) return; if( (e1 = a_db->effect_1) ) clif_specialeffect_single(&tsd->bl, e1, sd->fd); // Ýôôåêò #1 if( (e2 = a_db->effect_2) ) clif_specialeffect_single(&tsd->bl, e2, sd->fd); // Ýôôåêò #2 if( (e3 = a_db->effect_3) ) clif_specialeffect_single(&tsd->bl, e3, sd->fd); // Ýôôåêò #3 } // Îòîáðàæåíèå àóðû âñåì â çîíå type void faction_aura_send(struct map_session_data *sd, enum send_target type) { struct faction_data* db = faction_search(sd->status.faction_id); struct aura_data* a_db = aura_search(sd->status.faction_id); int e1,e2,e3; if( pc_ishiding(sd) || !map[sd->bl.m].flag.fvf || a_db == NULL ) return; if( (e1 = a_db->effect_1) ) clif_specialeffect(&sd->bl, e1, type); // Ýôôåêò #1 if( (e2 = a_db->effect_2) ) clif_specialeffect(&sd->bl, e2, type); // Ýôôåêò #2 if( (e3 = a_db->effect_3) ) clif_specialeffect(&sd->bl, e3, type); // Ýôôåêò #3 } // Ñîêðûòèå àóðû íîñèòåëÿ ( åñëè íîñèòåëü â õàéäå) int faction_aura_update(struct block_list *bl,va_list ap) { struct block_list *tbl = va_arg(ap,struct block_list*); struct map_session_data *sd = BL_CAST(BL_PC,bl); if( bl == tbl || tbl->type != BL_PC || !sd ) return 0; clif_getareachar_unit(sd,tbl); return 0; } // Ðàñ÷¸ò óðîíà íà òåððèòîðèè âîéíû ôðàêöèé int faction_calc_damage(struct block_list *src, struct block_list *bl, int damage, int div_, int skill_num, int skill_lv, int flag) { if( damage ) switch( skill_num ) { case PA_PRESSURE: case HW_GRAVITATION: case NJ_ZENYNAGE: break; default: if( flag&BF_SKILL ) { if( flag&BF_WEAPON ) damage = damage * battle_config.fvf_weapon_damage_rate/100; if( flag&BF_MAGIC ) damage = damage * battle_config.fvf_magic_damage_rate/100; if( flag&BF_MISC ) damage = damage * battle_config.fvf_misc_damage_rate/100; } else { if( flag&BF_SHORT ) damage = damage * battle_config.fvf_short_damage_rate/100; if( flag&BF_LONG ) damage = damage * battle_config.fvf_long_damage_rate/100; } if( !damage ) damage = 1; } return damage; } // Ïðèñâàèâàíèå âèçóàëüíîãî ðàçìåðà â çàâèñèìîñòè îò ëîêàöèè void faction_display_size(struct map_session_data *sd) { struct faction_data* db = faction_search(sd->status.faction_id); if( db ) { if( map[sd->bl.m].flag.fvf ) sd->state.size = db->size; else { sd->state.size = (sd->class_&JOBL_BABY)?1:0; if (battle_config.character_size && pc_isriding(sd)) { if (sd->class_&JOBL_BABY) { if (battle_config.character_size&SZ_BIG) sd->state.size++; } else if(battle_config.character_size&SZ_MEDIUM) sd->state.size++; } } } } // Îòîáðàæåíèå HP ïåðñîíàæåé îäíîé ôðàêöèè void faction_show_hp(struct map_session_data *sd) { unsigned char buf[34]; const int cmd = 0x2e0; nullpo_retv(sd); WBUFW(buf,0) = cmd; WBUFL(buf,2) = sd->status.account_id; memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH); if( sd->battle_status.max_hp > INT16_MAX ) { WBUFW(buf,30) = sd->battle_status.hp/(sd->battle_status.max_hp/100); WBUFW(buf,32) = 100; } else { WBUFW(buf,30) = sd->battle_status.hp; WBUFW(buf,32) = sd->battle_status.max_hp; } clif_send(buf, packet_len(cmd), &sd->bl, FACTION_AREA_WOS); } // Ïîèñê ID ôðàêöèè struct faction_data* faction_search(int id) { return (struct faction_data*)idb_get(faction_db,id); } // Ïîèñê ID àóðû struct aura_data* aura_search(int id) { return (struct aura_data*)idb_get(aura_db,id); } // Âîçâðàùåíèå ID ôðàêöèè int faction_get_id(struct block_list* bl) { if( bl ) switch( bl->type ) { case BL_PC: // Èãðîê return ((TBL_PC*)bl)->status.faction_id; case BL_PET: // Ïèòîìåö if( ((TBL_PET*)bl)->msd ) return ((TBL_PET*)bl)->msd->status.faction_id; break; case BL_MOB: // Ìîíñòð { struct map_session_data *msd; struct mob_data *md = (TBL_MOB*)bl; if( md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL ) return msd->status.faction_id; return md->faction_id; } case BL_HOM: // Ãîìóíêóëóñ if( ((TBL_HOM*)bl)->master ) return ((TBL_HOM*)bl)->master->status.faction_id; break; case BL_MER: // Íà¸ìíèê if( ((TBL_MER*)bl)->master ) return ((TBL_MER*)bl)->master->status.faction_id; break; case BL_ELEM: // Ýëåìåíòàëü if( ((TBL_ELEM*)bl)->master ) return ((TBL_ELEM*)bl)->master->status.faction_id; break; case BL_SKILL: // Íàâûê return ((TBL_SKILL*)bl)->group->faction_id; } return 0; } // Ïðîâåðêà íà àëüÿíñ int faction_check_alliance(struct block_list* bl, struct block_list* t_bl) { struct faction_data* db, *t_db; db = faction_search(faction_get_id(bl)); t_db = faction_search(faction_get_id(t_bl)); if( db == NULL || t_db == NULL ) return 0; if( db->alliance_id > 0 && db->alliance_id == t_db->alliance_id ) return 1; return 0; } // Ïðèñâàèâàíèå ðàñû, ýåëåìåíòà, óð. ýëåìåíòà, ðàçìåðà è îïðåäåë¸ííîãî áîíóñà void faction_calc(struct map_session_data *sd) { struct status_data *status = &sd->base_status; struct status_change *sc = &sd->sc; struct faction_data* db; if( (db = faction_search(sd->status.faction_id)) == NULL ) return; status->race = db->race; // Ðàñà status->def_ele = db->ele; // Ýëåìåíò status->ele_lv = db->ele_lvl; // Óðîâåíü ýëåìåíòà status->size = db->size; // Ðàçìåð if( db->script ) run_script(db->script,0,sd->bl.id,0); // Áîíóñ if( sc && sc->data[sC_FACTION_AURA] && sc->data[sC_FACTION_AURA]->val2 ) { struct faction_data* mdb = faction_search(sc->data[sC_FACTION_AURA]->val2); if( mdb->aura_bonus ) run_script(mdb->aura_bonus,0,sd->bl.id,0); // Áîíóñ àóðû } { struct item_data *item_data; int i; for( i = 0; i < MAX_RELIC; i++ ) { if( (item_data = itemdb_exists(db->relic[i])) ) { if( item_data->script ) run_script(item_data->script,0,sd->bl.id,0); // Áîíóñ ðåëèêâèè } } } } // ×òåíèå ôàéëà êîíôèãóðàöèè // <ID>,<Íàçâàíèå ôðàêöèè>,<Ðàñà>,<Ýëåìåíò>,<Óðîâåíü ýëåìåíòà>,<Ðàçìåð>,<ID Àëüÿíñà>,<ID Àóðû>,<Öâåò ñîîáùåíèé â ÷àòå>,<{ Áîíóñ }>,<{ Áîíóñ àóðû }> static int faction_readdb(void) { struct faction_data* db; const char* filename = "faction_db.txt"; uint32 lines = 0, count = 0; char line[1024], path[256]; FILE* fp; sprintf(path, "%s/%s", db_path, filename); if((fp = fopen(path, "r")) == NULL ) { ShowWarning("faction_readdb: Ôàéë íå íàéäåí \"%s\", ïðîïóñê.\n", path); return 0; } while(fgets(line, sizeof(line), fp)) { char *str[32], *p; int i, id, race, ele, ele_lvl, all_id, aura, size; unsigned long chat_color; lines++; if(line[0] == '/' && line[1] == '/') continue; memset(str, 0, sizeof(str)); p = line; while( ISSPACE(*p) ) ++p; if( *p == '\0' ) continue; for( i = 0; i < 9; ++i ) { str[i] = p; p = strchr(p,','); if( p == NULL ) break; *p = '\0'; ++p; } if( p == NULL ) { ShowError("faction_readdb: Ïóñòûå ïîëÿ â ñòðîêå %d ôàéëà \"%s\" (ðàñà %d), ïðîïóñê.\n", lines, path, atoi(str[0])); continue; } // Óíèêàëüíûé ID id = atoi(str[0]); if( id < 1 || id > MAX_FACTION ) { ShowError("faction_readdb : Íåâåðíûé ID ôðàêöèè %d.\n", id); continue; } else if( faction_search(id) ) { ShowError("faction_readdb : Äóáëèðîâàíèå ID %d, ñòðîêà %d.\n", id, lines); continue; } // Ðàñà race = atoi(str[2]); if( race < RC_FORMLESS || race > RC_DRAGON ) { ShowError("faction_readdb : Íåèçâåñòíàÿ ðàñà %d.\n", race); continue; } // Ýëåìåíò ele = atoi(str[3]); if( ele < ELE_NEUTRAL || ele > ELE_UNDEAD ) { ShowError("faction_readdb : Íåèçâåñòíûé ýëåìåíò %d.\n", ele); continue; } // Óðîâåíü ýëåìåíòà ele_lvl = atoi(str[4]); if( ele_lvl < 1 || ele_lvl > 4 ) { ShowError("faction_readdb : Íåâåðíûé óðîâåíü ýëåìåíòà %d.\n", ele_lvl); continue; } // Ðàçìåð size = atoi(str[5]); if( size < 0 || size > 2 ) { ShowError("faction_readdb : Íåâåðíûé ðàçìåð %d.\n", size); continue; } // ID àëüÿíñà all_id = atoi(str[6]); if( all_id < 0 ) { ShowError("faction_readdb : Íåâåðíûé ID àëüÿíñà %d\n", all_id); continue; } all_id += MIN_FACTION_ALLIANCE; // ID àóðû aura = atoi(str[7]); if( aura < 0 ) { ShowError("faction_readdb : Íåâåðíûé ID àóðû %d.\n", aura); continue; } // Öâåò ñîîáùåíèé â ÷àòå chat_color = strtoul(str[8],NULL,0); // RGB -> BGR chat_color = (chat_color&0x0000FF)<<16|(chat_color&0x00FF00)|(chat_color&0xFF0000)>>16; // Áîíóñ if( *p != '{' ) { ShowError("faction_readdb: Íåâåðíûé ôîðìàò (Ïîëå áîíóñà) â ñòðîêå %d ôàéëà \"%s\" (ðàñà %d), ïðîïóñê.\n", lines, path, atoi(str[0])); continue; } str[9] = p; p = strstr(p+1,"},"); if( p == NULL ) { ShowError("faction_readdb: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0])); continue; } p[1] = '\0'; p += 2; // Áîíóñ àóðû if( *p != '{' ) { ShowError("faction_readdb: Invalid format (OnUnequip_Script column) in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0])); continue; } str[10] = p; p = strstr(p+1,"}"); if ( strchr(p,',') != NULL ) { ShowError("faction_readdb: Extra columns in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0])); continue; } CREATE(db,struct faction_data,1); // Ñîçäàíèå db->id = id; // Óíèêàëüíûé ID safestrncpy(db->name,str[1],sizeof(db->name)); // Íàçâàíèå ôðàêöèè db->race = race; // Ðàñà db->ele = ele; // Ýëåìåíò db->ele_lvl = ele_lvl; // Óðîâåíü ýëåìåíòà db->size = size; // Ðàçìåð db->alliance_id = all_id; // ID àëüÿíñà db->aura_id = aura; // ID àóðû db->chat_color = chat_color; // Öâåò ñîîáùåíèé â ÷àòå db->script = parse_script(str[9],path,lines,0); // Áîíóñ db->aura_bonus = parse_script(str[10],path,lines,0); // Áîíóñ àóðû idb_put(faction_db,id,db); // Ñîõðàíåíèå count++; } fclose(fp); ShowStatus("Çàêîí÷åíî ÷òåíèå '"CL_WHITE"%lu"CL_RESET"' ñòðîê â ôàéëå '"CL_WHITE"%s"CL_RESET"'.\n", count, filename); return 0; } // ×òåíèå ôàéëà êîíôèãóðàöèè // <ID àóðû>,<ýôôåêò #1>,<ýôôåêò #2>,<ýôôåêò #3> static int faction_readauradb(void) { struct aura_data* db; const char* filename = "faction_aura_db.txt"; uint32 lines = 0, count = 0; char line[1024], path[256]; FILE* fp; sprintf(path, "%s/%s", db_path, filename); if((fp = fopen(path, "r")) == NULL ) { ShowWarning("faction_readauradb: Ôàéë íå íàéäåí \"%s\", ïðîïóñê.\n", path); return 0; } while(fgets(line, sizeof(line), fp)) { char *str[32], *p; int i, id; lines++; if(line[0] == '/' && line[1] == '/') continue; memset(str, 0, sizeof(str)); p = line; while( ISSPACE(*p) ) ++p; if( *p == '\0' ) continue; for( i = 0; i < 3; ++i ) { str[i] = p; p = strchr(p,','); if( p == NULL ) break; *p = '\0'; ++p; } if( p == NULL ) { ShowError("faction_readauradb: Ïóñòûå ïîëÿ â ñòðîêå %d ôàéëà \"%s\" (ID: %d), ïðîïóñê.\n", lines, path, atoi(str[0])); continue; } // Óíèêàëüíûé ID id = atoi(str[0]); if( id < 1 ) { ShowError("faction_readauradb : Íåâåðíûé ID àóðû %d.\n", id); continue; } else if( aura_search(id) ) { ShowError("faction_readauradb : Äóáëèðîâàíèå ID %d, ñòðîêà %d.\n", id, lines); continue; } str[3] = p; CREATE(db,struct aura_data,1); // Ñîçäàíèå db->id = id; // Óíèêàëüíûé ID db->effect_1 = atoi(str[1]); // Ýôôåêò #1 db->effect_2 = atoi(str[2]); // Ýôôåêò #2 db->effect_3 = atoi(str[3]); // Ýôôåêò #3 idb_put(aura_db,id,db); // Ñîõðàíåíèå count++; } fclose(fp); ShowStatus("Çàêîí÷åíî ÷òåíèå '"CL_WHITE"%lu"CL_RESET"' ñòðîê â ôàéëå '"CL_WHITE"%s"CL_RESET"'.\n", count, filename); return 0; } // Î÷èñòêà ïàìÿòè static int faction_db_destroy(DBKey key, DBData *data, va_list ap) { struct faction_data *db = (struct faction_data*)data; if( db->script ) { script_free_code(db->script); db->script = NULL; } return 0; } // Çàãðóçêà ñèñòåìû ôðàêöèé void do_init_faction(void) { faction_db = idb_alloc(DB_OPT_BASE); aura_db = idb_alloc(DB_OPT_BASE); faction_readdb(); // ×òåíèå äàííûõ î ôðàêöèÿõ faction_readauradb(); // ×òåíèå äàííûõ îá àóðàõ } // Î÷èñòêà ïàìÿòè void do_final_faction(void) { faction_db->destroy(faction_db,faction_db_destroy); aura_db->destroy(aura_db,NULL); }
  3. bump..anyone have simple script like this?
  4. already done patch it, but seem's it's not working..anyone have simple script about this topic?
  5. i don't know how to manually patch it..coz it's seems different lines in my src folder... can any one help me to manually patch it? bump
  6. sorry i'am nubie when i follow this http://rathena.org/wiki/Diff Windows: 1. go place the folder in the index folder 2. richt click the *.diff file and go to TortoiseSVN menu 3. click patch i get this message D:\Beginer athena' is not working copy where i should path the patch file? in src folder or in index folder?
  7. where i must put the clan.diff?
  8. how about the npc? i mean where i must put the clan.diff? how to player to choose the clan?
  9. can anybody help me? the script is like, when you talk to npc you will give 2 choice 1. Elf clan 2. Dwarf clan when you choose Elf clan, that clan will give you matk+100 mdef-30 and when you choose Dwarf clan, that clan will give you atk+100 def-30 can anyone help me? thx for your help
  10. bump..i need to when uneequip
  11. i saw http://www.eathena.ws/board/index.php?showtopic=217704&st=0 is that still work?
  12. no..the castle not owned by any guild... so how to disable some castle for my WOE?
  13. hi all could you help me with my emperium... my emperium always show even i use npc woe...and i can't disable all castle from woe time... how to fix this? please help
  14. it's already, but the script error when i attack the monster it's said arround this line OnDo: callfunc "Minner",1; end;
×
×
  • Create New...