Occupation Chat?

Results 1 to 9 of 9
  1. #1
    Enthusiast ronggyuann is offline
    MemberRank
    Nov 2012 Join Date
    29Posts

    Occupation Chat?

    Hey guys , can i know how do i add like [occupation Name] Infront of the character name in default ? Like for example my occupation name is LazyMaster

    Then when i talk to people my name will be [LazyMaster]RongYuan : blablabla Instead of just RongYuan :blablabla .

    I wanna make for a few occupation . Please tell me how , i can't figure it out .


  2. #2
    Apprentice Jiklipuff is offline
    MemberRank
    Nov 2012 Join Date
    10Posts

    Re: Occupation Chat?

    Generalchathandler.java

    After
    PHP Code:
    if (!CommandProcessor.processCommand(ctext) && c.getPlayer().getCanTalk()) { 
    add something like

    PHP Code:
     if (c.getPlayer().getOccupation() != 0) { //if the player has any occupation (change this accordingly)
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getChatText(c.getPlayer().getId(), "["+c.getPlayer().getOccupation()+"] " c.getPlayer().getName() + ": " text c.getPlayer().getGMChat(), slea.readByte())); //don't blindly trust this part tho, read underneath

    Just change the above. It's a general, untested, example of how it could be done. Could be different for your server. The idea behind it is to go to your generalchathandler, look for the part where it allows you to chat and it should have the broadcastMessage method there somewhere. Change the text variable (the part you typed) to what you want (in this case [occupationname] playername: text).

  3. #3
    Enthusiast ronggyuann is offline
    MemberRank
    Nov 2012 Join Date
    29Posts

    Re: Occupation Chat?

    Oh okay . i got a problem , when i am done , it give me like : John : [Noob] John : hi ._.
    Last edited by ronggyuann; 30-11-12 at 08:11 PM.

  4. #4
    Alpha Member TiredGuy is offline
    MemberRank
    Mar 2012 Join Date
    Behind YouLocation
    1,527Posts

    Re: Occupation Chat?

    If u copied what the guy said, it shoulda worked properly o.o

  5. #5
    Enthusiast ronggyuann is offline
    MemberRank
    Nov 2012 Join Date
    29Posts

    Re: Occupation Chat?

    My script is below , I just have a problem , like i talk , it will go in John : [noob]John : blablabl .

    But my occupation is BankaiRailer.

    PHP Code:
    public final void handlePacket(SeekableLittleEndianAccessor sleaMapleClient c) {

            
    String text slea.readMapleAsciiString();
            try {
                try {
                    if (!
    CommandProcessor.processCommand(ctext) && c.getPlayer().getCanTalk()) {
                         if (
    c.getPlayer().getOccupation() != (MapleOccupations.BankaiRailer)) { //if the player has any occupation (change this accordingly)
                    
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getChatText(c.getPlayer().getId(),"[BankaiRailer]" c.getPlayer().getName() + ": " text c.getPlayer().getGMChat(), slea.readByte())); //don't blindly trust this part tho, read underneath
                         
    ChatLog.getInstance().add("["+ChatLog.getInstance().generateTime()+"]" " [All] " c.getPlayer().getName() + ": " text);
                    if (
    ChatLog.getInstance().getChat().size() >= 0ChatLog.getInstance().makeLog(); //change 500 to w/e  
                         

                        if (!
    c.getPlayer().getCheatTracker().Spam(3001)) {
                        if (
    c.getPlayer().isDonor()) {
                            
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.sendYellowTip("" c.getPlayer().getName() + ": " text));
                            
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getChatText(c.getPlayer().getId(), textfalse1));
                            
    ChatLog.getInstance().add("["+ChatLog.getInstance().generateTime()+"]" " [All] " c.getPlayer().getName() + ": " text);
                    if (
    ChatLog.getInstance().getChat().size() >= 0ChatLog.getInstance().makeLog(); //change 500 to w/e  

                        
    } else {
                            
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getChatText(c.getPlayer().getId(), textc.getPlayer().getGMChat(), slea.readByte()));
                        
    ChatLog.getInstance().add("["+ChatLog.getInstance().generateTime()+"]" " [All] " c.getPlayer().getName() + ": " text);
                    if (
    ChatLog.getInstance().getChat().size() >= 0ChatLog.getInstance().makeLog(); //change 500 to w/e  
    }
                        }
                    }
                } catch (
    RemoteException ex) {
                    
    Logger.getLogger(GeneralchatHandler.class.getName()).log(Level.SEVEREnullex);
                } catch (
    IllegalCommandSyntaxException ex) {
                    
    Logger.getLogger(GeneralchatHandler.class.getName()).log(Level.SEVEREnullex);
                }
            } catch (
    SQLException ex) {
                
    Logger.getLogger(GeneralchatHandler.class.getName()).log(Level.SEVEREnullex);
            }
                if (
    c.getPlayer().getWatcher() != null) {
                    
    c.getPlayer().getWatcher().dropMessage("[" c.getPlayer().getName() + " All] : " text);
            }
            }
        } 
    Please tell me how to fix it .

  6. #6
    Enthusiast ronggyuann is offline
    MemberRank
    Nov 2012 Join Date
    29Posts

    Re: Occupation Chat?

    Bump !

  7. #7
    Apprentice Jiklipuff is offline
    MemberRank
    Nov 2012 Join Date
    10Posts

    Re: Occupation Chat?

    Meh, there's something like the sendYellowTip method. Which makes it send a yellow message without your own name at the beginning. Don't quote me on this but I think there was one for normal text too. Find that one and use the same logic.

  8. #8
    Alpha Member TiredGuy is offline
    MemberRank
    Mar 2012 Join Date
    Behind YouLocation
    1,527Posts

    Re: Occupation Chat?

    From what I see, the code u posted should work properly o.o
    I don't see anything wrong with it. It should say [bankairailer] ign: text

  9. #9
    Apprentice Jiklipuff is offline
    MemberRank
    Nov 2012 Join Date
    10Posts

    Re: Occupation Chat?

    I think broadcastMessage sends [ign] : text, which indeed results into ign [occ] ign. It was the idea behind it. He can play around with it.



Advertisement