• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Pokemon System and EXP bug

Joined
Oct 29, 2009
Messages
738
Reaction score
14
I leeched the Pokemon System from TetraSEA , manage to get my pokemon from @pokemon , but It won't save at the database , I already added the savetodb function for pokemon , and also I already executed the Pokemon SQL in my database , but it won't save it . And also after I @accept challenge , both my opponent and I will dc , I had added everything on pokemon into the source , no bat error .

Another error is that when a player died , instead of decreasing EXP , the EXP increases 2 times the original amount .
PHP:
public void playerDead() {
              if (this.getSubclass() == 2) {  
          int rand = Randomizer.nextInt(100);
                   if (rand >= 60) {
                     this.dropMessage(5, "You've cheated death!");  
                     this.getStat().setHp(this.getStat().getMaxHp() / 2, this);
                   }  
      }
                if (this.getHardcore() == 1) {
                MapleInventory equipped = this.getInventory(MapleInventoryType.EQUIPPED);
                List<Short> ids = new LinkedList<Short>();
                for (Item item : equipped.list()) {
                ids.add(item.getPosition());
                }
                for (short idf : ids) {
                MapleInventoryManipulator.drop(this.getClient(), MapleInventoryType.EQUIPPED, idf, (short) 1);
                }
                World.Broadcast.broadcastMessage(MaplePacketCreator.serverNotice(6, 6, "[Hardcore]" + this.getName() + " has died in " + this.getMap().getMapName() + " Ch " + this.getClient().getChannel() + " - All of the equips the player wore were dropped in the map!"));
        } 
        final MapleStatEffect statss = getStatForBuff(MapleBuffStat.SOUL_STONE);
        if (statss != null) {
            dropMessage(5, "You have been revived by Soul Stone.");
            getStat().setHp(((getStat().getMaxHp() / 100) * statss.getX()), this);
            setStance(0);
            changeMap(getMap(), getMap().getPortal(0));
            return;
        }
        if (getEventInstance() != null) {
            getEventInstance().playerKilled(this);
        }
        cancelEffectFromBuffStat(MapleBuffStat.SHADOWPARTNER);
        cancelEffectFromBuffStat(MapleBuffStat.MORPH);
        cancelEffectFromBuffStat(MapleBuffStat.SOARING);
        cancelEffectFromBuffStat(MapleBuffStat.MONSTER_RIDING);
        cancelEffectFromBuffStat(MapleBuffStat.MECH_CHANGE);
        cancelEffectFromBuffStat(MapleBuffStat.RECOVERY);
        cancelEffectFromBuffStat(MapleBuffStat.HP_BOOST);
        cancelEffectFromBuffStat(MapleBuffStat.MP_BOOST);
        cancelEffectFromBuffStat(MapleBuffStat.ENHANCED_MAXHP);
        cancelEffectFromBuffStat(MapleBuffStat.ENHANCED_MAXMP);
        cancelEffectFromBuffStat(MapleBuffStat.MAXHP);
        cancelEffectFromBuffStat(MapleBuffStat.MAXMP);
        dispelSummons();
        checkFollow();
        dotHP = 0;
        lastDOTTime = 0;
        if (!GameConstants.isBeginnerJob(job) && !inPVP()) {
            int charms = getItemQuantity(5130000, false);
            if (charms > 0) {
                MapleInventoryManipulator.removeById(client, MapleInventoryType.CASH, 5130000, 1, true, false);

                charms--;
                if (charms > 0xFF) {
                    charms = 0xFF;
                }
                client.getSession().write(MTSCSPacket.useCharm((byte) charms, (byte) 0));
            } else {
                float diepercentage = 0.0f;
                int expforlevel = getNeededExp();
                if (map.isTown() || FieldLimitType.RegularExpLoss.check(map.getFieldLimit())) {
                    diepercentage = 0.01f;
                } else {
                    diepercentage = (float) (0.1f - ((traits.get(MapleTraitType.charisma).getLevel() / 20) / 100f));
                }
                int v10 = (int) (exp.get() - (long) ((double) expforlevel * diepercentage));
                if (v10 < 0) {
                    v10 = 0;
                }
                 exp.addAndGet(v10);
            }
            this.updateSingleStat(MapleStat.EXP, this.exp.get());
        }
        if (!stats.checkEquipDurabilitys(this, -100)) { //i guess this is how it works ?
            dropMessage(5, "An item has run out of durability but has no inventory room to go to.");
        } //lol
        if (pyramidSubway != null) {
            stats.setHp((short) 50, this);
            pyramidSubway.fail(this);
        }
    }

