Monument land radius.

Place for sharing your game modifications for Life is Feudal: Your Own

Bogu
 
Posts: 6
Joined: 17 Oct 2015, 09:12

Monument land radius.

Post by Bogu » 25 Nov 2015, 01:01

Hi, im trying to stop possibility of growing monument lands on my RP server, i would use that for claiming only the gates of the city.

I see that is easy to change radius in server database ,but is it possible atleast to make process of resizing all the monuments to radius 4 every restart? Or can i freeze somehow this growing?

Thanks in advance, sorry for grama.


Keoir
 
Posts: 13
Joined: 18 Dec 2015, 18:20

Re: Monument land radius.

Post by Keoir » 23 Dec 2015, 04:51

+1 This is something that I have been trying to figure out my self. Mainly to prevent our spawn city from decaying as we need a rather large radius for it.

- Keoir


Aircode
 
Posts: 16
Joined: 23 Mar 2015, 13:57

Re: Monument land radius.

Post by Aircode » 08 Feb 2016, 19:33

EDIT SQL Trigger is work now
With this tiny SQL modification you can limit the guild_lands Radius. The goal is to prevent single players or small guilds to own a to large land.

What is done now;
- create a helper table (auto) "CharCount" and count how many characters have the same GuildID
- set the guild_lands.Radius VALUE like your need
- prevent a claim Radius to grow up more then the Value you desired
- bind the radius on the existing GuildMembers
- you have an exeption for your wanted guild
- the Trigger now react on UPDATE of guild_lands works with charm.

What will be done next;
- count the Guild Members on update guild_lands. At the moment, the GuildMembers are count on Server startup only.


YOU NEED TO ADD THE FOLLOWING CODE AS DESCIBED BELOW!

-- 1. ADD BLOCK (1)
Code: Select all
-- BLOCK (1)
-- CREATE a procedure IN SQL!
-- TO USE THE PROCEDURE "AddColumnUnlessExists" you need to add it!
-- I FOUND THIS USEFULL SCRIPT ON http://www.cryer.co.uk/brian/mysql/howto_add_column_unless_exists.htm

-- Copyright (c) 2009 www.cryer.co.uk
-- Script is free to use provided this copyright header is included.
create procedure AddColumnUnlessExists(
   IN dbName tinytext,
   IN tableName tinytext,
   IN fieldName tinytext,
   IN fieldDef text)
begin
   IF NOT EXISTS (
      SELECT * FROM information_schema.COLUMNS
      WHERE column_name=fieldName
      and table_name=tableName
      and table_schema=dbName
      )
   THEN
      set @ddl=CONCAT('ALTER TABLE ',dbName,'.',tableName,
         ' ADD COLUMN ',fieldName,' ',fieldDef);
      prepare stmt from @ddl;
      execute stmt;
   END IF;
end;


-- 2. ADD BLOCK (2)
Code: Select all
-- BLOCK (2)
-- Query this in SQL!
-- THEN Copy this to patch.sql for inital handling!
-- Call The Procedure "AddColumnUnlessExists" to check if "CharCount" COLUMN exist and create IF NOT
call AddColumnUnlessExists(Database(), 'guild_lands', 'CharCount', 'smallint');
-- Count the "characters" with a GuildID and write it down to CharCount
UPDATE lif_1.guild_lands g SET CharCount = (SELECT COUNT(ID) FROM lif_1.`character` c WHERE c.GuildID = g.ID);


-- 3. ADD BLOCK (3)
Code: Select all
-- BLOCK (3)
-- CREATE a Trigger in SQL!
-- and always BEFORE UPDATE new Radius from server it will be reset (automatic) to your given values
CREATE
   DEFINER = 'root'@'localhost'
TRIGGER lif_1.Guild_Land_limiter
   BEFORE UPDATE
   ON lif_1.guild_lands
   FOR EACH ROW
BEGIN
  DECLARE CharCount smallint;
  DECLARE Radius smallint;
   IF new.CharCount<4 AND new.Radius>40 AND new.GuildID !=4 THEN SET new.Radius = 55;
END IF;END


new.CharCount = how many Members a Guild need to not be affected by this Trigger.

new.Radius = how big a claim can be before affected by this Trigger.

new.GuildID = makes an exception for a Guild (eg. your Admin Claim...)

