|
Регистрация | Файлы | Правила | Альбомы | Дневники | Справка | Пользователи | Календарь | Поиск | Сообщения за день | Все разделы прочитаны |
Принятые патчи Иногда выкладывают патчи, которые потом в итоге все-таки принимают в ядро.
Повод для гордости. |
|
Опции темы | Поиск в этой теме | Опции просмотра |
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]; |
24.03.2013, 20:11 | #2 |
MaNGOS Dev
Регистрация: 17.11.2011
Сообщений: 99
Сказал(а) спасибо: 35
Поблагодарили 80 раз(а) в 26 сообщениях
|
Did you test both command and condition?
And wasn't there an issue about saving these extra flags? |
24.03.2013, 20:15 | #3 |
YTDB Dev
Регистрация: 06.03.2010
Сообщений: 259
Сказал(а) спасибо: 28
Поблагодарили 280 раз(а) в 136 сообщениях
|
Checked and compiled in the game is running, the output from the world of player status preserves (do not know how they work and whether all checks for data monitoring)
for database(YTDB) Код:
INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`) VALUES ('2073', '34', '1', '0'), ('2074', '34', '0', '0'); REPLACE INTO `locales_gossip_menu_option` (`menu_id`, `id`, `option_text_loc1`, `option_text_loc2`, `option_text_loc3`, `option_text_loc4`, `option_text_loc5`, `option_text_loc6`, `option_text_loc7`, `option_text_loc8`, `box_text_loc1`, `box_text_loc2`, `box_text_loc3`, `box_text_loc4`, `box_text_loc5`, `box_text_loc6`, `box_text_loc7`, `box_text_loc8`) VALUES (10638, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Я больше не хочу получать опыт.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Вы уверены, что хотите отказаться от получения опыта?'), (10638, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Я хочу снова начать получать опыт.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Вы уверены, что хотите снова получать опыт?'); DELETE FROM `dbscripts_on_gossip` WHERE `id` in (101,10638); INSERT INTO `dbscripts_on_gossip` (`id`, `delay`, `command`, `datalong`, `datalong2`, `buddy_entry`, `search_radius`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `comments`) VALUES ('10638', '0', '33', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'stop XP USER'), ('101', '0', '33', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'start XP USER'); REPLACE INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, `condition_id`) VALUES (10638, 0, 16, 'I no longer wish to gain experience.', 1, 1, -1, 0, 10638, 0, 100000, 'Are you certain you wish to stop gaining experience?', 2073), (10638, 1, 16, 'I wish to start gaining experience again.', 1, 1, -1, 0, 101, 0, 100000, 'Are you certain you wish to see again experience?', 2074); Последний раз редактировалось NeatElves; 24.03.2013 в 20:24. |
25.03.2013, 23:26 | #4 |
MaNGOS Dev
Регистрация: 17.11.2011
Сообщений: 99
Сказал(а) спасибо: 35
Поблагодарили 80 раз(а) в 26 сообщениях
|
In [12420] - Thank you
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|
|