GM equipment maker (tested and works)

Results 1 to 9 of 9
  1. #1
    Enthusiast deternary is offline
    MemberRank
    Jul 2009 Join Date
    40Posts

    GM equipment maker (tested and works)

    This isn't a leak, my coder made this for our server. And since that previous one doesn't work, I decided to release this with his permission. If you want to change the access level, go to "if (cm.getChar().gmLevel() > 4) {" and change the 4 to the level you want. (4 = admins only, 3 = superGMs/admins only, etc)

    Code:
    /*
      GM Custom Equipment Creator
      Author: Kanashisou
    */
    
    importPackage(java.util);
    importPackage(net.sf.odinms.client);
    importPackage(net.sf.odinms.server);
    importPackage(net.sf.odinms.tools);
    
    importPackage(net.sf.odinms.server.maps);
    
    var equip = null;
    var change = null;
    var ii = MapleItemInformationProvider.getInstance();
    
    var statNames = new Array("STR", "DEX", "INT", "LUK", "HP", "MP", "Weapon attack",
    	"Magic attack", "Weapon defense", "Magic defense", "Accuracy", "Avoidability", "Speed", "Jump", "Upgrade slots", "Owner");
    
    function start() {
    	status = -1;
    	action(1, 0, 0);
    }
    
    function action(mode, type, selection) {
    	if (mode == -1) {
    		cm.dispose();
    	} else {
    		if ((status == 1 || status == 3 || status == 4) && mode == 0) {
    			cm.dispose();
    			return;
    		}
    	
    		if (mode == 1)
    			status++;
    		else if (mode == 0)
    			status--;
    			
    		if (status == 0) {
    			if (cm.getChar().gmLevel() > 4) {
    				cm.sendYesNo("Hello #b[GM] #h ##k! Would you like to create an equip?");
    			} else {
    				cm.sendOk("Hey... you aren't a GM!");
    				cm.dispose();
    			}
    		} else if (status == 1) {
    			cm.sendGetNumber("Enter the equip ID.", 1000000, 1000000, 1999999);
    		} else if (status == 2) {
    			// This is a bit slow
    			var items = ii.getAllItems().toArray();
    			for (var i = 0; i < items.length; i++) {
    				if (items[i].getLeft() == selection) {
    					equip = ii.getEquipById(selection);
    					cm.sendYesNo("Do you want to create #b#z" + selection + "##k?");
    					return;
    				}
    			}
    			
    			cm.sendPrev("The item you are trying to create does not exist.");
    		} else if (status == 3) {
    			var s = "You are creating: #b#z" + equip.getItemId() + "##k.\r\nSelect a stat to change it.\r\n";
    			for (var i = 0; i < 16; i++) {
    				s += "#L" + i + "##b" + statNames[i] + ": " + getEquipStat(i) + "#k#l\r\n";
    			}
    			
    			s += "\r\n#L16##bCreate the equipment#k#l";
    			cm.sendSimple(s);
    		} else if (status == 4) {
    			if (selection == 16) {
    				var newSlot = cm.getChar().getInventory(MapleInventoryType.EQUIP).addItem(equip);
    				if (newSlot == -1) {
    					cm.sendOk("Please make sure your equipment inventory is not full.");
    					cm.dispose();
    					return;
    				}
    				cm.getChar().getClient().getSession().write(MaplePacketCreator.addInventorySlot(MapleInventoryType.EQUIP, equip));
    				cm.sendOk("Have fun with your new #b#t" + equip.getItemId() + "##k!");
    				cm.dispose();
    			} else {
    				change = selection;
    				if (selection == 15) {
    					cm.sendGetText("Enter the new value for #bowner#k.");
    					return;
    				}
    				
    				var def = getEquipStat(selection);
    				cm.sendGetNumber("Enter the new value for #b" + statNames[selection] + "#k.", def, 0, 32767);
    			}
    		} else if (status == 5) {
    			setEquipStat(change, selection);
    			status = 3;
    			action(2, 0, 0);
    		}
    	}
    }
    
    function getEquipStat(i) {
    	switch (i) {
    		case 0: return equip.getStr();
    		case 1: return equip.getDex();
    		case 2: return equip.getInt();
    		case 3: return equip.getLuk();
    		case 4: return equip.getHp();
    		case 5: return equip.getMp();
    		case 6: return equip.getWatk();
    		case 7: return equip.getMatk();
    		case 8: return equip.getWdef();
    		case 9: return equip.getMdef();
    		case 10: return equip.getAcc();
    		case 11: return equip.getAvoid();
    		case 12: return equip.getSpeed();
    		case 13: return equip.getJump();
    		case 14: return equip.getUpgradeSlots();
    		case 15: return equip.getOwner() == "" ? "(none)" : equip.getOwner();;
    	}
    }
    
    function setEquipStat(i, v) {
    	switch (i) {
    		case 0: equip.setStr(v); break;
    		case 1: equip.setDex(v); break;
    		case 2: equip.setInt(v); break;
    		case 3: equip.setLuk(v); break;
    		case 4: equip.setHp(v); break;
    		case 5: equip.setMp(v); break;
    		case 6: equip.setWatk(v); break;
    		case 7: equip.setMatk(v); break;
    		case 8: equip.setWdef(v); break;
    		case 9: equip.setMdef(v); break;
    		case 10: equip.setAcc(v); break;
    		case 11: equip.setAvoid(v); break;
    		case 12: equip.setSpeed(v); break;
    		case 13: equip.setJump(v); break;
    		case 14: equip.setUpgradeSlots(v); break;
    		case 15: equip.setOwner(cm.getText()); break;
    	}
    }
    Last edited by deternary; 02-11-09 at 05:06 AM.


  2. #2
    bleh.... Shawn is offline
    MemberRank
    Oct 2008 Join Date
    Mississauga, CaLocation
    5,904Posts

    Re: GM equipment maker (tested and works)

    Your coder didn't make anything. Just because he edited something, doesn't mean it's "his". As a matter of fact, looking at it now, it's the exact same change that I told someone in a Help thread earlier today.

  3. #3
    iamTheKing NyCPirate is offline
    MemberRank
    Aug 2009 Join Date
    c.getNyC.posLocation
    1,746Posts

    Re: GM equipment maker (tested and works)

    Lmao I read that thread bboy

  4. #4
    offonline King Grub is offline
    MemberRank
    Aug 2009 Join Date
    Spring fieldLocation
    3,303Posts

    Re: GM equipment maker (tested and works)

    Quote Originally Posted by NyCPirate View Post
    Lmao I read that thread bboy
    Read some java tuts insted.
    Goodluck.

  5. #5
    Valued Member chocolateownz is offline
    MemberRank
    Nov 2008 Join Date
    147Posts

    Re: GM equipment maker (tested and works)

    How come this npc script doesn't work? How do I fix it? I really need it :(.

  6. #6
    NO PLEASE I CAN'T ShEtY is offline
    MemberRank
    Sep 2009 Join Date
    398Posts

    Re: GM equipment maker (tested and works)

    Quote Originally Posted by chocolateownz View Post
    How come this npc script doesn't work? How do I fix it? I really need it :(.
    cm.getChar() ---> cm.getPlayer().getChar()

  7. #7
    Apprentice prokiller is offline
    MemberRank
    Nov 2009 Join Date
    MalaysiaLocation
    18Posts

    Re: GM equipment maker (tested and works)

    Nice Releases^^

  8. #8
    Novice galchu is offline
    MemberRank
    Dec 2009 Join Date
    2Posts

    Re: GM equipment maker (tested and works)

    where do i put this?

  9. #9
    Novice Yakir is offline
    MemberRank
    Oct 2009 Join Date
    2Posts

    Re: GM equipment maker (tested and works)

    nice work thanks =]



Advertisement