SET new.Radius = the value you like to give to a claim.


Aircode
 
Posts: 16
Joined: 23 Mar 2015, 13:57

Re: Monument land radius.

Post by Aircode » 11 Feb 2016, 11:27

finally it`s done and working. I tested the code the past 2 days on my testserver. Monument upgrade and downgrade works from ingame mechanic and script.

Have fun...


Halvdal
 
Posts: 107
Joined: 20 Jan 2016, 13:36

Re: Monument land radius.

Post by Halvdal » 26 Apr 2016, 15:57

How can i change the support points for every tier 4 monument?

It would be great if i can set the supportpoints from 300.000 to 600.000.


SomeoneD
Zealous Believer
 
Posts: 14
Joined: 10 Jun 2016, 22:49

Re: Monument land radius.

Post by SomeoneD » 24 Oct 2016, 02:43

Aircode wrote:EDIT SQL Trigger is work now
With this tiny SQL modification you can limit the guild_lands Radius. The goal is to prevent single players or small guilds to own a to large land.

What is done now;
- create a helper table (auto) "CharCount" and count how many characters have the same GuildID
- set the guild_lands.Radius VALUE like your need
- prevent a claim Radius to grow up more then the Value you desired
- bind the radius on the existing GuildMembers
- you have an exeption for your wanted guild
- the Trigger now react on UPDATE of guild_lands works with charm.

What will be done next;
- count the Guild Members on update guild_lands. At the moment, the GuildMembers are count on Server startup only.


YOU NEED TO ADD THE FOLLOWING CODE AS DESCIBED BELOW!

-- 1. ADD BLOCK (1)
Code: Select all
-- BLOCK (1)
-- CREATE a procedure IN SQL!
-- TO USE THE PROCEDURE "AddColumnUnlessExists" you need to add it!
-- I FOUND THIS USEFULL SCRIPT ON http://www.cryer.co.uk/brian/mysql/howto_add_column_unless_exists.htm

-- Copyright (c) 2009 www.cryer.co.uk
-- Script is free to use provided this copyright header is included.
create procedure AddColumnUnlessExists(
   IN dbName tinytext,
   IN tableName tinytext,
   IN fieldName tinytext,
   IN fieldDef text)
begin
   IF NOT EXISTS (
      SELECT * FROM information_schema.COLUMNS
      WHERE column_name=fieldName
      and table_name=tableName
      and table_schema=dbName
      )
   THEN
      set @ddl=CONCAT('ALTER TABLE ',dbName,'.',tableName,
         ' ADD COLUMN ',fieldName,' ',fieldDef);
      prepare stmt from @ddl;
      execute stmt;
   END IF;
end;


-- 2. ADD BLOCK (2)
Code: Select all
-- BLOCK (2)
-- Query this in SQL!
-- THEN Copy this to patch.sql for inital handling!
-- Call The Procedure "AddColumnUnlessExists" to check if "CharCount" COLUMN exist and create IF NOT
call AddColumnUnlessExists(Database(), 'guild_lands', 'CharCount', 'smallint');
-- Count the "characters" with a GuildID and write it down to CharCount
UPDATE lif_1.guild_lands g SET CharCount = (SELECT COUNT(ID) FROM lif_1.`character` c WHERE c.GuildID = g.ID);


-- 3. ADD BLOCK (3)
Code: Select all
-- BLOCK (3)
-- CREATE a Trigger in SQL!
-- and always BEFORE UPDATE new Radius from server it will be reset (automatic) to your given values
CREATE
   DEFINER = 'root'@'localhost'
TRIGGER lif_1.Guild_Land_limiter
   BEFORE UPDATE
   ON lif_1.guild_lands
   FOR EACH ROW
BEGIN
  DECLARE CharCount smallint;
  DECLARE Radius smallint;
   IF new.CharCount<4 AND new.Radius>40 AND new.GuildID !=4 THEN SET new.Radius = 55;
END IF;END


new.CharCount = how many Members a Guild need to not be affected by this Trigger.

new.Radius = how big a claim can be before affected by this Trigger.

new.GuildID = makes an exception for a Guild (eg. your Admin Claim...)

SET new.Radius = the value you like to give to a claim.

How to use it?

Return to Game mods