I tried replacing that with the 1 in TetraSEA , which is this.
PHP:
public void playerDead() {
        final MapleStatEffect statss = getStatForBuff(MapleBuffStat.SOUL_STONE);
        if (statss != null) {
            dropMessage(5, "You have been revived by Soul Stone.");
            getStat().setHp(((getStat().getMaxHp() / 100) * statss.getX()), this);
            setStance(0);
            changeMap(getMap(), getMap().getPortal(0));
            return;
        }
        if (getEventInstance() != null) {
            getEventInstance().playerKilled(this);
        }
        cancelEffectFromBuffStat(MapleBuffStat.SHADOWPARTNER);
        cancelEffectFromBuffStat(MapleBuffStat.MORPH);
        cancelEffectFromBuffStat(MapleBuffStat.SOARING);
        cancelEffectFromBuffStat(MapleBuffStat.MONSTER_RIDING);
        cancelEffectFromBuffStat(MapleBuffStat.MECH_CHANGE);
        cancelEffectFromBuffStat(MapleBuffStat.RECOVERY);
        cancelEffectFromBuffStat(MapleBuffStat.HP_BOOST);
        cancelEffectFromBuffStat(MapleBuffStat.MP_BOOST);
        cancelEffectFromBuffStat(MapleBuffStat.ENHANCED_MAXHP);
        cancelEffectFromBuffStat(MapleBuffStat.ENHANCED_MAXMP);
        cancelEffectFromBuffStat(MapleBuffStat.MAXHP);
        cancelEffectFromBuffStat(MapleBuffStat.MAXMP);
        dispelSummons();
        checkFollow();
        dotHP = 0;
        lastDOTTime = 0;
        if (!GameConstants.isBeginnerJob(job) && !inPVP()) {
            int charms = getItemQuantity(5130000, false);
            if (charms > 0) {
                MapleInventoryManipulator.removeById(client, MapleInventoryType.CASH, 5130000, 1, true, false);

                charms--;
                if (charms > 0xFF) {
                    charms = 0xFF;
                }
                client.getSession().write(MTSCSPacket.useCharm((byte) charms, (byte) 0));
            } else {
                float diepercentage = 0.0f;
                int expforlevel = getNeededExp();
                if (map.isTown() || FieldLimitType.RegularExpLoss.check(map.getFieldLimit())) {
                    diepercentage = 0.01f;
                } else {
                    diepercentage = (float) (0.1f - ((traits.get(MapleTraitType.charisma).getLevel() / 20) / 100f));
                }
                int v10 = (int) (exp - (long) ((double) expforlevel * diepercentage));
                if (v10 < 0) {
                    v10 = 0;
                }
                this.exp = v10;
            }
            this.updateSingleStat(MapleStat.EXP, this.exp);
        }
        if (!stats.checkEquipDurabilitys(this, -100)) { //i guess this is how it works ?
            dropMessage(5, "An item has run out of durability but has no inventory room to go to.");
        } //lol
        if (pyramidSubway != null) {
            stats.setHp((short) 50, this);
            pyramidSubway.fail(this);
        }
    }

But I am getting this error in Netbean
PHP:
C:\Users\Darren\Desktop\src\client\MapleCharacter.java:3874: error: bad operand types for binary operator '-'
                int v10 = (int) (exp - (long) ((double) expforlevel * diepercentage));
  first type:  AtomicInteger
  second type: long
C:\Users\Darren\Desktop\src\client\MapleCharacter.java:3878: error: incompatible types
                this.exp = v10;
  required: AtomicInteger
  found:    int
C:\Users\Darren\Desktop\src\client\MapleCharacter.java:3880: error: no suitable method found for updateSingleStat(MapleStat,AtomicInteger)
            this.updateSingleStat(MapleStat.EXP, this.exp);
    method MapleCharacter.updateSingleStat(MapleStat,int,boolean) is not applicable
      (actual and formal argument lists differ in length)
    method MapleCharacter.updateSingleStat(MapleStat,int) is not applicable
      (actual argument AtomicInteger cannot be converted to int by method invocation conversion)
3 errors
Both updateSingleStat is the same ... So what's the problem for the EXP ? :X
 
butt > Tits
Loyal Member
Joined
Feb 16, 2009
Messages
658
Reaction score
96
You have 3 errors:

  1. Code:
    int v10 = (int) (exp - (long) ((double) expforlevel * diepercentage)); 
      first type:  AtomicInteger 
      second type: long
    Exp is an 'AtomicInteger' and you're substracting a long from it. You're also saving the result in an integer which might cause trouble.
  2. Code:
    incompatible types 
                    this.exp = v10; 
      required: AtomicInteger 
      found:    int
    Again, you're trying to save an integer in an 'AtomicInteger'. Google is your best friend.
  3. Code:
    this.updateSingleStat(MapleStat.EXP, this.exp); 
        method MapleCharacter.updateSingleStat(MapleStat,int,boolean) is not applicable 
          (actual and formal argument lists differ in length)
    You need to add a boolean value to the function. I assume it's whether you want to save the character but that's for you to check.
Good luck.
 
Upvote 0
Joined
Oct 29, 2009
Messages
738
Reaction score
14
You have 3 errors:

  1. Code:
    int v10 = (int) (exp - (long) ((double) expforlevel * diepercentage)); 
      first type:  AtomicInteger 
      second type: long
    Exp is an 'AtomicInteger' and you're substracting a long from it. You're also saving the result in an integer which might cause trouble.
  2. Code:
    incompatible types 
                    this.exp = v10; 
      required: AtomicInteger 
      found:    int
    Again, you're trying to save an integer in an 'AtomicInteger'. Google is your best friend.
  3. Code:
    this.updateSingleStat(MapleStat.EXP, this.exp); 
        method MapleCharacter.updateSingleStat(MapleStat,int,boolean) is not applicable 
          (actual and formal argument lists differ in length)
    You need to add a boolean value to the function. I assume it's whether you want to save the character but that's for you to check.
Good luck.

Thank you Sir :) Do you know about the pokemkn thing ?
 
Upvote 0
Junior Spellweaver
Joined
Apr 25, 2011
Messages
153
Reaction score
38
You could try to leech it from Xeon They Have it in their source as well not sure if this is helpful but i could fix some of the error if you take it from them....
 
Upvote 0
Back
Top