Changeset 1142

Show
Ignore:
Timestamp:
02/01/2010 11:56:21 PM (5 weeks ago)
Author:
Hypersniper
Message:

ADDED: Plyr:AddAchievement(ID), Plyr:RemoveAchievement(ID), Plyr:HasAchievement(ID).

Location:
Trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • Trunk/LUA_ENGINE_COMMANDS.txt

    r1136 r1142  
    323323Unit:SetPower(amount, [type])                   +- Sets Unit's power. type is as above. 
    324324 
    325 Unit:CreateCustomWaypoint(id,x,y,z,o,waittime,movementflags,modelid) +- This command creates waypoints for the creature GIVEN an id rather than generated one. movementflags are 0x0 for walk, 0x100 for run ... etc the rest is self explanatory 
    326 Unit:DeleteWaypoints()                          +- Does just, erases all waypoints the unit has. 
     325Unit:CreateCustomWaypoint(id,x,y,z,o,waittime,movementflags,modelid) +- Same as CreateWaypoint, but allows for set ID instead of incremental. 
     326Unit:DeleteWaypoints()                          +- Erases all waypoints that Unit has. 
    327327Plyr:LearnSpells(lua_table)                     +- lua_table must be an array of spell ids. The function will teach Plyr each of those spells. 
    328328 ex.  
     
    331331    player:LearnSpells(spellz)  
    332332   end 
     333Plyr:AddAchievement(ID)                         +- Makes Plyr complete an achievement with the specified ID. Returns true on success, false on failure. 
     334Plyr:RemoveAchievement(ID)                      +- Removes the achievement with the specified ID from Plyr. 
     335Plyr:HasAchievement(ID)                         +- Returns true if Plyr has completed the specified achievement, false otherwise. 
    333336 
    334337:Packets 
     
    401404 
    402405:QUERYRESULT 
    403 QResult:GetColumn(colNum)                       +- Returns a field object (see below) based on the column number given, errors if colNum is greater than max columns 
     406QResult:GetColumn(colNum)                       +- Returns a field object (see below) based on the column number given. Errors if colNum is greater than max columns 
    404407 e.x Usage:  
    405408   local qres = WorldDBQuery(...)  
  • Trunk/src/LuaEngine/FunctionTables.h

    r1136 r1142  
    479479                { "GetEquippedItemBySlot", &luaUnit::GetEquippedItemBySlot }, 
    480480                { "GetGuildMembers", &luaUnit::GetGuildMembers }, 
    481                 //{ "AddAchievement", &luaUnit::AddAchievement }, 
    482                 //{ "RemoveAchievement", &luaUnit::RemoveAchievement }, 
    483                 //{ "HasAchievement", &luaUnit::HasAchievement }, 
     481                { "AddAchievement", &luaUnit::AddAchievement }, 
     482                { "RemoveAchievement", &luaUnit::RemoveAchievement }, 
     483                { "HasAchievement", &luaUnit::HasAchievement }, 
    484484                { "RemoveArenaPoints", &luaUnit::RemoveArenaPoints}, 
    485485                { "TakeHonor", &luaUnit::TakeHonor}, 
  • Trunk/src/LuaEngine/UnitFunctions.h

    r1137 r1142  
    57025702        } 
    57035703 
    5704         /*int AddAchievement(lua_State * L, Unit * ptr) 
     5704        int AddAchievement(lua_State * L, Unit * ptr) 
    57055705        { 
    57065706                CHECK_TYPEID(TYPEID_PLAYER); 
    57075707                int32 achievementID = luaL_checkint(L,1); 
    5708                 Player * plr = ((Player*)ptr); 
    5709                 plr->GetAchievementMgr().GMCompleteAchievement(NULL, achievementID); 
     5708                Player * plr = TO_PLAYER(ptr); 
     5709                if (plr->GetAchievementMgr().GMCompleteAchievement(NULL, achievementID)) 
     5710                        lua_pushboolean(L, 1); 
     5711                else 
     5712                        lua_pushboolean(L, 0); 
    57105713                return 1; 
    57115714        } 
     
    57155718                CHECK_TYPEID(TYPEID_PLAYER); 
    57165719                int32 achievementID = luaL_checkint(L,1); 
    5717                 ((Player*)ptr)->GetAchievementMgr().GMResetAchievement(achievementID); 
    5718                 return 1; 
     5720                TO_PLAYER(ptr)->GetAchievementMgr().GMResetAchievement(achievementID); 
     5721                return 0; 
    57195722        } 
    57205723 
     
    57235726                CHECK_TYPEID(TYPEID_PLAYER); 
    57245727                uint32 achievementID = luaL_checkint(L,1); 
    5725                 lua_pushboolean(L, ((Player*)ptr)->GetAchievementMgr().HasCompleted(achievementID) ? 1 : 0); 
    5726                 return 1; 
    5727         }*/ 
     5728                lua_pushboolean(L, TO_PLAYER(ptr)->GetAchievementMgr().HasCompleted(achievementID) ? 1 : 0); 
     5729                return 1; 
     5730        } 
    57285731 
    57295732        int GetAreaId(lua_State * L, Unit * ptr)