Guild Hideouts

Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    Ass > Tits Lapje is offline
    MemberRank
    Feb 2009 Join Date
    nullLocation
    1,879Posts

    Guild Hideouts

    Hi guys,

    My first contribution to the Maple Community, altho it's been partly released already. I did write it from scratch with mainly saveToDB and other saving functions as an example.

    In MapleGuild.java add these two functions. Anywhere will do.
    PHP Code:
        public int getHideout() {
            return 
    hideout;
        }
        
        public 
    void setHideout(int id) {
            
    this.hideout id;        
        } 
    At the top of the file, look for this:
    PHP Code:
    private int idgplogologoColorleadercapacitylogoBGlogoBGColorsignatureallianceId
    Add hideout to it:
    PHP Code:
    private int idgplogologoColorleadercapacitylogoBGlogoBGColorsignatureallianceIdhideout
    Now in PlayerCommands.java (or w/e you use as player commands file)
    PHP Code:
            } else if (sub[0].equalsIgnoreCase("hideout")) {
                 if (
    c.getPlayer().getGuildId() == 0) {
                     
    chr.dropMessage("You are currently not in a guild.");
                 } else {
                     
    int guildId c.getPlayer().getGuildId();
                     
    int map c.getPlayer().getGuild().getHideout();
                     
    chr.changeMap(cserv.getMapFactory().getMap(map), cserv.getMapFactory().getMap(map).getPortal(0));
                 }
             } else if (
    sub[0].equalsIgnoreCase("sethideout")) {
                 if (
    c.getPlayer().getGuildId() != 0) {
                     if (
    c.getPlayer().getGuildRank() == 1) {
                         
    c.getPlayer().getGuild().setHideout(c.getPlayer().getMapId());
                         
    chr.dropMessage("You have changed your Guilds Hideout.");  
                     } else {
                        
    chr.dropMessage("You are not allowed to change this Guilds Hideout.");
                     }
                 } else {
                     
    chr.dropMessage("You are currently not in a guild.");
                 } 
    In MySQL execute this piece of code:
    Code:
    ALTER TABLE `moopledev`.`guilds` ADD COLUMN `hideout` INT(11) NOT NULL DEFAULT 100000000 AFTER `allianceId`;
    Where moopledev is your scheme, u should change it to yours.
    100000000 is the default map (I have henesys in case the guild leader didn't set a hideout yet).
    and allianceId is just the last column on the table, if you don't have it just scroll all the way right and put whatever is the last one there.

    Credits to me for most of the stuff, Kevin for the setHideout function and askHugo explaining to me why it's better to have this in MapleGuild.java .
    Hope u guys like it =].
    Last edited by Lapje; 26-06-11 at 01:06 PM.


  2. #2
    Proficient Member <ÄrtΣMis> is offline
    MemberRank
    Feb 2011 Join Date
    Scr/AdamLocation
    198Posts

    Re: Guild Hideouts

    Cool release ;D

  3. #3
    return null; mertjuh is offline
    MemberRank
    Dec 2008 Join Date
    The NetherlandsLocation
    1,269Posts

    Re: Guild Hideouts

    Lmao, I did exactly the same a few weeks ago.

    Code:
         return 10000;
    And why did you do this?
    Last edited by mertjuh; 25-06-11 at 10:46 PM.

  4. #4
    Ass > Tits Lapje is offline
    MemberRank
    Feb 2009 Join Date
    nullLocation
    1,879Posts

    Re: Guild Hideouts

    Lol thanks Adam,

    @mertjuh
    Yah I know, I stole it from ya =x, No, jokes. I did make this myself ;].
    Last edited by Lapje; 26-06-11 at 12:04 AM.

  5. #5
    Member CodeSomeBS is offline
    MemberRank
    Jun 2011 Join Date
    60Posts

    Re: Guild Hideouts

    I still don't understand why the hideout field is in MapleCharacter.

  6. #6
    Ass > Tits Lapje is offline
    MemberRank
    Feb 2009 Join Date
    nullLocation
    1,879Posts

    Re: Guild Hideouts

    Quote Originally Posted by CodeSomeBS View Post
    I still don't understand why the hideout field is in MapleCharacter.
    I guess u're askHugo? I told you, I'm a nub and I don't see why it would matter if it's in MapleGuild. =].

  7. #7
    Account Upgraded | Title Enabled! Expedia is offline
    MemberRank
    Nov 2009 Join Date
    884Posts

    Re: Guild Hideouts

    Quote Originally Posted by Lapje View Post
    I guess u're askHugo? I told you, I'm a nub and I don't see why it would matter if it's in MapleGuild. =].
    Because it's called a Guild Hideout not a character hideout. If it's in MapleGuild, you'll only have to load the id once not continuously for each character of the guild.

  8. #8
    Novice iRawr is offline
    MemberRank
    Jun 2011 Join Date
    4Posts

    Re: Guild Hideouts

    Quote Originally Posted by Expedia View Post
    Because it's called a Guild Hideout not a character hideout. If it's in MapleGuild, you'll only have to load the id once not continuously for each character of the guild.
    Yeah, just adding it to MapleGuild would be less work.

    But this way it's more "noob-friendly" (imo).
    Because people can just add it, instead of editing and spamming posts like "ErRoRz Pl0X ... DUN WoRkZ?!?!?" ;D

    So...
    Good Job (:

  9. #9
    Ass > Tits Lapje is offline
    MemberRank
    Feb 2009 Join Date
    nullLocation
    1,879Posts

    Re: Guild Hideouts

    Quote Originally Posted by Expedia View Post
    Because it's called a Guild Hideout not a character hideout. If it's in MapleGuild, you'll only have to load the id once not continuously for each character of the guild.
    Mm yah that's what Hugo told me too. Alright, next time I'll do that, but for now I'm staying with this x].
    -------------------
    Edit: Kk lols, I do know understand what u guys are trying to say. Thanks for that x].

    ---------- Post added at 10:04 PM ---------- Previous post was at 09:59 PM ----------

    Quote Originally Posted by mertjuh View Post
    Lmao, I did exactly the same a few weeks ago.

    Code:
         return 10000;
    And why did you do this?
    In case it could not load from the db o_O. So it'd have a default map to go to. And it needed a return value
    Last edited by Lapje; 26-06-11 at 12:36 AM.

  10. #10
    Member CodeSomeBS is offline
    MemberRank
    Jun 2011 Join Date
    60Posts

    Re: Guild Hideouts

    Quote Originally Posted by Lapje View Post
    In case it could not load from the db o_O. So it'd have a default map to go to. And it needed a return value
    Edit: Nvm.
    And no, I'm not AskHugo.
    Last edited by CodeSomeBS; 26-06-11 at 12:09 AM.

  11. #11
    Gamma Sparrow is offline
    MemberRank
    Mar 2009 Join Date
    SydneyLocation
    2,960Posts

    Re: Guild Hideouts

    All this is doing is setting a map. What's the point of having a guild hideout?

  12. #12
    Ass > Tits Lapje is offline
    MemberRank
    Feb 2009 Join Date
    nullLocation
    1,879Posts

    Re: Guild Hideouts

    Well err, a map for you and your guild alone. It's private and u can easily warp to it. Like it or not, but my players find it awesome o_O.
    If you find a nice map it has more value then assigning fm to it >.>

    Soz if this does not live up to your expectations, I had quite a hard time getting this working..
    -----------
    I shouldn't say it's private cause the map is not blocked for other players, but if you choose your map carefully you can find a map that players rarely visit. There are plenty of those map which are great for using as hideouts.
    Last edited by Lapje; 26-06-11 at 01:22 AM.

  13. #13
    You'll never know what th AskHugo is offline
    MemberRank
    Jun 2010 Join Date
    The InternetLocation
    234Posts

    Re: Guild Hideouts

    Quote Originally Posted by Lapje View Post
    I guess u're askHugo? I told you, I'm a nub and I don't see why it would matter if it's in MapleGuild. =].
    No he's not me.

    First of all, the 'int hideout' at the top of the MapleCharacter is now rendered useless. What's the point of caching it if you're sending queries every time you save and load it anyways?

    Secondly, you are sending queries to the database every time a player uses both commands, which isn't really that good for your server. Notice that almost everything is cached (look at loadCharFromDB in MapleCharacter)

    Thirdly, it would've been much easier if you had the hideout load and cache once the guild is loaded in MapleGuild, then you could make a function to return that value.


    Here, let me fix it up for you.

    Delete everything you have to do with hideouts from MapleCharacter.

    in MapleGuild:

    add:
    PHP Code:
        private int hideout
    after:
    PHP Code:
        private int capacity
    and:
    PHP Code:
                hideout rs.getInt("hideout"); 
    after:
    PHP Code:
                allianceId rs.getInt("allianceId"); 
    add these near the other functions:
    PHP Code:
        public int getHideout() {
            return 
    hideout;
        }
        
        public 
    void setHideout(int id) {
            
    hideout id;        
        } 
    in WriteToDB change:
    PHP Code:
                    sql += "capacity = ?, " "notice = ? WHERE guildid = ?"
    to
    PHP Code:
                    sql += "capacity = ?, notice = ?, hideout = ? WHERE guildid = ?"
    and:
    PHP Code:
                    ps.setInt(13this.id); 
    to:
    PHP Code:
                    ps.setInt(14this.id); 
    and before it add:
    PHP Code:
                    ps.setInt(13hideout); 

    Now if you want to set hideouts just to player.getGuild().setHideout(id) and if you want to load just player.getGuild().getHideout()


    EDIT: I forgot your commands.

    PHP Code:
             } else if (sub[0].equalsIgnoreCase("hideout")) {
                 if (
    c.getPlayer().getGuild() == null) {
                     
    chr.dropMessage("You are currently not in a guild");
                 } else {
                     
    int map c.getPlayer().getGuild().getHideout(c.getPlayer().getGuildId());
                     
    chr.changeMap(cserv.getMapFactory().getMap(map), cserv.getMapFactory().getMap(map).getPortal(0)); // you sure you don't have an easier version of changeMap in your source? 
                 
    }
             } else if (
    sub[0].equalsIgnoreCase("sethideout")) {
                 if (
    c.getPlayer().getGuild() != null) {
                     if (
    c.getPlayer().getGuildRank() == 1) {
                         
    c.getPlayer().getGuild().setHideout(c.getPlayer().getMapId());
                         
    chr.dropMessage("You have changed your guild's hideout");  
                     } else {
                        
    chr.dropMessage("You are not allowed to change your guild's hideout");
                     }
                 } else {
                     
    chr.dropMessage("You are currently not in a guild");
                 } 
    Last edited by AskHugo; 26-06-11 at 09:37 AM.

  14. #14
    Ooo, shiny! FateJiki is offline
    MemberRank
    Feb 2008 Join Date
    1,057Posts

    Re: Guild Hideouts

    I thought this was released before in '08. x)

  15. #15
    You'll never know what th AskHugo is offline
    MemberRank
    Jun 2010 Join Date
    The InternetLocation
    234Posts

    Re: Guild Hideouts

    Quote Originally Posted by FateJiki View Post
    I thought this was released before in '08. x)
    Look around in the releases section for a page or two and calculate the ratio between new/been done before (Count the new threads, not old bumped ones). It's not going to be very high.
    Last edited by AskHugo; 26-06-11 at 04:43 AM.



Page 1 of 2 12 LastLast

Advertisement