[Release] House System menu

User Tag List

Page 1 of 10 12345 ... LastLast
Results 1 to 15 of 150
  1. #1
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Release][Updated] House System v.2

    House System v.2
    I finally decided to update House System to a newer version. There is some things I've made better. I haven't tested this. Please I appreciate if you report the errors to me as fast as possible so I can do something about them.

    Changelog v.2:
    Removed the annoying MySQL outgoing connection,
    so now you don't have to edit the code to get this working.
    Added a prize you can edit via Optional Config.
    No warnings now.

    NOTE: You have to add this additionally to your Optional Config file.
    These options controlls the Prize of a House and the Teleportation prize of a house. They must be over 0.
    Code:
    <HouseSystem
                              HousePrize="1064"       #In gold.
                              HouseTeleportationPrize="20">  #In gold.
    HouseSystem v.2
    Code:
    /*
        House System v.2
    
        Made by Link_S of MMOwned, him and only.
    
        Changelog:
            Removed the annoying MySQL outgoing connection,
            so now you don't have to edit the code to get this working.
            Added a prize you can edit via Optional Config.
            No warnings now.
    */
    
    #include "StdAfx.h"
    
    uint32 HOUSEPRIZE = 1064, HOUSETELEPORTPRIZE = 20; //Variables to store the prizes, Changeable via Optional Config
     
    class HouseNPC : public GossipScript
    {
    public:
        void GossipHello(Object * pObject, Player* plr, bool AutoSend)
        {
            GossipMenu *menu;
            objmgr.CreateGossipMenuForPlayer(&menu, pObject->GetGUID(), 1, plr);
    
            if(!plr->CombatStatus.IsInCombat())
            {
                //Merge the House prize with the menu options.
                char m_1[512], m_2[512];
                snprintf(m_1, 512, "Buy a house.        %s g", HOUSEPRIZE);
                snprintf(m_2, 512, "Take me to my house %s g", HOUSETELEPORTPRIZE);
                //Add the options..
                menu->AddItem(1, m_1, 1);
                menu->AddItem(2, m_2, 2);
            }
            else
                plr->BroadcastMessage("I don't want to talk to you when you're in combat.");
     
            if(AutoSend)
               menu->SendTo(plr);
        };
    
        void GossipSelectOption(Object * pObject, Player* plr, uint32 id, uint32 intId, const char * code)
        {
           switch(intId)
           {
           case 1: //The player wants a house
                {
                    QueryResult * res = CharacterDatabase.Query("SELECT * FROM houses WHERE ownerguid = %u", plr->GetGUID());
                    if(res != NULL) //Appearantly the player alredy have a house.
                    {
                        plr->BroadcastMessage("You do alredy have a house.");
                        plr->Gossip_Complete();
                        return;
                    }
                    //Hmm, a House do also have a prize.
                    uint32 player_money = plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
                    if(player_money < (HOUSEPRIZE * 10000))
                    {
                        plr->BroadcastMessage("You don't afford a house.");
                        plr->Gossip_Complete();
                        return;
                    }
                    //Remove the money.
                    plr->SetUInt32Value(PLAYER_FIELD_COINAGE, (player_money - (HOUSEPRIZE * 10000)));
                    //Give the house.
                    CharacterDatabase.Execute("INSERT INTO houses VALUES(%u, 242.284, 0.74529, 1.75938, 598)", plr->GetGUID());
                    plr->BroadcastMessage("Congratulations, you just bought a house.");
                    plr->Gossip_Complete();
                }break;
     
           case 2: //Teleport to your house
               {
                   QueryResult * res = CharacterDatabase.Query("SELECT * FROM houses WHERE ownerguid = %u", plr->GetGUID());
                   if(res == NULL)
                   {
                       plr->BroadcastMessage("Sorry, you don't have a house.");
                       plr->Gossip_Complete();
                       return;
                   }
                   if(res->GetRowCount() > 1)
                   {
                       Log.Error("HouseSystem", "Report this error to Link_S of MMOwned : received to many rows out of query.");
                       plr->BroadcastMessage("Error occured. Operation aborted.");
                       return;
                   }
                   //Now draw the money, so the player don't get pissed off when he loses money and don't get teleported.
                   uint32 player_money = plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
                   if(player_money < (HOUSEPRIZE * 10000))
                   {
                       plr->BroadcastMessage("You don't afford to teleport to your house.");
                       plr->Gossip_Complete();
                       return;
                   }
                   //Just some variables for teleportation, makes better structure.
                   float x, y, z;
                   uint32 mapid;
                   Field * f = res->Fetch();
                   x = f[1].GetFloat();
                   y = f[2].GetFloat();
                   z = f[3].GetFloat();
                   mapid = f[4].GetUInt32();
                   //Now teleport the player to their house.
                   plr->EventTeleport(mapid, x, y, z);
                   plr->Gossip_Complete();
               }break;
           }
        };
     
        void Destroy()
        {
            delete this;
        };
    };
     
    void SetupHouseNPC(ScriptMgr * mgr)
    {
        HOUSEPRIZE = (uint32)Config.OptionalConfig.GetIntDefault("HouseSystem", "HousePrize", 1064);
        HOUSETELEPORTPRIZE = (uint32)Config.OptionalConfig.GetIntDefault("HouseSystem", "HouseTeleportationPrize", 20);
        if((HOUSEPRIZE < 0) || (HOUSETELEPORTPRIZE < 0))
        {
            Log.Error("HouseSystem", "HousePrize and HouseTeleportationPrize in Optional Config can't be under 0.");
            return;
        }
        GossipScript * gs = (GossipScript*) new HouseNPC();
        mgr->register_gossip_script(160000, gs);
    };
    Here is the house table, execute this in the same database as your characters.
    Code:
    --
    -- Table structure for table `houses`
    --
     
    DROP TABLE IF EXISTS `houses`;
    CREATE TABLE IF NOT EXISTS `houses` (
      `ownerguid` int(6) unsigned NOT NULL DEFAULT '0',
      `posX` float NOT NULL DEFAULT '0',
      `posY` float NOT NULL DEFAULT '0',
      `posZ` float NOT NULL DEFAULT '0',
      `mapId` int(10) unsigned NOT NULL DEFAULT '0',
      PRIMARY KEY (`ownerguid`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='House System structure' AUTO_INCREMENT=944 ;


    Here is the Additional Npc's for the house decoration, but I suggest you make a unique decoration style in your house.
    Code:
    --HOUSE PART
     
    INSERT INTO creature_spawns
    VALUES
       (6152980, 7733, 598, 263.153, 0.0362612, 1.23726, 3.10861, 0, 7346, 474, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
     
    INSERT INTO creature_spawns
    VALUES
       (6152981, 2456, 598, 274.185, -2.88463, 1.91083, 2.83921, 0, 1436, 814, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
     
    INSERT INTO recall
    VALUES
       (836, 'house', 598, 242.284, 0.74529, 1.75938);
     
    INSERT INTO creature_names
    VALUES
       (160000, 'Guild House NPC', 'Handles guild houses', '', 0, 0, 0, 4, 0, 0, 24905, 24905, 0, 0, 1, 1, 1, 0);
     
    INSERT INTO creature_proto
    VALUES
       (160000, 80, 80, 35, 1000, 1000, 1000, 1, 1, 150, 0, 5000, 6000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 360000, 1500, 0, 0, 0, 0, 0, 0, 1, 1, '0', 0, 0, 0, 0, 2.5, 8, 14, 0, 0, 0, 0, 0, 0, 0);

    You could either execute the query up there, or you could make your own custom House Npc. Just remember to change the NpcId in the code also.

    NOTE: I haven't tested the v.2 version, please report all bugs to me.

    Credits
    Link_S - I made it.
    Last edited by Link_S; 05-13-2009 at 11:25 AM. Reason: Updated to version 2.

    [Release] House System
  2. #2
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The one thing I noticed, is that it send every player to 1 house. Maybe some more explanation would be nice. Like, what does this actually do? For instance...
    Life Puzzler WoW - Website | Forums

  3. #3
    kaato's Avatar Member
    Reputation
    12
    Join Date
    Dec 2007
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    eh ?
    what the hell is this?

  4. #4
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Gastric, note: the house is in a instance. So player's won't see each other

  5. #5
    tkon's Avatar Member
    Reputation
    1
    Join Date
    Jul 2007
    Posts
    51
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome idea~ Wonder how it works in action ><

  6. #6
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It actually works .. ^^

  7. #7
    Edude's Avatar Member
    Reputation
    98
    Join Date
    Jul 2008
    Posts
    406
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    uuuuhhhhhh EPIC, +Rep

    Opps need to spread some, sorry

  8. #8
    Pharia's Avatar Active Member
    Reputation
    24
    Join Date
    May 2007
    Posts
    0
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is just epic. I'll try this when I get back to launching a private server. Oh and, +rep for yoo. ^^

  9. #9
    tkon's Avatar Member
    Reputation
    1
    Join Date
    Jul 2007
    Posts
    51
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's great to hear it works. Setting up a private server right now to have some fun w/ this.

  10. #10
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    150/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    It's good to know you finnaly finished Doesn't look at all as complicated as you made it sound on msn I've been waiting for a Guild House system (as back when i started all I saw was people saying guild houses is impossible to do without a gamemaster helping every 5 seconds). It's very nice but as Gastric said, you need to sell the product. Tell us what it does, how it works, post some screenshots, why this is better than the gm versions, what do you need to do. +Rep

  11. #11
    Lilltimmy's Avatar Member
    Reputation
    20
    Join Date
    Jun 2007
    Posts
    275
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well how can i make it able on my server? I know its C++... But everyone says i need to make my own server 100% to make it work.

  12. #12
    the_venom's Avatar Member
    Reputation
    1
    Join Date
    Oct 2007
    Posts
    55
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think to make it Found we Need to insert the housenpc.cpp (with correct mysql logon) in src/world and later compile it with all rev. :P and later execute sql in db

  13. #13
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the feedback.
    Took me a while to figure out how to make this, as the CharacterDatabase didn't work.

  14. #14
    BrantX's Avatar Contributor
    Reputation
    205
    Join Date
    Jul 2007
    Posts
    899
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats pretty niffty.
    +Rep x3.



  15. #15
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very good job with this link. x3 for you.
    Cheese Cake?

Page 1 of 10 12345 ... LastLast

Similar Threads

  1. Epic Core Mod - Trinity Core 2 Player / Guild - Housing System
    By tekkeryole in forum WoW EMU General Releases
    Replies: 1
    Last Post: 09-05-2009, 09:30 PM
  2. Lua Housing System help
    By Confucius in forum WoW EMU Questions & Requests
    Replies: 18
    Last Post: 07-24-2009, 07:47 AM
  3. Compile House System (With pics)
    By Link_S in forum WoW EMU Guides & Tutorials
    Replies: 26
    Last Post: 04-22-2009, 09:13 AM
  4. Arcemu House System
    By xnerdx in forum Programming
    Replies: 0
    Last Post: 03-21-2009, 12:33 PM
All times are GMT -5. The time now is 12:57 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search