08-14-2012, 11:14 PM
UPDATE t_npc SET a_exp = a_exp * 1;
UPDATE t_npc SET a_skill_point = a_skill_point * 1;
UPDATE t_npc SET a_prize = a_prize * 1;
# droptable
UPDATE t_npc SET a_item_percent_0 = a_item_percent_0 * 1;
....;
For gold drop and item drop table there already is the table t_drop_prob.
For EXP/SP I suggest using a temporary table to hold the original EXP/SP, because
Create a temp table to hold the original data
CREATE TABLE IF NOT EXISTS t_rates(
a_index int not null,
a_exp bigint not null,
a_sp int not null
);
-- if table exists it will clear it
DELETE FROM t_rates;
-- inserts new data from t_npc
INSERT INTO t_rates
SELECT a_index, a_exp, a_skill_point from t_npc;
Changing rates is much easier:
-- input data
SET @exp_rate = 1;
SET @sp_rate = 1;
-- restores exp/sp in t_npc to the original
UPDATE t_npc npc, t_rates p SET npc.a_exp = p.a_exp * @exp_rate WHERE npc.a_index = p.a_index;
UPDATE t_npc npc, t_rates p SET npc.a_skill_point = p.a_sp * @sp_rate WHERE npc.a_index = p.a_index;
If you added new NPC to t_npc this will update the rates table:
-- changes exp/sp in t_npc according with exp_rate and sp_rate
UPDATE t_npc npc, t_rates p SET npc.a_exp = p.a_exp WHERE npc.a_index = p.a_index;
UPDATE t_npc npc, t_rates p SET npc.a_skill_point = p.a_sp WHERE npc.a_index = p.a_index;
-- clear the rates table
DELETE FROM t_rates;
-- inserts new data from t_npc
INSERT INTO t_rates
SELECT a_index, a_exp, a_skill_point from t_npc;
Why do this, modifying the t_npc table without a backup its not a good Idea.

