diff --git a/conf/inter_athena.conf b/conf/inter_athena.conf index 5938f2e20e..e10fd3f961 100644 --- a/conf/inter_athena.conf +++ b/conf/inter_athena.conf @@ -149,6 +149,7 @@ vending_table: vendings vending_items_table: vending_items market_table: market roulette_table: db_roulette +guild_storage_log: guild_storage_log // Use SQL item_db, mob_db and mob_skill_db for the map server? (yes/no) use_sql_db: no diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 28e8e4fad7..00ca704dc4 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -5502,6 +5502,32 @@ Return values: --------------------------------------- +*guildopenstorage_log({}) + +Opens the guild storage log window for the attached character or the given character id. + +Possible return values: +GUILDSTORAGE_LOG_FINAL_SUCCESS Window was opened successfully. +GUILDSTORAGE_LOG_EMPTY Window was not opened, because no entries exist. +GUILDSTORAGE_LOG_FAILED Some database error occurred. + +--------------------------------------- + +*guild_has_permission({,}) + +Checks if the attached player or the player with the given character id has the given permission(s). +Permission can be a bitmask and allows to use multiple values at the same time. +Returns true if the player has all of the given permissions or false if the player does at least +miss one of the given permissions or is not in a guild at all. + +Available permissions are: +GUILD_PERM_INVITE If a player is allowed to invite other players. +GUILD_PERM_EXPEL If a player is allowed to expel other guild members. +GUILD_PERM_STORAGE If a player is allowed to access the guild storage. +GUILD_PERM_ALL A combination of all permissions above. + +--------------------------------------- + *guildchangegm(,) This function will change the Guild Master of a guild. The ID is the guild's diff --git a/npc/re/merchants/guild_warehouse.txt b/npc/re/merchants/guild_warehouse.txt new file mode 100644 index 0000000000..69cd24babc --- /dev/null +++ b/npc/re/merchants/guild_warehouse.txt @@ -0,0 +1,111 @@ +//===== rAthena Script ======================================= +//= Guild Warehouse Manager +//===== Description: ========================================= +//= [Walkthrough Conversion] +//= Gives players access to their guild storage and log. +//===== Changelogs: ========================================== +//= 1.0 First Version. [Lemongrass] +//============================================================ + +- script GuildWarehouse -1,{ + mes "[Warehouse Manager]"; + mes "How are you? We are specialized in guild warehouses. This is our ^0000cdstory^000000:"; + mes "Why can't guild members share a storage? We started off with that simple question."; + next; + mes "[Warehouse Manager]"; + mes "You can open the warehouse for 1000 Zeny or look up the usage history of the guild."; + mes "How can I help you?"; + next; + if( select( "Open guild warehouse:View warehouse usage history" ) == 1 ){ + .@guildid = getcharid( 2 ); + + if( .@guildid == 0 ){ + mes "[Warehouse Manager]"; + mes "The guild storage is only available for guild members."; + close; + } + + if( getgdskilllv( .@guildid, "GD_GUILD_STORAGE" ) == 0 || !guild_has_permission( GUILD_PERM_STORAGE ) ){ + mes "[Warehouse Manager]"; + mes "It seems that it is not yet possible for your guild to use the guild warehouse or you do not have access permissions for the warehouse."; + mes "Please come back after checking the guild skill and the permission to access the warehouse."; + close; + } + + if( Zeny < 1000 ){ + mes "[Warehouse Manager]"; + mes "I am afraid you do not have enough money to settle the fee."; + mes "The fee is 1000 Zeny."; + close; + } + + mes "[Warehouse Manager]"; + mes "I will open the guild storage for you then. Have a memorable time!"; + close2; + + if( Zeny < 1000 ){ + // Cheat prevention + end; + } + + if( guildopenstorage() == GSTORAGE_OPEN ){ + Zeny -= 1000; + end; + }else{ + mes "[Warehouse Manager]"; + mes "I am afraid someone else is using the warehouse right now."; + mes "Please try again after a while."; + close; + } + }else{ + .@guildid = getcharid( 2 ); + + if( .@guildid == 0 ){ + mes "[Warehouse Manager]"; + mes "The guild storage is only available for guild members."; + close; + } + + if( getgdskilllv( .@guildid, "GD_GUILD_STORAGE" ) == 0 || !guild_has_permission( GUILD_PERM_STORAGE ) ){ + mes "[Warehouse Manager]"; + mes "It seems that it is not yet possible for your guild to use the guild warehouse or you do not have access permissions for the warehouse."; + mes "Please come back after checking the guild skill and the permission to access the warehouse."; + close; + } + + mes "[Warehouse Manager]"; + mes "I will show you the usage history of the warehouse. Usage history will be retained for up to 3 months."; + mes "Have a memorable time!"; + close2; + guildopenstorage_log(); + end; + } +} + +alberta,114,65,5 duplicate(GuildWarehouse) Guild Warehouse Manager#alberta 896 +aldebaran,146,122,3 duplicate(GuildWarehouse) Guild Warehouse Manager#aldebaran 896 +amatsu,100,156,5 duplicate(GuildWarehouse) Guild Warehouse Manager#amatsu 896 +ayothaya,203,173,3 duplicate(GuildWarehouse) Guild Warehouse Manager#ayothaya 896 +brasilis,204,227,3 duplicate(GuildWarehouse) Guild Warehouse Manager#brasilis 896 +comodo,204,153,3 duplicate(GuildWarehouse) Guild Warehouse Manager#comodo 896 +dewata,196,193,3 duplicate(GuildWarehouse) Guild Warehouse Manager#dewata 896 +einbech,182,124,3 duplicate(GuildWarehouse) Guild Warehouse Manager#einbech 896 +einbroch,238,203,3 duplicate(GuildWarehouse) Guild Warehouse Manager#einbroch 896 +geffen,128,68,3 duplicate(GuildWarehouse) Guild Warehouse Manager#geffen 896 +gonryun,164,127,5 duplicate(GuildWarehouse) Guild Warehouse Manager#gonryun 896 +harboro1,288,212,5 duplicate(GuildWarehouse) Guild Warehouse Manager#harboro1 896 +hugel,91,158,5 duplicate(GuildWarehouse) Guild Warehouse Manager#hugel 896 +izlude,133,149,3 duplicate(GuildWarehouse) Guild Warehouse Manager#izlude 896 +lighthalzen,162,102,3 duplicate(GuildWarehouse) Guild Warehouse Manager#lighthalzen 896 +louyang,210,111,5 duplicate(GuildWarehouse) Guild Warehouse Manager#louyang 896 +malaya,238,206,3 duplicate(GuildWarehouse) Guild Warehouse Manager#malaya 896 +morocc,168,107,3 duplicate(GuildWarehouse) Guild Warehouse Manager#morocc 896 +moscovia,211,200,5 duplicate(GuildWarehouse) Guild Warehouse Manager#moscovia 896 +niflheim,200,184,3 duplicate(GuildWarehouse) Guild Warehouse Manager#niflheim 896 +payon,180,106,3 duplicate(GuildWarehouse) Guild Warehouse Manager#payon 896 +prontera,150,191,3 duplicate(GuildWarehouse) Guild Warehouse Manager#prontera 896 +rachel,123,145,3 duplicate(GuildWarehouse) Guild Warehouse Manager#rachel 896 +umbala,106,160,3 duplicate(GuildWarehouse) Guild Warehouse Manager#umbala 896 +veins,205,130,3 duplicate(GuildWarehouse) Guild Warehouse Manager#veins 896 +xmas,155,140,5 duplicate(GuildWarehouse) Guild Warehouse Manager#xmas 896 +yuno,176,187,3 duplicate(GuildWarehouse) Guild Warehouse Manager#yuno 896 diff --git a/npc/re/scripts_athena.conf b/npc/re/scripts_athena.conf index 26de0871d5..b9759f5329 100644 --- a/npc/re/scripts_athena.conf +++ b/npc/re/scripts_athena.conf @@ -101,6 +101,7 @@ npc: npc/re/merchants/enchan_mora.txt npc: npc/re/merchants/enchan_rockridge.txt npc: npc/re/merchants/flute.txt npc: npc/re/merchants/gld_mission_exchange.txt +npc: npc/re/merchants/guild_warehouse.txt npc: npc/re/merchants/hd_refiner.txt npc: npc/re/merchants/HorrorToyFactory_merchants.txt npc: npc/re/merchants/inn.txt diff --git a/sql-files/main.sql b/sql-files/main.sql index 50f9bfbb17..58619424fa 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -580,6 +580,47 @@ CREATE TABLE IF NOT EXISTS `guild_storage` ( KEY `guild_id` (`guild_id`) ) ENGINE=MyISAM; +-- +-- Table structure for table `guild_storage_log` +-- + +CREATE TABLE IF NOT EXISTS `guild_storage_log` ( + `id` int(11) NOT NULL auto_increment, + `guild_id` int(11) unsigned NOT NULL default '0', + `time` datetime NOT NULL, + `char_id` int(11) NOT NULL default '0', + `name` varchar(24) NOT NULL default '', + `nameid` smallint(5) unsigned NOT NULL default '0', + `amount` int(11) NOT NULL default '1', + `identify` smallint(6) NOT NULL default '0', + `refine` tinyint(3) unsigned NOT NULL default '0', + `attribute` tinyint(4) unsigned NOT NULL default '0', + `card0` smallint(5) unsigned NOT NULL default '0', + `card1` smallint(5) unsigned NOT NULL default '0', + `card2` smallint(5) unsigned NOT NULL default '0', + `card3` smallint(5) unsigned NOT NULL default '0', + `option_id0` smallint(5) NOT NULL default '0', + `option_val0` smallint(5) NOT NULL default '0', + `option_parm0` tinyint(3) NOT NULL default '0', + `option_id1` smallint(5) NOT NULL default '0', + `option_val1` smallint(5) NOT NULL default '0', + `option_parm1` tinyint(3) NOT NULL default '0', + `option_id2` smallint(5) NOT NULL default '0', + `option_val2` smallint(5) NOT NULL default '0', + `option_parm2` tinyint(3) NOT NULL default '0', + `option_id3` smallint(5) NOT NULL default '0', + `option_val3` smallint(5) NOT NULL default '0', + `option_parm3` tinyint(3) NOT NULL default '0', + `option_id4` smallint(5) NOT NULL default '0', + `option_val4` smallint(5) NOT NULL default '0', + `option_parm4` tinyint(3) NOT NULL default '0', + `expire_time` int(11) unsigned NOT NULL default '0', + `unique_id` bigint(20) unsigned NOT NULL default '0', + `bound` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`id`), + INDEX (`guild_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; + -- -- Table structure for table `homunculus` -- diff --git a/sql-files/upgrades/upgrade_20181010.sql b/sql-files/upgrades/upgrade_20181010.sql new file mode 100644 index 0000000000..74f6e838a8 --- /dev/null +++ b/sql-files/upgrades/upgrade_20181010.sql @@ -0,0 +1,40 @@ +-- +-- Table structure for table `guild_storage_log` +-- + +CREATE TABLE IF NOT EXISTS `guild_storage_log` ( + `id` int(11) NOT NULL auto_increment, + `guild_id` int(11) unsigned NOT NULL default '0', + `time` datetime NOT NULL, + `char_id` int(11) NOT NULL default '0', + `name` varchar(24) NOT NULL default '', + `nameid` smallint(5) unsigned NOT NULL default '0', + `amount` int(11) NOT NULL default '1', + `identify` smallint(6) NOT NULL default '0', + `refine` tinyint(3) unsigned NOT NULL default '0', + `attribute` tinyint(4) unsigned NOT NULL default '0', + `card0` smallint(5) unsigned NOT NULL default '0', + `card1` smallint(5) unsigned NOT NULL default '0', + `card2` smallint(5) unsigned NOT NULL default '0', + `card3` smallint(5) unsigned NOT NULL default '0', + `option_id0` smallint(5) NOT NULL default '0', + `option_val0` smallint(5) NOT NULL default '0', + `option_parm0` tinyint(3) NOT NULL default '0', + `option_id1` smallint(5) NOT NULL default '0', + `option_val1` smallint(5) NOT NULL default '0', + `option_parm1` tinyint(3) NOT NULL default '0', + `option_id2` smallint(5) NOT NULL default '0', + `option_val2` smallint(5) NOT NULL default '0', + `option_parm2` tinyint(3) NOT NULL default '0', + `option_id3` smallint(5) NOT NULL default '0', + `option_val3` smallint(5) NOT NULL default '0', + `option_parm3` tinyint(3) NOT NULL default '0', + `option_id4` smallint(5) NOT NULL default '0', + `option_val4` smallint(5) NOT NULL default '0', + `option_parm4` tinyint(3) NOT NULL default '0', + `expire_time` int(11) unsigned NOT NULL default '0', + `unique_id` bigint(20) unsigned NOT NULL default '0', + `bound` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`id`), + INDEX (`guild_id`) +) ENGINE=MyISAM AUTO_INCREMENT=1; diff --git a/src/common/mmo.hpp b/src/common/mmo.hpp index 5af592b643..f0c25929bb 100644 --- a/src/common/mmo.hpp +++ b/src/common/mmo.hpp @@ -705,13 +705,12 @@ struct guild_castle { enum e_guild_permission { GUILD_PERM_INVITE = 0x001, GUILD_PERM_EXPEL = 0x010, -#if PACKETVER >= 20140205 GUILD_PERM_STORAGE = 0x100, +#if PACKETVER >= 20140205 GUILD_PERM_ALL = GUILD_PERM_INVITE|GUILD_PERM_EXPEL|GUILD_PERM_STORAGE, #else GUILD_PERM_ALL = GUILD_PERM_INVITE|GUILD_PERM_EXPEL, #endif - GUILD_PERM_MASK = GUILD_PERM_ALL, GUILD_PERM_DEFAULT = GUILD_PERM_ALL, }; diff --git a/src/map/clif.cpp b/src/map/clif.cpp index f19e047a5b..8c86741aeb 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -20501,6 +20501,53 @@ void clif_parse_private_airship_request( int fd, struct map_session_data* sd ){ #endif } +/// Sends out the usage history of the guild storage +/// 09DA .W .W .W { .L .W .L .B .L .Q .B .W +/// { .W }*4 .24B