Jump to content
  • 0

MySql and Character Create


ganjaradio

Question

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!

Link to comment
Share on other sites

Recommended Posts

  • 0

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));

Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0
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

Link to comment
Share on other sites

  • 0
	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

Link to comment
Share on other sites

  • 0

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=?";

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • Witchit ESP | Cheat | Affordable ✅ Windows 10 & 11 supported ✅ Compatible with all Windows versions ✅ Works with AMD & Intel processors ✅ internal software Boost Your Game Visibility – Get Witchit ESP Now! https://witchitcheat.mysellix.io/
    • yes this is if the editor and map files do not match
    • How do I make class buffs look like this and have the same dynamics as a skill toggle? Example in the Rage skill image, I would like to activate and deactivate it as a skill toggle and have the same appearance. Solved. I needed to modify the values to make them the same as a skill toggle.
    • A message from Faytas, the player who got banned for revealing the "petition" screenshot:   So week ago i posted picture in discord of player Arab talking with Lithuanian admin Tony aka Mindaugas Cekavičius the main head of server l2Damage.com i saved picture it wasnt mine made so i posted it in discord just to let people realise that some players is under admins back i’ll post that picture and here it was an interesting picture player FatherOfDamage aka Arab was crying to admin to boost his classes in olympiad and admin was easily doing that and still doing till this day… after i posted that picture admin banned me in discord and two accounts ingame, dc-ingame nick was Faytas, then someone of my discord friends made more posts about corrupted admin Mindaugas Cekavičius at more forums/sites and guess what i instantly got ss in discord chat that player Arab saying that was me that posting more shit on other sites like maxcheaters,l2j i got also the screenshots of all that guy posts he did but i”ll not post his name couse he may get banned too couse he said truth as i did, then in about 2-3 days i took friends acc and named it iFaytas and clan member made a joke in hero voice “ban Faytas” so immidiatly i got banned again! ban says im banned couse i pretend as other player then he changed it that i used illigal software, after that i logged box to talk with him why i got banned he was standing in town so i asked him and he was ignoring me and all other people who asked why he banned me, and guess what? once again i got banned so in total i got banned 4 accounts for no reason just couse i posted picture of illigal things that admin doing and helping other players, by the way a month ago i was spamming that player arab like i always do just to make fun of him and that guy ciuldn’t handle the spam so he asked Tony to jail me and he jailed me for 120min being in jail i asked why and he unjailed me instantly xD i dont care anymore about this server and won’t play there couse he is helping other people/boosting theyr classes in olympiad lol im posting that special picture bellow… after 4 free bans i could’t do nothing just to post it everywhere couse that pissed me off that people getting bans for telling the truth!   https://ibb.co/GsMFfwx   https://ibb.co/nfsPwZP https://ibb.co/zRNH0yd
  • Topics

×
×
  • Create New...