Jump to content
  • 0

Guild Castle Count


cahadeyelo

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

how can i check the total castle count of a guild through codes?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

You can use getcastledata command:

*getcastledata("<map name>",<type of data>)
*setcastledata "<map name>",<type of data>,<value>;

This function returns the castle ownership information for the castle referred 
to by its map name. Castle information is stored in `guild_castle` SQL table.

Types of data correspond to `guild_castle` table columns:

 1 - `guild_id`   - Guild ID.
 2 - `economy`    - Castle Economy score.
 3 - `defense`    - Castle Defense score.
 4 - `triggerE`   - Number of times the economy was invested in today.
 5 - `triggerD`   - Number of times the defense was invested in today.
 6 - `nextTime`   - unused
 7 - `payTime`    - unused
 8 - `createTime` - unused
 9 - `visibleC`   - Is 1 if a Kafra was hired for this castle, 0 otherwise.
10 - `visibleG0`  - Is 1 if the 1st guardian is present (Soldier Guardian)
11 - `visibleG1`  - Is 1 if the 2nd guardian is present (Soldier Guardian)
12 - `visibleG2`  - Is 1 if the 3rd guardian is present (Soldier Guardian)
13 - `visibleG3`  - Is 1 if the 4th guardian is present (Archer Guardian)
14 - `visibleG4`  - Is 1 if the 5th guardian is present (Archer Guardian)
15 - `visibleG5`  - Is 1 if the 6th guardian is present (Knight Guardian)
16 - `visibleG6`  - Is 1 if the 7th guardian is present (Knight Guardian)
17 - `visibleG7`  - Is 1 if the 8th guardian is present (Knight Guardian)

All types of data have their meaning determined by War of Emperium scripts, 
with exception of:
 - `guild_id` that is always considered ID of the guild that owns the castle,
 - `defense` that is used in Guardians & Emperium HP calculations,
 - `visibleG` that is always considered to hold guardian presence bits.

The 'setcastledata' command will behave identically, but instead of returning 
values for the specified types of accessible data, it will alter them and cause 
them to be sent to the char-server for storage.

Changing Guild ID or Castle Defense will trigger additional actions, like 
recalculating guardians' HP.

In a Script, set an array with the list of all castles and make a loop checking the ID of the castle owner match the desired Guild check.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

can you give a simple example of this coz i can't find the rathena wiki on the net

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

The Wiki can be found on the upper menu, under Docs > Wiki.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  170
  • Reputation:   1
  • Joined:  11/13/14
  • Last Seen:  

here's the codes that i'm making right now

 

	if( strcharinfo(0) == getguildmaster( getcastledata( .Map$,1 ) ) ){
	getitem 7146,1;

i just want to give the guild leader of kriemhild the item 7146 x the total castles they owned...

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

	mes "Enter Guild Name";
	input .@name$;
	query_sql( "SELECT `guild_id` FROM `guild` WHERE `name` LIKE '"+escape_sql( .@name$ )+"' LIMIT 1",.@gid );
	if ( .@gid ) {
		query_sql( "SELECT COUNT(`castle_id`) FROM `guild_castle` WHERE `guild_id` = "+.@gid, .@total_castle );
		mes "Guild: "+.@name$;
		mes "Owned "+.@total_castle+" Castle(s)";
	}
	else {
		mes "Guild '"+.@name$+"' not found.";
	}
	close;

you can try this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...