Jump to content

Lunera

Members
  • Posts

    5
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by Lunera

  1. MaNGOS is a learning project, if you download and run a precompiled repack.. what do you learn? nothing...

    HEAR HEAR.

    I'm on the learning side of the fence, and I get a lot of people asking me for help with setting up their repacks. Telling me they run navicat DB now instead of heidi... :huh:

    I send them ebooks; SQL for Dummies and PHP 5 for Dummies. I've stopped helping, but rather give good shoves in a general direction.

    Give a man a fish.....

  2. The only reason I have done it this way, is because I've used it before, so I know it works. It's a slightly modified ArcScript.

    Now what I wonder is, wasn't there something in place at some point to use the mini-game gameobject type? That is 27 I believe. That method, from what I understand used the data fields for coordinates. If THOSE are cached at launch, then I could implement that method.

    Does anybody have any info on this?

    I'm not expecting this to make it into the master branch, or any branch even, I'm just doing this for the fun of the coding and seeing how things work.

  3. Hy i have a lithel confusion problem here i use Microsoft SQL 2008 and i have as strange behavior patern, and some problem's i am a beginner, and have some starting probčlems and my boog SQL from begining dosent give me much advise on this one, so im asking you guys if you can tell me.

    Ok my absence of experience is at faul i think, i crated a table

    USE Accounting

    CREATE TABLE Orders

    (

    OrderID int IDENTITY NOT NULL PRIMARY KEY,

    CustomerNo int NOT NULL FOREIGN KEY REFERENCES Customers(CustomerNo),

    OrderDate smalldatetime NOT NULL,

    EmpleyeeID int NOT NULL

    )

    and when AFTER i made some changes to the table, i try to execute the following query :

    USE Accounting

    ALTER TABLE Orders

    ADD CONSTRAINT FK_EmployeeCreatsOrder

    FOREIGN KEY (EmployeeID) REFERENCES Employees (EmployeeID)

    i get the error

    --Msg 1769, Level 16, State 1, Line 112

    --Foreign key 'FK_EmployeeCreatsOrder' references invalid column 'EmployeeID' in referencing table 'Orders'.

    --Msg 1750, Level 16, State 0, Line 112

    --Could not create constraint. See previous errors.

    BUT the funy thing is it is writen in teh book to write as it is writen above,,,,, when i do it over the SQL menagment studio ovar a diagram IT WORKS, so myy gues is im using a an old book 2005 and useing 2oo8 server,,, were there eny changes which result un failure of this query,,,

    MOUST funy thing is, when i delelte tge staded above constrain and recreate it over the given query after i freshly restarted the server (power button on my laptop) the query gets trough,, can somoen hep me?:confused:

    2.

    When i make a table :

    CREATE TABLE OrderDetails

    (

    OrderID int NOT NULL,

    PartNO varchar(10) NOT NULL,

    Description varchar (25) NOT NULL,

    UnitPrice money NOT NULL,

    Qty int NOT NULL

    CONSTRAINT FKOrderDetails Primary key (OrderID, PartNO),

    FOREIGN KEY (OrderID) REFERENCES Orders(OrderID)

    ON UPDATE NO ACTION

    ON DELETE CASCADE

    )

    and, enter some data and want to delete the constrain on delete cascade i know it is handled by FK constrains,,,, but the model gous like this

    ALTER TABLE TableName

    ADD CONSTRAINT ConstraintName FOREIGN KEY (FieldNameInChildTable)

    REFERENCES ParentTable (FieldNameInParentTable)

    First question,, the ON DELETE CASCADE handels the whole table,,, so cold somoen give me an example of the name of the constraint PLESE xD^_^

    THY in advise...

    EmpleyeeID != EmployeeID, Problem solved. 90% of my programming issues are typos and mislaid semicolons.

  4. * What bug does the patch fix? What features does the patch add?

    Makes for easy custom portals

    * For which repository revision was the patch created?

    8171

    * Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

    no

    * Who has been writing this patch? Please include either forum user names or email addresses.

    Lunera(me)

    diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
    index 56a5d06..50a0ed6 100644
    --- a/src/game/GameObject.cpp
    +++ b/src/game/GameObject.cpp
    @@ -35,6 +35,9 @@
    #include "InstanceData.h"
    #include "BattleGround.h"
    #include "Util.h"
    +
    
    GameObject::GameObject() : WorldObject()
    {
    @@ -966,7 +969,36 @@ void GameObject::Use(Unit* user)
                if(user->GetTypeId()==TYPEID_PLAYER)
                {
                    Player* player = (Player*)user;
    -
    +// Probably not doing this right -- Lunera
    +                                       float xt,yt,zt,orientationt;
    +                               uint32 mapidt;
    +
    +                               QueryResult *result = NULL;
    +                               std::ostringstream qry;
    +                                       qry << "SELECT * FROM gameobject_teleports WHERE entry = " << info->id;
    +                               result = WorldDatabase.Query(qry.str( ).c_str( ));
    +                               if(result != NULL)
    +                               {
    +                                               Field *fields = result->Fetch();
    +                                               uint32 required_level = fields[6].GetInt32();
    +
    +                                               if ((required_level == 0) || (required_level <= player->getLevel()))
    +                                               {
    +                                                       mapidt = fields[1].GetInt32();
    +                                                       xt = fields[2].GetFloat();
    +                                                       yt = fields[3].GetFloat();
    +                                                       zt = fields[4].GetFloat();
    +                                                       orientationt = fields[5].GetFloat();
    +
    +                                                       player->TeleportTo(mapidt, xt, yt, zt, orientationt, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET);
    +                                               }
    +                                               else if (required_level != 0)
    +                                               {
    +                                               }
    +                                   delete result;
    +                               }
    +               //I'm done here -- Lunera
                    // show page
                    if(info->goober.pageId)
                    {
    
    
    

    This was inspired by another (open source)cores method. Okay, more like copypasta, but I had to change some of it to work with MaNGOS. I'm not taking any credit for anything other than the edits.

    There is also some SQL to make it work.

    # Table structure for table 'gameobject_teleports'
    #
    
    CREATE TABLE "gameobject_teleports" (
     "entry" int(10) unsigned NOT NULL AUTO_INCREMENT,
     "mapid" int(10) unsigned NOT NULL,
     "x_pos" float NOT NULL,
     "y_pos" float NOT NULL,
     "z_pos" float NOT NULL,
     "orientation" float NOT NULL,
     "required_level" int(10) unsigned NOT NULL,
     PRIMARY KEY ("entry")
    ) AUTO_INCREMENT=800213 /*!40100 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC COMMENT='Optional table to create custom portals'*/;
    

    To implement this, make a gameobject with a type of 10 (goober), and make a matching entry in the gameobject_teleports table with entry being the id of the gameobject. The other coloumns are the destination and required level to use the portal. This can work with any gameobject display. If there is no entry in the gameobject_teleport table, the rest of the goober handler executes. There is no need to reload the table as it is accesed as needed so all changes made in the DB are immediate.

    -still to work on: Returning a message to the player if their level is too low.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use