|
Принятые патчи Иногда выкладывают патчи, которые потом в итоге все-таки принимают в ядро.
Повод для гордости. |
|
Опции темы | Поиск в этой теме | Опции просмотра |
24.03.2013, 00:58 | #1 |
YTDB Dev
Регистрация: 06.03.2010
Сообщений: 259
Сказал(а) спасибо: 28
Поблагодарили 280 раз(а) в 136 сообщениях
|
[patch] PLAYER_FLAGS_XP_USER_DISABLED
Теория. Для оживления.))
Можно и скриптом, но не интересно... Ввел кондицию и скрипткоманду. Код:
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index c14e791..75617d4 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -267,12 +267,18 @@ Where "A -> B" means that the command is executed from A with B as target. 29 SCRIPT_COMMAND_MODIFY_NPC_FLAGS resultingSource = Creature * datalong=NPCFlags * datalong2= 0x00=toggle, 0x01=add, 0x02=remove + 30 SCRIPT_COMMAND_SEND_TAXI_PATH resultingTarget or Source must be Player * datalong = taxi path id + 31 SCRIPT_COMMAND_TERMINATE_SCRIPT * datalong = search for npc entry if provided * datalong2= search distance * !(data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL): if npc not alive found, terminate script data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: if npc alive found, terminate script * dataint = change of waittime (MILLIESECONDS) of a current waypoint movement type (negative values will decrease time) + 32 SCRIPT_COMMAND_PAUSE_WAYPOINTS resultingSource must be Creature * datalong: 0/1 unpause/pause waypoint movement + +33 SCRIPT_COMMAND_XP_USER source or target with Player + * datalong=bool 0=off, 1=on diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 4e6b2c9..0584beb 100755 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7900,6 +7900,15 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co } return false; } + case CONDITION_XP_USER: + { + switch (m_value1) + { + case 0: return player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_XP_USER_DISABLED); + case 1: return !player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_XP_USER_DISABLED); + } + return false; + } default: return false; } @@ -8299,6 +8308,19 @@ bool PlayerCondition::IsValid(uint16 entry, ConditionType condition, uint32 valu } break; } + case CONDITION_XP_USER: + { + if (value1 > 1) + { + sLog.outErrorDb("XP user condition (entry %u, type %u) has invalid argument %u (must be 0..1), skipped", entry, condition, value1); + return false; + } + + if (value2) + sLog.outErrorDb("XP user condition (entry %u, type %u) has useless data in value2 (%u)!", entry, condition, value2); + + break; + } case CONDITION_NONE: break; default: diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 8ebf3ae..bb2783f 100755 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -391,6 +391,8 @@ enum ConditionType CONDITION_COMPLETED_ENCOUNTER = 31, // encounter_id encounter_id2 encounter_id[2] = DungeonEncounter(dbc).id (if value2 provided it will return value1 OR value2) CONDITION_SOURCE_AURA = 32, // spell_id effindex (returns true if the source of the condition check has aura of spell_id, effIndex) CONDITION_LAST_WAYPOINT = 33, // waypointId 0 = exact, 1: wp <= waypointId, 2: wp > waypointId Use to check what waypoint was last reached + CONDITION_XP_USER = 34, // 0, 1 (0: XP off, 1: XP on) for player 0 + }; enum ConditionSource // From where was the condition called? diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 381539d..5b17792 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2441,6 +2441,9 @@ void Player::GiveXP(uint32 xp, Unit* victim) if (!isAlive()) return; + if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_XP_USER_DISABLED)) + return; + uint32 level = getLevel(); // XP to money conversion processed in Player::RewardQuest diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index 95c5cf5..2e1de9e 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -634,6 +634,8 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } case SCRIPT_COMMAND_PAUSE_WAYPOINTS: // 32 break; + case SCRIPT_COMMAND_XP_USER: // 33 + break; default: { sLog.outErrorDb("Table `%s` unknown command %u, skipping.", tablename, tmp.command); @@ -1681,6 +1683,18 @@ bool ScriptAction::HandleScriptStep() ((Creature*)pSource)->clearUnitState(UNIT_STAT_WAYPOINT_PAUSED); break; } + case SCRIPT_COMMAND_XP_USER: // 33 + { + Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget); + if (!pPlayer) + break; + + if (m_script->xpDisabled.flags) + pPlayer->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_XP_USER_DISABLED); + else + pPlayer->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_XP_USER_DISABLED); + break; + } default: sLog.outError(" DB-SCRIPTS: Process table `%s` id %u, command %u unknown command used.", m_table, m_script->id, m_script->command); break; diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h index f50d80c..7ce2d6f 100644 --- a/src/game/ScriptMgr.h +++ b/src/game/ScriptMgr.h @@ -98,6 +98,8 @@ enum ScriptCommand // resSource, resTar // dataint=diff to change a waittime of current Waypoint Movement SCRIPT_COMMAND_PAUSE_WAYPOINTS = 32, // resSource = Creature // datalong = 0: unpause waypoint 1: pause waypoint + SCRIPT_COMMAND_XP_USER = 33, // source or target with Player, datalong = bool (0=off, 1=on) + }; #define MAX_TEXT_ID 4 // used for SCRIPT_COMMAND_TALK @@ -313,6 +315,12 @@ struct ScriptInfo uint32 empty; } pauseWaypoint; + struct // SCRIPT_COMMAND_XP_USER (33) + { + uint32 flags; // datalong + uint32 empty; // datalong2 + } xpDisabled; + struct { uint32 data[2]; |