Jump to content
  • 0
Sign in to follow this  
theong456

DB error - Duplicate entry '150004-0' for key 'PRIMARY'

Question

Posted (edited)

Hello everyone

maybe Bonus_script error

I use my item 

  - Id: 14603
    AegisName: MistressS
    Name: Mistress Scroll
    Type: Usable
    Weight: 10
    Trade:
      Override: 100
      NoDrop: true
      NoTrade: true
      NoSell: true
      NoCart: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true
    Script: |
      specialeffect2 EF_SPELLBREAKER;
      bonus_script "{ bonus bNoGemStone; bonus bUseSPrate,25; }",180,0,0,EFST_MVPCARD_MISTRESS;

and

  - Id: 14602
    AegisName: TaogunkaS
    Name: Tao Gunka Scroll
    Type: Usable
    Weight: 10
    Trade:
      Override: 100
      NoDrop: true
      NoTrade: true
      NoSell: true
      NoCart: true
      NoGuildStorage: true
      NoMail: true
      NoAuction: true
    Script: |
      specialeffect2 EF_LIGHTSPHERE;
      bonus_script "{ bonus bMaxHPrate,100; bonus bDefRate,-50; bonus bMdefRate,-50; }",180,0,0,EFST_MVPCARD_TAOGUNKA;

image.png.2c7838b142f50f64055cc86cd112abe2.png

I Log out now and log in now 

image.png.2287ea758d521353203aeb435364879f.png
 

image.png.1ae85b4f602be2d20cadbd5f2deb590c.png
 

Bonus script gone
and show im Charserv.bat about

image.thumb.png.defbe33e24d5987c4411dee08a58e2af.png

plz help me

Edited by Mael
Use codebox

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

you can't use same type, for each bonus

look at the db structure

--
-- Table structure for table `bonus_script`
--

CREATE TABLE IF NOT EXISTS `bonus_script` (
  `char_id` INT(11) UNSIGNED NOT NULL,
  `script` TEXT NOT NULL,
  `tick` BIGINT(20) NOT NULL DEFAULT '0',
  `flag` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
  `type` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
  `icon` SMALLINT(3) NOT NULL DEFAULT '-1',
  PRIMARY KEY (`char_id`, `type`)
) ENGINE=InnoDB;

and script command of bonus_script

*bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};

This command will attach a script to a player for a given duration, in seconds.
After that time, the script will automatically expire. The same bonus cannot be
stacked. By default, this bonus will be stored on `bonus_script` table when player
logs out.

Flags (bitmask):
	1   : Remove when dead.
	2   : Removable by Dispell.
	4   : Removable by Clearance.
	8   : Remove when player logs out.
	16  : Removeable by Banishing Buster.
	32  : Removable by Refresh.
	64  : Removable by Lux Anima.
	128 : Remove when Madogear is activated or deactivated.
	256 : Remove when receive damage.
	512 : Script is permanent, cannot be cleared by bonus_script_clear.
	1024: Force to replace duplicated script by expanding the duration.
	2048: Force to add duplicated script. This flag cannot be stacked with 1024,
	      if both are defined, 1024 will be checked first and ignore this flag.

Types:
	This will be used to decide negative or positive buff for 'debuff_on_logout'.
	0: Ignore the buff type and won't be removed if the flag is not &8 (Default)
	1: Buff
	2: Debuff

Status_icon: See "Status Icon" section in 'src/map/script_constants.hpp'. Default is SI_BLANK (-1).

Example:
	// Apple gives you +5 Str bonus for 1 minute when it's consumed.
	512,Apple,Apple,0,15,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bStr,5; }",60; },{},{}

 

this 2 script contain same type and then resulting duplicate entry, which was clear if you read in console (150003, 0) 150003 is that char id and 0 is the type.

bonus_script "{ bonus bNoGemStone; bonus bUseSPrate,25; }",180,0,0,EFST_MVPCARD_MISTRESS;
bonus_script "{ bonus bMaxHPrate,100; bonus bDefRate,-50; bonus bMdefRate,-50; }",180,0,0,EFST_MVPCARD_TAOGUNKA;

for the fix, you can change the primary key in the db. since type field is only have 3 type 0,1,2 which maybe will be used in multiple script_bonus script, try replacing the primary key of table with  char id and icon, which mean you can't use same icon for each entry of bonus_script and icon has many type and you can make new icon too.

--
-- Table structure for table `bonus_script`
--

CREATE TABLE IF NOT EXISTS `bonus_script` (
  `char_id` INT(11) UNSIGNED NOT NULL,
  `script` TEXT NOT NULL,
  `tick` BIGINT(20) NOT NULL DEFAULT '0',
  `flag` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
  `type` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
  `icon` SMALLINT(3) NOT NULL DEFAULT '-1',
  PRIMARY KEY (`char_id`, `icon`)
) ENGINE=InnoDB;

 

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.