Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Contributor
    Lbniese's Avatar
    Join Date
    Aug 2009
    Location
    C# Developer
    Posts
    381
    Post Thanks / Like
    Rep Power
    16
    Reputation
    91

    [C++] Guild Housing System v2.0


    Register to remove this ad
    WARNING!
    Script was compiled for Latest Aspire Hearthstone 3_1_0 Branch with shared ptrs
    As is, this is not 'Completely' compatible with ArcEmu, some errors may still occur, if they do please post the errors you recieve on this thread ONLY.

    ##EDIT##
    GUILD HOUSING V.2.0
    UPDATE

    I Spent the better part of the last 3 weeks trying to dig out some old school guild house scripts and hopefully convert those to work for Aspire's shared ptr's on their 3.1.X Branch. After weeks of converting, nothing would work. My NPC's would always crash the realm on talk or option choices. And no matter what I did, after modding the code to safely compile my options were very limited. So I decided to code myself a new Guild House script to work on as a base for my future Guild System which will include a FFA Guild battle system. I've already gone thru some kinks in the script and am very confident this will be a good starting point for any other average coder like myself. I release this to you AC Webians with the hope of inspiring a bit of hope that anybody can code if given a moment to breathe.

    What it does:
    Guild Houses
    Will query the Guild ID of player and cross check with entries in the character database (house table posted below)
    checks if players guild owns an area
    checks if player has enough gold
    if no gold no port to house
    enters in coords based on players gps location (i have some future plans for this - change to actual coords instead of gps function if you want to limit locations)
    Ports to guild house cost 100 gold (1000 * 1000 = 100 gold)

    Q_RESULTS_1 and Q_RESULTS_2 now check to see if Guilds own a Zone
    Q_RESULTS_G_LEADER now checks guild_data table in character DB for guildid, guid, and guildrank
    if all 3 are proper, Only Guild Masters can purchase
    Guilds can now purchase multiple zones
    If a zone is already owned - you cannot purchase
    Now checks correctly in various ways if you are -
    level 10
    in a guild
    Guild Master
    what Zone
    Guild ID
    Player GUID
    In Combat

    Now teleports you to nearest Housing Area if in a Zone that
    Your Guild Controls - If not in a Guild Controlled Zone you cannot port there
    -- Next Stop
    On Owned Zone Entry - If players own a Zone there will be
    an announcement to players if they own / if its available
    and what options are allowed

    Everybody say yay for ownable zones


    G_House.CPP
    Code:
    /*
     * Written by Tekkeryole / AKA / WHOS / Galv
     * Copyright (C)2009 <http://wowtek.servegame.org/> WoWTek Realms
     * Feel free to modify as you wish - Give Credits if you
     * Repost this anywhere else and/or modify and re-release.
     * I will not tolerate Leechers and / or code stealers
     * So for the sake of Open Source, give Credits please.
     * Cheers :)
     */ 
     
     
    #include "StdAfx.h"
    #include "Setup.h"
     
    #ifdef WIN32
    #pragma warning(disable:4305)
    #pragma warning(disable:4101)
     
    #endif
     
     
    #define HOUSE_MANAGER 40014//< Duh, NPC ID >
    #define REQ_COIN 1000 * 1000//< 1000 * 1000 = 100 Gold 
    #define GUILD_MASTER_RANK 0
     
    class SCRIPT_DECL H_MANAGER : public GossipScript
    {
    public:
        void GossipHello(ObjectPointer Ob, PlayerPointer Plr, bool AutoSend);
        void GossipSelectOption(ObjectPointer Ob, PlayerPointer Plr, uint32 Id, uint32 IntId, const char * Code);
        void GossipEnd(ObjectPointer Ob, PlayerPointer Plr);
        void Destroy()
        {
        delete this;
        }
    };
     
    void H_MANAGER::GossipHello(ObjectPointer Ob, PlayerPointer Plr, bool AutoSend)
        {
        GossipMenu * Menu;
        objmgr.CreateGossipMenuForPlayer(&Menu, Ob->GetGUID(), 1, Plr);
     
        if(
        Plr->CombatStatus.IsInCombat())
        {
        Plr->BroadcastMessage("You are in Combat!");
        return;
        }
        if(
        Plr->GetGuildId() == NULL)
        {
        Plr->BroadcastMessage("You are not in a Guild!");
        return;
        }
        if(
        Plr->getLevel() < 10)
        {    
        Plr->BroadcastMessage("You must be level 10.");
        }else{
            Menu->AddItem(1, "Buy this Area.", 1);
            Menu->AddItem(2, "Port me to the nearest Guild Area.", 2);
            Menu->AddItem(3, "Area Options", 3);
        }
        if(AutoSend)
            Menu->SendTo(Plr);
        }
    void H_MANAGER::GossipSelectOption(ObjectPointer Ob, PlayerPointer Plr, uint32 Id, uint32 IntId, const char * Code)
        {
        CreaturePointer    pCreature = (Ob->GetTypeId()==TYPEID_UNIT) ?TO_CREATURE(Ob):NULLCREATURE;
     
        uint32 PLR_COIN = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
     
        if(pCreature==NULLCREATURE)
            return;
        GossipMenu * Menu;
            switch(IntId)
        {
        case 0:
        GossipHello(Ob, Plr, true);
            break;
     
     
    //CASE ONE - BUYING THE HOUSE - DO YOU HAVE THE PRE-REQUISITES FILLED OUT?
        case 1:
        {
            //    SQL HACK CHECK TO SEE IF YOU ARE A GUILD MASTER UNTIL I FIGURE OUT HOW
            //    TO CALL FUNCTION GETGUILDLEADER PROPERLY
        QueryResult * Q_RESULTS_G_LEADER = CharacterDatabase.Query("SELECT * FROM guild_data WHERE guildid = %u AND playerid = %u AND guildRank = %u", Plr->GetGuildId(), Plr->GetGUID(), GUILD_MASTER_RANK);
        if(Q_RESULTS_G_LEADER == GUILD_MASTER_RANK)
            {
            Plr->BroadcastMessage("You are not the Guild Master.");
            Plr->Gossip_Complete();
        return;
        }
        QueryResult * Q_RESULTS_1 = CharacterDatabase.Query("SELECT * FROM House_system WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
        if(Q_RESULTS_1 != NULL)
        {    //ARE YOU SERIOUSLY TRYING TO BUY PROPERTY TWICE?
            Plr->BroadcastMessage("This area has already been purchased.");
            Plr->Gossip_Complete();
        return;
        }
        if(PLR_COIN < (REQ_COIN))
            //REMINDER FOR LATER - ADD IN OPTION TO TELE TO OTHER GUILDS
            //OWNED HOUSE IF ON ZONE - EXTRA CHARGE APPLIES FOR NON OWNERS
     
        {    //YOU NEED TO HAVE A SUBSTANTIAL BREAD FLOW OR THIS HAPPENS
            Plr->BroadcastMessage("You don't have enough gold to Teleport to nearby Guilds Land.");
            Plr->Gossip_Complete();
        return;
        }
        if(Q_RESULTS_1 == NULL)
        {    //MMMM, DATA INSERTION
            //NOW GIVE ME MY MONEY!
            CharacterDatabase.Execute("INSERT INTO House_system VALUES('%u', '%f', '%f', '%f', '%u', '%u')", Plr->GetGuildId(), Plr->GetPositionX(), Plr->GetPositionY(), Plr->GetPositionZ(), Plr->GetMapId(), Plr->GetZoneId());
            Plr->SetUInt32Value(PLAYER_FIELD_COINAGE, (PLR_COIN - (REQ_COIN)));//GOLD REMOVAL
            Plr->BroadcastMessage("Gratz! Your Guild now Owns this area.");    //PLAYER SEES THIS IN CHAT
            Plr->Gossip_Complete();
            }
        }break;
     
    //CASE TWO - READ ALL THE FINE PRINT AND GET ACCESS
        case 2:
        {
        QueryResult * Q_RESULTS_2 = CharacterDatabase.Query("SELECT * FROM House_system WHERE guild_id = %u AND zoneid = %u", Plr->GetGuildId(), Plr->GetZoneId());
        if(Q_RESULTS_2 == NULL)
        {    //EITHER YOU ARE TRYING TO OUTBUY SOMEONE ELSES HOUSE
            //OR YOUR GUILD ALREADY OWNS A HOUSE
            Plr->BroadcastMessage("Your Guild does not own any Land Nearby.");
            Plr->Gossip_Complete();
        return;
        }
        if(Q_RESULTS_2->GetRowCount() > 1)
        {    //OH BEJESUS, ANOTHER MYSQL ERROR
            //BTW - ERROR 421 = BETTER THEN SOBER
            //AND YOU THOUGHT 4:20 WAS SO COOL
            //BY THE TIME 4:21 ROLLS AROUND IM BETTER THEN SOBER
            Plr->BroadcastMessage("Error 421 - Please Report this on the Forums - ");
            Plr->Gossip_Complete();
        return;
        }
        if(PLR_COIN < (REQ_COIN))
        {    //ZOMG NO GOLD?
            Plr->BroadcastMessage("You don't have enough gold to teleport to your house.");
            Plr->Gossip_Complete();
        return;
        }
            float x, y, z;
            uint32 MapID;
            Field * F_RESULT = Q_RESULTS_2->Fetch();
            x = F_RESULT[1].GetFloat();
            y = F_RESULT[2].GetFloat();
            z = F_RESULT[3].GetFloat();
            MapID = F_RESULT[4].GetUInt32();
            Plr->EventTeleport(MapID, x, y, z);
            Plr->Gossip_Complete();
        }break;
     
    //CASE THREE - AVAILABLE HOUSE OPTIONS
    case 3:
        {
        objmgr.CreateGossipMenuForPlayer(&Menu, Ob->GetGUID(), 1, Plr);
            Menu->AddItem(0, "This menu is under construction");
            //WILL FINISH CREATURE SPAWNS AND OBJECT SPAWNS
            //ONCE HOUSE LOCATIONS IN EACH ZONE ARE SET UP
            //UNLESS I CAN FIGURE OUT A BETTER WAY
            Menu->AddItem(1, "Purchase Repair Bot", 4);
            Menu->AddItem(2, "Purchase Furniture", 5);
            Menu->AddItem(3, "Purchase Armor Vendor", 6);
            Menu->AddItem(4, "Purchase Weapon Vendor", 7);
            Menu->AddItem(5, "Teleport List", 8);
            Menu->SendTo(Plr);
                }break;
        //BEGINNING OF CASES
    //case OPEN:
    //    {
    //        Plr->FUNCTION(PARAMETERS);
    //            }break;
     
        }
    };
     
    void H_MANAGER::GossipEnd(ObjectPointer Ob, PlayerPointer Plr)
    {
        GossipScript::GossipEnd(Ob, Plr);
    }
     
    void SetupH_MANAGER(ScriptMgr * mgr)
    {
        GossipScript * H_M = (GossipScript*) new H_MANAGER();
        mgr->register_gossip_script(HOUSE_MANAGER, H_M);
    }
    SETUP.CPP
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    #define SKIP_ALLOCATOR_SHARING 1
    #include <ScriptSetup.h>
     
    extern "C" SCRIPT_DECL uint32 _exp_get_script_type()
    {
            return SCRIPT_TYPE_MISC;
    }
     
    extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
    {
        SetupH_MANAGER(mgr);
    }
     
    #ifdef WIN32
     
    BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved )
    {
        return TRUE;
    }
     
    #endif
    SETUP.H
    Code:
    #ifndef INSTANCE_SCRIPTS_SETUP_H
    #define INSTANCE_SCRIPTS_SETUP_H
     
    void SetupH_MANAGER(ScriptMgr * mgr);
     
    #endif
    SQL Table to be loaded into Character Database
    Code:
    DROP TABLE IF EXISTS "house_system";
     
    CREATE TABLE "house_system" (
      "guild_id" 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',
      "zoneid" int(10) unsigned NOT NULL COMMENT 'zone id',
      PRIMARY KEY ("zoneid")
    );
    GUILD HOUSE MANAGER
    Code:
    INSERT INTO `creature_names` (`entry`, `name`, `subname`, `info_str`, `Flags1`, `type`, `family`, `rank`, `unk4`, `spelldataid`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `civilian`, `leader`) VALUES ('40014', 'Housing Manager', 'Guild House Manager', '', '1', '7', '0', '4', '0', '0', '22220', '0', '0', '0', '1.0', '1.0', '0', '1');INSERT INTO `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `item1`, `item2`, `item3`, `RespawnTime`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `resistance7`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `death_state`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `auraimmune_flag`, `vehicle_entry`, `CanMove`) VALUES ('40014', '80', '80', '35', '50000', '50000', '0', '1.0', '3', '3000', '0', '20000.0', '20000.0', '0', '0.0', '0.0', '0', '0', '0', '30000', '1', '1', '1', '1', '1', '1', '0', '0.0', '0.0', '0', '1', '0', '0', '0', '2.5', '8.0', '14.0', '0', '0', '-1', '7');



    Credits by Tekkeryole




    › See More: [C++] Guild Housing System v2.0
    Last edited by Lbniese; 23-09-09 at 08:35 AM.



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Banned

    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    652
    Post Thanks / Like
    Rep Power
    0
    Reputation
    103
    Put credits in. I know for a fact you didn't create this. I've seen this a while back...

  4. #3
    Elite Member
    Dimman's Avatar
    Join Date
    Apr 2009
    Posts
    1,091
    Post Thanks / Like
    Rep Power
    21
    Reputation
    319
    Wrong section
    No credits written
    No touching please.

  5. #4
    Contributor
    Lbniese's Avatar
    Join Date
    Aug 2009
    Location
    C# Developer
    Posts
    381
    Post Thanks / Like
    Rep Power
    16
    Reputation
    91
    ohh ye, it needs to be in the scripting > C++ section...
    and credits its some1 from ac-web and i will add it

  6. #5
    Elite Member
    Dimman's Avatar
    Join Date
    Apr 2009
    Posts
    1,091
    Post Thanks / Like
    Rep Power
    21
    Reputation
    319
    good . you deserv a ""
    No touching please.

  7. #6
    Contributor
    enegue's Avatar
    Join Date
    Aug 2008
    Location
    Before God
    Posts
    715
    Post Thanks / Like
    Rep Power
    17
    Reputation
    106
    Agreed. Add credits before cookies are given!
    me if I have helped you in anyway ^^ Example: Sharing a repack, answering questions... Well you know the rest xD. As long as I help you!

  8. #7
    Contributor
    Lbniese's Avatar
    Join Date
    Aug 2009
    Location
    C# Developer
    Posts
    381
    Post Thanks / Like
    Rep Power
    16
    Reputation
    91
    i found them, there was credits just in the c++ script
    i will add it in the thread

  9. #8
    Contributor
    enegue's Avatar
    Join Date
    Aug 2008
    Location
    Before God
    Posts
    715
    Post Thanks / Like
    Rep Power
    17
    Reputation
    106
    Saw this exact script on another emulation forum
    me if I have helped you in anyway ^^ Example: Sharing a repack, answering questions... Well you know the rest xD. As long as I help you!

  10. #9
    Banned

    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    652
    Post Thanks / Like
    Rep Power
    0
    Reputation
    103
    I dont think he should be given any rep to be honest. All he does is take other peoples posts, copy and paste them for rep.

  11. #10
    Contributor
    enegue's Avatar
    Join Date
    Aug 2008
    Location
    Before God
    Posts
    715
    Post Thanks / Like
    Rep Power
    17
    Reputation
    106

    Register to remove this ad
    It's ok to do so but once in a while...
    me if I have helped you in anyway ^^ Example: Sharing a repack, answering questions... Well you know the rest xD. As long as I help you!

 

 
Page 1 of 2 12 LastLast

Visitors found this page by searching for:

trinity c check for guild on teleport

ac web guild house system

script teleporter guild house ac-web

guild house ac-web

guildhouse c acweb

SEO Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 03:21 PM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org