Jump to content
  • 0

MySql and Character Create


Question

Posted

Hello im getting error for line 140 on character create (newChar.setCurrentHp(template.baseHpMax + 400);)

after adding a custom faction system

 

CharacterCreate.java: https://pastebin.com/nBF57eMB

Changes in L2PcInstance

// Character Character SQL String Definitions:
private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,last_recom_date,factionid, returnx, returny, returnz) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,death_penalty_level=?,bookmarkslot=?,streak=?,lastKill1=?,lastKill2=?,vitality_points=?,heroWpnDel=?,cancraft=?, factionid=?,returnx=?, returny=?, returnz =? FROM characters WHERE charId=?";
private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,streak,lastKill1,lastKill2,vitality_points,heroWpnDel,factionid, returnx, returny, returnz FROM characters WHERE charId=?";
// Faction System
private int factionId;
public int getFactionId() { return factionId; }
public void setFactionId(int newFaction) { factionId = newFaction; }

			player.setVitalityPoints(rset.getInt("vitality_points"), true);
			player._heroWpnDelCount = rset.getByte("heroWpnDel");

			+player.setFactionId(rset.getInt("factionid"));
			+player.setReturnX(rset.getInt("returnx"));
			+player.setReturnY(rset.getInt("returny"));
			+player.setReturnZ(rset.getInt("returnz"));
	statement.setInt(57, getObjectId());
		+statement.setInt(58, getFactionId());
		+statement.setInt(59, getReturnX());
		+statement.setInt(60, getReturnY());
		+statement.setInt(61, getReturnZ());

And i cant create the character, if possible ot help me, thx in advance!

Recommended Posts

  • 0
Posted

Probably baseHpMax returns null. Debug it to be sure,

Check in your custom code how the baseHpMax is getting values ( probably dB connection), if yes then you missing the line in restore case of adding the base hp.. something like that 

player.setBaseHpMax(reset.getInt(something));

  • 0
Posted (edited)

btw the sql file:

CREATE TABLE IF NOT EXISTS `characters` (
  `account_name` VARCHAR(45) DEFAULT NULL,
  `charId` INT UNSIGNED NOT NULL DEFAULT 0,
  `char_name` VARCHAR(35) NOT NULL,
  `level` TINYINT UNSIGNED DEFAULT NULL,
  `maxHp` MEDIUMINT UNSIGNED DEFAULT NULL,
  `curHp` MEDIUMINT UNSIGNED DEFAULT NULL,
  `maxCp` MEDIUMINT UNSIGNED DEFAULT NULL,
  `curCp` MEDIUMINT UNSIGNED DEFAULT NULL,
  `maxMp` MEDIUMINT UNSIGNED DEFAULT NULL,
  `curMp` MEDIUMINT UNSIGNED DEFAULT NULL,
  `face` TINYINT UNSIGNED DEFAULT NULL,
  `hairStyle` TINYINT UNSIGNED DEFAULT NULL,
  `hairColor` TINYINT UNSIGNED DEFAULT NULL,
  `sex` TINYINT UNSIGNED DEFAULT NULL,
  `heading` MEDIUMINT DEFAULT NULL,
  `x` MEDIUMINT DEFAULT NULL,
  `y` MEDIUMINT DEFAULT NULL,
  `z` MEDIUMINT DEFAULT NULL,
  `exp` BIGINT UNSIGNED DEFAULT 0,
  `expBeforeDeath` BIGINT UNSIGNED DEFAULT 0,
  `sp` INT UNSIGNED NOT NULL DEFAULT 0,
  `karma` INT UNSIGNED DEFAULT NULL,
  `fame` MEDIUMINT UNSIGNED NOT NULL default 0,
  `pvpkills` SMALLINT UNSIGNED DEFAULT NULL,
  `pkkills` SMALLINT UNSIGNED DEFAULT NULL,
  `clanid` INT UNSIGNED DEFAULT NULL,
  `race` TINYINT UNSIGNED DEFAULT NULL,
  `classid` TINYINT UNSIGNED DEFAULT NULL,
  `base_class` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  `transform_id` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
  `deletetime` BIGINT DEFAULT NULL,
  `cancraft` TINYINT UNSIGNED DEFAULT NULL,
  `title` VARCHAR(16) DEFAULT NULL,
  `rec_have` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  `rec_left` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  `accesslevel` MEDIUMINT DEFAULT 0,
  `online` TINYINT UNSIGNED DEFAULT NULL,
  `onlinetime` INT DEFAULT NULL,
  `char_slot` TINYINT UNSIGNED DEFAULT NULL,
  `newbie` MEDIUMINT UNSIGNED DEFAULT 1,
  `lastAccess` BIGINT UNSIGNED DEFAULT NULL,
  `clan_privs` MEDIUMINT UNSIGNED DEFAULT 0,
  `wantspeace` TINYINT UNSIGNED DEFAULT 0,
  `isin7sdungeon` TINYINT UNSIGNED NOT NULL default 0,
  `punish_level` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  `punish_timer` INT UNSIGNED NOT NULL DEFAULT 0,
  `power_grade` TINYINT UNSIGNED DEFAULT NULL,
  `nobless` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  `subpledge` SMALLINT NOT NULL DEFAULT 0,
  `last_recom_date` BIGINT UNSIGNED NOT NULL DEFAULT 0,
  `lvl_joined_academy` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  `apprentice` INT UNSIGNED NOT NULL DEFAULT 0,
  `sponsor` INT UNSIGNED NOT NULL DEFAULT 0,
  `varka_ketra_ally` TINYINT NOT NULL DEFAULT 0,
  `clan_join_expiry_time` BIGINT UNSIGNED NOT NULL DEFAULT 0,
  `clan_create_expiry_time` BIGINT UNSIGNED NOT NULL DEFAULT 0,
  `death_penalty_level` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
  `bookmarkslot` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
  `factionid` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
  `returnx` MEDIUMINT UNSIGNED NOT NULL DEFAULT 1,
  `returny` MEDIUMINT UNSIGNED NOT NULL DEFAULT 1,
  `returnz` MEDIUMINT UNSIGNED NOT NULL DEFAULT 1,
  PRIMARY KEY (`charId`),
  KEY `clanid` (`clanid`)
);

