コード例 #1
0
ファイル: BlockStream.cpp プロジェクト: Elfmagi/OpenJK
int CBlock::Write( int member_id, const char *member_data, CIcarus* icarus )
{
	CBlockMember *bMember = new CBlockMember;

	bMember->SetID( member_id );
	
	bMember->SetData( member_data, icarus );
	bMember->SetSize( strlen(member_data) + 1 );

	AddMember( bMember );

	return true;
}
コード例 #2
0
ファイル: Group.cpp プロジェクト: Ghaster/mangos-classic
bool Group::Create(ObjectGuid guid, const char* name)
{
    m_leaderGuid = guid;
    m_leaderName = name;
    m_leaderLastOnline = time(nullptr);

    m_groupType  = isBattleGroup() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL;

    if (m_groupType == GROUPTYPE_RAID)
        _initRaidSubGroupsCounter();

    m_lootMethod = GROUP_LOOT;
    m_lootThreshold = ITEM_QUALITY_UNCOMMON;
    m_masterLooterGuid = guid;
    m_currentLooterGuid = guid;                                             // used for round robin looter


    if (!isBattleGroup())
    {
        m_Id = sObjectMgr.GenerateGroupId();

        Player* leader = sObjectMgr.GetPlayer(guid);

        Player::ConvertInstancesToGroup(leader, this, guid);

        // store group in database
        CharacterDatabase.BeginTransaction();
        CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId ='%u'", m_Id);
        CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id);

        CharacterDatabase.PExecute("INSERT INTO groups(groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid) "
                                   "VALUES('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u')",
                                   m_Id, m_leaderGuid.GetCounter(), m_mainTankGuid.GetCounter(), m_mainAssistantGuid.GetCounter(), uint32(m_lootMethod),
                                   m_masterLooterGuid.GetCounter(), uint32(m_lootThreshold),
                                   m_targetIcons[0].GetRawValue(), m_targetIcons[1].GetRawValue(),
                                   m_targetIcons[2].GetRawValue(), m_targetIcons[3].GetRawValue(),
                                   m_targetIcons[4].GetRawValue(), m_targetIcons[5].GetRawValue(),
                                   m_targetIcons[6].GetRawValue(), m_targetIcons[7].GetRawValue(),
                                   isRaidGroup());
    }

    if (!AddMember(guid, name))
        return false;

    if (!isBattleGroup())
        CharacterDatabase.CommitTransaction();

    _updateLeaderFlag();

    return true;
}
コード例 #3
0
bool Guild::create(uint64 lGuid, std::string gname)
{
    std::string rname;
    std::string lName;

    if(!objmgr.GetPlayerNameByGUID(lGuid, lName))
        return false;
    if(objmgr.GetGuildByName(gname))
        return false;

    sLog.outDebug("GUILD: creating guild %s to leader: %u", gname.c_str(), GUID_LOPART(lGuid));

    leaderGuid = lGuid;
    name = gname;
    GINFO = "";
    MOTD = "No message set.";
    guildbank_money = 0;
    purchased_tabs = 0;

    Id = objmgr.GenerateGuildId();

    // gname already assigned to Guild::name, use it to encode string for DB
    CharacterDatabase.escape_string(gname);

    std::string dbGINFO = GINFO;
    std::string dbMOTD = MOTD;
    CharacterDatabase.escape_string(dbGINFO);
    CharacterDatabase.escape_string(dbMOTD);

    CharacterDatabase.BeginTransaction();
    // CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid='%u'", Id); - MAX(guildid)+1 not exist
    CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", Id);
    CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid='%u'", Id);
    CharacterDatabase.PExecute("INSERT INTO guild (guildid,name,leaderguid,info,motd,createdate,EmblemStyle,EmblemColor,BorderStyle,BorderColor,BackgroundColor,BankMoney) "
        "VALUES('%u','%s','%u', '%s', '%s', NOW(),'%u','%u','%u','%u','%u','" I64FMTD "')",
        Id, gname.c_str(), GUID_LOPART(leaderGuid), dbGINFO.c_str(), dbMOTD.c_str(), EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, guildbank_money);
    CharacterDatabase.CommitTransaction();

    rname = "Guild Master";
    CreateRank(rname,GR_RIGHT_ALL);
    rname = "Officer";
    CreateRank(rname,GR_RIGHT_ALL);
    rname = "Veteran";
    CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
    rname = "Member";
    CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
    rname = "Initiate";
    CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);

    return AddMember(lGuid, (uint32)GR_GUILDMASTER);
}
コード例 #4
0
ファイル: BlockStream.cpp プロジェクト: DavidZeise/OpenJK
int CBlock::Write( int member_id, vector_t member_data )
{
	CBlockMember *bMember; 

	bMember = new CBlockMember;

	bMember->SetID( member_id );
	bMember->SetData( member_data );
	bMember->SetSize( sizeof(vector_t) );

	AddMember( bMember );

	return true;
}
コード例 #5
0
void
nsXBLContentSink::ConstructMethod(const PRUnichar **aAtts)
{
  mMethod = nsnull;

  const PRUnichar* name = nsnull;
  if (FindValue(aAtts, nsGkAtoms::name, &name)) {
    mMethod = new nsXBLProtoImplMethod(name);
  }

  if (mMethod) {
    AddMember(mMethod);
  }
}
コード例 #6
0
ファイル: RogueGameParty.cpp プロジェクト: yumakmc/cuigame
bool Party::AddMember(const int aid, const RogueGame &roguegame) {
	//めちゃくちゃ例外的な処理 4番目に無理やり冬(すぐ死ぬ)を入れてる
	if (aid == 23) {
		members[3] = make_shared<MyChara>(aid, actionlog, situation);
	}
	else {
		for (int i = 0; i < maxmember; ++i) {
			if (members[i] == NULL) {
				return AddMember(aid, i, roguegame);
			}
		}
	}
	return false;
}
コード例 #7
0
ファイル: Guild.cpp プロジェクト: Artea/mangos-svn
void Guild::create(uint64 lGuid, std::string gname)
{
	Player *pl;
	MemberSlot *newmember;
	std::string rname;

	pl = ObjectAccessor::Instance().FindPlayer(lGuid);
	if(!pl) return;
	
	leaderGuid = lGuid;
	name = gname;
	MOTD = "No message set.";
	
	rname = "Guild Master";
	CreateRank(rname,GR_RIGHT_ALL);
	rname = "Officer";
	CreateRank(rname,GR_RIGHT_ALL);
	rname = "Veteran";
	CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
	rname = "Member";
	CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
	rname = "Initiate";
	CreateRank(rname,GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);

	Log::getSingleton().outDebug("GUILD: creating guild %s to leader:%d", gname.c_str(), leaderGuid);

	
	QueryResult *result = sDatabase.Query( "SELECT MAX(guildId) FROM guilds" );
	if( result )
	{
  		Id = (*result)[0].GetUInt32()+1;
  		delete result;
	}
	else Id = 1;	
	
	if(pl) 
	{
		pl->SetInGuild(Id);
		pl->SetRank( GR_GUILDMASTER	);
	}
	
	newmember = new MemberSlot;
	newmember->guid = leaderGuid;
	newmember->RankId = GR_GUILDMASTER;
	newmember->Pnote = "";
	newmember->OFFnote = "";
	AddMember(newmember);
	SaveGuildToDB();

}
コード例 #8
0
ファイル: BlockStream.cpp プロジェクト: DingoOz/OpenJK
int CBlock::Write( int member_id, vec3_t member_data, CIcarus* icarus )
{
	CBlockMember *bMember; 

	bMember = new CBlockMember;

	bMember->SetID( member_id );
	bMember->SetData( member_data, icarus );
	bMember->SetSize( sizeof(vec3_t) );

	AddMember( bMember );

	return true;
}
コード例 #9
0
ファイル: Guild.cpp プロジェクト: billy1arm/MangosMC
bool Guild::Create(Player* leader, std::string gname)
{
    if (sGuildMgr.GetGuildByName(gname))
        { return false; }

    WorldSession* lSession = leader->GetSession();
    if (!lSession)
        { return false; }

    m_LeaderGuid = leader->GetObjectGuid();
    m_Name = gname;
    GINFO.clear();
    MOTD = "No message set.";
    m_Id = sObjectMgr.GenerateGuildId();

    // creating data
    time_t now = time(0);
    tm local = *(localtime(&now));                          // dereference and assign
    m_CreatedDay   = local.tm_mday;
    m_CreatedMonth = local.tm_mon + 1;
    m_CreatedYear  = local.tm_year + 1900;

    DEBUG_LOG("GUILD: creating guild %s to leader: %s", gname.c_str(), m_LeaderGuid.GetString().c_str());

    // gname already assigned to Guild::name, use it to encode string for DB
    CharacterDatabase.escape_string(gname);

    std::string dbGINFO = GINFO;
    std::string dbMOTD = MOTD;
    CharacterDatabase.escape_string(dbGINFO);
    CharacterDatabase.escape_string(dbMOTD);

    CharacterDatabase.BeginTransaction();
    // CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid='%u'", Id); - MAX(guildid)+1 not exist
    CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid='%u'", m_Id);
    CharacterDatabase.PExecute("INSERT INTO guild (guildid,name,leaderguid,info,motd,createdate,EmblemStyle,EmblemColor,BorderStyle,BorderColor,BackgroundColor) "
                               "VALUES('%u','%s','%u', '%s', '%s','" UI64FMTD "','%u','%u','%u','%u','%u')",
                               m_Id, gname.c_str(), m_LeaderGuid.GetCounter(), dbGINFO.c_str(), dbMOTD.c_str(), uint64(now), m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor, m_BackgroundColor);
    CharacterDatabase.CommitTransaction();

    CreateDefaultGuildRanks(lSession->GetSessionDbLocaleIndex());

    // Used by Eluna
#ifdef ENABLE_ELUNA
    sEluna->OnCreate(this, leader, gname.c_str());
#endif /* ENABLE_ELUNA */

    return AddMember(m_LeaderGuid, (uint32)GR_GUILDMASTER);
}
コード例 #10
0
ファイル: HUtil.c プロジェクト: deardaniel/PizzaTest
/* PIntRange: parse an integer range and add its members to s */
static void PIntRange(IntSet s)
{
   int i,i1,i2;

   i1 = GetInt(1,s.nMembers);
   SkipSpaces();
   if (ch == '-') {
      ReadCh();
      i2 = GetInt(1,s.nMembers);
   }
   else
      i2=i1;
   for (i=i1; i<=i2; i++)
      AddMember(s,i);
}
コード例 #11
0
ファイル: ArenaTeam.cpp プロジェクト: sk3tche/TrinityCore
bool ArenaTeam::Create(uint32 captainGuid, ArenaType type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
{
    // Check if arena type is valid
    if (!IsArenaTypeValid(type))
        return false;

    // Check if captain is present
    if (!sObjectMgr->GetPlayer(captainGuid))
        return false;

    // Check if arena team name is already taken
    if (sArenaTeamMgr->GetArenaTeamByName(TeamName))
        return false;


    // Generate new arena team id
    TeamId = sArenaTeamMgr->GenerateArenaTeamId();

    // Assign member variables
    CaptainGuid = captainGuid;
    Type = type;
    TeamName = teamName;
    BackgroundColor = backgroundColor;
    EmblemStyle = emblemStyle;
    EmblemColor = emblemColor;
    BorderStyle = borderStyle;
    BorderColor = borderColor;

    // Save arena team to db
    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_ARENA_TEAM);
    stmt->setUInt32(0, TeamId);
    stmt->setString(1, TeamName);
    stmt->setUInt32(2, GUID_LOPART(CaptainGuid));
    stmt->setUInt8(3, Type);
    stmt->setUInt16(4, Stats.Rating);
    stmt->setUInt32(5, BackgroundColor);
    stmt->setUInt8(6, EmblemStyle);
    stmt->setUInt32(7, EmblemColor);
    stmt->setUInt8(8, BorderStyle);
    stmt->setUInt32(9, BorderColor);
    CharacterDatabase.Execute(stmt);

    // Add captain as member
    AddMember(CaptainGuid);

    sLog->outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), GUID_LOPART(CaptainGuid));
    return true;
}
コード例 #12
0
ファイル: JSONValue.cpp プロジェクト: Boshin/Urho3D
JSONValue JSONValue::CreateChild(const String& name, JSONValueType valueType)
{
    assert(IsObject());
    if (!IsObject())
        return JSONValue::EMPTY;

    Value jsonValue;
    if (valueType == JSON_OBJECT)
        jsonValue.SetObject();
    else if (valueType == JSON_ARRAY)
        jsonValue.SetArray();

    AddMember(name, jsonValue);

    return GetChild(name, valueType);
}
コード例 #13
0
ファイル: ArenaTeam.cpp プロジェクト: reon/5.4.1
bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& arenaTeamName,
                       uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor,
                       uint8 borderStyle, uint32 borderColor)
{
    // Check if captain is present
    if (!ObjectAccessor::FindPlayer(captainGuid))
        return false;

    // Check if arena team name is already taken
    if (sArenaTeamMgr->GetArenaTeamByName(arenaTeamName))
        return false;

    // Generate new arena team id
    TeamId = sArenaTeamMgr->GenerateArenaTeamId();

    // Assign member variables
    CaptainGuid = captainGuid;
    Type = type;
    TeamName = arenaTeamName;
    BackgroundColor = backgroundColor;
    EmblemStyle = emblemStyle;
    EmblemColor = emblemColor;
    BorderStyle = borderStyle;
    BorderColor = borderColor;
    uint32 captainLowGuid = GUID_LOPART(captainGuid);

    // Save arena team to db
    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM);
    stmt->setUInt32(0, TeamId);
    stmt->setString(1, TeamName);
    stmt->setUInt32(2, captainLowGuid);
    stmt->setUInt8(3, Type);
    stmt->setUInt16(4, Stats.Rating);
    stmt->setUInt32(5, BackgroundColor);
    stmt->setUInt8(6, EmblemStyle);
    stmt->setUInt32(7, EmblemColor);
    stmt->setUInt8(8, BorderStyle);
    stmt->setUInt32(9, BorderColor);
    CharacterDatabase.Execute(stmt);

    // Add captain as member
    AddMember(CaptainGuid);

    TC_LOG_DEBUG("bg.arena", "New ArenaTeam created [Id: %u, Name: %s] [Type: %u] [Captain low GUID: %u]", GetId(), GetName().c_str(), GetType(), captainLowGuid);
    return true;
}
コード例 #14
0
ファイル: party.cpp プロジェクト: ZeDingo/darkstar
CParty::CParty(CBattleEntity* PEntity)
{
	DSP_DEBUG_BREAK_IF(PEntity == NULL);
	DSP_DEBUG_BREAK_IF(PEntity->PParty != NULL);

    m_PartyID   = PEntity->id;
    m_PartyType = PEntity->objtype == TYPE_PC ? PARTY_PCS : PARTY_MOBS;

    m_PLeader       = NULL;
	m_PAlliance		= NULL;
	m_PSyncTarget 	= NULL;
	m_PQuaterMaster = NULL;


	AddMember(PEntity);
	SetLeader(PEntity);
}
コード例 #15
0
ファイル: party.cpp プロジェクト: DerpStarProject/darkstar
CParty::CParty(CBattleEntity* PEntity)
{
    DSP_DEBUG_BREAK_IF(PEntity == nullptr);
    DSP_DEBUG_BREAK_IF(PEntity->PParty != nullptr);

    m_PartyID = PEntity->id;
    m_PartyType = PEntity->objtype == TYPE_PC ? PARTY_PCS : PARTY_MOBS;
    m_PartyNumber = 0;

    m_PLeader = nullptr;
    m_PAlliance = nullptr;
    m_PSyncTarget = nullptr;
    m_PQuaterMaster = nullptr;

    m_EffectsChanged = false;
    AddMember(PEntity);
    SetLeader((char*)PEntity->name.c_str());
}
コード例 #16
0
ファイル: party.cpp プロジェクト: ERA-Found-It/darkstar
CParty::CParty(CBattleEntity* PEntity, Sql_t* sql)
{
	DSP_DEBUG_BREAK_IF(PEntity == NULL);
	DSP_DEBUG_BREAK_IF(PEntity->PParty != NULL);

    m_PartyID   = PEntity->id;
    m_PartyType = PEntity->objtype == TYPE_PC ? PARTY_PCS : PARTY_MOBS;
    m_PartyNumber = 0;

    m_PLeader       = NULL;
	m_PAlliance		= NULL;
	m_PSyncTarget 	= NULL;
	m_PQuaterMaster = NULL;


	AddMember(PEntity, sql);
	SetLeader((int8*)PEntity->name.c_str());
}
コード例 #17
0
ファイル: AutoCad.cpp プロジェクト: dshawul/StAnD
void CmyDocument::ImportFromAutocad(CString sPath) {
	RPOINTLIST list;
	DXF dxf(sPath);
	dxf.init(true);
	dxf.read_lines(list);
	
	SYSTEM system;
	system.name = "GLOBAL";
	system.rank = LEVEL3;
	JOINT j1,j2;
	POSITION pos = list.GetHeadPosition();
	while(pos) {
		j1.p = list.GetNext(pos);
        j2.p = list.GetNext(pos);
		system.grid[IUX].AddSorted(j1.p.x);
        system.grid[IUY].AddSorted(j1.p.y);
		system.grid[IUZ].AddSorted(j1.p.z);
		system.grid[IUX].AddSorted(j2.p.x);
        system.grid[IUY].AddSorted(j2.p.y);
		system.grid[IUZ].AddSorted(j2.p.z);
		AddMember(&j1,&j2);
	}
	*global = system;
	
	/*views*/
	CmyView* pView;
	pos = GetFirstViewPosition();
	while(pos) {
		pView = (CmyView*) GetNextView(pos);
		pView->force_diagram = INONE;
		if(pView->view != VIEW_3D) {
			GRIDLIST* pgrid = &global->grid[NORMGRID[pView->view]];
			if(!pgrid->IsEmpty()) {
				pView->position = pgrid->GetCount() - 1;
				pView->pvalue = pgrid->GetAt(pgrid->FindIndex(pView->position));
			} 
		}
		pView->InitView();
	}
	UpdateAllViews(NULL);
	
	/*close file*/
	dxf.finish(true);
}
コード例 #18
0
ファイル: std2.c プロジェクト: MattWherry/yorick
void Y_add_member(int nArgs)
{
  Operand op;
  IOStream *file;
  long offset;
  char *structName, *name;
  StructDef *memType, *base;
  Symbol *stack= sp-nArgs+1;
  if (nArgs<5) YError("add_member requires at least five arguments");

  file= YGetFile(stack++);
  structName= YGetString(stack++);
  offset= YGetInteger(stack++);
  name= YGetString(stack++);

  stack->ops->FormOperand(stack, &op);
  if (op.ops==&structDefOps) memType= op.value;
  else if (op.ops==&stringOps && !op.type.dims) {
    char *typeName= ((char **)op.value)[0];
    if (!HashFind(&file->structTable, typeName, 0L))
      YError("5th argument refers to non-existent data type");
    memType= file->structList[hashIndex];
  } else {
    YError("5th argument must be either string or struct definition");
    memType= 0;
  }

  if (HashFind(&file->structTable, structName, 0L))
    base= file->structList[hashIndex];
  else
    base= AddStruct(file, structName, 0L);

  if (!base) YError("unable to create given struct_name in add_member");

  nArgs-= 5;
  stack++;
  BuildDimList(stack, nArgs);

  if (AddMember(base, offset, name, memType, tmpDims))
    YError("add_member failed -- duplicate member name?");

  Drop(nArgs);
}
コード例 #19
0
ファイル: ifcontext.cpp プロジェクト: Bluehorn/wxPython
void spInterFileContext::ParseContents( SourceParserPlugin* pPlugin )
{
    mDeletionMarks.erase( mDeletionMarks.begin(), mDeletionMarks.end() );

    RemoveChildren(); // clean up top-level context

    mParser.SetPlugin( pPlugin );

    for( size_t i = 0; i != m_Files.size(); ++i )
    {
        wxChar* s = (char*)(m_Contents[i].c_str());

        spFile* pFCtx = mParser.Parse( s, s + m_Contents[i].length() );

        pFCtx->m_FileName = m_Files[i];

        AddMember( pFCtx );
    }
}
コード例 #20
0
void
nsXBLContentSink::ConstructProperty(const PRUnichar **aAtts)
{
  const PRUnichar* name     = nsnull;
  const PRUnichar* readonly = nsnull;
  const PRUnichar* onget    = nsnull;
  const PRUnichar* onset    = nsnull;

  nsCOMPtr<nsIAtom> prefix, localName;
  for (; *aAtts; aAtts += 2) {
    PRInt32 nameSpaceID;
    nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix),
                                   getter_AddRefs(localName), &nameSpaceID);

    if (nameSpaceID != kNameSpaceID_None) {
      continue;
    }

    // Is this attribute one of the ones we care about?
    if (localName == nsGkAtoms::name) {
      name = aAtts[1];
    }
    else if (localName == nsGkAtoms::readonly) {
      readonly = aAtts[1];
    }
    else if (localName == nsGkAtoms::onget) {
      onget = aAtts[1];
    }
    else if (localName == nsGkAtoms::onset) {
      onset = aAtts[1];
    }
  }

  if (name) {
    // All of our pointers are now filled in. Construct our property with all of
    // these parameters.
    mProperty = new nsXBLProtoImplProperty(name, onget, onset, readonly);
    if (mProperty) {
      AddMember(mProperty);
    }
  }
}
コード例 #21
0
ファイル: Group.cpp プロジェクト: Aion/caldari
void Group::Create(const uint64 &guid, const char * name)
{
    m_leaderGuid = guid;
    m_leaderName = name;

    m_groupType  = GROUPTYPE_NORMAL;
    m_lootMethod = GROUP_LOOT;

    AddMember(guid, name);

    // store group in database
    sDatabase.BeginTransaction();
    sDatabase.PExecute("DELETE FROM `group` WHERE `leaderGuid`='%u'", GUID_LOPART(m_leaderGuid));
    sDatabase.PExecute("DELETE FROM `group_member` WHERE `leaderGuid`='%u'", GUID_LOPART(m_leaderGuid));
    sDatabase.PExecute("INSERT INTO `group`(`leaderGuid`,`lootMethod`,`looterGuid`,`icon1`,`icon2`,`icon3`,`icon4`,`icon5`,`icon6`,`icon7`,`icon8`,`isRaid`) VALUES('%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u',0)", GUID_LOPART(m_leaderGuid), m_lootMethod, GUID_LOPART(m_looterGuid), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7]);

    for(vector<MemberSlot>::const_iterator citr=m_members.begin(); citr!=m_members.end(); citr++)
        sDatabase.PExecute("INSERT INTO `group_member`(`leaderGuid`,`memberGuid`,`assistant`,`subgroup`) VALUES('%u','%u','%u','%u')", GUID_LOPART(m_leaderGuid), GUID_LOPART(citr->guid), (citr->assistant==1)?1:0, citr->group);
    sDatabase.CommitTransaction();
}
コード例 #22
0
QtPropertyDataIntrospection::QtPropertyDataIntrospection(void *_object, const DAVA::InspInfo *_info, int hasAllFlags)
	: object(_object)
	, info(_info)
{
	CreateCustomButtonsForRenderObject();

	while(NULL != _info && NULL != object)
	{
		for(DAVA::int32 i = 0; i < _info->MembersCount(); ++i)
		{
			const DAVA::InspMember *member = _info->Member(i);
			if(NULL != member && (member->Flags() & hasAllFlags) == hasAllFlags)
			{
                AddMember(member, hasAllFlags);
			}
		}

		_info = _info->BaseInfo();
	}

	SetFlags(FLAG_IS_DISABLED);
}
コード例 #23
0
ファイル: ArenaTeam.cpp プロジェクト: gladden/mangos
bool ArenaTeam::create(uint64 captainGuid, uint32 type, std::string ArenaTeamName)
{
    if(!objmgr.GetPlayer(captainGuid))                      // player not exist
        return false;
    if(objmgr.GetArenaTeamByName(ArenaTeamName))            // arena team with this name already exist
        return false;

    sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(CaptainGuid));

    CaptainGuid = captainGuid;
    Name = ArenaTeamName;
    Type = type;

    QueryResult *result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team");
    if( result )
    {
        Id = (*result)[0].GetUInt32()+1;
        delete result;
    }
    else Id = 1;

    // ArenaTeamName already assigned to ArenaTeam::name, use it to encode string for DB
    CharacterDatabase.escape_string(ArenaTeamName);

    CharacterDatabase.BeginTransaction();
    // CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid='%u'", Id); - MAX(arenateam)+1 not exist
    CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid='%u'", Id);
    CharacterDatabase.PExecute("INSERT INTO arena_team (arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor) "
        "VALUES('%u','%s','%u','%u','%u','%u','%u','%u','%u')",
        Id, ArenaTeamName.c_str(), GUID_LOPART(CaptainGuid), Type, BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor);
    CharacterDatabase.PExecute("INSERT INTO arena_team_stats (arenateamid, rating, games, wins, played, wins2, rank) VALUES "
        "('%u', '%u', '%u', '%u', '%u', '%u', '%u')", Id,stats.rating,stats.games,stats.wins,stats.played,stats.wins2,stats.rank);

    CharacterDatabase.CommitTransaction();

    AddMember(CaptainGuid);
    return true;
}
コード例 #24
0
ファイル: Guild.cpp プロジェクト: zeroR2/mangos
bool Guild::Create(Player* leader, std::string gname)
{
    if (sGuildMgr.GetGuildByName(gname))
        return false;

    WorldSession* lSession = leader->GetSession();
    if (!lSession)
        return false;

    m_LeaderGuid = leader->GetObjectGuid();
    m_Name = gname;
    GINFO = "";
    MOTD = "No message set.";
    m_Id = sObjectMgr.GenerateGuildId();
    m_CreatedDate = time(0);

    DEBUG_LOG("GUILD: creating guild %s to leader: %s", gname.c_str(), m_LeaderGuid.GetString().c_str());

    // gname already assigned to Guild::name, use it to encode string for DB
    CharacterDatabase.escape_string(gname);

    std::string dbGINFO = GINFO;
    std::string dbMOTD = MOTD;
    CharacterDatabase.escape_string(dbGINFO);
    CharacterDatabase.escape_string(dbMOTD);

    CharacterDatabase.BeginTransaction();
    // CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid='%u'", Id); - MAX(guildid)+1 not exist
    CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid='%u'", m_Id);
    CharacterDatabase.PExecute("INSERT INTO guild (guildid,name,leaderguid,info,motd,createdate,EmblemStyle,EmblemColor,BorderStyle,BorderColor,BackgroundColor) "
                               "VALUES('%u','%s','%u', '%s', '%s','" UI64FMTD "','%u','%u','%u','%u','%u')",
                               m_Id, gname.c_str(), m_LeaderGuid.GetCounter(), dbGINFO.c_str(), dbMOTD.c_str(), uint64(m_CreatedDate), m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor, m_BackgroundColor);
    CharacterDatabase.CommitTransaction();

    CreateDefaultGuildRanks(lSession->GetSessionDbLocaleIndex());

    return AddMember(m_LeaderGuid, (uint32)GR_GUILDMASTER);
}
コード例 #25
0
ファイル: page.cpp プロジェクト: JIM-DB/Server
        std::shared_ptr<rapidjson::Document> Page::getJSONObject(long long headerpos)
        {
            //reading the Page
            tasking::RWLockGuard<> lock(m_rwLock, tasking::READ);
            //get the header first
            auto l_header = reinterpret_cast<HeaderMetaData*>(static_cast<char*>(m_header) + headerpos);
            //get the type
            auto l_objectType = l_header->getObjektType();

            //get the idx
            auto& l_metaIdx = meta::MetaIndex::getInstance();
            //get the meta dataset
            auto& l_meta = l_metaIdx[l_objectType];

            //create the document
            auto l_obj = std::make_shared<rapidjson::Document>();
            l_obj->SetObject();

            //now generate the inner part of the object
            rapidjson::Value l_value;
            l_value.SetObject();
            //calc the start id
            void* start = (static_cast<char*>(m_body) + l_header->getPos());
            auto temp = buildObject(l_objectType, start, l_value, l_obj->GetAllocator());
            if(temp == nullptr)
            {
                LOG_WARN << "build failed id: " << l_header->getOID();
                return nullptr;
            }
            //generate name
            auto l_objName = l_meta->getName();
            rapidjson::Value l_name(l_objName.c_str(), l_objName.length(), l_obj->GetAllocator());
            //now add the inner object
            l_obj->AddMember(l_name, l_value, l_obj->GetAllocator());

            return l_obj;
        }
コード例 #26
0
ファイル: ArenaTeam.cpp プロジェクト: Blumfield/TBCPvP
bool ArenaTeam::Create(uint64 captainGuid, uint32 type, std::string arenaTeamName, bool skipChecks)
{
    if (!skipChecks)
    {
        if (!sObjectMgr->GetPlayer(captainGuid))                      // player not exist
            return false;
        if (sObjectMgr->GetArenaTeamByName(arenaTeamName))            // arena team with this name already exist
            return false;
    }

    sLog->outDebug("GUILD: creating arena team %s to leader: %u", arenaTeamName.c_str(), GUID_LOPART(captainGuid));

    m_CaptainGuid = captainGuid;
    m_Name = arenaTeamName;
    m_Type = type;

    m_TeamId = sObjectMgr->GenerateArenaTeamId();

    // ArenaTeamName already assigned to ArenaTeam::name, use it to encode string for DB
    CharacterDatabase.EscapeString(arenaTeamName);

    CharacterDatabase.BeginTransaction();
    // CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid='%u'", m_TeamId); - MAX(arenateam)+1 not exist
    CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid='%u'", m_TeamId);
    CharacterDatabase.PExecute("INSERT INTO arena_team (arenateamid, name, captainguid, type, BackgroundColor, EmblemStyle, EmblemColor, BorderStyle, BorderColor) "
        "VALUES('%u', '%s', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')",
        m_TeamId, arenaTeamName.c_str(), GUID_LOPART(m_CaptainGuid), m_Type, m_BackgroundColor, m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor);
    CharacterDatabase.PExecute("INSERT INTO arena_team_stats (arenateamid, rating, games, wins, played, wins2, rank) VALUES "
        "('%u', '%u', '%u', '%u', '%u', '%u', '%u')", m_TeamId, m_stats.rating, m_stats.games_week, m_stats.wins_week, m_stats.games_season, m_stats.wins_season, m_stats.rank);

    CharacterDatabase.CommitTransaction();

    AddMember(m_CaptainGuid);
    sLog->outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain GUID: %u]", GetId(), GetType(), GetCaptain());
    return true;
}
コード例 #27
0
ファイル: Alliance.cpp プロジェクト: Bastid/spitfire
void Alliance::ParseMembers(char * str)
{
	if (str && strlen(str) > 0)
	{
		uint32_t clientid;
		uint8_t rank;

		char * ch = 0, * cr = 0;
		char * tok;
		tok = strtok_s(str, "|", &ch);
		do
		{
			tok = strtok_s(tok, ",", &cr);
			if (tok != 0)
				clientid = atoi(tok);
			tok = strtok_s(0, ",", &cr);
			if (tok != 0)
				rank = atoi(tok);

			AddMember(clientid, rank);
			tok = strtok_s(0, "|", &ch);
		} while (tok != 0);
	}
}
コード例 #28
0
ファイル: Group.cpp プロジェクト: vata/wowice
void Group::LoadFromDB(Field *fields)
{
#define LOAD_ASSISTANT(__i, __d) g = fields[__i].GetUInt32(); if(g != 0) { __d = objmgr.GetPlayerInfo(g); }

	uint32 g;
	m_updateblock = true;
	m_Id = fields[0].GetUInt32();

	ObjectMgr::getSingleton().AddGroup( this );

	m_GroupType = fields[1].GetUInt8();
	m_SubGroupCount = fields[2].GetUInt8();
	m_LootMethod = fields[3].GetUInt8();
	m_LootThreshold = fields[4].GetUInt8();
	m_difficulty = fields[5].GetUInt8();
	m_raiddifficulty = fields[6].GetUInt8();

	LOAD_ASSISTANT(6, m_assistantLeader);
	LOAD_ASSISTANT(7, m_mainTank);
	LOAD_ASSISTANT(8, m_mainAssist);

	// create groups
	for( uint8 i = 1; i < m_SubGroupCount; ++i )
		m_SubGroups[i] = new SubGroup(this, i);

	// assign players into groups
	for( uint8 i = 0; i < m_SubGroupCount; ++i )
	{
		for( uint8 j = 0; j < 5; ++j)
		{
			uint32 guid = fields[9 + (i*5) + j].GetUInt32();
			if( guid == 0 )
				continue;

			PlayerInfo * inf = objmgr.GetPlayerInfo( guid );
			if( inf == NULL )
				continue;

			AddMember( inf );
		}
	}
	
	char *ids = strdup(fields[50].GetString());
	char *q = ids;
	char *p = strchr(q, ' ');
	while(p)
	{
		char *r = strchr(q, ':');
		if(r == NULL || r > p)
			continue;
		*p = 0;
		*r = 0;
		char *s = strchr(r+1, ':');
		if(s == NULL || s > p)
			continue;
		*s = 0;
		uint32 mapId = atoi(q);
		uint32 mode = atoi(r+1);
		uint32 instanceId = atoi(s+1);

		if(mapId >= NUM_MAPS)
			continue;

		m_instanceIds[mapId][mode] = instanceId;

		q = p+1;
		p = strchr(q, ' ');
	}
	free(ids);

	m_updateblock = false;
}
コード例 #29
0
ファイル: serial.cpp プロジェクト: swuecho/igblast
CMemberInfo* AddMember(CClassTypeInfoBase* info, const char* name,
                       const void* member,
                       TTypeInfoGetter f)
{
    return AddMember(info, name, member, CTypeRef(f));
}
コード例 #30
0
ファイル: HUtil.c プロジェクト: deardaniel/PizzaTest
/* PStatecomp: parse a statecomp */
static void PStatecomp(ILink models, ILink *ilist, char *type,
                       IntSet states, HMMSet *hset)
{
   HMMDef *hmm;
   ILink h;
   int s,j;
   IntSet streams;
   Keyword kw;

   switch(kw=GetKey()) {
   case MIX_KEY:
   case STREAM_KEY:
      if (hset->hsKind==TIEDHS || hset->hsKind==DISCRETEHS)
         HError(7231,"PStatecomp: Cannot specify streams or mixes unless continuous");
      streams = CreateSet(SMAX);
      if(kw==STREAM_KEY) {
         PIndex(streams);
         SkipSpaces();
         if (ch != '.')
            EdError(". expected after stream spec");
         ReadCh();
         if (GetKey() != MIX_KEY)
            EdError("Mix expected after Stream index");
      } else
         AddMember(streams,1);
      SkipSpaces();
      if (ch=='[')
         PMix(models,ilist,type,states,streams,hset);
      else {
         ChkType('p',type);
         for (h=models; h!=NULL; h=h->next) {
            hmm = h->owner;
            for (j=2; j<hmm->numStates; j++)
               if (IsMember(states,j))
                  for (s=1; s<=hset->swidth[0];s++)
                     if (IsMember(streams,s)) { /* tie -> spdf */
                        if (trace & T_ITM)
                           printf(" %12s.state[%d].stream[%d]\n",
                                  HMMPhysName(hset,hmm),j,s);
                        AddItem(hmm,hmm->svec[j].info->pdf+s,ilist);
                     }
         }
      }
      FreeSet(streams);
      break;
   case DUR_KEY:
      ChkType('d',type);
      for (h=models; h!=NULL; h=h->next) {
         hmm = h->owner;
         for (j=2; j<hmm->numStates; j++)
            if (IsMember(states,j)) {  /* tie ->dur */
               if (trace & T_ITM)
                  printf(" %12s.state[%d].dur\n",
                         HMMPhysName(hset,hmm),j);
               AddItem(hmm,hmm->svec[j].info,ilist);
            }
      }
      break;
   case WEIGHTS_KEY:
      ChkType('w',type);
      for (h=models; h!=NULL; h=h->next) {
         hmm = h->owner;
         for (j=2; j<hmm->numStates; j++)
            if (IsMember(states,j)) { /* tie ->stream weights */
               if (trace & T_ITM)
                  printf(" %12s.state[%d].weights\n",
                         HMMPhysName(hset,hmm),j);
               AddItem(hmm,hmm->svec[j].info,ilist);
            }
      }
      break;
   default:
      EdError("dur, weight, stream or mix expected");
   }
}