|
@@ -73,8 +73,7 @@ unsigned short guild_flags_count;
|
|
/*==========================================
|
|
/*==========================================
|
|
* Retrieves and validates the sd pointer for this guild member [Skotlex]
|
|
* Retrieves and validates the sd pointer for this guild member [Skotlex]
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-static TBL_PC* guild_sd_check(int guild_id, int account_id, int char_id)
|
|
|
|
-{
|
|
|
|
|
|
+static TBL_PC* guild_sd_check(int guild_id, int account_id, int char_id) {
|
|
TBL_PC* sd = map_id2sd(account_id);
|
|
TBL_PC* sd = map_id2sd(account_id);
|
|
|
|
|
|
if (!(sd && sd->status.char_id == char_id))
|
|
if (!(sd && sd->status.char_id == char_id))
|
|
@@ -90,8 +89,7 @@ static TBL_PC* guild_sd_check(int guild_id, int account_id, int char_id)
|
|
}
|
|
}
|
|
|
|
|
|
// Modified [Komurka]
|
|
// Modified [Komurka]
|
|
-int guild_skill_get_max (int id)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_skill_get_max (int id) {
|
|
if (id < GD_SKILLBASE || id >= GD_SKILLBASE+MAX_GUILDSKILL)
|
|
if (id < GD_SKILLBASE || id >= GD_SKILLBASE+MAX_GUILDSKILL)
|
|
return 0;
|
|
return 0;
|
|
return guild_skill_tree[id-GD_SKILLBASE].max;
|
|
return guild_skill_tree[id-GD_SKILLBASE].max;
|
|
@@ -109,15 +107,13 @@ int guild_checkskill(struct guild *g, int id) {
|
|
/*==========================================
|
|
/*==========================================
|
|
* guild_skill_tree.txt reading - from jA [Komurka]
|
|
* guild_skill_tree.txt reading - from jA [Komurka]
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-static bool guild_read_guildskill_tree_db(char* split[], int columns, int current)
|
|
|
|
-{// <skill id>,<max lv>,<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>
|
|
|
|
|
|
+static bool guild_read_guildskill_tree_db(char* split[], int columns, int current) {// <skill id>,<max lv>,<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>
|
|
int k, id, skill_id;
|
|
int k, id, skill_id;
|
|
|
|
|
|
skill_id = atoi(split[0]);
|
|
skill_id = atoi(split[0]);
|
|
id = skill_id - GD_SKILLBASE;
|
|
id = skill_id - GD_SKILLBASE;
|
|
|
|
|
|
- if( id < 0 || id >= MAX_GUILDSKILL )
|
|
|
|
- {
|
|
|
|
|
|
+ if( id < 0 || id >= MAX_GUILDSKILL ) {
|
|
ShowWarning("guild_read_guildskill_tree_db: Invalid skill id %d.\n", skill_id);
|
|
ShowWarning("guild_read_guildskill_tree_db: Invalid skill id %d.\n", skill_id);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -125,13 +121,11 @@ static bool guild_read_guildskill_tree_db(char* split[], int columns, int curren
|
|
guild_skill_tree[id].id = skill_id;
|
|
guild_skill_tree[id].id = skill_id;
|
|
guild_skill_tree[id].max = atoi(split[1]);
|
|
guild_skill_tree[id].max = atoi(split[1]);
|
|
|
|
|
|
- if( guild_skill_tree[id].id == GD_GLORYGUILD && battle_config.require_glory_guild && guild_skill_tree[id].max == 0 )
|
|
|
|
- {// enable guild's glory when required for emblems
|
|
|
|
|
|
+ if( guild_skill_tree[id].id == GD_GLORYGUILD && battle_config.require_glory_guild && guild_skill_tree[id].max == 0 ) {// enable guild's glory when required for emblems
|
|
guild_skill_tree[id].max = 1;
|
|
guild_skill_tree[id].max = 1;
|
|
}
|
|
}
|
|
|
|
|
|
- for( k = 0; k < MAX_GUILD_SKILL_REQUIRE; k++ )
|
|
|
|
- {
|
|
|
|
|
|
+ for( k = 0; k < MAX_GUILD_SKILL_REQUIRE; k++ ) {
|
|
guild_skill_tree[id].need[k].id = atoi(split[k*2+2]);
|
|
guild_skill_tree[id].need[k].id = atoi(split[k*2+2]);
|
|
guild_skill_tree[id].need[k].lv = atoi(split[k*2+3]);
|
|
guild_skill_tree[id].need[k].lv = atoi(split[k*2+3]);
|
|
}
|
|
}
|
|
@@ -142,8 +136,7 @@ static bool guild_read_guildskill_tree_db(char* split[], int columns, int curren
|
|
/*==========================================
|
|
/*==========================================
|
|
* Guild skill check - from jA [Komurka]
|
|
* Guild skill check - from jA [Komurka]
|
|
*------------------------------------------*/
|
|
*------------------------------------------*/
|
|
-int guild_check_skill_require(struct guild *g,int id)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_check_skill_require(struct guild *g,int id) {
|
|
int i;
|
|
int i;
|
|
int idx = id-GD_SKILLBASE;
|
|
int idx = id-GD_SKILLBASE;
|
|
|
|
|
|
@@ -162,8 +155,7 @@ int guild_check_skill_require(struct guild *g,int id)
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
-static bool guild_read_castledb(char* str[], int columns, int current)
|
|
|
|
-{// <castle id>,<map name>,<castle name>,<castle event>[,<reserved/unused switch flag>]
|
|
|
|
|
|
+static bool guild_read_castledb(char* str[], int columns, int current) {// <castle id>,<map name>,<castle name>,<castle event>[,<reserved/unused switch flag>]
|
|
struct guild_castle *gc;
|
|
struct guild_castle *gc;
|
|
int mapindex = mapindex_name2id(str[1]);
|
|
int mapindex = mapindex_name2id(str[1]);
|
|
|
|
|
|
@@ -181,19 +173,16 @@ static bool guild_read_castledb(char* str[], int columns, int current)
|
|
}
|
|
}
|
|
|
|
|
|
/// lookup: guild id -> guild*
|
|
/// lookup: guild id -> guild*
|
|
-struct guild* guild_search(int guild_id)
|
|
|
|
-{
|
|
|
|
|
|
+struct guild* guild_search(int guild_id) {
|
|
return (struct guild*)idb_get(guild_db,guild_id);
|
|
return (struct guild*)idb_get(guild_db,guild_id);
|
|
}
|
|
}
|
|
|
|
|
|
/// lookup: guild name -> guild*
|
|
/// lookup: guild name -> guild*
|
|
-struct guild* guild_searchname(char* str)
|
|
|
|
-{
|
|
|
|
|
|
+struct guild* guild_searchname(char* str) {
|
|
struct guild* g;
|
|
struct guild* g;
|
|
DBIterator *iter = db_iterator(guild_db);
|
|
DBIterator *iter = db_iterator(guild_db);
|
|
|
|
|
|
- for( g = dbi_first(iter); dbi_exists(iter); g = dbi_next(iter) )
|
|
|
|
- {
|
|
|
|
|
|
+ for( g = dbi_first(iter); dbi_exists(iter); g = dbi_next(iter) ) {
|
|
if( strcmpi(g->name, str) == 0 )
|
|
if( strcmpi(g->name, str) == 0 )
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -203,19 +192,16 @@ struct guild* guild_searchname(char* str)
|
|
}
|
|
}
|
|
|
|
|
|
/// lookup: castle id -> castle*
|
|
/// lookup: castle id -> castle*
|
|
-struct guild_castle* guild_castle_search(int gcid)
|
|
|
|
-{
|
|
|
|
|
|
+struct guild_castle* guild_castle_search(int gcid) {
|
|
return (struct guild_castle*)idb_get(castle_db,gcid);
|
|
return (struct guild_castle*)idb_get(castle_db,gcid);
|
|
}
|
|
}
|
|
|
|
|
|
/// lookup: map index -> castle*
|
|
/// lookup: map index -> castle*
|
|
-struct guild_castle* guild_mapindex2gc(short mapindex)
|
|
|
|
-{
|
|
|
|
|
|
+struct guild_castle* guild_mapindex2gc(short mapindex) {
|
|
struct guild_castle* gc;
|
|
struct guild_castle* gc;
|
|
DBIterator *iter = db_iterator(castle_db);
|
|
DBIterator *iter = db_iterator(castle_db);
|
|
|
|
|
|
- for( gc = dbi_first(iter); dbi_exists(iter); gc = dbi_next(iter) )
|
|
|
|
- {
|
|
|
|
|
|
+ for( gc = dbi_first(iter); dbi_exists(iter); gc = dbi_next(iter) ) {
|
|
if( gc->mapindex == mapindex )
|
|
if( gc->mapindex == mapindex )
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -225,13 +211,11 @@ struct guild_castle* guild_mapindex2gc(short mapindex)
|
|
}
|
|
}
|
|
|
|
|
|
/// lookup: map name -> castle*
|
|
/// lookup: map name -> castle*
|
|
-struct guild_castle* guild_mapname2gc(const char* mapname)
|
|
|
|
-{
|
|
|
|
|
|
+struct guild_castle* guild_mapname2gc(const char* mapname) {
|
|
return guild_mapindex2gc(mapindex_name2id(mapname));
|
|
return guild_mapindex2gc(mapindex_name2id(mapname));
|
|
}
|
|
}
|
|
|
|
|
|
-struct map_session_data* guild_getavailablesd(struct guild* g)
|
|
|
|
-{
|
|
|
|
|
|
+struct map_session_data* guild_getavailablesd(struct guild* g) {
|
|
int i;
|
|
int i;
|
|
|
|
|
|
nullpo_retr(NULL, g);
|
|
nullpo_retr(NULL, g);
|
|
@@ -241,8 +225,7 @@ struct map_session_data* guild_getavailablesd(struct guild* g)
|
|
}
|
|
}
|
|
|
|
|
|
/// lookup: player AID/CID -> member index
|
|
/// lookup: player AID/CID -> member index
|
|
-int guild_getindex(struct guild *g,int account_id,int char_id)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_getindex(struct guild *g,int account_id,int char_id) {
|
|
int i;
|
|
int i;
|
|
|
|
|
|
if( g == NULL )
|
|
if( g == NULL )
|
|
@@ -253,8 +236,7 @@ int guild_getindex(struct guild *g,int account_id,int char_id)
|
|
}
|
|
}
|
|
|
|
|
|
/// lookup: player sd -> member position
|
|
/// lookup: player sd -> member position
|
|
-int guild_getposition(struct guild* g, struct map_session_data* sd)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_getposition(struct guild* g, struct map_session_data* sd) {
|
|
int i;
|
|
int i;
|
|
|
|
|
|
if( g == NULL && (g=sd->guild) == NULL )
|
|
if( g == NULL && (g=sd->guild) == NULL )
|
|
@@ -265,8 +247,7 @@ int guild_getposition(struct guild* g, struct map_session_data* sd)
|
|
}
|
|
}
|
|
|
|
|
|
//Creation of member information
|
|
//Creation of member information
|
|
-void guild_makemember(struct guild_member *m,struct map_session_data *sd)
|
|
|
|
-{
|
|
|
|
|
|
+void guild_makemember(struct guild_member *m,struct map_session_data *sd) {
|
|
nullpo_retv(sd);
|
|
nullpo_retv(sd);
|
|
|
|
|
|
memset(m,0,sizeof(struct guild_member));
|
|
memset(m,0,sizeof(struct guild_member));
|
|
@@ -317,8 +298,7 @@ int guild_payexp_timer_sub(DBKey key, DBData *data, va_list ap) {
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int guild_payexp_timer(int tid, unsigned int tick, int id, intptr_t data)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_payexp_timer(int tid, unsigned int tick, int id, intptr_t data) {
|
|
guild_expcache_db->clear(guild_expcache_db,guild_payexp_timer_sub);
|
|
guild_expcache_db->clear(guild_expcache_db,guild_payexp_timer_sub);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -327,22 +307,20 @@ int guild_payexp_timer(int tid, unsigned int tick, int id, intptr_t data)
|
|
* Taken from party_send_xy_timer_sub. [Skotlex]
|
|
* Taken from party_send_xy_timer_sub. [Skotlex]
|
|
* @see DBApply
|
|
* @see DBApply
|
|
*/
|
|
*/
|
|
-int guild_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_send_xy_timer_sub(DBKey key, DBData *data, va_list ap) {
|
|
struct guild *g = db_data2ptr(data);
|
|
struct guild *g = db_data2ptr(data);
|
|
int i;
|
|
int i;
|
|
|
|
|
|
nullpo_ret(g);
|
|
nullpo_ret(g);
|
|
|
|
|
|
- if( !g->connect_member )
|
|
|
|
- {// no members connected to this guild so do not iterate
|
|
|
|
|
|
+ if( !g->connect_member ) {
|
|
|
|
+ // no members connected to this guild so do not iterate
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
for(i=0;i<g->max_member;i++){
|
|
for(i=0;i<g->max_member;i++){
|
|
struct map_session_data* sd = g->member[i].sd;
|
|
struct map_session_data* sd = g->member[i].sd;
|
|
- if( sd != NULL && sd->fd && (sd->guild_x != sd->bl.x || sd->guild_y != sd->bl.y) && !sd->bg_id )
|
|
|
|
- {
|
|
|
|
|
|
+ if( sd != NULL && sd->fd && (sd->guild_x != sd->bl.x || sd->guild_y != sd->bl.y) && !sd->bg_id ) {
|
|
clif_guild_xy(sd);
|
|
clif_guild_xy(sd);
|
|
sd->guild_x = sd->bl.x;
|
|
sd->guild_x = sd->bl.x;
|
|
sd->guild_y = sd->bl.y;
|
|
sd->guild_y = sd->bl.y;
|
|
@@ -352,22 +330,19 @@ int guild_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
|
|
}
|
|
}
|
|
|
|
|
|
//Code from party_send_xy_timer [Skotlex]
|
|
//Code from party_send_xy_timer [Skotlex]
|
|
-static int guild_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data)
|
|
|
|
-{
|
|
|
|
|
|
+static int guild_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data) {
|
|
guild_db->foreach(guild_db,guild_send_xy_timer_sub,tick);
|
|
guild_db->foreach(guild_db,guild_send_xy_timer_sub,tick);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int guild_send_dot_remove(struct map_session_data *sd)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_send_dot_remove(struct map_session_data *sd) {
|
|
if (sd->status.guild_id)
|
|
if (sd->status.guild_id)
|
|
clif_guild_xy_remove(sd);
|
|
clif_guild_xy_remove(sd);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
//------------------------------------------------------------------------
|
|
//------------------------------------------------------------------------
|
|
|
|
|
|
-int guild_create(struct map_session_data *sd, const char *name)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_create(struct map_session_data *sd, const char *name) {
|
|
char tname[NAME_LENGTH];
|
|
char tname[NAME_LENGTH];
|
|
struct guild_member m;
|
|
struct guild_member m;
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
@@ -378,13 +353,13 @@ int guild_create(struct map_session_data *sd, const char *name)
|
|
if( !tname[0] )
|
|
if( !tname[0] )
|
|
return 0; // empty name
|
|
return 0; // empty name
|
|
|
|
|
|
- if( sd->status.guild_id )
|
|
|
|
- {// already in a guild
|
|
|
|
|
|
+ if( sd->status.guild_id ) {
|
|
|
|
+ // already in a guild
|
|
clif_guild_created(sd,1);
|
|
clif_guild_created(sd,1);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
- if( battle_config.guild_emperium_check && pc_search_inventory(sd,ITEMID_EMPERIUM) == -1 )
|
|
|
|
- {// item required
|
|
|
|
|
|
+ if( battle_config.guild_emperium_check && pc_search_inventory(sd,ITEMID_EMPERIUM) == -1 ) {
|
|
|
|
+ // item required
|
|
clif_guild_created(sd,3);
|
|
clif_guild_created(sd,3);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -396,8 +371,7 @@ int guild_create(struct map_session_data *sd, const char *name)
|
|
}
|
|
}
|
|
|
|
|
|
//Whether or not to create guild
|
|
//Whether or not to create guild
|
|
-int guild_created(int account_id,int guild_id)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_created(int account_id,int guild_id) {
|
|
struct map_session_data *sd=map_id2sd(account_id);
|
|
struct map_session_data *sd=map_id2sd(account_id);
|
|
|
|
|
|
if(sd==NULL)
|
|
if(sd==NULL)
|
|
@@ -415,24 +389,20 @@ int guild_created(int account_id,int guild_id)
|
|
}
|
|
}
|
|
|
|
|
|
//Information request
|
|
//Information request
|
|
-int guild_request_info(int guild_id)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_request_info(int guild_id) {
|
|
return intif_guild_request_info(guild_id);
|
|
return intif_guild_request_info(guild_id);
|
|
}
|
|
}
|
|
|
|
|
|
//Information request with event
|
|
//Information request with event
|
|
-int guild_npc_request_info(int guild_id,const char *event)
|
|
|
|
-{
|
|
|
|
- if( guild_search(guild_id) )
|
|
|
|
- {
|
|
|
|
|
|
+int guild_npc_request_info(int guild_id,const char *event) {
|
|
|
|
+ if( guild_search(guild_id) ) {
|
|
if( event && *event )
|
|
if( event && *event )
|
|
npc_event_do(event);
|
|
npc_event_do(event);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
- if( event && *event )
|
|
|
|
- {
|
|
|
|
|
|
+ if( event && *event ) {
|
|
struct eventlist *ev;
|
|
struct eventlist *ev;
|
|
DBData prev;
|
|
DBData prev;
|
|
ev=(struct eventlist *)aCalloc(sizeof(struct eventlist),1);
|
|
ev=(struct eventlist *)aCalloc(sizeof(struct eventlist),1);
|
|
@@ -446,8 +416,7 @@ int guild_npc_request_info(int guild_id,const char *event)
|
|
}
|
|
}
|
|
|
|
|
|
//Confirmation of the character belongs to guild
|
|
//Confirmation of the character belongs to guild
|
|
-int guild_check_member(struct guild *g)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_check_member(struct guild *g) {
|
|
int i;
|
|
int i;
|
|
struct map_session_data *sd;
|
|
struct map_session_data *sd;
|
|
struct s_mapiterator* iter;
|
|
struct s_mapiterator* iter;
|
|
@@ -455,8 +424,7 @@ int guild_check_member(struct guild *g)
|
|
nullpo_ret(g);
|
|
nullpo_ret(g);
|
|
|
|
|
|
iter = mapit_getallusers();
|
|
iter = mapit_getallusers();
|
|
- for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
|
|
|
|
- {
|
|
|
|
|
|
+ for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) ) {
|
|
if( sd->status.guild_id != g->guild_id )
|
|
if( sd->status.guild_id != g->guild_id )
|
|
continue;
|
|
continue;
|
|
|
|
|
|
@@ -474,8 +442,7 @@ int guild_check_member(struct guild *g)
|
|
}
|
|
}
|
|
|
|
|
|
//Delete association with guild_id for all characters
|
|
//Delete association with guild_id for all characters
|
|
-int guild_recv_noinfo(int guild_id)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_recv_noinfo(int guild_id) {
|
|
struct map_session_data *sd;
|
|
struct map_session_data *sd;
|
|
struct s_mapiterator* iter;
|
|
struct s_mapiterator* iter;
|
|
|
|
|
|
@@ -490,8 +457,7 @@ int guild_recv_noinfo(int guild_id)
|
|
}
|
|
}
|
|
|
|
|
|
//Get and display information for all member
|
|
//Get and display information for all member
|
|
-int guild_recv_info(struct guild *sg)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_recv_info(struct guild *sg) {
|
|
struct guild *g,before;
|
|
struct guild *g,before;
|
|
int i,bm,m;
|
|
int i,bm,m;
|
|
DBData data;
|
|
DBData data;
|
|
@@ -636,8 +602,7 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
|
|
|
|
|
|
/// Guild invitation reply.
|
|
/// Guild invitation reply.
|
|
/// flag: 0:rejected, 1:accepted
|
|
/// flag: 0:rejected, 1:accepted
|
|
-int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag) {
|
|
struct map_session_data* tsd;
|
|
struct map_session_data* tsd;
|
|
|
|
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
@@ -650,33 +615,28 @@ int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag)
|
|
//NOTE: this can be NULL because the person might have logged off in the meantime
|
|
//NOTE: this can be NULL because the person might have logged off in the meantime
|
|
tsd = map_id2sd(sd->guild_invite_account);
|
|
tsd = map_id2sd(sd->guild_invite_account);
|
|
|
|
|
|
- if ( sd->status.guild_id > 0 ) // [Paradox924X]
|
|
|
|
- { // Already in another guild.
|
|
|
|
|
|
+ if ( sd->status.guild_id > 0 ) {
|
|
|
|
+ // [Paradox924X]
|
|
|
|
+ // Already in another guild.
|
|
if ( tsd ) clif_guild_inviteack(tsd,0);
|
|
if ( tsd ) clif_guild_inviteack(tsd,0);
|
|
return 0;
|
|
return 0;
|
|
- }
|
|
|
|
- else if( flag == 0 )
|
|
|
|
- {// rejected
|
|
|
|
|
|
+ } else if( flag == 0 ) {// rejected
|
|
sd->guild_invite = 0;
|
|
sd->guild_invite = 0;
|
|
sd->guild_invite_account = 0;
|
|
sd->guild_invite_account = 0;
|
|
if( tsd ) clif_guild_inviteack(tsd,1);
|
|
if( tsd ) clif_guild_inviteack(tsd,1);
|
|
- }
|
|
|
|
- else
|
|
|
|
- {// accepted
|
|
|
|
|
|
+ } else {// accepted
|
|
struct guild_member m;
|
|
struct guild_member m;
|
|
struct guild* g;
|
|
struct guild* g;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- if( (g=guild_search(guild_id)) == NULL )
|
|
|
|
- {
|
|
|
|
|
|
+ if( (g=guild_search(guild_id)) == NULL ) {
|
|
sd->guild_invite = 0;
|
|
sd->guild_invite = 0;
|
|
sd->guild_invite_account = 0;
|
|
sd->guild_invite_account = 0;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
ARR_FIND( 0, g->max_member, i, g->member[i].account_id == 0 );
|
|
ARR_FIND( 0, g->max_member, i, g->member[i].account_id == 0 );
|
|
- if( i == g->max_member )
|
|
|
|
- {
|
|
|
|
|
|
+ if( i == g->max_member ) {
|
|
sd->guild_invite = 0;
|
|
sd->guild_invite = 0;
|
|
sd->guild_invite_account = 0;
|
|
sd->guild_invite_account = 0;
|
|
if( tsd ) clif_guild_inviteack(tsd,3);
|
|
if( tsd ) clif_guild_inviteack(tsd,3);
|
|
@@ -695,8 +655,7 @@ int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag)
|
|
//- If guild is not in memory, it is requested
|
|
//- If guild is not in memory, it is requested
|
|
//- Otherwise sd pointer is set up.
|
|
//- Otherwise sd pointer is set up.
|
|
//- Player must be authed and must belong to a guild before invoking this method
|
|
//- Player must be authed and must belong to a guild before invoking this method
|
|
-void guild_member_joined(struct map_session_data *sd)
|
|
|
|
-{
|
|
|
|
|
|
+void guild_member_joined(struct map_session_data *sd) {
|
|
struct guild* g;
|
|
struct guild* g;
|
|
int i;
|
|
int i;
|
|
g=guild_search(sd->status.guild_id);
|
|
g=guild_search(sd->status.guild_id);
|
|
@@ -726,8 +685,7 @@ void guild_member_joined(struct map_session_data *sd)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Add a player to a given guild_id
|
|
* Add a player to a given guild_id
|
|
*----------------------------------------*/
|
|
*----------------------------------------*/
|
|
-int guild_member_added(int guild_id,int account_id,int char_id,int flag)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_member_added(int guild_id,int account_id,int char_id,int flag) {
|
|
struct map_session_data *sd= map_id2sd(account_id),*sd2;
|
|
struct map_session_data *sd= map_id2sd(account_id),*sd2;
|
|
struct guild *g;
|
|
struct guild *g;
|
|
|
|
|
|
@@ -774,8 +732,7 @@ int guild_member_added(int guild_id,int account_id,int char_id,int flag)
|
|
/*==========================================
|
|
/*==========================================
|
|
* Player request leaving a given guild_id
|
|
* Player request leaving a given guild_id
|
|
*----------------------------------------*/
|
|
*----------------------------------------*/
|
|
-int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) {
|
|
struct guild *g;
|
|
struct guild *g;
|
|
|
|
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
@@ -797,8 +754,7 @@ int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int c
|
|
/*==========================================
|
|
/*==========================================
|
|
* Request remove a player to a given guild_id
|
|
* Request remove a player to a given guild_id
|
|
*----------------------------------------*/
|
|
*----------------------------------------*/
|
|
-int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) {
|
|
struct map_session_data *tsd;
|
|
struct map_session_data *tsd;
|
|
struct guild *g;
|
|
struct guild *g;
|
|
int i,ps;
|
|
int i,ps;
|
|
@@ -830,8 +786,7 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, const char* name, const char* mes)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, const char* name, const char* mes) {
|
|
int i;
|
|
int i;
|
|
struct guild* g = guild_search(guild_id);
|
|
struct guild* g = guild_search(guild_id);
|
|
struct map_session_data* sd = map_charid2sd(char_id);
|
|
struct map_session_data* sd = map_charid2sd(char_id);
|
|
@@ -864,8 +819,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
|
|
clif_guild_memberlist(online_member_sd);
|
|
clif_guild_memberlist(online_member_sd);
|
|
|
|
|
|
// update char, if online
|
|
// update char, if online
|
|
- if(sd != NULL && sd->status.guild_id == guild_id)
|
|
|
|
- {
|
|
|
|
|
|
+ if(sd != NULL && sd->status.guild_id == guild_id) {
|
|
// do stuff that needs the guild_id first, BEFORE we wipe it
|
|
// do stuff that needs the guild_id first, BEFORE we wipe it
|
|
if (sd->state.storage_flag == 2) //Close the guild storage.
|
|
if (sd->state.storage_flag == 2) //Close the guild storage.
|
|
storage_guild_storageclose(sd);
|
|
storage_guild_storageclose(sd);
|
|
@@ -882,8 +836,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef BOUND_ITEMS
|
|
#ifdef BOUND_ITEMS
|
|
-void guild_retrieveitembound(int char_id,int aid,int guild_id)
|
|
|
|
-{
|
|
|
|
|
|
+void guild_retrieveitembound(int char_id,int aid,int guild_id) {
|
|
TBL_PC *sd = map_id2sd(aid);
|
|
TBL_PC *sd = map_id2sd(aid);
|
|
if(sd){ //Character is online
|
|
if(sd){ //Character is online
|
|
int idxlist[MAX_INVENTORY];
|
|
int idxlist[MAX_INVENTORY];
|
|
@@ -899,8 +852,7 @@ void guild_retrieveitembound(int char_id,int aid,int guild_id)
|
|
}
|
|
}
|
|
storage_guild_storageclose(sd); //Close and save the storage
|
|
storage_guild_storageclose(sd); //Close and save the storage
|
|
}
|
|
}
|
|
- }
|
|
|
|
- else { //Character is offline, ask char server to do the job
|
|
|
|
|
|
+ } else { //Character is offline, ask char server to do the job
|
|
struct guild_storage* stor = guild2storage2(guild_id);
|
|
struct guild_storage* stor = guild2storage2(guild_id);
|
|
struct guild *g = guild_search(guild_id);
|
|
struct guild *g = guild_search(guild_id);
|
|
nullpo_retv(g);
|
|
nullpo_retv(g);
|
|
@@ -917,8 +869,7 @@ void guild_retrieveitembound(int char_id,int aid,int guild_id)
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-int guild_send_memberinfoshort(struct map_session_data *sd,int online)
|
|
|
|
-{ // cleaned up [LuzZza]
|
|
|
|
|
|
+int guild_send_memberinfoshort(struct map_session_data *sd,int online) { // cleaned up [LuzZza]
|
|
struct guild *g;
|
|
struct guild *g;
|
|
|
|
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
@@ -941,8 +892,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
- if(sd->state.connect_new)
|
|
|
|
- { //Note that this works because it is invoked in parse_LoadEndAck before connect_new is cleared.
|
|
|
|
|
|
+ if(sd->state.connect_new) { //Note that this works because it is invoked in parse_LoadEndAck before connect_new is cleared.
|
|
clif_guild_belonginfo(sd,g);
|
|
clif_guild_belonginfo(sd,g);
|
|
clif_guild_notice(sd,g);
|
|
clif_guild_notice(sd,g);
|
|
sd->guild_emblem_id = g->emblem_id;
|
|
sd->guild_emblem_id = g->emblem_id;
|
|
@@ -950,8 +900,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_)
|
|
|
|
-{ // cleaned up [LuzZza]
|
|
|
|
|
|
+int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_) { // cleaned up [LuzZza]
|
|
|
|
|
|
int i,alv,c,idx=-1,om=0,oldonline=-1;
|
|
int i,alv,c,idx=-1,om=0,oldonline=-1;
|
|
struct guild *g = guild_search(guild_id);
|
|
struct guild *g = guild_search(guild_id);
|
|
@@ -1016,8 +965,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin
|
|
/*====================================================
|
|
/*====================================================
|
|
* Send a message to whole guild
|
|
* Send a message to whole guild
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_send_message(struct map_session_data *sd,const char *mes,int len)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_send_message(struct map_session_data *sd,const char *mes,int len) {
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
|
|
|
|
if(sd->status.guild_id==0)
|
|
if(sd->status.guild_id==0)
|
|
@@ -1034,8 +982,7 @@ int guild_send_message(struct map_session_data *sd,const char *mes,int len)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Guild receive a message, will be displayed to whole member
|
|
* Guild receive a message, will be displayed to whole member
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_recv_message(int guild_id,int account_id,const char *mes,int len)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_recv_message(int guild_id,int account_id,const char *mes,int len) {
|
|
struct guild *g;
|
|
struct guild *g;
|
|
if( (g=guild_search(guild_id))==NULL)
|
|
if( (g=guild_search(guild_id))==NULL)
|
|
return 0;
|
|
return 0;
|
|
@@ -1046,16 +993,14 @@ int guild_recv_message(int guild_id,int account_id,const char *mes,int len)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Member changing position in guild
|
|
* Member changing position in guild
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_change_memberposition(int guild_id,int account_id,int char_id,short idx)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_change_memberposition(int guild_id,int account_id,int char_id,short idx) {
|
|
return intif_guild_change_memberinfo(guild_id,account_id,char_id,GMI_POSITION,&idx,sizeof(idx));
|
|
return intif_guild_change_memberinfo(guild_id,account_id,char_id,GMI_POSITION,&idx,sizeof(idx));
|
|
}
|
|
}
|
|
|
|
|
|
/*====================================================
|
|
/*====================================================
|
|
* Notification of new position for member
|
|
* Notification of new position for member
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_memberposition_changed(struct guild *g,int idx,int pos)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_memberposition_changed(struct guild *g,int idx,int pos) {
|
|
nullpo_ret(g);
|
|
nullpo_ret(g);
|
|
|
|
|
|
g->member[idx].position=pos;
|
|
g->member[idx].position=pos;
|
|
@@ -1071,8 +1016,7 @@ int guild_memberposition_changed(struct guild *g,int idx,int pos)
|
|
* Change guild title or member
|
|
* Change guild title or member
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
int guild_change_position(int guild_id,int idx,
|
|
int guild_change_position(int guild_id,int idx,
|
|
- int mode,int exp_mode,const char *name)
|
|
|
|
-{
|
|
|
|
|
|
+ int mode,int exp_mode,const char *name) {
|
|
struct guild_position p;
|
|
struct guild_position p;
|
|
|
|
|
|
exp_mode = cap_value(exp_mode, 0, battle_config.guild_exp_limit);
|
|
exp_mode = cap_value(exp_mode, 0, battle_config.guild_exp_limit);
|
|
@@ -1087,8 +1031,7 @@ int guild_change_position(int guild_id,int idx,
|
|
/*====================================================
|
|
/*====================================================
|
|
* Notification of member has changed his guild title
|
|
* Notification of member has changed his guild title
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_position_changed(int guild_id,int idx,struct guild_position *p)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_position_changed(int guild_id,int idx,struct guild_position *p) {
|
|
struct guild *g=guild_search(guild_id);
|
|
struct guild *g=guild_search(guild_id);
|
|
int i;
|
|
int i;
|
|
if(g==NULL)
|
|
if(g==NULL)
|
|
@@ -1106,8 +1049,7 @@ int guild_position_changed(int guild_id,int idx,struct guild_position *p)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Change guild notice
|
|
* Change guild notice
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2) {
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
|
|
|
|
if(guild_id!=sd->status.guild_id)
|
|
if(guild_id!=sd->status.guild_id)
|
|
@@ -1118,8 +1060,7 @@ int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes
|
|
/*====================================================
|
|
/*====================================================
|
|
* Notification of guild has changed his notice
|
|
* Notification of guild has changed his notice
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_notice_changed(int guild_id,const char *mes1,const char *mes2)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_notice_changed(int guild_id,const char *mes1,const char *mes2) {
|
|
int i;
|
|
int i;
|
|
struct guild *g=guild_search(guild_id);
|
|
struct guild *g=guild_search(guild_id);
|
|
if(g==NULL)
|
|
if(g==NULL)
|
|
@@ -1139,8 +1080,7 @@ int guild_notice_changed(int guild_id,const char *mes1,const char *mes2)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Change guild emblem
|
|
* Change guild emblem
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_change_emblem(struct map_session_data *sd,int len,const char *data)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_change_emblem(struct map_session_data *sd,int len,const char *data) {
|
|
struct guild *g;
|
|
struct guild *g;
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
|
|
|
|
@@ -1156,8 +1096,7 @@ int guild_change_emblem(struct map_session_data *sd,int len,const char *data)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Notification of guild emblem changed
|
|
* Notification of guild emblem changed
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) {
|
|
int i;
|
|
int i;
|
|
struct map_session_data *sd;
|
|
struct map_session_data *sd;
|
|
struct guild *g=guild_search(guild_id);
|
|
struct guild *g=guild_search(guild_id);
|
|
@@ -1217,8 +1156,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
|
|
/**
|
|
/**
|
|
* @see DBCreateData
|
|
* @see DBCreateData
|
|
*/
|
|
*/
|
|
-static DBData create_expcache(DBKey key, va_list args)
|
|
|
|
-{
|
|
|
|
|
|
+static DBData create_expcache(DBKey key, va_list args) {
|
|
struct guild_expcache *c;
|
|
struct guild_expcache *c;
|
|
struct map_session_data *sd = va_arg(args, struct map_session_data*);
|
|
struct map_session_data *sd = va_arg(args, struct map_session_data*);
|
|
|
|
|
|
@@ -1233,8 +1171,7 @@ static DBData create_expcache(DBKey key, va_list args)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Return taxed experience from player sd to guild
|
|
* Return taxed experience from player sd to guild
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
|
|
|
|
-{
|
|
|
|
|
|
+unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) {
|
|
struct guild *g;
|
|
struct guild *g;
|
|
struct guild_expcache *c;
|
|
struct guild_expcache *c;
|
|
int per;
|
|
int per;
|
|
@@ -1269,8 +1206,7 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
|
|
* Add this experience to guild exp
|
|
* Add this experience to guild exp
|
|
* [Celest]
|
|
* [Celest]
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_getexp(struct map_session_data *sd,int exp)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_getexp(struct map_session_data *sd,int exp) {
|
|
struct guild_expcache *c;
|
|
struct guild_expcache *c;
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
|
|
|
|
@@ -1288,8 +1224,7 @@ int guild_getexp(struct map_session_data *sd,int exp)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Ask to increase guildskill skill_id
|
|
* Ask to increase guildskill skill_id
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_skillup(TBL_PC* sd, uint16 skill_id)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_skillup(TBL_PC* sd, uint16 skill_id) {
|
|
struct guild* g;
|
|
struct guild* g;
|
|
int idx = skill_id - GD_SKILLBASE;
|
|
int idx = skill_id - GD_SKILLBASE;
|
|
int max = guild_skill_get_max(skill_id);
|
|
int max = guild_skill_get_max(skill_id);
|
|
@@ -1312,8 +1247,7 @@ int guild_skillup(TBL_PC* sd, uint16 skill_id)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Notification of guildskill skill_id increase request
|
|
* Notification of guildskill skill_id increase request
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_skillupack(int guild_id,uint16 skill_id,int account_id)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_skillupack(int guild_id,uint16 skill_id,int account_id) {
|
|
struct map_session_data *sd=map_id2sd(account_id);
|
|
struct map_session_data *sd=map_id2sd(account_id);
|
|
struct guild *g=guild_search(guild_id);
|
|
struct guild *g=guild_search(guild_id);
|
|
int i;
|
|
int i;
|
|
@@ -1368,8 +1302,7 @@ void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint1
|
|
* 0 = allied
|
|
* 0 = allied
|
|
* 1 = enemy
|
|
* 1 = enemy
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_get_alliance_count(struct guild *g,int flag)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_get_alliance_count(struct guild *g,int flag) {
|
|
int i,c;
|
|
int i,c;
|
|
|
|
|
|
nullpo_ret(g);
|
|
nullpo_ret(g);
|
|
@@ -1383,8 +1316,7 @@ int guild_get_alliance_count(struct guild *g,int flag)
|
|
}
|
|
}
|
|
|
|
|
|
// Blocks all guild skills which have a common delay time.
|
|
// Blocks all guild skills which have a common delay time.
|
|
-void guild_block_skill(struct map_session_data *sd, int time)
|
|
|
|
-{
|
|
|
|
|
|
+void guild_block_skill(struct map_session_data *sd, int time) {
|
|
uint16 skill_id[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL };
|
|
uint16 skill_id[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL };
|
|
int i;
|
|
int i;
|
|
for (i = 0; i < 4; i++)
|
|
for (i = 0; i < 4; i++)
|
|
@@ -1398,8 +1330,7 @@ void guild_block_skill(struct map_session_data *sd, int time)
|
|
* 1 = enemy
|
|
* 1 = enemy
|
|
* Returns true if yes.
|
|
* Returns true if yes.
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_check_alliance(int guild_id1, int guild_id2, int flag)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_check_alliance(int guild_id1, int guild_id2, int flag) {
|
|
struct guild *g;
|
|
struct guild *g;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
@@ -1414,12 +1345,11 @@ int guild_check_alliance(int guild_id1, int guild_id2, int flag)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Player sd, asking player tsd an alliance between their 2 guilds
|
|
* Player sd, asking player tsd an alliance between their 2 guilds
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) {
|
|
struct guild *g[2];
|
|
struct guild *g[2];
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- if(agit_flag || agit2_flag) { // Disable alliance creation during woe [Valaris]
|
|
|
|
|
|
+ if(agit_flag || agit2_flag) { // Disable alliance creation during woe [Valaris]
|
|
clif_displaymessage(sd->fd,msg_txt(sd,676)); //"Alliances cannot be made during Guild Wars!"
|
|
clif_displaymessage(sd->fd,msg_txt(sd,676)); //"Alliances cannot be made during Guild Wars!"
|
|
return 0;
|
|
return 0;
|
|
} // end addition [Valaris]
|
|
} // end addition [Valaris]
|
|
@@ -1440,7 +1370,7 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
|
|
if(sd->status.guild_id == tsd->status.guild_id)
|
|
if(sd->status.guild_id == tsd->status.guild_id)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- if( guild_get_alliance_count(g[0],0) >= battle_config.max_guild_alliance ) {
|
|
|
|
|
|
+ if( guild_get_alliance_count(g[0],0) >= battle_config.max_guild_alliance ) {
|
|
clif_guild_allianceack(sd,4);
|
|
clif_guild_allianceack(sd,4);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -1472,8 +1402,7 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Player sd, answer to player tsd (account_id) for an alliance request
|
|
* Player sd, answer to player tsd (account_id) for an alliance request
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag) {
|
|
struct map_session_data *tsd;
|
|
struct map_session_data *tsd;
|
|
|
|
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
@@ -1533,8 +1462,7 @@ int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Player sd asking to break alliance with guild guild_id
|
|
* Player sd asking to break alliance with guild guild_id
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) {
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
|
|
|
|
if(agit_flag || agit2_flag) { // Disable alliance breaking during woe [Valaris]
|
|
if(agit_flag || agit2_flag) { // Disable alliance breaking during woe [Valaris]
|
|
@@ -1549,8 +1477,7 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Player sd, asking player tsd a formal enemy relation between their 2 guilds
|
|
* Player sd, asking player tsd a formal enemy relation between their 2 guilds
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd) {
|
|
struct guild *g;
|
|
struct guild *g;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
@@ -1623,13 +1550,10 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
|
|
}
|
|
}
|
|
|
|
|
|
if (!(flag & 0x08)) { // new relationship
|
|
if (!(flag & 0x08)) { // new relationship
|
|
- for(i=0;i<2-(flag&1);i++)
|
|
|
|
- {
|
|
|
|
- if(g[i]!=NULL)
|
|
|
|
- {
|
|
|
|
|
|
+ for(i=0;i<2-(flag&1);i++) {
|
|
|
|
+ if(g[i]!=NULL) {
|
|
ARR_FIND( 0, MAX_GUILDALLIANCE, j, g[i]->alliance[j].guild_id == 0 );
|
|
ARR_FIND( 0, MAX_GUILDALLIANCE, j, g[i]->alliance[j].guild_id == 0 );
|
|
- if( j < MAX_GUILDALLIANCE )
|
|
|
|
- {
|
|
|
|
|
|
+ if( j < MAX_GUILDALLIANCE ) {
|
|
g[i]->alliance[j].guild_id=guild_id[1-i];
|
|
g[i]->alliance[j].guild_id=guild_id[1-i];
|
|
memcpy(g[i]->alliance[j].name,guild_name[1-i],NAME_LENGTH);
|
|
memcpy(g[i]->alliance[j].name,guild_name[1-i],NAME_LENGTH);
|
|
g[i]->alliance[j].opposition=flag&1;
|
|
g[i]->alliance[j].opposition=flag&1;
|
|
@@ -1637,10 +1561,8 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else { // remove relationship
|
|
} else { // remove relationship
|
|
- for(i=0;i<2-(flag&1);i++)
|
|
|
|
- {
|
|
|
|
- if(g[i]!=NULL)
|
|
|
|
- {
|
|
|
|
|
|
+ for(i=0;i<2-(flag&1);i++) {
|
|
|
|
+ if(g[i]!=NULL) {
|
|
for(j=0;j<g[i]->max_member;j++) channel_pcquit(g[i]->member[j].sd,2); //leave all alliance chan
|
|
for(j=0;j<g[i]->max_member;j++) channel_pcquit(g[i]->member[j].sd,2); //leave all alliance chan
|
|
ARR_FIND( 0, MAX_GUILDALLIANCE, j, g[i]->alliance[j].guild_id == guild_id[1-i] && g[i]->alliance[j].opposition == (flag&1) );
|
|
ARR_FIND( 0, MAX_GUILDALLIANCE, j, g[i]->alliance[j].guild_id == guild_id[1-i] && g[i]->alliance[j].opposition == (flag&1) );
|
|
if( j < MAX_GUILDALLIANCE )
|
|
if( j < MAX_GUILDALLIANCE )
|
|
@@ -1677,8 +1599,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
|
|
* Notification for the guild disbanded
|
|
* Notification for the guild disbanded
|
|
* @see DBApply
|
|
* @see DBApply
|
|
*/
|
|
*/
|
|
-int guild_broken_sub(DBKey key, DBData *data, va_list ap)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_broken_sub(DBKey key, DBData *data, va_list ap) {
|
|
struct guild *g = db_data2ptr(data);
|
|
struct guild *g = db_data2ptr(data);
|
|
int guild_id=va_arg(ap,int);
|
|
int guild_id=va_arg(ap,int);
|
|
int i,j;
|
|
int i,j;
|
|
@@ -1723,8 +1644,7 @@ int castle_guild_broken_sub(DBKey key, DBData *data, va_list ap)
|
|
}
|
|
}
|
|
|
|
|
|
//Invoked on /breakguild "Guild name"
|
|
//Invoked on /breakguild "Guild name"
|
|
-int guild_broken(int guild_id,int flag)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_broken(int guild_id,int flag) {
|
|
struct guild *g = guild_search(guild_id);
|
|
struct guild *g = guild_search(guild_id);
|
|
int i;
|
|
int i;
|
|
|
|
|
|
@@ -1754,8 +1674,7 @@ int guild_broken(int guild_id,int flag)
|
|
}
|
|
}
|
|
|
|
|
|
//Changes the Guild Master to the specified player. [Skotlex]
|
|
//Changes the Guild Master to the specified player. [Skotlex]
|
|
-int guild_gm_change(int guild_id, struct map_session_data *sd)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_gm_change(int guild_id, struct map_session_data *sd) {
|
|
struct guild *g;
|
|
struct guild *g;
|
|
nullpo_ret(sd);
|
|
nullpo_ret(sd);
|
|
|
|
|
|
@@ -1775,8 +1694,7 @@ int guild_gm_change(int guild_id, struct map_session_data *sd)
|
|
}
|
|
}
|
|
|
|
|
|
//Notification from Char server that a guild's master has changed. [Skotlex]
|
|
//Notification from Char server that a guild's master has changed. [Skotlex]
|
|
-int guild_gm_changed(int guild_id, int account_id, int char_id)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_gm_changed(int guild_id, int account_id, int char_id) {
|
|
struct guild *g;
|
|
struct guild *g;
|
|
struct guild_member gm;
|
|
struct guild_member gm;
|
|
int pos, i;
|
|
int pos, i;
|
|
@@ -1815,10 +1733,8 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
|
|
}
|
|
}
|
|
|
|
|
|
// announce the change to all guild members
|
|
// announce the change to all guild members
|
|
- for( i = 0; i < g->max_member; i++ )
|
|
|
|
- {
|
|
|
|
- if( g->member[i].sd && g->member[i].sd->fd )
|
|
|
|
- {
|
|
|
|
|
|
+ for( i = 0; i < g->max_member; i++ ) {
|
|
|
|
+ if( g->member[i].sd && g->member[i].sd->fd ) {
|
|
clif_guild_basicinfo(g->member[i].sd);
|
|
clif_guild_basicinfo(g->member[i].sd);
|
|
clif_guild_memberlist(g->member[i].sd);
|
|
clif_guild_memberlist(g->member[i].sd);
|
|
}
|
|
}
|
|
@@ -1830,8 +1746,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Guild disbanded
|
|
* Guild disbanded
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-int guild_break(struct map_session_data *sd,char *name)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_break(struct map_session_data *sd,char *name) {
|
|
struct guild *g;
|
|
struct guild *g;
|
|
int i;
|
|
int i;
|
|
#ifdef BOUND_ITEMS
|
|
#ifdef BOUND_ITEMS
|
|
@@ -1873,8 +1788,7 @@ int guild_break(struct map_session_data *sd,char *name)
|
|
* Creates a list of guild castle IDs to be requested
|
|
* Creates a list of guild castle IDs to be requested
|
|
* from char-server.
|
|
* from char-server.
|
|
*/
|
|
*/
|
|
-void guild_castle_map_init(void)
|
|
|
|
-{
|
|
|
|
|
|
+void guild_castle_map_init(void) {
|
|
int num = db_size(castle_db);
|
|
int num = db_size(castle_db);
|
|
|
|
|
|
if (num > 0) {
|
|
if (num > 0) {
|
|
@@ -1903,8 +1817,7 @@ void guild_castle_map_init(void)
|
|
* @param index Type of data to change
|
|
* @param index Type of data to change
|
|
* @param value New value
|
|
* @param value New value
|
|
*/
|
|
*/
|
|
-int guild_castledatasave(int castle_id, int index, int value)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_castledatasave(int castle_id, int index, int value) {
|
|
struct guild_castle *gc = guild_castle_search(castle_id);
|
|
struct guild_castle *gc = guild_castle_search(castle_id);
|
|
|
|
|
|
if (gc == NULL) {
|
|
if (gc == NULL) {
|
|
@@ -1964,8 +1877,7 @@ int guild_castledatasave(int castle_id, int index, int value)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-void guild_castle_reconnect_sub(void *key, void *data, va_list ap)
|
|
|
|
-{
|
|
|
|
|
|
+void guild_castle_reconnect_sub(void *key, void *data, va_list ap) {
|
|
int castle_id = GetWord((int)__64BPRTSIZE(key), 0);
|
|
int castle_id = GetWord((int)__64BPRTSIZE(key), 0);
|
|
int index = GetWord((int)__64BPRTSIZE(key), 1);
|
|
int index = GetWord((int)__64BPRTSIZE(key), 1);
|
|
intif_guild_castle_datasave(castle_id, index, *(int *)data);
|
|
intif_guild_castle_datasave(castle_id, index, *(int *)data);
|
|
@@ -1977,8 +1889,7 @@ void guild_castle_reconnect_sub(void *key, void *data, va_list ap)
|
|
* disconnected.
|
|
* disconnected.
|
|
* On reconnect pushes all changes to char-server for saving.
|
|
* On reconnect pushes all changes to char-server for saving.
|
|
*/
|
|
*/
|
|
-void guild_castle_reconnect(int castle_id, int index, int value)
|
|
|
|
-{
|
|
|
|
|
|
+void guild_castle_reconnect(int castle_id, int index, int value) {
|
|
static struct linkdb_node *gc_save_pending = NULL;
|
|
static struct linkdb_node *gc_save_pending = NULL;
|
|
|
|
|
|
if (castle_id < 0) { // char-server reconnected
|
|
if (castle_id < 0) { // char-server reconnected
|
|
@@ -1993,8 +1904,7 @@ void guild_castle_reconnect(int castle_id, int index, int value)
|
|
}
|
|
}
|
|
|
|
|
|
// Load castle data then invoke OnAgitInit* on last
|
|
// Load castle data then invoke OnAgitInit* on last
|
|
-int guild_castledataloadack(int len, struct guild_castle *gc)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_castledataloadack(int len, struct guild_castle *gc) {
|
|
int i;
|
|
int i;
|
|
int n = (len-4) / sizeof(struct guild_castle);
|
|
int n = (len-4) / sizeof(struct guild_castle);
|
|
int ev;
|
|
int ev;
|
|
@@ -2008,10 +1918,8 @@ int guild_castledataloadack(int len, struct guild_castle *gc)
|
|
if( ev < 0 ) { //No castles owned, invoke OnAgitInit as it is.
|
|
if( ev < 0 ) { //No castles owned, invoke OnAgitInit as it is.
|
|
npc_event_doall("OnAgitInit");
|
|
npc_event_doall("OnAgitInit");
|
|
npc_event_doall("OnAgitInit2");
|
|
npc_event_doall("OnAgitInit2");
|
|
- }
|
|
|
|
- else // load received castles into memory, one by one
|
|
|
|
- for( i = 0; i < n; i++, gc++ )
|
|
|
|
- {
|
|
|
|
|
|
+ } else // load received castles into memory, one by one
|
|
|
|
+ for( i = 0; i < n; i++, gc++ ) {
|
|
struct guild_castle *c = guild_castle_search(gc->castle_id);
|
|
struct guild_castle *c = guild_castle_search(gc->castle_id);
|
|
if (!c) {
|
|
if (!c) {
|
|
ShowError("guild_castledataloadack: castle id=%d not found.\n", gc->castle_id);
|
|
ShowError("guild_castledataloadack: castle id=%d not found.\n", gc->castle_id);
|
|
@@ -2021,8 +1929,7 @@ int guild_castledataloadack(int len, struct guild_castle *gc)
|
|
// update map-server castle data with new info
|
|
// update map-server castle data with new info
|
|
memcpy(&c->guild_id, &gc->guild_id, sizeof(struct guild_castle) - offsetof(struct guild_castle, guild_id));
|
|
memcpy(&c->guild_id, &gc->guild_id, sizeof(struct guild_castle) - offsetof(struct guild_castle, guild_id));
|
|
|
|
|
|
- if( c->guild_id )
|
|
|
|
- {
|
|
|
|
|
|
+ if( c->guild_id ) {
|
|
if( i != ev )
|
|
if( i != ev )
|
|
guild_request_info(c->guild_id);
|
|
guild_request_info(c->guild_id);
|
|
else { // last owned one
|
|
else { // last owned one
|
|
@@ -2038,8 +1945,7 @@ int guild_castledataloadack(int len, struct guild_castle *gc)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Start normal woe and triggers all npc OnAgitStart
|
|
* Start normal woe and triggers all npc OnAgitStart
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-void guild_agit_start(void)
|
|
|
|
-{ // Run All NPC_Event[OnAgitStart]
|
|
|
|
|
|
+void guild_agit_start(void) { // Run All NPC_Event[OnAgitStart]
|
|
int c = npc_event_doall("OnAgitStart");
|
|
int c = npc_event_doall("OnAgitStart");
|
|
ShowStatus("NPC_Event:[OnAgitStart] Run (%d) Events by @AgitStart.\n",c);
|
|
ShowStatus("NPC_Event:[OnAgitStart] Run (%d) Events by @AgitStart.\n",c);
|
|
}
|
|
}
|
|
@@ -2047,8 +1953,7 @@ void guild_agit_start(void)
|
|
/*====================================================
|
|
/*====================================================
|
|
* End normal woe and triggers all npc OnAgitEnd
|
|
* End normal woe and triggers all npc OnAgitEnd
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-void guild_agit_end(void)
|
|
|
|
-{ // Run All NPC_Event[OnAgitEnd]
|
|
|
|
|
|
+void guild_agit_end(void) { // Run All NPC_Event[OnAgitEnd]
|
|
int c = npc_event_doall("OnAgitEnd");
|
|
int c = npc_event_doall("OnAgitEnd");
|
|
ShowStatus("NPC_Event:[OnAgitEnd] Run (%d) Events by @AgitEnd.\n",c);
|
|
ShowStatus("NPC_Event:[OnAgitEnd] Run (%d) Events by @AgitEnd.\n",c);
|
|
}
|
|
}
|
|
@@ -2056,8 +1961,7 @@ void guild_agit_end(void)
|
|
/*====================================================
|
|
/*====================================================
|
|
* Start woe2 and triggers all npc OnAgitStart2
|
|
* Start woe2 and triggers all npc OnAgitStart2
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-void guild_agit2_start(void)
|
|
|
|
-{ // Run All NPC_Event[OnAgitStart2]
|
|
|
|
|
|
+void guild_agit2_start(void) { // Run All NPC_Event[OnAgitStart2]
|
|
int c = npc_event_doall("OnAgitStart2");
|
|
int c = npc_event_doall("OnAgitStart2");
|
|
ShowStatus("NPC_Event:[OnAgitStart2] Run (%d) Events by @AgitStart2.\n",c);
|
|
ShowStatus("NPC_Event:[OnAgitStart2] Run (%d) Events by @AgitStart2.\n",c);
|
|
}
|
|
}
|
|
@@ -2065,15 +1969,13 @@ void guild_agit2_start(void)
|
|
/*====================================================
|
|
/*====================================================
|
|
* End woe2 and triggers all npc OnAgitEnd2
|
|
* End woe2 and triggers all npc OnAgitEnd2
|
|
*---------------------------------------------------*/
|
|
*---------------------------------------------------*/
|
|
-void guild_agit2_end(void)
|
|
|
|
-{ // Run All NPC_Event[OnAgitEnd2]
|
|
|
|
|
|
+void guild_agit2_end(void) { // Run All NPC_Event[OnAgitEnd2]
|
|
int c = npc_event_doall("OnAgitEnd2");
|
|
int c = npc_event_doall("OnAgitEnd2");
|
|
ShowStatus("NPC_Event:[OnAgitEnd2] Run (%d) Events by @AgitEnd2.\n",c);
|
|
ShowStatus("NPC_Event:[OnAgitEnd2] Run (%d) Events by @AgitEnd2.\n",c);
|
|
}
|
|
}
|
|
|
|
|
|
// How many castles does this guild have?
|
|
// How many castles does this guild have?
|
|
-int guild_checkcastles(struct guild *g)
|
|
|
|
-{
|
|
|
|
|
|
+int guild_checkcastles(struct guild *g) {
|
|
int nb_cas = 0;
|
|
int nb_cas = 0;
|
|
struct guild_castle* gc = NULL;
|
|
struct guild_castle* gc = NULL;
|
|
DBIterator *iter = db_iterator(castle_db);
|
|
DBIterator *iter = db_iterator(castle_db);
|
|
@@ -2088,8 +1990,7 @@ int guild_checkcastles(struct guild *g)
|
|
}
|
|
}
|
|
|
|
|
|
// Are these two guilds allied?
|
|
// Are these two guilds allied?
|
|
-bool guild_isallied(int guild_id, int guild_id2)
|
|
|
|
-{
|
|
|
|
|
|
+bool guild_isallied(int guild_id, int guild_id2) {
|
|
int i;
|
|
int i;
|
|
struct guild* g = guild_search(guild_id);
|
|
struct guild* g = guild_search(guild_id);
|
|
nullpo_ret(g);
|
|
nullpo_ret(g);
|
|
@@ -2206,7 +2107,7 @@ void do_init_guild(void) {
|
|
char* dbsubpath1 = aMalloc(n1+1);
|
|
char* dbsubpath1 = aMalloc(n1+1);
|
|
safesnprintf(dbsubpath1,n1+1,"%s/%s",db_path,dbsubpath[i]);
|
|
safesnprintf(dbsubpath1,n1+1,"%s/%s",db_path,dbsubpath[i]);
|
|
|
|
|
|
- sv_readdb(dbsubpath1, "castle_db.txt", ',', 4, 5, -1, &guild_read_castledb, i);
|
|
|
|
|
|
+ sv_readdb(dbsubpath1, "castle_db.txt", ',', 4, 4, -1, &guild_read_castledb, i);
|
|
sv_readdb(dbsubpath1, "guild_skill_tree.txt", ',', 2+MAX_GUILD_SKILL_REQUIRE*2, 2+MAX_GUILD_SKILL_REQUIRE*2, -1, &guild_read_guildskill_tree_db, i); //guild skill tree [Komurka]
|
|
sv_readdb(dbsubpath1, "guild_skill_tree.txt", ',', 2+MAX_GUILD_SKILL_REQUIRE*2, 2+MAX_GUILD_SKILL_REQUIRE*2, -1, &guild_read_guildskill_tree_db, i); //guild skill tree [Komurka]
|
|
|
|
|
|
aFree(dbsubpath1);
|
|
aFree(dbsubpath1);
|