l2pcinstance.java:  http://www23.zippyshare.com/v/Gayilcc7/file.html

 

Edited by ganjaradio
  • 0
Posted (edited)

Except if you edited the concept of hp/mp/cp, those lines mean nothing (at least on latest aCis):

 
newChar.setCurrentHp(template.baseHpMax + 400);
newChar.setCurrentCp(template.baseCpMax + 400);
newChar.setCurrentMp(template.baseMpMax + 400); 

Since hp/mp/cp are now in tables and you need a level to refer to the correct hp/mp/cp value (cp being accessible only for players).

 

Instead of doing voodoo magic, simply use getMaxHp(), getMaxMp() and getMaxCp() or leave current latest.

Edited by Tryskell
  • 0
Posted
26 minutes ago, .Elfocrash said:

Move these lines:

newChar.setCurrentHp(template.baseHpMax + 400);

newChar.setCurrentCp(template.baseCpMax + 400);

newChar.setCurrentMp(template.baseMpMax + 400);

 

Inside the synchronize brackets right after this line

 

newChar = L2PcInstance.create(objectId, template, getClient().getAccountName(), _name, _hairStyle, _hairColor, _face, _sex != 0);

tried it again the same error in the same line

  • 0
Posted
	statement.setInt(57, getObjectId());
		+statement.setInt(58, getFactionId());
		+statement.setInt(59, getReturnX());
		+statement.setInt(60, getReturnY());
		+statement.setInt(61, getReturnZ());

he got them in his code at least

  • 0
Posted

statement.setInt(55, blabla)

statement.setInt(56, blabla)

statement.setInt(57, blabla)

statement.setInt(58, getObjectId()) // at the end always cause the sql statement is WHERE obj_id=?";

Guest
This topic is now closed to further replies.


  • Posts

    • My official facebook profile!: https://www.facebook.com/spectrumL2 Specifications: Revamped L2JACIS revision FROM the core Private project!!! Revision that has been receiving corrections for over 3 years!!! Events already installed in the revision: TVT CTF KTB PARTY FARM SPOIL EVENT CRAZY RATES TOURNAMENT TIME ZONE (INSTANCE) All working correctly!!! SIEGE ESSENTIAL FEATURES: Walls fix Gates fix Flags fix 100% functional: OLYMPIADS: Implemented settings Hero receives enchanted Weapons with equal status PvP Weapons Optional /true/false Hero can acquire all Hero Weapons Optional true/false OTHER IMPLEMENTATIONS: Teleport fixed (directly to Giran) Teleport effect classic Vip skins vip collor name Pack NPCs with effect already configured BOSES already configured Mobs already configured CLASS BALANCE SPECIAL SYSTEM We have a SPECIAL system developed for Class Balance with only 1 digit in XML %tage of configurable debuffs Player limitation system in BOSES or PvP zones BS blocking system in FLEG zones or events Among others dozens of improvements made in the review... price: 390 USD !  OBS: WE CAN CHANGE THE BANNER AND NAME OF THE SERVICE TO THE ONE OF YOUR PREFERENCE BUT THE SETTINGS MUST BE KEPT ANY CHANGES REQUIRE ADDITION        
    • Server is Online – 1,000+ Active Players! We’re excited to announce the addition of a Europe Proxy to improve connectivity for our EU players! Clans can now benefit from VIP Access to help you catch up faster. 🎯 If you're a clan leader with at least 9 active members, join our Discord and open a ticket to claim your VIP rewards!  
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock