顺势而为47 发表于 2020-3-31 23:30:43

雷霆传奇H5-合区教程-合区方法-合区代码




actor_plat_slave替换为二区数据库名
index_slave替换为二区服务器ID
index_master替换为一区服务器ID
替换完成后
在一区数据库执行


注意:是把2区合进1区
如果1区合进2区就反着来


合区代码:

#从actor_plat_slave导入角色二进制数据
insert into actorbinarydata (select * from actor_plat_slave.actorbinarydata);
#从actor_plat_slave导入角色数据
insert into actors (select * from actor_plat_slave.actors where serverindex=index_slave);
#从actor_plat_slave导入角色物品数据
insert into items (select * from actor_plat_slave.items);
#从actor_plat_slave导入角色脚本数据
insert into actorvariable (select * from actor_plat_slave.actorvariable);

#从actor_plat_slave导入mail
insert into mails (select * from actor_plat_slave.mails);
#从actor_plat_slave导入角色列表
insert into roles (select * from actor_plat_slave.roles);

#从actor_plat_slave导入旧的角色名
insert into actoroldname (select * from actor_plat_slave.actoroldname where serverindex=index_slave);

#从actor_plat_slave导入工会列表
insert into guildlist (select * from actor_plat_slave.guildlist where serverindex=index_slave);

#导入工会信息
insert into actorguild (select * from actor_plat_slave.actorguild);
insert into guildlog (select * from actor_plat_slave.guildlog);
insert into guildchat (select * from actor_plat_slave.guildchat);
insert into guildstorelog (select * from actor_plat_slave.guildstorelog);

#从actor_plat_slave导入好友列表
insert into friends (select * from actor_plat_slave.friends);

#导入拍卖行信息
insert into auction (select * from actor_plat_slave.auction where serverid=index_slave);

#----------------------------------------------------------------

#更新主服actor_plat_master全服邮件ID为0, 清除主服actor_plat_master的全服邮件
TRUNCATE globalmails;
#TRUNCATE actorservermail;

#检查修正角色名重复现象……
create temporary table tmp_charname SELECT actorname,actorid FROM actors;
alter table tmp_charname add index tmp_charname(actorname);
ALTER TABLE actors add column tmpmailfile int default 0;
UPDATE actors SET actorname=CONCAT(actorname,''), tmpmailfile=1 WHERE
(actorname in (SELECT actorname FROM tmp_charname where actors.actorid <> tmp_charname.actorid)) AND (serverindex=index_slave);
insert into offlinemails (`actorid`, `head`, `context`, `file0_type`, `file0_id`, `file0_num`) (select actorid,"合服改名卡补发","尊敬的勇士,由于你的名称和其他勇士重复,特补发改名卡一张,请在附件中领取。",1,450001,1 from actors where actors.tmpmailfile = 1);
alter table actors drop column tmpmailfile;
drop table tmp_charname;

create temporary table tmp_guildname SELECT guildname,guildid FROM guildlist;
alter table tmp_guildname add index tmp_guildname(guildname);
ALTER TABLE guildlist add column tmpmailfile int default 0;
UPDATE guildlist SET guildname=CONCAT(guildname,''), tmpmailfile=1 WHERE
(guildname in (SELECT guildname FROM tmp_guildname where guildlist.guildid <> tmp_guildname.guildid)) AND (serverindex=index_slave);
UPDATE guildlist SET changenamenum=1 WHERE tmpmailfile=1 AND changenamenum <= 1;
alter table guildlist drop column tmpmailfile;
drop table tmp_guildname;

#检查修正旧角色名重复现象……
create temporary table tmp_charoldname SELECT oldname,actorid FROM actoroldname;
alter table tmp_charoldname add index tmp_actoroldname(oldname);
UPDATE actoroldname SET oldname=CONCAT(oldname,'') WHERE
(oldname in (SELECT oldname FROM tmp_charoldname where actoroldname.actorid <> tmp_charoldname.actorid)) AND (serverindex=index_slave);
drop table tmp_charoldname;

ALTER TABLE actors add column tmpmailfile int default 0;
UPDATE actors SET actorname=CONCAT(actorname,''), tmpmailfile=1 WHERE
(actorname in (SELECT oldname FROM actoroldname where actoroldname.actorid <> actors.actorid)) AND (serverindex=index_slave);
insert into offlinemails (`actorid`, `head`, `context`, `file0_type`, `file0_id`, `file0_num`) (select actorid,"合服改名卡补发","尊敬的勇士,由于你的名称和其他勇士重复,特补发改名卡一张,请在附件中领取。",1,450001,1 from actors where actors.tmpmailfile = 1);
alter table actors drop column tmpmailfile;

UPDATE actoroldname SET oldname=CONCAT(oldname,'') WHERE
(oldname in (SELECT actorname FROM actors where actors.actorid <> actoroldname.actorid)) AND (serverindex=index_slave);

#改变角色归属服务器……
update actors set serverindex = index_master where serverindex=index_slave;
#改变帮会归属服务器……
update guildlist set serverindex = index_master where serverindex=index_slave;
#改变拍卖行商品归属服务器……
update auction set serverid = index_master where serverid=index_slave;

#清除小号
drop table if exists cidx;
CREATE TEMPORARY TABLE cidx(`actorid` int not null primary key);
#选出长期没登陆的actorid
#actor_plat_slave的小号
insert into cidx (select actorid from actor_plat_slave.actors where recharge=0 and level<=35 and updatetime<=subdate(now(),interval 30 day));
#改变角色旧名的归属服务器……
update actoroldname set serverindex = index_master where serverindex=index_slave;
#清除二进制数据
delete from actorbinarydata where actorid in (select actorid from cidx);
#清除帮派
delete from actorguild where actorid in (select actorid from cidx);
#清除邮件系统
delete from mails where actorid in (select actorid from cidx);
#清除角色数据
delete from actors where actorid in (select actorid from cidx);
#清除脚本数据
delete from actorvariable where actorid in (select actorid from cidx);
#roles
delete from roles where actorid in (select actorid from cidx);
#物品
delete from items where actorid in (select actorid from cidx);
#清理完成







a283211417 发表于 2020-4-3 04:07:34

我看不错噢 谢谢楼主!

a598112788 发表于 2020-4-4 09:57:57

社区不能没有像楼主这样的人才啊!
页: [1]
查看完整版本: 雷霆传奇H5-合区教程-合区方法-合区代码