diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2012-12-12 22:36:08 -0800 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2012-12-12 22:36:08 -0800 |
commit | 608f959900968e83fd25231c72308fc608742dd5 (patch) | |
tree | 33a250f00947d7c83ba50779da466b5f5885db9f /src/map | |
parent | d8e5c96fbbed5d526dd77d2e427bcb3090bddd58 (diff) | |
download | tmwa-608f959900968e83fd25231c72308fc608742dd5.tar.gz tmwa-608f959900968e83fd25231c72308fc608742dd5.tar.bz2 tmwa-608f959900968e83fd25231c72308fc608742dd5.tar.xz tmwa-608f959900968e83fd25231c72308fc608742dd5.zip |
Remove guilds, finally
If anyone in the future wonders why I did this,
just look at how many lines of code this eliminates.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.cpp | 387 | ||||
-rw-r--r-- | src/map/atcommand.hpp | 7 | ||||
-rw-r--r-- | src/map/battle.cpp | 141 | ||||
-rw-r--r-- | src/map/battle.hpp | 10 | ||||
-rw-r--r-- | src/map/chrif.cpp | 5 | ||||
-rw-r--r-- | src/map/clif.cpp | 1487 | ||||
-rw-r--r-- | src/map/clif.hpp | 38 | ||||
-rw-r--r-- | src/map/guild.cpp | 1922 | ||||
-rw-r--r-- | src/map/guild.hpp | 95 | ||||
-rw-r--r-- | src/map/intif.cpp | 575 | ||||
-rw-r--r-- | src/map/intif.hpp | 25 | ||||
-rw-r--r-- | src/map/map.cpp | 17 | ||||
-rw-r--r-- | src/map/map.hpp | 14 | ||||
-rw-r--r-- | src/map/mob.cpp | 253 | ||||
-rw-r--r-- | src/map/mob.hpp | 1 | ||||
-rw-r--r-- | src/map/npc.cpp | 12 | ||||
-rw-r--r-- | src/map/party.cpp | 2 | ||||
-rw-r--r-- | src/map/pc.cpp | 107 | ||||
-rw-r--r-- | src/map/script.cpp | 683 | ||||
-rw-r--r-- | src/map/skill.cpp | 65 | ||||
-rw-r--r-- | src/map/storage.cpp | 369 | ||||
-rw-r--r-- | src/map/storage.hpp | 24 | ||||
-rw-r--r-- | src/map/tmw.cpp | 1 | ||||
-rw-r--r-- | src/map/trade.cpp | 6 |
24 files changed, 125 insertions, 6121 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 336ef47..3d9e409 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -21,7 +21,6 @@ #include "battle.hpp" #include "clif.hpp" #include "chrif.hpp" -#include "guild.hpp" #include "intif.hpp" #include "itemdb.hpp" #include "map.hpp" @@ -58,7 +57,6 @@ ATCOMMAND_FUNC (save); ATCOMMAND_FUNC (load); ATCOMMAND_FUNC (speed); ATCOMMAND_FUNC (storage); -ATCOMMAND_FUNC (guildstorage); ATCOMMAND_FUNC (option); ATCOMMAND_FUNC (hide); ATCOMMAND_FUNC (die); @@ -75,8 +73,6 @@ ATCOMMAND_FUNC (help); ATCOMMAND_FUNC (gm); ATCOMMAND_FUNC (pvpoff); ATCOMMAND_FUNC (pvpon); -ATCOMMAND_FUNC (gvgoff); -ATCOMMAND_FUNC (gvgon); ATCOMMAND_FUNC (model); ATCOMMAND_FUNC (go); //ATCOMMAND_FUNC (spawn); @@ -91,7 +87,6 @@ ATCOMMAND_FUNC (statuspoint); ATCOMMAND_FUNC (skillpoint); ATCOMMAND_FUNC (zeny); ATCOMMAND_FUNC (param); -ATCOMMAND_FUNC (guildlevelup); //ATCOMMAND_FUNC (recall); ATCOMMAND_FUNC (recallall); ATCOMMAND_FUNC (revive); @@ -115,7 +110,6 @@ ATCOMMAND_FUNC (charquestskill); ATCOMMAND_FUNC (lostskill); ATCOMMAND_FUNC (charlostskill); ATCOMMAND_FUNC (party); -ATCOMMAND_FUNC (guild); ATCOMMAND_FUNC (charskreset); ATCOMMAND_FUNC (charstreset); ATCOMMAND_FUNC (charreset); @@ -123,8 +117,6 @@ ATCOMMAND_FUNC (charstpoint); ATCOMMAND_FUNC (charmodel); ATCOMMAND_FUNC (charskpoint); ATCOMMAND_FUNC (charzeny); -ATCOMMAND_FUNC (agitstart); -ATCOMMAND_FUNC (agitend); ATCOMMAND_FUNC (reloaditemdb); ATCOMMAND_FUNC (reloadmobdb); ATCOMMAND_FUNC (reloadskilldb); @@ -144,9 +136,7 @@ ATCOMMAND_FUNC (char_unblock); // by Yor ATCOMMAND_FUNC (char_unban); // by Yor ATCOMMAND_FUNC (mount_peco); // by Valaris ATCOMMAND_FUNC (char_mount_peco); // by Yor -ATCOMMAND_FUNC (guildspy); // [Syrus22] ATCOMMAND_FUNC (partyspy); // [Syrus22] -ATCOMMAND_FUNC (guildrecall); // by Yor ATCOMMAND_FUNC (partyrecall); // by Yor ATCOMMAND_FUNC (enablenpc); ATCOMMAND_FUNC (disablenpc); @@ -237,7 +227,6 @@ static AtCommandInfo atcommand_info[] = { {AtCommand_Load, "@load", 40, atcommand_load}, {AtCommand_Speed, "@speed", 40, atcommand_speed}, {AtCommand_Storage, "@storage", 1, atcommand_storage}, - {AtCommand_GuildStorage, "@gstorage", 50, atcommand_guildstorage}, {AtCommand_Option, "@option", 40, atcommand_option}, {AtCommand_Hide, "@hide", 40, atcommand_hide}, // + /hide {AtCommand_Die, "@die", 1, atcommand_die}, @@ -254,10 +243,6 @@ static AtCommandInfo atcommand_info[] = { {AtCommand_GM, "@gm", 100, atcommand_gm}, {AtCommand_PvPOff, "@pvpoff", 40, atcommand_pvpoff}, {AtCommand_PvPOn, "@pvpon", 40, atcommand_pvpon}, - {AtCommand_GvGOff, "@gvgoff", 40, atcommand_gvgoff}, - {AtCommand_GvGOff, "@gpvpoff", 40, atcommand_gvgoff}, - {AtCommand_GvGOn, "@gvgon", 40, atcommand_gvgon}, - {AtCommand_GvGOn, "@gpvpon", 40, atcommand_gvgon}, {AtCommand_Model, "@model", 20, atcommand_model}, {AtCommand_Go, "@go", 10, atcommand_go}, {AtCommand_Spawn, "@spawn", 50, atcommand_spawn}, @@ -276,7 +261,6 @@ static AtCommandInfo atcommand_info[] = { {AtCommand_Intelligence, "@int", 60, atcommand_param}, {AtCommand_Dexterity, "@dex", 60, atcommand_param}, {AtCommand_Luck, "@luk", 60, atcommand_param}, - {AtCommand_GuildLevelUp, "@guildlvl", 60, atcommand_guildlevelup}, {AtCommand_Recall, "@recall", 60, atcommand_recall}, // + /recall {AtCommand_Revive, "@revive", 60, atcommand_revive}, {AtCommand_CharacterStats, "@charstats", 40, atcommand_character_stats}, @@ -304,9 +288,6 @@ static AtCommandInfo atcommand_info[] = { {AtCommand_LostSkill, "@lostskill", 40, atcommand_lostskill}, {AtCommand_CharLostSkill, "@charlostskill", 60, atcommand_charlostskill}, {AtCommand_Party, "@party", 1, atcommand_party}, - {AtCommand_Guild, "@guild", 50, atcommand_guild}, - {AtCommand_AgitStart, "@agitstart", 60, atcommand_agitstart}, - {AtCommand_AgitEnd, "@agitend", 60, atcommand_agitend}, {AtCommand_MapExit, "@mapexit", 99, atcommand_mapexit}, {AtCommand_IDSearch, "@idsearch", 60, atcommand_idsearch}, {AtCommand_MapMove, "@mapmove", 40, atcommand_warp}, // /mm command @@ -338,9 +319,7 @@ static AtCommandInfo atcommand_info[] = { {AtCommand_CharUnBan, "@unban", 60, atcommand_char_unban}, // by Yor {AtCommand_MountPeco, "@mountpeco", 20, atcommand_mount_peco}, // by Valaris {AtCommand_CharMountPeco, "@charmountpeco", 50, atcommand_char_mount_peco}, // by Yor - {AtCommand_GuildSpy, "@guildspy", 60, atcommand_guildspy}, // [Syrus22] {AtCommand_PartySpy, "@partyspy", 60, atcommand_partyspy}, // [Syrus22] - {AtCommand_GuildRecall, "@guildrecall", 60, atcommand_guildrecall}, // by Yor {AtCommand_PartyRecall, "@partyrecall", 60, atcommand_partyrecall}, // by Yor {AtCommand_Enablenpc, "@enablenpc", 80, atcommand_enablenpc}, // [] {AtCommand_Disablenpc, "@disablenpc", 80, atcommand_disablenpc}, // [] @@ -1264,7 +1243,6 @@ int atcommand_whogroup (const int fd, struct map_session_data *sd, int pl_GM_level, GM_level; char match_text[100]; char player_name[24]; - struct guild *g; struct party *p; memset (temp0, '\0', sizeof (temp0)); @@ -1296,11 +1274,6 @@ int atcommand_whogroup (const int fd, struct map_session_data *sd, player_name[j] = tolower (player_name[j]); if (strstr (player_name, match_text) != NULL) { // search with no case sensitive - g = guild_search (pl_sd->status.guild_id); - if (g == NULL) - sprintf (temp1, "None"); - else - sprintf (temp1, "%s", g->name); p = party_search (pl_sd->status.party_id); if (p == NULL) sprintf (temp0, "None"); @@ -1308,9 +1281,8 @@ int atcommand_whogroup (const int fd, struct map_session_data *sd, sprintf (temp0, "%s", p->name); if (pl_GM_level > 0) sprintf (output, - "Name: %s (GM:%d) | Party: '%s' | Guild: '%s'", - pl_sd->status.name, pl_GM_level, temp0, - temp1); + "Name: %s (GM:%d) | Party: '%s'", + pl_sd->status.name, pl_GM_level, temp0); else sprintf (output, "Name: %s | Party: '%s' | Guild: '%s'", @@ -1415,18 +1387,15 @@ int atcommand_whomapgroup (const int fd, struct map_session_data *sd, const char *command, const char *message) { char temp0[100]; - char temp1[100]; char output[200]; struct map_session_data *pl_sd; int i, count; int pl_GM_level, GM_level; int map_id = 0; char map_name[100]; - struct guild *g; struct party *p; memset (temp0, '\0', sizeof (temp0)); - memset (temp1, '\0', sizeof (temp1)); memset (output, '\0', sizeof (output)); memset (map_name, '\0', sizeof (map_name)); @@ -1453,14 +1422,10 @@ int atcommand_whomapgroup (const int fd, struct map_session_data *sd, ((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_HIDE)) && (pl_GM_level > GM_level))) - { // you can look only lower or same level + { + // you can look only lower or same level if (pl_sd->bl.m == map_id) { - g = guild_search (pl_sd->status.guild_id); - if (g == NULL) - sprintf (temp1, "None"); - else - sprintf (temp1, "%s", g->name); p = party_search (pl_sd->status.party_id); if (p == NULL) sprintf (temp0, "None"); @@ -1468,13 +1433,12 @@ int atcommand_whomapgroup (const int fd, struct map_session_data *sd, sprintf (temp0, "%s", p->name); if (pl_GM_level > 0) sprintf (output, - "Name: %s (GM:%d) | Party: '%s' | Guild: '%s'", - pl_sd->status.name, pl_GM_level, temp0, - temp1); + "Name: %s (GM:%d) | Party: '%s'", + pl_sd->status.name, pl_GM_level, temp0); else sprintf (output, - "Name: %s | Party: '%s' | Guild: '%s'", - pl_sd->status.name, temp0, temp1); + "Name: %s | Party: '%s'", + pl_sd->status.name, temp0); clif_displaymessage (fd, output); count++; } @@ -1503,18 +1467,15 @@ int atcommand_whogm (const int fd, struct map_session_data *sd, const char *command, const char *message) { char temp0[100]; - char temp1[100]; char output[200]; struct map_session_data *pl_sd; int i, j, count; int pl_GM_level, GM_level; char match_text[100]; char player_name[24]; - struct guild *g; struct party *p; memset (temp0, '\0', sizeof (temp0)); - memset (temp1, '\0', sizeof (temp1)); memset (output, '\0', sizeof (output)); memset (match_text, '\0', sizeof (match_text)); memset (player_name, '\0', sizeof (player_name)); @@ -1555,18 +1516,13 @@ int atcommand_whogm (const int fd, struct map_session_data *sd, job_name (pl_sd->status.pc_class), pl_sd->status.job_level); clif_displaymessage (fd, output); - g = guild_search (pl_sd->status.guild_id); - if (g == NULL) - sprintf (temp1, "None"); - else - sprintf (temp1, "%s", g->name); p = party_search (pl_sd->status.party_id); if (p == NULL) sprintf (temp0, "None"); else sprintf (temp0, "%s", p->name); - sprintf (output, " Party: '%s' | Guild: '%s'", - temp0, temp1); + sprintf (output, " Party: '%s'", + temp0); clif_displaymessage (fd, output); count++; } @@ -1689,7 +1645,7 @@ int atcommand_storage (const int fd, struct map_session_data *sd, struct storage *stor; //changes from Freya/Yor nullpo_retr (-1, sd); - if (sd->state.storage_flag) + if (sd->state.storage_open) { clif_displaymessage (fd, "msg_table[250]"); return -1; @@ -1711,40 +1667,6 @@ int atcommand_storage (const int fd, struct map_session_data *sd, * *------------------------------------------ */ -int atcommand_guildstorage (const int fd, struct map_session_data *sd, - const char *command, const char *message) -{ - struct storage *stor; //changes from Freya/Yor - nullpo_retr (-1, sd); - - if (sd->status.guild_id > 0) - { - if (sd->state.storage_flag) - { - clif_displaymessage (fd, "msg_table[251]"); - return -1; - } - if ((stor = account2storage2 (sd->status.account_id)) != NULL - && stor->storage_status == 1) - { - clif_displaymessage (fd, "msg_table[251]"); - return -1; - } - storage_guild_storageopen (sd); - } - else - { - clif_displaymessage (fd, "msg_table[252]"); - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ int atcommand_option (const int fd, struct map_session_data *sd, const char *command, const char *message) { @@ -2384,50 +2306,6 @@ int atcommand_pvpon (const int fd, struct map_session_data *sd, * *------------------------------------------ */ -int atcommand_gvgoff (const int fd, struct map_session_data *sd, - const char *command, const char *message) -{ - if (map[sd->bl.m].flag.gvg) - { - map[sd->bl.m].flag.gvg = 0; - clif_send0199 (sd->bl.m, 0); - clif_displaymessage (fd, "GvG: Off."); - } - else - { - clif_displaymessage (fd, "GvG is already Off."); - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int atcommand_gvgon (const int fd, struct map_session_data *sd, - const char *command, const char *message) -{ - if (!map[sd->bl.m].flag.gvg) - { - map[sd->bl.m].flag.gvg = 1; - clif_send0199 (sd->bl.m, 3); - clif_displaymessage (fd, "GvG: On."); - } - else - { - clif_displaymessage (fd, "GvG is already On."); - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ int atcommand_model (const int fd, struct map_session_data *sd, const char *command, const char *message) { @@ -3510,58 +3388,6 @@ int atcommand_all_stats (const int fd, struct map_session_data *sd, * *------------------------------------------ */ -int atcommand_guildlevelup (const int fd, struct map_session_data *sd, - const char *command, const char *message) -{ - int level = 0; - short added_level; - struct guild *guild_info; - - if (!message || !*message || sscanf (message, "%d", &level) < 1 - || level == 0) - { - clif_displaymessage (fd, - "Please, enter a valid level (usage: @guildlvl <# of levels>)."); - return -1; - } - - if (sd->status.guild_id <= 0 - || (guild_info = guild_search (sd->status.guild_id)) == NULL) - { - clif_displaymessage (fd, "You're not in a guild."); - return -1; - } - if (strcmp (sd->status.name, guild_info->master) != 0) - { - clif_displaymessage (fd, "You're not the master of your guild."); - return -1; - } - - added_level = (short) level; - if (level > 0 && (level > MAX_GUILDLEVEL || added_level > ((short) MAX_GUILDLEVEL - guild_info->guild_lv))) // fix positiv overflow - added_level = (short) MAX_GUILDLEVEL - guild_info->guild_lv; - else if (level < 0 && (level < -MAX_GUILDLEVEL || added_level < (1 - guild_info->guild_lv))) // fix negativ overflow - added_level = 1 - guild_info->guild_lv; - - if (added_level != 0) - { - intif_guild_change_basicinfo (guild_info->guild_id, GBI_GUILDLV, - &added_level, 2); - clif_displaymessage (fd, "Guild level changed."); - } - else - { - clif_displaymessage (fd, "Guild level change failed."); - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ int atcommand_recall (const int fd, struct map_session_data *sd, const char *command, const char *message) { @@ -4891,73 +4717,6 @@ int atcommand_party (const int fd, struct map_session_data *sd, } /*========================================== - * - *------------------------------------------ - */ -int atcommand_guild (const int fd, struct map_session_data *sd, - const char *command, const char *message) -{ - char guild[100]; - int prev; - - memset (guild, '\0', sizeof (guild)); - - if (!message || !*message || sscanf (message, "%99[^\n]", guild) < 1) - { - clif_displaymessage (fd, - "Please, enter a guild name (usage: @guild <guild_name>)."); - return -1; - } - - prev = battle_config.guild_emperium_check; - battle_config.guild_emperium_check = 0; - guild_create (sd, guild); - battle_config.guild_emperium_check = prev; - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int atcommand_agitstart (const int fd, struct map_session_data *sd, - const char *command, const char *message) -{ - if (agit_flag == 1) - { - clif_displaymessage (fd, "Already it has started siege warfare."); - return -1; - } - - agit_flag = 1; - guild_agit_start (); - clif_displaymessage (fd, "Guild siege warfare start!"); - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int atcommand_agitend (const int fd, struct map_session_data *sd, - const char *command, const char *message) -{ - if (agit_flag == 0) - { - clif_displaymessage (fd, "Siege warfare hasn't started yet."); - return -1; - } - - agit_flag = 0; - guild_agit_end (); - clif_displaymessage (fd, "Guild siege warfare end!"); - - return 0; -} - -/*========================================== * @mapexitでマップサーバーを終了させる *------------------------------------------ */ @@ -5525,75 +5284,6 @@ int atcommand_recallall (const int fd, struct map_session_data *sd, } /*========================================== - * Recall online characters of a guild to your location - *------------------------------------------ - */ -int atcommand_guildrecall (const int fd, struct map_session_data *sd, - const char *command, const char *message) -{ - struct map_session_data *pl_sd; - int i; - char guild_name[100]; - char output[200]; - struct guild *g; - int count; - - memset (guild_name, '\0', sizeof (guild_name)); - memset (output, '\0', sizeof (output)); - - if (!message || !*message || sscanf (message, "%99[^\n]", guild_name) < 1) - { - clif_displaymessage (fd, - "Please, enter a guild name/id (usage: @guildrecall <guild_name/id>)."); - return -1; - } - - if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto - && battle_config.any_warp_GM_min_level > pc_isGM (sd)) - { - clif_displaymessage (fd, - "You are not authorised to warp somenone to your actual map."); - return -1; - } - - if ((g = guild_searchname (guild_name)) != NULL || // name first to avoid error when name begin with a number - (g = guild_search (atoi (message))) != NULL) - { - count = 0; - for (i = 0; i < fd_max; i++) - { - if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data) - && pl_sd->state.auth - && sd->status.account_id != pl_sd->status.account_id - && pl_sd->status.guild_id == g->guild_id) - { - if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp - && battle_config.any_warp_GM_min_level > pc_isGM (sd)) - count++; - else - pc_setpos (pl_sd, sd->mapname, sd->bl.x, sd->bl.y, 2); - } - } - sprintf (output, "All online characters of the %s guild are near you.", g->name); - clif_displaymessage (fd, output); - if (count) - { - sprintf (output, - "Because you are not authorised to warp from some maps, %d player(s) have not been recalled.", - count); - clif_displaymessage (fd, output); - } - } - else - { - clif_displaymessage (fd, "Incorrect name/ID, or no one from the guild is online."); - return -1; - } - - return 0; -} - -/*========================================== * Recall online characters of a party to your location *------------------------------------------ */ @@ -5796,15 +5486,10 @@ int atcommand_mapinfo (const int fd, struct map_session_data *sd, sprintf (output, "Chats In Map: %d", chat_num); clif_displaymessage (fd, output); clif_displaymessage (fd, "------ Map Flags ------"); - sprintf (output, "Player vs Player: %s | No Guild: %s | No Party: %s", + sprintf (output, "Player vs Player: %s | No Party: %s", (map[m_id].flag.pvp) ? "True" : "False", - (map[m_id].flag.pvp_noguild) ? "True" : "False", (map[m_id].flag.pvp_noparty) ? "True" : "False"); clif_displaymessage (fd, output); - sprintf (output, "Guild vs Guild: %s | No Party: %s", - (map[m_id].flag.gvg) ? "True" : "False", - (map[m_id].flag.gvg_noparty) ? "True" : "False"); - clif_displaymessage (fd, output); sprintf (output, "No Dead Branch: %s", (map[m_id].flag.nobranch) ? "True" : "False"); clif_displaymessage (fd, output); @@ -6056,52 +5741,6 @@ int atcommand_char_mount_peco (const int fd, struct map_session_data *sd, *Spy Commands by Syrus22 *------------------------------------------ */ -int atcommand_guildspy (const int fd, struct map_session_data *sd, - const char *command, const char *message) -{ - char guild_name[100]; - char output[200]; - struct guild *g; - - memset (guild_name, '\0', sizeof (guild_name)); - memset (output, '\0', sizeof (output)); - - if (!message || !*message || sscanf (message, "%99[^\n]", guild_name) < 1) - { - clif_displaymessage (fd, - "Please, enter a guild name/id (usage: @guildspy <guild_name/id>)."); - return -1; - } - - if ((g = guild_searchname (guild_name)) != NULL || // name first to avoid error when name begin with a number - (g = guild_search (atoi (message))) != NULL) - { - if (sd->guildspy == g->guild_id) - { - sd->guildspy = 0; - sprintf (output, "No longer spying on the %s guild.", g->name); - clif_displaymessage (fd, output); - } - else - { - sd->guildspy = g->guild_id; - sprintf (output, "Spying on the %s guild.", g->name); - clif_displaymessage (fd, output); - } - } - else - { - clif_displaymessage (fd, "Incorrect name/ID, or no one from the guild is online."); - return -1; - } - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ int atcommand_partyspy (const int fd, struct map_session_data *sd, const char *command, const char *message) { @@ -7784,7 +7423,7 @@ atcommand_storeall (const int fd, struct map_session_data *sd, int i; nullpo_retr (-1, sd); - if (sd->state.storage_flag != 1) + if (!sd->state.storage_open) { //Open storage. switch (storage_storageopen (sd)) { diff --git a/src/map/atcommand.hpp b/src/map/atcommand.hpp index d35cb4f..b052fc6 100644 --- a/src/map/atcommand.hpp +++ b/src/map/atcommand.hpp @@ -26,7 +26,6 @@ enum AtCommandType AtCommand_Load, AtCommand_Speed, AtCommand_Storage, - AtCommand_GuildStorage, AtCommand_Option, AtCommand_Hide, AtCommand_Die, @@ -66,7 +65,6 @@ enum AtCommandType AtCommand_Intelligence, AtCommand_Dexterity, AtCommand_Luck, - AtCommand_GuildLevelUp, AtCommand_Recall, AtCommand_Revive, AtCommand_CharacterStats, @@ -90,9 +88,6 @@ enum AtCommandType AtCommand_LostSkill, AtCommand_CharLostSkill, AtCommand_Party, - AtCommand_Guild, - AtCommand_AgitStart, - AtCommand_AgitEnd, AtCommand_MapExit, AtCommand_IDSearch, AtCommand_CharSkReset, @@ -121,9 +116,7 @@ enum AtCommandType AtCommand_CharUnBan, // by Yor AtCommand_MountPeco, // by Valaris AtCommand_CharMountPeco, // by Yor - AtCommand_GuildSpy, // [Syrus22] AtCommand_PartySpy, // [Syrus22] - AtCommand_GuildRecall, // by Yor AtCommand_PartyRecall, // by Yor AtCommand_Enablenpc, AtCommand_Disablenpc, diff --git a/src/map/battle.cpp b/src/map/battle.cpp index a636af4..2d3ff9a 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -10,7 +10,6 @@ #include "../common/nullpo.hpp" #include "clif.hpp" -#include "guild.hpp" #include "itemdb.hpp" #include "map.hpp" #include "mob.hpp" @@ -1266,19 +1265,6 @@ int battle_get_party_id (struct block_list *bl) return 0; } -int battle_get_guild_id (struct block_list *bl) -{ - nullpo_retr (0, bl); - if (bl->type == BL_PC && (struct map_session_data *) bl) - return ((struct map_session_data *) bl)->status.guild_id; - else if (bl->type == BL_MOB && (struct mob_data *) bl) - return ((struct mob_data *) bl)->mob_class; - else if (bl->type == BL_SKILL && (struct skill_unit *) bl) - return ((struct skill_unit *) bl)->group->guild_id; - else - return 0; -} - int battle_get_race (struct block_list *bl) { nullpo_retr (0, bl); @@ -1529,7 +1515,7 @@ int battle_damage (struct block_list *bl, struct block_list *target, if (tsd && tsd->skilltimer != -1) { // 詠唱妨害 // フェンカードや妨害されないスキルかの検査 - if ((!tsd->special_state.no_castcancel || map[bl->m].flag.gvg) + if (!tsd->special_state.no_castcancel && tsd->state.skillcastcancel && !tsd->special_state.no_castcancel2) skill_castcancel (target, 0); @@ -1791,53 +1777,6 @@ int battle_calc_damage (struct block_list *src, struct block_list *bl, } } - if (class_ == 1288 || class_ == 1287 || class_ == 1286 || class_ == 1285) - { -// if(class == 1288) { - if (class_ == 1288 && flag & BF_SKILL) - damage = 0; - if (src->type == BL_PC) - { - struct guild *g = - guild_search (((struct map_session_data *) src)-> - status.guild_id); - struct guild_castle *gc = guild_mapname2gc (map[bl->m].name); - if (!((struct map_session_data *) src)->status.guild_id) - damage = 0; - if (gc && agit_flag == 0 && class_ != 1288) // guardians cannot be damaged during non-woe [Valaris] - damage = 0; // end woe check [Valaris] - if (g == NULL) - damage = 0; //ギルド未加入ならダメージ無し - else if ((gc != NULL) && guild_isallied (g, gc)) - damage = 0; //自占領ギルドのエンペならダメージ無し - else if (g && guild_checkskill (g, GD_APPROVAL) <= 0) - damage = 0; //正規ギルド承認がないとダメージ無し - else if (battle_config.guild_max_castles != 0 - && guild_checkcastles (g) >= - battle_config.guild_max_castles) - damage = 0; // [MouseJstr] - } - else - damage = 0; - } - - if (map[bl->m].flag.gvg && damage > 0) - { //GvG - if (flag & BF_WEAPON) - { - if (flag & BF_SHORT) - damage = damage * battle_config.gvg_short_damage_rate / 100; - if (flag & BF_LONG) - damage = damage * battle_config.gvg_long_damage_rate / 100; - } - if (flag & BF_MAGIC) - damage = damage * battle_config.gvg_magic_damage_rate / 100; - if (flag & BF_MISC) - damage = damage * battle_config.gvg_misc_damage_rate / 100; - if (damage < 1) - damage = 1; - } - if (battle_config.skill_min_damage || flag & BF_MISC) { if (div_ < 255) @@ -4477,7 +4416,7 @@ struct Damage battle_calc_magic_attack (struct block_list *bl, { if (battle_config.gtb_pvp_only != 0) { // [MouseJstr] - if ((map[target->m].flag.pvp || map[target->m].flag.gvg) + if (map[target->m].flag.pvp && target->type == BL_PC) damage = (damage * (100 - battle_config.gtb_pvp_only)) / 100; } @@ -5181,7 +5120,7 @@ int battle_check_undead (int race, int element) int battle_check_target (struct block_list *src, struct block_list *target, int flag) { - int s_p, s_g, t_p, t_g; + int s_p, t_p; struct block_list *ss = src; nullpo_retr (0, src); @@ -5292,10 +5231,8 @@ int battle_check_target (struct block_list *src, struct block_list *target, return 0; // PCvsMOBなら否定 s_p = battle_get_party_id (ss); - s_g = battle_get_guild_id (ss); t_p = battle_get_party_id (target); - t_g = battle_get_guild_id (target); if (flag & 0x10000) { @@ -5305,9 +5242,6 @@ int battle_check_target (struct block_list *src, struct block_list *target, return 0; } - if (ss->type == BL_MOB && s_g > 0 && t_g > 0 && s_g == t_g) // 同じギルド/mobクラスなら肯定(味方) - return 1; - //printf("ss:%d src:%d target:%d flag:0x%x %d %d ",ss->id,src->id,target->id,flag,src->type,target->type); //printf("p:%d %d g:%d %d\n",s_p,t_p,s_g,t_g); @@ -5330,36 +5264,6 @@ int battle_check_target (struct block_list *src, struct block_list *target, else if (map[ss->m].flag.pvp_noparty && s_p > 0 && t_p > 0 && s_p == t_p) return 1; - else if (map[ss->m].flag.pvp_noguild && s_g > 0 && t_g > 0 - && s_g == t_g) - return 1; - return 0; - } - if (map[src->m].flag.gvg) - { - struct guild *g = NULL; - if (su && su->group->target_flag == BCT_NOENEMY) - return 1; - if (s_g > 0 && s_g == t_g) - return 1; - if (map[src->m].flag.gvg_noparty && s_p > 0 && t_p > 0 - && s_p == t_p) - return 1; - if ((g = guild_search (s_g))) - { - int i; - for (i = 0; i < MAX_GUILDALLIANCE; i++) - { - if (g->alliance[i].guild_id > 0 - && g->alliance[i].guild_id == t_g) - { - if (g->alliance[i].opposition) - return 0; //敵対ギルドなら無条件に敵 - else - return 1; //同盟ギルドなら無条件に味方 - } - } - } return 0; } } @@ -5490,7 +5394,6 @@ int battle_config_read (const char *cfgName) battle_config.gm_allskill = 0; battle_config.gm_allequip = 0; battle_config.gm_skilluncond = 0; - battle_config.guild_max_castles = 0; battle_config.skillfree = 0; battle_config.skillup_limit = 0; battle_config.wp_rate = 100; @@ -5503,8 +5406,6 @@ int battle_config_read (const char *cfgName) battle_config.quest_skill_learn = 0; battle_config.quest_skill_reset = 1; battle_config.basic_skill_check = 1; - battle_config.guild_emperium_check = 1; - battle_config.guild_exp_limit = 50; battle_config.pc_invincible_time = 5000; battle_config.skill_min_damage = 0; battle_config.finger_offensive_type = 0; @@ -5554,11 +5455,6 @@ int battle_config_read (const char *cfgName) battle_config.monster_skill_nofootset = 0; battle_config.pc_cloak_check_type = 0; battle_config.monster_cloak_check_type = 0; - battle_config.gvg_short_damage_rate = 100; - battle_config.gvg_long_damage_rate = 100; - battle_config.gvg_magic_damage_rate = 100; - battle_config.gvg_misc_damage_rate = 100; - battle_config.gvg_eliminate_time = 7000; battle_config.mob_changetarget_byskill = 0; battle_config.pc_attack_direction_change = 1; battle_config.monster_attack_direction_change = 1; @@ -5738,8 +5634,6 @@ int battle_config_read (const char *cfgName) { "gtb_pvp_only", &battle_config.gtb_pvp_only}, { - "guild_max_castles", &battle_config.guild_max_castles}, - { "death_penalty_type", &battle_config.death_penalty_type}, { "death_penalty_base", &battle_config.death_penalty_base}, @@ -5800,10 +5694,6 @@ int battle_config_read (const char *cfgName) { "basic_skill_check", &battle_config.basic_skill_check}, { - "guild_emperium_check", &battle_config.guild_emperium_check}, - { - "guild_exp_limit", &battle_config.guild_exp_limit}, - { "player_invincible_time", &battle_config.pc_invincible_time}, { "skill_min_damage", &battle_config.skill_min_damage}, @@ -5914,20 +5804,6 @@ int battle_config_read (const char *cfgName) "monster_cloak_check_type", &battle_config.monster_cloak_check_type}, { - "gvg_short_attack_damage_rate", - &battle_config.gvg_short_damage_rate}, - { - "gvg_long_attack_damage_rate", - &battle_config.gvg_long_damage_rate}, - { - "gvg_magic_attack_damage_rate", - &battle_config.gvg_magic_damage_rate}, - { - "gvg_misc_attack_damage_rate", - &battle_config.gvg_misc_damage_rate}, - { - "gvg_eliminate_time", &battle_config.gvg_eliminate_time}, - { "mob_changetarget_byskill", &battle_config.mob_changetarget_byskill}, { @@ -5999,8 +5875,6 @@ int battle_config_read (const char *cfgName) { "disp_experience", &battle_config.disp_experience}, { - "castle_defense_rate", &battle_config.castle_defense_rate}, - { "riding_weight", &battle_config.riding_weight}, { "item_rate_common", &battle_config.item_rate_common}, // Added by RoVeRT @@ -6173,15 +6047,6 @@ int battle_config_read (const char *cfgName) if (battle_config.vit_penaly_count < 2) battle_config.vit_penaly_count = 2; - if (battle_config.guild_exp_limit > 99) - battle_config.guild_exp_limit = 99; - if (battle_config.guild_exp_limit < 0) - battle_config.guild_exp_limit = 0; - - if (battle_config.castle_defense_rate < 0) - battle_config.castle_defense_rate = 0; - if (battle_config.castle_defense_rate > 100) - battle_config.castle_defense_rate = 100; if (battle_config.item_drop_common_min < 1) // Added by TyrNemesis^ battle_config.item_drop_common_min = 1; if (battle_config.item_drop_common_max > 10000) diff --git a/src/map/battle.hpp b/src/map/battle.hpp index 5f2a22f..22cc0a3 100644 --- a/src/map/battle.hpp +++ b/src/map/battle.hpp @@ -111,7 +111,6 @@ int battle_get_attack_element2 (struct block_list *bl); //左手武器属性 #define battle_get_elem_type(bl) (battle_get_element(bl)%10) #define battle_get_elem_level(bl) (battle_get_element(bl)/10/2) int battle_get_party_id (struct block_list *bl); -int battle_get_guild_id (struct block_list *bl); int battle_get_race (struct block_list *bl); int battle_get_size (struct block_list *bl); int battle_get_mode (struct block_list *bl); @@ -203,9 +202,6 @@ extern struct Battle_Config int quest_skill_learn; int quest_skill_reset; int basic_skill_check; - int guild_emperium_check; - int guild_exp_limit; - int guild_max_castles; int pc_invincible_time; int skill_min_damage; int finger_offensive_type; @@ -252,11 +248,6 @@ extern struct Battle_Config int monster_skill_nofootset; int pc_cloak_check_type; int monster_cloak_check_type; - int gvg_short_damage_rate; - int gvg_long_damage_rate; - int gvg_magic_damage_rate; - int gvg_misc_damage_rate; - int gvg_eliminate_time; int mob_changetarget_byskill; int pc_attack_direction_change; int monster_attack_direction_change; @@ -311,7 +302,6 @@ extern struct Battle_Config int invite_request_check; int skill_removetrap_type; int disp_experience; - int castle_defense_rate; int riding_weight; int backstab_bow_penalty; diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index 3367f6f..ca4f9ff 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -120,11 +120,8 @@ int chrif_save (struct map_session_data *sd) WFIFOSET (char_fd, WFIFOW (char_fd, 2)); //For data sync - if (sd->state.storage_flag == 1) + if (sd->state.storage_open) storage_storage_save (sd->status.account_id, 0); - else if (sd->state.storage_flag == 2) - storage_guild_storagesave (sd->status.account_id, sd->status.guild_id, - 0); return 0; } diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 69c913e..860c677 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -30,7 +30,6 @@ #include "chat.hpp" #include "chrif.hpp" #include "clif.hpp" -#include "guild.hpp" #include "intif.hpp" #include "itemdb.hpp" #include "magic.hpp" @@ -116,12 +115,6 @@ enum PARTY_SAMEMAP_WOS, PARTY_AREA, PARTY_AREA_WOS, - GUILD, - GUILD_WOS, - GUILD_SAMEMAP, // [Valaris] - GUILD_SAMEMAP_WOS, - GUILD_AREA, - GUILD_AREA_WOS, // end additions [Valaris] SELF }; @@ -311,7 +304,6 @@ int clif_send (const uint8_t *buf, int len, struct block_list *bl, int type) struct map_session_data *sd; struct chat_data *cd; struct party *p = NULL; - struct guild *g = NULL; int x0 = 0, x1 = 0, y0 = 0, y1 = 0; if (type != ALL_CLIENT) @@ -486,96 +478,6 @@ int clif_send (const uint8_t *buf, int len, struct block_list *bl, int type) } break; -/* New definitions for guilds [Valaris] */ - - case GUILD_AREA: - case GUILD_AREA_WOS: - x0 = bl->x - AREA_SIZE; - y0 = bl->y - AREA_SIZE; - x1 = bl->x + AREA_SIZE; - y1 = bl->y + AREA_SIZE; - case GUILD: - case GUILD_WOS: - if (bl && bl->type == BL_PC) - { // guildspy [Syrus22] - sd = (struct map_session_data *) bl; - if (sd->guildspy > 0) - { - g = guild_search (sd->guildspy); - } - else - { - if (sd->status.guild_id > 0) - g = guild_search (sd->status.guild_id); - } - } - if (g) - { - for (i = 0; i < g->max_member; i++) - { - if ((sd = g->member[i].sd) != NULL) - { - if (type == GUILD_WOS && sd->bl.id == bl->id) - continue; - if (packet_len_table[RBUFW (buf, 0)]) - { // packet must exist - memcpy (WFIFOP (sd->fd, 0), buf, len); - WFIFOSET (sd->fd, len); - } - } - } - for (i = 0; i < fd_max; i++) - { - if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL - && sd->state.auth) - { - if (sd->guildspy == g->guild_id) - { - if (packet_len_table[RBUFW (buf, 0)]) - { // packet must exist - memcpy (WFIFOP (sd->fd, 0), buf, len); - WFIFOSET (sd->fd, len); - } - } - } - } - } - break; - case GUILD_SAMEMAP: - case GUILD_SAMEMAP_WOS: - if (bl->type == BL_PC) - { - sd = (struct map_session_data *) bl; - if (sd->status.guild_id > 0) - g = guild_search (sd->status.guild_id); - } - if (g) - { - for (i = 0; i < g->max_member; i++) - { - if ((sd = g->member[i].sd) != NULL) - { - if (sd->bl.id == bl->id && (type == GUILD_WOS || - type == GUILD_SAMEMAP_WOS - || type == - GUILD_AREA_WOS)) - continue; - if (type != GUILD && type != GUILD_WOS && bl->m != sd->bl.m) // マップチェック - continue; - if ((type == GUILD_AREA || type == GUILD_AREA_WOS) && - (sd->bl.x < x0 || sd->bl.y < y0 || - sd->bl.x > x1 || sd->bl.y > y1)) - continue; - if (packet_len_table[RBUFW (buf, 0)]) - { // packet must exist - memcpy (WFIFOP (sd->fd, 0), buf, len); - WFIFOSET (sd->fd, len); - } - } - } - } - break; - default: if (battle_config.error_log) printf ("clif_send まだ作ってないよー\n"); @@ -878,8 +780,8 @@ static int clif_set0078 (struct map_session_data *sd, unsigned char *buf) WBUFW (buf, 28) = sd->status.hair_color; WBUFW (buf, 30) = sd->status.clothes_color; WBUFW (buf, 32) = sd->head_dir; - WBUFL (buf, 34) = sd->status.guild_id; - WBUFW (buf, 38) = sd->guild_emblem_id; + WBUFL (buf, 34) = 0 /*guild_id*/; + WBUFW (buf, 38) = 0 /*guild_emblem_id*/; WBUFW (buf, 40) = sd->status.manner; WBUFW (buf, 42) = sd->opt3; WBUFB (buf, 44) = sd->status.karma; @@ -961,8 +863,8 @@ static int clif_set007b (struct map_session_data *sd, unsigned char *buf) WBUFW (buf, 32) = sd->status.hair_color; WBUFW (buf, 34) = sd->status.clothes_color; WBUFW (buf, 36) = sd->head_dir; - WBUFL (buf, 38) = sd->status.guild_id; - WBUFW (buf, 42) = sd->guild_emblem_id; + WBUFL (buf, 38) = 0/*guild_id*/; + WBUFW (buf, 42) = 0/*guild_emblem_id*/; WBUFW (buf, 44) = sd->status.manner; WBUFW (buf, 46) = sd->opt3; WBUFB (buf, 48) = sd->status.karma; @@ -1075,21 +977,6 @@ static int clif_mob0078 (struct mob_data *md, unsigned char *buf) WBUFB (buf, 45) = mob_get_sex (md->mob_class); } - if (md->mob_class >= 1285 && md->mob_class <= 1287) - { // Added guardian emblems [Valaris] - struct guild *g; - struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); - if (gc && gc->guild_id > 0) - { - g = guild_search (gc->guild_id); - if (g) - { - WBUFL (buf, 26) = gc->guild_id; - WBUFL (buf, 22) = g->emblem_id; - } - } - } // End addition - WBUFPOS (buf, 46, md->bl.x, md->bl.y); WBUFB (buf, 48) |= md->dir & 0x0f; WBUFB (buf, 49) = 5; @@ -1139,21 +1026,6 @@ static int clif_mob007b (struct mob_data *md, unsigned char *buf) else WBUFL (buf, 22) = gettick (); - if (md->mob_class >= 1285 && md->mob_class <= 1287) - { // Added guardian emblems [Valaris] - struct guild *g; - struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); - if (gc && gc->guild_id > 0) - { - g = guild_search (gc->guild_id); - if (g) - { - WBUFL (buf, 28) = gc->guild_id; - WBUFL (buf, 24) = g->emblem_id; - } - } - } // End addition - WBUFPOS2 (buf, 50, md->bl.x, md->bl.y, md->to_x, md->to_y); WBUFB (buf, 56) = 5; WBUFB (buf, 57) = 5; @@ -1171,8 +1043,6 @@ static int clif_mob007b (struct mob_data *md, unsigned char *buf) */ static int clif_npc0078 (struct npc_data *nd, unsigned char *buf) { - struct guild *g; - nullpo_retr (0, nd); memset (buf, 0, packet_len_table[0x78]); @@ -1181,12 +1051,6 @@ static int clif_npc0078 (struct npc_data *nd, unsigned char *buf) WBUFL (buf, 2) = nd->bl.id; WBUFW (buf, 6) = nd->speed; WBUFW (buf, 14) = nd->npc_class; - if ((nd->npc_class == 722) && (nd->u.scr.guild_id > 0) - && ((g = guild_search (nd->u.scr.guild_id)) != NULL)) - { - WBUFL (buf, 22) = g->emblem_id; - WBUFL (buf, 26) = g->guild_id; - } WBUFPOS (buf, 46, nd->bl.x, nd->bl.y); WBUFB (buf, 48) |= nd->dir & 0x0f; WBUFB (buf, 49) = 5; @@ -1291,13 +1155,6 @@ int clif_spawnpc (struct map_session_data *sd) if (sd->spiritball > 0) clif_spiritball (sd); - if (sd->status.guild_id > 0) - { // force display of guild emblem [Valaris] - struct guild *g = guild_search (sd->status.guild_id); - if (g) - clif_guild_emblem (sd, g); - } // end addition [Valaris] - if (sd->status.pc_class == 13 || sd->status.pc_class == 21 || sd->status.pc_class == 4014 || sd->status.pc_class == 4022) pc_setoption (sd, sd->status.option | 0x0020); // [Valaris] @@ -2201,135 +2058,6 @@ int clif_storageequiplist (struct map_session_data *sd, struct storage *stor) } /*========================================== - * - *------------------------------------------ - */ -int clif_guildstorageitemlist (struct map_session_data *sd, - struct guild_storage *stor) -{ - struct item_data *id; - int i, n, fd; - unsigned char *buf; - - nullpo_retr (0, sd); - nullpo_retr (0, stor); - - fd = sd->fd; - buf = WFIFOP (fd, 0); - - WBUFW (buf, 0) = 0x1f0; - for (i = 0, n = 0; i < MAX_GUILD_STORAGE; i++) - { - if (stor->storage_[i].nameid <= 0) - continue; - nullpo_retr (0, id = itemdb_search (stor->storage_[i].nameid)); - if (itemdb_isequip2 (id)) - continue; - - WBUFW (buf, n * 18 + 4) = i + 1; - if (id->view_id > 0) - WBUFW (buf, n * 18 + 6) = id->view_id; - else - WBUFW (buf, n * 18 + 6) = stor->storage_[i].nameid; - WBUFB (buf, n * 18 + 8) = id->type;; - WBUFB (buf, n * 18 + 9) = stor->storage_[i].identify; - WBUFW (buf, n * 18 + 10) = stor->storage_[i].amount; - WBUFW (buf, n * 18 + 12) = 0; - WBUFW (buf, n * 18 + 14) = stor->storage_[i].card[0]; - WBUFW (buf, n * 18 + 16) = stor->storage_[i].card[1]; - WBUFW (buf, n * 18 + 18) = stor->storage_[i].card[2]; - WBUFW (buf, n * 18 + 20) = stor->storage_[i].card[3]; - n++; - } - if (n) - { - WBUFW (buf, 2) = 4 + n * 18; - WFIFOSET (fd, WFIFOW (fd, 2)); - } - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int clif_guildstorageequiplist (struct map_session_data *sd, - struct guild_storage *stor) -{ - struct item_data *id; - int i, j, n, fd; - unsigned char *buf; - - nullpo_retr (0, sd); - - fd = sd->fd; - buf = WFIFOP (fd, 0); - - WBUFW (buf, 0) = 0xa6; - for (i = 0, n = 0; i < MAX_GUILD_STORAGE; i++) - { - if (stor->storage_[i].nameid <= 0) - continue; - nullpo_retr (0, id = itemdb_search (stor->storage_[i].nameid)); - if (!itemdb_isequip2 (id)) - continue; - WBUFW (buf, n * 20 + 4) = i + 1; - if (id->view_id > 0) - WBUFW (buf, n * 20 + 6) = id->view_id; - else - WBUFW (buf, n * 20 + 6) = stor->storage_[i].nameid; - WBUFB (buf, n * 20 + 8) = id->type; - WBUFB (buf, n * 20 + 9) = stor->storage_[i].identify; - WBUFW (buf, n * 20 + 10) = id->equip; - WBUFW (buf, n * 20 + 12) = stor->storage_[i].equip; - if (stor->storage_[i].broken == 1) - WBUFB (buf, n * 20 + 14) = 1; // is weapon broken [Valaris] - else - WBUFB (buf, n * 20 + 14) = stor->storage_[i].attribute; - WBUFB (buf, n * 20 + 15) = stor->storage_[i].refine; - if (stor->storage_[i].card[0] == 0x00ff - || stor->storage_[i].card[0] == 0x00fe - || stor->storage_[i].card[0] == (short) 0xff00) - { - WBUFW (buf, n * 20 + 16) = stor->storage_[i].card[0]; - WBUFW (buf, n * 20 + 18) = stor->storage_[i].card[1]; - WBUFW (buf, n * 20 + 20) = stor->storage_[i].card[2]; - WBUFW (buf, n * 20 + 22) = stor->storage_[i].card[3]; - } - else - { - if (stor->storage_[i].card[0] > 0 - && (j = itemdb_viewid (stor->storage_[i].card[0])) > 0) - WBUFW (buf, n * 20 + 16) = j; - else - WBUFW (buf, n * 20 + 16) = stor->storage_[i].card[0]; - if (stor->storage_[i].card[1] > 0 - && (j = itemdb_viewid (stor->storage_[i].card[1])) > 0) - WBUFW (buf, n * 20 + 18) = j; - else - WBUFW (buf, n * 20 + 18) = stor->storage_[i].card[1]; - if (stor->storage_[i].card[2] > 0 - && (j = itemdb_viewid (stor->storage_[i].card[2])) > 0) - WBUFW (buf, n * 20 + 20) = j; - else - WBUFW (buf, n * 20 + 20) = stor->storage_[i].card[2]; - if (stor->storage_[i].card[3] > 0 - && (j = itemdb_viewid (stor->storage_[i].card[3])) > 0) - WBUFW (buf, n * 20 + 22) = j; - else - WBUFW (buf, n * 20 + 22) = stor->storage_[i].card[3]; - } - n++; - } - if (n) - { - WBUFW (buf, 2) = 4 + n * 20; - WFIFOSET (fd, WFIFOW (fd, 2)); - } - return 0; -} - -/*========================================== * ステータスを送りつける * 表示専用数字はこの中で計算して送る *------------------------------------------ @@ -3440,91 +3168,6 @@ int clif_storageitemadded (struct map_session_data *sd, struct storage *stor, } /*========================================== - * - *------------------------------------------ - */ -int clif_updateguildstorageamount (struct map_session_data *sd, - struct guild_storage *stor) -{ - int fd; - - nullpo_retr (0, sd); - nullpo_retr (0, stor); - - fd = sd->fd; - WFIFOW (fd, 0) = 0xf2; // update storage amount - WFIFOW (fd, 2) = stor->storage_amount; //items - WFIFOW (fd, 4) = MAX_GUILD_STORAGE; //items max - WFIFOSET (fd, packet_len_table[0xf2]); - - return 0; -} - -/*========================================== - * - *------------------------------------------ - */ -int clif_guildstorageitemadded (struct map_session_data *sd, - struct guild_storage *stor, int index, - int amount) -{ - int view, fd, j; - - nullpo_retr (0, sd); - nullpo_retr (0, stor); - - fd = sd->fd; - WFIFOW (fd, 0) = 0xf4; // Storage item added - WFIFOW (fd, 2) = index + 1; // index - WFIFOL (fd, 4) = amount; // amount - if ((view = itemdb_viewid (stor->storage_[index].nameid)) > 0) - WFIFOW (fd, 8) = view; - else - WFIFOW (fd, 8) = stor->storage_[index].nameid; // id - WFIFOB (fd, 10) = stor->storage_[index].identify; //identify flag - if (stor->storage_[index].broken == 1) - WFIFOB (fd, 11) = 1; // is weapon broken [Valaris] - else - WFIFOB (fd, 11) = stor->storage_[index].attribute; // attribute - WFIFOB (fd, 12) = stor->storage_[index].refine; //refine - if (stor->storage_[index].card[0] == 0x00ff - || stor->storage_[index].card[0] == 0x00fe - || stor->storage_[index].card[0] == (short) 0xff00) - { - WFIFOW (fd, 13) = stor->storage_[index].card[0]; //card (4w) - WFIFOW (fd, 15) = stor->storage_[index].card[1]; //card (4w) - WFIFOW (fd, 17) = stor->storage_[index].card[2]; //card (4w) - WFIFOW (fd, 19) = stor->storage_[index].card[3]; //card (4w) - } - else - { - if (stor->storage_[index].card[0] > 0 - && (j = itemdb_viewid (stor->storage_[index].card[0])) > 0) - WFIFOW (fd, 13) = j; - else - WFIFOW (fd, 13) = stor->storage_[index].card[0]; - if (stor->storage_[index].card[1] > 0 - && (j = itemdb_viewid (stor->storage_[index].card[1])) > 0) - WFIFOW (fd, 15) = j; - else - WFIFOW (fd, 15) = stor->storage_[index].card[1]; - if (stor->storage_[index].card[2] > 0 - && (j = itemdb_viewid (stor->storage_[index].card[2])) > 0) - WFIFOW (fd, 17) = j; - else - WFIFOW (fd, 17) = stor->storage_[index].card[2]; - if (stor->storage_[index].card[3] > 0 - && (j = itemdb_viewid (stor->storage_[index].card[3])) > 0) - WFIFOW (fd, 19) = j; - else - WFIFOW (fd, 19) = stor->storage_[index].card[3]; - } - WFIFOSET (fd, packet_len_table[0xf4]); - - return 0; -} - -/*========================================== * カプラ倉庫からアイテムを取り去る *------------------------------------------ */ @@ -5744,718 +5387,6 @@ int clif_mvp_exp (struct map_session_data *sd, int exp) } /*========================================== - * ギルド作成可否通知 - * Relay the result of guild creation. - * - * (R 0167 <flag>.B) - * - * flag: - * 0 The guild was created. - * 1 The character is already in a guild. - * 2 The guild name is invalid/taken. - * 3 The Emperium item is required. - *------------------------------------------ - */ -int clif_guild_created (struct map_session_data *sd, int flag) -{ - int fd; - - nullpo_retr (0, sd); - - fd = sd->fd; - WFIFOW (fd, 0) = 0x167; - WFIFOB (fd, 2) = flag; - WFIFOSET (fd, packet_len_table[0x167]); - return 0; -} - -/*========================================== - * ギルド所属通知 - *------------------------------------------ - */ -int clif_guild_belonginfo (struct map_session_data *sd, struct guild *g) -{ - int ps, fd; - - nullpo_retr (0, sd); - nullpo_retr (0, g); - - fd = sd->fd; - ps = guild_getposition (sd, g); - - memset (WFIFOP (fd, 0), 0, packet_len_table[0x16c]); - WFIFOW (fd, 0) = 0x16c; - WFIFOL (fd, 2) = g->guild_id; - WFIFOL (fd, 6) = g->emblem_id; - WFIFOL (fd, 10) = g->position[ps].mode; - memcpy (WFIFOP (fd, 19), g->name, 24); - WFIFOSET (fd, packet_len_table[0x16c]); - return 0; -} - -/*========================================== - * ギルドメンバログイン通知 - *------------------------------------------ - */ -int clif_guild_memberlogin_notice (struct guild *g, int idx, int flag) -{ - unsigned char buf[64]; - - nullpo_retr (0, g); - - WBUFW (buf, 0) = 0x16d; - WBUFL (buf, 2) = g->member[idx].account_id; - WBUFL (buf, 6) = 0; - WBUFL (buf, 10) = flag; - if (g->member[idx].sd == NULL) - { - struct map_session_data *sd = guild_getavailablesd (g); - if (sd != NULL) - clif_send (buf, packet_len_table[0x16d], &sd->bl, GUILD); - } - else - clif_send (buf, packet_len_table[0x16d], &g->member[idx].sd->bl, - GUILD_WOS); - return 0; -} - -/*========================================== - * ギルドマスター通知(14dへの応答) - *------------------------------------------ - */ -static -int clif_guild_masterormember (struct map_session_data *sd) -{ - int type = 0x57, fd; - struct guild *g; - - nullpo_retr (0, sd); - - fd = sd->fd; - g = guild_search (sd->status.guild_id); - if (g != NULL && strcmp (g->master, sd->status.name) == 0) - type = 0xd7; - WFIFOW (fd, 0) = 0x14e; - WFIFOL (fd, 2) = type; - WFIFOSET (fd, packet_len_table[0x14e]); - return 0; -} - -/*========================================== - * Basic Info (Territories [Valaris]) - *------------------------------------------ - */ -int clif_guild_basicinfo (struct map_session_data *sd) -{ - int fd, i, t = 0; - struct guild *g; - struct guild_castle *gc = NULL; - - nullpo_retr (0, sd); - - fd = sd->fd; - g = guild_search (sd->status.guild_id); - if (g == NULL) - return 0; - - WFIFOW (fd, 0) = 0x1b6; //0x150; - WFIFOL (fd, 2) = g->guild_id; - WFIFOL (fd, 6) = g->guild_lv; - WFIFOL (fd, 10) = g->connect_member; - WFIFOL (fd, 14) = g->max_member; - WFIFOL (fd, 18) = g->average_lv; - WFIFOL (fd, 22) = g->exp; - WFIFOL (fd, 26) = g->next_exp; - WFIFOL (fd, 30) = 0; // 上納 - WFIFOL (fd, 34) = 0; // VW(性格の悪さ?:性向グラフ左右) - WFIFOL (fd, 38) = 0; // RF(正義の度合い?:性向グラフ上下) - WFIFOL (fd, 42) = 0; // 人数? - memcpy (WFIFOP (fd, 46), g->name, 24); - memcpy (WFIFOP (fd, 70), g->master, 24); - - for (i = 0; i < MAX_GUILDCASTLE; i++) - { - gc = guild_castle_search (i); - if (!gc) - continue; - if (g->guild_id == gc->guild_id) - t++; - } - - if (t == 1) - memcpy (WFIFOP (fd, 94), "One Castle", 20); - else if (t == 2) - memcpy (WFIFOP (fd, 94), "Two Castles", 20); - else if (t == 3) - memcpy (WFIFOP (fd, 94), "Three Castles", 20); - else if (t == 4) - memcpy (WFIFOP (fd, 94), "Four Castles", 20); - else if (t == 5) - memcpy (WFIFOP (fd, 94), "Five Castles", 20); - else if (t == 6) - memcpy (WFIFOP (fd, 94), "Six Castles", 20); - else if (t == 7) - memcpy (WFIFOP (fd, 94), "Seven Castles", 20); - else if (t == 8) - memcpy (WFIFOP (fd, 94), "Eight Castles", 20); - else if (t == 9) - memcpy (WFIFOP (fd, 94), "Nine Castles", 20); - else if (t == 10) - memcpy (WFIFOP (fd, 94), "Ten Castles", 20); - else if (t == 11) - memcpy (WFIFOP (fd, 94), "Eleven Castles", 20); - else if (t == 12) - memcpy (WFIFOP (fd, 94), "Twelve Castles", 20); - else if (t == 13) - memcpy (WFIFOP (fd, 94), "Thirteen Castles", 20); - else if (t == 14) - memcpy (WFIFOP (fd, 94), "Fourteen Castles", 20); - else if (t == 15) - memcpy (WFIFOP (fd, 94), "Fifteen Castles", 20); - else if (t == 16) - memcpy (WFIFOP (fd, 94), "Sixteen Castles", 20); - else if (t == 17) - memcpy (WFIFOP (fd, 94), "Seventeen Castles", 20); - else if (t == 18) - memcpy (WFIFOP (fd, 94), "Eighteen Castles", 20); - else if (t == 19) - memcpy (WFIFOP (fd, 94), "Nineteen Castles", 20); - else if (t == 20) - memcpy (WFIFOP (fd, 94), "Twenty Castles", 20); - else if (t == 21) - memcpy (WFIFOP (fd, 94), "Twenty One Castles", 20); - else if (t == 22) - memcpy (WFIFOP (fd, 94), "Twenty Two Castles", 20); - else if (t == 23) - memcpy (WFIFOP (fd, 94), "Twenty Three Castles", 20); - else if (t == 24) - memcpy (WFIFOP (fd, 94), "Twenty Four Castles", 20); - else if (t == MAX_GUILDCASTLE) - memcpy (WFIFOP (fd, 94), "Total Domination", 20); - else - memcpy (WFIFOP (fd, 94), "None Taken", 20); - - WFIFOSET (fd, packet_len_table[WFIFOW (fd, 0)]); - clif_guild_emblem (sd, g); // Guild emblem vanish fix [Valaris] - return 0; -} - -/*========================================== - * ギルド同盟/敵対情報 - *------------------------------------------ - */ -int clif_guild_allianceinfo (struct map_session_data *sd) -{ - int fd, i, c; - struct guild *g; - - nullpo_retr (0, sd); - - fd = sd->fd; - g = guild_search (sd->status.guild_id); - if (g == NULL) - return 0; - WFIFOW (fd, 0) = 0x14c; - for (i = c = 0; i < MAX_GUILDALLIANCE; i++) - { - GuildAlliance *a = &g->alliance[i]; - if (a->guild_id > 0) - { - WFIFOL (fd, c * 32 + 4) = a->opposition; - WFIFOL (fd, c * 32 + 8) = a->guild_id; - memcpy (WFIFOP (fd, c * 32 + 12), a->name, 24); - c++; - } - } - WFIFOW (fd, 2) = c * 32 + 4; - WFIFOSET (fd, WFIFOW (fd, 2)); - return 0; -} - -/*========================================== - * ギルドメンバーリスト - *------------------------------------------ - */ -int clif_guild_memberlist (struct map_session_data *sd) -{ - int fd; - int i, c; - struct guild *g; - - nullpo_retr (0, sd); - - fd = sd->fd; - g = guild_search (sd->status.guild_id); - if (g == NULL) - return 0; - - WFIFOW (fd, 0) = 0x154; - for (i = 0, c = 0; i < g->max_member; i++) - { - struct guild_member *m = &g->member[i]; - if (m->account_id == 0) - continue; - WFIFOL (fd, c * 104 + 4) = m->account_id; - WFIFOL (fd, c * 104 + 8) = 0; - WFIFOW (fd, c * 104 + 12) = m->hair; - WFIFOW (fd, c * 104 + 14) = m->hair_color; - WFIFOW (fd, c * 104 + 16) = m->gender; - WFIFOW (fd, c * 104 + 18) = m->pc_class; - WFIFOW (fd, c * 104 + 20) = m->lv; - WFIFOL (fd, c * 104 + 22) = m->exp; - WFIFOL (fd, c * 104 + 26) = m->online; - WFIFOL (fd, c * 104 + 30) = m->position; - memset (WFIFOP (fd, c * 104 + 34), 0, 50); // メモ? - memcpy (WFIFOP (fd, c * 104 + 84), m->name, 24); - c++; - } - WFIFOW (fd, 2) = c * 104 + 4; - WFIFOSET (fd, WFIFOW (fd, 2)); - return 0; -} - -/*========================================== - * ギルド役職名リスト - *------------------------------------------ - */ -static -int clif_guild_positionnamelist (struct map_session_data *sd) -{ - int i, fd; - struct guild *g; - - nullpo_retr (0, sd); - - fd = sd->fd; - g = guild_search (sd->status.guild_id); - if (g == NULL) - return 0; - WFIFOW (fd, 0) = 0x166; - for (i = 0; i < MAX_GUILDPOSITION; i++) - { - WFIFOL (fd, i * 28 + 4) = i; - memcpy (WFIFOP (fd, i * 28 + 8), g->position[i].name, 24); - } - WFIFOW (fd, 2) = i * 28 + 4; - WFIFOSET (fd, WFIFOW (fd, 2)); - return 0; -} - -/*========================================== - * ギルド役職情報リスト - *------------------------------------------ - */ -static -int clif_guild_positioninfolist (struct map_session_data *sd) -{ - int i, fd; - struct guild *g; - - nullpo_retr (0, sd); - - fd = sd->fd; - g = guild_search (sd->status.guild_id); - if (g == NULL) - return 0; - WFIFOW (fd, 0) = 0x160; - for (i = 0; i < MAX_GUILDPOSITION; i++) - { - struct guild_position *p = &g->position[i]; - WFIFOL (fd, i * 16 + 4) = i; - WFIFOL (fd, i * 16 + 8) = p->mode; - WFIFOL (fd, i * 16 + 12) = i; - WFIFOL (fd, i * 16 + 16) = p->exp_mode; - } - WFIFOW (fd, 2) = i * 16 + 4; - WFIFOSET (fd, WFIFOW (fd, 2)); - return 0; -} - -/*========================================== - * ギルド役職変更通知 - *------------------------------------------ - */ -int clif_guild_positionchanged (struct guild *g, int idx) -{ - struct map_session_data *sd; - unsigned char buf[128]; - - nullpo_retr (0, g); - - WBUFW (buf, 0) = 0x174; - WBUFW (buf, 2) = 44; - WBUFL (buf, 4) = idx; - WBUFL (buf, 8) = g->position[idx].mode; - WBUFL (buf, 12) = idx; - WBUFL (buf, 16) = g->position[idx].exp_mode; - memcpy (WBUFP (buf, 20), g->position[idx].name, 24); - if ((sd = guild_getavailablesd (g)) != NULL) - clif_send (buf, WBUFW (buf, 2), &sd->bl, GUILD); - return 0; -} - -/*========================================== - * ギルドメンバ変更通知 - *------------------------------------------ - */ -int clif_guild_memberpositionchanged (struct guild *g, int idx) -{ - struct map_session_data *sd; - unsigned char buf[64]; - - nullpo_retr (0, g); - - WBUFW (buf, 0) = 0x156; - WBUFW (buf, 2) = 16; - WBUFL (buf, 4) = g->member[idx].account_id; - WBUFL (buf, 8) = 0; - WBUFL (buf, 12) = g->member[idx].position; - if ((sd = guild_getavailablesd (g)) != NULL) - clif_send (buf, WBUFW (buf, 2), &sd->bl, GUILD); - return 0; -} - -/*========================================== - * ギルドエンブレム送信 - *------------------------------------------ - */ -int clif_guild_emblem (struct map_session_data *sd, struct guild *g) -{ - int fd; - - nullpo_retr (0, sd); - nullpo_retr (0, g); - - fd = sd->fd; - - if (g->emblem_len <= 0) - return 0; - WFIFOW (fd, 0) = 0x152; - WFIFOW (fd, 2) = g->emblem_len + 12; - WFIFOL (fd, 4) = g->guild_id; - WFIFOL (fd, 8) = g->emblem_id; - memcpy (WFIFOP (fd, 12), g->emblem_data, g->emblem_len); - WFIFOSET (fd, WFIFOW (fd, 2)); - return 0; -} - -/*========================================== - * ギルドスキル送信 - *------------------------------------------ - */ -int clif_guild_skillinfo (struct map_session_data *sd) -{ - int fd; - int i, id, c; - struct guild *g; - - nullpo_retr (0, sd); - - fd = sd->fd; - g = guild_search (sd->status.guild_id); - if (g == NULL) - return 0; - WFIFOW (fd, 0) = 0x0162; - WFIFOW (fd, 4) = g->skill_point; - for (i = c = 0; i < MAX_GUILDSKILL; i++) - { - if (g->skill[i].id > 0) - { - WFIFOW (fd, c * 37 + 6) = id = g->skill[i].id; - WFIFOW (fd, c * 37 + 8) = guild_skill_get_inf (id); - WFIFOW (fd, c * 37 + 10) = 0; - WFIFOW (fd, c * 37 + 12) = g->skill[i].lv; - WFIFOW (fd, c * 37 + 14) = - guild_skill_get_sp (id, g->skill[i].lv); - WFIFOW (fd, c * 37 + 16) = guild_skill_get_range (id); - memset (WFIFOP (fd, c * 37 + 18), 0, 24); - WFIFOB (fd, c * 37 + 42) = //up; - (g->skill[i].lv < guild_skill_get_max (id)) ? 1 : 0; - c++; - } - } - WFIFOW (fd, 2) = c * 37 + 6; - WFIFOSET (fd, WFIFOW (fd, 2)); - return 0; -} - -/*========================================== - * ギルド告知送信 - *------------------------------------------ - */ -int clif_guild_notice (struct map_session_data *sd, struct guild *g) -{ - int fd; - - nullpo_retr (0, sd); - nullpo_retr (0, g); - - fd = sd->fd; - if (*g->mes1 == 0 && *g->mes2 == 0) - return 0; - WFIFOW (fd, 0) = 0x16f; - memcpy (WFIFOP (fd, 2), g->mes1, 60); - memcpy (WFIFOP (fd, 62), g->mes2, 120); - WFIFOSET (fd, packet_len_table[0x16f]); - return 0; -} - -/*========================================== - * ギルドメンバ勧誘 - *------------------------------------------ - */ -int clif_guild_invite (struct map_session_data *sd, struct guild *g) -{ - int fd; - - nullpo_retr (0, sd); - nullpo_retr (0, g); - - fd = sd->fd; - WFIFOW (fd, 0) = 0x16a; - WFIFOL (fd, 2) = g->guild_id; - memcpy (WFIFOP (fd, 6), g->name, 24); - WFIFOSET (fd, packet_len_table[0x16a]); - return 0; -} - -/*========================================== - * ギルドメンバ勧誘結果 - *------------------------------------------ - */ -int clif_guild_inviteack (struct map_session_data *sd, int flag) -{ - int fd; - - nullpo_retr (0, sd); - - fd = sd->fd; - WFIFOW (fd, 0) = 0x169; - WFIFOB (fd, 2) = flag; - WFIFOSET (fd, packet_len_table[0x169]); - return 0; -} - -/*========================================== - * ギルドメンバ脱退通知 - *------------------------------------------ - */ -int clif_guild_leave (struct map_session_data *sd, const char *name, - const char *mes) -{ - unsigned char buf[128]; - - nullpo_retr (0, sd); - - WBUFW (buf, 0) = 0x15a; - memcpy (WBUFP (buf, 2), name, 24); - memcpy (WBUFP (buf, 26), mes, 40); - clif_send (buf, packet_len_table[0x15a], &sd->bl, GUILD); - return 0; -} - -/*========================================== - * ギルドメンバ追放通知 - *------------------------------------------ - */ -int clif_guild_explusion (struct map_session_data *sd, const char *name, - const char *mes, int account_id) -{ - unsigned char buf[128]; - - nullpo_retr (0, sd); - - WBUFW (buf, 0) = 0x15c; - memcpy (WBUFP (buf, 2), name, 24); - memcpy (WBUFP (buf, 26), mes, 40); - memcpy (WBUFP (buf, 66), "dummy", 24); - clif_send (buf, packet_len_table[0x15c], &sd->bl, GUILD); - return 0; -} - -/*========================================== - * ギルド追放メンバリスト - *------------------------------------------ - */ -static -int clif_guild_explusionlist (struct map_session_data *sd) -{ - int fd; - int i, c; - struct guild *g; - - nullpo_retr (0, sd); - - fd = sd->fd; - g = guild_search (sd->status.guild_id); - if (g == NULL) - return 0; - WFIFOW (fd, 0) = 0x163; - for (i = c = 0; i < MAX_GUILDEXPLUSION; i++) - { - GuildExpulsion *e = &g->explusion[i]; - if (e->account_id > 0) - { - memcpy (WFIFOP (fd, c * 88 + 4), e->name, 24); - memcpy (WFIFOP (fd, c * 88 + 28), e->acc, 24); - memcpy (WFIFOP (fd, c * 88 + 52), e->mes, 44); - c++; - } - } - WFIFOW (fd, 2) = c * 88 + 4; - WFIFOSET (fd, WFIFOW (fd, 2)); - return 0; -} - -/*========================================== - * ギルド会話 - *------------------------------------------ - */ -int clif_guild_message (struct guild *g, int account_id, const char *mes, - int len) -{ - struct map_session_data *sd; - unsigned char lbuf[255]; - unsigned char *buf = lbuf; - if (len + 32 >= sizeof (lbuf)) - buf = (unsigned char *)malloc (len + 32); - WBUFW (buf, 0) = 0x17f; - WBUFW (buf, 2) = len + 4; - memcpy (WBUFP (buf, 4), mes, len); - - if ((sd = guild_getavailablesd (g)) != NULL) - clif_send (buf, WBUFW (buf, 2), &sd->bl, GUILD); - if (buf != lbuf) - free (buf); - return 0; -} - -/*========================================== - * ギルドスキル割り振り通知 - *------------------------------------------ - */ -int clif_guild_skillup (struct map_session_data *sd, int skill_num, int lv) -{ - int fd; - - nullpo_retr (0, sd); - - fd = sd->fd; - WFIFOW (fd, 0) = 0x10e; - WFIFOW (fd, 2) = skill_num; - WFIFOW (fd, 4) = lv; - WFIFOW (fd, 6) = guild_skill_get_sp (skill_num, lv); - WFIFOW (fd, 8) = guild_skill_get_range (skill_num); - WFIFOB (fd, 10) = 1; - WFIFOSET (fd, 11); - return 0; -} - -/*========================================== - * ギルド同盟要請 - *------------------------------------------ - */ -int clif_guild_reqalliance (struct map_session_data *sd, int account_id, - const char *name) -{ - int fd; - - nullpo_retr (0, sd); - - fd = sd->fd; - WFIFOW (fd, 0) = 0x171; - WFIFOL (fd, 2) = account_id; - memcpy (WFIFOP (fd, 6), name, 24); - WFIFOSET (fd, packet_len_table[0x171]); - return 0; -} - -/*========================================== - * ギルド同盟結果 - *------------------------------------------ - */ -int clif_guild_allianceack (struct map_session_data *sd, int flag) -{ - int fd; - - nullpo_retr (0, sd); - - fd = sd->fd; - WFIFOW (fd, 0) = 0x173; - WFIFOL (fd, 2) = flag; - WFIFOSET (fd, packet_len_table[0x173]); - return 0; -} - -/*========================================== - * ギルド関係解消通知 - *------------------------------------------ - */ -int clif_guild_delalliance (struct map_session_data *sd, int guild_id, - int flag) -{ - int fd; - - nullpo_retr (0, sd); - - fd = sd->fd; - WFIFOW (fd, 0) = 0x184; - WFIFOL (fd, 2) = guild_id; - WFIFOL (fd, 6) = flag; - WFIFOSET (fd, packet_len_table[0x184]); - return 0; -} - -/*========================================== - * ギルド敵対結果 - *------------------------------------------ - */ -int clif_guild_oppositionack (struct map_session_data *sd, int flag) -{ - int fd; - - nullpo_retr (0, sd); - - fd = sd->fd; - WFIFOW (fd, 0) = 0x181; - WFIFOB (fd, 2) = flag; - WFIFOSET (fd, packet_len_table[0x181]); - return 0; -} - -/*========================================== - * ギルド関係追加 - *------------------------------------------ - */ -/*int clif_guild_allianceadded(struct guild *g,int idx) -{ - unsigned char buf[64]; - WBUFW(fd,0)=0x185; - WBUFL(fd,2)=g->alliance[idx].opposition; - WBUFL(fd,6)=g->alliance[idx].guild_id; - memcpy(WBUFP(fd,10),g->alliance[idx].name,24); - clif_send(buf,packet_len_table[0x185],guild_getavailablesd(g),GUILD); - return 0; -}*/ - -/*========================================== - * ギルド解散通知 - *------------------------------------------ - */ -int clif_guild_broken (struct map_session_data *sd, int flag) -{ - int fd; - - nullpo_retr (0, sd); - - fd = sd->fd; - WFIFOW (fd, 0) = 0x15e; - WFIFOL (fd, 2) = flag; - WFIFOSET (fd, packet_len_table[0x15e]); - return 0; -} - -/*========================================== * エモーション *------------------------------------------ */ @@ -6819,17 +5750,12 @@ void clif_parse_LoadEndAck (int fd, struct map_session_data *sd) clif_initialstatus (sd); // party party_send_movemap (sd); - // guild - guild_send_memberinfoshort (sd, 1); // 119 // 78 if (battle_config.pc_invincible_time > 0) { - if (map[sd->bl.m].flag.gvg) - pc_setinvincibletimer (sd, battle_config.pc_invincible_time << 1); - else - pc_setinvincibletimer (sd, battle_config.pc_invincible_time); + pc_setinvincibletimer (sd, battle_config.pc_invincible_time); } map_addblock (&sd->bl); // ブロック登録 @@ -6859,29 +5785,12 @@ void clif_parse_LoadEndAck (int fd, struct map_session_data *sd) { sd->pvp_timer = -1; } - if (map[sd->bl.m].flag.gvg) - { - clif_set0199 (sd->fd, 3); - } if (sd->state.connect_new) { sd->state.connect_new = 0; if (sd->status.pc_class != sd->view_class) clif_changelook (&sd->bl, LOOK_BASE, sd->view_class); - -/* Stop players from spawning inside castles [Valaris] */ - - { - struct guild_castle *gc = guild_mapname2gc (map[sd->bl.m].name); - if (gc) - pc_setpos (sd, sd->status.save_point.map, - sd->status.save_point.x, sd->status.save_point.y, - 2); - } - -/* End Addition [Valaris] */ - } // view equipment item @@ -6965,7 +5874,7 @@ void clif_parse_WalkToXY (int fd, struct map_session_data *sd) return; } - if (sd->npc_id != 0 || sd->state.storage_flag) + if (sd->npc_id != 0 || sd->state.storage_open) return; if (sd->skilltimer != -1 && pc_checkskill (sd, SA_FREECAST) <= 0) // フリーキャスト @@ -7073,31 +5982,12 @@ void clif_parse_GetCharNameRequest (int fd, struct map_session_data *sd) memcpy (WFIFOP (fd, 6), ssd->status.name, 24); WFIFOSET (fd, packet_len_table[0x95]); - struct guild *g = NULL; struct party *p = NULL; - const char *guild_name = "", *guild_pos = "", *party_name = ""; + const char *party_name = ""; int send = 0; - if (ssd->status.guild_id > 0 && (g = guild_search (ssd->status.guild_id)) != NULL) - { - // there used to be a comment near here, but the code has changed slightly - // ギルド所属ならパケット0195を返す - // google says that means: 0195 return if the packet belongs Guild - int i, ps = -1; - for (i = 0; i < g->max_member; i++) - { - if (g->member[i].account_id == ssd->status.account_id) - ps = g->member[i].position; - } - if (ps >= 0 && ps < MAX_GUILDPOSITION) - { - guild_name = g->name; - guild_pos = g->position[ps].name; - send = 1; - } - } if (ssd->status.party_id > 0 && (p = party_search (ssd->status.party_id)) != NULL) { party_name = p->name; @@ -7109,9 +5999,9 @@ void clif_parse_GetCharNameRequest (int fd, struct map_session_data *sd) WFIFOW (fd, 0) = 0x195; WFIFOL (fd, 2) = account_id; memcpy (WFIFOP (fd, 6), party_name, 24); - memcpy (WFIFOP (fd, 30), guild_name, 24); - memcpy (WFIFOP (fd, 54), guild_pos, 24); - memcpy (WFIFOP (fd, 78), guild_pos, 24); // We send this value twice because the client expects it + memcpy (WFIFOP (fd, 30), "", 24); + memcpy (WFIFOP (fd, 54), "", 24); + memcpy (WFIFOP (fd, 78), "", 24); // We send this value twice because the client expects it WFIFOSET (fd, packet_len_table[0x195]); } @@ -7359,7 +6249,7 @@ void clif_parse_ActionRequest (int fd, struct map_session_data *sd) clif_clearchar_area (&sd->bl, 1); return; } - if (sd->npc_id != 0 || sd->opt1 > 0 || sd->status.option & 2 || sd->state.storage_flag || + if (sd->npc_id != 0 || sd->opt1 > 0 || sd->status.option & 2 || sd->state.storage_open || (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り sd->sc_data[SC_DANCING].timer != -1))) @@ -8062,7 +6952,7 @@ void clif_parse_UseSkillToId (int fd, struct map_session_data *sd) if (map[sd->bl.m].flag.noskill) return; - if (sd->chatID || sd->npc_id != 0 || sd->state.storage_flag) + if (sd->chatID || sd->npc_id != 0 || sd->state.storage_open) return; skilllv = RFIFOW (fd, 2); @@ -8141,7 +7031,7 @@ void clif_parse_UseSkillToPos (int fd, struct map_session_data *sd) if (map[sd->bl.m].flag.noskill) return; - if (sd->npc_id != 0 || sd->state.storage_flag) + if (sd->npc_id != 0 || sd->state.storage_open) return; if (sd->chatID) return; @@ -8438,13 +7328,11 @@ void clif_parse_MoveToKafra (int fd, struct map_session_data *sd) item_amount = RFIFOL (fd, 4); if ((sd->npc_id != 0 && !sd->npc_flags.storage) || sd->trade_partner != 0 - || !sd->state.storage_flag) + || !sd->state.storage_open) return; - if (sd->state.storage_flag == 1) + if (sd->state.storage_open) storage_storageadd (sd, item_index, item_amount); - else if (sd->state.storage_flag == 2) - storage_guild_storageadd (sd, item_index, item_amount); } /*========================================== @@ -8462,13 +7350,11 @@ void clif_parse_MoveFromKafra (int fd, struct map_session_data *sd) item_amount = RFIFOL (fd, 4); if ((sd->npc_id != 0 && !sd->npc_flags.storage) || sd->trade_partner != 0 - || !sd->state.storage_flag) + || !sd->state.storage_open) return; - if (sd->state.storage_flag == 1) + if (sd->state.storage_open) storage_storageget (sd, item_index, item_amount); - else if (sd->state.storage_flag == 2) - storage_guild_storageget (sd, item_index, item_amount); } /*========================================== @@ -8481,13 +7367,10 @@ void clif_parse_MoveToKafraFromCart (int fd, struct map_session_data *sd) nullpo_retv (sd); if ((sd->npc_id != 0 && !sd->npc_flags.storage) || sd->trade_partner != 0 - || !sd->state.storage_flag) + || !sd->state.storage_open) return; - if (sd->state.storage_flag == 1) + if (sd->state.storage_open) storage_storageaddfromcart (sd, RFIFOW (fd, 2) - 2, RFIFOL (fd, 4)); - else if (sd->state.storage_flag == 2) - storage_guild_storageaddfromcart (sd, RFIFOW (fd, 2) - 2, - RFIFOL (fd, 4)); } /*========================================== @@ -8500,13 +7383,10 @@ void clif_parse_MoveFromKafraToCart (int fd, struct map_session_data *sd) nullpo_retv (sd); if ((sd->npc_id != 0 && !sd->npc_flags.storage) || sd->trade_partner != 0 - || !sd->state.storage_flag) + || !sd->state.storage_open) return; - if (sd->state.storage_flag == 1) + if (sd->state.storage_open) storage_storagegettocart (sd, RFIFOW (fd, 2) - 1, RFIFOL (fd, 4)); - else if (sd->state.storage_flag == 2) - storage_guild_storagegettocart (sd, RFIFOW (fd, 2) - 1, - RFIFOL (fd, 4)); } /*========================================== @@ -8518,10 +7398,8 @@ void clif_parse_CloseKafra (int fd, struct map_session_data *sd) { nullpo_retv (sd); - if (sd->state.storage_flag == 1) + if (sd->state.storage_open) storage_storageclose (sd); - else if (sd->state.storage_flag == 2) - storage_guild_storageclose (sd); } /*========================================== @@ -8712,291 +7590,6 @@ void clif_parse_GM_Monster_Item (int fd, struct map_session_data *sd) } } -/*========================================== - * ギルドを作る - * Process request to create a guild. - * - * (S 0165 <account_ID>.l <guild_name>.24B) - * - * Note: The account ID seems to be ignored. - *------------------------------------------ - */ -static -void clif_parse_CreateGuild (int fd, struct map_session_data *sd) -{ - guild_create (sd, (const char *)RFIFOP (fd, 6)); -} - -/*========================================== - * ギルドマスターかどうか確認 - *------------------------------------------ - */ -static -void clif_parse_GuildCheckMaster (int fd, struct map_session_data *sd) -{ - clif_guild_masterormember (sd); -} - -/*========================================== - * ギルド情報要求 - *------------------------------------------ - */ -static -void clif_parse_GuildReqeustInfo (int fd, struct map_session_data *sd) -{ - switch (RFIFOL (fd, 2)) - { - case 0: // ギルド基本情報、同盟敵対情報 - clif_guild_basicinfo (sd); - clif_guild_allianceinfo (sd); - break; - case 1: // メンバーリスト、役職名リスト - clif_guild_positionnamelist (sd); - clif_guild_memberlist (sd); - break; - case 2: // 役職名リスト、役職情報リスト - clif_guild_positionnamelist (sd); - clif_guild_positioninfolist (sd); - break; - case 3: // スキルリスト - clif_guild_skillinfo (sd); - break; - case 4: // 追放リスト - clif_guild_explusionlist (sd); - break; - default: - if (battle_config.error_log) - printf ("clif: guild request info: unknown type %d\n", - RFIFOL (fd, 2)); - break; - } -} - -/*========================================== - * ギルド役職変更 - *------------------------------------------ - */ -static -void clif_parse_GuildChangePositionInfo (int fd, struct map_session_data *sd) -{ - struct guild *g; - int i, ps; - - nullpo_retv (sd); - - g = guild_search (sd->status.guild_id); - - if (g == NULL) - return; - - if ((ps = guild_getposition (sd, g)) < 0 - || (!(g->position[ps].mode & 0x0010) && strcmp (g->master, sd->status.name))) - return; - - for (i = 4; i < RFIFOW (fd, 2); i += 40) - { - guild_change_position (sd, RFIFOL (fd, i), RFIFOL (fd, i + 4), - RFIFOL (fd, i + 12), (const char *)RFIFOP (fd, i + 16)); - } -} - -/*========================================== - * ギルドメンバ役職変更 - *------------------------------------------ - */ -static -void clif_parse_GuildChangeMemberPosition (int fd, - struct map_session_data *sd) -{ - struct guild *g; - int i, ps; - - nullpo_retv (sd); - - g = guild_search (sd->status.guild_id); - - if (g == NULL) - return; - - if ((ps = guild_getposition (sd, g)) < 0 - || (!(g->position[ps].mode & 0x0010) && strcmp (g->master, sd->status.name))) - return; - - for (i = 4; i < RFIFOW (fd, 2); i += 12) - { - guild_change_memberposition (sd->status.guild_id, - RFIFOL (fd, i), RFIFOL (fd, i + 4), - RFIFOL (fd, i + 8)); - } -} - -/*========================================== - * ギルドエンブレム要求 - *------------------------------------------ - */ -static -void clif_parse_GuildRequestEmblem (int fd, struct map_session_data *sd) -{ - struct guild *g = guild_search (RFIFOL (fd, 2)); - if (g != NULL) - clif_guild_emblem (sd, g); -} - -/*========================================== - * ギルドエンブレム変更 - *------------------------------------------ - */ -static -void clif_parse_GuildChangeEmblem (int fd, struct map_session_data *sd) -{ - guild_change_emblem (sd, RFIFOW (fd, 2) - 4, (const char *)RFIFOP (fd, 4)); -} - -/*========================================== - * ギルド告知変更 - *------------------------------------------ - */ -static -void clif_parse_GuildChangeNotice (int fd, struct map_session_data *sd) -{ - guild_change_notice (sd, RFIFOL (fd, 2), (const char *)RFIFOP (fd, 6), (const char *)RFIFOP (fd, 66)); -} - -/*========================================== - * ギルド勧誘 - *------------------------------------------ - */ -static -void clif_parse_GuildInvite (int fd, struct map_session_data *sd) -{ - guild_invite (sd, RFIFOL (fd, 2)); -} - -/*========================================== - * ギルド勧誘返信 - *------------------------------------------ - */ -static -void clif_parse_GuildReplyInvite (int fd, struct map_session_data *sd) -{ - guild_reply_invite (sd, RFIFOL (fd, 2), RFIFOB (fd, 6)); -} - -/*========================================== - * ギルド脱退 - *------------------------------------------ - */ -static -void clif_parse_GuildLeave (int fd, struct map_session_data *sd) -{ - guild_leave (sd, RFIFOL (fd, 2), RFIFOL (fd, 6), RFIFOL (fd, 10), - (const char *)RFIFOP (fd, 14)); -} - -/*========================================== - * ギルド追放 - *------------------------------------------ - */ -static -void clif_parse_GuildExplusion (int fd, struct map_session_data *sd) -{ - guild_explusion (sd, RFIFOL (fd, 2), RFIFOL (fd, 6), RFIFOL (fd, 10), - (const char *)RFIFOP (fd, 14)); -} - -/*========================================== - * ギルド会話 - * Validate and process transmission of a - * guild message. - * - * (S 017e <len>.w <message>.?B) - *------------------------------------------ - */ -static -void clif_parse_GuildMessage (int fd, struct map_session_data *sd) -{ - size_t message_len = 0; - char *buf = NULL; - char *message = NULL; /* The message text only. */ - - nullpo_retv (sd); - - if (!(buf = clif_validate_chat (sd, 2, &message, &message_len))) - { - clif_displaymessage (fd, "Your message could not be sent."); - return; - } - - if (is_atcommand (fd, sd, message, 0) != AtCommand_None - || (sd->sc_data && (sd->sc_data[SC_BERSERK].timer != -1 //バーサーク時は会話も不可 - || sd->sc_data[SC_NOCHAT].timer != -1))) //チャット禁止 - { - free (buf); - return; - } - - /* Don't send chat that results in an automatic ban. */ - if (tmw_CheckChatSpam (sd, message)) - { - free (buf); - clif_displaymessage (fd, "Your message could not be sent."); - return; - } - - guild_send_message (sd, buf + 8, RFIFOW (fd, 2) - 4); - free (buf); -} - -/*========================================== - * ギルド同盟要求 - *------------------------------------------ - */ -static -void clif_parse_GuildRequestAlliance (int fd, struct map_session_data *sd) -{ - guild_reqalliance (sd, RFIFOL (fd, 2)); -} - -/*========================================== - * ギルド同盟要求返信 - *------------------------------------------ - */ -static -void clif_parse_GuildReplyAlliance (int fd, struct map_session_data *sd) -{ - guild_reply_reqalliance (sd, RFIFOL (fd, 2), RFIFOL (fd, 6)); -} - -/*========================================== - * ギルド関係解消 - *------------------------------------------ - */ -static -void clif_parse_GuildDelAlliance (int fd, struct map_session_data *sd) -{ - guild_delalliance (sd, RFIFOL (fd, 2), RFIFOL (fd, 6)); -} - -/*========================================== - * ギルド敵対 - *------------------------------------------ - */ -static -void clif_parse_GuildOpposition (int fd, struct map_session_data *sd) -{ - guild_opposition (sd, RFIFOL (fd, 2)); -} - -/*========================================== - * ギルド解散 - *------------------------------------------ - */ -static -void clif_parse_GuildBreak (int fd, struct map_session_data *sd) -{ - guild_break (sd, (const char *)RFIFOP (fd, 2)); -} - // Kick (right click menu for GM "(name) force to quit") static void clif_parse_GMKick (int fd, struct map_session_data *sd) @@ -9789,44 +8382,44 @@ func_table clif_parse_func_table[0x220] = { NULL, 0 }, // 14a { NULL, 0 }, // 14b { NULL, 0 }, // 14c - { clif_parse_GuildCheckMaster, 0 }, // 14d + { NULL, 0 }, // 14d { NULL, 0 }, // 14e - { clif_parse_GuildReqeustInfo, 0 }, // 14f + { NULL, 0 }, // 14f { NULL, 0 }, // 150 - { clif_parse_GuildRequestEmblem, 0 }, // 151 + { NULL, 0 }, // 151 { NULL, 0 }, // 152 - { clif_parse_GuildChangeEmblem, 0 }, // 153 + { NULL, 0 }, // 153 { NULL, 0 }, // 154 - { clif_parse_GuildChangeMemberPosition, 0 }, // 155 + { NULL, 0 }, // 155 { NULL, 0 }, // 156 { NULL, 0 }, // 157 { NULL, 0 }, // 158 - { clif_parse_GuildLeave, 0 }, // 159 + { NULL, 0 }, // 159 { NULL, 0 }, // 15a - { clif_parse_GuildExplusion, 0 }, // 15b + { NULL, 0 }, // 15b { NULL, 0 }, // 15c - { clif_parse_GuildBreak, 0 }, // 15d + { NULL, 0 }, // 15d { NULL, 0 }, // 15e { NULL, 0 }, // 15f { NULL, 0 }, // 160 - { clif_parse_GuildChangePositionInfo, 0 }, // 161 + { NULL, 0 }, // 161 { NULL, 0 }, // 162 { NULL, 0 }, // 163 { NULL, 0 }, // 164 - { clif_parse_CreateGuild, 0 }, // 165 + { NULL, 0 }, // 165 { NULL, 0 }, // 166 { NULL, 0 }, // 167 - { clif_parse_GuildInvite, 2000 }, // 168 + { NULL, 0 }, // 168 { NULL, 0 }, // 169 { NULL, 0 }, // 16a - { clif_parse_GuildReplyInvite, 0 }, // 16b + { NULL, 0 }, // 16b { NULL, 0 }, // 16c { NULL, 0 }, // 16d - { clif_parse_GuildChangeNotice, 0 }, // 16e + { NULL, 0 }, // 16e { NULL, 0 }, // 16f - { clif_parse_GuildRequestAlliance, 0 }, // 170 + { NULL, 0 }, // 170 { NULL, 0 }, // 171 - { clif_parse_GuildReplyAlliance, 0 }, // 172 + { NULL, 0 }, // 172 { NULL, 0 }, // 173 { NULL, 0 }, // 174 { NULL, 0 }, // 175 @@ -9838,12 +8431,12 @@ func_table clif_parse_func_table[0x220] = { NULL, 0 }, // 17b { clif_parse_InsertCard, 0 }, // 17c { NULL, 0 }, // 17d - { clif_parse_GuildMessage, 300 }, // 17e + { NULL, 0 }, // 17e { NULL, 0 }, // 17f - { clif_parse_GuildOpposition, 0 }, // 180 + { NULL, 0 }, // 180 { NULL, 0 }, // 181 { NULL, 0 }, // 182 - { clif_parse_GuildDelAlliance, 0 }, // 183 + { NULL, 0 }, // 183 { NULL, 0 }, // 184 { NULL, 0 }, // 185 { NULL, 0 }, // 186 diff --git a/src/map/clif.hpp b/src/map/clif.hpp index f4bc40b..998730d 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -111,15 +111,6 @@ int clif_storageitemadded (struct map_session_data *sd, struct storage *stor, int clif_storageitemremoved (struct map_session_data *sd, int index, int amount); int clif_storageclose (struct map_session_data *sd); -int clif_guildstorageitemlist (struct map_session_data *sd, - struct guild_storage *stor); -int clif_guildstorageequiplist (struct map_session_data *sd, - struct guild_storage *stor); -int clif_updateguildstorageamount (struct map_session_data *sd, - struct guild_storage *stor); -int clif_guildstorageitemadded (struct map_session_data *sd, - struct guild_storage *stor, int index, - int amount); void clif_pcinsight (struct block_list *, va_list); // map_forallinmovearea callback void clif_pcoutsight (struct block_list *, va_list); // map_forallinmovearea callback @@ -223,35 +214,6 @@ int clif_party_move (struct party *p, struct map_session_data *sd, int clif_party_xy (struct party *p, struct map_session_data *sd); int clif_party_hp (struct party *p, struct map_session_data *sd); -// guild -int clif_guild_created (struct map_session_data *sd, int flag); -int clif_guild_belonginfo (struct map_session_data *sd, struct guild *g); -int clif_guild_basicinfo (struct map_session_data *sd); -int clif_guild_allianceinfo (struct map_session_data *sd); -int clif_guild_memberlist (struct map_session_data *sd); -int clif_guild_skillinfo (struct map_session_data *sd); -int clif_guild_memberlogin_notice (struct guild *g, int idx, int flag); -int clif_guild_invite (struct map_session_data *sd, struct guild *g); -int clif_guild_inviteack (struct map_session_data *sd, int flag); -int clif_guild_leave (struct map_session_data *sd, const char *name, - const char *mes); -int clif_guild_explusion (struct map_session_data *sd, const char *name, - const char *mes, int account_id); -int clif_guild_positionchanged (struct guild *g, int idx); -int clif_guild_memberpositionchanged (struct guild *g, int idx); -int clif_guild_emblem (struct map_session_data *sd, struct guild *g); -int clif_guild_notice (struct map_session_data *sd, struct guild *g); -int clif_guild_message (struct guild *g, int account_id, const char *mes, - int len); -int clif_guild_skillup (struct map_session_data *sd, int skill_num, int lv); -int clif_guild_reqalliance (struct map_session_data *sd, int account_id, - const char *name); -int clif_guild_allianceack (struct map_session_data *sd, int flag); -int clif_guild_delalliance (struct map_session_data *sd, int guild_id, - int flag); -int clif_guild_oppositionack (struct map_session_data *sd, int flag); -int clif_guild_broken (struct map_session_data *sd, int flag); - // atcommand int clif_displaymessage (int fd, const char *mes); int clif_disp_onlyself (struct map_session_data *sd, const char *mes, int len); diff --git a/src/map/guild.cpp b/src/map/guild.cpp deleted file mode 100644 index eba856d..0000000 --- a/src/map/guild.cpp +++ /dev/null @@ -1,1922 +0,0 @@ -// $Id: guild.c,v 1.5 2004/09/25 05:32:18 MouseJstr Exp $ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "guild.hpp" -#include "storage.hpp" -#include "../common/db.hpp" -#include "../common/timer.hpp" -#include "../common/socket.hpp" -#include "../common/nullpo.hpp" -#include "battle.hpp" -#include "npc.hpp" -#include "pc.hpp" -#include "map.hpp" -#include "mob.hpp" -#include "intif.hpp" -#include "clif.hpp" -#include "tmw.hpp" - -#ifdef MEMWATCH -#include "memwatch.hpp" -#endif - -static struct dbt *guild_db; -static struct dbt *castle_db; -static struct dbt *guild_expcache_db; -static struct dbt *guild_infoevent_db; -static struct dbt *guild_castleinfoevent_db; - -struct eventlist -{ - char name[50]; - struct eventlist *next; -}; - -// ギルドのEXPキャッシュのフラッシュに関連する定数 -#define GUILD_PAYEXP_INVERVAL 10000 // 間隔(キャッシュの最大生存時間、ミリ秒) -#define GUILD_PAYEXP_LIST 8192 // キャッシュの最大数 - -// ギルドのEXPキャッシュ -struct guild_expcache -{ - int guild_id, account_id, char_id, exp; -}; - -// ギルドスキルdbのアクセサ(今は直打ちで代用) -int guild_skill_get_inf (int id) -{ - return 0; -} - -int guild_skill_get_sp (int id, int lv) -{ - return 0; -} - -int guild_skill_get_range (int id) -{ - return 0; -} - -int guild_skill_get_max (int id) -{ - return (id == 10004) ? 10 : 1; -} - -// ギルドスキルがあるか確認 -int guild_checkskill (struct guild *g, int id) -{ - return g->skill[id - 10000].lv; -} - -void guild_payexp_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t data); -void guild_gvg_eliminate_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t data); - -static int guild_read_castledb (void) -{ - FILE *fp; - char line[1024]; - int j, ln = 0; - char *str[32], *p; - struct guild_castle *gc; - - if ((fp = fopen_ ("db/castle_db.txt", "r")) == NULL) - { - printf ("can't read db/castle_db.txt\n"); - return -1; - } - - while (fgets (line, 1020, fp)) - { - if (line[0] == '/' && line[1] == '/') - continue; - memset (str, 0, sizeof (str)); - CREATE (gc, struct guild_castle, 1); - for (j = 0, p = line; j < 6 && p; j++) - { - str[j] = p; - p = strchr (p, ','); - if (p) - *p++ = 0; - } - - gc->guild_id = 0; // <Agit> Clear Data for Initialize - gc->economy = 0; - gc->defense = 0; - gc->triggerE = 0; - gc->triggerD = 0; - gc->nextTime = 0; - gc->payTime = 0; - gc->createTime = 0; - gc->visibleC = 0; - gc->visibleG0 = 0; - gc->visibleG1 = 0; - gc->visibleG2 = 0; - gc->visibleG3 = 0; - gc->visibleG4 = 0; - gc->visibleG5 = 0; - gc->visibleG6 = 0; - gc->visibleG7 = 0; - gc->Ghp0 = 0; - gc->Ghp1 = 0; - gc->Ghp2 = 0; - gc->Ghp3 = 0; - gc->Ghp4 = 0; - gc->Ghp5 = 0; - gc->Ghp6 = 0; - gc->Ghp7 = 0; // guardian HP [Valaris] - - gc->castle_id = atoi (str[0]); - memcpy (gc->map_name, str[1], 24); - memcpy (gc->castle_name, str[2], 24); - memcpy (gc->castle_event, str[3], 24); - - numdb_insert (castle_db, gc->castle_id, gc); - - //intif_guild_castle_info(gc->castle_id); - - ln++; - } - fclose_ (fp); - printf ("read db/castle_db.txt done (count=%d)\n", ln); - return 0; -} - -// 初期化 -void do_init_guild (void) -{ - guild_db = numdb_init (); - castle_db = numdb_init (); - guild_expcache_db = numdb_init (); - guild_infoevent_db = numdb_init (); - guild_castleinfoevent_db = numdb_init (); - - guild_read_castledb (); - - add_timer_interval (gettick () + GUILD_PAYEXP_INVERVAL, - guild_payexp_timer, 0, 0, GUILD_PAYEXP_INVERVAL); -} - -// 検索 -struct guild *guild_search (int guild_id) -{ - return (struct guild *)numdb_search (guild_db, guild_id); -} - -static -void guild_searchname_sub (db_key_t key, db_val_t data, va_list ap) -{ - struct guild *g = (struct guild *) data, **dst; - char *str; - str = va_arg (ap, char *); - dst = va_arg (ap, struct guild **); - if (strcasecmp (g->name, str) == 0) - *dst = g; -} - -// ギルド名検索 -struct guild *guild_searchname (const char *str) -{ - struct guild *g = NULL; - numdb_foreach (guild_db, guild_searchname_sub, str, &g); - return g; -} - -struct guild_castle *guild_castle_search (int gcid) -{ - return (struct guild_castle *)numdb_search (castle_db, gcid); -} - -// mapnameに対応したアジトのgcを返す -struct guild_castle *guild_mapname2gc (const char *mapname) -{ - int i; - struct guild_castle *gc = NULL; - for (i = 0; i < MAX_GUILDCASTLE; i++) - { - gc = guild_castle_search (i); - if (!gc) - continue; - if (strcmp (gc->map_name, mapname) == 0) - return gc; - } - return NULL; -} - -// ログイン中のギルドメンバーの1人のsdを返す -struct map_session_data *guild_getavailablesd (struct guild *g) -{ - int i; - - nullpo_retr (NULL, g); - - for (i = 0; i < g->max_member; i++) - if (g->member[i].sd != NULL) - return g->member[i].sd; - return NULL; -} - -// ギルドメンバーのインデックスを返す -int guild_getindex (struct guild *g, int account_id, int char_id) -{ - int i; - if (g == NULL) - return -1; - for (i = 0; i < g->max_member; i++) - if (g->member[i].account_id == account_id) - return i; - return -1; -} - -// ギルドメンバーの役職を返す -int guild_getposition (struct map_session_data *sd, struct guild *g) -{ - int i; - - nullpo_retr (-1, sd); - - if (g == NULL && (g = guild_search (sd->status.guild_id)) == NULL) - return -1; - for (i = 0; i < g->max_member; i++) - if (g->member[i].account_id == sd->status.account_id) - return g->member[i].position; - return -1; -} - -// メンバー情報の作成 -static -void guild_makemember (struct guild_member *m, struct map_session_data *sd) -{ - nullpo_retv (sd); - - memset (m, 0, sizeof (struct guild_member)); - m->account_id = sd->status.account_id; - m->char_id = 0; - m->hair = sd->status.hair; - m->hair_color = sd->status.hair_color; - m->gender = sd->sex; - m->pc_class = sd->status.pc_class; - m->lv = sd->status.base_level; - m->exp = 0; - m->exp_payper = 0; - m->online = 1; - m->position = MAX_GUILDPOSITION - 1; - memcpy (m->name, sd->status.name, 24); - return; -} - -// ギルド競合確認 -static -int guild_check_conflict (struct map_session_data *sd) -{ - nullpo_retr (0, sd); - - intif_guild_checkconflict (sd->status.guild_id, - sd->status.account_id, 0 /*char_id*/); - return 0; -} - -// ギルドのEXPキャッシュをinter鯖にフラッシュする -static -void guild_payexp_timer_sub (db_key_t key, db_val_t data, va_list ap) -{ - int i, *dellist, *delp, dataid = key.i; - struct guild_expcache *c; - struct guild *g; - - nullpo_retv (ap); - nullpo_retv (c = (struct guild_expcache *) data); - nullpo_retv (dellist = va_arg (ap, int *)); - nullpo_retv (delp = va_arg (ap, int *)); - - if (*delp >= GUILD_PAYEXP_LIST - || (g = guild_search (c->guild_id)) == NULL) - return; - if ((i = guild_getindex (g, c->account_id, 0 /*c->char_id*/)) < 0) - return; - - g->member[i].exp += c->exp; - intif_guild_change_memberinfo (g->guild_id, c->account_id, 0 /*char_id*/, - GMI_EXP, &g->member[i].exp, - sizeof (g->member[i].exp)); - c->exp = 0; - - dellist[(*delp)++] = dataid; - free (c); -} - -void guild_payexp_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t data) -{ - int dellist[GUILD_PAYEXP_LIST], delp = 0, i; - numdb_foreach (guild_expcache_db, guild_payexp_timer_sub, dellist, &delp); - for (i = 0; i < delp; i++) - numdb_erase (guild_expcache_db, dellist[i]); -// if(battle_config.etc_log) -// printf("guild exp %d charactor's exp flushed !\n",delp); -} - -//------------------------------------------------------------------------ - -/* Process a guild creation request. */ -int guild_create (struct map_session_data *sd, const char *name) -{ - char pname[24]; - - nullpo_retr (0, sd); - - strncpy (pname, name, 24); - pname[23] = '\0'; - tmw_TrimStr (pname); - - /* The guild name is empty/invalid. */ - if (!*pname) - clif_guild_created (sd, 2); - - /* Make sure the character isn't already in a guild. */ - if (sd->status.guild_id == 0) - { - /* - * A special item is required to create a guild. This is specified - * in battle_athena.conf as guild_emperium_check. This item will - * be removed from the player's inventory when used to create a - * guild. - */ - if (!battle_config.guild_emperium_check - || pc_search_inventory (sd, - battle_config.guild_emperium_check) >= 0) - { - struct guild_member m; - guild_makemember (&m, sd); - m.position = 0; - intif_guild_create (pname, &m); - } - else - clif_guild_created (sd, 3); - } - else - clif_guild_created (sd, 1); - - return 0; -} - -/* Relay the result of a guild creation request. */ -int guild_created (int account_id, int guild_id) -{ - struct map_session_data *sd = map_id2sd (account_id); - - if (!sd) - return 0; - - /* The guild name is valid and not already taken. */ - if (guild_id > 0) - { - struct guild *g; - sd->status.guild_id = guild_id; - sd->guild_sended = 0; - - if ((g = (struct guild *)numdb_search (guild_db, guild_id)) != NULL) - { - printf ("guild_created(): ID already exists!\n"); - exit (1); - } - - /* The guild was created successfully. */ - clif_guild_created (sd, 0); - - if (battle_config.guild_emperium_check) - pc_delitem (sd, - pc_search_inventory (sd, - battle_config. - guild_emperium_check), 1, 0); - } - else - clif_guild_created (sd, 2); - - return 0; -} - -// 情報要求 -int guild_request_info (int guild_id) -{ -// if(battle_config.etc_log) -// printf("guild_request_info\n"); - return intif_guild_request_info (guild_id); -} - -// イベント付き情報要求 -int guild_npc_request_info (int guild_id, const char *event) -{ - struct eventlist *ev; - - if (guild_search (guild_id)) - { - if (event && *event) - npc_event_do (event); - return 0; - } - - if (event == NULL || *event == 0) - return guild_request_info (guild_id); - - CREATE (ev, struct eventlist, 1); - memcpy (ev->name, event, sizeof (ev->name)); - ev->next = - (struct eventlist *) numdb_search (guild_infoevent_db, guild_id); - numdb_insert (guild_infoevent_db, guild_id, ev); - return guild_request_info (guild_id); -} - -// 所属キャラの確認 -static -int guild_check_member (const struct guild *g) -{ - int i; - struct map_session_data *sd; - - nullpo_retr (0, g); - - for (i = 0; i < fd_max; i++) - { - if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth) - { - if (sd->status.guild_id == g->guild_id) - { - int j, f = 1; - for (j = 0; j < MAX_GUILD; j++) - { // データがあるか - if (g->member[j].account_id == sd->status.account_id) - f = 0; - } - if (f) - { - sd->status.guild_id = 0; - sd->guild_sended = 0; - sd->guild_emblem_id = 0; - if (battle_config.error_log) - printf ("guild: check_member %d[%s] is not member\n", - sd->status.account_id, sd->status.name); - } - } - } - } - return 0; -} - -// 情報所得失敗(そのIDのキャラを全部未所属にする) -int guild_recv_noinfo (int guild_id) -{ - int i; - struct map_session_data *sd; - for (i = 0; i < fd_max; i++) - { - if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth) - { - if (sd->status.guild_id == guild_id) - sd->status.guild_id = 0; - } - } - return 0; -} - -// 情報所得 -int guild_recv_info (struct guild *sg) -{ - struct guild *g, before; - int i, bm, m; - struct eventlist *ev, *ev2; - - nullpo_retr (0, sg); - - if ((g = (struct guild *)numdb_search (guild_db, sg->guild_id)) == NULL) - { - CREATE (g, struct guild, 1); - numdb_insert (guild_db, sg->guild_id, g); - before = *sg; - - // 最初のロードなのでユーザーのチェックを行う - guild_check_member (sg); - } - else - before = *g; - memcpy (g, sg, sizeof (struct guild)); - - for (i = bm = m = 0; i < g->max_member; i++) - { // sdの設定と人数の確認 - if (g->member[i].account_id > 0) - { - struct map_session_data *sd = map_id2sd (g->member[i].account_id); - g->member[i].sd = (sd != NULL && - sd->status.guild_id == - g->guild_id) ? sd : NULL; - m++; - } - else - g->member[i].sd = NULL; - if (before.member[i].account_id > 0) - bm++; - } - - for (i = 0; i < g->max_member; i++) - { // 情報の送信 - struct map_session_data *sd = g->member[i].sd; - if (sd == NULL) - continue; - - if (before.guild_lv != g->guild_lv || bm != m || - before.max_member != g->max_member) - { - clif_guild_basicinfo (sd); // 基本情報送信 - clif_guild_emblem (sd, g); // エンブレム送信 - } - - if (bm != m) - { // メンバー情報送信 - clif_guild_memberlist (g->member[i].sd); - } - - if (before.skill_point != g->skill_point) - clif_guild_skillinfo (sd); // スキル情報送信 - - if (sd->guild_sended == 0) - { // 未送信なら所属情報も送る - clif_guild_belonginfo (sd, g); - clif_guild_notice (sd, g); - sd->guild_emblem_id = g->emblem_id; - sd->guild_sended = 1; - } - } - - // イベントの発生 - if ((ev = (struct eventlist *)numdb_search (guild_infoevent_db, sg->guild_id)) != NULL) - { - numdb_erase (guild_infoevent_db, sg->guild_id); - for (; ev; ev2 = ev->next, free (ev), ev = ev2) - { - npc_event_do (ev->name); - } - } - - return 0; -} - -// ギルドへの勧誘 -int guild_invite (struct map_session_data *sd, int account_id) -{ - struct map_session_data *tsd; - struct guild *g; - int i; - - nullpo_retr (0, sd); - - tsd = map_id2sd (account_id); - g = guild_search (sd->status.guild_id); - - if (tsd == NULL || g == NULL) - return 0; - if (!battle_config.invite_request_check) - { - if (tsd->party_invite > 0 || tsd->trade_partner) - { // 相手が取引中かどうか - clif_guild_inviteack (sd, 0); - return 0; - } - } - if (tsd->status.guild_id > 0 || tsd->guild_invite > 0) - { // 相手の所属確認 - clif_guild_inviteack (sd, 0); - return 0; - } - - // 定員確認 - for (i = 0; i < g->max_member; i++) - if (g->member[i].account_id == 0) - break; - if (i == g->max_member) - { - clif_guild_inviteack (sd, 3); - return 0; - } - - tsd->guild_invite = sd->status.guild_id; - tsd->guild_invite_account = sd->status.account_id; - - clif_guild_invite (tsd, g); - return 0; -} - -// ギルド勧誘への返答 -int guild_reply_invite (struct map_session_data *sd, int guild_id, int flag) -{ - struct map_session_data *tsd; - - nullpo_retr (0, sd); - nullpo_retr (0, tsd = map_id2sd (sd->guild_invite_account)); - - if (sd->guild_invite != guild_id) // 勧誘とギルドIDが違う - return 0; - - if (flag == 1) - { // 承諾 - struct guild_member m; - struct guild *g; - int i; - - // 定員確認 - if ((g = guild_search (tsd->status.guild_id)) == NULL) - { - sd->guild_invite = 0; - sd->guild_invite_account = 0; - return 0; - } - for (i = 0; i < g->max_member; i++) - if (g->member[i].account_id == 0) - break; - if (i == g->max_member) - { - sd->guild_invite = 0; - sd->guild_invite_account = 0; - clif_guild_inviteack (tsd, 3); - return 0; - } - - //inter鯖へ追加要求 - guild_makemember (&m, sd); - intif_guild_addmember (sd->guild_invite, &m); - return 0; - } - else - { // 拒否 - sd->guild_invite = 0; - sd->guild_invite_account = 0; - if (tsd == NULL) - return 0; - clif_guild_inviteack (tsd, 1); - } - return 0; -} - -// ギルドメンバが追加された -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 guild *g; - - if ((g = guild_search (guild_id)) == NULL) - return 0; - - if ((sd == NULL || sd->guild_invite == 0) && flag == 0) - { - // キャラ側に登録できなかったため脱退要求を出す - if (battle_config.error_log) - printf ("guild: member added error %d is not online\n", - account_id); - intif_guild_leave (guild_id, account_id, 0 /*char_id*/, 0, "**登録失敗**"); - return 0; - } - sd->guild_invite = 0; - sd->guild_invite_account = 0; - - sd2 = map_id2sd (sd->guild_invite_account); - - if (flag == 1) - { // 失敗 - if (sd2 != NULL) - clif_guild_inviteack (sd2, 3); - return 0; - } - - // 成功 - sd->guild_sended = 0; - sd->status.guild_id = guild_id; - - if (sd2 != NULL) - clif_guild_inviteack (sd2, 2); - - // いちおう競合確認 - guild_check_conflict (sd); - - return 0; -} - -// ギルド脱退要求 -int guild_leave (struct map_session_data *sd, int guild_id, - int account_id, int char_id, const char *mes) -{ - struct guild *g; - int i; - - nullpo_retr (0, sd); - - g = guild_search (sd->status.guild_id); - - if (g == NULL) - return 0; - - if (sd->status.account_id != account_id || - sd->status.guild_id != guild_id) - return 0; - - for (i = 0; i < g->max_member; i++) - { // 所属しているか - if (g->member[i].account_id == sd->status.account_id) - { - intif_guild_leave (g->guild_id, sd->status.account_id, - sd->status.char_id, 0, mes); - return 0; - } - } - return 0; -} - -// ギルド追放要求 -int guild_explusion (struct map_session_data *sd, int guild_id, - int account_id, int char_id, const char *mes) -{ - struct guild *g; - int i, ps; - - nullpo_retr (0, sd); - - g = guild_search (sd->status.guild_id); - - if (g == NULL) - return 0; - - if (sd->status.guild_id != guild_id) - return 0; - - if ((ps = guild_getposition (sd, g)) < 0 - || !(g->position[ps].mode & 0x0010)) - return 0; // 処罰権限無し - - for (i = 0; i < g->max_member; i++) - { // 所属しているか - if (g->member[i].account_id == account_id) - { - intif_guild_leave (g->guild_id, account_id, 0 /*char_id*/, 1, mes); - return 0; - } - } - return 0; -} - -// ギルドメンバが脱退した -int guild_member_leaved (int guild_id, int account_id, int char_id, int flag, - const char *name, const char *mes) -{ - struct map_session_data *sd = map_id2sd (account_id); - struct guild *g = guild_search (guild_id); - int i; - - if (g != NULL) - { - int i; - for (i = 0; i < g->max_member; i++) - if (g->member[i].account_id == account_id) - { - struct map_session_data *sd2 = sd; - if (sd2 == NULL) - sd2 = guild_getavailablesd (g); - else - { - if (flag == 0) - clif_guild_leave (sd2, name, mes); - else - clif_guild_explusion (sd2, name, mes, account_id); - } - g->member[i].account_id = 0; - g->member[i].sd = NULL; - } - } - if (sd != NULL && sd->status.guild_id == guild_id) - { - if (sd->state.storage_flag == 2) //Close the guild storage. - storage_guild_storageclose (sd); - sd->status.guild_id = 0; - sd->guild_emblem_id = 0; - sd->guild_sended = 0; - } - - // メンバーリストを全員に再通知 - for (i = 0; i < g->max_member; i++) - { - if (g->member[i].sd != NULL) - clif_guild_memberlist (g->member[i].sd); - } - - return 0; -} - -// ギルドメンバのオンライン状態/Lv更新送信 -int guild_send_memberinfoshort (struct map_session_data *sd, int online) -{ - struct guild *g; - - nullpo_retr (0, sd); - - if (sd->status.guild_id <= 0) - return 0; - g = guild_search (sd->status.guild_id); - if (g == NULL) - return 0; - - intif_guild_memberinfoshort (g->guild_id, - sd->status.account_id, 0 /*char_id*/, - online, sd->status.base_level, - sd->status.pc_class); - - if (!online) - { // ログアウトするならsdをクリアして終了 - int i = - guild_getindex (g, sd->status.account_id, 0 /*char_id*/); - if (i >= 0) - g->member[i].sd = NULL; - return 0; - } - - if (sd->guild_sended != 0) // ギルド初期送信データは送信済み - return 0; - - // 競合確認 - guild_check_conflict (sd); - - // あるならギルド初期送信データ送信 - if ((g = guild_search (sd->status.guild_id)) != NULL) - { - guild_check_member (g); // 所属を確認する - if (sd->status.guild_id == g->guild_id) - { - clif_guild_belonginfo (sd, g); - clif_guild_notice (sd, g); - sd->guild_sended = 1; - sd->guild_emblem_id = g->emblem_id; - } - } - return 0; -} - -// ギルドメンバのオンライン状態/Lv更新通知 -int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id, - int online, int lv, int pc_class) -{ - int i, alv, c, idx = 0, om = 0, oldonline = -1; - struct guild *g = guild_search (guild_id); - if (g == NULL) - return 0; - for (i = 0, alv = 0, c = 0, om = 0; i < g->max_member; i++) - { - struct guild_member *m = &g->member[i]; - if (m->account_id == account_id) - { - oldonline = m->online; - m->online = online; - m->lv = lv; - m->pc_class = pc_class; - idx = i; - } - if (m->account_id > 0) - { - alv += m->lv; - c++; - } - if (m->online) - om++; - } - if (idx == g->max_member) - { - if (battle_config.error_log) - printf ("guild: not found member %d,%d on %d[%s]\n", account_id, - char_id, guild_id, g->name); - return 0; - } - g->average_lv = alv / c; - g->connect_member = om; - - if (oldonline != online) // オンライン状態が変わったので通知 - clif_guild_memberlogin_notice (g, idx, online); - - for (i = 0; i < g->max_member; i++) - { // sd再設定 - struct map_session_data *sd = map_id2sd (g->member[i].account_id); - g->member[i].sd = (sd != NULL && - sd->status.guild_id == guild_id) ? sd : NULL; - } - - // ここにクライアントに送信処理が必要 - - return 0; -} - -// ギルド会話送信 -int guild_send_message (struct map_session_data *sd, const char *mes, int len) -{ - nullpo_retr (0, sd); - - if (sd->status.guild_id == 0) - return 0; - intif_guild_message (sd->status.guild_id, sd->status.account_id, mes, - len); - return 0; -} - -// ギルド会話受信 -int guild_recv_message (int guild_id, int account_id, const char *mes, int len) -{ - struct guild *g; - if ((g = guild_search (guild_id)) == NULL) - return 0; - clif_guild_message (g, account_id, mes, len); - return 0; -} - -// ギルドメンバの役職変更 -int guild_change_memberposition (int guild_id, int account_id, int char_id, - int idx) -{ - return intif_guild_change_memberinfo (guild_id, account_id, 0 /*char_id*/, - GMI_POSITION, &idx, sizeof (idx)); -} - -// ギルドメンバの役職変更通知 -int guild_memberposition_changed (struct guild *g, int idx, int pos) -{ - nullpo_retr (0, g); - - g->member[idx].position = pos; - clif_guild_memberpositionchanged (g, idx); - return 0; -} - -// ギルド役職変更 -int guild_change_position (struct map_session_data *sd, int idx, - int mode, int exp_mode, const char *name) -{ - struct guild_position p; - - nullpo_retr (0, sd); - - if (exp_mode > battle_config.guild_exp_limit) - exp_mode = battle_config.guild_exp_limit; - if (exp_mode < 0) - exp_mode = 0; - p.mode = mode; - p.exp_mode = exp_mode; - memcpy (p.name, name, 24); - return intif_guild_position (sd->status.guild_id, idx, &p); -} - -// ギルド役職変更通知 -int guild_position_changed (int guild_id, int idx, struct guild_position *p) -{ - struct guild *g = guild_search (guild_id); - if (g == NULL) - return 0; - memcpy (&g->position[idx], p, sizeof (struct guild_position)); - clif_guild_positionchanged (g, idx); - return 0; -} - -// ギルド告知変更 -int guild_change_notice (struct map_session_data *sd, int guild_id, - const char *mes1, const char *mes2) -{ - struct guild *g; - int ps; - - nullpo_retr (0, sd); - - g = guild_search (sd->status.guild_id); - - if (g == NULL) - return 0; - - if ((ps = guild_getposition (sd, g)) < 0 - || !(g->position[ps].mode & 0x0010)) - return 0; - - if (guild_id != sd->status.guild_id) - return 0; - - return intif_guild_notice (guild_id, mes1, mes2); -} - -// ギルド告知変更通知 -int guild_notice_changed (int guild_id, const char *mes1, const char *mes2) -{ - int i; - struct map_session_data *sd; - struct guild *g = guild_search (guild_id); - if (g == NULL) - return 0; - - memcpy (g->mes1, mes1, 60); - memcpy (g->mes2, mes2, 120); - - for (i = 0; i < g->max_member; i++) - { - if ((sd = g->member[i].sd) != NULL) - clif_guild_notice (sd, g); - } - return 0; -} - -// ギルドエンブレム変更 -int guild_change_emblem (struct map_session_data *sd, int len, - const char *data) -{ - struct guild *g; - int ps; - - nullpo_retr (0, sd); - - g = guild_search (sd->status.guild_id); - - if (g == NULL) - return 0; - - if ((ps = guild_getposition (sd, g)) < 0 - || !(g->position[ps].mode & 0x0010)) - return 0; - - return intif_guild_emblem (sd->status.guild_id, len, data); -} - -// ギルドエンブレム変更通知 -int guild_emblem_changed (int len, int guild_id, int emblem_id, - const char *data) -{ - int i; - struct map_session_data *sd; - struct guild *g = guild_search (guild_id); - if (g == NULL) - return 0; - - memcpy (g->emblem_data, data, len); - g->emblem_len = len; - g->emblem_id = emblem_id; - - for (i = 0; i < g->max_member; i++) - { - if ((sd = g->member[i].sd) != NULL) - { - sd->guild_emblem_id = emblem_id; - clif_guild_belonginfo (sd, g); - clif_guild_emblem (sd, g); - } - } - return 0; -} - -// ギルドのEXP上納 -int guild_payexp (struct map_session_data *sd, int exp) -{ - struct guild *g; - struct guild_expcache *c; - int per, exp2; - - nullpo_retr (0, sd); - - if (sd->status.guild_id == 0 - || (g = guild_search (sd->status.guild_id)) == NULL) - return 0; - if ((per = g->position[guild_getposition (sd, g)].exp_mode) <= 0) - return 0; - if (per > 100) - per = 100; - - if ((exp2 = exp * per / 100) <= 0) - return 0; - - if ((c = (struct guild_expcache *)numdb_search (guild_expcache_db, sd->status.account_id /*char_id*/)) == NULL) - { - CREATE (c, struct guild_expcache, 1); - c->guild_id = sd->status.guild_id; - c->account_id = sd->status.account_id; - c->char_id = 0; - c->exp = exp2; - numdb_insert (guild_expcache_db, c->account_id /*char_id*/, c); - } - else - { - c->exp += exp2; - } - return exp2; -} - -// スキルポイント割り振り -int guild_skillup (struct map_session_data *sd, int skill_num) -{ - struct guild *g; - int idx; - - nullpo_retr (0, sd); - - if (sd->status.guild_id == 0 - || (g = guild_search (sd->status.guild_id)) == NULL) - return 0; - if (strcmp (sd->status.name, g->master)) - return 0; - - if (g->skill_point > 0 && - g->skill[(idx = skill_num - 10000)].id != 0 && - g->skill[idx].lv < guild_skill_get_max (skill_num)) - { - intif_guild_skillup (g->guild_id, skill_num, sd->status.account_id); - } - return 0; -} - -// スキルポイント割り振り通知 -int guild_skillupack (int guild_id, int skill_num, int account_id) -{ - struct map_session_data *sd = map_id2sd (account_id); - struct guild *g = guild_search (guild_id); - int i; - if (g == NULL) - return 0; - if (sd != NULL) - clif_guild_skillup (sd, skill_num, g->skill[skill_num - 10000].lv); - // 全員に通知 - for (i = 0; i < g->max_member; i++) - if ((sd = g->member[i].sd) != NULL) - clif_guild_skillinfo (sd); - return 0; -} - -// ギルド同盟数所得 -static -int guild_get_alliance_count (struct guild *g, int flag) -{ - int i, c; - - nullpo_retr (0, g); - - for (i = c = 0; i < MAX_GUILDALLIANCE; i++) - { - if (g->alliance[i].guild_id > 0 && g->alliance[i].opposition == flag) - c++; - } - return c; -} - -// ギルド同盟要求 -int guild_reqalliance (struct map_session_data *sd, int account_id) -{ - struct map_session_data *tsd = map_id2sd (account_id); - struct guild *g[2]; - int i, ps; - - if (agit_flag) - { // Disable alliance creation during woe [Valaris] - clif_displaymessage (sd->fd, - "Alliances cannot be made during Guild Wars!"); - return 0; - } // end addition [Valaris] - - nullpo_retr (0, sd); - - if (tsd == NULL || tsd->status.guild_id <= 0) - return 0; - - g[0] = guild_search (sd->status.guild_id); - g[1] = guild_search (tsd->status.guild_id); - - if (g[0] == NULL || g[1] == NULL) - return 0; - - if ((ps = guild_getposition (sd, g[0])) < 0 - || !(g[0]->position[ps].mode & 0x0010)) - return 0; - - if (guild_get_alliance_count (g[0], 0) > 3) // 同盟数確認 - clif_guild_allianceack (sd, 4); - if (guild_get_alliance_count (g[1], 0) > 3) - clif_guild_allianceack (sd, 3); - - if (tsd->guild_alliance > 0) - { // 相手が同盟要請状態かどうか確認 - clif_guild_allianceack (sd, 1); - return 0; - } - - for (i = 0; i < MAX_GUILDALLIANCE; i++) - { // すでに同盟状態か確認 - if (g[0]->alliance[i].guild_id == tsd->status.guild_id && - g[0]->alliance[i].opposition == 0) - { - clif_guild_allianceack (sd, 0); - return 0; - } - } - - tsd->guild_alliance = sd->status.guild_id; - tsd->guild_alliance_account = sd->status.account_id; - - clif_guild_reqalliance (tsd, sd->status.account_id, g[0]->name); - return 0; -} - -// ギルド勧誘への返答 -int guild_reply_reqalliance (struct map_session_data *sd, int account_id, - int flag) -{ - struct map_session_data *tsd; - - nullpo_retr (0, sd); - nullpo_retr (0, tsd = map_id2sd (account_id)); - - if (sd->guild_alliance != tsd->status.guild_id) // 勧誘とギルドIDが違う - return 0; - - if (flag == 1) - { // 承諾 - int i; - - struct guild *g; // 同盟数再確認 - if ((g = guild_search (sd->status.guild_id)) == NULL || - guild_get_alliance_count (g, 0) > 3) - { - clif_guild_allianceack (sd, 4); - clif_guild_allianceack (tsd, 3); - return 0; - } - if ((g = guild_search (tsd->status.guild_id)) == NULL || - guild_get_alliance_count (g, 0) > 3) - { - clif_guild_allianceack (sd, 3); - clif_guild_allianceack (tsd, 4); - return 0; - } - - // 敵対関係なら敵対を止める - if ((g = guild_search (sd->status.guild_id)) == NULL) - return 0; - for (i = 0; i < MAX_GUILDALLIANCE; i++) - { - if (g->alliance[i].guild_id == tsd->status.guild_id && - g->alliance[i].opposition == 1) - intif_guild_alliance (sd->status.guild_id, - tsd->status.guild_id, - sd->status.account_id, - tsd->status.account_id, 9); - } - if ((g = guild_search (tsd->status.guild_id)) == NULL) - return 0; - for (i = 0; i < MAX_GUILDALLIANCE; i++) - { - if (g->alliance[i].guild_id == sd->status.guild_id && - g->alliance[i].opposition == 1) - intif_guild_alliance (tsd->status.guild_id, - sd->status.guild_id, - tsd->status.account_id, - sd->status.account_id, 9); - } - - // inter鯖へ同盟要請 - intif_guild_alliance (sd->status.guild_id, tsd->status.guild_id, - sd->status.account_id, tsd->status.account_id, - 0); - return 0; - } - else - { // 拒否 - sd->guild_alliance = 0; - sd->guild_alliance_account = 0; - if (tsd != NULL) - clif_guild_allianceack (tsd, 3); - } - return 0; -} - -// ギルド関係解消 -int guild_delalliance (struct map_session_data *sd, int guild_id, int flag) -{ - if (agit_flag) - { // Disable alliance breaking during woe [Valaris] - clif_displaymessage (sd->fd, - "Alliances cannot be broken during Guild Wars!"); - return 0; - } // end addition [Valaris] - - struct guild *g; - int ps; - - nullpo_retr (0, sd); - - g = guild_search (sd->status.guild_id); - - if (g == NULL) - return 0; - - if ((ps = guild_getposition (sd, g)) < 0 - || !(g->position[ps].mode & 0x0010)) - return 0; - - intif_guild_alliance (sd->status.guild_id, guild_id, - sd->status.account_id, 0, flag | 8); - return 0; -} - -// ギルド敵対 -int guild_opposition (struct map_session_data *sd, int account_id /*char_id*/) -{ - struct map_session_data *tsd = map_id2sd (account_id /*char_id*/); - struct guild *g; - int i, ps; - - nullpo_retr (0, sd); - - g = guild_search (sd->status.guild_id); - if (g == NULL || tsd == NULL) - return 0; - - if ((ps = guild_getposition (sd, g)) < 0 - || !(g->position[ps].mode & 0x0010)) - return 0; - - if (guild_get_alliance_count (g, 1) > 3) // 敵対数確認 - clif_guild_oppositionack (sd, 1); - - for (i = 0; i < MAX_GUILDALLIANCE; i++) - { // すでに関係を持っているか確認 - if (g->alliance[i].guild_id == tsd->status.guild_id) - { - if (g->alliance[i].opposition == 1) - { // すでに敵対 - clif_guild_oppositionack (sd, 2); - return 0; - } - else // 同盟破棄 - intif_guild_alliance (sd->status.guild_id, - tsd->status.guild_id, - sd->status.account_id, - tsd->status.account_id, 8); - } - } - - // inter鯖に敵対要請 - intif_guild_alliance (sd->status.guild_id, tsd->status.guild_id, - sd->status.account_id, tsd->status.account_id, 1); - return 0; -} - -// ギルド同盟/敵対通知 -int guild_allianceack (int guild_id1, int guild_id2, int account_id1, - int account_id2, int flag, const char *name1, - const char *name2) -{ - struct guild *g[2]; - int guild_id[2] = { guild_id1, guild_id2 }; - const char *guild_name[2] = { name1, name2 }; - struct map_session_data *sd[2] = - { map_id2sd (account_id1), map_id2sd (account_id2) }; - int j, i; - - g[0] = guild_search (guild_id1); - g[1] = guild_search (guild_id2); - - if (sd[0] != NULL && (flag & 0x0f) == 0) - { - sd[0]->guild_alliance = 0; - sd[0]->guild_alliance_account = 0; - } - - if (flag & 0x70) - { // 失敗 - for (i = 0; i < 2 - (flag & 1); i++) - if (sd[i] != NULL) - clif_guild_allianceack (sd[i], - ((flag >> 4) == i + 1) ? 3 : 4); - return 0; - } -// if(battle_config.etc_log) -// printf("guild alliance_ack %d %d %d %d %d %s %s\n",guild_id1,guild_id2,account_id1,account_id2,flag,name1,name2); - - if (!(flag & 0x08)) - { // 関係追加 - for (i = 0; i < 2 - (flag & 1); i++) - if (g[i] != NULL) - for (j = 0; j < MAX_GUILDALLIANCE; j++) - if (g[i]->alliance[j].guild_id == 0) - { - g[i]->alliance[j].guild_id = guild_id[1 - i]; - memcpy (g[i]->alliance[j].name, guild_name[1 - i], - 24); - g[i]->alliance[j].opposition = flag & 1; - break; - } - } - else - { // 関係解消 - for (i = 0; i < 2 - (flag & 1); i++) - { - if (g[i] != NULL) - for (j = 0; j < MAX_GUILDALLIANCE; j++) - if (g[i]->alliance[j].guild_id == guild_id[1 - i] && - g[i]->alliance[j].opposition == (flag & 1)) - { - g[i]->alliance[j].guild_id = 0; - break; - } - if (sd[i] != NULL) // 解消通知 - clif_guild_delalliance (sd[i], guild_id[1 - i], (flag & 1)); - } - } - - if ((flag & 0x0f) == 0) - { // 同盟通知 - if (sd[1] != NULL) - clif_guild_allianceack (sd[1], 2); - } - else if ((flag & 0x0f) == 1) - { // 敵対通知 - if (sd[0] != NULL) - clif_guild_oppositionack (sd[0], 0); - } - - for (i = 0; i < 2 - (flag & 1); i++) - { // 同盟/敵対リストの再送信 - struct map_session_data *sd; - if (g[i] != NULL) - for (j = 0; j < g[i]->max_member; j++) - if ((sd = g[i]->member[j].sd) != NULL) - clif_guild_allianceinfo (sd); - } - return 0; -} - -// ギルド解散通知用 -static -void guild_broken_sub (db_key_t key, db_val_t data, va_list ap) -{ - struct guild *g = (struct guild *) data; - int guild_id = va_arg (ap, int); - int i, j; - struct map_session_data *sd = NULL; - - nullpo_retv (g); - - for (i = 0; i < MAX_GUILDALLIANCE; i++) - { // 関係を破棄 - if (g->alliance[i].guild_id == guild_id) - { - for (j = 0; j < g->max_member; j++) - if ((sd = g->member[j].sd) != NULL) - clif_guild_delalliance (sd, guild_id, - g->alliance[i].opposition); - g->alliance[i].guild_id = 0; - } - } -} - -// ギルド解散通知 -int guild_broken (int guild_id, int flag) -{ - struct guild *g = guild_search (guild_id); - struct map_session_data *sd; - int i; - if (flag != 0 || g == NULL) - return 0; - - for (i = 0; i < g->max_member; i++) - { // ギルド解散を通知 - if ((sd = g->member[i].sd) != NULL) - { - if (sd->state.storage_flag == 2) - storage_guild_storage_quit (sd, 1); - sd->status.guild_id = 0; - sd->guild_sended = 0; - clif_guild_broken (g->member[i].sd, 0); - } - } - - numdb_foreach (guild_db, guild_broken_sub, guild_id); - numdb_erase (guild_db, guild_id); - guild_storage_delete (guild_id); - free (g); - return 0; -} - -// ギルド解散 -int guild_break (struct map_session_data *sd, const char *name) -{ - struct guild *g; - int i; - - nullpo_retr (0, sd); - - if ((g = guild_search (sd->status.guild_id)) == NULL) - return 0; - if (strcmp (g->name, name) != 0) - return 0; - if (strcmp (sd->status.name, g->master) != 0) - return 0; - for (i = 0; i < g->max_member; i++) - { - if (g->member[i].account_id > 0 - && (g->member[i].account_id != sd->status.account_id)) - break; - } - if (i < g->max_member) - { - clif_guild_broken (sd, 2); - return 0; - } - - intif_guild_break (g->guild_id); - return 0; -} - -// ギルド城データ要求 -int guild_castledataload (int castle_id, int index) -{ - return intif_guild_castle_dataload (castle_id, index); -} - -// ギルド城情報所得時イベント追加 -int guild_addcastleinfoevent (int castle_id, int index, const char *name) -{ - struct eventlist *ev; - int code = castle_id | (index << 16); - - if (name == NULL || *name == 0) - return 0; - - CREATE (ev, struct eventlist, 1); - memcpy (ev->name, name, sizeof (ev->name)); - ev->next = (struct eventlist *)numdb_search (guild_castleinfoevent_db, code); - numdb_insert (guild_castleinfoevent_db, code, ev); - return 0; -} - -// ギルド城データ要求返信 -int guild_castledataloadack (int castle_id, int index, int value) -{ - struct guild_castle *gc = guild_castle_search (castle_id); - int code = castle_id | (index << 16); - struct eventlist *ev, *ev2; - - if (gc == NULL) - { - return 0; - } - switch (index) - { - case 1: - gc->guild_id = value; - break; - case 2: - gc->economy = value; - break; - case 3: - gc->defense = value; - break; - case 4: - gc->triggerE = value; - break; - case 5: - gc->triggerD = value; - break; - case 6: - gc->nextTime = value; - break; - case 7: - gc->payTime = value; - break; - case 8: - gc->createTime = value; - break; - case 9: - gc->visibleC = value; - break; - case 10: - gc->visibleG0 = value; - break; - case 11: - gc->visibleG1 = value; - break; - case 12: - gc->visibleG2 = value; - break; - case 13: - gc->visibleG3 = value; - break; - case 14: - gc->visibleG4 = value; - break; - case 15: - gc->visibleG5 = value; - break; - case 16: - gc->visibleG6 = value; - break; - case 17: - gc->visibleG7 = value; - break; - case 18: - gc->Ghp0 = value; - break; // guardian HP [Valaris] - case 19: - gc->Ghp1 = value; - break; - case 20: - gc->Ghp2 = value; - break; - case 21: - gc->Ghp3 = value; - break; - case 22: - gc->Ghp4 = value; - break; - case 23: - gc->Ghp5 = value; - break; - case 24: - gc->Ghp6 = value; - break; - case 25: - gc->Ghp7 = value; - break; // end additions [Valaris] - default: - printf ("guild_castledataloadack ERROR!! (Not found index=%d)\n", - index); - return 0; - } - if ((ev = (struct eventlist *)numdb_search (guild_castleinfoevent_db, code)) != NULL) - { - numdb_erase (guild_castleinfoevent_db, code); - for (; ev; ev2 = ev->next, free (ev), ev = ev2) - { - npc_event_do (ev->name); - } - } - return 1; -} - -// ギルド城データ変更要求 -int guild_castledatasave (int castle_id, int index, int value) -{ - return intif_guild_castle_datasave (castle_id, index, value); -} - -// ギルド城データ変更通知 -int guild_castledatasaveack (int castle_id, int index, int value) -{ - struct guild_castle *gc = guild_castle_search (castle_id); - if (gc == NULL) - { - return 0; - } - switch (index) - { - case 1: - gc->guild_id = value; - break; - case 2: - gc->economy = value; - break; - case 3: - gc->defense = value; - break; - case 4: - gc->triggerE = value; - break; - case 5: - gc->triggerD = value; - break; - case 6: - gc->nextTime = value; - break; - case 7: - gc->payTime = value; - break; - case 8: - gc->createTime = value; - break; - case 9: - gc->visibleC = value; - break; - case 10: - gc->visibleG0 = value; - break; - case 11: - gc->visibleG1 = value; - break; - case 12: - gc->visibleG2 = value; - break; - case 13: - gc->visibleG3 = value; - break; - case 14: - gc->visibleG4 = value; - break; - case 15: - gc->visibleG5 = value; - break; - case 16: - gc->visibleG6 = value; - break; - case 17: - gc->visibleG7 = value; - break; - case 18: - gc->Ghp0 = value; - break; // guardian HP [Valaris] - case 19: - gc->Ghp1 = value; - break; - case 20: - gc->Ghp2 = value; - break; - case 21: - gc->Ghp3 = value; - break; - case 22: - gc->Ghp4 = value; - break; - case 23: - gc->Ghp5 = value; - break; - case 24: - gc->Ghp6 = value; - break; - case 25: - gc->Ghp7 = value; - break; // end additions [Valaris] - default: - printf ("guild_castledatasaveack ERROR!! (Not found index=%d)\n", - index); - return 0; - } - return 1; -} - -// ギルドデータ一括受信(初期化時) -int guild_castlealldataload (int len, struct guild_castle *gc) -{ - int i; - int n = (len - 4) / sizeof (struct guild_castle), ev = -1; - - nullpo_retr (0, gc); - - // イベント付きで要求するデータ位置を探す(最後の占拠データ) - for (i = 0; i < n; i++) - { - if ((gc + i)->guild_id) - ev = i; - } - - // 城データ格納とギルド情報要求 - for (i = 0; i < n; i++, gc++) - { - struct guild_castle *c = guild_castle_search (gc->castle_id); - if (!c) - { - printf ("guild_castlealldataload ??\n"); - continue; - } - memcpy (&c->guild_id, &gc->guild_id, - sizeof (struct guild_castle) - ((int) &c->guild_id - - (int) c)); - if (c->guild_id) - { - if (i != ev) - guild_request_info (c->guild_id); - else - guild_npc_request_info (c->guild_id, "::OnAgitInit"); - } - } - if (ev == -1) - npc_event_doall ("OnAgitInit"); - return 0; -} - -int guild_agit_start (void) -{ // Run All NPC_Event[OnAgitStart] - int c = npc_event_doall ("OnAgitStart"); - printf ("NPC_Event:[OnAgitStart] Run (%d) Events by @AgitStart.\n", c); - return 0; -} - -int guild_agit_end (void) -{ // Run All NPC_Event[OnAgitEnd] - int c = npc_event_doall ("OnAgitEnd"); - printf ("NPC_Event:[OnAgitEnd] Run (%d) Events by @AgitEnd.\n", c); - return 0; -} - -void guild_gvg_eliminate_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t data) -{ // Run One NPC_Event[OnAgitEliminate] - size_t len = strlen ((const char *) data); - char *evname; - CREATE (evname, char, len + 4); - int c = 0; - - if (!agit_flag) - return; // Agit already End - memcpy (evname, (const char *) data, len - 5); - strcpy (evname + len - 5, "Eliminate"); - c = npc_event_do (evname); - printf ("NPC_Event:[%s] Run (%d) Events.\n", evname, c); -} - -int guild_agit_break (struct mob_data *md) -{ // Run One NPC_Event[OnAgitBreak] - char *evname; - - nullpo_retr (0, md); - - CREATE (evname, char, strlen (md->npc_event) + 1); - - strcpy (evname, md->npc_event); -// Now By User to Run [OnAgitBreak] NPC Event... -// It's a little impossible to null point with player disconnect in this! -// But Script will be stop, so nothing... -// Maybe will be changed in the futher.. -// int c = npc_event_do(evname); - if (!agit_flag) - return 0; // Agit already End - add_timer (gettick () + battle_config.gvg_eliminate_time, - guild_gvg_eliminate_timer, md->bl.m, (int) evname); - return 0; -} - -// [MouseJstr] -// How many castles does this guild have? -int guild_checkcastles (struct guild *g) -{ - int i, nb_cas = 0, id, cas_id = 0; - struct guild_castle *gc; - id = g->guild_id; - for (i = 0; i < MAX_GUILDCASTLE; i++) - { - gc = guild_castle_search (i); - cas_id = gc->guild_id; - if (g->guild_id == cas_id) - nb_cas = nb_cas + 1; - } //end for - return nb_cas; -} - -// [MouseJstr] -// is this guild allied with this castle? -int guild_isallied (struct guild *g, struct guild_castle *gc) -{ - int i; - - nullpo_retr (0, g); - - if (g->guild_id == gc->guild_id) - return 1; - - if (gc->guild_id == 0) - return 0; - - for (i = 0; i < MAX_GUILDALLIANCE; i++) - if (g->alliance[i].guild_id == gc->guild_id) - { - if (g->alliance[i].opposition == 0) - return 1; - else - return 0; - } - - return 0; -} - -static void guild_db_final (db_key_t key, db_val_t data, va_list ap) -{ - free (data); -} - -static void castle_db_final (db_key_t key, db_val_t data, va_list ap) -{ - free (data); -} - -static void guild_expcache_db_final (db_key_t key, db_val_t data, va_list ap) -{ - free (data); -} - -static void guild_infoevent_db_final (db_key_t key, db_val_t data, va_list ap) -{ - free (data); -} - -void do_final_guild (void) -{ - if (guild_db) - numdb_final (guild_db, guild_db_final); - if (castle_db) - numdb_final (castle_db, castle_db_final); - if (guild_expcache_db) - numdb_final (guild_expcache_db, guild_expcache_db_final); - if (guild_infoevent_db) - numdb_final (guild_infoevent_db, guild_infoevent_db_final); - if (guild_castleinfoevent_db) - numdb_final (guild_castleinfoevent_db, guild_infoevent_db_final); -} diff --git a/src/map/guild.hpp b/src/map/guild.hpp deleted file mode 100644 index 983934c..0000000 --- a/src/map/guild.hpp +++ /dev/null @@ -1,95 +0,0 @@ -// $Id: guild.h,v 1.4 2004/09/25 05:32:18 MouseJstr Exp $ -#ifndef GUILD_HPP -#define GUILD_HPP - -struct map_session_data; -struct mob_data; -struct guild; -struct guild_member; -struct guild_position; -struct guild_castle; - -int guild_skill_get_inf (int id); -int guild_skill_get_sp (int id, int lv); -int guild_skill_get_range (int id); -int guild_skill_get_max (int id); - -int guild_checkskill (struct guild *g, int id); -int guild_checkcastles (struct guild *g); // [MouseJstr] -int guild_isallied (struct guild *g, struct guild_castle *gc); - -void do_init_guild (void); -struct guild *guild_search (int guild_id); -struct guild *guild_searchname (const char *str); -struct guild_castle *guild_castle_search (int gcid); - -struct guild_castle *guild_mapname2gc (const char *mapname); - -struct map_session_data *guild_getavailablesd (struct guild *g); -int guild_getindex (struct guild *g, int account_id, int char_id); -int guild_getposition (struct map_session_data *sd, struct guild *g); -int guild_payexp (struct map_session_data *sd, int exp); - -int guild_create (struct map_session_data *sd, const char *name); -int guild_created (int account_id, int guild_id); -int guild_request_info (int guild_id); -int guild_recv_noinfo (int guild_id); -int guild_recv_info (struct guild *sg); -int guild_npc_request_info (int guild_id, const char *ev); -int guild_invite (struct map_session_data *sd, int account_id); -int guild_reply_invite (struct map_session_data *sd, int guild_id, int flag); -int guild_member_added (int guild_id, int account_id, int char_id, int flag); -int guild_leave (struct map_session_data *sd, int guild_id, - int account_id, int char_id, const char *mes); -int guild_member_leaved (int guild_id, int account_id, int char_id, int flag, - const char *name, const char *mes); -int guild_explusion (struct map_session_data *sd, int guild_id, - int account_id, int char_id, const char *mes); -int guild_skillup (struct map_session_data *sd, int skill_num); -int guild_reqalliance (struct map_session_data *sd, int account_id); -int guild_reply_reqalliance (struct map_session_data *sd, int account_id, - int flag); -int guild_alliance (int guild_id1, int guild_id2, int account_id1, - int account_id2); -int guild_allianceack (int guild_id1, int guild_id2, int account_id1, - int account_id2, int flag, const char *name1, - const char *name2); -int guild_delalliance (struct map_session_data *sd, int guild_id, int flag); -int guild_opposition (struct map_session_data *sd, int char_id); - -int guild_send_memberinfoshort (struct map_session_data *sd, int online); -int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id, - int online, int lv, int class_); -int guild_change_memberposition (int guild_id, int account_id, int char_id, - int idx); -int guild_memberposition_changed (struct guild *g, int idx, int pos); -int guild_change_position (struct map_session_data *sd, int idx, - int mode, int exp_mode, const char *name); -int guild_position_changed (int guild_id, int idx, struct guild_position *p); -int guild_change_notice (struct map_session_data *sd, int guild_id, - const char *mes1, const char *mes2); -int guild_notice_changed (int guild_id, const char *mes1, const char *mes2); -int guild_change_emblem (struct map_session_data *sd, int len, - const char *data); -int guild_emblem_changed (int len, int guild_id, int emblem_id, - const char *data); -int guild_send_message (struct map_session_data *sd, const char *mes, int len); -int guild_recv_message (int guild_id, int account_id, const char *mes, int len); -int guild_skillupack (int guild_id, int skill_num, int account_id); -int guild_break (struct map_session_data *sd, const char *name); -int guild_broken (int guild_id, int flag); - -int guild_addcastleinfoevent (int castle_id, int index, const char *name); -int guild_castledataload (int castle_id, int index); -int guild_castledataloadack (int castle_id, int index, int value); -int guild_castledatasave (int castle_id, int index, int value); -int guild_castledatasaveack (int castle_id, int index, int value); -int guild_castlealldataload (int len, struct guild_castle *gc); - -int guild_agit_start (void); -int guild_agit_end (void); -int guild_agit_break (struct mob_data *md); - -void do_final_guild (void); - -#endif diff --git a/src/map/intif.cpp b/src/map/intif.cpp index dfbc665..c0c63b0 100644 --- a/src/map/intif.cpp +++ b/src/map/intif.cpp @@ -25,7 +25,6 @@ #include "battle.hpp" #include "chrif.hpp" #include "clif.hpp" -#include "guild.hpp" #include "intif.hpp" #include "map.hpp" #include "party.hpp" @@ -172,26 +171,6 @@ int intif_send_storage (struct storage *stor) return 0; } -int intif_request_guild_storage (int account_id, int guild_id) -{ - WFIFOW (inter_fd, 0) = 0x3018; - WFIFOL (inter_fd, 2) = account_id; - WFIFOL (inter_fd, 6) = guild_id; - WFIFOSET (inter_fd, 10); - return 0; -} - -int intif_send_guild_storage (int account_id, struct guild_storage *gstor) -{ - WFIFOW (inter_fd, 0) = 0x3019; - WFIFOW (inter_fd, 2) = sizeof (struct guild_storage) + 12; - WFIFOL (inter_fd, 4) = account_id; - WFIFOL (inter_fd, 8) = gstor->guild_id; - memcpy (WFIFOP (inter_fd, 12), gstor, sizeof (struct guild_storage)); - WFIFOSET (inter_fd, WFIFOW (inter_fd, 2)); - return 0; -} - // パーティ作成要求 int intif_create_party (struct map_session_data *sd, const char *name) { @@ -316,213 +295,6 @@ int intif_party_checkconflict (int party_id, int account_id, const char *nick) return 0; } -// ギルド作成要求 -int intif_guild_create (const char *name, const struct guild_member *master) -{ - nullpo_retr (0, master); - - WFIFOW (inter_fd, 0) = 0x3030; - WFIFOW (inter_fd, 2) = sizeof (struct guild_member) + 32; - WFIFOL (inter_fd, 4) = master->account_id; - memcpy (WFIFOP (inter_fd, 8), name, 24); - memcpy (WFIFOP (inter_fd, 32), master, sizeof (struct guild_member)); - WFIFOSET (inter_fd, WFIFOW (inter_fd, 2)); - return 0; -} - -// ギルド情報要求 -int intif_guild_request_info (int guild_id) -{ - WFIFOW (inter_fd, 0) = 0x3031; - WFIFOL (inter_fd, 2) = guild_id; - WFIFOSET (inter_fd, 6); - return 0; -} - -// ギルドメンバ追加要求 -int intif_guild_addmember (int guild_id, struct guild_member *m) -{ - WFIFOW (inter_fd, 0) = 0x3032; - WFIFOW (inter_fd, 2) = sizeof (struct guild_member) + 8; - WFIFOL (inter_fd, 4) = guild_id; - memcpy (WFIFOP (inter_fd, 8), m, sizeof (struct guild_member)); - WFIFOSET (inter_fd, WFIFOW (inter_fd, 2)); - return 0; -} - -// ギルドメンバ脱退/追放要求 -int intif_guild_leave (int guild_id, int account_id, int char_id, int flag, - const char *mes) -{ - WFIFOW (inter_fd, 0) = 0x3034; - WFIFOL (inter_fd, 2) = guild_id; - WFIFOL (inter_fd, 6) = account_id; - WFIFOL (inter_fd, 10) = char_id; - WFIFOB (inter_fd, 14) = flag; - memcpy (WFIFOP (inter_fd, 15), mes, 40); - WFIFOSET (inter_fd, 55); - return 0; -} - -// ギルドメンバのオンライン状況/Lv更新要求 -int intif_guild_memberinfoshort (int guild_id, - int account_id, int char_id, int online, - int lv, int class_) -{ - WFIFOW (inter_fd, 0) = 0x3035; - WFIFOL (inter_fd, 2) = guild_id; - WFIFOL (inter_fd, 6) = account_id; - WFIFOL (inter_fd, 10) = char_id; - WFIFOB (inter_fd, 14) = online; - WFIFOW (inter_fd, 15) = lv; - WFIFOW (inter_fd, 17) = class_; - WFIFOSET (inter_fd, 19); - return 0; -} - -// ギルド解散通知 -int intif_guild_break (int guild_id) -{ - WFIFOW (inter_fd, 0) = 0x3036; - WFIFOL (inter_fd, 2) = guild_id; - WFIFOSET (inter_fd, 6); - return 0; -} - -// ギルド会話送信 -int intif_guild_message (int guild_id, int account_id, const char *mes, int len) -{ - WFIFOW (inter_fd, 0) = 0x3037; - WFIFOW (inter_fd, 2) = len + 12; - WFIFOL (inter_fd, 4) = guild_id; - WFIFOL (inter_fd, 8) = account_id; - memcpy (WFIFOP (inter_fd, 12), mes, len); - WFIFOSET (inter_fd, len + 12); - return 0; -} - -// ギルド競合チェック要求 -int intif_guild_checkconflict (int guild_id, int account_id, int char_id) -{ - WFIFOW (inter_fd, 0) = 0x3038; - WFIFOL (inter_fd, 2) = guild_id; - WFIFOL (inter_fd, 6) = account_id; - WFIFOL (inter_fd, 10) = char_id; - WFIFOSET (inter_fd, 14); - return 0; -} - -// ギルド基本情報変更要求 -int intif_guild_change_basicinfo (int guild_id, int type, const void *data, - int len) -{ - WFIFOW (inter_fd, 0) = 0x3039; - WFIFOW (inter_fd, 2) = len + 10; - WFIFOL (inter_fd, 4) = guild_id; - WFIFOW (inter_fd, 8) = type; - memcpy (WFIFOP (inter_fd, 10), data, len); - WFIFOSET (inter_fd, len + 10); - return 0; -} - -// ギルドメンバ情報変更要求 -int intif_guild_change_memberinfo (int guild_id, int account_id, int char_id, - int type, const void *data, int len) -{ - WFIFOW (inter_fd, 0) = 0x303a; - WFIFOW (inter_fd, 2) = len + 18; - WFIFOL (inter_fd, 4) = guild_id; - WFIFOL (inter_fd, 8) = account_id; - WFIFOL (inter_fd, 12) = char_id; - WFIFOW (inter_fd, 16) = type; - memcpy (WFIFOP (inter_fd, 18), data, len); - WFIFOSET (inter_fd, len + 18); - return 0; -} - -// ギルド役職変更要求 -int intif_guild_position (int guild_id, int idx, struct guild_position *p) -{ - WFIFOW (inter_fd, 0) = 0x303b; - WFIFOW (inter_fd, 2) = sizeof (struct guild_position) + 12; - WFIFOL (inter_fd, 4) = guild_id; - WFIFOL (inter_fd, 8) = idx; - memcpy (WFIFOP (inter_fd, 12), p, sizeof (struct guild_position)); - WFIFOSET (inter_fd, WFIFOW (inter_fd, 2)); - return 0; -} - -// ギルドスキルアップ要求 -int intif_guild_skillup (int guild_id, int skill_num, int account_id) -{ - WFIFOW (inter_fd, 0) = 0x303c; - WFIFOL (inter_fd, 2) = guild_id; - WFIFOL (inter_fd, 6) = skill_num; - WFIFOL (inter_fd, 10) = account_id; - WFIFOSET (inter_fd, 14); - return 0; -} - -// ギルド同盟/敵対要求 -int intif_guild_alliance (int guild_id1, int guild_id2, int account_id1, - int account_id2, int flag) -{ - WFIFOW (inter_fd, 0) = 0x303d; - WFIFOL (inter_fd, 2) = guild_id1; - WFIFOL (inter_fd, 6) = guild_id2; - WFIFOL (inter_fd, 10) = account_id1; - WFIFOL (inter_fd, 14) = account_id2; - WFIFOB (inter_fd, 18) = flag; - WFIFOSET (inter_fd, 19); - return 0; -} - -// ギルド告知変更要求 -int intif_guild_notice (int guild_id, const char *mes1, const char *mes2) -{ - WFIFOW (inter_fd, 0) = 0x303e; - WFIFOL (inter_fd, 2) = guild_id; - memcpy (WFIFOP (inter_fd, 6), mes1, 60); - memcpy (WFIFOP (inter_fd, 66), mes2, 120); - WFIFOSET (inter_fd, 186); - return 0; -} - -// ギルドエンブレム変更要求 -int intif_guild_emblem (int guild_id, int len, const char *data) -{ - if (guild_id <= 0 || len < 0 || len > 2000) - return 0; - WFIFOW (inter_fd, 0) = 0x303f; - WFIFOW (inter_fd, 2) = len + 12; - WFIFOL (inter_fd, 4) = guild_id; - WFIFOL (inter_fd, 8) = 0; - memcpy (WFIFOP (inter_fd, 12), data, len); - WFIFOSET (inter_fd, len + 12); - return 0; -} - -//現在のギルド城占領ギルドを調べる -int intif_guild_castle_dataload (int castle_id, int index) -{ - WFIFOW (inter_fd, 0) = 0x3040; - WFIFOW (inter_fd, 2) = castle_id; - WFIFOB (inter_fd, 4) = index; - WFIFOSET (inter_fd, 5); - return 0; -} - -//ギルド城占領ギルド変更要求 -int intif_guild_castle_datasave (int castle_id, int index, int value) -{ - WFIFOW (inter_fd, 0) = 0x3041; - WFIFOW (inter_fd, 2) = castle_id; - WFIFOB (inter_fd, 4) = index; - WFIFOL (inter_fd, 5) = value; - WFIFOSET (inter_fd, 9); - return 0; -} - //----------------------------------------------------------------- // Packets receive from inter server @@ -684,7 +456,7 @@ int intif_parse_LoadStorage (int fd) memcpy (stor, RFIFOP (fd, 8), sizeof (struct storage)); stor->dirty = 0; stor->storage_status = 1; - sd->state.storage_flag = 1; + sd->state.storage_open = 1; clif_storageitemlist (sd, stor); clif_storageequiplist (sd, stor); clif_updatestorageamount (sd, stor); @@ -703,82 +475,6 @@ int intif_parse_SaveStorage (int fd) return 0; } -static -int intif_parse_LoadGuildStorage (int fd) -{ - struct guild_storage *gstor; - struct map_session_data *sd; - int guild_id; - - guild_id = RFIFOL (fd, 8); - if (guild_id > 0) - { - gstor = guild2storage (guild_id); - if (!gstor) - { - if (battle_config.error_log) - printf - ("intif_parse_LoadGuildStorage: error guild_id %d not exist\n", - guild_id); - return 1; - } - if (RFIFOW (fd, 2) - 12 != sizeof (struct guild_storage)) - { - gstor->storage_status = 0; - if (battle_config.error_log) - printf - ("intif_parse_LoadGuildStorage: data size error %d %d\n", - RFIFOW (fd, 2) - 12, sizeof (struct guild_storage)); - return 1; - } - sd = map_id2sd (RFIFOL (fd, 4)); - if (sd == NULL) - { - if (battle_config.error_log) - printf ("intif_parse_LoadGuildStorage: user not found %d\n", - RFIFOL (fd, 4)); - return 1; - } - if (gstor->storage_status == 1) - { // Already open.. lets ignore this update - if (battle_config.error_log) - printf - ("intif_parse_LoadGuildStorage: storage received for a client already open (User %d:%d)\n", - sd->status.account_id, sd->status.char_id); - return 1; - } - if (gstor->dirty) - { // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex] - if (battle_config.error_log) - printf - ("intif_parse_LoadGuildStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", - sd->status.account_id, sd->status.char_id); - return 1; - } - if (battle_config.save_log) - printf ("intif_open_guild_storage: %d\n", RFIFOL (fd, 4)); - memcpy (gstor, RFIFOP (fd, 12), sizeof (struct guild_storage)); - gstor->storage_status = 1; - sd->state.storage_flag = 2; - clif_guildstorageitemlist (sd, gstor); - clif_guildstorageequiplist (sd, gstor); - clif_updateguildstorageamount (sd, gstor); - } - return 0; -} - -static -int intif_parse_SaveGuildStorage (int fd) -{ - if (battle_config.save_log) - { - printf ("intif_save_guild_storage: done %d %d %d\n", RFIFOL (fd, 2), - RFIFOL (fd, 6), RFIFOB (fd, 10)); - } - storage_guild_storagesaved ( /*RFIFOL(fd,2), */ RFIFOL (fd, 6)); - return 0; -} - // パーティ作成可否 static int intif_parse_PartyCreated (int fd) @@ -875,214 +571,6 @@ int intif_parse_PartyMessage (int fd) return 0; } -// ギルド作成可否 -static -int intif_parse_GuildCreated (int fd) -{ - guild_created (RFIFOL (fd, 2), RFIFOL (fd, 6)); - return 0; -} - -// ギルド情報 -static -int intif_parse_GuildInfo (int fd) -{ - if (RFIFOW (fd, 2) == 8) - { - if (battle_config.error_log) - printf ("intif: guild noinfo %d\n", RFIFOL (fd, 4)); - guild_recv_noinfo (RFIFOL (fd, 4)); - return 0; - } - -// if(battle_config.etc_log) -// printf("intif: guild info %d\n",RFIFOL(fd,4)); - if (RFIFOW (fd, 2) != sizeof (struct guild) + 4) - { - if (battle_config.error_log) - printf ("intif: guild info : data size error\n %d %d %d", - RFIFOL (fd, 4), RFIFOW (fd, 2), - sizeof (struct guild) + 4); - } - guild_recv_info ((struct guild *) RFIFOP (fd, 4)); - return 0; -} - -// ギルドメンバ追加通知 -static -int intif_parse_GuildMemberAdded (int fd) -{ - if (battle_config.etc_log) - printf ("intif: guild member added %d %d %d %d\n", RFIFOL (fd, 2), - RFIFOL (fd, 6), RFIFOL (fd, 10), RFIFOB (fd, 14)); - guild_member_added (RFIFOL (fd, 2), RFIFOL (fd, 6), RFIFOL (fd, 10), - RFIFOB (fd, 14)); - return 0; -} - -// ギルドメンバ脱退/追放通知 -static -int intif_parse_GuildMemberLeaved (int fd) -{ - guild_member_leaved (RFIFOL (fd, 2), RFIFOL (fd, 6), RFIFOL (fd, 10), - RFIFOB (fd, 14), (const char *)RFIFOP (fd, 55), (const char *)RFIFOP (fd, 15)); - return 0; -} - -// ギルドメンバオンライン状態/Lv変更通知 -static -int intif_parse_GuildMemberInfoShort (int fd) -{ - guild_recv_memberinfoshort (RFIFOL (fd, 2), RFIFOL (fd, 6), - RFIFOL (fd, 10), RFIFOB (fd, 14), RFIFOW (fd, - 15), - RFIFOW (fd, 17)); - return 0; -} - -// ギルド解散通知 -static -int intif_parse_GuildBroken (int fd) -{ - guild_broken (RFIFOL (fd, 2), RFIFOB (fd, 6)); - return 0; -} - -// ギルド基本情報変更通知 -static -int intif_parse_GuildBasicInfoChanged (int fd) -{ - int type = RFIFOW (fd, 8), guild_id = RFIFOL (fd, 4); - void *data = RFIFOP (fd, 10); - struct guild *g = guild_search (guild_id); - short dw = *((short *) data); - int dd = *((int *) data); - if (g == NULL) - return 0; - switch (type) - { - case GBI_EXP: - g->exp = dd; - break; - case GBI_GUILDLV: - g->guild_lv = dw; - break; - case GBI_SKILLPOINT: - g->skill_point = dd; - break; - } - return 0; -} - -// ギルドメンバ情報変更通知 -static -int intif_parse_GuildMemberInfoChanged (int fd) -{ - int type = RFIFOW (fd, 16), guild_id = RFIFOL (fd, 4); - int account_id = RFIFOL (fd, 8), char_id = RFIFOL (fd, 12); - void *data = RFIFOP (fd, 18); - struct guild *g = guild_search (guild_id); - int idx, dd = *((int *) data); - if (g == NULL) - return 0; - idx = guild_getindex (g, account_id, char_id); - switch (type) - { - case GMI_POSITION: - g->member[idx].position = dd; - guild_memberposition_changed (g, idx, dd); - break; - case GMI_EXP: - g->member[idx].exp = dd; - break; - } - return 0; -} - -// ギルド役職変更通知 -static -int intif_parse_GuildPosition (int fd) -{ - if (RFIFOW (fd, 2) != sizeof (struct guild_position) + 12) - { - if (battle_config.error_log) - printf ("intif: guild info : data size error\n %d %d %d", - RFIFOL (fd, 4), RFIFOW (fd, 2), - sizeof (struct guild_position) + 12); - } - guild_position_changed (RFIFOL (fd, 4), RFIFOL (fd, 8), - (struct guild_position *) RFIFOP (fd, 12)); - return 0; -} - -// ギルドスキル割り振り通知 -static -int intif_parse_GuildSkillUp (int fd) -{ - guild_skillupack (RFIFOL (fd, 2), RFIFOL (fd, 6), RFIFOL (fd, 10)); - return 0; -} - -// ギルド同盟/敵対通知 -static -int intif_parse_GuildAlliance (int fd) -{ - guild_allianceack (RFIFOL (fd, 2), RFIFOL (fd, 6), RFIFOL (fd, 10), - RFIFOL (fd, 14), RFIFOB (fd, 18), (const char *)RFIFOP (fd, 19), - (const char *)RFIFOP (fd, 43)); - return 0; -} - -// ギルド告知変更通知 -static -int intif_parse_GuildNotice (int fd) -{ - guild_notice_changed (RFIFOL (fd, 2), (const char *)RFIFOP (fd, 6), (const char *)RFIFOP (fd, 66)); - return 0; -} - -// ギルドエンブレム変更通知 -static -int intif_parse_GuildEmblem (int fd) -{ - guild_emblem_changed (RFIFOW (fd, 2) - 12, RFIFOL (fd, 4), RFIFOL (fd, 8), - (const char *)RFIFOP (fd, 12)); - return 0; -} - -// ギルド会話受信 -static -int intif_parse_GuildMessage (int fd) -{ - guild_recv_message (RFIFOL (fd, 4), RFIFOL (fd, 8), (const char *)RFIFOP (fd, 12), - RFIFOW (fd, 2) - 12); - return 0; -} - -// ギルド城データ要求返信 -static -int intif_parse_GuildCastleDataLoad (int fd) -{ - return guild_castledataloadack (RFIFOW (fd, 2), RFIFOB (fd, 4), - RFIFOL (fd, 5)); -} - -// ギルド城データ変更通知 -static -int intif_parse_GuildCastleDataSave (int fd) -{ - return guild_castledatasaveack (RFIFOW (fd, 2), RFIFOB (fd, 4), - RFIFOL (fd, 5)); -} - -// ギルド城データ一括受信(初期化時) -static -int intif_parse_GuildCastleAllDataLoad (int fd) -{ - return guild_castlealldataload (RFIFOW (fd, 2), - (struct guild_castle *) RFIFOP (fd, 4)); -} - //----------------------------------------------------------------- // inter serverからの通信 // エラーがあれば0(false)を返すこと @@ -1137,12 +625,6 @@ int intif_parse (int fd) case 0x3811: intif_parse_SaveStorage (fd); break; - case 0x3818: - intif_parse_LoadGuildStorage (fd); - break; - case 0x3819: - intif_parse_SaveGuildStorage (fd); - break; case 0x3820: intif_parse_PartyCreated (fd); break; @@ -1167,61 +649,6 @@ int intif_parse (int fd) case 0x3827: intif_parse_PartyMessage (fd); break; - case 0x3830: - intif_parse_GuildCreated (fd); - break; - case 0x3831: - intif_parse_GuildInfo (fd); - break; - case 0x3832: - intif_parse_GuildMemberAdded (fd); - break; - case 0x3834: - intif_parse_GuildMemberLeaved (fd); - break; - case 0x3835: - intif_parse_GuildMemberInfoShort (fd); - break; - case 0x3836: - intif_parse_GuildBroken (fd); - break; - case 0x3837: - intif_parse_GuildMessage (fd); - break; - case 0x3839: - intif_parse_GuildBasicInfoChanged (fd); - break; - case 0x383a: - intif_parse_GuildMemberInfoChanged (fd); - break; - case 0x383b: - intif_parse_GuildPosition (fd); - break; - case 0x383c: - intif_parse_GuildSkillUp (fd); - break; - case 0x383d: - intif_parse_GuildAlliance (fd); - break; - case 0x383e: - intif_parse_GuildNotice (fd); - break; - case 0x383f: - intif_parse_GuildEmblem (fd); - break; - case 0x3840: - intif_parse_GuildCastleDataLoad (fd); - break; - case 0x3841: - intif_parse_GuildCastleDataSave (fd); - break; - case 0x3842: - intif_parse_GuildCastleAllDataLoad (fd); - break; - //case 0x3880: intif_parse_CreateP.et(fd); break; - //case 0x3881: intif_parse_RecvP.etData(fd); break; - //case 0x3882: intif_parse_SaveP.etOk(fd); break; - //case 0x3883: intif_parse_DeleteP.etOk(fd); break; default: if (battle_config.error_log) printf ("intif_parse : unknown packet %d %x\n", fd, diff --git a/src/map/intif.hpp b/src/map/intif.hpp index fcca523..97afce6 100644 --- a/src/map/intif.hpp +++ b/src/map/intif.hpp @@ -16,8 +16,6 @@ int intif_request_accountreg (struct map_session_data *sd); int intif_request_storage (int account_id); int intif_send_storage (struct storage *stor); -int intif_request_guild_storage (int account_id, int guild_id); -int intif_send_guild_storage (int account_id, struct guild_storage *gstor); int intif_create_party (struct map_session_data *sd, const char *name); int intif_request_partyinfo (int party_id); @@ -30,27 +28,4 @@ int intif_break_party (int party_id); int intif_party_message (int party_id, int account_id, const char *mes, int len); int intif_party_checkconflict (int party_id, int account_id, const char *nick); -int intif_guild_create (const char *name, const struct guild_member *master); -int intif_guild_request_info (int guild_id); -int intif_guild_addmember (int guild_id, struct guild_member *m); -int intif_guild_leave (int guild_id, int account_id, int char_id, int flag, - const char *mes); -int intif_guild_memberinfoshort (int guild_id, int account_id, int char_id, - int online, int lv, int class_); -int intif_guild_break (int guild_id); -int intif_guild_message (int guild_id, int account_id, const char *mes, int len); -int intif_guild_checkconflict (int guild_id, int account_id, int char_id); -int intif_guild_change_basicinfo (int guild_id, int type, const void *data, - int len); -int intif_guild_change_memberinfo (int guild_id, int account_id, int char_id, - int type, const void *data, int len); -int intif_guild_position (int guild_id, int idx, struct guild_position *p); -int intif_guild_skillup (int guild_id, int skill_num, int account_id); -int intif_guild_alliance (int guild_id1, int guild_id2, int account_id1, - int account_id2, int flag); -int intif_guild_notice (int guild_id, const char *mes1, const char *mes2); -int intif_guild_emblem (int guild_id, int len, const char *data); -int intif_guild_castle_dataload (int castle_id, int index); -int intif_guild_castle_datasave (int castle_id, int index, int value); - #endif diff --git a/src/map/map.cpp b/src/map/map.cpp index 2cd324f..c3d7233 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -29,7 +29,6 @@ #include "party.hpp" #include "battle.hpp" #include "script.hpp" -#include "guild.hpp" #include "atcommand.hpp" #include "../common/nullpo.hpp" #include "../common/socket.hpp" @@ -64,7 +63,6 @@ int map_port = 0; int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL; int save_settings = 0xFFFF; -int agit_flag = 0; int night_flag = 0; // 0=day, 1=night [Yor] struct charid2nick @@ -1111,15 +1109,8 @@ int map_quit (struct map_session_data *sd) if (sd->party_invite > 0) // パーティ勧誘を拒否する party_reply_invite (sd, sd->party_invite_account, 0); - if (sd->guild_invite > 0) // ギルド勧誘を拒否する - guild_reply_invite (sd, sd->guild_invite, 0); - if (sd->guild_alliance > 0) // ギルド同盟勧誘を拒否する - guild_reply_reqalliance (sd, sd->guild_alliance_account, 0); - party_send_logout (sd); // パーティのログアウトメッセージ送信 - guild_send_memberinfoshort (sd, 0); // ギルドのログアウトメッセージ送信 - pc_cleareventtimer (sd); // イベントタイマを破棄する skill_castcancel (&sd->bl, 0); // 詠唱を中断する @@ -1147,12 +1138,10 @@ int map_quit (struct map_session_data *sd) //クローンスキルで覚えたスキルは消す //The storage closing routines will save the char if needed. [Skotlex] - if (!sd->state.storage_flag) + if (!sd->state.storage_open) chrif_save (sd); - else if (sd->state.storage_flag == 1) + else if (sd->state.storage_open) storage_storage_quit (sd); - else if (sd->state.storage_flag == 2) - storage_guild_storage_quit (sd, 1); if (sd->npc_stackbuf && sd->npc_stackbuf != NULL) free (sd->npc_stackbuf); @@ -2105,7 +2094,6 @@ void term_func (void) do_final_script (); do_final_itemdb (); do_final_storage (); - do_final_guild (); } /// --help was passed @@ -2180,7 +2168,6 @@ int do_init (int argc, char *argv[]) do_init_npc (); do_init_pc (); do_init_party (); - do_init_guild (); do_init_storage (); do_init_skill (); do_init_magic (); diff --git a/src/map/map.hpp b/src/map/map.hpp index 5a252f9..f52537b 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -117,7 +117,6 @@ struct skill_unit_group { int src_id; int party_id; - int guild_id; int map, range; int target_flag; unsigned int tick; @@ -182,7 +181,7 @@ struct map_session_data unsigned produce_flag:1; unsigned make_arrow_flag:1; unsigned potionpitcher_flag:1; - unsigned storage_flag:2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex] + unsigned storage_open:1; unsigned shroud_active:1; unsigned shroud_hides_name_talking:1; unsigned shroud_disappears_on_pickup:1; @@ -368,9 +367,6 @@ struct map_session_data int party_sended, party_invite, party_invite_account; int party_hp, party_x, party_y; - int guild_sended, guild_invite, guild_invite_account; - int guild_emblem_id, guild_alliance, guild_alliance_account; - int guildspy; // [Syrus22] int partyspy; // [Syrus22] char message[80]; @@ -438,7 +434,6 @@ struct npc_data { const ScriptCode *script; short xs, ys; - int guild_id; int timer, timerid, timeramount, nexttimer; unsigned int timertick; struct npc_timerevent_list *timer_event; @@ -529,7 +524,6 @@ struct mob_data short opt1, opt2, opt3, option; short min_chase; short sg_count; - int guild_id; int deletetimer; int skilltimer; @@ -539,7 +533,7 @@ struct mob_data unsigned int skilldelay[MAX_MOBSKILL]; int def_ele; int master_id, master_dist; - int exclusion_src, exclusion_party, exclusion_guild; + int exclusion_src, exclusion_party; struct skill_timerskill skilltimerskill[MAX_MOBSKILLTIMERSKILL]; struct skill_unit_group skillunit[MAX_MOBSKILLUNITGROUP]; struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; @@ -582,11 +576,8 @@ struct map_data unsigned nopenalty:1; unsigned pvp:1; unsigned pvp_noparty:1; - unsigned pvp_noguild:1; unsigned pvp_nightmaredrop:1; unsigned pvp_nocalcrank:1; - unsigned gvg:1; - unsigned gvg_noparty:1; unsigned nozenypenalty:1; unsigned notrade:1; unsigned noskill:1; @@ -718,7 +709,6 @@ extern struct map_data map[]; extern int map_num; extern int autosave_interval; extern int save_settings; -extern int agit_flag; extern int night_flag; // 0=day, 1=night [Yor] extern char motd_txt[]; diff --git a/src/map/mob.cpp b/src/map/mob.cpp index b12de35..def6851 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -15,7 +15,6 @@ #include "intif.hpp" #include "pc.hpp" #include "mob.hpp" -#include "guild.hpp" #include "itemdb.hpp" #include "skill.hpp" #include "battle.hpp" @@ -426,17 +425,6 @@ int mob_once_spawn (struct map_session_data *sd, const char *mapname, md->bl.type = BL_MOB; map_addiddb (&md->bl); mob_spawn (md->bl.id); - - if (mob_class == 1288) - { // emperium hp based on defense level [Valaris] - struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); - if (gc) - { - mob_db[mob_class].max_hp += 2000 * gc->defense; - md->hp = mob_db[mob_class].max_hp; - } - } // end addition [Valaris] - } return (amount > 0) ? md->bl.id : 0; } @@ -529,7 +517,6 @@ int mob_spawn_guardian (struct map_session_data *sd, const char *mapname, for (count = 0; count < amount; count++) { - struct guild_castle *gc; CREATE (md, struct mob_data, 1); mob_spawn_dataset (md, mobname, mob_class); @@ -549,53 +536,6 @@ int mob_spawn_guardian (struct map_session_data *sd, const char *mapname, md->bl.type = BL_MOB; map_addiddb (&md->bl); mob_spawn (md->bl.id); - - gc = guild_mapname2gc (map[md->bl.m].name); - if (gc) - { - mob_db[mob_class].max_hp += 2000 * gc->defense; - if (guardian == 0) - { - md->hp = gc->Ghp0; - gc->GID0 = md->bl.id; - } - if (guardian == 1) - { - md->hp = gc->Ghp1; - gc->GID1 = md->bl.id; - } - if (guardian == 2) - { - md->hp = gc->Ghp2; - gc->GID2 = md->bl.id; - } - if (guardian == 3) - { - md->hp = gc->Ghp3; - gc->GID3 = md->bl.id; - } - if (guardian == 4) - { - md->hp = gc->Ghp4; - gc->GID4 = md->bl.id; - } - if (guardian == 5) - { - md->hp = gc->Ghp5; - gc->GID5 = md->bl.id; - } - if (guardian == 6) - { - md->hp = gc->Ghp6; - gc->GID6 = md->bl.id; - } - if (guardian == 7) - { - md->hp = gc->Ghp7; - gc->GID7 = md->bl.id; - } - - } } return (amount > 0) ? md->bl.id : 0; @@ -1429,38 +1369,6 @@ int mob_can_reach (struct mob_data *md, struct block_list *bl, int range) dx = abs (bl->x - md->bl.x); dy = abs (bl->y - md->bl.y); - //=========== guildcastle guardian no search start=========== - //when players are the guild castle member not attack them ! - if (md->mob_class == 1285 || md->mob_class == 1286 || md->mob_class == 1287) - { - struct map_session_data *sd; - struct guild *g = NULL; - struct guild_castle *gc = guild_mapname2gc (map[bl->m].name); - - if (gc && agit_flag == 0) // Guardians will not attack during non-woe time [Valaris] - return 0; // end addition [Valaris] - - if (bl && bl->type == BL_PC) - { - if ((sd = (struct map_session_data *) bl) == NULL) - { - printf ("mob_can_reach nullpo\n"); - return 0; - } - - if (gc && sd && sd->status.guild_id && sd->status.guild_id > 0) - { - g = guild_search (sd->status.guild_id); // don't attack guild members [Valaris] - if (g && g->guild_id > 0 && g->guild_id == gc->guild_id) - return 0; - if (g && gc && guild_isallied (g, gc)) - return 0; - - } - } - } - //========== guildcastle guardian no search eof============== - if (bl && bl->type == BL_PC && battle_config.monsters_ignore_gm == 1) { // option to have monsters ignore GMs [Valaris] struct map_session_data *sd; @@ -2737,88 +2645,6 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, md->hp -= damage; - if (md->mob_class >= 1285 && md->mob_class <= 1287) - { // guardian hp update [Valaris] - struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); - if (gc) - { - - if (md->bl.id == gc->GID0) - { - gc->Ghp0 = md->hp; - if (gc->Ghp0 <= 0) - { - guild_castledatasave (gc->castle_id, 10, 0); - guild_castledatasave (gc->castle_id, 18, 0); - } - } - if (md->bl.id == gc->GID1) - { - gc->Ghp1 = md->hp; - if (gc->Ghp1 <= 0) - { - guild_castledatasave (gc->castle_id, 11, 0); - guild_castledatasave (gc->castle_id, 19, 0); - } - } - if (md->bl.id == gc->GID2) - { - gc->Ghp2 = md->hp; - if (gc->Ghp2 <= 0) - { - guild_castledatasave (gc->castle_id, 12, 0); - guild_castledatasave (gc->castle_id, 20, 0); - } - } - if (md->bl.id == gc->GID3) - { - gc->Ghp3 = md->hp; - if (gc->Ghp3 <= 0) - { - guild_castledatasave (gc->castle_id, 13, 0); - guild_castledatasave (gc->castle_id, 21, 0); - } - } - if (md->bl.id == gc->GID4) - { - gc->Ghp4 = md->hp; - if (gc->Ghp4 <= 0) - { - guild_castledatasave (gc->castle_id, 14, 0); - guild_castledatasave (gc->castle_id, 22, 0); - } - } - if (md->bl.id == gc->GID5) - { - gc->Ghp5 = md->hp; - if (gc->Ghp5 <= 0) - { - guild_castledatasave (gc->castle_id, 15, 0); - guild_castledatasave (gc->castle_id, 23, 0); - } - } - if (md->bl.id == gc->GID6) - { - gc->Ghp6 = md->hp; - if (gc->Ghp6 <= 0) - { - guild_castledatasave (gc->castle_id, 16, 0); - guild_castledatasave (gc->castle_id, 24, 0); - } - } - if (md->bl.id == gc->GID7) - { - gc->Ghp7 = md->hp; - if (gc->Ghp7 <= 0) - { - guild_castledatasave (gc->castle_id, 17, 0); - guild_castledatasave (gc->castle_id, 25, 0); - - } - } - } - } // end addition [Valaris] - if (md->option & 2) skill_status_change_end (&md->bl, SC_HIDING, -1); if (md->option & 4) @@ -3137,16 +2963,6 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage, } // [MouseJstr] - // <Agit> NPC Event [OnAgitBreak] - if (md->npc_event[0] - && strcmp (((md->npc_event) + strlen (md->npc_event) - 13), - "::OnAgitBreak") == 0) - { - printf ("MOB.C: Run NPC_Event[OnAgitBreak].\n"); - if (agit_flag == 1) //Call to Run NPC_Event[OnAgitBreak] - guild_agit_break (md); - } - // SCRIPT実行 if (md->npc_event[0]) { @@ -3280,30 +3096,6 @@ int mob_heal (struct mob_data *md, int heal) if (max_hp < md->hp) md->hp = max_hp; - if (md->mob_class >= 1285 && md->mob_class <= 1287) - { // guardian hp update [Valaris] - struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name); - if (gc) - { - if (md->bl.id == gc->GID0) - gc->Ghp0 = md->hp; - if (md->bl.id == gc->GID1) - gc->Ghp1 = md->hp; - if (md->bl.id == gc->GID2) - gc->Ghp2 = md->hp; - if (md->bl.id == gc->GID3) - gc->Ghp3 = md->hp; - if (md->bl.id == gc->GID4) - gc->Ghp4 = md->hp; - if (md->bl.id == gc->GID5) - gc->Ghp5 = md->hp; - if (md->bl.id == gc->GID6) - gc->Ghp6 = md->hp; - if (md->bl.id == gc->GID7) - gc->Ghp7 = md->hp; - } - } // end addition [Valaris] - return 0; } @@ -3904,12 +3696,6 @@ int mobskill_use_id (struct mob_data *md, struct block_list *target, && skill_id != RG_BACKSTAP && skill_id != RG_RAID) return 0; - if (map[md->bl.m].flag.gvg - && (skill_id == SM_ENDURE || skill_id == AL_TELEPORT - || skill_id == AL_WARP || skill_id == WZ_ICEWALL - || skill_id == TF_BACKSLIDING)) - return 0; - if (skill_get_inf2 (skill_id) & 0x200 && md->bl.id == target->id) return 0; @@ -4036,12 +3822,6 @@ int mobskill_use_pos (struct mob_data *md, if (md->option & 2) return 0; - if (map[md->bl.m].flag.gvg - && (skill_id == SM_ENDURE || skill_id == AL_TELEPORT - || skill_id == AL_WARP || skill_id == WZ_ICEWALL - || skill_id == TF_BACKSLIDING)) - return 0; - // 射程と障害物チェック bl.type = BL_NUL; bl.m = md->bl.m; @@ -4414,39 +4194,6 @@ int mobskill_event (struct mob_data *md, int flag) } /*========================================== - * Mobがエンペリウムなどの場合の判定 - *------------------------------------------ - */ -int mob_gvmobcheck (struct map_session_data *sd, struct block_list *bl) -{ - struct mob_data *md = NULL; - - nullpo_retr (0, sd); - nullpo_retr (0, bl); - - if (bl->type == BL_MOB && (md = (struct mob_data *) bl) && - (md->mob_class == 1288 || md->mob_class == 1287 || md->mob_class == 1286 - || md->mob_class == 1285)) - { - struct guild_castle *gc = guild_mapname2gc (map[sd->bl.m].name); - struct guild *g = guild_search (sd->status.guild_id); - - if (g == NULL && md->mob_class == 1288) - return 0; //ギルド未加入ならダメージ無し - else if (gc != NULL && !map[sd->bl.m].flag.gvg) - return 0; //砦内でGvじゃないときはダメージなし - else if (g && gc != NULL && g->guild_id == gc->guild_id) - return 0; //自占領ギルドのエンペならダメージ無し - else if (g && guild_checkskill (g, GD_APPROVAL) <= 0 - && md->mob_class == 1288) - return 0; //正規ギルド承認がないとダメージ無し - - } - - return 1; -} - -/*========================================== * スキル用タイマー削除 *------------------------------------------ */ diff --git a/src/map/mob.hpp b/src/map/mob.hpp index 19addf2..c657118 100644 --- a/src/map/mob.hpp +++ b/src/map/mob.hpp @@ -145,7 +145,6 @@ void mobskill_castend_id (timer_id tid, tick_t tick, custom_id_t id, custom_data void mobskill_castend_pos (timer_id tid, tick_t tick, custom_id_t id, custom_data_t data); int mob_summonslave (struct mob_data *md2, int *value, int amount, int flag); -int mob_gvmobcheck (struct map_session_data *sd, struct block_list *bl); void mob_reload (void); #endif diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 36f9eb4..15418b9 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -2034,10 +2034,6 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4) { map[m].flag.pvp_noparty = 1; } - else if (strcasecmp (w3, "pvp_noguild") == 0) - { - map[m].flag.pvp_noguild = 1; - } else if (strcasecmp (w3, "pvp_nightmaredrop") == 0) { if (sscanf (w4, "%[^,],%[^,],%d", drop_arg1, drop_arg2, &drop_per) == @@ -2075,14 +2071,6 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4) { map[m].flag.pvp_nocalcrank = 1; } - else if (strcasecmp (w3, "gvg") == 0) - { - map[m].flag.gvg = 1; - } - else if (strcasecmp (w3, "gvg_noparty") == 0) - { - map[m].flag.gvg_noparty = 1; - } else if (strcasecmp (w3, "nozenypenalty") == 0) { map[m].flag.nozenypenalty = 1; diff --git a/src/map/party.cpp b/src/map/party.cpp index b58234a..c649ae5 100644 --- a/src/map/party.cpp +++ b/src/map/party.cpp @@ -250,7 +250,7 @@ int party_invite (struct map_session_data *sd, int account_id) if (!battle_config.invite_request_check) { /* Disallow the invitation under these conditions. */ - if (tsd->guild_invite > 0 || tsd->trade_partner || tsd->npc_id + if (tsd->trade_partner || tsd->npc_id || tsd->npc_shopid || pc_checkskill (tsd, NV_PARTY) < 1) { clif_party_inviteack (sd, tsd->status.name, 1); diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 95b5629..fef0af6 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -17,7 +17,6 @@ #include "chat.hpp" #include "chrif.hpp" #include "clif.hpp" -#include "guild.hpp" #include "intif.hpp" #include "itemdb.hpp" #include "map.hpp" @@ -647,9 +646,6 @@ int pc_isequip (struct map_session_data *sd, int n) if (map[sd->bl.m].flag.pvp && (item->flag.no_equip == 1 || item->flag.no_equip == 3)) return 0; - if (map[sd->bl.m].flag.gvg - && (item->flag.no_equip == 2 || item->flag.no_equip == 3)) - return 0; if (item->equip & 0x0002 && sc_data && sc_data[SC_STRIPWEAPON].timer != -1) return 0; @@ -763,7 +759,6 @@ int pc_authok (int id, int login_id2, time_t connect_until_time, struct map_session_data *sd = NULL; struct party *p; - struct guild *g; unsigned long tick = gettick (); struct sockaddr_in sai; socklen_t sa_len = sizeof(struct sockaddr); @@ -879,11 +874,6 @@ int pc_authok (int id, int login_id2, time_t connect_until_time, sd->party_y = -1; sd->party_hp = -1; - // ギルド関係の初期化 - sd->guild_sended = 0; - sd->guild_invite = 0; - sd->guild_alliance = 0; - // イベント関係の初期化 memset (sd->eventqueue, 0, sizeof (sd->eventqueue)); for (int i = 0; i < MAX_EVENTTIMER; i++) @@ -897,9 +887,6 @@ int pc_authok (int id, int login_id2, time_t connect_until_time, if (sd->status.party_id > 0 && (p = party_search (sd->status.party_id)) == NULL) party_request_info (sd->status.party_id); - if (sd->status.guild_id > 0 - && (g = guild_search (sd->status.guild_id)) == NULL) - guild_request_info (sd->status.guild_id); // pvpの設定 sd->pvp_rank = 0; @@ -3536,7 +3523,7 @@ int pc_dropitem (struct map_session_data *sd, int n, int amount) { nullpo_retr (1, sd); - if (sd->trade_partner != 0 || sd->npc_id != 0 || sd->state.storage_flag) + if (sd->trade_partner != 0 || sd->npc_id != 0 || sd->state.storage_open) return 0; // no dropping while trading/npc/storage if (n < 0 || n >= MAX_INVENTORY) @@ -3673,10 +3660,8 @@ int pc_isUseitem (struct map_session_data *sd, int n) return 0; if (itemdb_type (nameid) != 0) return 0; - if ((nameid == 605) && map[sd->bl.m].flag.gvg) - return 0; if (nameid == 601 - && (map[sd->bl.m].flag.noteleport || map[sd->bl.m].flag.gvg)) + && (map[sd->bl.m].flag.noteleport)) { clif_skill_teleportmessage (sd, 0); return 0; @@ -3685,7 +3670,7 @@ int pc_isUseitem (struct map_session_data *sd, int n) if (nameid == 602 && map[sd->bl.m].flag.noreturn) return 0; if (nameid == 604 - && (map[sd->bl.m].flag.nobranch || map[sd->bl.m].flag.gvg)) + && (map[sd->bl.m].flag.nobranch)) return 0; if (item->sex != 2 && sd->status.sex != item->sex) return 0; @@ -4076,17 +4061,11 @@ int pc_setpos (struct map_session_data *sd, const char *mapname_org, int x, int chat_leavechat (sd); if (sd->trade_partner) // 取引を中断する trade_tradecancel (sd); - if (sd->state.storage_flag == 1) + if (sd->state.storage_open) storage_storage_quit (sd); // 倉庫を開いてるなら保存する - else if (sd->state.storage_flag == 2) - storage_guild_storage_quit (sd, 0); if (sd->party_invite > 0) // パーティ勧誘を拒否する party_reply_invite (sd, sd->party_invite_account, 0); - if (sd->guild_invite > 0) // ギルド勧誘を拒否する - guild_reply_invite (sd, sd->guild_invite, 0); - if (sd->guild_alliance > 0) // ギルド同盟勧誘を拒否する - guild_reply_reqalliance (sd, sd->guild_alliance_account, 0); skill_castcancel (&sd->bl, 0); // 詠唱中断 pc_stop_walking (sd, 0); // 歩行中断 @@ -4145,12 +4124,10 @@ int pc_setpos (struct map_session_data *sd, const char *mapname_org, int x, int sd->state.waitingdisconnect = 1; pc_makesavestatus (sd); //The storage close routines save the char data. [Skotlex] - if (!sd->state.storage_flag) + if (!sd->state.storage_open) chrif_save (sd); - else if (sd->state.storage_flag == 1) + else if (sd->state.storage_open) storage_storage_quit (sd); - else if (sd->state.storage_flag == 2) - storage_guild_storage_quit (sd, 1); chrif_changemapserver (sd, mapname, x, y, ip, port); return 0; @@ -4648,10 +4625,7 @@ int pc_checkskill (struct map_session_data *sd, int skill_id) return 0; if (skill_id >= 10000) { - struct guild *g; - if (sd->status.guild_id > 0 - && (g = guild_search (sd->status.guild_id)) != NULL) - return guild_checkskill (g, skill_id); + // was: guild skills return 0; } @@ -5230,13 +5204,6 @@ int pc_gainexp_reason (struct map_session_data *sd, int base_exp, int job_exp, job_exp * (25 + sd->sc_data[SC_RICHMANKIM].val1 * 25) / 100; } - if (sd->status.guild_id > 0) - { // ギルドに上納 - base_exp -= guild_payexp (sd, base_exp); - if (base_exp < 0) - base_exp = 0; - } - if (!battle_config.multi_level_up && pc_nextbaseafter (sd)) { while (sd->status.base_exp + base_exp >= pc_nextbaseafter (sd) @@ -5954,7 +5921,7 @@ int pc_damage (struct block_list *src, struct map_session_data *sd, if (battle_config.death_penalty_type > 0 && sd->status.base_level >= 20) { // changed penalty options, added death by player if pk_mode [Valaris] - if (!map[sd->bl.m].flag.nopenalty && !map[sd->bl.m].flag.gvg) + if (!map[sd->bl.m].flag.nopenalty) { if (battle_config.death_penalty_type == 1 && battle_config.death_penalty_base > 0) @@ -6093,14 +6060,6 @@ int pc_damage (struct block_list *src, struct map_session_data *sd, sd->status.save_point.y, 0); } } - //GvG - if (map[sd->bl.m].flag.gvg) - { - pc_setstand (sd); - pc_setrestartvalue (sd, 3); - pc_setpos (sd, sd->status.save_point.map, sd->status.save_point.x, - sd->status.save_point.y, 0); - } if (src && src->type == BL_PC) { @@ -7706,12 +7665,6 @@ int pc_checkitem (struct map_session_data *sd) sd->status.inventory[i].equip = 0; calc_flag = 1; } - else if (sd->status.inventory[i].equip && map[sd->bl.m].flag.gvg - && (it->flag.no_equip == 2 || it->flag.no_equip == 3)) - { //GvG制限 - sd->status.inventory[i].equip = 0; - calc_flag = 1; - } } pc_setequipindex (sd); @@ -7911,7 +7864,6 @@ static int natural_heal_tick, natural_heal_prev_tick, natural_heal_diff_tick; static int pc_spheal (struct map_session_data *sd) { int a; - struct guild_castle *gc = NULL; nullpo_retr (0, sd); @@ -7921,15 +7873,6 @@ static int pc_spheal (struct map_session_data *sd) if (sd->sc_data[SC_MAGNIFICAT].timer != -1) // マグニフィカート a += a; - gc = guild_mapname2gc (sd->mapname); // Increased guild castle regen [Valaris] - if (gc) - { - struct guild *g; - g = guild_search (sd->status.guild_id); - if (g && g->guild_id == gc->guild_id) - a += a; - } // end addition [Valaris] - return a; } @@ -7940,7 +7883,6 @@ static int pc_spheal (struct map_session_data *sd) static int pc_hpheal (struct map_session_data *sd) { int a; - struct guild_castle *gc; nullpo_retr (0, sd); @@ -7950,15 +7892,6 @@ static int pc_hpheal (struct map_session_data *sd) if (sd->sc_data[SC_MAGNIFICAT].timer != -1) // Modified by RoVeRT a += a; - gc = guild_mapname2gc (sd->mapname); // Increased guild castle regen [Valaris] - if (gc) - { - struct guild *g; - g = guild_search (sd->status.guild_id); - if (g && g->guild_id == gc->guild_id) - a += a; - } // end addition [Valaris] - return a; } @@ -8411,35 +8344,11 @@ static int pc_autosave_sub (struct map_session_data *sd, va_list ap) if (save_flag == 0 && sd->fd > last_save_fd) { - struct guild_castle *gc = NULL; int i; pc_makesavestatus (sd); chrif_save (sd); - for (i = 0; i < MAX_GUILDCASTLE; i++) - { - gc = guild_castle_search (i); - if (!gc) - continue; - if (gc->visibleG0 == 1) - guild_castledatasave (gc->castle_id, 18, gc->Ghp0); - if (gc->visibleG1 == 1) - guild_castledatasave (gc->castle_id, 19, gc->Ghp1); - if (gc->visibleG2 == 1) - guild_castledatasave (gc->castle_id, 20, gc->Ghp2); - if (gc->visibleG3 == 1) - guild_castledatasave (gc->castle_id, 21, gc->Ghp3); - if (gc->visibleG4 == 1) - guild_castledatasave (gc->castle_id, 22, gc->Ghp4); - if (gc->visibleG5 == 1) - guild_castledatasave (gc->castle_id, 23, gc->Ghp5); - if (gc->visibleG6 == 1) - guild_castledatasave (gc->castle_id, 24, gc->Ghp6); - if (gc->visibleG7 == 1) - guild_castledatasave (gc->castle_id, 25, gc->Ghp7); - } - save_flag = 1; last_save_fd = sd->fd; } diff --git a/src/map/script.cpp b/src/map/script.cpp index 71b5bfb..b3f44b3 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -28,7 +28,6 @@ #include "chrif.hpp" #include "clif.hpp" #include "../common/db.hpp" -#include "guild.hpp" #include "intif.hpp" #include "itemdb.hpp" #include "../common/lock.hpp" @@ -149,9 +148,6 @@ void builtin_readparam(ScriptState *st); void builtin_getcharid(ScriptState *st); void builtin_getpartyname(ScriptState *st); void builtin_getpartymember(ScriptState *st); -void builtin_getguildname(ScriptState *st); -void builtin_getguildmaster(ScriptState *st); -void builtin_getguildmasterid(ScriptState *st); void builtin_strcharinfo(ScriptState *st); void builtin_getequipid(ScriptState *st); void builtin_getequipname(ScriptState *st); @@ -174,9 +170,7 @@ void builtin_bonus2(ScriptState *st); void builtin_bonus3(ScriptState *st); void builtin_skill(ScriptState *st); void builtin_setskill(ScriptState *st); -void builtin_guildskill(ScriptState *st); void builtin_getskilllv(ScriptState *st); -void builtin_getgdskilllv(ScriptState *st); void builtin_basicskillcheck(ScriptState *st); void builtin_getgmlevel(ScriptState *st); void builtin_end(ScriptState *st); @@ -195,7 +189,6 @@ void builtin_gettimetick(ScriptState *st); void builtin_gettime(ScriptState *st); void builtin_gettimestr(ScriptState *st); void builtin_openstorage(ScriptState *st); -void builtin_guildopenstorage(ScriptState *st); void builtin_itemskill(ScriptState *st); void builtin_monster(ScriptState *st); void builtin_areamonster(ScriptState *st); @@ -250,18 +243,7 @@ void builtin_removemapflag(ScriptState *st); void builtin_getmapflag(ScriptState *st); void builtin_pvpon(ScriptState *st); void builtin_pvpoff(ScriptState *st); -void builtin_gvgon(ScriptState *st); -void builtin_gvgoff(ScriptState *st); void builtin_emotion(ScriptState *st); -void builtin_maprespawnguildid(ScriptState *st); -void builtin_agitstart(ScriptState *st); // <Agit> -void builtin_agitend(ScriptState *st); -void builtin_agitcheck(ScriptState *st); // <Agitcheck> -void builtin_flagemblem(ScriptState *st); // Flag Emblem -void builtin_getcastlename(ScriptState *st); -void builtin_getcastledata(ScriptState *st); -void builtin_setcastledata(ScriptState *st); -void builtin_requestguildinfo(ScriptState *st); void builtin_getequipcardcnt(ScriptState *st); void builtin_successremovecards(ScriptState *st); void builtin_failedremovecards(ScriptState *st); @@ -290,8 +272,6 @@ void builtin_stoptimer(ScriptState *st); void builtin_cmdothernpc(ScriptState *st); void builtin_mobcount(ScriptState *st); void builtin_strmobinfo(ScriptState *st); // Script for displaying mob info [Valaris] -void builtin_guardian(ScriptState *st); // Script for displaying mob info [Valaris] -void builtin_guardianinfo(ScriptState *st); // Script for displaying mob info [Valaris] void builtin_npcskilleffect(ScriptState *st); // skill effects for npcs [Valaris] void builtin_specialeffect(ScriptState *st); // special effect script [Valaris] void builtin_specialeffect2(ScriptState *st); // special effect script [Valaris] @@ -371,9 +351,6 @@ struct {builtin_getcharid, "getcharid", "i*"}, {builtin_getpartyname, "getpartyname", "i"}, {builtin_getpartymember, "getpartymember", "i"}, - {builtin_getguildname, "getguildname", "i"}, - {builtin_getguildmaster, "getguildmaster", "i"}, - {builtin_getguildmasterid, "getguildmasterid", "i"}, {builtin_strcharinfo, "strcharinfo", "i"}, {builtin_getequipid, "getequipid", "i"}, {builtin_getequipname, "getequipname", "i"}, @@ -394,9 +371,7 @@ struct {builtin_bonus3, "bonus3", "iiii"}, {builtin_skill, "skill", "ii*"}, {builtin_setskill, "setskill", "ii"}, // [Fate] - {builtin_guildskill, "guildskill", "ii"}, {builtin_getskilllv, "getskilllv", "i"}, - {builtin_getgdskilllv, "getgdskilllv", "ii"}, {builtin_basicskillcheck, "basicskillcheck", "*"}, {builtin_getgmlevel, "getgmlevel", ""}, {builtin_end, "end", ""}, @@ -417,7 +392,6 @@ struct {builtin_gettime, "gettime", "i"}, {builtin_gettimestr, "gettimestr", "si"}, {builtin_openstorage, "openstorage", "*"}, - {builtin_guildopenstorage, "guildopenstorage", "*"}, {builtin_itemskill, "itemskill", "iis"}, {builtin_monster, "monster", "Mxysmi*"}, {builtin_areamonster, "areamonster", "Mxyxysmi*"}, @@ -473,18 +447,7 @@ struct {builtin_getmapflag, "getmapflag", "Mi"}, {builtin_pvpon, "pvpon", "M"}, {builtin_pvpoff, "pvpoff", "M"}, - {builtin_gvgon, "gvgon", "s"}, - {builtin_gvgoff, "gvgoff", "s"}, {builtin_emotion, "emotion", "i"}, - {builtin_maprespawnguildid, "maprespawnguildid", "sii"}, - {builtin_agitstart, "agitstart", ""}, // <Agit> - {builtin_agitend, "agitend", ""}, - {builtin_agitcheck, "agitcheck", "i"}, // <Agitcheck> - {builtin_flagemblem, "flagemblem", "i"}, // Flag Emblem - {builtin_getcastlename, "getcastlename", "s"}, - {builtin_getcastledata, "getcastledata", "si*"}, - {builtin_setcastledata, "setcastledata", "sii"}, - {builtin_requestguildinfo, "requestguildinfo", "i*"}, {builtin_getequipcardcnt, "getequipcardcnt", "i"}, {builtin_successremovecards, "successremovecards", "i"}, {builtin_failedremovecards, "failedremovecards", "ii"}, @@ -509,8 +472,6 @@ struct {builtin_misceffect, "misceffect", "i*"}, {builtin_soundeffect, "soundeffect", "si"}, {builtin_strmobinfo, "strmobinfo", "im"}, // display mob data [Valaris] - {builtin_guardian, "guardian", "siisii*i"}, // summon guardians - {builtin_guardianinfo, "guardianinfo", "i"}, // display guardian data [Valaris] {builtin_npcskilleffect, "npcskilleffect", "iiii"}, // npc skill effect [Valaris] {builtin_specialeffect, "specialeffect", "i"}, // npc skill effect [Valaris] {builtin_specialeffect2, "specialeffect2", "i"}, // skill effect on players[Valaris] @@ -2919,7 +2880,7 @@ void builtin_getcharid (ScriptState *st) if (num == 1) push_val (st->stack, ScriptCode::INT, sd->status.party_id); if (num == 2) - push_val (st->stack, ScriptCode::INT, sd->status.guild_id); + push_val (st->stack, ScriptCode::INT, 0/*guild_id*/); if (num == 3) push_val (st->stack, ScriptCode::INT, sd->status.account_id); } @@ -2990,89 +2951,6 @@ void builtin_getpartymember (ScriptState *st) } -/*========================================== - *指定IDのギルド名取得 - *------------------------------------------ - */ -static -char *builtin_getguildname_sub (int guild_id) -{ - struct guild *g = NULL; - g = guild_search (guild_id); - - if (g != NULL) - { - char *buf; - buf = (char *) calloc (24, 1); - strcpy (buf, g->name); - return buf; - } - return 0; -} - -void builtin_getguildname (ScriptState *st) -{ - char *name; - int guild_id = conv_num (st, &(st->stack->stack_data[st->start + 2])); - name = builtin_getguildname_sub (guild_id); - if (name != 0) - push_str (st->stack, ScriptCode::STR, name); - else - push_str (st->stack, ScriptCode::CONSTSTR, "null"); -} - -/*========================================== - *指定IDのGuildMaster名取得 - *------------------------------------------ - */ -static -char *builtin_getguildmaster_sub (int guild_id) -{ - struct guild *g = NULL; - g = guild_search (guild_id); - - if (g != NULL) - { - char *buf; - buf = (char *) calloc (24, 1); - strncpy (buf, g->master, 23); - return buf; - } - - return 0; -} - -void builtin_getguildmaster (ScriptState *st) -{ - char *master; - int guild_id = conv_num (st, &(st->stack->stack_data[st->start + 2])); - master = builtin_getguildmaster_sub (guild_id); - if (master != 0) - push_str (st->stack, ScriptCode::STR, master); - else - push_str (st->stack, ScriptCode::CONSTSTR, "null"); -} - -void builtin_getguildmasterid (ScriptState *st) -{ - char *master; - struct map_session_data *sd = NULL; - int guild_id = conv_num (st, &(st->stack->stack_data[st->start + 2])); - master = builtin_getguildmaster_sub (guild_id); - if (master != 0) - { - if ((sd = map_nick2sd (master)) == NULL) - { - push_val (st->stack, ScriptCode::INT, 0); - return; - } - push_val (st->stack, ScriptCode::INT, sd->status.char_id); - } - else - { - push_val (st->stack, ScriptCode::INT, 0); - } -} /*========================================== * キャラクタの名前 @@ -3103,12 +2981,8 @@ void builtin_strcharinfo (ScriptState *st) } if (num == 2) { - char *buf; - buf = builtin_getguildname_sub (sd->status.guild_id); - if (buf != 0) - push_str (st->stack, ScriptCode::STR, buf); - else - push_str (st->stack, ScriptCode::CONSTSTR, ""); + // was: guild name + push_str (st->stack, ScriptCode::CONSTSTR, ""); } } @@ -3542,26 +3416,6 @@ void builtin_setskill (ScriptState *st) } /*========================================== - * ギルドスキル取得 - *------------------------------------------ - */ -void builtin_guildskill (ScriptState *st) -{ - int id, level; - struct map_session_data *sd; - int i = 0; - - id = conv_num (st, &(st->stack->stack_data[st->start + 2])); - level = conv_num (st, &(st->stack->stack_data[st->start + 3])); -// if( st->end>st->start+4 ) -// flag=conv_num(st,&(st->stack->stack_data[st->start+4]) ); - sd = script_rid2sd (st); - for (i = 0; i < level; i++) - guild_skillup (sd, id); - -} - -/*========================================== * スキルレベル所得 *------------------------------------------ */ @@ -3572,40 +3426,6 @@ void builtin_getskilllv (ScriptState *st) } /*========================================== - * getgdskilllv(Guild_ID, Skill_ID); - * skill_id = 10000 : GD_APPROVAL - * 10001 : GD_KAFRACONTACT - * 10002 : GD_GUARDIANRESEARCH - * 10003 : GD_CHARISMA - * 10004 : GD_EXTENSION - *------------------------------------------ - */ -void builtin_getgdskilllv (ScriptState *st) -{ - int guild_id = conv_num (st, &(st->stack->stack_data[st->start + 2])); - int skill_id = conv_num (st, &(st->stack->stack_data[st->start + 3])); - struct guild *g = guild_search (guild_id); - push_val (st->stack, ScriptCode::INT, - (g == NULL) ? -1 : guild_checkskill (g, skill_id)); - return; -/* - struct map_session_data *sd=NULL; - struct guild *g=NULL; - int skill_id; - - skill_id=conv_num(st,& (st->stack->stack_data[st->start+2])); - sd=script_rid2sd(st); - if(sd && sd->status.guild_id > 0) g=guild_search(sd->status.guild_id); - if(sd && g) { - push_val(st->stack,ScriptCode::INT, guild_checkskill(g,skill_id+9999) ); - } else { - push_val(st->stack,ScriptCode::INT,-1); - } - return; -*/ -} - -/*========================================== * *------------------------------------------ */ @@ -3949,15 +3769,6 @@ void builtin_openstorage (ScriptState *st) storage_storageopen (sd); } -void builtin_guildopenstorage (ScriptState *st) -{ - struct map_session_data *sd = script_rid2sd (st); - int ret; - st->state = STOP; - ret = storage_guild_storageopen (sd); - push_val (st->stack, ScriptCode::INT, ret); -} - /*========================================== * アイテムによるスキル発動 *------------------------------------------ @@ -5020,11 +4831,28 @@ void builtin_isloggedin (ScriptState *st) *------------------------------------------ */ enum -{ MF_NOMEMO, MF_NOTELEPORT, MF_NOSAVE, MF_NOBRANCH, MF_NOPENALTY, - MF_NOZENYPENALTY, MF_PVP, MF_PVP_NOPARTY, MF_PVP_NOGUILD, MF_GVG, - MF_GVG_NOPARTY, MF_NOTRADE, MF_NOSKILL, MF_NOWARP, MF_NOPVP, - MF_NOICEWALL, - MF_SNOW, MF_FOG, MF_SAKURA, MF_LEAVES, MF_RAIN +{ + MF_NOMEMO = 0, + MF_NOTELEPORT = 1, + MF_NOSAVE = 2, + MF_NOBRANCH = 3, + MF_NOPENALTY = 4, + MF_NOZENYPENALTY = 5, + MF_PVP = 6, + MF_PVP_NOPARTY = 7, + //MF_PVP_NOGUILD = 8, + //MF_GVG = 9, + //MF_GVG_NOPARTY = 10, + MF_NOTRADE = 11, + MF_NOSKILL = 12, + MF_NOWARP = 13, + MF_NOPVP = 14, + MF_NOICEWALL = 15, + MF_SNOW = 16, + MF_FOG = 17, + MF_SAKURA = 18, + MF_LEAVES = 19, + MF_RAIN = 20, }; void builtin_setmapflagnosave (ScriptState *st) @@ -5072,12 +4900,6 @@ void builtin_setmapflag (ScriptState *st) case MF_PVP_NOPARTY: map[m].flag.pvp_noparty = 1; break; - case MF_PVP_NOGUILD: - map[m].flag.pvp_noguild = 1; - break; - case MF_GVG_NOPARTY: - map[m].flag.gvg_noparty = 1; - break; case MF_NOZENYPENALTY: map[m].flag.nozenypenalty = 1; break; @@ -5145,12 +4967,6 @@ void builtin_removemapflag (ScriptState *st) case MF_PVP_NOPARTY: map[m].flag.pvp_noparty = 0; break; - case MF_PVP_NOGUILD: - map[m].flag.pvp_noguild = 0; - break; - case MF_GVG_NOPARTY: - map[m].flag.gvg_noparty = 0; - break; case MF_NOZENYPENALTY: map[m].flag.nozenypenalty = 0; break; @@ -5216,12 +5032,6 @@ void builtin_getmapflag (ScriptState *st) case MF_PVP_NOPARTY: r = map[m].flag.pvp_noparty; break; - case MF_PVP_NOGUILD: - r = map[m].flag.pvp_noguild; - break; - case MF_GVG_NOPARTY: - r = map[m].flag.gvg_noparty; - break; case MF_NOZENYPENALTY: r = map[m].flag.nozenypenalty; break; @@ -5330,32 +5140,6 @@ void builtin_pvpoff (ScriptState *st) } -void builtin_gvgon (ScriptState *st) -{ - int m; - const char *str = conv_str (st, &(st->stack->stack_data[st->start + 2])); - m = map_mapname2mapid (str); - if (m >= 0 && !map[m].flag.gvg) - { - map[m].flag.gvg = 1; - clif_send0199 (m, 3); - } - -} - -void builtin_gvgoff (ScriptState *st) -{ - int m; - const char *str = conv_str (st, &(st->stack->stack_data[st->start + 2])); - m = map_mapname2mapid (str); - if (m >= 0 && map[m].flag.gvg) - { - map[m].flag.gvg = 0; - clif_send0199 (m, 0); - } - -} - /*========================================== * NPCエモーション *------------------------------------------ @@ -5370,368 +5154,6 @@ void builtin_emotion (ScriptState *st) clif_emotion (map_id2bl (st->oid), type); } -static -void builtin_maprespawnguildid_sub (struct block_list *bl, va_list ap) -{ - int g_id = va_arg (ap, int); - int flag = va_arg (ap, int); - struct map_session_data *sd = NULL; - struct mob_data *md = NULL; - - if (bl->type == BL_PC) - sd = (struct map_session_data *) bl; - if (bl->type == BL_MOB) - md = (struct mob_data *) bl; - - if (sd) - { - if ((sd->status.guild_id == g_id) && (flag & 1)) - pc_setpos (sd, sd->status.save_point.map, sd->status.save_point.x, - sd->status.save_point.y, 3); - else if ((sd->status.guild_id != g_id) && (flag & 2)) - pc_setpos (sd, sd->status.save_point.map, sd->status.save_point.x, - sd->status.save_point.y, 3); - else if (sd->status.guild_id == 0) // Warp out players not in guild [Valaris] - pc_setpos (sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 3); // end addition [Valaris] - } - if (md && flag & 4) - { - if (md->mob_class < 1285 || md->mob_class > 1288) - mob_delete (md); - } -} - -void builtin_maprespawnguildid (ScriptState *st) -{ - const char *mapname = conv_str (st, &(st->stack->stack_data[st->start + 2])); - int g_id = conv_num (st, &(st->stack->stack_data[st->start + 3])); - int flag = conv_num (st, &(st->stack->stack_data[st->start + 4])); - - int m = map_mapname2mapid (mapname); - - if (m) - map_foreachinarea (builtin_maprespawnguildid_sub, m, 0, 0, - map[m].xs - 1, map[m].ys - 1, BL_NUL, g_id, flag); -} - -void builtin_agitstart (ScriptState *st) -{ - if (agit_flag == 1) - return; // Agit already Start. - agit_flag = 1; - guild_agit_start (); -} - -void builtin_agitend (ScriptState *st) -{ - if (agit_flag == 0) - return; // Agit already End. - agit_flag = 0; - guild_agit_end (); -} - -/*========================================== - * agitcheck 1; // choice script - * if(@agit_flag == 1) goto agit; - * if(agitcheck(0) == 1) goto agit; - *------------------------------------------ - */ -void builtin_agitcheck (ScriptState *st) -{ - struct map_session_data *sd; - int cond; - - sd = script_rid2sd (st); - cond = conv_num (st, &(st->stack->stack_data[st->start + 2])); - - if (cond == 0) - { - if (agit_flag == 1) - push_val (st->stack, ScriptCode::INT, 1); - if (agit_flag == 0) - push_val (st->stack, ScriptCode::INT, 0); - } - else - { - if (agit_flag == 1) - pc_setreg (sd, add_str ("@agit_flag"), 1); - if (agit_flag == 0) - pc_setreg (sd, add_str ("@agit_flag"), 0); - } -} - -void builtin_flagemblem (ScriptState *st) -{ - int g_id = conv_num (st, &(st->stack->stack_data[st->start + 2])); - - if (g_id < 0) - return; - -// printf("Script.c: [FlagEmblem] GuildID=%d, Emblem=%d.\n", g->guild_id, g->emblem_id); - ((struct npc_data *) map_id2bl (st->oid))->u.scr.guild_id = g_id; -} - -void builtin_getcastlename (ScriptState *st) -{ - const char *mapname = conv_str (st, &(st->stack->stack_data[st->start + 2])); - struct guild_castle *gc; - int i; - char *buf = NULL; - for (i = 0; i < MAX_GUILDCASTLE; i++) - { - if ((gc = guild_castle_search (i)) != NULL) - { - if (strcmp (mapname, gc->map_name) == 0) - { - buf = (char *) calloc (24, 1); - strncpy (buf, gc->castle_name, 23); - break; - } - } - } - if (buf) - push_str (st->stack, ScriptCode::STR, buf); - else - push_str (st->stack, ScriptCode::CONSTSTR, ""); -} - -void builtin_getcastledata (ScriptState *st) -{ - const char *mapname = conv_str (st, &(st->stack->stack_data[st->start + 2])); - int index = conv_num (st, &(st->stack->stack_data[st->start + 3])); - const char *event = NULL; - struct guild_castle *gc; - int i, j; - - if (st->end > st->start + 4 && index == 0) - { - for (i = 0, j = -1; i < MAX_GUILDCASTLE; i++) - if ((gc = guild_castle_search (i)) != NULL && - strcmp (mapname, gc->map_name) == 0) - j = i; - if (j >= 0) - { - event = conv_str (st, &(st->stack->stack_data[st->start + 4])); - guild_addcastleinfoevent (j, 17, event); - } - } - - for (i = 0; i < MAX_GUILDCASTLE; i++) - { - if ((gc = guild_castle_search (i)) != NULL) - { - if (strcmp (mapname, gc->map_name) == 0) - { - switch (index) - { - case 0: - for (j = 1; j < 26; j++) - guild_castledataload (gc->castle_id, j); - break; // Initialize[AgitInit] - case 1: - push_val (st->stack, ScriptCode::INT, gc->guild_id); - break; - case 2: - push_val (st->stack, ScriptCode::INT, gc->economy); - break; - case 3: - push_val (st->stack, ScriptCode::INT, gc->defense); - break; - case 4: - push_val (st->stack, ScriptCode::INT, gc->triggerE); - break; - case 5: - push_val (st->stack, ScriptCode::INT, gc->triggerD); - break; - case 6: - push_val (st->stack, ScriptCode::INT, gc->nextTime); - break; - case 7: - push_val (st->stack, ScriptCode::INT, gc->payTime); - break; - case 8: - push_val (st->stack, ScriptCode::INT, gc->createTime); - break; - case 9: - push_val (st->stack, ScriptCode::INT, gc->visibleC); - break; - case 10: - push_val (st->stack, ScriptCode::INT, gc->visibleG0); - break; - case 11: - push_val (st->stack, ScriptCode::INT, gc->visibleG1); - break; - case 12: - push_val (st->stack, ScriptCode::INT, gc->visibleG2); - break; - case 13: - push_val (st->stack, ScriptCode::INT, gc->visibleG3); - break; - case 14: - push_val (st->stack, ScriptCode::INT, gc->visibleG4); - break; - case 15: - push_val (st->stack, ScriptCode::INT, gc->visibleG5); - break; - case 16: - push_val (st->stack, ScriptCode::INT, gc->visibleG6); - break; - case 17: - push_val (st->stack, ScriptCode::INT, gc->visibleG7); - break; - case 18: - push_val (st->stack, ScriptCode::INT, gc->Ghp0); - break; - case 19: - push_val (st->stack, ScriptCode::INT, gc->Ghp1); - break; - case 20: - push_val (st->stack, ScriptCode::INT, gc->Ghp2); - break; - case 21: - push_val (st->stack, ScriptCode::INT, gc->Ghp3); - break; - case 22: - push_val (st->stack, ScriptCode::INT, gc->Ghp4); - break; - case 23: - push_val (st->stack, ScriptCode::INT, gc->Ghp5); - break; - case 24: - push_val (st->stack, ScriptCode::INT, gc->Ghp6); - break; - case 25: - push_val (st->stack, ScriptCode::INT, gc->Ghp7); - break; - default: - push_val (st->stack, ScriptCode::INT, 0); - break; - } - return; - } - } - } - push_val (st->stack, ScriptCode::INT, 0); -} - -void builtin_setcastledata (ScriptState *st) -{ - const char *mapname = conv_str (st, &(st->stack->stack_data[st->start + 2])); - int index = conv_num (st, &(st->stack->stack_data[st->start + 3])); - int value = conv_num (st, &(st->stack->stack_data[st->start + 4])); - struct guild_castle *gc; - int i; - - for (i = 0; i < MAX_GUILDCASTLE; i++) - { - if ((gc = guild_castle_search (i)) != NULL) - { - if (strcmp (mapname, gc->map_name) == 0) - { - // Save Data byself First - switch (index) - { - case 1: - gc->guild_id = value; - break; - case 2: - gc->economy = value; - break; - case 3: - gc->defense = value; - break; - case 4: - gc->triggerE = value; - break; - case 5: - gc->triggerD = value; - break; - case 6: - gc->nextTime = value; - break; - case 7: - gc->payTime = value; - break; - case 8: - gc->createTime = value; - break; - case 9: - gc->visibleC = value; - break; - case 10: - gc->visibleG0 = value; - break; - case 11: - gc->visibleG1 = value; - break; - case 12: - gc->visibleG2 = value; - break; - case 13: - gc->visibleG3 = value; - break; - case 14: - gc->visibleG4 = value; - break; - case 15: - gc->visibleG5 = value; - break; - case 16: - gc->visibleG6 = value; - break; - case 17: - gc->visibleG7 = value; - break; - case 18: - gc->Ghp0 = value; - break; - case 19: - gc->Ghp1 = value; - break; - case 20: - gc->Ghp2 = value; - break; - case 21: - gc->Ghp3 = value; - break; - case 22: - gc->Ghp4 = value; - break; - case 23: - gc->Ghp5 = value; - break; - case 24: - gc->Ghp6 = value; - break; - case 25: - gc->Ghp7 = value; - break; - default: - return; - } - guild_castledatasave (gc->castle_id, index, value); - return; - } - } - } -} - -/* ===================================================================== - * ギルド情報を要求する - * --------------------------------------------------------------------- - */ -void builtin_requestguildinfo (ScriptState *st) -{ - int guild_id = conv_num (st, &(st->stack->stack_data[st->start + 2])); - const char *event = NULL; - - if (st->end > st->start + 3) - event = conv_str (st, &(st->stack->stack_data[st->start + 3])); - - if (guild_id > 0) - guild_npc_request_info (guild_id, event); -} - /* ===================================================================== * カードの数を得る * --------------------------------------------------------------------- @@ -6061,61 +5483,6 @@ void builtin_strmobinfo (ScriptState *st) } /*========================================== - * Summon guardians [Valaris] - *------------------------------------------ - */ -void builtin_guardian (ScriptState *st) -{ - int mob_class = 0, amount = 1, x = 0, y = 0, guardian = 0; - const char *event = ""; - - const char *mapname = conv_str (st, &(st->stack->stack_data[st->start + 2])); - x = conv_num (st, &(st->stack->stack_data[st->start + 3])); - y = conv_num (st, &(st->stack->stack_data[st->start + 4])); - const char *str = conv_str (st, &(st->stack->stack_data[st->start + 5])); - mob_class = conv_num (st, &(st->stack->stack_data[st->start + 6])); - amount = conv_num (st, &(st->stack->stack_data[st->start + 7])); - event = conv_str (st, &(st->stack->stack_data[st->start + 8])); - if (st->end > st->start + 9) - guardian = conv_num (st, &(st->stack->stack_data[st->start + 9])); - - mob_spawn_guardian (map_id2sd (st->rid), mapname, x, y, str, mob_class, amount, - event, guardian); - -} - -/*================================================ - * Script for Displaying Guardian Info [Valaris] - *------------------------------------------------ - */ -void builtin_guardianinfo (ScriptState *st) -{ - int guardian = conv_num (st, &(st->stack->stack_data[st->start + 2])); - struct map_session_data *sd = script_rid2sd (st); - struct guild_castle *gc = guild_mapname2gc (map[sd->bl.m].name); - - if (guardian == 0 && gc->visibleG0 == 1) - push_val (st->stack, ScriptCode::INT, gc->Ghp0); - if (guardian == 1 && gc->visibleG1 == 1) - push_val (st->stack, ScriptCode::INT, gc->Ghp1); - if (guardian == 2 && gc->visibleG2 == 1) - push_val (st->stack, ScriptCode::INT, gc->Ghp2); - if (guardian == 3 && gc->visibleG3 == 1) - push_val (st->stack, ScriptCode::INT, gc->Ghp3); - if (guardian == 4 && gc->visibleG4 == 1) - push_val (st->stack, ScriptCode::INT, gc->Ghp4); - if (guardian == 5 && gc->visibleG5 == 1) - push_val (st->stack, ScriptCode::INT, gc->Ghp5); - if (guardian == 6 && gc->visibleG6 == 1) - push_val (st->stack, ScriptCode::INT, gc->Ghp6); - if (guardian == 7 && gc->visibleG7 == 1) - push_val (st->stack, ScriptCode::INT, gc->Ghp7); - else - push_val (st->stack, ScriptCode::INT, -1); - -} - -/*========================================== * IDからItem名 *------------------------------------------ */ diff --git a/src/map/skill.cpp b/src/map/skill.cpp index b1b8627..cc4f709 100644 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -1720,9 +1720,6 @@ int skill_attack (int attack_type, struct block_list *src, return 0; if (dsrc->type == BL_PC && ((struct map_session_data *) dsrc)->chatID) //術者がPCでチャット中なら何もしない return 0; - if (src->type == BL_PC && bl - && mob_gvmobcheck (((struct map_session_data *) src), bl) == 0) - return 0; //何もしない判定ここまで @@ -1937,7 +1934,7 @@ int skill_attack (int attack_type, struct block_list *src, (lv != 0) ? lv : skilllv, (skillid == 0) ? 5 : type); } - if (dmg.blewcount > 0 && !map[src->m].flag.gvg) + if (dmg.blewcount > 0) { /* 吹き飛ばし処理とそのパケット */ if (skillid == WZ_SIGHTRASHER) skill_blown (src, bl, dmg.blewcount); @@ -1954,7 +1951,7 @@ int skill_attack (int attack_type, struct block_list *src, if (skillid != KN_BOWLINGBASH || flag) battle_damage (src, bl, damage, 0); if (skillid == RG_INTIMIDATE && damage > 0 - && !(battle_get_mode (bl) & 0x20) && !map[src->m].flag.gvg) + && !(battle_get_mode (bl) & 0x20)) { int s_lv = battle_get_lv (src), t_lv = battle_get_lv (bl); int rate = 50 + skilllv * 5; @@ -2828,8 +2825,6 @@ int skill_castend_damage_id (struct block_list *src, struct block_list *bl, { int i, c; /* 他人から聞いた動きなので間違ってる可能性大&効率が悪いっす>< */ c = skill_get_blewcount (skillid, skilllv); - if (map[bl->m].flag.gvg) - c = 0; for (i = 0; i < c; i++) { skill_blown (src, bl, 1); @@ -3660,8 +3655,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, if (dstmd && dstmd->skilltimer != -1 && dstmd->state.skillcastcancel) // 詠唱妨害 skill_castcancel (bl, 0); if (dstsd && dstsd->skilltimer != -1 - && (!dstsd->special_state.no_castcancel - || map[bl->m].flag.gvg) && dstsd->state.skillcastcancel + && !dstsd->special_state.no_castcancel + && dstsd->state.skillcastcancel && !dstsd->special_state.no_castcancel2) skill_castcancel (bl, 0); @@ -3696,9 +3691,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, if ((dstsd->bl.type != BL_PC) // 相手はPCじゃないとだめ || (sd->bl.id == dstsd->bl.id) // 相手が自分はだめ || (lv > 10) // レベル差±10まで - || (!sd->status.party_id && !sd->status.guild_id) // PTにもギルドにも所属無しはだめ - || ((sd->status.party_id != dstsd->status.party_id) // 同じパーティーか、 - || (sd->status.guild_id != dstsd->status.guild_id)) // 同じギルドじゃないとだめ + || (!sd->status.party_id) // PTにもギルドにも所属無しはだめ + || (sd->status.party_id != dstsd->status.party_id) // 同じパーティーか、 + // 同じギルドじゃないとだめ || (dstsd->status.pc_class == 14 || dstsd->status.pc_class == 21 || dstsd->status.pc_class == 4015 || dstsd->status.pc_class == 4022)) @@ -3760,8 +3755,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, int i = 0; if (sd && dstsd) { - if (sd == dstsd || map[sd->bl.m].flag.pvp - || map[sd->bl.m].flag.gvg) + if (sd == dstsd || map[sd->bl.m].flag.pvp) { if (dstsd->spiritball > 0) { @@ -4940,10 +4934,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, struct item item_tmp; if ((bl->type == BL_SKILL) && (su = (struct skill_unit *) bl) && - (su->group->src_id == src->id || map[bl->m].flag.pvp - || map[bl->m].flag.gvg) && (su->group->unit_id >= 0x8f - && su->group->unit_id <= - 0x99) + (su->group->src_id == src->id || map[bl->m].flag.pvp) + && (su->group->unit_id >= 0x8f + && su->group->unit_id <= 0x99) && (su->group->unit_id != 0x92)) { //罠を取り返す if (sd) @@ -5072,8 +5065,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, if (dstmd && dstmd->skilltimer != -1 && dstmd->state.skillcastcancel) // 詠唱妨害 skill_castcancel (bl, 0); if (dstsd && dstsd->skilltimer != -1 - && (!dstsd->special_state.no_castcancel - || map[bl->m].flag.gvg) && dstsd->state.skillcastcancel + && !dstsd->special_state.no_castcancel + && dstsd->state.skillcastcancel && !dstsd->special_state.no_castcancel2) skill_castcancel (bl, 0); @@ -5104,8 +5097,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, struct skill_unit *su = NULL; if ((bl->type == BL_SKILL) && (su = (struct skill_unit *) bl) && - (su->group->src_id == src->id || map[bl->m].flag.pvp - || map[bl->m].flag.gvg) && (su->group->unit_id == 0xb0)) + (su->group->src_id == src->id || map[bl->m].flag.pvp) + && (su->group->unit_id == 0xb0)) { //罠を取り返す if (sd) skill_delunit (su); @@ -5208,9 +5201,6 @@ void skill_castend_id (timer_id tid, tick_t tick, custom_id_t id, custom_data_t int fail_flag = 1; if (inf2 & 0x400 && battle_check_target (&sd->bl, bl, BCT_PARTY) > 0) fail_flag = 0; - if (inf2 & 0x800 && sd->status.guild_id > 0 - && sd->status.guild_id == battle_get_guild_id (bl)) - fail_flag = 0; if (fail_flag) { clif_skill_fail (sd, sd->skillid, 0, 0); @@ -6398,8 +6388,6 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, case 0x90: /* スキッドトラップ */ { int i, c = skill_get_blewcount (sg->skill_id, sg->skill_lv); - if (map[bl->m].flag.gvg) - c = 0; for (i = 0; i < c; i++) skill_blown (&src->bl, bl, 1 | 0x30000); sg->unit_id = 0x8c; @@ -7982,22 +7970,6 @@ int skill_use_id (struct map_session_data *sd, int target_id, && skill_num != RG_RAID) return 0; - if (map[sd->bl.m].flag.gvg) - { //GvGで使用できないスキル - switch (skill_num) - { - case SM_ENDURE: - case AL_TELEPORT: - case AL_WARP: - case WZ_ICEWALL: - case TF_BACKSLIDING: - case LK_BERSERK: - case HP_BASILICA: - case ST_CHASEWALK: - return 0; - } - } - /* 演奏/ダンス中 */ if (sc_data && sc_data[SC_DANCING].timer != -1) { @@ -8304,12 +8276,6 @@ int skill_use_pos (struct map_session_data *sd, if (sd->status.option & 2) return 0; - if (map[sd->bl.m].flag.gvg - && (skill_num == SM_ENDURE || skill_num == AL_TELEPORT - || skill_num == AL_WARP || skill_num == WZ_ICEWALL - || skill_num == TF_BACKSLIDING)) - return 0; - sd->skillid = skill_num; sd->skilllv = skill_lv; sd->skillx = skill_x; @@ -11109,7 +11075,6 @@ struct skill_unit_group *skill_initunitgroup (struct block_list *src, group->src_id = src->id; group->party_id = battle_get_party_id (src); - group->guild_id = battle_get_guild_id (src); group->group_id = skill_unit_group_newid++; if (skill_unit_group_newid <= 0) skill_unit_group_newid = 10; diff --git a/src/map/storage.cpp b/src/map/storage.cpp index 7d54343..2d45c69 100644 --- a/src/map/storage.cpp +++ b/src/map/storage.cpp @@ -14,12 +14,10 @@ #include "clif.hpp" #include "intif.hpp" #include "pc.hpp" -#include "guild.hpp" #include "battle.hpp" #include "atcommand.hpp" static struct dbt *storage_db; -static struct dbt *guild_storage_db; /*========================================== * 倉庫内アイテムソート @@ -39,12 +37,6 @@ int storage_comp_item (const void *_i1, const void *_i2) return i1->nameid - i2->nameid; } -static void guild_storage_db_final (db_key_t key, db_val_t data, va_list ap) -{ - struct guild_storage *gstor = (struct guild_storage *) data; - free (gstor); -} - static void storage_db_final (db_key_t key, db_val_t data, va_list ap) { struct storage *stor = (struct storage *) data; @@ -58,13 +50,6 @@ void sortage_sortitem (struct storage *stor) storage_comp_item); } -void sortage_gsortitem (struct guild_storage *gstor) -{ - nullpo_retv (gstor); - qsort (gstor->storage_, MAX_GUILD_STORAGE, sizeof (struct item), - storage_comp_item); -} - /*========================================== * 初期化とか *------------------------------------------ @@ -72,7 +57,6 @@ void sortage_gsortitem (struct guild_storage *gstor) int do_init_storage (void) // map.c::do_init()から呼ばれる { storage_db = numdb_init (); - guild_storage_db = numdb_init (); return 1; } @@ -80,32 +64,20 @@ void do_final_storage (void) // by [MC Cameri] { if (storage_db) numdb_final (storage_db, storage_db_final); - if (guild_storage_db) - numdb_final (guild_storage_db, guild_storage_db_final); } static void storage_reconnect_sub (db_key_t key, db_val_t data, va_list ap) -{ //Parses storage and saves 'dirty' ones upon reconnect. [Skotlex] - int type = va_arg (ap, int); - if (type) - { //Guild Storage - struct guild_storage *stor = (struct guild_storage *) data; - if (stor->dirty && stor->storage_status == 0) //Save closed storages. - storage_guild_storagesave (0, stor->guild_id, 0); - } - else - { //Account Storage - struct storage *stor = (struct storage *) data; - if (stor->dirty && stor->storage_status == 0) //Save closed storages. - storage_storage_save (stor->account_id, stor->dirty == 2 ? 1 : 0); - } +{ + //Parses storage and saves 'dirty' ones upon reconnect. [Skotlex] + struct storage *stor = (struct storage *) data; + if (stor->dirty && stor->storage_status == 0) //Save closed storages. + storage_storage_save (stor->account_id, stor->dirty == 2 ? 1 : 0); } //Function to be invoked upon server reconnection to char. To save all 'dirty' storages [Skotlex void do_reconnect_storage (void) { - numdb_foreach (storage_db, storage_reconnect_sub, 0); - numdb_foreach (guild_storage_db, storage_reconnect_sub, 1); + numdb_foreach (storage_db, storage_reconnect_sub); } struct storage *account2storage (int account_id) @@ -148,7 +120,7 @@ int storage_storageopen (struct map_session_data *sd) struct storage *stor; nullpo_retr (0, sd); - if (sd->state.storage_flag) + if (sd->state.storage_open) return 1; //Already open? if ((stor = @@ -163,7 +135,7 @@ int storage_storageopen (struct map_session_data *sd) return 1; //Already open/player already has it open... stor->storage_status = 1; - sd->state.storage_flag = 1; + sd->state.storage_open = 1; clif_storageitemlist (sd, stor); clif_storageequiplist (sd, stor); clif_updatestorageamount (sd, stor); @@ -382,7 +354,7 @@ int storage_storageclose (struct map_session_data *sd) storage_storage_save (sd->status.account_id, 0); } stor->storage_status = 0; - sd->state.storage_flag = 0; + sd->state.storage_open = 0; if (sd->npc_flags.storage) { @@ -408,7 +380,7 @@ int storage_storage_quit (struct map_session_data *sd) { chrif_save (sd); //Invokes the storage saving as well. stor->storage_status = 0; - sd->state.storage_flag = 0; + sd->state.storage_open = 0; } return 0; @@ -466,323 +438,4 @@ int storage_storage_saved (int account_id) return 1; } return 0; -} - -struct guild_storage *guild2storage (int guild_id) -{ - struct guild_storage *gs = NULL; - if (guild_search (guild_id) != NULL) - { - gs = (struct guild_storage *) numdb_search (guild_storage_db, - guild_id); - if (gs == NULL) - { - CREATE (gs, struct guild_storage, 1); - gs->guild_id = guild_id; - numdb_insert (guild_storage_db, gs->guild_id, gs); - } - } - return gs; -} - -static -struct guild_storage *guild2storage2 (int guild_id) -{ //For just locating a storage without creating one. [Skotlex] - return (struct guild_storage *) numdb_search (guild_storage_db, guild_id); -} - -int guild_storage_delete (int guild_id) -{ - struct guild_storage *gstor = - (struct guild_storage *) numdb_search (guild_storage_db, guild_id); - if (gstor) - { - numdb_erase (guild_storage_db, guild_id); - free (gstor); - } - return 0; -} - -int storage_guild_storageopen (struct map_session_data *sd) -{ - struct guild_storage *gstor; - - nullpo_retr (0, sd); - - if (sd->status.guild_id <= 0) - return 2; - - if (sd->state.storage_flag) - return 1; //Can't open both storages at a time. - - if ((gstor = guild2storage2 (sd->status.guild_id)) == NULL) - { - intif_request_guild_storage (sd->status.account_id, - sd->status.guild_id); - return 0; - } - if (gstor->storage_status) - return 1; - - gstor->storage_status = 1; - sd->state.storage_flag = 2; - clif_guildstorageitemlist (sd, gstor); - clif_guildstorageequiplist (sd, gstor); - clif_updateguildstorageamount (sd, gstor); - return 0; -} - -int guild_storage_additem (struct map_session_data *sd, - struct guild_storage *stor, struct item *item_data, - int amount) -{ - struct item_data *data; - int i; - - nullpo_retr (1, sd); - nullpo_retr (1, stor); - nullpo_retr (1, item_data); - nullpo_retr (1, data = itemdb_search (item_data->nameid)); - - if (item_data->nameid <= 0 || amount <= 0) - return 1; - - if (!itemdb_isequip2 (data)) - { //Stackable - for (i = 0; i < MAX_GUILD_STORAGE; i++) - { - if (compare_item (&stor->storage_[i], item_data)) - { - if (stor->storage_[i].amount + amount > MAX_AMOUNT) - return 1; - stor->storage_[i].amount += amount; - clif_guildstorageitemadded (sd, stor, i, amount); - stor->dirty = 1; - return 0; - } - } - } - //Add item - for (i = 0; i < MAX_GUILD_STORAGE && stor->storage_[i].nameid; i++); - - if (i >= MAX_GUILD_STORAGE) - return 1; - - memcpy (&stor->storage_[i], item_data, sizeof (stor->storage_[0])); - stor->storage_[i].amount = amount; - stor->storage_amount++; - clif_guildstorageitemadded (sd, stor, i, amount); - clif_updateguildstorageamount (sd, stor); - stor->dirty = 1; - return 0; -} - -int guild_storage_delitem (struct map_session_data *sd, - struct guild_storage *stor, int n, int amount) -{ - nullpo_retr (1, sd); - nullpo_retr (1, stor); - - if (stor->storage_[n].nameid == 0 || stor->storage_[n].amount < amount) - return 1; - - stor->storage_[n].amount -= amount; - if (stor->storage_[n].amount == 0) - { - memset (&stor->storage_[n], 0, sizeof (stor->storage_[0])); - stor->storage_amount--; - clif_updateguildstorageamount (sd, stor); - } - clif_storageitemremoved (sd, n, amount); - stor->dirty = 1; - return 0; -} - -int storage_guild_storageadd (struct map_session_data *sd, int index, - int amount) -{ - struct guild_storage *stor; - - nullpo_retr (0, sd); - nullpo_retr (0, stor = guild2storage2 (sd->status.guild_id)); - - if (!stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE) - return 0; - - if (index < 0 || index >= MAX_INVENTORY) - return 0; - - if (sd->status.inventory[index].nameid <= 0) - return 0; - - if (amount < 1 || amount > sd->status.inventory[index].amount) - return 0; - -// log_tostorage(sd, index, 1); - if (guild_storage_additem (sd, stor, &sd->status.inventory[index], amount) - == 0) - pc_delitem (sd, index, amount, 0); - - return 1; -} - -int storage_guild_storageget (struct map_session_data *sd, int index, - int amount) -{ - struct guild_storage *stor; - int flag; - - nullpo_retr (0, sd); - nullpo_retr (0, stor = guild2storage2 (sd->status.guild_id)); - - if (!stor->storage_status) - return 0; - - if (index < 0 || index >= MAX_GUILD_STORAGE) - return 0; - - if (stor->storage_[index].nameid <= 0) - return 0; - - if (amount < 1 || amount > stor->storage_[index].amount) - return 0; - - if ((flag = pc_additem (sd, &stor->storage_[index], amount)) == 0) - guild_storage_delitem (sd, stor, index, amount); - else - clif_additem (sd, 0, 0, flag); -// log_fromstorage(sd, index, 1); - - return 0; -} - -int storage_guild_storageaddfromcart (struct map_session_data *sd, int index, - int amount) -{ - struct guild_storage *stor; - - nullpo_retr (0, sd); - nullpo_retr (0, stor = guild2storage2 (sd->status.guild_id)); - - if (!stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE) - return 0; - - if (index < 0 || index >= MAX_CART) - return 0; - - if (sd->status.cart[index].nameid <= 0) - return 0; - - if (amount < 1 || amount > sd->status.cart[index].amount) - return 0; - - if (guild_storage_additem (sd, stor, &sd->status.cart[index], amount) == - 0) - pc_cart_delitem (sd, index, amount, 0); - - return 1; -} - -int storage_guild_storagegettocart (struct map_session_data *sd, int index, - int amount) -{ - struct guild_storage *stor; - - nullpo_retr (0, sd); - nullpo_retr (0, stor = guild2storage2 (sd->status.guild_id)); - - if (!stor->storage_status) - return 0; - - if (index < 0 || index >= MAX_GUILD_STORAGE) - return 0; - - if (stor->storage_[index].nameid <= 0) - return 0; - - if (amount < 1 || amount > stor->storage_[index].amount) - return 0; - - if (pc_cart_additem (sd, &stor->storage_[index], amount) == 0) - guild_storage_delitem (sd, stor, index, amount); - - return 1; -} - -int storage_guild_storagesave (int account_id, int guild_id, int flag) -{ - struct guild_storage *stor = guild2storage2 (guild_id); - - if (stor) - { - if (flag) //Char quitting, close it. - stor->storage_status = 0; - if (stor->dirty) - intif_send_guild_storage (account_id, stor); - return 1; - } - return 0; -} - -int storage_guild_storagesaved (int guild_id) -{ - struct guild_storage *stor; - - if ((stor = guild2storage2 (guild_id)) != NULL) - { - if (stor->dirty && stor->storage_status == 0) - { //Storage has been correctly saved. - stor->dirty = 0; - sortage_gsortitem (stor); - } - return 1; - } - return 0; -} - -int storage_guild_storageclose (struct map_session_data *sd) -{ - struct guild_storage *stor; - - nullpo_retr (0, sd); - nullpo_retr (0, stor = guild2storage2 (sd->status.guild_id)); - - clif_storageclose (sd); - chrif_save (sd); //This one also saves the storage. [Skotlex] - - stor->storage_status = 0; - sd->state.storage_flag = 0; - - return 0; -} - -int storage_guild_storage_quit (struct map_session_data *sd, int flag) -{ - struct guild_storage *stor; - - nullpo_retr (0, sd); - nullpo_retr (0, stor = guild2storage2 (sd->status.guild_id)); - - if (flag) - { //Only during a guild break flag is 1 (don't save storage) - sd->state.storage_flag = 0; - stor->storage_status = 0; - clif_storageclose (sd); - if (save_settings & 4) - chrif_save (sd); - return 0; - } - - if (stor->storage_status) - { - if (save_settings & 4) - chrif_save (sd); - else - storage_guild_storagesave (sd->status.account_id, - sd->status.guild_id, 1); - } - sd->state.storage_flag = 0; - stor->storage_status = 0; - - return 0; -} +}
\ No newline at end of file diff --git a/src/map/storage.hpp b/src/map/storage.hpp index 22625df..29702a6 100644 --- a/src/map/storage.hpp +++ b/src/map/storage.hpp @@ -22,33 +22,11 @@ struct storage *account2storage2 (int account_id); int storage_delete (int account_id); int storage_storage_quit (struct map_session_data *sd); int storage_storage_save (int account_id, int final); -int storage_storage_saved (int account_id); //Ack from char server that guild store was saved. +int storage_storage_saved (int account_id); void storage_storage_dirty (struct map_session_data *sd); -struct guild_storage *guild2storage (int guild_id); -int guild_storage_delete (int guild_id); -int storage_guild_storageopen (struct map_session_data *sd); -int guild_storage_additem (struct map_session_data *sd, - struct guild_storage *stor, - struct item *item_data, int amount); -int guild_storage_delitem (struct map_session_data *sd, - struct guild_storage *stor, int n, int amount); -int storage_guild_storageadd (struct map_session_data *sd, int index, - int amount); -int storage_guild_storageget (struct map_session_data *sd, int index, - int amount); -int storage_guild_storageaddfromcart (struct map_session_data *sd, int index, - int amount); -int storage_guild_storagegettocart (struct map_session_data *sd, int index, - int amount); -int storage_guild_storageclose (struct map_session_data *sd); -int storage_guild_storage_quit (struct map_session_data *sd, int flag); -int storage_guild_storagesave (int account_id, int guild_id, int flag); -int storage_guild_storagesaved (int guild_id); //Ack from char server that guild store was saved. - int storage_comp_item (const void *_i1, const void *_i2); //int storage_comp_item(const struct item* i1, const struct item* i2); void sortage_sortitem (struct storage *stor); -void sortage_gsortitem (struct guild_storage *gstor); #endif diff --git a/src/map/tmw.cpp b/src/map/tmw.cpp index 4b1831b..8c4f7fe 100644 --- a/src/map/tmw.cpp +++ b/src/map/tmw.cpp @@ -16,7 +16,6 @@ #include "chat.hpp" #include "chrif.hpp" #include "clif.hpp" -#include "guild.hpp" #include "intif.hpp" #include "itemdb.hpp" #include "magic.hpp" diff --git a/src/map/trade.cpp b/src/map/trade.cpp index 147db1b..4d5a9cd 100644 --- a/src/map/trade.cpp +++ b/src/map/trade.cpp @@ -25,7 +25,7 @@ void trade_traderequest (struct map_session_data *sd, int target_id) { if (!battle_config.invite_request_check) { - if (target_sd->guild_invite > 0 || target_sd->party_invite > 0) + if (target_sd->party_invite > 0) { clif_tradestart (sd, 2); // 相手はPT要請中かGuild要請中 return; @@ -91,10 +91,8 @@ void trade_tradeack (struct map_session_data *sd, int type) npc_event_dequeue (target_sd); //close STORAGE window if it's open. It protects from spooffing packets [Lupus] - if (sd->state.storage_flag == 1) + if (sd->state.storage_open) storage_storageclose (sd); - else if (sd->state.storage_flag == 2) - storage_guild_storageclose (sd); } } |