Jump to content

Lunera

Members
  • Posts

    5
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Lunera's Achievements

Newbie

Newbie (1/3)

0

Reputation

  1. I tried that method and for some reason, I could not get it to work. Ah well.
  2. 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.....
  3. 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.
  4. EmpleyeeID != EmployeeID, Problem solved. 90% of my programming issues are typos and mislaid semicolons.
  5. * 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