mobmap数据库分析与初步构架(2)
MobMap_Position收集代码[code]
function MobMap_ScanTarget()
--获取目标名称
local targetname=UnitName("target");
if(targetname~=nil and targetname~=UNKNOWNOBJECT) then
if(not UnitPlayerControlled("target") and not UnitIsPlayer("target") and not UnitIsDeadOrGhost("target") and (CheckInteractDistance("target", 1) or (UnitReaction("target", "player")~=nil and UnitReaction("target", "player")<5))) then
if(not WorldMapFrame:IsVisible()) then
local moblevel=UnitLevel("target");
if(mobmap_positions[targetname]==nil) then
mobmap_positions[targetname]={};
end
--获取区域名称
local x, y, zonename = MobMap_GetPlayerCoordinates();
if(mobmap_positions[targetname][zonename]==nil) then
mobmap_positions[targetname][zonename]={};
end
--获取等级 最大/最小
if(mobmap_positions[targetname]["min"]==nil) then
mobmap_positions[targetname]["min"]=moblevel;
else
if(moblevel<mobmap_positions[targetname]["min"]) then mobmap_positions[targetname]["min"]=moblevel; end
end
if(mobmap_positions[targetname]["max"]==nil) then
mobmap_positions[targetname]["max"]=moblevel;
else
if(moblevel>mobmap_positions[targetname]["max"]) then mobmap_positions[targetname]["max"]=moblevel; end
end
--获取坐标
if(mobmap_positions[targetname][zonename][x.."/"..y]==nil) then
mobmap_positions[targetname][zonename][x.."/"..y]=1;
if(mobmap_debug) then MobMap_DisplayMessage("已找到"..targetname.."在区域"..zonename.."于"..x.." / "..y); end
end
end
end
end
end[/code]
根据收集代码分析得出
[table=50%][tr][td]TargetName
[/td][/tr][tr][td]ZoneName[/td][/tr][tr][td]ZonePosition[/td][/tr][tr][td]TargetLevelMax[/td][/tr][tr][td]TargetLevelMin[/td][/tr][/table] mobmap_quests
[code]
mobmap_original_AcceptQuest=nil;
function MobMap_HookAcceptQuest()
mobmap_original_AcceptQuest=AcceptQuest;
AcceptQuest=MobMap_AcceptQuest;
end
function MobMap_AcceptQuest(...)
MobMap_ScanQuest();
mobmap_original_AcceptQuest(...);
end
function MobMap_ScanQuest()
if(not QuestFrame:IsVisible()) then return; end
local title=MobMap_FilterQuestTitle(GetTitleText());
local objective=MobMap_GetOriginalQuestText(GetObjectiveText());
local npcname=MobMap_GetQuestGiver();
local zonename=GetRealZoneText();
local playerfaction=UnitFactionGroup("player");
if(title==nil or objective==nil or npcname==nil) then return; end
local completetitle=title;
local counter=0;
while(mobmap_quests[completetitle]~=nil) do
if(mobmap_quests[completetitle].obj==objective) then
return;
end
counter=counter+1;
completetitle=title.."|"..counter;
end
mobmap_quests[completetitle]={obj=objective, level=0, npc=npcname, zone=zonename, group="solo", faction=playerfaction};
MobMap_QuestMonitor_ClearData();
mobmap_monitor_quest.action="newquest";
mobmap_monitor_quest.timestamp=MobMap_Monitor_GetTimestamp();
mobmap_monitor_quest.title=completetitle;
end
function MobMap_GetOriginalQuestText(str)
if(str==nil) then return ""; end
str=string.gsub(str,UnitName("player").."([%s%.,:;%(%)%!%-%?'])","$N%1");
str=string.gsub(str,UnitClass("player").."([%s%.,:;%(%)%!%-%?'])", "$C%1");
str=string.gsub(str,string.lower(UnitClass("player")).."([%s%.,:;%(%)%!%-%?'])", "$c%1");
str=string.gsub(str,UnitRace("player").."([%s%.,:;%(%)%!%-%?'])","$R%1");
str=string.gsub(str,string.lower(UnitRace("player")).."([%s%.,:;%(%)%!%-%?'])","$r%1");
return str;
end
function MobMap_ScanQuestLog()
if(mobmap_monitor_quest.timestamp==nil) then return; end
MobMap_QuestMonitor_CheckForTimeout(2);
if(mobmap_monitor_quest.title==nil or mobmap_monitor_quest.action~="newquest") then return; end
local quest=mobmap_quests[mobmap_monitor_quest.title];
if(quest==nil) then return; end
local objective, level, tag, time = MobMap_GetQuestInfoFromQuestLog(mobmap_monitor_quest.title);
if(objective==nil) then return; end
if(MobMap_GetOriginalQuestText(objective)==quest.obj) then
quest.group=tag;
quest.level=level;
quest.time=time;
MobMap_QuestMonitor_ClearData();
end
end
mobmap_original_GetQuestReward=nil;
function MobMap_HookGetQuestReward()
mobmap_original_GetQuestReward=GetQuestReward;
GetQuestReward=MobMap_GetQuestReward;
end
function MobMap_GetQuestReward(...)
MobMap_FinishQuest();
mobmap_original_GetQuestReward(...);
end
function MobMap_FinishQuest()
if(not QuestFrame:IsVisible()) then return; end
local title=MobMap_FilterQuestTitle(GetTitleText());
local objectiveText=MobMap_GetQuestInfoFromQuestLog(title);
if(objectiveText==nil) then return; end
local objective=MobMap_GetOriginalQuestText(objectiveText);
local npcname=MobMap_GetQuestGiver();
if(title==nil or objective==nil or npcname==nil) then return; end
local completetitle=title;
local counter=0;
local quest=nil;
while(mobmap_quests[completetitle]~=nil) do
if(mobmap_quests[completetitle].obj==objective) then
quest=mobmap_quests[completetitle];
break;
end
counter=counter+1;
completetitle=title.."|"..counter;
end
if(quest==nil) then
mobmap_quests[completetitle]={};
quest=mobmap_quests[completetitle];
quest.obj=objective;
end
quest.endnpc=npcname;
MobMap_QuestMonitor_ClearData();
mobmap_monitor_quest.timestamp=MobMap_Monitor_GetTimestamp();
mobmap_monitor_quest.action="endquest";
mobmap_monitor_quest.title=completetitle;
end
function MobMap_GetQuestGiver()
local target=UnitName("npc");
if(not UnitExists("npc")) then
if(mobmap_monitor.action=="questitem") then
local item=mobmap_monitor.target;
if(item==nil) then item=""; end
MobMap_Monitor_ClearData();
return "ITEM:"..item;
else
MobMap_SaveObject(target, "quest");
return "OBJECT:"..target;
end
else
return target;
end
end
function MobMap_GetQuestInfoFromQuestLog(title)
local selected=GetQuestLogSelection();
local collapsed={};
local i=1;
local objective=nil;
local unlocalizedQuestTag="solo";
local level=nil;
local time=nil;
while(i<=GetNumQuestLogEntries()) do
local questTitle, questLevel, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily = GetQuestLogTitle(i);
if(questTitle) then
questTitle=MobMap_FilterQuestTitle(questTitle);
if(isHeader) then
if(isCollapsed) then
collapsed[questTitle]=true;
ExpandQuestHeader(i);
end
else
if(questTitle==title) then
SelectQuestLogEntry(i);
_, objective = GetQuestLogQuestText();
unlocalizedQuestTag="solo";
if(questTag==ELITE) then unlocalizedQuestTag="elite"; end
if(questTag==LFG_TYPE_DUNGEON) then unlocalizedQuestTag="dungeon"; end
if(questTag==PVP) then unlocalizedQuestTag="pvp"; end
if(questTag==RAID) then unlocalizedQuestTag="raid"; end
if(questTag==GROUP) then unlocalizedQuestTag="group"; end
if(questTag==DUNGEON_DIFFICULTY2) then unlocalizedQuestTag="heroic"; end
if(isDaily) then unlocalizedQuestTag="daily"; end
level=questLevel;
time=GetQuestLogTimeLeft();
if(time==nil) then time=0; end
end
end
end
i=i+1;
end
i=1;
while(i<=GetNumQuestLogEntries()) do
local questTitle, questLevel, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily = GetQuestLogTitle(i);
if(questTitle) then
questTitle=MobMap_FilterQuestTitle(questTitle);
if(isHeader) then
if(collapsed[questTitle]) then
CollapseQuestHeader(i);
end
end
end
i=i+1;
end
SelectQuestLogEntry(selected);
return objective, level, unlocalizedQuestTag, time;
end
[/code]
收集数据
接任务 进行 标题,NPC 等级 任务形式 接受任务位置 声望. 阵营 奖励
连续的任务 使用
local completetitle = title;
local count = 0;
completetitle = tltle .. "|" .. count
标题 | 步骤数字
同时进行任务obj搜索
完成任务交给NPC 其步骤是与接任务一样的.
获取完成任务获取的声望值 经验值
[table=50%][tr][td] completetitle | count[/td][/tr][tr][td] questObj[/td][/tr][tr][td] quest.Group[/td][/tr][tr][td] quest.Level[/td][/tr][tr][td] npcname[/td][/tr][tr][td] endNpcname[/td][/tr][tr][td] zonename[/td][/tr][tr][td] quest.time[/td][/tr][tr][td] factionname | factionval[/td][/tr][tr][td] xp[/td][/tr][/table]
[color=darkorange]还是很迷糊..... 望大家解答...[/color] 关键信息
mobmapdatabase_metadata
dbinfo
["version"] =
["buildtime"] =
["language"] =
["mobcount"] =
["questcount"] =
["merchantcount"] =
["recipecount"] =
服务器产生的数据
ID = Zone 没思路啊 没思路
position的 target zone zoneposition lemax lemin 与metadata进行第一次换算
将zone 换算成 id形式.
页:
[1]